Skip to content
A set of projects examining refactoring the Azure IoTHub SDK Device Streaming Echo esample as a .Net Core and as a UWP reusable library.
C#
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
AzDeviceStreaming
AzIoTHubModues
AzureConnections
DNCore_DeviceApp
DNCore_ServiceApp
Sensors
UWP_BGAppAzDeviceStreamSvc2
UWP_BGAppAzDeviceStream_Device
UWP_Console_DeviceApp
UWP_Console_SvcApp
UWP_Xaml_App
common
device-streams-echo
images
.gitignore
AziothubDeviceStreams.sln
LICENSE
README.md

README.md

Azure IoT Hub Device Streaming

In the previous version of this repository, some issues were raised wrt refactoring of the Azure IoTHub SDK Device Streaming Echo sample functionality as .Net Core and UWP reusable libraries. These issues have been resolved and the library is now presented as a .Net Standard library that can be used in .Net Core, UWP and Xamarin apps (last yet to be tested). The library implements the device and service functionality of IoT Hub Device Streaming that can be used in UWP and other types apps.

My blog on this: AziothubDeviceStreaming Lib
Link to the previous version of the repository

We have a solution!

The main problem, as discussed previously, was that the developed Device Streaming library, regardless of the SDK .Net Framework used (UWP, .Net Core or .Net Standard), did not support the AMQP transport (Device-IoTHub) when used with a UWP app. It was determined that the Nuget installation of Microsoft.Azure.Device.Client (Device Streaming requires the latest preview version) implicitly installed an earlier version of Microsoft.Azure.Ampq 2.3.7, whereas version 2.4.2 was required. This was resolved by explicitly installing Microsoft.Azure.Amqp version (2.4.2) using Nuget.

Background

Azure IoT Hub Device Streaming, although in Preview, is a cool technology. It enables an IoT device app to receive messages from an app on another system (the service: for example a user app) and for device to respond by sending back a message to the service. An Azure IoT Hub acts as the intermediary in the communications. No modules are needed to be installed in the hub. The functionality is implemented by calls to the IoT Hub SDK by both the device and service apps.

I’ve developed a GitHub C# Library project for UWP Sockets: djaus2/SocketsUWP. With THIS new repository, I am attempting to use Azure IoTHub as the conduit in new library that mimics the socket stream functionality.

Whereas the previous version of the repository, implemented all three types of .Net libraries, the new version only implements the .Net Standard version as this can be used universally. The various types of test apps remain in the repository. The UWP app have been significantly extended to test some added features of the library:

  • The original communications were single shot. The service create a socket send a message waits for a reply then closes the socket. The device listens for a connection, create a socket, reads teh message, processes it and sends it back. It then closes its socket. Whilst this is the default behaviour with the new version of the library, there is a Keep Alive option that keeps the sockets open at both ends, subject to timeout, until closed. This option is dictated by the Service end.
  • The original device processing required a response to be sent back. For this repository the received message was uppercased. (The SDK Echo Sample app just sent back the received message). This is now optional, and is dictated by the Service end.
  • Whilst not 100% debugged, there is now an option to cancel the socket at either end.

Overall,the object here is to to create a conceptually high level library that encapsulates the Azure IoTHub Device Streaming functionality which is simple to use, but contains inbuilt extensibility (read options) that can be exploited in host apps without reconstruction of the library. ...
Read more of my blog

You can’t perform that action at this time.