修复【RoboTaxi司机端V2.8.0】【偶现】车辆下电重启后,多次重启pad,无定位数据,无感知,无地图
http://jira.zhidaohulian.com/browse/YHJSYHZNWL-1044
This commit is contained in:
donghongyu
2022-06-28 11:58:04 +08:00
parent 7eaa1ab7ed
commit 1c5bc09645
3 changed files with 81 additions and 77 deletions

View File

@@ -47,7 +47,7 @@ public class NettyClientActivity extends AppCompatActivity implements View.OnCli
setContentView(R.layout.activity_netty_client);
findViews();
initView();
NSDNettyManager.getInstance().searchAndConnectServer(this, "0", this);
NSDNettyManager.getInstance().searchAndConnectServer(this, "0", true,this);
}
private void initView() {

View File

@@ -36,26 +36,26 @@ PASSWORD=xintai2018
RELEASE=true
# AI CLOUD 云平台
# 工具类
MOGO_UTILS_VERSION=1.4.3.6
MOGO_UTILS_VERSION=1.4.3.7
# 网络请求
MOGO_NETWORK_VERSION=1.4.3.6
MOGO_NETWORK_VERSION=1.4.3.7
# 网络DNS
MOGO_HTTPDNS_VERSION=1.4.3.6
MOGO_HTTPDNS_VERSION=1.4.3.7
# 鉴权
MOGO_PASSPORT_VERSION=1.4.3.6
MOGO_PASSPORT_VERSION=1.4.3.7
# 常链接
MOGO_SOCKET_VERSION=1.4.3.6
MOGO_SOCKET_VERSION=1.4.3.7
# 数据采集
MOGO_REALTIME_VERSION=1.4.3.6
MOGO_REALTIME_VERSION=1.4.3.7
# 探路,道路事件发布,获取
MOGO_TANLU_VERSION=1.4.3.6
MOGO_TANLU_VERSION=1.4.3.7
# 直播推流
MOGO_LIVE_VERSION=1.4.3.6
MOGO_LIVE_VERSION=1.4.3.7
# 直播拉流
MOGO_TRAFFICLIVE_VERSION=1.4.3.6
MOGO_TRAFFICLIVE_VERSION=1.4.3.7
# 定位服务
MOGO_LOCATION_VERSION=1.4.3.6
MOGO_LOCATION_VERSION=1.4.3.7
# 远程通讯模块
MOGO_TELEMATIC_VERSION=1.4.3.6
MOGO_TELEMATIC_VERSION=1.4.3.7
# v2x
MOGO_V2X_VERSION=1.4.3.6
MOGO_V2X_VERSION=1.4.3.7

View File

@@ -203,76 +203,80 @@ public class NSDNettyManager {
*
* @param context
*/
public void searchAndConnectServer(Context context, String uuid, NettyClientListener listener) {
// 这里暂时关闭原因是因为BUS上无法透穿虚拟机的网络限制
// if (mNsdClient == null) {
// mNsdClient = new NsdClient(context, SERVER_NAME, new NsdClient.IServerFound() {
// @Override
// public void onServerFound(NsdServiceInfo info, int port) {
// if (info != null) {
// String hostAddress = info.getHost().getHostAddress();
// Logger.d(TAG, "NSD查询到指定服务器信息ip为" + hostAddress + ",port为" + port);
// //获取到指定的地址进行Netty的连接
// connectNettyServer(hostAddress, port, uuid, listener);
//
// if (info.getServiceName().startsWith(SERVER_NAME)) {
// //扫描到以后停止
// mNsdClient.stopServiceDiscovery();
// }
// }
// }
//
// @Override
// public void onServerFail() {
// Logger.d(TAG, "NSD查询失败未找到");
// }
// });
// }
// mNsdClient.startNSDClient();
public void searchAndConnectServer(Context context, String uuid, boolean isTaxi, NettyClientListener listener) {
if (isTaxi) {
// 这里暂时关闭原因是因为BUS上无法透穿虚拟机的网络限制
if (mNsdClient == null) {
mNsdClient = new NsdClient(context, SERVER_NAME, new NsdClient.IServerFound() {
@Override
public void onServerFound(NsdServiceInfo info, int port) {
if (info != null) {
String hostAddress = info.getHost().getHostAddress();
Logger.d(TAG, "NSD查询到指定服务器信息ip为" + hostAddress + ",port为" + port);
//获取到指定的地址进行Netty的连接
connectNettyServer(hostAddress, port, uuid, listener);
// 启动发现司机屏幕任务
mDiscoveryTask = new DiscoveryDriverTask();
network_ip = NetInfo.getUnsignedLongFromIp("192.168.1.0");
int cidr = 24;
// Detected IP
int shift = (32 - cidr);
if (cidr < 31) {
network_start = (network_ip >> shift << shift) + 1;
network_end = (network_start | ((1 << shift) - 1)) - 1;
} else {
network_start = (network_ip >> shift << shift);
network_end = (network_start | ((1 << shift) - 1));
}
mDiscoveryTask.setNetwork(network_ip, network_start, network_end);
mDiscoveryTask.addDiscoveryDriverListener(new DiscoveryDriverListener() {
@Override
public void onSuccess(ArrayList<HostBean> hostList) {
// 这里返回数据代表了有司机端正在运行,这里遍历集合数据进行连接
if (hostList != null && hostList.size() > 0) {
String hostAddress = "";
for (HostBean hostBean : hostList) {
if (mNettyTcpClient != null && (mNettyTcpClient.isConnecting() || mNettyTcpClient.getConnectStatus())) {
Logger.d(TAG, "当前乘客屏幕已经连接到了ip" + hostAddress + ",port为" + 1088);
return;
if (info.getServiceName().startsWith(SERVER_NAME)) {
//扫描到以后停止
mNsdClient.stopServiceDiscovery();
}
}
hostAddress = hostBean.ipAddress;
Logger.d(TAG, "NSD查询到指定服务器信息ip为" + hostAddress + ",port为" + 1088);
//获取到指定的地址进行Netty的连接
connectNettyServer(hostAddress, 1088, uuid, listener);
}
} else {
Logger.d(TAG, "扫描完成,未找到可连接司机屏幕服务");
@Override
public void onServerFail() {
Logger.d(TAG, "NSD查询失败未找到");
}
});
}
mNsdClient.startNSDClient();
}
// BUS 由于采用的虚拟机,不在同一个局域网内,所以无法使用上面的方案
else {
// 启动发现司机屏幕任务
mDiscoveryTask = new DiscoveryDriverTask();
network_ip = NetInfo.getUnsignedLongFromIp("192.168.1.0");
int cidr = 24;
// Detected IP
int shift = (32 - cidr);
if (cidr < 31) {
network_start = (network_ip >> shift << shift) + 1;
network_end = (network_start | ((1 << shift) - 1)) - 1;
} else {
network_start = (network_ip >> shift << shift);
network_end = (network_start | ((1 << shift) - 1));
}
mDiscoveryTask.setNetwork(network_ip, network_start, network_end);
mDiscoveryTask.addDiscoveryDriverListener(new DiscoveryDriverListener() {
@Override
public void onSuccess(ArrayList<HostBean> hostList) {
// 这里返回数据代表了有司机端正在运行,这里遍历集合数据进行连接
if (hostList != null && hostList.size() > 0) {
String hostAddress = "";
for (HostBean hostBean : hostList) {
if (mNettyTcpClient != null && (mNettyTcpClient.isConnecting() || mNettyTcpClient.getConnectStatus())) {
Logger.d(TAG, "当前乘客屏幕已经连接到了ip" + hostAddress + ",port为" + 1088);
return;
}
hostAddress = hostBean.ipAddress;
Logger.d(TAG, "NSD查询到指定服务器信息ip为" + hostAddress + ",port为" + 1088);
//获取到指定的地址进行Netty的连接
connectNettyServer(hostAddress, 1088, uuid, listener);
}
} else {
Logger.d(TAG, "扫描完成,未找到可连接司机屏幕服务");
}
}
}
@Override
public void onCancel() {
@Override
public void onCancel() {
}
});
mDiscoveryTask.execute();
}
});
mDiscoveryTask.execute();
}
}