Inheco.SiLA2.Odtc.Features 0.9.0-BETA

This is a prerelease version of Inheco.SiLA2.Odtc.Features.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Inheco.SiLA2.Odtc.Features --version 0.9.0-BETA                
NuGet\Install-Package Inheco.SiLA2.Odtc.Features -Version 0.9.0-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.0-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.0-BETA                
#r "nuget: Inheco.SiLA2.Odtc.Features, 0.9.0-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.0-BETA&prerelease

// Install Inheco.SiLA2.Odtc.Features as a Cake Tool
#tool nuget:?package=Inheco.SiLA2.Odtc.Features&version=0.9.0-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": true,
  "DeviceIp": "192.168.1.195",
  "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.10.0-BETA 62 6/26/2024
0.9.2-BETA 268 3/30/2023
0.9.1-BETA 88 3/29/2023
0.9.0-BETA 91 3/29/2023

v0.9.0
- beta release