Modules.Bluetooth.BluetoothServerSocket
A listening Bluetooth socket.
The purpose of the BluetoothSocketServer object is to listen for incoming connection requests and provide a connected BluetoothSocket after a request is accepted.
Extends: Titanium.Proxy · Since: 1.0.0 · Platforms: android
Methods #
close #
Closes the server socket.
This method, when called, closes the server socket. One cannot start accepting connections
again after calling this method. On error, this method will throw an exception.
isAccepting #
Determines whether the server socket is currently accepting connections.
Returns: Boolean — True if the server socket is accepting connections, false otherwise.
startAccept #
Inform the server socket to start accepting incoming connections.
This method, when called, starts listening for the incoming Bluetooth connections and block
until a connection is established. Listen for the
connectionReceived event to be
notified when a connection is received or the error
event when an error occured during accepting connection.
| Name | Type | Summary | Optional |
|---|---|---|---|
keepListening | Boolean | Defines whether the server socket should keep listening after an incoming connection was received. If this parameter is false, it will stop accepting connections after a single connection is recieved. | Yes |
stopAccept #
Inform the server socket to stop accepting incoming connections.
This method, when called stop accepting incoming connections. One can again start accepting
connections via startAccept method
after calling this method. On error, this method will throw an exception.
Events #
connectionReceived #
Fired when the server socket receives an incoming connection.
| Name | Type | Summary |
|---|---|---|
socket | Modules.Bluetooth.BluetoothSocket | The socket object bind to the connection. |
error #
Fired when a socket operation fails.
| Name | Type | Summary |
|---|---|---|
errorMessage | String | Description of the error. |