common/Hardware/Interfaces/Ports/SerialPorts/IrdaSerialPort.cs
2026-04-23 17:50:07 +02:00

41 lines
1.3 KiB
C#

using System;
using System.Threading;
using System.IO.Ports;
using Xylem.Common.Hardware.Interfaces.Ports.PortCore;
namespace Xylem.Common.Hardware.Interfaces.Ports.SerialPorts
{
/// <inheritdoc />
public class IrdaSerialPort : BaseSerialPort
{
/// <inheritdoc />
public IrdaSerialPort(String ident, SerialPort serialPort, TransmitPortSettings setting)
: base(ident, serialPort, setting)
{
}
/// <inheritdoc />
/// <remarks date="2018-Mar-15" author="T.Wiedebusch">
/// - Initial
/// </remarks>
/// <remarks date="2019-Aug-07" author="T.Wiedebusch">
/// - wakeup burst pattern changed from 2 times 0xF0 to 4 times 0x01,
/// - required delay from 500µs to 1ms between wakeup burst and data.
/// </remarks>
/// <remarks date="2022-Jun-28" author="T.Wiedebusch">
/// - Removed comments and one delay (was at 2 x 1 ms).
/// </remarks>
protected override void SpecificPortWrite(Byte[] tx)
{
//send wake up burst
var wakeUpBurst = new Byte[] { 0x01, 0x01, 0x01, 0x01 };
PhysicalWrite(wakeUpBurst);
//delay at least 500 µs
Thread.Sleep(1);
//send the IrDA record
PhysicalWrite(tx);
}
}
}