0.1.19 • Published 2 years ago
react-native-bt-sdk-trops v0.1.19
react-native-bt-sdk-trops
BLE
安装
npm install react-native-bt-sdk-trops监听器
蓝牙回调
使用
DeviceEventEmitter.addListener("Monitor", (data) => {
console.log("monitor", data);
});格式
| type | |
|---|---|
| 0 | 扫描设备 |
| 1 | 硬件发送 |
| 2 | 硬件回调 |
{
type:0,
data:"扫描失败"
}脚环方法
import { init } from 'react-native-bt-sdk-trops';
const result = await init();初始化
const data = await init();
console.log(data);搜索蓝牙设备
const data = await startScan();
console.log(data);连接蓝牙设备
const data = await connect(mac);
console.log(data);设置用户Id
const data = await setDebugUserId();
console.log(data);订阅
const data = await notify(mac);
console.log(data);脚环方法
绑定用户id
参数
- MAC地址
- 用户id
bindUser(address, id);解绑用户id
参数
- MAC地址
- 用户id
unBindUser(address, id);获取设备信息
queryHardwareInfo();获取设备状态
queryHardwareStatus();请求实时数据
startRealData();结束实时数据
stopRealData();开始数据采集
startGatherData();结束数据采集
stopGatherData();获取传感器文件信息
getFileInfo();传输传感器文件
参数:
- 传1 代表1号文件 2代表2号文件
- 文件大小
requestFile(fileIndex, size);删除传感器文件
参数
- 传1 代表1号文件 2代表2号文件
deleteFile(fileIndex);获取log文件信息
getLogFileInfo();传输log文件
参数
- 传1 代表1号文件 2代表2号文件
- 文件大小
requestLogFile(fileIndex, size);删除log文件
参数
- 传1 代表1号文件 2代表2号文件
deleteLogFile(fileIndex);更新蓝牙名字
参数
- 蓝牙名称
updateBtName(btName);更新设备时间
updateTime();更新固件(DFU)
参数
- uri
ota(path);关机
requestPowerOff();贡献
See the contributing guide to learn how to contribute to the repository and the development workflow.
许可证
MIT
Made with create-react-native-library
0.1.19
2 years ago
0.1.11
2 years ago
0.1.12
2 years ago
0.1.13
2 years ago
0.1.14
2 years ago
0.1.15
2 years ago
0.1.16
2 years ago
0.1.17
2 years ago
0.1.18
2 years ago
0.1.10
2 years ago
0.1.8
2 years ago
0.1.7
2 years ago
0.1.9
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.0
2 years ago