B2G/Bluetooth/WebBluetooth-v2/BluetoothServerSocket: Difference between revisions
< B2G | Bluetooth | WebBluetooth-v2
Jump to navigation
Jump to search
m (→BluetoothServerSocket: remove onaccept) |
m (→onclose: Fix the description) |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
BluetoothServerSocket is a listening socket which is used to listen incoming RFCOMM connection. | BluetoothServerSocket is a listening socket which is used to listen incoming RFCOMM connection. | ||
Line 11: | Line 9: | ||
interface BluetoothServerSocket: EventTarget | interface BluetoothServerSocket: EventTarget | ||
{ | { | ||
readonly attribute DOMString serviceUuid; | readonly attribute DOMString serviceUuid; | ||
readonly attribute DOMString? serviceName; | readonly attribute DOMString? serviceName; | ||
attribute EventHandler onclose; | |||
[NewObject, Throws] Promise<BluetoothSocket> listen() | |||
[NewObject, Throws] Promise<void> close(); | [NewObject, Throws] Promise<void> close(); | ||
}; | }; | ||
== Properties == | == Properties == | ||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothServerSocket#serviceUuid|BluetoothServerSocket.serviceUuid]] | |||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothServerSocket#serviceName|BluetoothServerSocket.serviceName]] | |||
=== 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 == | == Event Handlers == | ||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothServerSocket#onclose|BluetoothServerSocket.onclose]] | |||
=== onclose === | |||
; Description | |||
: Event raised when the listening socket has been close.. | |||
; Argument | |||
[CheckPermissions="bluetooth"] | |||
interface BtSocketClostEvent : Event | |||
{ | |||
readonly attribute DOMString reason; | |||
}; | |||
: ''reason'' | |||
:: A string indicating the reason the server closed the | |||
== Methods == | == Methods == | ||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothServerSocket#listen|BluetoothServerSocket.listen()]] | |||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothServerSocket#close|BluetoothServerSocket.close()]] | |||
=== 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. | |||
=== close() === | |||
; Description | |||
: Immediately close this listening socket. | |||
; Return | |||
: A Promise to indicate whether the operation is resolved or rejected. | |||
== See Also == | == See Also == | ||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothSocket|BluetoothSocket]] | * [[B2G/Bluetooth/WebBluetooth-v2/BluetoothSocket|BluetoothSocket]] |
Latest revision as of 08:44, 5 March 2015
Overview
BluetoothServerSocket is a listening socket which is used to listen incoming RFCOMM connection.
Interfaces
BluetoothServerSocket
[CheckPermissions="bluetoothSocket"] interface BluetoothServerSocket: EventTarget { readonly attribute DOMString serviceUuid; readonly attribute DOMString? serviceName; attribute EventHandler onclose; [NewObject, Throws] Promise<BluetoothSocket> listen() [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 the listening socket has been close..
- 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.
close()
- Description
- Immediately close this listening socket.
- Return
- A Promise to indicate whether the operation is resolved or rejected.