diff --git a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt index 129f809740..43db57e5bd 100644 --- a/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt +++ b/core/function-impl/mogo-core-function-autopilot/src/main/java/com/mogo/eagle/core/function/autopilot/MoGoAutopilotProvider.kt @@ -8,6 +8,7 @@ import com.alibaba.android.arouter.facade.annotation.Route import com.mogo.cloud.passport.MoGoAiCloudClientConfig import com.mogo.eagle.core.data.app.AppConfigInfo import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters +import com.mogo.eagle.core.data.autopilot.toAutoPilotLine import com.mogo.eagle.core.data.autopilot.toRouteInfo import com.mogo.eagle.core.data.config.FunctionBuildConfig import com.mogo.eagle.core.data.constants.MoGoConfig @@ -262,6 +263,10 @@ class MoGoAutopilotProvider : ) } + override fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine) { + AdasManager.getInstance().sendTrajectoryDownloadReq(autoPilotLine.toAutoPilotLine()) + } + override fun cancelAutoPilot() { if (AdasManager.getInstance().ipcConnectionStatus == Constants.IPC_CONNECTION_STATUS.CONNECTED) { AdasManager.getInstance().sendAutoPilotModeReq(0, 1, null) diff --git a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlParameters.kt b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlParameters.kt index 4c7f594317..2345c60145 100644 --- a/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlParameters.kt +++ b/core/mogo-core-data/src/main/java/com/mogo/eagle/core/data/autopilot/AutopilotControlParameters.kt @@ -1,10 +1,9 @@ package com.mogo.eagle.core.data.autopilot -import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat import mogo.telematics.pad.MessagePad /** - * @author donghongyu + * @author donghongyuO * @since 2021/09/22 * * @@ -32,7 +31,7 @@ import mogo.telematics.pad.MessagePad * } */ -fun AutopilotControlParameters.toRouteInfo(): MessagePad.RouteInfo{ +fun AutopilotControlParameters.toRouteInfo(): MessagePad.RouteInfo { val routeInfo = MessagePad.RouteInfo.newBuilder() val startLoc = routeInfo.startLocationBuilder val endLoc = routeInfo.endLocationBuilder @@ -61,27 +60,61 @@ fun AutopilotControlParameters.toRouteInfo(): MessagePad.RouteInfo{ routeInfo.speedLimit = this.speedLimit.toDouble() routeInfo.startLocation = startLoc.build() routeInfo.endLocation = endLoc.build() + + val line = MessagePad.Line.newBuilder() + this.autoPilotLine?.let { + line.lineId = it.lineId + line.trajMd5 = it.trajMd5 + line.trajUrl = it.trajUrl + line.stopMd5 = it.stopMd5 + line.stopUrl = it.stopUrl + line.timestamp = it.timestamp + line.setVehicleModel(it.vehicleModel) + } + + routeInfo.line = line.build() + return routeInfo.build() } +fun AutopilotControlParameters.AutoPilotLine.toAutoPilotLine(): MessagePad.Line { + val line = MessagePad.Line.newBuilder() + line.lineId = this.lineId + line.trajMd5 = this.trajMd5 + line.trajUrl = this.trajUrl + line.stopMd5 = this.stopMd5 + line.stopUrl = this.stopUrl + line.timestamp = this.timestamp + line.vehicleModel = this.vehicleModel + return line.build() +} + class AutopilotControlParameters { @JvmField var startName = "" + @JvmField var endName = "" + @JvmField var startLatLon: AutoPilotLonLat? = null + @JvmField var wayLatLons: List? = null + @JvmField var endLatLon: AutoPilotLonLat? = null - var speedLimit = 0f + @JvmField - var vehicleType // 运营类型 - = 0 + var speedLimit = 0f + + @JvmField + var vehicleType = 0// 运营类型 + @JvmField var routeID = 0 //线路id(bus用) + @JvmField var routeName = "" //线路名称(bus用) @@ -91,6 +124,37 @@ class AutopilotControlParameters { @JvmField var isSpeakVoice = true + @JvmField + var autoPilotLine: AutoPilotLine? = null // 自动驾驶路线 + + class AutoPilotLine { + var lineId = 0L + var trajUrl = "" + var trajMd5 = "" + var stopUrl = "" + var stopMd5 = "" + var timestamp = 0L + var vehicleModel = "" + + constructor(lineId: Long, trajUrl: String, + trajMd5: String, stopUrl: String, + stopMd5: String, timestamp: Long, + vehicleModel: String) { + this.lineId = lineId + this.trajUrl = trajUrl + this.trajMd5 = trajMd5 + this.stopUrl = stopUrl + this.stopMd5 = stopMd5 + this.timestamp = timestamp + this.vehicleModel = vehicleModel + } + + override fun toString(): String { + return "AutoPilotLine(lineId=$lineId, trajUrl='$trajUrl', trajMd5='$trajMd5', stopUrl='$stopUrl', stopMd5='$stopMd5', timestamp=$timestamp, vehicleModel='$vehicleModel')" + } + + } + class AutoPilotLonLat { var lat = 0.0 var lon = 0.0 diff --git a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt index 1815e0867f..6a0541fe02 100644 --- a/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt +++ b/core/mogo-core-function-api/src/main/java/com/mogo/eagle/core/function/api/autopilot/IMoGoAutopilotProvider.kt @@ -34,6 +34,11 @@ interface IMoGoAutopilotProvider : IMoGoFunctionServerProvider { */ fun sendTrafficLightData(trafficLightResult: TrafficLightResult) + /** + * 发送 轨迹下载请求 + */ + fun sendTrajectoryDownloadReq(autoPilotLine: AutopilotControlParameters.AutoPilotLine) + /** * 结束自动驾驶 */