Bluetooth LE CanUpdate Characteristic property

时间:2015-10-30 21:39:48

标签: c# xamarin bluetooth bluetooth-lowenergy

I am building a Xamarin.Formscross platform mobile app, which uses Monkey.Robotics for its Bluetoth Low Energy functionality. I am connecting to an mbed based implimentation of a custom GATT service.

In the Xamarin C#, What triggers the Characteristic.CanUpdate property in Monkey.Robotics?

This is a standard example my C# is based on:

if (characteristic.CanUpdate) {
                characteristic.ValueUpdated += (s, e) => {
                    Debug.WriteLine("characteristic.ValueUpdated");
                    Device.BeginInvokeOnMainThread( () => {
                        UpdateDisplay(characteristic);
                    });
                    IsBusy = false; // only spin until the first result is received
                };
                IsBusy = true;
                characteristic.StartUpdates();
            }

This has been working, but since I changed to my own custom GATT service which I am connecting to, the CanUpdate property is always false. What is this property and how is it triggered? This will really help me debugging my GATT service code.

Thanks

1 个答案:

答案 0 :(得分:0)

Monkey.Robotics is open source, so you can just look it up yourself

CanUpdate is implemented like this:

public bool CanUpdate {

  get {
    return (this.Properties & CharacteristicPropertyType.Notify) != 0;
  }
}