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

From MozillaWiki
Jump to navigation Jump to search
m (→‎BluetoothSocket: adjust layout)
(→‎Properties: Properties of BluetoothSocket)
Line 35: Line 35:


== Properties ==
== Properties ==
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothSocket#state|BluetoothSocket.state]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothSocket#serviceUuid|BluetoothSocket.serviceUuid]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothSocket#address|BluetoothSocket.address]]


=== state ===
; Description
: The current connection state of Bluetooth socket to the remote device. This property is set to default value (BluetoothSocketState.closed) before connection is established.
; Value type
: [[B2G/Bluetooth/WebBluetooth-v2/BluetoothSocket#BluetoothSocketState|BluetoothSocketState]]
; Default value
: BluetoothSocketState.closed
=== serviceUuid ===
; Description
: The service name this server socket expected to accept for.
; Value type
: DOMString
; Default value
: Empty string ("")
=== address ===
; Description
: The BD address of the remote device which this socket is connected to.
; Value type
: DOMString
; Default value
: Empty string ("")


== Event Handlers ==
== Event Handlers ==

Revision as of 08:33, 5 March 2015

  • Under Construction *

Overview

BluetoothSocket is used to send and receive data to Bluetooth devices using RFCOMM connections.

Interfaces

BluetoothSocket

[CheckPermissions="bluetoothSocket"]
interface BluetoothSocket: EventTarget
{
  readonly attribute BluetoothSocketState state;
  readonly attribute DOMString serviceUuid;
  readonly attribute DOMString address;

           attribute EventHandler onmessage;
           attribute EventHandler onclose;
           attribute EventHandler onconnect;

  [NewObject, Throws] Promise<void> send(ArrayBuffer aData);
  [NewObject, Throws] Promise<void> close();
};

BluetoothSocketState

[CheckPermissions="bluetoothSocket"]
enum BluetoothSocketState
{
  "connecting",
  "open",
  "closing",
  "closed"
};

Properties

state

Description
The current connection state of Bluetooth socket to the remote device. This property is set to default value (BluetoothSocketState.closed) before connection is established.
Value type
BluetoothSocketState
Default value
BluetoothSocketState.closed

serviceUuid

Description
The service name this server socket expected to accept for.
Value type
DOMString
Default value
Empty string ("")

address

Description
The BD address of the remote device which this socket is connected to.
Value type
DOMString
Default value
Empty string ("")

Event Handlers

Methods

See Also