本文整理汇总了C++中IOTHUB_CLIENT_LL_HANDLE_DATA::messageCallback方法的典型用法代码示例。如果您正苦于以下问题:C++ IOTHUB_CLIENT_LL_HANDLE_DATA::messageCallback方法的具体用法?C++ IOTHUB_CLIENT_LL_HANDLE_DATA::messageCallback怎么用?C++ IOTHUB_CLIENT_LL_HANDLE_DATA::messageCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOTHUB_CLIENT_LL_HANDLE_DATA
的用法示例。
在下文中一共展示了IOTHUB_CLIENT_LL_HANDLE_DATA::messageCallback方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogError
IOTHUBMESSAGE_DISPOSITION_RESULT IoTHubClient_LL_MessageCallback(IOTHUB_CLIENT_LL_HANDLE handle, IOTHUB_MESSAGE_HANDLE message)
{
int result;
/*Codes_SRS_IOTHUBCLIENT_LL_02_029: [If parameter handle is NULL then IoTHubClient_LL_MessageCallback shall return IOTHUBMESSAGE_ABANDONED.] */
if (handle == NULL)
{
LogError("invalid argument");
result = IOTHUBMESSAGE_ABANDONED;
}
else
{
IOTHUB_CLIENT_LL_HANDLE_DATA* handleData = (IOTHUB_CLIENT_LL_HANDLE_DATA*)handle;
/* Codes_SRS_IOTHUBCLIENT_LL_09_004: [IoTHubClient_LL_GetLastMessageReceiveTime shall return lastMessageReceiveTime in localtime] */
handleData->lastMessageReceiveTime = get_time(NULL);
/*Codes_SRS_IOTHUBCLIENT_LL_02_030: [IoTHubClient_LL_MessageCallback shall invoke the last callback function (the parameter messageCallback to IoTHubClient_LL_SetMessageCallback) passing the message and the passed userContextCallback.]*/
if (handleData->messageCallback != NULL)
{
result = handleData->messageCallback(message, handleData->messageUserContextCallback);
}
else
{
/*Codes_SRS_IOTHUBCLIENT_LL_02_032: [If the last callback function was NULL, then IoTHubClient_LL_MessageCallback shall return IOTHUBMESSAGE_ABANDONED.] */
LogError("user callback was NULL");
result = IOTHUBMESSAGE_ABANDONED;
}
}
/*Codes_SRS_IOTHUBCLIENT_LL_02_031: [Then IoTHubClient_LL_MessageCallback shall return what the user function returns.]*/
return result;
}