Commit 6092dd18 by wjg

1.0.9

parent 02260f0d
...@@ -18,8 +18,8 @@ android { ...@@ -18,8 +18,8 @@ android {
applicationId "com.ihaoin.hooloo.device" applicationId "com.ihaoin.hooloo.device"
minSdkVersion 26 minSdkVersion 26
targetSdkVersion 30 targetSdkVersion 30
versionCode 8 versionCode 9
versionName "1.0.8" versionName "1.0.9"
ndk { ndk {
//选择要添加的对应 cpu 类型的 .so 库。 //选择要添加的对应 cpu 类型的 .so 库。
......
package com.ihaoin.hooloo.device.base; package com.ihaoin.hooloo.device.base;
import android.content.Context; import android.content.Context;
import android.os.Handler;
import com.ihaoin.hooloo.device.data.vo.MachineInfoMsg; import com.ihaoin.hooloo.device.data.vo.MachineInfoMsg;
import com.ihaoin.hooloo.device.util.CollectionUtils; import com.ihaoin.hooloo.device.util.CollectionUtils;
...@@ -41,13 +42,15 @@ public class MachineInfoSocket extends Thread { ...@@ -41,13 +42,15 @@ public class MachineInfoSocket extends Thread {
} }
private void reconnect() { private void reconnect() {
try { new Handler().postDelayed(() -> {
mSocket = IO.socket(Base.NSP_MACHINE); try {
mSocket.connect(); mSocket = IO.socket(Base.NSP_MACHINE);
} catch (Exception e) { mSocket.connect();
Utils.i("连接server失败,错误原因:" + e.getMessage()); } catch (Exception e) {
e.printStackTrace(); Utils.i("连接server失败,错误原因:" + e.getMessage());
} e.printStackTrace();
}
}, 1000 * 10);
} }
private Emitter.Listener onConnect = args -> Utils.i("machine socket connected"); private Emitter.Listener onConnect = args -> Utils.i("machine socket connected");
......
package com.ihaoin.hooloo.device.interaction; package com.ihaoin.hooloo.device.interaction;
import android.content.Context; import android.content.Context;
import android.os.Handler;
import com.ihaoin.hooloo.device.base.Base; import com.ihaoin.hooloo.device.base.Base;
import com.ihaoin.hooloo.device.data.vo.InteractionMsg; import com.ihaoin.hooloo.device.data.vo.InteractionMsg;
...@@ -42,14 +43,15 @@ public class InteractionSocket extends Thread { ...@@ -42,14 +43,15 @@ public class InteractionSocket extends Thread {
} }
private void reconnect() { private void reconnect() {
try { new Handler().postDelayed(() -> {
mSocket = IO.socket(Base.NSP_INTERACTION); try {
mSocket.connect(); mSocket = IO.socket(Base.NSP_INTERACTION);
} catch (Exception e) { mSocket.connect();
Utils.i("连接server失败,错误原因:" + e.getMessage()); } catch (Exception e) {
e.printStackTrace(); Utils.i("连接server失败,错误原因:" + e.getMessage());
} e.printStackTrace();
}
}, 1000 * 10);
} }
private Emitter.Listener onConnect = args -> { private Emitter.Listener onConnect = args -> {
......
package com.ihaoin.hooloo.device.kds; package com.ihaoin.hooloo.device.kds;
import android.content.Context; import android.content.Context;
import android.os.Handler;
import com.ihaoin.hooloo.device.base.Base; import com.ihaoin.hooloo.device.base.Base;
import com.ihaoin.hooloo.device.data.vo.KDSMsg; import com.ihaoin.hooloo.device.data.vo.KDSMsg;
...@@ -42,13 +43,15 @@ public class KDSSocket extends Thread { ...@@ -42,13 +43,15 @@ public class KDSSocket extends Thread {
} }
private void reconnect() { private void reconnect() {
try { new Handler().postDelayed(() -> {
mSocket = IO.socket(Base.NSP_KDS); try {
mSocket.connect(); mSocket = IO.socket(Base.NSP_KDS);
} catch (Exception e) { mSocket.connect();
Utils.i("连接server失败,错误原因:" + e.getMessage()); } catch (Exception e) {
e.printStackTrace(); Utils.i("连接server失败,错误原因:" + e.getMessage());
} e.printStackTrace();
}
}, 1000 * 10);
} }
private Emitter.Listener onConnect = args -> { private Emitter.Listener onConnect = args -> {
......
...@@ -54,16 +54,18 @@ public class UpdateSocket extends Thread { ...@@ -54,16 +54,18 @@ public class UpdateSocket extends Thread {
} }
private void reconnect() { private void reconnect() {
try { new Handler().postDelayed(() -> {
mSocket = IO.socket(Base.NSP_UPGRADE); try {
mSocket.connect(); mSocket = IO.socket(Base.NSP_UPGRADE);
} catch (Exception e) { mSocket.connect();
Utils.i(AppConfig.TAG_UPDATE, "连接server失败,错误原因:" + e.getMessage()); } catch (Exception e) {
if (AppConfig.DEBUG) { Utils.i(AppConfig.TAG_UPDATE, "连接server失败,错误原因:" + e.getMessage());
Utils.showToast(mContext, "连接server失败,错误原因:" + e.getMessage(), Toast.LENGTH_LONG); if (AppConfig.DEBUG) {
Utils.showToast(mContext, "连接server失败,错误原因:" + e.getMessage(), Toast.LENGTH_LONG);
}
e.printStackTrace();
} }
e.printStackTrace(); }, 1000 * 10);
}
} }
private Emitter.Listener onConnect = args -> { private Emitter.Listener onConnect = args -> {
......
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