in source/azure_iot_hub_client_properties.c [192:245]
AzureIoTResult_t AzureIoTHubClientProperties_GetNextComponentProperty( AzureIoTHubClient_t * pxAzureIoTHubClient,
AzureIoTJSONReader_t * pxJSONReader,
AzureIoTHubMessageType_t xResponseType,
AzureIoTHubClientPropertyType_t xPropertyType,
const uint8_t ** ppucComponentName,
uint32_t * pulComponentNameLength )
{
AzureIoTResult_t xResult;
az_result xCoreResult;
az_span xComponentSpan;
az_iot_hub_client_properties_message_type xCoreMessageType;
if( ( pxAzureIoTHubClient == NULL ) || ( pxJSONReader == NULL ) ||
( ( xResponseType != eAzureIoTHubPropertiesRequestedMessage ) &&
( xResponseType != eAzureIoTHubPropertiesWritablePropertyMessage ) ) ||
( ppucComponentName == NULL ) || ( pulComponentNameLength == NULL ) )
{
AZLogError( ( "AzureIoTHubClientProperties_GetNextComponentProperty failed: invalid argument" ) );
xResult = eAzureIoTErrorInvalidArgument;
}
else
{
xComponentSpan = az_span_create( ( uint8_t * ) *ppucComponentName, ( int32_t ) *pulComponentNameLength );
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_next_component_property( &pxAzureIoTHubClient->_internal.xAzureIoTHubClientCore,
&pxJSONReader->_internal.xCoreReader,
xCoreMessageType,
( az_iot_hub_client_property_type ) xPropertyType,
&xComponentSpan ) ) )
{
if( xCoreResult == AZ_ERROR_IOT_END_OF_PROPERTIES )
{
xResult = eAzureIoTErrorEndOfProperties;
}
else
{
AZLogError( ( "Could not get next component property: core error=0x%08x", ( uint16_t ) xCoreResult ) );
xResult = AzureIoT_TranslateCoreError( xCoreResult );
}
}
else
{
*ppucComponentName = az_span_ptr( xComponentSpan );
*pulComponentNameLength = ( uint16_t ) az_span_size( xComponentSpan );
xResult = eAzureIoTSuccess;
}
}
return xResult;
}