[m1]
[1.1.2] [到达站点、启动自驾、结束订单、tts、车模修改]
@@ -0,0 +1,3 @@
|
||||
package com.mogo.och.bus.passenger.bean.request
|
||||
|
||||
data class ArriveDestRequest(val sn:String, val lineId:Long)
|
||||
@@ -0,0 +1,3 @@
|
||||
package com.mogo.och.bus.passenger.bean.request
|
||||
|
||||
data class EndOrderRequest(val sn:String,val orderNo:String)
|
||||
@@ -8,6 +8,7 @@ data class LineInfoResponse(val data: LineInfo?) : BaseData() {
|
||||
data class LineInfo(
|
||||
val name: String?,//线路名称
|
||||
val lineId: Long?,//线路Id
|
||||
var isCheck:Boolean = false,//是否选中
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,26 @@ data class OrderInfoResponse(val data: OrderInfo?) : BaseData() {
|
||||
val startTime: Long?,//开始时间
|
||||
val endTime: Long?,//结束时间
|
||||
val passengerPhone: String?,//乘客手机号
|
||||
val arriveStatus:Int?,//1:未到达 2:到达
|
||||
)
|
||||
companion object{
|
||||
val ARRIVING = 1
|
||||
val ARRIVED = 2
|
||||
|
||||
/**
|
||||
* 爱情号
|
||||
*/
|
||||
val M1_LOVE = 1
|
||||
|
||||
/**
|
||||
* 友情号
|
||||
*/
|
||||
val M1_FRIENDLY = 2
|
||||
|
||||
/**
|
||||
* 家庭号
|
||||
*/
|
||||
val M1_FAMILY = 3
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,8 @@ data class SiteInfoResponse(val data: List<SiteInfo>?) : BaseData(){
|
||||
val GcjLat: Double?,//高德坐标
|
||||
val seq: Double?,
|
||||
val type: Int?,
|
||||
var isNear:Boolean=false
|
||||
var isNear:Boolean=false,
|
||||
var isCheck:Boolean=false,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.mogo.och.bus.passenger.callback
|
||||
|
||||
interface ICarTypeCallback {
|
||||
fun setCarChangeListener(productType: Int?)
|
||||
}
|
||||
@@ -6,26 +6,32 @@ import android.net.ConnectivityManager
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener
|
||||
import com.mogo.commons.module.intent.IntentManager
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationWGS84Listener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerPlanningRottingListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.*
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.startAutoPilot
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateTransform
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||
import com.mogo.eagle.core.utilcode.util.CountDownTimer
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.bean.LoopInfo
|
||||
import com.mogo.och.bus.passenger.bean.response.*
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.ICarTypeCallback
|
||||
import com.mogo.och.bus.passenger.callback.IDistanceTimeCallback
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst.Companion.Charter_AVERAGE_SPEED
|
||||
import com.mogo.och.bus.passenger.net.BusPassengerModelLoopManager
|
||||
@@ -33,7 +39,9 @@ import com.mogo.och.bus.passenger.net.BusPassengerServiceManager
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager
|
||||
import com.mogo.och.common.module.biz.constant.TaxiLoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.manager.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.utils.CoordinateCalculateRouteUtil
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import system_master.SystemStatusInfo
|
||||
@@ -66,20 +74,34 @@ object CharterPassengerModel {
|
||||
|
||||
// 当前位置坐标
|
||||
private var mLocation: MogoLocation? = null
|
||||
private var mLocationWgs: MogoLocation? = null
|
||||
|
||||
// 订单信息 有订单有线路结束订单
|
||||
private var orderInfo: OrderInfoResponse.OrderInfo? = null
|
||||
|
||||
// 轨迹信息 用来启动自动驾驶
|
||||
private var locusInfo: LocusResponse.LocusInfo? = null
|
||||
|
||||
// 轨迹点、底盘透传的
|
||||
private val mRoutePoints: MutableList<MogoLocation> = ArrayList()
|
||||
|
||||
private var orderStatus:OrderStatusEnum = OrderStatusEnum.NoOrderUnuse
|
||||
private var orderStatus: OrderStatusEnum = OrderStatusEnum.NoOrderUnuse
|
||||
|
||||
private var orderStatusChangeListener:IOrderStatusChangeListener?=null
|
||||
private var orderStatusChangeListener: IOrderStatusChangeListener? = null
|
||||
|
||||
private var iDistanceTimeCallback: IDistanceTimeCallback?=null
|
||||
private var iDistanceTimeCallback: IDistanceTimeCallback? = null
|
||||
|
||||
/**
|
||||
* 到站是否播报 key 线路id+业务 value 是否播报
|
||||
*
|
||||
*/
|
||||
private var broadcastList : MutableMap<String,Boolean> = HashMap()
|
||||
|
||||
private val endKey = "arrivedLine"
|
||||
|
||||
private var countDownTimer:CountDownTimer?=null
|
||||
|
||||
private var carTypeChageListener: ICarTypeCallback?=null
|
||||
|
||||
fun init() {
|
||||
initListeners()
|
||||
@@ -94,6 +116,7 @@ object CharterPassengerModel {
|
||||
CallerAutoPilotStatusListenerManager.removeListener(mGoAutopilotStatusListener)
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
CallerPlanningRottingListenerManager.removeListener(moGoAutopilotPlanningListener)
|
||||
CallerChassisLocationWGS84ListenerManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
private fun initListeners() {
|
||||
@@ -104,6 +127,7 @@ object CharterPassengerModel {
|
||||
CallerAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, mMapLocationListener)
|
||||
CallerChassisLocationWGS84ListenerManager.addListener(TAG, 2, mMapWGS84LocationListener)
|
||||
// 自动驾驶路线规划接口 返回自动驾驶轨迹
|
||||
CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener)
|
||||
// 登录状态监听
|
||||
@@ -120,7 +144,7 @@ object CharterPassengerModel {
|
||||
mControllerStatusCallbackMap[tag] = callback
|
||||
}
|
||||
|
||||
fun setiDistanceTimeCallback(distanceTimeCallback: IDistanceTimeCallback?){
|
||||
fun setiDistanceTimeCallback(distanceTimeCallback: IDistanceTimeCallback?) {
|
||||
this.iDistanceTimeCallback = distanceTimeCallback
|
||||
}
|
||||
|
||||
@@ -162,6 +186,13 @@ object CharterPassengerModel {
|
||||
}
|
||||
}
|
||||
}
|
||||
private val mMapWGS84LocationListener: IMoGoChassisLocationWGS84Listener =
|
||||
object : IMoGoChassisLocationWGS84Listener {
|
||||
override fun onChassisLocationWGS84(gnssInfo: MogoLocation) {
|
||||
if (null == gnssInfo) return
|
||||
mLocationWgs = gnssInfo
|
||||
}
|
||||
}
|
||||
|
||||
// 前一个自动驾驶状体
|
||||
@Volatile
|
||||
@@ -187,6 +218,7 @@ object CharterPassengerModel {
|
||||
override fun onAutopilotSNRequest() {}
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: MessagePad.ArrivalNotification?) {
|
||||
mADASStatusCallback?.onAutopilotArriveEnd()
|
||||
arriveDest()
|
||||
}
|
||||
|
||||
override fun onAutopilotStatusRespByQuery(status: SystemStatusInfo.StatusInfo) {}
|
||||
@@ -198,26 +230,34 @@ object CharterPassengerModel {
|
||||
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener =
|
||||
object : IMoGoPlanningRottingListener {
|
||||
override fun onAutopilotRotting(globalPathResp: MessagePad.GlobalPathResp?) {
|
||||
CallerLogger.d(M_BUS_P + TAG,
|
||||
CallerLogger.d(
|
||||
M_BUS_P + TAG,
|
||||
"onAutopilotRotting = ${GsonUtil.jsonFromObject(globalPathResp)}"
|
||||
)
|
||||
globalPathResp?.wayPointsList?.let {
|
||||
if(it.size>0) {
|
||||
if (it.size > 0) {
|
||||
updateRoutePoints(it)
|
||||
startCalculateDistanceLoop()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateRoutePoints(routePoints: List<MessagePad.Location?>?) {
|
||||
mRoutePoints.clear()
|
||||
val latLngModels = CoordinateCalculateRouteUtil
|
||||
.coordinateConverterWgsToGcjLocations(mContext, routePoints)
|
||||
mRoutePoints.addAll(latLngModels)
|
||||
}
|
||||
fun setStatusChangeListener(orderStatusChangeListener:IOrderStatusChangeListener?){
|
||||
|
||||
fun setStatusChangeListener(orderStatusChangeListener: IOrderStatusChangeListener?) {
|
||||
this.orderStatusChangeListener = orderStatusChangeListener
|
||||
}
|
||||
fun getCurrentOrderStatus():OrderStatusEnum{
|
||||
fun setCarTypeChangeListener(carTypeChageListener: ICarTypeCallback?){
|
||||
this.carTypeChageListener = carTypeChageListener
|
||||
}
|
||||
|
||||
fun getCurrentOrderStatus(): OrderStatusEnum {
|
||||
return this.orderStatus
|
||||
}
|
||||
// endregion
|
||||
@@ -274,9 +314,15 @@ object CharterPassengerModel {
|
||||
BusPassengerServiceManager.queryOrderInfo(
|
||||
mContext, object : OchCommonServiceCallback<OrderInfoResponse> {
|
||||
override fun onSuccess(data: OrderInfoResponse?) {
|
||||
if (data?.data == null) return
|
||||
// 判断是否有订单
|
||||
ordrLagic(data?.data)
|
||||
if (data?.data == null){
|
||||
if(orderInfo!=null){
|
||||
// 启动车辆服务状态
|
||||
startCarStatusLoop()
|
||||
}
|
||||
}else {
|
||||
// 判断是否有订单
|
||||
ordrLagic(data?.data)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
@@ -289,36 +335,49 @@ object CharterPassengerModel {
|
||||
* 订单逻辑
|
||||
*/
|
||||
fun ordrLagic(orderData: OrderInfoResponse.OrderInfo) {
|
||||
if (orderData.orderNo == null) {
|
||||
setOrderStatus(OrderStatusEnum.NoOrderUnuse)
|
||||
return
|
||||
}
|
||||
// 有订单有线路后结束轮训
|
||||
orderData.let { order ->
|
||||
if (order.lineId == null || order.lineId == 0L || order.siteId == null || order.siteId == 0L) {
|
||||
// 去选线路和站点
|
||||
setOrderStatus(OrderStatusEnum.OrderNoLine)
|
||||
} else {
|
||||
this.orderInfo = orderData
|
||||
// 有订单取消轮训
|
||||
endOrderLoop()
|
||||
// 已经选择线路和终点、恢复现场数据
|
||||
// 启动车辆服务状态
|
||||
startCarStatusLoop()
|
||||
setOrderStatus(OrderStatusEnum.OrdersWithLine)
|
||||
// 启动时间校准
|
||||
startCalibrationLoop()
|
||||
// 查询自动驾驶轨迹
|
||||
queryLocusByLineId(order.lineId)
|
||||
// 有线路 有站点
|
||||
if (this.orderInfo?.lineId != orderData.lineId) {// 线路变更
|
||||
if (this.orderInfo?.productType!=orderData.productType) {
|
||||
this.carTypeChageListener?.setCarChangeListener(orderData.productType)
|
||||
}
|
||||
|
||||
this.orderInfo = orderData
|
||||
// 查询自动驾驶轨迹
|
||||
queryLocusByLineId(order.lineId)
|
||||
setOrderStatus(OrderStatusEnum.OrdersWithLine)
|
||||
}
|
||||
//计算终点距离
|
||||
mLocation?.let { currentInfo ->
|
||||
// 两点之间的距离
|
||||
val siteGCJ = CoordinateTransform.WGS84ToGCJ02(order.wgs84Lon, order.wgs84Lat)
|
||||
val calculateLineDistance = CoordinateUtils.calculateLineDistance(
|
||||
currentInfo.longitude,
|
||||
currentInfo.latitude,
|
||||
siteGCJ[0],
|
||||
siteGCJ[1]
|
||||
)
|
||||
// 小于30m到站
|
||||
if (calculateLineDistance < 30) {
|
||||
arriveDest()
|
||||
}
|
||||
}
|
||||
}
|
||||
// 启动时间校准
|
||||
startCalibrationLoop()
|
||||
}
|
||||
}
|
||||
|
||||
fun hasSetLineAndSite(): Pair<LineInfoResponse.LineInfo, SiteInfoResponse.SiteInfo>? {
|
||||
orderInfo?.let {
|
||||
if (it.lineId != null && it.lineId > 0 && it.siteId != null && it.siteId > 0) {
|
||||
val lineInfo = LineInfoResponse.LineInfo(it.lineName,it.lineId)
|
||||
val targetSizt = SiteInfoResponse.SiteInfo(
|
||||
val lineInfo = LineInfoResponse.LineInfo(it.lineName, it.lineId)
|
||||
val targetSizt = SiteInfoResponse.SiteInfo(
|
||||
lineId = it.lineId,
|
||||
lineName = it.lineName,
|
||||
siteId = it.siteId,
|
||||
@@ -330,7 +389,7 @@ object CharterPassengerModel {
|
||||
seq = null,
|
||||
type = null
|
||||
)
|
||||
return Pair(lineInfo,targetSizt)
|
||||
return Pair(lineInfo, targetSizt)
|
||||
}
|
||||
}
|
||||
return null
|
||||
@@ -370,7 +429,7 @@ object CharterPassengerModel {
|
||||
}
|
||||
|
||||
private fun carStatusLogic(data: BusinessStatusResponse.Result) {
|
||||
if (data.orderNo != null) {// 订单进行中
|
||||
if (data.orderNo != null && data.orderNo.isNotEmpty()) {// 订单进行中
|
||||
return
|
||||
}
|
||||
// 结束路距计算
|
||||
@@ -417,7 +476,24 @@ object CharterPassengerModel {
|
||||
mContext, object : OchCommonServiceCallback<BusinessTimeResponse> {
|
||||
override fun onSuccess(data: BusinessTimeResponse?) {
|
||||
if (data?.data == null) return
|
||||
// todo 轮训时间校准
|
||||
if (data.data.currentTime != null && data.data.endTime != null) {
|
||||
val endlast = data.data.endTime - data.data.currentTime
|
||||
countDownTimer?.cancel()
|
||||
if(endlast<300*1000){
|
||||
return
|
||||
}
|
||||
countDownTimer = object :CountDownTimer(endlast,1000){
|
||||
override fun onTick(millisUntilFinished: Long) {
|
||||
if(millisUntilFinished/1000==300L){
|
||||
VoiceManager.surplus5min()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFinish() {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
@@ -435,6 +511,7 @@ object CharterPassengerModel {
|
||||
if (data?.data == null) return
|
||||
//设置全局轨迹信息
|
||||
locusInfo = data.data
|
||||
CallerLogger.d(TAG,"查询自动驾驶轨迹信息")
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
@@ -470,7 +547,7 @@ object CharterPassengerModel {
|
||||
0, mRoutePoints, it.latitude, it.longitude
|
||||
)
|
||||
//要前往的站在轨迹中对应的点
|
||||
var nextRouteIndex:Int = mRoutePoints.size-1
|
||||
var nextRouteIndex: Int = mRoutePoints.size - 1
|
||||
orderInfo?.let {
|
||||
val wgS84ToGCJ02 = CoordinateTransform.WGS84ToGCJ02(it.wgs84Lon, it.wgs84Lat)
|
||||
nextRouteIndex = CoordinateCalculateRouteUtil.getArrivedPointIndexNew(
|
||||
@@ -478,15 +555,16 @@ object CharterPassengerModel {
|
||||
)
|
||||
}
|
||||
var lastSumLength = 0f
|
||||
if(currentRouteIndex<nextRouteIndex){//
|
||||
if (currentRouteIndex < nextRouteIndex) {//
|
||||
val subList = mRoutePoints.subList(currentRouteIndex, nextRouteIndex)
|
||||
val middlePoingDistancee = CoordinateCalculateRouteUtil.calculateRouteSumLength(subList)
|
||||
val middlePoingDistancee =
|
||||
CoordinateCalculateRouteUtil.calculateRouteSumLength(subList)
|
||||
val lastPoints = mRoutePoints.get(currentRouteIndex)
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
lastPoints.longitude, lastPoints.latitude,
|
||||
it.longitude, it.latitude
|
||||
)+middlePoingDistancee
|
||||
}else{
|
||||
) + middlePoingDistancee
|
||||
} else {
|
||||
val lastPoints = mRoutePoints.get(nextRouteIndex)
|
||||
lastSumLength = CoordinateUtils.calculateLineDistance(
|
||||
lastPoints.longitude, lastPoints.latitude,
|
||||
@@ -500,14 +578,14 @@ object CharterPassengerModel {
|
||||
"---lastSumLength: " + lastSumLength + "----lastTime : " + lastTime
|
||||
+ " thread = " + Thread.currentThread().name
|
||||
)
|
||||
iDistanceTimeCallback?.setDistancecAndTime(lastSumLength.toLong(),lastTime.toLong())
|
||||
iDistanceTimeCallback?.setDistancecAndTime(lastSumLength.toLong(), lastTime.toLong())
|
||||
}
|
||||
}
|
||||
// endregion
|
||||
|
||||
|
||||
private fun setOrderStatus(orderStatus: OrderStatusEnum) {
|
||||
if(this.orderStatus!=orderStatus) {
|
||||
if (this.orderStatus != orderStatus) {
|
||||
this.orderStatus = orderStatus
|
||||
orderStatusChangeListener?.onStatusChange(this.orderStatus)
|
||||
}
|
||||
@@ -516,8 +594,8 @@ object CharterPassengerModel {
|
||||
/**
|
||||
* 计算需要禁用的站点
|
||||
*/
|
||||
fun calculateCurrentSite(data: List<SiteInfoResponse.SiteInfo>): Pair<Int,Boolean> {
|
||||
var distanceMap:MutableMap<Float, Int> = TreeMap()
|
||||
fun calculateCurrentSite(data: List<SiteInfoResponse.SiteInfo>): Pair<Int, Boolean> {
|
||||
var distanceMap: MutableMap<Float, Int> = TreeMap()
|
||||
// 计算所有点的距离
|
||||
data.forEachIndexed { index, siteInfo ->
|
||||
mLocation?.let { currentInfo ->
|
||||
@@ -530,25 +608,152 @@ object CharterPassengerModel {
|
||||
)
|
||||
if (calculateLineDistance < 30) {
|
||||
return if (index + 1 <= data.size - 1) {
|
||||
Pair(index+1,true)
|
||||
Pair(index + 1, true)
|
||||
} else {
|
||||
Pair(index,true)// 距离最后一个站点小于30m
|
||||
Pair(index, true)// 距离最后一个站点小于30m
|
||||
}
|
||||
}
|
||||
distanceMap.put(calculateLineDistance,index)
|
||||
distanceMap.put(calculateLineDistance, index)
|
||||
}
|
||||
}
|
||||
var first = -1
|
||||
if(distanceMap.size>=2){
|
||||
if (distanceMap.size >= 2) {
|
||||
for (mutableEntry in distanceMap) {
|
||||
if(first>0){
|
||||
return Pair(Math.max(first,mutableEntry.value),false)
|
||||
if (first > 0) {
|
||||
return Pair(Math.max(first, mutableEntry.value), false)
|
||||
}
|
||||
first = mutableEntry.value
|
||||
}
|
||||
}
|
||||
|
||||
return Pair(0,false)
|
||||
return Pair(0, false)
|
||||
}
|
||||
|
||||
fun endOrder() {
|
||||
orderInfo?.orderNo?.let {
|
||||
BusPassengerServiceManager.endOrder(
|
||||
mContext, it, object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
ToastUtils.showShort("结束成功")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtils.showShort("$code:$msg")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
fun arriveDest() {
|
||||
orderInfo?.lineId?.let {
|
||||
if(orderInfo!!.arriveStatus==OrderInfoResponse.ARRIVING) {
|
||||
if (broadcastList.get("${it}$endKey")==null||broadcastList.get("${it}$endKey")==false) {
|
||||
BusPassengerServiceManager.arriveDest(
|
||||
mContext, lindId = it, object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
VoiceManager.arrivedStation(orderInfo!!.siteName!!)
|
||||
broadcastList["${it}$endKey"] = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtils.showShort("$code:$msg")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun leaveStation(){
|
||||
orderInfo?.siteName?.let {
|
||||
VoiceManager.leaveStation(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//检测当前订单
|
||||
private fun checkCurrentOCHOrder(): Boolean {
|
||||
return orderInfo != null && orderInfo!!.wgs84Lat != null && orderInfo!!.wgs84Lon != null
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启自动驾驶
|
||||
*
|
||||
* @param isRestart
|
||||
*/
|
||||
fun startAutopilot() {
|
||||
if (!OCHAdasAbilityManager.getInstance().autopilotAbilityStatus) {
|
||||
ToastUtils.showLong(
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason +
|
||||
", 请稍候重试"
|
||||
)
|
||||
return
|
||||
}
|
||||
orderInfo?.let {
|
||||
if(it.arriveStatus==OrderInfoResponse.ARRIVED){
|
||||
ToastUtils.showLong("已到达目的地请重新选择线路")
|
||||
return
|
||||
}
|
||||
val parameters = initAutopilotControlParameters()
|
||||
if (null == parameters) {
|
||||
CallerLogger.e(SceneConstant.M_BUS + TAG, "行程日志-AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
startAutoPilot(parameters)
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS + TAG,
|
||||
"行程日志-开启自动驾驶====" + com.elegant.network.utils.GsonUtil.jsonFromObject(parameters)
|
||||
+ " startLatLon=" + parameters.startName + ",endLatLon=" + parameters.endName +
|
||||
"isRestart = "
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(): AutopilotControlParameters? {
|
||||
if (!checkCurrentOCHOrder()) {
|
||||
CallerLogger.e(M_BUS_P + TAG, "no order or order is empty.")
|
||||
return null
|
||||
}
|
||||
mLocation?.let {
|
||||
|
||||
}
|
||||
val parameters = AutopilotControlParameters()
|
||||
orderInfo?.let { orderInfo ->
|
||||
mLocationWgs?.let { startPoint ->
|
||||
val startWgsLon: Double = startPoint.longitude
|
||||
val startWgsLat: Double = startPoint.latitude
|
||||
val endWgsLon: Double = orderInfo.wgs84Lon!!
|
||||
val endWgsLat: Double = orderInfo.wgs84Lat!!
|
||||
parameters.vehicleType = 10//bus
|
||||
// 起点名称拼音首字母大写:科学城B区2号门(KXCBQ2HM)
|
||||
parameters.startName = PinYinUtil.getPinYinHeadChar("QD")
|
||||
// 终点名称拼音首字母大写:科学城C区三号门(KXCCQSHM)
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(orderInfo.siteName)
|
||||
parameters.startLatLon = AutoPilotLonLat(startWgsLat, startWgsLon)
|
||||
parameters.endLatLon = AutoPilotLonLat(endWgsLat, endWgsLon)
|
||||
locusInfo?.let { locus ->
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutoPilotLine(
|
||||
orderInfo.lineId!!,
|
||||
locus.csvFileUrl!!,
|
||||
locus.csvFileMd5!!,
|
||||
locus.txtFileUrl!!, locus.txtFileMd5!!,
|
||||
locus.contrailSaveTime!!, locus.carModel!!,
|
||||
locus.csvFileUrlDPQP!!, locus.csvFileMd5DPQP!!,
|
||||
locus.txtFileUrlDPQP!!, locus.txtFileMd5DPQP!!,
|
||||
locus.contrailSaveTimeDPQP!!
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return parameters
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.mogo.och.bus.passenger.model
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
import com.mogo.tts.base.LangTtsEntity
|
||||
import com.mogo.tts.base.LanguageType
|
||||
import java.util.ArrayList
|
||||
|
||||
object VoiceManager {
|
||||
fun arrivedStation(siteName: String) {
|
||||
val contenxt = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val chineseTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.m1_arrived_station_zh, siteName),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val engTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.m1_arrived_station_en, siteName),
|
||||
LanguageType.ENGLISH
|
||||
)
|
||||
val koreanTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.m1_arrived_station_en, siteName),
|
||||
LanguageType.KOREAN
|
||||
)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1)
|
||||
}
|
||||
|
||||
fun leaveStation(siteName: String) {
|
||||
val contenxt = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val chineseTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.m1_leave_station_zh, siteName),
|
||||
LanguageType.CHINESE
|
||||
)
|
||||
val engTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.m1_leave_station_en, siteName),
|
||||
LanguageType.ENGLISH
|
||||
)
|
||||
val koreanTTS = LangTtsEntity(
|
||||
contenxt.getString(R.string.m1_leave_station_en, siteName),
|
||||
LanguageType.KOREAN
|
||||
)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL1)
|
||||
}
|
||||
|
||||
fun surplus5min() {
|
||||
val contenxt = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val chineseTTS = LangTtsEntity(contenxt.getString(R.string.m1_surplus5_order_zh), LanguageType.CHINESE)
|
||||
val engTTS = LangTtsEntity(contenxt.getString(R.string.m1_surplus5_order_en), LanguageType.ENGLISH)
|
||||
val koreanTTS = LangTtsEntity(contenxt.getString(R.string.m1_surplus5_order_ko), LanguageType.KOREAN)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL0)
|
||||
}
|
||||
|
||||
fun endOrder() {
|
||||
val contenxt = AbsMogoApplication.getApp()
|
||||
val list: MutableList<LangTtsEntity> = ArrayList()
|
||||
val chineseTTS = LangTtsEntity(contenxt.getString(R.string.m1_end_order_zh), LanguageType.CHINESE)
|
||||
val engTTS = LangTtsEntity(contenxt.getString(R.string.m1_end_order_en), LanguageType.ENGLISH)
|
||||
val koreanTTS = LangTtsEntity(contenxt.getString(R.string.m1_end_order_ko), LanguageType.KOREAN)
|
||||
list.add(chineseTTS)
|
||||
list.add(engTTS)
|
||||
list.add(koreanTTS)
|
||||
VoiceNotice.showNotice(list, AIAssist.LEVEL0)
|
||||
}
|
||||
fun stopSite() {
|
||||
val contenxt = AbsMogoApplication.getApp()
|
||||
VoiceNotice.showNotice(contenxt.getString(R.string.m1_stop_site_zh), AIAssist.LEVEL1)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,12 +2,17 @@ package com.mogo.och.bus.passenger.net
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.bean.request.ArriveDestRequest
|
||||
import com.mogo.och.bus.passenger.bean.request.EndOrderRequest
|
||||
import com.mogo.och.bus.passenger.bean.response.*
|
||||
import com.mogo.och.common.module.biz.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.biz.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.biz.network.interceptor.transformTry
|
||||
import retrofit2.http.Body
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
@@ -18,6 +23,13 @@ object BusPassengerServiceManager {
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl())
|
||||
.create(PassengerServiceApi::class.java)
|
||||
|
||||
private fun beforeNet():Boolean{
|
||||
if (CallerTelematicManager.getServerToken().isBlank()) {
|
||||
ToastUtils.showShort("已断开司机屏连接、请联系安全员")
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun queryDriverOperationStatus(
|
||||
@@ -33,6 +45,9 @@ object BusPassengerServiceManager {
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<OrderInfoResponse>?
|
||||
) {
|
||||
if(beforeNet()){
|
||||
return
|
||||
}
|
||||
mBusPassengerServiceApi.queryOrderInfo().transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "loginStatus"))
|
||||
}
|
||||
@@ -59,14 +74,30 @@ object BusPassengerServiceManager {
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<BusinessStatusResponse>
|
||||
) {
|
||||
if(beforeNet()){
|
||||
return
|
||||
}
|
||||
mBusPassengerServiceApi.queryBusinessStatus().transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "businessStatus"))
|
||||
}
|
||||
|
||||
|
||||
@JvmStatic
|
||||
fun endOrder(context: Context, callback: OchCommonServiceCallback<BaseData>?) {
|
||||
mBusPassengerServiceApi.endOrder().transformTry()
|
||||
fun endOrder(context: Context,orderNo:String ,callback: OchCommonServiceCallback<BaseData>?) {
|
||||
if(beforeNet()){
|
||||
return
|
||||
}
|
||||
val endOrderRequest = EndOrderRequest(CallerTelematicManager.getServerToken(),orderNo)
|
||||
mBusPassengerServiceApi.endOrder(request = endOrderRequest).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "serviceEnd"))
|
||||
}
|
||||
@JvmStatic
|
||||
fun arriveDest(context: Context,lindId: Long ,callback: OchCommonServiceCallback<BaseData>?) {
|
||||
if(beforeNet()){
|
||||
return
|
||||
}
|
||||
val request = ArriveDestRequest(CallerTelematicManager.getServerToken(),lindId)
|
||||
mBusPassengerServiceApi.arriveDest(request = request).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "serviceEnd"))
|
||||
}
|
||||
|
||||
@@ -76,6 +107,9 @@ object BusPassengerServiceManager {
|
||||
lindId: String,
|
||||
callback: OchCommonServiceCallback<LocusResponse>?
|
||||
) {
|
||||
if(beforeNet()){
|
||||
return
|
||||
}
|
||||
mBusPassengerServiceApi.queryLocusByLineId(lineId = lindId).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "contrail"))
|
||||
}
|
||||
@@ -85,6 +119,9 @@ object BusPassengerServiceManager {
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<BusinessTimeResponse>?
|
||||
) {
|
||||
if(beforeNet()){
|
||||
return
|
||||
}
|
||||
mBusPassengerServiceApi.queryBusinessTime().transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusinessTime"))
|
||||
}
|
||||
|
||||
@@ -3,11 +3,11 @@ package com.mogo.och.bus.passenger.net
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
|
||||
import com.mogo.och.bus.passenger.bean.request.ArriveDestRequest
|
||||
import com.mogo.och.bus.passenger.bean.request.EndOrderRequest
|
||||
import com.mogo.och.bus.passenger.bean.response.*
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Header
|
||||
import retrofit2.http.Query
|
||||
import retrofit2.http.*
|
||||
|
||||
/**
|
||||
* 包车乘客端接口定义
|
||||
@@ -68,11 +68,21 @@ internal interface PassengerServiceApi {
|
||||
/**
|
||||
* 06结束订单 03
|
||||
*/
|
||||
@GET("/och-rental-cabin/api/flow/v1/driver/serviceEnd")
|
||||
@POST("/och-rental-cabin/api/flow/v1/driver/serviceEnd")
|
||||
fun endOrder(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String=MoGoAiCloudClientConfig.getInstance().token,
|
||||
@Query("sn") sn: String = CallerTelematicManager.getServerToken()
|
||||
@Body request: EndOrderRequest
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
* 06结束订单 03
|
||||
*/
|
||||
@POST("/och-rental-cabin/api/flow/v1/driver/arriveDest")
|
||||
fun arriveDest(
|
||||
@Header("appId") appId: String = MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
@Header("ticket") ticket: String=MoGoAiCloudClientConfig.getInstance().token,
|
||||
@Body request: ArriveDestRequest
|
||||
): Observable<BaseData>
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback
|
||||
import com.mogo.och.bus.passenger.model.CharterPassengerModel
|
||||
import com.mogo.och.bus.passenger.model.VoiceManager
|
||||
import com.mogo.och.bus.passenger.ui.M1DeviceFragment
|
||||
import com.mogo.och.common.module.manager.OCHM1LightAirconditionDoorStatusManager
|
||||
import io.reactivex.disposables.Disposable
|
||||
@@ -124,11 +125,13 @@ class BusPassengerFunctionDevicePresenter(view: M1DeviceFragment?) :
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {//
|
||||
ToastUtils.showShort("启动自动驾驶中")
|
||||
// TODO: 查找线路和订单来确定 CallerAutoPilotControlManager.startAutoPilot(parameters);
|
||||
CharterPassengerModel.startAutopilot()
|
||||
CharterPassengerModel.leaveStation()
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {
|
||||
// 重新起步
|
||||
CallerAutoPilotControlManager.sendPlanningCmd(2)
|
||||
CharterPassengerModel.leaveStation()
|
||||
}
|
||||
IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING -> {
|
||||
ToastUtils.showShort("因车辆正在平行驾驶中无法靠边停车,请稍后再试")
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.model.VoiceManager
|
||||
import com.mogo.och.bus.passenger.ui.M1ContainFragment
|
||||
import com.mogo.och.common.module.manager.OCHPlanningStopSideStatusManager
|
||||
import com.mogo.och.common.module.voice.VoiceNotice
|
||||
@@ -32,7 +33,7 @@ class BusPassengerFunctionPresenter(view: M1ContainFragment?) :
|
||||
ToastUtils.showShort(errorInfo)
|
||||
}
|
||||
OCHPlanningStopSideStatusManager.Status.START -> {
|
||||
VoiceNotice.showNotice("正在为您靠边停车,请坐稳扶好哟")
|
||||
VoiceManager.stopSite()
|
||||
}
|
||||
OCHPlanningStopSideStatusManager.Status.DOING -> {
|
||||
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
package com.mogo.och.bus.passenger.presenter
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.eagle.core.data.config.HdMapBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.data.telematic.TelematicConstant
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.response.OrderInfoResponse
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.ICarTypeCallback
|
||||
import com.mogo.och.bus.passenger.callback.IDistanceTimeCallback
|
||||
import com.mogo.och.bus.passenger.model.CharterPassengerModel
|
||||
import com.mogo.och.bus.passenger.ui.MainFragment
|
||||
@@ -23,7 +28,7 @@ import java.util.*
|
||||
|
||||
class BusPassengerPresenter(view: MainFragment?) :
|
||||
BusBasePassengerFunctionDevicePresenter<MainFragment?>(view),
|
||||
IBusPassengerControllerStatusCallback, IDistanceTimeCallback {
|
||||
IBusPassengerControllerStatusCallback, IDistanceTimeCallback, ICarTypeCallback {
|
||||
|
||||
private var subscribe: Disposable? = null
|
||||
private var gnssSpeed = 0.0f
|
||||
@@ -33,6 +38,7 @@ class BusPassengerPresenter(view: MainFragment?) :
|
||||
// 定位监听
|
||||
CharterPassengerModel.setControllerStatusCallback(TAG,this)
|
||||
CharterPassengerModel.setiDistanceTimeCallback(this)
|
||||
CharterPassengerModel.setCarTypeChangeListener(this)
|
||||
CallerTelematicListenerManager.addListener(TAG, msgReceived)
|
||||
//BusPassengerModel.setMoGoAutopilotPlanningListener(this)
|
||||
|
||||
@@ -42,6 +48,7 @@ class BusPassengerPresenter(view: MainFragment?) :
|
||||
super.onDestroy(owner)
|
||||
CharterPassengerModel.setControllerStatusCallback(TAG,null)
|
||||
CharterPassengerModel.setiDistanceTimeCallback(null)
|
||||
CharterPassengerModel.setCarTypeChangeListener(null)
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
}
|
||||
private fun setSpeed(speed:Float){
|
||||
@@ -145,4 +152,25 @@ class BusPassengerPresenter(view: MainFragment?) :
|
||||
companion object{
|
||||
private const val TAG = "BusPassengerPresenter"
|
||||
}
|
||||
|
||||
override fun setCarChangeListener(productType: Int?) {
|
||||
when (productType) {
|
||||
OrderInfoResponse.M1_LOVE -> {
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.aiqinghao)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.aiqinghao
|
||||
}
|
||||
OrderInfoResponse.M1_FAMILY -> {
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.jiatinghao)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.jiatinghao
|
||||
}
|
||||
OrderInfoResponse.M1_FRIENDLY -> {
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.pengyouhao)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.pengyouhao
|
||||
}
|
||||
else -> {
|
||||
CallerMapUIServiceManager.getMapUIController()?.changeCurrentIcon(R.raw.aiqinghao)
|
||||
HdMapBuildConfig.currentCarVrIconRes = R.raw.aiqinghao
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,8 +56,8 @@ class M1OrderFragment :
|
||||
OrderStatusEnum.NoOrderUse -> {
|
||||
// 开门关门页面
|
||||
m1_order_noorder.visibility = View.GONE
|
||||
m1_order_early_end.visibility = View.VISIBLE
|
||||
eov_end_order.visibility = View.GONE
|
||||
m1_order_early_end.visibility = View.GONE
|
||||
eov_end_order.visibility = View.VISIBLE
|
||||
lsv_line_site.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.model.CharterPassengerModel
|
||||
import com.mogo.och.bus.passenger.presenter.BusPassengerPresenter
|
||||
import com.mogo.och.common.module.biz.constant.LoginStatusManager
|
||||
import kotlinx.android.synthetic.m1.m1_main_fragment.*
|
||||
@@ -57,10 +58,20 @@ class MainFragment :
|
||||
iv_end_order.onClick {
|
||||
if (LoginStatusManager.isLogin()) {
|
||||
// TODO: 结束订单
|
||||
CharterPassengerModel.endOrder()
|
||||
}else{
|
||||
ToastUtils.showShort(AbsMogoApplication.getApp().getString(R.string.m1_please_login_driver))
|
||||
}
|
||||
}
|
||||
ll_car_speed.onClick {
|
||||
if (LoginStatusManager.isLogin()) {
|
||||
// TODO: 结束订单
|
||||
CharterPassengerModel.arriveDest()
|
||||
}else{
|
||||
ToastUtils.showShort(AbsMogoApplication.getApp().getString(R.string.m1_please_login_driver))
|
||||
}
|
||||
}
|
||||
|
||||
v_debug.setOnLongClickListener {
|
||||
ToggleDebugView.toggleDebugView.toggle(requireContext())
|
||||
true
|
||||
|
||||
@@ -12,13 +12,16 @@ import com.mogo.och.bus.passenger.bean.response.LineInfoResponse
|
||||
/**
|
||||
* Created by adityagohad on 06/06/17.
|
||||
*/
|
||||
class OrderLineItemAdapter(private val context: Context, private val dataList: MutableList<LineInfoResponse.LineInfo>) : RecyclerView.Adapter<OrderLineItemAdapter.TextVH>() {
|
||||
class OrderLineItemAdapter(
|
||||
private val context: Context,
|
||||
private val dataList: MutableList<LineInfoResponse.LineInfo>
|
||||
) : RecyclerView.Adapter<OrderLineItemAdapter.TextVH>() {
|
||||
|
||||
private var checkIndex = -1
|
||||
private var enable = false
|
||||
|
||||
var checkChangeListener:CheckListener?=null
|
||||
var checkChangeListener: CheckListener? = null
|
||||
|
||||
fun setDataList(dataList: List<LineInfoResponse.LineInfo>){
|
||||
fun setDataList(dataList: List<LineInfoResponse.LineInfo>) {
|
||||
this.dataList.clear()
|
||||
this.dataList.addAll(dataList)
|
||||
notifyDataSetChanged()
|
||||
@@ -34,17 +37,23 @@ class OrderLineItemAdapter(private val context: Context, private val dataList: M
|
||||
|
||||
override fun onBindViewHolder(holder: TextVH, position: Int) {
|
||||
val lineInfo = dataList[holder.bindingAdapterPosition]
|
||||
if (position==checkIndex){
|
||||
if(lineInfo.isCheck){
|
||||
holder.lineNameTextView.setBackgroundResource(R.drawable.m1_order_line_checked_shape)
|
||||
}else{
|
||||
holder.lineNameTextView.setBackgroundResource(android.R.color.transparent)
|
||||
}
|
||||
holder.lineNameTextView.text = lineInfo.name
|
||||
holder.lineNameTextView.setOnClickListener {
|
||||
val preChecked = checkIndex
|
||||
checkIndex = holder.bindingAdapterPosition
|
||||
notifyItemChanged(preChecked)
|
||||
notifyItemChanged(checkIndex)
|
||||
if (!enable) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
if (lineInfo.isCheck) {
|
||||
return@setOnClickListener
|
||||
}
|
||||
dataList.forEachIndexed { index, lineInfo ->
|
||||
lineInfo.isCheck = index==position
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
checkChangeListener?.onCheckListener(lineInfo)
|
||||
}
|
||||
}
|
||||
@@ -53,8 +62,25 @@ class OrderLineItemAdapter(private val context: Context, private val dataList: M
|
||||
return dataList.size
|
||||
}
|
||||
|
||||
interface CheckListener{
|
||||
fun onCheckListener(lineInfo:LineInfoResponse.LineInfo)
|
||||
fun setEnable(enable: Boolean) {
|
||||
this.enable = enable
|
||||
dataList.forEachIndexed { _, lineInfo ->
|
||||
lineInfo.isCheck = false
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun submitLine(checkLine: LineInfoResponse.LineInfo) {
|
||||
this.dataList.clear()
|
||||
this.dataList.add(checkLine)
|
||||
dataList.forEachIndexed { _, lineInfo ->
|
||||
lineInfo.isCheck = false
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
interface CheckListener {
|
||||
fun onCheckListener(lineInfo: LineInfoResponse.LineInfo)
|
||||
}
|
||||
|
||||
inner class TextVH(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
|
||||
@@ -18,8 +18,8 @@ import com.mogo.och.bus.passenger.bean.response.SiteInfoResponse
|
||||
*/
|
||||
class OrderSiteItemAdapter(private val context: Context, private val dataList: MutableList<SiteInfoResponse.SiteInfo>) : RecyclerView.Adapter<OrderSiteItemAdapter.TextVH>() {
|
||||
|
||||
private var checkIndex = -1
|
||||
private var enableIndex = -1
|
||||
private var enable = true
|
||||
|
||||
var checkChangeListener:CheckListener?=null
|
||||
|
||||
@@ -34,6 +34,13 @@ class OrderSiteItemAdapter(private val context: Context, private val dataList: M
|
||||
this.enableIndex = enableIndex
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
fun setEnable(enable:Boolean){
|
||||
this.enable = enable
|
||||
dataList.forEachIndexed { _, lineInfo ->
|
||||
lineInfo.isCheck = false
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TextVH {
|
||||
val view: View
|
||||
@@ -45,9 +52,9 @@ class OrderSiteItemAdapter(private val context: Context, private val dataList: M
|
||||
override fun onBindViewHolder(holder: TextVH, position: Int) {
|
||||
val siteInfo = dataList[holder.bindingAdapterPosition]
|
||||
if(holder.bindingAdapterPosition>enableIndex){
|
||||
if (position == checkIndex) {
|
||||
if(siteInfo.isCheck){
|
||||
holder.iv_site_checked.setImageResource(R.drawable.m1_order_site_checked)
|
||||
} else {
|
||||
}else{
|
||||
holder.iv_site_checked.setImageResource(R.drawable.m1_order_site_check)
|
||||
}
|
||||
holder.tv_site_site_name.setTextColor(ContextCompat.getColor(context,R.color.bus_p_m1_2C2D31))
|
||||
@@ -55,20 +62,24 @@ class OrderSiteItemAdapter(private val context: Context, private val dataList: M
|
||||
holder.iv_site_checked.setImageResource(R.drawable.m1_order_site_check)
|
||||
holder.tv_site_site_name.setTextColor(ContextCompat.getColor(context,R.color.bus_p_m1_662C2D31))
|
||||
}
|
||||
holder.tv_site_site_name.text = siteInfo.lineName
|
||||
holder.tv_site_site_name.text = siteInfo.siteName
|
||||
holder.itemView.setOnClickListener {
|
||||
if(holder.bindingAdapterPosition>enableIndex) {
|
||||
val preChecked = checkIndex
|
||||
checkIndex = holder.bindingAdapterPosition
|
||||
notifyItemChanged(preChecked)
|
||||
notifyItemChanged(checkIndex)
|
||||
checkChangeListener?.onCheckListener(siteInfo)
|
||||
}else{
|
||||
if(siteInfo.isNear){
|
||||
ToastUtils.showShort("您已在此站点附近")
|
||||
}else{
|
||||
ToastUtils.showShort("请选择返程路线")
|
||||
if(enable) {
|
||||
if (holder.bindingAdapterPosition > enableIndex) {
|
||||
dataList.forEachIndexed { index, lineInfo ->
|
||||
lineInfo.isCheck = index==position
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
checkChangeListener?.onCheckListener(siteInfo)
|
||||
} else {
|
||||
if (siteInfo.isNear) {
|
||||
ToastUtils.showShort("您已在此站点附近")
|
||||
} else {
|
||||
ToastUtils.showShort("请选择返程路线")
|
||||
}
|
||||
}
|
||||
}else{
|
||||
ToastUtils.showShort("请切换线路")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,9 +89,10 @@ class OrderSiteItemAdapter(private val context: Context, private val dataList: M
|
||||
}
|
||||
|
||||
fun clearCheck() {
|
||||
val temp = checkIndex
|
||||
checkIndex = -1
|
||||
notifyItemChanged(temp)
|
||||
dataList.forEachIndexed { index, lineInfo ->
|
||||
lineInfo.isCheck = false
|
||||
}
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
interface CheckListener{
|
||||
|
||||
@@ -40,18 +40,20 @@ class LineSiteView @JvmOverloads constructor(
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
companion object{
|
||||
companion object {
|
||||
const val TAG = "LineSiteView"
|
||||
const val TAGLINELOOP = "LineSiteViewLineLoop"
|
||||
const val TAGSITELOOP = "LineSiteViewSiteLoop"
|
||||
}
|
||||
|
||||
private var checkLine: LineInfoResponse.LineInfo?=null
|
||||
private var checkSite: SiteInfoResponse.SiteInfo?=null
|
||||
private var currentSite: SiteInfoResponse.SiteInfo?=null
|
||||
|
||||
private var tempCheckLine: LineInfoResponse.LineInfo?=null
|
||||
private var tempCheckSite: SiteInfoResponse.SiteInfo?=null
|
||||
// 成功提交给后台得线路
|
||||
private var checkLine: LineInfoResponse.LineInfo? = null
|
||||
// 成功提交给后台得终点站点
|
||||
private var checkSite: SiteInfoResponse.SiteInfo? = null
|
||||
// 下一个站点
|
||||
private var currentSite: SiteInfoResponse.SiteInfo? = null
|
||||
// 向司机端端提交的临时线路
|
||||
private var tempCheckLine: LineInfoResponse.LineInfo? = null
|
||||
// 向司机端临时提交的终点站点
|
||||
private var tempCheckSite: SiteInfoResponse.SiteInfo? = null
|
||||
|
||||
|
||||
private val lineList = mutableListOf<LineInfoResponse.LineInfo>()
|
||||
@@ -60,71 +62,109 @@ class LineSiteView @JvmOverloads constructor(
|
||||
private var lineAdapter: OrderLineItemAdapter
|
||||
private var siteAdapter: OrderSiteItemAdapter
|
||||
|
||||
private var gnssSpeed =0.0
|
||||
private var gnssSpeed = 0.0
|
||||
|
||||
private val loadingAni = ObjectAnimator.ofFloat(iv_loading_wait_driver, "rotation", 0f, 90f ,180f, 270f, 360f).apply {
|
||||
repeatCount = -1
|
||||
interpolator = LinearInterpolator()
|
||||
duration = 1000
|
||||
}
|
||||
private val loadingAni =
|
||||
ObjectAnimator.ofFloat(iv_loading_wait_driver, "rotation", 0f, 90f, 180f, 270f, 360f)
|
||||
.apply {
|
||||
repeatCount = -1
|
||||
interpolator = LinearInterpolator()
|
||||
duration = 1000
|
||||
}
|
||||
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.m1_order_lineside, this, true)
|
||||
lineAdapter = OrderLineItemAdapter(context,lineList)
|
||||
siteAdapter = OrderSiteItemAdapter(context,siteList)
|
||||
lineAdapter = OrderLineItemAdapter(context, lineList)
|
||||
siteAdapter = OrderSiteItemAdapter(context, siteList)
|
||||
loadingAni.target = iv_loading_wait_driver
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
rlv_line_list.layoutManager = LinearLayoutManager(context,LinearLayoutManager.VERTICAL,false)
|
||||
rlv_line_list.addItemDecoration(BottomDecoration(AutoSizeUtils.dp2px(context,60f)))
|
||||
rlv_line_list.layoutManager =
|
||||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
rlv_line_list.addItemDecoration(BottomDecoration(AutoSizeUtils.dp2px(context, 60f)))
|
||||
rlv_line_list.adapter = lineAdapter
|
||||
|
||||
rv_site_list.layoutManager = LinearLayoutManager(context,LinearLayoutManager.VERTICAL,false)
|
||||
rv_site_list.addItemDecoration(BottomDecoration(AutoSizeUtils.dp2px(context,60f)))
|
||||
rv_site_list.layoutManager =
|
||||
LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
rv_site_list.addItemDecoration(BottomDecoration(AutoSizeUtils.dp2px(context, 60f)))
|
||||
rv_site_list.adapter = siteAdapter
|
||||
|
||||
val hasSetLineAndSite = CharterPassengerModel.hasSetLineAndSite()
|
||||
if (hasSetLineAndSite!=null) {// 已经设置了线路和站点
|
||||
lineList.add(hasSetLineAndSite.first)
|
||||
if (hasSetLineAndSite != null) {// 已经设置了线路和站点
|
||||
checkLine = hasSetLineAndSite.first
|
||||
checkSite = hasSetLineAndSite.second
|
||||
checkLine?.let {
|
||||
querySitesByLineId(it.lineId.toString())
|
||||
}
|
||||
setViewOrdeWithLine(true)
|
||||
}else{
|
||||
lineList.clear()
|
||||
resetData()
|
||||
setEnableLineStatus(false)
|
||||
setEnableSiteStatus(false)
|
||||
} else {
|
||||
queryLineList()
|
||||
setViewOrdeWithLine(false)
|
||||
setEnableLineStatus(true)
|
||||
setEnableSiteStatus(false)
|
||||
}
|
||||
|
||||
initListener()
|
||||
|
||||
}
|
||||
|
||||
private fun setViewOrdeWithLine(enable:Boolean) {
|
||||
tv_switch_line.isEnabled = enable
|
||||
if(enable) {
|
||||
gl_line_cancle_submit_guide.visibility = View.GONE
|
||||
g_side_cancle_submit_group.visibility = View.GONE
|
||||
}else{
|
||||
gl_line_cancle_submit_guide.visibility = View.VISIBLE
|
||||
g_side_cancle_submit_group.visibility = GONE
|
||||
/**
|
||||
* 重置数据
|
||||
*/
|
||||
private fun resetData() {
|
||||
checkLine?.let {
|
||||
lineList.add(it)
|
||||
checkLine?.let {
|
||||
querySitesByLineId(it.lineId.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否可用进行选择线路
|
||||
*/
|
||||
private fun setEnableLineStatus(enable: Boolean) {
|
||||
if (enable) {
|
||||
g_line_submit_group.visibility = View.VISIBLE
|
||||
lineAdapter.setEnable(true)
|
||||
} else {
|
||||
if (checkLine != null) {
|
||||
g_line_submit_group.visibility = View.GONE
|
||||
lineAdapter.setEnable(false)
|
||||
} else {
|
||||
ToastUtils.showShort("请选择线路")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否可用选择站点
|
||||
*/
|
||||
private fun setEnableSiteStatus(enable: Boolean) {
|
||||
if (enable) {
|
||||
g_side_cancle_submit_group.visibility = View.VISIBLE
|
||||
siteAdapter.setEnable(true)
|
||||
} else {
|
||||
if(checkSite!=null) {
|
||||
g_side_cancle_submit_group.visibility = View.GONE
|
||||
siteAdapter.setEnable(false)
|
||||
}else{
|
||||
ToastUtils.showShort("请确定站点")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
lineAdapter.checkChangeListener = object :OrderLineItemAdapter.CheckListener{
|
||||
lineAdapter.checkChangeListener = object : OrderLineItemAdapter.CheckListener {
|
||||
override fun onCheckListener(lineInfo: LineInfoResponse.LineInfo) {
|
||||
ToastUtils.showLong("选中线路${lineInfo} 对比当前坐标计算需要禁用的站点")
|
||||
tempCheckLine = lineInfo
|
||||
querySitesByLineId(lineInfo.lineId.toString())
|
||||
siteAdapter.clearCheck()
|
||||
}
|
||||
}
|
||||
siteAdapter.checkChangeListener = object :OrderSiteItemAdapter.CheckListener{
|
||||
siteAdapter.checkChangeListener = object : OrderSiteItemAdapter.CheckListener {
|
||||
override fun onCheckListener(siteInfo: SiteInfoResponse.SiteInfo) {
|
||||
// 设置临时选中的
|
||||
tempCheckSite = siteInfo
|
||||
@@ -132,14 +172,15 @@ class LineSiteView @JvmOverloads constructor(
|
||||
|
||||
}
|
||||
tv_line_cancle.onClick {
|
||||
ToastUtils.showLong("取消切换")
|
||||
resetData()
|
||||
setEnableLineStatus(false)
|
||||
}
|
||||
tv_line_submit.onClick {
|
||||
if (tempCheckLine==null) {
|
||||
if (tempCheckLine == null) {
|
||||
ToastUtils.showLong("请选择线路")
|
||||
return@onClick
|
||||
}
|
||||
if(!CallerTelematicManager.getClientConnStatus()){
|
||||
if (!CallerTelematicManager.getClientConnStatus()) {
|
||||
ToastUtils.showLong("乘客屏无法连接司机屏请联系安全员")
|
||||
return@onClick
|
||||
}
|
||||
@@ -159,23 +200,27 @@ class LineSiteView @JvmOverloads constructor(
|
||||
)
|
||||
startAni()
|
||||
// 启动查看和司机端链接
|
||||
BusPassengerModelLoopManager.setLoopFunction(TAGLINELOOP, LoopInfo(3,::checkServerStatus))
|
||||
BusPassengerModelLoopManager.setLoopFunction(
|
||||
TAGLINELOOP,
|
||||
LoopInfo(3, ::checkServerStatus)
|
||||
)
|
||||
}
|
||||
}
|
||||
tv_site_cancle.onClick {
|
||||
ToastUtils.showLong("取消切换")
|
||||
resetData()
|
||||
setEnableSiteStatus(false)
|
||||
}
|
||||
tv_site_submit.onClick {
|
||||
if (tempCheckSite==null) {
|
||||
if (tempCheckSite == null) {
|
||||
ToastUtils.showLong("请选择站点")
|
||||
return@onClick
|
||||
}
|
||||
if(!CallerTelematicManager.getClientConnStatus()){
|
||||
if (!CallerTelematicManager.getClientConnStatus()) {
|
||||
ToastUtils.showLong("乘客屏无法连接司机屏请联系安全员")
|
||||
return@onClick
|
||||
}
|
||||
checkLine?.let {lineInfo->
|
||||
tempCheckSite?.let {siteInfo->
|
||||
checkLine?.let { lineInfo ->
|
||||
tempCheckSite?.let { siteInfo ->
|
||||
val msg = ChangeDestMsg(
|
||||
lineInfo.lineId!!.toInt(),
|
||||
lineInfo.name!!,
|
||||
@@ -192,27 +237,28 @@ class LineSiteView @JvmOverloads constructor(
|
||||
}
|
||||
startAni()
|
||||
// 启动查看和司机端链接
|
||||
BusPassengerModelLoopManager.setLoopFunction(TAGLINELOOP, LoopInfo(3,::checkServerStatus))
|
||||
BusPassengerModelLoopManager.setLoopFunction(
|
||||
TAGLINELOOP,
|
||||
LoopInfo(3, ::checkServerStatus)
|
||||
)
|
||||
}
|
||||
}
|
||||
tv_switch_line.onClick {
|
||||
ToastUtils.showLong("判断速度是否为0,开始查询线路信息")
|
||||
}
|
||||
tv_loading_wait_driver_title.onClick {
|
||||
endAni()
|
||||
}
|
||||
|
||||
CallerTelematicListenerManager.addListener(TAG,msgReceived)
|
||||
CallerTelematicListenerManager.addListener(TAG, msgReceived)
|
||||
CharterPassengerModel.setControllerStatusCallback(TAG) { location ->
|
||||
location?.let {
|
||||
gnssSpeed = it.gnssInfo.vehicleSpeed
|
||||
}
|
||||
}
|
||||
tv_switch_line.onClick {
|
||||
if(gnssSpeed<0.01){
|
||||
if (gnssSpeed < 0.01) {
|
||||
// 可以切换路径
|
||||
gl_line_cancle_submit_guide.visibility = View.VISIBLE
|
||||
}else{
|
||||
setEnableLineStatus(true)
|
||||
queryLineList()
|
||||
} else {
|
||||
ToastUtils.showShort("请停车后再修改目的地~")
|
||||
}
|
||||
}
|
||||
@@ -221,29 +267,43 @@ class LineSiteView @JvmOverloads constructor(
|
||||
/**
|
||||
* 接收司机屏反馈信息
|
||||
*/
|
||||
val msgReceived = object : IReceivedMsgListener{
|
||||
val msgReceived = object : IReceivedMsgListener {
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
UiThreadHandler.post {
|
||||
if(type==TelematicConstant.BUSINESS_STRING){
|
||||
val msg = GsonUtils.fromJson(String(byteArray),
|
||||
ChangeDestMsg::class.java) as ChangeDestMsg
|
||||
if(msg.type==DPMsgType.TYPE_CHANGE_DEST.type){
|
||||
if(msg.destSiteId==0){
|
||||
checkLine = tempCheckLine
|
||||
ToastUtils.showShort("线路确定")
|
||||
gl_line_cancle_submit_guide.visibility = View.GONE
|
||||
g_side_cancle_submit_group.visibility = View.VISIBLE
|
||||
if(checkLine!=null) {
|
||||
lineList.clear()
|
||||
lineList.add(checkLine!!)
|
||||
lineAdapter.notifyDataSetChanged()
|
||||
if (type == TelematicConstant.BUSINESS_STRING) {
|
||||
val msg = GsonUtils.fromJson(
|
||||
String(byteArray),
|
||||
ChangeDestMsg::class.java
|
||||
) as ChangeDestMsg
|
||||
if (msg.type == DPMsgType.TYPE_CHANGE_DEST.type) {
|
||||
if (msg.destSiteId == 0) {
|
||||
if (msg.isConfirmed) {
|
||||
ToastUtils.showShort("线路确定")
|
||||
setEnableLineStatus(false)
|
||||
setEnableSiteStatus(true)
|
||||
tempCheckLine?.let {
|
||||
lineAdapter.submitLine(it)
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("司机端拒绝请重新选择")
|
||||
}
|
||||
} else {
|
||||
if (msg.isConfirmed) {
|
||||
ToastUtils.showShort("站点确定")
|
||||
g_side_cancle_submit_group.visibility = View.GONE
|
||||
g_line_submit_group.visibility = View.GONE
|
||||
setEnableLineStatus(false)
|
||||
setEnableSiteStatus(false)
|
||||
checkLine = tempCheckLine
|
||||
checkSite = tempCheckSite
|
||||
tempCheckLine?.let {
|
||||
lineAdapter.submitLine(it)
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showShort("司机端拒绝请重新选择")
|
||||
}
|
||||
BusPassengerModelLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
}else{
|
||||
ToastUtils.showShort("站点确定")
|
||||
g_side_cancle_submit_group.visibility = View.GONE
|
||||
gl_line_cancle_submit_guide.visibility = View.GONE
|
||||
}
|
||||
BusPassengerModelLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
endAni()
|
||||
}
|
||||
}
|
||||
@@ -251,15 +311,15 @@ class LineSiteView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun startAni(){
|
||||
private fun startAni() {
|
||||
g_lines_sites_data.visibility = View.GONE
|
||||
g_loading_group.visibility = View.VISIBLE
|
||||
if(!loadingAni.isRunning) {
|
||||
if (!loadingAni.isRunning) {
|
||||
loadingAni.start()
|
||||
}
|
||||
}
|
||||
|
||||
private fun endAni(){
|
||||
private fun endAni() {
|
||||
g_lines_sites_data.visibility = View.VISIBLE
|
||||
g_loading_group.visibility = View.GONE
|
||||
}
|
||||
@@ -269,12 +329,12 @@ class LineSiteView @JvmOverloads constructor(
|
||||
loadingAni.cancel()
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
BusPassengerModelLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
CharterPassengerModel.setControllerStatusCallback(TAG,null)
|
||||
CharterPassengerModel.setControllerStatusCallback(TAG, null)
|
||||
|
||||
}
|
||||
|
||||
private fun queryLineList() {
|
||||
BusPassengerServiceManager.queryLineList(context,object :
|
||||
BusPassengerServiceManager.queryLineList(context, object :
|
||||
OchCommonServiceCallback<LineInfoListResponse> {
|
||||
override fun onSuccess(data: LineInfoListResponse?) {
|
||||
if (data?.data == null) return
|
||||
@@ -287,7 +347,7 @@ class LineSiteView @JvmOverloads constructor(
|
||||
})
|
||||
}
|
||||
|
||||
private fun checkServerStatus(){
|
||||
private fun checkServerStatus() {
|
||||
if (!CallerTelematicManager.getClientConnStatus()) {
|
||||
ToastUtils.showShort("断开和司机端连接、请联系安全员")
|
||||
BusPassengerModelLoopManager.removeLoopFunction(TAGLINELOOP)
|
||||
@@ -295,28 +355,37 @@ class LineSiteView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun querySitesByLineId(lineId:String) {
|
||||
BusPassengerServiceManager.queryLineSiteList(context,lineId,object :OchCommonServiceCallback<SiteInfoResponse>{
|
||||
override fun onSuccess(data: SiteInfoResponse?) {
|
||||
if (data?.data == null) return
|
||||
siteAdapter.setDataList(data.data)
|
||||
if(data.data.isNotEmpty()) {
|
||||
// 计算当前站点是那个
|
||||
val calculateCurrentSite = CharterPassengerModel.calculateCurrentSite(data.data)
|
||||
val index = if(calculateCurrentSite.first<=data.data.size){
|
||||
calculateCurrentSite.first
|
||||
}else{
|
||||
data.data.size-1
|
||||
private fun querySitesByLineId(lineId: String) {
|
||||
BusPassengerServiceManager.queryLineSiteList(
|
||||
context,
|
||||
lineId,
|
||||
object : OchCommonServiceCallback<SiteInfoResponse> {
|
||||
override fun onSuccess(data: SiteInfoResponse?) {
|
||||
if (data?.data == null) return
|
||||
siteAdapter.setDataList(data.data)
|
||||
if (data.data.isNotEmpty()) {
|
||||
// 计算当前站点是那个
|
||||
val calculateCurrentSite =
|
||||
CharterPassengerModel.calculateCurrentSite(data.data)
|
||||
val index = if (calculateCurrentSite.first <= data.data.size) {
|
||||
calculateCurrentSite.first
|
||||
} else {
|
||||
data.data.size - 1
|
||||
}
|
||||
currentSite = data.data[index]
|
||||
currentSite!!.isNear = calculateCurrentSite.second
|
||||
siteAdapter.setEnableIndex(index)
|
||||
data.data.forEach {
|
||||
if(it.siteId==checkSite?.siteId){
|
||||
it.isCheck = true
|
||||
}
|
||||
}
|
||||
}
|
||||
currentSite = data.data[index]
|
||||
currentSite!!.isNear = calculateCurrentSite.second
|
||||
siteAdapter.setEnableIndex(index)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
ToastUtils.showShort("查询站点失败")
|
||||
}
|
||||
})
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
ToastUtils.showShort("查询站点失败")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 29 KiB |
|
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 808 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 30 KiB |
@@ -3,6 +3,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/cl_container"
|
||||
android:background="@drawable/m1_function_bg"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<FrameLayout
|
||||
@@ -51,7 +52,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/cb_bp_setting_device"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="@dimen/dp_162"
|
||||
android:layout_width="@dimen/dp_181"
|
||||
android:layout_height="@dimen/dp_179"/>
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
app:carDrawable="@drawable/bug_p_overmap_car_model"
|
||||
app:resetDrawableMarginRight="34dp"
|
||||
app:resetDrawableMarginBottom="54dp"
|
||||
app:isClearArrived="true"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
@@ -203,7 +204,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/cb_bp_setting_device"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_width="@dimen/dp_162"
|
||||
android:layout_width="@dimen/dp_181"
|
||||
android:layout_height="@dimen/dp_179"/>
|
||||
|
||||
<ImageView
|
||||
@@ -211,8 +212,6 @@
|
||||
android:src="@drawable/m1_order_end"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_29"
|
||||
android:layout_marginBottom="@dimen/dp_34"
|
||||
android:layout_width="@dimen/dp_95"
|
||||
android:layout_height="@dimen/dp_95"/>
|
||||
|
||||
|
||||
@@ -36,10 +36,6 @@
|
||||
<include
|
||||
android:id="@+id/m1_order_noorder"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
layout="@layout/m1_order_noorder"/>
|
||||
|
||||
|
||||
|
||||
@@ -97,6 +97,11 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical" />
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/g_line_submit_group"
|
||||
app:constraint_referenced_ids="tv_line_submit,tv_line_cancle,iv_line_cancle_submit_bg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/ll_noorder"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
@@ -24,9 +24,30 @@
|
||||
<string name="bus_p_m1_speed_unit">KM/h</string>
|
||||
|
||||
|
||||
<string name="m1_arrived_station_zh">已到达%1$s站</string>
|
||||
<string name="m1_arrived_station_en">We are arriving at %1$s</string>
|
||||
<string name="m1_arrived_station_ko">%1$s 역에 도착했습니다</string>
|
||||
|
||||
<string name="m1_leave_station_zh">车辆起步,请扶稳坐好,前方到站 %1$s</string>
|
||||
<string name="m1_leave_station_en">The next station is %1$s</string>
|
||||
<string name="m1_leave_station_ko">전방에서 역에 도착하는 %1$s</string>
|
||||
|
||||
<string name="m1_surplus5_order_zh">距离包车结束剩余5分钟,请您合理安排游玩时间</string>
|
||||
<string name="m1_surplus5_order_en">There are 5 minutes left from the end of chartering. Please arrange your time reasonably</string>
|
||||
<string name="m1_surplus5_order_ko">전세버스 종료 후 5분 남았습니다. 여행 시간을 합리적으로 안배해 주십시오</string>
|
||||
|
||||
<string name="m1_end_order_zh">感谢您体验蘑菇车联自动驾驶小巴车,本次旅程已结束,我们下次乘车再见</string>
|
||||
<string name="m1_end_order_en">Thank you for experiencing the self-driving minibus. See you next time</string>
|
||||
<string name="m1_end_order_ko">자율주행 버스를 체험해 주셔서 감사합니다. 다음에 또 뵙겠습니다</string>
|
||||
|
||||
<string name="m1_stop_site_zh">正在为您靠边停车,请坐稳扶好</string>
|
||||
|
||||
<string name="m1_please_login_driver">请安全员登录司机屏</string>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -51,6 +51,9 @@ object VoiceNotice {
|
||||
|
||||
@JvmStatic
|
||||
fun showNotice(listTTS: MutableList<LangTtsEntity>, level: Int) {
|
||||
AIAssist.getInstance(AbsMogoApplication.getApp())
|
||||
.speakMultiLangTTSWithLevel(MultiLangTtsEntity(listTTS), level,null) }
|
||||
UiThreadHandler.post {
|
||||
AIAssist.getInstance(AbsMogoApplication.getApp())
|
||||
.speakMultiLangTTSWithLevel(MultiLangTtsEntity(listTTS), level, null)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
"socket_tech_url": ""
|
||||
},
|
||||
"online": {
|
||||
"och_url": "http://tech.zhidaohulian.com",
|
||||
"och_url": "https://tech.zhidaohulian.com",
|
||||
"shuttle_url": "https://och-driver.zhidaozhixing.com",
|
||||
"passport_url": "",
|
||||
"socket_base_url": "",
|
||||
|
||||