35 lines
738 B
Go
35 lines
738 B
Go
package onvif
|
|
|
|
import (
|
|
"github.com/IOTechSystems/onvif/event"
|
|
"github.com/IOTechSystems/onvif/xsd"
|
|
)
|
|
|
|
func (c *Session) EventSubscribe(
|
|
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
|
|
}
|