Notification Event

Fires when a notification is received from the server.

Syntax

ANSI (Cross Platform)
virtual int FireNotification(CoAPNotificationEventParams *e);
typedef struct {
const char *URI;
int IsLatest;
int StopObserving; int reserved; } CoAPNotificationEventParams; Unicode (Windows) virtual INT FireNotification(CoAPNotificationEventParams *e);
typedef struct {
LPCWSTR URI;
BOOL IsLatest;
BOOL StopObserving; INT reserved; } CoAPNotificationEventParams;
- (void)onNotification:(NSString*)URI :(BOOL)isLatest :(int*)stopObserving;
#define EID_COAP_NOTIFICATION 3

virtual INT IPWORKSIOT_CALL FireNotification(LPSTR &lpszURI, BOOL &bIsLatest, BOOL &bStopObserving);

Remarks

This event fires when the class receives a notification from that server that some observed resource has changed. Query the ResponseCode, ResponseData, ResponseContentFormat, ResponseETag, and ResponseOption* properties to obtain the new resource information.

Note that, in some cases, the server may no longer be able to deliver notifications for a resource (e.g., if it is deleted). In such cases, the ResponseCode property will be populated with a non-2.xx code (e.g., 4.04 "Not Found") to indicate why the resource can no longer be observed. No further notifications will be delivered for the resource after such a notification arrives.

The URI parameter identifies the resource that has changed.

The IsLatest parameter reflects whether this notification actually has the most recent resource information available, since it is possible for notifications to arrive out of order under certain circumstances.

The StopObserving parameter specifies whether the class should stop observing the resource identified by URI. This parameter is False by default, set it to True to have the class unregister itself from further notifications. (Note: in the event of a non-2.xx notification, this parameter will be True by default instead, and changing it to False will have no effect.)

Note: This event is only used when the class is operating in client mode (i.e., when the Listening property is disabled).

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IoT 2020 C++ Edition - Version 20.0 [Build 8265]