|
@@ -39,13 +39,13 @@ func (s *CameraServer) RegisterCallback(branch byte, notifier Notifier) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-func (s *CameraServer) Callback(ip string) {
|
|
|
|
|
|
+func (s *CameraServer) Callback(ip, id string) {
|
|
notifier, ok := s.Notifiers[ip]
|
|
notifier, ok := s.Notifiers[ip]
|
|
if !ok {
|
|
if !ok {
|
|
logrus.Errorf("回调函数注册表没有该ip:%s", ip)
|
|
logrus.Errorf("回调函数注册表没有该ip:%s", ip)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- notifier.Notify()
|
|
|
|
|
|
+ notifier.Notify(id)
|
|
logrus.Debugf("camera [%s] Callback", ip)
|
|
logrus.Debugf("camera [%s] Callback", ip)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -69,7 +69,9 @@ func (s *CameraServer) Handler(w http.ResponseWriter, r *http.Request) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
//发送事件通知
|
|
//发送事件通知
|
|
- s.Callback(event.IpAddress)
|
|
|
|
|
|
+ for _, v := range event.DetectionRegionList.DetectionRegionEntry {
|
|
|
|
+ s.Callback(event.IpAddress, v.RegionID)
|
|
|
|
+ }
|
|
} else if strings.Contains(contentType, "multipart/form-data") {
|
|
} else if strings.Contains(contentType, "multipart/form-data") {
|
|
s.HandleMultipart(r)
|
|
s.HandleMultipart(r)
|
|
}
|
|
}
|
|
@@ -101,5 +103,5 @@ func (s *CameraServer) HandleMultipart(r *http.Request) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//发送事件通知
|
|
//发送事件通知
|
|
- s.Callback(event.IpAddress)
|
|
|
|
|
|
+ s.Callback(event.IpAddress, "")
|
|
}
|
|
}
|