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

From MozillaWiki
Jump to navigation Jump to search
(→‎Event Handlers: Event Handlers of BluetoothServerSocket)
(→‎Methods: Methods of BluetoothServerSocket)
Line 61: Line 61:


== Methods ==
== Methods ==
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothServerSocket#listen|BluetoothServerSocket.listen()]]


=== listen() ===
; Description
: Listen for a socket connection using the RFCOMM protocol.
; Return
: A Promise to indicate whether the operation is resolved or rejected. Once the Promise is resolved, it returns a BluetoothSocket object which is connected to a remote device.


== See Also ==
== See Also ==
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothSocket|BluetoothSocket]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothSocket|BluetoothSocket]]

Revision as of 07:02, 5 March 2015

  • Under Construction *

Overview

BluetoothServerSocket is a listening socket which is used to listen incoming RFCOMM connection.

Interfaces

BluetoothServerSocket

[CheckPermissions="bluetoothSocket"]
interface BluetoothServerSocket: EventTarget
{
  [NewObject, Throws] Promise<BluetoothSocket> listen()
  readonly attribute DOMString serviceUuid;
  readonly attribute DOMString? serviceName;
           attribute EventHandler onclose;   // DOMString aErrorMsg

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

Properties

serviceUuid

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

serviceName

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

Event Handlers

onclose

Description
Event raised when a connection has been established for a given service UUID.
Argument
[CheckPermissions="bluetooth"]
interface BtSocketClostEvent : Event
{
  readonly attribute DOMString reason;
};
reason
A string indicating the reason the server closed the

Methods

listen()

Description
Listen for a socket connection using the RFCOMM protocol.
Return
A Promise to indicate whether the operation is resolved or rejected. Once the Promise is resolved, it returns a BluetoothSocket object which is connected to a remote device.

See Also