Updated on 2022-02-24 GMT+08:00

Broadcast Mechanism

The AgentLite provides a broadcast mechanism for third-party developers to receive messages reported by the AgentLite.

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);