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 
70 #define IOTHUB_CLIENT_PROPERTY_REPORTED_STRUCT_VERSION_1 1
71 
76 typedef struct IOTHUB_CLIENT_PROPERTY_REPORTED_TAG {
80  const char* name;
82  const char* value;
84 
86 #define IOTHUB_CLIENT_PROPERTY_WRITABLE_RESPONSE_STRUCT_VERSION_1 1
87 
91 typedef struct IOTHUB_CLIENT_PROPERTY_WRITABLE_RESPONSE_TAG {
95  const char* name;
97  const char* value;
99  int result;
105  const char* description;
107 
112 typedef enum { IOTHUB_CLIENT_PROPERTY_TYPE_REPORTED_FROM_CLIENT, IOTHUB_CLIENT_PROPERTY_TYPE_WRITABLE } IOTHUB_CLIENT_PROPERTY_TYPE;
113 /* @brief Enumeration that indicates whether the JSON value of a deserialized property
114 * is a null-terminated string or binary. Currently only STRING values are supported.
115 */
116 typedef enum { IOTHUB_CLIENT_PROPERTY_VALUE_STRING } IOTHUB_CLIENT_PROPERTY_TYPE;
118 #define IOTHUB_CLIENT_PROPERTY_PARSED_STRUCT_VERSION_1 1
119 
122 typedef struct IOTHUB_CLIENT_PROPERTY_PARSED_TAG {
129  const char* componentName;
131  const char* name;
136  IOTHUB_CLIENT_PROPERTY_VALUE_TYPE valueType;
138  union {
139  const char* str;
140  } value;
143  size_t valueLength;
145 
169  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);
199  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);
206  void IoTHubClient_Properties_Serializer_Destroy( unsigned char* serializedProperties);
210 typedef struct IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_TAG* IOTHUB_CLIENT_PROPERTIES_DESERIALIZER_HANDLE;
211 
230  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);
275 #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:33
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:93
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:210
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:112
This struct represents a property from IoT Hub. It is generated by IoTHubClient_Deserialize_Propert...
Definition: iothub_client_properties.h:122
size_t valueLength
Number of bytes in valueLength. Does not include null-terminator if IOTHUB_CLIENT_PROPERTY_VALUE_STRI...
Definition: iothub_client_properties.h:143
IOTHUB_CLIENT_PROPERTY_VALUE_TYPE valueType
Whether the value is passed as a string or non-null terminated length.
Definition: iothub_client_properties.h:136
const char * componentName
Name of the component. Optional; may be NULL for the root component.
Definition: iothub_client_properties.h:129
const char * name
Name of the property.
Definition: iothub_client_properties.h:131
int structVersion
Version of the structure. Currently must be IOTHUB_CLIENT_PROPERTY_PARSED_STRUCT_VERSION_1.
Definition: iothub_client_properties.h:124
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:127
This struct defines properties reported from the client. This corresponds to what DTDLv2 calls a "rea...
Definition: iothub_client_properties.h:76
const char * name
Name of the property.
Definition: iothub_client_properties.h:80
int structVersion
Version of the structure. Currently must be IOTHUB_CLIENT_PROPERTY_REPORTED_STRUCT_VERSION_1.
Definition: iothub_client_properties.h:78
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:82
This struct represents the response to a writable property that the client will return....
Definition: iothub_client_properties.h:91
const char * name
Name of the property.
Definition: iothub_client_properties.h:95
int result
Result of the requested operation. This maps to an HTTP status code.
Definition: iothub_client_properties.h:99
int ackVersion
Acknowledgement version. This corresponds to the version of the writable properties being responded t...
Definition: iothub_client_properties.h:103
int structVersion
Version of the structure. Currently must be IOTHUB_CLIENT_PROPERTY_WRITABLE_RESPONSE_STRUCT_VERSION_1...
Definition: iothub_client_properties.h:93
const char * description
Optional friendly description of the operation. May be NULL.
Definition: iothub_client_properties.h:105
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:97