refactor: 迁移 service 代码逻辑

This commit is contained in:
2024-08-26 14:50:46 +08:00
parent de3667f957
commit 219116c961
5 changed files with 37 additions and 27 deletions

View File

@ -0,0 +1,28 @@
package onvif
import (
"github.com/IOTechSystems/onvif/event"
"github.com/IOTechSystems/onvif/gosoap"
"github.com/gin-gonic/gin"
"log"
"net/http"
"onvif-agent/response"
)
func NotifyCallback(c *gin.Context) {
//xaddr := c.Param("xaddr")
var notify event.Notify
envelope := gosoap.NewSOAPEnvelope(&notify)
if err := c.ShouldBindXML(&envelope); err != nil {
response.NewResponse().Error(err).WithCode(http.StatusBadRequest).Send(c)
return
}
// TODO: handle notifications
for _, msg := range envelope.Body.Content.(*event.Notify).NotificationMessage {
log.Printf("Topic: %s, Message: %s", msg.Topic.TopicKinds, msg.Message.Message)
}
response.NewResponse().Success().Send(c)
}