refactor(router): 改为结构化 web 项目

This commit is contained in:
2024-08-22 10:18:23 +08:00
parent 7047d896f8
commit 9ba49e0742
10 changed files with 214 additions and 225 deletions

34
service/onvif/event.go Normal file
View File

@ -0,0 +1,34 @@
package onvif
import (
"github.com/IOTechSystems/onvif/event"
"github.com/IOTechSystems/onvif/xsd"
)
func (c *Connection) SubscribeEvents(
consumerAddress event.AttributedURIType,
terminationTime xsd.String, // PT60S
) (*event.SubscribeResponse, error) {
resp, err := c.Device.CallMethod(event.Subscribe{
ConsumerReference: &event.EndpointReferenceType{
Address: consumerAddress,
},
Filter: &event.FilterType{
TopicExpression: &event.TopicExpressionType{
TopicKinds: "tns1:VideoSource//.",
},
},
TerminationTime: &terminationTime,
})
if err != nil {
return nil, err
}
result := &event.SubscribeResponse{}
err = unmarshalResponse(resp, result)
if err != nil {
return nil, err
}
return result, nil
}