bt_helper.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707
  1. // 引入必要的模块
  2. // const DeviceUtil = require('./DeviceUtil');
  3. // const BtAndroidHelper = require('./BtAndroidHelper');
  4. // const BtIOSHelper = require('./BtIOSHelper');
  5. // const QueueManager = require('./QueueManager');
  6. // const DeviceManager = require('./DeviceManager');
  7. const { CmdBase, BtCmd } = require('./../devices/bluetooth/bt_cmd');
  8. const { EnumCmdEvent, CmdEvent } = require('./../devices/cmd_key_event');
  9. const { addNotification } = require('./../utils/event_bus');
  10. const BtParse = require('./../devices/bluetooth/bt_parse');
  11. // const VolumeUtil = require('./VolumeUtil');
  12. // const EventManager = require('./EventManager');
  13. // const CmdBase = require('./../devices/bluetooth/bt_cmd');
  14. const bleManager = require('./ble_manager');
  15. const QueueManager = require('./QueueManager');
  16. // const EnumConnectStatus = require('./EnumConnectStatus');
  17. // const EnumOpen = require('./EnumOpen');
  18. // const EnumSupplier = require('./EnumSupplier');
  19. // const EnumLowDelayModeOpen = require('./EnumLowDelayModeOpen');
  20. // const EnumLowDelayMode = require('./EnumLowDelayMode');
  21. // const EnumPlayStatus = require('./EnumPlayStatus');
  22. class BtHelper {
  23. static getInstance() {
  24. // if (!BtHelper._instance) {
  25. // BtHelper._instance = new BtHelper();
  26. // }
  27. return BtHelper._instance;
  28. }
  29. static _instance = new BtHelper();
  30. static _isConnecting = false;
  31. static isDisConnectByOTA = false;
  32. // _helper;
  33. constructor() {
  34. this.timer = null;
  35. this.bleManager = new bleManager();
  36. // if (DeviceUtil.isAndroid) {
  37. // this._helper = BtAndroidHelper.instance;
  38. // } else {
  39. // this._helper = BtIOSHelper.instance;
  40. // }
  41. // QueueManager.instance.listenTask((task) => {
  42. // if (!DeviceManager.instance.isWatch) {
  43. // this._helper.send({ cmd: task });
  44. // }
  45. // });
  46. this.queueManager = new QueueManager();
  47. let _this = this
  48. this.queueManager.clear();
  49. this.queueManager.listenTask((task) => {
  50. _this.bleManager.sendData(task);
  51. });
  52. addNotification(CmdEvent.eventName, function (event) {
  53. console.log("蓝牙helper:", event)
  54. let device = getApp().globalData.mDeviceList[0] ?? {};
  55. if (device.connectType != 1 && device.state != "online") {
  56. return;
  57. }
  58. _this.handleCommand(event, device);
  59. }, this)
  60. }
  61. handleCommand(event, mDevice) {
  62. let name = event.name;
  63. switch (name) {
  64. ///音量 设备控制手机
  65. case EnumCmdEvent.volume:
  66. var volume = event.volume;
  67. // if (ProviderUtil.play.isSimulate) {
  68. // _isPhoneVolume = false;
  69. // await VolumeUtil.setVolume(volume);
  70. // Future.delayed(const Duration(milliseconds: 100), () {
  71. // _isPhoneVolume = true;
  72. // });
  73. // }
  74. mDevice.volume = volume;
  75. break;
  76. ///电量
  77. case EnumCmdEvent.battery:
  78. mDevice.kwh = event.kwh;
  79. break;
  80. ///低时延模式 低时延模式开启 1:音乐 , 2: 游戏 , 3: movie
  81. case EnumCmdEvent.lowDelayMode:
  82. mDevice.lowDelayMode = event.lowDelayMode;
  83. mDevice.lowDelayModeOpen = event.lowDelayModeOpen;
  84. break;
  85. ///电量 耳机电量
  86. case EnumCmdEvent.batteryEarphone:
  87. mDevice.kwh = event.kwh;
  88. mDevice.kwhLeft = event.kwhLeft;
  89. mDevice.kwhRight = event.kwhRight;
  90. mDevice.kwhBox = event.kwhBox;
  91. break;
  92. ///是否支持TTS
  93. case EnumCmdEvent.enableTTS:
  94. mDevice.enableTTS = event.enableTTS;
  95. break;
  96. ///切换设备连接模式 0:未知 1:低功耗蓝牙 2:wifi类型 3:经典蓝牙(不做任何操作) 4:4G类型
  97. case EnumCmdEvent.switchDeviceMode:
  98. var deviceMode = event.deviceMode.index;
  99. if (deviceMode != null) {
  100. L.d("switchDeviceMode======$deviceMode");
  101. mDevice.deviceMode = deviceMode;
  102. }
  103. break;
  104. ///4G外插卡 4G虚拟卡 当前使用的sim卡
  105. case EnumCmdEvent.sim:
  106. mDevice.sim = event.sim;
  107. mDevice.eSim = event.eSim;
  108. mDevice.simIndex = event.simIndex;
  109. break;
  110. ///闹钟是否开启 闹钟周期 闹钟唤醒时间
  111. case EnumCmdEvent.wake:
  112. mDevice.wakeSwitch = event.wakeSwitch;
  113. mDevice.wakeCycle = event.wakeCycle;
  114. mDevice.wakeHour = event.wakeHour;
  115. mDevice.wakeMinutes = event.wakeMinutes;
  116. break;
  117. ///休眠是否开启 休眠时间
  118. case EnumCmdEvent.sleep:
  119. mDevice.sleepSwitch = event.sleepSwitch;
  120. mDevice.sleepHour = event.sleepHour;
  121. mDevice.sleepMinutes = event.sleepMinutes;
  122. break;
  123. ///版本和型号
  124. case EnumCmdEvent.version:
  125. mDevice.version = event.version;
  126. var clientType = mDevice.clientType ?? "";
  127. ///验证设备首页固件升级图标
  128. // getCheckOTAIndexProvider.refresh();
  129. // // TODO 校验版本是否升级
  130. // if (clientType.isNotEmpty) {
  131. // var response = await DeviceService.getDeviceDetail(
  132. // clientType: clientType,
  133. // version: event.version,
  134. // type: mDevice.deviceMode ?? EnumDeviceMode.ble.index,
  135. // );
  136. // if (response.isSuccess) {
  137. // DeviceDetailEntity ? updateData = response.data;
  138. // if (updateData != null) {
  139. // // mDevice.typeList = updateData.typeList;
  140. // // 是否强制升级0-无更新 1-是,2-否
  141. // var force = updateData.isEnforcement;
  142. // var hasNewVersion = force == 1 || force == 2;
  143. // // if (force == 1) {
  144. // // EventManager.fire(OtaUpdateEvent(updateData: updateData));
  145. // // }
  146. // }
  147. // }
  148. // }
  149. break;
  150. ///云小微授权
  151. case EnumCmdEvent.auth:
  152. var authInfo = event.authInfo;
  153. mDevice.authInfo = authInfo;
  154. // QQMusicManager.auth(authInfo: authInfo);
  155. // CacheUtil.saveDSN(dsn: authInfo.dsn ?? "");
  156. break;
  157. case EnumCmdEvent.btMac:
  158. var btMac = event.btMac;
  159. mDevice.btMac = btMac;
  160. // // 更新一下 imei
  161. // getDeviceImei().then((e) {
  162. // mDevice.imei = e;
  163. // });
  164. break;
  165. ///EQ音效
  166. case EnumCmdEvent.eq:
  167. mDevice.eqs = event.eqs;
  168. break;
  169. ///payId 充流量使用
  170. case EnumCmdEvent.payId:
  171. mDevice.payId = event.payId;
  172. break;
  173. ///QQ音乐使用dsn授权
  174. case EnumCmdEvent.dsn:
  175. var dsn = event.dsn;
  176. mDevice.dsn = dsn;
  177. // //存储设备的DSN
  178. // await CacheUtil.saveDSN(dsn: dsn ?? "");
  179. // ProviderUtil.twelvePublic.wifiDeviceConnected();
  180. break;
  181. ///自动切换 0,1不能
  182. ///
  183. case EnumCmdEvent.netModeAuto:
  184. mDevice.netModeAuto = event.netModeAuto;
  185. break;
  186. ///解绑设备
  187. case EnumCmdEvent.unbind:
  188. // let unbindAddress = event.item.address ?? "";
  189. // if (unbindAddress != mDevice.address) {
  190. // _resetList();
  191. // return;
  192. // }
  193. // _lastConnectAddress = null;
  194. // bondedDeviceData.remove(mDevice);
  195. // if (mDevice.address == event.item.address) {
  196. // mDevice = null;
  197. // }
  198. // _resetList();
  199. break;
  200. ///解绑设备
  201. case EnumCmdEvent.ctrlStatus:
  202. // List < int > ctrlList = event.ctrlStatus;
  203. // if (ctrlList.length == 3) {
  204. // mDevice.singleClick = ctrlList[0];
  205. // mDevice.doubleClick = ctrlList[1];
  206. // mDevice.longPressClick = ctrlList[2];
  207. // }
  208. break;
  209. case EnumCmdEvent.lowPowerOpen:
  210. let lowPower = event.lowPowerOpen ?? 0;
  211. mDevice.lowPowerOpen = lowPower;
  212. break;
  213. case EnumCmdEvent.authSleepStatus:
  214. let pauseSleep = event.pauseSleep;
  215. mDevice.pauseSleep = pauseSleep;
  216. notifyListeners();
  217. break;
  218. ///设备信息
  219. case EnumCmdEvent.getDeviceInfo:
  220. // List list = [];
  221. // String userId = ProviderUtil.user.userModel.uid ?? "";
  222. // for (var element in bondedDeviceData) {
  223. // list.add({
  224. // "clientType": element.clientType ?? "",
  225. // "userId": userId,
  226. // "deviceName": element.name ?? "",
  227. // "mac": element.address,
  228. // "deviceId": element.deviceId ?? 0,
  229. // });
  230. // }
  231. // MobClickEvent.mobClickEvent(EnumMobEvent.eventDevicesConnect, params: { "devices": list });
  232. // if (mDevice != null) {
  233. // mDevice.imei ??= await CacheUtil.getImei(address: mDevice.address ?? "");
  234. // /// 用户绑定设备
  235. // await CacheUtil.addDevice(item: mDevice!);
  236. // // String dsn = await CacheUtil.getDSN();
  237. // // if (dsn.isEmpty) {
  238. // // 获取设备dsn
  239. // DeviceManager.instance.auth();
  240. // // }
  241. // //延迟
  242. // var address = mDevice.address ?? "";
  243. // bool isSuccess = await ProviderUtil.twelve.questDeviceTwelveData(address);
  244. // if (isSuccess) {
  245. // bool showDevice = await DeviceChannelAllPage.presentPage();
  246. // if (!showDevice) {
  247. // VipOpenAiTingDialogWidget.presentPage();
  248. // }
  249. // }
  250. // }
  251. // await CacheUtil.saveConnectedDevice(list: bondedDeviceData);
  252. break;
  253. default:
  254. break;
  255. }
  256. }
  257. resetConnectState(connect) {
  258. // BtHelper._isConnecting = connect;
  259. }
  260. async search(stopCall) {
  261. let res = await this.bleManager.startScan()
  262. this.timer = null;
  263. this.timer = setTimeout(() => {
  264. this.stopSearch();
  265. if (stopCall) {
  266. stopCall()
  267. }
  268. }, 10000);
  269. // console.log(res);
  270. // return await this._helper.search();
  271. }
  272. async findDevices(callback) {
  273. this.bleManager.onBluetoothDeviceFound(callback)
  274. // return await this._helper.search();
  275. }
  276. async stopSearch() {
  277. clearTimeout(this.timer);
  278. this.timer = null;
  279. await this.bleManager.stopScan();
  280. }
  281. async _connectSuccess() {
  282. this.checkDevice()
  283. this.getDeviceInfo()
  284. }
  285. async connect(data, onChanged) {
  286. // await this._helper.connect({ data, onChanged, isClick });
  287. clearTimeout(this.timer);
  288. this.timer = null;
  289. this.bleManager.stopScan()
  290. var res = await this.bleManager.connectToDevice(data);
  291. console.log(res ? '连接成功' : '连接失败');
  292. // this.setData({ connectedDeviceId: deviceId });
  293. if (res === false) {
  294. console.log("连接失败")
  295. this.disconnect(data)
  296. if (onChanged) {
  297. onChanged(false)
  298. }
  299. return
  300. }
  301. const serviceId = await this.bleManager.discoverServices(data.deviceId);
  302. if (serviceId == "") {
  303. console.log("连接失败")
  304. this.disconnect(data)
  305. if (onChanged) {
  306. onChanged(false)
  307. }
  308. return
  309. }
  310. // this.setData({ services });
  311. console.log("服务ID:" + serviceId)
  312. var characteristics = await this.bleManager.discoverCharacteristics(data.deviceId, serviceId)
  313. if (characteristics == "") {
  314. console.log("连接失败")
  315. this.disconnect(data)
  316. if (onChanged) {
  317. onChanged(false)
  318. }
  319. return
  320. }
  321. console.log('device特征值:', characteristics)
  322. let uuids = ["AB01", "FFC1"];
  323. for (let i = 0; i < characteristics.length; i++) {
  324. let charc = characteristics[i];
  325. if (uuids.includes(charc.uuid.toUpperCase())) {
  326. console.log('有特征值:', charc.uuid);
  327. }
  328. if (charc.properties.notify) {
  329. console.log('订阅数据:', charc.uuid);
  330. // 订阅的
  331. this.bleManager.notifyCharacteristicValueChange(charc.uuid, (res) => {
  332. BtParse.parseTLV(res);
  333. })
  334. }
  335. if (charc.properties.write || charc.properties.writeWithoutResponse) {
  336. // 写入的
  337. this.bleManager.setWrite(charc, charc.uuid)
  338. setTimeout(() => {
  339. this._connectSuccess()
  340. }, 100);
  341. if (onChanged) {
  342. onChanged(true)
  343. }
  344. }
  345. // if (charc.properties.read) {
  346. // var chara = await this.bleManager.readCharacteristicValue(charc.uuid,)
  347. // }
  348. }
  349. // this.setData({ characteristics: { ...this.data.characteristics, [service.uuid]: characteristics } });
  350. }
  351. async disconnect() {
  352. this.bleManager.disconnect()
  353. }
  354. async dispose() {
  355. // await this._helper.dispose();
  356. }
  357. async sendNow(cmd) {
  358. if (cmd) {
  359. this.bleManager.sendData(cmd)
  360. }
  361. }
  362. async send(cmd, type) {
  363. if (cmd) {
  364. this.queueManager.addTask(cmd)
  365. }
  366. // QueueManager.instance.addTask({ task: cmd });
  367. }
  368. // onLoad: function () {
  369. // bleManager = new bleManager();
  370. // this.initBluetooth();
  371. // }
  372. async initBluetooth(callback) {
  373. let adpter = await this.bleManager.initBluetoothAdapter((res) => {
  374. if (!res) {
  375. wx.showToast({
  376. title: '请开启蓝牙功能',
  377. icon: 'none'
  378. })
  379. if (callback) {
  380. callback(false, false)
  381. }
  382. return
  383. }
  384. });
  385. // console.log(res)
  386. this.bleManager.checkBluetoothPermission(function (per) {
  387. if (!per) {
  388. wx.showToast({
  389. title: '没有蓝牙权限',
  390. icon: 'none'
  391. })
  392. }
  393. if (callback) {
  394. callback(adpter, per)
  395. }
  396. });
  397. }
  398. closeBle() {
  399. this.bleManager.closeBle()
  400. }
  401. async getConnectedDevices() {
  402. try {
  403. const connectedDevices = await this.bleManager.getConnectedDevices();
  404. console.log("全部设备1:", connectedDevices)
  405. if (connectedDevices.length) {
  406. // todo 已经连接上的设备
  407. }
  408. const allDevices = await this.bleManager.getAllConnectedDevices()
  409. console.log("全部设备2:", allDevices)
  410. let newDevices = connectedDevices.concat(allDevices);
  411. return newDevices
  412. } catch (error) {
  413. console.error(error);
  414. return []
  415. }
  416. }
  417. async checkDevice() {
  418. // console.log("校验设备:", BtCmd); // 输出: EarPhone Info
  419. this.sendNow(BtCmd.checkDevice());
  420. //2.0有发这个,不知道是啥
  421. this.send([0x54, 0x44, 0x44, 0x48, 0x01, 0x09, 0x26, 0x01, 0x01]);
  422. }
  423. async getVersion() {
  424. this.send(BtCmd.queryVersion());
  425. }
  426. _time() {
  427. return 400;
  428. }
  429. getDeviceInfo() {
  430. // if (DeviceManager.instance.isEarphone) {
  431. // this.send(BtCmd.queryKwhEarPhone);
  432. // this.send(BtCmd.queryLowDelayMode);
  433. // this.send(BtCmd.queryEQ);
  434. // this.send(BtCmd.queryLowPower);
  435. // this.send(BtCmd.queryCtrlStatus);
  436. // } else {
  437. // this.send(BtCmd.setDevTime());
  438. this.send(BtCmd.queryKwh());
  439. this.getSleep();
  440. this.getAlert();
  441. this.send(BtCmd.queryRGB());
  442. this.getVolume();
  443. this.setVolume(8)
  444. this.getPauseSleep();
  445. this.send(BtCmd.getClientType());
  446. this.send(BtCmd.getIsConnect());
  447. this.send(BtCmd.getMac());
  448. // }
  449. }
  450. async getAlert() {
  451. this.send(BtCmd.queryAlarm());
  452. }
  453. async getSleep() {
  454. this.send(BtCmd.querySleep());
  455. }
  456. async setAlert(open, weekCycle, hour, minutes, channel = 1) {
  457. this.send(BtCmd.setAlarm({ switchStatus: open, weekCycle, hour, minutes }));
  458. }
  459. async setAutoPlay(open) {
  460. this.send(BtCmd.setAutoPlay({ switchStatus: open }));
  461. }
  462. async getAutoPlay() {
  463. this.send(BtCmd.getAutoPlay);
  464. }
  465. async setLowKwhWarningTone(notify) {
  466. this.send(BtCmd.setLowKwhWarningTone({ notify }));
  467. }
  468. async setPauseSleep(time) {
  469. this.send(BtCmd.setSleepAfterPlayPause({ time }));
  470. }
  471. async getPauseSleep() {
  472. this.send(BtCmd.querySleepAfterPlayPause());
  473. }
  474. async setRGB(r, g, b) {
  475. this.send(BtCmd.setRGB({ r, g, b }));
  476. }
  477. async setSleep(open, hour, minutes) {
  478. let defaultMin = minutes ?? 10;
  479. let defaultHour = hour ?? 0;
  480. this.send(BtCmd.setSleep({ switchStatus: open, defaultHour, defaultMin }));
  481. }
  482. async setTime() {
  483. console.log("setTime========111")
  484. // this.send(BtCmd.setTime());
  485. }
  486. async setVolume(volume) {
  487. // VolumeUtil.setVolume(volume, { hideVolumeView: true });
  488. const phoneMax = 15;//await VolumeUtil.getMaxVolume();
  489. const result = Math.floor(CmdBase.volumeMax * volume / phoneMax);
  490. console.log(`phoneMax=${phoneMax}, deviceMax=${CmdBase.volumeMax}, setVolume=${volume}, result=${result}`);
  491. this.send(BtCmd.setVolume(8));
  492. }
  493. async getVolume() {
  494. this.send(BtCmd.queryVolume());
  495. }
  496. stop() {
  497. // EventManager.fire({ event: 'playStatus', playStatus: EnumPlayStatus.stop.index });
  498. }
  499. next() {
  500. // TODO: implement next
  501. }
  502. pause() {
  503. // EventManager.fire({ event: 'playStatus', playStatus: EnumPlayStatus.pause.index });
  504. }
  505. play() {
  506. // TODO: implement play
  507. }
  508. previous() {
  509. // TODO: implement previous
  510. }
  511. startVoiceRecordResponse(supplier) {
  512. console.log(`回调开始录音:${supplier}`);
  513. // switch (supplier) {
  514. // case EnumSupplier.jieLi:
  515. // this.send(BtCmd.jlStartVoiceResponse);
  516. // break;
  517. // case EnumSupplier.lingXin:
  518. // this.send(BtCmd.lxStartVoiceResponse);
  519. // break;
  520. // case EnumSupplier.qiXinWei:
  521. // this.send(BtCmd.b1StartVoiceResponse);
  522. // break;
  523. // }
  524. }
  525. stopVoiceRecordResponse(supplier) {
  526. console.log(`回调结束录音:${supplier}`);
  527. // switch (supplier) {
  528. // case EnumSupplier.jieLi:
  529. // this.send(BtCmd.jlStopVoiceResponse());
  530. // break;
  531. // case EnumSupplier.lingXin:
  532. // this.send(BtCmd.lxStopVoiceResponse());
  533. // break;
  534. // case EnumSupplier.qiXinWei:
  535. // this.send(BtCmd.b1StopVoiceResponse());
  536. // break;
  537. // }
  538. }
  539. async getLowDelayMode() {
  540. this.send(BtCmd.queryLowDelayMode());
  541. }
  542. async setLowDelayMode(open, mode) {
  543. // 0 open,
  544. // 1 close,
  545. // mode 1:音乐 , 2: 游戏 , 3: movie
  546. this.send(BtCmd.setLowDelayMode({ open, mode }));
  547. }
  548. async setLowPowerMode(isOpen) {
  549. this.send(BtCmd.setLowPowerMode({ isOpen: isOpen ? EnumOpen.open : EnumOpen.close }));
  550. }
  551. async queryLowPower() {
  552. this.send(BtCmd.queryLowPower());
  553. }
  554. async setCtrlStatus(singleClick, doubleClick, longClick) {
  555. this.send(BtCmd.setCtrlStatus({ singleClick, doubleClick, longClick }));
  556. }
  557. async getEQ() {
  558. this.send(BtCmd.queryEQ());
  559. }
  560. async setEQ(list) {
  561. this.send(BtCmd.setEQ({ list }));
  562. }
  563. async queryLowKwhWarningTone() {
  564. this.send(BtCmd.queryLowKwhWarningTone());
  565. }
  566. async changeChannelCallBack() {
  567. this.send(Uint8Array.from([0x54, 0x44, 0x44, 0x48, 0x01, 0x0a, 0x29, 0x02, 0x00, 0x01]));
  568. this.send(Uint8Array.from([0x54, 0x44, 0x44, 0x48, 0x01, 0x09, 0x39, 0x01, 0x00]));
  569. }
  570. /* 黑胶音箱的指令 */
  571. // 壁纸指令 1开始, 0结束
  572. static wallPaper(value) {
  573. this.send(BtCmd.wallPaper(value));
  574. }
  575. // 壁纸指令
  576. static wallPaperData(value) {
  577. this.send(BtCmd.wallPaperData(value));
  578. }
  579. // 背景图指令
  580. static backgroudImg(value) {
  581. this.send(BtCmd.backgroudImg(value));
  582. } // 背景图指令
  583. static backgroudImgData(value) {
  584. this.send(BtCmd.backgroudImgData(value));
  585. }
  586. // OTA指令
  587. static otaCmd(value) {
  588. this.send(BtCmd.otaCmd(value));
  589. } static otaData(value) {
  590. this.send(BtCmd.otaData(value));
  591. }
  592. }
  593. // 导出 BtHelper 类
  594. // const btHelper = new BtHelper();
  595. module.exports = { BtHelper }