public void setUp() { siHandlerMock = new Mock <SiHandler>(); siHandler = siHandlerMock.Object; writerMock = new Mock <ICommWriter>(); writer = writerMock.Object; queue = new SiMessageQueue(10, 1); SiDriverState.setSicard6_192PunchesMode(false); GecoSiLogger.Open(); }
protected void CheckExpectedLength(byte[] accumulator, int accSize) { if (CompleteMessage(accumulator, accSize)) { SendMessage(); } else { GecoSiLogger.Debug("Fragment"); } }
private void port_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { CheckTimeout(); Accumulate(); if (accSize == 1 && accumulator[0] != 0x02) { SendMessage(); } else { CheckExpectedLength(accumulator, accSize); } } catch (Exception ex) { GecoSiLogger.Error(" #serialEvent# " + ex); ex.PrintStackTrace(); } }
public void Write(SiMessage message) { GecoSiLogger.Log("SEND", message.ToString()); byte[] buff = message.Sequence(); port.Write(buff, 0, buff.Length); }
private void QueueMessage(SiMessage message) { GecoSiLogger.Log("READ", message.ToString()); messageQueue.Add(message); }
public void setUp() { GecoSiLogger.Open(); }