mirror of
https://github.com/servo/servo.git
synced 2025-07-05 22:43:40 +01:00
Replace the union types with the correct typedefs in the webidl files and the API classes.
This commit is contained in:
parent
76d6685d7f
commit
402bc552ca
7 changed files with 21 additions and 21 deletions
|
@ -9,7 +9,6 @@ use dom::bindings::codegen::Bindings::BluetoothRemoteGATTCharacteristicBinding::
|
|||
BluetoothRemoteGATTCharacteristicMethods;
|
||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
||||
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
|
||||
use dom::bindings::error::Error::{Network, Type};
|
||||
use dom::bindings::error::{Fallible, ErrorResult};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
|
@ -19,7 +18,7 @@ use dom::bindings::str::ByteString;
|
|||
use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties;
|
||||
use dom::bluetoothremotegattdescriptor::BluetoothRemoteGATTDescriptor;
|
||||
use dom::bluetoothremotegattservice::BluetoothRemoteGATTService;
|
||||
use dom::bluetoothuuid::BluetoothUUID;
|
||||
use dom::bluetoothuuid::{BluetoothDescriptorUUID, BluetoothUUID};
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use net_traits::bluetooth_thread::{BluetoothMethodMsg, BluetoothObjectMsg};
|
||||
use util::str::DOMString;
|
||||
|
@ -94,7 +93,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
|||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptor
|
||||
fn GetDescriptor(&self, descriptor: StringOrUnsignedLong) -> Fallible<Root<BluetoothRemoteGATTDescriptor>> {
|
||||
fn GetDescriptor(&self, descriptor: BluetoothDescriptorUUID) -> Fallible<Root<BluetoothRemoteGATTDescriptor>> {
|
||||
let uuid: String = match BluetoothUUID::GetDescriptor(self.global().r(), descriptor.clone()) {
|
||||
Ok(domstring) => domstring.to_string(),
|
||||
Err(error) => return Err(error),
|
||||
|
@ -124,7 +123,7 @@ impl BluetoothRemoteGATTCharacteristicMethods for BluetoothRemoteGATTCharacteris
|
|||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattcharacteristic-getdescriptors
|
||||
fn GetDescriptors(&self,
|
||||
descriptor: Option<StringOrUnsignedLong>)
|
||||
descriptor: Option<BluetoothDescriptorUUID>)
|
||||
-> Fallible<Vec<Root<BluetoothRemoteGATTDescriptor>>> {
|
||||
let mut uuid: Option<String> = None;
|
||||
if let Some(d)= descriptor {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
use dom::bindings::codegen::Bindings::BluetoothDeviceBinding::BluetoothDeviceMethods;
|
||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding;
|
||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerMethods;
|
||||
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
|
||||
use dom::bindings::error::Error::Type;
|
||||
use dom::bindings::error::{Fallible, ErrorResult};
|
||||
use dom::bindings::global::GlobalRef;
|
||||
|
@ -13,7 +12,7 @@ use dom::bindings::js::{JS, MutHeap, Root};
|
|||
use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
|
||||
use dom::bluetoothdevice::BluetoothDevice;
|
||||
use dom::bluetoothremotegattservice::BluetoothRemoteGATTService;
|
||||
use dom::bluetoothuuid::BluetoothUUID;
|
||||
use dom::bluetoothuuid::{BluetoothServiceUUID, BluetoothUUID};
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use net_traits::bluetooth_thread::{BluetoothMethodMsg, BluetoothObjectMsg};
|
||||
use std::cell::Cell;
|
||||
|
@ -106,7 +105,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
|||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservice
|
||||
fn GetPrimaryService(&self, service: StringOrUnsignedLong) -> Fallible<Root<BluetoothRemoteGATTService>> {
|
||||
fn GetPrimaryService(&self, service: BluetoothServiceUUID) -> Fallible<Root<BluetoothRemoteGATTService>> {
|
||||
let uuid: String = match BluetoothUUID::GetService(self.global().r(), service.clone()) {
|
||||
Ok(domstring) => domstring.to_string(),
|
||||
Err(error) => return Err(error),
|
||||
|
@ -138,7 +137,7 @@ impl BluetoothRemoteGATTServerMethods for BluetoothRemoteGATTServer {
|
|||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattserver-getprimaryservices
|
||||
fn GetPrimaryServices(&self,
|
||||
service: Option<StringOrUnsignedLong>)
|
||||
service: Option<BluetoothServiceUUID>)
|
||||
-> Fallible<Vec<Root<BluetoothRemoteGATTService>>> {
|
||||
let mut uuid: Option<String> = None;
|
||||
if let Some(s)= service {
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding;
|
||||
use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServiceBinding::BluetoothRemoteGATTServiceMethods;
|
||||
use dom::bindings::codegen::UnionTypes::StringOrUnsignedLong;
|
||||
use dom::bindings::error::Error::Type;
|
||||
use dom::bindings::error::Fallible;
|
||||
use dom::bindings::global::GlobalRef;
|
||||
|
@ -13,7 +12,7 @@ use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object};
|
|||
use dom::bluetoothcharacteristicproperties::BluetoothCharacteristicProperties;
|
||||
use dom::bluetoothdevice::BluetoothDevice;
|
||||
use dom::bluetoothremotegattcharacteristic::BluetoothRemoteGATTCharacteristic;
|
||||
use dom::bluetoothuuid::BluetoothUUID;
|
||||
use dom::bluetoothuuid::{BluetoothCharacteristicUUID, BluetoothUUID};
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use net_traits::bluetooth_thread::{BluetoothMethodMsg, BluetoothObjectMsg};
|
||||
use util::str::DOMString;
|
||||
|
@ -86,7 +85,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
|||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristic
|
||||
fn GetCharacteristic(&self,
|
||||
characteristic: StringOrUnsignedLong)
|
||||
characteristic: BluetoothCharacteristicUUID)
|
||||
-> Fallible<Root<BluetoothRemoteGATTCharacteristic>> {
|
||||
let uuid: String = match BluetoothUUID::GetCharacteristic(self.global().r(), characteristic.clone()) {
|
||||
Ok(domstring) => domstring.to_string(),
|
||||
|
@ -137,7 +136,7 @@ impl BluetoothRemoteGATTServiceMethods for BluetoothRemoteGATTService {
|
|||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothremotegattservice-getcharacteristics
|
||||
fn GetCharacteristics(&self,
|
||||
characteristic: Option<StringOrUnsignedLong>)
|
||||
characteristic: Option<BluetoothCharacteristicUUID>)
|
||||
-> Fallible<Vec<Root<BluetoothRemoteGATTCharacteristic>>> {
|
||||
let mut uuid: Option<String> = None;
|
||||
if let Some(c)= characteristic {
|
||||
|
|
|
@ -11,6 +11,9 @@ use regex::Regex;
|
|||
use util::str::DOMString;
|
||||
|
||||
pub type UUID = DOMString;
|
||||
pub type BluetoothServiceUUID = StringOrUnsignedLong;
|
||||
pub type BluetoothCharacteristicUUID = StringOrUnsignedLong;
|
||||
pub type BluetoothDescriptorUUID = StringOrUnsignedLong;
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#bluetoothuuid
|
||||
#[dom_struct]
|
||||
|
@ -274,7 +277,7 @@ impl BluetoothUUID {
|
|||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getservice
|
||||
pub fn GetService(globalref: GlobalRef, name: StringOrUnsignedLong) -> Fallible<UUID> {
|
||||
pub fn GetService(globalref: GlobalRef, name: BluetoothServiceUUID) -> Fallible<UUID> {
|
||||
BluetoothUUID::resolve_uuid_name(globalref,
|
||||
name,
|
||||
BLUETOOTH_ASSIGNED_SERVICES,
|
||||
|
@ -282,7 +285,7 @@ impl BluetoothUUID {
|
|||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getcharacteristic
|
||||
pub fn GetCharacteristic(globalref: GlobalRef, name: StringOrUnsignedLong) -> Fallible<UUID> {
|
||||
pub fn GetCharacteristic(globalref: GlobalRef, name: BluetoothCharacteristicUUID) -> Fallible<UUID> {
|
||||
BluetoothUUID::resolve_uuid_name(globalref,
|
||||
name,
|
||||
BLUETOOTH_ASSIGNED_CHARCTERISTICS,
|
||||
|
@ -290,7 +293,7 @@ impl BluetoothUUID {
|
|||
}
|
||||
|
||||
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothuuid-getdescriptor
|
||||
pub fn GetDescriptor(globalref: GlobalRef, name: StringOrUnsignedLong) -> Fallible<UUID> {
|
||||
pub fn GetDescriptor(globalref: GlobalRef, name: BluetoothDescriptorUUID) -> Fallible<UUID> {
|
||||
BluetoothUUID::resolve_uuid_name(globalref,
|
||||
name,
|
||||
BLUETOOTH_ASSIGNED_DESCRIPTORS,
|
||||
|
|
|
@ -11,9 +11,9 @@ interface BluetoothRemoteGATTCharacteristic {
|
|||
readonly attribute BluetoothCharacteristicProperties properties;
|
||||
readonly attribute ByteString? value;
|
||||
[Throws]
|
||||
BluetoothRemoteGATTDescriptor getDescriptor((DOMString or unsigned long) descriptor);
|
||||
BluetoothRemoteGATTDescriptor getDescriptor(BluetoothDescriptorUUID descriptor);
|
||||
[Throws]
|
||||
sequence<BluetoothRemoteGATTDescriptor> getDescriptors(optional (DOMString or unsigned long) descriptor);
|
||||
sequence<BluetoothRemoteGATTDescriptor> getDescriptors(optional BluetoothDescriptorUUID descriptor);
|
||||
//Promise<BluetoothRemoteGATTDescriptor> getDescriptor(BluetoothDescriptorUUID descriptor);
|
||||
//Promise<sequence<BluetoothRemoteGATTDescriptor>>
|
||||
//getDescriptors(optional BluetoothDescriptorUUID descriptor);
|
||||
|
|
|
@ -13,9 +13,9 @@ interface BluetoothRemoteGATTServer {
|
|||
[Throws]
|
||||
void disconnect();
|
||||
[Throws]
|
||||
BluetoothRemoteGATTService getPrimaryService((DOMString or unsigned long) service);
|
||||
BluetoothRemoteGATTService getPrimaryService(BluetoothServiceUUID service);
|
||||
[Throws]
|
||||
sequence<BluetoothRemoteGATTService> getPrimaryServices(optional (DOMString or unsigned long) service);
|
||||
sequence<BluetoothRemoteGATTService> getPrimaryServices(optional BluetoothServiceUUID service);
|
||||
//Promise<BluetoothRemoteGATTService> getPrimaryService(BluetoothServiceUUID service);
|
||||
//Promise<sequence<BluetoothRemoteGATTService>>getPrimaryServices(optional BluetoothServiceUUID service);
|
||||
//Promise<BluetoothRemoteGATTServer> connect();
|
||||
|
|
|
@ -10,10 +10,10 @@ interface BluetoothRemoteGATTService {
|
|||
readonly attribute DOMString uuid;
|
||||
readonly attribute boolean isPrimary;
|
||||
[Throws]
|
||||
BluetoothRemoteGATTCharacteristic getCharacteristic((DOMString or unsigned long) characteristic);
|
||||
BluetoothRemoteGATTCharacteristic getCharacteristic(BluetoothCharacteristicUUID characteristic);
|
||||
[Throws]
|
||||
sequence<BluetoothRemoteGATTCharacteristic> getCharacteristics
|
||||
(optional (DOMString or unsigned long) characteristic);
|
||||
(optional BluetoothCharacteristicUUID characteristic);
|
||||
//Promise<BluetoothRemoteGATTCharacteristic>getCharacteristic(BluetoothCharacteristicUUID characteristic);
|
||||
//Promise<sequence<BluetoothRemoteGATTCharacteristic>>
|
||||
//getCharacteristics(optional BluetoothCharacteristicUUID characteristic);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue