Commit 47267e35 by 姜雷

添加打印

parents 1bfbf68a ec432609
...@@ -210,9 +210,15 @@ class Shower extends Component { ...@@ -210,9 +210,15 @@ class Shower extends Component {
if (sockedDone && task && deviceDone) { if (sockedDone && task && deviceDone) {
let deviceData = '{<' + bluetoothDevice.code + '>}'; let deviceData = '{<' + bluetoothDevice.code + '>}';
console.log('发送设备编号:', deviceData); console.log('<---发送设备编号:', deviceData);
task.send({ task.send({
data: str2ab(deviceData), data: str2ab(deviceData),
success: msg => {
console.log('发送设备编号:', msg, '--->');
},
fail: err => {
console.log('发送设备编号:', err, '--->');
},
}); });
} }
} }
...@@ -426,10 +432,16 @@ class Shower extends Component { ...@@ -426,10 +432,16 @@ class Shower extends Component {
datastr.substring(0, 1) === '{' && datastr.substring(0, 1) === '{' &&
datastr.substring(datastr.length - 1, datastr.length) === '}' datastr.substring(datastr.length - 1, datastr.length) === '}'
) { ) {
console.log('发送完整数据: ', datastr); console.log('<---发送完整数据: ', datastr);
if (task) { if (task) {
task.send({ task.send({
data: str2ab(datastr), data: str2ab(datastr),
success: msg => {
console.log('发送完整数据:', msg, '--->');
},
fail: err => {
console.log('发送完整数据:', err, '--->');
},
}); });
} }
} else if (datastr.substring(0, 1) === '{') { } else if (datastr.substring(0, 1) === '{') {
...@@ -441,10 +453,16 @@ class Shower extends Component { ...@@ -441,10 +453,16 @@ class Shower extends Component {
) { ) {
abStr += datastr; abStr += datastr;
console.log('接受尾部数据后: ', abStr); console.log('接受尾部数据后: ', abStr);
console.log('发送完整数据: ', abStr); console.log('<---发送完整数据: ', abStr);
if (task) { if (task) {
task.send({ task.send({
data: str2ab(abStr), data: str2ab(abStr),
success: msg => {
console.log('发送完整数据:', msg, '--->');
},
fail: err => {
console.log('发送完整数据:', err, '--->');
},
}); });
} }
abStr = ''; abStr = '';
...@@ -574,10 +592,16 @@ class Shower extends Component { ...@@ -574,10 +592,16 @@ class Shower extends Component {
msg.substring(msg.length - 1, msg.length) === '}' msg.substring(msg.length - 1, msg.length) === '}'
) { ) {
const { task } = this.state; const { task } = this.state;
console.log('发送给socket完整数据: ', msg); console.log('<---发送给socket完整数据: ', msg);
task && task &&
task.send({ task.send({
data: str2ab(msg), data: str2ab(msg),
success: msg => {
console.log('发送给socket完整数据:', msg, '--->');
},
fail: err => {
console.log('发送给socket完整数据:', err, '--->');
},
}); });
} else if (msg.substring(0, 1) === '{') { } else if (msg.substring(0, 1) === '{') {
console.log('接受头部数据: ', msg); console.log('接受头部数据: ', msg);
...@@ -588,12 +612,18 @@ class Shower extends Component { ...@@ -588,12 +612,18 @@ class Shower extends Component {
) { ) {
abStr += msg; abStr += msg;
console.log('接受尾部数据后: ', abStr); console.log('接受尾部数据后: ', abStr);
console.log('发送给socket完整数据: ', abStr); console.log('<---发送给socket完整数据: ', abStr);
const { task } = this.state; const { task } = this.state;
task && task &&
task.send({ task.send({
data: str2ab(abStr), data: str2ab(abStr),
success: msg => {
console.log('发送给socket完整数据:', msg, '--->');
},
fail: err => {
console.log('发送给socket完整数据:', err, '--->');
},
}); });
abStr = ''; abStr = '';
} else { } else {
......
...@@ -225,7 +225,6 @@ class WaterDispenser extends Component { ...@@ -225,7 +225,6 @@ class WaterDispenser extends Component {
); );
}) })
.catch(err => { .catch(err => {
Taro.hideLoading();
console.error('开启失败: ', err); console.error('开启失败: ', err);
}); });
} }
......
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