AzureIoTResult_t AzureIoTHubClientProperties_GetPropertiesVersion()

in source/azure_iot_hub_client_properties.c [153:190]


AzureIoTResult_t AzureIoTHubClientProperties_GetPropertiesVersion( AzureIoTHubClient_t * pxAzureIoTHubClient,
                                                                   AzureIoTJSONReader_t * pxJSONReader,
                                                                   AzureIoTHubMessageType_t xResponseType,
                                                                   uint32_t * pulVersion )
{
    AzureIoTResult_t xResult;
    az_result xCoreResult;
    az_iot_hub_client_properties_message_type xCoreMessageType;

    if( ( pxAzureIoTHubClient == NULL ) ||
        ( pxJSONReader == NULL ) ||
        ( ( xResponseType != eAzureIoTHubPropertiesRequestedMessage ) &&
          ( xResponseType != eAzureIoTHubPropertiesWritablePropertyMessage ) ) ||
        ( pulVersion == NULL ) )
    {
        AZLogError( ( "AzureIoTHubClientProperties_GetPropertiesVersion failed: invalid argument" ) );
        xResult = eAzureIoTErrorInvalidArgument;
    }
    else
    {
        xCoreMessageType = xResponseType == eAzureIoTHubPropertiesRequestedMessage ?
                           AZ_IOT_HUB_CLIENT_PROPERTIES_MESSAGE_TYPE_GET_RESPONSE : AZ_IOT_HUB_CLIENT_PROPERTIES_MESSAGE_TYPE_WRITABLE_UPDATED;

        if( az_result_failed(
                xCoreResult = az_iot_hub_client_properties_get_properties_version( &pxAzureIoTHubClient->_internal.xAzureIoTHubClientCore,
                                                                                   &pxJSONReader->_internal.xCoreReader, xCoreMessageType, ( int32_t * ) pulVersion ) ) )
        {
            AZLogError( ( "Could not get property version: core error=0x%08x", ( uint16_t ) xCoreResult ) );
            xResult = AzureIoT_TranslateCoreError( xCoreResult );
        }
        else
        {
            xResult = eAzureIoTSuccess;
        }
    }

    return xResult;
}