web-bluetooth-utils
Convenience functions for Web Bluetooth
Install
npm install --save web-bluetooth-utils
Example usage
navigatorbluetooth;
API
Characteristic.getFloat32Value
BluetoothRemoteGATTCharacteristic
Returns the cached value of the characteristic as a signed 32-bit float (float) at the specified byte offset.
Characteristic.getFloat64Value
BluetoothRemoteGATTCharacteristic
Returns the cached value of the characteristic as a signed 64-bit float (double) at the specified byte offset.
Characteristic.getInt16Value
BluetoothRemoteGATTCharacteristic
Returns the cached value of the characteristic as a signed 16-bit integer (short) at the specified byte offset.
Characteristic.getInt32Value
BluetoothRemoteGATTCharacteristic
Returns the cached value of the characteristic as a signed 32-bit integer (long) at the specified byte offset.
Characteristic.getInt8Value
BluetoothRemoteGATTCharacteristic
Returns the cached value of the characteristic as a signed 8-bit integer (byte) at the specified byte offset.
Characteristic.getStringValue
BluetoothRemoteGATTCharacteristic
Returns the cached value of the characteristic as a string containing the text decoded with the decoding algorithm.
Characteristic.getUint16Value
BluetoothRemoteGATTCharacteristic
Returns the cached value of the characteristic as an unsigned 16-bit integer (unsigned short) at the specified byte offset.
Characteristic.getUint32Value
BluetoothRemoteGATTCharacteristic
Returns the cached value of the characteristic as an unsigned 32-bit integer (unsigned long) at the specified byte offset.
Characteristic.getUint8Value
BluetoothRemoteGATTCharacteristic
Returns the cached value of the characteristic as an unsigned 8-bit integer (unsigned byte) at the specified byte offset.
Service.getCharacteristics
BluetoothRemoteGATTService
If characteristics
is an Array, returns all service's characteristics matching all characteristics UUIDs.
If characteristics
is a String, returns all service's characteristics matching the unique UUID.
Device.getCharacteristicFromPrimaryService
BluetoothDevice
Returns the characteristic from a primary service.
Device.readCharacteristicValueFromPrimaryService
BluetoothDevice
Reads the value of a characteristic from a primary service as a DataView
object.
If optionalCallback
is passed, it will be called with the characteristic value and optionalArgs
arguments.
Device.readFloat32CharacteristicValueFromPrimaryService
BluetoothDevice
Reads the value of the characteristic from a primary service as a signed 32-bit float (float) at the specified byte offset.
Device.readFloat64CharacteristicValueFromPrimaryService
BluetoothDevice
Reads the value of the characteristic from a primary service as a signed 64-bit float (double) at the specified byte offset.
Device.readInt16CharacteristicValueFromPrimaryService
BluetoothDevicereadInt16CharacteristicValueFromPrimaryService
Reads the value of the characteristic from a primary service as a signed 16-bit integer (short) at the specified byte offset.
Device.readInt32CharacteristicValueFromPrimaryService
BluetoothDevice
Reads the value of the characteristic from a primary service as a signed 32-bit integer (long) at the specified byte offset.
Device.readInt8CharacteristicValueFromPrimaryService
BluetoothDevice
Reads the value of the characteristic from a primary service as a signed 8-bit integer (byte) at the specified byte offset.
Device.readStringCharacteristicValueFromPrimaryService
BluetoothDevice
Reads the value of the characteristic from a primary service as a string containing the text decoded with the decoding algorithm.
Device.readUint16CharacteristicValueFromPrimaryService
BluetoothDevice
Reads the value of the characteristic from a primary service as an unsigned 16-bit integer (unsigned short) at the specified byte offset.
Device.readUint32CharacteristicValueFromPrimaryService
BluetoothDevice
Reads the value of the characteristic from a primary service as an unsigned 32-bit integer (unsigned long) at the specified byte offset.
Device.readUint8CharacteristicValueFromPrimaryService
BluetoothDevice
Reads the value of the characteristic from a primary service as an unsigned 8-bit integer (unsigned byte) at the specified byte offset.
Device.writeCharacteristicValueFromPrimaryService
BluetoothDevice
Writes data to a characteristic from a primary service.
Device.startCharacteristicNotificationsFromPrimaryService
BluetoothDevice
Start notifications from a characteristic from a primary service and attach an event listener.
Device.stopCharacteristicNotificationsFromPrimaryService
BluetoothDevice
Stop notifications from a characteristic from a primary service and remove an event listener.