static void Main(string[] args) { try { r = new SerialReaderWriter(comport: "COM4"); r.SerialMessageReceived += r_SerialDataReceived; r.StartListening(); while (true) { } } catch (Exception e) { Console.WriteLine(e.Message); } }
public void SendPacketTest() { SerialReaderWriter rw = new SerialReaderWriter(new SerialSettings()); rw.ParseData("T01N01I00P32Q00"); Packet p = new Packet(); p.PacketType = (PacketTypes)"01".FromHexStringToInt(); p.NodeID = "01".FromHexStringToInt(); p.CommandID = (Commands)"40".FromHexStringToInt(); p.Payload = "32".FromHexStringToInt(); p.Parity = "00".FromHexStringToInt(); Assert.AreEqual(rw.incomingPacket, p); //TODO: expand test (test other fields, test with more strings) }
public MainWindow() { InitializeComponent(); wr = new SerialReaderWriter(comport: "COM4"); }