Commit ec432609 by 姜雷

添加发送数据状态打印

parent e5e07c09
...@@ -10,7 +10,7 @@ export const CUSTOMER_SERVER_URL = ...@@ -10,7 +10,7 @@ export const CUSTOMER_SERVER_URL =
'https://ex-dev-dcxy-customer-app.168cad.top'; 'https://ex-dev-dcxy-customer-app.168cad.top';
export const SCHOOL_MAIN_URL = 'https://internal-dev-school-main.168cad.top'; export const SCHOOL_MAIN_URL = 'https://internal-dev-school-main.168cad.top';
export const ANN_LINK_URL = 'https://ex-dev-wx.168cad.top/announcement/'; export const ANN_LINK_URL = 'https://ex-dev-wx.168cad.top/announcement/';
export const SHOWER_APP_URL = 'http://192.168.3.55:8888'; export const SHOWER_APP_URL = 'http://ex-shower-app-server.168cad.top';
export const SOCKET_URL = 'ws://192.168.3.55:20003/ws'; export const SOCKET_URL = 'ws://192.168.1.35:22153/ws';
export const SMPRO_URL = 'https://ex-dev-dcxy-smapro-app.168cad.top'; export const SMPRO_URL = 'https://ex-dev-dcxy-smapro-app.168cad.top';
export const GX_URL = 'http://ex-dev-gx-app-server.168cad.top'; export const GX_URL = 'http://ex-dev-gx-app-server.168cad.top';
...@@ -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