Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

Allow a device to receive messages before sending telemetry. #321

Merged
merged 1 commit into from
Jun 27, 2017

Conversation

darobs
Copy link
Contributor

@darobs darobs commented Jun 26, 2017

A device may not ever send telemetry, or send telemetry rarely, but the user might still need to have that device receive messages from the cloud. The iothub module doesn't know about devices until it is sent a message about the device, so I added the ability to send a registration message to the iothub module.
The message has no telemetry, and does not send a d2c message, but the IoTHub device is created, and can receive messages.

Registration message is recognized by these properties:

PropertyName Description
deviceName The device ID registered with IoT Hub
deviceKey The device key registered with IoT Hub
deviceFunction "register"

As an example, Simulated device will send a register message.

@@ -113,7 +113,7 @@ function(findAndInstall libraryName version submoduleRootDirectory cmakeRootDire
#If the library directory doesn't exist, pull submodules
if(NOT EXISTS "${cmakeRootDirectory}/CMakeLists.txt")
execute_process(
COMMAND git submodule update --init ${submoduleRootDirectory}
COMMAND git submodule update --init --recursive ${submoduleRootDirectory}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting. Which of our dependencies require recursive clone now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iot-sdk-c - it pulls in c-shared code for unit tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that's a new dependency. I recall that Andrew did something special in the unit test case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to build the E2E tests to get the iothub_test library, and the E2E tests are pulling c files from c-shared. This is probably an issue we need to resolve, so I just posted #323

@@ -22,6 +22,16 @@ The IotHub module dynamically creates per-device instances of IoTHubClient. It c
IoTHubClient. Note that the AMQP and HTTP transports will share one TCP connection for all devices; the MQTT transport will create a new
TCP connection for each device.

#### Device registration

In some circumstances, a device may not want to send telemetry but receive cloud to device messages. WHen a device wants to connect to the IoTHub but but send a telemetry message, it may send a message with the following properties:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Minor fixes:

In some circumstances, a device may not want to send telemetry but receive cloud to device messages. When a device wants to connect to the IoTHub and wishes to signal that it is expecting to receive cloud-to-device messages, it may send a message with the following properties:

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's better - I'll make that change.

@darobs darobs force-pushed the receive_c2d_before_send branch from deb62af to 0f28cc4 Compare June 26, 2017 23:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants