554325746@qq.com
2019-07-22 5a0e125d6b05c42cf26d3e341249be7a2fd80d6d
camera/camera.go
@@ -14,6 +14,8 @@
   "fmt"
   "sync"
   // "time"
    "os"
)
var SocketManage sync.Map
@@ -52,6 +54,7 @@
            fmt.Println("create socket error")
                return 
         }
          go Recv(socketlisten, remote)
      }
}
@@ -79,6 +82,8 @@
      for key, op := range cameraChanDel {
         if op == "add" {
               CreateCamera(key, "camera") 
               fmt.Println("add new camera id=========================")
               os.Exit(1)
         } else {
            if sock, ok := SocketManage.Load(key); ok {
               if socket, sok := sock.(SocketContext); sok {
@@ -140,6 +145,7 @@
         //   fmt.Println(imagemsg.Cid)
            switch remote {
               case "camera":
                    fmt.Printf("=== cid: has %d task\n", len(GetAlltask(imagemsg.Cid)))
                    for _, taskid := range GetAlltask(imagemsg.Cid) {
                       //  time.Sleep(5 * time.Second)
                        fmt.Println("id: ", imagemsg.Cid, " taskid: ", taskid)
@@ -169,6 +175,7 @@
func Taskdolist(cid string, caddr string,  taskid string, data []byte) {
   //  数据加工(打标签)
    fmt.Printf("taskid %s: has %d data[]byte\n", taskid, len(data))
   sdkmsg := sdk.SdkData(cid, caddr, taskid, data)
   if sdkmsg.Tasklab == nil {
      fmt.Printf("cid:%s 没有任务%s\n", cid, taskid)