Commit d55ba468 authored by martin hou's avatar martin hou

fix: 增加对hidock-h1 lite的兼容支持

parent 20892c0b
......@@ -768,12 +768,12 @@ Jensen.prototype.restoreFactorySettings = async function (seconds) {
};
Jensen.prototype.scanDevices = async function (seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
return this.send(new Command(BLUETOOTH_SCAN), seconds || 35);
};
Jensen.prototype.connectBTDevice = async function (mac, seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
let marr = mac.split('-');
if (marr.length != 6) throw new Error('invalid mac');
let addr = [];
......@@ -782,50 +782,50 @@ Jensen.prototype.connectBTDevice = async function (mac, seconds) {
};
Jensen.prototype.disconnectBTDevice = async function (seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
return this.send(new Command(BLUETOOTH_CMD).body([0x01]), seconds);
};
Jensen.prototype.getBluetoothStatus = async function (seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
if (this.isLiveMode()) return null;
return this.send(new Command(BLUETOOTH_STATUS), seconds);
};
// 发起蓝牙扫描请求
Jensen.prototype.startBluetoothScan = async function (count, seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
count = count & 0xff;
return this.send(new Command(BT_SCAN).body([0x01, count]), seconds);
};
// 停止蓝牙扫描
Jensen.prototype.stopBluetoothScan = async function (seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
return this.send(new Command(BT_SCAN).body([0x00, 0x00]), seconds);
};
// 获取蓝牙设备列表
Jensen.prototype.getScanResults = async function (seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
return this.send(new Command(BT_DEV_LIST), seconds);
};
// 获取已配对的蓝牙设备列表
Jensen.prototype.getPairedDevices = async function (seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
return this.send(new Command(BT_GET_PAIRED_DEV_LIST), seconds);
};
// 清空已配对的蓝牙设备列表
Jensen.prototype.clearPairedDevices = async function (seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
return this.send(new Command(BT_REMOVE_PAIRED_DEV).body([0x00]), seconds);
}
// 设备回连
Jensen.prototype.reconnectDevice = async function (mac, seconds) {
if (this.model.indexOf('hidock-p1') == -1) return null;
if (this.model.indexOf('hidock-p1') == -1 && this.model !== 'hidock-h1:lite') return null;
let marr = mac.split('-');
if (marr.length != 6) throw new Error('invalid mac');
let addr = [];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment