| | |
| | | |
| | | |
| | | func Init(initChan chan bool,dbIp string,surveyPort int,pubSubPort int){ |
| | | urlSurvey := dbIp + strconv.Itoa(surveyPort) |
| | | urlPubSub := dbIp + strconv.Itoa(pubSubPort) |
| | | urlSurvey := "tcp://" + dbIp + strconv.Itoa(surveyPort) |
| | | urlPubSub := "tcp://" + dbIp + strconv.Itoa(pubSubPort) |
| | | client, _ := gopherdiscovery.ClientWithSub(urlSurvey, urlPubSub, uuid.NewV4().String()) |
| | | recvMsg := client.HeartBeatMsg() |
| | | fmt.Println(<-recvMsg) |
| | |
| | | var api dbapi.CameraApi |
| | | data := api.FindAllPolygons() |
| | | for _, item := range data { |
| | | cameraId :=item.CameraId |
| | | arr, b := cMap.Get(PREFIX_POLYGON + cameraId) |
| | | if b { |
| | | list := arr.([]protomsg.CameraPolygon) |
| | | list = append(list,item) |
| | | cMap.Set(PREFIX_POLYGON + cameraId,list) |
| | | } else { |
| | | cMap.Set(PREFIX_POLYGON + cameraId,[]protomsg.CameraPolygon{ item }) |
| | | if item.Type != "line" { |
| | | cameraId :=item.CameraId |
| | | arr, b := cMap.Get(PREFIX_POLYGON + cameraId) |
| | | if b { |
| | | list := arr.([]protomsg.CameraPolygon) |
| | | list = append(list,item) |
| | | cMap.Set(PREFIX_POLYGON + cameraId,list) |
| | | } else { |
| | | cMap.Set(PREFIX_POLYGON + cameraId,[]protomsg.CameraPolygon{ item }) |
| | | } |
| | | } |
| | | } |
| | | } |