Inheco.SiLA2.Odtc.Features 0.9.2-BETA

This is a prerelease version of Inheco.SiLA2.Odtc.Features.
dotnet add package Inheco.SiLA2.Odtc.Features --version 0.9.2-BETA
NuGet\Install-Package Inheco.SiLA2.Odtc.Features -Version 0.9.2-BETA
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Inheco.SiLA2.Odtc.Features" Version="0.9.2-BETA" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Inheco.SiLA2.Odtc.Features --version 0.9.2-BETA
#r "nuget: Inheco.SiLA2.Odtc.Features, 0.9.2-BETA"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Inheco.SiLA2.Odtc.Features as a Cake Addin
#addin nuget:?package=Inheco.SiLA2.Odtc.Features&version=0.9.2-BETA&prerelease

// Install Inheco.SiLA2.Odtc.Features as a Cake Tool
#tool nuget:?package=Inheco.SiLA2.Odtc.Features&version=0.9.2-BETA&prerelease

##SiLA2 Implementation of SiLA commands for ODTC Device

This feature enables the integration of ODTC device in a SiLA2 standard conformed software solutions.

For an introduction about SiLA2 development with C# there is a SiLA2 reference implementation sila_csharp.

The service that implements this SiLA2 feature is called

SiLA2.Odtc.Features.Services.OdtcSiLA1Service

which is a SiLA2 conformed wrapper for existing ODTC SiLA1 commands (in a separate library Inheco.IhcPmsLib.Odtc).

The configuration of the service in a SiLA2 Server would follow the pattern described in the sila_csharp reference implementation with additional two lines for configuration of network and IP address of the ODTC device ("UseVpn" and "DeviceIp" in the code below):

"ServerConfig": {
    "Name": "SiLA2 ODTC Server",
    "UUID": "DBBACE72-0483-44D0-82B4-D589AE4A5FD3",
    "FQHN": "localhost", //IP or CIDR or Fully Qualified Host Name
    "Port": 7096,
    "NetworkInterface": "Ethernet",
    "DiscoveryServiceName": "_sila._tcp"
  },
  "CommandLifetimeInSeconds": 60,
  "ServerInfo": {
    "VendorURI": "https://sila2.gitlab.io/sila_base/",
    "Description": "SiLA2 Server cross-platform implementation for 
    .NET with web server Kestrel as Service Host. 
    Example server for ODTC feature functionality.",
    "Version": "7.3.1",
    "Type": "SiLA2OdtcServer"
  },
  "UseVpn": false,
  "DeviceIp": "xxx.xxx.xxx.xxx",
  "ConnectLockId": null,
  "CustomDeviceId": null

As a dependency, the SiLA2 feature needs an instance of IhcPmsLib.PMS. The Inheco.IhcPmsLib library is already referenced by this feature and it only needs to be included with a using statement.

using IhcPmsLib.Odtc;
using IhcPmsLib.Odtc.Api;

Internally, the feature connects to a IhcPmsLib.Odtc.Odtc device (specified by the "DeviceIp" above) which sends DataEvents and StatusEvents to the PMS.

Registration of the services with WebApplicationBuilder (from sila_csharp reference implementation) would include also the following lines:

...
builder.Services.AddSingleton<IPMS, PMS>();
builder.Services.AddSingleton<OdtcSiLA1Service>();
var configuration = builder.Configuration;
var serverConfig = new ServerConfig(configuration["ServerConfig:Name"],
                                                Guid.Parse(configuration["ServerConfig:UUID"]),
                                                configuration["ServerConfig:FQHN"],
                                                int.Parse(configuration["ServerConfig:Port"]),
                                                configuration["ServerConfig:NetworkInterface"],
                                                configuration["ServerConfig:DiscoveryServiceName"]);
...                                                
builder.Services.AddSingleton(x =>
{
    var channel = x.GetRequiredService<IGrpcChannelProvider>().GetChannel(
        serverConfig.FQHN, serverConfig.Port, true);
    return new OdtcSiLA1Client(channel.Result);
});
...
app.MapGrpcService<OdtcSiLA1Service>();

In a SiLA2 client application, we could call a SiLA2 command as follows:


try
{
    var parameters = new GetStatus_Parameters();
    var response  = odtcSiLA1Client.GetStatus(parameters);
}
catch (Grpc.Core.RpcException rpcex)
{
    _errorMessage = ErrorHandling.HandleException(rpcex);
}
catch (Exception ex)
{
    _errorMessage = ex.Message;
}
    
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.9.2-BETA 261 3/30/2023
0.9.1-BETA 82 3/29/2023
0.9.0-BETA 86 3/29/2023

v0.9.2
     - update SiLA2.Core v7.4.3
     - cleanup package references
     v0.9.1
     - fixed feature validation
     - fixed feature xml
v0.9.0
- beta release