Items to manage events with GENA the General Event Notification Architecture. More...
PUPNP_Api int | UpnpAcceptSubscription (UpnpDevice_Handle Hnd, const char *DevID_const, const char *ServName_const, const char **VarName_const, const char **NewVal_const, int cVariables, const Upnp_SID SubsId) |
Accepts a subscription request and sends out the current state of the eventable variables for a service. | |
PUPNP_Api int | UpnpAcceptSubscriptionExt (UpnpDevice_Handle Hnd, const char *DevID_const, const char *ServName_const, IXML_Document *PropSet, const Upnp_SID SubsId) |
Similar to UpnpAcceptSubscription() except that it takes a DOM document for the variables to event rather than an array of strings. | |
PUPNP_Api int | UpnpNotify (UpnpDevice_Handle Hnd, const char *DevID_const, const char *ServName_const, const char **VarName_const, const char **NewVal_const, int cVariables) |
Sends out an event change notification to all control points subscribed to a particular service. | |
PUPNP_Api int | UpnpNotifyExt (UpnpDevice_Handle Hnd, const char *DevID_const, const char *ServName_const, IXML_Document *PropSet) |
Similar to UpnpNotify() except that it takes a DOM document for the event rather than an array of strings. | |
PUPNP_Api int | UpnpRenewSubscription (UpnpClient_Handle Hnd, int *TimeOut, const Upnp_SID SubsId) |
Renews a subscription that is about to expire. | |
PUPNP_Api int | UpnpRenewSubscriptionAsync (UpnpClient_Handle Hnd, int TimeOut, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie_const) |
Renews a subscription that is about to expire, generating a callback when the operation is complete. | |
PUPNP_Api int | UpnpSetMaxSubscriptions (UpnpDevice_Handle Hnd, int MaxSubscriptions) |
Sets the maximum number of subscriptions accepted per service. | |
PUPNP_Api int | UpnpSetMaxSubscriptionTimeOut (UpnpDevice_Handle Hnd, int MaxSubscriptionTimeOut) |
Sets the maximum time-out accepted for a subscription request or renewal. | |
PUPNP_Api int | UpnpSubscribe (UpnpClient_Handle Hnd, const char *EvtUrl_const, int *TimeOut, Upnp_SID SubsId) |
Registers a control point to receive event notifications from a UPnP device. | |
PUPNP_Api int | UpnpSubscribeAsync (UpnpClient_Handle Hnd, const char *EvtUrl_const, int TimeOut, Upnp_FunPtr Fun, const void *Cookie_const) |
Performs the same operation as UpnpSubscribe(), but returns immediately and calls the registered callback function when the operation is complete. | |
PUPNP_Api int | UpnpUnSubscribe (UpnpClient_Handle Hnd, const Upnp_SID SubsId) |
Removes the subscription of a control point from a service previously subscribed to using UpnpSubscribe() or UpnpSubscribeAsync(). | |
PUPNP_Api int | UpnpUnSubscribeAsync (UpnpClient_Handle Hnd, Upnp_SID SubsId, Upnp_FunPtr Fun, const void *Cookie_const) |
Removes a subscription of a control point from a service previously subscribed to using UpnpSubscribe() or UpnpSubscribeAsync(), generating a callback when the operation is complete. | |
Items to manage events with GENA the General Event Notification Architecture.
Eventing is Step 4 in UPnP networking. Eventing comes after addressing (Step 0) where devices get a network address, after discovery (Step 1) where control points find interesting device(s), and after description (Step 2) where control points learn about device capabilities. Eventing is intimately linked with control (Step 3) where control points send actions to devices. Through eventing, control points listen to state changes in device(s). Control and eventing are complementary to presentation (Step 5) where control points display a user interface provided by device(s).
PUPNP_Api int UpnpAcceptSubscription | ( | UpnpDevice_Handle | Hnd, |
const char * | DevID_const, | ||
const char * | ServName_const, | ||
const char ** | VarName_const, | ||
const char ** | NewVal_const, | ||
int | cVariables, | ||
const Upnp_SID | SubsId | ||
) |
Accepts a subscription request and sends out the current state of the eventable variables for a service.
The device application should call this function when it receives a UPNP_EVENT_SUBSCRIPTION_REQUEST
callback.
This function is synchronous and generates no callbacks.
This function can be called during the execution of a callback function.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid device handle. UPNP_E_INVALID_SERVICE:
The DevId/ServId pair refers to an invalid service. UPNP_E_INVALID_SID:
The specified subscription ID is not valid. UPNP_E_INVALID_PARAM:
Either VarName, NewVal, DevID, or ServID is not a valid pointer or cVariables is less than zero. UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. [in] | Hnd | The handle of the device. |
[in] | DevID_const | The device ID of the subdevice of the service generating the event. |
[in] | ServName_const | The unique service identifier of the service generating the event. |
[in] | VarName_const | Pointer to an array of event variables. |
[in] | NewVal_const | Pointer to an array of values for the event variables. |
[in] | cVariables | The number of event variables in VarName. |
[in] | SubsId | The subscription ID of the newly registered control point. |
Definition at line 2385 of file upnpapi.cpp.
PUPNP_Api int UpnpAcceptSubscriptionExt | ( | UpnpDevice_Handle | Hnd, |
const char * | DevID_const, | ||
const char * | ServName_const, | ||
IXML_Document * | PropSet, | ||
const Upnp_SID | SubsId | ||
) |
Similar to UpnpAcceptSubscription() except that it takes a DOM document for the variables to event rather than an array of strings.
This function is sychronous and generates no callbacks.
This function can be called during the execution of a callback function.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid device handle. UPNP_E_INVALID_SERVICE:
The DevId/ServId pair refers to an invalid service. UPNP_E_INVALID_SID:
The specified subscription ID is not valid. UPNP_E_INVALID_PARAM:
Either VarName, NewVal, DevID, ServID, or PropSet is not a valid pointer. UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. [in] | Hnd | The handle of the device. |
[in] | DevID_const | The device ID of the subdevice of the service generating the event. |
[in] | ServName_const | The unique service identifier of the service generating the event. |
[in] | PropSet | The DOM document for the property set. Property set documents must conform to the XML schema defined in section 4.3 of the Universal Plug and Play Device Architecture specification. |
[in] | SubsId | The subscription ID of the newly registered control point. |
Definition at line 2460 of file upnpapi.cpp.
PUPNP_Api int UpnpNotify | ( | UpnpDevice_Handle | Hnd, |
const char * | DevID_const, | ||
const char * | ServName_const, | ||
const char ** | VarName_const, | ||
const char ** | NewVal_const, | ||
int | cVariables | ||
) |
Sends out an event change notification to all control points subscribed to a particular service.
This function is synchronous and generates no callbacks.
This function may be called during a callback function to send out a notification.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid device handle. UPNP_E_INVALID_SERVICE:
The DevId/ServName pair refers to an invalid service. UPNP_E_INVALID_PARAM:
Either VarName, NewVal, DevID, or ServName is not a valid pointer or cVariables is less than zero. UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. [in] | Hnd | The handle to the device sending the event. |
[in] | DevID_const | The device ID of the subdevice of the service generating the event. |
[in] | ServName_const | The unique identifier of the service generating the event. |
[in] | VarName_const | Pointer to an array of variables that have changed. |
[in] | NewVal_const | Pointer to an array of new values for those variables. |
[in] | cVariables | The count of variables included in this notification. |
Definition at line 2300 of file upnpapi.cpp.
PUPNP_Api int UpnpNotifyExt | ( | UpnpDevice_Handle | Hnd, |
const char * | DevID_const, | ||
const char * | ServName_const, | ||
IXML_Document * | PropSet | ||
) |
Similar to UpnpNotify() except that it takes a DOM document for the event rather than an array of strings.
This function is synchronous and generates no callbacks.
This function may be called during a callback function to send out a notification.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid device handle. UPNP_E_INVALID_SERVICE:
The DevId/ServName pair refers to an invalid service. UPNP_E_INVALID_PARAM:
Either DevID, ServName, or PropSet is not a valid pointer. UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. [in] | Hnd | The handle to the device sending the event. |
[in] | DevID_const | The device ID of the subdevice of the service generating the event. |
[in] | ServName_const | The unique identifier of the service generating the event. |
[in] | PropSet | The DOM document for the property set. Property set documents must conform to the XML schema defined in section 4.3 of the Universal Plug and Play Device Architecture specification. |
Definition at line 2345 of file upnpapi.cpp.
PUPNP_Api int UpnpRenewSubscription | ( | UpnpClient_Handle | Hnd, |
int * | TimeOut, | ||
const Upnp_SID | SubsId | ||
) |
Renews a subscription that is about to expire.
This function is synchronous.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid control point handle. UPNP_E_INVALID_PARAM:
Timeout is not a valid pointer. UPNP_E_INVALID_SID:
The SID being passed to this function is not a valid subscription ID. UPNP_E_NETWORK_ERROR:
A network error occured. UPNP_E_SOCKET_WRITE:
An error or timeout occurred writing to a socket. UPNP_E_SOCKET_READ:
An error or timeout occurred reading from a socket. UPNP_E_SOCKET_BIND:
An error occurred binding a socket. UPNP_E_SOCKET_CONNECT:
An error occurred connecting to PublisherUrl. UPNP_E_OUTOF_SOCKET:
An error occurred creating a socket. UPNP_E_BAD_RESPONSE:
An error occurred in response from the publisher. UPNP_E_SUBSCRIBE_UNACCEPTED:
The publisher refused the subscription renew. UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. [in] | Hnd | The handle of the control point that is renewing the subscription. |
[in,out] | TimeOut | Pointer to a variable containing the requested subscription time. Upon return, it contains the actual renewal time. |
[in] | SubsId | The ID for the subscription to renew. |
Definition at line 2182 of file upnpapi.cpp.
PUPNP_Api int UpnpRenewSubscriptionAsync | ( | UpnpClient_Handle | Hnd, |
int | TimeOut, | ||
Upnp_SID | SubsId, | ||
Upnp_FunPtr | Fun, | ||
const void * | Cookie_const | ||
) |
Renews a subscription that is about to expire, generating a callback when the operation is complete.
Note that many of the error codes for this function are returned in the UpnpEventSubscribe structure. In those cases, the function returns UPNP_E_SUCCESS
and the appropriate error code will be in the UpnpEventSubscribe.ErrCode field in the Event structure passed to the callback.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid control point handle. UPNP_E_INVALID_SID:
The SubsId is not a valid subscription ID. UPNP_E_INVALID_PARAM:
Either Fun is not a valid callback function pointer or Timeout is less than zero but is not UPNP_INFINITE
. UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. UPNP_E_NETWORK_ERROR:
A network error occured (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_WRITE:
An error or timeout occurred writing to a socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_READ:
An error or timeout occurred reading from a socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_BIND:
An error occurred binding the socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_CONNECT:
An error occurred connecting to PublisherUrl (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_OUTOF_SOCKET:
An error occurred creating socket ( returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_BAD_RESPONSE:
An error occurred in response from the publisher (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SUBSCRIBE_UNACCEPTED:
The publisher refused the subscription request (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). [in] | Hnd | The handle of the control point that is renewing the subscription. |
[in] | TimeOut | The requested subscription time. The actual timeout value is returned when the callback function is called. |
[in] | SubsId | The ID for the subscription to renew. |
[in] | Fun | Pointer to a callback function to be invoked when the renewal is complete. |
[in] | Cookie_const | Pointer to user data passed to the callback function when invoked. |
Definition at line 2235 of file upnpapi.cpp.
PUPNP_Api int UpnpSetMaxSubscriptions | ( | UpnpDevice_Handle | Hnd, |
int | MaxSubscriptions | ||
) |
Sets the maximum number of subscriptions accepted per service.
The default value accepts as many as system resources allow. If the number of current subscriptions for a service is greater than the requested value, the SDK accepts no new subscriptions or renewals, however, the SDK does not remove any current subscriptions.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid device handle. Hnd | The handle of the device for which the maximum number of subscriptions is being set. |
MaxSubscriptions | The maximum number of subscriptions to be allowed per service. |
Definition at line 1869 of file upnpapi.cpp.
PUPNP_Api int UpnpSetMaxSubscriptionTimeOut | ( | UpnpDevice_Handle | Hnd, |
int | MaxSubscriptionTimeOut | ||
) |
Sets the maximum time-out accepted for a subscription request or renewal.
The default value accepts the time-out set by the control point. If a control point requests a subscription time-out less than or equal to the maximum, the SDK grants the value requested by the control point. If the time-out is greater, the SDK returns the maximum value.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid device handle. Hnd | The handle of the device for which the maximum subscription time-out is being set. |
MaxSubscriptionTimeOut | The maximum subscription time-out to be accepted. |
Definition at line 1902 of file upnpapi.cpp.
PUPNP_Api int UpnpSubscribe | ( | UpnpClient_Handle | Hnd, |
const char * | EvtUrl_const, | ||
int * | TimeOut, | ||
Upnp_SID | SubsId | ||
) |
Registers a control point to receive event notifications from a UPnP device.
This operation is synchronous.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid control point handle. UPNP_E_INVALID_URL:
PublisherUrl is not a valid URL. UPNP_E_INVALID_PARAM:
Timeout is not a valid pointer or SubsId or PublisherUrl is a nullptr
. UPNP_E_NETWORK_ERROR:
A network error occured. UPNP_E_SOCKET_WRITE:
An error or timeout occurred writing to a socket. UPNP_E_SOCKET_READ:
An error or timeout occurred reading from a socket. UPNP_E_SOCKET_BIND:
An error occurred binding a socket. UPNP_E_SOCKET_CONNECT:
An error occurred connecting to PublisherUrl. UPNP_E_OUTOF_SOCKET:
An error occurred creating a socket. UPNP_E_BAD_RESPONSE:
An error occurred in response from the publisher. UPNP_E_SUBSCRIBE_UNACCEPTED:
The publisher refused the subscription request. UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. [in] | Hnd | The handle of the control point. |
[in] | EvtUrl_const | The URL of the service to subscribe to. |
[in,out] | TimeOut | Pointer to a variable containing the requested subscription time. Upon return, it contains the actual subscription time returned from the service. |
[out] | SubsId | Pointer to a variable to receive the subscription ID (SID). |
Definition at line 2005 of file upnpapi.cpp.
PUPNP_Api int UpnpSubscribeAsync | ( | UpnpClient_Handle | Hnd, |
const char * | EvtUrl_const, | ||
int | TimeOut, | ||
Upnp_FunPtr | Fun, | ||
const void * | Cookie_const | ||
) |
Performs the same operation as UpnpSubscribe(), but returns immediately and calls the registered callback function when the operation is complete.
Note that many of the error codes for this function are returned in the s_UpnpEventSubscribe structure. In those cases, the function returns UPNP_E_SUCCESS
and the appropriate error code will be in the UpnpEventSubscribe.ErrCode field in the Event structure passed to the callback.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid control point handle. UPNP_E_INVALID_URL:
The PublisherUrl is not a valid URL. UPNP_E_INVALID_PARAM:
Either TimeOut or Fun or PublisherUrl is not a valid pointer. UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. UPNP_E_NETWORK_ERROR:
A network error occured (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_WRITE:
An error or timeout occurred writing to a socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_READ:
An error or timeout occurred reading from a socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_BIND:
An error occurred binding the socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_CONNECT:
An error occurred connecting to PublisherUrl (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_OUTOF_SOCKET:
An error occurred creating the socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_BAD_RESPONSE:
An error occurred in response from the publisher (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SUBSCRIBE_UNACCEPTED:
The publisher refused the subscription request (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). Hnd | The handle of the control point that is subscribing. |
EvtUrl_const | The URL of the service to subscribe to. |
TimeOut | The requested subscription time. Upon return, it contains the actual subscription time returned from the service. |
Fun | Pointer to the callback function for this subscribe request. |
Cookie_const | A user data value passed to the callback function when invoked. |
Definition at line 1939 of file upnpapi.cpp.
PUPNP_Api int UpnpUnSubscribe | ( | UpnpClient_Handle | Hnd, |
const Upnp_SID | SubsId | ||
) |
Removes the subscription of a control point from a service previously subscribed to using UpnpSubscribe() or UpnpSubscribeAsync().
This is a synchronous call.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid control point handle. UPNP_E_INVALID_SID:
The SubsId is not a valid subscription ID. UPNP_E_NETWORK_ERROR:
A network error occured. UPNP_E_SOCKET_WRITE:
An error or timeout occurred writing to a socket. UPNP_E_SOCKET_READ:
An error or timeout occurred reading from a socket. UPNP_E_SOCKET_BIND:
An error occurred binding a socket. UPNP_E_SOCKET_CONNECT:
An error occurred connecting to PublisherUrl. UPNP_E_OUTOF_SOCKET:
An error ocurred creating a socket. UPNP_E_BAD_RESPONSE:
An error occurred in response from the publisher. UPNP_E_UNSUBSCRIBE_UNACCEPTED:
The publisher refused the unsubscribe request (the client is still unsubscribed and no longer receives events). UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. [in] | Hnd | The handle of the subscribed control point. |
[in] | SubsId | The ID returned when the control point subscribed to the service. |
Definition at line 2071 of file upnpapi.cpp.
PUPNP_Api int UpnpUnSubscribeAsync | ( | UpnpClient_Handle | Hnd, |
Upnp_SID | SubsId, | ||
Upnp_FunPtr | Fun, | ||
const void * | Cookie_const | ||
) |
Removes a subscription of a control point from a service previously subscribed to using UpnpSubscribe() or UpnpSubscribeAsync(), generating a callback when the operation is complete.
Note that many of the error codes for this function are returned in the s_UpnpEventSubscribe structure. In those cases, the function returns UPNP_E_SUCCESS
and the appropriate error code will be in the UpnpEventSubscribe.ErrCode field in the Event structure passed to the callback.
UPNP_E_SUCCESS:
The operation completed successfully. UPNP_E_FINISH:
The SDK is already terminated or is not initialized. UPNP_E_INVALID_HANDLE:
The handle is not a valid control point handle. UPNP_E_INVALID_SID:
The SubsId is not a valid SID. UPNP_E_INVALID_PARAM:
Fun is not a valid callback function pointer. UPNP_E_OUTOF_MEMORY:
Insufficient resources exist to complete this operation. UPNP_E_NETWORK_ERROR:
A network error occured (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_WRITE:
An error or timeout occurred writing to a socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_READ:
An error or timeout occurred reading from a socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_BIND:
An error occurred binding the socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_SOCKET_CONNECT:
An error occurred connecting to PublisherUrl (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_OUTOF_SOCKET:
An error occurred creating a socket (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_BAD_RESPONSE:
An error occurred in response from the publisher (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). UPNP_E_UNSUBSCRIBE_UNACCEPTED:
The publisher refused the subscription request (returned in the UpnpEventSubscribe.ErrCode field as part of the callback). [in] | Hnd | The handle of the subscribed control point. |
[in] | SubsId | The ID returned when the control point subscribed to the service. |
[in] | Fun | Pointer to a callback function to be called when the operation is complete. |
[in] | Cookie_const | Pointer to user data to pass to the callback function when invoked. |
Definition at line 2117 of file upnpapi.cpp.