Example #1
0
 public XBeeApi(IXBeeConnection connection)
     : this()
 {
     _connection = connection;
     _connection.DataReceived += (data, offset, count) =>
     {
         var buffer = new byte[count];
         Array.Copy(data, offset, buffer, 0, count);
         _parser.AddToParse(buffer);
     };
 }
Example #2
0
 public XBeeApi(IXBeeConnection connection)
     : this()
 {
     _connection = connection;
     _connection.DataReceived += (data, offset, count) =>
     {
         var buffer = new byte[count];
         Array.Copy(data, offset, buffer, 0, count);
         _parser.AddToParse(buffer);
     };
 }
Example #3
0
        public void SetConnection(IXBeeConnection connection)
        {
            this.connection = connection;
            this.connection.Open();
            this.connection.SetPacketReader(reader);

            /*
             * receiveThread = new Thread(new ThreadStart(ReceiveData));
             * receiveThread.Name = "Receive Data Thread";
             * receiveThread.IsBackground = true;
             * receiveThread.Start();
             */
        }
Example #4
0
 public void Connect(string port)
 {
     _connection = new SerialConnection(port, 9600);
     _api = new XBeeApi(_connection);
     _api.Open();
 }