B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Overview ==
== Overview ==
'''BluetoothAdapterEvent''' is carried as the argument of [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothManager#onadapteradded manager.onadapteradded] and [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothManager#onadapterremoved manager.onadapterremoved] event handlers. Applications can know whether the added/removed adapter is default adapter, and get the added [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter BluetoothAdapter] object or the address of removed adapter.
'''BluetoothAdapterEvent''' is carried as the parameter of [[B2G/Bluetooth/WebBluetooth-v2/BluetoothManager#onadapteradded|manager.onadapteradded]] and [[B2G/Bluetooth/WebBluetooth-v2/BluetoothManager#onadapterremoved|manager.onadapterremoved]] event handlers. Applications can get the added [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter|BluetoothAdapter]] object or the address of removed adapter.


== Interface ==
== Interface ==
[CheckPermissions="bluetooth"]
  interface BluetoothAdapterEvent : Event
  interface BluetoothAdapterEvent : Event
  {
  {
  readonly attribute boolean          isDefault;
   readonly attribute BluetoothAdapter? [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#adapter|adapter]];
   readonly attribute BluetoothAdapter? adapter;
   readonly attribute DOMString?        [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#address|address]];
   readonly attribute DOMString?        address;
  };
  };


== Properties ==
== Properties ==
* [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#isDefault BluetoothAdapterEvent.isDefault]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#adapter|BluetoothAdapterEvent.adapter]]
* [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#adapter BluetoothAdapterEvent.adapter]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#address|BluetoothAdapterEvent.address]]
* [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapterEvent#address BluetoothAdapterEvent.address]
 
=== isDefault ===
; Description
: Whether the added/removed adapter is default adapter (true) or not (false).
 
; Value type
: boolean


=== adapter ===
=== adapter ===
; Description
; Description
: The added adapter.
: The added adapter. The property is null for event handler [[B2G/Bluetooth/WebBluetooth-v2/BluetoothManager#onadapterremoved|manager.onadapterremoved]] since the corresponding [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter|BluetoothAdapter]] is already removed.


; Value type
; Value type
: [https://wiki.mozilla.org/B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter BluetoothAdapter]
: [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter|BluetoothAdapter]]
 
; Default value
: Null pointer


=== address ===
=== address ===
; Description
; Description
: The address of removed adapter.
: The address of removed adapter. The property is empty string for event handler [[B2G/Bluetooth/WebBluetooth-v2/BluetoothManager#onadapteradded|manager.onadapteradded]] since [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter|BluetoothAdapter]] already has property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothAdapter#address|address]].


; Value type
; Value type
: DOMString
: DOMString
; Default value
: Empty string ("")

Latest revision as of 01:50, 25 January 2016

Overview

BluetoothAdapterEvent is carried as the parameter of manager.onadapteradded and manager.onadapterremoved event handlers. Applications can get the added BluetoothAdapter object or the address of removed adapter.

Interface

[CheckPermissions="bluetooth"]
interface BluetoothAdapterEvent : Event
{
  readonly attribute BluetoothAdapter? adapter;
  readonly attribute DOMString?        address;
};

Properties

adapter

Description
The added adapter. The property is null for event handler manager.onadapterremoved since the corresponding BluetoothAdapter is already removed.
Value type
BluetoothAdapter

address

Description
The address of removed adapter. The property is empty string for event handler manager.onadapteradded since BluetoothAdapter already has property address.
Value type
DOMString