Fix value types

This commit is contained in:
Attila Dusnoki 2016-03-22 14:24:45 +01:00
parent ddada69acb
commit 9e57364795
2 changed files with 48 additions and 44 deletions

View file

@ -12,13 +12,16 @@ use dom::bindings::reflector::{Reflector, reflect_dom_object};
#[dom_struct]
pub struct BluetoothAdvertisingData {
reflector_: Reflector,
appearance: u16,
txPower: i8,
rssi: i8,
appearance: Option<u16>,
txPower: Option<i8>,
rssi: Option<i8>,
}
impl BluetoothAdvertisingData {
pub fn new_inherited(appearance: u16, txPower: i8, rssi: i8) -> BluetoothAdvertisingData {
pub fn new_inherited(appearance: Option<u16>,
txPower: Option<i8>,
rssi: Option<i8>)
-> BluetoothAdvertisingData {
BluetoothAdvertisingData {
reflector_: Reflector::new(),
appearance: appearance,
@ -27,7 +30,11 @@ impl BluetoothAdvertisingData {
}
}
pub fn new(global: GlobalRef, appearance: u16, txPower: i8, rssi: i8) -> Root<BluetoothAdvertisingData> {
pub fn new(global: GlobalRef,
appearance: Option<u16>,
txPower: Option<i8>,
rssi: Option<i8>)
-> Root<BluetoothAdvertisingData> {
reflect_dom_object(box BluetoothAdvertisingData::new_inherited(appearance,
txPower,
rssi),
@ -39,16 +46,16 @@ impl BluetoothAdvertisingData {
impl BluetoothAdvertisingDataMethods for BluetoothAdvertisingData {
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingdata-appearance
fn GetAppearance(&self) -> Option<u16> {
Some(self.appearance)
self.appearance
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingdata-txpower
fn GetTxPower(&self) -> Option<i8> {
Some(self.txPower)
self.txPower
}
// https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetoothadvertisingdata-rssi
fn GetRssi(&self) -> Option<i8> {
Some(self.rssi)
self.rssi
}
}