Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
633 views
in Technique[技术] by (71.8m points)

azure iot hub - Get list of direct methods registered with IotHub device

I am working on one sample IoT project. Where 1 IoT device is registered on IotHub. It is exposing 1 direct method to control device temperature. On, device startup it is registering callback on IoTHub to listen for method invocation requests.

As per my understanding and knowledge, there is no way on cloud side that we can know that particular device is exposing this many direct methods and what is name of that method. (Because of MQTT/AMQP use internally).

Still, to be sure of if there is any work around to get direct methods registered by end device. Is there any SDK function or REST API to get list of direct methods registered by end-device.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You're correct in assuming there is no built-in support that lists the direct methods of your device. A device doesn't publish what methods it has implemented by default.

Options:

IoT PnP

Microsoft created IoT Plug and play, which focuses on "device models". When a Plug and Play device connects to the IoT Hub, it can make its device model known. Part of this model is the concept of "commands", which translates to a direct method for IoT Hub. Your device probably doesn't have this device model yet, as PnP is pretty new. A device manufacturer/developer can integrate this model into the device.

Create your own index command

If you are the one writing code for this device, and you don't want to do PnP, you could create a direct method that lists all the methods supported by your device. Of course, you would need to know the name of that direct method to call it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

63 comments

56.6k users

...