Link Search Menu Expand Document

Sentinel Manager

Jan 1 2022 at 12:00 AM

  1. Set up
  2. Configuration
    1. Sentinel Value Properties
    2. Sentinel Value Types
    3. Sentinel Comparison Types

A sentinel is an indicator of the presence of an issue or error.

Some physical devices use specific values to denote that an issue occurred when it tried to read the actual value.

Sentinel Manager is used by the device to detect these values in the properties and translate them to the correct error message. The manager maintains a list of Sentinel sets, where each set has one or more values and associated error descriptions.

Set up

Add the following NuGet packages:

  • IoTnxt.Raptor.TransformManager
  • IoTnxt.Raptor.SentinelManager
  • IoTnxt.Raptor.Common.Async

In the Program.cs file of the AspNetCore service, add the following lines in the CreateHostBuilder method:

    .AddRaptorDevice()
    .AddObjectCache<ITransformState>()
    .AddRaptorTransformManager("TransformSets", (services, configuration, builder) =>
    {
        builder.AddSentinelFunctions(services, configuration);
    }

Configuration

Configuration of the various transformations is done via a configuration file in the /config folder. An example configuration file is shown below:

{
  "SentinelOptions": {
    "Sets": {
      "SentinelSet1": {
        "Sentinels": {
          "FFFF": {
            "Value": 65535,
            "ValueType": "Int32"
            "Error": "Unimplemented"
          },
          "FFFE": {
            "Value": 65534,
            "ValueType": "Int32",
            "Error": "Over measurable range"
          },
          "FFFD": {
            "Value": 65533,
            "ValueType": "Int32",
            "Error": "Under measurable range"
          }
        }
      }
    } 
  } 
}

Sentinel Value Properties

Property NameDefault ValueDescription
Value Sets the value to check for.
ValueTypeUInt32The type of the value. See below for allowed value types.
ComparisonEqualDetermines the comparison function applied to the value. See below.
Error The error value to use if a match is found.

Sentinel Value Types

Value Type NameValueDescription
UInt320Value is a UInt32 value.
Int321Value is an Int32 value.
UInt642Value is a UInt64 value.
Int643Value is an Int64 value.
Double4Value is a double value.
String5Value is a string value.

Sentinel Comparison Types

Comparison NameValueDescription
Equal0The compared value should be equal to the sentinel value
NotEqual1The compared value should not be equal to the sentinel value
GreaterThan2The compared value should be greater than the test sentinel value
GreaterThanOrEquals3he compared value should be greater than or equal to the sentinel value
LessThan4The compared value should be less than the sentinel value
LessThanOrEquals5The compared value should be less than or equal to the sentinel value