[singapore]
[前后屏展示]
This commit is contained in:
yangyakun
2026-04-14 18:13:05 +08:00
parent 51233c5919
commit 5699271a9d
20 changed files with 346 additions and 52 deletions

View File

@@ -385,7 +385,7 @@ class DriverM1Model {
private fun onArriveAtSuccess() {
isArrivedStation = true
LedScreenManager.sendTripInfo2Led(LedScreenManager.ARRIVE_STATION,mCurrentOrder?.lineName!!
,mCurrentOrder?.startSiteName!!,mCurrentOrder?.siteName!!,false)
,mCurrentOrder?.startSiteName!!,mCurrentOrder?.siteName!!,false,"")
if (currentChangeDestMsg != null){
currentChangeDestMsg?.isConfirmed = true
@@ -771,13 +771,13 @@ class DriverM1Model {
private fun sendCharterStartTripInfo() {
if (mCurrentOrder == null) return
LedScreenManager.sendTripInfo2Led(LedScreenManager.START_TRIP,mCurrentOrder?.lineName!!
,"","",false)
,"","",false,"")
}
private fun sendCharterEndTripInfo() {
if (mCurrentOrder == null) return
LedScreenManager.sendTripInfo2Led(LedScreenManager.END_TRIP,mCurrentOrder?.lineName!!
,"","",false)
,"","",false,"")
}
fun checkOrderCountDown() {

View File

@@ -1226,7 +1226,7 @@ object CharterPassengerModel {
if(!it.lineName.isNullOrEmpty()&&!it.startSiteName.isNullOrEmpty()&&!it.siteName.isNullOrEmpty()) {
LedScreenManager.sendTripInfo2Led(
LedScreenManager.LEAVE_STATION,
it.lineName, it.startSiteName!!, it.siteName!!, false
it.lineName, it.startSiteName!!, it.siteName!!, false,""
)
}
}

View File

@@ -3,18 +3,26 @@ package com.mogo.och.common.module.view
import android.app.Activity
import android.graphics.PixelFormat
import android.util.DisplayMetrics
import android.view.*
import android.view.Gravity
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.WindowManager
import android.widget.RadioGroup
import android.widget.ToggleButton
import androidx.appcompat.widget.AppCompatButton
import androidx.appcompat.widget.AppCompatCheckBox
import androidx.appcompat.widget.AppCompatEditText
import androidx.appcompat.widget.AppCompatImageView
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
import com.mogo.eagle.core.utilcode.kotlin.onClick
import com.mogo.eagle.core.utilcode.util.BarUtils
import com.mogo.eagle.core.utilcode.util.RegexUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.och.common.module.R
import com.mogo.och.common.module.biz.media.VoiceNotice
import com.mogo.och.common.module.debug.autopilot.AutopilotStateDebug
import mogo_msg.MogoReportMsg
import com.mogo.support.device.culed.CuLedManager
/**
* @author XuXinChao
@@ -36,6 +44,8 @@ class DebugFloatWindow constructor(activity: Activity) : View.OnTouchListener{
private var mInScreenY = 0f
private var rg_autopilot:RadioGroup?=null
private var b4CuIp: AppCompatEditText?=null
private var b4CuPort: AppCompatEditText?=null
init {
initFloatWindow();
@@ -48,7 +58,8 @@ class DebugFloatWindow constructor(activity: Activity) : View.OnTouchListener{
mWindowManager = mActivity.windowManager
mWindowParams?.let {
it.format = PixelFormat.RGBA_8888
it.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
it.flags = (WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
or WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH)
it.gravity = Gravity.START or Gravity.TOP
it.width = 800
it.height = 1000
@@ -56,20 +67,13 @@ class DebugFloatWindow constructor(activity: Activity) : View.OnTouchListener{
}
rg_autopilot = mFloatLayout.findViewById<RadioGroup>(R.id.rg_autopilot)
b4CuIp = mFloatLayout.findViewById<AppCompatEditText>(R.id.b4_cu_ip)
b4CuPort = mFloatLayout.findViewById<AppCompatEditText>(R.id.b4_cu_port)
mFloatLayout.findViewById<AppCompatImageView>(R.id.close_window).onClick {
hideFloatWindow()
}
mFloatLayout.findViewById<AppCompatButton>(R.id.acbtn_send_15_dir).onClick {
val newBuilder = MogoReportMsg.MogoReportMessage.newBuilder()
newBuilder.code = "EMAP_ATTITUDE_INIT_FAILED"
newBuilder.timestampBuilder.sec = 0
newBuilder.timestampBuilder.nsec = 0
newBuilder.src = "2"
newBuilder.level = ""
CallerAutoPilotStatusListenerManager.invokeAutopilotGuardian(newBuilder.build())
}
mFloatLayout.findViewById<AppCompatCheckBox>(R.id.accb_autopilot_group).setOnCheckedChangeListener { buttonView, isChecked ->
if(isChecked){
rg_autopilot?.visibility = View.VISIBLE
@@ -102,6 +106,57 @@ class DebugFloatWindow constructor(activity: Activity) : View.OnTouchListener{
VoiceNotice.showNotice("混淆导致序列化问题")
VoiceNotice.showNoticeOut("混淆导致序列化问题")
}
mFloatLayout.findViewById<AppCompatButton>(R.id.b4_cu_reconnect).onClick {
val currentIp = b4CuIp?.text
val currentPort = b4CuPort?.text
if (RegexUtils.isIP(currentIp)) {
try {
val port = currentPort.toString().toInt()
if(port<65535){
CuLedManager.reConnect(currentIp.toString(),port)
}
}catch (e:Exception){
ToastUtils.showLong("请输入正确的端口号")
}
}else{
ToastUtils.showLong("请输入正确的ip")
}
}
mFloatLayout.findViewById<AppCompatButton>(R.id.b4_cu_setroot).onClick {
CuLedManager.updateTripInfoData(1,"100","last station name")
}
mFloatLayout.findViewById<AppCompatButton>(R.id.b4_cu_stop_service).onClick {
CuLedManager.updateTripInfoData(2,"100","last station name")
}
mFloatLayout.findViewById<ToggleButton>(R.id.b4_cu_left_light).setOnCheckedChangeListener { buttonView, isChecked ->
if(buttonView.id == R.id.b4_cu_left_light){
if(isChecked){
CuLedManager.updateTurnSignalData(1)
}else{
CuLedManager.updateTurnSignalData(0)
}
}
}
mFloatLayout.findViewById<ToggleButton>(R.id.b4_cu_right_light).setOnCheckedChangeListener { buttonView, isChecked ->
if(buttonView.id == R.id.b4_cu_right_light){
if(isChecked){
CuLedManager.updateTurnSignalData(2)
}else{
CuLedManager.updateTurnSignalData(0)
}
}
}
mFloatLayout.findViewById<ToggleButton>(R.id.b4_cu_stop_request).setOnCheckedChangeListener { buttonView, isChecked ->
if(buttonView.id == R.id.b4_cu_stop_request){
CuLedManager.triggerStopRequest(isChecked)
}
}
}
override fun onTouch(v: View?, motionEvent: MotionEvent?): Boolean {

View File

@@ -17,22 +17,12 @@
android:layout_width="@dimen/dp_50"
android:layout_height="@dimen/dp_50"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/acbtn_send_15_dir"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginStart="@dimen/dp_40"
android:text="15m/方向相反"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatCheckBox
android:id="@+id/accb_autopilot_group"
app:layout_constraintTop_toBottomOf="@+id/acbtn_send_15_dir"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_40"
android:layout_marginStart="@dimen/dp_20"
android:text="模拟自驾状态"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
@@ -81,9 +71,99 @@
app:layout_constraintTop_toBottomOf="@+id/rg_autopilot"
app:layout_constraintStart_toStartOf="parent"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginStart="@dimen/dp_40"
android:layout_marginStart="@dimen/dp_20"
android:text="测试tts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.constraintlayout.widget.ConstraintLayout
app:layout_constraintTop_toBottomOf="@+id/acbtn_tts"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginStart="@dimen/dp_20"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/b4_cu_ip"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:hint="ip地址"
android:text="192.168.1.8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatEditText
android:id="@+id/b4_cu_port"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/b4_cu_ip"
android:layout_marginStart="@dimen/dp_10"
android:text="1598"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/b4_cu_reconnect"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@+id/b4_cu_port"
android:layout_marginStart="@dimen/dp_50"
android:text="重新连接"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/b4_cu_setroot"
app:layout_constraintTop_toBottomOf="@+id/b4_cu_ip"
app:layout_constraintStart_toStartOf="@+id/b4_cu_ip"
android:layout_marginTop="@dimen/dp_10"
android:text="设置线路"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/b4_cu_stop_service"
app:layout_constraintTop_toBottomOf="@+id/b4_cu_ip"
app:layout_constraintStart_toEndOf="@+id/b4_cu_setroot"
android:layout_marginTop="@dimen/dp_10"
android:layout_marginStart="@dimen/dp_10"
android:text="设置停运"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ToggleButton
android:id="@+id/b4_cu_left_light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_20"
android:textOff="左转向灭灯"
android:textOn="左转向开灯"
app:layout_constraintTop_toBottomOf="@+id/b4_cu_setroot"
app:layout_constraintStart_toStartOf="parent"
/>
<ToggleButton
android:id="@+id/b4_cu_right_light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_20"
android:textOff="右转向灭灯"
android:textOn="右转向开灯"
app:layout_constraintTop_toBottomOf="@+id/b4_cu_setroot"
app:layout_constraintStart_toEndOf="@+id/b4_cu_left_light"
/>
<ToggleButton
android:id="@+id/b4_cu_stop_request"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="@dimen/dp_20"
android:textOff="右转向灭灯"
android:textOn="右转向开灯"
app:layout_constraintTop_toBottomOf="@+id/b4_cu_setroot"
app:layout_constraintStart_toEndOf="@+id/b4_cu_right_light"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -24,10 +24,12 @@ object LedScreenManager {
fun sendTripInfo2Led(type: Int, lineName: String,
departureStopName: String,
arrivalStopName: String,
isLastStop: Boolean) {
val logInfo = "type: $type, lineName: $lineName, departureStopName: $departureStopName, arrivalStopName: $arrivalStopName, isLastStop: $isLastStop"
isLastStop: Boolean,
lastStopName:String,
) {
val logInfo = "type: $type, lineName: $lineName, departureStopName: $departureStopName, arrivalStopName: $arrivalStopName, isLastStop: $isLastStop, lastStopName:${lastStopName}"
d(M_BUS + "BusSendTripInfoManager", logInfo)
OchChainLogManager.writeChainLogLanSocket("发送msg到外屏Led",logInfo,"send")
CallerAutoPilotControlManager.sendTripInfo(type,lineName,departureStopName, arrivalStopName, isLastStop)
CallerAutoPilotControlManager.sendTripInfo(type,lineName,departureStopName, arrivalStopName, isLastStop,lastStopName)
}
}

View File

@@ -323,9 +323,14 @@ object OrderModel {
LineModel.stationList?.let {
if (LineModel.startTaskMessage()) { //默认是第一站到站查询
LineManager.lineInfos?.lineName?.let { lineName->
val lastStopName = if(it.isNotEmpty()){
it.last().name?:""
}else{
""
}
LedScreenManager.sendTripInfo2Led(
LedScreenManager.START_TRIP,
lineName, "", "", false
lineName, "", "", false,lastStopName
)
}
}

View File

@@ -84,7 +84,8 @@ object ThirdDeviceData {
lineInfo.lineName,
start.name?:"",
end.name?:"",
LineModel.isLastStation() == true
LineModel.isLastStation() == true,
""
)
}
}
@@ -102,7 +103,8 @@ object ThirdDeviceData {
lineInfo.lineName,
start.name?:"",
end.name?:"",
LineModel.isLastStation(end)
LineModel.isLastStation(end),
""
)
}
}
@@ -116,7 +118,8 @@ object ThirdDeviceData {
lineInfo.lineName,
"",
"",
false
false,
""
)
}
}

View File

@@ -501,9 +501,14 @@ object OrderModel {
LineModel.stationList?.let {
if (LineModel.startTaskMessage()) { //默认是第一站到站查询
LineManager.lineInfos?.lineName?.let { lineName ->
val lastStopName = if(it.isNotEmpty()){
it.last().name?:""
}else{
""
}
LedScreenManager.sendTripInfo2Led(
LedScreenManager.START_TRIP,
lineName, "", "", false
lineName, "", "", false,lastStopName
)
}
//任务选择后首发前给司机提示任务

View File

@@ -131,7 +131,8 @@ object ThirdDeviceData {
lineInfo.lineName,
start.name ?: "",
end.name ?: "",
LineModel.isLastStation() == true
LineModel.isLastStation() == true,
"",
)
}
}
@@ -151,7 +152,8 @@ object ThirdDeviceData {
lineInfo.lineName,
start.name ?: "",
end.name ?: "",
LineModel.isLastStation(end)
LineModel.isLastStation(end),
""
)
}
}
@@ -167,7 +169,8 @@ object ThirdDeviceData {
lineInfo.lineName,
"",
"",
false
false,
""
)
}
}

View File

@@ -367,10 +367,15 @@ object OrderModel {
LineModel.stationList?.let {
if (LineModel.startTaskMessage()) { //默认是第一站到站查询
val lastStopName = if(it.isNotEmpty()){
it.last().name?:""
}else{
""
}
LineManager.lineInfos?.lineName?.let { lineName->
LedScreenManager.sendTripInfo2Led(
LedScreenManager.START_TRIP,
lineName, "", "", false
lineName, "", "", false,lastStopName
)
}
//任务选择后首发前给司机提示任务

View File

@@ -131,7 +131,8 @@ object ThirdDeviceData {
lineInfo.lineName,
start.name?:"",
end.name?:"",
LineModel.isLastStation() == true
LineModel.isLastStation() == true,
""
)
}
}
@@ -151,7 +152,8 @@ object ThirdDeviceData {
lineInfo.lineName,
start.name?:"",
end.name?:"",
LineModel.isLastStation(end)
LineModel.isLastStation(end),
""
)
}
}
@@ -167,7 +169,8 @@ object ThirdDeviceData {
lineInfo.lineName,
"",
"",
false
false,
""
)
}
}

View File

@@ -120,7 +120,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
long oldTime = SharedPrefsMgr.getInstance().getLong("roadwork", 0);
if (currentTime - oldTime > 60) { //超过一分钟,才会继续播报重复提醒
SharedPrefsMgr.getInstance().putLong("roadwork", System.currentTimeMillis() / 1000);
CallerAutoPilotControlManager.sendTripInfo(5, "", "", "", false);
CallerAutoPilotControlManager.sendTripInfo(5, "", "", "", false,"");
}
}

View File

@@ -40,7 +40,8 @@ class DataCenterProvider : IDataCenterProvider, IDataCenterBizListener {
super.invokeVehicleChange()
IotManager.init(
AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode),
AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode)
AppIdentityModeUtils.isB2(FunctionBuildConfig.appIdentityMode),
AppIdentityModeUtils.isB4(FunctionBuildConfig.appIdentityMode)
)
}

View File

@@ -57,6 +57,7 @@ import com.mogo.eagle.core.utilcode.util.StringUtils
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
import com.mogo.support.device.culed.CuLedManager
import com.mogo.support.device.led.LedSourceManager
import com.mogo.telematic.MogoProtocolMsg
import com.mogo.telematic.MogoProtocolMsg.NORMAL_DATA
@@ -1091,7 +1092,7 @@ class MoGoAutopilotControlProvider :
* @param isLastStop 是否最终站
* @return boolean
*/
override fun sendTripInfo(type: Int, lineName: String, departureStopName: String, arrivalStopName: String, isLastStop: Boolean) {
override fun sendTripInfo(type: Int, lineName: String, departureStopName: String, arrivalStopName: String, isLastStop: Boolean,lastStopName:String) {
AdasManager.getInstance().sendTripInfoReq(type, lineName, departureStopName, arrivalStopName, isLastStop)
LedSourceManager.updateTripInfoData(
type,
@@ -1100,6 +1101,10 @@ class MoGoAutopilotControlProvider :
arrivalStopName,
isLastStop
)
CuLedManager.updateTripInfoData(type,
lineName,
lastStopName
)
}
/**

View File

@@ -101,6 +101,7 @@ import com.mogo.eagle.core.function.call.obu.CallerObuWarningSpatListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_D_C
import com.mogo.eagle.core.utilcode.util.DeviceUtils
import com.mogo.support.device.culed.CuLedManager
import com.mogo.support.device.led.LedSourceManager
import com.mogo.support.obu.ObuScene
import com.zhidao.support.adas.high.AdasManager
@@ -327,6 +328,7 @@ class MoGoAdasListenerImpl : OnAdasListener {
type = 3
}
LedSourceManager.updateTurnSignalData(type)
CuLedManager.updateTurnSignalData(type)
}
//自动驾驶状态

View File

@@ -12,6 +12,7 @@ import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
import com.mogo.eagle.core.utilcode.util.StringUtils
import com.mogo.support.device.DevicesManager
import com.mogo.support.device.IWriteChainLogListener
import com.mogo.support.device.culed.CuLedManager
import com.mogo.support.device.led.LedSourceManager
import com.zhjt.service.chain.ChainLog
import java.text.SimpleDateFormat
@@ -24,7 +25,7 @@ object IotManager : IMoGoCloudListener, IWriteChainLogListener {
private const val EVENT_KEY_HARDWARE_DEVICES = "event_key_hardware_devices"
private var isPassenger: Boolean = false
fun init(isPassenger: Boolean, isB2: Boolean) {
fun init(isPassenger: Boolean, isB2: Boolean, isB4: Boolean) {
destroy()//重新初始化时销毁之前调用的数据
this.isPassenger = isPassenger
if (isPassenger) {
@@ -34,6 +35,10 @@ object IotManager : IMoGoCloudListener, IWriteChainLogListener {
} else {
LedSourceManager.registerWriteChainLogListener(this)
LedSourceManager.init(true, isB2)
if(isB4){
CuLedManager.init()
CuLedManager.registerWriteChainLogListener(this)
}
}
}
@@ -58,6 +63,7 @@ object IotManager : IMoGoCloudListener, IWriteChainLogListener {
DevicesManager.destroy()
} else {
LedSourceManager.unregisterWriteChainLogListener()
CuLedManager.unregisterWriteChainLogListener()
LedSourceManager.destroy()
}
}

View File

@@ -480,7 +480,7 @@ interface IMoGoAutopilotControlProvider : IMoGoFunctionServerProvider {
* @param isLastStop 是否最终站
* @return boolean
*/
fun sendTripInfo(type: Int, lineName: String, departureStopName: String,arrivalStopName: String, isLastStop: Boolean)
fun sendTripInfo(type: Int, lineName: String, departureStopName: String,arrivalStopName: String, isLastStop: Boolean,lastStopName:String,)
/**
* 福田清扫车业务指令下发

View File

@@ -734,9 +734,10 @@ object CallerAutoPilotControlManager {
lineName: String,
departureStopName: String,
arrivalStopName: String,
isLastStop: Boolean
isLastStop: Boolean,
lastStopName:String,
) {
providerApi?.sendTripInfo(type, lineName, departureStopName, arrivalStopName, isLastStop)
providerApi?.sendTripInfo(type, lineName, departureStopName, arrivalStopName, isLastStop,lastStopName)
}
/**

View File

@@ -40,5 +40,6 @@ dependencies {
implementation rootProject.ext.dependencies.androidxappcompat
api rootProject.ext.dependencies.serialport
implementation "com.mogo.support.device.manager:led_screen_cpower5a:1.0.13"
implementation "com.mogo.support.device.manager:led_screen_cubasic:1.0.0"
implementation rootProject.ext.dependencies.view_model_scope
}

View File

@@ -0,0 +1,117 @@
package com.mogo.support.device.culed
import com.mogo.support.device.IWriteChainLogListener
import com.mogo.support.device.manager.cubasic.log.LogLevel
import com.mogo.support.device.manager.cubasic.log.LogListener
import com.mogo.support.device.manager.cubasic.log.LogManager
import com.mogo.support.device.manager.cubasic.netty.NettyXimpleClient
import kotlin.properties.Delegates
object CuLedManager {
/**
* 0 没有灯态
* 1 左转灯
* 2 右转灯
* 3 双闪
*/
private var lightState: Int by Delegates.observable(0) { _, oldValue, newValue ->
if (oldValue != newValue) {
if(newValue==0){
if(oldValue==1) {
client?.setLeftTurn(false)
}else if(oldValue==2){
client?.setRightTurn(false)
}else{
client?.setLeftTurn(false)
client?.setRightTurn(false)
}
}else{
when (newValue) {
1 -> {client?.setLeftTurn(true)}
2 -> {client?.setRightTurn(true)}
else -> {}
}
}
}
}
private var client: NettyXimpleClient? = null
private var writeChainLogListener: IWriteChainLogListener? = null
fun init(host:String="",port:Int=0){
if (client == null) {
client = NettyXimpleClient()
if (host.isNotEmpty() && port > 0) {
client?.setHostAndPort(host, port)
}
client?.connect()
}
LogManager.getInstance().isDebug = true
LogManager.getInstance().logListener = object :LogListener{
override fun writeLog(logLevel: LogLevel?, tag: String?, message: String?) {
writeChainLogListener?.onWriteChainLog(logLevel?.name?:"level",tag?:"",message?:"")
}
}
}
fun registerWriteChainLogListener(writeChainLogListener: IWriteChainLogListener) {
this.writeChainLogListener = writeChainLogListener
}
fun unregisterWriteChainLogListener() {
this.writeChainLogListener = null
}
fun reConnect(host:String="",port:Int=0){
if (client == null) {
client = NettyXimpleClient()
if (host.isNotEmpty() && port > 0) {
client?.setHostAndPort(host, port)
}
client?.connect()
} else {
if(client?.isConnected==true) {
if (host.isNotEmpty() && port > 0) {
client?.setHostAndPort(host, port)
}
client?.reconnect()
}else{
if(client?.connectionStatus=="CONNECTING"){
if (host.isNotEmpty() && port > 0) {
client?.setHostAndPort(host, port)
}
}
}
}
}
/**
* 0 没有灯态
* 1 左转灯
* 2 右转灯
* 3 双闪
*/
fun updateTurnSignalData(type: Int) {
this.lightState = type
}
fun updateTripInfoData(
type: Int,
lineName: String,
lastStopName:String
) {
when (type) {
1 -> { client?.setRoute(lineName,lastStopName) }
2 -> { client?.setOffService() }
else -> {}
}
}
fun triggerStopRequest(isActive:Boolean){
client?.triggerStopRequest(isActive)
}
}