Use the chrome.bluetoothSocket API to send and receive data to Bluetooth devices using RFCOMM and L2CAP connections.
Use the chrome.bluetoothSocket API to send and receive data to Bluetooth devices using RFCOMM and L2CAP connections. * available since Chrome 37 * https://developer.chrome.com/apps/bluetoothSocket
(close socket-id)
Disconnects and destroys the socket. Each socket created should be closed after use. The socket id is no longer valid as soon at the function is called. However, the socket is guaranteed to be closed only when the callback is invoked.
|socket-id| - The socket identifier.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-close.
Disconnects and destroys the socket. Each socket created should be closed after use. The socket id is no longer valid as soon at the function is called. However, the socket is guaranteed to be closed only when the callback is invoked. |socket-id| - The socket identifier. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-close.
(connect socket-id address uuid)
Connects the socket to a remote Bluetooth device. When the connect operation completes successfully, onReceive events are raised when data is received from the peer. If a network error occur while the runtime is receiving packets, a onReceiveError event is raised, at which point no more onReceive event will be raised for this socket until the setPaused(false) method is called.
|socket-id| - The socket identifier. |address| - The address of the Bluetooth device. |uuid| - The UUID of the service to connect to.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-connect.
Connects the socket to a remote Bluetooth device. When the connect operation completes successfully, onReceive events are raised when data is received from the peer. If a network error occur while the runtime is receiving packets, a onReceiveError event is raised, at which point no more onReceive event will be raised for this socket until the setPaused(false) method is called. |socket-id| - The socket identifier. |address| - The address of the Bluetooth device. |uuid| - The UUID of the service to connect to. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-connect.
(create)
(create properties)
Creates a Bluetooth socket.
|properties| - The socket properties (optional).
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [create-info] where:
|create-info| - The result of the socket creation.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-create.
Creates a Bluetooth socket. |properties| - The socket properties (optional). This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [create-info] where: |create-info| - The result of the socket creation. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-create.
(disconnect socket-id)
Disconnects the socket. The socket identifier remains valid.
|socket-id| - The socket identifier.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-disconnect.
Disconnects the socket. The socket identifier remains valid. |socket-id| - The socket identifier. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-disconnect.
(get-info socket-id)
Retrieves the state of the given socket.
|socket-id| - The socket identifier.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [socket-info] where:
|socket-info| - Object containing the socket information.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-getInfo.
Retrieves the state of the given socket. |socket-id| - The socket identifier. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [socket-info] where: |socket-info| - Object containing the socket information. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-getInfo.
(get-sockets)
Retrieves the list of currently opened sockets owned by the application.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [sockets] where:
|sockets| - https://developer.chrome.com/apps/bluetoothSocket#property-callback-sockets.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-getSockets.
Retrieves the list of currently opened sockets owned by the application. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [sockets] where: |sockets| - https://developer.chrome.com/apps/bluetoothSocket#property-callback-sockets. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-getSockets.
(listen-using-l2cap socket-id uuid)
(listen-using-l2cap socket-id uuid options)
Listen for connections using the L2CAP protocol.
|socket-id| - The socket identifier. |uuid| - Service UUID to listen on. |options| - Optional additional options for the service.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-listenUsingL2cap.
Listen for connections using the L2CAP protocol. |socket-id| - The socket identifier. |uuid| - Service UUID to listen on. |options| - Optional additional options for the service. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-listenUsingL2cap.
(listen-using-rfcomm socket-id uuid)
(listen-using-rfcomm socket-id uuid options)
Listen for connections using the RFCOMM protocol.
|socket-id| - The socket identifier. |uuid| - Service UUID to listen on. |options| - Optional additional options for the service.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-listenUsingRfcomm.
Listen for connections using the RFCOMM protocol. |socket-id| - The socket identifier. |uuid| - Service UUID to listen on. |options| - Optional additional options for the service. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-listenUsingRfcomm.
(send socket-id data)
Sends data on the given Bluetooth socket.
|socket-id| - The socket identifier. |data| - The data to send.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [bytes-sent] where:
|bytes-sent| - The number of bytes sent.
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-send.
Sends data on the given Bluetooth socket. |socket-id| - The socket identifier. |data| - The data to send. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is [bytes-sent] where: |bytes-sent| - The number of bytes sent. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-send.
(set-paused socket-id paused)
Enables or disables a connected socket from receiving messages from its peer, or a listening socket from accepting new connections. The default value is 'false'. Pausing a connected socket is typically used by an application to throttle data sent by its peer. When a connected socket is paused, no onReceiveevent is raised. When a socket is connected and un-paused, onReceive events are raised again when messages are received. When a listening socket is paused, new connections are accepted until its backlog is full then additional connection requests are refused. onAccept events are raised only when the socket is un-paused.
|socket-id| - https://developer.chrome.com/apps/bluetoothSocket#property-setPaused-socketId. |paused| - https://developer.chrome.com/apps/bluetoothSocket#property-setPaused-paused.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-setPaused.
Enables or disables a connected socket from receiving messages from its peer, or a listening socket from accepting new connections. The default value is 'false'. Pausing a connected socket is typically used by an application to throttle data sent by its peer. When a connected socket is paused, no onReceiveevent is raised. When a socket is connected and un-paused, onReceive events are raised again when messages are received. When a listening socket is paused, new connections are accepted until its backlog is full then additional connection requests are refused. onAccept events are raised only when the socket is un-paused. |socket-id| - https://developer.chrome.com/apps/bluetoothSocket#property-setPaused-socketId. |paused| - https://developer.chrome.com/apps/bluetoothSocket#property-setPaused-paused. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-setPaused.
(tap-all-events chan)
Taps all valid non-deprecated events in chromex.app.bluetooth-socket namespace.
Taps all valid non-deprecated events in chromex.app.bluetooth-socket namespace.
(tap-on-accept-error-events channel & args)
Event raised when a network error occurred while the runtime was waiting for new connections on the given socket. Once this event is raised, the socket is set to paused and no more onAccept events are raised for this socket.
Events will be put on the |channel| with signature [::on-accept-error [info]] where:
|info| - The event data.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothSocket#event-onAcceptError.
Event raised when a network error occurred while the runtime was waiting for new connections on the given socket. Once this event is raised, the socket is set to paused and no more onAccept events are raised for this socket. Events will be put on the |channel| with signature [::on-accept-error [info]] where: |info| - The event data. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothSocket#event-onAcceptError.
(tap-on-accept-events channel & args)
Event raised when a connection has been established for a given socket.
Events will be put on the |channel| with signature [::on-accept [info]] where:
|info| - The event data.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothSocket#event-onAccept.
Event raised when a connection has been established for a given socket. Events will be put on the |channel| with signature [::on-accept [info]] where: |info| - The event data. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothSocket#event-onAccept.
(tap-on-receive-error-events channel & args)
Event raised when a network error occured while the runtime was waiting for data on the socket. Once this event is raised, the socket is set to paused and no more onReceive events are raised for this socket.
Events will be put on the |channel| with signature [::on-receive-error [info]] where:
|info| - The event data.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothSocket#event-onReceiveError.
Event raised when a network error occured while the runtime was waiting for data on the socket. Once this event is raised, the socket is set to paused and no more onReceive events are raised for this socket. Events will be put on the |channel| with signature [::on-receive-error [info]] where: |info| - The event data. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothSocket#event-onReceiveError.
(tap-on-receive-events channel & args)
Event raised when data has been received for a given socket.
Events will be put on the |channel| with signature [::on-receive [info]] where:
|info| - The event data.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothSocket#event-onReceive.
Event raised when data has been received for a given socket. Events will be put on the |channel| with signature [::on-receive [info]] where: |info| - The event data. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothSocket#event-onReceive.
(update socket-id properties)
Updates the socket properties.
|socket-id| - The socket identifier. |properties| - The properties to update.
This function returns a core.async channel of type promise-chan
which eventually receives a result value.
Signature of the result value put on the channel is [].
In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.
https://developer.chrome.com/apps/bluetoothSocket#method-update.
Updates the socket properties. |socket-id| - The socket identifier. |properties| - The properties to update. This function returns a core.async channel of type `promise-chan` which eventually receives a result value. Signature of the result value put on the channel is []. In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error. https://developer.chrome.com/apps/bluetoothSocket#method-update.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close