in source/azure_iot_json_writer.c [148:183]
AzureIoTResult_t AzureIoTJSONWriter_AppendPropertyWithStringValue( AzureIoTJSONWriter_t * pxWriter,
const uint8_t * pucPropertyName,
uint32_t ulPropertyNameLength,
const uint8_t * pucValue,
uint32_t ulValueLen )
{
AzureIoTResult_t xResult;
az_result xCoreResult;
az_span xPropertyNameSpan;
az_span xValueSpan;
if( ( pxWriter == NULL ) || ( pucPropertyName == NULL ) || ( ulPropertyNameLength == 0 ) ||
( pucValue == NULL ) || ( ulValueLen == 0 ) )
{
AZLogError( ( "AzureIoTJSONWriter_AppendPropertyWithStringValue failed: invalid argument" ) );
xResult = eAzureIoTErrorInvalidArgument;
}
else
{
xPropertyNameSpan = az_span_create( ( uint8_t * ) pucPropertyName, ( int32_t ) ulPropertyNameLength );
xValueSpan = az_span_create( ( uint8_t * ) pucValue, ( int32_t ) ulValueLen );
if( az_result_failed( xCoreResult = az_json_writer_append_property_name( &pxWriter->_internal.xCoreWriter, xPropertyNameSpan ) ) ||
az_result_failed( xCoreResult = az_json_writer_append_string( &pxWriter->_internal.xCoreWriter, xValueSpan ) ) )
{
AZLogError( ( "Could not append property and string: core error=0x%08x", ( uint16_t ) xCoreResult ) );
xResult = AzureIoT_TranslateCoreError( xCoreResult );
}
else
{
xResult = eAzureIoTSuccess;
}
}
return xResult;
}