startBLEScanBindDevice(params: Object)

Requires:
DeviceKit≥2.1.6@ray-js/ray≥0.6.23
Platforms:
iOSAndroid
import { device } from '@ray-js/ray';

const { startBLEScanBindDevice } = device;

// Promise usage
try {
  const res = await startBLEScanBindDevice({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Scan for provisioned devices within the specified time; results are obtained via the 【onBLEScanBindDevice】 event

Parameters

PropertyTypeRequiredDescription
intervalnumberYesScan interval. If < 0, return an error
scanTypestringYesDeprecated: Scan does not distinguish type Scan types SINGLE -> "SINGLE" SINGLE_QR -> "SINGLE_QR" MESH -> "MESH" SIG_MESH -> "SIG_MESH" NORMAL -> "NORMAL" Thing_BEACON -> "Thing_BEACON"
complete() => voidNoCompletion callback (executed on both success and failure)
success() => voidNoCallback on successful API call
fail(params: Object) => voidNoFailure callback
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { device } from '@ray-js/ray'

device.startBLEScanBindDevice({
  interval: 1,
  scanType: "xx",
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});