diff --git a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt index 6252a8e57b..7cf8d547aa 100644 --- a/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt +++ b/core/function-impl/mogo-core-function-datacenter/src/main/java/com/mogo/eagle/core/function/datacenter/autopilot/MoGoAutopilotControlProvider.kt @@ -365,12 +365,12 @@ class MoGoAutopilotControlProvider : if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { val invokeResult = AdasManager.getInstance() .sendAutoPilotModeReq(1, source, null) - invokeAutoPilotResult(if (invokeResult) "无参自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") + invokeAutoPilotResult(if (invokeResult > -1) "无参自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") } else { if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) { val invokeResult = AdasManager.getInstance() .sendAutoPilotModeReq(1, source, null) - invokeAutoPilotResult(if (invokeResult) "无参自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") + invokeAutoPilotResult(if (invokeResult > -1) "无参自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") } else { invokeAutoPilotResult("车机与工控机链接失败,无法开启自动驾驶 无参") CallerLogger.e("$M_D_C$TAG", "车机与工控机链接失败,无法开启自动驾驶") @@ -381,12 +381,12 @@ class MoGoAutopilotControlProvider : if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) { val invokeResult = AdasManager.getInstance() .sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo()) - invokeAutoPilotResult(if (invokeResult) "自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") + invokeAutoPilotResult(if (invokeResult > -1) "自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") } else { if (AdasManager.getInstance().ipcConnectionStatus == AdasConstants.IpcConnectionStatus.CONNECTED) { val invokeResult = AdasManager.getInstance() .sendAutoPilotModeReq(1, source, controlParameters.toRouteInfo()) - invokeAutoPilotResult(if (invokeResult) "自动驾驶调用成功" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") + invokeAutoPilotResult(if (invokeResult > -1) "自动驾驶调用成功:${invokeResult}" else "自动驾驶调用失败, socket 或者 rawPack 可能为空") } else { invokeAutoPilotResult("车机与工控机链接失败,无法开启自动驾驶") CallerLogger.e("$M_D_C$TAG", "车机与工控机链接失败,无法开启自动驾驶") @@ -439,19 +439,19 @@ class MoGoAutopilotControlProvider : override fun recordPackage(): Boolean { return AdasManager.getInstance() - .startRecordPackage((System.currentTimeMillis() / 1000).toInt(), 1) + .startRecordPackage((System.currentTimeMillis() / 1000).toInt(), 1) > -1 } override fun recordPackage(type: Int, id: Int): Boolean { - return AdasManager.getInstance().startRecordPackage(id, type) + return AdasManager.getInstance().startRecordPackage(id, type) > -1 } override fun recordPackage(type: Int, id: Int, duration: Int): Boolean { - return AdasManager.getInstance().startRecordPackage(id, duration, type) + return AdasManager.getInstance().startRecordPackage(id, duration, type) > -1 } override fun recordPackage(type: Int, id: Int, duration: Int, bduration: Int): Boolean { - return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration) + return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration) > -1 } override fun recordPackage( @@ -461,11 +461,11 @@ class MoGoAutopilotControlProvider : bduration: Int, topics: List ): Boolean { - return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration, topics) + return AdasManager.getInstance().startRecordPackage(id, duration, type, bduration, topics) > -1 } override fun stopRecord(type: Int, id: Int): Boolean { - return AdasManager.getInstance().stopRecordPackage(id, type) + return AdasManager.getInstance().stopRecordPackage(id, type) > -1 } override fun setEnableLog(isEnableLog: Boolean) { @@ -484,7 +484,7 @@ class MoGoAutopilotControlProvider : } override fun setAutoPilotSpeed(speed: Int): Boolean { - return AdasManager.getInstance().sendAutopilotSpeedReq(speed / 3.6) + return AdasManager.getInstance().sendAutopilotSpeedReq(speed / 3.6) > -1 } override fun recordCause(key: String?, name: String?, id: String?, reason: String?) { @@ -594,9 +594,9 @@ class MoGoAutopilotControlProvider : ) override fun sendDetouring(isEnable: Boolean): Boolean { return if (isEnable) { - AdasManager.getInstance().sendDetouring(1) + AdasManager.getInstance().sendDetouring(1) > -1 } else { - AdasManager.getInstance().sendDetouring(0) + AdasManager.getInstance().sendDetouring(0) > -1 } } @@ -606,7 +606,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendDetouringSpeed(speed: Double): Boolean { - return AdasManager.getInstance().sendDetouringSpeed(speed) + return AdasManager.getInstance().sendDetouringSpeed(speed) > -1 } /** @@ -617,9 +617,9 @@ class MoGoAutopilotControlProvider : */ override fun sendWeakNetSlowDown(isEnable: Boolean): Boolean { return if (isEnable) { - AdasManager.getInstance().sendWeakNetSlowDown(1) + AdasManager.getInstance().sendWeakNetSlowDown(1) > -1 } else { - AdasManager.getInstance().sendWeakNetSlowDown(0) + AdasManager.getInstance().sendWeakNetSlowDown(0) > -1 } } @@ -631,9 +631,9 @@ class MoGoAutopilotControlProvider : */ override fun sendBreakdownSlowDown(isEnable: Boolean): Boolean { return if (isEnable) { - AdasManager.getInstance().sendBreakdownSlowDown(1) + AdasManager.getInstance().sendBreakdownSlowDown(1) > -1 } else { - AdasManager.getInstance().sendBreakdownSlowDown(0) + AdasManager.getInstance().sendBreakdownSlowDown(0) > -1 } } @@ -644,7 +644,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendFusionMode(cmd: Int): Boolean { - return AdasManager.getInstance().sendFusionMode(cmd) + return AdasManager.getInstance().sendFusionMode(cmd) > -1 } /** @@ -654,10 +654,10 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendOvertakeMaxSpeed(maxSpeed: Double): Boolean { - return AdasManager.getInstance().sendOvertakeMaxSpeed(maxSpeed) + return AdasManager.getInstance().sendOvertakeMaxSpeed(maxSpeed) > -1 } - override fun sendSetParamReq(param: Map): Boolean { + override fun sendSetParamReq(param: Map): Set { return AdasManager.getInstance().sendSetParamReq(param) } @@ -668,7 +668,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendGetAllParamReq(): Boolean { - return AdasManager.getInstance().sendGetAllParamReq() + return AdasManager.getInstance().sendGetAllParamReq() > -1 } /** @@ -679,7 +679,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendGetParamReq(vararg paramType: AdasConstants.MapSystemParamType): Boolean { - return AdasManager.getInstance().sendGetParamReq(*paramType) + return AdasManager.getInstance().sendGetParamReq(*paramType) > -1 } /** @@ -690,7 +690,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun getBadCaseConfig(reqType: Int,recordType: Int,topicsNeedToCache: List): Boolean{ - return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache) + return AdasManager.getInstance().sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache) > -1 } /** @@ -788,7 +788,7 @@ class MoGoAutopilotControlProvider : } - return AdasManager.getInstance().sendBagManagerCmd(bagManager.build()) + return AdasManager.getInstance().sendBagManagerCmd(bagManager.build()) > -1 } /** @@ -878,8 +878,8 @@ class MoGoAutopilotControlProvider : * 系统命令请求 关机 * 命令下发存在回执 */ - override fun sendIpcPowerOff() { - AdasManager.getInstance().sendIpcPowerOff() + override fun sendIpcPowerOff() : Long{ + return AdasManager.getInstance().sendIpcPowerOff() } /** @@ -1030,7 +1030,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendSweeperStartTaskResp(reqNo: String, startTaskResp: SweeperTask.StartTaskResp): Boolean { - return AdasManager.getInstance().sendSweeperStartTaskResp(reqNo, startTaskResp) + return AdasManager.getInstance().sendSweeperStartTaskResp(reqNo, startTaskResp) > -1 } /** @@ -1042,7 +1042,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendSweeperTaskConfirmResp(reqNo: String, taskConfirmResp: SweeperTaskConfirm.TaskConfirmResp): Boolean { - return AdasManager.getInstance().sendSweeperTaskConfirmResp(reqNo, taskConfirmResp) + return AdasManager.getInstance().sendSweeperTaskConfirmResp(reqNo, taskConfirmResp) > -1 } /** @@ -1054,7 +1054,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendSweeperStopTaskResp(reqNo: String, stopTaskResp: SweeperTaskStop.StopTaskResp): Boolean { - return AdasManager.getInstance().sendSweeperStopTaskResp(reqNo, stopTaskResp) + return AdasManager.getInstance().sendSweeperStopTaskResp(reqNo, stopTaskResp) > -1 } /** @@ -1068,7 +1068,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendSweeperSuspendResumeTaskReq(isSuspend: Boolean, reqNo: String, suspendResumeTaskReq: SweeperTaskSuspendResume.SuspendResumeTaskReq): Boolean { - return AdasManager.getInstance().sendSweeperSuspendResumeTaskReq(isSuspend,reqNo, suspendResumeTaskReq) + return AdasManager.getInstance().sendSweeperSuspendResumeTaskReq(isSuspend,reqNo, suspendResumeTaskReq) > -1 } /** @@ -1080,7 +1080,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendSweeperGetTaskReq(reqNo: String, getTaskReq: SweeperTask.GetTaskReq): Boolean { - return AdasManager.getInstance().sendSweeperGetTaskReq(reqNo, getTaskReq) + return AdasManager.getInstance().sendSweeperGetTaskReq(reqNo, getTaskReq) > -1 } /** @@ -1092,7 +1092,7 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendSweeperAutopilotBootable(reqNo: String, isBootable: SweeperBootable.IsBootable): Boolean { - return AdasManager.getInstance().sendSweeperAutopilotBootable(reqNo, isBootable) + return AdasManager.getInstance().sendSweeperAutopilotBootable(reqNo, isBootable) > -1 } /** @@ -1104,14 +1104,14 @@ class MoGoAutopilotControlProvider : * @return boolean */ override fun sendSweeperCloudSuspendResumeTaskResp(reqNo: String, bigTaskActionResp: SweeperTaskCloudSuspendResume.BigTaskActionResp): Boolean { - return AdasManager.getInstance().sendSweeperCloudSuspendResumeTaskResp(reqNo, bigTaskActionResp) + return AdasManager.getInstance().sendSweeperCloudSuspendResumeTaskResp(reqNo, bigTaskActionResp) > -1 } override fun sendParallelDrivingReq( reqNo: String, parallelRequest: ParallelDrivingRequest.ParallelRequest ): Boolean { - return AdasManager.getInstance().sendParallelDrivingReq(reqNo, parallelRequest) + return AdasManager.getInstance().sendParallelDrivingReq(reqNo, parallelRequest) > -1 } override fun setIsDrawPointCloud(isDrawPointCloud: Boolean) { @@ -1153,7 +1153,7 @@ class MoGoAutopilotControlProvider : } override fun sendRoboBusJinlvM1FrontDoorCmd(switchCmd: Int): Boolean { - return AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(switchCmd) + return AdasManager.getInstance().sendRoboBusJinlvM1FrontDoorCmd(switchCmd) > -1 } override fun sendRoboBusJinlvM1AirConditionerCmd( @@ -1162,30 +1162,30 @@ class MoGoAutopilotControlProvider : windSpeedCmd: Int, temperatureCmd: Int ): Boolean { - return AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd) + return AdasManager.getInstance().sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd) > -1 } override fun sendRoboBusJinlvM1HeaderCmd(switchCmd: Int, windSpeedCmd: Int): Boolean { - return AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(switchCmd, windSpeedCmd) + return AdasManager.getInstance().sendRoboBusJinlvM1HeaderCmd(switchCmd, windSpeedCmd) > -1 } override fun sendRoboBusJinlvM1MainLamp1Cmd(switchCmd: Int): Boolean { - return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp1Cmd(switchCmd) + return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp1Cmd(switchCmd) > -1 } override fun sendRoboBusJinlvM1MainLamp2Cmd(switchCmd: Int): Boolean { - return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp2Cmd(switchCmd) + return AdasManager.getInstance().sendRoboBusJinlvM1MainLamp2Cmd(switchCmd) > -1 } override fun sendRoboBusJinlvM1SmallLampCmd(switchCmd: Int): Boolean { - return AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(switchCmd) + return AdasManager.getInstance().sendRoboBusJinlvM1SmallLampCmd(switchCmd) > -1 } override fun sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd: SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd): Boolean { - return AdasManager.getInstance().sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd) + return AdasManager.getInstance().sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd) > -1 } override fun sendPlanningCmd(cmd: Int): Boolean { - return AdasManager.getInstance().sendPlanningCmd(cmd) + return AdasManager.getInstance().sendPlanningCmd(cmd) > -1 } } \ No newline at end of file diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt index be790954d0..805b79c7e9 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotControlProvider.kt @@ -241,7 +241,7 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider { * {@link AdasConstants.MapSystemParamType#OVERTAKE_MAX_SPEED Value类型:double或double类型String} * @return boolean */ - fun sendSetParamReq(param: Map): Boolean + fun sendSetParamReq(param: Map): Set /** * 获取全部参数 * 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq)} @@ -308,7 +308,7 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider { * 系统命令请求 关机 * 命令下发存在回执 */ - fun sendIpcPowerOff() + fun sendIpcPowerOff(): Long /** * 办公室调试使用,强制开启自动驾驶,将 status,pilotmode,control_pilotmode,强追设置为 1 diff --git a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt index ac67bc82ab..cec06dfa2c 100644 --- a/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt +++ b/core/mogo-core-function-call/src/main/java/com/mogo/eagle/core/function/call/autopilot/CallerAutoPilotControlManager.kt @@ -344,10 +344,16 @@ object CallerAutoPilotControlManager { * {@link AdasConstants.MapSystemParamType#V2N_TO_PNC Value类型:boolean或boolean类型String} * {@link AdasConstants.MapSystemParamType#V2I_TO_PNC Value类型:boolean或boolean类型String} * {@link AdasConstants.MapSystemParamType#FUSION_MODE Value类型:int或int类型String} + * {@link AdasConstants.MapSystemParamType#SEAT_STATE Value类型:int或int类型String} * {@link AdasConstants.MapSystemParamType#OVERTAKE_MAX_SPEED Value类型:double或double类型String} - * @return boolean + * {@link AdasConstants.MapSystemParamType#FAULT_SIMULATION_CMD Value类型:int或int类型String} + * @return 消息是否添加到WS消息发送队列。由于批量设置参数,调用的域控接口存在不同,实际调用域控最多2个接口,调用次数最多4次,所以最多返回4条ID数据 + * * 返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - fun sendSetParamReq(param: Map): Boolean? { + fun sendSetParamReq(param: Map): Set? { return providerApi?.sendSetParamReq(param) } @@ -494,10 +500,11 @@ object CallerAutoPilotControlManager { * 系统命令请求 关机 * 命令下发存在回执 */ - fun sendIpcPowerOff(){ - if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {//TODO 是否需要判断是不是司机屏? - providerApi?.sendIpcPowerOff() + fun sendIpcPowerOff(): Long { + if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) { + return providerApi?.sendIpcPowerOff() ?: -1 } + return -1 } /** diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java index e11d515bc7..dd11378daa 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasChannel.java @@ -36,6 +36,7 @@ import com.zhidao.support.adas.high.common.RegexUtils; import com.zhidao.support.adas.high.common.autopilot.ability.AutopilotAbilityManager; import com.zhidao.support.adas.high.msg.IMsg; import com.zhidao.support.adas.high.msg.MyMessageFactory; +import com.zhidao.support.adas.high.protocol.PackData; import com.zhidao.support.adas.high.protocol.RawData; import com.zhidao.support.adas.high.protocol.RawPack; import com.zhidao.support.adas.high.protocol.RawUnpack; @@ -409,27 +410,32 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 发送PB数据 + * 乘客屏发送消息return 0解释,由于低版本域控不支持多客户端连接,乘客屏数据时由司机屏转发,低版本域控也不支持消息回执,无法提供和转发回执数据,所以返回0表示调用成功 * * @param msgType 数据类型 * @param data 数据 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - private boolean sendPBMessage(MessageType msgType, byte[] data) { + private long sendPBMessage(MessageType msgType, byte[] data) { if (rawPack != null) { //司机屏工控机数据转发 if (adasOptions.isPassenger()) { if (onMultiDeviceListener != null) { - onMultiDeviceListener.onForwardingPassengerIPCMessage(rawPack.pack(msgType, data)); + onMultiDeviceListener.onForwardingPassengerIPCMessage(rawPack.pack(msgType, data).bytes); } - return true; + return 0L; } else { if (mSocket == null || !mSocket.isConnected()) { - return false; + return -1L; } - return sendWsMessage(rawPack.pack(msgType, data)); + PackData packData = rawPack.pack(msgType, data); + return sendWsMessage(packData.bytes) ? packData.msgId : -1L; } } - return false; + return -1L; } @Override @@ -1115,10 +1121,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param versionCode 鹰眼版本号 * @param versionName 鹰眼版本名 * @param deviceCrt 鹰眼ssl证书 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, int versionCode, String versionName, String deviceCrt) { + public long sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, int versionCode, String versionName, String deviceCrt) { if (sn == null) { sn = ""; } @@ -1156,10 +1165,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param mode 1: enter autopilot mode, 0: quit autopilot mode * @param source 命令来源: 0: pad模拟, 1: pad业务, 2:aicloud, 3:魔方(清扫车MAP Version==332以及MAP Version>=350,其他车型目前未上线) * @param routeInfo 自动驾驶路径信息 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo) { + public long sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo) { MessagePad.SetAutopilotModeReq.Builder builder = MessagePad.SetAutopilotModeReq.newBuilder(); builder.setMode(mode); builder.setSource(source); @@ -1174,10 +1186,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 设置演示模式 * * @param enable 1: enable, 0: disable - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendDemoModeReq(int enable) { + public long sendDemoModeReq(int enable) { MessagePad.SetDemoModeReq req = MessagePad.SetDemoModeReq .newBuilder() .setEnable(enable) @@ -1188,10 +1203,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 车机基础信息请求 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendCarConfigReq() { + public long sendCarConfigReq() { MessagePad.CarConfigReq req = MessagePad.CarConfigReq .newBuilder() .build(); @@ -1205,10 +1223,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param filename 文件路径 * @param reasonID 接管原因id * @param reason 接管原因 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason) { + public long sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason) { if (filename == null) { filename = ""; } @@ -1228,41 +1249,39 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec return sendPBMessage(MessageType.TYPE_SEND_RECORD_CAUSE, resp.toByteArray()); } + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ @Override - public boolean startRecordPackage(int id, int type) { + public long startRecordPackage(int id, int type) { return sendRecordData(id, 0, type, true, -1, null); } + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ @Override - public boolean startRecordPackage(int id, int duration, int type) { + public long startRecordPackage(int id, int duration, int type) { return sendRecordData(id, duration, type, true, -1, null); } - @Override - public boolean startRecordPackage(int id, int duration, int type, int bduration) { - return sendRecordData(id, duration, type, true, bduration, null); - } - - @Override - public boolean startRecordPackage(int id, int type, List topics) { - return sendRecordData(id, 0, type, true, -1, topics); - } - - @Override - public boolean startRecordPackage(int id, int duration, int type, List topics) { - return sendRecordData(id, duration, type, true, -1, topics); - } - - @Override - public boolean startRecordPackage(int id, int duration, int type, int bduration, List topics) { - return sendRecordData(id, duration, type, true, bduration, topics); - } - - @Override - public boolean stopRecordPackage(int id, int type) { - return sendRecordData(id, 0, type, false, -1, null); - } - /** * 数据采集请求 主动录制Bag包 * sustain为true时 duration无效 @@ -1270,14 +1289,105 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param id 采集id * @param duration 采集时间长 Max:5*60 秒 * @param type 采集类型, 1:badCase, 2: map; 3: rests - * @param isRecord 采集指令, true: 采集, false: 停止采集 * @param bduration 前溯时长 - * @param sustain 是否持续采集 - * @param topics 要录制的Topic列表 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRecordData(int id, int duration, int type, boolean isRecord, int bduration, List topics) { + public long startRecordPackage(int id, int duration, int type, int bduration) { + return sendRecordData(id, duration, type, true, bduration, null); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long startRecordPackage(int id, int type, List topics) { + return sendRecordData(id, 0, type, true, -1, topics); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long startRecordPackage(int id, int duration, int type, List topics) { + return sendRecordData(id, duration, type, true, -1, topics); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param bduration 前溯时长 + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long startRecordPackage(int id, int duration, int type, int bduration, List topics) { + return sendRecordData(id, duration, type, true, bduration, topics); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long stopRecordPackage(int id, int type) { + return sendRecordData(id, 0, type, false, -1, null); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * * param sustain 是否持续采集 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param isRecord 采集指令, true: 采集, false: 停止采集 + * @param bduration 前溯时长 + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long sendRecordData(int id, int duration, int type, boolean isRecord, int bduration, List topics) { boolean sustain = false; if (isRecord) { if (duration <= 0) { @@ -1306,10 +1416,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 设置自动驾驶最大速度 * * @param speedLimit 最大车辆速度 m/s - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendAutopilotSpeedReq(double speedLimit) { + public long sendAutopilotSpeedReq(double speedLimit) { MessagePad.SetAutopilotSpeedReq req = MessagePad.SetAutopilotSpeedReq .newBuilder() .setSpeedLimit(speedLimit) @@ -1320,7 +1433,10 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 自动驾驶路径请求 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @ChainLog( linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT, @@ -1329,7 +1445,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec paramIndexes = {-1} ) @Override - public boolean sendGlobalPathReq() { + public long sendGlobalPathReq() { MessagePad.GlobalPathReq req = MessagePad.GlobalPathReq .newBuilder() .build(); @@ -1351,13 +1467,16 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param flashYellow 黄灯总时间 * @param laneDetail 灯态具体信息 * @param timestamp 当前卫星时间, 单位: ms - * @return + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Deprecated @Override - public boolean sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, - @NonNull String heading, @NonNull String direction, int lightId, int laneNo, - int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail, long timestamp) { + public long sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, + @NonNull String heading, @NonNull String direction, int lightId, int laneNo, + int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail, long timestamp) { if (crossID == null) { crossID = ""; } @@ -1392,7 +1511,10 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * SystemCmdType.SYSTEMCMD_STOP_NODE 停止节点(node表示不同的节点) * SystemCmdType.SYSTEMCMD_POWER_OFF 关机(不需要node) * @param node 0: default, 1: 前向camera 30 2: lidar 3: 左前radar 4: calib_check node - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @ChainLog( linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT, @@ -1401,7 +1523,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec paramIndexes = {0} ) @Override - public boolean sendSystemCmdReq(@NonNull MessagePad.SystemCmdType type, int node) { + public long sendSystemCmdReq(@NonNull MessagePad.SystemCmdType type, int node) { MessagePad.SystemCmdReq.Builder builder = MessagePad.SystemCmdReq.newBuilder(); builder.setCmdType(type); if (node > 0) { @@ -1414,20 +1536,26 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 系统命令请求 重启所有节点 * - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendIpcReboot() { + public long sendIpcReboot() { return sendSystemCmdReq(MessagePad.SystemCmdType.SYSTEMCMD_REBOOT, 0); } /** * 系统命令请求 关机 * - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendIpcPowerOff() { + public long sendIpcPowerOff() { return sendSystemCmdReq(MessagePad.SystemCmdType.SYSTEMCMD_POWER_OFF, 0); } @@ -1435,10 +1563,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 系统命令请求 控制前向camera 30节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendFrontCamera30Cmd(boolean isStart) { + public long sendFrontCamera30Cmd(boolean isStart) { return sendSystemCmdReq(isStart ? MessagePad.SystemCmdType.SYSTEMCMD_START_NODE : MessagePad.SystemCmdType.SYSTEMCMD_STOP_NODE, 1); } @@ -1446,10 +1577,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 系统命令请求 控制lidar节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendLidarCmd(boolean isStart) { + public long sendLidarCmd(boolean isStart) { return sendSystemCmdReq(isStart ? MessagePad.SystemCmdType.SYSTEMCMD_START_NODE : MessagePad.SystemCmdType.SYSTEMCMD_STOP_NODE, 2); } @@ -1457,10 +1591,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 系统命令请求 控制左前radar节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendLeftFrontRadarCmd(boolean isStart) { + public long sendLeftFrontRadarCmd(boolean isStart) { return sendSystemCmdReq(isStart ? MessagePad.SystemCmdType.SYSTEMCMD_START_NODE : MessagePad.SystemCmdType.SYSTEMCMD_STOP_NODE, 3); } @@ -1468,10 +1605,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 系统命令请求 控制标定节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendCalibCheckCmd(boolean isStart) { + public long sendCalibCheckCmd(boolean isStart) { return sendSystemCmdReq(isStart ? MessagePad.SystemCmdType.SYSTEMCMD_START_NODE : MessagePad.SystemCmdType.SYSTEMCMD_STOP_NODE, 4); } @@ -1480,7 +1620,10 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param line 线路相关参数详情见PB message_pad.proto -> Line * @param downloadType 下载类型: 0:正常下载 1:预下载 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @ChainLog( linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT, @@ -1489,7 +1632,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec paramIndexes = {0} ) @Override - public boolean sendTrajectoryDownloadReq(MessagePad.Line line, int downloadType) { + public long sendTrajectoryDownloadReq(MessagePad.Line line, int downloadType) { MessagePad.TrajectoryDownloadReq.Builder builder = MessagePad.TrajectoryDownloadReq.newBuilder(); builder.setSource(1);//指令来源: 0: default, 1:pad, 2:aicloud builder.setLine(line); @@ -1503,16 +1646,20 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 发送 状态查询请求 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - @Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 + //HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 + @Deprecated @Override - public boolean sendStatusQueryReq() { + public long sendStatusQueryReq() { MessagePad.CarConfigResp config = AdasManager.getInstance().getCarConfig(); if (config != null) { //HQ和M1 MAP>=350开始走定频SSM,其他车型360开始 if ((config.getMapVersion() >= 30500 && (config.getIsJinlvM1() || config.getIsHQ())) || config.getMapVersion() >= 30600) { - return false; + return -1L; } } MessagePad.StatusQueryReq req = MessagePad.StatusQueryReq @@ -1526,10 +1673,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 设置雨天模式 * * @param enable 1: enable, 0: disable - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRainModeReq(int enable) { + public long sendRainModeReq(int enable) { MessagePad.SetRainModeReq req = MessagePad.SetRainModeReq .newBuilder() .setEnable(enable) @@ -1543,10 +1693,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合 * @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合 * @param topicsNeedToCache - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRecordDataConfigReq(int reqType, int recordType, List topicsNeedToCache) { + public long sendRecordDataConfigReq(int reqType, int recordType, List topicsNeedToCache) { MessagePad.RecordDataConfigReq.Builder builder = MessagePad.RecordDataConfigReq .newBuilder() .setReqType(reqType) @@ -1559,7 +1712,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /**************************************注册接口相关*******************************************/ @Override - public boolean onSendSubscribe(byte[] bytes) { + public long onSendSubscribe(byte[] bytes) { return sendPBMessage(MessageType.TYPE_SEND_SUBSCRIBE_DATA_REQ, bytes); } @@ -1607,11 +1760,14 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param role 角色 详情参见{@link Constants.TERMINAL_ROLE} * @param type 注册类型 详情参见{@link Constants.SUBSCRIBE_TYPE} * @param messageTypes 要操作的接口 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull Set messageTypes) { - return subscribeInterface != null && subscribeInterface.subscribeInterface(role, type, messageTypes); + public long subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull Set messageTypes) { + return subscribeInterface == null ? -1 : subscribeInterface.subscribeInterface(role, type, messageTypes); } /** @@ -1620,11 +1776,14 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param role 角色 详情参见{@link Constants.TERMINAL_ROLE} * @param type 注册类型 详情参见{@link Constants.SUBSCRIBE_TYPE} * @param messageType 要操作的接口 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull MessageType messageType) { - return subscribeInterface != null && subscribeInterface.subscribeInterface(role, type, messageType); + public long subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull MessageType messageType) { + return subscribeInterface == null ? -1 : subscribeInterface.subscribeInterface(role, type, messageType); } @@ -1632,10 +1791,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 给Planning发送靠边停车指令 * * @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持 - * @return boolean 是否加入发送队列 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendPlanningPullOverCmd(int pullOverCmd) { + public long sendPlanningPullOverCmd(int pullOverCmd) { return sendPlanningCmd(pullOverCmd, -1); } @@ -1644,10 +1806,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * TODO 目前仅襄阳牌照考试支持 * * @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策 - * @return boolean 是否加入发送队列 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendPlanningLaneChangeCmd(int laneChangeCmd) { + public long sendPlanningLaneChangeCmd(int laneChangeCmd) { return sendPlanningCmd(-1, laneChangeCmd); } @@ -1656,10 +1821,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持 * @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策 TODO laneChangeCmd 目前仅襄阳牌照考试支持 - * @return boolean 是否加入发送队列 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendPlanningCmd(int pullOverCmd, int laneChangeCmd) { + public long sendPlanningCmd(int pullOverCmd, int laneChangeCmd) { MessagePad.PlanningCmd.Builder build = MessagePad.PlanningCmd.newBuilder(); if (pullOverCmd > -1) { build.setPullOverCmd(MessagePad.PullOverCmd.newBuilder().setCmd(pullOverCmd)); @@ -1675,10 +1843,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 福田清扫车业务指令下发 * * @param fuTianTaskCmd 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboSweeperFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd) { + public long sendRoboSweeperFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd) { SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd.Builder cmdBuild = SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd .newBuilder() .setRoboSweeperFutianTaskCmd(fuTianTaskCmd); @@ -1689,10 +1860,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 开沃小巴业务指令下发 * * @param vanSkywellTaskCmd 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboVanSkywellTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd vanSkywellTaskCmd) { + public long sendRoboVanSkywellTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd vanSkywellTaskCmd) { SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd.Builder cmdBuild = SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd .newBuilder() .setRoboVanSkywellTaskCmd(vanSkywellTaskCmd); @@ -1706,10 +1880,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param modeCmd 模式 0: default, 1: 自动模式, 2: 制冷模式, 3: 通风模式(仅送风,无温度) * @param windSpeedCmd 风速 0: default, 1: 1档,2: 2档,3:3档 * @param temperatureCmd 温度 0: default, 16-26: 温度 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1AirConditionerCmd(int switchCmd, int modeCmd, int windSpeedCmd, int temperatureCmd) { + public long sendRoboBusJinlvM1AirConditionerCmd(int switchCmd, int modeCmd, int windSpeedCmd, int temperatureCmd) { return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder() .setAirConditionerCmd(switchCmd) .setAirConditionerModeCmd(modeCmd) @@ -1723,10 +1900,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param switchCmd //0: default, 1: 开启暖风机, 2: 关闭暖风机 * @param windSpeedCmd //风速 0: default, 1: 1档,2: 2档 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1HeaderCmd(int switchCmd, int windSpeedCmd) { + public long sendRoboBusJinlvM1HeaderCmd(int switchCmd, int windSpeedCmd) { return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder() .setHeaderCmd(switchCmd) .setHeaderWindSpeedCmd(windSpeedCmd) @@ -1737,10 +1917,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 金旅M1顶灯1控制 * * @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1MainLamp1Cmd(int switchCmd) { + public long sendRoboBusJinlvM1MainLamp1Cmd(int switchCmd) { return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder() .setMainLamp1Cmd(switchCmd) .build()); @@ -1750,10 +1933,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 金旅M1顶灯2控制 * * @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1MainLamp2Cmd(int switchCmd) { + public long sendRoboBusJinlvM1MainLamp2Cmd(int switchCmd) { return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder() .setMainLamp2Cmd(switchCmd) .build()); @@ -1763,10 +1949,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 金旅M1小灯(氛围灯)控制 * * @param switchCmd //0: default, 1: 开启小灯(氛围灯), 2: 关闭小灯(氛围灯) - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1SmallLampCmd(int switchCmd) { + public long sendRoboBusJinlvM1SmallLampCmd(int switchCmd) { return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder() .setSmallLampCmd(switchCmd) .build()); @@ -1776,10 +1965,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 金旅M1车门控制 * * @param switchCmd //0: default, 1: 开启车门, 2: 关闭车门 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1FrontDoorCmd(int switchCmd) { + public long sendRoboBusJinlvM1FrontDoorCmd(int switchCmd) { return sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd.newBuilder() .setFrontDoorCmd(switchCmd) .build()); @@ -1789,10 +1981,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 金旅M1业务指令下发 * * @param roboBusJinlvM1Cmd 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd roboBusJinlvM1Cmd) { + public long sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd roboBusJinlvM1Cmd) { SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd.Builder cmdBuild = SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd .newBuilder() .setRoboBusJinlvM1Cmd(roboBusJinlvM1Cmd); @@ -1803,10 +1998,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 特种车辆命令下发 * * @param cmdBuild 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSpecialVehicleTaskCmd(SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd.Builder cmdBuild) { + public long sendSpecialVehicleTaskCmd(SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd.Builder cmdBuild) { long t = System.currentTimeMillis(); int sec = (int) (t / 1000); int nsec = (int) (t % 1000 * 1000000); @@ -1830,10 +2028,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 向左变道 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendOperatorCmdChangeLaneLeft() { + public long sendOperatorCmdChangeLaneLeft() { MessagePad.OperatorCmdReq req = MessagePad.OperatorCmdReq .newBuilder() .setCmdType(MessagePad.OperatorCmdType.OPERATOR_CMD_CHANGE_LANE) @@ -1845,10 +2046,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 向右变道 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendOperatorCmdChangeLaneRight() { + public long sendOperatorCmdChangeLaneRight() { MessagePad.OperatorCmdReq req = MessagePad.OperatorCmdReq .newBuilder() .setCmdType(MessagePad.OperatorCmdType.OPERATOR_CMD_CHANGE_LANE) @@ -1861,10 +2065,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 发送设置加速度 * * @param acc acc>0加速 acc<0减速 acc=0复位 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendOperatorCmdSetAcceleratedSpeed(double acc) { + public long sendOperatorCmdSetAcceleratedSpeed(double acc) { MessagePad.OperatorCmdReq req = MessagePad.OperatorCmdReq .newBuilder() .setCmdType(MessagePad.OperatorCmdType.OPERATOR_CMD_SET_ACCELERATED_SPEED) @@ -1877,10 +2084,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 鸣笛 * * @param value 1: honk 2: stop honking - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendOperatorCmdSetHorn(double value) { + public long sendOperatorCmdSetHorn(double value) { MessagePad.OperatorCmdReq req = MessagePad.OperatorCmdReq .newBuilder() .setCmdType(MessagePad.OperatorCmdType.OPERATOR_CMD_SET_HORN) @@ -1892,10 +2102,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 开始鸣笛 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendOperatorCmdStartHonking() { + public long sendOperatorCmdStartHonking() { return sendOperatorCmdSetHorn(1); } @@ -1903,10 +2116,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 停止鸣笛 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendOperatorCmdStopHonking() { + public long sendOperatorCmdStopHonking() { return sendOperatorCmdSetHorn(2); } @@ -1915,9 +2131,12 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param type 类型{@link AdasConstants.MapSystemParamType} * @param value 转成字符串的值 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - private boolean sendSetParamReq(int type, String value) { + private long sendSetParamReq(int type, String value) { MessagePad.SetOneParam oneParam = MessagePad.SetOneParam .newBuilder().setType(type).setValue(value).build(); MessagePad.SetParamReq req = MessagePad.SetParamReq @@ -1929,9 +2148,14 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec /** * 设置参数命令V2 + * + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - private boolean sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType paramSetType, T value) { + private long sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType paramSetType, T value) { ParamSetCmdOuterClass.ParamSetCmd.Builder builder = ParamSetCmdOuterClass.ParamSetCmd.newBuilder() .setSrc(1) .setType(paramSetType); @@ -1960,47 +2184,56 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * {@link AdasConstants.MapSystemParamType#V2N_TO_PNC Value类型:boolean或boolean类型String} * {@link AdasConstants.MapSystemParamType#V2I_TO_PNC Value类型:boolean或boolean类型String} * {@link AdasConstants.MapSystemParamType#FUSION_MODE Value类型:int或int类型String} + * {@link AdasConstants.MapSystemParamType#SEAT_STATE Value类型:int或int类型String} * {@link AdasConstants.MapSystemParamType#OVERTAKE_MAX_SPEED Value类型:double或double类型String} - * @return boolean + * {@link AdasConstants.MapSystemParamType#FAULT_SIMULATION_CMD Value类型:int或int类型String} + * @return 消息是否添加到WS消息发送队列。由于批量设置参数,调用的域控接口存在不同,实际调用域控最多2个接口,调用次数最多4次,所以最多返回4条ID数据 + * * 返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSetParamReq(@NonNull Map param) { - boolean isV1 = true; - boolean isV2BlindArea = true; - boolean isV2V2N = true; - boolean isV2V2NI = true; + public Set sendSetParamReq(@NonNull Map param) { + Set result = new HashSet<>(); MessagePad.SetParamReq.Builder builder = MessagePad.SetParamReq.newBuilder(); for (Map.Entry entry : param.entrySet()) { AdasConstants.MapSystemParamType key = entry.getKey(); if (key != AdasConstants.MapSystemParamType.DEFAULT_TYPE && key != AdasConstants.MapSystemParamType.M1_STITCHED_VIDEO_SELF_VEHICLE_PARAM) { Object value = entry.getValue(); if (key == AdasConstants.MapSystemParamType.BLIND_AREA) { - isV2BlindArea = sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea, (Boolean) value); + long isV2BlindArea = sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea, (Boolean) value); + result.add(isV2BlindArea); } else if (key == AdasConstants.MapSystemParamType.V2N_TO_PNC) { - isV2V2N = sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N, (Boolean) value); + long isV2V2N = sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N, (Boolean) value); + result.add(isV2V2N); } else if (key == AdasConstants.MapSystemParamType.V2I_TO_PNC) { - isV2V2NI = sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2I, (Boolean) value); + long isV2V2NI = sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2I, (Boolean) value); + result.add(isV2V2NI); } else { builder.addReqs(MessagePad.SetOneParam.newBuilder().setType(key.getNumber()).setValue(String.valueOf(value))); } } - } if (builder.getReqsCount() > 0) { MessagePad.SetParamReq req = builder.build(); - isV1 = sendPBMessage(MessageType.TYPE_SEND_SET_PARAM_REQ, req.toByteArray()); + long isV1 = sendPBMessage(MessageType.TYPE_SEND_SET_PARAM_REQ, req.toByteArray()); + result.add(isV1); } - return isV1 && isV2BlindArea && isV2V2N && isV2V2NI; + return result; } /** * 绕障类功能开关 * * @param enable 0:关闭,1:开启 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendDetouring(int enable) { + public long sendDetouring(int enable) { return sendSetParamReq(AdasConstants.MapSystemParamType.DETOURING_VALUE, String.valueOf(enable)); } @@ -2008,10 +2241,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 变道绕障的目标障碍物速度阈值 * * @param speed 速度阈值 m/s - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendDetouringSpeed(double speed) { + public long sendDetouringSpeed(double speed) { return sendSetParamReq(AdasConstants.MapSystemParamType.DETOURING_SPEED_VALUE, String.valueOf(speed)); } @@ -2020,10 +2256,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:关闭,1:开启 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendAebCmd(int enable) { + public long sendAebCmd(int enable) { return sendSetParamReq(AdasConstants.MapSystemParamType.AEB_VALUE, String.valueOf(enable)); } @@ -2032,10 +2271,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:正常绕障 1:限制绕障 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendLaneChangeRestrainValid(int enable) { + public long sendLaneChangeRestrainValid(int enable) { return sendSetParamReq(AdasConstants.MapSystemParamType.LANE_CHANGE_RESTRAIN_VALID_VALUE, String.valueOf(enable)); } @@ -2044,10 +2286,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:停车让行线前无需避让等待 1:停车让行线前需要避让等待 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendStopYieldValid(int enable) { + public long sendStopYieldValid(int enable) { return sendSetParamReq(AdasConstants.MapSystemParamType.STOP_YIELD_VALID_VALUE, String.valueOf(enable)); } @@ -2057,10 +2302,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:不使用地图限速功能 1:使用地图限速功能 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendHadmapSpeedLimitValid(int enable) { + public long sendHadmapSpeedLimitValid(int enable) { return sendSetParamReq(AdasConstants.MapSystemParamType.HADMAP_SPEED_LIMIT_VALID_VALUE, String.valueOf(enable)); } @@ -2069,10 +2317,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:普通模式 1:环岛模式 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRampThetaValid(int enable) { + public long sendRampThetaValid(int enable) { return sendSetParamReq(AdasConstants.MapSystemParamType.RAMP_THETA_VALID_VALUE, String.valueOf(enable)); } @@ -2080,10 +2331,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 弱网减速停车策略开关 * * @param enable 0:关闭弱网减速停车策略 1:使用弱网减速停车策略 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendWeakNetSlowDown(int enable) { + public long sendWeakNetSlowDown(int enable) { return sendSetParamReq(AdasConstants.MapSystemParamType.WEAK_NET_SLOW_DOWN_VALUE, String.valueOf(enable)); } @@ -2091,10 +2345,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 故障减速停车策路开关 * * @param enable 0:关闭故障减速停车策略 1:使用故障减速停车策略 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendBreakdownSlowDown(int enable) { + public long sendBreakdownSlowDown(int enable) { return sendSetParamReq(AdasConstants.MapSystemParamType.BREAKDOWN_SLOW_DOWN_VALUE, String.valueOf(enable)); } @@ -2102,10 +2359,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 融合模式 * * @param cmd 1:全融合模式 2:盲区模式 3:超视距模式 4:透传模式 5:纯路侧模式,默认1 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendFusionMode(int cmd) { + public long sendFusionMode(int cmd) { return sendSetParamReq(AdasConstants.MapSystemParamType.FUSION_MODE_VALUE, String.valueOf(cmd)); } @@ -2113,10 +2373,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 超车的最大速度阈值(double, m/s, 范围[3, 12.5]) * * @param maxSpeed m/s, 范围[3, 12.5] - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendOvertakeMaxSpeed(double maxSpeed) { + public long sendOvertakeMaxSpeed(double maxSpeed) { return sendSetParamReq(AdasConstants.MapSystemParamType.OVERTAKE_MAX_SPEED_VALUE, String.valueOf(maxSpeed)); } @@ -2124,10 +2387,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 盲区数据开关 * * @param switchCmd 数据开关 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendBlindAreaCmd(boolean switchCmd) { + public long sendBlindAreaCmd(boolean switchCmd) { return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeBlindArea, switchCmd); } @@ -2135,10 +2401,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 控制V2N进PnC * * @param switchCmd true:发给PnC,false:不发给PnC - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendV2nToPncCmd(boolean switchCmd) { + public long sendV2nToPncCmd(boolean switchCmd) { return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2N, switchCmd); } @@ -2146,33 +2415,44 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 控制V2I进PnC * * @param switchCmd true:发给Pnc和鹰眼,false:不发给PnC和鹰眼 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendV2iToPncCmd(boolean switchCmd) { + public long sendV2iToPncCmd(boolean switchCmd) { return sendSetParamReqV2(ParamSetCmdOuterClass.ParamSetType.ParamSetTypeV2I, switchCmd); } /** * 获取全部参数 * 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq, AdasParam)} + * MAP340 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendGetAllParamReq() { + public long sendGetAllParamReq() { return sendGetParamReq((AdasConstants.MapSystemParamType[]) null); } /** * 参数获取请求 * 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq, AdasParam)} + * MAP340 * * @param paramType 参数类型:libraries/mogo-adas-data/src/main/proto/personal/adas_constants.proto - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendGetParamReq(AdasConstants.MapSystemParamType... paramType) { + public long sendGetParamReq(AdasConstants.MapSystemParamType... paramType) { MessagePad.SetParamReq req; if (paramType == null || paramType[0] == null || (paramType.length == 1 && paramType[0] == AdasConstants.MapSystemParamType.DEFAULT_TYPE)) { req = MessagePad.SetParamReq @@ -2191,6 +2471,7 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec .addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.V2N_TO_PNC_VALUE)) .addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.V2I_TO_PNC_VALUE)) .addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.FUSION_MODE_VALUE)) + .addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.SEAT_STATE_VALUE)) .addReqs(MessagePad.SetOneParam.newBuilder().setType(AdasConstants.MapSystemParamType.OVERTAKE_MAX_SPEED_VALUE)) .build(); } else { @@ -2216,10 +2497,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param departureStopName 出站站点名 * @param arrivalStopName 下一站到达站点名 * @param isLastStop 是否最终站 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendTripInfoReq(int type, String lineName, String departureStopName, String arrivalStopName, boolean isLastStop) { + public long sendTripInfoReq(int type, String lineName, String departureStopName, String arrivalStopName, boolean isLastStop) { MessagePad.TripInfoEvent.Builder builder = MessagePad.TripInfoEvent .newBuilder() .setType(type); @@ -2242,10 +2526,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 发送包管理请求 * * @param bagManager 包管理参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendBagManagerCmd(BagManagerOuterClass.BagManager bagManager) { + public long sendBagManagerCmd(BagManagerOuterClass.BagManager bagManager) { return sendPBMessage(MessageType.TYPE_SEND_BAG_MANAGER_CMD, bagManager.toByteArray()); } @@ -2255,10 +2542,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * 当FSMFunctionStates的类型是PILOT_DRIVING_OFF时会自动调用 * * @param type 0:default, 1:请求反馈原因 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendFSMStatusReasonQuery(int type) { + public long sendFSMStatusReasonQuery(int type) { FSMStatusReasonQueryOuterClass.FSMStatusReasonQuery query = FSMStatusReasonQueryOuterClass.FSMStatusReasonQuery.newBuilder() .setType(type) .build(); @@ -2272,9 +2562,12 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param messageType PAD到AI云消息类型 * @param reqNo 请求编号 * @param payload 有效数据 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - private boolean sendAiCloudTaskCmd(@NonNull MessageType padMessageType, @NonNull AiCloudTask.MessageType messageType, @NonNull String reqNo, @NonNull com.google.protobuf.ByteString payload) { + private long sendAiCloudTaskCmd(@NonNull MessageType padMessageType, @NonNull AiCloudTask.MessageType messageType, @NonNull String reqNo, @NonNull com.google.protobuf.ByteString payload) { AiCloudTask.AiCloudPadMessage.Builder builder = AiCloudTask.AiCloudPadMessage.newBuilder() .setMsgType(messageType.getNumber()) .setSysTime(System.currentTimeMillis()); @@ -2294,10 +2587,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param reqNo 请求编号 * @param startTaskResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperStartTaskResp(@NonNull String reqNo, @NonNull SweeperTask.StartTaskResp startTaskResp) { + public long sendSweeperStartTaskResp(@NonNull String reqNo, @NonNull SweeperTask.StartTaskResp startTaskResp) { return sendAiCloudTaskCmd(MessageType.TYPE_SEND_SWEEPER_CLOUD_TASK_CMD, AiCloudTask.MessageType.CloudPushTask, reqNo, startTaskResp.toByteString()); } @@ -2307,10 +2603,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param reqNo 请求编号 * @param taskConfirmResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperTaskConfirmResp(@NonNull String reqNo, @NonNull SweeperTaskConfirm.TaskConfirmResp taskConfirmResp) { + public long sendSweeperTaskConfirmResp(@NonNull String reqNo, @NonNull SweeperTaskConfirm.TaskConfirmResp taskConfirmResp) { return sendAiCloudTaskCmd(MessageType.TYPE_SEND_SWEEPER_CLOUD_TASK_CMD, AiCloudTask.MessageType.CloudPushTaskConfirm, reqNo, taskConfirmResp.toByteString()); } @@ -2320,10 +2619,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param reqNo 请求编号 * @param stopTaskResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperStopTaskResp(@NonNull String reqNo, @NonNull SweeperTaskStop.StopTaskResp stopTaskResp) { + public long sendSweeperStopTaskResp(@NonNull String reqNo, @NonNull SweeperTaskStop.StopTaskResp stopTaskResp) { return sendAiCloudTaskCmd(MessageType.TYPE_SEND_SWEEPER_CLOUD_TASK_CMD, AiCloudTask.MessageType.CloudPushTaskStop, reqNo, stopTaskResp.toByteString()); } @@ -2335,10 +2637,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * @param isSuspend true:挂起任务 false:恢复挂起的任务 * @param reqNo 请求编号 * @param suspendResumeTaskReq 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperSuspendResumeTaskReq(boolean isSuspend, @NonNull String reqNo, @NonNull SweeperTaskSuspendResume.SuspendResumeTaskReq suspendResumeTaskReq) { + public long sendSweeperSuspendResumeTaskReq(boolean isSuspend, @NonNull String reqNo, @NonNull SweeperTaskSuspendResume.SuspendResumeTaskReq suspendResumeTaskReq) { return sendAiCloudTaskCmd(MessageType.TYPE_SEND_SWEEPER_CLOUD_TASK_CMD, isSuspend ? AiCloudTask.MessageType.PadSendTaskSuspend : AiCloudTask.MessageType.PadSendTaskResume, reqNo, suspendResumeTaskReq.toByteString()); } @@ -2349,10 +2654,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param reqNo 请求编号 * @param getTaskReq 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperGetTaskReq(@NonNull String reqNo, @NonNull SweeperTask.GetTaskReq getTaskReq) { + public long sendSweeperGetTaskReq(@NonNull String reqNo, @NonNull SweeperTask.GetTaskReq getTaskReq) { return sendAiCloudTaskCmd(MessageType.TYPE_SEND_SWEEPER_CLOUD_TASK_CMD, AiCloudTask.MessageType.PadSendGetTaskReq, reqNo, getTaskReq.toByteString()); } @@ -2362,23 +2670,29 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param reqNo 请求编号 * @param isBootable 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperAutopilotBootable(@NonNull String reqNo, @NonNull SweeperBootable.IsBootable isBootable) { + public long sendSweeperAutopilotBootable(@NonNull String reqNo, @NonNull SweeperBootable.IsBootable isBootable) { return sendAiCloudTaskCmd(MessageType.TYPE_SEND_SWEEPER_CLOUD_TASK_CMD, AiCloudTask.MessageType.PadSendBootable, reqNo, isBootable.toByteString()); } /** - * pad收到云端下发暂停恢复响应 + * pad收到云端下发暂停回复响应 * 10、云端下发任务暂停/恢复指令到pad(type: 100010)sweeper_task_cloud_suspend_resume.proto/BigTaskActionResp * * @param reqNo 请求编号 * @param bigTaskActionResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperCloudSuspendResumeTaskResp(@NonNull String reqNo, @NonNull SweeperTaskCloudSuspendResume.BigTaskActionResp bigTaskActionResp) { + public long sendSweeperCloudSuspendResumeTaskResp(@NonNull String reqNo, @NonNull SweeperTaskCloudSuspendResume.BigTaskActionResp bigTaskActionResp) { return sendAiCloudTaskCmd(MessageType.TYPE_SEND_SWEEPER_CLOUD_TASK_CMD, AiCloudTask.MessageType.CloudPushTaskSuspendResume, reqNo, bigTaskActionResp.toByteString()); } @@ -2387,10 +2701,13 @@ public class AdasChannel implements IAdasNetCommApi, FpgaSocket.IWebSocketConnec * * @param reqNo 请求编号 * @param parallelRequest 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendParallelDrivingReq(@NonNull String reqNo, @NonNull ParallelDrivingRequest.ParallelRequest parallelRequest) { + public long sendParallelDrivingReq(@NonNull String reqNo, @NonNull ParallelDrivingRequest.ParallelRequest parallelRequest) { return sendAiCloudTaskCmd(MessageType.TYPE_SEND_PARALLEL_DRIVING_REQ, AiCloudTask.MessageType.ParallelDrivingCmd, reqNo, parallelRequest.toByteString()); } diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java index 967e63a522..7cb6bdc56d 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/AdasManager.java @@ -270,8 +270,9 @@ public class AdasManager implements IAdasNetCommApi { /** * 获取工控机链接配置 + * 如果返回空,表示没有正确初始化或没有配置 * - * @return 工控机链接参数,如果未调用create 返回null + * @return 工控机链接参数 */ @Override public AdasOptions getAdasOptions() { @@ -324,9 +325,12 @@ public class AdasManager implements IAdasNetCommApi { * @param sn SN * @param environment 环境 详情参见{@link Constants.ENVIRONMENT}1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境 * @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE} - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - public boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role) { + public long sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role) { return sendBasicInfoResp(sn, environment, role, -1, null, null); } @@ -338,9 +342,12 @@ public class AdasManager implements IAdasNetCommApi { * @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE} * @param versionCode 鹰眼版本号 * @param versionName 鹰眼版本名 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - public boolean sendBasicInfoResp(@NonNull String sn, int environment, int role, int versionCode, String versionName) { + public long sendBasicInfoResp(@NonNull String sn, int environment, int role, int versionCode, String versionName) { return sendBasicInfoResp(sn, environment, role, versionCode, versionName, null); } @@ -351,9 +358,12 @@ public class AdasManager implements IAdasNetCommApi { * @param environment 环境 详情参见{@link Constants.ENVIRONMENT}1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境 * @param role 终端角色 详情参见{@link Constants.TERMINAL_ROLE} * @param deviceCrt 鹰眼ssl证书 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - public boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, String deviceCrt) { + public long sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, String deviceCrt) { return sendBasicInfoResp(sn, environment, role, -1, null, deviceCrt); } @@ -366,11 +376,14 @@ public class AdasManager implements IAdasNetCommApi { * @param versionCode 鹰眼版本号 * @param versionName 鹰眼版本名 * @param deviceCrt 鹰眼ssl证书 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, int versionCode, String versionName, String deviceCrt) { - return mChannel != null && mChannel.sendBasicInfoResp(sn, environment, role, versionCode, versionName, deviceCrt); + public long sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, int versionCode, String versionName, String deviceCrt) { + return mChannel == null ? -1L : mChannel.sendBasicInfoResp(sn, environment, role, versionCode, versionName, deviceCrt); } /** @@ -379,32 +392,41 @@ public class AdasManager implements IAdasNetCommApi { * @param mode 1: enter autopilot mode, 0: quit autopilot mode * @param source 命令来源: 0: pad模拟, 1: pad业务, 2:aicloud, 3:魔方(清扫车MAP Version==332以及MAP Version>=350,其他车型目前未上线) * @param routeInfo 自动驾驶路径信息 - * @return + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo) { - return mChannel != null && mChannel.sendAutoPilotModeReq(mode, source, routeInfo); + public long sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo) { + return mChannel == null ? -1L : mChannel.sendAutoPilotModeReq(mode, source, routeInfo); } /** * 设置演示模式 * * @param enable 1: enable, 0: disable - * @return + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendDemoModeReq(int enable) { - return mChannel != null && mChannel.sendDemoModeReq(enable); + public long sendDemoModeReq(int enable) { + return mChannel == null ? -1L : mChannel.sendDemoModeReq(enable); } /** * 车机基础信息请求 * - * @return + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendCarConfigReq() { - return mChannel != null && mChannel.sendCarConfigReq(); + public long sendCarConfigReq() { + return mChannel == null ? -1L : mChannel.sendCarConfigReq(); } /** @@ -414,130 +436,170 @@ public class AdasManager implements IAdasNetCommApi { * @param filename 文件路径 * @param reasonID 接管原因id * @param reason 接管原因 - * @return + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason) { - return mChannel != null && mChannel.sendRecordCause(key, filename, reasonID, reason); - } - - /** - * 同下 - * - * @param id - * @param type - * @return - */ - @Override - public boolean startRecordPackage(int id, int type) { - return mChannel != null && mChannel.startRecordPackage(id, type); - } - - /** - * 同下 - * - * @param id - * @param duration - * @param type - * @return - */ - @Override - public boolean startRecordPackage(int id, int duration, int type) { - return mChannel != null && mChannel.startRecordPackage(id, duration, type); - } - - /** - * 同下 - * - * @param id - * @param duration - * @param type - * @param bduration - * @return - */ - @Override - public boolean startRecordPackage(int id, int duration, int type, int bduration) { - return mChannel != null && mChannel.startRecordPackage(id, duration, type, bduration); - } - - /** - * 同下 - * - * @param id - * @param type - * @param topics - * @return - */ - @Override - public boolean startRecordPackage(int id, int type, List topics) { - return mChannel != null && mChannel.startRecordPackage(id, type, topics); - } - - /** - * 同下 - * - * @param id - * @param duration - * @param type - * @param topics - * @return - */ - @Override - public boolean startRecordPackage(int id, int duration, int type, List topics) { - return mChannel != null && mChannel.startRecordPackage(id, duration, type, topics); - } - - /** - * 同下 - * - * @param id - * @param duration - * @param type - * @param bduration - * @param topics - * @return - */ - @Override - public boolean startRecordPackage(int id, int duration, int type, int bduration, List topics) { - return mChannel != null && mChannel.startRecordPackage(id, duration, type, bduration, topics); - } - - /** - * 同下 - * - * @param id - * @param type - * @return - */ - @Override - public boolean stopRecordPackage(int id, int type) { - return mChannel != null && mChannel.stopRecordPackage(id, type); + public long sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason) { + return mChannel == null ? -1L : mChannel.sendRecordCause(key, filename, reasonID, reason); } /** * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 * - * @param id 采集id - * @param duration 采集时间长 - * @param type 采集类型, 1:badcase, 2: map; 3: rests - * @param isRecord 采集指令, true: 采集, false: 停止采集 - * @param bduration 前溯时长 - * @return boolean + * @param id 采集id + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRecordData(int id, int duration, int type, boolean isRecord, int bduration, List topics) { - return mChannel != null && mChannel.sendRecordData(id, duration, type, isRecord, bduration, topics); + public long startRecordPackage(int id, int type) { + return mChannel == null ? -1L : mChannel.startRecordPackage(id, type); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long startRecordPackage(int id, int duration, int type) { + return mChannel == null ? -1L : mChannel.startRecordPackage(id, duration, type); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param bduration 前溯时长 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long startRecordPackage(int id, int duration, int type, int bduration) { + return mChannel == null ? -1L : mChannel.startRecordPackage(id, duration, type, bduration); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long startRecordPackage(int id, int type, List topics) { + return mChannel == null ? -1L : mChannel.startRecordPackage(id, type, topics); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long startRecordPackage(int id, int duration, int type, List topics) { + return mChannel == null ? -1L : mChannel.startRecordPackage(id, duration, type, topics); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param bduration 前溯时长 + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long startRecordPackage(int id, int duration, int type, int bduration, List topics) { + return mChannel == null ? -1L : mChannel.startRecordPackage(id, duration, type, bduration, topics); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long stopRecordPackage(int id, int type) { + return mChannel == null ? -1L : mChannel.stopRecordPackage(id, type); + } + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * * param sustain 是否持续采集 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param isRecord 采集指令, true: 采集, false: 停止采集 + * @param bduration 前溯时长 + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + @Override + public long sendRecordData(int id, int duration, int type, boolean isRecord, int bduration, List topics) { + return mChannel == null ? -1L : mChannel.sendRecordData(id, duration, type, isRecord, bduration, topics); } /** * 设置自动驾驶最大速度 * * @param speedLimit 最大车辆速度 m/s - * @return + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendAutopilotSpeedReq(double speedLimit) { - return mChannel != null && mChannel.sendAutopilotSpeedReq(speedLimit); + public long sendAutopilotSpeedReq(double speedLimit) { + return mChannel == null ? -1L : mChannel.sendAutopilotSpeedReq(speedLimit); } /** @@ -545,8 +607,8 @@ public class AdasManager implements IAdasNetCommApi { * TODO MAP290开始此接口弃用 * * @param crossID roadID - * @param latitude - * @param longitude + * @param latitude 纬度 + * @param longitude 经度 * @param heading 红绿灯方向 * @param direction 路的航向角 * @param lightId 红绿灯ID @@ -555,22 +617,28 @@ public class AdasManager implements IAdasNetCommApi { * @param flashYellow 黄灯总时间 * @param laneDetail 灯态具体信息 * @param timestamp 当前卫星时间, 单位: ms - * @return + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Deprecated @Override - public boolean sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, @NonNull String heading, @NonNull String direction, int lightId, int laneNo, int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail, long timestamp) { - return mChannel != null && mChannel.sendTrafficLightData(crossID, latitude, longitude, heading, direction, lightId, laneNo, arrowNo, flashYellow, laneDetail, timestamp); + public long sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, @NonNull String heading, @NonNull String direction, int lightId, int laneNo, int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail, long timestamp) { + return mChannel == null ? -1L : mChannel.sendTrafficLightData(crossID, latitude, longitude, heading, direction, lightId, laneNo, arrowNo, flashYellow, laneDetail, timestamp); } /** * 自动驾驶路径请求 * - * @return + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendGlobalPathReq() { - return mChannel != null && mChannel.sendGlobalPathReq(); + public long sendGlobalPathReq() { + return mChannel == null ? -1L : mChannel.sendGlobalPathReq(); } /** @@ -581,85 +649,109 @@ public class AdasManager implements IAdasNetCommApi { * SystemCmdType.SYSTEMCMD_STOP_NODE 停止节点(node表示不同的节点) * SystemCmdType.SYSTEMCMD_POWER_OFF 关机(不需要node) * @param node 0: default, 1: 前向camera 30 2: lidar 3: 左前radar 4: calib_check node - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSystemCmdReq(@NonNull MessagePad.SystemCmdType type, int node) { - return mChannel != null && mChannel.sendSystemCmdReq(type, node); + public long sendSystemCmdReq(@NonNull MessagePad.SystemCmdType type, int node) { + return mChannel == null ? -1L : mChannel.sendSystemCmdReq(type, node); } /** * 系统命令请求 重启所有节点 * - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendIpcReboot() { - return mChannel != null && mChannel.sendIpcReboot(); + public long sendIpcReboot() { + return mChannel == null ? -1L : mChannel.sendIpcReboot(); } /** * 系统命令请求 关机 * - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendIpcPowerOff() { - return mChannel != null && mChannel.sendIpcPowerOff(); + public long sendIpcPowerOff() { + return mChannel == null ? -1L : mChannel.sendIpcPowerOff(); } /** * 系统命令请求 控制前向camera 30节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendFrontCamera30Cmd(boolean isStart) { - return mChannel != null && mChannel.sendFrontCamera30Cmd(isStart); + public long sendFrontCamera30Cmd(boolean isStart) { + return mChannel == null ? -1L : mChannel.sendFrontCamera30Cmd(isStart); } /** * 系统命令请求 控制lidar节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendLidarCmd(boolean isStart) { - return mChannel != null && mChannel.sendLidarCmd(isStart); + public long sendLidarCmd(boolean isStart) { + return mChannel == null ? -1L : mChannel.sendLidarCmd(isStart); } /** * 系统命令请求 控制左前radar节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendLeftFrontRadarCmd(boolean isStart) { - return mChannel != null && mChannel.sendLeftFrontRadarCmd(isStart); + public long sendLeftFrontRadarCmd(boolean isStart) { + return mChannel == null ? -1L : mChannel.sendLeftFrontRadarCmd(isStart); } /** * 系统命令请求 控制标定节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendCalibCheckCmd(boolean isStart) { - return mChannel != null && mChannel.sendCalibCheckCmd(isStart); + public long sendCalibCheckCmd(boolean isStart) { + return mChannel == null ? -1L : mChannel.sendCalibCheckCmd(isStart); } /** * 发送 轨迹下载请求 * * @param line 线路相关参数详情见PB message_pad.proto -> Line - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - public boolean sendTrajectoryDownloadReq(MessagePad.Line line) { - return mChannel != null && mChannel.sendTrajectoryDownloadReq(line, -1); + public long sendTrajectoryDownloadReq(MessagePad.Line line) { + return mChannel == null ? -1L : mChannel.sendTrajectoryDownloadReq(line, -1); } /** @@ -667,33 +759,43 @@ public class AdasManager implements IAdasNetCommApi { * * @param line 线路相关参数详情见PB message_pad.proto -> Line * @param downloadType 下载类型: 0:正常下载 1:预下载 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendTrajectoryDownloadReq(MessagePad.Line line, int downloadType) { - return mChannel != null && mChannel.sendTrajectoryDownloadReq(line, downloadType); + public long sendTrajectoryDownloadReq(MessagePad.Line line, int downloadType) { + return mChannel == null ? -1L : mChannel.sendTrajectoryDownloadReq(line, downloadType); } /** * 发送 状态查询请求 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - @Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 + //HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 + @Deprecated @Override - public boolean sendStatusQueryReq() { - return mChannel != null && mChannel.sendStatusQueryReq(); + public long sendStatusQueryReq() { + return mChannel == null ? -1L : mChannel.sendStatusQueryReq(); } /** * 设置雨天模式 * * @param enable 1: enable, 0: disable - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRainModeReq(int enable) { - return mChannel != null && mChannel.sendRainModeReq(enable); + public long sendRainModeReq(int enable) { + return mChannel == null ? -1L : mChannel.sendRainModeReq(enable); } /** @@ -702,11 +804,14 @@ public class AdasManager implements IAdasNetCommApi { * @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合 * @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合 * @param topicsNeedToCache - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRecordDataConfigReq(int reqType, int recordType, List topicsNeedToCache) { - return mChannel != null && mChannel.sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache); + public long sendRecordDataConfigReq(int reqType, int recordType, List topicsNeedToCache) { + return mChannel == null ? -1L : mChannel.sendRecordDataConfigReq(reqType, recordType, topicsNeedToCache); } /** @@ -753,35 +858,44 @@ public class AdasManager implements IAdasNetCommApi { * @param role 角色 详情参见{@link Constants.TERMINAL_ROLE} * @param type 注册类型 详情参见{@link Constants.SUBSCRIBE_TYPE} * @param messageTypes 要操作的接口 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull Set messageTypes) { - return mChannel != null && mChannel.subscribeInterface(role, type, messageTypes); + public long subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull Set messageTypes) { + return mChannel == null ? -1L : mChannel.subscribeInterface(role, type, messageTypes); } /** * 注册或取消注册 * - * @param role 角色 详情参见{@link Constants.TERMINAL_ROLE} - * @param type 注册类型 详情参见{@link Constants.SUBSCRIBE_TYPE} + * @param role 角色 详情参见{@link AdasConstants.TerminalRole} + * @param type 注册类型 详情参见{@link AdasConstants.SubscribeType} * @param messageType 要操作的接口 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull MessageType messageType) { - return mChannel != null && mChannel.subscribeInterface(role, type, messageType); + public long subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull MessageType messageType) { + return mChannel == null ? -1L : mChannel.subscribeInterface(role, type, messageType); } /** * 给Planning发送靠边停车指令 * * @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持 - * @return boolean 是否加入发送队列 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendPlanningPullOverCmd(int pullOverCmd) { - return mChannel != null && mChannel.sendPlanningPullOverCmd(pullOverCmd); + public long sendPlanningPullOverCmd(int pullOverCmd) { + return mChannel == null ? -1L : mChannel.sendPlanningPullOverCmd(pullOverCmd); } /** @@ -789,11 +903,14 @@ public class AdasManager implements IAdasNetCommApi { * TODO 目前仅襄阳牌照考试支持 * * @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策 - * @return boolean 是否加入发送队列 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendPlanningLaneChangeCmd(int laneChangeCmd) { - return mChannel != null && mChannel.sendPlanningLaneChangeCmd(laneChangeCmd); + public long sendPlanningLaneChangeCmd(int laneChangeCmd) { + return mChannel == null ? -1L : mChannel.sendPlanningLaneChangeCmd(laneChangeCmd); } /** @@ -801,11 +918,14 @@ public class AdasManager implements IAdasNetCommApi { * * @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持 * @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策 TODO laneChangeCmd 目前仅襄阳牌照考试支持 - * @return boolean 是否加入发送队列 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendPlanningCmd(int pullOverCmd, int laneChangeCmd) { - return mChannel != null && mChannel.sendPlanningCmd(pullOverCmd, laneChangeCmd); + public long sendPlanningCmd(int pullOverCmd, int laneChangeCmd) { + return mChannel == null ? -1L : mChannel.sendPlanningCmd(pullOverCmd, laneChangeCmd); } /** @@ -816,30 +936,36 @@ public class AdasManager implements IAdasNetCommApi { * @return boolean */ @Deprecated - public boolean sendPlanningCmd(int cmd) { - return mChannel != null && mChannel.sendPlanningPullOverCmd(cmd); + public long sendPlanningCmd(int cmd) { + return mChannel == null ? -1L : mChannel.sendPlanningPullOverCmd(cmd); } /** * 福田清扫车业务指令下发 * * @param fuTianTaskCmd 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboSweeperFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd) { - return mChannel != null && mChannel.sendRoboSweeperFuTianTaskCmd(fuTianTaskCmd); + public long sendRoboSweeperFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd) { + return mChannel == null ? -1L : mChannel.sendRoboSweeperFuTianTaskCmd(fuTianTaskCmd); } /** * 开沃小巴业务指令下发 * * @param vanSkywellTaskCmd 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboVanSkywellTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd vanSkywellTaskCmd) { - return mChannel != null && mChannel.sendRoboVanSkywellTaskCmd(vanSkywellTaskCmd); + public long sendRoboVanSkywellTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd vanSkywellTaskCmd) { + return mChannel == null ? -1L : mChannel.sendRoboVanSkywellTaskCmd(vanSkywellTaskCmd); } /** @@ -849,11 +975,14 @@ public class AdasManager implements IAdasNetCommApi { * @param modeCmd 模式 0: default, 1: 自动模式, 2: 制冷模式, 3: 通风模式(仅送风,无温度) * @param windSpeedCmd 风速 0: default, 1: 1档,2: 2档,3:3档 * @param temperatureCmd 温度 0: default, 16-26: 温度 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1AirConditionerCmd(int switchCmd, int modeCmd, int windSpeedCmd, int temperatureCmd) { - return mChannel != null && mChannel.sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd); + public long sendRoboBusJinlvM1AirConditionerCmd(int switchCmd, int modeCmd, int windSpeedCmd, int temperatureCmd) { + return mChannel == null ? -1L : mChannel.sendRoboBusJinlvM1AirConditionerCmd(switchCmd, modeCmd, windSpeedCmd, temperatureCmd); } /** @@ -861,130 +990,206 @@ public class AdasManager implements IAdasNetCommApi { * * @param switchCmd //0: default, 1: 开启暖风机, 2: 关闭暖风机 * @param windSpeedCmd //风速 0: default, 1: 1档,2: 2档 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1HeaderCmd(int switchCmd, int windSpeedCmd) { - return mChannel != null && mChannel.sendRoboBusJinlvM1HeaderCmd(switchCmd, windSpeedCmd); + public long sendRoboBusJinlvM1HeaderCmd(int switchCmd, int windSpeedCmd) { + return mChannel == null ? -1L : mChannel.sendRoboBusJinlvM1HeaderCmd(switchCmd, windSpeedCmd); } /** * 金旅M1顶灯1控制 * * @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1MainLamp1Cmd(int switchCmd) { - return mChannel != null && mChannel.sendRoboBusJinlvM1MainLamp1Cmd(switchCmd); + public long sendRoboBusJinlvM1MainLamp1Cmd(int switchCmd) { + return mChannel == null ? -1L : mChannel.sendRoboBusJinlvM1MainLamp1Cmd(switchCmd); } /** * 金旅M1顶灯2控制 * * @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1MainLamp2Cmd(int switchCmd) { - return mChannel != null && mChannel.sendRoboBusJinlvM1MainLamp2Cmd(switchCmd); + public long sendRoboBusJinlvM1MainLamp2Cmd(int switchCmd) { + return mChannel == null ? -1L : mChannel.sendRoboBusJinlvM1MainLamp2Cmd(switchCmd); } /** * 金旅M1小灯(氛围灯)控制 * * @param switchCmd //0: default, 1: 开启小灯(氛围灯), 2: 关闭小灯(氛围灯) - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1SmallLampCmd(int switchCmd) { - return mChannel != null && mChannel.sendRoboBusJinlvM1SmallLampCmd(switchCmd); + public long sendRoboBusJinlvM1SmallLampCmd(int switchCmd) { + return mChannel == null ? -1L : mChannel.sendRoboBusJinlvM1SmallLampCmd(switchCmd); } /** * 金旅M1车门控制 * * @param switchCmd //0: default, 1: 开启车门, 2: 关闭车门 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1FrontDoorCmd(int switchCmd) { - return mChannel != null && mChannel.sendRoboBusJinlvM1FrontDoorCmd(switchCmd); + public long sendRoboBusJinlvM1FrontDoorCmd(int switchCmd) { + return mChannel == null ? -1L : mChannel.sendRoboBusJinlvM1FrontDoorCmd(switchCmd); } /** * 金旅M1业务指令下发 * * @param roboBusJinlvM1Cmd 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd roboBusJinlvM1Cmd) { - return mChannel != null && mChannel.sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd); + public long sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd roboBusJinlvM1Cmd) { + return mChannel == null ? -1L : mChannel.sendRoboBusJinlvM1TaskCmd(roboBusJinlvM1Cmd); } /** * 特种车辆命令下发 * * @param cmdBuild 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSpecialVehicleTaskCmd(SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd.Builder cmdBuild) { - return mChannel != null && mChannel.sendSpecialVehicleTaskCmd(cmdBuild); + public long sendSpecialVehicleTaskCmd(SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd.Builder cmdBuild) { + return mChannel == null ? -1L : mChannel.sendSpecialVehicleTaskCmd(cmdBuild); } - + /** + * 向左变道 + * + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ @Override - public boolean sendOperatorCmdChangeLaneLeft() { - return mChannel != null && mChannel.sendOperatorCmdChangeLaneLeft(); + public long sendOperatorCmdChangeLaneLeft() { + return mChannel == null ? -1L : mChannel.sendOperatorCmdChangeLaneLeft(); } + /** + * 向右变道 + * + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ @Override - public boolean sendOperatorCmdChangeLaneRight() { - return mChannel != null && mChannel.sendOperatorCmdChangeLaneRight(); + public long sendOperatorCmdChangeLaneRight() { + return mChannel == null ? -1L : mChannel.sendOperatorCmdChangeLaneRight(); } + /** + * 发送设置加速度 + * + * @param acc acc>0加速 acc<0减速 acc=0复位 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ @Override - public boolean sendOperatorCmdSetAcceleratedSpeed(double acc) { - return mChannel != null && mChannel.sendOperatorCmdSetAcceleratedSpeed(acc); + public long sendOperatorCmdSetAcceleratedSpeed(double acc) { + return mChannel == null ? -1L : mChannel.sendOperatorCmdSetAcceleratedSpeed(acc); } + /** + * 鸣笛 + * + * @param value 1: honk 2: stop honking + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ @Override - public boolean sendOperatorCmdSetHorn(double value) { - return mChannel != null && mChannel.sendOperatorCmdSetHorn(value); + public long sendOperatorCmdSetHorn(double value) { + return mChannel == null ? -1L : mChannel.sendOperatorCmdSetHorn(value); } + /** + * 开始鸣笛 + * + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ @Override - public boolean sendOperatorCmdStartHonking() { - return mChannel != null && mChannel.sendOperatorCmdStartHonking(); + public long sendOperatorCmdStartHonking() { + return mChannel == null ? -1L : mChannel.sendOperatorCmdStartHonking(); } + /** + * 停止鸣笛 + * + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ @Override - public boolean sendOperatorCmdStopHonking() { - return mChannel != null && mChannel.sendOperatorCmdStopHonking(); + public long sendOperatorCmdStopHonking() { + return mChannel == null ? -1L : mChannel.sendOperatorCmdStopHonking(); } /** * 绕障类功能开关 * * @param enable 0:关闭,1:开启 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendDetouring(int enable) { - return mChannel != null && mChannel.sendDetouring(enable); + public long sendDetouring(int enable) { + return mChannel == null ? -1L : mChannel.sendDetouring(enable); } /** * 变道绕障的目标障碍物速度阈值 * * @param speed 速度阈值 m/s - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendDetouringSpeed(double speed) { - return mChannel != null && mChannel.sendDetouringSpeed(speed); + public long sendDetouringSpeed(double speed) { + return mChannel == null ? -1L : mChannel.sendDetouringSpeed(speed); } /** @@ -992,11 +1197,14 @@ public class AdasManager implements IAdasNetCommApi { * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:关闭,1:开启 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendAebCmd(int enable) { - return mChannel != null && mChannel.sendAebCmd(enable); + public long sendAebCmd(int enable) { + return mChannel == null ? -1L : mChannel.sendAebCmd(enable); } /** @@ -1004,11 +1212,14 @@ public class AdasManager implements IAdasNetCommApi { * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:正常绕障 1:限制绕障 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendLaneChangeRestrainValid(int enable) { - return mChannel != null && mChannel.sendLaneChangeRestrainValid(enable); + public long sendLaneChangeRestrainValid(int enable) { + return mChannel == null ? -1L : mChannel.sendLaneChangeRestrainValid(enable); } /** @@ -1016,11 +1227,14 @@ public class AdasManager implements IAdasNetCommApi { * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:停车让行线前无需避让等待 1:停车让行线前需要避让等待 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendStopYieldValid(int enable) { - return mChannel != null && mChannel.sendStopYieldValid(enable); + public long sendStopYieldValid(int enable) { + return mChannel == null ? -1L : mChannel.sendStopYieldValid(enable); } /** @@ -1028,11 +1242,14 @@ public class AdasManager implements IAdasNetCommApi { * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:不使用地图限速功能 1:使用地图限速功能 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendHadmapSpeedLimitValid(int enable) { - return mChannel != null && mChannel.sendHadmapSpeedLimitValid(enable); + public long sendHadmapSpeedLimitValid(int enable) { + return mChannel == null ? -1L : mChannel.sendHadmapSpeedLimitValid(enable); } /** @@ -1040,88 +1257,112 @@ public class AdasManager implements IAdasNetCommApi { * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:普通模式 1:环岛模式 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendRampThetaValid(int enable) { - return mChannel != null && mChannel.sendRampThetaValid(enable); + public long sendRampThetaValid(int enable) { + return mChannel == null ? -1L : mChannel.sendRampThetaValid(enable); } /** * 弱网减速停车策略开关 * * @param enable 0:关闭弱网减速停车策略 1:使用弱网减速停车策略 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendWeakNetSlowDown(int enable) { - return mChannel != null && mChannel.sendWeakNetSlowDown(enable); + public long sendWeakNetSlowDown(int enable) { + return mChannel == null ? -1L : mChannel.sendWeakNetSlowDown(enable); } /** * 故障减速停车策路开关 * * @param enable 0:关闭故障减速停车策略 1:使用故障减速停车策略 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendBreakdownSlowDown(int enable) { - return mChannel != null && mChannel.sendBreakdownSlowDown(enable); + public long sendBreakdownSlowDown(int enable) { + return mChannel == null ? -1L : mChannel.sendBreakdownSlowDown(enable); } /** * 融合模式 * * @param cmd 1:全融合模式 2:盲区模式 3:超视距模式 4:透传模式 5:纯路侧模式,默认1 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendFusionMode(int cmd) { - return mChannel != null && mChannel.sendFusionMode(cmd); + public long sendFusionMode(int cmd) { + return mChannel == null ? -1L : mChannel.sendFusionMode(cmd); } /** * 超车的最大速度阈值(double, m/s, 范围[3, 12.5]) * * @param maxSpeed m/s, 范围[3, 12.5] - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendOvertakeMaxSpeed(double maxSpeed) { - return mChannel != null && mChannel.sendOvertakeMaxSpeed(maxSpeed); + public long sendOvertakeMaxSpeed(double maxSpeed) { + return mChannel == null ? -1L : mChannel.sendOvertakeMaxSpeed(maxSpeed); } /** * 盲区数据开关 * * @param switchCmd 数据开关 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendBlindAreaCmd(boolean switchCmd) { - return mChannel != null && mChannel.sendBlindAreaCmd(switchCmd); + public long sendBlindAreaCmd(boolean switchCmd) { + return mChannel == null ? -1L : mChannel.sendBlindAreaCmd(switchCmd); } /** * 控制V2N进PnC * * @param switchCmd true:发给PnC,false:不发给PnC - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendV2nToPncCmd(boolean switchCmd) { - return mChannel != null && mChannel.sendV2nToPncCmd(switchCmd); + public long sendV2nToPncCmd(boolean switchCmd) { + return mChannel == null ? -1L : mChannel.sendV2nToPncCmd(switchCmd); } /** * 控制V2I进PnC * - * @param switchCmd true:发给Pnc和鹰眼,false:不发给PnC和鹰眼 - * @return boolean + * @param switchCmd true:发给Pnc和鹰眼,false:不发给PnC和鹰眼 默认false + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendV2iToPncCmd(boolean switchCmd) { - return mChannel != null && mChannel.sendV2iToPncCmd(switchCmd); + public long sendV2iToPncCmd(boolean switchCmd) { + return mChannel == null ? -1L : mChannel.sendV2iToPncCmd(switchCmd); } /** @@ -1140,35 +1381,49 @@ public class AdasManager implements IAdasNetCommApi { * {@link AdasConstants.MapSystemParamType#V2N_TO_PNC Value类型:boolean或boolean类型String} * {@link AdasConstants.MapSystemParamType#V2I_TO_PNC Value类型:boolean或boolean类型String} * {@link AdasConstants.MapSystemParamType#FUSION_MODE Value类型:int或int类型String} + * {@link AdasConstants.MapSystemParamType#SEAT_STATE Value类型:int或int类型String} * {@link AdasConstants.MapSystemParamType#OVERTAKE_MAX_SPEED Value类型:double或double类型String} - * @return boolean + * {@link AdasConstants.MapSystemParamType#FAULT_SIMULATION_CMD Value类型:int或int类型String} + * @return 消息是否添加到WS消息发送队列。由于批量设置参数,调用的域控接口存在不同,实际调用域控最多2个接口,调用次数最多4次,所以最多返回4条ID数据 + * * 返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSetParamReq(@NonNull Map param) { - return mChannel != null && mChannel.sendSetParamReq(param); + public Set sendSetParamReq(@NonNull Map param) { + return mChannel == null ? null : mChannel.sendSetParamReq(param); } /** * 获取全部参数 * 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq, AdasParam)} + * MAP340 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendGetAllParamReq() { - return mChannel != null && mChannel.sendGetAllParamReq(); + public long sendGetAllParamReq() { + return mChannel == null ? -1L : mChannel.sendGetAllParamReq(); } /** * 参数获取请求 * 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq, AdasParam)} + * MAP340 * * @param paramType 参数类型:libraries/mogo-adas-data/src/main/proto/personal/adas_constants.proto - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendGetParamReq(AdasConstants.MapSystemParamType... paramType) { - return mChannel != null && mChannel.sendGetParamReq(paramType); + public long sendGetParamReq(AdasConstants.MapSystemParamType... paramType) { + return mChannel == null ? -1L : mChannel.sendGetParamReq(paramType); } /** @@ -1182,22 +1437,28 @@ public class AdasManager implements IAdasNetCommApi { * @param departureStopName 出站站点名 * @param arrivalStopName 下一站到达站点名 * @param isLastStop 是否最终站 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendTripInfoReq(int type, String lineName, String departureStopName, String arrivalStopName, boolean isLastStop) { - return mChannel != null && mChannel.sendTripInfoReq(type, lineName, departureStopName, arrivalStopName, isLastStop); + public long sendTripInfoReq(int type, String lineName, String departureStopName, String arrivalStopName, boolean isLastStop) { + return mChannel == null ? -1L : mChannel.sendTripInfoReq(type, lineName, departureStopName, arrivalStopName, isLastStop); } /** * 发送包管理请求 * * @param bagManager 包管理参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendBagManagerCmd(BagManagerOuterClass.BagManager bagManager) { - return mChannel != null && mChannel.sendBagManagerCmd(bagManager); + public long sendBagManagerCmd(BagManagerOuterClass.BagManager bagManager) { + return mChannel == null ? -1L : mChannel.sendBagManagerCmd(bagManager); } /** @@ -1206,11 +1467,14 @@ public class AdasManager implements IAdasNetCommApi { * 当FSMFunctionStates的类型是PILOT_DRIVING_OFF时会自动调用 * * @param type 0:default, 1:请求反馈原因 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendFSMStatusReasonQuery(int type) { - return mChannel != null && mChannel.sendFSMStatusReasonQuery(type); + public long sendFSMStatusReasonQuery(int type) { + return mChannel == null ? -1L : mChannel.sendFSMStatusReasonQuery(type); } /** @@ -1219,11 +1483,14 @@ public class AdasManager implements IAdasNetCommApi { * * @param reqNo 请求编号 * @param startTaskResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperStartTaskResp(@NonNull String reqNo, @NonNull SweeperTask.StartTaskResp startTaskResp) { - return mChannel != null && mChannel.sendSweeperStartTaskResp(reqNo, startTaskResp); + public long sendSweeperStartTaskResp(@NonNull String reqNo, @NonNull SweeperTask.StartTaskResp startTaskResp) { + return mChannel == null ? -1L : mChannel.sendSweeperStartTaskResp(reqNo, startTaskResp); } /** @@ -1232,11 +1499,14 @@ public class AdasManager implements IAdasNetCommApi { * * @param reqNo 请求编号 * @param taskConfirmResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperTaskConfirmResp(@NonNull String reqNo, @NonNull SweeperTaskConfirm.TaskConfirmResp taskConfirmResp) { - return mChannel != null && mChannel.sendSweeperTaskConfirmResp(reqNo, taskConfirmResp); + public long sendSweeperTaskConfirmResp(@NonNull String reqNo, @NonNull SweeperTaskConfirm.TaskConfirmResp taskConfirmResp) { + return mChannel == null ? -1L : mChannel.sendSweeperTaskConfirmResp(reqNo, taskConfirmResp); } /** @@ -1245,11 +1515,14 @@ public class AdasManager implements IAdasNetCommApi { * * @param reqNo 请求编号 * @param stopTaskResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperStopTaskResp(@NonNull String reqNo, @NonNull SweeperTaskStop.StopTaskResp stopTaskResp) { - return mChannel != null && mChannel.sendSweeperStopTaskResp(reqNo, stopTaskResp); + public long sendSweeperStopTaskResp(@NonNull String reqNo, @NonNull SweeperTaskStop.StopTaskResp stopTaskResp) { + return mChannel == null ? -1L : mChannel.sendSweeperStopTaskResp(reqNo, stopTaskResp); } /** @@ -1260,11 +1533,14 @@ public class AdasManager implements IAdasNetCommApi { * @param isSuspend true:挂起任务 false:恢复挂起的任务 * @param reqNo 请求编号 * @param suspendResumeTaskReq 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperSuspendResumeTaskReq(boolean isSuspend, @NonNull String reqNo, @NonNull SweeperTaskSuspendResume.SuspendResumeTaskReq suspendResumeTaskReq) { - return mChannel != null && mChannel.sendSweeperSuspendResumeTaskReq(isSuspend, reqNo, suspendResumeTaskReq); + public long sendSweeperSuspendResumeTaskReq(boolean isSuspend, @NonNull String reqNo, @NonNull SweeperTaskSuspendResume.SuspendResumeTaskReq suspendResumeTaskReq) { + return mChannel == null ? -1L : mChannel.sendSweeperSuspendResumeTaskReq(isSuspend, reqNo, suspendResumeTaskReq); } /** @@ -1273,11 +1549,14 @@ public class AdasManager implements IAdasNetCommApi { * * @param reqNo 请求编号 * @param getTaskReq 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperGetTaskReq(@NonNull String reqNo, @NonNull SweeperTask.GetTaskReq getTaskReq) { - return mChannel != null && mChannel.sendSweeperGetTaskReq(reqNo, getTaskReq); + public long sendSweeperGetTaskReq(@NonNull String reqNo, @NonNull SweeperTask.GetTaskReq getTaskReq) { + return mChannel == null ? -1L : mChannel.sendSweeperGetTaskReq(reqNo, getTaskReq); } /** @@ -1286,24 +1565,30 @@ public class AdasManager implements IAdasNetCommApi { * * @param reqNo 请求编号 * @param isBootable 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperAutopilotBootable(@NonNull String reqNo, @NonNull SweeperBootable.IsBootable isBootable) { - return mChannel != null && mChannel.sendSweeperAutopilotBootable(reqNo, isBootable); + public long sendSweeperAutopilotBootable(@NonNull String reqNo, @NonNull SweeperBootable.IsBootable isBootable) { + return mChannel == null ? -1L : mChannel.sendSweeperAutopilotBootable(reqNo, isBootable); } /** - * pad收到云端下发暂停恢复响应 + * pad收到云端下发暂停回复响应 * 10、云端下发任务暂停/恢复指令到pad(type: 100010)sweeper_task_cloud_suspend_resume.proto/BigTaskActionResp * * @param reqNo 请求编号 * @param bigTaskActionResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendSweeperCloudSuspendResumeTaskResp(@NonNull String reqNo, @NonNull SweeperTaskCloudSuspendResume.BigTaskActionResp bigTaskActionResp) { - return mChannel != null && mChannel.sendSweeperCloudSuspendResumeTaskResp(reqNo, bigTaskActionResp); + public long sendSweeperCloudSuspendResumeTaskResp(@NonNull String reqNo, @NonNull SweeperTaskCloudSuspendResume.BigTaskActionResp bigTaskActionResp) { + return mChannel == null ? -1L : mChannel.sendSweeperCloudSuspendResumeTaskResp(reqNo, bigTaskActionResp); } /** @@ -1311,11 +1596,14 @@ public class AdasManager implements IAdasNetCommApi { * * @param reqNo 请求编号 * @param parallelRequest 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Override - public boolean sendParallelDrivingReq(@NonNull String reqNo, @NonNull ParallelDrivingRequest.ParallelRequest parallelRequest) { - return mChannel != null && mChannel.sendParallelDrivingReq(reqNo, parallelRequest); + public long sendParallelDrivingReq(@NonNull String reqNo, @NonNull ParallelDrivingRequest.ParallelRequest parallelRequest) { + return mChannel == null ? -1L : mChannel.sendParallelDrivingReq(reqNo, parallelRequest); } /** diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java index a9e58b9750..61e0641b66 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/IAdasNetCommApi.java @@ -7,6 +7,7 @@ import com.zhidao.support.adas.high.common.Constants; import com.zhidao.support.adas.high.common.Define; import com.zhjt.mogo.adas.common.MessageType; import com.zhjt.mogo.adas.data.AdasConstants; +import com.zhjt.mogo.adas.data.bean.AdasParam; import com.zhjt.mogo.adas.data.sweeper.bootable.SweeperBootable; import com.zhjt.mogo.adas.data.sweeper.task.SweeperTask; import com.zhjt.mogo.adas.data.sweeper.task.cloud.s_r.SweeperTaskCloudSuspendResume; @@ -52,6 +53,7 @@ public interface IAdasNetCommApi { /** * 获取工控机链接配置 + * 如果返回空,表示没有正确初始化或没有配置 * * @return 工控机链接参数 */ @@ -148,9 +150,12 @@ public interface IAdasNetCommApi { * @param versionCode 鹰眼版本号 * @param versionName 鹰眼版本名 * @param deviceCrt 鹰眼ssl证书 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, int versionCode, String versionName, String deviceCrt); + long sendBasicInfoResp(@NonNull String sn, @Define.Environment int environment, @Define.TerminalRole int role, int versionCode, String versionName, String deviceCrt); /** @@ -159,24 +164,34 @@ public interface IAdasNetCommApi { * @param mode 1: enter autopilot mode, 0: quit autopilot mode * @param source 命令来源: 0: pad模拟, 1: pad业务, 2:aicloud, 3:魔方(清扫车MAP Version==332以及MAP Version>=350,其他车型目前未上线) * @param routeInfo 自动驾驶路径信息 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo); + long sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo); + /** * 设置演示模式 * * @param enable 1: enable, 0: disable - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendDemoModeReq(int enable); + long sendDemoModeReq(int enable); /** * 车机基础信息请求 * - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendCarConfigReq(); + long sendCarConfigReq(); /** * 记录人工接管原因 @@ -185,99 +200,141 @@ public interface IAdasNetCommApi { * @param filename 文件路径 * @param reasonID 接管原因id * @param reason 接管原因 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason); - - /** - * 同下 - * - * @param id - * @param type - * @return 加入WS发送消息队列是否成功 - */ - boolean startRecordPackage(int id, int type); - - /** - * 同下 - * - * @param id - * @param type - * @return 加入WS发送消息队列是否成功 - */ - boolean startRecordPackage(int id, int duration, int type); - - /** - * 同下 - * - * @param id - * @param duration - * @param type - * @param bduration - * @return 加入WS发送消息队列是否成功 - */ - boolean startRecordPackage(int id, int duration, int type, int bduration); - - /** - * 同下 - * - * @param id - * @param type - * @param topics - * @return 加入WS发送消息队列是否成功 - */ - boolean startRecordPackage(int id, int type, List topics); - - /** - * 同下 - * - * @param id - * @param type - * @param topics - * @return 加入WS发送消息队列是否成功 - */ - boolean startRecordPackage(int id, int duration, int type, List topics); - - /** - * 同下 - * - * @param id - * @param duration - * @param type - * @param bduration - * @param topics - * @return 加入WS发送消息队列是否成功 - */ - boolean startRecordPackage(int id, int duration, int type, int bduration, List topics); - - /** - * 同下 - * - * @param id - * @param type - * @return 加入WS发送消息队列是否成功 - */ - boolean stopRecordPackage(int id, int type); + long sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason); /** * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + long startRecordPackage(int id, int type); + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + long startRecordPackage(int id, int duration, int type); + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 * * @param id 采集id - * @param duration 采集时间长 - * @param type 采集类型, 1:badcase, 2: map; 3: rests + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param bduration 前溯时长 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + long startRecordPackage(int id, int duration, int type, int bduration); + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + long startRecordPackage(int id, int type, List topics); + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + long startRecordPackage(int id, int duration, int type, List topics); + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @param bduration 前溯时长 + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + long startRecordPackage(int id, int duration, int type, int bduration, List topics); + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * + * @param id 采集id + * @param type 采集类型, 1:badCase, 2: map; 3: rests + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 + */ + long stopRecordPackage(int id, int type); + + /** + * 数据采集请求 主动录制Bag包 + * sustain为true时 duration无效 + * * param sustain 是否持续采集 + * + * @param id 采集id + * @param duration 采集时间长 Max:5*60 秒 + * @param type 采集类型, 1:badCase, 2: map; 3: rests * @param isRecord 采集指令, true: 采集, false: 停止采集 * @param bduration 前溯时长 - * @return 加入WS发送消息队列是否成功 + * @param topics 要录制的Topic列表 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRecordData(int id, int duration, int type, boolean isRecord, int bduration, List topics); + long sendRecordData(int id, int duration, int type, boolean isRecord, int bduration, List topics); /** * 设置自动驾驶最大速度 * * @param speedLimit 最大车辆速度 m/s - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendAutopilotSpeedReq(double speedLimit); + long sendAutopilotSpeedReq(double speedLimit); /** * 发送红绿灯数据到工控机 @@ -294,19 +351,25 @@ public interface IAdasNetCommApi { * @param flashYellow 黄灯总时间 * @param laneDetail 灯态具体信息 * @param timestamp 当前卫星时间, 单位: ms - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ @Deprecated - boolean sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, - @NonNull String heading, @NonNull String direction, int lightId, int laneNo, - int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail, long timestamp); + long sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, + @NonNull String heading, @NonNull String direction, int lightId, int laneNo, + int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail, long timestamp); /** * 自动驾驶路径请求 * - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendGlobalPathReq(); + long sendGlobalPathReq(); /** * 系统命令请求 @@ -316,80 +379,111 @@ public interface IAdasNetCommApi { * SystemCmdType.SYSTEMCMD_STOP_NODE 停止节点(node表示不同的节点) * SystemCmdType.SYSTEMCMD_POWER_OFF 关机(不需要node) * @param node 0: default, 1: 前向camera 30 2: lidar 3: 左前radar 4: calib_check node - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSystemCmdReq(@NonNull MessagePad.SystemCmdType type, int node); + long sendSystemCmdReq(@NonNull MessagePad.SystemCmdType type, int node); /** * 系统命令请求 重启所有节点 * - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendIpcReboot(); + long sendIpcReboot(); /** * 系统命令请求 关机 * - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendIpcPowerOff(); + long sendIpcPowerOff(); /** * 系统命令请求 控制前向camera 30节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendFrontCamera30Cmd(boolean isStart); + long sendFrontCamera30Cmd(boolean isStart); /** * 系统命令请求 控制lidar节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendLidarCmd(boolean isStart); + long sendLidarCmd(boolean isStart); /** * 系统命令请求 控制左前radar节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendLeftFrontRadarCmd(boolean isStart); + long sendLeftFrontRadarCmd(boolean isStart); /** * 系统命令请求 控制标定节点 运行还是停止 * * @param isStart true:运行 false:停止 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendCalibCheckCmd(boolean isStart); + long sendCalibCheckCmd(boolean isStart); /** * 发送 轨迹下载请求 * * @param line 线路相关参数详情见PB message_pad.proto -> Line * @param downloadType 下载类型: 0:正常下载 1:预下载 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendTrajectoryDownloadReq(MessagePad.Line line, int downloadType); + long sendTrajectoryDownloadReq(MessagePad.Line line, int downloadType); /** * 发送 状态查询请求 * - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - @Deprecated//HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 - boolean sendStatusQueryReq(); + //HQ、M1 MAP350开始弃用,其他车型MAP360开始弃用 + @Deprecated + long sendStatusQueryReq(); /** * 设置雨天模式 * * @param enable 1: enable, 0: disable - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRainModeReq(int enable); + long sendRainModeReq(int enable); /** * 数据采集配置查询 @@ -397,9 +491,12 @@ public interface IAdasNetCommApi { * @param reqType 0: all, 1:获取当前所有topic列表, 2:配置需要预加载的topic组合 * @param recordType 0:不需要修改内置类型的topic组合, 1:需要修改内置类型的topic组合 * @param topicsNeedToCache - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRecordDataConfigReq(int reqType, int recordType, List topicsNeedToCache); + long sendRecordDataConfigReq(int reqType, int recordType, List topicsNeedToCache); /** * 获取已注册接口 @@ -433,9 +530,12 @@ public interface IAdasNetCommApi { * @param role 角色 详情参见{@link Constants.TERMINAL_ROLE} * @param type 注册类型 详情参见{@link Constants.SUBSCRIBE_TYPE} * @param messageTypes 要操作的接口 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull Set messageTypes); + long subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull Set messageTypes); /** * 注册或取消注册 @@ -443,51 +543,69 @@ public interface IAdasNetCommApi { * @param role 角色 详情参见{@link Constants.TERMINAL_ROLE} * @param type 注册类型 详情参见{@link Constants.SUBSCRIBE_TYPE} * @param messageType 要操作的接口 - * @return 加入WS发送消息队列是否成功 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull MessageType messageType); + long subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull MessageType messageType); /** * 给Planning发送靠边停车指令 * * @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持 - * @return boolean 是否加入发送队列 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendPlanningPullOverCmd(int pullOverCmd); + long sendPlanningPullOverCmd(int pullOverCmd); /** * 给Planning发送变道指令 * TODO 目前仅襄阳牌照考试支持 * * @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策 - * @return boolean 是否加入发送队列 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendPlanningLaneChangeCmd(int laneChangeCmd); + long sendPlanningLaneChangeCmd(int laneChangeCmd); /** * 给Planning发送指令 * * @param pullOverCmd 命令 0: default 1: 靠边停车 2:重新起步 3:紧急停车 TODO 值3 目前仅襄阳牌照考试支持 * @param laneChangeCmd 命令 0: default 1: 左变道 2:右变道 3:超车 4:恢复自动决策 TODO laneChangeCmd 目前仅襄阳牌照考试支持 - * @return boolean 是否加入发送队列 + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendPlanningCmd(int pullOverCmd, int laneChangeCmd); + long sendPlanningCmd(int pullOverCmd, int laneChangeCmd); /** * 福田清扫车业务指令下发 * * @param fuTianTaskCmd 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRoboSweeperFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd); + long sendRoboSweeperFuTianTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboSweeperFuTianTaskCmd fuTianTaskCmd); /** * 开沃小巴业务指令下发 * * @param vanSkywellTaskCmd 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRoboVanSkywellTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd vanSkywellTaskCmd); + long sendRoboVanSkywellTaskCmd(SpecialVehicleTaskCmdOuterClass.RoboVanSkywellTaskCmd vanSkywellTaskCmd); /** * 金旅M1空调控制 @@ -496,147 +614,200 @@ public interface IAdasNetCommApi { * @param modeCmd 模式 0: default, 1: 自动模式, 2: 制冷模式, 3: 通风模式(仅送风,无温度) * @param windSpeedCmd 风速 0: default, 1: 1档,2: 2档,3:3档 * @param temperatureCmd 温度 0: default, 16-26: 温度 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRoboBusJinlvM1AirConditionerCmd(int switchCmd, int modeCmd, int windSpeedCmd, int temperatureCmd); + long sendRoboBusJinlvM1AirConditionerCmd(int switchCmd, int modeCmd, int windSpeedCmd, int temperatureCmd); /** * 金旅M1暖风机控制 * * @param switchCmd //0: default, 1: 开启暖风机, 2: 关闭暖风机 * @param windSpeedCmd //风速 0: default, 1: 1档,2: 2档 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRoboBusJinlvM1HeaderCmd(int switchCmd, int windSpeedCmd); + long sendRoboBusJinlvM1HeaderCmd(int switchCmd, int windSpeedCmd); /** * 金旅M1顶灯1控制 * * @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRoboBusJinlvM1MainLamp1Cmd(int switchCmd); + long sendRoboBusJinlvM1MainLamp1Cmd(int switchCmd); /** * 金旅M1顶灯2控制 * * @param switchCmd //0: default, 1: 开启顶灯, 2: 关闭顶灯 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRoboBusJinlvM1MainLamp2Cmd(int switchCmd); + long sendRoboBusJinlvM1MainLamp2Cmd(int switchCmd); /** * 金旅M1小灯(氛围灯)控制 * * @param switchCmd //0: default, 1: 开启小灯(氛围灯), 2: 关闭小灯(氛围灯) - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRoboBusJinlvM1SmallLampCmd(int switchCmd); + long sendRoboBusJinlvM1SmallLampCmd(int switchCmd); /** * 金旅M1车门控制 * * @param switchCmd //0: default, 1: 开启车门, 2: 关闭车门 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRoboBusJinlvM1FrontDoorCmd(int switchCmd); + long sendRoboBusJinlvM1FrontDoorCmd(int switchCmd); /** * 金旅M1业务指令下发 * * @param roboBusJinlvM1Cmd 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd roboBusJinlvM1Cmd); + long sendRoboBusJinlvM1TaskCmd(SpecialVehicleTaskCmdOuterClass.RoboBusJinlvM1Cmd roboBusJinlvM1Cmd); /** * 特种车辆命令下发 * * @param cmdBuild 命令 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSpecialVehicleTaskCmd(SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd.Builder cmdBuild); + long sendSpecialVehicleTaskCmd(SpecialVehicleTaskCmdOuterClass.SpecialVehicleTaskCmd.Builder cmdBuild); /** * 向左变道 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendOperatorCmdChangeLaneLeft(); + long sendOperatorCmdChangeLaneLeft(); /** * 向右变道 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendOperatorCmdChangeLaneRight(); + long sendOperatorCmdChangeLaneRight(); /** * 发送设置加速度 * * @param acc acc>0加速 acc<0减速 acc=0复位 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendOperatorCmdSetAcceleratedSpeed(double acc); + long sendOperatorCmdSetAcceleratedSpeed(double acc); /** * 鸣笛 * * @param value 1: honk 2: stop honking - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendOperatorCmdSetHorn(double value); + long sendOperatorCmdSetHorn(double value); /** * 开始鸣笛 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendOperatorCmdStartHonking(); + long sendOperatorCmdStartHonking(); /** * 停止鸣笛 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendOperatorCmdStopHonking(); + long sendOperatorCmdStopHonking(); /*******************************设置参数命令 包括V1************************************/ - /** * 绕障类功能开关 * * @param enable 0:关闭,1:开启 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendDetouring(int enable); + long sendDetouring(int enable); /** * 变道绕障的目标障碍物速度阈值 * * @param speed 速度阈值 m/s - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendDetouringSpeed(double speed); + long sendDetouringSpeed(double speed); /** * AEB开关 * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:关闭,1:开启 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendAebCmd(int enable); + long sendAebCmd(int enable); /** * 限制绕障开关 * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:正常绕障 1:限制绕障 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendLaneChangeRestrainValid(int enable); + long sendLaneChangeRestrainValid(int enable); /** @@ -644,9 +815,12 @@ public interface IAdasNetCommApi { * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:停车让行线前无需避让等待 1:停车让行线前需要避让等待 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendStopYieldValid(int enable); + long sendStopYieldValid(int enable); /** @@ -654,76 +828,102 @@ public interface IAdasNetCommApi { * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:不使用地图限速功能 1:使用地图限速功能 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendHadmapSpeedLimitValid(int enable); + long sendHadmapSpeedLimitValid(int enable); /** * 环岛模式开关 * TODO 目前仅襄阳牌照考试支持 * * @param enable 0:普通模式 1:环岛模式 默认0 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendRampThetaValid(int enable); + long sendRampThetaValid(int enable); /** * 弱网减速停车策略开关 * * @param enable 0:关闭弱网减速停车策略 1:使用弱网减速停车策略 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendWeakNetSlowDown(int enable); + long sendWeakNetSlowDown(int enable); /** * 故障减速停车策路开关 * * @param enable 0:关闭故障减速停车策略 1:使用故障减速停车策略 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendBreakdownSlowDown(int enable); + long sendBreakdownSlowDown(int enable); /** * 融合模式 * * @param cmd 1:全融合模式 2:盲区模式 3:超视距模式 4:透传模式 5:纯路侧模式,默认1 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendFusionMode(int cmd); + long sendFusionMode(int cmd); /** * 超车的最大速度阈值(double, m/s, 范围[3, 12.5]) * * @param maxSpeed m/s, 范围[3, 12.5] - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendOvertakeMaxSpeed(double maxSpeed); + long sendOvertakeMaxSpeed(double maxSpeed); /*******************************设置参数命令 V2************************************/ /** * 盲区数据开关 * * @param switchCmd 数据开关 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendBlindAreaCmd(boolean switchCmd); - + long sendBlindAreaCmd(boolean switchCmd); /** * 控制V2N进PnC * * @param switchCmd true:发给PnC,false:不发给PnC - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendV2nToPncCmd(boolean switchCmd); + long sendV2nToPncCmd(boolean switchCmd); /** * 控制V2I进PnC * * @param switchCmd true:发给Pnc和鹰眼,false:不发给PnC和鹰眼 默认false - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendV2iToPncCmd(boolean switchCmd); + long sendV2iToPncCmd(boolean switchCmd); /*******************************设置参数命令 批量设置************************************/ @@ -743,29 +943,45 @@ public interface IAdasNetCommApi { * {@link AdasConstants.MapSystemParamType#V2N_TO_PNC Value类型:boolean或boolean类型String} * {@link AdasConstants.MapSystemParamType#V2I_TO_PNC Value类型:boolean或boolean类型String} * {@link AdasConstants.MapSystemParamType#FUSION_MODE Value类型:int或int类型String} + * {@link AdasConstants.MapSystemParamType#SEAT_STATE Value类型:int或int类型String} * {@link AdasConstants.MapSystemParamType#OVERTAKE_MAX_SPEED Value类型:double或double类型String} - * @return boolean + * {@link AdasConstants.MapSystemParamType#FAULT_SIMULATION_CMD Value类型:int或int类型String} + * @return 消息是否添加到WS消息发送队列。由于批量设置参数,调用的域控接口存在不同,实际调用域控最多2个接口,调用次数最多4次,所以最多返回4条ID数据 + * * 返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSetParamReq(@NonNull Map param); + Set sendSetParamReq(@NonNull Map param); /*******************************设置参数命令 获取参数************************************/ - /** * 获取全部参数 + * 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq, AdasParam)} + * MAP340 * - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendGetAllParamReq(); + long sendGetAllParamReq(); /** * 参数获取请求 + * 结果回调{@link OnAdasListener#onGetParamResp(MessagePad.Header, MessagePad.SetParamReq, AdasParam)} + * MAP340 * * @param paramType 参数类型:libraries/mogo-adas-data/src/main/proto/personal/adas_constants.proto - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendGetParamReq(AdasConstants.MapSystemParamType... paramType); + long sendGetParamReq(AdasConstants.MapSystemParamType... paramType); /*******************************设置参数命令************************************/ + /** * 发生行程相关 * type=1或2的时 需要参数 lineName @@ -777,17 +993,23 @@ public interface IAdasNetCommApi { * @param departureStopName 出站站点名 * @param arrivalStopName 下一站到达站点名 * @param isLastStop 是否最终站 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendTripInfoReq(int type, String lineName, String departureStopName, String arrivalStopName, boolean isLastStop); + long sendTripInfoReq(int type, String lineName, String departureStopName, String arrivalStopName, boolean isLastStop); /** * 发送包管理请求 * * @param bagManager 包管理参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendBagManagerCmd(BagManagerOuterClass.BagManager bagManager); + long sendBagManagerCmd(BagManagerOuterClass.BagManager bagManager); /** * FSM状态原因查询 @@ -795,9 +1017,12 @@ public interface IAdasNetCommApi { * 当FSMFunctionStates的类型是PILOT_DRIVING_OFF时会自动调用 * * @param type 0:default, 1:请求反馈原因 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendFSMStatusReasonQuery(int type); + long sendFSMStatusReasonQuery(int type); /** * 开始大任务响应 @@ -805,9 +1030,12 @@ public interface IAdasNetCommApi { * * @param reqNo 请求编号 * @param startTaskResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSweeperStartTaskResp(@NonNull String reqNo, @NonNull SweeperTask.StartTaskResp startTaskResp); + long sendSweeperStartTaskResp(@NonNull String reqNo, @NonNull SweeperTask.StartTaskResp startTaskResp); /** * 子任务安全员确认响应 @@ -815,9 +1043,12 @@ public interface IAdasNetCommApi { * * @param reqNo 请求编号 * @param taskConfirmResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSweeperTaskConfirmResp(@NonNull String reqNo, @NonNull SweeperTaskConfirm.TaskConfirmResp taskConfirmResp); + long sendSweeperTaskConfirmResp(@NonNull String reqNo, @NonNull SweeperTaskConfirm.TaskConfirmResp taskConfirmResp); /** * 结束任务响应 @@ -825,9 +1056,12 @@ public interface IAdasNetCommApi { * * @param reqNo 请求编号 * @param stopTaskResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSweeperStopTaskResp(@NonNull String reqNo, @NonNull SweeperTaskStop.StopTaskResp stopTaskResp); + long sendSweeperStopTaskResp(@NonNull String reqNo, @NonNull SweeperTaskStop.StopTaskResp stopTaskResp); /** * 挂起任务 恢复挂起的任务 @@ -837,10 +1071,12 @@ public interface IAdasNetCommApi { * @param isSuspend true:挂起任务 false:恢复挂起的任务 * @param reqNo 请求编号 * @param suspendResumeTaskReq 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSweeperSuspendResumeTaskReq(boolean isSuspend, @NonNull String reqNo, @NonNull SweeperTaskSuspendResume.SuspendResumeTaskReq suspendResumeTaskReq); - + long sendSweeperSuspendResumeTaskReq(boolean isSuspend, @NonNull String reqNo, @NonNull SweeperTaskSuspendResume.SuspendResumeTaskReq suspendResumeTaskReq); /** * pad主动拉取当前车辆正在执行任务的完整信息请求 @@ -848,9 +1084,12 @@ public interface IAdasNetCommApi { * * @param reqNo 请求编号 * @param getTaskReq 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSweeperGetTaskReq(@NonNull String reqNo, @NonNull SweeperTask.GetTaskReq getTaskReq); + long sendSweeperGetTaskReq(@NonNull String reqNo, @NonNull SweeperTask.GetTaskReq getTaskReq); /** * pad上报是否可以进自驾 @@ -858,28 +1097,37 @@ public interface IAdasNetCommApi { * * @param reqNo 请求编号 * @param isBootable 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSweeperAutopilotBootable(@NonNull String reqNo, @NonNull SweeperBootable.IsBootable isBootable); + long sendSweeperAutopilotBootable(@NonNull String reqNo, @NonNull SweeperBootable.IsBootable isBootable); /** - * pad收到云端下发暂停恢复响应 + * pad收到云端下发暂停回复响应 * 10、云端下发任务暂停/恢复指令到pad(type: 100010)sweeper_task_cloud_suspend_resume.proto/BigTaskActionResp * * @param reqNo 请求编号 * @param bigTaskActionResp 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendSweeperCloudSuspendResumeTaskResp(@NonNull String reqNo, @NonNull SweeperTaskCloudSuspendResume.BigTaskActionResp bigTaskActionResp); + long sendSweeperCloudSuspendResumeTaskResp(@NonNull String reqNo, @NonNull SweeperTaskCloudSuspendResume.BigTaskActionResp bigTaskActionResp); /** * PAD发起平行驾驶请求 * * @param reqNo 请求编号 * @param parallelRequest 参数 - * @return boolean + * @return 消息是否添加到WS消息发送队列,返回值为非0的正整数时表示下发消息的消息ID + * * >=0:表示添加到WS发送消息队列 + * * =0:表示乘客屏模式添加到WS发送消息队列 + * * -1L:添加到WS发送消息队列失败 */ - boolean sendParallelDrivingReq(@NonNull String reqNo, @NonNull ParallelDrivingRequest.ParallelRequest parallelRequest); + long sendParallelDrivingReq(@NonNull String reqNo, @NonNull ParallelDrivingRequest.ParallelRequest parallelRequest); // TODO 需求暂停 待讨论 // boolean getRoutes(); diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageIdGenerator.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageIdGenerator.java index a66594da76..7e7f4a2e89 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageIdGenerator.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/common/MessageIdGenerator.java @@ -11,7 +11,8 @@ import mogo.telematics.pad.MessagePad; /** * 发送数据时ID生成器 - * 每天生成的ID重1开始自增,也可以表示为发送的数量 + * 每天生成的ID从1开始自增,只保存最后一条消息的相关信息,故也可以表示为每天发送的数量 + * 默认保存30天的数据 */ public class MessageIdGenerator { private static final String TAG = "MessageIdGenerator"; diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/protocol/PackData.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/protocol/PackData.java new file mode 100644 index 0000000000..fe53d4a6f4 --- /dev/null +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/protocol/PackData.java @@ -0,0 +1,15 @@ +package com.zhidao.support.adas.high.protocol; + +import androidx.annotation.NonNull; + +public class PackData { + + public final long msgId;//消息ID + @NonNull + public final byte[] bytes; + + public PackData(long msgId, @NonNull byte[] bytes) { + this.msgId = msgId; + this.bytes = bytes; + } +} diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/protocol/RawPack.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/protocol/RawPack.java index a045467a98..f2348a4545 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/protocol/RawPack.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/protocol/RawPack.java @@ -26,7 +26,7 @@ public class RawPack { } - public synchronized byte[] pack(MessageType msgType, byte[] data) { + public synchronized PackData pack(MessageType msgType, byte[] data) { if (msgType == null) { return null; } @@ -66,7 +66,7 @@ public class RawPack { if (isNeedAck) { receivedAckManager.addNeedAckData(timeMillis, msgId, msgType, msg); } - return msg; + return new PackData(msgId, msg); } /** diff --git a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/subscribe/SubscribeInterface.java b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/subscribe/SubscribeInterface.java index 3c3d4cc24f..1cb7bf3310 100644 --- a/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/subscribe/SubscribeInterface.java +++ b/libraries/mogo-adas/src/main/java/com/zhidao/support/adas/high/subscribe/SubscribeInterface.java @@ -32,7 +32,7 @@ public class SubscribeInterface { private final OnSubscribeInterfaceListener listener; public interface OnSubscribeInterfaceListener { - boolean onSendSubscribe(byte[] bytes); + long onSendSubscribe(byte[] bytes); } public SubscribeInterface(@NonNull OnSubscribeInterfaceListener listener) { @@ -65,8 +65,8 @@ public class SubscribeInterface { * @param messageTypes 要操作的接口 * @return */ - public boolean subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull Set messageTypes) { - if (messageTypes == null) return false; + public long subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull Set messageTypes) { + if (messageTypes == null) return -1L; MessagePad.SubscribeDataReq.Builder builder = MessagePad.SubscribeDataReq.newBuilder(); builder.setRole(role).setReqType(type); Map temp = new HashMap<>(); @@ -74,8 +74,8 @@ public class SubscribeInterface { temp.put(messageType, messageType.typeCode.getNumber()); } builder.addAllDataTypes(temp.values()); - boolean isSendSucceed = listener.onSendSubscribe(builder.build().toByteArray()); - if (isSendSucceed) { + long isSendSucceed = listener.onSendSubscribe(builder.build().toByteArray()); + if (isSendSucceed > -1L) { for (MessageType messageType : messageTypes) { if (type == Constants.SUBSCRIBE_TYPE.SUBSCRIBE) { if (!subscribedInterface.containsKey(messageType)) { @@ -103,12 +103,12 @@ public class SubscribeInterface { * @param messageType 要操作的接口 * @return 是否加入ws发送队列 */ - public boolean subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull MessageType messageType) { - if (messageType == null) return false; + public long subscribeInterface(@Define.TerminalRole int role, @Define.SubscribeType int type, @NonNull MessageType messageType) { + if (messageType == null) return -1L; MessagePad.SubscribeDataReq.Builder builder = MessagePad.SubscribeDataReq.newBuilder(); builder.setRole(role).setReqType(type).addDataTypes(messageType.typeCode.getNumber()); - boolean isSendSucceed = listener.onSendSubscribe(builder.build().toByteArray()); - if (isSendSucceed) { + long isSendSucceed = listener.onSendSubscribe(builder.build().toByteArray()); + if (isSendSucceed > -1L) { if (type == Constants.SUBSCRIBE_TYPE.SUBSCRIBE) { if (!subscribedInterface.containsKey(messageType)) { subscribedInterface.put(messageType, messageType.typeCode.getNumber());