void HandleReceiveValueUpdated (object sender, CharacteristicReadEventArgs e) { var bytes = e.Characteristic.Value; if (bytes == null || bytes.Length == 0) return; // Debug.WriteLine ("Receive.Value: " + string.Join (" ", bytes.Select (x => x.ToString ("X2")))); lock (readBuffer) { if (readBuffer.Count + bytes.Length > ReadBufferSize) { readBuffer.RemoveRange (0, ReadBufferSize / 2); } readBuffer.AddRange (bytes); } reset.Write (new byte[] { 1 }); dataReceived.Set (); }
public void NotifyStateUpdateDone(object sender, CharacteristicReadEventArgs e) { Debug.WriteLine("SyncHandlerDevice961: Notification State Updated: " + e.Characteristic.ID); switch (Command) { case Constants.SyncHandlerSequence.EnableFF07: Debug.WriteLine("Done enabling FF07"); break; case Constants.SyncHandlerSequence.EnableFF08: Debug.WriteLine("Done enabling FF08"); this.Adapter.CommandResponse += ReceiveResponse; break; default: Debug.WriteLine("Unknown response!"); break; } this.ProcessCommands(); }
public void GetValueFromChar(object sender, CharacteristicReadEventArgs e) { switch (command) { case Constants.SyncHandlerSequence.ReadModel: Debug.WriteLine("Model: " + System.Text.Encoding.UTF8.GetString(e.Characteristic.Value, 0, e.Characteristic.Value.Length)); break; case Constants.SyncHandlerSequence.ReadSerial: Debug.WriteLine("Serial: " + System.Text.Encoding.UTF8.GetString(e.Characteristic.Value, 0, e.Characteristic.Value.Length)); break; case Constants.SyncHandlerSequence.ReadFwVersion: Debug.WriteLine("Fw Version: " + System.Text.Encoding.UTF8.GetString(e.Characteristic.Value, 0, e.Characteristic.Value.Length)); break; case Constants.SyncHandlerSequence.ReadManufacturer: Debug.WriteLine("Manufacturer: " + System.Text.Encoding.UTF8.GetString(e.Characteristic.Value, 0, e.Characteristic.Value.Length)); break; case Constants.SyncHandlerSequence.ReadBatteryLevel: Debug.WriteLine("Battery: " + (int) e.Characteristic.Value[0]); break; default: Debug.WriteLine("SyncDeviceHandler961: Unable to identify command."); break; } this.ProcessCommands(); }
void Handle_ValueUpdated (object sender, CharacteristicReadEventArgs e) { CommandResponse (this, new CommandResponseEventArgs () { Data = e.Characteristic.Value }); }
void Handle_ValueUpdated (object sender, CharacteristicReadEventArgs e) { Debug.WriteLine("Adapter: Receiving command response..."); CommandResponse (this, new CommandResponseEventArgs () { Data = e.Characteristic.Value }); }
public void GetValueFromChar(object sender, CharacteristicReadEventArgs e) { throw new NotImplementedException(); }
void UpdatedNotificationState(object sender, CharacteristicReadEventArgs e) { Console.WriteLine("Notification state event " + e.Characteristic.ID); }