public bool Stream(IList <ISensor> sensors) { _streamSensors = sensors; _parser = new SensorParser(sensors); _port.DataReceived += this.dataReceived; List <byte> data = new List <byte>(); //number of data packets to receive data.Add((byte)sensors.Count); //which data packets to receive foreach (ISensor sensor in sensors) { data.Add(sensor.getPacketCode()); } try { execute(OpCode.Stream, data); } catch (Exception e) { System.Console.WriteLine("error:" + e.Message); return(false); } return(true); }
public void open() { _parser = new SensorParser(); if (!_port.IsOpen) { _port.Open(); } setMode(Mode.Passive); setMode(Mode.Safe); }