Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 50cb275

Browse files
cdvindhyaryanwinter
andauthored
Correctly identify telemetry as a component (#339)
* Correctly identify telemetry as a component * guard against empty component when sending telemetry Co-authored-by: Ryan Winter <ryanwinter@outlook.com>
1 parent c76cf31 commit 50cb275

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

‎shared/src/azure_iot_nx_client.c‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,18 @@ UINT azure_iot_nx_client_publish_telemetry(AZURE_IOT_NX_CONTEXT* context_ptr,
651651
printf("Error: nx_azure_iot_hub_client_telemetry_message_create failed (0x%08x)\r\n", status);
652652
}
653653

654+
if (component_name_ptr != NX_NULL)
655+
{
656+
printf("appending component name: %s\r\n", component_name_ptr);
657+
if ((status = nx_azure_iot_hub_client_telemetry_component_set(
658+
packet_ptr, (UCHAR*)component_name_ptr, strlen(component_name_ptr), NX_WAIT_FOREVER)))
659+
{
660+
printf("Error: nx_azure_iot_hub_client_telemetry_component_set failed (0x%08x)\r\n", status);
661+
nx_azure_iot_hub_client_telemetry_message_delete(packet_ptr);
662+
return status;
663+
}
664+
}
665+
654666
if ((status = nx_azure_iot_json_writer_with_buffer_init(&json_writer, telemetry_buffer, sizeof(telemetry_buffer))))
655667
{
656668
printf("Error: Failed to initialize json writer (0x%08x)\r\n", status);
@@ -659,12 +671,7 @@ UINT azure_iot_nx_client_publish_telemetry(AZURE_IOT_NX_CONTEXT* context_ptr,
659671
}
660672

661673
if ((status = nx_azure_iot_json_writer_append_begin_object(&json_writer)) ||
662-
(component_name_ptr != NX_NULL &&
663-
(status = nx_azure_iot_hub_client_reported_properties_component_begin(
664-
&context_ptr->iothub_client, &json_writer, (UCHAR*)component_name_ptr, strlen(component_name_ptr)))) ||
665674
(status = append_properties(&json_writer)) ||
666-
(component_name_ptr != NX_NULL && (status = nx_azure_iot_hub_client_reported_properties_component_end(
667-
&context_ptr->iothub_client, &json_writer))) ||
668675
(status = nx_azure_iot_json_writer_append_end_object(&json_writer)))
669676
{
670677
printf("Error: Failed to build telemetry (0x%08x)\r\n", status);

‎shared/src/sntp_client.c‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212

1313
#include "networking.h"
1414

15-
#define SNTP_THREAD_STACK_SIZE 1024
16-
#define SNTP_THREAD_PRIORITY 9
17-
1815
#define SNTP_UPDATE_EVENT 1
1916

2017
// Time to wait for each server poll

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /