add control time logic
This commit is contained in:
@@ -149,10 +149,18 @@ class MogoTrafficLightManager : IMogoCarLocationChangedListener2 {
|
||||
lightId: Int,
|
||||
crossingNo: String,
|
||||
heading: Double,
|
||||
controlTime: Int,
|
||||
onSuccess: (() -> Unit),
|
||||
onError: ((String) -> Unit)
|
||||
) {
|
||||
trafficLightNetWorkModel.turnLightToGreen(lightId, crossingNo, heading, onSuccess, onError)
|
||||
trafficLightNetWorkModel.turnLightToGreen(
|
||||
lightId,
|
||||
crossingNo,
|
||||
heading,
|
||||
controlTime,
|
||||
onSuccess,
|
||||
onError
|
||||
)
|
||||
}
|
||||
|
||||
override fun onCarLocationChanged(latLng: MogoLatLng?) {
|
||||
|
||||
@@ -107,13 +107,14 @@ class TrafficLightNetWorkModel {
|
||||
lightId: Int,
|
||||
crossingNo: String,
|
||||
heading: Double,
|
||||
controlTime: Int,
|
||||
onSuccess: (() -> Unit),
|
||||
onError: ((String) -> Unit)
|
||||
) {
|
||||
request<BaseResponse<Any>> {
|
||||
val map = hashMapOf<String, String>()
|
||||
start {
|
||||
val trafficLightRequestData = ChangeLightRequestData(lightId, crossingNo, heading)
|
||||
val trafficLightRequestData = ChangeLightRequestData(lightId, crossingNo, heading, controlTime)
|
||||
map["sn"] = MoGoAiCloudClientConfig.getInstance().sn
|
||||
map["data"] = Gson().toJson(trafficLightRequestData)
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@ import android.os.Looper
|
||||
import android.os.Message
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils
|
||||
import com.mogo.eagle.core.data.map.MogoLatLng
|
||||
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
|
||||
import com.mogo.eagle.core.data.trafficlight.currentRoadTrafficLight
|
||||
import com.mogo.eagle.core.data.trafficlight.turnRedAtOnce
|
||||
import com.mogo.eagle.core.data.trafficlight.*
|
||||
import com.mogo.eagle.core.data.v2x.VipMessage
|
||||
import com.mogo.eagle.core.function.api.hmi.warning.IMoGoWarningStatusListener
|
||||
import com.mogo.eagle.core.function.api.trafficlight.IMoGoTrafficLightListener
|
||||
@@ -114,8 +112,9 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
if (!turnLightFirst) {
|
||||
// 首次判断,变灯
|
||||
turnLightFirst = true
|
||||
Logger.d(TAG, "触发变灯")
|
||||
turnLight()
|
||||
val controlTime = if (currentResult!!.isGreen()) 45 - currentResult.remain else 45
|
||||
Logger.d(TAG, "触发变灯 , controlTime : $controlTime")
|
||||
turnLight(controlTime)
|
||||
}
|
||||
lastResult?.let {
|
||||
//如果上次结果和本次灯态结果变化比较大,则已变灯,控制HMI展示弹窗
|
||||
@@ -159,7 +158,7 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
|
||||
private fun cancelVip() {
|
||||
vip = false
|
||||
if(handler.hasMessages(MSG_WHAT_VIP_CANCEL)){
|
||||
if (handler.hasMessages(MSG_WHAT_VIP_CANCEL)) {
|
||||
handler.removeMessages(MSG_WHAT_VIP_CANCEL)
|
||||
}
|
||||
CallerHmiManager.vipIdentification(false)
|
||||
@@ -203,12 +202,12 @@ class VipCarManager : IMogoOnMessageListener<VipMessage>, IMoGoTrafficLightListe
|
||||
})
|
||||
}
|
||||
|
||||
private fun turnLight() {
|
||||
private fun turnLight(controlTime: Int) {
|
||||
result?.let {
|
||||
MogoTrafficLightManager.INSTANCE.turnLightToGreen(
|
||||
it.lightId,
|
||||
it.crossId,
|
||||
mLocation!!.bearing.toDouble(), {
|
||||
mLocation!!.bearing.toDouble(), controlTime, {
|
||||
Logger.d(TAG, "变灯请求成功")
|
||||
}, { errorMsg ->
|
||||
Logger.e(TAG, "变灯请求失败 msg : $errorMsg")
|
||||
|
||||
@@ -4,6 +4,6 @@ class ChangeLightRequestData(
|
||||
val lightId: Int, //红绿灯ID
|
||||
val crossingNo: String, //路口ID
|
||||
val heading: Double, //行车航向角
|
||||
val action: String? = "" //保留字段,暂时没用
|
||||
val time: Int //控灯时间
|
||||
) {
|
||||
}
|
||||
Reference in New Issue
Block a user