#VSGALLERY – Connected Service for #AzureIoTHub, a great time saver !!!

Hi !

Another Visual Studio Extension’s Friday, now with almost a repost from Greg Duncan original post in Channel9. However, this extension allows you avoid plenty of configuration steps if you want to work with Azure Iot Hubs. You only need to focus on your app business needs: Send or receive data from the Azure IoT Hub.

So, a simple way to describe this is with a quick step-by-step

  • Install the extension from Visual Studio Gallery
  • Create a Console App
  • Add a new Connected Service

Clipboard02

  • Follow the wizard steps to connect to the correct Azure IoT Hub
  • Select “Azure IoT Hub” and click “Configure”

Clipboard04

  • You need to enter your Azure credentials, and the wizard will retrieve the list of available Azure IoT Hubs you have in your Azure subscription

Picture1

  • You must select the Azure IoT Hub, and connect to this Hub
  • After you connect to the Hub, the wizard will display the list of devices who are already defined and configured to use this device
  • You can select one device or create a new one. For the sample, I’ll go with my Device01 sample device

Clipboard07

  • So, now is time for code generation
  • A couple of NuGet packages will be added into the project

Clipboard09

  • After this, a couple of new items are included in our project.

Clipboard11

  • Maybe the most important is the AzureIotHub.cs class. This class has 2 main methods
    • SendDeviceToCloudMessageAsync(), to send messages to the IoT Hub
    • ReceiveCloudToDeviceMessageAsync(), to start listening to messages from the IoT Hub 
  • To send data, we only need to call the 1st method like this

Clipboard14

  • That’s it in terms of Hello World project. However there are some additional tasks to do.
  • First one will be to move away and secure the Azure IoT Hub connection string from the class to a more secure place. The wizard stores this information in a simple text constant. Which is good to test and debug, but not so good for a final release.
  • Next step will be probably, make some updates to the main 2 methods. As you can see in the next image, the send message method, send an static “Hello Cloud” message. I’m sure that your app will require some extra information here

Clipboard16

  • More detailed steps are included in the GitHub page

So, this will be my basic review of the extension, which is basically a time saver !!!

Greetings @ Toronto

-El Bruno

References

Advertisements

2 thoughts on “#VSGALLERY – Connected Service for #AzureIoTHub, a great time saver !!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s