Commit 47267e35 by 姜雷

添加打印

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