|
@@ -12,6 +12,15 @@ function getDeviceWriteInfo() {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 判断一代脑机
|
|
|
+ */
|
|
|
+function isJELLYFISH() {
|
|
|
+ let $code = ble_store.getters.getDeviceSn();
|
|
|
+ return $code.indexOf("JELLYFISH") >= 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
* ArrayBuffer转16进度字符串示例
|
|
|
* @param buffer
|
|
|
* @returns {string}
|
|
@@ -235,6 +244,12 @@ export default {
|
|
|
that.SendOrder('09');
|
|
|
ble_store.setters.setCurrentToyId("00");
|
|
|
},1000);
|
|
|
+ //如果是一代脑机则发送00教具
|
|
|
+ if (isJELLYFISH()) {
|
|
|
+ setTimeout(()=>{
|
|
|
+ that.sendConnectOneToMore('00');
|
|
|
+ },1500);
|
|
|
+ }
|
|
|
},
|
|
|
/**
|
|
|
* todo 写入buffer
|
|
@@ -266,10 +281,11 @@ export default {
|
|
|
characteristicId: characteristicWriteId,
|
|
|
value: buffer,
|
|
|
success: function (res) {
|
|
|
- console.log($hex + "写入成功,时间:" + that.getNowTime())
|
|
|
+ WechatLog.info(process.env.NODE_ENV, "写入指令失败:",$hex, that.getNowTime());
|
|
|
},
|
|
|
fail: function (err) {
|
|
|
- console.log($hex + "写入失败", err);
|
|
|
+ console.log("写入指令失败:", $hex, err);
|
|
|
+ WechatLog.error(process.env.NODE_ENV, "写入指令失败:", $hex, err);
|
|
|
},
|
|
|
});
|
|
|
}
|
|
@@ -325,7 +341,9 @@ export default {
|
|
|
if (hexStr.toUpperCase().indexOf("AADD0A") >= 0) {
|
|
|
//没连接上教具
|
|
|
if (hexStr.toUpperCase().indexOf("AADD0A0000") >= 0) {
|
|
|
- $this.connect_toy = 3;
|
|
|
+ if(!isJELLYFISH()){
|
|
|
+ $this.connect_toy = 3;
|
|
|
+ }
|
|
|
return false;
|
|
|
}
|
|
|
let $baseIndex = hexStr.toUpperCase().indexOf("AADD0A");
|
|
@@ -335,11 +353,17 @@ export default {
|
|
|
console.log("教具", $toy_id)
|
|
|
// 连接上教具
|
|
|
if (new RegExp("00").test($hex_index) === true) {
|
|
|
- console.log("一对多")
|
|
|
- // 发送一对一连接 03 00 ${$toy_id} 01 0A
|
|
|
- that.sendConnectOneToOne($toy_id);
|
|
|
- ble_store.setters.setCurrentToyId($toy_id);
|
|
|
- // current_toy_id = $toy_id;
|
|
|
+ if (isJELLYFISH()){
|
|
|
+ // 一代脑机
|
|
|
+ $this.connect_toy = 2;
|
|
|
+ wx.showToast({title: "已连接到" + $this.toy_item.name });
|
|
|
+ } else {
|
|
|
+ console.log("一对多")
|
|
|
+ // 发送一对一连接 03 00 ${$toy_id} 01 0A
|
|
|
+ that.sendConnectOneToOne($toy_id);
|
|
|
+ ble_store.setters.setCurrentToyId($toy_id);
|
|
|
+ // current_toy_id = $toy_id;
|
|
|
+ }
|
|
|
}
|
|
|
if (new RegExp("01").test($hex_index) === true) {
|
|
|
console.log("一对一")
|