Azure / iot-edge-v1

Azure IoT Edge
http://azure.github.io/iot-edge/
Other
524 stars 258 forks source link

Field Gateway protocol ingestion module to act as a TCP listener #32

Closed nominator closed 8 years ago

nominator commented 8 years ago

Hi,

I am new to Azure IoT. I am trying to figure out a way to connect existing telemetry devices with Azure IoT Hub. Field Gateway SDK seems to be the right place to start doing this, however, going through SDK's documentation I am not sure if it is possible to write a module that can connect to devices over the internet and communicate over TCP/UDP? The device I am planning to integrate is Teltonika FM1120 https://teltonika.lt/product/fm1120-internal-gps-antenna-with-battery/

This device uses custom tcp packets to send telemetry data over cellular network. I will really appreciate pointers in the right direction.

Thanks Nouman.

andrew-buckley commented 8 years ago

Hi @nominator, glad to see you're having a look at the Azure IoT Gateway SDK. I'm assuming this device is not capable of running any of the Azure IoT Device SDKs, correct? It only reports telemetry data to some endpoint over internet?

And your thought is to create a module that can listen to this device and report that data to your IoT Hub?

Just want to clarify.

Thanks, -Andrew

nominator commented 8 years ago

Hi Andrew, Yes you are absolutely correct. Thanks Nouman On Sep 8, 2016 4:31 AM, Andrew Buckley notifications@github.com wrote:Hi @nominator, glad to see you're having a look at the Azure IoT Gateway SDK. I'm assuming this device is not capable of running any of the Azure IoT Device SDKs, correct? It only reports telemetry data to some endpoint over internet?

And your thought is to create a module that can listen to this device and report that data to your IoT Hub?

Just want to clarify.

Thanks, -Andrew

—You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub, or mute the thread.

andrew-buckley commented 8 years ago

This seems like a great scenario for a gateway. You should be able to create a module that does the following:

  1. Connects and listens to the FM1120 device for telemetry data
  2. Upon receiving data, generates a new Message with all relevant data and publish this message onto the gateway. This message should have the mac address property set

Then your gateway should be configured with the following modules and configurations:

  1. An IoTHub module with a config containing your IoT Hub information.
  2. An Identity Map module with a config containing your devices mac address, device ID, and device key from your IoT Hub.
  3. Optionally a Logger module to log all messages.

We have a sample showing how to send simulated device data to an IoT Hub here. This will be helpful to see how to create and configure your own JSON configuration file.

And you can get started with the SDK by starting with this getting started doc.

nominator commented 8 years ago

Thanks Andrew for sharing the info. I have gone through all of this documentation already. I will be using windows 10 to develop the gateway in visual studio. I am an experienced developer but haven't done any socket programming (assuming this is required for a tcp listener) on windows or other platforms. so I was not sure if the gateway sdk has libraries to build a tcp listener or do I need some windows sdk for it? Also do I need to use ANSI C or I can use .net C# and .net framework sdk for it since this gayeway will be running on windows platform or Azure and not in a physical gateway device.

Thanks

andrew-buckley commented 8 years ago

We do not provide a library for TCP, but I believe there is a .NET TcpListener class that you might find helpful https://msdn.microsoft.com/en-us/library/system.net.sockets(v=vs.110).aspx.

You can write your module in any of the following languages:

nominator commented 8 years ago

Thats great. I think I have enough to get going. Thanks a lot Andrew.

andrew-buckley commented 8 years ago

Great! If/when you feel this issue is resolved, please close it when you're ready.