Merge remote-tracking branch 'origin/dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0' into dev_robobus-m1-p-app-module_1.1.0_230112_1.1.0

This commit is contained in:
yangyakun
2023-02-27 09:45:57 +08:00
61 changed files with 1667 additions and 352 deletions

View File

@@ -20,6 +20,7 @@ import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.module.status.IMogoStatusChangedListener;
import com.mogo.commons.module.status.MogoStatusManager;
import com.mogo.commons.module.status.StatusDescriptor;
import com.mogo.commons.voice.AIAssist;
import com.mogo.eagle.core.data.BaseData;
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
@@ -67,6 +68,8 @@ import com.mogo.och.common.module.utils.NumberFormatUtil;
import com.mogo.och.common.module.utils.PinYinUtil;
import com.mogo.och.common.module.utils.ToastUtilsOch;
import com.mogo.och.common.module.voice.VoiceNotice;
import com.mogo.tts.base.LangTtsEntity;
import com.mogo.tts.base.LanguageType;
import org.jetbrains.annotations.NotNull;
@@ -714,9 +717,28 @@ public class OrderModel {
, isLastStop);
}
VoiceNotice.showNotice(String.format(mContext
// VoiceNotice.showNotice(String.format(mContext
// .getString(R.string.bus_arrived_station_tip),
// arriveStation));
ttsArrivedStation(arriveStation);
}
private void ttsArrivedStation(String arriveStation){
List<LangTtsEntity> list = new ArrayList<>();
LangTtsEntity chineseTTS = new LangTtsEntity(String.format(mContext
.getString(R.string.bus_arrived_station_tip),
arriveStation));
arriveStation), LanguageType.CHINESE);
LangTtsEntity engTTS = new LangTtsEntity(String.format(mContext
.getString(R.string.bus_arrived_station_english_tip),
arriveStation), LanguageType.ENGLISH);
LangTtsEntity koreanTTS = new LangTtsEntity(String.format(mContext
.getString(R.string.bus_arrived_station_korean_tip),
arriveStation), LanguageType.KOREAN);
list.add(chineseTTS);
list.add(engTTS);
list.add(koreanTTS);
VoiceNotice.showNotice(list, AIAssist.LEVEL0);
}
/**
@@ -768,9 +790,30 @@ public class OrderModel {
//车站10s后播报
private void leaveTTSTips(String nextStation) {
VoiceNotice.showNotice(String.format(mContext
.getString(R.string.bus_leave_station_tip),
nextStation), DELAY_10S);
UiThreadHandler.postDelayed(new Runnable() {
@Override
public void run() {
List<LangTtsEntity> list = new ArrayList<>();
LangTtsEntity chineseTTS = new LangTtsEntity(String.format(mContext
.getString(R.string.bus_leave_station_tip),
nextStation), LanguageType.CHINESE);
LangTtsEntity engTTS = new LangTtsEntity(String.format(mContext
.getString(R.string.bus_leave_station_english_tip),
nextStation), LanguageType.ENGLISH);
LangTtsEntity koreanTTS = new LangTtsEntity(String.format(mContext
.getString(R.string.bus_leave_station_korean_tip),
nextStation), LanguageType.KOREAN);
list.add(chineseTTS);
list.add(engTTS);
list.add(koreanTTS);
VoiceNotice.showNotice(list, AIAssist.LEVEL0);
}
},DELAY_10S);
// VoiceNotice.showNotice(String.format(mContext
// .getString(R.string.bus_leave_station_tip),
// nextStation), DELAY_10S);
}
/**
@@ -1014,7 +1057,7 @@ public class OrderModel {
queryBusRoutes();// 重新获取任务
removeTipRunnables();
// startOrStopQueryPassengerWriteOff(false);
VoiceNotice.showNotice(mContext.getString(R.string.bus_end_task_tip));
ttsEndTask();
}
}
@@ -1038,6 +1081,21 @@ public class OrderModel {
});
}
private void ttsEndTask() {
// VoiceNotice.showNotice(mContext.getString(R.string.bus_end_task_tip));
List<LangTtsEntity> list = new ArrayList<>();
LangTtsEntity chineseTTS = new LangTtsEntity(mContext
.getString(R.string.bus_end_task_tip), LanguageType.CHINESE);
LangTtsEntity engTTS = new LangTtsEntity(mContext
.getString(R.string.bus_end_task_english_tip), LanguageType.ENGLISH);
LangTtsEntity koreanTTS = new LangTtsEntity(mContext
.getString(R.string.bus_end_task_korean_tip), LanguageType.KOREAN);
list.add(chineseTTS);
list.add(engTTS);
list.add(koreanTTS);
VoiceNotice.showNotice(list, AIAssist.LEVEL0);
}
/**
* 到站
*

View File

@@ -43,8 +43,16 @@
<!-- region tts -->
<string name="bus_arrived_station_tip">已到达%1$s带好随身物品下车请注意安全。</string>
<string name="bus_arrived_station_english_tip">We are arriving at %1$s get off with your belongings</string>
<string name="bus_arrived_station_korean_tip">%1$s 역에 도착했습니다 , 소지품 챙겨서 내리세요</string>
<string name="bus_leave_station_tip">车辆起步,请扶稳坐好,前方到站是%1$s请下车的乘客做好准备。</string>
<string name="bus_leave_station_english_tip">The next station is %1$s please get ready for your arrival</string>
<string name="bus_leave_station_korean_tip">전방에서 역에 도착하는 %1$s ,차에서 내리는 승객은 준비하세요</string>
<string name="bus_end_task_tip">感谢您体验\'蘑菇车联\'自动驾驶小巴车,我们下次再见。</string>
<string name="bus_end_task_english_tip">Thank you for experiencing the self-driving minibus. See you next time</string>
<string name="bus_end_task_korean_tip">자율주행 버스를 체험해 주셔서 감사합니다. 다음에 또 뵙겠습니다</string>
<!-- endregion -->
<string name="bus_before_tips_s">距离发车时间还有%1$s分钟</string>

View File

@@ -0,0 +1,28 @@
package com.mogo.och.bus.passenger.model
/**
* Created on 2022/08/19
*
*
* 0 初始状态,
* 10 已登录,
* 20 已登出,
*/
enum class OrderStatusEnum(val code: Int) {
NoOrderUnuse( 0 ), //无订单车闲置 m1_order_noorder.xml 无订单页面
OrderNoLine( 10), //有订单无线路 m1_order_lineside 选择线路页面
OrdersWithLine( 20), //有订单有线路 m1_order_lineside 选择线路页面隐藏掉确定取消
NoOrderUse( 30),; //无订单车不闲置 m1_order_end.xml 开门关门页面
companion object {
@JvmStatic
fun valueOf(code: Int): OrderStatusEnum? {
for (value in values()) {
if (value.code == code) {
return value
}
}
return NoOrderUnuse
}
}
}

View File

@@ -0,0 +1,61 @@
package com.mogo.och.bus.passenger.ui.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.mogo.och.bus.passenger.R
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: List<LineInfoResponse.Result>) : RecyclerView.Adapter<OrderLineItemAdapter.TextVH>() {
private var checkIndex = -1
var checkChangeListener:CheckListener?=null
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TextVH {
val view: View
val inflater = LayoutInflater.from(context)
view = inflater.inflate(R.layout.m1_order_line_item, parent, false)
return TextVH(view)
}
override fun onBindViewHolder(holder: TextVH, position: Int) {
val lineInfo = dataList[holder.bindingAdapterPosition]
if (position==checkIndex){
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)
checkChangeListener?.onCheckListener(lineInfo)
}
}
override fun getItemCount(): Int {
return dataList.size
}
interface CheckListener{
fun onCheckListener(lineInfo:LineInfoResponse.Result)
}
inner class TextVH(itemView: View) : RecyclerView.ViewHolder(itemView) {
var lineNameTextView: TextView
init {
lineNameTextView = itemView.findViewById(R.id.tv_line_name)
}
}
}

View File

@@ -0,0 +1,88 @@
package com.mogo.och.bus.passenger.ui.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.bean.response.LineInfoResponse
import com.mogo.och.bus.passenger.bean.response.SiteInfoResponse
/**
* Created by adityagohad on 06/06/17.
*/
class OrderSiteItemAdapter(private val context: Context, private val dataList: List<SiteInfoResponse.SiteInfo>) : RecyclerView.Adapter<OrderSiteItemAdapter.TextVH>() {
private var checkIndex = -1
private var enableIndex = -1
var checkChangeListener:CheckListener?=null
fun setEnableIndex(enableIndex:Int){
this.enableIndex = enableIndex
notifyDataSetChanged()
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TextVH {
val view: View
val inflater = LayoutInflater.from(context)
view = inflater.inflate(R.layout.m1_order_site_item, parent, false)
return TextVH(view)
}
override fun onBindViewHolder(holder: TextVH, position: Int) {
val siteInfo = dataList[holder.bindingAdapterPosition]
if(holder.bindingAdapterPosition>enableIndex){
if (position == checkIndex) {
holder.iv_site_checked.setImageResource(R.drawable.m1_order_site_checked)
} 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))
}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_662C2D31))
}
holder.tv_site_site_name.text = siteInfo.lineName
holder.itemView.setOnClickListener {
if(holder.bindingAdapterPosition>enableIndex) {
val preChecked = checkIndex
checkIndex = holder.bindingAdapterPosition
notifyItemChanged(preChecked)
notifyItemChanged(checkIndex)
checkChangeListener?.onCheckListener(siteInfo)
}else{
ToastUtils.showShort("请选择可选站点")
}
}
}
override fun getItemCount(): Int {
return dataList.size
}
fun clearCheck() {
val temp = checkIndex
checkIndex = -1
notifyItemChanged(temp)
}
interface CheckListener{
fun onCheckListener(siteInfo:SiteInfoResponse.SiteInfo)
}
inner class TextVH(itemView: View) : RecyclerView.ViewHolder(itemView) {
var tv_site_site_name: TextView
var iv_site_checked: ImageView
init {
tv_site_site_name = itemView.findViewById(R.id.tv_site_site_name)
iv_site_checked = itemView.findViewById(R.id.iv_site_checked)
}
}
}

View File

@@ -1,18 +1,146 @@
package com.mogo.och.bus.passenger.ui.view
import android.animation.ObjectAnimator
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.view.animation.LinearInterpolator
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView
import androidx.recyclerview.widget.LinearLayoutManager
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.bus.passenger.R
import com.mogo.och.bus.passenger.bean.response.LineInfoResponse
import com.mogo.och.bus.passenger.bean.response.SiteInfoResponse
import com.mogo.och.bus.passenger.ui.adapter.OrderLineItemAdapter
import com.mogo.och.bus.passenger.ui.adapter.OrderSiteItemAdapter
import com.mogo.och.bus.passenger.view.BottomDecoration
import com.mogo.och.bus.passenger.view.RecyclerViewCornerRadius
import kotlinx.android.synthetic.m1.m1_order_lineside.view.*
import kotlinx.android.synthetic.m1.m1_soft_fragment.*
import me.jessyan.autosize.utils.AutoSizeUtils
class LineSiteView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
private var checkLine: LineInfoResponse.Result?=null
private var checkSite: SiteInfoResponse.SiteInfo?=null
private var tempCheckLine: LineInfoResponse.Result?=null
private var tempCheckSite: SiteInfoResponse.SiteInfo?=null
private val lineList = mutableListOf<LineInfoResponse.Result>()
private val siteList = mutableListOf<SiteInfoResponse.SiteInfo>()
private var lineAdapter: OrderLineItemAdapter
private var siteAdapter: OrderSiteItemAdapter
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)
loadingAni.target = iv_loading_wait_driver
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
lineList.add(LineInfoResponse.Result("路线名称1",1))
lineList.add(LineInfoResponse.Result("路线名称2",2))
lineList.add(LineInfoResponse.Result("路线名称3",3))
lineList.add(LineInfoResponse.Result("路线名称4",4))
lineList.add(LineInfoResponse.Result("路线名称5",5))
lineList.add(LineInfoResponse.Result("路线名称6",6))
lineList.add(LineInfoResponse.Result("路线名称7",7))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",1,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",2,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",3,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",4,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",5,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",6,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",7,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",8,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",9,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",10,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",11,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",12,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
siteList.add(SiteInfoResponse.SiteInfo(1,"线路id",13,"站点名称",0.0,0.0,0.0,0.0,0.0,0))
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.adapter = siteAdapter
initListener()
}
private fun initListener() {
lineAdapter.checkChangeListener = object :OrderLineItemAdapter.CheckListener{
override fun onCheckListener(lineInfo: LineInfoResponse.Result) {
ToastUtils.showLong("选中线路${lineInfo} 对比当前坐标计算需要禁用的站点")
tempCheckLine = lineInfo
siteAdapter.clearCheck()
siteAdapter.setEnableIndex(3)
}
}
siteAdapter.checkChangeListener = object :OrderSiteItemAdapter.CheckListener{
override fun onCheckListener(siteInfo: SiteInfoResponse.SiteInfo) {
// 设置临时选中的
tempCheckSite = siteInfo
}
}
tv_line_cancle.onClick {
ToastUtils.showLong("取消切换")
}
tv_line_submit.onClick {
ToastUtils.showLong("向司机端确认弹出loading 并启动轮询查看是否正常连接司机端、等待结果")
startAni()
}
tv_site_cancle.onClick {
ToastUtils.showLong("取消切换")
}
tv_site_submit.onClick {
ToastUtils.showLong("向司机端确认弹出loading 并启动轮询查看是否正常连接司机端、等待结果")
}
tv_switch_line.onClick {
ToastUtils.showLong("判断速度是否为0,开始查询线路信息")
}
tv_loading_wait_driver_title.onClick {
endAni()
}
}
fun startAni(){
g_lines_sites_data.visibility = View.GONE
g_loading_group.visibility = View.VISIBLE
if(!loadingAni.isRunning) {
loadingAni.start()
}
}
fun endAni(){
g_lines_sites_data.visibility = View.VISIBLE
g_loading_group.visibility = View.GONE
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
loadingAni.cancel()
}
}

View File

@@ -0,0 +1,43 @@
package com.mogo.och.bus.passenger.view;
import android.graphics.Rect;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.och.bus.passenger.ui.adapter.TemperatureAdapter;
public class BottomDecoration extends RecyclerView.ItemDecoration {
/**
* 第一个视图和最后一个视图偏移的距离
*/
public static int distance = 0;
/**
* 设置RecyclerView子视图的边距本示例仅用于定义两个子视图之间的边距为space*2
*/
public BottomDecoration(int distance) {
this.distance = distance;
}
@Override
public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
int pos = parent.getChildAdapterPosition(view);
RecyclerView.LayoutParams layoutParams = (RecyclerView.LayoutParams)view.getLayoutParams();
/**
* 通过设置Item左右边距实现第一个左侧和最后一个右侧设置边距,确保显示的视图位于屏幕中间
*/
int itemCount = parent.getAdapter().getItemCount();
if(pos == itemCount-1){
layoutParams.setMargins(0,0,0,distance);
}else {
layoutParams.setMargins(0,0,0,0);
}
view.setLayoutParams(layoutParams);
super.getItemOffsets(outRect, view, parent, state);
}
}

View File

@@ -0,0 +1,70 @@
package com.mogo.och.bus.passenger.view;
import android.graphics.Canvas;
import android.graphics.Path;
import android.graphics.RectF;
import android.graphics.Region;
import android.os.Build;
import android.view.ViewTreeObserver;
import androidx.recyclerview.widget.RecyclerView;
/**
* 为RecyclerView设置圆角
*/
public class RecyclerViewCornerRadius extends RecyclerView.ItemDecoration {
public static final String TAG = "RecyclerViewCornerRadius";
private RectF rectF;
private Path path;
private int topLeftRadius = 0;
private int topRightRadius = 0;
private int bottomLeftRadius = 0;
private int bottomRightRadius = 0;
public RecyclerViewCornerRadius(final RecyclerView recyclerView) {
recyclerView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
rectF = new RectF(0, 0, recyclerView.getMeasuredWidth(), recyclerView.getMeasuredHeight());
path = new Path();
path.reset();
path.addRoundRect(rectF, new float[]{
topLeftRadius, topLeftRadius,
topRightRadius, topRightRadius,
bottomLeftRadius, bottomLeftRadius,
bottomRightRadius, bottomRightRadius
}, Path.Direction.CCW);
recyclerView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
});
}
public void setCornerRadius(int radius) {
this.topLeftRadius = radius;
this.topRightRadius = radius;
this.bottomLeftRadius = radius;
this.bottomRightRadius = radius;
}
public void setCornerRadius(int topLeftRadius, int topRightRadius, int bottomLeftRadius, int bottomRightRadius) {
this.topLeftRadius = topLeftRadius;
this.topRightRadius = topRightRadius;
this.bottomLeftRadius = bottomLeftRadius;
this.bottomRightRadius = bottomRightRadius;
}
@Override
public void onDraw(Canvas c, RecyclerView parent, RecyclerView.State state) {
c.clipRect(rectF);
if (Build.VERSION.SDK_INT >= 28) {
c.clipPath(path);
} else {
c.clipPath(path, Region.Op.REPLACE);
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="@color/bus_p_m1_80288dfc" android:centerColor="@color/bus_p_m1_3060ABFE" android:endColor="@color/bus_p_m1_0060ABFE"/>
</shape>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:angle="90"
android:centerColor="@color/bus_p_m1_91EFF6FF"
android:endColor="@color/bus_p_m1_00EFF6FF"
android:startColor="@color/bus_p_m1_00EFF6FF" />
<corners android:bottomRightRadius="@dimen/dp_26"/>
</shape>

View File

@@ -12,7 +12,7 @@
android:layout_height="@dimen/dp_172"
android:layout_marginTop="@dimen/dp_63"
android:layout_marginStart="@dimen/dp_56"
android:src="@drawable/m1_order_early_end"
android:src="@drawable/m1_order_end_car"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View File

@@ -18,11 +18,11 @@
app:layout_constraintWidth_percent="0.53698">
<com.mogo.och.bus.passenger.ui.view.LineSiteView
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.mogo.och.bus.passenger.ui.view.EndOrderView
android:visibility="gone"
android:layout_width="match_parent"
android:layout_height="match_parent"/>

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/tv_line_name"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_81"
android:gravity="center_vertical|left"
android:paddingStart="46dp"
android:text="22°"
android:textColor="@color/bus_p_m1_292c39"
android:textSize="@dimen/dp_26" />

View File

@@ -49,6 +49,8 @@
android:layout_height="@dimen/dp_16"/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rlv_line_list"
android:background="@drawable/m1_order_line_shape"
app:layout_constraintTop_toBottomOf="@+id/tv_line_title"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginTop="@dimen/dp_24"
@@ -108,6 +110,7 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_site_list"
android:paddingTop="@dimen/dp_20"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
@@ -154,7 +157,6 @@
<androidx.constraintlayout.widget.Group
android:id="@+id/g_side_cancle_submit_group"
android:visibility="gone"
app:constraint_referenced_ids="tv_site_submit,tv_site_cancle,iv_site_cancle_submit_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
@@ -181,6 +183,7 @@
android:layout_height="0dp"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/g_side_submit_group"
android:visibility="gone"
app:constraint_referenced_ids="tv_site_only_submit,iv_site_submit_bg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
@@ -188,5 +191,41 @@
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.constraintlayout.widget.Group
android:id="@+id/g_lines_sites_data"
app:constraint_referenced_ids="cl_line_list,cl_side_list"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/iv_loading_wait_driver"
android:src="@drawable/bus_p_loading"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.372"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="@dimen/dp_71"
android:layout_height="@dimen/dp_73"/>
<TextView
android:id="@+id/tv_loading_wait_driver_title"
app:layout_constraintStart_toStartOf="@+id/iv_loading_wait_driver"
app:layout_constraintEnd_toEndOf="@+id/iv_loading_wait_driver"
app:layout_constraintTop_toBottomOf="@+id/iv_loading_wait_driver"
android:layout_marginTop="63dp"
android:text="等待司机确认信息,请稍候…"
android:textSize="@dimen/dp_30"
android:textColor="@color/bus_p_m1_4a5375"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/g_loading_group"
android:visibility="gone"
app:constraint_referenced_ids="iv_loading_wait_driver,tv_loading_wait_driver_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_81"
android:gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_site_checked"
android:layout_width="@dimen/dp_42"
android:layout_height="@dimen/dp_42"
android:layout_marginStart="@dimen/dp_74"
android:src="@drawable/m1_order_site_checked" />
<TextView
android:id="@+id/tv_site_site_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_25"
android:text="路线名称A"
android:textColor="@color/bus_p_m1_2C2D31"
android:textSize="@dimen/dp_26" />
</LinearLayout>

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
<ImageView
android:id="@+id/iv_early_end"
app:layout_constraintTop_toTopOf="parent"
android:src="@drawable/bus_p_loading"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginTop="@dimen/dp_83"
android:layout_width="@dimen/dp_252"
android:layout_height="@dimen/dp_172"/>
<TextView
android:text="等待司机确认信息,请稍候…"
android:textSize="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_65"
android:gravity="center"
android:textColor="@color/bus_p_m1_4a5375"
app:layout_constraintTop_toBottomOf="@+id/iv_early_end"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -21,7 +21,15 @@
<color name="bus_p_m1_3b4056">#3B4056</color>
<color name="bus_p_m1_23293b">#23293B</color>
<color name="bus_p_m1_485173">#485173</color>
<color name="bus_p_m1_292c39">#292C39</color>
<color name="bus_p_m1_2C2D31">#2C2D31</color>
<color name="bus_p_m1_662C2D31">#662C2D31</color>
<color name="bus_p_m1_80288dfc">#80288DFC</color>
<color name="bus_p_m1_3060ABFE">#3060ABFE</color>
<color name="bus_p_m1_0060ABFE">#0060ABFE</color>
<color name="bus_p_m1_00EFF6FF">#00EFF6FF</color>
<color name="bus_p_m1_91EFF6FF">#91EFF6FF</color>
<color name="bus_p_m1_CCFFFFFF">#CCFFFFFF</color>
<color name="bus_p_m1_80ffffff">#80FFFFFF</color>
</resources>

View File

@@ -55,7 +55,7 @@ dependencies {
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.arouter
annotationProcessor rootProject.ext.dependencies.aroutercompiler
kapt rootProject.ext.dependencies.aroutercompiler
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.amapnavi3dmap

View File

@@ -4,9 +4,9 @@ import android.content.Context
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.annotation.Route
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.magic.mogo.och.charter.constant.CharterConst
import com.magic.mogo.och.charter.fragment.DriverM1Fragment
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
/**
@@ -17,18 +17,19 @@ import com.magic.mogo.och.charter.fragment.DriverM1Fragment
class CharterProvider: ICharterOCH{
private var mActivity: FragmentActivity? = null
private var mContainerId = 0
private var mContainerId: Int? = 0
private var driverM1Fragment: Fragment? = null
override fun createCoverage(activity: FragmentActivity?, containerId: Int) {}
override fun createCoverage(activity: FragmentActivity?, containerId: Int?): Fragment? {
mActivity = activity
mContainerId = containerId!!
override fun createCoverage(fragmentActivity: FragmentActivity?, integer: Int?): Fragment? {
this.mContainerId = integer
this.mActivity = fragmentActivity
showFragment()
return null
}
private fun showFragment() {
val supportFragmentManager = mActivity?.supportFragmentManager
@@ -41,10 +42,11 @@ class CharterProvider: ICharterOCH{
DriverM1Fragment()
}
if (!driverM1Fragment!!.isAdded) {
supportFragmentManager?.beginTransaction()
?.add(mContainerId, driverM1Fragment!!, DriverM1Fragment.TAG)?.commitAllowingStateLoss()
mContainerId?.let {
supportFragmentManager?.beginTransaction()
?.add(it, driverM1Fragment!!, DriverM1Fragment.TAG)?.commitAllowingStateLoss()
}
}
return
}
d(TAG, "准备show fragment")
supportFragmentManager?.beginTransaction()?.show(driverM1Fragment!!)?.commitAllowingStateLoss()
@@ -55,7 +57,7 @@ class CharterProvider: ICharterOCH{
}
override val functionName: String
get() = "och-charter-driver-m1"
get() = ""
override fun onDestroy() {
// 若不调用finish, 设置中打开关闭UITouch,会造成och fragment 重叠

View File

@@ -0,0 +1,16 @@
package com.magic.mogo.och.charter.bean
import com.mogo.eagle.core.data.BaseData
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class CheckOrderCountDownResponse(var data: Result):BaseData(){
data class Result(
var currentTime: Long,
var startTime: Long,
var endTime: Long
)
}

View File

@@ -0,0 +1,14 @@
package com.magic.mogo.och.charter.bean
import com.mogo.eagle.core.data.BaseData
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class QueryBusinessStatusResponse(var data: Result):BaseData(){
data class Result(var orderNo: String, var businessStatus: Int)
//1: 闲置 2:orderNo = "" 当前并没有核销的订单, orderNo != "" 当前车辆需还车状态
}

View File

@@ -0,0 +1,25 @@
package com.magic.mogo.och.charter.bean
import com.mogo.eagle.core.data.BaseData
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class QueryCurrentOrderResponse(var data: Result):BaseData(){ //线路id , 线路名, 当前站点和坐标, 目的站点和坐标, 包车时间, 乘客信息
data class Result(
var sn: String,
var productType: Int,
var orderNo: String,
var lineId: Int,
var lineName: String,
var siteId: Int,
var siteName: String,
var wgs84Lon: Double,
var wgs84Lat: Double,
var startTime: Long,
var endTime: Long,
var passengerPhone: String
)
}

View File

@@ -0,0 +1,7 @@
package com.magic.mogo.och.charter.bean
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class RequestChangeDest(var sn: String,var lineId: Int,var siteId: Int)

View File

@@ -0,0 +1,7 @@
package com.magic.mogo.och.charter.bean
/**
* @author: wangmingjun
* @date: 2023/2/23
*/
data class Station(var siteId: Int, var siteName: String, var seq: Int)

View File

@@ -0,0 +1,9 @@
package com.magic.mogo.och.charter.callback
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
interface ChangeDestCallback {
fun showCommitDialog(title: String,content: String)
}

View File

@@ -0,0 +1,13 @@
package com.magic.mogo.och.charter.callback
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse
/**
* @author: wangmingjun
* @date: 2023/2/23
*/
interface DriverM1OrderCallback {
fun updateOrderUI(orderStatus: QueryCurrentOrderResponse.Result) // 到达站
fun updateOverCountDown(minutes: Int) //倒计时 分钟
fun updateReturnCarStatus(returnSuccess: Boolean)
}

View File

@@ -8,9 +8,6 @@ import com.mogo.eagle.core.data.map.MogoLocation
* Model->Presenter回调状态控制器监听accOn、adas ui show、voice ui show、push ui show、v2x ui show等等
*/
interface IDriverM1ControllerStatusCallback {
// 是否vr map模式
fun onVRModeChanged(isVRMode: Boolean)
// 自车定位
fun onCarLocationChanged(location: MogoLocation?)

View File

@@ -3,16 +3,21 @@ package com.magic.mogo.och.charter.fragment
import android.os.Bundle
import android.view.View
import com.alibaba.android.arouter.launcher.ARouter
import com.charter.driverm1.view.SlidePanelView
import com.magic.mogo.och.charter.R
import com.magic.mogo.och.charter.base.CharterBaseFragment
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse
import com.magic.mogo.och.charter.net.login.LoginDriverM1Impl
import com.magic.mogo.och.charter.presenter.DriverM1Presenter
import com.magic.mogo.och.charter.view.SlidePanelView
import com.mogo.eagle.core.data.temp.EventLogout
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.och.common.module.biz.constant.OchCommonConst
import com.mogo.och.common.module.biz.provider.LoginService
import com.mogo.och.common.module.utils.DateTimeUtil
import com.mogo.och.common.module.wigets.OCHCommitDialog
import kotlinx.android.synthetic.driverm1.bus_no_line_view.*
import kotlinx.android.synthetic.driverm1.fragment_driver_m1.*
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
@@ -21,8 +26,9 @@ import org.greenrobot.eventbus.ThreadMode
* @date: 2023/2/22
*/
class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presenter?>(),
SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
SlidePanelView.OnSlidePanelMoveToEndListener{
private var loginService: LoginService? = null
private var ochCommitDialog: OCHCommitDialog? = null
companion object{
val TAG: String = DriverM1Fragment::class.java.name
@@ -33,16 +39,42 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
loginService =
ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation() as LoginService
if (loginService != null) {
loginService?.registerFragment(
this,
presenter,
LoginDriverM1Impl()
)
loginService?.registerFragment(this, presenter, LoginDriverM1Impl())
}
}
override fun initViews() {
super.initViews()
}
fun showOrHideOrderUI(show:Boolean){
if (show){
group_stations_panel.visibility = View.VISIBLE
}else{
group_stations_panel.visibility = View.GONE
hideSlidePanel()
}
}
fun updateOrderUI(orderStatus: QueryCurrentOrderResponse.Result){
requireActivity().runOnUiThread {
driverm1_line_name.text = orderStatus.lineName
driverm1StationName1Tv.text = "" //todo 更新
driverm1StationName2Tv.text = orderStatus.siteName
passenger_phone.text = orderStatus.passengerPhone
during_time.text = String.format(resources.getString(R.string.during_time_tv),
DateTimeUtil.formatLongToString(orderStatus.startTime,DateTimeUtil.HH_mm)
+""+DateTimeUtil.formatLongToString(orderStatus.endTime,DateTimeUtil.HH_mm))
}
}
fun updateCountDown(minutes: Int) {
requireActivity().runOnUiThread {
driverm1_order_count_down.text = String.format(resources.getString(R.string.count_down_txt),
minutes)
}
}
override fun onDestroyView() {
@@ -59,8 +91,13 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
}
}
override fun getSlidePanelOnEndListener(): SlidePanelView.OnSlidePanelMoveToEndListener? {
return this
}
override fun moveToEnd() {
TODO("Not yet implemented")
//滑动还车
mPresenter?.driverEndLease()
}
override fun getStationPanelViewId(): Int {
@@ -68,11 +105,10 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
}
override fun restartAutopilot() {
TODO("Not yet implemented")
}
override fun debugAutoPilotStatus(status: Int) {
TODO("Not yet implemented")
//启动自驾
if (!isAnimateRunning) {
mPresenter?.restartAutopilot()
}
}
override fun getTagName(): String {
@@ -83,8 +119,45 @@ class DriverM1Fragment : CharterBaseFragment<DriverM1Fragment?, DriverM1Presente
return DriverM1Presenter(this)
}
override fun onClick(p0: View?) {
TODO("Not yet implemented")
override fun debugAutoPilotStatus(status: Int) {
}
/**
* 更换路线目的地确认dialog
*/
fun showCommitDialog(title: String,content: String) {
if (ochCommitDialog !== null){
if (ochCommitDialog?.isShowing == true){
ochCommitDialog?.dismiss()
}
ochCommitDialog = null
}
var builder = OCHCommitDialog.Builder()
ochCommitDialog = builder.title(title).tips(content)
.confirmStr(getString(R.string.bus_dialog_confirm))
.cancelStr(getString(R.string.bus_dialog_cancel))
.build(requireContext())
ochCommitDialog?.setClickListener(object : OCHCommitDialog.ClickListener {
override fun confirm() { //同意
mPresenter?.changeDest()
}
override fun cancel() { //取消
mPresenter?.sendCommitMsgToClient(false)
}
})
ochCommitDialog?.show()
}
fun updateReturnCarStatus(returnSuccess: Boolean) {
requireActivity().runOnUiThread {
if (returnSuccess){
group_stations_panel.visibility = View.GONE
no_line_data_view.visibility = View.VISIBLE
}else{
slidePanelView?.visibility = View.VISIBLE
}
}
}
}

View File

@@ -0,0 +1,71 @@
package com.magic.mogo.och.charter.model
import com.magic.mogo.och.charter.constant.CharterConst
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit
/**
* @author: wangmingjun
* @date: 2023/2/23
*/
object DriverM1LooperManager {
private val TAG: String = DriverM1LooperManager::class.java.name
private var mQueryLineDisposable: Disposable? = null //订单查询
private var mQueryCountDownDisposable: Disposable? = null //订单查询
fun startQueryDriverLineLoop() {
if (mQueryLineDisposable != null && !mQueryLineDisposable!!.isDisposed) {
return
}
CallerLogger.i(SceneConstant.M_BUS_P + TAG, "startQueryDriverLineLoop()")
mQueryLineDisposable = Observable.interval(
CharterConst.LOOP_DELAY,
CharterConst.LOOP_2S, TimeUnit.MILLISECONDS
)
.map { aLong: Long -> aLong + 1 }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
DriverM1Model.get().queryCurrentServiceStatus()
}
}
fun stopQueryDriverLineLoop() {
if (mQueryLineDisposable != null) {
CallerLogger.i(SceneConstant.M_BUS_P + TAG, "stopQueryDriverLineLoop()")
mQueryLineDisposable!!.dispose()
mQueryLineDisposable = null
}
}
fun starCountDownLoop() {
if (mQueryCountDownDisposable != null && !mQueryCountDownDisposable!!.isDisposed) {
return
}
CallerLogger.i(SceneConstant.M_BUS_P + TAG, "starCountDownLoop()")
mQueryCountDownDisposable = Observable.interval(
CharterConst.LOOP_DELAY,
CharterConst.LOOP_5M, TimeUnit.MINUTES
)
.map { aLong: Long -> aLong + 1 }
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe {
DriverM1Model.get().checkOrderCountDown()
}
}
fun stopCountDownLoop() {
if (mQueryCountDownDisposable != null) {
CallerLogger.i(SceneConstant.M_BUS_P + TAG, "stopCountDownLoop()")
mQueryCountDownDisposable!!.dispose()
mQueryCountDownDisposable = null
}
}
}

View File

@@ -1,35 +1,51 @@
package com.magic.mogo.och.charter.model
import android.content.Context
import android.net.ConnectivityManager
import android.os.Handler
import com.alibaba.android.arouter.launcher.ARouter
import com.alibaba.android.arouter.utils.TextUtils
import com.elegant.network.utils.GsonUtil
import com.magic.mogo.och.charter.bean.CheckOrderCountDownResponse
import com.magic.mogo.och.charter.bean.QueryBusinessStatusResponse
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse
import com.magic.mogo.och.charter.callback.ChangeDestCallback
import com.magic.mogo.och.charter.callback.DriverM1OrderCallback
import com.magic.mogo.och.charter.callback.IADASStatusCallback
import com.magic.mogo.och.charter.callback.IDriverM1ControllerStatusCallback
import com.magic.mogo.och.charter.net.DriverM1ServiceManager
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.module.status.IMogoStatusChangedListener
import com.mogo.commons.module.status.MogoStatusManager
import com.mogo.commons.module.status.StatusDescriptor
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.config.FunctionBuildConfig
import com.mogo.eagle.core.data.map.MogoLocation
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.data.telematic.TelematicConstant
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
import com.mogo.eagle.core.function.api.autopilot.IMoGoPlanningRottingListener
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIPCDemoMode
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.setIgnoreConditionDraw
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.startAutoPilot
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getAutoPilotStatusInfo
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.telematic.CallerTelematicListenerManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager.sendMsgToAllClients
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.eagle.core.utilcode.util.GsonUtils
import com.mogo.eagle.core.utilcode.util.NetworkUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.och.common.module.bean.dpmsg.*
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.pushAppOperationalMsgBox
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.releaseSocketMessageListener
import com.mogo.och.common.module.biz.common.socketmessage.data.*
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.provider.LoginService
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback
import com.mogo.och.common.module.manager.AbnormalFactorsLoopManager.startLoopAbnormalFactors
@@ -49,9 +65,6 @@ class DriverM1Model {
private var backgroundCurrentStationIndex = 0 //A->B 此处值是A站点索引
@Volatile
private var sInstance: DriverM1Model? = null
var mLongitude = 0.0
var mLatitude = 0.0
private var mContext: Context? = null
@@ -62,26 +75,38 @@ class DriverM1Model {
private var isGoingToNextStation = false
// 运营类型
private val VEHICLE_TYPE = 10
private val MSG_QUERY_BUS_STATION = 1001
private val MSG_QUERY_BUS_STATION: Int = 1001
private val QUERY_BUS_STATION_DELAY: Long = 5000
// private var slidePanelHideCallback: ISlidePannelHideCallback? = null
private var mControllerStatusCallback //Model->PresenterVR mode等
: IDriverM1ControllerStatusCallback? = null
private var mADASStatusCallback: IADASStatusCallback? = null
private var mOrderCallback: DriverM1OrderCallback? = null
@Volatile
private var isArrivedStation = false
private var mChangeDestCallback: ChangeDestCallback? = null
private var mCurrentOrder: QueryCurrentOrderResponse.Result? = null
private var currentChangeDestMsg: ChangeDestMsg? = null
//0: 代表没有启动过 1代表是启动第一次当>=1 代表是重试 每次到站/路线结束清空置为0
@Volatile
private var firstStartAutopilot = 0
private var loginService: LoginService? = null
companion object {
val TAG = DriverM1Model::class.java.simpleName
private var INSTANCE: DriverM1Model? = null
@Synchronized
fun get(): DriverM1Model{
if (INSTANCE == null) {
INSTANCE = DriverM1Model()
}
return INSTANCE!!
}
}
private val handler = Handler(Handler.Callback { msg ->
if (msg.what == MSG_QUERY_BUS_STATION) {
return@Callback true
@@ -89,64 +114,63 @@ class DriverM1Model {
false
})
companion object {
val TAG = DriverM1Model::class.java.simpleName
const val MSG_QUERY_BUS_P_STATION = 1001
val INSTANCE: DriverM1Model by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
DriverM1Model()
}
}
fun init() {
mContext = AbsMogoApplication.getApp()
loginService = ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation() as LoginService
// 定位监听
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, mMapLocationListener)
MogoStatusManager.getInstance().registerStatusChangedListener(
TAG,
StatusDescriptor.VR_MODE,
mMogoStatusChangedListener
)
//自动驾驶路线规划接口
CallerPlanningRottingListenerManager.addListener(TAG, moGoAutopilotPlanningListener)
//开启自驾后 异常信息返回
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(mAdasStartFailureListener)
// registerSocketMessageListener( //监听运营消息
// OCHSocketMessageManager.msgMonitorType,
// mMogoOnMessageListener
// )
// registerSocketMessageListener<WriteOffPassenger>( //监听核销乘客
// OCHSocketMessageManager.msgWriteOffPassengerType,
// mWriteOffPassengeOnMessageListener
// )
// 监听运营信息
OCHSocketMessageManager.registerSocketMessageListener(
OCHSocketMessageManager.msgMonitorType,
mMogoOnMessageListener)
//监听开门
OCHSocketMessageManager.registerSocketMessageListener(
OCHSocketMessageManager.msgOperateDoorType,
mMogoOnMessageListener)
//监听订单结束
OCHSocketMessageManager.registerSocketMessageListener(
OCHSocketMessageManager.msgOrderClosedType,
mMogoOnMessageListener)
//监听乘客屏发来的消息
CallerTelematicListenerManager.addListener(TAG,mReceivedMsgListener)
//定位,长连接等异常提示
startLoopAbnormalFactors(mContext!!)
//网络监听
IntentManager.getInstance().registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
loginService = ARouter.getInstance().build(OchCommonConst.LOGINSERVICE).navigation() as LoginService
//2022.1.28
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
// The exception could not be delivered to the consumer because it has already canceled/disposed
// the flow or the excTeption has nowhere to go to begin with
RxJavaPlugins.setErrorHandler(object : Consumer<Throwable?>{
RxJavaPlugins.setErrorHandler(object : Consumer<Throwable?> {
override fun accept(e: Throwable?) {
var e = e
if (e is UndeliverableException) {
e = e.cause!!
d(SceneConstant.M_BUS + TAG, "UndeliverableException")
d(SceneConstant.M_CHARTER_D + TAG, "UndeliverableException")
}
if (e is IOException) { //
// fine, irrelevant network problem or API that throws on cancellation
d(SceneConstant.M_BUS + TAG, "IOException")
d(SceneConstant.M_CHARTER_D + TAG, "IOException")
return
}
if (e is InterruptedException) {
// fine, some blocking code was interrupted by a dispose call
d(SceneConstant.M_BUS + TAG, "InterruptedException")
d(SceneConstant.M_CHARTER_D + TAG, "InterruptedException")
return
}
if (e is NullPointerException || e is IllegalArgumentException) {
// that's likely a bug in the application
d(SceneConstant.M_BUS + TAG, "NullPointerException or IllegalArgumentException")
d(SceneConstant.M_CHARTER_D + TAG, "NullPointerException or IllegalArgumentException")
Thread.currentThread().uncaughtExceptionHandler.uncaughtException(
Thread.currentThread(),
e
@@ -168,82 +192,102 @@ class DriverM1Model {
})
}
// private val mMogoOnMessageListener: IMogoOnMessageListener<OCHOperationalMessage> =
// object : IMogoOnMessageListener<OCHOperationalMessage?> {
// override fun target(): Class<OCHOperationalMessage> {
// return OCHOperationalMessage::class.java
// }
//
// fun onMsgReceived(obj: OCHOperationalMessage) {
// if (obj == null) {
// d(SceneConstant.M_BUS + TAG, "onMsgReceived = null")
// return
// }
// i(SceneConstant.M_BUS + TAG, "onMsgReceived = " + obj.message)
// pushAppOperationalMsgBox(
// obj.pushTimeStamp,
// obj.message
// )
// }
// }
/**
* 接收乘客屏发来确认信息
*/
private val mReceivedMsgListener: IReceivedMsgListener =
object : IReceivedMsgListener {
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
if (TelematicConstant.BUSINESS_STRING == type){
try {
val msg = GsonUtils.fromJson(String(byteArray),
BaseDPMsg::class.java) as BaseDPMsg
if (msg.type == DPMsgType.TYPE_CHANGE_DEST.type){
val changeDestMsg = GsonUtils.fromJson(String(byteArray),
ChangeDestMsg::class.java) as ChangeDestMsg
currentChangeDestMsg = changeDestMsg
showChangerDestCommitDialog(changeDestMsg)
}
d(SceneConstant.M_CHARTER_D,"onReceivedMsg = "+ GsonUtils.toJson(msg))
}catch (e: Exception){
d(SceneConstant.M_CHARTER_D,"onReceivedMsg = "+"消息解析错误")
}
// private val mWriteOffPassengeOnMessageListener: IMogoOnMessageListener<WriteOffPassenger> =
// object : IMogoOnMessageListener<WriteOffPassenger?> {
// override fun target(): Class<WriteOffPassenger> {
// return WriteOffPassenger::class.java
// }
//
// override fun onMsgReceived(passenger: WriteOffPassenger) {
// //进行播报
// i(SceneConstant.M_BUS + TAG, "passenger = " + GsonUtil.jsonFromObject(passenger))
// if (passenger != null && passenger.passengerSize == 0) return
// if (mPassengerCallback != null) {
// mPassengerCallback.playPassenger(passenger)
// }
// }
// }
}
}
}
private fun showChangerDestCommitDialog(changeDestMsg: ChangeDestMsg) {
if (changeDestMsg.destSiteName !== ""){
UiThreadHandler.post{
mChangeDestCallback?.showCommitDialog("确认站点",
"请确认是否前往"+ changeDestMsg.destSiteName + "站点")
}
}else if (changeDestMsg.lineName !== ""){
UiThreadHandler.post{
mChangeDestCallback?.showCommitDialog("确认路线",
"请确认是否切换"+ changeDestMsg.lineName + "路线")
}
}
}
private val mMogoOnMessageListener =
object : IMogoOnMessageListener<DataBaseMsg> {
override fun onMsgReceived(obj: DataBaseMsg) {
if (obj == null) {
d(SceneConstant.M_CHARTER_D + TAG, "onMsgReceived = null")
return
}
d(SceneConstant.M_CHARTER_D + TAG, "onMsgReceived = " + obj.msgType)
when(obj.msgType){
OCHSocketMessageManager.msgMonitorType ->{
val msg = obj as SystemMsg
pushAppOperationalMsgBox(obj.pushTimeStamp, msg.context)
val list = msg.screenList
if (list.size > 1){ //发送乘客屏
}
}
OCHSocketMessageManager.msgOperateDoorType ->{
val msg = obj as OperateDoorMsg
// pushAppOperationalMsgBox(obj.pushTimeStamp, msg.)
sendMsgToClient(DPOperateDoorMsg(true))
}
OCHSocketMessageManager.msgOrderClosedType ->{
val msg = obj as OrderCloseMsg
pushAppOperationalMsgBox(obj.pushTimeStamp, msg.message)
sendMsgToClient(DPOrderClosedMsg())
}
}
}
override fun target(): Class<DataBaseMsg> {
return DataBaseMsg::class.java
}
}
fun setAdasStatusCallback(callback: IADASStatusCallback?) {
mADASStatusCallback = callback
}
// fun setSlidePanelHideCallback(callback: ISlidePannelHideCallback?) {
// slidePanelHideCallback = callback
// }
fun setChangeDestCallback(callback: ChangeDestCallback?){
mChangeDestCallback = callback
}
fun setDriverM1OrderCallback(callback: DriverM1OrderCallback?) {
mOrderCallback = callback
}
fun setControllerStatusCallback(callback: IDriverM1ControllerStatusCallback?) {
mControllerStatusCallback = callback
}
private val moGoAutopilotPlanningListener: IMoGoPlanningRottingListener =
object : IMoGoPlanningRottingListener {
override fun onAutopilotRotting(routeList: GlobalPathResp?) {
if (null != routeList && routeList.getWayPointsList().size() > 0) {
// points.clear()
// points.addAll(
// coordinateConverterWgsToGcjList(
// mContext,
// routeList.getWayPointsList()
// )!!
// )
// updateOrderRoute()
}
}
}
fun release() {
// startOrStopOrderLoop(false)
MogoStatusManager.getInstance().unregisterStatusChangedListener(
TAG,
StatusDescriptor.VR_MODE,
mMogoStatusChangedListener
)
// 注销定位监听
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
//自动驾驶路线规划接口
CallerPlanningRottingListenerManager.removeListener(moGoAutopilotPlanningListener)
loginService = null
OCHAdasAbilityManager.getInstance().setAdasStartFailureCallback(null)
releaseSocketMessageListener(
@@ -255,20 +299,6 @@ class DriverM1Model {
stopLoopAbnormalFactors()
}
private fun readResolve(): Any? {
// 阻止反序列化,必须实现 Serializable 接口
return sInstance
}
private val mMogoStatusChangedListener: IMogoStatusChangedListener =
IMogoStatusChangedListener { descriptor, isTrue ->
// VR mode变更回调
if (StatusDescriptor.VR_MODE == descriptor) {
mControllerStatusCallback?.onVRModeChanged(isTrue)
}
}
private val mAdasStartFailureListener: OchAdasStartFailureCallback =
object : OchAdasStartFailureCallback {
override fun onStartAutopilotFailure(
@@ -282,11 +312,22 @@ class DriverM1Model {
// SceneConstant.M_BUS + TAG,
// "mAdasStartFailureListener = $startFailedMessage"
// )
// mADASStatusCallback.onStartAdasFailure()
// mADASStatusCallback?.onStartAdasFailure()
// }
}
}
//监听网络变化,避免启动机器时无网导致无法更新订单信息
private val mNetWorkIntentListener =
IMogoIntentListener { intentStr, _ ->
d(SceneConstant.M_TAXI + TAG, "onIntentReceived = %s", intentStr)
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
if (NetworkUtils.isConnected(mContext)) {
loginService!!.queryLoginStatusByNet()
}
}
}
// 自车定位
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
object : IMoGoChassisLocationGCJ02Listener {
@@ -294,14 +335,14 @@ class DriverM1Model {
if (null == gnssInfo) return
mLongitude = gnssInfo.longitude
mLatitude = gnssInfo.latitude
// if (mControllerStatusCallback != null) {
// mControllerStatusCallback.onCarLocationChanged(gnssInfo)
// }
if (mControllerStatusCallback != null) {
mControllerStatusCallback?.onCarLocationChanged(gnssInfo)
}
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
if (isGoingToNextStation && !isArrivedStation) {
judgeArrivedStation(gnssInfo)
}
// if (isGoingToNextStation && !isArrivedStation) {
// judgeArrivedStation(gnssInfo)
// }
}
}
@@ -328,24 +369,12 @@ class DriverM1Model {
// }
}
private fun onStartAutopilot(leaveIndex: Int) {
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
isGoingToNextStation = true
if (getAutoPilotStatusInfo().state
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
) {
startAutopilot(false, leaveIndex)
} else {
firstStartAutopilot = 0
}
}
/**
* 开启自动驾驶
*
* @param isRestart
*/
private fun startAutopilot(isRestart: Boolean, leaveIndex: Int) {
private fun startAutopilot() {
if (!FunctionBuildConfig.isDemoMode && !OCHAdasAbilityManager.getInstance().autopilotAbilityStatus) {
ToastUtils.showLong(
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason +
@@ -354,99 +383,67 @@ class DriverM1Model {
triggerUnableStartAPReasonEvent()
return
}
firstStartAutopilot++
triggerStartServiceEvent(isRestart, false)
val parameters = initAutopilotControlParameters(leaveIndex)
triggerStartServiceEvent(true, false)
val parameters = initAutopilotControlParameters()
if (null == parameters) {
e(SceneConstant.M_BUS + TAG, "行程日志-AutopilotControlParameters is empty.")
d(SceneConstant.M_BUS + TAG, "行程日志-AutopilotControlParameters is empty.")
return
}
startAutoPilot(parameters)
d(
SceneConstant.M_BUS + TAG, "行程日志-开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
+ " startLatLon=" + parameters.startName + "endLatLon=" + parameters.endName +
"isRestart = " + isRestart
+ " startLatLon=" + parameters.startName + "endLatLon=" + parameters.endName
)
if (mControllerStatusCallback != null) {
mControllerStatusCallback?.startOpenAutopilot()
}
}
//车站10s后播报
// private fun leaveTTSTips(nextStation: String) {
// showNotice(
// String.format(
// mContext
// .getString(R.string.bus_leave_station_tip),
// nextStation
// ), CharterConst.Companion.DELAY_10S
// )
// }
/**
* 关闭美化模式
*/
fun closeBeautificationMode() {
if (FunctionBuildConfig.isDemoMode) { //收车结束美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData =
false //是否强制绘制引导线
setIgnoreConditionDraw(false) // 同步给乘客屏
setIPCDemoMode(false) //是否自动启动自驾
d(SceneConstant.M_BUS + TAG, "美化模式-ignore置为false")
}
/**
* 关闭美化模式
*/
fun closeBeautificationMode() {
if (FunctionBuildConfig.isDemoMode) { //收车结束美化
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData =
false //是否强制绘制引导线
setIgnoreConditionDraw(false) // 同步给乘客屏
setIPCDemoMode(false) //是否自动启动自驾
d(SceneConstant.M_BUS + TAG, "美化模式-ignore置为false")
}
}
fun clearStartAutopilotTag() {
firstStartAutopilot = 0
}
fun startBeautificationMode() {
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
setIgnoreConditionDraw(true)
setIPCDemoMode(true)
}
fun startBeautificationMode() {
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
setIgnoreConditionDraw(true)
setIPCDemoMode(true)
}
/**
* 延时查询站点信心
*/
fun queryBusStationDelay() {
handler.sendEmptyMessageDelayed(MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY)
}
/**
* 延时查询站点信心
*/
fun queryBusStationDelay() {
handler.sendEmptyMessageDelayed(MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY)
}
/**
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
*/
fun restartAutopilot() {
d(SceneConstant.M_BUS + TAG, "行程日志-重启自动驾驶===$isGoingToNextStation")
//只去启动自动驾驶,不再去上报离站
startAutopilot(firstStartAutopilot >= 1, -1)
}
/**
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
*/
fun restartAutopilot() {
d(SceneConstant.M_BUS + TAG, "司机端-启动自动驾驶===$isGoingToNextStation")
//只去启动自动驾驶
startAutopilot()
}
fun isRestartAutopilot(): Boolean {
return firstStartAutopilot > 1
}
fun isGoingToNextStation(): Boolean {
return isGoingToNextStation
}
fun isGoingToNextStation(): Boolean {
return isGoingToNextStation
}
fun sendWriteOffNumToClient(msg: String?) {}
// fun startOrStopOrderLoop(start: Boolean) {
// d(SceneConstant.M_BUS + TAG, "startOrStopOrderLoop() $start")
// if (start) {
// BusModelLoopManager.getInstance().startHeartbeatLoop()
// } else {
// BusModelLoopManager.getInstance().stopHeartbeatLoop()
// }
// }
// 登出
fun logout() {
loginService!!.loginOut(mLatitude, mLongitude)
}
// 登出
fun logout() {
loginService!!.loginOut(mLatitude, mLongitude)
}
fun triggerStartServiceEvent(isRestart: Boolean, send: Boolean) {
// if (stationList == null || backgroundCurrentStationIndex >= stationList.size - 1) {
@@ -460,7 +457,7 @@ class DriverM1Model {
// )
}
fun triggerUnableStartAPReasonEvent() {
fun triggerUnableStartAPReasonEvent() {
// if (stationList == null || backgroundCurrentStationIndex >= stationList.size - 1) {
// return
// }
@@ -470,32 +467,32 @@ class DriverM1Model {
// currentStation.getName(), nextStation.getName(), currentLineId,
// OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
// )
}
}
fun getCurrentStationIndex(): Int {
return backgroundCurrentStationIndex
}
fun getCurrentStationIndex(): Int {
return backgroundCurrentStationIndex
}
/**
* 将业务订单信息保存,鹰眼可取用
*/
fun updateAutopilotControlParameters() {
// TODO: 业务信息保存
val parameters = initAutopilotControlParameters(-1)
if (null == parameters) {
e(SceneConstant.M_BUS + TAG, "AutopilotControlParameters is empty.")
return
}
d(SceneConstant.M_BUS + TAG, "AutopilotControlParameters is update.")
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
/**
* 将业务订单信息保存,鹰眼可取用
*/
fun updateAutopilotControlParameters() {
// TODO: 业务信息保存
val parameters = initAutopilotControlParameters()
if (null == parameters) {
d(SceneConstant.M_CHARTER_D + TAG, "AutopilotControlParameters is empty.")
return
}
d(SceneConstant.M_CHARTER_D + TAG, "AutopilotControlParameters is update.")
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
}
fun clearAutopilotControlParameters() {
d(SceneConstant.M_BUS + TAG, "AutopilotControlParameters is clear.")
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
}
fun clearAutopilotControlParameters() {
d(SceneConstant.M_CHARTER_D + TAG, "AutopilotControlParameters is clear.")
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
}
fun initAutopilotControlParameters(leaveIndex: Int): AutopilotControlParameters? {
fun initAutopilotControlParameters(): AutopilotControlParameters? {
// var currentStation: BusStationBean? = null
// var nextStation: BusStationBean? = null
// if (leaveIndex < 0) {
@@ -513,7 +510,7 @@ class DriverM1Model {
// currentStation = stationList[leaveIndex]
// nextStation = stationList[leaveIndex + 1]
// }
var parameters = AutopilotControlParameters()
var parameters = AutopilotControlParameters()
// parameters.routeID = busRoutesResult.getLineId()
// parameters.routeName = busRoutesResult.getName()
// parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.getName())
@@ -532,6 +529,134 @@ class DriverM1Model {
// busRoutesResult.contrailSaveTimeDPQP
// )
// }
return parameters
return parameters
}
fun startQueryCurrentOrder(){
DriverM1LooperManager.startQueryDriverLineLoop()
}
fun stopQueryCurrentOrder(){
DriverM1LooperManager.stopQueryDriverLineLoop()
}
/**
* 司机端发送消息给乘客屏
*/
fun sendCommitMsgToClient(isConfirmed: Boolean) {
if (currentChangeDestMsg !== null) {
currentChangeDestMsg?.isConfirmed = isConfirmed
sendMsgToClient(currentChangeDestMsg)
}
}
private fun sendMsgToClient(msg: BaseDPMsg?){
sendMsgToAllClients(
TelematicConstant.BUSINESS_STRING,
GsonUtils.toJson(msg).toByteArray()
)
}
fun driverEndLease() {
DriverM1ServiceManager.driverEndLease(mContext,object : OchCommonServiceCallback<BaseData>{
override fun onSuccess(data: BaseData?) {
if (data != null && data.code == 0){
mOrderCallback?.updateReturnCarStatus(true)
}
}
override fun onFail(code: Int, msg: String?) {
ToastUtilsOch.toastRequestError(mContext,msg)
}
})
}
fun queryCurrentServiceStatus() {
DriverM1ServiceManager.queryCurrentServiceStatus(mContext
,object: OchCommonServiceCallback<QueryBusinessStatusResponse>{
override fun onSuccess(data: QueryBusinessStatusResponse?) {
if (data == null || data.code != 0){
return
}
if (data.data.businessStatus == 2){
if (TextUtils.isEmpty(data.data.orderNo)){//还未换车,显示还车状态
mOrderCallback?.updateReturnCarStatus(false)
startOrStopCheckCountDown(false)
}else{ // 去查询订单
mOrderCallback?.updateReturnCarStatus(true)
queryCurrentOrder()
}
}else{
startOrStopCheckCountDown(false)
}
}
override fun onFail(code: Int, msg: String?) {
ToastUtilsOch.toastRequestError(mContext,msg)
}
})
}
fun queryCurrentOrder(){
DriverM1ServiceManager.queryCurrentOrder(mContext
,object: OchCommonServiceCallback<QueryCurrentOrderResponse>{
override fun onSuccess(data: QueryCurrentOrderResponse?) {
if (data == null || data.code == 0 || mCurrentOrder === data.data) return
mCurrentOrder = data.data
mOrderCallback?.updateOrderUI(data.data)
// 倒计时校验开始
startOrStopCheckCountDown(true)
}
override fun onFail(code: Int, msg: String?) {
TODO("Not yet implemented")
}
})
}
private fun startOrStopCheckCountDown(start: Boolean) {
if (start){
DriverM1LooperManager.starCountDownLoop()
}else{
DriverM1LooperManager.stopCountDownLoop()
}
}
fun checkOrderCountDown() {
DriverM1ServiceManager.checkOrderCountDown(mContext,
object: OchCommonServiceCallback<CheckOrderCountDownResponse>{
override fun onSuccess(data: CheckOrderCountDownResponse?) {
if (data?.data == null || data.code != 0){
return
}
val gap = data.data.endTime - data.data.currentTime
if (gap >= 0){
mOrderCallback?.updateOverCountDown((gap/1000/60).toInt())
}
}
override fun onFail(code: Int, msg: String?) {
TODO("Not yet implemented")
}
})
}
fun changeDest(){
if (currentChangeDestMsg == null) return
DriverM1ServiceManager.changeDest(mContext,currentChangeDestMsg!!.lineId,
currentChangeDestMsg!!.destSiteId,
object : OchCommonServiceCallback<BaseData>{
override fun onSuccess(data: BaseData?) {
if (data != null && data.code == 0){
sendCommitMsgToClient(true)
}
}
override fun onFail(code: Int, msg: String?) {
TODO("Not yet implemented")
}
})
}
}

View File

@@ -0,0 +1,81 @@
package com.magic.mogo.och.charter.net
import android.content.Context
import com.magic.mogo.och.charter.bean.CheckOrderCountDownResponse
import com.magic.mogo.och.charter.bean.QueryBusinessStatusResponse
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse
import com.magic.mogo.och.charter.bean.RequestChangeDest
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
import com.mogo.och.common.module.biz.constant.OchCommonConst
import com.mogo.eagle.core.data.BaseData
import com.mogo.eagle.core.network.MoGoRetrofitFactory
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
/**
* Created by pangfan on 2021/8/19
*/
object DriverM1ServiceManager {
private val mDriverM1ServiceApi: IDriverM1Service =
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
IDriverM1Service::class.java
)
/**
* 司机还车
* @param context
* @param callback
*/
@JvmStatic
fun driverEndLease(
context: Context?,
callback: OchCommonServiceCallback<BaseData>?
) {
mDriverM1ServiceApi.driverEndLease(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
MoGoAiCloudClientConfig.getInstance().sn
)?.transformTry()
?.subscribe(OchCommonSubscribeImpl(context!!, callback, "driverEndLease"))
}
fun queryCurrentServiceStatus(context: Context?,
callback: OchCommonServiceCallback<QueryBusinessStatusResponse>?){
mDriverM1ServiceApi.queryBusinessStatus(
MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
MoGoAiCloudClientConfig.getInstance().sn
)?.transformTry()
?.subscribe(OchCommonSubscribeImpl(context!!, callback, "queryCurrentServiceStatus"))
}
fun queryCurrentOrder(context: Context?,
callback: OchCommonServiceCallback<QueryCurrentOrderResponse>?){
mDriverM1ServiceApi.queryCurrentOrder(MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
MoGoAiCloudClientConfig.getInstance().sn
)?.transformTry()
?.subscribe(OchCommonSubscribeImpl(context!!, callback, "queryCurrentOrder"))
}
fun checkOrderCountDown(context: Context?,
callback: OchCommonServiceCallback<CheckOrderCountDownResponse>?){
mDriverM1ServiceApi.checkOrderCountDown(MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
MoGoAiCloudClientConfig.getInstance().sn
)?.transformTry()
?.subscribe(OchCommonSubscribeImpl(context!!, callback, "checkOrderCountDown"))
}
fun changeDest(context: Context?,lineId: Int,siteId: Int,
callback: OchCommonServiceCallback<BaseData>?){
mDriverM1ServiceApi.changeDest(MoGoAiCloudClientConfig.getInstance().serviceAppId,
MoGoAiCloudClientConfig.getInstance().token,
RequestChangeDest(MoGoAiCloudClientConfig.getInstance().sn,lineId,siteId)
)?.transformTry()
?.subscribe(OchCommonSubscribeImpl(context!!, callback, "changeDest"))
}
}

View File

@@ -1,10 +1,55 @@
package com.magic.mogo.och.charter.net
import com.magic.mogo.och.charter.bean.CheckOrderCountDownResponse
import com.magic.mogo.och.charter.bean.QueryBusinessStatusResponse
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse
import com.magic.mogo.och.charter.bean.RequestChangeDest
import com.mogo.eagle.core.data.BaseData
import io.reactivex.Observable
import retrofit2.http.*
/**
* @author: wangmingjun
* @date: 2023/2/22
*/
interface IDriverM1Service {
/**
* 司机还车
* @param sn
* @return
*/
@Headers("Content-type:application/json;charset=UTF-8")
@GET("/och-rental-cabin/api/flow/v1/driver/endLease")
fun driverEndLease(@Header("appId") appId: String?, @Header("ticket") ticket: String?,
@Query("sn") sn: String?): Observable<BaseData>?
/**
* 查询当前订单信息
*/
@Headers("Content-type:application/json;charset=UTF-8")
@GET("/och-rental-cabin/api/business/v1/driver/order")
fun queryCurrentOrder(@Header("appId") appId: String?, @Header("ticket") ticket: String?,
@Query("sn") sn: String?): Observable<QueryCurrentOrderResponse>?
/**
* 查询车辆服务状态
*/
@Headers("Content-type:application/json;charset=UTF-8")
@GET("/och-rental-cabin/api/business/v1/driver/businessStatus")
fun queryBusinessStatus(@Header("appId") appId: String?, @Header("ticket") ticket: String?,
@Query("sn") sn: String?): Observable<QueryBusinessStatusResponse>?
/**
* 确认更换目的地成功
*/
@Headers("Content-Type:application/json;charset=UTF-8")
@POST("/och-rental-cabin/api/flow/v1/driver/changeDest")
fun changeDest(@Header("appId") appId: String?, @Header("ticket") ticket: String?
,@Body request: RequestChangeDest): Observable<BaseData>?
@Headers("Content-type:application/json;charset=UTF-8")
@GET("/och-rental-cabin/api/business/v1/driver/queryBusinessTime")
fun checkOrderCountDown(@Header("appId") appId: String?, @Header("ticket") ticket: String?,
@Query("sn") sn: String?): Observable<CheckOrderCountDownResponse>?
}

View File

@@ -1,8 +1,16 @@
package com.magic.mogo.och.charter.presenter
import androidx.lifecycle.LifecycleOwner
import com.magic.mogo.och.charter.bean.QueryCurrentOrderResponse
import com.magic.mogo.och.charter.callback.ChangeDestCallback
import com.magic.mogo.och.charter.callback.DriverM1OrderCallback
import com.magic.mogo.och.charter.fragment.DriverM1Fragment
import com.magic.mogo.och.charter.model.DriverM1Model
import com.mogo.commons.mvp.Presenter
import com.mogo.eagle.core.data.autopilot.AutopilotStatusInfo
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
import com.mogo.och.common.module.biz.bean.DriverStatusQueryRespBean
@@ -14,25 +22,113 @@ import com.mogo.och.common.module.biz.constant.LoginStatusManager.isLogin
* @date: 2023/2/22
*/
class DriverM1Presenter(view: DriverM1Fragment?) :
Presenter<DriverM1Fragment?>(view),ILoginCallback{
Presenter<DriverM1Fragment?>(view),ILoginCallback, DriverM1OrderCallback, ChangeDestCallback,
IMoGoAutopilotStatusListener {
private val TAG = DriverM1Presenter::class.java.name
private var mCurrentAutopilotStatus : Int = -1
init {
DriverM1Model.get().init()
registerListener()
}
private fun registerListener() {
//2021.11.1 鹰眼架构整合由IMoGoAutopilotStatusListener逐步替代IMogoAdasOCHCallback接口
CallerAutoPilotStatusListenerManager.addListener(TAG, this)
DriverM1Model.get().setDriverM1OrderCallback(this)
DriverM1Model.get().setChangeDestCallback(this)
}
private fun releaseListener() {
DriverM1Model.get().setDriverM1OrderCallback(null)
DriverM1Model.get().setChangeDestCallback(null)
}
override fun onDestroy(owner: LifecycleOwner) {
super.onDestroy(owner)
releaseListener()
DriverM1Model.get().release()
}
override fun loginSuccess(data: DriverStatusQueryRespBean?) {
d(SceneConstant.M_BUS + TAG, " loginStatus =" + isLogin())
if (isLogin()) {
// todo 已经登陆
// 查询服务状态
DriverM1Model.get().queryCurrentServiceStatus()
} else {
// todo 未登陆
DriverM1Model.get().stopQueryCurrentOrder()
}
}
override fun loginFail(isLogin: Boolean) {
//todo 登陆失败
DriverM1Model.get().stopQueryCurrentOrder()
}
// 登出
fun logout() {
DriverM1Model.INSTANCE.logout()
DriverM1Model.get().logout()
}
fun restartAutopilot() {
// todo 启动自驾必须有订单路线
if (DriverM1Model.get().isGoingToNextStation()) {
DriverM1Model.get().restartAutopilot()
}
}
fun driverEndLease() {
DriverM1Model.get().driverEndLease()
}
override fun updateOrderUI(orderStatus: QueryCurrentOrderResponse.Result) {
mView?.updateOrderUI(orderStatus)
}
override fun updateOverCountDown(minutes: Int) {
mView?.updateCountDown(minutes)
}
override fun updateReturnCarStatus(returnSuccess: Boolean) {
mView?.updateReturnCarStatus(returnSuccess)
}
override fun showCommitDialog(title: String,content: String) {
mView?.showCommitDialog(title,content)
}
fun sendCommitMsgToClient(isAffirm: Boolean){
DriverM1Model.get().sendCommitMsgToClient(isAffirm)
}
fun changeDest(){
DriverM1Model.get().changeDest()
}
override fun onAutopilotStatusResponse(autoPilotStatusInfo: AutopilotStatusInfo) {
val status = autoPilotStatusInfo.state
if (mCurrentAutopilotStatus == status) return
if (FunctionBuildConfig.isDemoMode){ //todo 此处要加上判断订单状态 美化模式生效
mView?.onAutopilotStatusChanged(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)
}else{
mView?.onAutopilotStatusChanged(status)
}
// when(status){
//
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> { //
//
// }
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ->{
//
// }
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE ->{
//
// }
// IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING ->{
//
// }
// }
}
}

View File

@@ -1,4 +1,4 @@
package com.charter.driverm1.view
package com.magic.mogo.och.charter.view
import android.animation.ObjectAnimator
import android.animation.ValueAnimator
@@ -8,6 +8,7 @@ import android.util.AttributeSet
import android.view.MotionEvent
import android.view.View
import android.view.animation.DecelerateInterpolator
import com.magic.mogo.och.charter.R
import com.mogo.commons.AbsMogoApplication
import me.jessyan.autosize.AutoSizeConfig
import me.jessyan.autosize.utils.AutoSizeUtils
@@ -62,7 +63,7 @@ class SlidePanelView @JvmOverloads constructor(
}
private fun init() {
bgRectF = RectF(0, 0, 0, 0)
bgRectF = RectF(0F, 0F, 0F, 0F)
bgPaint.color = Color.parseColor("#CC0F1325")
bgPaint.style = Paint.Style.FILL
textPaint.style = Paint.Style.FILL
@@ -70,22 +71,23 @@ class SlidePanelView @JvmOverloads constructor(
textPaint.textAlign = Paint.Align.LEFT
textGradient = LinearGradient(
-GRADIENT_OFFSET,
0,
0,
0,
0f,
0f,
0f,
intArrayOf(0x33ffffff, -0x1, 0x33ffffff),
null,
Shader.TileMode.CLAMP
)
textGradient!!.setLocalMatrix(gradientMatrix)
textPaint.shader = textGradient
textPaint.getFontMetrics(blockTextMetrics)
val size = AutoSizeUtils.dp2px(context, 120f)
val opts = BitmapFactory.Options()
opts.inDensity = AutoSizeConfig.getInstance().initDensity.toInt()
bmBlock = BitmapFactory.decodeResource(resources, R.drawable.bus_base_slide_block, opts)
bmBlock = Bitmap.createScaledBitmap(bmBlock, size, size, true)
blockWidth = bmBlock.getWidth()
bmBlock = BitmapFactory.decodeResource(resources, R.drawable.bus_base_slide_block, opts) as Bitmap
bmBlock = Bitmap.createScaledBitmap(bmBlock!!, size, size, true) as Bitmap
blockWidth = bmBlock!!.width
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
@@ -233,7 +235,7 @@ class SlidePanelView @JvmOverloads constructor(
private var SHORT_TEXT_MARGIN_LEFT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(), 60f)
private var SHORT_TEXT_MARGIN_RIGHT = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(), 70f)
private const val STRING_SLIDE_TO_RIGHT = "向右滑动"
private const val GRADIENT_OFFSET = 200
private const val GRADIENT_OFFSET = 200f
}
init {

View File

@@ -5,7 +5,9 @@
android:id="@+id/module_och_bus_order_status_stationInfo"
android:layout_width="@dimen/module_mogo_och_autopilot_order_bg_width"
android:layout_height="wrap_content"
android:minHeight="@dimen/dp_754"
android:background="@drawable/bus_line_panel_bg"
android:paddingBottom="@dimen/dp_90"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
@@ -138,6 +140,7 @@
app:layout_constraintRight_toLeftOf="@+id/driverm1StationName2Tv"
app:layout_constraintTop_toTopOf="@+id/driverm1StationName2Tv"
app:layout_constraintBottom_toBottomOf="@+id/driverm1StationName2Tv"/>
<ImageView
android:id="@+id/driverm1ArrowBg"
android:layout_width="@dimen/dp_4"
@@ -154,9 +157,41 @@
<include layout="@layout/bus_no_line_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_100"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"/>
<View
android:id="@+id/line3"
android:layout_width="0dp"
android:layout_height="@dimen/dp_1"
android:layout_marginTop="@dimen/dp_40"
android:background="#FFFFFF"
app:layout_constraintTop_toBottomOf="@+id/driverm1StationName2Tv"
app:layout_constraintLeft_toLeftOf="@+id/driverm1nextCircleIv"
app:layout_constraintRight_toRightOf="@+id/driverm1_order_count_down"/>
<TextView
android:id="@+id/during_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_40"
android:textSize="@dimen/dp_30"
android:textColor="@color/station_title_color"
android:text="@string/during_time_tv"
app:layout_constraintLeft_toLeftOf="@+id/line3"
app:layout_constraintTop_toBottomOf="@+id/line3"/>
<TextView
android:id="@+id/passenger_phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_10"
android:textSize="@dimen/dp_30"
android:text="@string/passenger_phone"
android:textColor="@color/station_title_color"
app:layout_constraintLeft_toLeftOf="@+id/line3"
app:layout_constraintTop_toBottomOf="@+id/during_time"/>
<androidx.constraintlayout.widget.Group
android:id="@+id/group_stations_panel"
android:layout_width="wrap_content"
@@ -164,6 +199,8 @@
android:visibility="gone"
app:constraint_referenced_ids="driverm1_line_name,driverm1_order_count_down
,cur_station_title,cur_station_title1,line1,line2,driverm1StationName1Tv,
driverm1StationName2Tv,driverm1nextCircleIv,driverm1CircleIvBg,driverm1ArrowBg"/>
driverm1StationName2Tv,driverm1nextCircleIv,driverm1CircleIvBg,driverm1ArrowBg
,line3,during_time,passenger_phone"/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="SlidePanelView">
<attr name="textSize" format="dimension" />
<attr name="NORMAL_TEXT_MARGIN_LEFT" format="dimension" />
<attr name="NORMAL_TEXT_MARGIN_RIGHT" format="dimension" />
<attr name="SHORT_TEXT_MARGIN_LEFT" format="dimension" />
<attr name="SHORT_TEXT_MARGIN_RIGHT" format="dimension" />
<attr name="BLOCK_START_X" format="dimension" />
<attr name="BLOCK_START_Y" format="dimension" />
</declare-styleable>
</resources>

View File

@@ -1,4 +1,7 @@
<resources>
<string name="count_down_txt">剩余分钟</string>
<string name="count_down_txt">剩余%1$s分钟</string>
<string name="during_time_tv">包车时间:%1$s</string>
<string name="passenger_phone">乘客信息:%1$s</string>
</resources>

View File

@@ -5,14 +5,13 @@ import androidx.fragment.app.FragmentActivity;
import com.mogo.eagle.core.function.api.base.IMoGoFunctionProvider;
public
/**
* @author congtaowang
* @since 2021/1/15
*
* 网约车抽象接口
*/
interface ICharterOCH extends IMoGoFunctionProvider {
public interface ICharterOCH extends IMoGoFunctionProvider {
/**
* 初始化网约车容器

View File

@@ -11,6 +11,7 @@ import android.widget.*
import androidx.constraintlayout.widget.Group
import com.magic.mogo.och.charter.R
import com.magic.mogo.och.charter.constant.CharterConst
import com.magic.mogo.och.charter.view.SlidePanelView
import com.mogo.commons.mvp.IView
import com.mogo.commons.mvp.MvpFragment
import com.mogo.commons.mvp.Presenter
@@ -63,9 +64,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
private var mapBizView: MapBizView? = null
private var groupTestPanel: Group? = null
private var mTrafficDataView: TrafficDataView? = null
// private BusTrafficLightView mTrafficLightView;
// private BusTrafficLightView mTrafficLightView;
protected var slidePanelView: SlidePanelView? = null
//远景和中景的切换
private var mSwitchMapModeImage: ImageView? = null
private var mSwitchMapModeLayout: LinearLayout? = null
@@ -93,6 +92,9 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
ctvAutopilotStatusTv = findViewById(R.id.bus_autopolot_btn_tv)
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container)
slidePanelView = findViewById(R.id.charter_slide_panel)
slidePanelView?.setOnSlidePanelMoveToEndListener(onSlideToEndListener)
mTrafficDataView = findViewById<View>(R.id.bus_arc) as TrafficDataView?
LayoutInflater.from(context).inflate(getStationPanelViewId(), flStationPanelContainer)
mSwitchMapModeLayout = findViewById(R.id.bus_switch_model_layout)
@@ -155,8 +157,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
)
}
// 模拟 自动驾驶网约车回调数据
findViewById<View>(R.id.btnAutopilotRoute)!!.setOnClickListener { view: View? -> debugArrivedRoute() }
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout)
mSettingBtn!!.setOnClickListener { v: View? ->
// TODO: 2021/12/9
@@ -212,6 +212,38 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
return super.onCreateView(inflater, container, savedInstanceState)
}
private val onSlideToEndListener = object : SlidePanelView.OnSlidePanelMoveToEndListener{
override fun moveToEnd() {
// 此处做一个代理,处理一下共有情况
if (getSlidePanelOnEndListener() != null) {
getSlidePanelOnEndListener()?.moveToEnd()
}
}
}
open fun getSlidePanelOnEndListener(): SlidePanelView.OnSlidePanelMoveToEndListener? {
return null
}
/**
* 展示滑动按钮
*
* @param text 指定的文字
*/
fun showSlidePanel(text: String?) {
requireActivity().runOnUiThread {
slidePanelView?.setText(text!!)
slidePanelView?.visibility = View.VISIBLE
}
}
/**
* 隐藏滑动按钮
*/
fun hideSlidePanel() {
requireActivity().runOnUiThread { slidePanelView?.visibility = View.GONE }
}
private fun updateSwitchMapIcon() {
val controller = getMapUIController()
if (controller != null) {
@@ -225,10 +257,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
}
}
private fun debugArrivedRoute() {
// BDRouteDataTestUtils.converToRouteData()
}
override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
mapBizView!!.onSaveInstanceState(outState)
@@ -257,7 +285,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
}
open fun playDI() {
fun playDI() {
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
}
@@ -266,8 +294,8 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
*
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
*/
open fun onAutopilotStatusChanged(autopilotStatus: Int) {
activity?.runOnUiThread {
fun onAutopilotStatusChanged(autopilotStatus: Int) {
requireActivity().runOnUiThread {
changeAutopilotBtnView(
autopilotStatus,
isAnimateRunning
@@ -275,7 +303,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
}
}
open fun setAutopilotBtnStatus(autopilotStatus: Int) {
private fun setAutopilotBtnStatus(autopilotStatus: Int) {
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
== autopilotStatus
) { //0不可用
@@ -344,7 +372,7 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
* 展示【自动驾驶】按钮
*/
open fun showAutopilotBiz() {
activity?.runOnUiThread { ctvAutopilotStatus!!.visibility = View.VISIBLE }
requireActivity().runOnUiThread { ctvAutopilotStatus!!.visibility = View.VISIBLE }
}
/**

View File

@@ -7,7 +7,7 @@ class CharterConst {
companion object {
// OCH arouter 路由path
const val PATH = "/och/api"
const val PATH = "/driver/api"
// 测试用的广播
const val BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY = "sceneType"
@@ -66,9 +66,9 @@ class CharterConst {
const val ARRIVE_AT_END_STATION_DISTANCE = 10
// 轮询
const val LOOP_PASSENGER_5S = 5 * 1000L
const val LOOP_PASSENGER_2S = 2 * 1000L
const val LOOP_PASSENGER_1S = 1 * 1000L
const val LOOP_5M = 3 * 1000L
const val LOOP_2S = 2 * 1000L
const val LOOP_1S = 1 * 1000L
const val LOOP_DELAY_500 = 500L
const val DELAY_10S = 10 * 1000L

View File

@@ -366,4 +366,22 @@
app:layout_constraintEnd_toEndOf="parent"
/>
<com.magic.mogo.och.charter.view.SlidePanelView
android:id="@+id/charter_slide_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"
android:visibility="invisible"
app:BLOCK_START_X="@dimen/module_mogo_och_slide_panel_block_start_x"
app:BLOCK_START_Y="@dimen/module_mogo_och_slide_panel_block_start_y"
app:NORMAL_TEXT_MARGIN_LEFT="@dimen/module_mogo_och_slide_panel_normal_text_margin_left"
app:NORMAL_TEXT_MARGIN_RIGHT="@dimen/module_mogo_och_slide_panel_normal_text_margin_right"
app:SHORT_TEXT_MARGIN_LEFT="@dimen/module_mogo_och_slide_panel_short_text_margin_left"
app:SHORT_TEXT_MARGIN_RIGHT="@dimen/module_mogo_och_slide_panel_short_text_margin_right"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:textSize="@dimen/module_mogo_och_slide_panel_textSize"
tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,9 @@
package com.mogo.och.common.module.bean.dpmsg
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class DPOperateDoorMsg(
var open: Boolean = false // true: 开门, false: 关门
): BaseDPMsg(DPMsgType.TYPE_CHANGE_DEST.type)

View File

@@ -0,0 +1,9 @@
package com.mogo.och.common.module.bean.dpmsg
/**
* @author: wangmingjun
* @date: 2023/2/24
*/
data class DPOrderClosedMsg(
var closed: Boolean = true // true: 开门, false: 关门
): BaseDPMsg(DPMsgType.TYPE_CHANGE_DEST.type)

View File

@@ -12,8 +12,10 @@ import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
* 统一管理业务长链消息推送
*/
object OCHSocketMessageManager {
const val msgMonitorType:Int = 6295553
const val msgWriteOffPassengerType:Int = 6295554
public const val msgMonitorType:Int = 6295553 //后台运营消息
public const val msgWriteOffPassengerType:Int = 6295554 //核销消息
public const val msgOperateDoorType = 6295554 // 开/关门消息
public const val msgOrderClosedType = 6295555 //订单结束消息
fun <T> registerSocketMessageListener(msgType:Int,
mogoOnMessageListener :IMogoOnMessageListener<T>){

View File

@@ -0,0 +1,7 @@
package com.mogo.och.common.module.biz.common.socketmessage.data
/**
* @author: wangmingjun
* @date: 2023/2/25
*/
open class DataBaseMsg (var msgType: Int,var pushTimeStamp: Long = System.currentTimeMillis())

View File

@@ -0,0 +1,12 @@
package com.mogo.och.common.module.biz.common.socketmessage.data
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.msgOperateDoorType
/**
* @author: wangmingjun
* @date: 2023/2/25
*/
data class OperateDoorMsg(
var orderNo: String,
var message: String
):DataBaseMsg(msgOperateDoorType) //{"orderNo":"","message":""}

View File

@@ -0,0 +1,12 @@
package com.mogo.och.common.module.biz.common.socketmessage.data
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.msgOrderClosedType
/**
* @author: wangmingjun
* @date: 2023/2/25
*/
data class OrderCloseMsg(
var orderNo: String,
var message: String
):DataBaseMsg(msgOrderClosedType) //{"orderNo":"","message":""}

View File

@@ -0,0 +1,13 @@
package com.mogo.och.common.module.biz.common.socketmessage.data
import com.mogo.och.common.module.biz.common.socketmessage.OCHSocketMessageManager.msgMonitorType
/**
* @author: wangmingjun
* @date: 2023/2/25
*/
data class SystemMsg(
var context: String,
var screenList: MutableList<Int>
):DataBaseMsg(msgMonitorType) // {"context":"","screenList":[]} 1:司机屏 2:乘客屏

View File

@@ -60,7 +60,6 @@ class TaxiLoginDialogFragment :
super.onCreate(savedInstanceState)
setStyle(STYLE_NO_TITLE, R.style.DialogFullScreen) //dialog全屏
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
@@ -99,7 +98,8 @@ class TaxiLoginDialogFragment :
//出租车司机
acivLoginBg.setImageResource(R.drawable.taxi_ic_login_bg)
} else if ((AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)
|| AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) &&
|| AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)
|| AppIdentityModeUtils.isCharter(FunctionBuildConfig.appIdentityMode)) &&
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
//小巴车司机
acivLoginBg.setImageResource(R.drawable.bus_ic_login_bg)

View File

@@ -4,6 +4,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_CHARTER_D
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_SWEEPER
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_TAXI
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_TAXI_P
@@ -13,7 +14,7 @@ object CallerLoggerUtils {
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
//出租车司机
M_TAXI
}else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)&&
}else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
//小巴车司机
M_BUS
@@ -28,6 +29,10 @@ object CallerLoggerUtils {
}else if (AppIdentityModeUtils.isSweeper(FunctionBuildConfig.appIdentityMode)){
//清扫车
M_SWEEPER
}else if (AppIdentityModeUtils.isCharter(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)){
//M1司机端
M_CHARTER_D
}
else{
""

View File

@@ -3,6 +3,8 @@ package com.mogo.och.common.module.voice
import com.mogo.commons.AbsMogoApplication
import com.mogo.commons.voice.AIAssist
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.tts.base.LangTtsEntity
import com.mogo.tts.base.MultiLangTtsEntity
object VoiceNotice {
@JvmStatic
@@ -46,4 +48,9 @@ object VoiceNotice {
AIAssist.getInstance(AbsMogoApplication.getApp()).stopTts()
}
}
@JvmStatic
fun showNotice(listTTS: MutableList<LangTtsEntity>, level: Int) {
AIAssist.getInstance(AbsMogoApplication.getApp())
.speakMultiLangTTSWithLevel(MultiLangTtsEntity(listTTS), level,null) }
}

View File

@@ -481,6 +481,8 @@ Object readFileToJson(env){
def variantName() {
if(gradle.startParameter.taskNames.size()>0) {
def taskName = gradle.startParameter.taskNames[0]
taskName = taskName.replace("Debug","")
taskName = taskName.replace("Release","")
if (taskName.endsWith("Qa")) {
return "qa"
} else if (taskName.endsWith("Online")) {

View File

@@ -89,8 +89,11 @@ object ConfigStartUp {
HdMapBuildConfig.currentCarVrIconRes = R.raw.huanwei
} else if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)){
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
} else if (AppIdentityModeUtils.isCharter(FunctionBuildConfig.appIdentityMode)){
HdMapBuildConfig.currentCarVrIconRes = R.raw.xiaobache
}
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
//是否显示 限速UI

View File

@@ -8,7 +8,7 @@
"socket_tech_url": ""
},
"online": {
"och_url": "http://tech-dev.zhidaohulian.com",
"och_url": "http://tech.zhidaohulian.com",
"shuttle_url": "https://och-driver.zhidaozhixing.com",
"passport_url": "",
"socket_base_url": "",

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -41,5 +41,7 @@ class SceneConstant {
//清扫车
const val M_SWEEPER = "M_SWEEPER-"
//M1司机端
const val M_CHARTER_D = "M_CHARTER_D-"
}
}

View File

@@ -21,7 +21,8 @@ public class ScreenHelper {
int baseHeight = 1600;
boolean baseOnWidth = true;
if (AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode)) {
if (AppIdentityModeUtils.isM1(FunctionBuildConfig.appIdentityMode) &&
AppIdentityModeUtils.isPassenger((FunctionBuildConfig.appIdentityMode))) {
baseWidth = 1920;
baseHeight = 1080;
} else if (AppIdentityModeUtils.isM2(FunctionBuildConfig.appIdentityMode)) {