From f205893029f91feb65b799cebb793d719fa5d1ff Mon Sep 17 00:00:00 2001 From: xinfengkun Date: Thu, 13 Jun 2024 11:31:19 +0800 Subject: [PATCH] =?UTF-8?q?[650][adas]=20NDE=20V2N=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=EF=BC=9A=E7=BB=BF=E6=B3=A2=E9=80=9A=E8=A1=8C=EF=BC=88=E5=8D=95?= =?UTF-8?q?=E8=B7=AF=E5=8F=A3=EF=BC=89=E4=BA=8B=E4=BB=B6=E6=8E=A8=E9=80=81?= =?UTF-8?q?,=20=E9=80=8F=E4=BC=A0=E3=80=81=E8=A1=8C=E4=BA=BA=E6=A8=AA?= =?UTF-8?q?=E7=A9=BF=EF=BC=88=E8=B7=AF=E4=BE=A7=EF=BC=89=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=8E=A8=E9=80=81,=20=E9=80=8F=E4=BC=A0=E3=80=81=E4=BB=96?= =?UTF-8?q?=E8=BD=A6=E9=80=86=E8=A1=8C=EF=BC=88=E8=B7=AF=E4=BE=A7=EF=BC=89?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E6=8E=A8=E9=80=81,=20=E9=80=8F=E4=BC=A0?= =?UTF-8?q?=E3=80=81=E6=8B=A5=E5=A0=B5=E4=BA=8B=E4=BB=B6=E6=8E=A8=E9=80=81?= =?UTF-8?q?,=20=E9=80=8F=E4=BC=A0;=E6=95=B0=E6=8D=AE=E4=B8=AD=E5=BF=83?= =?UTF-8?q?=E6=96=B0=E5=A2=9ENDE=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../autopilot/adapter/MoGoAdasListenerImpl.kt | 46 ++++++ .../api/autopilot/IMoGoV2nNioEventListener.kt | 38 +++++ .../CallerV2nNioEventListenerManager.kt | 51 +++++++ .../zhjt/mogo/adas/common/MessageType.java | 4 + .../src/main/proto/message_pad.proto | 131 +++++++++++++++++- .../support/adas/high/OnAdasListener.java | 36 ++++- .../adas/high/msg/MyMessageFactory.java | 28 ++++ .../msg/V2nNioCongestionEventMessage.java | 31 +++++ ...erEventAndOtherRetrogradeEventMessage.java | 43 ++++++ .../V2nNioGreenWavePassageEventMessage.java | 31 +++++ 10 files changed, 436 insertions(+), 3 deletions(-) create mode 100644 core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoV2nNioEventListener.kt create mode 100644 core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerV2nNioEventListenerManager.kt create mode 100644 libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioCongestionEventMessage.java create mode 100644 libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioCrossoverEventAndOtherRetrogradeEventMessage.java create mode 100644 libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioGreenWavePassageEventMessage.java diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt index c165e1244d..3233537066 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/adapter/MoGoAdasListenerImpl.kt @@ -938,6 +938,52 @@ class MoGoAdasListenerImpl : OnAdasListener { CallerRoboBusJinlvM1StitchedVideoListenerManager.invokeRoboBusJinlvM1StitchedVideo(data) } + /** + * 绿波通行(单路口)事件推送, 透传 + * + * @param header 头 + * @param crossSpeed 数据 + */ + override fun onV2nNioGreenWavePassageEvent( + header: MessagePad.Header, + crossSpeed: MessagePad.V2nCrossSpeed + ) { + CallerV2nNioEventListenerManager.invokeV2nNioGreenWavePassageEvent(crossSpeed) + } + + /** + * 行人横穿(路侧)事件推送, 透传 + * + * @param header 头 + * @param event 数据 + */ + override fun onV2nNioCrossoverEvent(header: MessagePad.Header, event: MessagePad.Event) { + CallerV2nNioEventListenerManager.invokeV2nNioCrossoverEvent(event) + } + + /** + * 他车逆行(路侧)事件推送, 透传 + * + * @param header 头 + * @param event 数据 + */ + override fun onV2nNioOtherRetrogradeEvent(header: MessagePad.Header, event: MessagePad.Event) { + CallerV2nNioEventListenerManager.invokeV2nNioOtherRetrogradeEvent(event) + } + + /** + * 拥堵事件推送, 透传 + * + * @param header 头 + * @param congestion 数据 + */ + override fun onV2nNioCongestionEvent( + header: MessagePad.Header, + congestion: MessagePad.V2nCongestion + ) { + CallerV2nNioEventListenerManager.invokeV2nNioCongestionEvent(congestion) + } + override fun onSsmReceiveTimeout(isTimeout: Boolean) { CallerAutoPilotStatusListenerManager.invokeSsmReceiveTimeout(isTimeout) } diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoV2nNioEventListener.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoV2nNioEventListener.kt new file mode 100644 index 0000000000..208c00250a --- /dev/null +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoV2nNioEventListener.kt @@ -0,0 +1,38 @@ +package com.mogo.eagle.core.function.api.autopilot + +import mogo.telematics.pad.MessagePad + +/** + *NDE 数据接口 + */ +interface IMoGoV2nNioEventListener { + + /** + * 绿波通行(单路口)事件推送, 透传 + * + * @param crossSpeed 数据 + */ + fun onV2nNioGreenWavePassageEvent(crossSpeed: MessagePad.V2nCrossSpeed){} + + /** + * 行人横穿(路侧)事件推送, 透传 + * + * @param event 数据 + */ + fun onV2nNioCrossoverEvent(event: MessagePad.Event){} + + /** + * 他车逆行(路侧)事件推送, 透传 + * + * @param event 数据 + */ + fun onV2nNioOtherRetrogradeEvent(event: MessagePad.Event){} + + /** + * 拥堵事件推送, 透传 + * + * @param congestion 数据 + */ + fun onV2nNioCongestionEvent(congestion: MessagePad.V2nCongestion){} + +} \ No newline at end of file diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerV2nNioEventListenerManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerV2nNioEventListenerManager.kt new file mode 100644 index 0000000000..d2cd8fff96 --- /dev/null +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerV2nNioEventListenerManager.kt @@ -0,0 +1,51 @@ +package com.mogo.eagle.core.function.call.autopilot + +import com.mogo.eagle.core.function.api.autopilot.IMoGoV2nNioEventListener +import com.mogo.eagle.core.function.call.base.CallerBase +import mogo.telematics.pad.MessagePad + +/** + *NDE 数据接口 + */ +object CallerV2nNioEventListenerManager : CallerBase() { + + /** + * 绿波通行(单路口)事件推送, 透传 + */ + fun invokeV2nNioGreenWavePassageEvent(crossSpeed: MessagePad.V2nCrossSpeed) { + M_LISTENERS.forEach { + val listener = it.value + listener.onV2nNioGreenWavePassageEvent(crossSpeed) + } + } + + /** + * 行人横穿(路侧)事件推送, 透传 + */ + fun invokeV2nNioCrossoverEvent(event: MessagePad.Event) { + M_LISTENERS.forEach { + val listener = it.value + listener.onV2nNioCrossoverEvent(event) + } + } + + /** + * 他车逆行(路侧)事件推送, 透传 + */ + fun invokeV2nNioOtherRetrogradeEvent(event: MessagePad.Event) { + M_LISTENERS.forEach { + val listener = it.value + listener.onV2nNioOtherRetrogradeEvent(event) + } + } + + /** + * 拥堵事件推送, 透传 + */ + fun invokeV2nNioCongestionEvent(congestion: MessagePad.V2nCongestion) { + M_LISTENERS.forEach { + val listener = it.value + listener.onV2nNioCongestionEvent(congestion) + } + } +} \ No newline at end of file diff --git a/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/common/MessageType.java b/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/common/MessageType.java index f51b9037b6..3e4d223910 100644 --- a/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/common/MessageType.java +++ b/libraries/mogo-adas-data/src/main/java/com/zhjt/mogo/adas/common/MessageType.java @@ -80,6 +80,10 @@ public enum MessageType { TYPE_RECEIVE_PARALLEL_DRIVING_STATUS(MessagePad.MessageType.MsgTypeParallelDrivingCmd, "平行驾驶状态", 5000), TYPE_SEND_RECEIVED_ACK(MessagePad.MessageType.MsgTypeReceivedAck, "发送消息回执"), TYPE_RECEIVE_RECEIVED_ACK(MessagePad.MessageType.MsgTypeReceivedAck, "接收消息回执"), + TYPE_RECEIVE_V2N_NIO_GREEN_WAVE_PASSAGE_EVENT(MessagePad.MessageType.MsgTypeV2nNioGreenWavePassageEvent, "V2N NIO绿波通行(单路口)"), + TYPE_RECEIVE_V2N_NIO_CROSSOVER_EVENT(MessagePad.MessageType.MsgTypeV2nNioCrossoverEvent, "V2N NIO行人横穿(路侧)"), + TYPE_RECEIVE_V2N_NIO_OTHER_RETROGRADE_EVENT(MessagePad.MessageType.MsgTypeV2nNioOtherRetrogradeEvent, "V2N NIO他车逆行(路侧)"), + TYPE_RECEIVE_V2N_NIO_CONGESTION_EVENT(MessagePad.MessageType.MsgTypeV2nNioCongestionEvent, "V2N NIO拥堵事件"), //TODO 透传原始pb文件中不存在以下type。由于Java中无法强转,所以在mogo-adas-data/message_pad.proto中放开注释 TYPE_RECEIVE_PLANNING_DECISION_STATE(MessagePad.MessageType.MsgTypePlanningDecisionState, "Planning决策状态"), TYPE_RECEIVE_SWEEPER_TASK_INDEX_DATA(MessagePad.MessageType.MsgTypeSweeperTaskIndexData, "清扫车指标数据"), diff --git a/libraries/mogo-adas-data/src/main/proto/message_pad.proto b/libraries/mogo-adas-data/src/main/proto/message_pad.proto index 54a15f6401..6792fd7f22 100644 --- a/libraries/mogo-adas-data/src/main/proto/message_pad.proto +++ b/libraries/mogo-adas-data/src/main/proto/message_pad.proto @@ -77,6 +77,11 @@ enum MessageType MsgTypeGetDebugInfo = 0x10125; //debug信息查询 pad->telematics MsgTypeParallelDrivingCmd = 0x10126; //无人化场景,平行驾驶请求相关指令及状态反馈, 云控<->鹰眼双向透传 MsgTypeReceivedAck = 0x10127; //消息接收ack, 表示消息已接收到 + + MsgTypeV2nNioGreenWavePassageEvent = 0x10128; //绿波通行(单路口)事件推送, 透传 + MsgTypeV2nNioCrossoverEvent = 0x10129; //行人横穿(路侧)事件推送, 透传 + MsgTypeV2nNioOtherRetrogradeEvent = 0x1012a; //他车逆行(路侧)事件推送, 透传 + MsgTypeV2nNioCongestionEvent = 0x1012b; //拥堵事件推送, 透传 } message Header @@ -94,6 +99,130 @@ message ReceivedAck repeated uint64 msgids = 1; //确认收到的msgid列表 } +// message definition for MsgTypeV2nNioGreenWavePassageEvent +message V2nCrossSpeed +{ + //直行 + uint32 speed_straight_min = 1; + uint32 speed_straight_max = 2; + //左转 + uint32 speed_left_min = 3; + uint32 speed_left_max = 4; + //右转 + uint32 speed_right_min = 5; + uint32 speed_right_max = 6; + //车道限速 + uint32 max_speed = 7; + //限速来源 0融合 1默认 + uint32 max_status = 8; + //路口经度 + double lng = 9; + //路口纬度 + double lat = 10; +} + +// message definition for MsgTypeV2nNioCongestionEvent +message V2nCongestion +{ + // 消息时间,发送消息时间戳,单位毫秒 + uint64 msg_time = 1; + // 消息名称 + string msg_name = 2; + // 数据源,0:路侧设备、1:人工上报、2:地图、3:三方数据源 + uint32 data_source = 3; + // 路段拥堵详情 + repeated CongestionInfo infos = 4; +} + +message Geo{ + // 经度 + double lon = 1; + // 维度 + double lat = 2; +} + +message EventLocationGeo{ + //开始经度--队头 + double startLng = 1; + //开始纬度--队头 + double startLat = 2; + //结束经度 -- 队尾 + double endLng = 3; + //结束纬度 --队尾 + double endLat =4; + // 事件区域--- 车道中心线的坐标 + repeated Geo regions = 5; +} + +message TimePeriod{ + // 事件开始时间,UTC+0 时间戳,精确到毫秒 + uint64 start_time = 1; + // 事件结束时间,UTC+0 时间戳,精确到毫秒,没有传 0 + uint64 end_time = 2; + // 事件更新时间,UTC+0 时间戳,精确到毫秒,没有传 0 + uint64 update_time = 3; + // 事件确认时间,UTC+0 时间戳,精确到毫秒,没有传 0 + uint64 confirm_time = 4; +} + +message CongestionInfo +{ + // 事件状态,0:消散、1:生成 + uint32 data_status = 1; + // 事件时间相关信息 + TimePeriod time_period = 2; + // 事件发生位置的经纬度信息 + EventLocationGeo event_location_geo = 3; + //事件发生的原始照片 + repeated string img_file_key = 4; + // 事件类型, 101 施工、 102 三角牌, 103 静止车,104 拥堵 + uint32 event_type = 5; + // 事件唯一性 + string msg_uuid = 6; + // 拥堵等级 1,畅通,2,缓行,3,拥堵,4,严重拥堵 + uint32 congestion_level = 7; + // 车道号 + uint32 lane_no = 8; + // 拥堵细类 0,路段拥堵,1 路口拥堵 + uint32 congestion_type = 9; + // 车道方向,正北是0,顺时针方向 + double bearing = 10; + // 如果拥堵细类是路口,则有该路口中心点坐标 + double lon = 11; + double lat = 12; + // 视频地址 2024-06-03新增字段 + string video_url = 13; + // 来源ip 2024-06-03 新增字段 + string camera_ip = 14; +} + +enum EventType +{ + CONVERSE_RUNNING = 0;//逆行/倒车 + SLOW_RUNNING = 1;//慢行 + SPEEDING_RUNNING = 2;//快行 + EMERGENCY_BRAKING = 3;//紧急制动 + ABNORMAL_PARKING = 4;//异常停车 + NON_VEHICLE_INTRUSION = 5;//行人/非机动车闯入 +} + +// message definition for MsgTypeV2nNioCrossoverEvent / MsgTypeV2nNioOtherRetrogradeEvent +message Event +{ + uint32 channelId = 1; //渠道来源,mogo默认10 + uint64 rcuId = 2; //平台未维护,暂用基站号 + EventType eventType = 3; //事件类别 + uint32 confidence = 4; //事件置信度 + uint32 gnssType = 5; //坐标系类型, 0:GCJ02坐标系,2:WGS84坐标系 + double longitude = 6; + double latitude = 7; + uint64 timestamp = 8; //时间戳 + string eventId = 9; // 事件id + string exts = 10; //扩展字段,传递相机ip,{"cameraIp":"172.18.7.40"} + uint32 targetIdsLen = 11; //事件关联的目标对象uuid个数 + repeated string targetIds = 12; //事件关联的目标对象uuid列表 +} + // message definition for MsgTypeTrajectory message TrajectoryPoint { @@ -345,7 +474,7 @@ message CarConfigResp double maxAcceleration = 8; //最大加速度, 单位:m/s² string carType = 9; //车辆类型 string subCarType = 10; //车辆子类型 - string vinCode = 11;//车辆vin码 + string vinCode = 11;//车辆vin码 taxi: 420 bus: 440 reserved 12 to 100; int32 mapVersion = 101;//dockVersion解析出版本号,仅用于版本对比,解析失败为-1。例如:"MAP-taxi_RoboTaxi_df_2.8.0.3_20220928_test" 解析结果为:20800 bool isDF = 102;//车型是否是东风 diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java index 90afedde94..dcca26f15f 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/OnAdasListener.java @@ -11,8 +11,8 @@ import com.zhjt.mogo.adas.data.AdasConstants; import com.zhjt.mogo.adas.data.AiCloudTask; import com.zhjt.mogo.adas.data.bean.AdasParam; import com.zhjt.mogo.adas.data.bean.AutopilotStatistics; -import com.zhjt.mogo.adas.data.bean.ReceivedAck; import com.zhjt.mogo.adas.data.bean.LaunchConditionData; +import com.zhjt.mogo.adas.data.bean.ReceivedAck; import com.zhjt.mogo.adas.data.bean.UnableLaunchReason; import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable; import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask; @@ -480,6 +480,38 @@ public interface OnAdasListener { */ void onM1StitchedVideo(@NonNull MessagePad.Header header, @NonNull byte[] data); + /** + * 绿波通行(单路口)事件推送, 透传 + * + * @param header 头 + * @param crossSpeed 数据 + */ + void onV2nNioGreenWavePassageEvent(@NonNull MessagePad.Header header, @NonNull MessagePad.V2nCrossSpeed crossSpeed); + + /** + * 行人横穿(路侧)事件推送, 透传 + * + * @param header 头 + * @param event 数据 + */ + void onV2nNioCrossoverEvent(@NonNull MessagePad.Header header, @NonNull MessagePad.Event event); + + /** + * 他车逆行(路侧)事件推送, 透传 + * + * @param header 头 + * @param event 数据 + */ + void onV2nNioOtherRetrogradeEvent(@NonNull MessagePad.Header header, @NonNull MessagePad.Event event); + + /** + * 拥堵事件推送, 透传 + * + * @param header 头 + * @param congestion 数据 + */ + void onV2nNioCongestionEvent(@NonNull MessagePad.Header header, @NonNull MessagePad.V2nCongestion congestion); + /** * 域控SSM接口接收超时 * 状态变动时才会回调,默认SSM状态正常 @@ -492,7 +524,7 @@ public interface OnAdasListener { * 是否有能力启动自动驾驶 * * @param isAutopilotAbility 是否能启动自动驾驶 - * @param launchConditionData 原始数据 + * @param launchConditionData 原始数据 * @param unableAutopilotReasons 不能启动自动驾驶原因 */ void onAutopilotAbility(boolean isAutopilotAbility, @NonNull LaunchConditionData launchConditionData, @Nullable ArrayList unableAutopilotReasons); diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java index cf77bff8e7..f3942c96fc 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/MyMessageFactory.java @@ -46,6 +46,10 @@ public class MyMessageFactory implements IMyMessageFactory { private IMsg aiCloudTaskMessage;//云控任务:清扫车任务指令、无人化场景,平行驾驶请求相关指令及状态反馈 private IMsg m1StitchedVideoMessage;//M1拼接视频 private IMsg fSMStatusReasonRespondMessage;//FSM状态原因查询 + private IMsg v2nNioGreenWavePassageEventMessage;//V2N NIO绿波通行(单路口) + private IMsg v2nNioCrossoverEventMessage;//V2N NIO行人横穿(路侧) + private IMsg v2nNioOtherRetrogradeEventMessage;//V2N NIO他车逆行(路侧) + private IMsg v2nNioCongestionEventMessage;//V2N NIO拥堵事件 private final AutopilotReview autopilotReview; private final TurnLightState lightLeft = new TurnLightState(); @@ -254,6 +258,30 @@ public class MyMessageFactory implements IMyMessageFactory { fSMStatusReasonRespondMessage = new FSMStatusReasonRespondMessage(); } return fSMStatusReasonRespondMessage; + } else if (messageType == MessageType.TYPE_RECEIVE_V2N_NIO_GREEN_WAVE_PASSAGE_EVENT.typeCode) { + //V2N NIO绿波通行(单路口) + if (v2nNioGreenWavePassageEventMessage == null) { + v2nNioGreenWavePassageEventMessage = new V2nNioGreenWavePassageEventMessage(); + } + return v2nNioGreenWavePassageEventMessage; + } else if (messageType == MessageType.TYPE_RECEIVE_V2N_NIO_CROSSOVER_EVENT.typeCode) { + //V2N NIO行人横穿(路侧) + if (v2nNioCrossoverEventMessage == null) { + v2nNioCrossoverEventMessage = new V2nNioCrossoverEventAndOtherRetrogradeEventMessage(messageType); + } + return v2nNioCrossoverEventMessage; + } else if (messageType == MessageType.TYPE_RECEIVE_V2N_NIO_OTHER_RETROGRADE_EVENT.typeCode) { + //V2N NIO他车逆行(路侧) + if (v2nNioOtherRetrogradeEventMessage == null) { + v2nNioOtherRetrogradeEventMessage = new V2nNioCrossoverEventAndOtherRetrogradeEventMessage(messageType); + } + return v2nNioOtherRetrogradeEventMessage; + } else if (messageType == MessageType.TYPE_RECEIVE_V2N_NIO_CONGESTION_EVENT.typeCode) { + //V2N NIO拥堵事件 + if (v2nNioCongestionEventMessage == null) { + v2nNioCongestionEventMessage = new V2nNioCongestionEventMessage(); + } + return v2nNioCongestionEventMessage; } else { //MessageType.TYPE_DEFAULT.typeCode return null; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioCongestionEventMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioCongestionEventMessage.java new file mode 100644 index 0000000000..9e013b73f6 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioCongestionEventMessage.java @@ -0,0 +1,31 @@ +package com.zhidao.support.adas.high.msg; + +import android.os.SystemClock; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.zhidao.support.adas.high.AdasChannel; +import com.zhidao.support.adas.high.OnAdasListener; +import com.zhidao.support.adas.high.common.CupidLogUtils; +import com.zhidao.support.adas.high.protocol.RawData; + +import mogo.telematics.pad.MessagePad; + +/** + * V2N NIO拥堵事件 + */ +public class V2nNioCongestionEventMessage extends MyAbstractMessageHandler { + + @Override + public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException { + MessagePad.V2nCongestion v2nCongestion = MessagePad.V2nCongestion.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue()); + AdasChannel.calculateTimeConsumingOnDispatchRaw("V2N NIO拥堵事件", raw.receiveTime); + long nowTime = 0; + if (CupidLogUtils.isEnableLog()) + nowTime = SystemClock.elapsedRealtime(); + if (adasListener != null) { + adasListener.onV2nNioCongestionEvent(raw.getHeader(), v2nCongestion); + } + AdasChannel.calculateTimeConsumingBusiness("V2N NIO拥堵事件", nowTime); + } + +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioCrossoverEventAndOtherRetrogradeEventMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioCrossoverEventAndOtherRetrogradeEventMessage.java new file mode 100644 index 0000000000..4350431594 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioCrossoverEventAndOtherRetrogradeEventMessage.java @@ -0,0 +1,43 @@ +package com.zhidao.support.adas.high.msg; + +import android.os.SystemClock; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.zhidao.support.adas.high.AdasChannel; +import com.zhidao.support.adas.high.OnAdasListener; +import com.zhidao.support.adas.high.common.CupidLogUtils; +import com.zhidao.support.adas.high.protocol.RawData; +import com.zhjt.mogo.adas.common.MessageType; + +import mogo.telematics.pad.MessagePad; + +/** + * V2N NIO行人横穿(路侧)和 V2N NIO他车逆行(路侧) + */ +public class V2nNioCrossoverEventAndOtherRetrogradeEventMessage extends MyAbstractMessageHandler { + private final MessagePad.MessageType messageType; + private final String TAG; + + public V2nNioCrossoverEventAndOtherRetrogradeEventMessage(MessagePad.MessageType messageType) { + this.messageType = messageType; + TAG = messageType == MessageType.TYPE_RECEIVE_V2N_NIO_CROSSOVER_EVENT.typeCode ? "V2N NIO行人横穿(路侧)" : "V2N NIO他车逆行(路侧)"; + } + + @Override + public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException { + MessagePad.Event event = MessagePad.Event.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue()); + AdasChannel.calculateTimeConsumingOnDispatchRaw(TAG, raw.receiveTime); + long nowTime = 0; + if (CupidLogUtils.isEnableLog()) + nowTime = SystemClock.elapsedRealtime(); + if (adasListener != null) { + if (messageType == MessageType.TYPE_RECEIVE_V2N_NIO_CROSSOVER_EVENT.typeCode) { + adasListener.onV2nNioCrossoverEvent(raw.getHeader(), event); + } else if (messageType == MessageType.TYPE_RECEIVE_V2N_NIO_OTHER_RETROGRADE_EVENT.typeCode) { + adasListener.onV2nNioOtherRetrogradeEvent(raw.getHeader(), event); + } + } + AdasChannel.calculateTimeConsumingBusiness(TAG, nowTime); + } + +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioGreenWavePassageEventMessage.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioGreenWavePassageEventMessage.java new file mode 100644 index 0000000000..7841104d40 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/msg/V2nNioGreenWavePassageEventMessage.java @@ -0,0 +1,31 @@ +package com.zhidao.support.adas.high.msg; + +import android.os.SystemClock; + +import com.google.protobuf.InvalidProtocolBufferException; +import com.zhidao.support.adas.high.AdasChannel; +import com.zhidao.support.adas.high.OnAdasListener; +import com.zhidao.support.adas.high.common.CupidLogUtils; +import com.zhidao.support.adas.high.protocol.RawData; + +import mogo.telematics.pad.MessagePad; + +/** + * V2N NIO绿波通行(单路口) + */ +public class V2nNioGreenWavePassageEventMessage extends MyAbstractMessageHandler { + + @Override + public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException { + MessagePad.V2nCrossSpeed v2nCrossSpeed = MessagePad.V2nCrossSpeed.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue()); + AdasChannel.calculateTimeConsumingOnDispatchRaw("V2N NIO绿波通行(单路口)", raw.receiveTime); + long nowTime = 0; + if (CupidLogUtils.isEnableLog()) + nowTime = SystemClock.elapsedRealtime(); + if (adasListener != null) { + adasListener.onV2nNioGreenWavePassageEvent(raw.getHeader(), v2nCrossSpeed); + } + AdasChannel.calculateTimeConsumingBusiness("V2N NIO绿波通行(单路口)", nowTime); + } + +}