[8.1.0]OTA升级+自动驾驶检测
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.bean
|
||||
|
||||
/*{
|
||||
"code":0,
|
||||
"message":"success",
|
||||
"msg":"success",
|
||||
"result":{
|
||||
"trackContrail":{
|
||||
"csvFileUrl":"xxxxx.csv",
|
||||
"csvFileMd5":"1018c022535df18448ab740af0b9c9a0",
|
||||
"txtFileUrl":"xxxx.txt",
|
||||
"txtFileMd5":"aea78906597cf97a0d61bc9918778c17",
|
||||
"contrailSaveTime":1656468916000
|
||||
},
|
||||
"dbqpContrail":{
|
||||
"csvFileUrl":"xxxx.csv",
|
||||
"csvFileMd5":"1018c022535df18448ab740af0b9c9a0",
|
||||
"txtFileUrl":"xxxx.txt",
|
||||
"txtFileMd5":"aea78906597cf97a0d61bc9918778c17",
|
||||
"contrailSaveTime":1656468916000
|
||||
}
|
||||
}
|
||||
}*/
|
||||
data class TrajectoryInfoRes(
|
||||
val code: Int,
|
||||
val message: String,
|
||||
val msg: String,
|
||||
val result: TrajectoryInfo
|
||||
)
|
||||
|
||||
data class TrajectoryInfo(
|
||||
val dbqpContrail: DbqpContrail,
|
||||
val trackContrail: TrackContrail
|
||||
)
|
||||
|
||||
data class TrackContrail(
|
||||
val contrailSaveTime: Long,
|
||||
val csvFileMd5: String,
|
||||
val csvFileUrl: String,
|
||||
val txtFileMd5: String,
|
||||
val txtFileUrl: String
|
||||
)
|
||||
|
||||
data class DbqpContrail(
|
||||
val contrailSaveTime: Long,
|
||||
val csvFileMd5: String,
|
||||
val csvFileUrl: String,
|
||||
val txtFileMd5: String,
|
||||
val txtFileUrl: String
|
||||
)
|
||||
|
||||
|
||||
data class TrajectoryInfoReq(
|
||||
val brand: String,
|
||||
val carModel: String,
|
||||
val lineId: Int
|
||||
)
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.bean
|
||||
|
||||
/*{
|
||||
"code":0,
|
||||
"message":"success",
|
||||
"msg":"success",
|
||||
"result":[
|
||||
{
|
||||
"lineId":89,
|
||||
"lineName":"顺义Bus10KM路线"
|
||||
},
|
||||
{
|
||||
"lineId":90,
|
||||
"lineName":"Bus鹰眼_13号路口起到终"
|
||||
}
|
||||
]
|
||||
}*/
|
||||
data class TrajectoryLisRes(
|
||||
val code: Int,
|
||||
val message: String,
|
||||
val msg: String,
|
||||
val result: List<TrajectoryListInfo>
|
||||
)
|
||||
|
||||
data class TrajectoryListInfo(
|
||||
val lineId: Int,
|
||||
val lineName: String
|
||||
)
|
||||
|
||||
class TrajectoryLisReq {
|
||||
var name: String = ""
|
||||
var page: Int = 0
|
||||
var pageSize: Int = 100
|
||||
var cityCode: String = ""
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.bean
|
||||
|
||||
/*{
|
||||
"code":0,
|
||||
"message":"success",
|
||||
"msg":"success",
|
||||
"result":[
|
||||
{
|
||||
"siteId":47,
|
||||
"seq":1,
|
||||
"name":"石家庄市",
|
||||
"description":"",
|
||||
"lon":114.25118147313091,
|
||||
"lat":38.123641911994746,
|
||||
"wgs84Lon":115.0050379087139,
|
||||
"wgs84Lat":38.12405426963943
|
||||
},
|
||||
{
|
||||
"siteId":48,
|
||||
"seq":2,
|
||||
"name":"市政府",
|
||||
"description":"市政府",
|
||||
"wgs84Lon":115.0050379087139,
|
||||
"wgs84Lat":38.12405426963943,
|
||||
"lat":38.12405426963943
|
||||
"lat":38.12405426963943
|
||||
}
|
||||
]
|
||||
}*/
|
||||
data class TrajectorySiteLRes(
|
||||
val code: Int,
|
||||
val message: String,
|
||||
val msg: String,
|
||||
val result: List<TrajectorySiteInfo>
|
||||
)
|
||||
|
||||
data class TrajectorySiteInfo(
|
||||
val description: String,
|
||||
val lat: Double,
|
||||
val lon: Double,
|
||||
val wgs84Lat: Double,
|
||||
val wgs84Lon: Double,
|
||||
val name: String,
|
||||
val seq: Int,
|
||||
val siteId: Int
|
||||
)
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.bean
|
||||
|
||||
/**
|
||||
* 车辆配置数据
|
||||
*/
|
||||
object VehicleConfigData {
|
||||
// plate:JL-金旅小巴、HQ-红旗、DF-东风,车牌号信息
|
||||
var plate = ""
|
||||
|
||||
// brand:HQ-红旗 DF-东风 JINLV-金旅 FT-清扫车 KW-开沃
|
||||
var brand = ""
|
||||
|
||||
// 车辆子类型:M1、M2
|
||||
var subtype = ""
|
||||
|
||||
// 102 镜像版本名称
|
||||
var dockerName = "未知"
|
||||
|
||||
// 当前机器上配置的所有 Docker 信息
|
||||
var dockerList: Map<String, String>? = null
|
||||
|
||||
// MAP 加载地图版本
|
||||
var dockerMapHDVersionName = "未知"
|
||||
|
||||
// StartupConfigCache.json 文件不存在时候,使用命令获取文件MD5
|
||||
var scaliBratedSensorMD5 = ""
|
||||
|
||||
/**
|
||||
* 获取车辆平台类型
|
||||
* -1--未定义或者没获取到车辆类型,调用者需要处理异常,并提示用户重新尝试
|
||||
* 0--taxi,
|
||||
* 1--bus,
|
||||
* 2--sweeper
|
||||
*/
|
||||
fun getCarType(): VehicleType {
|
||||
// brand:HQ-红旗 DF-东风 JINLV-金旅 FT-清扫车 KW-开沃
|
||||
// 处理Taxi
|
||||
return if (
|
||||
brand.startsWith("DF")
|
||||
or brand.startsWith("HQ")
|
||||
) {
|
||||
VehicleType.TAXI
|
||||
}
|
||||
// 处理BUS:B1、M1、M2、KW
|
||||
else if (
|
||||
brand.startsWith("JINLV")
|
||||
or brand.startsWith("KW")
|
||||
) {
|
||||
VehicleType.BUS
|
||||
}
|
||||
// 清扫车:FT、
|
||||
else if (brand.startsWith("FT")) {
|
||||
VehicleType.SWEEPER
|
||||
}
|
||||
// 默认使用
|
||||
else {
|
||||
VehicleType.TAXI
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆品牌
|
||||
*/
|
||||
fun getCarBrand(): String {
|
||||
return if (brand.startsWith("DF")) {
|
||||
"东风"
|
||||
} else if (brand.startsWith("HQ")) {
|
||||
"红旗"
|
||||
} else if (brand.startsWith("JINLV") || brand.startsWith("JV") || brand.startsWith("JL")) {
|
||||
"金旅"
|
||||
} else if (brand.startsWith("KW")) {
|
||||
"开沃"
|
||||
} else if (brand.startsWith("FT")) {
|
||||
"福田"
|
||||
} else {
|
||||
"金旅"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取车辆品牌--类型
|
||||
*/
|
||||
fun getCarModel(): String {
|
||||
return if (plate.startsWith("DF")) {
|
||||
"E70"
|
||||
} else if (plate.startsWith("HQ")) {
|
||||
"H9"
|
||||
} else if (plate.startsWith("JV") || plate.startsWith("JL")) {
|
||||
"金旅牌XML6606JEVY0"
|
||||
} else if (plate.startsWith("KW")) {
|
||||
"NJL6450ICEV"
|
||||
} else if (plate.startsWith("FT")) {
|
||||
"清扫车"
|
||||
} else if (plate.startsWith("SW")) {
|
||||
"清扫车"
|
||||
} else {
|
||||
"金旅牌XML6606JEVY0"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.bean;
|
||||
|
||||
/**
|
||||
* 车辆类型
|
||||
*/
|
||||
public enum VehicleType {
|
||||
// 出租车
|
||||
TAXI,
|
||||
// 公交车
|
||||
BUS,
|
||||
// 清扫车
|
||||
SWEEPER,
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.dialog
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.Dialog
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.view.WindowManager
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.LifecycleRegistry
|
||||
import androidx.recyclerview.widget.DividerItemDecoration
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationWGS84ListenerManager
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.Utils
|
||||
import com.mogo.eagle.core.utilcode.util.WindowUtils
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.net.TrajectoryApiClient
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.R
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryListInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.VehicleConfigData
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.dialog.adapter.AutopilotLineAdapter
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.net.NetworkCallback
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.ui.views.MoGoLoadingView
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.cancel
|
||||
|
||||
/**
|
||||
* 自动驾驶路线选择提示窗
|
||||
*/
|
||||
class SelectAutopilotLineDialog(context: Context) : Dialog(context), LifecycleOwner {
|
||||
private val scopeQueryTrajectoryList = CoroutineScope(Dispatchers.Main)
|
||||
private val mLifecycleRegistry = LifecycleRegistry(this)
|
||||
|
||||
private var mActivity: Activity? = null
|
||||
private var autopilotLineAdapter: AutopilotLineAdapter? = null
|
||||
private var clickListener: ClickListener? = null
|
||||
private var searchStr: String? = null
|
||||
private var allLineList: ArrayList<TrajectoryListInfo> = ArrayList() //所有的路线
|
||||
private var selectLineList: ArrayList<TrajectoryListInfo> = ArrayList() //选择的路线
|
||||
|
||||
private lateinit var etSearch: EditText
|
||||
private lateinit var rvLineList: RecyclerView
|
||||
private lateinit var tvLoading: MoGoLoadingView
|
||||
private lateinit var tvCancel: TextView
|
||||
private lateinit var ivSearch: ImageView
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.dialog_select_autopilot_line)
|
||||
setCanceledOnTouchOutside(false)
|
||||
etSearch = findViewById(R.id.etSearch)
|
||||
rvLineList = findViewById(R.id.rvLineList)
|
||||
tvLoading = findViewById(R.id.tvLoading)
|
||||
tvCancel = findViewById(R.id.tvCancel)
|
||||
ivSearch = findViewById(R.id.ivSearch)
|
||||
|
||||
autopilotLineAdapter = AutopilotLineAdapter()
|
||||
autopilotLineAdapter?.setListener(object : AutopilotLineAdapter.SubClickListener {
|
||||
override fun onClick(trajectoryListInfo: TrajectoryListInfo) {
|
||||
etSearch.setText("")
|
||||
clickListener?.onClick(trajectoryListInfo)
|
||||
dismiss()
|
||||
}
|
||||
})
|
||||
val linearLayoutManager = LinearLayoutManager(Utils.getApp())
|
||||
rvLineList.layoutManager = linearLayoutManager
|
||||
rvLineList.adapter = autopilotLineAdapter
|
||||
val divider = DividerItemDecoration(context, linearLayoutManager.orientation)
|
||||
rvLineList.addItemDecoration(divider)
|
||||
val params: WindowManager.LayoutParams = window!!.attributes
|
||||
params.width = WindowUtils.dip2px(context,context.resources.getDimension(R.dimen.dp_280))
|
||||
params.height = WindowUtils.dip2px(context,context.resources.getDimension(R.dimen.dp_250))
|
||||
window?.attributes = params
|
||||
window?.setBackgroundDrawable(null)
|
||||
initEvent()
|
||||
}
|
||||
|
||||
fun showSelectLineDialog(activity: Activity) {
|
||||
mActivity = activity
|
||||
// if (activity.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE) {
|
||||
// AutoSize.autoConvertDensity(activity, 1660f, true)
|
||||
// } else {
|
||||
// AutoSize.autoConvertDensity(activity, 960f, true)
|
||||
// }
|
||||
show()
|
||||
}
|
||||
|
||||
fun setSelectLineData(list: ArrayList<TrajectoryListInfo>) {
|
||||
if (list.isNotEmpty()) {
|
||||
autopilotLineAdapter?.setData(list)
|
||||
allLineList = list
|
||||
}
|
||||
}
|
||||
|
||||
private fun initEvent() {
|
||||
setOnShowListener {
|
||||
mLifecycleRegistry.currentState = Lifecycle.State.CREATED
|
||||
mLifecycleRegistry.currentState = Lifecycle.State.STARTED
|
||||
|
||||
tvLoading.show("数据加载中……")
|
||||
|
||||
// 处理Taxi
|
||||
// 处理BUS包含:JV、KW、FT、SW
|
||||
// CallerChassisLocationWGS84ListenerManager.getChassisLocationWGS84().cityCode?.let {
|
||||
// TrajectoryApiClient.queryTrajectoryList(
|
||||
// this,
|
||||
// VehicleConfigData.getCarType().name,
|
||||
// it,
|
||||
// object :
|
||||
// NetworkCallback<ArrayList<TrajectoryListInfo>> {
|
||||
// override fun onSuccess(data: ArrayList<TrajectoryListInfo>) {
|
||||
// setSelectLineData(data)
|
||||
// tvLoading.hide()
|
||||
// }
|
||||
//
|
||||
// override fun onError(msg: String) {
|
||||
// ToastUtils.showLong("获取 Bus 站点列表异常,异常原因:${msg}")
|
||||
// tvLoading.show("获取 Bus 站点列表异常")
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// } ?: let {
|
||||
// ToastUtils.showLong("获取 Bus 站点列表异常,获取当前未知失败,请开启定位权限")
|
||||
// tvLoading.show("获取 Bus 站点列表异常,请开启定位权限")
|
||||
// }
|
||||
|
||||
}
|
||||
//取消
|
||||
tvCancel.setOnClickListener {
|
||||
etSearch.setText("")
|
||||
dismiss()
|
||||
}
|
||||
//搜索
|
||||
etSearch.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun onTextChanged(p0: CharSequence?, p1: Int, p2: Int, p3: Int) {
|
||||
|
||||
}
|
||||
|
||||
override fun afterTextChanged(str: Editable?) {
|
||||
searchStr = str.toString()
|
||||
if (searchStr.isNullOrBlank()) {
|
||||
ivSearch.setImageResource(R.drawable.icon_line_search)
|
||||
autopilotLineAdapter?.setData(allLineList)
|
||||
} else {
|
||||
ivSearch.setImageResource(R.drawable.icon_line_delect)
|
||||
selectLineList.clear()
|
||||
for (info in allLineList) {
|
||||
if (info.lineName.contains(searchStr!!) || info.lineId.toString()
|
||||
.contains(searchStr!!)
|
||||
) {
|
||||
selectLineList.add(info)
|
||||
}
|
||||
}
|
||||
autopilotLineAdapter?.setData(selectLineList)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
})
|
||||
ivSearch.setOnClickListener {
|
||||
if (searchStr != null && searchStr!!.isNotEmpty()) {
|
||||
etSearch.setText("")
|
||||
ivSearch.setImageResource(R.drawable.icon_line_search)
|
||||
autopilotLineAdapter?.setData(allLineList)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun setListener(listener: ClickListener) {
|
||||
clickListener = listener
|
||||
}
|
||||
|
||||
interface ClickListener {
|
||||
fun onClick(info: TrajectoryListInfo)
|
||||
}
|
||||
|
||||
override fun dismiss() {
|
||||
scopeQueryTrajectoryList.cancel()
|
||||
mActivity = null
|
||||
super.dismiss()
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
mLifecycleRegistry.currentState = Lifecycle.State.DESTROYED
|
||||
scopeQueryTrajectoryList.cancel()
|
||||
super.onDetachedFromWindow()
|
||||
}
|
||||
|
||||
override fun getLifecycle(): Lifecycle {
|
||||
return lifecycle
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.dialog.adapter
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.R
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryListInfo
|
||||
|
||||
/**
|
||||
* 自动驾驶路线适配器
|
||||
*/
|
||||
class AutopilotLineAdapter : RecyclerView.Adapter<AutopilotLineAdapter.AutopilotLineHolder>() {
|
||||
|
||||
private var data: ArrayList<TrajectoryListInfo>? = null
|
||||
private var subClickListener: SubClickListener? = null
|
||||
|
||||
fun setData(list: ArrayList<TrajectoryListInfo>) {
|
||||
data = list
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
fun setListener(listener: SubClickListener) {
|
||||
subClickListener = listener
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): AutopilotLineHolder {
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_autopilot_line, parent, false)
|
||||
return AutopilotLineHolder(view)
|
||||
}
|
||||
|
||||
override fun getItemCount() = data?.size ?: 0
|
||||
|
||||
override fun onBindViewHolder(holder: AutopilotLineHolder, position: Int) {
|
||||
data?.let {
|
||||
val info = it[position]
|
||||
holder.tvAutopilotLine.text = "${info.lineId}-${info.lineName}"
|
||||
holder.tvAutopilotLine.setOnClickListener {
|
||||
subClickListener?.onClick(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class AutopilotLineHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
|
||||
var tvAutopilotLine: TextView = itemView.findViewById(R.id.tvAutopilotLine)
|
||||
}
|
||||
|
||||
interface SubClickListener {
|
||||
fun onClick(trajectoryListInfo: TrajectoryListInfo)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.dialog.adapter;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.graphics.Color;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.eagle.core.data.deva.report.ReportEntity;
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author XuXinChao
|
||||
* @description 状态监控-控制台适配器
|
||||
* @since: 2022/7/26
|
||||
*/
|
||||
public class ConsoleAdapter extends RecyclerView.Adapter<ConsoleAdapter.ConsoleHolder> {
|
||||
|
||||
private List<ReportEntity> data;
|
||||
|
||||
private static final String RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE";
|
||||
private static final String RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED";
|
||||
private static final String RESULT_REMOTEPILOT_DISABLE = "RESULT_REMOTEPILOT_DISABLE";
|
||||
|
||||
public void setData(List<ReportEntity> data) {
|
||||
if (data != null && data.size() > 0) {
|
||||
this.data = data;
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ConsoleHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
// AutoSizeCompat.autoConvertDensityOfGlobal(parent.getContext().getResources());
|
||||
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_console, parent, false);
|
||||
return new ConsoleHolder(view);
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ConsoleHolder holder, int position) {
|
||||
ReportEntity reportEntity = data.get(position);
|
||||
holder.tvConsoleContent.setText("Time:" + reportEntity.getTime() + "\nCode:" + reportEntity.getCode() + "\nMsg:" + reportEntity.getMsg());
|
||||
if (RESULT_AUTOPILOT_DISABLE.equals(reportEntity.getCode())
|
||||
|| RESULT_AUTOPILOT_SYSTEM_UNSTARTED.equals(reportEntity.getCode())
|
||||
|| RESULT_REMOTEPILOT_DISABLE.equals(reportEntity.getCode())) {
|
||||
holder.tvConsoleContent.setTextColor(Color.RED);
|
||||
} else {
|
||||
holder.tvConsoleContent.setTextColor(Color.WHITE);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return data != null ? data.size() : 0;
|
||||
}
|
||||
|
||||
public static class ConsoleHolder extends RecyclerView.ViewHolder {
|
||||
|
||||
private TextView tvConsoleContent;
|
||||
|
||||
public ConsoleHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
tvConsoleContent = itemView.findViewById(R.id.tvConsoleContent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.net
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.eagle.core.data.EnvConfig
|
||||
|
||||
object MisHost {
|
||||
private const val HOST_QA = "https://eagle-qa.zhidaozhixing.com/"
|
||||
private const val HOST_RELEASE = "https://eagle-mis-v6.zhidaozhixing.com/"
|
||||
|
||||
private const val LOGIN_HOST_QA =
|
||||
"https://carlife-test.zhidaohulian.com/qa/eagle/login/index.html?deviceId="
|
||||
private const val LOGIN_HOST_RELEASE =
|
||||
"https://carlife-test.zhidaohulian.com/eagle/login/index.html?deviceId="
|
||||
|
||||
fun getHost(): String {
|
||||
return if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_DEV || DebugConfig.getNetMode() == DebugConfig.NET_MODE_QA) {
|
||||
HOST_QA
|
||||
} else {
|
||||
HOST_RELEASE
|
||||
}
|
||||
}
|
||||
|
||||
fun getLoginURL(): String {
|
||||
return if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_DEV || DebugConfig.getNetMode() == DebugConfig.NET_MODE_QA) {
|
||||
LOGIN_HOST_QA
|
||||
} else {
|
||||
LOGIN_HOST_RELEASE
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.net;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleObserver;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
import androidx.lifecycle.OnLifecycleEvent;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.OkHttpClient;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
import retrofit2.converter.scalars.ScalarsConverterFactory;
|
||||
|
||||
/**
|
||||
* 网络请求工具
|
||||
*/
|
||||
public class NetworkManager implements LifecycleObserver {
|
||||
private static final String TAG = "NetworkManager";
|
||||
private static final int DEFAULT_TIMEOUT = 10;
|
||||
|
||||
private static NetworkManager instance;
|
||||
private final Retrofit.Builder retrofit;
|
||||
private final Map<String, Object> serviceMap;
|
||||
private final Map<LifecycleOwner, Disposable> ownerDisposableMap;
|
||||
private final CompositeDisposable compositeDisposable;
|
||||
|
||||
private NetworkManager() {
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
builder.connectTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS);
|
||||
|
||||
retrofit = new Retrofit.Builder()
|
||||
.client(builder.build())
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(ScalarsConverterFactory.create())
|
||||
.addCallAdapterFactory(RxJava2CallAdapterFactory.create());
|
||||
|
||||
serviceMap = new HashMap<>();
|
||||
ownerDisposableMap = new HashMap<>();
|
||||
compositeDisposable = new CompositeDisposable();
|
||||
}
|
||||
|
||||
public static synchronized NetworkManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new NetworkManager();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建网络请求
|
||||
*
|
||||
* @param serviceClass API服务
|
||||
* @param baseUrl 请求地址
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public <T> T createService(Class<T> serviceClass, String baseUrl) {
|
||||
if (serviceMap.containsKey(baseUrl)) {
|
||||
return (T) serviceMap.get(baseUrl);
|
||||
} else {
|
||||
T service = retrofit.baseUrl(baseUrl).build().create(serviceClass);
|
||||
serviceMap.put(baseUrl, service);
|
||||
return service;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送网络请求
|
||||
*
|
||||
* @param observable
|
||||
* @param owner 发送网络请求的 LifecycleOwner
|
||||
* @param callback 回调
|
||||
* @param <T>
|
||||
*/
|
||||
public <T> void sendRequest(Observable<T> observable,
|
||||
final LifecycleOwner owner,
|
||||
final NetworkCallback<T> callback) {
|
||||
// 在工作线程执行网络请求
|
||||
Disposable disposable = observable.subscribeOn(Schedulers.io())
|
||||
// 切换到主线程回调
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
// 回调
|
||||
.subscribe(new Consumer<T>() {
|
||||
@Override
|
||||
public void accept(T t) {
|
||||
if (callback != null) {
|
||||
callback.onSuccess(t);
|
||||
}
|
||||
}
|
||||
}, new Consumer<Throwable>() {
|
||||
@Override
|
||||
public void accept(Throwable throwable) {
|
||||
if (callback != null) {
|
||||
callback.onError(throwable.getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (owner != null) {
|
||||
owner.getLifecycle().addObserver(this);
|
||||
ownerDisposableMap.put(owner, disposable);
|
||||
compositeDisposable.add(disposable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消所有网络请求
|
||||
*/
|
||||
public void cancelAllRequests() {
|
||||
compositeDisposable.clear();
|
||||
}
|
||||
|
||||
// 绑定生命周期,跟随发起网络请求的地方生命周期自动销毁
|
||||
@OnLifecycleEvent(Lifecycle.Event.ON_DESTROY)
|
||||
public void onDestroy(LifecycleOwner owner) {
|
||||
Log.d(TAG, "onDestroy: owner=" + owner);
|
||||
owner.getLifecycle().removeObserver(this);
|
||||
ownerDisposableMap.remove(owner);
|
||||
}
|
||||
|
||||
/**
|
||||
* 网络请求回调
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public interface NetworkCallback<T> {
|
||||
// 请求成功回调
|
||||
void onSuccess(T response);
|
||||
|
||||
/**
|
||||
* 异常回调
|
||||
*
|
||||
* @param throwable 异常信息
|
||||
*/
|
||||
void onError(String throwable);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,135 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.net
|
||||
|
||||
import android.util.Log
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.module.common.net.mis.trajectory.net.TrajectoryApiService
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfoReq
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryLisReq
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryListInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectorySiteInfo
|
||||
|
||||
|
||||
object TrajectoryApiClient {
|
||||
private val TAG = "TrajectoryApiClient"
|
||||
|
||||
private val baseUrl = MisHost.getHost()
|
||||
private val apiService: TrajectoryApiService =
|
||||
NetworkManager.getInstance().createService(TrajectoryApiService::class.java, baseUrl)
|
||||
|
||||
// /**
|
||||
// * 查询 Bus&Taxi 有轨迹的QA线路列表
|
||||
// */
|
||||
// fun queryTrajectoryList(
|
||||
// owner: LifecycleOwner,
|
||||
// carType: String,
|
||||
// cityCode: String,
|
||||
// callback: NetworkCallback<ArrayList<TrajectoryListInfo>>
|
||||
// ) {
|
||||
// val reqBody = TrajectoryLisReq()
|
||||
// reqBody.page = 1
|
||||
// reqBody.pageSize = 1000
|
||||
// reqBody.cityCode = cityCode
|
||||
//
|
||||
// val observable = if (carType == "TAXI") {
|
||||
// apiService.queryTaxiTrajectoryList(reqBody)
|
||||
// } else {
|
||||
// apiService.queryBusTrajectoryList(reqBody)
|
||||
// }
|
||||
//
|
||||
// NetworkManager.getInstance()
|
||||
// .sendRequest(
|
||||
// observable,
|
||||
// owner,
|
||||
// object :
|
||||
// NetworkManager.NetworkCallback<BaseResponse<ArrayList<TrajectoryListInfo>>> {
|
||||
// override fun onSuccess(response: BaseResponse<ArrayList<TrajectoryListInfo>>?) {
|
||||
// Log.d(TAG, "查询 $carType 有轨迹的QA线路列表:$response")
|
||||
// // 处理网络请求成功的响应
|
||||
// response?.result?.let { callback.onSuccess(it) }
|
||||
// }
|
||||
//
|
||||
// override fun onError(throwable: String) {
|
||||
// Log.e(TAG, "查询 $carType 有轨迹的QA线路列表:$throwable")
|
||||
// // 处理网络请求失败的情况
|
||||
// callback.onError(throwable)
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 查询 Bus&Taxi 线路对应的站点
|
||||
// */
|
||||
// fun querySiteList(
|
||||
// owner: LifecycleOwner,
|
||||
// carType: String,
|
||||
// lineId: Int,
|
||||
// callback: NetworkCallback<ArrayList<TrajectorySiteInfo>>
|
||||
// ) {
|
||||
// val observable = if (carType == "TAXI") {
|
||||
// apiService.queryTaxiSiteList(lineId)
|
||||
// } else {
|
||||
// apiService.queryBusSiteList(lineId)
|
||||
// }
|
||||
//
|
||||
// NetworkManager.getInstance()
|
||||
// .sendRequest(
|
||||
// observable,
|
||||
// owner,
|
||||
// object :
|
||||
// NetworkManager.NetworkCallback<BaseResponse<ArrayList<TrajectorySiteInfo>>> {
|
||||
// override fun onSuccess(response: BaseResponse<ArrayList<TrajectorySiteInfo>>?) {
|
||||
// Log.d(TAG, "查询 $carType 线路对应的站点:$response")
|
||||
// // 处理网络请求成功的响应
|
||||
// response?.result?.let { callback.onSuccess(it) }
|
||||
// }
|
||||
//
|
||||
// override fun onError(throwable: String) {
|
||||
// Log.e(TAG, "查询 $carType 线路对应的站点:$throwable")
|
||||
// // 处理网络请求失败的情况
|
||||
// callback.onError(throwable)
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 查询 Bus&Taxi 线路对应的轨迹
|
||||
// */
|
||||
// fun queryTrajectoryInfo(
|
||||
// owner: LifecycleOwner,
|
||||
// carType: String,
|
||||
// reqBody: TrajectoryInfoReq,
|
||||
// callback: NetworkCallback<TrajectoryInfo>
|
||||
// ) {
|
||||
//
|
||||
// val observable = if (carType == "TAXI") {
|
||||
// apiService.queryTaxiTrajectoryInfo(reqBody)
|
||||
// } else {
|
||||
// apiService.queryBusTrajectoryInfo(reqBody)
|
||||
// }
|
||||
//
|
||||
// NetworkManager.getInstance()
|
||||
// .sendRequest(
|
||||
// observable,
|
||||
// owner,
|
||||
// object :
|
||||
// NetworkManager.NetworkCallback<BaseResponse<TrajectoryInfo>> {
|
||||
// override fun onSuccess(response: BaseResponse<TrajectoryInfo>?) {
|
||||
// Log.d(TAG, "查询 $carType 线路对应的轨迹:$response")
|
||||
// // 处理网络请求成功的响应
|
||||
// response?.result?.let { callback.onSuccess(it) }
|
||||
// }
|
||||
//
|
||||
// override fun onError(throwable: String) {
|
||||
// Log.e(TAG, "查询 $carType 线路对应的轨迹:$throwable")
|
||||
// // 处理网络请求失败的情况
|
||||
// callback.onError(throwable)
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mogo.module.common.net.mis.trajectory.net
|
||||
|
||||
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfoReq
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryLisReq
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryListInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectorySiteInfo
|
||||
import io.reactivex.Observable
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Query
|
||||
|
||||
interface TrajectoryApiService {
|
||||
/**
|
||||
* 查询 Bus 有轨迹的QA线路列表
|
||||
* @param deviceId deviceId
|
||||
*/
|
||||
@POST("/eagleEye-mis/line/qa/bus/list")
|
||||
fun queryBusTrajectoryList(@Body reqBody: TrajectoryLisReq): Observable<BaseResponse<ArrayList<TrajectoryListInfo>>>
|
||||
|
||||
/**
|
||||
* 查询 Taxi 有轨迹的QA线路列表
|
||||
* @param deviceId deviceId
|
||||
*/
|
||||
@POST("/eagleEye-mis/line/qa/taxi/list")
|
||||
fun queryTaxiTrajectoryList(@Body reqBody: TrajectoryLisReq): Observable<BaseResponse<ArrayList<TrajectoryListInfo>>>
|
||||
|
||||
/**
|
||||
* 查询 Bus 线路对应的站点
|
||||
* @param lineId 线路ID
|
||||
*/
|
||||
@GET("/eagleEye-mis/line/query/bus/site")
|
||||
fun queryBusSiteList(@Query("lineId") lineId: Int): Observable<BaseResponse<ArrayList<TrajectorySiteInfo>>>
|
||||
|
||||
/**
|
||||
* 查询 Taxi 线路对应的站点
|
||||
* @param lineId 线路ID
|
||||
*/
|
||||
@GET("/eagleEye-mis/line/query/taxi/site")
|
||||
fun queryTaxiSiteList(@Query("lineId") lineId: Int): Observable<BaseResponse<ArrayList<TrajectorySiteInfo>>>
|
||||
|
||||
|
||||
/**
|
||||
* 查询 Bus 线路对应的轨迹
|
||||
*/
|
||||
@POST("/eagleEye-mis/line/query/bus/contrail")
|
||||
fun queryBusTrajectoryInfo(@Body reqBody: TrajectoryInfoReq): Observable<BaseResponse<TrajectoryInfo>>
|
||||
|
||||
|
||||
/**
|
||||
* 查询 Taxi 线路对应的轨迹
|
||||
*/
|
||||
@POST("/eagleEye-mis/line/query/taxi/contrail")
|
||||
fun queryTaxiTrajectoryInfo(@Body reqBody: TrajectoryInfoReq): Observable<BaseResponse<TrajectoryInfo>>
|
||||
}
|
||||
@@ -0,0 +1,350 @@
|
||||
package com.mogo.module.common.net.mis.trajectory.net
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfoReq
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryLisReq
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryListInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectorySiteInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.net.MisHost
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.net.MoGoRetrofitFactory
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.net.NetworkCallback
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.launch
|
||||
import retrofit2.Call
|
||||
import retrofit2.Callback
|
||||
import retrofit2.Response
|
||||
|
||||
object TrajectoryNetModel {
|
||||
private val TAG = "TrajectoryNetModel"
|
||||
private val coroutineScopeMap = HashMap<CoroutineScope, Job>()
|
||||
|
||||
private fun getNetWorkApi(baseUrl: String = MisHost.getHost()): TrajectoryApi {
|
||||
return MoGoRetrofitFactory.getInstanceNoCallAdapter(baseUrl)
|
||||
.create(TrajectoryApi::class.java)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询 Bus 有轨迹的QA线路列表
|
||||
*/
|
||||
fun queryBusTrajectoryList(
|
||||
scope: CoroutineScope,
|
||||
cityCode: String,
|
||||
callback: NetworkCallback<ArrayList<TrajectoryListInfo>>
|
||||
) {
|
||||
|
||||
val reqBody = TrajectoryLisReq()
|
||||
reqBody.page = 1
|
||||
reqBody.pageSize = 1000
|
||||
reqBody.cityCode = cityCode
|
||||
|
||||
val call = getNetWorkApi().queryBusTrajectoryList(reqBody)
|
||||
|
||||
coroutineScopeMap[scope]?.cancel()
|
||||
val newJob = scope.async {
|
||||
call.enqueue(object : Callback<BaseResponse<ArrayList<TrajectoryListInfo>>> {
|
||||
override fun onResponse(
|
||||
call: Call<BaseResponse<ArrayList<TrajectoryListInfo>>>,
|
||||
response: Response<BaseResponse<ArrayList<TrajectoryListInfo>>>
|
||||
) {
|
||||
Log.d(TAG, "查询 Bus 有轨迹的QA线路列表:" + response.body().toString())
|
||||
scope.launch {
|
||||
response.body()?.let { responseBody ->
|
||||
if (responseBody.code == 0) {
|
||||
responseBody.result?.let { result ->
|
||||
callback.onSuccess(result)
|
||||
} ?: let {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} else {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} ?: let {
|
||||
callback.onError("网络异常")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(
|
||||
call: Call<BaseResponse<ArrayList<TrajectoryListInfo>>>,
|
||||
t: Throwable
|
||||
) {
|
||||
Log.e(TAG, "网络异常")
|
||||
scope.launch { callback.onError("网络异常") }
|
||||
}
|
||||
})
|
||||
}
|
||||
coroutineScopeMap[scope] = newJob
|
||||
|
||||
scope.coroutineContext[Job]?.invokeOnCompletion {
|
||||
coroutineScopeMap.remove(scope)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 Taxi 有轨迹的QA线路列表
|
||||
*/
|
||||
fun queryTaxiTrajectoryList(
|
||||
scope: CoroutineScope,
|
||||
cityCode: String,
|
||||
callback: NetworkCallback<ArrayList<TrajectoryListInfo>>
|
||||
) {
|
||||
|
||||
val reqBody = TrajectoryLisReq()
|
||||
reqBody.page = 1
|
||||
reqBody.pageSize = 1000
|
||||
reqBody.cityCode = cityCode
|
||||
|
||||
val call = getNetWorkApi().queryTaxiTrajectoryList(reqBody)
|
||||
|
||||
coroutineScopeMap[scope]?.cancel()
|
||||
val newJob = scope.async {
|
||||
call.enqueue(object : Callback<BaseResponse<ArrayList<TrajectoryListInfo>>> {
|
||||
override fun onResponse(
|
||||
call: Call<BaseResponse<ArrayList<TrajectoryListInfo>>>,
|
||||
response: Response<BaseResponse<ArrayList<TrajectoryListInfo>>>
|
||||
) {
|
||||
Log.d(TAG, "查询 Taxi 有轨迹的QA线路列表:" + response.body().toString())
|
||||
scope.launch {
|
||||
response.body()?.let { responseBody ->
|
||||
if (responseBody.code == 0) {
|
||||
responseBody.result?.let { result ->
|
||||
callback.onSuccess(result)
|
||||
} ?: let {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} else {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} ?: let {
|
||||
callback.onError("网络异常")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(
|
||||
call: Call<BaseResponse<ArrayList<TrajectoryListInfo>>>,
|
||||
t: Throwable
|
||||
) {
|
||||
Log.e(TAG, "网络异常:")
|
||||
scope.launch { callback.onError("网络异常") }
|
||||
}
|
||||
})
|
||||
}
|
||||
coroutineScopeMap[scope] = newJob
|
||||
|
||||
scope.coroutineContext[Job]?.invokeOnCompletion {
|
||||
coroutineScopeMap.remove(scope)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 Bus 线路对应的站点
|
||||
*/
|
||||
fun queryBusSiteList(
|
||||
scope: CoroutineScope,
|
||||
lineId: Int,
|
||||
callback: NetworkCallback<ArrayList<TrajectorySiteInfo>>
|
||||
) {
|
||||
val call = getNetWorkApi().queryBusSiteList(lineId)
|
||||
|
||||
coroutineScopeMap[scope]?.cancel()
|
||||
val newJob = scope.async {
|
||||
call.enqueue(object : Callback<BaseResponse<ArrayList<TrajectorySiteInfo>>> {
|
||||
override fun onResponse(
|
||||
call: Call<BaseResponse<ArrayList<TrajectorySiteInfo>>>,
|
||||
response: Response<BaseResponse<ArrayList<TrajectorySiteInfo>>>
|
||||
) {
|
||||
Log.d(TAG, "查询 Bus 有轨迹的QA线路列表:" + response.body().toString())
|
||||
scope.launch {
|
||||
response.body()?.let { responseBody ->
|
||||
if (responseBody.code == 0) {
|
||||
responseBody.result?.let { result ->
|
||||
callback.onSuccess(result)
|
||||
} ?: let {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} else {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} ?: let {
|
||||
callback.onError("网络异常")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(
|
||||
call: Call<BaseResponse<ArrayList<TrajectorySiteInfo>>>,
|
||||
t: Throwable
|
||||
) {
|
||||
Log.e(TAG, "网络异常:")
|
||||
scope.launch { callback.onError("网络异常") }
|
||||
}
|
||||
})
|
||||
}
|
||||
coroutineScopeMap[scope] = newJob
|
||||
|
||||
scope.coroutineContext[Job]?.invokeOnCompletion {
|
||||
coroutineScopeMap.remove(scope)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 Taxi 线路对应的站点
|
||||
*/
|
||||
fun queryTaxiSiteList(
|
||||
scope: CoroutineScope,
|
||||
lineId: Int,
|
||||
callback: NetworkCallback<ArrayList<TrajectorySiteInfo>>
|
||||
) {
|
||||
|
||||
val call = getNetWorkApi().queryTaxiSiteList(lineId)
|
||||
|
||||
coroutineScopeMap[scope]?.cancel()
|
||||
val newJob = scope.async {
|
||||
call.enqueue(object : Callback<BaseResponse<ArrayList<TrajectorySiteInfo>>> {
|
||||
override fun onResponse(
|
||||
call: Call<BaseResponse<ArrayList<TrajectorySiteInfo>>>,
|
||||
response: Response<BaseResponse<ArrayList<TrajectorySiteInfo>>>
|
||||
) {
|
||||
Log.d(TAG, "查询 Taxi 有轨迹的QA线路列表:" + response.body().toString())
|
||||
scope.launch {
|
||||
response.body()?.let { responseBody ->
|
||||
if (responseBody.code == 0) {
|
||||
responseBody.result?.let { result ->
|
||||
callback.onSuccess(result)
|
||||
} ?: let {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} else {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} ?: let {
|
||||
callback.onError("网络异常")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(
|
||||
call: Call<BaseResponse<ArrayList<TrajectorySiteInfo>>>,
|
||||
t: Throwable
|
||||
) {
|
||||
Log.e(TAG, "网络异常:")
|
||||
scope.launch { callback.onError("网络异常") }
|
||||
}
|
||||
})
|
||||
}
|
||||
coroutineScopeMap[scope] = newJob
|
||||
|
||||
scope.coroutineContext[Job]?.invokeOnCompletion {
|
||||
coroutineScopeMap.remove(scope)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 Bus 线路对应的轨迹
|
||||
*/
|
||||
fun queryBusTrajectoryInfo(
|
||||
scope: CoroutineScope,
|
||||
reqBody: TrajectoryInfoReq,
|
||||
callback: NetworkCallback<TrajectoryInfo>
|
||||
) {
|
||||
|
||||
val call = getNetWorkApi().queryBusTrajectoryInfo(reqBody)
|
||||
|
||||
coroutineScopeMap[scope]?.cancel()
|
||||
val newJob = scope.async {
|
||||
call.enqueue(object : Callback<BaseResponse<TrajectoryInfo>> {
|
||||
override fun onResponse(
|
||||
call: Call<BaseResponse<TrajectoryInfo>>,
|
||||
response: Response<BaseResponse<TrajectoryInfo>>
|
||||
) {
|
||||
Log.d(TAG, "查询 Bus 有轨迹的QA线路列表:" + response.body().toString())
|
||||
scope.launch {
|
||||
response.body()?.let { responseBody ->
|
||||
if (responseBody.code == 0) {
|
||||
responseBody.result?.let { result ->
|
||||
callback.onSuccess(result)
|
||||
} ?: let {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} else {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} ?: let {
|
||||
callback.onError("网络异常")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(
|
||||
call: Call<BaseResponse<TrajectoryInfo>>,
|
||||
t: Throwable
|
||||
) {
|
||||
Log.e(TAG, "网络异常:")
|
||||
scope.launch { callback.onError("网络异常") }
|
||||
}
|
||||
})
|
||||
}
|
||||
coroutineScopeMap[scope] = newJob
|
||||
|
||||
scope.coroutineContext[Job]?.invokeOnCompletion {
|
||||
coroutineScopeMap.remove(scope)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 Taxi 线路对应的轨迹
|
||||
*/
|
||||
fun queryTaxiTrajectoryInfo(
|
||||
scope: CoroutineScope,
|
||||
reqBody: TrajectoryInfoReq,
|
||||
callback: NetworkCallback<TrajectoryInfo>
|
||||
) {
|
||||
val call = getNetWorkApi().queryTaxiTrajectoryInfo(reqBody)
|
||||
|
||||
coroutineScopeMap[scope]?.cancel()
|
||||
val newJob = scope.async {
|
||||
call.enqueue(object : Callback<BaseResponse<TrajectoryInfo>> {
|
||||
override fun onResponse(
|
||||
call: Call<BaseResponse<TrajectoryInfo>>,
|
||||
response: Response<BaseResponse<TrajectoryInfo>>
|
||||
) {
|
||||
Log.d(TAG, "查询 Taxi 有轨迹的QA线路列表:" + response.body().toString())
|
||||
response.body()?.let { responseBody ->
|
||||
if (responseBody.code == 0) {
|
||||
responseBody.result?.let { result ->
|
||||
callback.onSuccess(result)
|
||||
} ?: let {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} else {
|
||||
callback.onError("msg=${responseBody.msg},code=${responseBody.code}")
|
||||
}
|
||||
} ?: let {
|
||||
callback.onError("网络异常")
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFailure(
|
||||
call: Call<BaseResponse<TrajectoryInfo>>,
|
||||
t: Throwable
|
||||
) {
|
||||
Log.e(TAG, "网络异常:")
|
||||
scope.launch { callback.onError("网络异常") }
|
||||
}
|
||||
})
|
||||
}
|
||||
coroutineScopeMap[scope] = newJob
|
||||
|
||||
scope.coroutineContext[Job]?.invokeOnCompletion {
|
||||
coroutineScopeMap.remove(scope)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.module.common.net.mis.trajectory.net
|
||||
|
||||
import com.mogo.eagle.core.data.BaseResponse
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfoReq
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryLisReq
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryListInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectorySiteInfo
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.*
|
||||
|
||||
interface TrajectoryApi {
|
||||
|
||||
/**
|
||||
* 查询 Bus 有轨迹的QA线路列表
|
||||
* @param deviceId deviceId
|
||||
*/
|
||||
@POST("/eagleEye-mis/line/qa/bus/list")
|
||||
fun queryBusTrajectoryList(@Body reqBody: TrajectoryLisReq): Call<BaseResponse<ArrayList<TrajectoryListInfo>>>
|
||||
|
||||
/**
|
||||
* 查询 Taxi 有轨迹的QA线路列表
|
||||
* @param deviceId deviceId
|
||||
*/
|
||||
@POST("/eagleEye-mis/line/qa/taxi/list")
|
||||
fun queryTaxiTrajectoryList(@Body reqBody: TrajectoryLisReq): Call<BaseResponse<ArrayList<TrajectoryListInfo>>>
|
||||
|
||||
/**
|
||||
* 查询 Bus 线路对应的站点
|
||||
* @param lineId 线路ID
|
||||
*/
|
||||
@GET("/eagleEye-mis/line/query/bus/site")
|
||||
fun queryBusSiteList(@Query("lineId") lineId: Int): Call<BaseResponse<ArrayList<TrajectorySiteInfo>>>
|
||||
|
||||
/**
|
||||
* 查询 Taxi 线路对应的站点
|
||||
* @param lineId 线路ID
|
||||
*/
|
||||
@GET("/eagleEye-mis/line/query/taxi/site")
|
||||
fun queryTaxiSiteList(@Query("lineId") lineId: Int): Call<BaseResponse<ArrayList<TrajectorySiteInfo>>>
|
||||
|
||||
|
||||
/**
|
||||
* 查询 Bus 线路对应的轨迹
|
||||
*/
|
||||
@POST("/eagleEye-mis/line/query/bus/contrail")
|
||||
fun queryBusTrajectoryInfo(@Body reqBody: TrajectoryInfoReq): Call<BaseResponse<TrajectoryInfo>>
|
||||
|
||||
|
||||
/**
|
||||
* 查询 Taxi 线路对应的轨迹
|
||||
*/
|
||||
@POST("/eagleEye-mis/line/query/taxi/contrail")
|
||||
fun queryTaxiTrajectoryInfo(@Body reqBody: TrajectoryInfoReq): Call<BaseResponse<TrajectoryInfo>>
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,741 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.ui.views
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import android.widget.ToggleButton
|
||||
import androidx.appcompat.widget.AppCompatEditText
|
||||
import androidx.appcompat.widget.AppCompatTextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import androidx.lifecycle.LifecycleRegistry
|
||||
import androidx.lifecycle.Observer
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import chassis.Chassis
|
||||
import chassis.VehicleStateOuterClass
|
||||
import com.mogo.eagle.core.data.deva.report.ReportEntity
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.R
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrackContrail
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryInfoReq
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectoryListInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.TrajectorySiteInfo
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.VehicleConfigData
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.bean.VehicleType
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.common.coroutines.FlowBus
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.dialog.SelectAutopilotLineDialog
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.dialog.adapter.ConsoleAdapter
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.net.NetworkCallback
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.net.TrajectoryApiClient
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.widgets.ros.TelematicsSubscriberEventKey
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.widgets.ros.TopicSubscriberEventKey
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import java.util.LinkedList
|
||||
|
||||
class CheckAutopilotView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), LifecycleOwner {
|
||||
|
||||
companion object {
|
||||
const val TAG = "CheckAutopilotView"
|
||||
}
|
||||
|
||||
|
||||
// private val scopeUploadReportInfo = CoroutineScope(Dispatchers.Main)
|
||||
//
|
||||
// private val mLifecycleRegistry = LifecycleRegistry(this)
|
||||
// private var reportMsgInfoSubscriber: CommSubscriber<BinaryData, MogoReportMsg.MogoReportMessage>? =
|
||||
// null
|
||||
// private var reportMsgErrorSubscriber: CommSubscriber<BinaryData, MogoReportMsg.MogoReportMessage>? =
|
||||
// null
|
||||
//
|
||||
// // 当前选择的自动驾驶路线信息
|
||||
// var mTrajectoryListInfo: TrajectoryListInfo? = null
|
||||
// var mTrajectorySiteInfo: List<TrajectorySiteInfo>? = null
|
||||
// var mTrajectoryInfo: TrajectoryInfo? = null
|
||||
//
|
||||
// private var selectAutopilotLineDialog: SelectAutopilotLineDialog? = null
|
||||
// private var mActivity: Activity? = null
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 传给自动驾驶
|
||||
// * 1、先下载轨迹信息
|
||||
// * @see TelematicsControlApi.sendTrajectoryDownloadReq
|
||||
// * 2、再启动自动驾驶
|
||||
// * @see TelematicsControlApi.requestEnterAutoPilot
|
||||
// */
|
||||
// val mTrajectoryLine = MessagePad.Line.newBuilder()
|
||||
//
|
||||
// private val consoleAdapter =
|
||||
// ConsoleAdapter()//控制台适配器
|
||||
// private val consoleList = LinkedList<ReportEntity>()
|
||||
//
|
||||
// private var trajectoryListInfo: TrajectoryListInfo? = null
|
||||
//
|
||||
// private var currentAutopilotStatus: Int = 0 //自动驾驶状态 0代表不可自动驾驶,1代表可自动驾驶,2代表自动驾驶中,7:平行驾驶中
|
||||
//
|
||||
// @Volatile
|
||||
// private var speedLimit: Int = 1
|
||||
//
|
||||
// //Warning
|
||||
// // 自动驾驶效果受影响:
|
||||
// // 自动驾驶部分功能受严重影响,演示模式可以考虑强行启动,非演示模式下建议停止自动驾驶,联系人员排查问题。
|
||||
// //例如定位偏移,camera无数据,算法非常严重的丢帧,属于自动驾驶可以启动,但是效果受影响。
|
||||
// private val RESULT_AUTOPILOT_INFERIOR = "RESULT_AUTOPILOT_INFERIOR"
|
||||
//
|
||||
// // 存在不确定因素
|
||||
// // 一般为过渡状态,存在不确定因素,有可能对自动驾驶有微弱影响,需要在pad端显示为黄色告警。
|
||||
// //如果偶尔上报该result可忽略,如果频繁上报需联系人员进行排查。 目前仅有RTK无法确认状态事件
|
||||
// private val RESULT_SHOW_WARNING = "RESULT_SHOW_WARNING"
|
||||
//
|
||||
// // 远程驾驶效果受影响
|
||||
// // 远程驾驶部分功能受影响。例如网络高延迟
|
||||
// private val RESULT_REMOTEPILOT_INFERIOR = "RESULT_REMOTEPILOT_INFERIOR"
|
||||
//
|
||||
// //Error
|
||||
// // 无法启动自动驾驶
|
||||
// private val RESULT_AUTOPILOT_DISABLE = "RESULT_AUTOPILOT_DISABLE"
|
||||
//
|
||||
// // 自动驾驶系统启动失败
|
||||
// // 自动驾驶系统启动过程中出错,pad可能无法连接,云端监控可能无法上报
|
||||
// private val RESULT_AUTOPILOT_SYSTEM_UNSTARTED = "RESULT_AUTOPILOT_SYSTEM_UNSTARTED"
|
||||
//
|
||||
// // 自动驾驶效果受影响
|
||||
// //自动驾驶部分功能受严重影响,演示模式可以考虑强行启动,非演示模式下建议停止自动驾驶,联系人员排查问题。
|
||||
// //例如定位偏移,camera无数据,算法非常严重的丢帧,属于自动驾驶可以启动,但是效果受影响。
|
||||
// private val RESULT_REMOTEPILOT_DISABLE = "RESULT_REMOTEPILOT_DISABLE"
|
||||
//
|
||||
// /**
|
||||
// * 获取控制台上报数据列表
|
||||
// */
|
||||
// fun getConsoleList(): List<com.mogo.eagle.core.data.deva.report.ReportEntity> {
|
||||
// return consoleList
|
||||
// }
|
||||
//
|
||||
// fun getTrajectoryListInfo(): TrajectoryListInfo? {
|
||||
// return trajectoryListInfo
|
||||
// }
|
||||
//
|
||||
// fun getTrackContrail(): TrackContrail? {
|
||||
// return mTrajectoryInfo?.trackContrail
|
||||
// }
|
||||
//
|
||||
// fun setActivity(activity: Activity) {
|
||||
// mActivity = activity
|
||||
// }
|
||||
//
|
||||
// // 订阅工控机日志
|
||||
// private val consoleObserver: Observer<MogoReportMsg.MogoReportMessage> =
|
||||
// Observer { mogoReportMessage: MogoReportMsg.MogoReportMessage ->
|
||||
// if (consoleList.size > 1000) {
|
||||
// consoleList.removeLast()
|
||||
// }
|
||||
// if (mogoReportMessage.resultList.contains(RESULT_AUTOPILOT_INFERIOR)
|
||||
// || mogoReportMessage.resultList.contains(RESULT_SHOW_WARNING)
|
||||
// || mogoReportMessage.resultList.contains(RESULT_REMOTEPILOT_INFERIOR)
|
||||
// || mogoReportMessage.resultList.contains(RESULT_AUTOPILOT_DISABLE)
|
||||
// || mogoReportMessage.resultList.contains(RESULT_AUTOPILOT_SYSTEM_UNSTARTED)
|
||||
// || mogoReportMessage.resultList.contains(RESULT_REMOTEPILOT_DISABLE)
|
||||
// ) {
|
||||
// // 处理底盘超时
|
||||
//// if (
|
||||
//// !mogoReportMessage.resultList.equals(RESULT_AUTOPILOT_DISABLE)
|
||||
//// || !mogoReportMessage.resultList.equals(RESULT_REMOTEPILOT_INFERIOR)
|
||||
//// || !mogoReportMessage.resultList.equals(RESULT_AUTOPILOT_INFERIOR)
|
||||
//// ) {
|
||||
//// btnControlAutoPilot.isChecked = false
|
||||
//// Log.e(TAG, "进入自动驾驶--失败")
|
||||
//// }
|
||||
//
|
||||
// consoleList.addFirst(
|
||||
// ReportEntity(
|
||||
// TimeUtils.getNowString(),
|
||||
// mogoReportMessage.code,
|
||||
// mogoReportMessage.msg
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
// if (consoleList.size > 0) {
|
||||
// consoleAdapter.setData(consoleList)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //订阅到站
|
||||
// private val arrivalObserver: Observer<MessagePad.ArrivalNotification> = Observer {
|
||||
// it.let {
|
||||
// Log.i("arrivalObserver", "CheckAuto页面收到到站回调")
|
||||
// Log.i("arrivalObserver", "latitude=" + it.endLocation.latitude)
|
||||
// Log.i("arrivalObserver", "longitude=" + it.endLocation.longitude)
|
||||
// //取消自动驾驶
|
||||
// CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
// //吐司提示
|
||||
// ToastUtils.showShort("您已到达站点")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //订阅工控机日志监控
|
||||
// private val reportObserver: Observer<MogoReportMsg.MogoReportMessage> = Observer {
|
||||
// it.let {
|
||||
// //掉自驾
|
||||
// when (it.code) {
|
||||
// "EMAP_EXIT_AUTOPILOT_FOR_PLANNING",//因planning掉帧强退自动驾驶
|
||||
// "EMAP_EXIT_AUTOPILOT_FOR_LOCATION",//因location掉帧强退自动驾驶
|
||||
// "EMAP_EXIT_AUTOPILOT_FOR_CHASSIS",//因底盘消息掉帧强退自动驾驶
|
||||
// "EXIT_AUTOPILOT_FOR_DISTANCE",//因planning起点距离当前过远强退自动驾驶
|
||||
// "EXIT_AUTOPILOT_FOR_BRAKE",//制动踏板干预而强退自动驾驶
|
||||
// "EXIT_AUTOPILOT_FOR_ACCEL",//加速踏板干预而强退自动驾驶
|
||||
// "EXIT_AUTOPILOT_FOR_STEER",//方向盘干预而强退自动驾驶
|
||||
// "EXIT_AUTOPILOT_FOR_GEAR_SWITCH",//档位切换干预而强退自动驾驶
|
||||
// "EMAP_EXIT_AUTOPILOT_FOR_CHASSIS_NO_RESPONSE",//底盘不响应请求而强退自动驾驶
|
||||
// "EMAP_EXIT_AUTOPILOT_FOR_CHASSIS_UNKNOWN",//底盘退出原因未知而强退自动驾驶
|
||||
// "IRECORDER_TASK_AUTO"//自动录包任务创建
|
||||
// -> {
|
||||
// //当司机或外界原因导致自动驾驶退出,需要在页面将状态同步显示出来,并将按钮设置为「启动自动驾驶」
|
||||
// ThreadUtils.runOnUiThread {
|
||||
// ToastUtils.showShort("自动驾驶退出")
|
||||
// btnControlAutoPilot.isEnabled = true
|
||||
// btnControlAutoPilot.isChecked = false
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //自动驾驶状态
|
||||
// private val autopilotStateObserver: Observer<MessagePad.AutopilotState> = Observer {
|
||||
// it.let {
|
||||
// if (currentAutopilotStatus != it.state) {
|
||||
// currentAutopilotStatus = it.state
|
||||
// ThreadUtils.runOnUiThread {
|
||||
// when (it.state) {
|
||||
// 0 -> {
|
||||
// btnAutoPilotStatus.text = "不可自驾"
|
||||
// }
|
||||
//
|
||||
// 1 -> {
|
||||
// btnAutoPilotStatus.text = "可自动驾驶"
|
||||
// }
|
||||
//
|
||||
// 2 -> {
|
||||
// btnAutoPilotStatus.text = "自动驾驶中"
|
||||
// }
|
||||
//
|
||||
// 7 -> {
|
||||
// btnAutoPilotStatus.text = "平行驾驶中"
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //车机基础信息应答
|
||||
// private val carConfigObserver: Observer<MessagePad.CarConfigResp> = Observer {
|
||||
// it.let {
|
||||
// ThreadUtils.runOnUiThread {
|
||||
// speedLimit = (it.speedLimit * 3.6).toInt()
|
||||
// etInputSpeed.setText(speedLimit.toString())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //自车状态(底盘),车灯、转向灯等
|
||||
// private val vehicleStateObserver: Observer<VehicleStateOuterClass.VehicleState> = Observer {
|
||||
// ThreadUtils.runOnUiThread {
|
||||
// when (it.gear) {
|
||||
// Chassis.GearPosition.GEAR_P -> {
|
||||
// tvGearP.setTextColor(ContextCompat.getColor(context, R.color.white))
|
||||
// tvGearR.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearN.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearD.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// Chassis.GearPosition.GEAR_R -> {
|
||||
// tvGearP.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearR.setTextColor(ContextCompat.getColor(context, R.color.white))
|
||||
// tvGearN.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearD.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// Chassis.GearPosition.GEAR_N -> {
|
||||
// tvGearP.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearR.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearN.setTextColor(ContextCompat.getColor(context, R.color.white))
|
||||
// tvGearD.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// Chassis.GearPosition.GEAR_D -> {
|
||||
// tvGearP.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearR.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearN.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearD.setTextColor(ContextCompat.getColor(context, R.color.white))
|
||||
// }
|
||||
//
|
||||
// else -> {
|
||||
// tvGearP.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearR.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearN.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// tvGearD.setTextColor(
|
||||
// ContextCompat.getColor(
|
||||
// context,
|
||||
// R.color.p_default_txt_color
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// init {
|
||||
// LayoutInflater.from(context).inflate(R.layout.view_check_autopilot, this, true)
|
||||
// initView(context, attrs!!)
|
||||
// mLifecycleRegistry.currentState = Lifecycle.State.CREATED
|
||||
// }
|
||||
//
|
||||
// private lateinit var tvAutoDriveLineSelect: TextView
|
||||
// private lateinit var tvSpeedTitle: TextView
|
||||
// private lateinit var ivSpeedReduce: ImageView
|
||||
// private lateinit var etInputSpeed: AppCompatEditText
|
||||
// private lateinit var ivSpeedAdd: ImageView
|
||||
// private lateinit var tvSureModify: AppCompatTextView
|
||||
// private lateinit var tvGearP: TextView
|
||||
// private lateinit var tvGearR: TextView
|
||||
// private lateinit var tvGearN: TextView
|
||||
// private lateinit var tvGearD: TextView
|
||||
// private lateinit var btnAutoPilotStatus: Button
|
||||
// private lateinit var btnControlAutoPilot: ToggleButton
|
||||
// private lateinit var rvReportConsole: RecyclerView
|
||||
//
|
||||
//
|
||||
// private fun initView(context: Context, attrs: AttributeSet) {
|
||||
// tvAutoDriveLineSelect = findViewById(R.id.tvAutoDriveLineSelect)
|
||||
// tvSpeedTitle = findViewById(R.id.tvSpeedTitle)
|
||||
// ivSpeedReduce = findViewById(R.id.ivSpeedReduce)
|
||||
// etInputSpeed = findViewById(R.id.etInputSpeed)
|
||||
// ivSpeedAdd = findViewById(R.id.ivSpeedAdd)
|
||||
// tvSureModify = findViewById(R.id.tvSureModify)
|
||||
// tvGearP = findViewById(R.id.tvGearP)
|
||||
// tvGearR = findViewById(R.id.tvGearR)
|
||||
// tvGearN = findViewById(R.id.tvGearN)
|
||||
// tvGearD = findViewById(R.id.tvGearD)
|
||||
// btnAutoPilotStatus = findViewById(R.id.btnAutoPilotStatus)
|
||||
// btnControlAutoPilot = findViewById(R.id.btnControlAutoPilot)
|
||||
// rvReportConsole = findViewById(R.id.rvReportConsole)
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// initSpeedView()
|
||||
// consoleAdapter.setData(consoleList)
|
||||
// rvReportConsole.adapter = consoleAdapter
|
||||
// initAutopilotLineData()
|
||||
//
|
||||
// // 启动自动驾驶
|
||||
// btnControlAutoPilot.setOnClickListener {
|
||||
// if (currentAutopilotStatus != 0) {
|
||||
// if (currentAutopilotStatus != 2) {
|
||||
// mTrajectoryListInfo?.let { trajectoryListInfo ->
|
||||
// mTrajectorySiteInfo?.let { trajectorySiteInfo ->
|
||||
// if (trajectorySiteInfo.isEmpty()) {
|
||||
// if (btnControlAutoPilot.isChecked) {
|
||||
// ToastUtils.showShort("该路线缺少站点信息")
|
||||
// }
|
||||
// btnControlAutoPilot.isChecked = false
|
||||
// return@setOnClickListener
|
||||
// }
|
||||
// val routeInfo = MessagePad.RouteInfo.newBuilder()
|
||||
// routeInfo.routeID = trajectoryListInfo.lineId
|
||||
// routeInfo.routeName = trajectoryListInfo.lineName
|
||||
//
|
||||
// routeInfo.vehicleType =
|
||||
// if (VehicleConfigData.getCarType() == VehicleType.TAXI) {
|
||||
// 9
|
||||
// } else {
|
||||
// 10
|
||||
// }
|
||||
// routeInfo.isSpeakVoice = false
|
||||
//
|
||||
// val startSite = trajectorySiteInfo[0]
|
||||
// val endSite = trajectorySiteInfo[trajectorySiteInfo.size - 1]
|
||||
//
|
||||
// routeInfo.startName =
|
||||
// PinYinUtil.getPinYinHeadChar(startSite.name) // 起点名称拼音首字母大写:科学城B区2号门(KXCBQ2HM)
|
||||
// routeInfo.endName =
|
||||
// PinYinUtil.getPinYinHeadChar(endSite.name) // 终点名称拼音首字母大写:科学城C区三号门(KXCCQSHM)
|
||||
//
|
||||
// val startLoc = routeInfo.startLocationBuilder
|
||||
// startLoc.latitude = startSite.wgs84Lat
|
||||
// startLoc.longitude = startSite.wgs84Lon
|
||||
//
|
||||
// val endLoc = routeInfo.endLocationBuilder
|
||||
// endLoc.latitude = endSite.wgs84Lat
|
||||
// endLoc.longitude = endSite.wgs84Lon
|
||||
//
|
||||
// routeInfo.startLocation = startLoc.build()
|
||||
// routeInfo.endLocation = endLoc.build()
|
||||
//
|
||||
// //传入站点列表
|
||||
// for(site in trajectorySiteInfo){
|
||||
// val locBuilder = MessagePad.Location.newBuilder()
|
||||
// locBuilder.latitude = site.wgs84Lat
|
||||
// locBuilder.longitude = site.wgs84Lon
|
||||
// routeInfo.addWayPoints(locBuilder.build())
|
||||
// }
|
||||
//
|
||||
// // 初始化选择的自动驾驶路线信息
|
||||
// routeInfo.line = initTrajectoryLine(trajectoryListInfo)
|
||||
//
|
||||
// // 模拟强制进入
|
||||
// //if (TelematicsControlApi.instance.requestEnterAutoPilotSimulate(true)) {
|
||||
// // 启动自动驾驶
|
||||
// if (TelematicsControlApi.instance.requestEnterAutoPilot(routeInfo.build())) {
|
||||
// btnControlAutoPilot.isChecked = true
|
||||
// Log.d(TAG, "自动驾驶命令下发成功")
|
||||
// ToastUtils.showShort("自动驾驶命令下发成功")
|
||||
// } else {
|
||||
// btnControlAutoPilot.isChecked = false
|
||||
// Log.e(TAG, "自动驾驶命令下发失败")
|
||||
// ToastUtils.showShort("自动驾驶命令下发失败")
|
||||
// }
|
||||
// } ?: let {
|
||||
// btnControlAutoPilot.isChecked = false
|
||||
// Log.e(TAG, "进入自动驾驶--失败")
|
||||
// Log.e(TAG, "站点信息异常,请选择要测试的驾驶路线!!!")
|
||||
// ToastUtils.showShort("进入自动驾驶--失败")
|
||||
// }
|
||||
// } ?: let {
|
||||
// btnControlAutoPilot.isChecked = false
|
||||
// Log.e(TAG, "进入自动驾驶--失败")
|
||||
// Log.e(TAG, "未选择自动驾驶路线,请选择要测试的驾驶路线!!!")
|
||||
// ToastUtils.showShort("进入自动驾驶--失败")
|
||||
// }
|
||||
// } else {
|
||||
// // 模拟强制退出
|
||||
// //if (TelematicsControlApi.instance.requestEnterAutoPilotSimulate(false)) {
|
||||
// // 正常流程退出自动驾驶
|
||||
// CallerAutoPilotControlManager.cancelAutoPilot()
|
||||
// }
|
||||
// } else {
|
||||
// btnControlAutoPilot.isChecked = false
|
||||
// ToastUtils.showShort("车辆未就绪,请稍后再试")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 自动驾驶车速设置
|
||||
// */
|
||||
// //TODO
|
||||
//
|
||||
// /**
|
||||
// * 初始化轨迹信息
|
||||
// */
|
||||
// private fun initTrajectoryLine(trajectoryListInfo: TrajectoryListInfo): MessagePad.Line {
|
||||
// // 给自动驾驶用于进行循迹路线加载
|
||||
// mTrajectoryInfo?.trackContrail?.let {
|
||||
// mTrajectoryLine.lineId = trajectoryListInfo.lineId.toLong()
|
||||
// mTrajectoryLine.lineName =trajectoryListInfo.lineName
|
||||
// mTrajectoryLine.trajMd5 = it.csvFileMd5
|
||||
// mTrajectoryLine.trajUrl = it.csvFileUrl
|
||||
// mTrajectoryLine.stopMd5 = it.txtFileMd5
|
||||
// mTrajectoryLine.stopUrl = it.txtFileUrl
|
||||
// mTrajectoryLine.timestamp = it.contrailSaveTime
|
||||
// mTrajectoryLine.vehicleModel =
|
||||
// VehicleConfigData.getCarBrand() + VehicleConfigData.getCarModel()
|
||||
// } ?: let {
|
||||
// btnControlAutoPilot.isChecked = false
|
||||
// Log.e(TAG, "循迹路线未配置! 请登录运营管理平台配置!")
|
||||
// ToastUtils.showShort("循迹路线未配置!请登录运营管理平台配置!")
|
||||
// }
|
||||
// mTrajectoryInfo?.dbqpContrail?.let {
|
||||
// mTrajectoryLine.trajUrlDpqp = it.csvFileUrl
|
||||
// mTrajectoryLine.trajMd5Dpqp = it.csvFileMd5
|
||||
// mTrajectoryLine.stopUrlDpqp = it.txtFileUrl
|
||||
// mTrajectoryLine.stopMd5Dpqp = it.txtFileMd5
|
||||
// mTrajectoryLine.timestampDpqp = it.contrailSaveTime
|
||||
// } ?: let {
|
||||
// Log.e(TAG, "dbqp路线未配置!请登录运营管理平台配置!")
|
||||
// //ToastUtils.show("dbqp路线未配置!请登录运营管理平台配置!")
|
||||
// }
|
||||
//
|
||||
// return mTrajectoryLine.build()
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 初始化路线选择器
|
||||
// */
|
||||
// private fun initAutopilotLineData() {
|
||||
// // 循迹路线选择
|
||||
// tvAutoDriveLineSelect.setOnClickListener {
|
||||
// //弹出路线选择弹窗
|
||||
// if (selectAutopilotLineDialog == null) {
|
||||
// selectAutopilotLineDialog = SelectAutopilotLineDialog(context)
|
||||
// }
|
||||
// mActivity?.let { activity ->
|
||||
// selectAutopilotLineDialog?.setListener(object :
|
||||
// SelectAutopilotLineDialog.ClickListener {
|
||||
// override fun onClick(info: TrajectoryListInfo) {
|
||||
// Log.d(TAG, "选中路线:${info}")
|
||||
// info.let {
|
||||
// mTrajectoryListInfo = it
|
||||
// tvAutoDriveLineSelect.text = it.lineName
|
||||
// checkAutoLine(it)
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
// selectAutopilotLineDialog?.showSelectLineDialog(activity)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 调用接口获取选中的路线信息
|
||||
// */
|
||||
// private fun checkAutoLine(trajectoryListInfo: TrajectoryListInfo) {
|
||||
// val trajectoryInfoReq = TrajectoryInfoReq(
|
||||
// VehicleConfigData.getCarBrand(),
|
||||
// VehicleConfigData.getCarModel(),
|
||||
// trajectoryListInfo.lineId
|
||||
// )
|
||||
// Log.d(
|
||||
// TAG,
|
||||
// "调用接口获取选中的路线信息 checkAutoLine,trajectoryInfoReq:${trajectoryInfoReq}"
|
||||
// )
|
||||
// // 处理Taxi
|
||||
// // 处理BUS包含:JV、KW、FT、SW
|
||||
// TrajectoryApiClient.querySiteList(
|
||||
// this,
|
||||
// VehicleConfigData.getCarType().name,
|
||||
// trajectoryListInfo.lineId,
|
||||
// object : NetworkCallback<ArrayList<TrajectorySiteInfo>> {
|
||||
// override fun onSuccess(data: ArrayList<TrajectorySiteInfo>) {
|
||||
// mTrajectorySiteInfo = data
|
||||
// if (data.size > 0) {
|
||||
// btnControlAutoPilot.isEnabled = true
|
||||
// } else {
|
||||
// btnControlAutoPilot.isEnabled = false
|
||||
// ToastUtils.showShort("该路线缺少站点信息")
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onError(msg: String) {
|
||||
// Log.e(
|
||||
// TAG,
|
||||
// "获取 ${VehicleConfigData.getCarType().name} 站点详情异常,异常原因:网络异常"
|
||||
// )
|
||||
// ToastUtils.showShort("获取 ${VehicleConfigData.getCarType().name} 站点详情异常,异常原因:网络异常")
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// TrajectoryApiClient.queryTrajectoryInfo(
|
||||
// this,
|
||||
// VehicleConfigData.getCarType().name,
|
||||
// trajectoryInfoReq,
|
||||
// object : NetworkCallback<TrajectoryInfo> {
|
||||
// override fun onSuccess(data: TrajectoryInfo) {
|
||||
// mTrajectoryInfo = data
|
||||
//
|
||||
// // 先发给自动驾驶下载路线
|
||||
// TelematicsControlApi.instance.sendTrajectoryDownloadReq(
|
||||
// initTrajectoryLine(
|
||||
// trajectoryListInfo
|
||||
// )
|
||||
// )
|
||||
// }
|
||||
//
|
||||
// override fun onError(msg: String) {
|
||||
// Log.e(
|
||||
// TAG,
|
||||
// "查询 ${VehicleConfigData.getCarType().name} 线路对应的轨迹 异常,异常原因:网络异常"
|
||||
// )
|
||||
// ToastUtils.showShort("查询 ${VehicleConfigData.getCarType().name} 线路对应的轨迹 异常,异常原因:网络异常")
|
||||
// }
|
||||
// }
|
||||
// )
|
||||
// }
|
||||
//
|
||||
//
|
||||
// override fun onAttachedToWindow() {
|
||||
// super.onAttachedToWindow()
|
||||
// mLifecycleRegistry.currentState = Lifecycle.State.STARTED
|
||||
// postDelayed({
|
||||
// //订阅工控机异常上报
|
||||
// reportMsgInfoSubscriber =
|
||||
// CommSubscriber<BinaryData, MogoReportMsg.MogoReportMessage>(
|
||||
// ConfigFactory.getInstance().topicConfig.autopilotInfoReportMsgInfo.topicPath,
|
||||
// ConfigFactory.getInstance().topicConfig.autopilotInfoReportMsgInfo.msgType,
|
||||
// MogoReportMsg.MogoReportMessage.parser(),
|
||||
// TopicSubscriberEventKey.REPORT_MSG_SUBSCRIBER
|
||||
// )
|
||||
// TopicSubscriberServiceManager.instance.addTopicSubscriber(
|
||||
// reportMsgInfoSubscriber!!.getTopicPath(),
|
||||
// reportMsgInfoSubscriber!!
|
||||
// )
|
||||
//
|
||||
// reportMsgErrorSubscriber =
|
||||
// CommSubscriber<BinaryData, MogoReportMsg.MogoReportMessage>(
|
||||
// ConfigFactory.getInstance().topicConfig.autopilotInfoReportMsgError.topicPath,
|
||||
// ConfigFactory.getInstance().topicConfig.autopilotInfoReportMsgError.msgType,
|
||||
// MogoReportMsg.MogoReportMessage.parser(),
|
||||
// TopicSubscriberEventKey.REPORT_MSG_SUBSCRIBER
|
||||
// )
|
||||
// TopicSubscriberServiceManager.instance.addTopicSubscriber(
|
||||
// reportMsgErrorSubscriber!!.getTopicPath(),
|
||||
// reportMsgErrorSubscriber!!
|
||||
// )
|
||||
// }, 2000)
|
||||
//
|
||||
// // 订阅数据
|
||||
// FlowBus.with<MogoReportMsg.MogoReportMessage>(TopicSubscriberEventKey.REPORT_MSG_SUBSCRIBER)
|
||||
// .register(this) {
|
||||
// consoleObserver.onChanged(it)
|
||||
// }
|
||||
//
|
||||
// //订阅到站提醒
|
||||
// FlowBus.with<MessagePad.ArrivalNotification>(TelematicsSubscriberEventKey.Subscribe_Arrival_Notification)
|
||||
// .register(this) {
|
||||
// arrivalObserver.onChanged(it)
|
||||
// }
|
||||
//
|
||||
// //订阅工控机日志监控
|
||||
// FlowBus.with<MogoReportMsg.MogoReportMessage>(TelematicsSubscriberEventKey.Subscribe_Mogo_Report_Message)
|
||||
// .register(this) {
|
||||
// reportObserver.onChanged(it)
|
||||
// }
|
||||
//
|
||||
// //订阅自动驾驶状态
|
||||
// FlowBus.with<MessagePad.AutopilotState>(TelematicsSubscriberEventKey.Subscribe_Autopilot_State)
|
||||
// .register(this) {
|
||||
// autopilotStateObserver.onChanged(it)
|
||||
// }
|
||||
//
|
||||
// //订阅车机基础信息
|
||||
// FlowBus.withStick<MessagePad.CarConfigResp>(TelematicsSubscriberEventKey.Subscribe_CarConfig_Resp)
|
||||
// .register(this) {
|
||||
// carConfigObserver.onChanged(it)
|
||||
// }
|
||||
//
|
||||
// //订阅自车状态(底盘),车灯、转向灯等
|
||||
// FlowBus.with<VehicleStateOuterClass.VehicleState>(TelematicsSubscriberEventKey.Subscribe_Vehicle_State)
|
||||
// .register(this) {
|
||||
// vehicleStateObserver.onChanged(it)
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// override fun onDetachedFromWindow() {
|
||||
// super.onDetachedFromWindow()
|
||||
// scopeUploadReportInfo.cancel()
|
||||
//
|
||||
// mLifecycleRegistry.currentState = Lifecycle.State.DESTROYED
|
||||
//
|
||||
// reportMsgInfoSubscriber?.let {
|
||||
// TopicSubscriberServiceManager.instance.removeTopicSubscriber(
|
||||
// reportMsgInfoSubscriber!!.getTopicPath(),
|
||||
// )
|
||||
// }
|
||||
// reportMsgErrorSubscriber?.let {
|
||||
// TopicSubscriberServiceManager.instance.removeTopicSubscriber(
|
||||
// reportMsgErrorSubscriber!!.getTopicPath(),
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
|
||||
override fun getLifecycle(): Lifecycle {
|
||||
return lifecycle
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.ui.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.zhjt.mogo_core_function_devatools.rviz.R;
|
||||
|
||||
/**
|
||||
* 加载进度View
|
||||
*/
|
||||
public class MoGoLoadingView extends LinearLayout {
|
||||
|
||||
private Context context;
|
||||
private ProgressBar progressBar;
|
||||
private ImageView placeholderMap;
|
||||
private TextView textView;
|
||||
|
||||
public MoGoLoadingView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public MoGoLoadingView(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public MoGoLoadingView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this.context = context;
|
||||
setOrientation(LinearLayout.VERTICAL);
|
||||
setGravity(Gravity.CENTER);
|
||||
|
||||
// 创建ProgressBar
|
||||
progressBar = new ProgressBar(context);
|
||||
addView(progressBar);
|
||||
|
||||
// 创建TextView
|
||||
textView = new TextView(context);
|
||||
textView.setTextSize(30f);
|
||||
textView.setTextColor(getResources().getColor(R.color.white));
|
||||
LayoutParams params = new LayoutParams(
|
||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
params.setMargins(0, 16, 0, 0); // 设置文字的上边距
|
||||
textView.setLayoutParams(params);
|
||||
addView(textView);
|
||||
}
|
||||
|
||||
public void setText(String text) {
|
||||
textView.setText(text);
|
||||
}
|
||||
|
||||
public void show(String text) {
|
||||
setVisibility(VISIBLE);
|
||||
textView.setText(text);
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,280 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.widgets.ros;
|
||||
|
||||
/**
|
||||
* 通过LiveEventBus订阅的消息key
|
||||
*
|
||||
* @author mogoauto
|
||||
*/
|
||||
public interface TelematicsSubscriberEventKey {
|
||||
|
||||
/**
|
||||
* 感知物体
|
||||
*/
|
||||
String Subscribe_Tracked_Objects = "Telematics_Tracked_Objects";
|
||||
|
||||
/**
|
||||
* 工控机日志监控
|
||||
*/
|
||||
String Subscribe_Mogo_Report_Message = "Telematics_Mogo_Report_Message";
|
||||
|
||||
/**
|
||||
* 感知红绿灯
|
||||
*/
|
||||
String Subscribe_Traffic_Lights = "Telematics_TrafficLights";
|
||||
|
||||
/**
|
||||
* 车前引导线
|
||||
*/
|
||||
String Subscribe_Trajectory = "Telematics_Trajectory";
|
||||
|
||||
/**
|
||||
* 他车轨迹预测
|
||||
*/
|
||||
String Subscribe_Prediction_Objects = "Telematics_PredictionObjects";
|
||||
|
||||
/**
|
||||
* 过滤后的点云数据
|
||||
*/
|
||||
String Subscribe_PointCloud = "Telematics_PointCloud";
|
||||
|
||||
/**
|
||||
* planning障碍物
|
||||
*/
|
||||
String Subscribe_Planning_Objects = "Telematics_PlanningObjects";
|
||||
|
||||
/**
|
||||
* 数据采集结果
|
||||
*/
|
||||
String Subscribe_Record_Panel = "Telematics_RecordPanel";
|
||||
|
||||
/**
|
||||
* 报警信息
|
||||
* 暂时保留,目前没有使用
|
||||
*/
|
||||
String Subscribe_Warn = "Telematics_Warn";
|
||||
|
||||
/**
|
||||
* 到站提醒 自动驾驶站点
|
||||
*/
|
||||
String Subscribe_Arrival_Notification = "Telematics_ArrivalNotification";
|
||||
|
||||
String Arrival_Notification = "Arrival_Notification";
|
||||
|
||||
/**
|
||||
* 工控机数据错误
|
||||
*/
|
||||
String Subscribe_Error = "Telematics_Error";
|
||||
|
||||
/**
|
||||
* 车机基础信息应答
|
||||
*/
|
||||
String Subscribe_CarConfig_Resp = "Telematics_CarConfigResp";
|
||||
|
||||
/**
|
||||
* 自动驾驶状态
|
||||
*/
|
||||
String Subscribe_Autopilot_State = "Telematics_AutopilotState";
|
||||
|
||||
/**
|
||||
* 工控机健康状态查询应答
|
||||
*/
|
||||
String Subscribe_System_Status_Info = "Telematics_SystemStatusInfo";
|
||||
|
||||
/**
|
||||
* 自车定位信息
|
||||
*/
|
||||
String Subscribe_Gnss_Info = "Telematics_GnssInfo";
|
||||
|
||||
/**
|
||||
* 自车状态(底盘),车灯等。
|
||||
*/
|
||||
String Subscribe_Vehicle_State = "Telematics_VehicleState";
|
||||
/**
|
||||
* 自车状态(底盘),车灯等。
|
||||
*/
|
||||
String Subscribe_ChassisStates_State = "Telematics_ChassisStates";
|
||||
|
||||
/**
|
||||
* DebugInfo
|
||||
*/
|
||||
String Subscribe_DebugInfo = "Telematics_DebugInfo";
|
||||
|
||||
/**
|
||||
* 自动驾驶路径应答
|
||||
*/
|
||||
String Subscribe_Global_Path_Resp = "Telematics_GlobalPathResp";
|
||||
|
||||
/**
|
||||
* planning决策状态, 透传
|
||||
*/
|
||||
String Subscribe_Planning_Action_Msg = "Telematics_PlanningActionMsg";
|
||||
|
||||
/**
|
||||
* 是否有能力启动自动驾驶
|
||||
*/
|
||||
String Subscribe_Autopilot_Ability = "Telematics_AutopilotAbility";
|
||||
|
||||
/**
|
||||
* 启动自动驾驶状态统计
|
||||
*/
|
||||
String Subscribe_Autopilot_Statistics = "Telematics_AutopilotStatistics";
|
||||
|
||||
/**
|
||||
* 数据采集配置应答
|
||||
*/
|
||||
String Subscribe_Record_Data_Config = "Telematics_RecordDataConfig";
|
||||
|
||||
/**
|
||||
* 启动自动驾驶调用结果数组
|
||||
* enterResult[0]===true-进入自动驾驶,false-未进入自动驾驶
|
||||
* enterResult[1]===具体原因
|
||||
*/
|
||||
String Control_Enter_Autopilot_Result = "Telematics_ControlEnterAutopilotResult";
|
||||
|
||||
/**
|
||||
* 退出自动驾驶调用结果数组
|
||||
* enterResult[0]===true-退出自动驾驶,false-未退出自动驾驶
|
||||
* enterResult[1]===具体原因
|
||||
*/
|
||||
String Control_Out_Autopilot_Result = "Telematics_ControlOutAutopilotResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送红绿灯数据
|
||||
*/
|
||||
String Control_Traffic_Light_Result = "Telematics_ControlTrafficLightResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送红绿灯数据
|
||||
*/
|
||||
String Control_Trajectory_Download_Result = "Telematics_ControlTrajectoryDownloadResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 录制开始Bag包请求
|
||||
*/
|
||||
String Control_Start_Record_Package_Result = "Telematics_ControlStartRecordPackageResult";
|
||||
/**
|
||||
* 向工控机发送 录制结束Bag包请求
|
||||
*/
|
||||
String Control_Stop_Record_Package_Result = "Telematics_ControlStartRecordPackageResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 向左变道 请求
|
||||
*/
|
||||
String Control_Operator_Change_Lane_Left_Result = "Telematics_ControlOperatorChangeLaneLeftResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 向右变道 请求
|
||||
*/
|
||||
String Control_Operator_Change_Lane_Right_Result = "Telematics_ControlOperatorChangeLaneRightResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 设置加速度 请求
|
||||
*/
|
||||
String Control_Operator_Set_Accelerated_Speed_Result = "Telematics_ControlOperatorSetAcceleratedSpeedResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 鸣笛 请求
|
||||
*/
|
||||
String Control_Operator_Set_Horn_Result = "Telematics_ControlOperatorSetHornResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 所有节点重启命令 请求
|
||||
*/
|
||||
String Control_Ipc_Reboot_Result = "Telematics_ControlIpcRebootResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 办公室调试使用,强制开启自动驾驶,将 status,pilotMode,control_pilotMode,强追设置为 1 请求
|
||||
*/
|
||||
String Control_Auto_Pilot_Mode_Result = "Telematics_ControlAutoPilotModeResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 发生行程相关 请求
|
||||
*/
|
||||
String Set_Trip_Info_Result = "Telematics_SetTripInfoResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 设置自动驾驶最大速度 请求
|
||||
*/
|
||||
String Set_Speed_Limit_Result = "Telematics_SetSpeedLimitResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 设置工控机演示模式(美化模式)开启、关闭 请求
|
||||
*/
|
||||
String Set_Demo_Mode_Result = "Telematics_SetDemoModeResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 雨天模式 开启、关闭 请求
|
||||
*/
|
||||
String Set_Rain_Mode_Result = "Telematics_SetRainModeResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 绕障类功能开关 开启、关闭 请求
|
||||
*/
|
||||
String Set_Detouring_Mode_Result = "Telematics_SetDetouringModeResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 主动查询工控机的各topic状态 请求
|
||||
*/
|
||||
String Get_Ros_Topic_Status_Query_Result = "Telematics_GetRosTopicStatusQueryResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 获取数据采集录制模式配置列表 请求
|
||||
*/
|
||||
String Get_Bad_Case_Config_Result = "Telematics_GetBadCaseConfigResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 请求工控机基础配置信息 请求
|
||||
*/
|
||||
String Get_Car_Config_Result = "Telematics_GetCarConfigResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 获取全局路径 请求
|
||||
*/
|
||||
String Get_Global_Path_Result = "Telematics_GetGlobalPathResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 获取协议版本 请求
|
||||
*/
|
||||
String Get_Protocol_Version_Result = "Telematics_GetProtocolVersionResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 获取工控机上报数据result 请求
|
||||
*/
|
||||
String Get_Report_Result_Desc_Result = "Telematics_GetReportResultDescResult";
|
||||
|
||||
/**
|
||||
* 向工控机发送 获取工控机上报数据action 请求
|
||||
*/
|
||||
String Get_Report_Action_Desc_Result = "Telematics_GetReportActionDescResult";
|
||||
|
||||
|
||||
/**
|
||||
* 相机标定检查视频30 1Hz
|
||||
*/
|
||||
String Camera_Calib_Check_Data30 = "Camera_Calib_Check_Data30";
|
||||
/**
|
||||
* 相机标定检查视频60 1Hz
|
||||
*/
|
||||
String Camera_Calib_Check_Data60 = "Camera_Calib_Check_Data60";
|
||||
/**
|
||||
* 相机标定检查视频120前 1Hz
|
||||
*/
|
||||
String Camera_Calib_Check_Data120Front = "Camera_Calib_Check_Data120Front";
|
||||
/**
|
||||
* 相机标定检查视频120后 1Hz
|
||||
*/
|
||||
String Camera_Calib_Check_Data120Back = "Camera_Calib_Check_Data120Back";
|
||||
/**
|
||||
* 相机标定检查视频120左 1Hz
|
||||
*/
|
||||
String Camera_Calib_Check_Data120Left = "Camera_Calib_Check_Data120Left";
|
||||
/**
|
||||
* 相机标定检查视频120右 1Hz
|
||||
*/
|
||||
String Camera_Calib_Check_Data120Right = "Camera_Calib_Check_Data120Right";
|
||||
|
||||
/**
|
||||
*电源盒协议接口
|
||||
*/
|
||||
String Power_Supply_Unit = "Power_Supply_Unit";
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.zhjt.mogo_core_function_devatools.rviz.widgets.ros;
|
||||
|
||||
/**
|
||||
* 通过LiveEventBus订阅的消息key
|
||||
*/
|
||||
public interface TopicSubscriberEventKey {
|
||||
// 红绿灯
|
||||
String HAD_MAP_TRAFFIC_LIGHTS_SUBSCRIBER = "HadMapTrafficLightsSubscriber";
|
||||
// 自车GPS/TRK位置数据
|
||||
String LOCALIZATION_GLOBAL_SUBSCRIBER = "LocalizationGlobalSubscriber";
|
||||
//RTK检测 /sensor/gnss/gps_fix
|
||||
String GPS_FIX_SUBSCRIBER = "GpsFixSubscriber";
|
||||
// 自车底盘信息
|
||||
String LOCALIZATION_ODOMETRY_SUBSCRIBER = "LocalizationOdometrySubscriber";
|
||||
|
||||
// 图像识别
|
||||
String PERCEPTION_OBJECT_DETECTION_IMAGE_SUBSCRIBER = "PerceptionObjectDetectionImageSubscriber";
|
||||
// PB格式的点云数据
|
||||
String PERCEPTION_POINT_CLOUD_PB_SUBSCRIBER = "PerceptionPointCloudPbSubscriber";
|
||||
// 激光雷达+图像标定融合Image数据
|
||||
String SIG_IMAGE_SUBSCRIBER = "SignImageSubscriber";
|
||||
// H264 视频流
|
||||
String SIG_H264_IMAGE_SUBSCRIBER = "SIG_H264_IMAGE_SUBSCRIBER";
|
||||
// 规划控制画的车道线、引导线
|
||||
String PLANNING_CONTROL_SUBSCRIBER = "PlanningControlSubscriber";
|
||||
// ROS数据格式的点云数据
|
||||
String SENSOR_POINT_CLOUD2_SUBSCRIBER = "SensorPointCloud2Subscriber";
|
||||
// 全局地图
|
||||
String TELEMATICS_GLOBAL_DISPLAY_SUBSCRIBER = "TelematicsGlobalDisplaySubscriber";
|
||||
// 底盘状态信息
|
||||
String VEHICLE_STATE_SUBSCRIBER = "VehicleStateSubscriber";
|
||||
// 融合感知TXT数据
|
||||
String PERCEPTION_TEXT_SUBSCRIBER = "PerceptionTextSubscriber";
|
||||
// 融合感知框数据
|
||||
String PERCEPTION_BOX_SUBSCRIBER = "PerceptionBoxSubscriber";
|
||||
// 用户交互选中到命名空间
|
||||
String PERCEPTION_BOX_SUBSCRIBER_SHOW = "PERCEPTION_BOX_SUBSCRIBER_SHOW";
|
||||
// Marker的分类命名空间
|
||||
String PERCEPTION_BOX_NAME_SPACE_CHANGE = "PERCEPTION_BOX_NAME_SPACE_CHANGE";
|
||||
|
||||
|
||||
// 系统日志--错误日志&错误日志
|
||||
String REPORT_MSG_SUBSCRIBER = "REPORT_MSG_SUBSCRIBER";
|
||||
|
||||
|
||||
// 公用的取消注册监听,配合传入的String参数区分具体是谁
|
||||
String COMMON_UN_SUBSCRIBER = "COMMON_UN_SUBSCRIBER";
|
||||
|
||||
// Topic HZ
|
||||
String TOPIC_HZ_SUBSCRIBER = "TOPIC_HZ_SUBSCRIBER";
|
||||
|
||||
// Node Health
|
||||
String NODE_HEALTH_SUBSCRIBER = "NODE_HEALTH_SUBSCRIBER";
|
||||
|
||||
// System cmd
|
||||
String SYSTEM_CMS_SUBSCRIBER = "SYSTEM_CMS_SUBSCRIBER";
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 915 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
@@ -0,0 +1,102 @@
|
||||
<?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"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSelectLineTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_15"
|
||||
android:text="请选择自动驾驶路线"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/sp_18"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/clSearchLayout"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_30"
|
||||
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSelectLineTitle">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSearch"
|
||||
android:layout_width="@dimen/dp_25"
|
||||
android:layout_height="@dimen/dp_25"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:src="@drawable/icon_line_search"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/etSearch"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:background="@null"
|
||||
android:hint="自动驾驶路线搜索"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textColorHint="#B3FFFFFF"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@id/ivSearch"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvLineList"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
app:layout_constraintBottom_toTopOf="@id/viewHorizontalLine"
|
||||
app:layout_constraintLeft_toLeftOf="@id/clSearchLayout"
|
||||
app:layout_constraintRight_toRightOf="@id/clSearchLayout"
|
||||
app:layout_constraintTop_toBottomOf="@id/clSearchLayout" />
|
||||
|
||||
<com.zhjt.mogo_core_function_devatools.rviz.ui.views.MoGoLoadingView
|
||||
android:id="@+id/tvLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/viewHorizontalLine"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@+id/clSearchLayout" />
|
||||
|
||||
<View
|
||||
android:id="@+id/viewHorizontalLine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_1"
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintBottom_toTopOf="@id/tvCancel"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvCancel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:padding="@dimen/dp_15"
|
||||
android:text="取消"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/sp_18"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/tvAutopilotLine"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="@dimen/dp_10"
|
||||
>
|
||||
</TextView>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?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="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvConsoleContent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:gravity="start"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_12"
|
||||
tools:text="ReportMsg" />
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_1"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
android:layout_marginEnd="@dimen/dp_5"
|
||||
android:background="@color/white" />
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,218 @@
|
||||
<?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:id="@+id/vehicleStateView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/auto_check_bg"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvAutoDriveLineSelect"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/ivSpeedReduce"
|
||||
android:text="请选择自动驾驶路线"
|
||||
android:padding="@dimen/dp_5"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:textColor="@color/white"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvSpeedTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="车 速 设 置:"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_18"
|
||||
app:layout_constraintStart_toStartOf="@id/tvAutoDriveLineSelect"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedReduce"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedReduce"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_35"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:src="@drawable/icon_speed_reduce"
|
||||
app:layout_constraintStart_toEndOf="@id/tvSpeedTitle"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvAutoDriveLineSelect"
|
||||
android:scaleType="fitXY"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/etInputSpeed"
|
||||
android:layout_width="@dimen/dp_60"
|
||||
android:layout_height="@dimen/dp_35"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedReduce"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedReduce"
|
||||
android:background="#1E3062"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/sp_16"
|
||||
android:gravity="center"
|
||||
tools:ignore="SpeakableTextPresentCheck"
|
||||
android:focusableInTouchMode="false"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivSpeedAdd"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_height="@dimen/dp_35"
|
||||
app:layout_constraintTop_toTopOf="@id/etInputSpeed"
|
||||
app:layout_constraintBottom_toBottomOf="@id/etInputSpeed"
|
||||
app:layout_constraintLeft_toRightOf="@id/etInputSpeed"
|
||||
android:src="@drawable/icon_speed_add"
|
||||
android:scaleType="fitXY"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvUnit"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="km/h"
|
||||
android:textColor="#FFFFFFFF"
|
||||
android:textSize="@dimen/sp_18"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintLeft_toRightOf="@id/ivSpeedAdd"
|
||||
android:layout_marginStart="@dimen/dp_10" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/tvSureModify"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:gravity="center"
|
||||
android:text="确定"
|
||||
android:textColor="@android:color/white"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:paddingTop="@dimen/dp_5"
|
||||
android:paddingBottom="@dimen/dp_5"
|
||||
android:paddingStart="@dimen/dp_20"
|
||||
android:paddingEnd="@dimen/dp_20"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
app:layout_constraintTop_toTopOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivSpeedAdd"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvUnit"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvGearP"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/btnAutoPilotStatus"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnAutoPilotStatus"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:text="P"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/p_default_txt_color"
|
||||
android:textSize="@dimen/sp_20"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvGearR"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/btnAutoPilotStatus"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnAutoPilotStatus"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvGearP"
|
||||
android:text="R"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/p_default_txt_color"
|
||||
android:textSize="@dimen/sp_20"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvGearN"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/btnAutoPilotStatus"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnAutoPilotStatus"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvGearR"
|
||||
android:text="N"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/p_default_txt_color"
|
||||
android:textSize="@dimen/sp_20"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvGearD"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/btnAutoPilotStatus"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnAutoPilotStatus"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvGearN"
|
||||
android:text="D"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/p_default_txt_color"
|
||||
android:textSize="@dimen/sp_20"
|
||||
android:textStyle="bold"
|
||||
android:layout_marginStart="@dimen/dp_5"
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAutoPilotStatus"
|
||||
android:layout_width="@dimen/dp_120"
|
||||
android:layout_height="@dimen/dp_35"
|
||||
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintLeft_toRightOf="@id/tvGearD"
|
||||
app:layout_constraintRight_toLeftOf="@id/btnControlAutoPilot"
|
||||
app:layout_constraintTop_toTopOf="@id/btnControlAutoPilot"
|
||||
app:layout_constraintBottom_toBottomOf="@id/btnControlAutoPilot"
|
||||
android:layout_marginStart="@dimen/dp_15"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:text="自驾状态"
|
||||
/>
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/btnControlAutoPilot"
|
||||
android:layout_width="@dimen/dp_0"
|
||||
android:layout_height="@dimen/dp_35"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:enabled="false"
|
||||
android:paddingStart="@dimen/dp_20"
|
||||
android:paddingEnd="@dimen/dp_20"
|
||||
android:textColor="@color/white"
|
||||
android:textOff="启动自动驾驶"
|
||||
android:textOn="退出自动驾驶"
|
||||
android:textSize="@dimen/sp_18"
|
||||
app:layout_constraintTop_toBottomOf="@+id/ivSpeedReduce"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/btnAutoPilotStatus"
|
||||
/>
|
||||
|
||||
<!--控制台 RecyclerVie=-->
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvReportConsole"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_0"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@color/bottom_container_bg"
|
||||
android:orientation="vertical"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnControlAutoPilot"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -17,4 +17,8 @@
|
||||
<color name="rviz_fmd_fm_fault_level2">#D4AF37</color>
|
||||
<color name="rviz_fmd_fm_fault_level3">#fc8f28</color>
|
||||
<color name="rviz_fmd_fm_fault_level4">#bb0000</color>
|
||||
|
||||
<color name="auto_check_bg">#F2384F70</color>
|
||||
<color name="p_default_txt_color">#FF6E8EC9</color>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user