This gives a paragraph summary of the service vs device sdk:
https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-devguide-sdks
Hi, I have two repositories or projects I'm working on, one is using the Azure Iot Hub Service SDK (documentation API for java here: https://docs.microsoft.com/en-us/java/api/com.microsoft.azure.sdk.iot.service?view=azure-java-stable), which makes it very easy to get the DeviceTwin desired properties. I just need a DeviceTwinDevice
object and then I call getDesiredProperties()
on it. This all comes from the dependency:
compile group: 'com.microsoft.azure.sdk.iot', name: 'iot-service-client', version: '1.16.0'
Now, I am working on another repo, where I have to read a specific property from the Device twin, but that project is using the Azure Iot Hub Device SDK (documentation API for Java here: https://docs.microsoft.com/en-us/java/api/com.microsoft.azure.sdk.iot.device?view=azure-java-stable), and it works a little different. It looks like they use a DeviceClient
object to connect the Iot hub and such. I don't see any methods for retrieving the desired properties for the DeviceTwin other than a getDeviceTwin()
method, but it is a void method and returns nothing? The dependency for this is
compile(group: 'com.microsoft.azure.sdk.iot', name: 'iot-device-client', version: '1.19.1')
For those of you who haven't seen these "properties" before, it's just JSON located on the Azure Portal website:
Is there an easy way to grab these properties with the device sdk or must I drag the dependency in Gradle for the service sdk and do it that way? It seems redundant. Please help!