示例#1
0
        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();
        }
示例#2
0
 protected void CheckExpectedLength(byte[] accumulator, int accSize)
 {
     if (CompleteMessage(accumulator, accSize))
     {
         SendMessage();
     }
     else
     {
         GecoSiLogger.Debug("Fragment");
     }
 }
示例#3
0
 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);
 }
示例#5
0
 private void QueueMessage(SiMessage message)
 {
     GecoSiLogger.Log("READ", message.ToString());
     messageQueue.Add(message);
 }
示例#6
0
 public void setUp()
 {
     GecoSiLogger.Open();
 }