public override IObservable <CharacteristicResult> WhenNotificationReceived() => Observable.Create <CharacteristicResult>(ob => { var readCharPath = new ObjectPath("/org/bluez/hci0/dev_F6_58_7F_09_5D_E6/service000c/char000f"); var readChar = Bus.System.GetObject <GattCharacteristic1>(BlueZPath.Service, readCharPath); var properties = Bus.System.GetObject <Properties>(BlueZPath.Service, readCharPath); var handler = new PropertiesChangedHandler((@interface, changed, invalidated) => { if (changed != null) { foreach (var prop in changed.Keys) { if (changed[prop] is byte[]) { } } } }); properties.PropertiesChanged += handler; return(() => { properties.PropertiesChanged -= handler; //agentManager.UnregisterAgent (agentPath); //gattManager.UnregisterProfile (gattProfilePath); }); });
private void HandlePropertiesChange(string interface_name) { PropertiesChangedHandler handler = properties_changed; if (handler != null) { lock (changed_properties) { try { handler(interface_name, changed_properties, invalidated_properties.ToArray()); } catch (Exception e) { Log.Exception(e); } changed_properties.Clear(); invalidated_properties.Clear(); } } }
public Task <IDisposable> WatchPropertiesChanged(PropertiesChangedHandler callback) { PropertyChangedCallback = callback; return(null); }