refactor: 重命名 callback
This commit is contained in:
parent
2a1852188e
commit
a6cc98a32b
@ -11,10 +11,10 @@ import (
|
|||||||
"onvif-agent/response"
|
"onvif-agent/response"
|
||||||
)
|
)
|
||||||
|
|
||||||
func CreateEventSubscription(c *gin.Context) {
|
func CreateSubscription(c *gin.Context) {
|
||||||
xaddr := c.Param("xaddr")
|
xaddr := c.Param("xaddr")
|
||||||
callbackURL := event.AttributedURIType(fmt.Sprintf("%s/onvif/subscriptions/%s/callback", config.Config.App.URL, xaddr))
|
callbackURL := event.AttributedURIType(fmt.Sprintf("%s/onvif/subscriptions/%s/callback", config.Config.App.URL, xaddr))
|
||||||
log.Printf("CreateEventSubscription callback URL: %s", callbackURL)
|
log.Printf("CreateSubscription callback URL: %s", callbackURL)
|
||||||
|
|
||||||
conn := Conns[xaddr]
|
conn := Conns[xaddr]
|
||||||
if conn == nil {
|
if conn == nil {
|
||||||
@ -31,9 +31,9 @@ func CreateEventSubscription(c *gin.Context) {
|
|||||||
response.NewResponse().Success().WithData(result).Send(c)
|
response.NewResponse().Success().WithData(result).Send(c)
|
||||||
}
|
}
|
||||||
|
|
||||||
func EventNotifyCallback(c *gin.Context) {
|
func NotifyCallback(c *gin.Context) {
|
||||||
xaddr := c.Param("xaddr")
|
xaddr := c.Param("xaddr")
|
||||||
log.Printf("EventNotifyCallback from: %s", xaddr)
|
log.Printf("NotifyCallback from: %s", xaddr)
|
||||||
|
|
||||||
var notify event.Notify
|
var notify event.Notify
|
||||||
envelope := gosoap.NewSOAPEnvelope(¬ify)
|
envelope := gosoap.NewSOAPEnvelope(¬ify)
|
||||||
|
@ -22,8 +22,8 @@ func SetupRoutes(r *gin.Engine) {
|
|||||||
|
|
||||||
subscriptionGroup := onvifGroup.Group("/subscriptions")
|
subscriptionGroup := onvifGroup.Group("/subscriptions")
|
||||||
{
|
{
|
||||||
subscriptionGroup.POST("/:xaddr", onvif.CreateEventSubscription)
|
subscriptionGroup.POST("/:xaddr", onvif.CreateSubscription)
|
||||||
subscriptionGroup.POST("/:xaddr/callback", onvif.EventNotifyCallback)
|
subscriptionGroup.POST("/:xaddr/callback", onvif.NotifyCallback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user