Azure IoT C SDK
iothub_client_properties.h
Go to the documentation of this file.
1 // Copyright (c) Microsoft. All rights reserved.
2 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3 
60 #ifndef IOTHUB_CLIENT_PROPERTIES_H
61 #define IOTHUB_CLIENT_PROPERTIES_H
62 
63 #include "umock_c/umock_c_prod.h"
64 
65 #include <stddef.h>
66 
68 
69 #ifdef __cplusplus
70 extern "C"
71 {
72 #endif
73 
75 #define IOTHUB_CLIENT_PROPERTY_REPORTED_STRUCT_VERSION_1 1
76 
81 typedef struct IOTHUB_CLIENT_PROPERTY_REPORTED_TAG {
85  const char* name;
87  const char* value;
89 
91 #define IOTHUB_CLIENT_PROPERTY_WRITABLE_RESPONSE_STRUCT_VERSION_1 1
92 
96 typedef struct IOTHUB_CLIENT_PROPERTY_WRITABLE_RESPONSE_TAG {
100  const char* name;
102  const char* value;
104  int result;
110  const char* description;
112 
117 typedef enum { IOTHUB_CLIENT_PROPERTY_TYPE_REPORTED_FROM_CLIENT, IOTHUB_CLIENT_PROPERTY_TYPE_WRITABLE } IOTHUB_CLIENT_PROPERTY_TYPE;
118 /* @brief Enumeration that indicates whether the JSON value of a deserialized property
119 * is a null-terminated string or binary. Currently only STRING values are supported.
120 */
121 typedef enum { IOTHUB_CLIENT_PROPERTY_VALUE_STRING } IOTHUB_CLIENT_PROPERTY_TYPE;
123 #define IOTHUB_CLIENT_PROPERTY_PARSED_STRUCT_VERSION_1 1
124 
127 typedef struct IOTHUB_CLIENT_PROPERTY_PARSED_TAG {
134  const char* componentName;
136  const char* name;
141  IOTHUB_CLIENT_PROPERTY_VALUE_TYPE valueType;
143  union {
144  const char* str;
145  } value;
148  size_t valueLength;
150 
174  IOTHUB_CLIENT_RESULT IoTHubClient_Properties_Serializer_CreateReported( const IOTHUB_CLIENT_PROPERTY_REPORTED* properties, size_t numProperties, const char* componentName, unsigned char** serializedProperties, size_t* serializedPropertiesLength);
204  IOTHUB_CLIENT_RESULT IoTHubClient_Properties_Serializer_CreateWritableResponse( const IOTHUB_CLIENT_PROPERTY_WRITABLE_RESPONSE* properties, size_t numProperties, const char* componentName, unsigned char** serializedProperties, size_t* serializedPropertiesLength);
211  void IoTHubClient_Properties_Serializer_Destroy( unsigned char* serializedProperties);
215 typedef struct IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_TAG* IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_HANDLE;
216 
235  IOTHUB_CLIENT_RESULT IoTHubClient_Properties_Deserializer_Create( IOTHUB_CLIENT_PROPERTY_PAYLOAD_TYPE payloadType, const unsigned char* payload, size_t payloadLength, IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_HANDLE* propertiesDeserializerHandle);
280 #ifdef __cplusplus
281 }
282 #endif
283 
284 #endif /* IOTHUB_CLIENT_PROPERTIES_H */
Shared enums, structures, and callback functions for IoT Hub client.
IOTHUB_CLIENT_RESULT
Enumeration specifying the status of calls to IoT Hub client.
Definition: iothub_client_core_common.h:42
IOTHUB_CLIENT_PROPERTY_PAYLOAD_TYPE
Enumeration passed to IoT Hub device and module client property update callbacks to indicate whether ...
Definition: iothub_client_core_common.h:155
struct IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_TAG * IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_HANDLE
Handle used during deserialization of IoT Plug and Play properties.
Definition: iothub_client_properties.h:215
IOTHUB_CLIENT_RESULT IoTHubClient_Properties_Serializer_CreateWritableResponse(const IOTHUB_CLIENT_PROPERTY_WRITABLE_RESPONSE *properties, size_t numProperties, const char *componentName, unsigned char **serializedProperties, size_t *serializedPropertiesLength)
Serializes the response to writable properties into bytes for sending to IoT Hub.
IOTHUB_CLIENT_RESULT IoTHubClient_Properties_Deserializer_GetNext(IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_HANDLE propertiesDeserializerHandle, IOTHUB_CLIENT_PROPERTY_PARSED *property, bool *propertySpecified)
Gets the next property during iteration.
IOTHUB_CLIENT_RESULT IoTHubClient_Properties_Deserializer_Create(IOTHUB_CLIENT_PROPERTY_PAYLOAD_TYPE payloadType, const unsigned char *payload, size_t payloadLength, IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_HANDLE *propertiesDeserializerHandle)
Setup a deserialization handle to parse through Plug and Play properties received from IoT Hub.
void IoTHubClient_Properties_DeserializerProperty_Destroy(IOTHUB_CLIENT_PROPERTY_PARSED *property)
Frees memory allocated by IoTHubClient_Properties_Deserializer_GetNext().
void IoTHubClient_Properties_Deserializer_Destroy(IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_HANDLE propertiesDeserializerHandle)
Frees memory allocated by IoTHubClient_Properties_Deserializer_Create().
IOTHUB_CLIENT_RESULT IoTHubClient_Properties_Deserializer_GetVersion(IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_HANDLE propertiesDeserializerHandle, int *propertiesVersion)
Retrieves the version associated with the properties payload.
void IoTHubClient_Properties_Serializer_Destroy(unsigned char *serializedProperties)
Frees serialized properties that were initially allocated with IoTHubClient_Properties_Serializer_Cre...
IOTHUB_CLIENT_RESULT IoTHubClient_Properties_Serializer_CreateReported(const IOTHUB_CLIENT_PROPERTY_REPORTED *properties, size_t numProperties, const char *componentName, unsigned char **serializedProperties, size_t *serializedPropertiesLength)
Serializes reported properties into the required format for sending to IoT Hub.
IOTHUB_CLIENT_PROPERTY_TYPE
Enumeration that indicates whether a given property from the service was originally reported from the...
Definition: iothub_client_properties.h:117
This struct represents a property from IoT Hub. It is generated by IoTHubClient_Deserialize_Propert...
Definition: iothub_client_properties.h:127
size_t valueLength
Number of bytes in valueLength. Does not include null-terminator if IOTHUB_CLIENT_PROPERTY_VALUE_STRI...
Definition: iothub_client_properties.h:148
IOTHUB_CLIENT_PROPERTY_VALUE_TYPE valueType
Whether the value is passed as a string or non-null terminated length.
Definition: iothub_client_properties.h:141
const char * componentName
Name of the component. Optional; may be NULL for the root component.
Definition: iothub_client_properties.h:134
const char * name
Name of the property.
Definition: iothub_client_properties.h:136
int structVersion
Version of the structure. Currently must be IOTHUB_CLIENT_PROPERTY_PARSED_STRUCT_VERSION_1.
Definition: iothub_client_properties.h:129
IOTHUB_CLIENT_PROPERTY_TYPE propertyType
Whether this is a property the client reported (and we're seeing what IoT Hub last received from the ...
Definition: iothub_client_properties.h:132
This struct defines properties reported from the client. This corresponds to what DTDLv2 calls a "rea...
Definition: iothub_client_properties.h:81
const char * name
Name of the property.
Definition: iothub_client_properties.h:85
int structVersion
Version of the structure. Currently must be IOTHUB_CLIENT_PROPERTY_REPORTED_STRUCT_VERSION_1.
Definition: iothub_client_properties.h:83
const char * value
Value of the property. This must be legal JSON. Strings need to be escaped by the application,...
Definition: iothub_client_properties.h:87
This struct represents the response to a writable property that the client will return....
Definition: iothub_client_properties.h:96
const char * name
Name of the property.
Definition: iothub_client_properties.h:100
int result
Result of the requested operation. This maps to an HTTP status code.
Definition: iothub_client_properties.h:104
int ackVersion
Acknowledgement version. This corresponds to the version of the writable properties being responded t...
Definition: iothub_client_properties.h:108
int structVersion
Version of the structure. Currently must be IOTHUB_CLIENT_PROPERTY_WRITABLE_RESPONSE_STRUCT_VERSION_1...
Definition: iothub_client_properties.h:98
const char * description
Optional friendly description of the operation. May be NULL.
Definition: iothub_client_properties.h:110
const char * value
Value of the property. This must be legal JSON. Strings need to be escaped by the application,...
Definition: iothub_client_properties.h:102