Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

Add back the capability to send each telemetry value with a separated message #863

Open
PezzoniL opened this issue Dec 4, 2019 · 1 comment
Assignees
Labels
Milestone

Comments

@PezzoniL
Copy link

PezzoniL commented Dec 4, 2019

In the actual vscode plugin version, If a interface contains more than one telemetry value (like could be for example a combo Temperature and Humidity sensor):
{
"@type": "Telemetry",
"name": "hts221_temp_value",
"displayName": "HTS221 Temp Value",
"comment": "HTS221 Temperature Value",
"schema": "double",
"unit": "Units/Temperature/celsius"
},
{
"@type": "Telemetry",
"name": "hts221_hum_value",
"displayName": "HTS221 Hum Value",
"comment": "HTS221 Humidity Value",
"schema": "double",
"unit": "Units/Humidity/percent"
},

The plugin creates for it a single API for reporting all the telemetries with a single message using a single function ( *******_Telemetry_SendAll(void) ) like for example:

DIGITALTWIN_CLIENT_RESULT Temp_humInterface_Telemetry_SendAll();

The previous plugin versions have also the APIs for sending each telemetry value with a separate message
In my case:
DIGITALTWIN_CLIENT_RESULT Temp_humInterface_Telemetry_SendHts221_temp_value();
DIGITALTWIN_CLIENT_RESULT Temp_humInterface_Telemetry_SendHts221_hum_value();

Could be good to add back this possibility in order to provide more flexibility to the user.
Thanks a lot
Luca

@dooriya dooriya self-assigned this Dec 5, 2019
@dooriya dooriya added the Feature label Dec 5, 2019
@dooriya dooriya added this to the Backlog milestone Dec 5, 2019
@dooriya
Copy link
Member

dooriya commented Dec 5, 2019

Thank you @PezzoniL for the feedback.

As you said, since 0.10.17, In PnP generated project, all telemetries defined in a interface will be sent to Azure IoT Hub in a single send, to reduce the message count sending to the cloud, which may cause the "Message Explosion" issue.

And CodeGen no longer generates separate functions for sending each telemetry, since they became unused code piece in the generated project.

If developer still wants to send each telemetry value with a separated message, he can add his own implementation for this, as the generated xxxTelemetry_SendAll() does. From this point of view, the CodeGen tool still has flexibility for a customization.

Note: you need to compose the JSON payload for each message, e.g. {"temperature": 16} before sending to cloud.

The last point we want to make clear is that PnP CodeGen only generates skeleton code, to help device developer easy connect to Azure IoT with IoT Plug and Play feature, without knowing much more details on the complicated integration with Azure IoT Device C SDK.

We will put this into our backlog and discuss the justification with the IoT platform / E2E team for this.

Thanks,
Dooriya

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants