connectBluetoothDevice
Requires:
DeviceKit≥3.1.0@ray-js/ray≥0.8.0
Platforms:
iOSAndroid
Method signature
connectBluetoothDevice(params: )Minimum SDK versions
- iOS
ThingSmartDeviceKitBizBundle - ≥ 5.2.0
- Android
com.thingclips.smart:thingsmart-bizbundle-devicekit - ≥ 5.2.0
Description
Aggregated Bluetooth connection API; supports ble, ble in dual-mode, beacon, mesh, and mesh single-live-wire connections.
Parameters
| Property | Type | Required | Default | Description | DeviceKit Since | Minimum SDK versions |
|---|---|---|---|---|---|---|
devId | string | Yes | - | Device ID | - | — |
timeoutMillis | number | No | 15000 | Connection timeout Unit: milliseconds | - | — |
souceType | number | No | 0 | Source type If it's an automatic connection from a panel, pass 1; otherwise the default is 0 for a manual connection | - | — |
connectType | number | No | 0 | Bluetooth connection mode (default: 0) 0: Gateway and app. Default mode; effective if either the local or gateway path is available. 1: App only. Only checks whether the device is locally online and whether the local connection succeeds. 2: Gateway only. Only checks whether the gateway is online and whether the gateway connection succeeds. | v3.1.2 | — |
complete | () => void | No | - | Completion callback (executed on both success and failure) | - | — |
success | () => void | No | - | Callback on successful API call | - | — |
fail | (params: Object) => void | No | - | Failure callback | - | — |
fail callback parameters
| Property | Type | Description |
|---|---|---|
errorMsg | string | Error message |
errorCode | string | number | Error code |
| Error extension |
Return Value
None