in source/azure_iot_hub_client.c [408:453]
static AzureIoTResult_t prvGetPropertiesRequestId( AzureIoTHubClient_t * pxAzureIoTHubClient,
az_span xSpan,
bool xOddSeq,
uint32_t * pulRequestId,
az_span * pxSpan )
{
AzureIoTResult_t xResult;
az_span xRemainder;
az_result xCoreResult;
/* Check the last request Id used, and do increment of 2 or 1 based on xOddSeq */
if( xOddSeq == ( bool ) ( pxAzureIoTHubClient->_internal.ulCurrentPropertyRequestID & 0x01 ) )
{
pxAzureIoTHubClient->_internal.ulCurrentPropertyRequestID += 2;
}
else
{
pxAzureIoTHubClient->_internal.ulCurrentPropertyRequestID += 1;
}
if( pxAzureIoTHubClient->_internal.ulCurrentPropertyRequestID == 0 )
{
pxAzureIoTHubClient->_internal.ulCurrentPropertyRequestID = 2;
}
xCoreResult = az_span_u32toa( xSpan, pxAzureIoTHubClient->_internal.ulCurrentPropertyRequestID, &xRemainder );
if( az_result_failed( xCoreResult ) )
{
AZLogError( ( "Couldn't convert request id to span" ) );
xResult = AzureIoT_TranslateCoreError( xCoreResult );
}
else
{
*pxSpan = az_span_slice( *pxSpan, 0, az_span_size( *pxSpan ) - az_span_size( xRemainder ) );
if( pulRequestId )
{
*pulRequestId = pxAzureIoTHubClient->_internal.ulCurrentPropertyRequestID;
}
xResult = eAzureIoTSuccess;
}
return xResult;
}