/// <summary> /// Initializes a new instance of the <see cref="EquipmentPort"/> class. /// </summary> /// <param name="commProvider">The communication provider.</param> public EquipmentPort(ICommProvider commProvider) { _commProvider = commProvider; _commProvider.RemoteCommandRun += OnRemoteCommandRun; _commProvider.VariableChanged += OnVariableChanged; _commProvider.Initialize(); _heartbeatTimer.Interval = 5000; _heartbeatTimer.Elapsed += HeartbeatElapsed; LastHeartbeat = DateTime.Now; }
void Terminal_TerminalEvent(ICommProvider sender, TerminalEventArgs e) { switch (e.EventType) { case EventTypeCodes.Connected: Buffer.PrintString("Connected"); Buffer.NewLine(); break; case EventTypeCodes.Disconnected: Buffer.PrintString("Disconnected: "); Buffer.PrintString(e.Message); Buffer.NewLine(); break; } }
void _transport_DataReceived(ICommProvider sender, byte[] Data) { ReceiveData(Data); }
void _transport_TerminalEvent(ICommProvider sender, TerminalEventArgs e) { onTerminalEvent(e.EventType, e.Message); }
void Terminal_ColorEvent(ICommProvider sender, Common.ColorEventArgs e) { }
void Terminal_CursorEvent(ICommProvider sender, Common.CursorEventArgs e) { switch (e.CursorCommand) { case CursorCommandCodes.None: break; case CursorCommandCodes.Goto: CursorRow = e.Row; CursorCol = e.Col; break; case CursorCommandCodes.Up: CursorRow--; break; case CursorCommandCodes.Down: CursorRow++; break; case CursorCommandCodes.Left: CursorCol--; break; case CursorCommandCodes.Right: CursorCol++; break; case CursorCommandCodes.PageUp: break; case CursorCommandCodes.PageDown: break; case CursorCommandCodes.LineStart: break; case CursorCommandCodes.LineEnd: break; case CursorCommandCodes.Insert: break; case CursorCommandCodes.Delete: break; case CursorCommandCodes.BackSpace: if (CursorCol == 0) { CursorRow--; CursorCol = Columns - 1; SetChar(' '); } else { CursorCol--; } break; case CursorCommandCodes.ScreenHome: CursorCol = 0; CursorRow = 0; break; case CursorCommandCodes.ClearScreen: Clear(); break; case CursorCommandCodes.Return: CursorCol = 0; break; default: break; } }
void Terminal_TextReceived(ICommProvider sender, string Text) { PrintString(Text); }
void Terminal_DataReceived(ICommProvider sender, byte[] Data) { }
void _terminal_TextReceived(ICommProvider sender, string Text) { FixString.Text = Text; }
void Modem_TerminalEvent(ICommProvider sender, TerminalEventArgs e) { onTerminalEvent(e); }
void Modem_DataReceived(ICommProvider sender, byte[] Data) { ReceiveData(Data); }