refactor(router): 改为结构化 web 项目
This commit is contained in:
34
service/onvif/event.go
Normal file
34
service/onvif/event.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user