Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support getting and setting the module/device twin for Azure IoT Hub Service #82

Merged

Conversation

corollaries
Copy link
Contributor

This PR adds support for most twin related operations for the IoT Hub Service SDK.

Added

  • get_module_twin, get_device_twin, update_module_twin, replace_module_twin, update_device_twin, replace_device_twin functions to iothub::ServiceClient.
  • Structs/Enums for common types found in the module twin or device twin.
  • Examples for getting the device twin and updating the device twin.

Discussion

  • I've tried keeping DesiredTwinBuilder generic so it can be used for both updating module and device twins. As to hide some details for the user (mainly the return type of execute which returns the ModuleTwin when updating modules and DeviceTwin for updating the devices) I had to resort to using std::marker::PhantomData in the DesiredTwinBuilder. I'm not too sure about that in particular, but couldn't find another way of doing this neatly.

Copy link
Contributor

@MindFlavor MindFlavor left a comment

Choose a reason for hiding this comment

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

Excellent work! Thank you!

sdk/iothub/src/lib.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@rylev rylev left a comment

Choose a reason for hiding this comment

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

Looking good, but I have some questions before I'd be ready to merge this.

sdk/iothub/src/service/mod.rs Outdated Show resolved Hide resolved
sdk/iothub/src/service/mod.rs Outdated Show resolved Hide resolved
sdk/iothub/src/service/twin.rs Outdated Show resolved Hide resolved
sdk/iothub/src/service/twin.rs Show resolved Hide resolved
sdk/iothub/src/service/twin.rs Outdated Show resolved Hide resolved
@corollaries corollaries force-pushed the feature/corollaries/implement-twin branch from 38a9e29 to b214734 Compare November 16, 2020 19:02
@corollaries corollaries force-pushed the feature/corollaries/implement-twin branch from b214734 to 3715842 Compare November 16, 2020 19:04
Copy link
Contributor

@rylev rylev left a comment

Choose a reason for hiding this comment

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

Awesome stuff. I've noted a few nits that you might consider addressing, but we can also merge as is. 🎉

sdk/iothub/src/service/mod.rs Outdated Show resolved Hide resolved
sdk/iothub/src/service/twin.rs Show resolved Hide resolved
sdk/iothub/src/service/twin.rs Outdated Show resolved Hide resolved
sdk/iothub/src/service/twin.rs Show resolved Hide resolved
@MindFlavor MindFlavor merged commit 7d684b4 into Azure:master Nov 23, 2020
@corollaries corollaries deleted the feature/corollaries/implement-twin branch December 6, 2020 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants