|
|
@@ -26,42 +26,16 @@ const tools = require('./tools.js'); |
|
|
|
const jlApi = require("../../static/etc/JLAPI/JLObuSDK.js"); //聚力SDK |
|
|
|
const wjApi = require("../etc/WJAPI/wjBleAPI"); |
|
|
|
let tdApi = require("../etc/TDAPI/TDRObuSDK.js"); |
|
|
|
const datas = require("../../static/etcUtil/datas.js"); |
|
|
|
// #ifdef MP-ALIPAY |
|
|
|
// 这部分代码将仅在支付宝小程序平台下执行 |
|
|
|
// jlApi = require("../../static/etc/JLObuSDK/JLObuSDK.js"); |
|
|
|
// wjApi = require("../etc/WJBLE/WJBleAPI"); |
|
|
|
|
|
|
|
//支付宝小程序时打开 微信小程序时注释掉 |
|
|
|
tdApi = require("../etc/TDRAPI/TDRObuSDK.js"); |
|
|
|
// 执行支付宝小程序的特定功能 |
|
|
|
// #endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 断开蓝牙 |
|
|
|
*/ |
|
|
|
function disconnectDevice() { |
|
|
|
// #ifdef MP-ALIPAY |
|
|
|
my.cancelBluetoothPair({ |
|
|
|
deviceId: device.deviceId, |
|
|
|
success: (res) => { |
|
|
|
console.log('解除蓝牙配对123', res); |
|
|
|
my.disconnectBLEDevice({ |
|
|
|
deviceId: device.deviceId, |
|
|
|
success: (res) => { |
|
|
|
console.log(res, "连接情况"); |
|
|
|
my.alert({ content: "断开成功" }); |
|
|
|
}, |
|
|
|
fail: (error) => { |
|
|
|
console.log(error, "断开情况"); |
|
|
|
my.alert({ content: JSON.stringify(error) }); |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
fail: (err) => { |
|
|
|
console.log('解除蓝牙配对456', err); |
|
|
|
}, |
|
|
|
}); |
|
|
|
// #endif |
|
|
|
var connectPrefixName = datas.getData("connectPrefixName"); |
|
|
|
switch (connectPrefixName) { |
|
|
|
case "WJ": |
|
|
@@ -124,7 +98,7 @@ function disconnectDevice() { |
|
|
|
tdApi.disConnectDevice(function(res) { |
|
|
|
datas.setData("bluLinkStatus", false); |
|
|
|
datas.setData("connectPrefixName", ""); |
|
|
|
console.log(res,'=============') |
|
|
|
console.log(res, '=============') |
|
|
|
}); |
|
|
|
break; |
|
|
|
case "ZZ": |
|
|
@@ -148,20 +122,6 @@ function transCmd(cmdArr, type, func, callBack = null) { |
|
|
|
var connectPrefixName = datas.getData("connectPrefixName"); |
|
|
|
switch (connectPrefixName) { |
|
|
|
case "WJ": |
|
|
|
// #ifdef MP-ALIPAY |
|
|
|
wjApi.transCmd(cmdArr, '00', type == '10' ? 'A3' : 'AC', function(res) { |
|
|
|
if (res.code == 0) { |
|
|
|
func(res.data); |
|
|
|
} else { |
|
|
|
if (callBack != null) { |
|
|
|
callBack(res.msg); |
|
|
|
} else { |
|
|
|
alertF(res.msg); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
// #endif |
|
|
|
// #ifdef MP-WEIXIN |
|
|
|
wjApi.transCmd(cmdArr, type, function(res) { |
|
|
|
if (res.code == 0) { |
|
|
|
func(res.data); |
|
|
@@ -173,7 +133,6 @@ function transCmd(cmdArr, type, func, callBack = null) { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
// #endif |
|
|
|
break; |
|
|
|
case "JL": |
|
|
|
jlApi.transCmd(cmdArr, type, function(res) { |