Monitoring Incoming Strings to Device Emulators in Pathfinder CorePro

Updated by Brett Patram

Scope

We will be using the SAPv2 protocol in CorePro to debug incoming strings that are being received with Device Emulator connections. It can be difficult sometimes when creating a Device Emulator with Watchers to determine if the incoming text strings are arriving to Emulator. The following guide will let you see if the data is arriving to the emulator, and how it is formatted so you can better adjust your Watcher match properties. It is also possible to create a custom log writer for long-term logging. Since version 1.9.5.27


Monitoring via SAPv2

Open a telnet connection to Pathfinder CorePro SAPV2 protocol on port 9600, and login as shown below on first line. You can use PuTTY or a similar terminal application to make the connection.
Response is the second line
Login Admin Admin
>>login successful

-

Send a Get request as shown below on the first line to get a listing of all emulators you may have configured in your CorePro.
In the example below we see one Device Emulator named "Driver_LWRP" exists. You may have more
GET DeviceEmulators#0 $MAX_DEPTH=1
>>indi DeviceEmulators#0.GenericEmulator#Driver_LWRP Id=Driver_LWRP, Failed=False, LastStarted="2021-09-24T23:20:44.287-04:00", FriendlyName="GenericEmulator#Driver_LWRP", SapObjectType=GenericEmulator, SubVersion="0001-01-01T00:00:00.000+00:00" $MAX_DEPTH=1

-

After locating the desired emulator, we can submit a more directed Get request (shown on the first line below) to pull related properties back from the Emulator
Look for the "LastReceived=" property in the response back, this is the property we are wanting to check on
GET DeviceEmulators#0.GenericEmulator#Driver_LWRP $MAX_DEPTH=1  
>>indi DeviceEmulators#0.GenericEmulator#Driver_LWRP.GenericClient#[tcp://10.0.1.100:93/] Buffer="", LastReceived="", AutoReconnect=True, ToSend="", RemoteEndpointUri="tcp://10.0.1.100:93/", Connected=True, Direction=Outbound, FriendlyName="GenericClient#[tcp://10.0.1.100:93/]", SapObjectType=GenericClient, SubVersion="0001-01-01T00:00:00.000+00:00" $MAX_DEPTH=1
>>indi DeviceEmulators#0.GenericEmulator#Driver_LWRP.SapClient#[tcp://127.0.0.1:9600/] RemoteEndpointUri="tcp://127.0.0.1:9600/", Connected=True, Direction=Outbound, LoginState=None, FriendlyName="SapClient#[tcp://127.0.0.1:9600/]", SapObjectType=SapClient, SubVersion="0001-01-01T00:00:00.000+00:00" $MAX_DEPTH=1

-

We can refine the Get request to only give us back the LastReceived property (shown on the first line, response back on the second line). In this example, no data has arrived as LastReceived property is empty
GET DeviceEmulators#0.GenericEmulator#Driver_LWRP LastReceived
>>indi DeviceEmulators#0.GenericEmulator#Driver_LWRP LastReceived=""

-

Lastly, we can Subscribe to this refined Get request to only receive updates when this property changes for this particular Device Emulator. You can subscribe to multiple Device Emulators
The received string is wrapped between %BeginEncap% and %EndEncap%
SUB DeviceEmulators#0.GenericEmulator#Driver_LWRP LastReceived
>>indi DeviceEmulators#0.GenericEmulator#Driver_LWRP LastReceived=%BeginEncap%ERROR 1000 bad command
%EndEncap%


Let us know how we can help

If you have further questions on this topic or have ideas about how we can improve this document, please contact us.


How did we do?