添加注释,删除无用log,AdasManager中添加工控机配置对象的获取方法
This commit is contained in:
@@ -793,7 +793,7 @@ public class MainActivity extends AppCompatActivity implements OnAdasListener, O
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
AdasManager.getInstance().setOnAdasListener(null);
|
||||
AdasManager.getInstance().destory();
|
||||
AdasManager.getInstance().disconnect();
|
||||
if (mExecutorServiceConfigTimer != null) {
|
||||
mExecutorServiceConfigTimer.shutdownNow();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
#### 说明
|
||||
# ADAS LIB
|
||||
## 与工控机交互LIB
|
||||
|
||||
# 使用方法参见【app_ipc_monitoring】中的代码
|
||||
|
||||
## 工控机账号密码
|
||||
~~~
|
||||
RSA密钥
|
||||
privateBase64=MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEA127FFvuPolaxYTBg5wkyDIrEbcNKXoIjf0bK7QUQ991Lsbv5Ktv/XM2F6qJFssVF1KTkStVBSQGxJB1eZLwJEwIDAQABAkBM39AgpV/Z1Amz3qmVh+h+JT521ItDMjksf7yF25r0dzGjOfGLQmMAqQXT68B+cQX5HSoFMwk/rE1hnXgifyNBAiEA6uNE2TfPj51mPOZztGy1Q8p4exWohfotiy64g/CyVeMCIQDqy9e7bGeZEi6p1zemEgFVtwgZZvLn/BOP4UO7NjJnEQIhAJBnprUwha/SYb+BIpNC3fHOcWGigBfWJdfSomejO9BnAiEApfojLqKbOWHZCsbQ19yyhN02JH7aB5PyYCtlrdnKF4ECIHR1P2LOQLddXO8PwgoF6gtCTO2sxIqdvu8fUruWyouQ
|
||||
publicBase64=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANduxRb7j6JWsWEwYOcJMgyKxG3DSl6CI39Gyu0FEPfdS7G7+Srb/1zNheqiRbLFRdSk5ErVQUkBsSQdXmS8CRMCAwEAAQ==
|
||||
@@ -8,7 +13,468 @@ publicBase64=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANduxRb7j6JWsWEwYOcJMgyKxG3DSl6CI39
|
||||
工控机SSH
|
||||
账号:titan
|
||||
密码:mogo@ZHIDAO10
|
||||
|
||||
加密后的密码:Lz71dnr3eEbcXbuRqSBuLPTk9N7vfqL1lkV1FvAzrLE45OslTvAmm0ekjXIuvOz3jw4hh/saV5pxc3ywNubnjQ==
|
||||
~~~
|
||||
|
||||
## 可用接口
|
||||
~~~java
|
||||
/**
|
||||
* 设置多设备监听
|
||||
*
|
||||
* @param l 监听
|
||||
*/
|
||||
AdasManager.getInstance().setOnMultiDeviceListener(OnMultiDeviceListener l);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 设置工控机数据监听
|
||||
*
|
||||
* @param l 监听
|
||||
*/
|
||||
AdasManager.getInstance().setOnAdasListener(OnAdasListener l);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 创建一个连接
|
||||
*
|
||||
* @param options 连接参数
|
||||
* @param onAdasConnectStatusListener 连接状态监听
|
||||
*/
|
||||
AdasManager.getInstance().create(AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* MoGo-AP 版本
|
||||
*
|
||||
* @return 版本
|
||||
*/
|
||||
AdasManager.getInstance().getAPVersion();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取协议版本
|
||||
*
|
||||
* @return 版本
|
||||
*/
|
||||
AdasManager.getInstance().getProtocolVersion();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取工控机配置信息
|
||||
*
|
||||
* @return 配置信息 未连接为null 断开连接会清空
|
||||
*/
|
||||
AdasManager.getInstance().getCarConfig();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 连接工控机
|
||||
*/
|
||||
AdasManager.getInstance().connect();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 与工控机断开连接
|
||||
*/
|
||||
AdasManager.getInstance().disconnect();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取当前工控机的链接状态
|
||||
*
|
||||
* @return {@link Constants.IPC_CONNECTION_STATUS}
|
||||
*/
|
||||
AdasManager.getInstance().getIpcConnectionStatus();
|
||||
~~~
|
||||
~~~java
|
||||
|
||||
/**
|
||||
* Log是否开启打印
|
||||
*/
|
||||
AdasManager.getInstance().setEnableLog(boolean isEnableLog);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 向工控机发送关机命令
|
||||
*/
|
||||
AdasManager.getInstance().shutdownIPC();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 向工控机发送重启命令
|
||||
*/
|
||||
AdasManager.getInstance().rebootIPC();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 向工控机发送重启自动驾驶Docker命令
|
||||
*/
|
||||
AdasManager.getInstance().rebootAPDocker();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 解析工控机发送过来的数据
|
||||
* 多设备时使用
|
||||
*
|
||||
* @param bytes 数据
|
||||
*/
|
||||
AdasManager.getInstance().parseIPCData(byte[] bytes);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取工控机链接配置
|
||||
*
|
||||
* @return 工控机链接参数
|
||||
*/
|
||||
AdasManager.getInstance().getAdasOptions();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取已经链接成功的工控机IP 未连接为null
|
||||
*
|
||||
* @return ip null:表示未连接
|
||||
*/
|
||||
AdasManager.getInstance().getIpcConnectedIp();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取已经链接成功的工控机端口
|
||||
*
|
||||
* @return 端口 未连接为默认端口
|
||||
*/
|
||||
AdasManager.getInstance().getIpcConnectedPort();
|
||||
~~~
|
||||
~~~java
|
||||
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendBasicInfoResp(@NonNull String sn, int environment);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 设置自动驾驶模式 启动自动驾驶
|
||||
*
|
||||
* @param mode 1: enter autopilot mode, 0: quit autopilot mode
|
||||
* @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务
|
||||
* @param routeInfo 自动驾驶路径信息
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 设置演示模式
|
||||
*
|
||||
* @param enable 1: enable, 0: disable
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendDemoModeReq(int enable);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 车机基础信息请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendCarConfigReq();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 记录人工接管原因
|
||||
*
|
||||
* @param key bag key 唯一标识
|
||||
* @param filename 文件路径
|
||||
* @param reasonID 接管原因id
|
||||
* @param reason 接管原因
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().startRecordPackage(int id, int type);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().startRecordPackage(int id, int duration, int type);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
|
||||
AdasManager.getInstance().stopRecordPackage(int id, int type);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 数据采集请求 主动录制Bag包
|
||||
*
|
||||
* @param id 采集id
|
||||
* @param duration 采集时间长
|
||||
* @param type 采集类型, 1:badcase, 2: map; 3: rests
|
||||
* @param isRecord 采集指令, true: 采集, false: 停止采集
|
||||
* @param sustain 是否持续采集
|
||||
* @return
|
||||
*/
|
||||
|
||||
AdasManager.getInstance().sendRecordData(int id, int duration, int type, boolean isRecord);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 设置自动驾驶最大速度
|
||||
*
|
||||
* @param speedLimit 最大车辆速度 m/s
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendAutopilotSpeedReq(double speedLimit);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 发送红绿灯数据到工控机
|
||||
*
|
||||
* @param crossID roadID
|
||||
* @param latitude
|
||||
* @param longitude
|
||||
* @param heading 红绿灯方向
|
||||
* @param direction 路的航向角
|
||||
* @param lightId 红绿灯ID
|
||||
* @param laneNo 车道号
|
||||
* @param arrowNo 当前车道对应地面要素转向
|
||||
* @param flashYellow 黄灯总时间
|
||||
* @param laneDetail 灯态具体信息
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, @NonNull String heading, @NonNull String direction, int lightId, int laneNo, int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶路径请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendGlobalPathReq();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取工控机固定IP列表
|
||||
*
|
||||
* @return 返回默认工控机IP列表
|
||||
*/
|
||||
AdasManager.getInstance().getIPCFixationIPList(Context context);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 增加工控机固定IP
|
||||
*
|
||||
* @param ipcIP IP
|
||||
*/
|
||||
AdasManager.getInstance().addIPCFixationIP(Context context, String ipcIP);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 删除指定的工控机固定IP
|
||||
*
|
||||
* @param ipcIP IP
|
||||
*/
|
||||
AdasManager.getInstance().delIPCFixationIP(Context context, String ipcIP);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 删除所有工控机固定IP
|
||||
*/
|
||||
AdasManager.getInstance().delIPCFixationIP(Context context);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 发送升级指令 TODO 将会被删除
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Deprecated
|
||||
AdasManager.getInstance().sendBaseInfo(BaseInfo info);
|
||||
~~~
|
||||
|
||||
## OnAdasListener
|
||||
### 工控机数据回调
|
||||
#### 回调中对象的字段详情参见各个proto文件
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶局部轨迹 前车引导线
|
||||
*
|
||||
* @param header 头
|
||||
* @param trajectory 数据
|
||||
*/
|
||||
void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 障碍物 他车数据
|
||||
*
|
||||
* @param header 头
|
||||
* @param trackedObjects 数据
|
||||
*/
|
||||
void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 惯导信息
|
||||
*
|
||||
* @param header 头
|
||||
* @param gnssInfo 数据
|
||||
*/
|
||||
void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 底盘信息, 透传底盘状态,pb参考底盘
|
||||
*
|
||||
* @param header 头
|
||||
* @param vehicleState 数据
|
||||
*/
|
||||
void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶状态
|
||||
*
|
||||
* @param header 头
|
||||
* @param autopilotState 数据
|
||||
*/
|
||||
void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 监控事件报告
|
||||
*
|
||||
* @param header 头
|
||||
* @param mogoReportMessage 数据
|
||||
*/
|
||||
void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶设备基础信息请求
|
||||
*
|
||||
* @param header 头
|
||||
* @param basicInfoReq 数据 目前没有任何参数
|
||||
*/
|
||||
void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 车机基础信息应答
|
||||
*
|
||||
* @param header 头
|
||||
* @param carConfigResp 数据
|
||||
*/
|
||||
void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 数据采集结果
|
||||
*
|
||||
* @param header 头
|
||||
* @param recordPanel 数据
|
||||
*/
|
||||
void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶路径应答
|
||||
*
|
||||
* @param header 头
|
||||
* @param globalPathResp 数据
|
||||
*/
|
||||
void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 报警信息
|
||||
* 暂时保留,目前没有使用
|
||||
*
|
||||
* @param header 头
|
||||
* @param warn 数据
|
||||
*/
|
||||
@Deprecated
|
||||
void onWarn(MessagePad.Header header, MessagePad.Warn warn);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 到站提醒 自动驾驶站点
|
||||
*
|
||||
* @param header 头
|
||||
* @param arrivalNotification 数据
|
||||
*/
|
||||
void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 升级状态
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Deprecated
|
||||
void onUpgradeStateInfo(IPCUpgradeStateInfo info);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 向IPC发送命令返回结果
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
void onSSHResult(SSHResult info);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 数据错误
|
||||
*
|
||||
* @param status 错误原因
|
||||
* @param bytes 原始数据
|
||||
*/
|
||||
void onError(ProtocolStatus status, byte[] bytes);
|
||||
~~~
|
||||
|
||||
## OnAdasConnectStatusListener
|
||||
### 连接状态监听
|
||||
~~~java
|
||||
/**
|
||||
* 与工控机链接状态变化
|
||||
*
|
||||
* @param ipcConnectionStatus {@link Constants.IPC_CONNECTION_STATUS}
|
||||
* @param failedMsg 连接异常信息
|
||||
*/
|
||||
void onConnectionIPCStatus(@Define.IPCConnectionStatus int ipcConnectionStatus, String failedMsg);
|
||||
~~~
|
||||
|
||||
## OnMultiDeviceListener
|
||||
### 多设备链接监听
|
||||
~~~java
|
||||
/**
|
||||
* 转发工控机消息
|
||||
* 如果是客户端此回调不会被调用
|
||||
*
|
||||
* @param bytes 数据
|
||||
*/
|
||||
void onForwardingIPCMessage(byte[] bytes);
|
||||
~~~
|
||||
@@ -348,7 +348,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
callError(raw.getProtocolStatus(), bytes);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
callError(ProtocolStatus.BUSINESS_DATA_PARSE_FAILED, bytes);
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -548,14 +548,6 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
CupidLogUtils.setEnableLog(isEnableLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* log是否写入本地
|
||||
*
|
||||
* @param isWriteLog
|
||||
*/
|
||||
public void setIsWriteLog(boolean isWriteLog) {
|
||||
CupidLogUtils.setIsWriteLog(isWriteLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向工控机发送数据
|
||||
|
||||
@@ -30,8 +30,11 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
* 当前协议使用的版本
|
||||
*/
|
||||
private static final int PROTOCOL_VERSION = MessagePad.ProtocolVersion.CurrentVersion.getNumber();
|
||||
private MessagePad.CarConfigResp carConfig;
|
||||
private static final String AP_VERSION = BuildConfig.AP_VERSION;
|
||||
|
||||
private AdasChannel mChannel;
|
||||
|
||||
public static AdasManager getInstance() {
|
||||
if (ourInstance == null) {
|
||||
synchronized (AdasManager.class) {
|
||||
@@ -43,18 +46,31 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private AdasChannel mChannel;
|
||||
|
||||
private AdasManager() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void setCarConfig(MessagePad.CarConfigResp carConfig) {
|
||||
this.carConfig = carConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置多设备监听
|
||||
*
|
||||
* @param l 监听
|
||||
*/
|
||||
public void setOnMultiDeviceListener(OnMultiDeviceListener l) {
|
||||
if (mChannel != null) {
|
||||
mChannel.setOnMultiDeviceListener(l);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置工控机数据监听
|
||||
*
|
||||
* @param l 监听
|
||||
*/
|
||||
public void setOnAdasListener(OnAdasListener l) {
|
||||
if (mChannel != null) {
|
||||
mChannel.setOnAdasListener(l);
|
||||
@@ -76,7 +92,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
/**
|
||||
* MoGo-AP 版本
|
||||
*
|
||||
* @return
|
||||
* @return 版本
|
||||
*/
|
||||
public String getAPVersion() {
|
||||
return AP_VERSION;
|
||||
@@ -85,33 +101,36 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
/**
|
||||
* 获取协议版本
|
||||
*
|
||||
* @return
|
||||
* @return 版本
|
||||
*/
|
||||
public int getProtocolVersion() {
|
||||
return PROTOCOL_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工控机配置信息
|
||||
*
|
||||
* @return 配置信息 未连接为null 断开连接会清空
|
||||
*/
|
||||
public MessagePad.CarConfigResp getCarConfig() {
|
||||
return carConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送信息
|
||||
*
|
||||
* @param msg
|
||||
* @param msg 消息
|
||||
*/
|
||||
public void sendMessage(String msg) {
|
||||
private void sendMessage(String msg) {
|
||||
if (mChannel != null) {
|
||||
mChannel.sendWsMessage(msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public synchronized void destory() {
|
||||
if (mChannel != null) {
|
||||
mChannel.disconnect();
|
||||
mChannel = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 连接工控机
|
||||
*/
|
||||
@Override
|
||||
public void connect() {
|
||||
if (mChannel != null) {
|
||||
@@ -119,6 +138,9 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 与工控机断开连接
|
||||
*/
|
||||
@Override
|
||||
public void disconnect() {
|
||||
if (mChannel != null) {
|
||||
@@ -126,7 +148,11 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前工控机的链接状态
|
||||
*
|
||||
* @return {@link Constants.IPC_CONNECTION_STATUS}
|
||||
*/
|
||||
@Override
|
||||
public int getIpcConnectionStatus() {
|
||||
if (mChannel != null) {
|
||||
@@ -145,6 +171,9 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Log是否开启打印
|
||||
*/
|
||||
@Override
|
||||
public void setEnableLog(boolean isEnableLog) {
|
||||
if (mChannel != null) {
|
||||
@@ -152,14 +181,10 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsWriteLog(boolean isWriteLog) {
|
||||
if (mChannel != null) {
|
||||
mChannel.setIsWriteLog(isWriteLog);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向工控机发送关机命令
|
||||
*/
|
||||
@Override
|
||||
public void shutdownIPC() {
|
||||
if (mChannel != null) {
|
||||
@@ -167,6 +192,9 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向工控机发送重启命令
|
||||
*/
|
||||
@Override
|
||||
public void rebootIPC() {
|
||||
if (mChannel != null) {
|
||||
@@ -174,6 +202,9 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向工控机发送重启自动驾驶Docker命令
|
||||
*/
|
||||
@Override
|
||||
public void rebootAPDocker() {
|
||||
if (mChannel != null) {
|
||||
@@ -181,6 +212,12 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析工控机发送过来的数据
|
||||
* 多设备时使用
|
||||
*
|
||||
* @param bytes 数据
|
||||
*/
|
||||
@Override
|
||||
public void parseIPCData(byte[] bytes) {
|
||||
if (mChannel != null) {
|
||||
@@ -188,77 +225,183 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取工控机链接配置
|
||||
*
|
||||
* @return 工控机链接参数
|
||||
*/
|
||||
@Override
|
||||
public AdasOptions getAdasOptions() {
|
||||
return mChannel == null ? null : mChannel.getAdasOptions();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取已经链接成功的工控机IP 未连接为null
|
||||
*
|
||||
* @return ip null:表示未连接
|
||||
*/
|
||||
@Override
|
||||
public String getIpcConnectedIp() {
|
||||
return mChannel == null ? null : mChannel.getIpcConnectedIp();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已经链接成功的工控机端口
|
||||
*
|
||||
* @return 端口 未连接为默认端口
|
||||
*/
|
||||
@Override
|
||||
public int getIpcConnectedPort() {
|
||||
return mChannel == null ? Constants.DEFAULT_PORT : mChannel.getIpcConnectedPort();
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBasicInfoResp(@NonNull String sn, int environment) {
|
||||
return mChannel != null && mChannel.sendBasicInfoResp(sn, environment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶模式 启动自动驾驶
|
||||
*
|
||||
* @param mode 1: enter autopilot mode, 0: quit autopilot mode
|
||||
* @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务
|
||||
* @param routeInfo 自动驾驶路径信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo) {
|
||||
return mChannel != null && mChannel.sendAutoPilotModeReq(mode, source, routeInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置演示模式
|
||||
*
|
||||
* @param enable 1: enable, 0: disable
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendDemoModeReq(int enable) {
|
||||
return mChannel != null && mChannel.sendDemoModeReq(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 车机基础信息请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendCarConfigReq() {
|
||||
return mChannel != null && mChannel.sendCarConfigReq();
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录人工接管原因
|
||||
*
|
||||
* @param key bag key 唯一标识
|
||||
* @param filename 文件路径
|
||||
* @param reasonID 接管原因id
|
||||
* @param reason 接管原因
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason) {
|
||||
return mChannel != null && mChannel.sendRecordCause(key, filename, reasonID, reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean startRecordPackage(int id, int type) {
|
||||
return mChannel != null && mChannel.startRecordPackage(id, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean startRecordPackage(int id, int duration, int type) {
|
||||
return mChannel != null && mChannel.startRecordPackage(id, duration, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean stopRecordPackage(int id, int type) {
|
||||
return mChannel != null && mChannel.stopRecordPackage(id, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据采集请求 主动录制Bag包
|
||||
*
|
||||
* @param id 采集id
|
||||
* @param duration 采集时间长
|
||||
* @param type 采集类型, 1:badcase, 2: map; 3: rests
|
||||
* @param isRecord 采集指令, true: 采集, false: 停止采集
|
||||
* @param sustain 是否持续采集
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendRecordData(int id, int duration, int type, boolean isRecord) {
|
||||
return mChannel != null && mChannel.sendRecordData(id, duration, type, isRecord);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶最大速度
|
||||
*
|
||||
* @param speedLimit 最大车辆速度 m/s
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendAutopilotSpeedReq(double speedLimit) {
|
||||
return mChannel != null && mChannel.sendAutopilotSpeedReq(speedLimit);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送红绿灯数据到工控机
|
||||
*
|
||||
* @param crossID roadID
|
||||
* @param latitude
|
||||
* @param longitude
|
||||
* @param heading 红绿灯方向
|
||||
* @param direction 路的航向角
|
||||
* @param lightId 红绿灯ID
|
||||
* @param laneNo 车道号
|
||||
* @param arrowNo 当前车道对应地面要素转向
|
||||
* @param flashYellow 黄灯总时间
|
||||
* @param laneDetail 灯态具体信息
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, @NonNull String heading, @NonNull String direction, int lightId, int laneNo, int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail) {
|
||||
return mChannel != null && mChannel.sendTrafficLightData(crossID, latitude, longitude, heading, direction, lightId, laneNo, arrowNo, flashYellow, laneDetail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶路径请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendGlobalPathReq() {
|
||||
return mChannel != null && mChannel.sendGlobalPathReq();
|
||||
@@ -267,7 +410,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
/**
|
||||
* 获取工控机固定IP列表
|
||||
*
|
||||
* @return
|
||||
* @return 返回默认工控机IP列表
|
||||
*/
|
||||
public HashSet<String> getIPCFixationIPList(Context context) {
|
||||
return AppPreferenceHelper.getInstance(context).getIPCFixationIPList();
|
||||
@@ -276,7 +419,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
/**
|
||||
* 增加工控机固定IP
|
||||
*
|
||||
* @param ipcIP
|
||||
* @param ipcIP IP
|
||||
*/
|
||||
public boolean addIPCFixationIP(Context context, String ipcIP) {
|
||||
return AppPreferenceHelper.getInstance(context).addIPCFixationIP(ipcIP);
|
||||
@@ -285,7 +428,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
/**
|
||||
* 删除指定的工控机固定IP
|
||||
*
|
||||
* @param ipcIP
|
||||
* @param ipcIP IP
|
||||
*/
|
||||
public boolean delIPCFixationIP(Context context, String ipcIP) {
|
||||
return AppPreferenceHelper.getInstance(context).delIPCFixationIP(ipcIP);
|
||||
@@ -299,11 +442,12 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* 向工控机发送数据
|
||||
* 发送升级指令 TODO 将会被删除
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
public void sendBaseInfo(BaseInfo info) {
|
||||
if (mChannel != null) {
|
||||
mChannel.sendBaseInfo(info);
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.util.HashSet;
|
||||
|
||||
/**
|
||||
* Date:2019/5/31。
|
||||
* Note: Adas相关配置。
|
||||
* Note: 工控机连接配置
|
||||
* 更换链接方式必须先断开与工控机的连接
|
||||
*/
|
||||
public class AdasOptions {
|
||||
|
||||
@@ -14,7 +14,7 @@ import mogo.telematics.pad.MessagePad;
|
||||
*/
|
||||
public interface IAdasNetCommApi {
|
||||
/**
|
||||
* 链接工控机
|
||||
* 连接工控机
|
||||
*/
|
||||
void connect();
|
||||
|
||||
@@ -42,14 +42,14 @@ public interface IAdasNetCommApi {
|
||||
/**
|
||||
* 获取已经链接成功的工控机IP 未连接为null
|
||||
*
|
||||
* @return ip null:表示未连接
|
||||
* @return ip null:表示未连接
|
||||
*/
|
||||
String getIpcConnectedIp();
|
||||
|
||||
/**
|
||||
* 获取已经链接成功的工控机端口 未连接为默认端口
|
||||
* 获取已经链接成功的工控机端口
|
||||
*
|
||||
* @return ip null:表示未连接
|
||||
* @return 端口 未连接为默认端口
|
||||
*/
|
||||
int getIpcConnectedPort();
|
||||
|
||||
@@ -173,6 +173,12 @@ public interface IAdasNetCommApi {
|
||||
|
||||
// TODO 需求暂停 待讨论
|
||||
// boolean getRoutes();
|
||||
|
||||
/**
|
||||
* 发送升级指令 TODO 将会被删除
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Deprecated
|
||||
void sendBaseInfo(BaseInfo info);
|
||||
|
||||
@@ -193,19 +199,16 @@ public interface IAdasNetCommApi {
|
||||
|
||||
/**
|
||||
* 解析工控机发送过来的数据
|
||||
*
|
||||
* 多设备时使用
|
||||
* @param bytes 数据
|
||||
*/
|
||||
void parseIPCData(byte[] bytes);
|
||||
|
||||
/**
|
||||
* log是否显示
|
||||
* Log是否开启打印
|
||||
*/
|
||||
void setEnableLog(boolean isEnableLog);
|
||||
|
||||
/**
|
||||
* log是否写入
|
||||
*/
|
||||
void setIsWriteLog(boolean isWriteLog);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -111,7 +111,6 @@ public class IPCFixationIPHelper {
|
||||
|
||||
private synchronized void allNotAvailable(final HashSet<String> ips) {
|
||||
unavailableCount++;
|
||||
CupidLogUtils.i(TAG, "unavailableCount=" + unavailableCount);
|
||||
if (queryCount == unavailableCount) {
|
||||
if (!isCallListener) {
|
||||
isCallListener = true;
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhidao.support.adas.high.msg;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -23,7 +22,7 @@ public class ArrivalNotificationMessage extends MyAbstractMessageHandler {
|
||||
adasListener.onArrivalNotification(header, arrivalNotification);
|
||||
|
||||
}
|
||||
CupidLogUtils.e("到站提醒--->" + arrivalNotification.toString());
|
||||
// CupidLogUtils.e("到站提醒--->" + arrivalNotification.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,9 +3,7 @@ package com.zhidao.support.adas.high.msg;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
@@ -23,7 +21,7 @@ public class AutopilotStateMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onAutopilotState(header, autopilotState);
|
||||
}
|
||||
CupidLogUtils.e("自动驾驶状态--->" + autopilotState.toString());
|
||||
// CupidLogUtils.e("自动驾驶状态--->" + autopilotState.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhidao.support.adas.high.msg;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -22,7 +21,7 @@ public class BasicInfoReqMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onBasicInfoReq(header, autopilotState);
|
||||
}
|
||||
CupidLogUtils.e("自动驾驶设备基础信息请求--->" + autopilotState.toString());
|
||||
// CupidLogUtils.e("自动驾驶设备基础信息请求--->" + autopilotState.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
@@ -19,6 +20,7 @@ public class CarConfigRespMessage extends MyAbstractMessageHandler {
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.CarConfigResp carConfigResp = MessagePad.CarConfigResp.parseFrom(msg);
|
||||
AdasManager.getInstance().setCarConfig(carConfigResp);
|
||||
if (adasListener != null) {
|
||||
adasListener.onCarConfigResp(header, carConfigResp);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhidao.support.adas.high.msg;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -22,7 +21,7 @@ public class GlobalPathRespMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onGlobalPathResp(header, globalPathResp);
|
||||
}
|
||||
CupidLogUtils.e("自动驾驶路径应答--->" + globalPathResp.toString());
|
||||
// CupidLogUtils.e("自动驾驶路径应答--->" + globalPathResp.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhidao.support.adas.high.msg;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -22,7 +21,7 @@ public class GnssInfoMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onGnssInfo(header, trajectory);
|
||||
}
|
||||
CupidLogUtils.e("惯导信息--->" + trajectory.toString());
|
||||
// CupidLogUtils.e("惯导信息--->" + trajectory.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,9 +2,7 @@ package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.google.protobuf.TextFormat;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
@@ -24,7 +22,7 @@ public class RecordResultMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onRecordResult(header, recordPanel);
|
||||
}
|
||||
CupidLogUtils.e("数据采集结果--->" + recordPanel.toString());
|
||||
// CupidLogUtils.e("数据采集结果--->" + recordPanel.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhidao.support.adas.high.msg;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
@@ -23,7 +22,7 @@ public class ReportMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onReportMessage(header, mogoReportMessage);
|
||||
}
|
||||
CupidLogUtils.e("监控事件报告--->" + mogoReportMessage.toString());
|
||||
// CupidLogUtils.e("监控事件报告--->" + mogoReportMessage.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -29,7 +24,7 @@ public class TrackedObjectsMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onTrackedObjects(header, trackedObjects);
|
||||
}
|
||||
CupidLogUtils.e("障碍物信息--->" + trackedObjects.toString());
|
||||
// CupidLogUtils.e("障碍物信息--->" + trackedObjects.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhidao.support.adas.high.msg;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -22,7 +21,7 @@ public class TrajectoryMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onTrajectory(header, trajectory);
|
||||
}
|
||||
CupidLogUtils.e("车前引导线--->" + trajectory.toString());
|
||||
// CupidLogUtils.e("车前引导线--->" + trajectory.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhidao.support.adas.high.msg;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
@@ -23,7 +22,7 @@ public class VehicleStateMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onVehicleState(header, vehicleState);
|
||||
}
|
||||
CupidLogUtils.e("底盘信息--->" + vehicleState.toString());
|
||||
// CupidLogUtils.e("底盘信息--->" + vehicleState.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zhidao.support.adas.high.msg;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -23,7 +22,7 @@ public class WarnMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onWarn(header, warn);
|
||||
}
|
||||
CupidLogUtils.e("预警数据--->" + warn.toString());
|
||||
// CupidLogUtils.e("预警数据--->" + warn.toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
@@ -21,7 +20,7 @@ public class WsAutopilotUpgradeStatusMessage extends MyAbstractMessageHandler {
|
||||
if (adasListener != null) {
|
||||
adasListener.onUpgradeStateInfo(autopilotStatus);
|
||||
}
|
||||
CupidLogUtils.i("工控机升级", "msg=" + msg);
|
||||
// CupidLogUtils.i("工控机升级", "msg=" + msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zhidao.support.adas.high.protocol;
|
||||
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.DigitalTrans;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
|
||||
@@ -34,17 +33,17 @@ public class RawUnpack {
|
||||
}
|
||||
|
||||
private synchronized void unpack(ByteString bytes, RawData raw) {
|
||||
CupidLogUtils.w(TAG, "WS 原始数据=" + bytes.hex());
|
||||
// CupidLogUtils.w(TAG, "WS 原始数据=" + bytes.hex());
|
||||
//读取magicCode
|
||||
ByteString magicCode = bytes.substring(0, messageProtocol.getMagicCodeLength());
|
||||
raw.setMagicCode(magicCode.toByteArray());
|
||||
CupidLogUtils.w(TAG, "WS MagicCode=" + magicCode.hex());
|
||||
// CupidLogUtils.w(TAG, "WS MagicCode=" + magicCode.hex());
|
||||
if (Arrays.equals(magicCode.toByteArray(), Constants.RAW_MG)) {
|
||||
//读取offset
|
||||
ByteString offset = bytes.substring(messageProtocol.getMagicCodeLength(), messageProtocol.getMagicCodeLength() + messageProtocol.getOffsetLength());
|
||||
byte[] offsetB = offset.toByteArray();
|
||||
raw.setOffset(offsetB, getOffsetValue(offsetB));
|
||||
CupidLogUtils.w(TAG, "WS 偏移量 bytes=" + offset.hex() + " 偏移量=" + raw.getOffsetValue());
|
||||
// CupidLogUtils.w(TAG, "WS 偏移量 bytes=" + offset.hex() + " 偏移量=" + raw.getOffsetValue());
|
||||
//读取packageLength
|
||||
ByteString packageLength = bytes.substring(messageProtocol.getMagicCodeLength() + messageProtocol.getOffsetLength(), messageProtocol.getOutHeader());
|
||||
byte[] packageLengthB = packageLength.toByteArray();
|
||||
@@ -54,16 +53,16 @@ public class RawUnpack {
|
||||
raw.clear();
|
||||
return;
|
||||
}
|
||||
CupidLogUtils.w(TAG, "WS 数据包从长度 bytes=" + packageLength.hex() + " 数据包从长度=" + raw.getPackageLengthValue());
|
||||
// CupidLogUtils.w(TAG, "WS 数据包从长度 bytes=" + packageLength.hex() + " 数据包从长度=" + raw.getPackageLengthValue());
|
||||
//读取header
|
||||
ByteString header = bytes.substring(messageProtocol.getOutHeader(), raw.getOffsetValue());
|
||||
raw.setHeader(header.toByteArray());
|
||||
CupidLogUtils.w(TAG, "WS Header=" + header.hex());
|
||||
// CupidLogUtils.w(TAG, "WS Header=" + header.hex());
|
||||
//读取payload
|
||||
ByteString payload = bytes.substring(raw.getOffsetValue());
|
||||
raw.setPayload(payload.toByteArray());
|
||||
raw.setProtocolStatus(ProtocolStatus.SUCCEED);
|
||||
CupidLogUtils.w(TAG, "WS IPC数据=" + payload.hex() + " IPC数据长度=" + messageProtocol.getPayloadLength(raw.getPackageLengthValue(), raw.getOffsetValue()));
|
||||
// CupidLogUtils.w(TAG, "WS IPC数据=" + payload.hex() + " IPC数据长度=" + messageProtocol.getPayloadLength(raw.getPackageLengthValue(), raw.getOffsetValue()));
|
||||
} else {
|
||||
raw.setProtocolStatus(ProtocolStatus.MAGIC_CODE_CHECK_FAILED);
|
||||
raw.clear();
|
||||
|
||||
Reference in New Issue
Block a user