Broadcasting
The AgentLite SDK provides a broadcast mechanism for developers to receive messages reported by the AgentLite SDK.
Subscribing to a Broadcast
1 | HW_BroadCastReg(HW_CHAR *pcTopic ,PFN_HW_BROADCAST_RECV pfnReceiver);
|
The broadcast processing function prototype is as follows:
1 | (*PFN_HW_BROADCAST_RECV)(HW_UINT uiCookie, HW_MSG *pstMsg);
|
uiCookie in the broadcast is the same as uiCookie provided over the API. It is used to match the request and response of a service. If uiCookie is not provided over the API, uiCookie in the broadcast is invalid.
Unsubscribing from a Broadcast
1 | HW_BroadCastUnreg(HW_CHAR *pcTopic, PFN_HW_BROADCAST_RECV pfnReceiver);
|
Obtaining Data from the pstMsg
Obtaining a character string:
1 | HW_MsgGetStr(HW_MSG pstMsg, HW_UINT uiTag);
|
Obtaining an unsigned integer:
1 | HW_MsgGetUint(HW_MSG pstMsg, HW_UINT uiTag, HW_UINT uiDefault);
|
Obtaining a byte array:
1 | HW_MsgGetByteArray(HW_MSG pstMsg, HW_UINT uiTag);
|
Last Article: Development Description
Next Article: JSON Component Description
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.