GithubHelp home page GithubHelp logo

azure / iot-plug-and-play-bridge Goto Github PK

View Code? Open in Web Editor NEW
60.0 25.0 27.0 4.82 MB

IoT Plug and Play bridge

License: Other

Batchfile 0.87% C 72.48% C++ 19.44% CMake 2.67% HTML 3.69% Shell 0.85%
iot-device azure-iot peripherals

iot-plug-and-play-bridge's Introduction

⚠️ Note: Thank you for your interest in the IoT Plug and Play bridge, due to the changing needs of our customers and partners, evolving technology landscape, and innovations in Azure IoT, we have come to the decision to deprecate the IoT Plug and Play bridge. The repo will be marked as read-only repository on November 30th 2023. Thank you to everyone who contributed bug fixes and new adapters for connecting devices with IoT Plug and Play and thanks to your support on this journey. Developers looking to connect their device can continue to use the Azure IoT Device SDKs directly. You can find the latest IoT innovations at https://azure.microsoft.com/solutions/iot/. Please note that any use of archived repositories introduces more risks from a security standpoint and code from this repository should no longer be used as is.

IoT Plug and Play bridge

Introduction

IoT Plug and Play bridge is the open source effort from Microsoft that connects the PC sensor and peripheral ecosystem to Azure. It builds on top of IoT Plug and Play so that with minimal to no code, developers can easily connect peripherals/sensors to Azure, remotely access their data, monitor them, and manage them. This allows developers to perform analytics and gain valuable insights on their IoT devices from either the edge or the cloud. The IoT Plug and Play bridge accomplishes this without requiring peripherals to have direct Azure connectivity, enabling them to use a Windows or Linux host as a gateway to Azure instead. Because of this, it is particularly well suited for connecting existing/constrained sensors to Azure.

IoT Plug and Play bridge can be deployed as a standalone executable on any IoT device, industrial PC, server, or gateway running Windows 10 or Linux. It can also be compiled into your application code. A simple configuration file tells the IoT Plug and Play bridge which sensors and peripherals should be exposed up to Azure. Once configured, the IoT Plug and Play bridge uses the Azure IoT Hub Device C SDK to create a single device client handle, corresponding to a top level interface with specific model ID (DTMI) and supported IoT Plug and Play (PnP) components as specified in the model,for the specified sensors and peripherals up to Azure.

IoT Plug and Play bridge can also be deployed as an IoT edge module running on any IoT edge device from an edge runtime running Linux. When the IoT Plug and Play bridge starts running as an edge module, it creates a single module client handle, corresponding to a top level interface with specific model ID (DTMI). Plug and Play Bridge adapter and IoT Plug and Play (PnP) components are not created until a property update for component and adapter related configuration (same as the JSON payload in the configuration file for IoT device) is received by the module. The JSON payload for the configuration, which tells the IoT Plug and Play bridge which sensors and peripherals should be exposed up to Azure, must be sent from the cloud to the module in the form of a desired property update for PnpBridgeConfig. The Plug and Play bridge will wait for this property update from the module twin to begin adapter and component configuration. Once configured, the IoT Plug and Play bridge uses the Azure IoT Hub Module C SDK to begin device <-> cloud communication corresponding to the sensors and peripherals configured.

Developers can then use existing Azure services and solution accelerators to receive data from and send commands to their sensors and peripherals.

Get Started - Documentation

To get started with a simple example and learn about IoT Plug and Play bridge, view the How to connect an IoT Plug and Play bridge to IoT Hub. Follow Build and deploy the IoT Plug and Play bridge and Extend the IoT Plug and Play bridge to get started on building, deploying and extending the IoT Plug and Play bridge.

Peripherals and sensors supported by default

IoT Plug and Play bridge supports the following types of peripherals by default. Developers can extend the IoT Plug and Play bridge to support additional peripherals via the instructions in the Extend the IoT Plug and Play bridge.

✔️ feature available ➕ feature planned but not supported ➖ no support planned N/A - Not Applicable

Peripheral (with Link to Adaptor Documentation) Windows Linux
Bluetooth LE ✔️
Cameras [1] ✔️
Modbus ✔️ ✔️
MQTT ✔️ ✔️
Serial [2] ✔️ ✔️
Windows USB peripherals ✔️ N/A

[1] All cameras supported by Windows OS (Webcam, MIPI cameras and IP of RGB/IR/Depth cameras). To enable full support of ONVIF cameras, it is recomended to use 20H1 or later builds.

[2] For peripherals controlled by MCUs that are accessed over serial ports:

  • Refer to the SerialPnP documentation for information on how such devices should self-describe their interfaces to the IoT Plug and Play bridge

Pre-Requisites

OS Platform

The following OS platforms and versions are supported:

Platform Supported Versions
Windows 10 All Windows SKUs are supported. For example:
  • IoT Enterprise
  • Server
  • Desktop
  • IoT Core

  • For Camera health monitoring functionality, 20H1 or later build is recommended. All other functionality is available on all Windows 10 builds.
    Linux Tested and Supported on Ubuntu 18.04, functionality on other distributions has not been tested.

    Hardware

    • Any hardware platform capable of supporting the above OS SKUs and versions.
    • Serial, USB, Bluetooth, and Camera peripherals and sensors are supported natively. The IoT Plug and Play Bridge can be extended to support any custom peripheral or sensor (see peripherals section above).

    Development Environment

    Azure IoT Products and Tools

    Note: IoT Plug and Play support is not included in basic-tier IoT Hubs.

    IoT Plug and Play bridge Architecture

    Architecture

    Contributing

    We encourage community members to write and contribute their own IoT Plug and Play bridge adaptors. This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

    Microsoft collects performance and usage information which may be used to provide and improve Microsoft products and services and enhance your experience. To learn more, review the privacy statement.

    Contributing Code

    We require pull-requests for code and documentation to be submitted against the master branch in order to review and run it in our gated build system. We try to maintain a high bar for code quality and maintainability, we request having tests associated with the code, and if necessary, additions/modifications to the requirement documents.

    Please ensure you review and sign the Contribution License Agreement (CLA). A friendly bot will remind you about it when you submit your pull-request. :)

    Support

    For any questions, you can contact - [email protected]. Found a bug? Please help us fix it by thoroughly documenting it and filing an issue on GitHub.

    iot-plug-and-play-bridge's People

    Contributors

    ajbarb avatar alscarpan avatar anthony-msft avatar benpyeh avatar dipannita-shaw avatar dipannita08 avatar dominicbetts avatar kartben avatar meiwill avatar sangchoe avatar shyamal-v avatar usivagna avatar

    Stargazers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    Watchers

     avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

    iot-plug-and-play-bridge's Issues

    404 on https://github.com/Azure/iot-plug-and-play-bridge/tree/master/serialpnp/STM32Example and where is az iot pnp?

    Describe the bug
    The link to setup az iot pnp is a 404

    To Reproduce
    Steps to reproduce the behavior:

    1. Go to https://github.com/Azure/iot-plug-and-play-bridge/tree/master/serialpnp/STM32Example
    2. Click on instruction in the line: Follow the instruction here to setup Azure Pnp CLI (Nb should be instructions)
    3. You get a a 404
    4. See error

    Expected behavior
    Get those instructions :(

    Additional context
    Ps: How do you run az iot pnp anyway??
    There is no az iot pnp at https://docs.microsoft.com/en-us/cli/azure/iot?view=azure-cli-latest

    Zigbee Protocol Support

    While popular in the home automation space, Zigbee remains a popular wireless protocol.
    Are there plans to support ZigBee protocols and/or Discovery of Zigbee gateways or endpoint devices?

    Thanks,
    ~Bryan

    [Feature request]: PnP - Dynamic Telemetry for Modbus (or any other model)

    @usivagna, @rido-min
    Make the Modbus Properties a Map to setup the configuration

    image

    and make the Telemetry to use the "Key" as the filed name

    {"VoltAN":123.2}

    Note: VoltAN is the name of the field and it is dynamically plugged into the telemetry.
    IoT Central will need some flag to understand that this field comes from the configuration, maybe something like this:
    {"DKey":"VoltAN", "DValue":123.2} and the tool understands that it needs to flatten the JSON.

    Here is the DTDLv2 model that describes the properties

    {
      "@context": "dtmi:dtdl:context;2",
      "@id": "dtmi:MeshSystems:tXs_modbus;2",
      "@type": "Interface",
      "displayName": {
        "en": "Modbus"
      },
      "contents": [
        {
          "@type": "Property",
          "displayName": {
            "en": "BaudRate"
          },
          "name": "BaudRate",
          "schema": "integer",
          "writable": true
        },
        {
          "@type": "Property",
          "displayName": {
            "en": "Operation"
          },
          "name": "Operation",
          "writable": true,
          "schema": {
            "@type": "Map",
            "mapKey": {
              "name": "Key",
              "schema": "string"
            },
            "mapValue": {
              "name": "Value",
              "schema": "dtmi:MeshSystems:tXs_modbusOperation;1"
            }
          }
        }
      ],
      "schemas": [
        {
          "@id": "dtmi:MeshSystems:tXs_modbusOperation;1",
          "@type": "Object",
          "fields": [
            {
              "name": "UnitId",
              "schema": "integer"
            },
            {
              "name": "RegisterType",
              "schema": {
                "@type": "Enum",
                "valueSchema": "integer",
                "enumValues": [
                  {
                    "@type": "EnumValue",
                    "enumValue": 1,
                    "name": "READ_COILS"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 2,
                    "name": "READ_DISCRETE_INPUTS"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 3,
                    "name": "READ_HOLDING_REGISTERS"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 4,
                    "name": "READ_INPUT_REGISTERS"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 5,
                    "name": "WRITE_SINGLE_COIL"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 6,
                    "name": "WRITE_SINGLE_REGISTER"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 7,
                    "name": "READ_EXCEPTION_STATUS"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 15,
                    "name": "WRITE_MULTIPLE_COILS"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 16,
                    "name": "WRITE_MULTIPLE_REGISTERS"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 17,
                    "name": "REPORT_SLAVE_ID"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 22,
                    "name": "MASK_WRITE_REGISTER"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 23,
                    "name": "WRITE_AND_READ_REGISTERS"
                  }
                ]
              }
            },
            {
              "name": "PollingIntervalMs",
              "schema": "integer"
            },
            {
              "name": "StartAddress",
              "schema": "integer"
            },
            {
              "name": "DataType",
              "schema": {
                "@type": "Enum",
                "valueSchema": "integer",
                "enumValues": [
                  {
                    "@type": "EnumValue",
                    "enumValue": 1,
                    "name": "MB_int16"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 2,
                    "name": "MB_bcd32"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 3,
                    "name": "MB_logBase2"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 4,
                    "name": "MB_float32"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 5,
                    "name": "MB_float32swap"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 7,
                    "name": "MB_int32"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 11,
                    "name": "MB_uint16"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 12,
                    "name": "MB_bcd16"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 13,
                    "name": "MB_int64"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 15,
                    "name": "MB_uint64"
                  },
                  {
                    "@type": "EnumValue",
                    "enumValue": 16,
                    "name": "MB_double64"
                  }
                ]
              }
            }
          ]
        }
      ]
    }
    

    [Question] - How to use the single DeviceId from IotHub perspective for multiple devices reporting different telemetry

    • Do I understand correctly that at this phase the bridge can is made to report only telemetry for single device as it is deporting to single Device Id from IotHub perspective. Is it correct?
    • Is there any plan to support multiple device reporting telemetry through it and have mapping of telemetry to specific device Id in IotHub?

    Thank you for your work guys, looks promising! This could be good enabler of mass migration for existing device that cannot be rewritten to support Azure Iot. Keep it up

    Should this be public?

    The front page README says:

    "Access to this pre-release software is confidential and should not be disclosed or shared with other parties per your NDA with Microsoft."

    Does that mean that this repo should not be public? Or, has there been a change to this?

    Thanks,
    Max

    More issues with the Arduino Serial example

    Following on from the closed issue Getting Arduino Example to work .. Specifying the COM Port #66

    I've created a public repository just for the Arduino Serial sample : djaus2/ArduinoSerialPnPExample

    I can't get the modeling to work.
    The overall aim there is to implement a PnP component that handles the Grove Beginner Kit for Arduino functionality.

    Currently:

    • Implements temperature measurement with Grove BME280 Sensor.
    • Implements some properties and commands but can't get these to work from Azure IoT Explorer.

    Q What needs to change with the config.json and the Schema files to get this all to work properly when exercised from Azure IoT Explorer?:

    • Actioning commands.
    • Setting propoerties

    Can't get PnP Modelled Telemetry when can set Properties and action commands [BUG]

    Describe the bug
    In Azure IoT Explorer on the IoT Plug and Play Components tab, Telemetry doesn't show any results. Telemetry does though work from the menu on left. Properties(Writeable) and Commands both on the IoT Plug and Play components tab do work as well. Using the Arduino Serial Sample.

    So the question is how to get the modeled schema for Telemetry working in Azure IoT Explorer?

    To Reproduce
    Steps to reproduce the behavior:
    1.Build or download the PnPBridge_bin app (on Windowsx64)
    2. build and deploy the Arduino Serial Sample to an Arduino Uno connected to teh dev machine via USB
    3. Get the config.json and set the correct Com Port and Hub-Device connection string.
    4.Run the app .\PnPBridge_bin .\config.json.'
    5. Run the Azure IoT Explorer and connect the Hub-Device
    6. Go to the Telemetry lab (left menu) and run it.
    7. Go to the IoT Plug and Play components tab
    8. Configure the schema file to be local and point to folder where you have it on the dev machine
    9. Choose Default Component, then check the Interface, which should match the schema.
    10. Choose Telemetry from that tab, and run it
    11. Select Show modeled events

    Expected behavior
    In 6. should see telemetry
    In 10. Should see telemetry similar to 6.
    In11. Should see the modeled data.

    Screenshots
    In 6.:

    {
      "body": {
        "temperature": 12.34
      },
      "enqueuedTime": "Fri Sep 10 2021 13:27:13 GMT+1000 (Australian Eastern Standard Time)",
      "properties": {}
    }
    

    Output on bridge app:

    Info: Starting Azure PnpBridge
    Info: Pnp Bridge is running as an IoT Egde device.
    Info: Pnp Bridge creation succeeded.
    Info: Connection_type is [connection_string]
    Info: Tracing is disabled
    Info: IoT Edge Device configuration initialized successfully
    Info: Building Pnp Bridge Adapter Manager, Adapters & Components
    Info: Pnp Adapter with adapter ID serial-pnp-interface has been created. 
    Info: Pnp Adapter Manager created successfully.
    Info: Opening com port COM4
    Info: Pnp components created successfully.
    Info: Pnp components built in model successfully.
    Info: Sent reset request
    Info: Receieved reset response
    Info: Sent descriptor request
    Info: Connected to Azure IoT Hub
    Info: Receieved descriptor response, of length 348
    Info: Device Version : 1
    Info: Device Name    : Example Thermometer
    Info: Interface ID : http://contoso.com/thermometer_example
    Info:   Property type : 3
    Info:   Name : temperature
    Info:   Display Name : Ambient Temperature
    Info:   Description : A sample of the ambient temperature.
    Info:   Unit : celsius
    Info:   Property type : 2
    Info:   Name : sample_rate
    Info:   Display Name : Sample Rate
    Info:   Description : Sample Rate of temperature measurements
    Info:   Unit : ms
    Info:   Property type : 1
    Info:   Name : calibrate
    Info:   Display Name : Calibrate Temperature
    Info:   Description : Calibrates the thermometer
    Info:   Property type : 1
    Info:   Name : toggle_state
    Info:   Display Name : Toggle State
    Info:   Description : Pauses/Unpauses the Telemetry
    Info: Pnp components started successfully.
    Info: Processing property update for the device or module twin
    Info: Received PnP property update for component=serialpnp, property=sample_rate
    Info: Serial Pnp Adapter: Processed property. PropertyUpdated = 3333
    Info: Setting property sample_rate to 3333
    Info: Serial Pnp Adapter: Sending device information property to IoTHub. propertyName=sample_rate, propertyValue=3333
    Info: Serial Pnp Adapter: Got Property Update Notification. propertyName=sample_rate
    Info: temperature: 12.340000
    Info: PnpBridge_PnpBridgeStateTelemetryCallback called, result=0, telemetry=PnpBridge configuration complete
    Info: SerialDataSendEventCallback called, result=0, telemetry=temperature
    Info: temperature: 12.340000
    Info: SerialDataSendEventCallback called, result=0, telemetry=temperature
    Info: temperature: 12.340000
    Info: SerialDataSendEventCallback called, result=0, telemetry=temperature
    Info: temperature: 12.340000
    Info: SerialDataSendEventCallback called, result=0, telemetry=temperature
    Info: temperature: 12.340000
    

    Nb: I am actually using a fork of the the bridge at djaus2/iot-plug-and-play-bridge that has enabled the Property Updates and Commands to work with the Arduino device when exercised from IoT Explorer. But this problem exists as well with the unforked bridge with the Arduino device and teh following config and schema files.

    Desktop (please complete the following information):

    • Windows 10
    • Version 21H1 Build 19043.1165
    • Could not see a version for Azure IoT Explorer (preview) but is latest (as of a week ago) version.
    • Copy of the config.json file See below
    • Copy of PnP interface json See below

    Additional context
    Running built app in iot-plug-and-play-bridge\pnpbridge\cmake\pnpbridge_x86\src\pnpbridge\samples\console\Debug

    config.json is location there:

    {
        
        "$schema": "../../../../../../../../../iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/src/pnpbridge_config_schema.json",
        "pnp_bridge_connection_parameters": 
        {
            "connection_type" : "connection_string",
            "connection_string" : "HostName=HubPnP3.azure-devices.net;DeviceId=PnPDev3",
            "root_interface_model_id": "dtmi:com:contoso:serialpnp;1",
            "auth_parameters": 
            {
                "auth_type": "symmetric_key",
                "symmetric_key": "q+6OU6byhvpT9zU3Mbr6KhR8Ur47zEa/EFyM8fEHHMU="
            }
        },
        "pnp_bridge_debug_trace": false,
        "pnp_bridge_config_source": "local",
        "_comment_devices": "Array of devices for Azure Pnp interface should be published",
        "pnp_bridge_interface_components": 
        [
            {
                "_comment": "Grove Beginner Kit for Arduino Sensors and Actuators Device Component",
                "pnp_bridge_component_name": "serialpnp",
                "pnp_bridge_adapter_id": "serial-pnp-interface",
                "pnp_bridge_adapter_config": 
                {
                    "com_port": "COM4",
                    "_comment": "NOTE: com_port parameter will NOT be used when use_com_device_interface is set to true. In case of windows iot edition, the COMXX symbolic links are not created. Setting use_com_device_interface to false will pick the first available COM interface.",
                    "use_com_device_interface": "false",
                    "baud_rate": "115200"
                }
            }
        ],
        "pnp_bridge_adapter_global_configs": 
        {
            "serial-pnp-interface": {
                "DjAus" : {
                    "company_id": "0x499",
                    "endianness": "big",
                    "telemetry": {
                        "temperature":
                        {
                            "name": "temperature",
                            "telemetry_name": "temperature",
                            "displayName":"Temperature",
                            "data_parse_type": "decimal",
                            "conversion_bias": 0,
                            "conversion_coefficient": 1.0
                        }
                    },
                    "properties": {
                        "sample_rate": {
                            "name": "sample_rate",
                            "displayName":"Sample Rate",
                            "dataType": "integer",
                            "required": true
                        }
                    },
                    "commands": {
                        "calibrate": {
                            "commandType": "synchronous",
                            "request":
                            {
                                "dataType": "integer"
                            },
                            "response":
                            {
                                "dataType": "integer"
                            },
                            "toggle_state": {
                                "commandType": "synchronous",
                                "request":
                                {
                                    "dataType": "integer"
                                },
                                "response":
                                {
                                    "dataType": "integer"
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    

    the schema file **arduino-serial-grove.json locally:

    
    {
        "@context": "dtmi:dtdl:context;2",
        "@id": "dtmi:com:contoso:serialpnp;1",
        "@type": "Interface",
        "displayName": "Pnp Bridge Root Interface Model serialpnp",
        "description": "Arduino Serial PnP",
        "contents": [
          {
              "@type": "Property",
              "displayName": "Sample Rate",
              "description": "Rate of temperature readings.",
              "name": "sample_rate",
              "schema": "integer",
              "writable": true
          },
          {
              "@type": [
                "Telemetry",
                "Temperature"
              ],
              "description": "Current temperature on the device",
              "displayName": "Temperature",
              "name": "temperature",
              "schema": "float",
              "unit": "degreeCelsius"
          }  ,
          {
            "@type": "Command",
            "name": "calibrate",
            "description": "Calibrates the thermometer.",
            "commandType": "synchronous",
            "request": {
                "name": "input",
                "schema": "integer"
            },
            "response": {
              "name": "calibrateResponse",
              "schema": "integer"
            }  
          },
          {
            "@type": "Command",
            "name": "toggle_state",
            "description": "Calibrates the thermometer.",
            "commandType": "synchronous",
            "request": {
                "name": "input",
                "schema": "integer"
            },
            "response": {
              "name": "calibrateResponse",
              "schema": "integer"
            }  
          }
        ]
    
    }
    

    Problems with PropertyUpdate and Commands

    Describe the bug
    With the Arduino Serial Sample, the PropertyUpdate and Commands, when exercised from Azure IoTExplorer do not work. There is some code that uses a NULL for the component in both cases which means the Callbacks to the device don't get actioned by the Bridge.

    To Reproduce
    Steps to reproduce the behavior:

    1. Build the Bridge
    2. Create and IoTHub and configure a config.json and schema for it
    3. Build and deploy the Arduino Serial Sample'
    4. Run the Bridge using the using the config.json
    5. Run AzureIoTExplorer and connect to the Hub
    6. Set schema to the local schema file.

    Expected behavior
    In AzureIOTHub expect to action Properties and Commands and see messages in Bridge Console saying its happened, and impacted upon the Arduino App. Examples when it works:

    PropertyUpdate:

    Info: Processing property update for the device or module twin
    Info: Received PnP property update for component=serialpnp, property=sample_rate
    Info: Serial Pnp Adapter: Processed property. PropertyUpdated = 3000
    Info: Setting property sample_rate to 3000
    Info: Serial Pnp Adapter: Sending device information property to IoTHub. propertyName=sample_rate, propertyValue=3000
    Info: Serial Pnp Adapter: Got Property Update Notification. propertyName=sample_rate
    

    Command

    Info: Number of components in model=1. Using first: serialpnp
    Info: Received PnP command for component=serialpnp, command=calibrate
    Info: Invoking command calibrate to 3
    Info: Command was processed.
    

    Outcome with existing code
    Both don't happen.

    Desktop (please complete the following information):

    • OS: [Windows (19043.1165]

    • Copy of the config.json file Both after Additional Comment

    • Copy of PnP interface json

    Additional context
    As discussed in More issues with the Arduino Serial example #74

    • Getting Arduino Serial to work
    • Issues with Property Update and Commands
    • In both cases you get a NULL component and so the action is not taken.
      • With PropertyUpdate, a NULL is hard coded when it can be gleaned for ComponentsInModel parameters
        • In pnp_protocol.c VisitDesiredObject( ) calls
          • // If the child element is NOT an object OR its not a model the application knows about, this is a property of the model's root component.
          • // Invoke the application's passed in callback for it to process this property.
          • pnpPropertyCallback(NULL ,name, value, version, userContextCallback) in pnpadapter_manager.c
        • Also it only supports update of a string component
        • Both of these are resolved in my Pull Request today
        • Also added some code for // Got a property update
      • With Commands
        • In pnpadapter_manager.c
        • In PnpAdapterManager_DeviceMethodCallback( )
        • PnP_ParseCommandName(methodName, (const unsigned char**) (&componentName), &componentNameSize, &pnpCommandName);
          • Returns a NULL componentName
        • So componentHandle->processCommand doesn't get called.
        • Can get components from g_PnpBridge->PnpMgr->ComponentsInModel

    In both cases the index for the string array ComponentsInModel used,is zero. Zero is "arbitrary" (but a good guess, there should be at least one), particularly with Commands
    Also the comment "its not a model the application knows about, this is a property of the model's root component" needs resolution.

    • As stated above, the solution for Properties has been Pushed
    • The solution for Commands, as above is in my clone of the repository, djaus2/iot-plug-and-play-bridge

    config.json

    {
        
        "$schema": "../../iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/src/pnpbridge_config_schema.json",
        "pnp_bridge_connection_parameters": 
        {
            "connection_type" : "connection_string",
            "connection_string" : "HostName=HubPnP2.azure-devices.net;DeviceId=PnPDev2",
            "root_interface_model_id": "dtmi:com:contoso:serialpnp;1",
            "auth_parameters": 
            {
                "auth_type": "symmetric_key",
                "symmetric_key": "Aw6w8ax677Ovgp4FXDaxcEiLJfVsbAjR+cvudt/oKqE="
            }
        },
        "pnp_bridge_debug_trace": false,
        "pnp_bridge_config_source": "local",
        "_comment_devices": "Array of devices for Azure Pnp interface should be published",
        "pnp_bridge_interface_components": 
        [
            {
                "_comment": "Grove Beginner Kit for Arduino Sensors and Actuators Device Component",
                "pnp_bridge_component_name": "serialpnp",
                "pnp_bridge_adapter_id": "serial-pnp-interface",
                "pnp_bridge_adapter_config": 
                {
                    "com_port": "COM4",
                    "_comment": "NOTE: com_port parameter will NOT be used when use_com_device_interface is set to true. In case of windows iot edition, the COMXX symbolic links are not created. Setting use_com_device_interface to false will pick the first available COM interface.",
                    "use_com_device_interface": "false",
                    "baud_rate": "115200"
                }
            }
        ],
        "pnp_bridge_adapter_global_configs": 
        {
            "serial-pnp-interface": {
                "DjAus" : {
                    "company_id": "0x499",
                    "endianness": "big",
                    "telemetry_descriptor": [
                        {
                            "telemetry_name": "temperature",
                            "displayName":"Temperature",
                            "data_parse_type": "decimal",
                            "conversion_bias": 0,
                            "conversion_coefficient": 1.0
                        }
                    ],
                    "properties": {
                        "sample_rate": {
                            "name": "sample_rate",
                            "displayName":"Sample Rate",
                            "dataType": "integer",
                            "required": true
                        }
                    },
                    "commands": {
                        "calibrate": {
                            "commandType": "synchronous",
                            "request":
                            {
                                "dataType": "integer"
                            },
                            "response":
                            {
                                "dataType": "integer"
                            }
                        },
                        "toggle_state": {
                            "commandType": "synchronous",
                            "request":
                            {
                                "dataType": "integer"
                            },
                            "response":
                            {
                                "dataType": "integer"
                            }
                        }
                    }
                }
            }
        }
    }
    

    Schema.json

    
    {
      "@context": "dtmi:dtdl:context;2",
      "@id": "dtmi:com:contoso:serialpnp;1",
      "@type": "Interface",
      "displayName": "Pnp Bridge Root Interface Model serialpnp",
      "description": "Arduino Serial PnP",
      "comment": "Serial PnP for Arduino",
      
      "contents": [
        {
          "@type": "Property",
          "displayName": "Sample Rate",
          "description": "Rate of temperature readings.",
          "name": "sample_rate",
          "schema": "integer",
          "writable": true
        },
        {
          "@type": [
          "Telemetry",
          "Temperature"
          ],
          "description": "Current temperature on the device",
          "displayName": "Temperature",
          "name": "temperature",
          "schema": "float",
          "unit": "degreeCelsius"
        },
        {
          "@type": "Command",
          "name": "calibrate",
          "description": "Calibrates the thermometer.",
          "commandType": "synchronous",
          "request": {
              "name": "input",
              "schema": "integer"
          },
          "response": {
            "name": "calibrateResponse",
            "schema": "integer"
          }  
        },
        {
          "@type": "Command",
          "name": "toggle_state",
          "comment": "Enable-disable sampling.",
          "commandType": "synchronous" ,
          "request": {
            "name": "input",
            "schema": "integer"
          },
          "response": {
            "name": "output",
            "schema": "integer"
          }  
        }
      ]
    
    }
    

    A Samll Typo

    Describe the bug
    Need to edit 3rd debug message at startup.

    To Reproduce
    Steps to reproduce the behavior:

    1. Run Bridge
    2. Observe 3rd debug line of outpout

    Expected behavior
    Pnp Bridge is running as am IoT egde device.
    should be;
    Pnp Bridge is running as an IoT Edge device.

    Screenshots
    PS C:\Temp\pnp> .\pnp

    Info:
    -- Press Ctrl+C to stop PnpBridge

    Info: Using default configuration location
    Info: Starting Azure PnpBridge
    Info: Pnp Bridge is running as am IoT egde device.

    NO_LOGGING = ON flag in build.sh script not structured

    Describe the bug
    When I set the flag "no_logging=ON" in build.sh and I run it, I got the error, see screenshot below.

    error in log:
    /usr/bin/ld: CMakeFiles/pnpbridge_bin.dir/main.c.o: in function main': main.c:(.text+0x43): undefined reference to xlogging_get_log_function'
    /usr/bin/ld: main.c:(.text+0xe6): undefined reference to xlogging_get_log_function' /usr/bin/ld: main.c:(.text+0x169): undefined reference to xlogging_get_log_function'
    /usr/bin/ld: ../../libpnpbridge.a(pnpbridge.c.o): in function PnpBridge_InitializePnpDeviceConfig': pnpbridge.c:(.text+0x191): undefined reference to xlogging_get_log_function'
    /usr/bin/ld: pnpbridge.c:(.text+0x286): undefined reference to xlogging_get_log_function' /usr/bin/ld: ../../libpnpbridge.a(pnpbridge.c.o):pnpbridge.c:(.text+0x37b): more undefined references to xlogging_get_log_function' follow
    collect2: error: ld returned 1 exit status
    make[2]: *** [src/pnpbridge/samples/console/CMakeFiles/pnpbridge_bin.dir/build.make:125: src/pnpbridge/samples/console/pnpbridge_bin] Error 1
    make[1]: *** [CMakeFiles/Makefile2:2483: src/pnpbridge/samples/console/CMakeFiles/pnpbridge_bin.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    /usr/bin/ld: CMakeFiles/pnpbridge_module.dir/main.c.o: in function main': main.c:(.text+0xd): undefined reference to xlogging_get_log_function'
    /usr/bin/ld: CMakeFiles/pnpbridge_module.dir/__/src/configuration_parser.c.o: in function PnpBridgeConfig_GetConnectionDetails': configuration_parser.c:(.text+0x4c): undefined reference to xlogging_get_log_function'
    /usr/bin/ld: configuration_parser.c:(.text+0xc3): undefined reference to xlogging_get_log_function' /usr/bin/ld: configuration_parser.c:(.text+0x1a7): undefined reference to xlogging_get_log_function'
    /usr/bin/ld: configuration_parser.c:(.text+0x20e): undefined reference to xlogging_get_log_function' /usr/bin/ld: CMakeFiles/pnpbridge_module.dir/__/src/configuration_parser.c.o:configuration_parser.c:(.text+0x297): more undefined references to xlogging_get_log_function' follow
    collect2: error: ld returned 1 exit status
    make[2]: *** [src/pnpbridge/module/CMakeFiles/pnpbridge_module.dir/build.make:262: src/pnpbridge/module/pnpbridge_module] Error 1
    make[1]: *** [CMakeFiles/Makefile2:2532: src/pnpbridge/module/CMakeFiles/pnpbridge_module.dir/all] Error 2
    make: *** [Makefile:141: all] Error 2

    Screenshots
    image

    Desktop (please complete the following information):

    • OS: Ubuntu 20.04

    Takephoto command takes too many photos

    With the pnpbridge as is, the takephoto command takes multiple photos. Moreover, in the Azure CLI, timeout errors and retries attempts can be seen. The PnpBridge might not be handling timeouts gracefully.

    BLE for Linux

    I'm looking forward to have the PnP bridge available as a Azure IoT Edge module as already planned. But it would really useful to have the BLE bridge available for linux as it is a very popular scenario, don't you think too? Is there a specific reason why it's not yet planned to support it?

    [BUG]DPS with IoT Central supported?

    Describe the bug
    Tried DPS but failed with unauthorized. Looks this code doesn't include changes in IoT Central side.

    To Reproduce
    Steps to reproduce the behavior:

    1. Create device
    2. Set dps and other configuration
    3. Run

    Expected behavior
    DPS succeed

    Screenshots
    If applicable, add screenshots to help explain your problem.

    Desktop (please complete the following information):

    • OS: [e.g. Ubuntu 18.04, or Windows (Version 2004)]
    • Version [e.g. 22]
    • Copy of the config.json file
    • Copy of PnP interface json

    Additional context
    Add any other context about the problem here.

    Freeze after 'Sent reset request'

    I tried to run pnpbridge_bin and arduino using serial with IoTC.
    Arduino not response when SERIALPNP_PACKET_TYPE_RESET_REQUEST received.

    What should I look for?

    pnpbridge_bin:

    <- 12:11:40 PUBLISH | IS_DUP: false | RETAIN: 0 | QOS: DELIVER_AT_LEAST_ONCE = 0x01 | TOPIC_NAME: $dps/registrations/res/200/?$rid=3 | PACKET_ID: 2 | PAYLOAD_LEN: 467
    Info: Provisioning callback indicates success.  iothubUri=iotc-0289d4d3-9c48-461b-a803-3943e1e85247.azure-devices.net, deviceId=29bc3v3nkdz
    -> 12:11:40 DISCONNECT
    Info: DPS successfully registered.  Continuing on to creation of IoTHub device client handle.
    Info: ***** Successfully created device device=<29bc3v3nkdz> via provisioning *****
    Info: Connected to Azure IoT Hub
    Info: Opening com port COM1
    Info: Sent reset request
    

    serial monitor:
    image
    image
    image

    [Question] why build the releases in debug mode ?

    Enter your question here:
    I was wondering if you could also provide a release build of the bridge ? Since now it looks like a debug build so i will have to install VS C++ , since else it will miss the VCRUNTIME140D.dll

    please correct me if i am wrong.
    michel

    PnP Bridge command data will receive the request data but has mojibake

    [Robert Chung] Just tried the Telemetry, Property, and Command function, and there is no problem but Command. When I send the command payload to the Arduino device, the PnP Bridge will receive the request data but has mojibake, like: “\”15\”yyyy~!y”. Here is my request command:
    az iot pnp invoke-command --command-name "calibrate" --command-payload ""15"" --interface "http://robert.com/bridgeInterface/1.0.0" --hub-name "RobertTestHub" --device-id "TestDevice"

    OPC UA Support or Integration

    OPC UA is typically an industrial IoT gateway approach that Microsoft supports via IoT Hub.
    Is the IoT Plug and Play Gateway approach a parallel approach?
    Any integration layer there?
    Can your gateway become an MQTT subscriber for instance to “listen” to other gateways?

    Thank you in Advance,
    ~Bryan

    [Feature request]:callback function in adapter when a device is power up and gets configuration

    Is your feature request related to a problem? Please describe.
    I need a callback function in adapter when a device is power up and gets configuration from IoT hub/central. The configuration is all writable properties (desired property in device twin). Then the device automatically starts its sensor after configuring.

    Describe the solution you'd like
    When I ran the sample Environmental Sensor, there's a message "Info: PnpBridge_PnpBridgeStateTelemetryCallback called, result=0, telemetry=PnpBridge configuration complete" in the log. It looks like to notify the configuration complete. If it can generate a callback function in adapter, that should work.

    For example, there is a callback function code line in function "EnvironmentSensor_CreatePnpComponent" in file environmental_sensor_pnpbridge.c:
    PnpComponentHandleSetPropertyUpdateCallback(BridgeComponentHandle, EnvironmentSensor_ProcessPropertyUpdate);
    Can we have a callback function like that for "Configuration Complete"?

    Additional context
    Here is the log:

    Info: Using configuration from specified file path: model/config_hub_eddytest01.json
    Info: Starting Azure PnpBridge
    Info: Pnp Bridge is running as am IoT egde device.
    Info: Pnp Bridge creation succeeded.
    Info: Connection_type is [connection_string]
    Info: Tracing is disabled
    Info: WARNING: SharedAccessKey is included in connection string. Ignoring symmetric_key in config file.
    Info: IoT Edge Device configuration initialized successfully
    Info: Building Pnp Bridge Adapter Manager, Adapters & Components
    Info: Adapter with identity impinj-r420-pnp-adapter does not have any associated global parameters. Proceeding with adapter creation.
    Info: Pnp Adapter with adapter ID impinj-r420-pnp-adapter has been created.
    Info: Pnp Adapter Manager created successfully.
    Info: Pnp components created successfully.
    Info: Pnp components built in model successfully.
    Info: Connected to Azure IoT Hub
    Info: Starting Pnp Component
    Info: Adapter:: Sending device information property to IoTHub. propertyName=DeviceState, propertyValue="INITIAL"
    Info: Pnp components started successfully.
    Info: Processing property update for the device or module twin
    Info: Received PnP property update for component=ImpinjR420Component, property=ReaderName
    Info: Get property:: PropertyName= PropertyValue=
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:Reader01a
    Info: Received PnP property update for component=ImpinjR420Component, property=Antenna1
    Info: Get property value:1
    Info: Get property value:1.000000
    Info: Get property value:12.000000
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Received PnP property update for component=ImpinjR420Component, property=Session
    Info: Get property:: PropertyName= PropertyValue=<1.000000>
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:1.000000
    Info: Received PnP property update for component=ImpinjR420Component, property=SearchMode
    Info: Get property:: PropertyName= PropertyValue=<SINGLE_TARGET>
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:SINGLE_TARGET
    Info: Received PnP property update for component=ImpinjR420Component, property=RfMode
    Info: Get property:: PropertyName= PropertyValue=<3.000000>
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:3.000000
    Info: Received PnP property update for component=ImpinjR420Component, property=ReaderIp
    Info: Get property:: PropertyName= PropertyValue=<169.254.1.1>
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:169.254.1.1
    Info: Received PnP property update for component=ImpinjR420Component, property=SetClientId
    Info: Get property:: PropertyName= PropertyValue=<75.000000>
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:75.000000
    Info: Received PnP property update for component=ImpinjR420Component, property=UseKeepAlive
    Info: Get property:: PropertyName= PropertyValue=
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:1
    Info: Received PnP property update for component=ImpinjR420Component, property=KeepAliveInterval
    Info: Get property:: PropertyName= PropertyValue=<3000.000000>
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:3000.000000
    Info: Received PnP property update for component=ImpinjR420Component, property=UseGpiDoorControl
    Info: Get property:: PropertyName= PropertyValue=
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:1
    Info: Received PnP property update for component=ImpinjR420Component, property=GpiPhotoeye
    Info: Get property:: PropertyName= PropertyValue=<1.000000>
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:1.000000
    Info: PnpBridge_PnpBridgeStateTelemetryCallback called, result=0, telemetry=PnpBridge configuration complete
    Info: PropertyCallback called, result=204, property name=DeviceState
    Info: PropertyCallback called, result=204, property name=����erName
    Info: PropertyCallback called, result=204, property name=����nna1
    Info: PropertyCallback called, result=204, property name=����chMode
    Info: PropertyCallback called, result=204, property name=H{��ion
    Info: PropertyCallback called, result=204, property name=h{��de
    Info: PropertyCallback called, result=204, property name=H|��eepAlive
    Info: PropertyCallback called, result=204, property name=x{��erIp
    Info: PropertyCallback called, result=204, property name|��lientId
    Info: PropertyCallback called, result=204, property name=h|��AliveInterval
    Info: PropertyCallback called, result=204, property name=�|��piDoorControl
    Info: PropertyCallback called, result=204, property name=�{��hotoeye
    Info: Processing property update for the device or module twin
    Info: Received PnP property update for component=ImpinjR420Component, property=UseGpiDoorControl
    Info: Get property:: PropertyName= PropertyValue=
    Info: IoTHub client call to _SendReportedState succeeded
    Info: Get property value:0
    Info: PropertyCallback called, result=204, property name=����
    ^CError: Time:Tue Feb 9 13:58:20 2021 File:/home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/deps/azure-iot-sdk-c-pnp/c-utility/adapters/threadapi_pthreads.c Func:ThreadAPI_Join Line:97 (result = THREADAPI_INVALID_ARG (2))
    Info: Cleaning Pnp Bridge resources

    Terminal will be reused by tasks, press any key to close it.

    Certificate verify failed for embedded device

    I built the pnp bridge with toolchain for embedded device (RFID reader R420) by running build.sh script. Then I ran it on the device. I got error “certificate verify failed”. I had the same error before when I used Azure IoT SDK C. After I added the flag “-Duse_sample_trusted_cert:BOOL=on” in the build.sh script, it’s fixed. But I even added this flag that won’t fix it.

    To Reproduce
    Steps to reproduce the behavior:

    1. Download pnp bridge in https://github.com/Azure/iot-plug-and-play-bridge/tree/pnpbridgedev-surgere
    2. Follow the steps to install and setup in https://docs.microsoft.com/en-us/azure/iot-pnp/howto-use-iot-pnp-bridge
    3. Set the toolchainfile flag to a toolchain file for device reader
    4. Put the pnpbridge_bin console app to the device and run it
    5. Got error

    Error from log
    image

    ** Log **

    root@SpeedwayR-12-C8-A7:/cust/iot# ./pnpbridge_bin
    Info:
    -- Press Ctrl+C to stop PnpBridge

    Info: Using default configuration location
    Info: Starting Azure PnpBridge
    Info: Pnp Bridge is running as am IoT egde device.
    Info: Pnp Bridge creation succeeded.
    Info: Connection_type is [dps]
    Info: Tracing is disabled
    Info: IoT Edge Device configuration initialized successfully
    Info: Building Pnp Bridge Adapter Manager, Adapters & Components
    Info: Adapter with identity environment-sensor-sample-pnp-adapter does not have any associated global parameters. Proceeding with adapter creation.
    Info: Pnp Adapter with adapter ID environment-sensor-sample-pnp-adapter has been created.
    Info: Pnp Adapter Manager created successfully.
    Info: Pnp components created successfully.
    Info: Pnp components built in model successfully.
    Info: Eddy:PnP_CreateDeviceClientHandle
    Info: Initiating DPS client to retrieve IoT Hub connection information
    Error: Time:Fri Jan 15 21:19:53 2021 File:/home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/deps/azure-iot-sdk-c-pnp/c-utility/adapters/tlsio_openssl.c Func:send_handshake_bytes Line:674 error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

    ** Device : Speedyway R420 RFID reader**

    • OS: Linux
    • Cross-compiler

    Additional question
    I have another question. When I set these two flags prov_use_tpm_simulator and use_edge_modules to OFF in build.sh script file and built it, I got error.

    ** Screenshot for error **
    image

    ** Log from building **

    etk@f40df7f55477:~/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/scripts/linux$ ./build_linux32.sh
    ~/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/cmake/linux32 ~/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/scripts/linux
    -- The C compiler identification is GNU 9.3.0
    -- The CXX compiler identification is GNU 7.5.0
    -- Check for working C compiler: /usr/bin/cc
    -- Check for working C compiler: /usr/bin/cc -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Detecting C compile features
    -- Detecting C compile features - done
    -- Check for working CXX compiler: /usr/bin/c++
    -- Check for working CXX compiler: /usr/bin/c++ -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    -- Looking for include file stdint.h
    -- Looking for include file stdint.h - found
    -- Looking for include file stdbool.h
    -- Looking for include file stdbool.h - found
    -- target architecture: x86_64
    -- Performing Test CXX_FLAG_CXX11
    -- Performing Test CXX_FLAG_CXX11 - Success
    -- IoT Client SDK Version = 1.3.9
    -- Provisioning SDK Version = 1.3.9
    CMake Warning (dev) at deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeLists.txt:13 (option):
    Policy CMP0077 is not set: option() honors normal variables. Run "cmake
    --help-policy CMP0077" for policy details. Use the cmake_policy command to
    set the policy and suppress this warning.

    For compatibility with older versions of CMake, option is clearing the
    normal variable 'use_cppunittest'.
    

    This warning is for project developers. Use -Wno-dev to suppress it.

    -- target architecture: x86_64
    -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1f")
    -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
    -- Checking for module 'libcurl'
    -- Found libcurl, version 7.68.0
    -- Found CURL: curl
    -- target architecture: x86_64
    -- iothub architecture: x86_64
    -- Configuring done
    -- Generating done
    CMake Warning:
    Manually-specified variables were not used by the project:

      run_valgrind
      use_32bit
    

    -- Build files have been written to: /home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/cmake/linux32
    Initial MAKE_CORES=2
    VSPACE=5081628
    MAKE_CORES=2
    Starting run...
    Sat Jan 16 16:38:19 UTC 2021
    Scanning dependencies of target parson
    Scanning dependencies of target umock_c
    [ 0%] Building C object deps/azure-iot-sdk-c-pnp/CMakeFiles/parson.dir/deps/parson/parson.c.o
    [ 1%] Linking C static library libparson.a
    [ 1%] Built target parson
    Scanning dependencies of target aziotsharedutil
    [ 2%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umock_c.c.o
    [ 2%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umock_c_negative_tests.c.o
    [ 2%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umockalloc.c.o
    [ 3%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umockcall.c.o
    [ 3%] Building C object deps/azure-iot-sdk-c-pnp/deps/umock-c/CMakeFiles/umock_c.dir/src/umockcallrecorder.c.o
    ...
    ...
    [ 92%] Building C object deps/azure-iot-sdk-c-pnp/iothub_client/CMakeFiles/iothub_client.dir/src/iothub_client_ll_uploadtoblob.c.o
    [ 92%] Building C object deps/azure-iot-sdk-c-pnp/iothub_client/CMakeFiles/iothub_client.dir/src/blob.c.o
    [ 93%] Linking C static library libiothub_client.a
    [ 93%] Built target iothub_client
    Scanning dependencies of target pnpbridge
    [ 93%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/configuration_parser.c.o
    [ 93%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/iothub_comms.c.o
    [ 94%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/pnpadapter_manager.c.o
    [ 94%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/pnpbridge.c.o
    [ 94%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/utility.c.o
    [ 95%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/src/pnpadapter_api.c.o
    [ 95%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/common/pnp_device_client.c.o
    [ 95%] Building C object src/pnpbridge/CMakeFiles/pnpbridge.dir/common/pnp_dps.c.o
    /home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/common/pnp_device_client.c: In function 'AllocateModuleClientHandle':
    /home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/common/pnp_device_client.c:144:35: error: implicit declaration of function 'IoTHubModuleClient_CreateFromEnvironment'; did you mean 'IoTHubModuleClient_CreateFromConnectionString'? [-Werror=implicit-function-declaration]
    144 | if ((moduleClientHandle = IoTHubModuleClient_CreateFromEnvironment(MQTT_Protocol)) == NULL)
    | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    | IoTHubModuleClient_CreateFromConnectionString
    /home/etk/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/src/pnpbridge/common/pnp_device_client.c:144:33: error: assignment to 'IOTHUB_MODULE_CLIENT_HANDLE' {aka 'struct IOTHUB_CLIENT_CORE_INSTANCE_TAG *'} from 'int' makes pointer from integer without a cast [-Werror=int-conversion]
    144 | if ((moduleClientHandle = IoTHubModuleClient_CreateFromEnvironment(MQTT_Protocol)) == NULL)
    | ^
    cc1: all warnings being treated as errors
    make[2]: *** [src/pnpbridge/CMakeFiles/pnpbridge.dir/build.make:141: src/pnpbridge/CMakeFiles/pnpbridge.dir/common/pnp_device_client.c.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    make[1]: *** [CMakeFiles/Makefile2:2401: src/pnpbridge/CMakeFiles/pnpbridge.dir/all] Error 2
    make: *** [Makefile:141: all] Error 2
    etk@f40df7f55477:~/Projects/lib_sources/iot-plug-and-play-bridge/pnpbridge/scripts/linux$

    Getting Arduino Example to work .. Specifyimg the COM Port

    Enter your question here:
    Arduino sample builds and runs OK.. Can see telemetry in in Arduino Serial Monitor.
    Have created and conncted to Azure Iot Hub/Device.
    Bridge app conncts Ok

    My question is how to specify the Serial connection (in my case COM7) in config.json
    Is there as list somewhere of that part of config.json.
    OK can see for Bluetooth but want to use COM Port..

    This part:

      "pnp_bridge_config_source": "local",
      "_comment_devices": "Array of devices for Azure Pnp interface should be published",
      "pnp_bridge_interface_components": [
          {
              "_comment": "Environment Sensor Device Component",
              "pnp_bridge_component_name": "environmentalSensor",
              "pnp_bridge_adapter_id": "environment-sensor-sample-pnp-adapter",
              "pnp_bridge_adapter_config": {
                  "sensor_id": "10"
              }
          }
      ]```
    

    [BUG] Command not working when sending "true" to PnP Bridge

    Describe the bug

    Customer was testing IoT PnP bridge and trying to send commands with string containing boolean information to Modsim and real Modbus devices via PnP bridge, but only false/0 works, but true/1 does not work.

    Customer tested command on real Modbus device and the results are familiar with on Modsim.

    To sum up, pnpbridge.exe fails to set Modbus coil type to true, but it’s okay to set to false.

    To Reproduce

    Please refer to customer's testing process.

    **On Real Modbus device:

    Set 1 from IoT Central -> Failed**

    image

    Error message:

    image

    Info: Received PnP command for component=ModbusComponent, command=fan
    Error: Time:Wed Apr 7 00:47:34 2021 File:F:\b1\pnpbridge\src\adapters\src\modbus_pnp\ModbusConnection\ModbusConnection.c Func:ValidateModbusResponse Line:42 Modbus exception code: 0x3
    Error: Time:Wed Apr 7 00:47:34 2021 File:F:\b1\pnpbridge\src\adapters\src\modbus_pnp\ModbusConnection\ModbusConnection.c Func:ModbusPnp_WriteToCapability Line:598 Invalid response for command "fan".

    Set True from IoT Central -> Failed

    image

    No error message also no response.

    Set 0 from IoT Central -> Successful

    Before:

    image

    After:

    image

    Command was set immediately.

    Set false from IoT Central -> Successful

    Before:
    image

    After:

    image

    Command was set immediately.

    **On Modsim:

    Set 1 from IoT Central -> Failed**

    image

    No error message also no response.

    Set true from IoT Central -> Failed

    image

    No error message also no response.

    Set 0 from IoT Central -> Successful

    Before:

    image

    After:

    image

    Command was set immediately.

    Set false from IoT Central -> Successful

    Before:

    image

    After:

    image

    Command was set immediately.

    Expected behavior
    A clear and concise description of what you expected to happen.

    Screenshots
    If applicable, add screenshots to help explain your problem.

    Desktop (please complete the following information):

    • OS: [e.g. Ubuntu 18.04, or Windows (Version 2004)]
    • Version [e.g. 22]
    • Copy of the config.json file
    • Copy of PnP interface json

    Additional context
    Add any other context about the problem here.

    How to connect a weather station with azure IoT-Hub via pnp Bridge

    Hello,

    for the last few days I was wondering if I can connect a weather station off the shelf with the Azure IoT-Hub.
    I don't really want to hard code the connection.
    So is it possible to connect a weather station which is not programmable with a Plug and Play Bridge?
    Or is there another way to get the data into the IoT-Hub.

    The weather station can be connected via Wi-Fi to the internet.

    As you can see I dont really konw much in this area, so some help would be really good.

    Thank you very much.

    A Small Typo

    Describe the bug
    Need to edit 3rd debug message at startup.

    To Reproduce
    Steps to reproduce the behavior:

    1. Run Bridge
    2. Observe 3rd debug line of outpout

    Expected behavior
    Pnp Bridge is running as am IoT egde device.
    should be;
    Pnp Bridge is running as an IoT Edge device.

    Screenshots
    PS C:\Temp\pnp> .\pnp

    Info:
    -- Press Ctrl+C to stop PnpBridge

    Info: Using default configuration location
    Info: Starting Azure PnpBridge
    Info: Pnp Bridge is running as am IoT egde device.

    Recommend Projects

    • React photo React

      A declarative, efficient, and flexible JavaScript library for building user interfaces.

    • Vue.js photo Vue.js

      🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

    • Typescript photo Typescript

      TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

    • TensorFlow photo TensorFlow

      An Open Source Machine Learning Framework for Everyone

    • Django photo Django

      The Web framework for perfectionists with deadlines.

    • D3 photo D3

      Bring data to life with SVG, Canvas and HTML. 📊📈🎉

    Recommend Topics

    • javascript

      JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

    • web

      Some thing interesting about web. New door for the world.

    • server

      A server is a program made to process requests and deliver data to clients.

    • Machine learning

      Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

    • Game

      Some thing interesting about game, make everyone happy.

    Recommend Org

    • Facebook photo Facebook

      We are working to build community through open source technology. NB: members must have two-factor auth.

    • Microsoft photo Microsoft

      Open source projects and samples from Microsoft.

    • Google photo Google

      Google ❤️ Open Source for everyone.

    • D3 photo D3

      Data-Driven Documents codes.