Auto merge of #11028 - szeged:webbluetooth, r=jdm

Remove BluetoothDevice members

Five of the BluetoothDevice members has been deleted in the spec:
8d148ba3c3

These were the vendorID, vendorIDSource, deviceClass, productID, productVersion.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11028)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-05-06 17:07:55 -07:00
commit a153e20c55
6 changed files with 5 additions and 93 deletions

View file

@ -368,11 +368,6 @@ impl BluetoothManager {
let message = Ok(BluetoothDeviceMsg { let message = Ok(BluetoothDeviceMsg {
id: address, id: address,
name: device.get_name().ok(), name: device.get_name().ok(),
device_class: device.get_class().ok(),
vendor_id_source: device.get_vendor_id_source().ok(),
vendor_id: device.get_vendor_id().ok(),
product_id: device.get_product_id().ok(),
product_version: device.get_device_id().ok(),
appearance: device.get_appearance().ok(), appearance: device.get_appearance().ok(),
tx_power: device.get_tx_power().ok().map(|p| p as i8), tx_power: device.get_tx_power().ok().map(|p| p as i8),
rssi: device.get_rssi().ok().map(|p| p as i8), rssi: device.get_rssi().ok().map(|p| p as i8),

View file

@ -9,11 +9,6 @@ pub struct BluetoothDeviceMsg {
// Bluetooth Device properties // Bluetooth Device properties
pub id: String, pub id: String,
pub name: Option<String>, pub name: Option<String>,
pub device_class: Option<u32>,
pub vendor_id_source: Option<String>,
pub vendor_id: Option<u32>,
pub product_id: Option<u32>,
pub product_version: Option<u32>,
// Advertisiong Data properties // Advertisiong Data properties
pub appearance: Option<u16>, pub appearance: Option<u16>,
pub tx_power: Option<i8>, pub tx_power: Option<i8>,

View file

@ -6,7 +6,6 @@ use core::clone::Clone;
use dom::bindings::codegen::Bindings::BluetoothBinding; use dom::bindings::codegen::Bindings::BluetoothBinding;
use dom::bindings::codegen::Bindings::BluetoothBinding::RequestDeviceOptions; use dom::bindings::codegen::Bindings::BluetoothBinding::RequestDeviceOptions;
use dom::bindings::codegen::Bindings::BluetoothBinding::{BluetoothScanFilter, BluetoothMethods}; use dom::bindings::codegen::Bindings::BluetoothBinding::{BluetoothScanFilter, BluetoothMethods};
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::VendorIDSource;
use dom::bindings::error::Error::Type; use dom::bindings::error::Error::Type;
use dom::bindings::error::Fallible; use dom::bindings::error::Fallible;
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
@ -142,20 +141,10 @@ impl BluetoothMethods for Bluetooth {
device.appearance, device.appearance,
device.tx_power, device.tx_power,
device.rssi); device.rssi);
let vendor_id_source = device.vendor_id_source.map(|vid| match vid.as_str() {
"bluetooth" => VendorIDSource::Bluetooth,
"usb" => VendorIDSource::Usb,
_ => VendorIDSource::Unknown,
});
Ok(BluetoothDevice::new(self.global().r(), Ok(BluetoothDevice::new(self.global().r(),
DOMString::from(device.id), DOMString::from(device.id),
device.name.map(DOMString::from), device.name.map(DOMString::from),
&ad_data, &ad_data))
device.device_class,
vendor_id_source,
device.vendor_id,
device.product_id,
device.product_version))
}, },
Err(error) => { Err(error) => {
Err(Type(error)) Err(Type(error))

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding;
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::{BluetoothDeviceMethods, VendorIDSource}; use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
use dom::bindings::global::GlobalRef; use dom::bindings::global::GlobalRef;
use dom::bindings::js::{JS, Root, MutHeap, MutNullableHeap}; use dom::bindings::js::{JS, Root, MutHeap, MutNullableHeap};
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
@ -18,34 +18,19 @@ pub struct BluetoothDevice {
id: DOMString, id: DOMString,
name: Option<DOMString>, name: Option<DOMString>,
adData: MutHeap<JS<BluetoothAdvertisingData>>, adData: MutHeap<JS<BluetoothAdvertisingData>>,
deviceClass: Option<u32>,
vendorIDSource: Option<VendorIDSource>,
vendorID: Option<u32>,
productID: Option<u32>,
productVersion: Option<u32>,
gatt: MutNullableHeap<JS<BluetoothRemoteGATTServer>>, gatt: MutNullableHeap<JS<BluetoothRemoteGATTServer>>,
} }
impl BluetoothDevice { impl BluetoothDevice {
pub fn new_inherited(id: DOMString, pub fn new_inherited(id: DOMString,
name: Option<DOMString>, name: Option<DOMString>,
adData: &BluetoothAdvertisingData, adData: &BluetoothAdvertisingData)
deviceClass: Option<u32>,
vendorIDSource: Option<VendorIDSource>,
vendorID: Option<u32>,
productID: Option<u32>,
productVersion: Option<u32>)
-> BluetoothDevice { -> BluetoothDevice {
BluetoothDevice { BluetoothDevice {
reflector_: Reflector::new(), reflector_: Reflector::new(),
id: id, id: id,
name: name, name: name,
adData: MutHeap::new(adData), adData: MutHeap::new(adData),
deviceClass: deviceClass,
vendorIDSource: vendorIDSource,
vendorID: vendorID,
productID: productID,
productVersion: productVersion,
gatt: Default::default(), gatt: Default::default(),
} }
} }
@ -53,21 +38,11 @@ impl BluetoothDevice {
pub fn new(global: GlobalRef, pub fn new(global: GlobalRef,
id: DOMString, id: DOMString,
name: Option<DOMString>, name: Option<DOMString>,
adData: &BluetoothAdvertisingData, adData: &BluetoothAdvertisingData)
deviceClass: Option<u32>,
vendorIDSource: Option<VendorIDSource>,
vendorID: Option<u32>,
productID: Option<u32>,
productVersion: Option<u32>)
-> Root<BluetoothDevice> { -> Root<BluetoothDevice> {
reflect_dom_object(box BluetoothDevice::new_inherited(id, reflect_dom_object(box BluetoothDevice::new_inherited(id,
name, name,
adData, adData),
deviceClass,
vendorIDSource,
vendorID,
productID,
productVersion),
global, global,
BluetoothDeviceBinding::Wrap) BluetoothDeviceBinding::Wrap)
} }
@ -90,31 +65,6 @@ impl BluetoothDeviceMethods for BluetoothDevice {
self.adData.get() self.adData.get()
} }
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-deviceclass
fn GetDeviceClass(&self) -> Option<u32> {
self.deviceClass
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-vendoridsource
fn GetVendorIDSource(&self) -> Option<VendorIDSource> {
self.vendorIDSource
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-vendorid
fn GetVendorID(&self) -> Option<u32> {
self.vendorID
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-productid
fn GetProductID(&self) -> Option<u32> {
self.productID
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-productversion
fn GetProductVersion(&self) -> Option<u32> {
self.productVersion
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-gatt // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothdevice-gatt
fn Gatt(&self) -> Root<BluetoothRemoteGATTServer> { fn Gatt(&self) -> Root<BluetoothRemoteGATTServer> {
self.gatt.or_init(|| BluetoothRemoteGATTServer::new(self.global().r(), self)) self.gatt.or_init(|| BluetoothRemoteGATTServer::new(self.global().r(), self))

View file

@ -4,23 +4,11 @@
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdevice // https://webbluetoothcg.github.io/web-bluetooth/#bluetoothdevice
// Allocation authorities for Vendor IDs:
enum VendorIDSource {
"bluetooth",
"usb",
"unknown"
};
[Pref="dom.bluetooth.enabled"] [Pref="dom.bluetooth.enabled"]
interface BluetoothDevice { interface BluetoothDevice {
readonly attribute DOMString id; readonly attribute DOMString id;
readonly attribute DOMString? name; readonly attribute DOMString? name;
readonly attribute BluetoothAdvertisingData adData; readonly attribute BluetoothAdvertisingData adData;
readonly attribute unsigned long? deviceClass;
readonly attribute VendorIDSource? vendorIDSource;
readonly attribute unsigned long? vendorID;
readonly attribute unsigned long? productID;
readonly attribute unsigned long? productVersion;
readonly attribute BluetoothRemoteGATTServer gatt; readonly attribute BluetoothRemoteGATTServer gatt;
// readonly attribute FrozenArray[] uuids; // readonly attribute FrozenArray[] uuids;
}; };

View file

@ -34,11 +34,6 @@
log('Found a device!'); log('Found a device!');
log('> Name: ' + device.name); log('> Name: ' + device.name);
log('> Id: ' + device.id); log('> Id: ' + device.id);
log('> Device Class: ' + device.deviceClass);
log('> Vendor Id Source: ' + device.vendorIDSource);
log('> Vendor Id: ' + device.vendorID);
log('> Product Id: ' + device.productID);
log('> Product Version: ' + device.productVersion);
log('> Appearance: ' + device.adData.appearance); log('> Appearance: ' + device.adData.appearance);
log('> Tx Power: ' + device.adData.txPower + ' dBm'); log('> Tx Power: ' + device.adData.txPower + ' dBm');
log('> RSSI: ' + device.adData.rssi + ' dBm'); log('> RSSI: ' + device.adData.rssi + ' dBm');