panlei
2019-11-13 1d9804998f955e7d713d24ae719c757c0be73993
ruleserver/ruleToformula.go
@@ -77,7 +77,7 @@
   }
}
func CallMiddleware(args *structure.SdkDatas,rule protomsg.GroupRule,lable *structure.Others,message *protomsg.SdkMessage) (bool, []*structure.Arg, string, string){
func CallMiddleware(args *structure.SdkDatas,rule protomsg.GroupRule,lable *structure.Others,message *protomsg.SdkMessage) (bool, string, string){
   p,err :=  plugin.Open("./algorithm/middleware.so")
   if err != nil {
      panic(err)
@@ -86,8 +86,8 @@
   if err1 != nil {
      panic("没有找到中间件入口函数")
   }
   a,b,c,d := f.(func(args *structure.SdkDatas,rule protomsg.GroupRule,label *structure.Others,message *protomsg.SdkMessage)(bool,[]*structure.Arg, string, string))(args,rule,lable,message)
   return a,b,c,d
   a,b,c := f.(func(args *structure.SdkDatas,rule protomsg.GroupRule,label *structure.Others,message *protomsg.SdkMessage)(bool,string, string))(args,rule,lable,message)
   return a,b,c
}
func RunRule(args *structure.SdkDatas, groupRule *protomsg.GroupRule, taskId string, message *protomsg.SdkMessage, label structure.Others) (bool,[]int) {
@@ -104,8 +104,16 @@
   polygonId := ""
   targets := []*structure.Arg{} // 符合条件的目标
   // 把一帧数据和一组规则发给算法部分,得出判断结果
   result,targets,sdkNames,polygonId = CallMiddleware(args,*groupRule,&label,message)
   logger.Info("符合条件的目标数据:",targets)
   result,sdkNames,polygonId = CallMiddleware(args,*groupRule,&label,message)
   for _, sdkData := range args.Sdkdata {
      for _, areaMap := range sdkData.AreaMapList {
         targets = append(targets,areaMap.AlarmObj...)
         for _,obj := range areaMap.AlarmObj {
            logger.Info("个体静止的目标",obj.Id,obj.Location)
         }
      }
   }
   //logger.Info("符合条件的目标数据:",targets)
   if result {
      // 最后过持续时间等时间维度的条件   把时间规则位置调整到这个位置是为了缓存数据         !!!!!ps: 对画面中单个目标做定时器的不用再过画面定时器
      cacheId := ""