bluetoothCapabilityIsSupport
蓝牙设备是否支持某个能力 5->定时 6->BT
引入
import { bluetoothCapabilityIsSupport } from '@ray-js/ray';
需引入
DeviceKit
,且在>=2.2.1
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
deviceId | string | 是 | 设备 Id | |
capability | number | 是 | 能力值标位 5:定时 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
object.success 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
isSupport | boolean | 是否支持蓝牙相关能力的结果回调 isSupport 是否支持 |
object.fail 回调参数
参数
Object res
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
bluetoothIsPowerOn
判断手机蓝牙是否打开
引入
import { bluetoothIsPowerOn } from '@ray-js/ray';
需引入
DeviceKit
,且在>=1.2.6
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
cancelBLEFileTransfer
取消文件传输到蓝牙设备 仅 IOS 支持
引入
import { cancelBLEFileTransfer } from '@ray-js/ray';
需引入
DeviceKit
,且在>=3.0.0
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
deviceId | string | 是 | 设备模型 设备 id | |
fileId | number | 是 | 文件 id | |
fileIdentifier | string | 是 | 文件标识符 | |
fileVersion | number | 是 | 文件版本 | |
filePath | string | 是 | 文件地址 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
connectBLEDevice
连接 BLE(thing)设备,【Android 特有:与 directConnectBLEDevice 方法的区别在于,该方法会先进行扫描的动作,扫描到设备之后才会进行连接。】
引入
import { connectBLEDevice } from '@ray-js/ray';
需引入
DeviceKit
,且在>=3.0.0
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
deviceId | string | 是 | 设备模型 deviceId 设备 Id | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
directConnectBLEDevice
直连 BLE(thing)设备,【Android 特有:与 connectBLEDevice 方法的区别在于,该方法在连接设备时并不会进行扫描的动作。换言之,需要先扫描到设备之后,方可调用该方法进行连接】
引入
import { directConnectBLEDevice } from '@ray-js/ray';
需引入
DeviceKit
,且在>=2.1.6
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
deviceId | string | 是 | 设备模型 deviceId 设备 Id | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
disconnectBLEDevice
断开 BLE(thing)设备
引入
import { disconnectBLEDevice } from '@ray-js/ray';
需引入
DeviceKit
,且在>=3.0.0
版本才可使用
参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
deviceId | string | 是 | 设备模型 deviceId 设备 Id | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。