Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.rebellapp.com/llms.txt

Use this file to discover all available pages before exploring further.

Use this API to remove a listener registered with my.onBLECharacteristicValueChange. If no callback is provided, all listeners are removed.

Parameters

PropertyTypeRequiredDescription
callbackFunctionNoThe specific callback to remove. If omitted, all listeners are removed.

Code Example

Remove All Listeners

my.offBLECharacteristicValueChange();

Remove Specific Listener

Page({
  onLoad() {
    my.onBLECharacteristicValueChange(this.handleValueChange);
  },

  handleValueChange(res) {
    console.log('Value changed:', res.value);
  },

  onUnload() {
    my.offBLECharacteristicValueChange(this.handleValueChange);
  }
});

Complete BLE Cleanup

function cleanupBLE() {
  my.offBLECharacteristicValueChange();
  my.offBluetoothDeviceFound();
  my.offBluetoothAdapterStateChange();
  my.disconnectBLEDevice({ deviceId: currentDeviceId });
  my.closeBluetoothAdapter();
}

my.onBLECharacteristicValueChange

Listen for value changes

my.readBLECharacteristicValue

Trigger a read on a characteristic