diff --git a/haxe_libraries/why-dbus.hxml b/haxe_libraries/why-dbus.hxml index e378a22..c08f8f8 100644 --- a/haxe_libraries/why-dbus.hxml +++ b/haxe_libraries/why-dbus.hxml @@ -1,5 +1,5 @@ -# @install: lix --silent download "gh://github.com/why-haxe/why-dbus#f84f1971bf49748bb57eef4c06fe1b87c622ea01" into why-dbus/0.0.0/github/f84f1971bf49748bb57eef4c06fe1b87c622ea01 +# @install: lix --silent download "gh://github.com/why-haxe/why-dbus#b02b032942338667196c71d811530e5584e06113" into why-dbus/0.0.0/github/b02b032942338667196c71d811530e5584e06113 -lib tink_chunk -lib tink_xml --cp ${HAXE_LIBCACHE}/why-dbus/0.0.0/github/f84f1971bf49748bb57eef4c06fe1b87c622ea01/src +-cp ${HAXE_LIBCACHE}/why-dbus/0.0.0/github/b02b032942338667196c71d811530e5584e06113/src -D why-dbus=0.0.0 \ No newline at end of file diff --git a/src/org/bluez/GattCharacteristic1.hx b/src/org/bluez/GattCharacteristic1.hx index c912594..cf6644a 100644 --- a/src/org/bluez/GattCharacteristic1.hx +++ b/src/org/bluez/GattCharacteristic1.hx @@ -15,6 +15,7 @@ interface GattCharacteristic1 { function readValue(options:Map):Chunk; function writeValue(value:Chunk, options:Map):Void; + // function acquireNotify(options:Map):Void; function startNotify():Void; function stopNotify():Void; } \ No newline at end of file diff --git a/src/why/bluez/BlueZ.hx b/src/why/bluez/BlueZ.hx index 32427f3..edc7dce 100644 --- a/src/why/bluez/BlueZ.hx +++ b/src/why/bluez/BlueZ.hx @@ -22,28 +22,25 @@ class BlueZ { this.destination = cnx.getDestination(DESTINATION); this.manager = destination.getObject('/').getInterface(org.freedesktop.DBus.ObjectManager); - this.deviceAdded = manager.interfacesAdded.select(tuple -> { - final path = tuple.v0; - final interfaces = tuple.v1; - switch interfaces['org.bluez.Device1'] { - case null: None; - case iface: Some(getDevice(path, iface['Address'].value)); - } + this.deviceAdded = new Signal(cb -> { + manager.interfacesAdded.handle((path, interfaces) -> { + switch interfaces['org.bluez.Device1'] { + case null: // skip + case iface: cb(getDevice(path, iface['Address'].value)); + } + }); }); - this.deviceRemoved = manager.interfacesRemoved.select(tuple -> { - final path = tuple.v0; - final interfaces = tuple.v1; - if(interfaces.contains('org.bluez.Device1')) { - switch devices[path] { - case null: - None; - case device: - devices.remove(path); - Some(device); + this.deviceRemoved = new Signal(cb -> { + manager.interfacesRemoved.handle((path, interfaces) -> { + if(interfaces.contains('org.bluez.Device1')) { + switch devices[path] { + case null: // skip + case device: + devices.remove(path); + cb(device); + } } - } else { - None; - } + }); }); } diff --git a/tests/Playground.hx b/tests/Playground.hx index c023097..e155462 100644 --- a/tests/Playground.hx +++ b/tests/Playground.hx @@ -171,10 +171,13 @@ class Playground { class EmptyObjectManager implements why.dbus.server.Interface { - public final interfacesAdded = Signal.trigger(); - public final interfacesRemoved = Signal.trigger(); + public final interfacesAdded:why.dbus.server.Signal>>; + public final interfacesRemoved:why.dbus.server.Signal>; - public function new() {} + public function new() { + interfacesAdded = null; + interfacesRemoved = null; + } public function getManagedObjects():tink.core.Promise>>> { trace('EmptyObjectManager'); @@ -216,8 +219,8 @@ class Application implements why.dbus.server.Interface>; public function new() { - interfacesAdded = tink.core.Signal.trigger(); - interfacesRemoved = tink.core.Signal.trigger(); + interfacesAdded = null; + interfacesRemoved = null; } public function getManagedObjects():Promise>>> {