Notifications
This category covers the local real-time notifications, which can be filtered by session. The caller does not have to deal with native formats and can register multiple handlers if needed.
Warning:
- Make no assumptions regarding the thread(s) executing the callbacks, but make sure you provide thread-safe callbacks not just throwing.
- Although processed by batch, notifications are delivered one-by-one by the call back function.
- The callback should not block, but handle its own threads if this could lead to blocking or interactive actions.
- Maximum validity is set by default to 30 seconds and 64K events. This delivery mechanism is intended for user interface notifications and may include data loss (compared with Logs, which have no data loss unless the disk is full).
Typedefs
typedef void(HSDCAPI * HSDC_NOTIFICATION_PROCESSOR_CALLBACK) (DWORD cookie, DWORD sessionId, const char *jstr)
The callback parameter is the subscription cookie, the session in which the event occurs (0 for service session), and the JSON payload containing one event.
Functions
HSDCError HSDCAPI HSDCRegisterNotificationProcessor (DWORD *pCookie, DWORD sessionId, const char *jstr, HSDC_NOTIFICATION_PROCESSOR_CALLBACK cb)
Registers a callback to get notification.
HSDCError HSDCAPI HSDCUnregisterNotificationProcessor (DWORD cookie)
Unregisters a callback using the cookie returned at registration.
Typedef Documentation
HSDC_NOTIFICATION_PROCESSOR_CALLBACK
typedef void(HSDCAPI * HSDC_NOTIFICATION_PROCESSOR_CALLBACK) (DWORD cookie, DWORD sessionId, const char *jstr)
The callback parameter is the subscription cookie, the session in which the event occurs (0 for service session), and the JSON payload containing one event.
The format of the event is:
{
"code": "INVALID-PASSWORD",
"devicename": "JetFlash Transcend 512MB USB Device, Disk drive, (Standard disk drives)",
"devicetype": "Removable",
"local": "2013-12-12T15:50:50.125",
"machine": "XDW7X64LES3",
"modelid": "51B518CB1B304F5DD7AD267EA1AFF2CCA4451672",
"other": "3",
"path": "E:",
"processname": "scomc.exe",
"strongid": "6cd38e89cc9776489ae9edaebeb00ef6",
"timestamp": "2015-10-16T13:38:59.526Z",
"type": "notification",
"uniqueid": "1B987F1B5B971C80FB946FF88E8321E4B4F47BE7",
"user": "S-1-5-21-2887968943-2130729715-1269760985-9449",
"utc": "2013-12-12T14:50:50.125Z"
}
Various types of notification are dispatched using this mechanism. These include:
Type |
Description |
---|---|
notification |
Notification used by popup menu items, check OEM chapter. |
ui |
Notification used by popup menu items, check OEM chapter. |
connectivity |
Notification sent when connectivity switches state (online/offline). |
other |
Work in progress for encryption of removables and optical disks. |
Function Documentation
HSDCRegisterNotificationProcessor()
HSDCError HSDCAPI HSDCRegisterNotificationProcessor ( DWORD * pCookie, DWORD sessionId, const char * jstr, HSDC_NOTIFICATION_PROCESSOR_CALLBACK cb )
Registers a callback to get a notification.
Parameters
pCookie |
[out] Set to uniquely identify this registration. |
sessionId |
The ID of the user session for which the user wants to receive notifications. |
jstr |
[optional] Additional configuration, which is not currently used. |
cb |
The Notification Processor callback function pointer. |
HSDCUnregisterNotificationProcessor()
HSDCError HSDCAPI HSDCUnregisterNotificationProcessor ( DWORD cookie )
Unregisters a callback using the cookie returned at registration
Parameters
cookie |
The callback registration cookie that the user wants to unregister. |