IOT

The 1Vision365 IoT Application contains functionality to allow you to send signals from IoT (Internet of Things) devices via Azure IoT Hub to your Business Central solution.

All signals received through a generic web service will initially be stored in a IoT Event Hub table for further processing by additional code. a PTE (Per Tenant Extension) can subscribe to these received events and handle the data.

The way to consume the received signals is to build an implementation on our IoT Device Provider Interface

interface "1VIS IoT Device Provider"
{
  procedure HandleIoTHubEvent(IotDeviceId: Text[80]; var JsonMessage: JsonObject)
}
Example:
codeunit 50000 "PTE IoT Device Provider" implements "1VIS IoT Device Provider"
{
    procedure HandleIoTHubEvent(IotDeviceId: Text[80]; var JsonMessage: JsonObject)
    var
        TagIdNotFoundError: Label 'Property %1 not found in JSON object';
TagId: Label 'SOMETAG';
    begin
        if JsonMessage.Contains(TagId) then
            <DO SOME CODE WITH THE OBJECT>
        else
            Error(TagIdNotFoundError, TagId);
    end;
}

In order for the application to use the correct interface implementation, you need to extend the Iot Device Type Enum and tell that to use the new implementation

enumextension 50000 "PTE IoT Device Type" extends "1VIS IoT Device Type"
{
    value(50000; "MyDeviceType")
    {
        Caption = 'My own IoT Device';
        Implementation = "1VIS IoT Device Provider" = "PTE IoT Device Provider";
    }
}

When setting up the IoT Device in Business Central, you’ll assign the newly created Device Type to that device and as such, when signals are received for this device, they will be handled through your interface implementation.