[change]修复乘客屏分发线程没启动问题

This commit is contained in:
xinfengkun
2022-06-16 15:07:20 +08:00
committed by liujing
parent 819c127dd9
commit e5c3800a18
4 changed files with 58 additions and 19 deletions

View File

@@ -122,6 +122,7 @@ class TeleMsgHandler : IMsgHandler {
if (!isFirstDisc) {
isFirstDisc = true
}
AdasManager.getInstance().startDispatchHandler()
ToastUtils.showShort("连接司机屏成功!")
invokeNettyConnResult("乘客屏连接司机屏成功")
val byteArray = byteArrayOf(0)
@@ -138,14 +139,18 @@ class TeleMsgHandler : IMsgHandler {
AppConfigInfo.iPCMacAddress = ""
ToastUtils.showLong("断开和司机屏的连接!")
invokeNettyConnResult("断开和司机屏的连接!")
AdasManager.getInstance().stopDispatchHandler()
}
}
ConnectState.STATUS_CONNECT_ERROR -> {
AppConfigInfo.plateNumber = ""
ToastUtils.showLong("和司机端连接异常!")
invokeNettyConnResult("乘客屏和司机屏连接异常,错误为:$content")
AdasManager.getInstance().stopDispatchHandler()
}
else -> {
AdasManager.getInstance().stopDispatchHandler()
}
else -> {}
}
}

View File

@@ -473,34 +473,44 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus.get(), reason);
}
if (status == Constants.IPC_CONNECTION_STATUS.CONNECTED) {
if (dispatchHandler != null) {
dispatchHandler.start();
}
if (dispatchHandlerPointCloud != null) {
dispatchHandlerPointCloud.start();
}
if (dispatchHandlerParsePointCloud != null) {
dispatchHandlerParsePointCloud.start();
}
startDispatchHandler();
startCheckCompatibility();
} else {
stopCheckCompatibility();
}
if (status == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
AdasManager.getInstance().setCarConfig(null);
if (dispatchHandler != null) {
dispatchHandler.stop();
}
if (dispatchHandlerPointCloud != null) {
dispatchHandlerPointCloud.stop();
}
if (dispatchHandlerParsePointCloud != null) {
dispatchHandlerParsePointCloud.stop();
}
stopDispatchHandler();
}
CupidLogUtils.i(TAG, "工控机连接状态 status=" + status + " reason=" + reason);
}
@Override
public void startDispatchHandler() {
if (dispatchHandler != null) {
dispatchHandler.start();
}
if (dispatchHandlerPointCloud != null) {
dispatchHandlerPointCloud.start();
}
if (dispatchHandlerParsePointCloud != null) {
dispatchHandlerParsePointCloud.start();
}
}
@Override
public void stopDispatchHandler() {
if (dispatchHandler != null) {
dispatchHandler.stop();
}
if (dispatchHandlerPointCloud != null) {
dispatchHandlerPointCloud.stop();
}
if (dispatchHandlerParsePointCloud != null) {
dispatchHandlerParsePointCloud.stop();
}
}
/**
* 检查兼容性
*/

View File

@@ -200,6 +200,20 @@ public class AdasManager implements IAdasNetCommApi {
}
}
@Override
public void startDispatchHandler() {
if (mChannel != null) {
mChannel.startDispatchHandler();
}
}
@Override
public void stopDispatchHandler() {
if (mChannel != null) {
mChannel.stopDispatchHandler();
}
}
/**
* 获取工控机链接配置
*

View File

@@ -214,6 +214,16 @@ public interface IAdasNetCommApi {
*/
void decoderRaw(byte[] bytes);
/**
* 启动分发线程
*/
void startDispatchHandler();
/**
* 停止分发线程
*/
void stopDispatchHandler();
/**
* Log是否开启打印
*/