与工控机通讯数据协议全部更改成PB格式
This commit is contained in:
@@ -214,7 +214,7 @@ ext {
|
||||
mogo_core_network : "com.mogo.eagle.core:network:${MOGO_CORE_NETWORK_VERSION}",
|
||||
|
||||
//========================= V2X SDK =========================
|
||||
mogo_v2x : "com.mogo.v2x:v2x:${MOGO_V2X_SDK_VERSION}",
|
||||
mogo_v2x : "com.mogo.v2x:v2x:${MOGO_V2X_SDK_VERSION}",
|
||||
|
||||
life_cycle_scope : "androidx.lifecycle:lifecycle-runtime-ktx:2.2.0",
|
||||
view_model_scope : "androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0",
|
||||
@@ -228,7 +228,12 @@ ext {
|
||||
androidx_unit_ext : "androidx.test.ext:junit:1.1.2",
|
||||
androidx_unit_ext_ktx : "androidx.test.ext:junit-ktx:1.1.2",
|
||||
androidx_runner : "androidx.test:runner:1.3.0",
|
||||
androidx_espresso_core : "androidx.test.espresso:espresso-core:3.3.0"
|
||||
androidx_espresso_core : "androidx.test.espresso:espresso-core:3.3.0",
|
||||
|
||||
//========================== ProtoBuf =======================
|
||||
protoc : "com.google.protobuf:protoc:3.12.4",
|
||||
protobuf_java : "com.google.protobuf:protobuf-java:3.12.4",
|
||||
protobuf_java_util : "com.google.protobuf:protobuf-java-util:3.12.4"
|
||||
|
||||
]
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ class MoGoAutopilotProvider :
|
||||
.setClient(false)
|
||||
.build()
|
||||
|
||||
AdasManager.getInstance().create(context, options)
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance().startNSDNettyServerWithSN(context, object :
|
||||
NettyServerListener<MogoProtocolMsg> {
|
||||
override fun onMessageResponseServer(msg: MogoProtocolMsg?, channel: Channel?) {
|
||||
@@ -107,7 +107,7 @@ class MoGoAutopilotProvider :
|
||||
.setIpcAssignIP(FunctionBuildConfig.adasConnectIP)
|
||||
.setClient(true)
|
||||
.build()
|
||||
AdasManager.getInstance().create(context, options)
|
||||
AdasManager.getInstance().create(options, MoGoAdasMsgConnectStatusListenerImpl())
|
||||
NSDNettyManager.getInstance()
|
||||
.searchAndConnectServer(context, MoGoAiCloudClientConfig.getInstance().sn, object :
|
||||
NettyClientListener<MogoProtocolMsg> {
|
||||
@@ -134,9 +134,7 @@ class MoGoAutopilotProvider :
|
||||
})
|
||||
}
|
||||
//////////////////////////////////注意先后顺序,AdasManager.getInstance().create后才可以设置监听/////////////////////////////////////////////
|
||||
// 监听 adas 连接状态
|
||||
AdasManager.getInstance()
|
||||
.setOnAdasConnectStatusListener(MoGoAdasMsgConnectStatusListenerImpl())
|
||||
|
||||
// 监听ADAS-SDK获取到的工控机数据(乘客也需注册)
|
||||
AdasManager.getInstance().setOnAdasListener(MoGoAdasListenerImpl())
|
||||
// 司机端监听
|
||||
|
||||
@@ -4,6 +4,7 @@ plugins {
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
id 'com.google.protobuf'
|
||||
}
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
@@ -33,7 +34,35 @@ android {
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/main/java'
|
||||
}
|
||||
|
||||
proto {
|
||||
srcDir 'src/main/proto'
|
||||
include '**/*.proto'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = rootProject.ext.dependencies.protoc
|
||||
}
|
||||
|
||||
generateProtoTasks {
|
||||
all().each { task ->
|
||||
task.builtins {
|
||||
remove java
|
||||
}
|
||||
task.builtins {
|
||||
java {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
@@ -53,6 +82,8 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxroomruntime
|
||||
implementation rootProject.ext.dependencies.androidxroomktx
|
||||
kapt rootProject.ext.dependencies.androidxroomcompiler
|
||||
api rootProject.ext.dependencies.protobuf_java
|
||||
api rootProject.ext.dependencies.protobuf_java_util
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
implementation rootProject.ext.dependencies.mogo_core_res
|
||||
} else {
|
||||
|
||||
41
core/mogo-core-data/src/main/proto/chassis.proto
Normal file
41
core/mogo-core-data/src/main/proto/chassis.proto
Normal file
@@ -0,0 +1,41 @@
|
||||
syntax = "proto2";
|
||||
package chassis;
|
||||
|
||||
enum GearPosition {
|
||||
GEAR_NONE = 0;
|
||||
GEAR_N = 1;
|
||||
GEAR_R = 2;
|
||||
GEAR_P = 3;
|
||||
GEAR_D = 4;
|
||||
}
|
||||
|
||||
enum LightSwitch {
|
||||
LIGHT_NONE = 0;
|
||||
LIGHT_LEFT = 1;
|
||||
LIGHT_RIGHT = 2;
|
||||
LIGHT_FLASH = 3;
|
||||
LIGHT_MANUAL = 4;
|
||||
LIGHT_AUTO = 5;
|
||||
}
|
||||
|
||||
enum PilotMode {
|
||||
MODE_MANUAL = 0;
|
||||
MODE_AUTO_DRIVE = 1;
|
||||
MODE_STEER_ONLY = 2;
|
||||
MODE_SPEED_ONLY = 3;
|
||||
}
|
||||
|
||||
enum LongitudeDrivingMode {
|
||||
ManualMode = 0;
|
||||
AutomaticStandby = 1;
|
||||
AutomaticAcceleration = 2;
|
||||
AutomaticDeceleration = 3;
|
||||
}
|
||||
|
||||
enum EPSSteeringMode {
|
||||
Manual = 0;
|
||||
Automatic = 1;
|
||||
ManualFromInterference = 2;
|
||||
ManualFromEPSFailure = 3;
|
||||
TemporaryInhibited = 4;
|
||||
}
|
||||
274
core/mogo-core-data/src/main/proto/message_pad.proto
Normal file
274
core/mogo-core-data/src/main/proto/message_pad.proto
Normal file
@@ -0,0 +1,274 @@
|
||||
syntax = "proto3";
|
||||
package mogo.telematics.pad;
|
||||
|
||||
enum ProtocolVersion{
|
||||
Defaultver = 0;
|
||||
CurrentVersion = 1; //每次修改proto文件增加1
|
||||
}
|
||||
|
||||
enum MessageType
|
||||
{
|
||||
MsgTypeDefault = 0;
|
||||
|
||||
MsgTypeTrajectory = 0x10000; //局部轨迹,车前引导线
|
||||
MsgTypeTrackedObjects = 0x10001; //障碍物信息
|
||||
MsgTypeGnssInfo = 0x10002; //惯导信息
|
||||
MsgTypeVehicleState = 0x10003; //底盘信息, 透传底盘状态,pb参考底盘
|
||||
MsgTypeAutopilotState = 0x10004; //自动驾驶状态
|
||||
MsgTypeReportMessage = 0x10005; //监控事件报告
|
||||
|
||||
MsgTypeBasicInfoReq = 0x10100; //自动驾驶设备基础信息请求
|
||||
MsgTypeBasicInfoResp = 0x10101; //自动驾驶设备基础信息应答
|
||||
MsgTypeSetAutopilotModeReq = 0x10102; //设置自动驾驶模式
|
||||
MsgTypeSetDemoModeReq = 0x10103; //设置演示模式
|
||||
MsgTypeCarConfigReq = 0x10104; //车机基础信息请求
|
||||
MsgTypeCarConfigResp = 0x10105; //车机基础信息应答
|
||||
MsgTypeRecordCause = 0x10106; //记录人工接管原因
|
||||
MsgTypeRecordData = 0x10107; //数据采集请求
|
||||
MsgTypeRecordResult = 0x10108; //数据采集结果
|
||||
MsgTypeSetAutopilotSpeedReq = 0x10109; //设置自动驾驶最大速度
|
||||
MsgTypeGlobalPathReq = 0x1010a; //自动驾驶路径请求
|
||||
MsgTypeGlobalPathResp = 0x1010b; //自动驾驶路径应答
|
||||
MsgTypeTrafficLightData = 0x1010c; //发送红绿灯数据到工控机
|
||||
MsgTypeWarn = 0x1010d; //预警数据
|
||||
MsgTypeArrivalNotification = 0x1010e; //到站提醒
|
||||
}
|
||||
|
||||
message Header
|
||||
{
|
||||
uint64 msgID = 1; //消息唯一id,自增
|
||||
MessageType msgType = 2; //消息类型
|
||||
double timestamp = 3; //telematics消息发送时间, 单位:秒
|
||||
double sourceTimestamp = 4; //数据源消息发送时间, 单位:秒
|
||||
}
|
||||
|
||||
// message definition for MsgTypeTrajectory
|
||||
message TrajectoryPoint
|
||||
{
|
||||
double longitude = 1;
|
||||
double latitude = 2;
|
||||
double altitude = 3;
|
||||
double time = 4; //时间, 单位:秒
|
||||
double velocity = 5; //速度, m/s
|
||||
double acceleration = 6; //加速度, m/s^2
|
||||
double theta = 7; //速度方向
|
||||
double kappa = 8; //曲率
|
||||
double accumulatedDis = 9; //从起点到目前的总距离
|
||||
double reversedAccumulatedDis = 10; //从当前到终点的距离
|
||||
}
|
||||
|
||||
message Trajectory
|
||||
{
|
||||
repeated TrajectoryPoint points = 1;
|
||||
}
|
||||
|
||||
// message definition for MsgTypeTrackedObjects
|
||||
message TrackedObject
|
||||
{
|
||||
uint32 type = 1; //物体类型, 0:Background, 1:Person, 2:Bicycle, 3:Car, 4:MotorCycle,
|
||||
//5:TrafficSign, 6:Bus, 7:CellPhone, 8:Truck, 9:Bottle, 10:TrafficLight,
|
||||
//11:Rider, 12:TriangleRoadblock, 13:WarningTriangle, 100:Unknown
|
||||
double longitude = 2; //经度
|
||||
double latitude = 3; //纬度
|
||||
double altitude = 4; //海拔
|
||||
double systemTime = 5; //系统时间 单位:秒s
|
||||
double satelliteTime = 6; //gps时间 单位:秒s
|
||||
uint32 uuid = 7; //车辆id
|
||||
string carID = 8; //车牌id
|
||||
string color = 9; //车辆颜色
|
||||
double heading = 10; //车辆朝向
|
||||
double speed = 11; //车辆速度
|
||||
uint32 drawLevel = 12; //危险等级 1 绿,2 黄,3 红
|
||||
double driverTime = 13; //驱动感知时间
|
||||
}
|
||||
|
||||
message TrackedObjects
|
||||
{
|
||||
repeated TrackedObject objs = 1;
|
||||
}
|
||||
|
||||
// message definition for MsgTypeGnssInfo
|
||||
message GnssInfo
|
||||
{
|
||||
double longitude = 1; //经度
|
||||
double latitude = 2; //纬度
|
||||
double altitude = 3; //海拔
|
||||
double heading = 4; //航向角
|
||||
double acceleration = 5; //加速度
|
||||
double yawRate = 6; //曲率
|
||||
double gnssSpeed = 7; //惯导车速 m/s
|
||||
double vehicleSpeed = 8; //车辆车速 m/s
|
||||
double satelliteTime = 9; //gps时间 单位:秒s
|
||||
double systemTime = 10; //系统时间 单位:秒s
|
||||
}
|
||||
|
||||
// message definition for MessageType: MsgTypeVehicleState
|
||||
// refer to VehicleState in vehicle_state.proto
|
||||
|
||||
// message definition for MessageType: MsgTypeAutopilotState
|
||||
message AutopilotState
|
||||
{
|
||||
uint32 state = 1; //0: 不可用, 1:ready, 2:自动驾驶中
|
||||
uint32 camera = 2; //camera节点状态 1:开启,0:关闭
|
||||
uint32 radar = 3; //雷达节点状态 1:开启,0:关闭
|
||||
uint32 rtk = 4; //RTK节点状态 1:开启,0:关闭
|
||||
uint32 autopilotMode = 5; //自动驾驶状态 0: 非自动驾驶,1: 自动驾驶
|
||||
double speed = 6; //惯导车速 m/s
|
||||
string reason = 7; //不可用原因
|
||||
}
|
||||
|
||||
// message definition for MessageType: MsgTypeReportMessage
|
||||
// refer to mogo_report_msg.proto
|
||||
|
||||
// message definition for MessageType: MsgTypeBasicInfoReq
|
||||
message BasicInfoReq
|
||||
{
|
||||
}
|
||||
|
||||
// message definition for MessageType: MsgTypeBasicInfoRsp
|
||||
message BasicInfoResp
|
||||
{
|
||||
string sn = 1;
|
||||
uint32 environment = 2; //1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
}
|
||||
|
||||
// message definition for MsgTypeSetAutopilotModeReq
|
||||
message Location
|
||||
{
|
||||
double longitude = 1;
|
||||
double latitude = 2;
|
||||
double altitude = 3;
|
||||
double heading = 4;
|
||||
}
|
||||
|
||||
message RouteInfo{
|
||||
Location startLocation = 1;
|
||||
string startName = 2;
|
||||
Location endLocation = 3;
|
||||
string endName = 4;
|
||||
repeated Location wayPoints = 5;
|
||||
double speedLimit = 6;
|
||||
uint32 vehicleType = 7;
|
||||
bool isSpeakVoice = 8;
|
||||
}
|
||||
|
||||
message SetAutopilotModeReq
|
||||
{
|
||||
uint32 mode = 1; //1: enter autopilot mode, 0: quit autopilot mode
|
||||
uint32 source = 2; //命令来源: 0: pad模拟, 1: aicloud业务
|
||||
RouteInfo routeInfo = 3; //自动驾驶路径信息
|
||||
}
|
||||
|
||||
// message definition for MsgTypeSetDemoModeReq
|
||||
message SetDemoModeReq
|
||||
{
|
||||
uint32 enable = 1; //1: enable, 0: disable
|
||||
}
|
||||
|
||||
// message definition for MsgTypeCarConfigReq
|
||||
message CarConfigReq
|
||||
{
|
||||
}
|
||||
|
||||
// message definition for MsgTypeCarConfigResp
|
||||
message CarConfigResp
|
||||
{
|
||||
string dockVersion = 1;
|
||||
string plateNumber = 2;
|
||||
string macAddress = 3;
|
||||
ProtocolVersion protocolVersion = 4; //通信协议版本
|
||||
double speedLimit = 5; //自动驾驶限速
|
||||
}
|
||||
|
||||
// message definition for MsgTypeRecordCause
|
||||
message RecordCause
|
||||
{
|
||||
string key = 1; //bag key 唯一标识
|
||||
string filename = 2; //文件路径
|
||||
string reason = 3; //接管原因
|
||||
string reasonID = 4; //接管原因id
|
||||
}
|
||||
|
||||
// message definition for MsgTypeRecordData
|
||||
message RecordData
|
||||
{
|
||||
uint32 id = 1; //采集id
|
||||
uint32 duration = 2; //采集时间长
|
||||
uint32 type = 3; //采集类型, 1:badcase, 2: map; 3: rests
|
||||
bool isRecord = 4; //采集指令, true: 采集, false: 停止采集
|
||||
bool sustain = 5; //是否持续采集
|
||||
}
|
||||
|
||||
// message definition for MsgTypeRecordResult
|
||||
// refer to RecordPanel in record_panel.proto
|
||||
|
||||
// message definition for MsgTypeSetAutopilotSpeedReq
|
||||
message SetAutopilotSpeedReq
|
||||
{
|
||||
double speedLimit = 1; //最大车辆速度 m/s
|
||||
}
|
||||
|
||||
// message definition for MsgTypeGlobalPathReq
|
||||
message GlobalPathReq
|
||||
{
|
||||
}
|
||||
|
||||
// message definition for MsgTypeGlobalPathResp
|
||||
message GlobalPathResp
|
||||
{
|
||||
repeated Location wayPoints = 1;
|
||||
}
|
||||
|
||||
// message definition for MsgTypeTrafficLightData
|
||||
message TrafficLightStatus
|
||||
{
|
||||
string phaseNo = 1; //相位编号
|
||||
string color = 2; //灯态: 红灯-R,绿灯-G,绿闪-FG,黄-Y,B-黑
|
||||
int32 remain = 3; //倒计时-秒
|
||||
}
|
||||
|
||||
message TrafficLightDetail
|
||||
{
|
||||
TrafficLightStatus left = 1; //左灯
|
||||
TrafficLightStatus mid = 2; //中间灯
|
||||
TrafficLightStatus right = 3; //右灯
|
||||
}
|
||||
|
||||
message TrafficLightData
|
||||
{
|
||||
string crossID = 1; //roadID
|
||||
double latitude = 2;
|
||||
double longitude = 3;
|
||||
string heading = 4; //红绿灯方向
|
||||
string direction = 5; //路的航向角
|
||||
int32 lightId = 6; //红绿灯ID
|
||||
int32 laneNo = 7; //车道号
|
||||
int32 arrowNo = 8; //当前车道对应地面要素转向
|
||||
int32 flashYellow = 9; //黄灯总时间
|
||||
TrafficLightDetail laneDetail = 10; //灯态具体信息
|
||||
}
|
||||
|
||||
// message definition for MsgTypeWarn
|
||||
message Warn
|
||||
{
|
||||
uint32 type = 1; //16: 小心行人, 17: 前车起步, 18: 左车道偏离, 19: 右车道偏离
|
||||
//20: 保持车距/小心前车, 23:摩托车碰撞
|
||||
//40: 禁止掉头, 41: 禁止左转, 42: 禁止右转, 43: 禁止鸣喇叭, 44: 禁止通行, 45: 限速%d
|
||||
string content = 2; //words describe type
|
||||
uint32 level = 3; //1:low 2:high
|
||||
string value = 4; //reserved
|
||||
}
|
||||
|
||||
// message definition for MsgTypeArrivalNotification
|
||||
message ArrivalNotification
|
||||
{
|
||||
uint32 carType = 1;
|
||||
Location endLocation = 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
21
core/mogo-core-data/src/main/proto/mogo_report_msg.proto
Normal file
21
core/mogo-core-data/src/main/proto/mogo_report_msg.proto
Normal file
@@ -0,0 +1,21 @@
|
||||
syntax = "proto2";
|
||||
package mogo_msg;
|
||||
|
||||
message MogoMsgTimestamp {
|
||||
required fixed32 sec = 1;
|
||||
required fixed32 nsec = 2;
|
||||
}
|
||||
|
||||
message MogoReportMessage {
|
||||
required MogoMsgTimestamp timestamp = 1; //来自消息源的时间戳,转发消息时不应修改
|
||||
required string src = 2; //消息来源
|
||||
required string level = 3; //error info
|
||||
optional string msg = 4; //研发自己看的信息;对标准日志来说就是日志内容
|
||||
optional string code = 5; //error日志中的错误原因,这是一个类似宏的受约束字段,用字符串的目的是便于排查问题时查看
|
||||
|
||||
repeated string result = 6; //带来的后果;例如pad无法启动驾驶,远程驾驶无法启动等;可供监控后台做错误分类;pad无法理解code时也可参考此字段
|
||||
|
||||
repeated string actions = 16; //试验性字段。消息发出者希望触发的动作,例如:触发短信报警,自动创建工单,要求pad弹框等
|
||||
}
|
||||
|
||||
|
||||
35
core/mogo-core-data/src/main/proto/record_panel.proto
Normal file
35
core/mogo-core-data/src/main/proto/record_panel.proto
Normal file
@@ -0,0 +1,35 @@
|
||||
syntax = "proto2";
|
||||
|
||||
package record_cache;
|
||||
|
||||
import "header.proto";
|
||||
|
||||
message RecordItem {
|
||||
optional string topic = 1; //topic name of record data
|
||||
optional int32 nums = 2; //quantity of this topic's data
|
||||
}
|
||||
|
||||
message TriggerInfo {
|
||||
required bool auto_trig = 1; //trigger mode: true - auto trig when autopilot mode turn to handle | false - subscribe topic to trig
|
||||
optional string trig_topic = 2; //name of topic used to trig(mode is 0 available)
|
||||
optional string trig_msg = 3; //topic message(mode is 0 available)
|
||||
}
|
||||
|
||||
message RecordPanel {
|
||||
optional common.Header header = 1;
|
||||
optional int32 stat = 2; //record stat:100 - record succeed,auto stop | 101 - record succeed,handle stop | 200 - record failed
|
||||
optional int64 disk_free = 3; //disk space available
|
||||
optional int64 total_size = 4; //space used by bag
|
||||
optional string timestamp = 5; //timestamp
|
||||
optional float duration = 6; //data duration
|
||||
optional TriggerInfo triggerinfo = 7; //information of trigger
|
||||
optional string filename = 8; //bag's filename
|
||||
repeated RecordItem records = 9; //information of each topic's record
|
||||
optional string note = 10; //other message(warn,error or other message included)
|
||||
optional int32 type = 11;
|
||||
optional int32 id = 12;
|
||||
required uint64 key = 13;
|
||||
repeated string topics = 14;
|
||||
}
|
||||
|
||||
|
||||
41
core/mogo-core-data/src/main/proto/vehicle_state.proto
Normal file
41
core/mogo-core-data/src/main/proto/vehicle_state.proto
Normal file
@@ -0,0 +1,41 @@
|
||||
syntax = "proto2";
|
||||
package chassis;
|
||||
|
||||
import "header.proto";
|
||||
import "chassis.proto";
|
||||
|
||||
message VehicleState {
|
||||
optional common.Header header = 1;
|
||||
optional chassis.PilotMode pilot_mode = 2 [default = MODE_MANUAL];
|
||||
optional float steering = 3 [default = 0]; // steering angle in degrees
|
||||
optional float speed = 4 [default = 0]; // speed in m/s
|
||||
optional float accel = 5 [default = 0]; // target acceleration in m/s^2
|
||||
optional float throttle = 6 [default = 0]; // target throttle in percentage [0, 100]
|
||||
optional float brake = 7 [default = 0]; // target brake in percentage [0, 100]
|
||||
|
||||
optional chassis.GearPosition gear = 8 [default = GEAR_NONE];
|
||||
optional chassis.LightSwitch light = 9 [default = LIGHT_NONE];
|
||||
|
||||
//TODO: move to chassis
|
||||
optional bool horn = 10 [default = false]; //鸣笛
|
||||
optional bool highbeam = 11 [default = false]; //远光灯
|
||||
optional bool lowbeam = 12 [default = false]; //近光灯
|
||||
optional bool foglight = 13 [default = false]; //雾灯
|
||||
optional bool clearance_lamps = 14 [default = false]; //示廓灯
|
||||
optional bool warn_light = 15 [default = false]; //报警灯
|
||||
optional bool parking_brake = 16 [default = false];
|
||||
|
||||
optional chassis.LongitudeDrivingMode longitude_driving_mode = 20;
|
||||
optional chassis.EPSSteeringMode eps_steering_mode = 21;
|
||||
optional uint32 steering_sign = 22;
|
||||
|
||||
optional bool steer_inference = 23 [default = false]; //方向盘干预
|
||||
optional bool brake_inference = 24 [default = false]; //制动踏板干预
|
||||
optional bool accel_inference = 25 [default = false]; //加速踏板干预
|
||||
optional bool gear_switch_inference = 26 [default = false]; //档位切换干预
|
||||
optional bool location_missing = 27 [default = false]; //未收到定位
|
||||
optional bool trajectory_missing = 28 [default = false]; //未收到轨迹
|
||||
optional bool chassis_status_missing = 29 [default = false]; //未收到车辆底盘反馈信息
|
||||
optional bool brake_light_status = 30 [default = false]; //自驾模式下制动灯状态
|
||||
optional bool pilot_mode_condition_met = 31 [default = false];
|
||||
}
|
||||
@@ -5,7 +5,7 @@ plugins {
|
||||
}
|
||||
ext {
|
||||
//自动驾驶产品版本号
|
||||
AP_VERSION = "2.2.1"
|
||||
AP_VERSION = "2.6.0"
|
||||
}
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
@@ -33,35 +33,35 @@ android {
|
||||
}
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/main/java'
|
||||
}
|
||||
|
||||
proto {
|
||||
srcDir 'src/main/proto'
|
||||
include '**/*.proto'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protobuf {
|
||||
protoc {
|
||||
artifact = 'com.google.protobuf:protoc:3.6.1'
|
||||
}
|
||||
|
||||
generateProtoTasks {
|
||||
all().each { task ->
|
||||
task.builtins {
|
||||
remove java
|
||||
}
|
||||
task.builtins {
|
||||
java {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// sourceSets {
|
||||
// main {
|
||||
// java {
|
||||
// srcDir 'src/main/java'
|
||||
// }
|
||||
//
|
||||
// proto {
|
||||
// srcDir 'src/main/proto'
|
||||
// include '**/*.proto'
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// protobuf {
|
||||
// protoc {
|
||||
// artifact = 'com.google.protobuf:protoc:3.6.1'
|
||||
// }
|
||||
//
|
||||
// generateProtoTasks {
|
||||
// all().each { task ->
|
||||
// task.builtins {
|
||||
// remove java
|
||||
// }
|
||||
// task.builtins {
|
||||
// java {}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -76,9 +76,9 @@ dependencies {
|
||||
// logger
|
||||
//implementation 'com.orhanobut:logger:2.2.0'
|
||||
//ProtoBuf
|
||||
implementation 'com.google.protobuf:protobuf-java:3.6.1'
|
||||
implementation 'com.google.protobuf:protoc:3.6.1'
|
||||
implementation 'com.google.protobuf:protobuf-java-util:3.6.1'
|
||||
// implementation 'com.google.protobuf:protobuf-java:3.6.1'
|
||||
// implementation 'com.google.protobuf:protoc:3.6.1'
|
||||
// implementation 'com.google.protobuf:protobuf-java-util:3.6.1'
|
||||
implementation 'com.jcraft:jsch:0.1.55'
|
||||
// api project(path: ':lib_recorder')
|
||||
api "com.zhidao.support.recorder:recorder:1.0.0.3"
|
||||
|
||||
@@ -3,43 +3,30 @@ package com.zhidao.support.adas.high;
|
||||
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_UDP_CONNECT_ADDRESS;
|
||||
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_LINK_ADAS;
|
||||
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
|
||||
import static com.zhidao.support.adas.high.common.ActionTypeReceive.ACTION_WS_AUTOPILOT_CONTROL;
|
||||
import static com.zhidao.support.adas.high.udp.CupidUdpConstract.VIDEO_RENDER_IMAGE_UDP;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.bean.AdasConfig;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotControl;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotSpeedParam;
|
||||
import com.zhidao.support.adas.high.bean.BaseInfo;
|
||||
import com.zhidao.support.adas.high.bean.BasicInfo;
|
||||
import com.zhidao.support.adas.high.bean.DemoModeInfo;
|
||||
import com.zhidao.support.adas.high.bean.SSHResult;
|
||||
import com.zhidao.support.adas.high.bean.record.RecordCauseParam;
|
||||
import com.zhidao.support.adas.high.bean.record.RecordDataParam;
|
||||
import com.zhidao.support.adas.high.common.AppPreferenceHelper;
|
||||
import com.zhidao.support.adas.high.common.Base64;
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.Define;
|
||||
import com.zhidao.support.adas.high.common.IPCFixationIPHelper;
|
||||
import com.zhidao.support.adas.high.common.MgContextUtils;
|
||||
import com.zhidao.support.adas.high.common.MessageType;
|
||||
import com.zhidao.support.adas.high.common.RSATool;
|
||||
import com.zhidao.support.adas.high.common.RegexUtils;
|
||||
import com.zhidao.support.adas.high.common.SSH;
|
||||
import com.zhidao.support.adas.high.common.ThreadPoolManager;
|
||||
import com.zhidao.support.adas.high.msg.MyMessageFactory;
|
||||
import com.zhidao.support.adas.high.queue.UdpQueueManager;
|
||||
import com.zhidao.support.adas.high.protocol.RawPack;
|
||||
import com.zhidao.support.adas.high.queue.WSByteQueueManager;
|
||||
import com.zhidao.support.adas.high.queue.WebSocketQueueManager;
|
||||
import com.zhidao.support.adas.high.socket.FpgaSocket;
|
||||
import com.zhidao.support.adas.high.socket.read.OriginReadData;
|
||||
import com.zhidao.support.adas.high.socket.read.SocketReader;
|
||||
import com.zhidao.support.adas.high.udp.CupidUdpConstract;
|
||||
import com.zhidao.support.adas.high.udp.IConnectRtpListener;
|
||||
import com.zhidao.support.adas.high.udp.IGetH264Data;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
import com.zhidao.support.adas.high.protocol.RawUnpack;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
import com.zhjt.service.chain.TracingConstants;
|
||||
|
||||
@@ -48,7 +35,7 @@ import org.json.JSONObject;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mogo.webproto.WebsocketHeader;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import okio.ByteString;
|
||||
|
||||
/**
|
||||
@@ -63,15 +50,12 @@ import okio.ByteString;
|
||||
* @UpdateRemark: 更新说明:
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnectListener, IConnectRtpListener, IGetH264Data, IPCFixationIPHelper.IIPCFixationIPListener {
|
||||
public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnectListener, IPCFixationIPHelper.IIPCFixationIPListener {
|
||||
private static final String TAG = AdasChannel.class.getSimpleName();
|
||||
|
||||
private FpgaSocket mSocket;
|
||||
private SocketReader socketReader;
|
||||
/**
|
||||
* udp server
|
||||
*/
|
||||
private CupidUdpConstract udpConstract;
|
||||
private RawUnpack rawUnpack;//数据拆包
|
||||
private RawPack rawPack;//数据打包
|
||||
/**
|
||||
* 与工控机链接状态
|
||||
*/
|
||||
@@ -80,13 +64,10 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
|
||||
|
||||
/**
|
||||
* 是否使用队列处理数据
|
||||
* 是否使用队列处理数据 TODO 测试了一下队列有bug
|
||||
*/
|
||||
public static final boolean isUseQueue = false;
|
||||
/**
|
||||
* 录包信息
|
||||
*/
|
||||
private RecordDataParam recordDataParam = null;
|
||||
|
||||
|
||||
/**
|
||||
* 序列化rect
|
||||
@@ -96,17 +77,19 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
* 消息工厂
|
||||
*/
|
||||
private MyMessageFactory myMessageFactory;
|
||||
private AutopilotSpeedParam speedParam;
|
||||
/**
|
||||
* 工控机连接配置
|
||||
*/
|
||||
private final AdasOptions adasOptions;
|
||||
private RecordCauseParam recordCauseParam;
|
||||
private SSH ssh;
|
||||
/**
|
||||
* 已经链接成功的工控机IP 未连接未null
|
||||
*/
|
||||
private String ipcConnectedIP;
|
||||
private String ipcConnectedIp;
|
||||
/**
|
||||
* 已经链接成功的工控机端口
|
||||
*/
|
||||
private int ipcConnectedPort = Constants.DEFAULT_PORT;
|
||||
private OnMultiDeviceListener onMultiDeviceListener;
|
||||
/**
|
||||
* IPC固定IP查询工具类
|
||||
@@ -140,11 +123,19 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
*/
|
||||
@Override
|
||||
public void onAvailableIP(String ip) {
|
||||
getOnConnectionAddress(ip);
|
||||
onConnectionAddress(ip);
|
||||
}
|
||||
|
||||
AdasChannel(Context context, AdasOptions options) {
|
||||
initData(context);
|
||||
/**
|
||||
* 创建对象时会自动连接工控机,如果使用setListener 会出现 listener=null而调用回调的情况,所以将所使用到的接口
|
||||
*
|
||||
* @param context
|
||||
* @param options
|
||||
* @param onAdasConnectStatusListener
|
||||
*/
|
||||
AdasChannel( AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener) {
|
||||
this.adasConnectStatusListener = onAdasConnectStatusListener;
|
||||
initData();
|
||||
//配置为null默认是乘客屏幕
|
||||
if (options == null) {
|
||||
this.adasOptions = new AdasOptions.Builder().setClient(true).build();
|
||||
@@ -156,28 +147,15 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
}
|
||||
}
|
||||
|
||||
private void initData(Context context) {
|
||||
private void initData() {
|
||||
//原始数据解析类
|
||||
socketReader = new SocketReader();
|
||||
MgContextUtils.setContext(context.getApplicationContext());
|
||||
rawUnpack = new RawUnpack();
|
||||
rawPack = new RawPack();
|
||||
//消息工厂
|
||||
myMessageFactory = new MyMessageFactory();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化udp
|
||||
*/
|
||||
private void initUdpServer() {
|
||||
if (isUseQueue) {
|
||||
UdpQueueManager.getInstance().registerAdasChannel(this);
|
||||
UdpQueueManager.getInstance().initDector();
|
||||
}
|
||||
udpConstract = new CupidUdpConstract(VIDEO_RENDER_IMAGE_UDP);
|
||||
udpConstract.setOnReceiverH264Data(this);
|
||||
udpConstract.setOnConnectListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据固定IP查询可用IP
|
||||
*/
|
||||
@@ -205,51 +183,20 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
nodeAliasCode = CHAIN_ALIAS_CODE_UDP_CONNECT_ADDRESS,
|
||||
paramIndexes = {0},
|
||||
clientPkFileName = "sn")
|
||||
private void connectSocket(String address) {
|
||||
private void connectSocket(String address, int port) {
|
||||
if (mSocket != null) {
|
||||
mSocket.connectWebSocket(address);
|
||||
mSocket.connectWebSocket(address, port);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础信息
|
||||
*
|
||||
* @param basicInfo
|
||||
*/
|
||||
public void sendWsBasicInfo(BasicInfo basicInfo) {
|
||||
if (basicInfo == null) {
|
||||
return;
|
||||
}
|
||||
String msg = gson.toJson(basicInfo);
|
||||
sendWsMessage(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向工控机发送数据
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Override
|
||||
public void sendBaseInfo(BaseInfo info) {
|
||||
if (info == null) {
|
||||
return;
|
||||
}
|
||||
String msg = gson.toJson(info);
|
||||
sendWsMessage(msg);
|
||||
}
|
||||
|
||||
private void sendIPCCmd(final String cmd) {
|
||||
if (ssh == null) {
|
||||
// String ip = ipcIp;
|
||||
if (TextUtils.isEmpty(ipcConnectedIP)) {
|
||||
//尝试从缓存中获取工控机IP
|
||||
// String ip = AppPreferenceHelper.getInstance(MgContextUtils.getContext()).getUdpClientAddress();
|
||||
// if (TextUtils.isEmpty(ip)) {
|
||||
if (TextUtils.isEmpty(ipcConnectedIp)) {
|
||||
if (mAdasListener != null) {
|
||||
mAdasListener.onSSHResult(new SSHResult(SSHResult.RESULT_CODE.IP_UNKNOWN, cmd, "IPC IP未知"));
|
||||
}
|
||||
return;
|
||||
// }
|
||||
}
|
||||
ThreadPoolManager.getsInstance().execute(new Runnable() {
|
||||
@Override
|
||||
@@ -259,7 +206,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
String privateKey = "MIIBVQIBADANBgkqhkiG9w0BAQEFAASCAT8wggE7AgEAAkEA127FFvuPolaxYTBg5wkyDIrEbcNKXoIjf0bK7QUQ991Lsbv5Ktv/XM2F6qJFssVF1KTkStVBSQGxJB1eZLwJEwIDAQABAkBM39AgpV/Z1Amz3qmVh+h+JT521ItDMjksf7yF25r0dzGjOfGLQmMAqQXT68B+cQX5HSoFMwk/rE1hnXgifyNBAiEA6uNE2TfPj51mPOZztGy1Q8p4exWohfotiy64g/CyVeMCIQDqy9e7bGeZEi6p1zemEgFVtwgZZvLn/BOP4UO7NjJnEQIhAJBnprUwha/SYb+BIpNC3fHOcWGigBfWJdfSomejO9BnAiEApfojLqKbOWHZCsbQ19yyhN02JH7aB5PyYCtlrdnKF4ECIHR1P2LOQLddXO8PwgoF6gtCTO2sxIqdvu8fUruWyouQ";
|
||||
try {
|
||||
String pwd = RSATool.decodeByPrivateKey(encodePwd, Base64.decodeBase64(privateKey));
|
||||
ssh.connect(ipcConnectedIP, 22, "titan", pwd);
|
||||
ssh.connect(ipcConnectedIp, 22, "titan", pwd);
|
||||
SSHResult result = ssh.exec(cmd, pwd);
|
||||
if (mAdasListener != null)
|
||||
mAdasListener.onSSHResult(result);
|
||||
@@ -292,18 +239,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
|
||||
|
||||
@Override
|
||||
public void enableDemoMode() {
|
||||
sendBaseInfo(DemoModeInfo.enable());
|
||||
public String getIpcConnectedIp() {
|
||||
return ipcConnectedIp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableDemoMode() {
|
||||
sendBaseInfo(DemoModeInfo.disable());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIPCConnectedIP() {
|
||||
return ipcConnectedIP;
|
||||
public int getIpcConnectedPort() {
|
||||
return ipcConnectedPort;
|
||||
}
|
||||
|
||||
|
||||
@@ -318,11 +260,20 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
|
||||
|
||||
/**
|
||||
* 初始化webSocket
|
||||
* 发送PB数据
|
||||
*
|
||||
* @param msgType 数据类型
|
||||
* @param data 数据
|
||||
* @return
|
||||
*/
|
||||
public void setUdpIsFirstInit() {
|
||||
if (udpConstract != null)
|
||||
udpConstract.setUdpIsFirstInit();
|
||||
private boolean sendWsMessage(MessagePad.MessageType msgType, byte[] data) {
|
||||
if (mSocket != null && rawPack != null) {
|
||||
ByteString byteString = rawPack.pack(msgType, data);
|
||||
if (byteString != null) {
|
||||
return mSocket.sendDataWebSocket(byteString);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -378,18 +329,17 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
//PB解析
|
||||
ByteString byteString = ByteString.of(bytes);
|
||||
try {
|
||||
if (socketReader != null) {
|
||||
OriginReadData read = socketReader.read(byteString);
|
||||
if (read == null) {
|
||||
//read 解析为空 默认解析view
|
||||
CupidLogUtils.w("--->websocket byte read null, analysis view");
|
||||
myMessageFactory.createMessage(0x101).handlerMsg(gson, mAdasListener, bytes);
|
||||
return;
|
||||
if (rawUnpack != null) {
|
||||
RawData raw = rawUnpack.read(byteString);
|
||||
if (raw.isUnpackSucceed()) {
|
||||
MessagePad.Header header = MessagePad.Header.parseFrom(raw.getHeader());
|
||||
MessagePad.MessageType messageType = header.getMsgType();
|
||||
CupidLogUtils.w("--->websocket byte read header = " + messageType.toString());
|
||||
myMessageFactory.createMessage(messageType).handlerMsg(header, raw.getPayload(), mAdasListener);
|
||||
} else {
|
||||
CupidLogUtils.w("数据解析失败=" + byteString.hex());
|
||||
}
|
||||
WebsocketHeader.Header_websock header = WebsocketHeader.Header_websock.parseFrom(read.getHeader());
|
||||
int headerType = header.getMsgType();
|
||||
CupidLogUtils.w("--->websocket byte read header = " + headerType);
|
||||
myMessageFactory.createMessage(headerType).handlerMsg(gson, mAdasListener, read.getPayload());
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -408,29 +358,18 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
public void connect() {
|
||||
//当是司机屏才启用
|
||||
if (!adasOptions.isClient()) {
|
||||
if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED) {
|
||||
if (ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.DISCONNECTED ||
|
||||
ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS) {
|
||||
ipcConnectionStatus = Constants.IPC_CONNECTION_STATUS.SEARCH_ADDRESS;
|
||||
if (adasConnectStatusListener != null) {
|
||||
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus, null);
|
||||
}
|
||||
switch (adasOptions.getIpcConnectionMode()) {
|
||||
case AdasOptions.IPC_CONNECTION_MODE.FIXATION:
|
||||
if (mSocket != null) {
|
||||
mSocket.setIsReconnect(true);
|
||||
}
|
||||
ipcFixationIPHelper(adasOptions.getIpcFixationIP());
|
||||
break;
|
||||
case AdasOptions.IPC_CONNECTION_MODE.ASSIGN:
|
||||
if (mSocket != null) {
|
||||
mSocket.setIsReconnect(true);
|
||||
}
|
||||
getOnConnectionAddress(adasOptions.getIpcAssignIP());
|
||||
break;
|
||||
case AdasOptions.IPC_CONNECTION_MODE.UDP:
|
||||
if (mSocket != null) {
|
||||
mSocket.setIsReconnect(false);
|
||||
}
|
||||
initUdpServer();
|
||||
onConnectionAddress(adasOptions.getIpcAssignIP());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -443,16 +382,15 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
*/
|
||||
@Override
|
||||
public void disconnect() {
|
||||
if (ipcFixationIPHelper!=null){
|
||||
if (ipcFixationIPHelper != null) {
|
||||
ipcFixationIPHelper.stop();
|
||||
}
|
||||
if (!adasOptions.isClient()) {
|
||||
if (udpConstract != null)
|
||||
udpConstract.release();
|
||||
if (mSocket != null)
|
||||
mSocket.closeWebSocket();
|
||||
if (isUseQueue) {
|
||||
UdpQueueManager.getInstance().release();
|
||||
WebSocketQueueManager.getInstance().release();
|
||||
WSByteQueueManager.getInstance().release();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -479,18 +417,21 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketConnectSuccess() {
|
||||
public void onWebSocketConnectSuccess(String ipAddress, int port) {
|
||||
ipcConnectionStatus = Constants.IPC_CONNECTION_STATUS.CONNECTED;
|
||||
ipcConnectedIp = ipAddress;
|
||||
ipcConnectedPort = port;
|
||||
sendCarConfigReq();
|
||||
if (adasConnectStatusListener != null) {
|
||||
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus, null);
|
||||
queryCarConfig();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWebSocketConnectFailed(String t) {
|
||||
ipcConnectionStatus = Constants.IPC_CONNECTION_STATUS.DISCONNECTED;
|
||||
setUdpIsFirstInit();
|
||||
ipcConnectedIp = null;
|
||||
ipcConnectedPort = Constants.DEFAULT_PORT;
|
||||
if (adasConnectStatusListener != null) {
|
||||
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus, t);
|
||||
}
|
||||
@@ -506,232 +447,78 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
handlerWSMsg(bytes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionSuccessRtp() {
|
||||
CupidLogUtils.e(TAG, "--->onConnectionSuccessRtp");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnectionFailedRtp(String reason) {
|
||||
CupidLogUtils.e(TAG, "--->onConnectionFailedRtp:" + reason);
|
||||
// TODO 暂时注释 测试完成添加
|
||||
// closeSocket();
|
||||
setUdpIsFirstInit();
|
||||
/*if (mRenderImageListener != null) {
|
||||
mRenderImageListener.onConnectionFailedRtp(reason);
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOnConnectionAddress(String address) {
|
||||
CupidLogUtils.e(TAG, "要连接的工控机IP=" + address);
|
||||
if (TextUtils.isEmpty(address)) {
|
||||
if (mSocket != null) {
|
||||
mSocket.setIsReconnect(false);
|
||||
}
|
||||
if (adasConnectStatusListener != null) {
|
||||
ipcConnectionStatus = Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS;
|
||||
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus, "找不到可用的IP");
|
||||
}
|
||||
return;
|
||||
}
|
||||
ipcConnectedIP = address;
|
||||
AppPreferenceHelper.getInstance(MgContextUtils.getContext()).saveUdpClientAddress(address);
|
||||
connectSocket(address);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnectRtp() {
|
||||
CupidLogUtils.e(TAG, "--->onDisconnectRtp");
|
||||
setUdpIsFirstInit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getH264Data(byte[] data, long receiverDataTimeUdp) {
|
||||
//处理数据
|
||||
String content = new String(data).trim();
|
||||
CupidLogUtils.e("--->udp数据回调:" + content);
|
||||
if (isUseQueue) {
|
||||
UdpQueueManager.getInstance().addQueueData(content);
|
||||
} else {
|
||||
udpDataManage(content);
|
||||
private void notFoundAddress() {
|
||||
ipcConnectionStatus = Constants.IPC_CONNECTION_STATUS.NOT_FOUND_ADDRESS;
|
||||
if (adasConnectStatusListener != null) {
|
||||
adasConnectStatusListener.onConnectionIPCStatus(ipcConnectionStatus, "地址不可用或不合法");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理udp数据
|
||||
* 根据IP和端口进行连接
|
||||
*
|
||||
* @param content
|
||||
* @param address
|
||||
*/
|
||||
public void udpDataManage(String content) {
|
||||
if (!TextUtils.isEmpty(content)) {
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(content);
|
||||
String udpRenderAction = jsonObject.getString("action");
|
||||
if (!TextUtils.isEmpty(udpRenderAction)) {
|
||||
//udp消息处理
|
||||
myMessageFactory.createMessage(udpRenderAction).handlerMsg(gson, mAdasListener, content);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CupidLogUtils.e("--->json数据解析异常-换用protoBuf:" + e.toString());
|
||||
myMessageFactory.createMessage("view").handlerMsg(gson, mAdasListener, content);
|
||||
e.printStackTrace();
|
||||
}
|
||||
private void onConnectionAddress(String address) {
|
||||
CupidLogUtils.e(TAG, "要连接的工控机地址=" + address);
|
||||
|
||||
if (TextUtils.isEmpty(address)) {
|
||||
notFoundAddress();
|
||||
return;
|
||||
}
|
||||
String tempIp;
|
||||
int tempPort;
|
||||
if (address.contains(":")) {
|
||||
String[] temp = address.split(":");
|
||||
if (temp.length < 2) {
|
||||
notFoundAddress();
|
||||
return;
|
||||
}
|
||||
tempIp = temp[0];
|
||||
try {
|
||||
tempPort = Integer.parseInt(temp[1]);
|
||||
if (tempPort <= 0 || tempPort > 65535) {
|
||||
notFoundAddress();
|
||||
return;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
notFoundAddress();
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
tempIp = address;
|
||||
tempPort = Constants.DEFAULT_PORT;
|
||||
}
|
||||
if (!RegexUtils.isIP(tempIp)) {
|
||||
notFoundAddress();
|
||||
return;
|
||||
}
|
||||
connectSocket(tempIp, tempPort);
|
||||
}
|
||||
|
||||
private OnAdasListener mAdasListener;
|
||||
//连接状态listener
|
||||
private OnAdasConnectStatusListener adasConnectStatusListener;
|
||||
private final OnAdasConnectStatusListener adasConnectStatusListener;
|
||||
|
||||
void setOnAdasListener(OnAdasListener adasListener) {
|
||||
mAdasListener = adasListener;
|
||||
}
|
||||
|
||||
void setOnAdasMsgConnectStatusListener(OnAdasConnectStatusListener adasMsgConnectStatusListener) {
|
||||
adasConnectStatusListener = adasMsgConnectStatusListener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean controlAutopilotCarAuto() {
|
||||
AutopilotControl autopilotControl = new AutopilotControl();
|
||||
autopilotControl.setAction(ACTION_WS_AUTOPILOT_CONTROL.getmActionType());
|
||||
AutopilotControl.ValuesBean autopilotControlValues = new AutopilotControl.ValuesBean();
|
||||
autopilotControlValues.setMode(1);
|
||||
autopilotControl.setValues(autopilotControlValues);
|
||||
return sendWsMessage(gson.toJson(autopilotControl));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean controlAutopilotCarHead() {
|
||||
AutopilotControl autopilotControl = new AutopilotControl();
|
||||
autopilotControl.setAction(ACTION_WS_AUTOPILOT_CONTROL.getmActionType());
|
||||
AutopilotControl.ValuesBean autopilotControlValues = new AutopilotControl.ValuesBean();
|
||||
autopilotControlValues.setMode(0);
|
||||
autopilotControl.setValues(autopilotControlValues);
|
||||
return sendWsMessage(gson.toJson(autopilotControl));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIpcConnectionStatus() {
|
||||
return ipcConnectionStatus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdasConfig getAdasConfig() {
|
||||
String address = AppPreferenceHelper.getInstance(MgContextUtils.getContext()).getUdpClientAddress();
|
||||
String dockConfig = AppPreferenceHelper.getInstance(MgContextUtils.getContext()).getDockConfig();
|
||||
if (TextUtils.isEmpty(dockConfig)) {
|
||||
queryCarConfig();
|
||||
}
|
||||
AdasConfig adasConfig = new AdasConfig();
|
||||
adasConfig.setAddress(address);
|
||||
adasConfig.setDockVersion(dockConfig);
|
||||
return adasConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询config信息
|
||||
*/
|
||||
private void queryCarConfig() {
|
||||
sendWsMessage(Constants.QUERY_CAR_CONFIG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean aiCloudToAdasData(String msg) {
|
||||
//位置信息 action是aiCloudToStartAutopilot
|
||||
if (!TextUtils.isEmpty(msg)) {
|
||||
return sendWsMessage(msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean queryAutopilotRoute() {
|
||||
//查询自动驾驶路径
|
||||
return sendWsMessage(Constants.QUERY_GLOBAL_PATH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean queryAutopilotGuardian() {
|
||||
//查询节点信息
|
||||
return sendWsMessage(Constants.QUERY_GUARDIAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recordPackage(int type, int id) {
|
||||
return recordBag(true, type, id, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recordPackage(int type, int id, int duration) {
|
||||
return recordBag(true, type, id, duration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stopRecord(int type, int id) {
|
||||
return recordBag(false, type, id, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recordCause(String key, String name, String id, String reason) {
|
||||
if (recordCauseParam == null) {
|
||||
recordCauseParam = new RecordCauseParam();
|
||||
}
|
||||
RecordCauseParam.Result result = new RecordCauseParam.Result();
|
||||
result.setKey(key);
|
||||
result.setFilename(name);
|
||||
result.setReason(reason);
|
||||
result.setId(id);
|
||||
recordCauseParam.setResult(result);
|
||||
return sendWsMessage(gson.toJson(recordCauseParam));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setSpeed(int speed) {
|
||||
if (speedParam == null) {
|
||||
speedParam = new AutopilotSpeedParam();
|
||||
}
|
||||
speedParam.setSpeed(speed);
|
||||
String speedJson = gson.toJson(speedParam);
|
||||
return sendWsMessage(speedJson);
|
||||
}
|
||||
// TODO 需求暂停 待讨论
|
||||
// @Override
|
||||
// public boolean getRoutes() {
|
||||
// return sendWsMessage(Constants.QUERY_ROUTES);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 主动录制Bag包
|
||||
*
|
||||
* @param isRecord
|
||||
* @param type
|
||||
* @param id
|
||||
* @param duration
|
||||
* @return
|
||||
*/
|
||||
private boolean recordBag(boolean isRecord, int type, int id, int duration) {
|
||||
if (recordDataParam == null) {
|
||||
recordDataParam = new RecordDataParam();
|
||||
}
|
||||
RecordDataParam.Result result = new RecordDataParam.Result();
|
||||
result.setIsRecord(isRecord);
|
||||
result.setType(type);
|
||||
result.setId(id);
|
||||
if (isRecord == true) {
|
||||
if (duration > 0) {
|
||||
result.setSustain(false);
|
||||
result.setDuration(duration);
|
||||
} else {
|
||||
result.setSustain(true);
|
||||
}
|
||||
}
|
||||
recordDataParam.setResult(result);
|
||||
String param = gson.toJson(recordDataParam);
|
||||
return sendWsMessage(param);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 接管原因
|
||||
@@ -756,6 +543,213 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec
|
||||
CupidLogUtils.setIsWriteLog(isWriteLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 向工控机发送数据
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Override
|
||||
public void sendBaseInfo(BaseInfo info) {
|
||||
if (info == null) {
|
||||
return;
|
||||
}
|
||||
String msg = gson.toJson(info);
|
||||
sendWsMessage(msg);
|
||||
}
|
||||
|
||||
/**************************************************************************************************************************/
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendBasicInfoResp(String sn, int environment) {
|
||||
MessagePad.BasicInfoResp resp = MessagePad.BasicInfoResp
|
||||
.newBuilder()
|
||||
.setSn(sn)
|
||||
.setEnvironment(environment)
|
||||
.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_BASIC_INFO_RESP.typeCode, resp.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶模式 启动自动驾驶
|
||||
*
|
||||
* @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) {
|
||||
MessagePad.SetAutopilotModeReq.Builder builder = MessagePad.SetAutopilotModeReq.newBuilder();
|
||||
builder.setMode(mode);
|
||||
builder.setSource(source);
|
||||
if (routeInfo != null)
|
||||
builder.setRouteInfo(routeInfo);
|
||||
MessagePad.SetAutopilotModeReq req = builder.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_SET_AUTOPILOT_MODE_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置演示模式
|
||||
*
|
||||
* @param enable 1: enable, 0: disable
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendDemoModeReq(int enable) {
|
||||
MessagePad.SetDemoModeReq req = MessagePad.SetDemoModeReq
|
||||
.newBuilder()
|
||||
.setEnable(enable)
|
||||
.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_SET_DEMO_MODE_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 车机基础信息请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendCarConfigReq() {
|
||||
MessagePad.CarConfigReq req = MessagePad.CarConfigReq
|
||||
.newBuilder()
|
||||
.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_CAR_CONFIG_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录人工接管原因
|
||||
*
|
||||
* @param key bag key 唯一标识
|
||||
* @param filename 文件路径
|
||||
* @param reasonID 接管原因id
|
||||
* @param reason 接管原因
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendRecordCause(String key, String filename, String reasonID, String reason) {
|
||||
MessagePad.RecordCause resp = MessagePad.RecordCause
|
||||
.newBuilder()
|
||||
.setKey(key)
|
||||
.setFilename(filename)
|
||||
.setReason(reason)
|
||||
.setReasonID(reasonID)
|
||||
.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_RECORD_CAUSE.typeCode, resp.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startRecordPackage(int id, int type) {
|
||||
return sendRecordData(id, 0, type, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startRecordPackage(int id, int duration, int type) {
|
||||
return sendRecordData(id, duration, type, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stopRecordPackage(int id, int type) {
|
||||
return sendRecordData(id, 0, type, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 数据采集请求 主动录制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) {
|
||||
boolean sustain = false;
|
||||
if (isRecord) {
|
||||
if (duration <= 0) {
|
||||
duration = 0;
|
||||
sustain = true;
|
||||
}
|
||||
}
|
||||
MessagePad.RecordData req = MessagePad.RecordData
|
||||
.newBuilder()
|
||||
.setId(id)
|
||||
.setDuration(duration)
|
||||
.setType(type)
|
||||
.setIsRecord(isRecord)
|
||||
.setSustain(sustain)
|
||||
.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_RECORD_DATA.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶最大速度
|
||||
*
|
||||
* @param speedLimit 最大车辆速度 m/s
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendAutopilotSpeedReq(double speedLimit) {
|
||||
MessagePad.SetAutopilotSpeedReq req = MessagePad.SetAutopilotSpeedReq
|
||||
.newBuilder()
|
||||
.setSpeedLimit(speedLimit)
|
||||
.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_SET_AUTOPILOT_SPEED_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动驾驶路径请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean sendGlobalPathReq() {
|
||||
MessagePad.GlobalPathReq req = MessagePad.GlobalPathReq
|
||||
.newBuilder()
|
||||
.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_GLOBAL_PATH_REQ.typeCode, req.toByteArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送红绿灯数据到工控机
|
||||
*
|
||||
* @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(String crossID, double latitude, double longitude,
|
||||
String heading, String direction, int lightId, int laneNo,
|
||||
int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail) {
|
||||
MessagePad.TrafficLightData.Builder builder = MessagePad.TrafficLightData.newBuilder();
|
||||
builder.setCrossID(crossID);
|
||||
builder.setLatitude(latitude);
|
||||
builder.setLongitude(longitude);
|
||||
builder.setHeading(heading);
|
||||
builder.setDirection(direction);
|
||||
builder.setLightId(lightId);
|
||||
builder.setLaneNo(laneNo);
|
||||
builder.setArrowNo(arrowNo);
|
||||
builder.setFlashYellow(flashYellow);
|
||||
if (laneDetail != null)
|
||||
builder.setLaneDetail(laneDetail);
|
||||
MessagePad.TrafficLightData req = builder.build();
|
||||
return sendWsMessage(MessageType.TYPE_SEND_TRAFFIC_LIGHT_DATA.typeCode, req.toByteArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,14 +2,14 @@ package com.zhidao.support.adas.high;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.zhidao.support.adas.high.bean.AdasConfig;
|
||||
import com.zhidao.support.adas.high.bean.BaseInfo;
|
||||
import com.zhidao.support.adas.high.bean.BasicInfo;
|
||||
import com.zhidao.support.adas.high.common.AppPreferenceHelper;
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @ProjectName: lib-adas-fpga
|
||||
* @Package: com.zhidao.lib.adas.high
|
||||
@@ -24,7 +24,11 @@ import java.util.HashSet;
|
||||
*/
|
||||
public class AdasManager implements IAdasNetCommApi {
|
||||
private static volatile AdasManager ourInstance;
|
||||
|
||||
/**
|
||||
* 当前协议使用的版本
|
||||
*/
|
||||
private static final int PROTOCOL_VERSION = MessagePad.ProtocolVersion.CurrentVersion.getNumber();
|
||||
public static final String AP_VERSION = BuildConfig.AP_VERSION;
|
||||
|
||||
public static AdasManager getInstance() {
|
||||
if (ourInstance == null) {
|
||||
@@ -56,20 +60,33 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 adas 连接状态
|
||||
* 创建一个连接
|
||||
*
|
||||
* @param onAdasConnectStatusListener
|
||||
* @param options 连接参数
|
||||
* @param onAdasConnectStatusListener 连接状态监听
|
||||
*/
|
||||
public void setOnAdasConnectStatusListener(OnAdasConnectStatusListener onAdasConnectStatusListener) {
|
||||
if (mChannel != null) {
|
||||
mChannel.setOnAdasMsgConnectStatusListener(onAdasConnectStatusListener);
|
||||
public synchronized void create(AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener) {
|
||||
if (mChannel == null) {
|
||||
mChannel = new AdasChannel(options, onAdasConnectStatusListener);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void create(Context context, AdasOptions options) {
|
||||
if (mChannel == null) {
|
||||
mChannel = new AdasChannel(context, options);
|
||||
}
|
||||
/**
|
||||
* MoGo-AP 版本
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getAPVersion() {
|
||||
return AP_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取协议版本
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getProtocolVersion() {
|
||||
return PROTOCOL_VERSION;
|
||||
}
|
||||
|
||||
|
||||
@@ -84,22 +101,9 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送基础信息
|
||||
*
|
||||
* @param basicInfo
|
||||
*/
|
||||
public void setBasicInfo(BasicInfo basicInfo) {
|
||||
if (mChannel != null) {
|
||||
mChannel.sendWsBasicInfo(basicInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public synchronized void destory() {
|
||||
if (mChannel != null) {
|
||||
mChannel.onDisconnectRtp();
|
||||
mChannel.disconnect();
|
||||
mChannel = null;
|
||||
}
|
||||
@@ -120,21 +124,6 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean controlAutopilotCarAuto() {
|
||||
if (mChannel != null) {
|
||||
return mChannel.controlAutopilotCarAuto();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean controlAutopilotCarHead() {
|
||||
if (mChannel != null) {
|
||||
return mChannel.controlAutopilotCarHead();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIpcConnectionStatus() {
|
||||
@@ -144,74 +133,7 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
return Constants.IPC_CONNECTION_STATUS.DISCONNECTED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdasConfig getAdasConfig() {
|
||||
if (mChannel != null) {
|
||||
return mChannel.getAdasConfig();
|
||||
}
|
||||
return new AdasConfig();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean aiCloudToAdasData(String msg) {
|
||||
if (mChannel != null) {
|
||||
return mChannel.aiCloudToAdasData(msg);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean queryAutopilotRoute() {
|
||||
if (mChannel != null) {
|
||||
return mChannel.queryAutopilotRoute();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean queryAutopilotGuardian() {
|
||||
if (mChannel != null) {
|
||||
return mChannel.queryAutopilotGuardian();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recordPackage(int type, int id) {
|
||||
if (mChannel != null) {
|
||||
return mChannel.recordPackage(type, id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recordPackage(int type, int id, int duration) {
|
||||
if (mChannel != null) {
|
||||
return mChannel.recordPackage(type, id, duration);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stopRecord(int type, int id) {
|
||||
if (mChannel != null) {
|
||||
return mChannel.stopRecord(type, id);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recordCause(String key, String name, String id, String reason) {
|
||||
return mChannel.recordCause(key, name, id, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setSpeed(int speed) {
|
||||
if (mChannel != null) {
|
||||
return mChannel.setSpeed(speed);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// TODO 需求暂停 待讨论 获取车辆轨迹文件
|
||||
// @Override
|
||||
// public boolean getRoutes() {
|
||||
@@ -236,18 +158,6 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向工控机发送数据
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Override
|
||||
public void sendBaseInfo(BaseInfo info) {
|
||||
if (mChannel != null) {
|
||||
mChannel.sendBaseInfo(info);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutdownIPC() {
|
||||
if (mChannel != null) {
|
||||
@@ -278,33 +188,78 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
|
||||
@Override
|
||||
public AdasOptions getAdasOptions() {
|
||||
if (mChannel != null) {
|
||||
return mChannel.getAdasOptions();
|
||||
}
|
||||
return null;
|
||||
return mChannel == null ? null : mChannel.getAdasOptions();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void enableDemoMode() {
|
||||
if (mChannel != null) {
|
||||
mChannel.enableDemoMode();
|
||||
}
|
||||
public String getIpcConnectedIp() {
|
||||
return mChannel == null ? null : mChannel.getIpcConnectedIp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disableDemoMode() {
|
||||
if (mChannel != null) {
|
||||
mChannel.disableDemoMode();
|
||||
}
|
||||
public int getIpcConnectedPort() {
|
||||
return mChannel == null ? Constants.DEFAULT_PORT : mChannel.getIpcConnectedPort();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIPCConnectedIP() {
|
||||
if (mChannel != null) {
|
||||
return mChannel.getIPCConnectedIP();
|
||||
}
|
||||
return null;
|
||||
public boolean sendBasicInfoResp(String sn, int environment) {
|
||||
return mChannel != null && mChannel.sendBasicInfoResp(sn, environment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo) {
|
||||
return mChannel != null && mChannel.sendAutoPilotModeReq(mode, source, routeInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendDemoModeReq(int enable) {
|
||||
return mChannel != null && mChannel.sendDemoModeReq(enable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendCarConfigReq() {
|
||||
return mChannel != null && mChannel.sendCarConfigReq();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendRecordCause(String key, String filename, String reasonID, String reason) {
|
||||
return mChannel != null && mChannel.sendRecordCause(key, filename, reasonID, reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startRecordPackage(int id, int type) {
|
||||
return mChannel != null && mChannel.startRecordPackage(id, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startRecordPackage(int id, int duration, int type) {
|
||||
return mChannel != null && mChannel.startRecordPackage(id, duration, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stopRecordPackage(int id, int type) {
|
||||
return mChannel != null && mChannel.stopRecordPackage(id, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendRecordData(int id, int duration, int type, boolean isRecord) {
|
||||
return mChannel != null && mChannel.sendRecordData(id, duration, type, isRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendAutopilotSpeedReq(double speedLimit) {
|
||||
return mChannel != null && mChannel.sendAutopilotSpeedReq(speedLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendTrafficLightData(String crossID, double latitude, double longitude, String heading, 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean sendGlobalPathReq() {
|
||||
return mChannel != null && mChannel.sendGlobalPathReq();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -321,8 +276,8 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
*
|
||||
* @param ipcIP
|
||||
*/
|
||||
public void addIPCFixationIP(Context context, String ipcIP) {
|
||||
AppPreferenceHelper.getInstance(context).addIPCFixationIP(ipcIP);
|
||||
public boolean addIPCFixationIP(Context context, String ipcIP) {
|
||||
return AppPreferenceHelper.getInstance(context).addIPCFixationIP(ipcIP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,8 +285,8 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
*
|
||||
* @param ipcIP
|
||||
*/
|
||||
public void delIPCFixationIP(Context context, String ipcIP) {
|
||||
AppPreferenceHelper.getInstance(context).delIPCFixationIP(ipcIP);
|
||||
public boolean delIPCFixationIP(Context context, String ipcIP) {
|
||||
return AppPreferenceHelper.getInstance(context).delIPCFixationIP(ipcIP);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,5 +296,15 @@ public class AdasManager implements IAdasNetCommApi {
|
||||
AppPreferenceHelper.getInstance(context).delIPCFixationIP();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 向工控机发送数据
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Override
|
||||
public void sendBaseInfo(BaseInfo info) {
|
||||
if (mChannel != null) {
|
||||
mChannel.sendBaseInfo(info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,6 @@ public class AdasOptions {
|
||||
* 指定IP
|
||||
*/
|
||||
int ASSIGN = 1;
|
||||
/**
|
||||
* UDP方式
|
||||
*/
|
||||
int UDP = 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.zhidao.support.adas.high;
|
||||
|
||||
import com.zhidao.support.adas.high.bean.AdasConfig;
|
||||
import com.zhidao.support.adas.high.bean.BaseInfo;
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
@@ -19,94 +21,157 @@ public interface IAdasNetCommApi {
|
||||
*/
|
||||
void disconnect();
|
||||
|
||||
/**
|
||||
* 控制自动驾驶车辆 自动模式 自动驾驶
|
||||
*/
|
||||
boolean controlAutopilotCarAuto();
|
||||
|
||||
/**
|
||||
* 控制自动驾驶车辆 手动模式
|
||||
*/
|
||||
boolean controlAutopilotCarHead();
|
||||
|
||||
/**
|
||||
* 获取当前工控机的链接状态
|
||||
*
|
||||
* @return
|
||||
* @return {@link Constants.IPC_CONNECTION_STATUS}
|
||||
*/
|
||||
int getIpcConnectionStatus();
|
||||
|
||||
/**
|
||||
* 基础信息
|
||||
*/
|
||||
AdasConfig getAdasConfig();
|
||||
|
||||
/**
|
||||
* ai云
|
||||
* 获取工控机链接配置
|
||||
*
|
||||
* @param msg
|
||||
* @return 工控机链接参数
|
||||
*/
|
||||
boolean aiCloudToAdasData(String msg);
|
||||
AdasOptions getAdasOptions();
|
||||
|
||||
|
||||
/**
|
||||
* 查询自动驾驶路径
|
||||
*/
|
||||
boolean queryAutopilotRoute();
|
||||
|
||||
/**
|
||||
* 查询节点监控信息
|
||||
*/
|
||||
boolean queryAutopilotGuardian();
|
||||
|
||||
/**
|
||||
* 数据采集
|
||||
*/
|
||||
boolean recordPackage(int type, int id);
|
||||
|
||||
boolean recordPackage(int type, int id, int duration);
|
||||
|
||||
boolean stopRecord(int type, int id);
|
||||
|
||||
/**
|
||||
* 采集类型
|
||||
* 获取已经链接成功的工控机IP 未连接为null
|
||||
*
|
||||
* @param key 工控机返回的
|
||||
* @param name 文件名称 也是工控机返回
|
||||
* @param id 接管原因id
|
||||
* @param reason 接管原因
|
||||
* @return ip null:表示未连接
|
||||
*/
|
||||
String getIpcConnectedIp();
|
||||
|
||||
/**
|
||||
* 获取已经链接成功的工控机端口 未连接为默认端口
|
||||
*
|
||||
* @return ip null:表示未连接
|
||||
*/
|
||||
int getIpcConnectedPort();
|
||||
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @return
|
||||
*/
|
||||
boolean recordCause(String key, String name, String id, String reason);
|
||||
boolean sendBasicInfoResp(String sn, int environment);
|
||||
|
||||
/**
|
||||
* 设置车速
|
||||
* speed km/h
|
||||
*/
|
||||
boolean setSpeed(int speed);
|
||||
|
||||
/**
|
||||
* 查询轨迹文件
|
||||
* 设置自动驾驶模式 启动自动驾驶
|
||||
*
|
||||
* @param mode 1: enter autopilot mode, 0: quit autopilot mode
|
||||
* @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务
|
||||
* @param routeInfo 自动驾驶路径信息
|
||||
* @return
|
||||
*/
|
||||
// TODO 需求暂停 待讨论
|
||||
boolean sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo);
|
||||
|
||||
/**
|
||||
* 设置演示模式
|
||||
*
|
||||
* @param enable 1: enable, 0: disable
|
||||
* @return
|
||||
*/
|
||||
boolean sendDemoModeReq(int enable);
|
||||
|
||||
/**
|
||||
* 车机基础信息请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean sendCarConfigReq();
|
||||
|
||||
/**
|
||||
* 记录人工接管原因
|
||||
*
|
||||
* @param key bag key 唯一标识
|
||||
* @param filename 文件路径
|
||||
* @param reasonID 接管原因id
|
||||
* @param reason 接管原因
|
||||
* @return
|
||||
*/
|
||||
boolean sendRecordCause(String key, String filename, String reasonID, String reason);
|
||||
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
boolean startRecordPackage(int id, int type);
|
||||
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
boolean startRecordPackage(int id, int duration, int type);
|
||||
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
boolean stopRecordPackage(int id, int type);
|
||||
|
||||
/**
|
||||
* 数据采集请求 主动录制Bag包
|
||||
*
|
||||
* @param id 采集id
|
||||
* @param duration 采集时间长
|
||||
* @param type 采集类型, 1:badcase, 2: map; 3: rests
|
||||
* @param isRecord 采集指令, true: 采集, false: 停止采集
|
||||
* @param sustain 是否持续采集
|
||||
* @return
|
||||
*/
|
||||
boolean sendRecordData(int id, int duration, int type, boolean isRecord);
|
||||
|
||||
/**
|
||||
* 设置自动驾驶最大速度
|
||||
*
|
||||
* @param speedLimit 最大车辆速度 m/s
|
||||
* @return
|
||||
*/
|
||||
boolean sendAutopilotSpeedReq(double speedLimit);
|
||||
|
||||
/**
|
||||
* 发送红绿灯数据到工控机
|
||||
*
|
||||
* @param crossID roadID
|
||||
* @param latitude
|
||||
* @param longitude
|
||||
* @param heading 红绿灯方向
|
||||
* @param direction 路的航向角
|
||||
* @param lightId 红绿灯ID
|
||||
* @param laneNo 车道号
|
||||
* @param arrowNo 当前车道对应地面要素转向
|
||||
* @param flashYellow 黄灯总时间
|
||||
* @param laneDetail 灯态具体信息
|
||||
* @return
|
||||
*/
|
||||
boolean sendTrafficLightData(String crossID, double latitude, double longitude,
|
||||
String heading, String direction, int lightId, int laneNo,
|
||||
int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail);
|
||||
|
||||
/**
|
||||
* 自动驾驶路径请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean sendGlobalPathReq();
|
||||
|
||||
// TODO 需求暂停 待讨论
|
||||
// boolean getRoutes();
|
||||
|
||||
/**
|
||||
* log是否显示
|
||||
*/
|
||||
void setEnableLog(boolean isEnableLog);
|
||||
|
||||
/**
|
||||
* log是否写入
|
||||
*/
|
||||
void setIsWriteLog(boolean isWriteLog);
|
||||
|
||||
|
||||
/**
|
||||
* 向工控机发送数据
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Deprecated
|
||||
void sendBaseInfo(BaseInfo info);
|
||||
|
||||
/**
|
||||
@@ -132,26 +197,13 @@ public interface IAdasNetCommApi {
|
||||
void parseIPCData(byte[] bytes);
|
||||
|
||||
/**
|
||||
* 获取工控机链接配置
|
||||
*
|
||||
* @return
|
||||
* log是否显示
|
||||
*/
|
||||
AdasOptions getAdasOptions();
|
||||
void setEnableLog(boolean isEnableLog);
|
||||
|
||||
/**
|
||||
* 打开演示模式
|
||||
* log是否写入
|
||||
*/
|
||||
void enableDemoMode();
|
||||
void setIsWriteLog(boolean isWriteLog);
|
||||
|
||||
/**
|
||||
* 关闭演示模式
|
||||
*/
|
||||
void disableDemoMode();
|
||||
|
||||
/**
|
||||
* 获取已经链接成功的工控机IP 未连接未null
|
||||
*
|
||||
* @return ip null:表示未连接
|
||||
*/
|
||||
String getIPCConnectedIP();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zhidao.support.adas.high;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.Define;
|
||||
|
||||
/**
|
||||
@@ -10,16 +9,12 @@ import com.zhidao.support.adas.high.common.Define;
|
||||
* @date 2020/3/20
|
||||
*/
|
||||
public interface OnAdasConnectStatusListener {
|
||||
/**
|
||||
* 指定IP或固定IP(轮询ping集合中的IP) 找不到可用的IP时会被调用
|
||||
* 规则: TextUtils.isEmpty()
|
||||
*/
|
||||
// void onAddressDisabled();
|
||||
|
||||
/**
|
||||
* 与工控机链接状态变化
|
||||
*
|
||||
* @param ipcConnectionStatus
|
||||
* @param ipcConnectionStatus {@link Constants.IPC_CONNECTION_STATUS}
|
||||
* @param failedMsg 连接异常信息
|
||||
*/
|
||||
void onConnectionIPCStatus(@Define.IPCConnectionStatus int ipcConnectionStatus, String failedMsg);
|
||||
|
||||
|
||||
@@ -1,21 +1,12 @@
|
||||
package com.zhidao.support.adas.high;
|
||||
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.SSHResult;
|
||||
import com.zhidao.support.adas.high.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
|
||||
import com.zhidao.support.adas.high.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
|
||||
import com.zhidao.support.adas.high.bean.record.AutopilotRecordResult;
|
||||
import com.zhidao.support.adas.high.bean.SSHResult;
|
||||
|
||||
import java.util.List;
|
||||
import chassis.VehicleStateOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
/**
|
||||
* @ProjectName: lib-adas-fpga
|
||||
@@ -30,106 +21,113 @@ import java.util.List;
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public interface OnAdasListener {
|
||||
/**
|
||||
* 报警信息
|
||||
*
|
||||
* @param warnMessageInfo
|
||||
*/
|
||||
void onWarnMessage(WarnMessageInfo warnMessageInfo);
|
||||
|
||||
/**
|
||||
* 视频宽高
|
||||
* 自动驾驶局部轨迹 前车引导线
|
||||
*
|
||||
* @param width
|
||||
* @param height
|
||||
* @param header 头
|
||||
* @param trajectory 数据
|
||||
*/
|
||||
void onVideoSize(int width, int height);
|
||||
void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory);
|
||||
|
||||
/**
|
||||
* 车框
|
||||
* 障碍物 他车数据
|
||||
*
|
||||
* @param rectInfo
|
||||
* @param header 头
|
||||
* @param trackedObjects 数据
|
||||
*/
|
||||
void onRectData(RectInfo rectInfo);
|
||||
void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects);
|
||||
|
||||
/**
|
||||
* 车辆状态数据
|
||||
* 惯导信息
|
||||
*
|
||||
* @param carStateInfo
|
||||
* @param header 头
|
||||
* @param gnssInfo 数据
|
||||
*/
|
||||
void onCarStateData(CarStateInfo carStateInfo);
|
||||
void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo);
|
||||
|
||||
/**
|
||||
* 红绿灯状态
|
||||
* 底盘信息, 透传底盘状态,pb参考底盘
|
||||
*
|
||||
* @param lightStatueInfo
|
||||
* @param header 头
|
||||
* @param vehicleState 数据
|
||||
*/
|
||||
void onLightStateData(LightStatueInfo lightStatueInfo);
|
||||
|
||||
/**
|
||||
* 周边渲染
|
||||
*
|
||||
* @param obstaclesInfo
|
||||
*/
|
||||
void onObstaclesInfo(ObstaclesInfo obstaclesInfo);
|
||||
|
||||
/**
|
||||
* 车道线渲染
|
||||
*
|
||||
* @param carLaneInfo
|
||||
*/
|
||||
void onCarLaneInfo(CarLaneInfo carLaneInfo);
|
||||
void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState);
|
||||
|
||||
/**
|
||||
* 自动驾驶状态
|
||||
*
|
||||
* @param autopilotStatus
|
||||
* @param header 头
|
||||
* @param autopilotState 数据
|
||||
*/
|
||||
void autopilotStatus(AutopilotStatus autopilotStatus);
|
||||
void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState);
|
||||
|
||||
/**
|
||||
* 自动驾驶到站
|
||||
* 监控事件报告
|
||||
*
|
||||
* @param autopilotWayArrive
|
||||
* @param header 头
|
||||
* @param mogoReportMessage 数据
|
||||
*/
|
||||
void autopilotArrive(AutopilotWayArrive autopilotWayArrive);
|
||||
/**
|
||||
* 接收到FPGA端发来的数据
|
||||
*
|
||||
* @param msg json格式
|
||||
*/
|
||||
//void onMessage(String msg);
|
||||
void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage);
|
||||
|
||||
/**
|
||||
* 自动驾驶路径
|
||||
* 自动驾驶设备基础信息请求
|
||||
*
|
||||
* @param route
|
||||
* @param header 头
|
||||
* @param basicInfoReq 数据 目前没有任何参数
|
||||
*/
|
||||
void onAutopilotRoute(AutopilotRoute route);
|
||||
void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq);
|
||||
|
||||
/**
|
||||
* 自动驾驶局部轨迹
|
||||
* 车机基础信息应答
|
||||
*
|
||||
* @param trajectoryList
|
||||
* @param header 头
|
||||
* @param carConfigResp 数据
|
||||
*/
|
||||
void onAutopilotTrajectory(List<TrajectoryInfo> trajectoryList);
|
||||
|
||||
/**
|
||||
* 工控机获取SN
|
||||
*
|
||||
* @param
|
||||
*/
|
||||
void onAutopilotSNRequest();
|
||||
|
||||
/**
|
||||
* 工控机监控节点
|
||||
*/
|
||||
void onAutopilotGuardian(AutopilotGuardianInfo guardianInfo);
|
||||
void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp);
|
||||
|
||||
/**
|
||||
* 数据采集结果
|
||||
*
|
||||
* @param header 头
|
||||
* @param recordPanel 数据
|
||||
*/
|
||||
void onAutopilotRecord(AutopilotRecordResult result);
|
||||
void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel);
|
||||
|
||||
/**
|
||||
* 自动驾驶路径应答
|
||||
*
|
||||
* @param header 头
|
||||
* @param globalPathResp 数据
|
||||
*/
|
||||
void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp);
|
||||
|
||||
|
||||
/**
|
||||
* 报警信息
|
||||
* 暂时保留,目前没有使用
|
||||
*
|
||||
* @param header 头
|
||||
* @param warn 数据
|
||||
*/
|
||||
@Deprecated
|
||||
void onWarn(MessagePad.Header header, MessagePad.Warn warn);
|
||||
|
||||
/**
|
||||
* 到站提醒 自动驾驶站点
|
||||
*
|
||||
* @param header 头
|
||||
* @param arrivalNotification 数据
|
||||
*/
|
||||
void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification);
|
||||
|
||||
/**
|
||||
* 升级状态
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
@Deprecated
|
||||
void onUpgradeStateInfo(IPCUpgradeStateInfo info);
|
||||
|
||||
/**
|
||||
* 向IPC发送命令返回结果
|
||||
@@ -138,12 +136,5 @@ public interface OnAdasListener {
|
||||
*/
|
||||
void onSSHResult(SSHResult info);
|
||||
|
||||
/**
|
||||
* 升级状态
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
void onUpgradeStateInfo(IPCUpgradeStateInfo info);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import com.zhidao.support.adas.high.BuildConfig;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/13
|
||||
*/
|
||||
public class AdasConfig {
|
||||
private static final String VERSION = BuildConfig.VERSION_NAME;
|
||||
private static final String AP_VERSION = BuildConfig.AP_VERSION;
|
||||
private String address;
|
||||
private String dockVersion;
|
||||
|
||||
/**
|
||||
* MoGo-AP 版本
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getAPVersion() {
|
||||
return AP_VERSION;
|
||||
}
|
||||
|
||||
/**
|
||||
* SDK版本
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getVersion() {
|
||||
return VERSION;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getDockVersion() {
|
||||
return dockVersion;
|
||||
}
|
||||
|
||||
public void setDockVersion(String dockVersion) {
|
||||
this.dockVersion = dockVersion;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des
|
||||
* @date 2020/7/14
|
||||
*/
|
||||
|
||||
public class AutopilotConfig implements Serializable {
|
||||
|
||||
private String action;
|
||||
private ResultBean result;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotWayArrive{" +
|
||||
"action='" + action + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
private String dock_version;
|
||||
|
||||
public String getDock_version() {
|
||||
return dock_version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResultBean{" +
|
||||
"dock_version='" + dock_version + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des mode 0是手动 1是自动
|
||||
* @date 2020/7/14
|
||||
*/
|
||||
|
||||
public class AutopilotControl implements Serializable {
|
||||
|
||||
/**
|
||||
* action : autopilotmode
|
||||
* values : {"mode":0}
|
||||
*/
|
||||
|
||||
private String action;
|
||||
private ValuesBean values;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public ValuesBean getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(ValuesBean values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public static class ValuesBean {
|
||||
/**
|
||||
* mode : 0
|
||||
*/
|
||||
|
||||
private int mode;
|
||||
|
||||
public int getMode() {
|
||||
return mode;
|
||||
}
|
||||
|
||||
public void setMode(int mode) {
|
||||
this.mode = mode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/6/21
|
||||
*/
|
||||
|
||||
public class AutopilotRoute {
|
||||
|
||||
@SerializedName("action")
|
||||
private String action;
|
||||
@SerializedName("models")
|
||||
private List<RouteModels> models;
|
||||
|
||||
public static class RouteModels {
|
||||
@SerializedName("lat")
|
||||
private Double lat;
|
||||
@SerializedName("lon")
|
||||
private Double lon;
|
||||
|
||||
public Double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(Double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public Double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(Double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RouteModels{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public List<RouteModels> getModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
public void setModels(List<RouteModels> models) {
|
||||
this.models = models;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotRoute{" +
|
||||
"action='" + action + '\'' +
|
||||
", models=" + models +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/7/2
|
||||
*/
|
||||
public class AutopilotSnRequest {
|
||||
private String action;
|
||||
private String models;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
public void setModels(String models) {
|
||||
this.models = models;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/6
|
||||
*/
|
||||
public class AutopilotSpeedParam {
|
||||
private final String action = "autospeed";
|
||||
private SpeedParam result;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setSpeed(int speed){
|
||||
if (result==null){
|
||||
result = new SpeedParam();
|
||||
}
|
||||
result.setSpeed(speed);
|
||||
}
|
||||
|
||||
public static class SpeedParam {
|
||||
//车辆速度 m/s
|
||||
private double speed;
|
||||
|
||||
public double getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(int speed) {
|
||||
// speed km/h
|
||||
// this.speed m/s
|
||||
this.speed = speed/3.6;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des
|
||||
* @date 2020/7/14
|
||||
*/
|
||||
public class AutopilotStatus implements Serializable {
|
||||
|
||||
/**
|
||||
* action : autopilotstate
|
||||
* values : {"state":0,"reason":""}
|
||||
*/
|
||||
|
||||
private String action;
|
||||
private ValuesBean values;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public ValuesBean getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(ValuesBean values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public static class ValuesBean {
|
||||
/**
|
||||
* 0是不可用 1是ready 2是自动驾驶start
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private int state;
|
||||
/**
|
||||
* 车速 m/s
|
||||
*/
|
||||
private float speed;
|
||||
/**
|
||||
* 不可用原因
|
||||
*/
|
||||
private String reason;
|
||||
/**
|
||||
* 摄像头状态 1代表开启,0代表关闭
|
||||
*/
|
||||
private int camera;
|
||||
/**
|
||||
* 雷达状态 1代表开启,0代表关闭
|
||||
*/
|
||||
private int radar;
|
||||
/**
|
||||
* RTK状态 1代表开启,0代表关闭
|
||||
*/
|
||||
private int rtk;
|
||||
/**
|
||||
* 自动驾驶状态 0非自动驾驶,1自动驾驶
|
||||
*/
|
||||
private int pilotmode;
|
||||
|
||||
/**
|
||||
* 自动驾驶车控状态
|
||||
*/
|
||||
private int control_pilotmode;
|
||||
|
||||
|
||||
public int getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(int state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
public int getCamera() {
|
||||
return camera;
|
||||
}
|
||||
|
||||
public int getRadar() {
|
||||
return radar;
|
||||
}
|
||||
|
||||
public int getRtk() {
|
||||
return rtk;
|
||||
}
|
||||
|
||||
public int getPilotmode() {
|
||||
return pilotmode;
|
||||
}
|
||||
|
||||
public int getControl_pilotmode() {
|
||||
return control_pilotmode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ValuesBean{" +
|
||||
"state=" + state +
|
||||
", speed=" + speed +
|
||||
", reason='" + reason + '\'' +
|
||||
", camera=" + camera +
|
||||
", radar=" + radar +
|
||||
", rtk=" + rtk +
|
||||
", pilotmode=" + pilotmode +
|
||||
", control_pilotmode=" + control_pilotmode +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotStatus{" +
|
||||
"action='" + action + '\'' +
|
||||
", values=" + values +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/19
|
||||
*/
|
||||
public class AutopilotTrajectory {
|
||||
|
||||
@SerializedName("action")
|
||||
private String action;
|
||||
@SerializedName("models")
|
||||
private List<TrajectoryInfo> models;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public List<TrajectoryInfo> getModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotTrajectory{" +
|
||||
"action='" + action + '\'' +
|
||||
", models=" + models +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des
|
||||
* @date 2020/7/14
|
||||
*/
|
||||
|
||||
public class AutopilotWayArrive implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* action : autopilotArrive
|
||||
* result : {"carType":0,"endLatLon":{"lat":116.7559675438664,"lon":116.7559675438664}}
|
||||
*/
|
||||
|
||||
private String action;
|
||||
private ResultBean result;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public ResultBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ResultBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotWayArrive{" +
|
||||
"action='" + action + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class ResultBean {
|
||||
/**
|
||||
* carType : 0
|
||||
* endLatLon : {"lat":116.7559675438664,"lon":116.7559675438664}
|
||||
*/
|
||||
|
||||
private int carType;
|
||||
private EndLatLonBean endLatLon;
|
||||
|
||||
|
||||
public int getCarType() {
|
||||
return carType;
|
||||
}
|
||||
|
||||
public void setCarType(int carType) {
|
||||
this.carType = carType;
|
||||
}
|
||||
|
||||
public EndLatLonBean getEndLatLon() {
|
||||
return endLatLon;
|
||||
}
|
||||
|
||||
public void setEndLatLon(EndLatLonBean endLatLon) {
|
||||
this.endLatLon = endLatLon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ResultBean{" +
|
||||
"carType=" + carType +
|
||||
", endLatLon=" + endLatLon +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class EndLatLonBean {
|
||||
/**
|
||||
* lat : 116.7559675438664
|
||||
* lon : 116.7559675438664
|
||||
*/
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EndLatLonBean{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
@Deprecated
|
||||
public abstract class BaseInfo<T> {
|
||||
protected String action;
|
||||
protected T values;
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
/**
|
||||
* 7.5. 自动驾驶设备基础信息
|
||||
*/
|
||||
public class BasicInfo {
|
||||
private String action = "basicinfo";
|
||||
private Values values;
|
||||
|
||||
public void setSn(String sn) {
|
||||
if (values == null) {
|
||||
values = new Values();
|
||||
}
|
||||
values.setSn(sn);
|
||||
}
|
||||
|
||||
public void setTileid(String tileid) {
|
||||
if (values == null) {
|
||||
values = new Values();
|
||||
}
|
||||
values.setTileid(tileid);
|
||||
}
|
||||
|
||||
public void setNetEnvironment(int environment) {
|
||||
if (values == null) {
|
||||
values = new Values();
|
||||
}
|
||||
values.setNetEnvironment(environment);
|
||||
}
|
||||
|
||||
private static class Values {
|
||||
private String sn;
|
||||
private String tileid;
|
||||
//研发环境 1;测试环境 2;生产环境 3;演示环境 4;
|
||||
private int netEnvironment;
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getTileid() {
|
||||
return tileid;
|
||||
}
|
||||
|
||||
public void setTileid(String tileid) {
|
||||
this.tileid = tileid;
|
||||
}
|
||||
|
||||
public int getNetEnvironment() {
|
||||
return netEnvironment;
|
||||
}
|
||||
|
||||
public void setNetEnvironment(int environment) {
|
||||
this.netEnvironment = environment;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des 车道线
|
||||
* @date 2020/4/24
|
||||
*/
|
||||
public class CarLaneInfo {
|
||||
|
||||
private String action;
|
||||
|
||||
private List<CarLaneDetailInfo> models;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public List<CarLaneDetailInfo> getModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
public void setModels(List<CarLaneDetailInfo> models) {
|
||||
this.models = models;
|
||||
}
|
||||
|
||||
public static class CarLaneDetailInfo {
|
||||
private String id; //50~55, 50左黄,51左红,(52左白),53右黄,54右红,(55右白)
|
||||
private String type;
|
||||
private int color; //0白色,1黄色
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,279 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des 车辆状态
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class CarStateInfo implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
* action : “state”
|
||||
* values : {"lon":116.8,"lat":39.4,"alt":22.3,"heading":87.5,"acceleration":0.5,"yaw_rate":0.3}
|
||||
*/
|
||||
|
||||
private String action;
|
||||
private ValuesBean values;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public ValuesBean getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(ValuesBean values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
public static class ValuesBean {
|
||||
/**
|
||||
* lon : 116.8
|
||||
* lat : 39.4
|
||||
* alt : 22.3
|
||||
* heading : 87.5
|
||||
* acceleration : 0.5
|
||||
* yaw_rate : 0.3
|
||||
*/
|
||||
|
||||
private double lon;
|
||||
private double lat;
|
||||
private double alt;
|
||||
private double heading;
|
||||
private double acceleration;
|
||||
private double yaw_rate;
|
||||
//惯导车速 m/s
|
||||
private float gnss_speed;
|
||||
//车辆车速 m/s
|
||||
private float vehicle_speed;
|
||||
//gps时间
|
||||
private String satelliteTime;
|
||||
//UTC时间差
|
||||
private long utcTimeDiffer;
|
||||
//系统时间
|
||||
private String systemTime;
|
||||
//接收到数据的时间
|
||||
private long receiverDataTime;
|
||||
//接收到gps时间
|
||||
private String adasSatelliteTime;
|
||||
//开始接收数据时间
|
||||
private String startReceiverDataTime;
|
||||
//时间延迟
|
||||
private long timeDiff = 0;
|
||||
private int turn_light; //转向灯状态 0是正常 1是左转 2是右转
|
||||
private int flash_light; //双闪灯状态
|
||||
private int brake_light; //刹车灯状态
|
||||
private int frame_num;//统计发包个数
|
||||
/**
|
||||
* 常开 常关 转向灯
|
||||
* 0 --关
|
||||
* 1 --左转
|
||||
* 2 --右转
|
||||
*/
|
||||
private int turnLightOften = 0;
|
||||
|
||||
|
||||
public int getFrame_num() {
|
||||
return frame_num;
|
||||
}
|
||||
|
||||
public void setFrame_num(int frame_num) {
|
||||
this.frame_num = frame_num;
|
||||
}
|
||||
|
||||
public int getTurnLightOften() {
|
||||
return turnLightOften;
|
||||
}
|
||||
|
||||
public void setTurnLightOften(int turnLightOften) {
|
||||
this.turnLightOften = turnLightOften;
|
||||
}
|
||||
|
||||
public long getTimeDiff() {
|
||||
return timeDiff;
|
||||
}
|
||||
|
||||
public void setTimeDiff(long timeDiff) {
|
||||
this.timeDiff = timeDiff;
|
||||
}
|
||||
|
||||
public long getReceiverDataTime() {
|
||||
return receiverDataTime;
|
||||
}
|
||||
|
||||
public void setReceiverDataTime(long receiverDataTime) {
|
||||
this.receiverDataTime = receiverDataTime;
|
||||
}
|
||||
|
||||
public String getAdasSatelliteTime() {
|
||||
return adasSatelliteTime;
|
||||
}
|
||||
|
||||
public void setAdasSatelliteTime(String adasSatelliteTime) {
|
||||
this.adasSatelliteTime = adasSatelliteTime;
|
||||
}
|
||||
|
||||
public String getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(String systemTime) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public float getGnss_speed() {
|
||||
return gnss_speed;
|
||||
}
|
||||
|
||||
public void setGnss_speed(float gnss_speed) {
|
||||
this.gnss_speed = gnss_speed;
|
||||
}
|
||||
|
||||
public float getVehicle_speed() {
|
||||
return vehicle_speed;
|
||||
}
|
||||
|
||||
public void setVehicle_speed(float vehicle_speed) {
|
||||
this.vehicle_speed = vehicle_speed;
|
||||
}
|
||||
|
||||
public int getTurn_light() {
|
||||
return turn_light;
|
||||
}
|
||||
|
||||
public void setTurn_light(int turn_light) {
|
||||
this.turn_light = turn_light;
|
||||
}
|
||||
|
||||
public int getFlash_light() {
|
||||
return flash_light;
|
||||
}
|
||||
|
||||
public void setFlash_light(int flash_light) {
|
||||
this.flash_light = flash_light;
|
||||
}
|
||||
|
||||
public int getBrake_light() {
|
||||
return brake_light;
|
||||
}
|
||||
|
||||
public void setBrake_light(int brake_light) {
|
||||
this.brake_light = brake_light;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getAlt() {
|
||||
return alt;
|
||||
}
|
||||
|
||||
public void setAlt(double alt) {
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public double getAcceleration() {
|
||||
return acceleration;
|
||||
}
|
||||
|
||||
public void setAcceleration(double acceleration) {
|
||||
this.acceleration = acceleration;
|
||||
}
|
||||
|
||||
public double getYaw_rate() {
|
||||
return yaw_rate;
|
||||
}
|
||||
|
||||
public void setYaw_rate(double yaw_rate) {
|
||||
this.yaw_rate = yaw_rate;
|
||||
}
|
||||
|
||||
public String getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public void setSatelliteTime(String satelliteTime) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
public long getUtcTimeDiffer() {
|
||||
return utcTimeDiffer;
|
||||
}
|
||||
|
||||
public void setUtcTimeDiffer(long utcTimeDiffer) {
|
||||
this.utcTimeDiffer = utcTimeDiffer;
|
||||
}
|
||||
|
||||
public String getStartReceiverDataTime() {
|
||||
return startReceiverDataTime;
|
||||
}
|
||||
|
||||
public void setStartReceiverDataTime(String startReceiverDataTime) {
|
||||
this.startReceiverDataTime = startReceiverDataTime;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ValuesBean{" +
|
||||
"lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", alt=" + alt +
|
||||
", heading=" + heading +
|
||||
", acceleration=" + acceleration +
|
||||
", yaw_rate=" + yaw_rate +
|
||||
", gnss_speed=" + gnss_speed +
|
||||
", vehicle_speed=" + vehicle_speed +
|
||||
", satelliteTime='" + satelliteTime + '\'' +
|
||||
", utcTimeDiffer=" + utcTimeDiffer +
|
||||
", systemTime='" + systemTime + '\'' +
|
||||
", receiverDataTime='" + receiverDataTime + '\'' +
|
||||
", adasSatelliteTime='" + adasSatelliteTime + '\'' +
|
||||
", startReceiverDataTime='" + startReceiverDataTime + '\'' +
|
||||
", timeDiff=" + timeDiff +
|
||||
", turn_light=" + turn_light +
|
||||
", flash_light=" + flash_light +
|
||||
", brake_light=" + brake_light +
|
||||
", frame_num=" + frame_num +
|
||||
", turnLightOften=" + turnLightOften +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CarStateInfo{" +
|
||||
"action='" + action + '\'' +
|
||||
", values=" + values +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
/**
|
||||
* 演示模式
|
||||
*/
|
||||
public class DemoModeInfo extends BaseInfo {
|
||||
public DemoModeInfo(String action) {
|
||||
super(action);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启演示模式
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static DemoModeInfo enable() {
|
||||
return new DemoModeInfo("enable_demo_pilot");
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭演示模式
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static DemoModeInfo disable() {
|
||||
return new DemoModeInfo("disable_demo_pilot");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.zhidao.support.adas.high.bean;
|
||||
/**
|
||||
* 工控机升级
|
||||
*/
|
||||
@Deprecated
|
||||
public class IPCUpgradeInfo extends BaseInfo<IPCUpgradeInfo.Values> {
|
||||
public IPCUpgradeInfo() {
|
||||
super("ipc_upgrade");
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.google.gson.annotations.SerializedName;
|
||||
/**
|
||||
* 工控机升级
|
||||
*/
|
||||
@Deprecated
|
||||
public class IPCUpgradeStateInfo extends BaseInfo<IPCUpgradeStateInfo.Values> {
|
||||
/**
|
||||
* 升级模式
|
||||
|
||||
@@ -1,143 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des 红绿灯状态
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class LightStatueInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* action : light
|
||||
* values : {"left":1,"right ":0,"straight":3,"u_turn":0,"left_time_remains":3,"right_time_remains":3,"straight_time_remains":3,"u_turn_time_remains":3}
|
||||
*/
|
||||
|
||||
private String action;
|
||||
private ValuesBean values;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public ValuesBean getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public void setValues(ValuesBean values) {
|
||||
this.values = values;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LightStatueInfo{" +
|
||||
"action='" + action + '\'' +
|
||||
", values=" + values +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class ValuesBean {
|
||||
/**
|
||||
* left : 1
|
||||
* right : 0
|
||||
* straight : 3
|
||||
* u_turn : 0
|
||||
* left_time_remains : 3
|
||||
* right_time_remains : 3
|
||||
* straight_time_remains : 3
|
||||
* u_turn_time_remains : 3
|
||||
*/
|
||||
|
||||
private int left;
|
||||
private int right;
|
||||
private int straight;
|
||||
private int u_turn;
|
||||
private int left_time_remains;
|
||||
private int right_time_remains;
|
||||
private int straight_time_remains;
|
||||
private int u_turn_time_remains;
|
||||
|
||||
public int getLeft() {
|
||||
return left;
|
||||
}
|
||||
|
||||
public void setLeft(int left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
public int getRight() {
|
||||
return right;
|
||||
}
|
||||
|
||||
public void setRight(int right) {
|
||||
this.right = right;
|
||||
}
|
||||
|
||||
public int getStraight() {
|
||||
return straight;
|
||||
}
|
||||
|
||||
public void setStraight(int straight) {
|
||||
this.straight = straight;
|
||||
}
|
||||
|
||||
public int getU_turn() {
|
||||
return u_turn;
|
||||
}
|
||||
|
||||
public void setU_turn(int u_turn) {
|
||||
this.u_turn = u_turn;
|
||||
}
|
||||
|
||||
public int getLeft_time_remains() {
|
||||
return left_time_remains;
|
||||
}
|
||||
|
||||
public void setLeft_time_remains(int left_time_remains) {
|
||||
this.left_time_remains = left_time_remains;
|
||||
}
|
||||
|
||||
public int getRight_time_remains() {
|
||||
return right_time_remains;
|
||||
}
|
||||
|
||||
public void setRight_time_remains(int right_time_remains) {
|
||||
this.right_time_remains = right_time_remains;
|
||||
}
|
||||
|
||||
public int getStraight_time_remains() {
|
||||
return straight_time_remains;
|
||||
}
|
||||
|
||||
public void setStraight_time_remains(int straight_time_remains) {
|
||||
this.straight_time_remains = straight_time_remains;
|
||||
}
|
||||
|
||||
public int getU_turn_time_remains() {
|
||||
return u_turn_time_remains;
|
||||
}
|
||||
|
||||
public void setU_turn_time_remains(int u_turn_time_remains) {
|
||||
this.u_turn_time_remains = u_turn_time_remains;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ValuesBean{" +
|
||||
"left=" + left +
|
||||
", right=" + right +
|
||||
", straight=" + straight +
|
||||
", u_turn=" + u_turn +
|
||||
", left_time_remains=" + left_time_remains +
|
||||
", right_time_remains=" + right_time_remains +
|
||||
", straight_time_remains=" + straight_time_remains +
|
||||
", u_turn_time_remains=" + u_turn_time_remains +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des 周边物体渲染
|
||||
* @date 2020/4/24
|
||||
*/
|
||||
public class ObstaclesInfo {
|
||||
|
||||
private String action;
|
||||
|
||||
private List<ObstaclesModelInfo> models;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public List<ObstaclesModelInfo> getModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
public void setModels(List<ObstaclesModelInfo> models) {
|
||||
this.models = models;
|
||||
}
|
||||
|
||||
public static class ObstaclesModelInfo {
|
||||
|
||||
private String id; //50~55, 50左黄,51左红,(52左白),53右黄,54右红,(55右白)
|
||||
private String type;
|
||||
private double distance; //距离/米
|
||||
private double direction; //正前为0,左为90,后为180,右为270
|
||||
private double heading; //物体的朝向角,90~270属于逆向车辆
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public double getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(double direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,344 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ProjectName: lib-adas-fpga
|
||||
* @Package: com.zhidao.lib.adas.high.bean
|
||||
* @ClassName: RectInfo
|
||||
* @Description: java类作用描述
|
||||
* @Author: fenghl
|
||||
* @CreateDate: 2020/2/9 20:22
|
||||
* @UpdateUser: 更新者:
|
||||
* @UpdateDate: 2020/2/9 20:22
|
||||
* @UpdateRemark: 更新说明:
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class RectInfo {
|
||||
private String type;
|
||||
private String action;
|
||||
private List<RectBean> models;
|
||||
private float fps;
|
||||
|
||||
public float getFps() {
|
||||
return fps;
|
||||
}
|
||||
|
||||
public void setFps(float fps) {
|
||||
this.fps = fps;
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public List<RectBean> getModels() {
|
||||
return models;
|
||||
}
|
||||
|
||||
public void setModels(List<RectBean> models) {
|
||||
this.models = models;
|
||||
}
|
||||
|
||||
public static class RectBean {
|
||||
private int id;
|
||||
private double xl;
|
||||
private double xr;
|
||||
private double yb;
|
||||
private double yt;
|
||||
//距离x轴值
|
||||
private double distance_x;
|
||||
//距离y轴值
|
||||
private double distance_y;
|
||||
//type="car" 是车辆
|
||||
private String type;
|
||||
//纬度
|
||||
private double lat;
|
||||
//经度
|
||||
private double lon;
|
||||
//朝向
|
||||
private double heading;
|
||||
//系统时间
|
||||
private String systemTime;
|
||||
//gps 时间
|
||||
private String satelliteTime;
|
||||
//海拔高度
|
||||
private double alt;
|
||||
//车牌id
|
||||
private String carId;
|
||||
//uuid
|
||||
private String uuid;
|
||||
//color
|
||||
private String color;
|
||||
//speed
|
||||
private double speed;
|
||||
//危险等级 1 绿,2 黄,3 红
|
||||
private int drawlevel;
|
||||
//长
|
||||
private float length;
|
||||
//宽
|
||||
private float width;
|
||||
//高
|
||||
private float height;
|
||||
//驱动时间
|
||||
private String driverTime;
|
||||
/**
|
||||
* 数据来源精度 0 - 普通定位、1 - 高精定位
|
||||
*/
|
||||
public int dataAccuracy = 1;
|
||||
|
||||
/**
|
||||
* 实际距离,使用 distanceX 和 distanceY 计算
|
||||
*/
|
||||
public double distance;
|
||||
|
||||
public int getDataAccuracy() {
|
||||
return dataAccuracy;
|
||||
}
|
||||
|
||||
public void setDataAccuracy(int dataAccuracy) {
|
||||
this.dataAccuracy = dataAccuracy;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public String getSystemTime() {
|
||||
return systemTime;
|
||||
}
|
||||
|
||||
public void setSystemTime(String systemTime) {
|
||||
this.systemTime = systemTime;
|
||||
}
|
||||
|
||||
public String getSatelliteTime() {
|
||||
return satelliteTime;
|
||||
}
|
||||
|
||||
public void setSatelliteTime(String satelliteTime) {
|
||||
this.satelliteTime = satelliteTime;
|
||||
}
|
||||
|
||||
public double getAlt() {
|
||||
return alt;
|
||||
}
|
||||
|
||||
public void setAlt(double alt) {
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
public String getCarId() {
|
||||
return carId;
|
||||
}
|
||||
|
||||
public void setCarId(String carId) {
|
||||
this.carId = carId;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
public void setColor(String color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
public float getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(float length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(float width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public float getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(float height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getDrawlevel() {
|
||||
return drawlevel;
|
||||
}
|
||||
|
||||
public void setDrawlevel(int drawlevel) {
|
||||
this.drawlevel = drawlevel;
|
||||
}
|
||||
|
||||
public double getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public void setSpeed(double speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getDistance_x() {
|
||||
return distance_x;
|
||||
}
|
||||
|
||||
public void setDistance_x(double distance_x) {
|
||||
this.distance_x = distance_x;
|
||||
}
|
||||
|
||||
public double getDistance_y() {
|
||||
return distance_y;
|
||||
}
|
||||
|
||||
public void setDistance_y(double distance_y) {
|
||||
this.distance_y = distance_y;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
return heading;
|
||||
}
|
||||
|
||||
public void setHeading(double heading) {
|
||||
this.heading = heading;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public double getXl() {
|
||||
return xl;
|
||||
}
|
||||
|
||||
public void setXl(double xl) {
|
||||
this.xl = xl;
|
||||
}
|
||||
|
||||
public double getXr() {
|
||||
return xr;
|
||||
}
|
||||
|
||||
public void setXr(double xr) {
|
||||
this.xr = xr;
|
||||
}
|
||||
|
||||
public double getYb() {
|
||||
return yb;
|
||||
}
|
||||
|
||||
public void setYb(double yb) {
|
||||
this.yb = yb;
|
||||
}
|
||||
|
||||
public double getYt() {
|
||||
return yt;
|
||||
}
|
||||
|
||||
public void setYt(double yt) {
|
||||
this.yt = yt;
|
||||
}
|
||||
|
||||
public String getDriverTime() {
|
||||
return driverTime;
|
||||
}
|
||||
|
||||
public void setDriverTime(String driverTime) {
|
||||
this.driverTime = driverTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RectBean{" +
|
||||
"id=" + id +
|
||||
", xl=" + xl +
|
||||
", xr=" + xr +
|
||||
", yb=" + yb +
|
||||
", yt=" + yt +
|
||||
", distance_x=" + distance_x +
|
||||
", distance_y=" + distance_y +
|
||||
", type='" + type + '\'' +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", heading=" + heading +
|
||||
", systemTime='" + systemTime + '\'' +
|
||||
", satelliteTime='" + satelliteTime + '\'' +
|
||||
", alt=" + alt +
|
||||
", carId='" + carId + '\'' +
|
||||
", uuid='" + uuid + '\'' +
|
||||
", color='" + color + '\'' +
|
||||
", speed=" + speed +
|
||||
", drawlevel=" + drawlevel +
|
||||
", length=" + length +
|
||||
", width=" + width +
|
||||
", height=" + height +
|
||||
", driverTime=" + driverTime +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RectInfo{" +
|
||||
", action='" + action + '\'' +
|
||||
", models=" + models +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,139 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/16
|
||||
*
|
||||
* 自动驾驶参数
|
||||
*/
|
||||
class RemoteControlAutoPilotParameters {
|
||||
|
||||
private String action;
|
||||
|
||||
private RemoteControlAutoPilotParameters.ValuesBean result;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public ValuesBean getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(ValuesBean result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RemoteControlAutoPilotParameters{" +
|
||||
"action='" + action + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
|
||||
public static class ValuesBean {
|
||||
public AutoPilotLonLat startLatLon;
|
||||
public List< AutoPilotLonLat > wayLatLons;
|
||||
public AutoPilotLonLat endLatLon;
|
||||
public float speedLimit;
|
||||
public int vehicleType;// 运营类型
|
||||
|
||||
public static class AutoPilotLonLat {
|
||||
public double lat;
|
||||
public double lon;
|
||||
|
||||
public AutoPilotLonLat() {
|
||||
}
|
||||
|
||||
public AutoPilotLonLat( double lat, double lon ) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutoPilotLonLat{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public AutoPilotLonLat getStartLatLon() {
|
||||
return startLatLon;
|
||||
}
|
||||
|
||||
public void setStartLatLon(AutoPilotLonLat startLatLon) {
|
||||
this.startLatLon = startLatLon;
|
||||
}
|
||||
|
||||
public List<AutoPilotLonLat> getWayLatLons() {
|
||||
return wayLatLons;
|
||||
}
|
||||
|
||||
public void setWayLatLons(List<AutoPilotLonLat> wayLatLons) {
|
||||
this.wayLatLons = wayLatLons;
|
||||
}
|
||||
|
||||
public AutoPilotLonLat getEndLatLon() {
|
||||
return endLatLon;
|
||||
}
|
||||
|
||||
public void setEndLatLon(AutoPilotLonLat endLatLon) {
|
||||
this.endLatLon = endLatLon;
|
||||
}
|
||||
|
||||
public float getSpeedLimit() {
|
||||
return speedLimit;
|
||||
}
|
||||
|
||||
public void setSpeedLimit(float speedLimit) {
|
||||
this.speedLimit = speedLimit;
|
||||
}
|
||||
|
||||
public int getVehicleType() {
|
||||
return vehicleType;
|
||||
}
|
||||
|
||||
public void setVehicleType(int vehicleType) {
|
||||
this.vehicleType = vehicleType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RemoteControlAutoPilotParameters{" +
|
||||
"startLatLon=" + startLatLon +
|
||||
", wayLatLons=" + wayLatLons +
|
||||
", endLatLon=" + endLatLon +
|
||||
", speedLimit=" + speedLimit +
|
||||
", vehicleType=" + vehicleType +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/7
|
||||
*/
|
||||
public class RouteInfo {
|
||||
|
||||
private String id;
|
||||
|
||||
private double startLat;
|
||||
|
||||
private double startLon;
|
||||
|
||||
private double endLat;
|
||||
|
||||
private double endLon;
|
||||
|
||||
private String path;
|
||||
|
||||
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/21
|
||||
*/
|
||||
public class TrajectoryInfo {
|
||||
//经度
|
||||
@SerializedName("lon")
|
||||
private Double lon;
|
||||
//纬度
|
||||
@SerializedName("lat")
|
||||
private Double lat;
|
||||
//高度
|
||||
@SerializedName("alt")
|
||||
private Double alt;
|
||||
//时间 秒s
|
||||
@SerializedName("time")
|
||||
private Double time;
|
||||
//速度 m/s
|
||||
@SerializedName("velocity")
|
||||
private Double velocity;
|
||||
//加速度
|
||||
@SerializedName("acceleration")
|
||||
private Double acceleration;
|
||||
//速度方向
|
||||
@SerializedName("theta")
|
||||
private Double theta;
|
||||
//曲率
|
||||
@SerializedName("kappa")
|
||||
private Double kappa;
|
||||
//从起点到目前的总距离
|
||||
@SerializedName("accumulated_dis")
|
||||
private Double accumulatedDis;
|
||||
|
||||
public void setLon(Double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setLat(Double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setAlt(Double alt) {
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
public void setTime(Double time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public void setVelocity(Double velocity) {
|
||||
this.velocity = velocity;
|
||||
}
|
||||
|
||||
public void setAcceleration(Double acceleration) {
|
||||
this.acceleration = acceleration;
|
||||
}
|
||||
|
||||
public void setTheta(Double theta) {
|
||||
this.theta = theta;
|
||||
}
|
||||
|
||||
public void setKappa(Double kappa) {
|
||||
this.kappa = kappa;
|
||||
}
|
||||
|
||||
public void setAccumulatedDis(Double accumulatedDis) {
|
||||
this.accumulatedDis = accumulatedDis;
|
||||
}
|
||||
|
||||
public Double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public Double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public Double getAlt() {
|
||||
return alt;
|
||||
}
|
||||
|
||||
public Double getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public Double getVelocity() {
|
||||
return velocity;
|
||||
}
|
||||
|
||||
public Double getAcceleration() {
|
||||
return acceleration;
|
||||
}
|
||||
|
||||
public Double getTheta() {
|
||||
return theta;
|
||||
}
|
||||
|
||||
public Double getKappa() {
|
||||
return kappa;
|
||||
}
|
||||
|
||||
public Double getAccumulatedDis() {
|
||||
return accumulatedDis;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TrajectoryModels{" +
|
||||
"lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", alt=" + alt +
|
||||
", time='" + time + '\'' +
|
||||
", velocity=" + velocity +
|
||||
", acceleration=" + acceleration +
|
||||
", theta=" + theta +
|
||||
", kappa=" + kappa +
|
||||
", accumulatedDis=" + accumulatedDis +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean;
|
||||
|
||||
/**
|
||||
* @ProjectName: lib-adas-fpga
|
||||
* @Package: com.zhidao.lib.adas.high.bean
|
||||
* @ClassName: WarnMessageInfo
|
||||
* @Description: java类作用描述
|
||||
* @Author: fenghl
|
||||
* @CreateDate: 2020/2/9 20:40
|
||||
* @UpdateUser: 更新者:
|
||||
* @UpdateDate: 2020/2/9 20:40
|
||||
* @UpdateRemark: 更新说明:
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class WarnMessageInfo {
|
||||
/**
|
||||
* content : 小心前车
|
||||
* level : 2
|
||||
* type : 20
|
||||
* value :
|
||||
*/
|
||||
|
||||
private String content;
|
||||
private String level;
|
||||
private String type;
|
||||
private String value;
|
||||
|
||||
public WarnMessageInfo() {
|
||||
}
|
||||
|
||||
public WarnMessageInfo(String type, String content, String value, String level) {
|
||||
this.type = type;
|
||||
this.content = content;
|
||||
this.value = value;
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(String level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WarnMessageInfo{" +
|
||||
"content='" + content + '\'' +
|
||||
", level='" + level + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author songkenan
|
||||
* @des 节点监控
|
||||
* @date 2021/7/7
|
||||
*/
|
||||
public class AutopilotGuardianInfo implements Serializable {
|
||||
//接口名称
|
||||
@SerializedName("action")
|
||||
private String action;
|
||||
//监控项名称
|
||||
@SerializedName("agentName")
|
||||
private String agentName;
|
||||
//车牌号
|
||||
@SerializedName("carNum")
|
||||
private String carNum;
|
||||
//车型
|
||||
@SerializedName("carType")
|
||||
private String carType;
|
||||
//monitorType
|
||||
@SerializedName("monitorType")
|
||||
private String monitorType;
|
||||
//sn
|
||||
@SerializedName("sn")
|
||||
private String sn;
|
||||
//时间
|
||||
@SerializedName("time")
|
||||
private long time;
|
||||
@SerializedName("modules")
|
||||
private GuardianModule modules;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public String getAgentName() {
|
||||
return agentName;
|
||||
}
|
||||
|
||||
public void setAgentName(String agentName) {
|
||||
this.agentName = agentName;
|
||||
}
|
||||
|
||||
public String getCarNum() {
|
||||
return carNum;
|
||||
}
|
||||
|
||||
public void setCarNum(String carNum) {
|
||||
this.carNum = carNum;
|
||||
}
|
||||
|
||||
public String getCarType() {
|
||||
return carType;
|
||||
}
|
||||
|
||||
public void setCarType(String carType) {
|
||||
this.carType = carType;
|
||||
}
|
||||
|
||||
public String getMonitorType() {
|
||||
return monitorType;
|
||||
}
|
||||
|
||||
public void setMonitorType(String monitorType) {
|
||||
this.monitorType = monitorType;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(long time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public GuardianModule getModules() {
|
||||
return modules;
|
||||
}
|
||||
|
||||
public void setModules(GuardianModule modules) {
|
||||
this.modules = modules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotGuardianInfo{" +
|
||||
"action='" + action + '\'' +
|
||||
", agentName='" + agentName + '\'' +
|
||||
", carNum='" + carNum + '\'' +
|
||||
", carType='" + carType + '\'' +
|
||||
", monitorType='" + monitorType + '\'' +
|
||||
", modules=" + modules +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/10
|
||||
*/
|
||||
public class GuardianItem {
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("value")
|
||||
private String value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GuardianItem{" +
|
||||
"name='" + name + '\'' +
|
||||
", value='" + value + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/10
|
||||
*/
|
||||
public class GuardianItemsName {
|
||||
@SerializedName("name")
|
||||
private String name;
|
||||
@SerializedName("items")
|
||||
private List<GuardianItem> items;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<GuardianItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<GuardianItem> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GuardianItemsName{" +
|
||||
"name='" + name + '\'' +
|
||||
", items=" + items +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean.guardian;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/10
|
||||
*/
|
||||
public class GuardianModule {
|
||||
@SerializedName("itemsname")
|
||||
private List<GuardianItemsName> itemsname;
|
||||
@SerializedName("submodules")
|
||||
private List<GuardianSubmodule> submodules;
|
||||
|
||||
public List<GuardianItemsName> getItemsname() {
|
||||
return itemsname;
|
||||
}
|
||||
|
||||
public void setItemsname(List<GuardianItemsName> itemsname) {
|
||||
this.itemsname = itemsname;
|
||||
}
|
||||
|
||||
public List<GuardianSubmodule> getSubmodules() {
|
||||
return submodules;
|
||||
}
|
||||
|
||||
public void setSubmodules(List<GuardianSubmodule> submodules) {
|
||||
this.submodules = submodules;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GuardianModule{" +
|
||||
"itemsname=" + itemsname +
|
||||
", submodules=" + submodules +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean.guardian;
|
||||
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/12/10
|
||||
*/
|
||||
public class GuardianSubmodule {
|
||||
@SerializedName("modulename")
|
||||
private String modulename;
|
||||
@SerializedName("subnodes")
|
||||
private List<Subnode> subnodes;
|
||||
|
||||
public String getModulename() {
|
||||
return modulename;
|
||||
}
|
||||
|
||||
public void setModulename(String modulename) {
|
||||
this.modulename = modulename;
|
||||
}
|
||||
|
||||
public List<Subnode> getSubnodes() {
|
||||
return subnodes;
|
||||
}
|
||||
|
||||
public void setSubnodes(List<Subnode> subnodes) {
|
||||
this.subnodes = subnodes;
|
||||
}
|
||||
|
||||
public static class Subnode {
|
||||
@SerializedName("nodename")
|
||||
private String nodename;
|
||||
@SerializedName("nodeitems")
|
||||
private List<GuardianItemsName> nodeitems;
|
||||
@SerializedName("topicitems")
|
||||
private List<GuardianItemsName> topicitems;
|
||||
|
||||
public String getNodename() {
|
||||
return nodename;
|
||||
}
|
||||
|
||||
public void setNodename(String nodename) {
|
||||
this.nodename = nodename;
|
||||
}
|
||||
|
||||
public List getNodeitems() {
|
||||
return nodeitems;
|
||||
}
|
||||
|
||||
public void setNodeitems(List nodeitems) {
|
||||
this.nodeitems = nodeitems;
|
||||
}
|
||||
|
||||
public List<GuardianItemsName> getTopicitems() {
|
||||
return topicitems;
|
||||
}
|
||||
|
||||
public void setTopicitems(List<GuardianItemsName> topicitems) {
|
||||
this.topicitems = topicitems;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Subnode{" +
|
||||
"nodename='" + nodename + '\'' +
|
||||
", nodeitems=" + nodeitems +
|
||||
", topicitems=" + topicitems +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GuardianSubmodule{" +
|
||||
"modulename='" + modulename + '\'' +
|
||||
", subnodes=" + subnodes +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean.record;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/8/26
|
||||
*/
|
||||
public class AutopilotIdentifyInfo {
|
||||
|
||||
@SerializedName("action")
|
||||
private String action;
|
||||
@SerializedName("result")
|
||||
private Result result;
|
||||
|
||||
public static class Result {
|
||||
@SerializedName("panel")
|
||||
private AutopilotRecordResult panel;
|
||||
@SerializedName("passwd")
|
||||
private String passwd;
|
||||
@SerializedName("user")
|
||||
private String user;
|
||||
|
||||
public AutopilotRecordResult getPanel() {
|
||||
return panel;
|
||||
}
|
||||
|
||||
public void setPanel(AutopilotRecordResult panel) {
|
||||
this.panel = panel;
|
||||
}
|
||||
|
||||
public String getPasswd() {
|
||||
return passwd;
|
||||
}
|
||||
|
||||
public void setPasswd(String passwd) {
|
||||
this.passwd = passwd;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return user;
|
||||
}
|
||||
|
||||
public void setUser(String user) {
|
||||
this.user = user;
|
||||
}
|
||||
}
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public void setAction(String action) {
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotIdentifyInfo{" +
|
||||
"action='" + action + '\'' +
|
||||
", result=" + result +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,171 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean.record;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @ 自动驾驶数据采集结果
|
||||
* @date 2021/11/8
|
||||
*/
|
||||
public class AutopilotRecordResult {
|
||||
//磁盘可用空间(M)
|
||||
@SerializedName("disk_free")
|
||||
private Long diskFree;
|
||||
//采集时长(秒)
|
||||
@SerializedName("duration")
|
||||
private double duration;
|
||||
//保存的文件名
|
||||
@SerializedName("filename")
|
||||
private String filename;
|
||||
//其他信息,包含错误信息等
|
||||
@SerializedName("note")
|
||||
private String note;
|
||||
//域控制器定义的bag key
|
||||
@SerializedName("key")
|
||||
private String key;
|
||||
//采集状态:100 - 采集成功,自动结束
|
||||
//101 - 采集成功,收到结束指令
|
||||
//102 -- 达到最大采集时长
|
||||
//103 --达到最大采集空间
|
||||
//200 - 采集失败
|
||||
//201 - 采集中
|
||||
//300 - 开始采集
|
||||
@SerializedName("stat")
|
||||
private int stat;
|
||||
//任务类型:1-badcase采集任务,2-地图数据采集任务
|
||||
@SerializedName("type")
|
||||
private int type;
|
||||
//任务id
|
||||
@SerializedName("id")
|
||||
private int id;
|
||||
//时间戳,格式:YYYY-MM-DD-hh-mm-ss
|
||||
@SerializedName("timestamp")
|
||||
private String timestamp;
|
||||
//此次数据总大小(M)
|
||||
@SerializedName("total_size")
|
||||
private Long totalSize;
|
||||
//触发指令
|
||||
@SerializedName("triggerinfo")
|
||||
private Triggerinfo triggerinfo;
|
||||
//各topic数据量
|
||||
@SerializedName("records")
|
||||
private List<Records> records;
|
||||
|
||||
public static class Triggerinfo {
|
||||
//是否为人工接管时自动采集:true - 自动采集 false - 手动触发
|
||||
@SerializedName("auto_trig")
|
||||
private Boolean autoTrig;
|
||||
//触发采集附带的信息,如任务ID,时间戳等。若为自动采集则此项忽略
|
||||
@SerializedName("trig_msg")
|
||||
private String trigMsg;
|
||||
|
||||
public Boolean getAutoTrig() {
|
||||
return autoTrig;
|
||||
}
|
||||
|
||||
public String getTrigMsg() {
|
||||
return trigMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Triggerinfo{" +
|
||||
"autoTrig=" + autoTrig +
|
||||
", trigMsg='" + trigMsg + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public static class Records {
|
||||
//数据记录数
|
||||
@SerializedName("nums")
|
||||
private Integer nums;
|
||||
//数据来源的topic名
|
||||
@SerializedName("topic")
|
||||
private String topic;
|
||||
|
||||
public Integer getNums() {
|
||||
return nums;
|
||||
}
|
||||
|
||||
public String getTopic() {
|
||||
return topic;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Records{" +
|
||||
"nums=" + nums +
|
||||
", topic='" + topic + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
public Long getDiskFree() {
|
||||
return diskFree;
|
||||
}
|
||||
|
||||
public double getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public List<Records> getRecords() {
|
||||
return records;
|
||||
}
|
||||
|
||||
public int getStat() {
|
||||
return stat;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getTimestamp() {
|
||||
return timestamp;
|
||||
}
|
||||
|
||||
public Long getTotalSize() {
|
||||
return totalSize;
|
||||
}
|
||||
|
||||
public Triggerinfo getTriggerinfo() {
|
||||
return triggerinfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AutopilotRecordResult{" +
|
||||
"diskFree=" + diskFree +
|
||||
", duration=" + duration +
|
||||
", filename='" + filename + '\'' +
|
||||
", note='" + note + '\'' +
|
||||
", key='" + key + '\'' +
|
||||
", stat=" + stat +
|
||||
", type=" + type +
|
||||
", id=" + id +
|
||||
", timestamp='" + timestamp + '\'' +
|
||||
", totalSize=" + totalSize +
|
||||
", triggerinfo=" + triggerinfo +
|
||||
", records=" + records +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean.record;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des 采集类型
|
||||
* @date 2021/8/25
|
||||
*/
|
||||
|
||||
public class RecordCauseParam {
|
||||
private final String action = "record_cause";
|
||||
private Result result;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class Result{
|
||||
//bag key 唯一标识
|
||||
private String key;
|
||||
//文件路径
|
||||
private String filename;
|
||||
//接管原因
|
||||
private String reason;
|
||||
//接管原因id
|
||||
private String id;
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getFilename() {
|
||||
return filename;
|
||||
}
|
||||
|
||||
public void setFilename(String filename) {
|
||||
this.filename = filename;
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RecordDataParam{" +
|
||||
"action='" + action + '\'' +
|
||||
", result='" + result + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
package com.zhidao.support.adas.high.bean.record;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/8/25
|
||||
*/
|
||||
|
||||
public class RecordDataParam {
|
||||
private final String action = "record_data";
|
||||
private Result result;
|
||||
|
||||
public String getAction() {
|
||||
return action;
|
||||
}
|
||||
|
||||
public Result getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(Result result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public static class Result{
|
||||
//采集时间
|
||||
private String time;
|
||||
//采集指令 true 采集 , false 停止采集
|
||||
private boolean isRecord;
|
||||
//采集类型 1 badcase; 2 map; 3 rests
|
||||
private int type;
|
||||
//采集id
|
||||
private int id;
|
||||
//是否持续采集
|
||||
private boolean sustain;
|
||||
//采集时间长
|
||||
private int duration;
|
||||
//余留字段
|
||||
private String note;
|
||||
|
||||
public String getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime(String time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public boolean getIsRecord() {
|
||||
return isRecord;
|
||||
}
|
||||
|
||||
public void setIsRecord(boolean isRecord) {
|
||||
this.isRecord = isRecord;
|
||||
}
|
||||
|
||||
public boolean isRecord() {
|
||||
return isRecord;
|
||||
}
|
||||
|
||||
public void setRecord(boolean record) {
|
||||
isRecord = record;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public boolean isSustain() {
|
||||
return sustain;
|
||||
}
|
||||
|
||||
public void setSustain(boolean sustain) {
|
||||
this.sustain = sustain;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return duration;
|
||||
}
|
||||
|
||||
public void setDuration(int duration) {
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "RecordDataParam{" +
|
||||
"action='" + action + '\'' +
|
||||
", result='" + result + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
/**
|
||||
* 接收的Action
|
||||
*
|
||||
* @author nie yunlong
|
||||
* @description 请求值
|
||||
* @date 2018/7/3
|
||||
*/
|
||||
public enum ActionTypeReceive {
|
||||
|
||||
/**
|
||||
* udp 消息渲染 action
|
||||
*/
|
||||
ACTION_WS_MSG_RENDER_TYPE("view", 0x101, "渲染流 渲染图像"),
|
||||
/**
|
||||
* 周边物体的状态
|
||||
*/
|
||||
ACTION_WS_OBSTACLES_MESSAGE_TYPE("obstacles", -1, "周边物体的状态"),
|
||||
/**
|
||||
* 车道线渲染
|
||||
*/
|
||||
ACTION_WS_LANES_MESSAGE_TYPE("lanes", -1, "车道线渲染"),
|
||||
/**
|
||||
* 车辆状态
|
||||
*/
|
||||
ACTION_WS_CAR_STATE_TYPE("state", 0x102, "车辆状态"),
|
||||
/**
|
||||
* ws 报警消息 action
|
||||
*/
|
||||
ACTION_WS_MSG_WARNING_TYPE("warn", -1, "ws 报警消息"),
|
||||
/**
|
||||
* 红绿灯状态
|
||||
*/
|
||||
ACTION_UDP_LIGHT_STATE_TYPE("light", -1, "udp 红绿灯状态"),
|
||||
/**
|
||||
* 自动驾驶状态
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_STATUE("autopilotstate", -1, "自动驾驶状态"),
|
||||
/**
|
||||
* 自动驾驶控制
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_CONTROL("autopilotmode", -1, "自动驾驶控制"),
|
||||
/**
|
||||
* obu红绿灯数据
|
||||
*/
|
||||
ACTION_WS_AI_CLOUD_OBU_RED_GREEN_LIGHT_TYPE("obuTrafficLight", -1, "obu红绿灯数据"),
|
||||
/**
|
||||
* ai云
|
||||
*/
|
||||
ACTION_WS_AI_CLOUD_TYPE("aiCloudToStartAutopilot", -1, "云端控制自动驾驶"),
|
||||
/**
|
||||
* 图片大小
|
||||
*/
|
||||
ACTION_WS_MSG_IMAGE_SIZE_TYPE("imagesize", -1, "ws 图片大小"),
|
||||
/**
|
||||
* ai云推送 在线车辆
|
||||
*/
|
||||
ACTION_WS_AI_CLOUD_ONLINE_CAR_TYPE("aiCloudToOnLineCar", -1, "云端推送在线车辆"),
|
||||
/**
|
||||
* 自动驾驶站点通信
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_WAY_ARRIVE("autopilotArrive", -1, "自动驾驶站点"),
|
||||
/**
|
||||
* 获取自动驾驶路径
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_ROUTE("global_path", -1, "自动驾驶路径"),
|
||||
/**
|
||||
* 查询自动驾驶路径
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_QUERY_ROUTE("query_global_path", -1, "查询自动驾驶路径"),
|
||||
/**
|
||||
* 工控机请求SN
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_SN_REQUEST("autopilotSN", -1, "工控机请求SN"),
|
||||
/**
|
||||
* 监控车辆节点
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_GUARDIAN("guardian", 0x105, "监控车辆节点"),
|
||||
/**
|
||||
* BadCase数据采集
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_IDENTIFY("identify", -1, "BadCase数据采集"),
|
||||
/**
|
||||
* 局部轨迹 车前引导钱
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_TRAJECTORY("trajectory", 0x100, "局部轨迹 车前引导钱"),
|
||||
/**
|
||||
* car dock 基础信息
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_CAR_CONFIG("car_config", -1, "car_config"),
|
||||
/**
|
||||
* 轨迹列表 routes
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_ROUTES("route_list", 0x104, "轨迹列表"),
|
||||
/**
|
||||
* 工控机升级状态
|
||||
*/
|
||||
ACTION_WS_AUTOPILOT_UPGRADE_STATUS("ipc_upgrade_status", -1, "IPC升级状态");
|
||||
|
||||
/**
|
||||
* 消息action 类型
|
||||
*/
|
||||
String mActionType;
|
||||
|
||||
/**
|
||||
* 消息action code
|
||||
*/
|
||||
int mActionCode;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
String mMsgDesc;
|
||||
|
||||
ActionTypeReceive(String actionType, int actionCode, String msgDesc) {
|
||||
this.mActionType = actionType;
|
||||
this.mActionCode = actionCode;
|
||||
this.mMsgDesc = msgDesc;
|
||||
}
|
||||
|
||||
public String getmActionType() {
|
||||
return mActionType;
|
||||
}
|
||||
|
||||
public void setmActionType(String mActionType) {
|
||||
this.mActionType = mActionType;
|
||||
}
|
||||
|
||||
public int getmActionCode() {
|
||||
return mActionCode;
|
||||
}
|
||||
|
||||
public void setmActionCode(int mActionCode) {
|
||||
this.mActionCode = mActionCode;
|
||||
}
|
||||
|
||||
public String getmMsgDesc() {
|
||||
return mMsgDesc;
|
||||
}
|
||||
|
||||
public void setmMsgDesc(String mMsgDesc) {
|
||||
this.mMsgDesc = mMsgDesc;
|
||||
}
|
||||
}
|
||||
@@ -19,17 +19,13 @@ public class AppPreferenceHelper implements IPreferencesHelper {
|
||||
/**
|
||||
* 保存deviceId 文件名称
|
||||
*/
|
||||
private final String UDP_RECEIVER_ADDRESS_FILE_NAME = "upd_receive";
|
||||
private final static String SP_NAME = "adas_config";
|
||||
|
||||
/**
|
||||
* 手机Id
|
||||
*/
|
||||
private SharedPreferences mDevicePre;
|
||||
private SharedPreferences ipcPre;
|
||||
|
||||
/**
|
||||
* 默认data
|
||||
*/
|
||||
private String defaultData = "{\"configInfoHistory\":[{\"kCode\":\"d_fcw_touch\",\"kName\":\"前车碰撞预警\",\"kOrder\":1,\"kType\":\"aided_driving_dic\",\"kVal\":\"5\",\"userId\":0},{\"kCode\":\"d_fcw_start\",\"kName\":\"前车启动提醒\",\"kOrder\":1,\"kType\":\"aided_driving_dic\",\"kVal\":\"5\",\"userId\":0},{\"kCode\":\"d_hdw_driver\",\"kName\":\"驾驶员疲劳/危险预警\",\"kOrder\":1,\"kType\":\"aided_driving_dic\",\"kVal\":\"5\",\"userId\":0},{\"kCode\":\"d_fcw_person\",\"kName\":\"行人碰撞预警\",\"kOrder\":1,\"kType\":\"aided_driving_dic\",\"kVal\":\"5\",\"userId\":0},{\"kCode\":\"d_hdw_sliding\",\"kName\":\"溜车碰撞预警\",\"kOrder\":1,\"kType\":\"aided_driving_dic\",\"kVal\":\"5\",\"userId\":0},{\"kCode\":\"d_ldw_out\",\"kName\":\"车道线偏离预警\",\"kOrder\":1,\"kType\":\"aided_driving_dic\",\"kVal\":\"5\",\"userId\":0},{\"kCode\":\"d_hmw_follow\",\"kName\":\"跟车距离预警\",\"kOrder\":1,\"kType\":\"aided_driving_dic\",\"kVal\":\"5\",\"userId\":0},{\"kCode\":\"d_volume_size\",\"kName\":\"音量大小\",\"kOrder\":1,\"kType\":\"aided_driving_dic\",\"kVal\":\"60\",\"userId\":0},{\"kCode\":\"is_use_ar_navBar\",\"kName\":\"是否使用AR导航\",\"kOrder\":1,\"kType\":\"aided_driving_dic\",\"kVal\":\"5\",\"userId\":0}]}";
|
||||
|
||||
private HashSet<String> ipcFixationIPSet;//工控机固定IP列表
|
||||
|
||||
@@ -41,35 +37,16 @@ public class AppPreferenceHelper implements IPreferencesHelper {
|
||||
}
|
||||
|
||||
private AppPreferenceHelper(Context context) {
|
||||
mDevicePre = context.getSharedPreferences(UDP_RECEIVER_ADDRESS_FILE_NAME, Context.MODE_PRIVATE);
|
||||
ipcPre = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
|
||||
getIPCFixationIPList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveUdpClientAddress(String address) {
|
||||
mDevicePre.edit().putString("upd_client_address", address).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUdpClientAddress() {
|
||||
return mDevicePre.getString("upd_client_address", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveDockConfig(String dockConfig) {
|
||||
mDevicePre.edit().putString("dock_version", dockConfig).apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDockConfig() {
|
||||
return mDevicePre.getString("dock_version", null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HashSet<String> getIPCFixationIPList() {
|
||||
if (ipcFixationIPSet == null || ipcFixationIPSet.isEmpty()) {
|
||||
String json = mDevicePre.getString("ipc_fixation_ip", Constants.DEFAULT_IPC_FIXATION_IP);
|
||||
String json = ipcPre.getString("ipc_fixation_ip", Constants.DEFAULT_IPC_FIXATION_IP);
|
||||
ipcFixationIPSet = JsonUtil.fromJson(json, new TypeToken<HashSet<String>>() {
|
||||
}.getType());
|
||||
|
||||
@@ -78,25 +55,29 @@ public class AppPreferenceHelper implements IPreferencesHelper {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addIPCFixationIP(String ipcIP) {
|
||||
public boolean addIPCFixationIP(String ipcIP) {
|
||||
if (ipcFixationIPSet == null)
|
||||
ipcFixationIPSet = new HashSet<>();
|
||||
if (!ipcFixationIPSet.contains(ipcIP)) {
|
||||
ipcFixationIPSet.add(ipcIP);
|
||||
mDevicePre.edit().putString("ipc_fixation_ip", JsonUtil.toJson(ipcFixationIPSet)).apply();
|
||||
ipcPre.edit().putString("ipc_fixation_ip", JsonUtil.toJson(ipcFixationIPSet)).apply();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delIPCFixationIP(String ipcIP) {
|
||||
public boolean delIPCFixationIP(String ipcIP) {
|
||||
if (ipcFixationIPSet != null && ipcFixationIPSet.contains(ipcIP)) {
|
||||
ipcFixationIPSet.remove(ipcIP);
|
||||
mDevicePre.edit().putString("ipc_fixation_ip", JsonUtil.toJson(ipcFixationIPSet)).apply();
|
||||
ipcPre.edit().putString("ipc_fixation_ip", JsonUtil.toJson(ipcFixationIPSet)).apply();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delIPCFixationIP() {
|
||||
mDevicePre.edit().remove("ipc_fixation_ip").apply();
|
||||
ipcPre.edit().remove("ipc_fixation_ip").apply();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,38 +14,21 @@ package com.zhidao.support.adas.high.common;
|
||||
*/
|
||||
public class Constants {
|
||||
/**
|
||||
* ws 主机地址 需要从udp里面获取
|
||||
* ws 主机地址
|
||||
*/
|
||||
public static final String WS_IP_HOST_HEAD = "ws:";
|
||||
/**
|
||||
* ws 端口以及资源名称
|
||||
*/
|
||||
public static final String WS_PORT = ":4110/xvideo-detector";
|
||||
|
||||
public static final String RESOURCE_PATH = ":%d/xvideo-detector";
|
||||
/**
|
||||
* 发送位置信息 action
|
||||
* 默认端口
|
||||
*/
|
||||
public static final int WS_SEND_LOCATION = 2;
|
||||
|
||||
public static final int DEFAULT_PORT = 4110;
|
||||
/**
|
||||
* 查询自动驾驶轨迹
|
||||
* 数据协议头
|
||||
*/
|
||||
public static final String QUERY_GLOBAL_PATH = "{\"action\":\"query_global_path\",\"result\":null}";
|
||||
/**
|
||||
* 查询节点信息
|
||||
*/
|
||||
public static final String QUERY_GUARDIAN = "{\"action\":\"query_guardian\",\"result\":null}";
|
||||
|
||||
/**
|
||||
* 查询docker版本
|
||||
*/
|
||||
public static final String QUERY_CAR_CONFIG = "{\"action\":\"car_config\",\"result\":null}";
|
||||
|
||||
/**
|
||||
* 查询轨迹
|
||||
*/
|
||||
public static final String QUERY_ROUTES = "{\"action\":\"query_routes\",\"result\":null}";
|
||||
|
||||
public static final byte[] RAW_MG = new byte[]{(byte) 0x6d, 0x67};
|
||||
|
||||
public static final String DEFAULT_IPC_FIXATION_IP = "[\"192.168.1.102\", \"192.168.8.102\"]";
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.zhidao.support.adas.high.common;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.zhidao.support.adas.high.BuildConfig;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @description video-lib
|
||||
@@ -70,16 +68,4 @@ public class CupidLogUtils {
|
||||
}
|
||||
Log.e("elita_lib", msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 写文件
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public static void writeOwnerCarStateLog(String msg) {
|
||||
if (!isWriteLog) {
|
||||
return;
|
||||
}
|
||||
LogSaveManage.getInstance().saveWrite(msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -513,4 +513,95 @@ public class DigitalTrans {
|
||||
return bRet;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 无符号
|
||||
* 1 byte
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
|
||||
|
||||
public static int get8bitUnsignedValue(byte[] data) {
|
||||
int value = 0;
|
||||
int index = 0;
|
||||
if (data.length > index) {
|
||||
value = data[index] & 0xFF;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 无符号
|
||||
* 合并 2 byte
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static int get16bitUnsignedValue(byte[] data) {
|
||||
int value = 0;
|
||||
int index = 0;
|
||||
if (data.length > index + 1) {
|
||||
value = data[index++] & 0xFF;
|
||||
value = value << 8;
|
||||
value = value | (data[index] & 0xFF);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 无符号
|
||||
* 合并 4 byte
|
||||
*
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
public static long get32bitUnsignedValue(byte[] data) {
|
||||
long value = 0L;
|
||||
int index = 0;
|
||||
if (data.length > index + 3) {
|
||||
value = data[index++] & 0xFF;
|
||||
value = value << 8;
|
||||
value = value | (data[index++] & 0xFF);
|
||||
value = value << 8;
|
||||
value = value | (data[index++] & 0xFF);
|
||||
value = value << 8;
|
||||
value = value | (data[index] & 0xFF);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
public static byte[] set8bitUnsignedValue(int num) {
|
||||
return new byte[]{(byte) (num)};
|
||||
}
|
||||
|
||||
public static byte[] set16bitUnsignedValue(int num) {
|
||||
byte[] bytes = new byte[2];
|
||||
bytes[0] = (byte) (num >> 8);
|
||||
bytes[1] = (byte) num;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static byte[] set32bitUnsignedValue(long num) {
|
||||
byte[] bytes = new byte[4];
|
||||
bytes[0] = (byte) (num >> 24);
|
||||
bytes[1] = (byte) (num >> 16);
|
||||
bytes[2] = (byte) (num >> 8);
|
||||
bytes[3] = (byte) num;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
public static byte[] set64bitUnsignedValue(long num) {
|
||||
byte[] bytes = new byte[8];
|
||||
bytes[0] = (byte) (num >> 56);
|
||||
bytes[1] = (byte) (num >> 48);
|
||||
bytes[2] = (byte) (num >> 40);
|
||||
bytes[3] = (byte) (num >> 32);
|
||||
bytes[4] = (byte) (num >> 24);
|
||||
bytes[5] = (byte) (num >> 16);
|
||||
bytes[6] = (byte) (num >> 8);
|
||||
bytes[7] = (byte) num;
|
||||
return bytes;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,35 +8,6 @@ import java.util.HashSet;
|
||||
*/
|
||||
|
||||
public interface IPreferencesHelper {
|
||||
/**
|
||||
* 保存udp client address
|
||||
*
|
||||
* @param address
|
||||
*/
|
||||
void saveUdpClientAddress(String address);
|
||||
|
||||
/**
|
||||
* 获取client address
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getUdpClientAddress();
|
||||
|
||||
/**
|
||||
* 保存dock config
|
||||
*
|
||||
* @param dockConfig
|
||||
*/
|
||||
void saveDockConfig(String dockConfig);
|
||||
|
||||
/**
|
||||
* 获取dock config
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getDockConfig();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -51,14 +22,14 @@ public interface IPreferencesHelper {
|
||||
*
|
||||
* @param ipcIP
|
||||
*/
|
||||
void addIPCFixationIP(String ipcIP);
|
||||
boolean addIPCFixationIP(String ipcIP);
|
||||
|
||||
/**
|
||||
* 删除指定的工控机固定IP
|
||||
*
|
||||
* @param ipcIP
|
||||
*/
|
||||
void delIPCFixationIP(String ipcIP);
|
||||
boolean delIPCFixationIP(String ipcIP);
|
||||
|
||||
/**
|
||||
* 删除所有工控机固定IP
|
||||
|
||||
@@ -1,70 +0,0 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.zhidao.support.adas.high.thread.QueuedWork;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des
|
||||
* @date 2021/3/4
|
||||
*/
|
||||
class LogSaveManage {
|
||||
private static final LogSaveManage ourInstance = new LogSaveManage();
|
||||
//当前保存的文件路径
|
||||
private String currentSaveFilePath;
|
||||
//6M
|
||||
private final long FILE_LIMIT_SIZE = 6 * 1024 * 1024;
|
||||
|
||||
static LogSaveManage getInstance() {
|
||||
return ourInstance;
|
||||
}
|
||||
|
||||
private LogSaveManage() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存文件
|
||||
*
|
||||
* @param msg
|
||||
*/
|
||||
public synchronized void saveWrite(final String msg) {
|
||||
QueuedWork.runInBack(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
String logFilePath = createFileReturnPath();
|
||||
FileUtils.writeFile(logFilePath, msg, true);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建文件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private synchronized String createFileReturnPath() throws Exception {
|
||||
if (!TextUtils.isEmpty(currentSaveFilePath)) {
|
||||
long fileSize = FileUtils.getFileSizeLong(new File(currentSaveFilePath));
|
||||
if (fileSize <= FILE_LIMIT_SIZE) {
|
||||
return currentSaveFilePath;
|
||||
}
|
||||
}
|
||||
//大于6M
|
||||
String filePath = BaseSDCardHelper.getSDCardPrivateFilesDir(MgContextUtils.getContext(), "adas-log") + File.separator + BaseTimeUtils.formatTimeDate3() + "-log.txt";
|
||||
//把日志保存到文件
|
||||
boolean isCreateFileSuccess = FileUtils.createOrExistsFile(filePath);
|
||||
if (isCreateFileSuccess) {
|
||||
currentSaveFilePath = filePath;
|
||||
}
|
||||
return currentSaveFilePath;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* 工控机发送或接收的类型
|
||||
*
|
||||
* @author nie yunlong
|
||||
* @description 请求值
|
||||
* @date 2018/7/3
|
||||
*/
|
||||
public enum MessageType {
|
||||
|
||||
TYPE_DEFAULT("default", MessagePad.MessageType.MsgTypeDefault, "默认"),
|
||||
TYPE_RECEIVE_TRAJECTORY("trajectory", MessagePad.MessageType.MsgTypeTrajectory, "局部轨迹,车前引导线"),
|
||||
TYPE_RECEIVE_TRACKED_OBJECTS("tracked_objects", MessagePad.MessageType.MsgTypeTrackedObjects, "障碍物信息"),
|
||||
TYPE_RECEIVE_GNSS_INFO("gnss_info", MessagePad.MessageType.MsgTypeGnssInfo, "惯导信息"),
|
||||
TYPE_RECEIVE_VEHICLE_STATE("vehicle_state", MessagePad.MessageType.MsgTypeVehicleState, "底盘信息, 透传底盘状态,pb参考底盘"),
|
||||
TYPE_RECEIVE_AUTOPILOT_STATE("autopilot_state", MessagePad.MessageType.MsgTypeAutopilotState, "自动驾驶状态"),
|
||||
TYPE_RECEIVE_REPORT_MESSAGE("report_message", MessagePad.MessageType.MsgTypeReportMessage, "监控事件报告"),
|
||||
|
||||
TYPE_RECEIVE_BASIC_INFO_REQ("basic_info_req", MessagePad.MessageType.MsgTypeBasicInfoReq, "自动驾驶设备基础信息请求"),
|
||||
TYPE_SEND_BASIC_INFO_RESP("basic_info_resp", MessagePad.MessageType.MsgTypeBasicInfoResp, "自动驾驶设备基础信息应答"),
|
||||
TYPE_SEND_SET_AUTOPILOT_MODE_REQ("set_autopilot_mode_req", MessagePad.MessageType.MsgTypeSetAutopilotModeReq, "设置自动驾驶模式 启动自动驾驶"),
|
||||
TYPE_SEND_SET_DEMO_MODE_REQ("set_demo_mode_req", MessagePad.MessageType.MsgTypeSetDemoModeReq, "设置演示模式"),
|
||||
TYPE_SEND_CAR_CONFIG_REQ("car_config_req", MessagePad.MessageType.MsgTypeCarConfigReq, "车机基础信息请求"),
|
||||
TYPE_RECEIVE_CAR_CONFIG_RESP("car_config_resp", MessagePad.MessageType.MsgTypeCarConfigResp, "车机基础信息应答"),
|
||||
TYPE_SEND_RECORD_CAUSE("record_cause", MessagePad.MessageType.MsgTypeRecordCause, "记录人工接管原因"),
|
||||
TYPE_SEND_RECORD_DATA("record_data", MessagePad.MessageType.MsgTypeRecordData, "数据采集请求"),
|
||||
TYPE_RECEIVE_RECORD_RESULT("record_result", MessagePad.MessageType.MsgTypeRecordResult, "数据采集结果"),
|
||||
TYPE_SEND_SET_AUTOPILOT_SPEED_REQ("set_autopilot_speed_req", MessagePad.MessageType.MsgTypeSetAutopilotSpeedReq, "设置自动驾驶最大速度"),
|
||||
TYPE_SEND_GLOBAL_PATH_REQ("global_path_req", MessagePad.MessageType.MsgTypeGlobalPathReq, "自动驾驶路径请求"),
|
||||
TYPE_RECEIVE_GLOBAL_PATH_RESP("global_path_resp", MessagePad.MessageType.MsgTypeGlobalPathResp, "自动驾驶路径应答"),
|
||||
TYPE_SEND_TRAFFIC_LIGHT_DATA("traffic_light_data", MessagePad.MessageType.MsgTypeTrafficLightData, "发送红绿灯数据到工控机"),
|
||||
@Deprecated
|
||||
TYPE_RECEIVE_WARN("warn", MessagePad.MessageType.MsgTypeWarn, "预警数据"),
|
||||
TYPE_RECEIVE_ARRIVAL_NOTIFICATION("arrival_notification", MessagePad.MessageType.MsgTypeArrivalNotification, "到站提醒"),
|
||||
|
||||
/**
|
||||
* 工控机升级状态
|
||||
*/
|
||||
@Deprecated
|
||||
TYPE_RECEIVE_IPC_UPGRADE_STATUS("ipc_upgrade_status", null, "IPC升级状态");
|
||||
|
||||
public final String typeName;
|
||||
/**
|
||||
* 消息action code
|
||||
*/
|
||||
public final MessagePad.MessageType typeCode;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
public final String desc;
|
||||
|
||||
MessageType(String typeName, MessagePad.MessageType typeCode, String desc) {
|
||||
this.typeName = typeName;
|
||||
this.typeCode = typeCode;
|
||||
this.desc = desc;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des 上下文管理
|
||||
* @date 2019/5/13
|
||||
*/
|
||||
public class MgContextUtils {
|
||||
/**
|
||||
* 上下文
|
||||
*/
|
||||
private static Context mContext;
|
||||
|
||||
/**
|
||||
* 设置上下文
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public static void setContext(Context context) {
|
||||
mContext = context.getApplicationContext();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上下文
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
/**
|
||||
* Created by goldze on 2017/6/19.
|
||||
* 正则相关工具类
|
||||
*/
|
||||
public final class RegexUtils {
|
||||
public static final String REGEX_IP = "((2[0-4]\\d|25[0-5]|[01]?\\d\\d?)\\.){3}(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)";
|
||||
|
||||
private RegexUtils() {
|
||||
throw new UnsupportedOperationException("u can't instantiate me...");
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否匹配正则
|
||||
*
|
||||
* @param regex 正则表达式
|
||||
* @param input 要匹配的字符串
|
||||
* @return {@code true}: 匹配<br>{@code false}: 不匹配
|
||||
*/
|
||||
public static boolean isMatch(final String regex, final CharSequence input) {
|
||||
return input != null && input.length() > 0 && Pattern.matches(regex, input);
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证IP地址
|
||||
*
|
||||
* @param input 待验证文本
|
||||
* @return {@code true}: 匹配<br>{@code false}: 不匹配
|
||||
*/
|
||||
public static boolean isIP(final CharSequence input) {
|
||||
return isMatch(REGEX_IP, input);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 到站提醒 自动驾驶站点
|
||||
*/
|
||||
public class ArrivalNotificationMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.ArrivalNotification arrivalNotification = MessagePad.ArrivalNotification.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onArrivalNotification(header, arrivalNotification);
|
||||
CupidLogUtils.e("到站提醒--->" + arrivalNotification.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 自动驾驶状态
|
||||
*/
|
||||
public class AutopilotStateMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.AutopilotState autopilotState = MessagePad.AutopilotState.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onAutopilotState(header, autopilotState);
|
||||
CupidLogUtils.e("自动驾驶状态--->" + autopilotState.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 自动驾驶设备基础信息请求
|
||||
*/
|
||||
public class BasicInfoReqMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.BasicInfoReq autopilotState = MessagePad.BasicInfoReq.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onBasicInfoReq(header, autopilotState);
|
||||
CupidLogUtils.e("自动驾驶设备基础信息请求--->" + autopilotState.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 车机基础信息应答
|
||||
*/
|
||||
public class CarConfigRespMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.CarConfigResp carConfigResp = MessagePad.CarConfigResp.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onCarConfigResp(header, carConfigResp);
|
||||
CupidLogUtils.e("车机基础信息应答--->" + carConfigResp.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 自动驾驶路径应答
|
||||
*/
|
||||
public class GlobalPathRespMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.GlobalPathResp globalPathResp = MessagePad.GlobalPathResp.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onGlobalPathResp(header, globalPathResp);
|
||||
CupidLogUtils.e("自动驾驶路径应答--->" + globalPathResp.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 惯导信息
|
||||
*/
|
||||
public class GnssInfoMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.GnssInfo trajectory = MessagePad.GnssInfo.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onGnssInfo(header, trajectory);
|
||||
CupidLogUtils.e("惯导信息--->" + trajectory.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
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.queue.UdpMsgModel;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
@@ -17,6 +19,6 @@ public interface IMsg {
|
||||
*/
|
||||
void handlerMsg(Gson gson, OnAdasListener adasListener, String msg);
|
||||
|
||||
void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg);
|
||||
void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* 生产产品的工厂
|
||||
*/
|
||||
public interface IMyMessageFactory {
|
||||
/**
|
||||
*
|
||||
* @param messageType 消息类型
|
||||
* @return
|
||||
*/
|
||||
public IMsg createMessage(String messageType);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param messageCode 消息类型
|
||||
* @return
|
||||
*/
|
||||
public IMsg createMessage(int messageCode);
|
||||
public IMsg createMessage(MessagePad.MessageType messageCode);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.zhidao.support.adas.high.common.MessageType;
|
||||
|
||||
import com.zhidao.support.adas.high.common.ActionTypeReceive;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
@@ -10,224 +10,123 @@ import com.zhidao.support.adas.high.common.ActionTypeReceive;
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class MyMessageFactory implements IMyMessageFactory {
|
||||
/**
|
||||
* udp 渲染 image
|
||||
*/
|
||||
private IMsg udpRenderImageMsg;
|
||||
/**
|
||||
* ws 报警 消息
|
||||
*/
|
||||
private IMsg wsWarnMessage;
|
||||
/**
|
||||
* ws 图像size
|
||||
*/
|
||||
private IMsg wsImageSizeMessage;
|
||||
/**
|
||||
* 空实现
|
||||
*/
|
||||
private IMsg nuImplMessage;
|
||||
/**
|
||||
* udp 车辆状态消息
|
||||
*/
|
||||
private IMsg udpCarStateMessage;
|
||||
/**
|
||||
* 红绿灯状态
|
||||
*/
|
||||
private IMsg udpLightStateMessage;
|
||||
/**
|
||||
* 周边物体的状态
|
||||
*/
|
||||
private IMsg udpObstaclesMessage;
|
||||
|
||||
/**
|
||||
* 局部轨迹消息
|
||||
*/
|
||||
private IMsg trajectoryMessage;
|
||||
private IMsg trajectoryMessage;//局部轨迹消息
|
||||
private IMsg trackedObjectsMessage;//障碍物信息
|
||||
private IMsg gnssInfoMessage;//惯导信息
|
||||
private IMsg vehicleStateMessage;//底盘信息, 透传底盘状态,pb参考底盘
|
||||
private IMsg autopilotStateMessage;//自动驾驶状态
|
||||
private IMsg reportMessage;//监控事件报告
|
||||
|
||||
/**
|
||||
* 监控信息
|
||||
*/
|
||||
private IMsg guardianMessage;
|
||||
/**
|
||||
* 车道线渲染
|
||||
*/
|
||||
private IMsg lanesMessage;
|
||||
/**
|
||||
* 自动驾驶状态
|
||||
*/
|
||||
private IMsg autopilotStatusMessage;
|
||||
/**
|
||||
* 自动驾驶到站
|
||||
*/
|
||||
private IMsg autopilotArriveMessage;
|
||||
/**
|
||||
* 自动驾驶路径
|
||||
*/
|
||||
private IMsg autopilotRouteMessage;
|
||||
/**
|
||||
* 工控机获取SN
|
||||
*/
|
||||
private IMsg autopilotSNMessage;
|
||||
/**
|
||||
* 数据采集信息
|
||||
*/
|
||||
private IMsg autopilotIdentify;
|
||||
/**
|
||||
* 工控机升级状态
|
||||
*/
|
||||
private IMsg autopilotUpgradeStatusMessage;
|
||||
/**
|
||||
* car dock 基础信息
|
||||
*/
|
||||
private IMsg autopilotConfig;
|
||||
private IMsg basicInfoReqMessage;//自动驾驶设备基础信息请求
|
||||
private IMsg carConfigRespMessage;//车机基础信息应答
|
||||
private IMsg recordResultMessage;//数据采集结果
|
||||
private IMsg globalPathRespMessage;//自动驾驶路径应答
|
||||
private IMsg warnMessage;//预警数据
|
||||
private IMsg arrivalNotificationMessage;//到站提醒
|
||||
|
||||
|
||||
private IMsg nuImplMessage;//空实现
|
||||
private IMsg autopilotUpgradeStatusMessage;//工控机升级状态
|
||||
|
||||
|
||||
@Override
|
||||
public IMsg createMessage(String messageType) {
|
||||
if (TextUtils.isEmpty(messageType)) {
|
||||
if (nuImplMessage == null) {
|
||||
nuImplMessage = new NuImplMessage();
|
||||
}
|
||||
return nuImplMessage;
|
||||
}
|
||||
if (messageType.equals(ActionTypeReceive.ACTION_WS_MSG_RENDER_TYPE.getmActionType())) {
|
||||
//udp render
|
||||
if (udpRenderImageMsg == null) {
|
||||
udpRenderImageMsg = new UdpRenderImageMessage();
|
||||
}
|
||||
return udpRenderImageMsg;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_MSG_WARNING_TYPE.getmActionType())) {
|
||||
//ws 报警消息
|
||||
if (wsWarnMessage == null) {
|
||||
wsWarnMessage = new WsWarnMessage();
|
||||
}
|
||||
return wsWarnMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_MSG_IMAGE_SIZE_TYPE.getmActionType())) {
|
||||
//ws 报警消息
|
||||
if (wsImageSizeMessage == null) {
|
||||
wsImageSizeMessage = new WsImageSizeMessage();
|
||||
}
|
||||
return wsImageSizeMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_CAR_STATE_TYPE.getmActionType())) {
|
||||
//udp 车辆消息
|
||||
if (udpCarStateMessage == null) {
|
||||
udpCarStateMessage = new UdpCarStateMessage();
|
||||
}
|
||||
return udpCarStateMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_UDP_LIGHT_STATE_TYPE.getmActionType())) {
|
||||
//udp 红绿灯状态
|
||||
if (udpLightStateMessage == null) {
|
||||
udpLightStateMessage = new UdpLightStateMessage();
|
||||
}
|
||||
return udpLightStateMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_OBSTACLES_MESSAGE_TYPE.getmActionType())) {
|
||||
//udp 周边物体的状态
|
||||
if (udpObstaclesMessage == null) {
|
||||
udpObstaclesMessage = new UdpObstaclesMessage();
|
||||
}
|
||||
return udpObstaclesMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_LANES_MESSAGE_TYPE.getmActionType())) {
|
||||
// 车道线渲染
|
||||
if (lanesMessage == null) {
|
||||
lanesMessage = new UdpLanesMessage();
|
||||
}
|
||||
return lanesMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_AUTOPILOT_STATUE.getmActionType())) {
|
||||
//ws 自动驾驶状态
|
||||
if (autopilotStatusMessage == null) {
|
||||
autopilotStatusMessage = new WsAutopilotStatusMessage();
|
||||
}
|
||||
return autopilotStatusMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_AUTOPILOT_WAY_ARRIVE.getmActionType())) {
|
||||
//自送驾驶到站
|
||||
if (autopilotArriveMessage == null) {
|
||||
autopilotArriveMessage = new WsAutopilotArriveMessage();
|
||||
}
|
||||
return autopilotArriveMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_AUTOPILOT_ROUTE.getmActionType())) {
|
||||
//自动驾驶路径
|
||||
if (autopilotRouteMessage == null) {
|
||||
autopilotRouteMessage = new WsAutopilotRouteMessage();
|
||||
}
|
||||
return autopilotRouteMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_AUTOPILOT_SN_REQUEST.getmActionType())) {
|
||||
//工控机获取sn
|
||||
if (autopilotSNMessage == null) {
|
||||
autopilotSNMessage = new WsAutopilotSNMessage();
|
||||
}
|
||||
return autopilotSNMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_AUTOPILOT_IDENTIFY.getmActionType())) {
|
||||
//数据采集信息
|
||||
if (autopilotIdentify == null) {
|
||||
autopilotIdentify = new WsAutopilotIdentify();
|
||||
}
|
||||
return autopilotIdentify;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_AUTOPILOT_TRAJECTORY.getmActionType())) {
|
||||
//局部轨迹
|
||||
if (trajectoryMessage == null) {
|
||||
trajectoryMessage = new WsAutopilotTrajectoryMessage();
|
||||
}
|
||||
return trajectoryMessage;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_AUTOPILOT_CAR_CONFIG.getmActionType())) {
|
||||
//dock config
|
||||
if (autopilotConfig == null) {
|
||||
autopilotConfig = new WsAutopilotConfig();
|
||||
}
|
||||
return autopilotConfig;
|
||||
} else if (messageType.equals(ActionTypeReceive.ACTION_WS_AUTOPILOT_UPGRADE_STATUS.getmActionType())) {
|
||||
if (MessageType.TYPE_RECEIVE_IPC_UPGRADE_STATUS.typeName.equals(messageType)) {
|
||||
//ws 工控机升级状态
|
||||
if (autopilotUpgradeStatusMessage == null) {
|
||||
autopilotUpgradeStatusMessage = new WsAutopilotUpgradeStatusMessage();
|
||||
}
|
||||
return autopilotUpgradeStatusMessage;
|
||||
}
|
||||
|
||||
if (nuImplMessage == null) {
|
||||
nuImplMessage = new NuImplMessage();
|
||||
}
|
||||
return nuImplMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMsg createMessage(int messageCode) {
|
||||
if (messageCode == 0) {
|
||||
} else {
|
||||
if (nuImplMessage == null) {
|
||||
nuImplMessage = new NuImplMessage();
|
||||
}
|
||||
return nuImplMessage;
|
||||
}
|
||||
if (messageCode == ActionTypeReceive.ACTION_WS_MSG_RENDER_TYPE.getmActionCode()) {
|
||||
//感知数据
|
||||
if (udpRenderImageMsg == null) {
|
||||
udpRenderImageMsg = new UdpRenderImageMessage();
|
||||
}
|
||||
return udpRenderImageMsg;
|
||||
} else if (messageCode == ActionTypeReceive.ACTION_WS_CAR_STATE_TYPE.getmActionCode()) {
|
||||
//定位数据
|
||||
if (udpCarStateMessage == null) {
|
||||
udpCarStateMessage = new UdpCarStateMessage();
|
||||
}
|
||||
return udpCarStateMessage;
|
||||
} else if (messageCode == (ActionTypeReceive.ACTION_WS_AUTOPILOT_TRAJECTORY.getmActionCode())) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMsg createMessage(MessagePad.MessageType messageType) {
|
||||
|
||||
if (messageType == MessageType.TYPE_RECEIVE_TRAJECTORY.typeCode) {
|
||||
//局部轨迹
|
||||
if (trajectoryMessage == null) {
|
||||
trajectoryMessage = new WsAutopilotTrajectoryMessage();
|
||||
trajectoryMessage = new TrajectoryMessage();
|
||||
}
|
||||
return trajectoryMessage;
|
||||
} else if (messageCode == (ActionTypeReceive.ACTION_WS_AUTOPILOT_ROUTES.getmActionCode())) {
|
||||
//轨迹列表
|
||||
|
||||
} else if (messageCode == (ActionTypeReceive.ACTION_WS_AUTOPILOT_GUARDIAN.getmActionCode())) {
|
||||
//监控信息
|
||||
if (guardianMessage == null) {
|
||||
guardianMessage = new WsAutopilotGuardian();
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_TRACKED_OBJECTS.typeCode) {
|
||||
//感知数据 障碍物信息 他车数据
|
||||
if (trackedObjectsMessage == null) {
|
||||
trackedObjectsMessage = new TrackedObjectsMessage();
|
||||
}
|
||||
return guardianMessage;
|
||||
return trackedObjectsMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_GNSS_INFO.typeCode) {
|
||||
//惯导信息
|
||||
if (gnssInfoMessage == null) {
|
||||
gnssInfoMessage = new GnssInfoMessage();
|
||||
}
|
||||
return gnssInfoMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_VEHICLE_STATE.typeCode) {
|
||||
//底盘信息, 透传底盘状态,pb参考底盘
|
||||
if (vehicleStateMessage == null) {
|
||||
vehicleStateMessage = new VehicleStateMessage();
|
||||
}
|
||||
return vehicleStateMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_AUTOPILOT_STATE.typeCode) {
|
||||
//自动驾驶状态
|
||||
if (autopilotStateMessage == null) {
|
||||
autopilotStateMessage = new AutopilotStateMessage();
|
||||
}
|
||||
return autopilotStateMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_REPORT_MESSAGE.typeCode) {
|
||||
//监控事件报告
|
||||
if (reportMessage == null) {
|
||||
reportMessage = new ReportMessage();
|
||||
}
|
||||
return reportMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_BASIC_INFO_REQ.typeCode) {
|
||||
//自动驾驶设备基础信息请求
|
||||
if (basicInfoReqMessage == null) {
|
||||
basicInfoReqMessage = new BasicInfoReqMessage();
|
||||
}
|
||||
return basicInfoReqMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_CAR_CONFIG_RESP.typeCode) {
|
||||
//车机基础信息应答
|
||||
if (carConfigRespMessage == null) {
|
||||
carConfigRespMessage = new CarConfigRespMessage();
|
||||
}
|
||||
return carConfigRespMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_RECORD_RESULT.typeCode) {
|
||||
//数据采集结果
|
||||
if (recordResultMessage == null) {
|
||||
recordResultMessage = new RecordResultMessage();
|
||||
}
|
||||
return recordResultMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_GLOBAL_PATH_RESP.typeCode) {
|
||||
//自动驾驶路径应答
|
||||
if (globalPathRespMessage == null) {
|
||||
globalPathRespMessage = new GlobalPathRespMessage();
|
||||
}
|
||||
return globalPathRespMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_WARN.typeCode) {
|
||||
//预警数据
|
||||
if (warnMessage == null) {
|
||||
warnMessage = new WarnMessage();
|
||||
}
|
||||
return warnMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_ARRIVAL_NOTIFICATION.typeCode) {
|
||||
//到站提醒
|
||||
if (arrivalNotificationMessage == null) {
|
||||
arrivalNotificationMessage = new ArrivalNotificationMessage();
|
||||
}
|
||||
return arrivalNotificationMessage;
|
||||
} else {
|
||||
//MessageType.TYPE_DEFAULT.typeCode
|
||||
if (nuImplMessage == null) {
|
||||
nuImplMessage = new NuImplMessage();
|
||||
}
|
||||
return nuImplMessage;
|
||||
}
|
||||
if (nuImplMessage == null) {
|
||||
nuImplMessage = new NuImplMessage();
|
||||
}
|
||||
return nuImplMessage;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
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.queue.UdpMsgModel;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
@@ -17,7 +19,9 @@ public class NuImplMessage extends MyAbstractMessageHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
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 record_cache.RecordPanelOuterClass;
|
||||
|
||||
/**
|
||||
* 数据采集结果
|
||||
*/
|
||||
public class RecordResultMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
RecordPanelOuterClass.RecordPanel recordPanel = RecordPanelOuterClass.RecordPanel.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onRecordResult(header, recordPanel);
|
||||
CupidLogUtils.e("数据采集结果--->" + recordPanel.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 监控事件报告
|
||||
*/
|
||||
public class ReportMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MogoReportMsg.MogoReportMessage mogoReportMessage = MogoReportMsg.MogoReportMessage.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onReportMessage(header, mogoReportMessage);
|
||||
CupidLogUtils.e("到站提醒--->" + mogoReportMessage.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des 障碍物信息 他车数据
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class TrackedObjectsMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.TrackedObjects trackedObjects = MessagePad.TrackedObjects.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onTrackedObjects(header, trackedObjects);
|
||||
CupidLogUtils.e("障碍物--->" + trackedObjects.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 自动驾驶局部轨迹 前车引导线
|
||||
*/
|
||||
public class TrajectoryMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.Trajectory trajectory = MessagePad.Trajectory.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onTrajectory(header, trajectory);
|
||||
CupidLogUtils.e("自动驾驶局部轨迹 前车引导线--->" + trajectory.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
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.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.status.CarStatus;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des udp 车辆状态
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class UdpCarStateMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
CupidLogUtils.w("CarStateData", "===>carStateInfo" + adasListener);
|
||||
CarStateInfo carStateInfo = gson.fromJson(msg, CarStateInfo.class);
|
||||
// String satelliteTime = carStateInfo.getValues().getSatelliteTime();
|
||||
// long systemTime = System.currentTimeMillis();
|
||||
// Date date = BaseTimeUtils.localToUTC(String.valueOf(System.currentTimeMillis()));
|
||||
// long time = date.getTime();
|
||||
// long l = Long.parseLong(satelliteTime)-time;
|
||||
// CupidLogUtils.w("CarStateData", "carStateInfo2 pad system time="+systemTime);
|
||||
// CupidLogUtils.w("CarStateData", "carStateInfo2 pad utc time=" + time);
|
||||
// CupidLogUtils.w("CarStateData", "carStateInfo2 gkj utc time=" + satelliteTime);
|
||||
// CupidLogUtils.w("CarStateData", "carStateInfo2 time difference=" + l);
|
||||
if (adasListener != null) {
|
||||
adasListener.onCarStateData(carStateInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
try {
|
||||
long time = System.currentTimeMillis();
|
||||
CarStatus.Status status = CarStatus.Status.parseFrom(msg);
|
||||
if (status != null) {
|
||||
CarStateInfo carStateInfo = new CarStateInfo();
|
||||
carStateInfo.setAction("state");
|
||||
CarStateInfo.ValuesBean values = new CarStateInfo.ValuesBean();
|
||||
values.setLon(status.getLon());
|
||||
values.setLat(status.getLat());
|
||||
values.setAlt(status.getAlt());
|
||||
values.setHeading(status.getHeading());
|
||||
values.setAcceleration(status.getAcceleration());
|
||||
values.setYaw_rate(status.getYawRate());
|
||||
values.setGnss_speed(status.getGnssSpeed());
|
||||
values.setVehicle_speed(status.getVehicleSpeed());
|
||||
values.setSatelliteTime(status.getSatelliteTime());
|
||||
values.setSystemTime(status.getSystemTime());
|
||||
values.setTurn_light(status.getTurnLight());
|
||||
values.setFlash_light(status.getFlashLight());
|
||||
values.setBrake_light(status.getBrakeLight());
|
||||
values.setFrame_num(status.getFrameNum());
|
||||
values.setReceiverDataTime(time);
|
||||
carStateInfo.setValues(values);
|
||||
setTurnLightState(values);
|
||||
if (adasListener != null) {
|
||||
adasListener.onCarStateData(carStateInfo);
|
||||
CupidLogUtils.w("UdpCarStateMessage", "" + carStateInfo.toString());
|
||||
}
|
||||
}
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析转向灯
|
||||
*/
|
||||
private int turnLightTimes = 0;
|
||||
private boolean isOnTurnLight = false;
|
||||
private int turnLight = 0;
|
||||
|
||||
public void setTurnLightState(CarStateInfo.ValuesBean values) {
|
||||
int turn_light = values.getTurn_light();
|
||||
if (turn_light == 0) {
|
||||
if (isOnTurnLight) {
|
||||
if (turnLightTimes >= 10) {
|
||||
isOnTurnLight = false;
|
||||
turnLight = 0;
|
||||
}
|
||||
turnLightTimes++;
|
||||
}
|
||||
} else if (turn_light == 1) {
|
||||
turnLightTimes = 0;
|
||||
isOnTurnLight = true;
|
||||
turnLight = 1;
|
||||
} else if (turn_light == 2) {
|
||||
turnLightTimes = 0;
|
||||
isOnTurnLight = true;
|
||||
turnLight = 2;
|
||||
}
|
||||
values.setTurnLightOften(turnLight);
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.CarLaneInfo;
|
||||
import com.zhidao.support.adas.high.queue.UdpMsgModel;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des udp 车道线渲染
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class UdpLanesMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
//udp 车道线渲染
|
||||
CarLaneInfo carLaneInfo = gson.fromJson(msg, CarLaneInfo.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.onCarLaneInfo(carLaneInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.CarStateInfo;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.queue.UdpMsgModel;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des udp 红绿灯状态
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class UdpLightStateMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
//udp 红绿灯状态
|
||||
LightStatueInfo lightStatueInfo = gson.fromJson(msg, LightStatueInfo.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.onLightStateData(lightStatueInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.LightStatueInfo;
|
||||
import com.zhidao.support.adas.high.bean.ObstaclesInfo;
|
||||
import com.zhidao.support.adas.high.queue.UdpMsgModel;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des udp 周边物体渲染
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class UdpObstaclesMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
//udp 周边物体渲染
|
||||
ObstaclesInfo obstaclesInfo = gson.fromJson(msg, ObstaclesInfo.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.onObstaclesInfo(obstaclesInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
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.bean.RectInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import adas.Adas;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des udp渲染
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class UdpRenderImageMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
//渲染图像流
|
||||
RectInfo rectInfo = gson.fromJson(msg, RectInfo.class);
|
||||
CupidLogUtils.e("UdpRenderImageMessage--->json:num = " + rectInfo.getModels().size());
|
||||
if (adasListener != null) {
|
||||
adasListener.onRectData(rectInfo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
Adas.ViwesMsg viewMsg = null;
|
||||
try {
|
||||
viewMsg = Adas.ViwesMsg.parseFrom(msg);
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
CupidLogUtils.e("UdpRenderImageMessage--->protoBuf Exception:" + e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (viewMsg != null) {
|
||||
if (TextUtils.equals(viewMsg.getAction(), "view")) {
|
||||
RectInfo rectInfo = new RectInfo();
|
||||
rectInfo.setAction(viewMsg.getAction());
|
||||
ArrayList<RectInfo.RectBean> rectBeans = new ArrayList<>();
|
||||
for (int i = 0; i < viewMsg.getModelsList().size(); i++) {
|
||||
RectInfo.RectBean rectBean = new RectInfo.RectBean();
|
||||
rectBean.setYt(viewMsg.getModels(i).getYt());
|
||||
rectBean.setYb(viewMsg.getModels(i).getYb());
|
||||
rectBean.setXr(viewMsg.getModels(i).getXr());
|
||||
rectBean.setXl(viewMsg.getModels(i).getXl());
|
||||
rectBean.setDistance_x(viewMsg.getModels(i).getDistanceX());
|
||||
rectBean.setDistance_y(viewMsg.getModels(i).getDistanceY());
|
||||
rectBean.setType(viewMsg.getModels(i).getType());
|
||||
rectBean.setLat(viewMsg.getModels(i).getLat());
|
||||
rectBean.setLon(viewMsg.getModels(i).getLon());
|
||||
rectBean.setHeading(viewMsg.getModels(i).getHeading());
|
||||
rectBean.setSystemTime(viewMsg.getModels(i).getSystemTime());
|
||||
rectBean.setSatelliteTime(viewMsg.getModels(i).getSatelliteTime());
|
||||
rectBean.setAlt(viewMsg.getModels(i).getAlt());
|
||||
rectBean.setCarId(viewMsg.getModels(i).getCarId());
|
||||
rectBean.setUuid(viewMsg.getModels(i).getUuid());
|
||||
rectBean.setColor(viewMsg.getModels(i).getColor());
|
||||
rectBean.setSpeed(viewMsg.getModels(i).getSpeed());
|
||||
rectBean.setDrawlevel(viewMsg.getModels(i).getDrawlevel());
|
||||
rectBean.setLength(viewMsg.getModels(i).getLength());
|
||||
rectBean.setWidth(viewMsg.getModels(i).getWidth());
|
||||
rectBean.setHeight(viewMsg.getModels(i).getHeight());
|
||||
rectBean.setDriverTime(viewMsg.getModels(i).getDriverTime());
|
||||
// if (viewMsg.getModels(i).getDriverTime()!=null){
|
||||
// String s16 = conversionTime(viewMsg.getModels(i).getDriverTime());
|
||||
// if (s16!=null){
|
||||
// CupidLogUtils.e("UdpRenderImageMessage--->time===>s16=" + s16);
|
||||
// String s13 = s16.substring(0, 13);
|
||||
// CupidLogUtils.e("UdpRenderImageMessage--->time===>s13=" + s13);
|
||||
// rectBean.setDriverTime(s13);
|
||||
// }else {
|
||||
// rectBean.setDriverTime(viewMsg.getModels(i).getDriverTime());
|
||||
// }
|
||||
// }
|
||||
rectBeans.add(rectBean);
|
||||
}
|
||||
rectInfo.setModels(rectBeans);
|
||||
if (adasListener != null) {
|
||||
adasListener.onRectData(rectInfo);
|
||||
CupidLogUtils.e("UdpRenderImageMessage--->protoBuf===>:rectInfo = " + rectInfo.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String conversionTime(String str) {
|
||||
StringBuffer stringBuffer = new StringBuffer("");
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
if (str.charAt(i) != '.') {
|
||||
stringBuffer.append(str.charAt(i));
|
||||
}
|
||||
}
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 底盘信息, 透传底盘状态,pb参考底盘
|
||||
*/
|
||||
public class VehicleStateMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
VehicleStateOuterClass.VehicleState vehicleState = VehicleStateOuterClass.VehicleState.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onVehicleState(header, vehicleState);
|
||||
CupidLogUtils.e("惯导信息--->" + vehicleState.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 预警数据
|
||||
*/
|
||||
@Deprecated
|
||||
public class WarnMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
MessagePad.Warn warn = MessagePad.Warn.parseFrom(msg);
|
||||
if (adasListener != null) {
|
||||
adasListener.onWarn(header, warn);
|
||||
CupidLogUtils.e("自动驾驶路径应答--->" + warn.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotWayArrive;
|
||||
import com.zhidao.support.adas.high.queue.UdpMsgModel;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des ws自动驾驶到站
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class WsAutopilotArriveMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
//ws 自动驾驶状态
|
||||
AutopilotWayArrive autopilotWayArrive = gson.fromJson(msg, AutopilotWayArrive.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.autopilotArrive(autopilotWayArrive);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AdasConfig;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotConfig;
|
||||
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
|
||||
import com.zhidao.support.adas.high.common.AppPreferenceHelper;
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.MgContextUtils;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/11/17
|
||||
*/
|
||||
public class WsAutopilotConfig extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
AutopilotConfig autopilotConfig = gson.fromJson(msg, AutopilotConfig.class);
|
||||
AutopilotConfig.ResultBean result = autopilotConfig.getResult();
|
||||
if (result!=null){
|
||||
String dockVersion = result.getDock_version();
|
||||
AppPreferenceHelper.getInstance(MgContextUtils.getContext()).saveDockConfig(dockVersion);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.google.protobuf.util.JsonFormat;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.guardian.AutopilotGuardianInfo;
|
||||
import com.zhidao.support.adas.high.bean.guardian.GuardianItemsName;
|
||||
import com.zhidao.support.adas.high.bean.guardian.GuardianModule;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mogo.guardian.MogoGuardian;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/7/7
|
||||
*/
|
||||
public class WsAutopilotGuardian extends MyAbstractMessageHandler{
|
||||
private final JsonFormat.Printer printer = JsonFormat.printer();
|
||||
private AutopilotGuardianInfo info;
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
// CupidLogUtils.w("WsAutopilotGuardian===>"+msg);
|
||||
AutopilotGuardianInfo autopilotGuardian = gson.fromJson(msg, AutopilotGuardianInfo.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.onAutopilotGuardian(autopilotGuardian);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
try {
|
||||
MogoGuardian.GuardianProto proto = MogoGuardian.GuardianProto.parseFrom(msg);
|
||||
String print = printer.print(proto);
|
||||
info = gson.fromJson(print, AutopilotGuardianInfo.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.onAutopilotGuardian(info);
|
||||
CupidLogUtils.w("WsAutopilotGuardian===>"+ info.toString());
|
||||
|
||||
}
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.record.AutopilotIdentifyInfo;
|
||||
import com.zhidao.support.adas.high.bean.record.AutopilotRecordResult;
|
||||
import com.zhidao.support.adas.high.common.HandlerThreadManager;
|
||||
import com.zhidao.support.adas.high.common.MgContextUtils;
|
||||
import com.zhidao.support.recorder.RecordDataManager;
|
||||
import com.zhidao.support.recorder.activity.LoginSftpActivity;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/7/7
|
||||
*/
|
||||
public class WsAutopilotIdentify extends MyAbstractMessageHandler {
|
||||
private static final int SHOW_RECORDER = 0x01;
|
||||
private boolean isConnect = false;
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
AutopilotIdentifyInfo info = gson.fromJson(msg, AutopilotIdentifyInfo.class);
|
||||
AutopilotIdentifyInfo.Result result = info.getResult();
|
||||
AutopilotRecordResult panel = result.getPanel();
|
||||
if (adasListener != null) {
|
||||
adasListener.onAutopilotRecord(panel);
|
||||
}
|
||||
// if (panel!=null){
|
||||
// int stat = panel.getStat();
|
||||
// if (stat==1){
|
||||
// final String user = result.getUser();
|
||||
// final String passwd = result.getPasswd();
|
||||
// String timestamp = panel.getTimestamp();
|
||||
// final String udpClientAddress = AppPreferenceHelper.getInstance(MgContextUtils.getContext()).getUdpClientAddress();
|
||||
// if (TextUtils.isEmpty(user) || TextUtils.isEmpty(passwd) || TextUtils.isEmpty(udpClientAddress)) {
|
||||
// CupidLogUtils.w("ftp message error");
|
||||
// return;
|
||||
// }
|
||||
// RecordDataManager.getInstance().init(MgContextUtils.getContext(),timestamp , udpClientAddress, 22, user, passwd);
|
||||
// isConnect = RecordDataManager.getInstance().connectSftp();
|
||||
// handler.removeMessages(SHOW_RECORDER);
|
||||
// handler.sendEmptyMessage(SHOW_RECORDER);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
|
||||
private Handler handler = new Handler(HandlerThreadManager.getMainHandler().getLooper()) {
|
||||
@Override
|
||||
public void handleMessage(Message msg) {
|
||||
super.handleMessage(msg);
|
||||
if (isConnect) {
|
||||
RecordDataManager.getInstance().record();
|
||||
} else {
|
||||
Intent intent = new Intent(MgContextUtils.getContext(), LoginSftpActivity.class);
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
MgContextUtils.getContext().startActivity(intent);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotRoute;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
/**
|
||||
* 自动驾驶路径
|
||||
*/
|
||||
public class WsAutopilotRouteMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
// CupidLogUtils.w("WsAutopilotRouteMessage===>"+msg);
|
||||
AutopilotRoute autopilotRoute = gson.fromJson(msg, AutopilotRoute.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.onAutopilotRoute(autopilotRoute);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
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.bean.AutopilotTrajectory;
|
||||
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.trajectory.TrajectoryOuterClass;
|
||||
|
||||
/**
|
||||
* 自动驾驶路径
|
||||
*/
|
||||
public class WsAutopilotRoutesMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotSnRequest;
|
||||
|
||||
/**
|
||||
* 自动驾驶路径
|
||||
*/
|
||||
public class WsAutopilotSNMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
// CupidLogUtils.w("WsAutopilotSNMessage===>"+msg);
|
||||
AutopilotSnRequest autopilotSn = gson.fromJson(msg, AutopilotSnRequest.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.onAutopilotSNRequest();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.AutopilotStatus;
|
||||
import com.zhidao.support.adas.high.queue.UdpMsgModel;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des ws自动驾驶状态
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class WsAutopilotStatusMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
//ws 自动驾驶状态
|
||||
AutopilotStatus autopilotStatus = gson.fromJson(msg, AutopilotStatus.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.autopilotStatus(autopilotStatus);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
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.bean.AutopilotTrajectory;
|
||||
import com.zhidao.support.adas.high.bean.TrajectoryInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.trajectory.TrajectoryOuterClass;
|
||||
|
||||
/**
|
||||
* 自动驾驶路径
|
||||
*/
|
||||
public class WsAutopilotTrajectoryMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
CupidLogUtils.w("WsAutopilotTrajectoryMessage===>" + msg);
|
||||
AutopilotTrajectory trajectory = gson.fromJson(msg, AutopilotTrajectory.class);
|
||||
if (adasListener != null) {
|
||||
adasListener.onAutopilotTrajectory(trajectory.getModels());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
try {
|
||||
TrajectoryOuterClass.Trajectory trajectory = TrajectoryOuterClass.Trajectory.parseFrom(msg);
|
||||
List<TrajectoryOuterClass.TrajectoryPoint> pointsList = trajectory.getPointsList();
|
||||
ArrayList<TrajectoryInfo> trajectoryInfos = new ArrayList<>();
|
||||
for (int i = 0; i < pointsList.size(); i++) {
|
||||
TrajectoryOuterClass.TrajectoryPoint point = pointsList.get(i);
|
||||
TrajectoryInfo trajectoryInfo = new TrajectoryInfo();
|
||||
trajectoryInfo.setLon(point.getX());
|
||||
trajectoryInfo.setLat(point.getY());
|
||||
trajectoryInfo.setAlt(point.getZ());
|
||||
trajectoryInfo.setTime(point.getT());
|
||||
trajectoryInfo.setVelocity(point.getV());
|
||||
trajectoryInfo.setAcceleration(point.getA());
|
||||
trajectoryInfo.setTheta(point.getTheta());
|
||||
trajectoryInfo.setKappa(point.getKappa());
|
||||
trajectoryInfo.setAccumulatedDis(point.getS());
|
||||
trajectoryInfos.add(trajectoryInfo);
|
||||
}
|
||||
if (adasListener != null) {
|
||||
adasListener.onAutopilotTrajectory(trajectoryInfos);
|
||||
CupidLogUtils.e("WsAutopilotTrajectoryMessage--->" + trajectoryInfos.toString());
|
||||
}
|
||||
} catch (InvalidProtocolBufferException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,18 @@
|
||||
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.bean.IPCUpgradeStateInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
/**
|
||||
* @des 工控机升级状态
|
||||
* @des 工控机升级状态 之后版本会被替换成PB格式
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
@Deprecated
|
||||
public class WsAutopilotUpgradeStatusMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
@@ -21,7 +25,9 @@ public class WsAutopilotUpgradeStatusMessage extends MyAbstractMessageHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
public void handlerMsg(MessagePad.Header header, byte[] msg, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.queue.UdpMsgModel;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des 图像大小
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class WsImageSizeMessage extends MyAbstractMessageHandler {
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
JSONObject jsonObject = null;
|
||||
try {
|
||||
jsonObject = new JSONObject(msg);
|
||||
JSONObject videoInfo = jsonObject.optJSONObject("values");
|
||||
if (videoInfo != null) {
|
||||
int width = videoInfo.optInt("width");
|
||||
int height = videoInfo.optInt("height");
|
||||
CupidLogUtils.e("--->width" + width + ",height" + height);
|
||||
if (adasListener != null) {
|
||||
adasListener.onVideoSize(width, height);
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.queue.UdpMsgModel;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* @author nie yunlong
|
||||
* @des 报警消息
|
||||
* @date 2020/3/12
|
||||
*/
|
||||
public class WsWarnMessage extends MyAbstractMessageHandler {
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, String msg) {
|
||||
try {
|
||||
JSONObject jsonObject = new JSONObject(msg);
|
||||
JSONObject warning = jsonObject.optJSONObject("values");
|
||||
if (warning != null) {
|
||||
String type = warning.optString("type");
|
||||
String content = warning.optString("content");
|
||||
String value = warning.optString("value");
|
||||
String level = warning.optString("level");
|
||||
CupidLogUtils.e(String.format("--->type:%s, content:%s, value:%s, level:%s", type, content, value, level));
|
||||
if (adasListener != null) {
|
||||
adasListener.onWarnMessage(new WarnMessageInfo(type, content, value, level));
|
||||
}
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(Gson gson, OnAdasListener adasListener, byte[] msg) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.zhidao.support.adas.high.protocol;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/20
|
||||
*/
|
||||
public class DefaultMessageProtocol implements IMessageProtocol {
|
||||
/**
|
||||
* MC 2字节
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getMagicCodeLength() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 偏移量 2字节
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getOffsetLength() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据包总长度 4字节
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getPackageLength() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* MC+偏移量+数据包总长度
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getOutHeader() {
|
||||
return getMagicCodeLength() + getPackageLength() + getOffsetLength();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Header 长度
|
||||
*
|
||||
* @param offsetValue
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int getHeaderLength(int offsetValue) {
|
||||
if (offsetValue == 0) {
|
||||
return offsetValue;
|
||||
}
|
||||
return offsetValue - getOutHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据长度
|
||||
*
|
||||
* @param packageLengthValue 数据包总长度
|
||||
* @param offsetValue 偏移量
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public long getPayloadLength(long packageLengthValue, int offsetValue) {
|
||||
if (packageLengthValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (offsetValue == 0) {
|
||||
return 0;
|
||||
}
|
||||
return packageLengthValue - offsetValue;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
package com.zhidao.support.adas.high.socket.read;
|
||||
|
||||
import java.nio.ByteOrder;
|
||||
package com.zhidao.support.adas.high.protocol;
|
||||
|
||||
/**
|
||||
* @author song kenan
|
||||
@@ -13,23 +11,25 @@ public interface IMessageProtocol {
|
||||
*/
|
||||
int getMagicCodeLength();
|
||||
|
||||
/**
|
||||
* 包长度
|
||||
*/
|
||||
int getPackageLength();
|
||||
|
||||
/**
|
||||
* 数据偏移量的长度
|
||||
*/
|
||||
int getOffsetLength();
|
||||
|
||||
/**
|
||||
* 数据包长度
|
||||
*/
|
||||
int getPackageLength();
|
||||
|
||||
int getOutHeader();
|
||||
|
||||
/**
|
||||
* 获取header数据长度
|
||||
*/
|
||||
int getHeaderLength(byte[] offset);
|
||||
int getHeaderLength(int offsetValue);
|
||||
|
||||
/**
|
||||
* 消息体长度
|
||||
*/
|
||||
int getPayloadLength(byte[] readData,byte[] offset);
|
||||
long getPayloadLength(long packageLengthValue, int offsetValue);
|
||||
}
|
||||
@@ -1,30 +1,45 @@
|
||||
package com.zhidao.support.adas.high.socket.read;
|
||||
package com.zhidao.support.adas.high.protocol;
|
||||
|
||||
import com.zhidao.support.adas.high.common.DigitalTrans;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 原始数据协议
|
||||
*
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/20
|
||||
* 原始数据格式:MagicCode(2字节 6d67) 偏移量(2字节 从原始数据头开始一直到Body头) 数据包总长度(4字节) Header Body
|
||||
*/
|
||||
public class OriginReadData implements Serializable {
|
||||
public class RawData implements Serializable {
|
||||
/**
|
||||
* 数据拆包是否成功
|
||||
*/
|
||||
private boolean isUnpackSucceed = true;
|
||||
|
||||
/**
|
||||
* 用于检查数据是否为正确数据
|
||||
* mg=0x6d67
|
||||
*/
|
||||
private byte[] magicCode;
|
||||
|
||||
/**
|
||||
* 包长度
|
||||
*/
|
||||
private byte[] packageLength;
|
||||
|
||||
/**
|
||||
* 偏移量,用于计算header长度
|
||||
*/
|
||||
private byte[] offset;
|
||||
/**
|
||||
* 偏移量,用于计算header长度
|
||||
*/
|
||||
private int offsetValue;
|
||||
/**
|
||||
* 包长度
|
||||
*/
|
||||
private byte[] packageLength;
|
||||
/**
|
||||
* 包长度
|
||||
*/
|
||||
private long packageLengthValue;
|
||||
|
||||
/**
|
||||
* 头部消息,装载消息类型等
|
||||
@@ -37,6 +52,8 @@ public class OriginReadData implements Serializable {
|
||||
*/
|
||||
private byte[] payload;
|
||||
|
||||
public RawData() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取out_header 由魔数、包大小、payload偏移量组成;
|
||||
@@ -44,22 +61,11 @@ public class OriginReadData implements Serializable {
|
||||
* 固定8个字节,否则出错。
|
||||
*/
|
||||
public byte[] getOutHeaderBytes() {
|
||||
byte[] bytes = DigitalTrans.concatBytes(getMagicCode(), getPackageLength());
|
||||
byte[] outHeader = DigitalTrans.concatBytes(bytes, getOffset());
|
||||
byte[] bytes = DigitalTrans.concatBytes(getMagicCode(), getOffset());
|
||||
byte[] outHeader = DigitalTrans.concatBytes(bytes, getPackageLength());
|
||||
return outHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取完整的数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public byte[] getOriginDataBytes() {
|
||||
byte[] bytes = DigitalTrans.concatBytes(getOutHeaderBytes(), getHeader());
|
||||
byte[] originData = DigitalTrans.concatBytes(bytes, getPayload());
|
||||
return originData;
|
||||
}
|
||||
|
||||
|
||||
public byte[] getMagicCode() {
|
||||
return magicCode;
|
||||
@@ -69,20 +75,23 @@ public class OriginReadData implements Serializable {
|
||||
this.magicCode = magicCode;
|
||||
}
|
||||
|
||||
public byte[] getPackageLength() {
|
||||
return packageLength;
|
||||
}
|
||||
|
||||
public void setPackageLength(byte[] packageLength) {
|
||||
this.packageLength = packageLength;
|
||||
}
|
||||
|
||||
public byte[] getOffset() {
|
||||
return offset;
|
||||
}
|
||||
|
||||
public void setOffset(byte[] offset) {
|
||||
public void setOffset(byte[] offset, int offsetValue) {
|
||||
this.offset = offset;
|
||||
this.offsetValue = offsetValue;
|
||||
}
|
||||
|
||||
public byte[] getPackageLength() {
|
||||
return packageLength;
|
||||
}
|
||||
|
||||
public void setPackageLength(byte[] packageLength, long packageLengthValue) {
|
||||
this.packageLength = packageLength;
|
||||
this.packageLengthValue = packageLengthValue;
|
||||
}
|
||||
|
||||
public byte[] getHeader() {
|
||||
@@ -100,4 +109,20 @@ public class OriginReadData implements Serializable {
|
||||
public void setPayload(byte[] payload) {
|
||||
this.payload = payload;
|
||||
}
|
||||
|
||||
public boolean isUnpackSucceed() {
|
||||
return isUnpackSucceed;
|
||||
}
|
||||
|
||||
public void setUnpackSucceed(boolean unpackSucceed) {
|
||||
isUnpackSucceed = unpackSucceed;
|
||||
}
|
||||
|
||||
public int getOffsetValue() {
|
||||
return offsetValue;
|
||||
}
|
||||
|
||||
public long getPackageLengthValue() {
|
||||
return packageLengthValue;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.zhidao.support.adas.high.protocol;
|
||||
|
||||
import com.zhidao.support.adas.high.common.Constants;
|
||||
import com.zhidao.support.adas.high.common.DigitalTrans;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import okio.ByteString;
|
||||
|
||||
/**
|
||||
* 数据打包
|
||||
*
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/20
|
||||
*/
|
||||
public class RawPack {
|
||||
private static final String TAG = RawPack.class.getSimpleName();
|
||||
private final DefaultMessageProtocol messageProtocol;
|
||||
private volatile long msgID = 0L;
|
||||
|
||||
public RawPack() {
|
||||
messageProtocol = new DefaultMessageProtocol();
|
||||
}
|
||||
|
||||
|
||||
public synchronized ByteString pack(MessagePad.MessageType msgType, byte[] data) {
|
||||
if (msgType == null) {
|
||||
return null;
|
||||
}
|
||||
msgID++;
|
||||
double time = System.nanoTime() / 1000000000.0;
|
||||
//封装Header
|
||||
MessagePad.Header.Builder headerBuilder = MessagePad.Header.newBuilder();
|
||||
headerBuilder.setMsgID(msgID);//消息唯一ID,生成数据累加。从1开始,程序或者就一直累加,断开连接或者更换连接的工控机不做重置
|
||||
headerBuilder.setMsgType(msgType);
|
||||
headerBuilder.setTimestamp(time);
|
||||
headerBuilder.setSourceTimestamp(time);
|
||||
MessagePad.Header headerPb = headerBuilder.build();
|
||||
int lengthValue = messageProtocol.getOutHeader() + headerPb.getSerializedSize();//数据总长度
|
||||
byte[] offset = getOffset(lengthValue);
|
||||
if (data != null && data.length > 0) {
|
||||
lengthValue += data.length;
|
||||
}
|
||||
byte[] msg = new byte[lengthValue];
|
||||
byte[] length = getPackageLength(lengthValue);
|
||||
byte[] header = headerPb.toByteArray();
|
||||
//添加MG
|
||||
System.arraycopy(Constants.RAW_MG, 0, msg, 0, messageProtocol.getMagicCodeLength());
|
||||
//添加偏移量
|
||||
System.arraycopy(offset, 0, msg, messageProtocol.getMagicCodeLength(), messageProtocol.getOffsetLength());
|
||||
//添加数据包长度
|
||||
System.arraycopy(length, 0, msg, messageProtocol.getMagicCodeLength() + messageProtocol.getOffsetLength(), messageProtocol.getPackageLength());
|
||||
//添加Header
|
||||
System.arraycopy(header, 0, msg, messageProtocol.getOutHeader(), header.length);
|
||||
//添加数据
|
||||
if (data != null && data.length > 0) {
|
||||
System.arraycopy(data, 0, msg, messageProtocol.getOutHeader() + header.length, data.length);
|
||||
}
|
||||
return ByteString.of(msg);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 偏移量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private byte[] getOffset(int offsetValue) {
|
||||
return DigitalTrans.set16bitUnsignedValue(offsetValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* 偏移量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private byte[] getPackageLength(long lengthValue) {
|
||||
return DigitalTrans.set32bitUnsignedValue(lengthValue);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
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 java.util.Arrays;
|
||||
|
||||
import okio.ByteString;
|
||||
|
||||
/**
|
||||
* 数据拆包
|
||||
*
|
||||
* @author song kenan
|
||||
* @des
|
||||
* @date 2021/10/20
|
||||
*/
|
||||
public class RawUnpack {
|
||||
private static final String TAG = RawUnpack.class.getSimpleName();
|
||||
private final DefaultMessageProtocol messageProtocol;
|
||||
|
||||
|
||||
public RawUnpack() {
|
||||
messageProtocol = new DefaultMessageProtocol();
|
||||
}
|
||||
|
||||
public RawData read(ByteString bytes) {
|
||||
RawData originalData = new RawData();
|
||||
unpack(bytes, originalData);
|
||||
return originalData;
|
||||
|
||||
}
|
||||
|
||||
private synchronized void unpack(ByteString bytes, RawData raw) {
|
||||
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());
|
||||
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());
|
||||
//读取packageLength
|
||||
ByteString packageLength = bytes.substring(messageProtocol.getMagicCodeLength() + messageProtocol.getOffsetLength(), messageProtocol.getOutHeader());
|
||||
byte[] packageLengthB = packageLength.toByteArray();
|
||||
raw.setPackageLength(packageLengthB, getPackageLengthValue(packageLengthB));
|
||||
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());
|
||||
//读取payload
|
||||
ByteString payload = bytes.substring(raw.getOffsetValue());
|
||||
raw.setPayload(payload.toByteArray());
|
||||
CupidLogUtils.w(TAG, "WS IPC数据=" + payload.hex() + " IPC数据长度=" + messageProtocol.getPayloadLength(raw.getPackageLengthValue(), raw.getOffsetValue()));
|
||||
} else {
|
||||
raw.setUnpackSucceed(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 偏移量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private int getOffsetValue(byte[] offset) {
|
||||
if (offset == null || offset.length != 2) {
|
||||
return 0;
|
||||
}
|
||||
return DigitalTrans.get16bitUnsignedValue(offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 偏移量
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private long getPackageLengthValue(byte[] length) {
|
||||
if (length == null || length.length != 4) {
|
||||
return 0;
|
||||
}
|
||||
return DigitalTrans.get32bitUnsignedValue(length);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.zhidao.support.adas.high.queue;
|
||||
|
||||
import okio.ByteString;
|
||||
|
||||
/**
|
||||
* author nieyunlong
|
||||
*
|
||||
* @des
|
||||
* @date 2021/3/10
|
||||
*/
|
||||
public class UdpMsgModel {
|
||||
|
||||
/**
|
||||
* 发送数据类型
|
||||
* 1 json,2 pb
|
||||
*/
|
||||
private int type;
|
||||
|
||||
/**
|
||||
* 当前接收到的时间
|
||||
*/
|
||||
private long receiverDataTimeUdp;
|
||||
|
||||
/**
|
||||
* udp 数据
|
||||
*/
|
||||
private String content;
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public long getReceiverDataTimeUdp() {
|
||||
return receiverDataTimeUdp;
|
||||
}
|
||||
|
||||
public void setReceiverDataTimeUdp(long receiverDataTimeUdp) {
|
||||
this.receiverDataTimeUdp = receiverDataTimeUdp;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UdpMsgModel{" +
|
||||
"receiverDataTimeUdp=" + receiverDataTimeUdp +
|
||||
", content='" + content + '\'' +
|
||||
", type='" + type + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,101 +0,0 @@
|
||||
package com.zhidao.support.adas.high.queue;
|
||||
|
||||
import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.thread.QueuedWork;
|
||||
import com.zhidao.support.adas.high.thread.callback.NormalCallback;
|
||||
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
* author : peng hongqiu
|
||||
* e-mail : penghongqiu@163.com
|
||||
* date : 2020/12/22 11:46
|
||||
* desc :
|
||||
* version:
|
||||
*/
|
||||
public class UdpQueueManager {
|
||||
|
||||
private static UdpQueueManager sInstance = new UdpQueueManager();
|
||||
//存储dup发送的数据
|
||||
PublicQueue<String> publicQueue = new PublicQueue<>();
|
||||
//实时消费
|
||||
private boolean runConsumerFlag = true;
|
||||
private AdasChannel adasChannel;
|
||||
private RealTimeConsumerFrameMission realTimeConsumerFrameMission;
|
||||
private Future<String> mFutureTask;
|
||||
|
||||
public static UdpQueueManager getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private UdpQueueManager() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void addQueueData(String data) {
|
||||
publicQueue.add(data);
|
||||
}
|
||||
|
||||
public void registerAdasChannel(AdasChannel adasChannel) {
|
||||
this.adasChannel = adasChannel;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实时消费帧 消费完一帧 立马取最新一帧
|
||||
*/
|
||||
private class RealTimeConsumerFrameMission extends NormalCallback<String> {
|
||||
//消费者
|
||||
private PublicQueue<String> mPublicQueue;
|
||||
|
||||
public RealTimeConsumerFrameMission(PublicQueue<String> publicQueue) {
|
||||
mPublicQueue = publicQueue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String doInBackground() {
|
||||
try {
|
||||
while (runConsumerFlag) {
|
||||
String data = mPublicQueue.remove();
|
||||
if (adasChannel != null) {
|
||||
adasChannel.udpDataManage(data);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return super.doInBackground();
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
runConsumerFlag = false;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void initDector() {
|
||||
CupidLogUtils.w("===>UdpQueueManager initDector");
|
||||
release();
|
||||
runConsumerFlag = true;
|
||||
if (realTimeConsumerFrameMission == null){
|
||||
realTimeConsumerFrameMission = new RealTimeConsumerFrameMission(publicQueue);
|
||||
}
|
||||
mFutureTask = QueuedWork.submit(null, realTimeConsumerFrameMission);
|
||||
}
|
||||
|
||||
public void release() {
|
||||
publicQueue.clear();
|
||||
stopCallBack();
|
||||
}
|
||||
|
||||
private void stopCallBack() {
|
||||
if (realTimeConsumerFrameMission != null) {
|
||||
realTimeConsumerFrameMission.stop();
|
||||
realTimeConsumerFrameMission = null;
|
||||
}
|
||||
if (mFutureTask != null) {
|
||||
mFutureTask.cancel(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_ALIAS_CODE_WEB_
|
||||
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_LINK_ADAS;
|
||||
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_LINK_LOG_CONNECT_STATUS;
|
||||
import static com.mogo.eagle.core.data.chain.ChainConstant.CHAIN_LINK_LOG_WEB_SOCKET_DATA;
|
||||
import static com.zhidao.support.adas.high.common.Constants.RESOURCE_PATH;
|
||||
import static com.zhidao.support.adas.high.common.Constants.WS_IP_HOST_HEAD;
|
||||
import static com.zhidao.support.adas.high.common.Constants.WS_PORT;
|
||||
|
||||
import android.text.TextUtils;
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.zhidao.support.adas.high.queue.WebSocketQueueManager;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
import com.zhjt.service.chain.TracingConstants;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
@@ -55,6 +56,8 @@ public class FpgaSocket implements IWebSocket {
|
||||
private OkHttpClient.Builder okBuilder;
|
||||
|
||||
private String wsHost;
|
||||
private String ipAddress;
|
||||
private int port;
|
||||
/**
|
||||
* 是否是用户主动关闭socket
|
||||
*/
|
||||
@@ -84,9 +87,11 @@ public class FpgaSocket implements IWebSocket {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connectWebSocket(String address) {
|
||||
public void connectWebSocket(String address, int port) {
|
||||
this.ipAddress = address;
|
||||
this.port = port;
|
||||
isUserCloseWebSocket = false;
|
||||
wsHost = WS_IP_HOST_HEAD + address + WS_PORT;
|
||||
wsHost = WS_IP_HOST_HEAD + address + String.format(Locale.getDefault(), RESOURCE_PATH, port);
|
||||
CupidLogUtils.i(TAG, "WebSocket 主动连接= " + wsHost);
|
||||
init();
|
||||
connect();
|
||||
@@ -174,7 +179,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
*/
|
||||
void onConnecting();
|
||||
|
||||
void onWebSocketConnectSuccess();
|
||||
void onWebSocketConnectSuccess(String ipAddress, int port);
|
||||
|
||||
void onWebSocketConnectFailed(String t);
|
||||
|
||||
@@ -205,7 +210,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
} else {
|
||||
CupidLogUtils.i(TAG, "WebSocket 连接成功");
|
||||
if (mWebSocketConnectListener != null)
|
||||
mWebSocketConnectListener.onWebSocketConnectSuccess();
|
||||
mWebSocketConnectListener.onWebSocketConnectSuccess(ipAddress, port);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ public interface IWebSocket {
|
||||
/**
|
||||
* 连接socket
|
||||
*/
|
||||
void connectWebSocket(String address);
|
||||
void connectWebSocket(String address, int port);
|
||||
|
||||
/**
|
||||
* 关闭webSocket
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user