mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
servo: Merge #15525 - Reorder startNotifications steps (from szeged:step-reorder); r=Wafflespeanut
<!-- Please describe your changes on the following line: --> https://github.com/WebBluetoothCG/web-bluetooth/pull/355 changed the step order in startNotifications. The connection check is now Step 2 instead of Step 6. Link for the current spec state: https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-startnotifications Step annotations are also updated for this function. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> Source-Repo: https://github.com/servo/servo Source-Revision: 13f6d1f53f5293dee32ae2a30067719854fa1104 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 161bdc8f4203bfdae47303002d578eadf60654e9
This commit is contained in:
parent
c26c254d4b
commit
237eb76031
@ -886,7 +886,7 @@ impl BluetoothManager {
|
|||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-startnotifications
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-startnotifications
|
||||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-stopnotifications
|
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-stopnotifications
|
||||||
fn enable_notification(&mut self, id: String, enable: bool) -> BluetoothResponseResult {
|
fn enable_notification(&mut self, id: String, enable: bool) -> BluetoothResponseResult {
|
||||||
// (StartNotifications) Step 2 - 3.
|
// (StartNotifications) Step 3 - 4.
|
||||||
// (StopNotifications) Step 1 - 2.
|
// (StopNotifications) Step 1 - 2.
|
||||||
if !self.characteristic_is_cached(&id) {
|
if !self.characteristic_is_cached(&id) {
|
||||||
return Err(BluetoothError::InvalidState);
|
return Err(BluetoothError::InvalidState);
|
||||||
@ -909,11 +909,11 @@ impl BluetoothManager {
|
|||||||
// (StopNotification) Step 5.
|
// (StopNotification) Step 5.
|
||||||
Ok(_) => return Ok(BluetoothResponse::EnableNotification(())),
|
Ok(_) => return Ok(BluetoothResponse::EnableNotification(())),
|
||||||
|
|
||||||
// (StartNotification) Step 4.
|
// (StartNotification) Step 5.
|
||||||
Err(_) => return Err(BluetoothError::NotSupported),
|
Err(_) => return Err(BluetoothError::NotSupported),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// (StartNotification) Step 3.
|
// (StartNotification) Step 4.
|
||||||
None => return Err(BluetoothError::InvalidState),
|
None => return Err(BluetoothError::InvalidState),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,22 +209,22 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 4.
|
// Step 2.
|
||||||
|
if !self.Service().Device().Gatt().Connected() {
|
||||||
|
p.reject_error(p_cx, Network);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Step 5.
|
||||||
if !(self.Properties().Notify() ||
|
if !(self.Properties().Notify() ||
|
||||||
self.Properties().Indicate()) {
|
self.Properties().Indicate()) {
|
||||||
p.reject_error(p_cx, NotSupported);
|
p.reject_error(p_cx, NotSupported);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Step 5: Implement `active notification context set` for BluetoothRemoteGATTCharacteristic.
|
// TODO: Step 6: Implement `active notification context set` for BluetoothRemoteGATTCharacteristic.
|
||||||
|
|
||||||
// Step 6.
|
// Note: Steps 3 - 4, 7 - 11 are implemented in components/bluetooth/lib.rs in enable_notification function
|
||||||
if !self.Service().Device().Gatt().Connected() {
|
|
||||||
p.reject_error(p_cx, Network);
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: Steps 2 - 3, 7 - 11 are implemented in components/bluetooth/lib.rs in enable_notification function
|
|
||||||
// and in handle_response function.
|
// and in handle_response function.
|
||||||
let sender = response_async(&p, self);
|
let sender = response_async(&p, self);
|
||||||
self.get_bluetooth_thread().send(
|
self.get_bluetooth_thread().send(
|
||||||
|
Loading…
Reference in New Issue
Block a user