Microsoft OPC Publisher
Перейти к файлу
Erich Barnstedt 440f0eda6c Fix namespace and tracing. 2017-06-21 08:51:09 +02:00
src Fix namespace and tracing. 2017-06-21 08:51:09 +02:00
.gitattributes Fix line endings (#23) 2017-03-13 10:15:07 +01:00
.gitignore Now using official GW packages. 2017-05-08 22:38:22 +02:00
.travis.yml Framework SDK bug fixing. 2017-06-06 15:05:57 +02:00
Dockerfile Upgrade to VS2017 and simplify runtime dependencies loading. 2017-06-08 15:13:26 +02:00
License.txt Create License.txt 2017-06-08 15:48:42 +02:00
Opc.Ua.Publisher.Module.sln Make module naming consitent with other module, add default app name in command line arguments. 2017-06-20 10:11:33 +02:00
README.md Update README.md 2017-06-19 21:09:37 +02:00
appveyor.yml Fix CI files. 2017-04-20 13:15:27 +02:00

README.md

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments

OPC Publisher Module for Azure IoT Edge

This reference implementation demonstrates how Azure IoT Edge can be used to connect to existing OPC UA servers and publishes JSON encoded telemetry data from these servers in OPC UA "Pub/Sub" format (using a JSON payload) to Azure IoT Hub. All transport protocols supported by Azure IoT Edge can be used, i.e. HTTPS, AMQP and MQTT. The transport is selected in the transport setting in the gatewayconfig.json file.

This module, apart from including an OPC UA client for connecting to existing OPC UA servers you have on your network, also includes an OPC UA server on port 62222 that can be used to manage the module.

This module uses the OPC Foundations's OPC UA reference stack and therefore licensing restrictions apply. Visit http://opcfoundation.github.io/UA-.NETStandardLibrary/ for OPC UA documentation and licensing terms.

Branch Status
master Build status Build Status

Directory Structure

/src

This folder contains the source code of the module, a managed gateway loader and a library to handle IoT Hub credentials.

Building the Module

This module requires the .NET Core SDK V1.1. You can build the module from Visual Studio 2017 by opening the solution file, right clicking the GatewayApp.NetCore project and selecting "publish".

Configuring the Module

The OPC UA nodes whose values should be published to Azure IoT Hub can be configured by creating a "publishednodes.json" file. This file is auto-generated and persisted by the module automatically when using the Publisher's OPC UA server interface from a client. If you want to create the file manually, below is a sample publishednodes.json file:

[
  {
    "EndpointUrl": "opc.tcp://myopcservername:51210/UA/SampleServer",
    "NodeId": { "Identifier": "ns=1;i=123" }
  }
  {
    "EndpointUrl": "opc.tcp:// myopcservername:51210/UA/SampleServer",
    "NodeId": { "Identifier": "ns=2;i=456" }
  }
]

Configuring the Gateway

The Configuration Section must contain at a minimum all items shown in the provide file. The JSON type conforms to the OPC UA reference stack serialization of the ApplicationConfiguration type.

You should pass your application name and the IoT Hub owner connection string (which can be read out for your IoT Hub from portal.azure.com) as command line arguments. The IoT Hub owner connection string is only required for device registration with IoT Hub on first run.

Running the module

You can run the module through the supplied gateway app GatewayApp.NetCore on Windows along with the Gateway SDK and IoT Hub module directly via Visual Studio 2017 by hitting F5 (after publishing GatewayApp.NetCore). Don't forget your command line arguments!

You can also run the module in a Docker container using the Dockerfile provided. From the root of the repo, in a console, type:

docker build -t gw .

On first run, for one-time IoT Hub registration:

docker run -it --rm gw <applicationName> <IoTHubOwnerConnectionString>

From then on:

docker run -it --rm gw <applicationName>