Untitled diff

Created Diff never expires
16 Entfernungen
Zeilen
Gesamt
Entfernt
Wörter
Gesamt
Entfernt
Um diese Funktion weiterhin zu nutzen, aktualisieren Sie auf
Diffchecker logo
Diffchecker Pro
31 Zeilen
11 Hinzufügungen
Zeilen
Gesamt
Hinzugefügt
Wörter
Gesamt
Hinzugefügt
Um diese Funktion weiterhin zu nutzen, aktualisieren Sie auf
Diffchecker logo
Diffchecker Pro
25 Zeilen
Interface per object:
As opposed to:


interface Service {
interface GattRemoteServer {
GetCharacteristic(CharacteristicId id);
GetServices() => (array<ServiceInfo> services);
GetCharacteristics() =>
GetCharacteristicsForService(ServiceId id) =>
(array<CharacteristicInfo> characteristics);
(array<CharacteristicInfo> characteristics);
}
}


How Web Bluetooth would use it:
How Web Bluetooth would use it:


// BluetoothRemoteGATTService.cpp
// BluetoothRemoteGATTService.cpp
GetCharacteristic(String uuid) {
GetCharacteristic(String uuid) {
service_->GetCharacteristics(base::Bind(&OnGetCharacteristics, this, uuid,
gatt_->GetCharacteristicsForService(base::Bind(&OnGetCharacteristics, this,
...));
uuid, ...));
});
}


OnGetCharacteristics(uuid, characteristics, promise) {
OnGetCharacteristics(uuid, characteristics, promise) {
for (characteristic : characteristics) {
for (characteristic : characteristics) {
if (characteristic->uuid == uuid) {
if (characteristic->uuid == uuid) {
service_->GetCharacteristic(base::Bind(&OnGetCharacteristic, this, uuid,
promise.resolve(new BluetoothRemoteGATTCharacteristic(characteristic));
characteristic->id, promise));
return;
}
}
}
}
}
promise.reject("Not Found Error");

OnGetCharacteristic(uuid, id, characteristic, promise) {
promise.resolve(new BluetoothRemoteGATTCharacteristic(id, uuid));
}
}