C# Health Deepsy API

To work with Deepsy Health service it is necessary to use HealthManager located in GMV.ITS.HAL.DEEPSY.Health.Facade for getting the initial HealthManager object. More...

Collaboration diagram for C# Health Deepsy API:

Modules

 Enumerations
 List of enumerations available for configuration or GNSS events.
 

Classes

interface  IHealthManager
 Health Manager interface for interacting with Deepsy health service More...
 

Detailed Description

HealthManager healthManager = new HealthManager("");


HealthManager has an optional parameter indicating the ip address of remote service. For instance:

HealthManager healthManager = new HealthManager("172.22.198.103");


HealthManager implements IDisposable. It can hold resources (such as socket handles) until it is disposed. The Dispose method is automatically called when existing a using or try / catch block, for which the object has been declared. This construction ensures prompt release, avoiding resource exhaustion exceptions and errors that may otherwise occur.

  • * HealthManager healthManager= null;
    try{
    healthManager = new HealthManager("172.22.198.103");
    healthManager.GetPendingStatusList();
    } catch (Exception e) {
    throw e;
    }
    healthManager.Dispose();

Examples

  • Report new status to health service and retrieve list of pending status

    using System;
    using System.Collections.Generic;
    using System.Threading;
    namespace GMV.ITS.HAL.DEEPSY.Examples.Health
    {
    class ReportNewStatus
    {
    static void Main(string[] args)
    {
    using (HealthManager healthManager = new HealthManager("172.22.198.103"))
    {
    healthManager.ReportNewStatus("PROJECT_ROUTE_NUMBER", "146", HealthStatusPriority.Priority.NORMAL);
    healthManager.ReportNewStatus("PROJECT_PASSENGER_QTY", "35", HealthStatusPriority.Priority.NORMAL);
    Console.WriteLine("Project status reported correctly to Health system");
    Thread.Sleep(2000);
    IEnumerable<IHealthStatus> currentStatusList = healthManager.GetCurrentStatusList();
    Console.WriteLine("Current status list is:");
    foreach (IHealthStatus currentStatus in currentStatusList)
    {
    Console.WriteLine($"Status Key: {currentStatus.Key}. Value: {currentStatus.Value}");
    }
    IEnumerable<IHealthStatus> pendingStatusList = healthManager.GetPendingStatusList();
    Console.WriteLine("Pending status to report are:");
    foreach (IHealthStatus pendingStatus in pendingStatusList)
    {
    Console.WriteLine($"Status Key: {pendingStatus.Key}. Value: {pendingStatus.Value}");
    }
    }
    Console.WriteLine($"Press any key for exit");
    Console.ReadKey();
    }
    }
    }


  • Request information for all peripherals, including their parent-child relationships
    using System;
    using System.Collections.Generic;
    using System.Threading;
    using System.Linq;
    namespace GMV.ITS.HAL.DEEPSY.Examples.Health
    {
    class GetDeviceInformation
    {
    static void Main(string[] args)
    {
    using (HealthManager healthManager = new HealthManager("192.168.1.140")) //172.22.198.103
    {
    Console.WriteLine("Getting the information of all the peripherals...");
    IEnumerable<IDeviceInformation> deviceInfoList = healthManager.GetDeviceInfoList();
    if (deviceInfoList.Any())
    {
    const int width = 50;
    Console.WriteLine("Parent ID".PadRight(width) + "Serial Number".PadRight(width) + "Firmware Version".PadRight(width) + "Others".PadRight(width));
    Console.WriteLine(new string('-', width * 4));
    foreach (IDeviceInformation deviceInfo in deviceInfoList)
    {
    Console.WriteLine(
    deviceInfo.ParentId.PadRight(width) +
    deviceInfo.SerialNumber.PadRight(width) +
    deviceInfo.FwVersion.PadRight(width) +
    deviceInfo.Others.PadRight(width)
    );
    }
    }
    else
    {
    Console.WriteLine("There are not devices available");
    }
    }
    Console.WriteLine($"Press any key for exit");
    Console.ReadKey();
    }
    }
    }

Definition: HealthStatusPriority.cs:5
Definition: HealthManager.cs:12
Definition: McuDeepsyTest.cs:17
Definition: Configuration/AudioConfiguration.cs:6
Definition: Configuration/AudioConfiguration.cs:6
Definition: McuDeepsyTest.cs:17
Definition: DeviceInformation.cs:5
Definition: HealthConfiguration.cs:6