NRC_SetMsgHappenCallback(void (*fun)(void))
Set the callback function to be called when the message occurs
When a message occurs, this callback function will be called
Type
int =>Set the callback function to be called when the message occurs
Return value | Description |
---|---|
0 | The function is called successfully |
-101 | Invalid input parameter |
-102 | The target object does not exist. This typically occurs when the system initialization is incomplete, and calling other functions may return this value |
-103 | The target object is currently in an inoperable state |
Parameter Option
Parameter | Type | Description |
---|---|---|
*fun | void | Function pointer of the callback function |
Sample code
void msgHook()
{
NRC_Messsage tmp;//Define a message structure object
NRC_GetMesssage(1, tmp);//Assign the earliest message in the message queue to the object "tmp"
printf("msgHooklocalTime=%d:%d::%d,0x%x,0x%x,text=%s,size=%d\n",tmp.localTime.minute, tmp.localTime.second, tmp.localTime.milliseconds, tmp.kind, tmp.code, tmp.text.c_str(),NRC_GetMesssageSize());
}
NRC_SetMsgHappenCallback(msgHook);//Set the callback function to be called when the message occurs