本文整理汇总了C++中IOTHUB_CLIENT_LL_HANDLE_DATA::IoTHubTransport_SetOption方法的典型用法代码示例。如果您正苦于以下问题:C++ IOTHUB_CLIENT_LL_HANDLE_DATA::IoTHubTransport_SetOption方法的具体用法?C++ IOTHUB_CLIENT_LL_HANDLE_DATA::IoTHubTransport_SetOption怎么用?C++ IOTHUB_CLIENT_LL_HANDLE_DATA::IoTHubTransport_SetOption使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOTHUB_CLIENT_LL_HANDLE_DATA
的用法示例。
在下文中一共展示了IOTHUB_CLIENT_LL_HANDLE_DATA::IoTHubTransport_SetOption方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: IoTHubClient_LL_SetOption
IOTHUB_CLIENT_RESULT IoTHubClient_LL_SetOption(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, const char* optionName, const void* value)
{
IOTHUB_CLIENT_RESULT result;
/*Codes_SRS_IOTHUBCLIENT_LL_02_034: [If iotHubClientHandle is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.]*/
/*Codes_SRS_IOTHUBCLIENT_LL_02_035: [If optionName is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.] */
/*Codes_SRS_IOTHUBCLIENT_LL_02_036: [If value is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.] */
if (
(iotHubClientHandle == NULL) ||
(optionName == NULL) ||
(value == NULL)
)
{
result = IOTHUB_CLIENT_INVALID_ARG;
LogError("invalid argument (NULL)\r\n");
}
else
{
IOTHUB_CLIENT_LL_HANDLE_DATA* handleData = (IOTHUB_CLIENT_LL_HANDLE_DATA*)iotHubClientHandle;
/*Codes_SRS_IOTHUBCLIENT_LL_02_038: [Otherwise, IoTHubClient_LL shall call the function _SetOption of the underlying transport and return what that function is returning.] */
result = handleData->IoTHubTransport_SetOption(handleData->transportHandle, optionName, value);
if (result != IOTHUB_CLIENT_OK)
{
LogError("underlying transport failed, returned = %s\r\n", ENUM_TO_STRING(IOTHUB_CLIENT_RESULT, result));
}
}
return result;
}
示例2: IoTHubClient_LL_SetOption
IOTHUB_CLIENT_RESULT IoTHubClient_LL_SetOption(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, const char* optionName, const void* value)
{
IOTHUB_CLIENT_RESULT result;
/*Codes_SRS_IOTHUBCLIENT_LL_02_034: [If iotHubClientHandle is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.]*/
/*Codes_SRS_IOTHUBCLIENT_LL_02_035: [If optionName is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.] */
/*Codes_SRS_IOTHUBCLIENT_LL_02_036: [If value is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.] */
if (
(iotHubClientHandle == NULL) ||
(optionName == NULL) ||
(value == NULL)
)
{
result = IOTHUB_CLIENT_INVALID_ARG;
LogError("invalid argument (NULL)");
}
else
{
IOTHUB_CLIENT_LL_HANDLE_DATA* handleData = (IOTHUB_CLIENT_LL_HANDLE_DATA*)iotHubClientHandle;
/*Codes_SRS_IOTHUBCLIENT_LL_02_039: [ "messageTimeout" - once IoTHubClient_LL_SendEventAsync is called the message shall timeout after value miliseconds. Value is a pointer to a uint64. ]*/
if (strcmp(optionName, "messageTimeout") == 0)
{
/*this is an option handled by IoTHubClient_LL*/
/*Codes_SRS_IOTHUBCLIENT_LL_02_043: [ Calling IoTHubClient_LL_SetOption with value set to "0" shall disable the timeout mechanism for all new messages. ]*/
handleData->currentMessageTimeout = *(const uint64_t*)value;
result = IOTHUB_CLIENT_OK;
}
else
{
/*Codes_SRS_IOTHUBCLIENT_LL_02_038: [Otherwise, IoTHubClient_LL shall call the function _SetOption of the underlying transport and return what that function is returning.] */
result = handleData->IoTHubTransport_SetOption(handleData->transportHandle, optionName, value);
if (result != IOTHUB_CLIENT_OK)
{
LogError("underlying transport failed, returned = %s", ENUM_TO_STRING(IOTHUB_CLIENT_RESULT, result));
}
}
}
return result;
}
示例3: IoTHubClient_LL_SetOption
IOTHUB_CLIENT_RESULT IoTHubClient_LL_SetOption(IOTHUB_CLIENT_LL_HANDLE iotHubClientHandle, const char* optionName, const void* value)
{
IOTHUB_CLIENT_RESULT result;
/*Codes_SRS_IOTHUBCLIENT_LL_02_034: [If iotHubClientHandle is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.]*/
/*Codes_SRS_IOTHUBCLIENT_LL_02_035: [If optionName is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.] */
/*Codes_SRS_IOTHUBCLIENT_LL_02_036: [If value is NULL then IoTHubClient_LL_SetOption shall return IOTHUB_CLIENT_INVALID_ARG.] */
if (
(iotHubClientHandle == NULL) ||
(optionName == NULL) ||
(value == NULL)
)
{
result = IOTHUB_CLIENT_INVALID_ARG;
LogError("invalid argument (NULL)");
}
else
{
IOTHUB_CLIENT_LL_HANDLE_DATA* handleData = (IOTHUB_CLIENT_LL_HANDLE_DATA*)iotHubClientHandle;
/*Codes_SRS_IOTHUBCLIENT_LL_02_039: [ "messageTimeout" - once IoTHubClient_LL_SendEventAsync is called the message shall timeout after value miliseconds. Value is a pointer to a uint64. ]*/
if (strcmp(optionName, "messageTimeout") == 0)
{
/*this is an option handled by IoTHubClient_LL*/
/*Codes_SRS_IOTHUBCLIENT_LL_02_043: [ Calling IoTHubClient_LL_SetOption with value set to "0" shall disable the timeout mechanism for all new messages. ]*/
handleData->currentMessageTimeout = *(const uint64_t*)value;
result = IOTHUB_CLIENT_OK;
}
else
{
/*Codes_SRS_IOTHUBCLIENT_LL_02_099: [ IoTHubClient_LL_SetOption shall return according to the table below ]*/
IOTHUB_CLIENT_RESULT uploadToBlob_result;
#ifndef DONT_USE_UPLOADTOBLOB
uploadToBlob_result = IoTHubClient_LL_UploadToBlob_SetOption(handleData->uploadToBlobHandle, optionName, value);
if(uploadToBlob_result == IOTHUB_CLIENT_ERROR)
{
LogError("unable to IoTHubClient_LL_UploadToBlob_SetOption");
result = IOTHUB_CLIENT_ERROR;
}
#else
uploadToBlob_result = IOTHUB_CLIENT_INVALID_ARG; /*harmless value (IOTHUB_CLIENT_INVALID_ARG)in the case when uploadtoblob is not compiled in, otherwise whatever IoTHubClient_LL_UploadToBlob_SetOption returned*/
#endif /*DONT_USE_UPLOADTOBLOB*/
result =
/*based on uploadToBlob_result value this is what happens:*/
/*IOTHUB_CLIENT_INVALID_ARG always returns what IoTHubTransport_SetOption returns*/
/*IOTHUB_CLIENT_ERROR always returns IOTHUB_CLIENT_ERROR */
/*IOTHUB_CLIENT_OK returns OK
IOTHUB_CLIENT_OK if IoTHubTransport_SetOption returns OK or INVALID_ARG
IOTHUB_CLIENT_ERROR if IoTHubTransport_SetOption returns ERROR*/
(uploadToBlob_result == IOTHUB_CLIENT_INVALID_ARG) ? handleData->IoTHubTransport_SetOption(handleData->transportHandle, optionName, value) :
(uploadToBlob_result == IOTHUB_CLIENT_ERROR) ? IOTHUB_CLIENT_ERROR :
(handleData->IoTHubTransport_SetOption(handleData->transportHandle, optionName, value) == IOTHUB_CLIENT_ERROR) ? IOTHUB_CLIENT_ERROR : IOTHUB_CLIENT_OK;
if (result != IOTHUB_CLIENT_OK)
{
LogError("underlying transport failed, returned = %s", ENUM_TO_STRING(IOTHUB_CLIENT_RESULT, result));
}
#ifndef DONT_USE_UPLOADTOBLOB
}
#endif
}
return result;
}