using System; using System.Collections.Generic; using Xylem.Common.Hardware.Interfaces.Ports.PortCore; namespace Xylem.Common.Hardware.Interfaces.Protocols.TransmitProtocol { public class LedTransmitProtocol : BaseTransmitProtocol { private readonly Byte? _protSyncByte = null; private const UInt16 ProtAddLength = 0; private readonly UInt16? _protLengthIndex = null; private const Int32 DefaultResponseTimeoutMs = 50; private Int32 _responseTimeoutMs = DefaultResponseTimeoutMs; private const UInt32 BaudRate = 115200; private readonly UInt32? _receiveBufferFlushThreshold = 1000; /// public override void SetResponseTimeout(Int32 responseTimeoutMs) { _responseTimeoutMs = responseTimeoutMs; } /// public override void SetDefaultResponseTimeout() { _responseTimeoutMs = DefaultResponseTimeoutMs; } public LedTransmitProtocol(String portName) : base (portName) { } public override TransmitPortSettings GetTransmitPortSettings() { return new TransmitPortSettings(_protSyncByte, _protLengthIndex, ProtAddLength, _responseTimeoutMs, BaudRate, _receiveBufferFlushThreshold); } public TransmitPortSettings GetTransmitPortSettings(UInt32 baudRate) { return new TransmitPortSettings(_protSyncByte, _protLengthIndex, ProtAddLength, _responseTimeoutMs, baudRate, _receiveBufferFlushThreshold); } /// public override List DecodeDataForPhysicalLayer(String ident, Byte command, Byte[] payload, Boolean hideDataInLog = false) { throw new ApplicationException("Streaming port cannot send data"); } /// public override List DecodeDataForLogicLayer(String ident, List rawData, Boolean hideDataInLog = false) { return rawData; } public override List DecodeDataForPhysicalLayerUI1236(String ident, Byte[] payload, Boolean hideDataInLog = false) => throw new ApplicationException("Streaming port cannot send data"); } }