static void LineOutFeedNewDataReceived(object sender, SerialDataEventArgs e) { string message = "Unexpectedly received " + BytesToString(e.Data); Console.WriteLine(message); AppLogger.Log(LogLevel.INFO, message); }
static void LineInFeedCommonDataReceived(int index, SerialDataEventArgs e) { // collect data until delimiter comes in string outputAsText = System.Text.Encoding.UTF8.GetString(e.Data); PrintLog(String.Format("Infeed {0} Received {1}", index.ToString(), outputAsText)); if (LineInFeeds[index - 1].BufferDataUpdated(outputAsText)) { PrintLog(String.Format("Infeed {0} updated with {1}", index.ToString(), LineInFeeds[index - 1].InFeedData)); } // ignore if string is invalid or the same as last one else { PrintLog(String.Format("Infeed {0} invalid data: {1}", index.ToString(), outputAsText)); } }
static void LineInFeed2NewDataReceived(object sender, SerialDataEventArgs e) { LineInFeedCommonDataReceived(2, e); }