Files
DP44/DataPRO/IService/Classes/SLICE/S6DBConnectedDevice.cs
2026-04-17 14:55:32 -04:00

87 lines
3.0 KiB
C#

using System.Net.NetworkInformation;
using DTS.Common.Enums.Hardware;
using DTS.Common.Interface.Communication;
namespace DTS.DASLib.Service.Classes.SLICE
{
/// <summary>
/// describes a device connected to a S6DB as determined by
/// QAUTIL_QUERY_MAC_IP_TABLE
/// part of
/// 10582 Implement auto-discover and monitor DAS status.
/// </summary>
public class S6DBConnectedDevice : IDASConnectedDevice
{
/// <summary>
/// the device type of the connected device
/// </summary>
public HardwareTypes DeviceType { get; } = HardwareTypes.SLICE6_Base;
/// <summary>
/// the port the device is on only positive values are valid
/// 0 based
/// </summary>
public int Port { get; private set; } = -1;
/// <summary>
/// the position on the chain or port
/// only positive values are valid
/// 0 based
/// </summary>
public int SpotOnPort { get; private set; } = -1;
/// <summary>
/// MAC address
/// </summary>
public PhysicalAddress PhysicalAddress { get; private set; }
/// <summary>
/// IP address reported by device
/// default value empty string
/// </summary>
public string IPAddress { get; private set; } = string.Empty;
/// <summary>
/// serial number of device
/// default value empty string
/// </summary>
public string SerialNumber { get; private set; } = string.Empty;
/// <summary>
/// location of device
/// default value empty string
/// </summary>
public string Location { get; private set; } = string.Empty;
/// <summary>
/// version of device
/// default value empty string
/// </summary>
public string Version { get; private set; } = string.Empty;
/// <summary>
/// constructs new connected device record
/// </summary>
/// <param name="port">port, 0 based</param>
/// <param name="spotOnPort">position on port/chain 0 based</param>
/// <param name="physicalAddress">mac address</param>
/// <param name="ipAddress">ip address</param>
/// <param name="serialNumber">serial number of connected device</param>
/// <param name="location">location</param>
/// <param name="version">version</param>
public S6DBConnectedDevice(int port, int spotOnPort, PhysicalAddress physicalAddress, string ipAddress,
string serialNumber, string location, string version)
{
Port = port;
SpotOnPort = spotOnPort;
PhysicalAddress = physicalAddress;
IPAddress = ipAddress;
SerialNumber = serialNumber;
Location = location;
Version = version;
if (SerialNumber.StartsWith("S6A"))
{
DeviceType = HardwareTypes.SLICE6_AIR;
}
}
}
}