The chrome.bluetoothLowEnergy API is used to communicate with Bluetooth Smart (Low Energy) devices using the
Generic Attribute Profile (GATT).
The chrome.bluetoothLowEnergy API is used to communicate with Bluetooth Smart (Low Energy) devices using the Generic Attribute Profile (GATT). * available since Chrome 37 * https://developer.chrome.com/apps/bluetoothLowEnergy
(connect device-address)
(connect device-address properties)
Establishes a connection between the application and the device with the given address. A device may be already connected and its GATT services available without calling connect, however, an app that wants to access GATT services of a device should call this function to make sure that a connection to the device is maintained. If the device is not connected, all GATT services of the device will be discovered after a successful call to connect.
|device-address| - The Bluetooth address of the remote device to which a GATT connection should be opened. |properties| - Connection 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 [].
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/bluetoothLowEnergy#method-connect.
Establishes a connection between the application and the device with the given address. A device may be already connected and its GATT services available without calling connect, however, an app that wants to access GATT services of a device should call this function to make sure that a connection to the device is maintained. If the device is not connected, all GATT services of the device will be discovered after a successful call to connect. |device-address| - The Bluetooth address of the remote device to which a GATT connection should be opened. |properties| - Connection 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 []. 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/bluetoothLowEnergy#method-connect.
(create-characteristic characteristic service-id)
Create a locally hosted GATT characteristic. This characteristic must be hosted under a valid service. If the service ID is not valid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
|characteristic| - The characteristic to create. |service-id| - ID of the service to create this characteristic for.
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 [characteristic-id] where:
|characteristic-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-characteristicId.
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/bluetoothLowEnergy#method-createCharacteristic.
Create a locally hosted GATT characteristic. This characteristic must be hosted under a valid service. If the service ID is not valid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. |characteristic| - The characteristic to create. |service-id| - ID of the service to create this characteristic for. 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 [characteristic-id] where: |characteristic-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-characteristicId. 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/bluetoothLowEnergy#method-createCharacteristic.
(create-descriptor descriptor characteristic-id)
Create a locally hosted GATT descriptor. This descriptor must be hosted under a valid characteristic. If the characteristic ID is not valid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
|descriptor| - The descriptor to create. |characteristic-id| - ID of the characteristic to create this descriptor for.
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 [descriptor-id] where:
|descriptor-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-descriptorId.
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/bluetoothLowEnergy#method-createDescriptor.
Create a locally hosted GATT descriptor. This descriptor must be hosted under a valid characteristic. If the characteristic ID is not valid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. |descriptor| - The descriptor to create. |characteristic-id| - ID of the characteristic to create this descriptor for. 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 [descriptor-id] where: |descriptor-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-descriptorId. 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/bluetoothLowEnergy#method-createDescriptor.
(create-service service)
Create a locally hosted GATT service. This service can be registered to be available on a local GATT server. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
|service| - The service to create.
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 [service-id] where:
|service-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-serviceId.
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/bluetoothLowEnergy#method-createService.
Create a locally hosted GATT service. This service can be registered to be available on a local GATT server. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. |service| - The service to create. 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 [service-id] where: |service-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-serviceId. 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/bluetoothLowEnergy#method-createService.
(disconnect device-address)
Closes the app's connection to the device with the given address. Note that this will not always destroy the physical link itself, since there may be other apps with open connections.
|device-address| - The Bluetooth address of the remote device.
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/bluetoothLowEnergy#method-disconnect.
Closes the app's connection to the device with the given address. Note that this will not always destroy the physical link itself, since there may be other apps with open connections. |device-address| - The Bluetooth address of the remote device. 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/bluetoothLowEnergy#method-disconnect.
(get-characteristic characteristic-id)
Get the GATT characteristic with the given instance ID that belongs to the given GATT service, if the characteristic exists.
|characteristic-id| - The instance ID of the requested GATT characteristic.
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 [result] where:
|result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result.
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/bluetoothLowEnergy#method-getCharacteristic.
Get the GATT characteristic with the given instance ID that belongs to the given GATT service, if the characteristic exists. |characteristic-id| - The instance ID of the requested GATT characteristic. 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 [result] where: |result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result. 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/bluetoothLowEnergy#method-getCharacteristic.
(get-characteristics service-id)
Get a list of all discovered GATT characteristics that belong to the given service.
|service-id| - The instance ID of the GATT service whose characteristics should be returned.
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 [result] where:
|result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result.
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/bluetoothLowEnergy#method-getCharacteristics.
Get a list of all discovered GATT characteristics that belong to the given service. |service-id| - The instance ID of the GATT service whose characteristics should be returned. 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 [result] where: |result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result. 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/bluetoothLowEnergy#method-getCharacteristics.
(get-descriptor descriptor-id)
Get the GATT characteristic descriptor with the given instance ID.
|descriptor-id| - The instance ID of the requested GATT characteristic descriptor.
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 [result] where:
|result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result.
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/bluetoothLowEnergy#method-getDescriptor.
Get the GATT characteristic descriptor with the given instance ID. |descriptor-id| - The instance ID of the requested GATT characteristic descriptor. 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 [result] where: |result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result. 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/bluetoothLowEnergy#method-getDescriptor.
(get-descriptors characteristic-id)
Get a list of GATT characteristic descriptors that belong to the given characteristic.
|characteristic-id| - The instance ID of the GATT characteristic whose descriptors should be returned.
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 [result] where:
|result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result.
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/bluetoothLowEnergy#method-getDescriptors.
Get a list of GATT characteristic descriptors that belong to the given characteristic. |characteristic-id| - The instance ID of the GATT characteristic whose descriptors should be returned. 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 [result] where: |result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result. 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/bluetoothLowEnergy#method-getDescriptors.
(get-included-services service-id)
Get a list of GATT services that are included by the given service.
|service-id| - The instance ID of the GATT service whose included services should be returned.
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 [result] where:
|result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result.
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/bluetoothLowEnergy#method-getIncludedServices.
Get a list of GATT services that are included by the given service. |service-id| - The instance ID of the GATT service whose included services should be returned. 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 [result] where: |result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result. 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/bluetoothLowEnergy#method-getIncludedServices.
(get-service service-id)
Get the GATT service with the given instance ID.
|service-id| - The instance ID of the requested GATT 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 [result] where:
|result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result.
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/bluetoothLowEnergy#method-getService.
Get the GATT service with the given instance ID. |service-id| - The instance ID of the requested GATT 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 [result] where: |result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result. 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/bluetoothLowEnergy#method-getService.
(get-services device-address)
Get all the GATT services that were discovered on the remote device with the given device address.Note: If service discovery is not yet complete on the device, this API will return a subset (possibly empty) of services. A work around is to add a time based delay and/or call repeatedly until the expected number of services is returned.
|device-address| - The Bluetooth address of the remote device whose GATT services should be returned.
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 [result] where:
|result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result.
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/bluetoothLowEnergy#method-getServices.
Get all the GATT services that were discovered on the remote device with the given device address.Note: If service discovery is not yet complete on the device, this API will return a subset (possibly empty) of services. A work around is to add a time based delay and/or call repeatedly until the expected number of services is returned. |device-address| - The Bluetooth address of the remote device whose GATT services should be returned. 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 [result] where: |result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result. 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/bluetoothLowEnergy#method-getServices.
(notify-characteristic-value-changed characteristic-id notification)
Notify a remote device of a new value for a characteristic. If the shouldIndicate flag in the notification object is true, an indication will be sent instead of a notification. Note, the characteristic needs to correctly set the 'notify' or 'indicate' property during creation for this call to succeed. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
|characteristic-id| - The characteristic to send the notication for. |notification| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-notifyCharacteristicValueChanged-notification.
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/bluetoothLowEnergy#method-notifyCharacteristicValueChanged.
Notify a remote device of a new value for a characteristic. If the shouldIndicate flag in the notification object is true, an indication will be sent instead of a notification. Note, the characteristic needs to correctly set the 'notify' or 'indicate' property during creation for this call to succeed. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. |characteristic-id| - The characteristic to send the notication for. |notification| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-notifyCharacteristicValueChanged-notification. 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/bluetoothLowEnergy#method-notifyCharacteristicValueChanged.
(notify-characteristic-value-changed* config characteristic-id notification)
(read-characteristic-value characteristic-id)
Retrieve the value of a specified characteristic from a remote peripheral.
|characteristic-id| - The instance ID of the GATT characteristic whose value should be read from the remote device.
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 [result] where:
|result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result.
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/bluetoothLowEnergy#method-readCharacteristicValue.
Retrieve the value of a specified characteristic from a remote peripheral. |characteristic-id| - The instance ID of the GATT characteristic whose value should be read from the remote device. 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 [result] where: |result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result. 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/bluetoothLowEnergy#method-readCharacteristicValue.
(read-descriptor-value descriptor-id)
Retrieve the value of a specified characteristic descriptor from a remote peripheral.
|descriptor-id| - The instance ID of the GATT characteristic descriptor whose value should be read from the remote device.
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 [result] where:
|result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result.
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/bluetoothLowEnergy#method-readDescriptorValue.
Retrieve the value of a specified characteristic descriptor from a remote peripheral. |descriptor-id| - The instance ID of the GATT characteristic descriptor whose value should be read from the remote device. 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 [result] where: |result| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-result. 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/bluetoothLowEnergy#method-readDescriptorValue.
(register-advertisement advertisement)
Create an advertisement and register it for advertising. To call this function, the app must have the bluetooth:low_energy and bluetooth:peripheral permissions set to true. Additionally this API is only available to auto launched apps in Kiosk Mode of by setting the 'enable-ble-advertising-in-apps' flag. See https://developer.chrome.com/apps/manifest/bluetooth Note: On some hardware, central and peripheral modes at the same time is supported but on hardware that doesn't support this, making this call will switch the device to peripheral mode. In the case of hardware which does not support both central and peripheral mode, attempting to use the device in both modes will lead to undefined behavior or prevent other central-role applications from behaving correctly (including the discovery of Bluetooth Low Energy devices).
|advertisement| - The advertisement to advertise.
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 [advertisement-id] where:
|advertisement-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-advertisementId.
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/bluetoothLowEnergy#method-registerAdvertisement.
Create an advertisement and register it for advertising. To call this function, the app must have the bluetooth:low_energy and bluetooth:peripheral permissions set to true. Additionally this API is only available to auto launched apps in Kiosk Mode of by setting the 'enable-ble-advertising-in-apps' flag. See https://developer.chrome.com/apps/manifest/bluetooth Note: On some hardware, central and peripheral modes at the same time is supported but on hardware that doesn't support this, making this call will switch the device to peripheral mode. In the case of hardware which does not support both central and peripheral mode, attempting to use the device in both modes will lead to undefined behavior or prevent other central-role applications from behaving correctly (including the discovery of Bluetooth Low Energy devices). |advertisement| - The advertisement to advertise. 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 [advertisement-id] where: |advertisement-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-callback-advertisementId. 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/bluetoothLowEnergy#method-registerAdvertisement.
(register-service service-id)
Register the given service with the local GATT server. If the service ID is invalid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
|service-id| - Unique ID of a created 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/bluetoothLowEnergy#method-registerService.
Register the given service with the local GATT server. If the service ID is invalid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. |service-id| - Unique ID of a created 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/bluetoothLowEnergy#method-registerService.
(remove-service service-id)
Remove the specified service, unregistering it if it was registered. If the service ID is invalid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
|service-id| - Unique ID of a current registered 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/bluetoothLowEnergy#method-removeService.
Remove the specified service, unregistering it if it was registered. If the service ID is invalid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. |service-id| - Unique ID of a current registered 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/bluetoothLowEnergy#method-removeService.
(reset-advertising)
Resets advertising on the current device. It will unregister and stop all existing advertisements.
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/bluetoothLowEnergy#method-resetAdvertising.
Resets advertising on the current device. It will unregister and stop all existing advertisements. 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/bluetoothLowEnergy#method-resetAdvertising.
(send-request-response response)
Sends a response for a characteristic or descriptor read/write request. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
|response| - The response to the request.
https://developer.chrome.com/apps/bluetoothLowEnergy#method-sendRequestResponse.
Sends a response for a characteristic or descriptor read/write request. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. |response| - The response to the request. https://developer.chrome.com/apps/bluetoothLowEnergy#method-sendRequestResponse.
(set-advertising-interval min-interval max-interval)
Set's the interval betweeen two consecutive advertisements. Note: This is a best effort. The actual interval may vary non-trivially from the requested intervals. On some hardware, there is a minimum interval of 100ms. The minimum and maximum values cannot exceed the the range allowed by the Bluetooth 4.2 specification.
|min-interval| - Minimum interval between advertisments (in milliseconds). This cannot be lower than 20ms (as per the spec). |max-interval| - Maximum interval between advertisments (in milliseconds). This cannot be more than 10240ms (as per the spec).
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/bluetoothLowEnergy#method-setAdvertisingInterval.
Set's the interval betweeen two consecutive advertisements. Note: This is a best effort. The actual interval may vary non-trivially from the requested intervals. On some hardware, there is a minimum interval of 100ms. The minimum and maximum values cannot exceed the the range allowed by the Bluetooth 4.2 specification. |min-interval| - Minimum interval between advertisments (in milliseconds). This cannot be lower than 20ms (as per the spec). |max-interval| - Maximum interval between advertisments (in milliseconds). This cannot be more than 10240ms (as per the spec). 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/bluetoothLowEnergy#method-setAdvertisingInterval.
(start-characteristic-notifications characteristic-id)
(start-characteristic-notifications characteristic-id properties)
Enable value notifications/indications from the specified characteristic. Once enabled, an application can listen to notifications using the 'onCharacteristicValueChanged' event.
|characteristic-id| - The instance ID of the GATT characteristic that notifications should be enabled on. |properties| - Notification session 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 [].
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/bluetoothLowEnergy#method-startCharacteristicNotifications.
Enable value notifications/indications from the specified characteristic. Once enabled, an application can listen to notifications using the 'onCharacteristicValueChanged' event. |characteristic-id| - The instance ID of the GATT characteristic that notifications should be enabled on. |properties| - Notification session 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 []. 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/bluetoothLowEnergy#method-startCharacteristicNotifications.
(start-characteristic-notifications* config characteristic-id properties)
(stop-characteristic-notifications characteristic-id)
Disable value notifications/indications from the specified characteristic. After a successful call, the application will stop receiving notifications/indications from this characteristic.
|characteristic-id| - The instance ID of the GATT characteristic on which this app's notification session should be stopped.
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/bluetoothLowEnergy#method-stopCharacteristicNotifications.
Disable value notifications/indications from the specified characteristic. After a successful call, the application will stop receiving notifications/indications from this characteristic. |characteristic-id| - The instance ID of the GATT characteristic on which this app's notification session should be stopped. 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/bluetoothLowEnergy#method-stopCharacteristicNotifications.
(stop-characteristic-notifications* config characteristic-id)
(tap-all-events chan)
Taps all valid non-deprecated events in chromex.app.bluetooth-low-energy namespace.
Taps all valid non-deprecated events in chromex.app.bluetooth-low-energy namespace.
(tap-on-characteristic-read-request-events channel & args)
Fired when a connected central device requests to read the value of a characteristic registered on the local GATT server. Not responding to this request for a long time may lead to a disconnection. This event is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
Events will be put on the |channel| with signature [::on-characteristic-read-request [request characteristic-id]] where:
|request| - Request data for this request. |characteristic-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-onCharacteristicReadRequest-characteristicId.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothLowEnergy#event-onCharacteristicReadRequest.
Fired when a connected central device requests to read the value of a characteristic registered on the local GATT server. Not responding to this request for a long time may lead to a disconnection. This event is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. Events will be put on the |channel| with signature [::on-characteristic-read-request [request characteristic-id]] where: |request| - Request data for this request. |characteristic-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-onCharacteristicReadRequest-characteristicId. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothLowEnergy#event-onCharacteristicReadRequest.
(tap-on-characteristic-value-changed-events channel & args)
Fired when the value of a remote GATT characteristic changes, either as a result of a read request, or a value change notification/indication This event will only be sent if the app has enabled notifications by calling 'startCharacteristicNotifications'.
Events will be put on the |channel| with signature [::on-characteristic-value-changed [characteristic]] where:
|characteristic| - The GATT characteristic whose value has changed.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothLowEnergy#event-onCharacteristicValueChanged.
Fired when the value of a remote GATT characteristic changes, either as a result of a read request, or a value change notification/indication This event will only be sent if the app has enabled notifications by calling 'startCharacteristicNotifications'. Events will be put on the |channel| with signature [::on-characteristic-value-changed [characteristic]] where: |characteristic| - The GATT characteristic whose value has changed. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothLowEnergy#event-onCharacteristicValueChanged.
(tap-on-characteristic-write-request-events channel & args)
Fired when a connected central device requests to write the value of a characteristic registered on the local GATT server. Not responding to this request for a long time may lead to a disconnection. This event is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
Events will be put on the |channel| with signature [::on-characteristic-write-request [request characteristic-id]] where:
|request| - Request data for this request. |characteristic-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-onCharacteristicWriteRequest-characteristicId.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothLowEnergy#event-onCharacteristicWriteRequest.
Fired when a connected central device requests to write the value of a characteristic registered on the local GATT server. Not responding to this request for a long time may lead to a disconnection. This event is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. Events will be put on the |channel| with signature [::on-characteristic-write-request [request characteristic-id]] where: |request| - Request data for this request. |characteristic-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-onCharacteristicWriteRequest-characteristicId. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothLowEnergy#event-onCharacteristicWriteRequest.
(tap-on-descriptor-read-request-events channel & args)
Fired when a connected central device requests to read the value of a descriptor registered on the local GATT server. Not responding to this request for a long time may lead to a disconnection. This event is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
Events will be put on the |channel| with signature [::on-descriptor-read-request [request descriptor-id]] where:
|request| - Request data for this request. |descriptor-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-onDescriptorReadRequest-descriptorId.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothLowEnergy#event-onDescriptorReadRequest.
Fired when a connected central device requests to read the value of a descriptor registered on the local GATT server. Not responding to this request for a long time may lead to a disconnection. This event is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. Events will be put on the |channel| with signature [::on-descriptor-read-request [request descriptor-id]] where: |request| - Request data for this request. |descriptor-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-onDescriptorReadRequest-descriptorId. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothLowEnergy#event-onDescriptorReadRequest.
(tap-on-descriptor-value-changed-events channel & args)
Fired when the value of a remote GATT characteristic descriptor changes, usually as a result of a read request. This event exists mostly for convenience and will always be sent after a successful call to 'readDescriptorValue'.
Events will be put on the |channel| with signature [::on-descriptor-value-changed [descriptor]] where:
|descriptor| - The GATT characteristic descriptor whose value has changed.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothLowEnergy#event-onDescriptorValueChanged.
Fired when the value of a remote GATT characteristic descriptor changes, usually as a result of a read request. This event exists mostly for convenience and will always be sent after a successful call to 'readDescriptorValue'. Events will be put on the |channel| with signature [::on-descriptor-value-changed [descriptor]] where: |descriptor| - The GATT characteristic descriptor whose value has changed. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothLowEnergy#event-onDescriptorValueChanged.
(tap-on-descriptor-write-request-events channel & args)
Fired when a connected central device requests to write the value of a descriptor registered on the local GATT server. Not responding to this request for a long time may lead to a disconnection. This event is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
Events will be put on the |channel| with signature [::on-descriptor-write-request [request descriptor-id]] where:
|request| - Request data for this request. |descriptor-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-onDescriptorWriteRequest-descriptorId.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothLowEnergy#event-onDescriptorWriteRequest.
Fired when a connected central device requests to write the value of a descriptor registered on the local GATT server. Not responding to this request for a long time may lead to a disconnection. This event is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. Events will be put on the |channel| with signature [::on-descriptor-write-request [request descriptor-id]] where: |request| - Request data for this request. |descriptor-id| - https://developer.chrome.com/apps/bluetoothLowEnergy#property-onDescriptorWriteRequest-descriptorId. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothLowEnergy#event-onDescriptorWriteRequest.
(tap-on-service-added-events channel & args)
Fired whan a new GATT service has been discovered on a remote device.
Events will be put on the |channel| with signature [::on-service-added [service]] where:
|service| - The GATT service that was added.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothLowEnergy#event-onServiceAdded.
Fired whan a new GATT service has been discovered on a remote device. Events will be put on the |channel| with signature [::on-service-added [service]] where: |service| - The GATT service that was added. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothLowEnergy#event-onServiceAdded.
(tap-on-service-changed-events channel & args)
Fired when the state of a remote GATT service changes. This involves any characteristics and/or descriptors that get added or removed from the service, as well as 'ServiceChanged' notifications from the remote device.
Events will be put on the |channel| with signature [::on-service-changed [service]] where:
|service| - The GATT service whose state has changed.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothLowEnergy#event-onServiceChanged.
Fired when the state of a remote GATT service changes. This involves any characteristics and/or descriptors that get added or removed from the service, as well as 'ServiceChanged' notifications from the remote device. Events will be put on the |channel| with signature [::on-service-changed [service]] where: |service| - The GATT service whose state has changed. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothLowEnergy#event-onServiceChanged.
(tap-on-service-removed-events channel & args)
Fired when a GATT service that was previously discovered on a remote device has been removed.
Events will be put on the |channel| with signature [::on-service-removed [service]] where:
|service| - The GATT service that was removed.
Note: |args| will be passed as additional parameters into Chrome event's .addListener call.
https://developer.chrome.com/apps/bluetoothLowEnergy#event-onServiceRemoved.
Fired when a GATT service that was previously discovered on a remote device has been removed. Events will be put on the |channel| with signature [::on-service-removed [service]] where: |service| - The GATT service that was removed. Note: |args| will be passed as additional parameters into Chrome event's .addListener call. https://developer.chrome.com/apps/bluetoothLowEnergy#event-onServiceRemoved.
(unregister-advertisement advertisement-id)
Unregisters an advertisement and stops its advertising. If the advertisement fails to unregister the only way to stop advertising might be to restart the device.
|advertisement-id| - Id of the advertisement to unregister.
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/bluetoothLowEnergy#method-unregisterAdvertisement.
Unregisters an advertisement and stops its advertising. If the advertisement fails to unregister the only way to stop advertising might be to restart the device. |advertisement-id| - Id of the advertisement to unregister. 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/bluetoothLowEnergy#method-unregisterAdvertisement.
(unregister-service service-id)
Unregister the given service with the local GATT server. If the service ID is invalid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps.
|service-id| - Unique ID of a current registered 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/bluetoothLowEnergy#method-unregisterService.
Unregister the given service with the local GATT server. If the service ID is invalid, the lastError will be set. This function is only available if the app has both the bluetooth:low_energy and the bluetooth:peripheral permissions set to true. The peripheral permission may not be available to all apps. |service-id| - Unique ID of a current registered 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/bluetoothLowEnergy#method-unregisterService.
(write-characteristic-value characteristic-id value)
Write the value of a specified characteristic from a remote peripheral.
|characteristic-id| - The instance ID of the GATT characteristic whose value should be written to. |value| - The value that should be sent to the remote characteristic as part of the write request.
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/bluetoothLowEnergy#method-writeCharacteristicValue.
Write the value of a specified characteristic from a remote peripheral. |characteristic-id| - The instance ID of the GATT characteristic whose value should be written to. |value| - The value that should be sent to the remote characteristic as part of the write request. 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/bluetoothLowEnergy#method-writeCharacteristicValue.
(write-descriptor-value descriptor-id value)
Write the value of a specified characteristic descriptor from a remote peripheral.
|descriptor-id| - The instance ID of the GATT characteristic descriptor whose value should be written to. |value| - The value that should be sent to the remote descriptor as part of the write request.
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/bluetoothLowEnergy#method-writeDescriptorValue.
Write the value of a specified characteristic descriptor from a remote peripheral. |descriptor-id| - The instance ID of the GATT characteristic descriptor whose value should be written to. |value| - The value that should be sent to the remote descriptor as part of the write request. 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/bluetoothLowEnergy#method-writeDescriptorValue.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close