Methods
createPullPointSubscription(filteropt, initialTerminationTimeopt, subscriptionPolicyopt, callbackopt)
Event Type: Pull Event
This method returns a PullPointSubscription that can be polled using PullMessages. This message contains the same elements as the SubscriptionRequest of the WS-BaseNotification without the ConsumerReference.
If no Filter is specified the pullpoint notifies all occurring events to the client.
This method is mandatory.
This method returns a PullPointSubscription that can be polled using PullMessages. This message contains the same elements as the SubscriptionRequest of the WS-BaseNotification without the ConsumerReference.
If no Filter is specified the pullpoint notifies all occurring events to the client.
This method is mandatory.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
filter |
string |
<optional> |
Optional XPATH expression to select specific topics. |
initialTerminationTime |
integer |
<optional> |
Optional Initial termination time (in milliseconds) |
subscriptionPolicy |
xml |
<optional> |
Optional Refer to Web Services Base Notification 1.3 (WS-BaseNotification). |
callback |
callback |
<optional> |
Optional callback, instead of a Promise. |
- Source:
createRequest(body, subscriptionIdopt)
Private function for creating a SOAP request.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
body |
string | The body of the xml. | |
subscriptionId |
object |
<optional> |
Used internally. |
- Source:
getEventProperties(callbackopt)
Event Type: Agnostic
The WS-BaseNotification specification defines a set of OPTIONAL WS-ResouceProperties. This specification does not require the implementation of the WS-ResourceProperty interface. Instead, the subsequent direct interface shall be implemented by an ONVIF compliant device in order to provide information about the FilterDialects, Schema files and topics supported by the device.
The WS-BaseNotification specification defines a set of OPTIONAL WS-ResouceProperties. This specification does not require the implementation of the WS-ResourceProperty interface. Instead, the subsequent direct interface shall be implemented by an ONVIF compliant device in order to provide information about the FilterDialects, Schema files and topics supported by the device.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
callback |
<optional> |
Optional callback, instead of a Promise. |
- Source:
getServiceCapabilities(callbackopt)
Event Type: Agnostic
Returns the capabilities of the event service. The result is returned in a typed answer.
Returns the capabilities of the event service. The result is returned in a typed answer.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
callback |
<optional> |
Optional callback, instead of a Promise. |
- Source:
init(timeDiff, serviceAddress, usernameopt, passwordopt)
Call this function directly after instantiating an Events object.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
timeDiff |
number | The onvif device's time difference. | |
serviceAddress |
object | An url object from url package - require('url'). | |
username |
string |
<optional> |
Optional only if the device does NOT have a user. |
password |
string |
<optional> |
Optional only if the device does NOT have a password. |
- Source:
pullMessages(subscriptionId, timeout, messageLimit, callbackopt)
Event Type: Pull Event
This method pulls one or more messages from a PullPoint. The device shall provide the following PullMessages command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command. This method shall not wait until the requested number of messages is available but return as soon as at least one message is available.
The command shall at least support a Timeout of one minute. In case a device supports retrieval of less messages than requested it shall return these without generating a fault.
This method pulls one or more messages from a PullPoint. The device shall provide the following PullMessages command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command. This method shall not wait until the requested number of messages is available but return as soon as at least one message is available.
The command shall at least support a Timeout of one minute. In case a device supports retrieval of less messages than requested it shall return these without generating a fault.
Parameters:
Name | Type | Attributes | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
subscriptionId |
object | An object after createPullPointSubscription is called.
Properties
|
||||||||||||||||
timeout |
integer | [msec] Maximum time to block until this method returns. | ||||||||||||||||
messageLimit |
integer | Upper limit for the number of messages to return at once. A server implementation may decide to return less messages. | ||||||||||||||||
callback |
callback |
<optional> |
Optional callback, instead of a Promise. |
- Source:
renew(callbackopt)
Event Type: Agnostic
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
callback |
<optional> |
Optional callback, instead of a Promise. |
- Source:
seek(utcTime, reverseopt, callbackopt)
Not implemented
Event Type: Pull Event
This method readjusts the pull pointer into the past. A device supporting persistent notification storage shall provide the following Seek command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command. The optional Reverse argument can be used to reverse the pull direction of the PullMessages command.
The UtcTime argument will be matched against the UtcTime attribute on a NotificationMessage.
This method readjusts the pull pointer into the past. A device supporting persistent notification storage shall provide the following Seek command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command. The optional Reverse argument can be used to reverse the pull direction of the PullMessages command.
The UtcTime argument will be matched against the UtcTime attribute on a NotificationMessage.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
utcTime |
string | The date and time to match against stored messages. | |
reverse |
boolean |
<optional> |
Reverse the pull direction of PullMessages. |
callback |
callback |
<optional> |
Optional callback, instead of a Promise. |
- Source:
setSynchronizationPoint(callbackopt)
Event Type: Agnostic
Properties inform a client about property creation, changes and deletion in a uniform way. When a client wants to synchronize its properties with the properties of the device, it can request a synchronization point which repeats the current status of all properties to which a client has subscribed. The PropertyOperation of all produced notifications is set to “Initialized”. The Synchronization Point is requested directly from the SubscriptionManager which was returned in either the SubscriptionResponse or in the CreatePullPointSubscriptionResponse. The property update is transmitted via the notification transportation of the notification interface. This method is mandatory.
Properties inform a client about property creation, changes and deletion in a uniform way. When a client wants to synchronize its properties with the properties of the device, it can request a synchronization point which repeats the current status of all properties to which a client has subscribed. The PropertyOperation of all produced notifications is set to “Initialized”. The Synchronization Point is requested directly from the SubscriptionManager which was returned in either the SubscriptionResponse or in the CreatePullPointSubscriptionResponse. The property update is transmitted via the notification transportation of the notification interface. This method is mandatory.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
callback |
<optional> |
Optional callback, instead of a Promise. |
- Source:
startPull(loopTimeMSopt, timeoutopt, messageLimitopt)
Start a PullMessages event loop
This method does a createPullPointSubscription followed by a pullMessages. The resulting xml from the camera is then sent via an emit('messages', data). On error, emit('messages:error', error)
This method does a createPullPointSubscription followed by a pullMessages. The resulting xml from the camera is then sent via an emit('messages', data). On error, emit('messages:error', error)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
loopTimeMS |
integer |
<optional> |
The amount of time between polls (in milliseconds; default 10000). |
timeout |
string |
<optional> |
The timeout to send to the server (using PT interval format - ex: PT1S is one second; default 'PT1M'). |
messageLimit |
integer |
<optional> |
The message limit to retrive (default 1) |
- Source:
Example
camera.events.on('messages', messages => {
console.log('Messages Received:', messages)
})
camera.events.on('messages:error', error => {
console.error('Messages Error:', error)
})
camera.events.startPull()
stopPull()
Stops a PullMessages event loop that has been started with start().
- Source:
subscribe(callbackopt)
Event Type: Push Event
The device shall provide the following Unsubscribe command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command.
This command shall terminate the lifetime of a pull point.
The device shall provide the following Unsubscribe command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command.
This command shall terminate the lifetime of a pull point.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
callback |
<optional> |
Optional callback, instead of a Promise. |
- Source:
unsubscribe(callbackopt)
Event Type: Agnostic
The device shall provide the following Unsubscribe command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command.
This command shall terminate the lifetime of a pull point.
The device shall provide the following Unsubscribe command for all SubscriptionManager endpoints returned by the CreatePullPointSubscription command.
This command shall terminate the lifetime of a pull point.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
callback |
callback |
<optional> |
Optional callback, instead of a Promise. |
- Source: