Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: azure_umqtt_c iothub_mqtt_transport mbed-rtos mbed wolfSSL Socket lwip-eth lwip-sys lwip
iothub_message.h File Reference
The IoTHub_Message component encapsulates one message that can be transferred by an IoT hub client.  
More...
Go to the source code of this file.
Functions | |
| DEFINE_ENUM (IOTHUB_MESSAGE_RESULT, IOTHUB_MESSAGE_RESULT_VALUES) | |
| Enumeration specifying the status of calls to various APIs in this module.   | |
| DEFINE_ENUM (IOTHUBMESSAGE_CONTENT_TYPE, IOTHUBMESSAGE_CONTENT_TYPE_VALUES) | |
| Enumeration specifying the content type of the a given message.   | |
| MOCKABLE_FUNCTION (, IOTHUB_MESSAGE_HANDLE, IoTHubMessage_CreateFromByteArray, const unsigned char *, byteArray, size_t, size) | |
| Creates a new IoT hub message from a byte array.   | |
| MOCKABLE_FUNCTION (, IOTHUB_MESSAGE_HANDLE, IoTHubMessage_CreateFromString, const char *, source) | |
| Creates a new IoT hub message from a null terminated string.   | |
| MOCKABLE_FUNCTION (, IOTHUB_MESSAGE_HANDLE, IoTHubMessage_Clone, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle) | |
Creates a new IoT hub message with the content identical to that of the iotHubMessageHandle parameter.   | |
| MOCKABLE_FUNCTION (, IOTHUB_MESSAGE_RESULT, IoTHubMessage_GetByteArray, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle, const unsigned char **, buffer, size_t *, size) | |
| Fetches a pointer and size for the data associated with the IoT hub message handle.   | |
| MOCKABLE_FUNCTION (, const char *, IoTHubMessage_GetString, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle) | |
| Returns the null terminated string stored in the message.   | |
| MOCKABLE_FUNCTION (, IOTHUBMESSAGE_CONTENT_TYPE, IoTHubMessage_GetContentType, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle) | |
Returns the content type of the message given by parameter iotHubMessageHandle.   | |
| MOCKABLE_FUNCTION (, MAP_HANDLE, IoTHubMessage_Properties, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle) | |
| Gets a handle to the message's properties map.   | |
| MOCKABLE_FUNCTION (, const char *, IoTHubMessage_GetMessageId, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle) | |
| Gets the MessageId from the IOTHUB_MESSAGE_HANDLE.   | |
| MOCKABLE_FUNCTION (, IOTHUB_MESSAGE_RESULT, IoTHubMessage_SetMessageId, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle, const char *, messageId) | |
| Sets the MessageId for the IOTHUB_MESSAGE_HANDLE.   | |
| MOCKABLE_FUNCTION (, const char *, IoTHubMessage_GetCorrelationId, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle) | |
| Gets the CorrelationId from the IOTHUB_MESSAGE_HANDLE.   | |
| MOCKABLE_FUNCTION (, IOTHUB_MESSAGE_RESULT, IoTHubMessage_SetCorrelationId, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle, const char *, correlationId) | |
| Sets the CorrelationId for the IOTHUB_MESSAGE_HANDLE.   | |
| MOCKABLE_FUNCTION (, void, IoTHubMessage_Destroy, IOTHUB_MESSAGE_HANDLE, iotHubMessageHandle) | |
| Frees all resources associated with the given message handle.   | |
Detailed Description
The IoTHub_Message component encapsulates one message that can be transferred by an IoT hub client. 
Definition in file iothub_message.h.
Function Documentation
| DEFINE_ENUM | ( | IOTHUB_MESSAGE_RESULT | , | 
| IOTHUB_MESSAGE_RESULT_VALUES | |||
| ) | 
Enumeration specifying the status of calls to various APIs in this module.
| DEFINE_ENUM | ( | IOTHUBMESSAGE_CONTENT_TYPE | , | 
| IOTHUBMESSAGE_CONTENT_TYPE_VALUES | |||
| ) | 
Enumeration specifying the content type of the a given message.
| MOCKABLE_FUNCTION | ( | IOTHUB_MESSAGE_RESULT | , | 
| IoTHubMessage_SetCorrelationId | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | , | ||
| const char * | , | ||
| correlationId | |||
| ) | 
Sets the CorrelationId for the IOTHUB_MESSAGE_HANDLE.
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message. correlationId Pointer to the memory location of the messageId  
- Returns:
 - Returns IOTHUB_MESSAGE_OK if the messageId was set successfully or an error code otherwise.
 
| MOCKABLE_FUNCTION | ( | const char * | , | 
| IoTHubMessage_GetCorrelationId | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | |||
| ) | 
Gets the CorrelationId from the IOTHUB_MESSAGE_HANDLE.
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message.  
- Returns:
 - A const char* pointing to the Correlation Id.
 
| MOCKABLE_FUNCTION | ( | IOTHUB_MESSAGE_RESULT | , | 
| IoTHubMessage_SetMessageId | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | , | ||
| const char * | , | ||
| messageId | |||
| ) | 
Sets the MessageId for the IOTHUB_MESSAGE_HANDLE.
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message. messageId Pointer to the memory location of the messageId  
- Returns:
 - Returns IOTHUB_MESSAGE_OK if the messageId was set successfully or an error code otherwise.
 
| MOCKABLE_FUNCTION | ( | const char * | , | 
| IoTHubMessage_GetMessageId | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | |||
| ) | 
Gets the MessageId from the IOTHUB_MESSAGE_HANDLE.
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message.  
- Returns:
 - A const char* pointing to the Message Id.
 
| MOCKABLE_FUNCTION | ( | MAP_HANDLE | , | 
| IoTHubMessage_Properties | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | |||
| ) | 
Gets a handle to the message's properties map.
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message.  
- Returns:
 - A 
MAP_HANDLEpointing to the properties map for this message. 
| MOCKABLE_FUNCTION | ( | IOTHUBMESSAGE_CONTENT_TYPE | , | 
| IoTHubMessage_GetContentType | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | |||
| ) | 
Returns the content type of the message given by parameter iotHubMessageHandle. 
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message.  
- Returns:
 - An 
IOTHUBMESSAGE_CONTENT_TYPEvalue. 
| MOCKABLE_FUNCTION | ( | const char * | , | 
| IoTHubMessage_GetString | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | |||
| ) | 
Returns the null terminated string stored in the message.
If the content type of the message is not IOTHUBMESSAGE_STRING then the function returns NULL.
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message.  
- Returns:
 NULLif an error occurs or a pointer to the stored null terminated string otherwise.
| MOCKABLE_FUNCTION | ( | IOTHUB_MESSAGE_RESULT | , | 
| IoTHubMessage_GetByteArray | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | , | ||
| const unsigned char ** | , | ||
| buffer | , | ||
| size_t * | , | ||
| size | |||
| ) | 
Fetches a pointer and size for the data associated with the IoT hub message handle.
If the content type of the message is not IOTHUBMESSAGE_BYTEARRAY then the function returns IOTHUB_MESSAGE_INVALID_ARG.
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message. buffer Pointer to the memory location where the pointer to the buffer will be written. size The size of the buffer will be written to this address.  
- Returns:
 - Returns IOTHUB_MESSAGE_OK if the byte array was fetched successfully or an error code otherwise.
 
| MOCKABLE_FUNCTION | ( | IOTHUB_MESSAGE_HANDLE | , | 
| IoTHubMessage_Clone | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | |||
| ) | 
Creates a new IoT hub message with the content identical to that of the iotHubMessageHandle parameter. 
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message that is to be cloned.  
- Returns:
 - A valid 
IOTHUB_MESSAGE_HANDLEif the message was successfully cloned orNULLin case an error occurs. 
| MOCKABLE_FUNCTION | ( | IOTHUB_MESSAGE_HANDLE | , | 
| IoTHubMessage_CreateFromString | , | ||
| const char * | , | ||
| source | |||
| ) | 
Creates a new IoT hub message from a null terminated string.
The type of the message will be set to IOTHUBMESSAGE_STRING.
- Parameters:
 - 
  
source The null terminated string from which the message is to be created.  
- Returns:
 - A valid 
IOTHUB_MESSAGE_HANDLEif the message was successfully created orNULLin case an error occurs. 
| MOCKABLE_FUNCTION | ( | IOTHUB_MESSAGE_HANDLE | , | 
| IoTHubMessage_CreateFromByteArray | , | ||
| const unsigned char * | , | ||
| byteArray | , | ||
| size_t | , | ||
| size | |||
| ) | 
Creates a new IoT hub message from a byte array.
The type of the message will be set to IOTHUBMESSAGE_BYTEARRAY.
- Parameters:
 - 
  
byteArray The byte array from which the message is to be created. size The size of the byte array.  
- Returns:
 - A valid 
IOTHUB_MESSAGE_HANDLEif the message was successfully created orNULLin case an error occurs. 
| MOCKABLE_FUNCTION | ( | void | , | 
| IoTHubMessage_Destroy | , | ||
| IOTHUB_MESSAGE_HANDLE | , | ||
| iotHubMessageHandle | |||
| ) | 
Frees all resources associated with the given message handle.
- Parameters:
 - 
  
iotHubMessageHandle Handle to the message.  
Generated on Wed Jul 13 2022 07:19:04 by
 1.7.2