1111#include "nx_api.h"
1212#include "nx_azure_iot_hub_client.h"
1313#include "nx_azure_iot_provisioning_client.h"
14+ #include "nx_azure_iot_json_reader.h"
1415
1516// These are sample files, user can build their own certificate and ciphersuites
1617#include "azure_iot_cert.h"
@@ -46,7 +47,7 @@ static void set_led_state(bool level)
4647}
4748
4849static void direct_method_cb (AZURE_IOT_NX_CONTEXT * nx_context ,
49- UCHAR * method ,
50+ const UCHAR * method ,
5051 USHORT method_length ,
5152 UCHAR * payload ,
5253 USHORT payload_length ,
@@ -84,15 +85,17 @@ static void device_twin_desired_property_cb(UCHAR* component_name,
8485 UINT component_name_len ,
8586 UCHAR * property_name ,
8687 UINT property_name_len ,
87- az_json_reader property_value_reader ,
88+ NX_AZURE_IOT_JSON_READER property_value_reader ,
8889 UINT version ,
8990 VOID * userContextCallback )
9091{
92+ UINT status ;
9193 AZURE_IOT_NX_CONTEXT * nx_context = (AZURE_IOT_NX_CONTEXT * )userContextCallback ;
9294
9395 if (strncmp ((CHAR * )property_name , TELEMETRY_INTERVAL_PROPERTY , property_name_len ) == 0 )
9496 {
95- if (az_succeeded (az_json_token_get_int32 (& property_value_reader .token , & telemetry_interval )))
97+ status = nx_azure_iot_json_reader_token_int32_get (& property_value_reader , & telemetry_interval );
98+ if (status == NX_AZURE_IOT_SUCCESS )
9699 {
97100 // Set a telemetry event so we pick up the change immediately
98101 tx_event_flags_set (& azure_iot_flags , TELEMETRY_INTERVAL_EVENT , TX_OR );
@@ -108,15 +111,17 @@ static void device_twin_property_cb(UCHAR* component_name,
108111 UINT component_name_len ,
109112 UCHAR * property_name ,
110113 UINT property_name_len ,
111- az_json_reader property_value_reader ,
114+ NX_AZURE_IOT_JSON_READER property_value_reader ,
112115 UINT version ,
113116 VOID * userContextCallback )
114117{
118+ UINT status ;
115119 AZURE_IOT_NX_CONTEXT * nx_context = (AZURE_IOT_NX_CONTEXT * )userContextCallback ;
116120
117121 if (strncmp ((CHAR * )property_name , TELEMETRY_INTERVAL_PROPERTY , property_name_len ) == 0 )
118122 {
119- if (az_succeeded (az_json_token_get_int32 (& property_value_reader .token , & telemetry_interval )))
123+ status = nx_azure_iot_json_reader_token_int32_get (& property_value_reader , & telemetry_interval );
124+ if (status == NX_AZURE_IOT_SUCCESS )
120125 {
121126 // Set a telemetry event so we pick up the change immediately
122127 tx_event_flags_set (& azure_iot_flags , TELEMETRY_INTERVAL_EVENT , TX_OR );
@@ -132,7 +137,7 @@ UINT azure_iot_nx_client_entry(
132137 NX_IP * ip_ptr , NX_PACKET_POOL * pool_ptr , NX_DNS * dns_ptr , UINT (* unix_time_callback )(ULONG * unix_time ))
133138{
134139 UINT status ;
135- ULONG events = 0 ;
140+ ULONG events = 0 ;
136141 int telemetry_state = 0 ;
137142 lps22hb_t lps22hb_data ;
138143 hts221_data_t hts221_data ;
@@ -222,7 +227,7 @@ UINT azure_iot_nx_client_entry(
222227 // Send the compensated humidity
223228 hts221_data = hts221_data_read ();
224229 azure_iot_nx_client_publish_float_telemetry (
225- & azure_iot_nx_client , "humidityPercentage " , hts221_data .humidity_perc );
230+ & azure_iot_nx_client , "humidity " , hts221_data .humidity_perc );
226231 break ;
227232
228233 case 3 :
0 commit comments