locked
Which API provide filter function with RegistryManager? RRS feed

  • Question

  • Hi,

        Which API provide filter function with RegistryManager ? I wish I could get the minimum and useful information from Azure Iot Hub. If I already register 100 devices, ten devices are on-line and others are off-line. I want to get some devices(connected) with RegistryManager. It seems that only one api(GetDevicesAsync) could do that. But the result from RegistryManager is not what I need.
    Tuesday, July 25, 2017 9:25 AM

All replies

  • Not quite sure what you are asking.  It seems that you can use the RegistryManager.GetDevicesAsync method to get your devices (multiple calls may be needed depending on how many devices you have).  This returns an Task<IEnumerable<Device>> and the Device class has a properties for Status and ConnectionState.  Do the Status and ConnectionState properties not contain the information you need?


    Gary A. Bushey

    Tuesday, July 25, 2017 10:42 AM
  • Hi Gary,
        Thanks for getting back to me, sorry I didn't make myself clear. The Status and ConnectionState properties contain the information that I need actually. In my scenario, it's easy to send messages to my devices and does not queue any message in azure iot hub service.

        So, basically what I'm saying is I must know which devices are enabled and truly connected before I send any messages. I don't know how to directly get the "connected information of device's status" from Azure iot hub. Any suggestion?
    Monday, July 31, 2017 9:50 AM
  • Hi @FitiV,

    - I do recommend to read an Understand identity registry in your IoT Hub about the connectionState field. Using this field is recommended for development and debugging purposes, only. 

    If your scenario uses all devices with a MQTT protocol, than easy way is just invoking a direct method on the device, otherwise another option is to use an operations monitoring feature of the Azure IoT Hub for real-time device connect/disconnect status. The following screen snippet shows an example of this solution:

    Thanks

    Roman



    • Edited by Roman Kiss Monday, July 31, 2017 12:48 PM
    Monday, July 31, 2017 12:48 PM