Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAnnotations for WebBluetooth functions #14407
Conversation
highfive
commented
Nov 29, 2016
|
Heads up! This PR modifies the following files:
|
highfive
commented
Nov 29, 2016
|
r? @jdm |
|
This is a great improvement! Thanks! |
| let manufacturer_id = match u16::from_str(key.as_ref()) { | ||
| Ok(id) => id, | ||
| Err(err) => return Err(Type(format!("{} {} {}", KEY_CONVERSION_ERROR, key, err))), | ||
| }; | ||
|
|
||
| // Step 7.3: This step is missing, | ||
| // because we don't necesarry need to make the conversion to an IDL value. |
This comment has been minimized.
This comment has been minimized.
| if uuid_is_blocklisted(service.as_ref(), Blocklist::All) { | ||
| return Err(Security); | ||
| } | ||
|
|
||
| // Step 9.6: This step is missing, | ||
| // because we don't need necesarry to make the conversion to an IDL value. |
This comment has been minimized.
This comment has been minimized.
| @@ -636,18 +639,22 @@ impl BluetoothManager { | |||
| thread::sleep(Duration::from_millis(CONNECTION_TIMEOUT_MS)); | |||
| }, | |||
| } | |||
| // TODO: Step 5.1.4: Use the excahnge MTU procedure. | |||
This comment has been minimized.
This comment has been minimized.
| @@ -664,10 +671,12 @@ impl BluetoothManager { | |||
| } | |||
| } | |||
|
|
|||
| // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice | |||
This comment has been minimized.
This comment has been minimized.
jdm
Nov 29, 2016
Member
Shouldn't this be https://webbluetoothcg.github.io/web-bluetooth/#getgattchildren or at least reference it?
| fn get_primary_service(&mut self, | ||
| device_id: String, | ||
| uuid: String, | ||
| sender: IpcSender<BluetoothResponseResult>) { | ||
| // Step 2.5. |
This comment has been minimized.
This comment has been minimized.
jdm
Nov 29, 2016
Member
These numbers don't correspond to step numbers in the spec, given the split between https://webbluetoothcg.github.io/web-bluetooth/#getgattchildren and https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice .
| @@ -851,10 +892,12 @@ impl BluetoothManager { | |||
| return drop(sender.send(Err(BluetoothError::NotFound))); | |||
| } | |||
|
|
|||
| // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristics | |||
This comment has been minimized.
This comment has been minimized.
| if !self.cached_characteristics.contains_key(&characteristic_id) { | ||
| return drop(sender.send(Err(BluetoothError::InvalidState))); | ||
| } | ||
| let mut adapter = get_adapter_or_return_error!(self, sender); | ||
| let descriptors = self.get_gatt_descriptors_by_uuid(&mut adapter, &characteristic_id, &uuid); | ||
|
|
||
| // Step 7: If its argument is empty, throws a NotFoundError. | ||
| if descriptors.is_empty() { | ||
| return drop(sender.send(Err(BluetoothError::NotFound))); | ||
| } |
This comment has been minimized.
This comment has been minimized.
| if characteristics_vec.is_empty() { | ||
| return drop(sender.send(Err(BluetoothError::NotFound))); | ||
| } | ||
|
|
||
| return drop(sender.send(Ok(BluetoothResponse::GetCharacteristics(characteristics_vec)))); | ||
| } | ||
|
|
||
| // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptor |
This comment has been minimized.
This comment has been minimized.
jdm
Nov 29, 2016
Member
Add a link to https://webbluetoothcg.github.io/web-bluetooth/#getgattchildren .
| @@ -922,10 +977,12 @@ impl BluetoothManager { | |||
| return drop(sender.send(Err(BluetoothError::NotFound))); | |||
| } | |||
|
|
|||
| // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptors | |||
This comment has been minimized.
This comment has been minimized.
jdm
Nov 29, 2016
Member
Add a link to https://webbluetoothcg.github.io/web-bluetooth/#getgattchildren .
| @@ -934,9 +991,13 @@ impl BluetoothManager { | |||
| Some(id) => self.get_gatt_descriptors_by_uuid(&mut adapter, &characteristic_id, &id), | |||
| None => self.get_and_cache_gatt_descriptors(&mut adapter, &characteristic_id), | |||
| }; | |||
|
|
|||
| // Step 7: If its argument is empty, throws a NotFoundError. | |||
| if descriptors.is_empty() { | |||
| return drop(sender.send(Err(BluetoothError::NotFound))); | |||
| } | |||
This comment has been minimized.
This comment has been minimized.
|
|
|
@jdm How should I number the steps? e.g. I realize this thing is a bit unfortunate, but i could move up the gattchildren implementation in my todo list if you prefer :) |
|
@dati91 I would add a comment like |
|
@bors-servo: delegate+ |
|
|
|
@bors-servo r=jdm |
|
|
Annotations for WebBluetooth functions <!-- Please describe your changes on the following line: --> 1. Moved the `convert_request_device_options` function steps into `request_bluetooth_devices` function, to stay consistent with the current specification. 2. Updated the existing step annotations for the requestDevice and related methods. 3. Added step annotations for the implemented WebBluetooth methods. --- <!-- 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] These changes fix #14324, #12614 <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14407) <!-- Reviewable:end -->
|
|
|
@bors-servo try |
|
|
Annotations for WebBluetooth functions <!-- Please describe your changes on the following line: --> 1. Moved the `convert_request_device_options` function steps into `request_bluetooth_devices` function, to stay consistent with the current specification. 2. Updated the existing step annotations for the requestDevice and related methods. 3. Added step annotations for the implemented WebBluetooth methods. --- <!-- 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] These changes fix #14324, #12614 <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14407) <!-- Reviewable:end -->
|
@zakorgy That's just servo/saltfs#545. You should be able to retry like usual. |
|
|
|
|
Annotations for WebBluetooth functions <!-- Please describe your changes on the following line: --> 1. Moved the `convert_request_device_options` function steps into `request_bluetooth_devices` function, to stay consistent with the current specification. 2. Updated the existing step annotations for the requestDevice and related methods. 3. Added step annotations for the implemented WebBluetooth methods. --- <!-- 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] These changes fix #14324, #12614 <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14407) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
|
|
|
|
|
@bors-servo retry |
|
|
Annotations for WebBluetooth functions <!-- Please describe your changes on the following line: --> 1. Moved the `convert_request_device_options` function steps into `request_bluetooth_devices` function, to stay consistent with the current specification. 2. Updated the existing step annotations for the requestDevice and related methods. 3. Added step annotations for the implemented WebBluetooth methods. --- <!-- 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] These changes fix #14324, #12614 <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14407) <!-- Reviewable:end -->
|
|
zakorgy commentedNov 29, 2016
•
edited by larsbergstrom
convert_request_device_optionsfunction steps intorequest_bluetooth_devicesfunction, to stay consistent with the current specification../mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is