Compare commits
10 Commits
4833e91b2b
...
8755b95e5b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8755b95e5b | ||
|
|
bf2bd70538 | ||
|
|
25e5e1d321 | ||
|
|
a9b7e5beac | ||
|
|
83dd65eb8d | ||
|
|
e47fcfcd10 | ||
|
|
4b120ac3b3 | ||
|
|
823e87a329 | ||
|
|
9662cac761 | ||
|
|
82f46aa5f0 |
@@ -28,8 +28,8 @@ import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.biz.login.callback.ILoginViewCallback
|
||||
import com.mogo.och.biz.login.model.LoginModel
|
||||
import com.mogo.och.biz.login.bean.LoginInfo
|
||||
import com.mogo.och.biz.login.model.SwitchLoginModel
|
||||
import com.mogo.och.common.module.biz.lansocket.IOchLanPassengerStatusListener
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
@@ -180,12 +180,12 @@ object LoginServiceManager : IOchLanPassengerStatusListener {
|
||||
}
|
||||
|
||||
private fun queryLoginStatusByNet() {
|
||||
LoginModel.queryCarStatus(false)
|
||||
SwitchLoginModel.queryCarStatus(false)
|
||||
}
|
||||
|
||||
fun queryLoginStatusByNet(readCatche: Boolean) {
|
||||
d(tag, "queryLoginStatusByNet")
|
||||
LoginModel.queryCarStatus(readCatche)
|
||||
SwitchLoginModel.queryCarStatus(readCatche)
|
||||
}
|
||||
|
||||
fun loginOut() {
|
||||
@@ -198,7 +198,7 @@ object LoginServiceManager : IOchLanPassengerStatusListener {
|
||||
FunctionBuildConfig.isOffLine = false
|
||||
sendLogin2Client(1)
|
||||
}
|
||||
LoginModel.logout()
|
||||
SwitchLoginModel.logout()
|
||||
}
|
||||
|
||||
fun checkAllEnv(
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.mogo.och.biz.login.bean.f2a;
|
||||
|
||||
/**
|
||||
* Created by yangyakun on 2021/8/19
|
||||
* 通过手机号验证码登录
|
||||
*/
|
||||
public class LoginF2aReqBean {
|
||||
|
||||
public String phone;
|
||||
public String mfaCode;
|
||||
public String sn;
|
||||
public Location4Login loc;
|
||||
|
||||
public LoginF2aReqBean(String phone, String mfaCode, String sn, Location4Login location4Login) {
|
||||
this.phone = phone;
|
||||
this.mfaCode = mfaCode;
|
||||
this.sn = sn;
|
||||
this.loc = location4Login;
|
||||
}
|
||||
|
||||
public static class Location4Login{
|
||||
public double lat;
|
||||
public double lon;
|
||||
public String coordinateType = "WGS84";
|
||||
|
||||
|
||||
public Location4Login(double lat, double lon,String coordinateType) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this.coordinateType = coordinateType;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.och.biz.login.bean.f2a;
|
||||
|
||||
/**
|
||||
* Created by yangyakun on 2021/8/19
|
||||
* 通过手机号验证码登录
|
||||
*/
|
||||
public class LoginReqBean {
|
||||
|
||||
public String phone;
|
||||
public String password;
|
||||
public String sn;
|
||||
|
||||
public LoginReqBean(String phone, String password, String sn) {
|
||||
this.phone = phone;
|
||||
this.password = password;
|
||||
this.sn = sn;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.och.biz.login.bean.f2a;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* Created by yangyakun on 2021/8/19
|
||||
* 通过账号密码登录
|
||||
*/
|
||||
public class LoginRespBean extends BaseData {
|
||||
|
||||
public Result data;
|
||||
|
||||
public static final class Result {
|
||||
public Long driverId;
|
||||
public boolean isFirstLogin;
|
||||
public boolean isPasswordExpired;
|
||||
public boolean isPasswordExpiringSoon;
|
||||
public boolean needInitPassword;
|
||||
public String otpAuthUrl;
|
||||
public String phone;
|
||||
public String sn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.och.biz.login.bean.f2a;
|
||||
|
||||
/**
|
||||
* Created by yangyakun on 2021/8/19
|
||||
* 通过手机号验证码登录
|
||||
*/
|
||||
public class RestPwdReqBean {
|
||||
|
||||
public Long driverId;
|
||||
public String newPwd;
|
||||
public String oldPwd;
|
||||
|
||||
public RestPwdReqBean(Long driverId, String newPwd,String oldPwd) {
|
||||
this.driverId = driverId;
|
||||
this.newPwd = newPwd;
|
||||
this.oldPwd = oldPwd;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.och.biz.login.bean.f2a;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
/**
|
||||
* Created by yangyakun on 2021/8/19
|
||||
* 通过账号密码登录
|
||||
*/
|
||||
public class RestPwdRespBean extends BaseData {
|
||||
|
||||
public Result data;
|
||||
|
||||
public static final class Result {
|
||||
public Long driverId;
|
||||
public boolean isFirstLogin;
|
||||
public boolean isPasswordExpired;
|
||||
public boolean isPasswordExpiringSoon;
|
||||
public String otpAuthUrl;
|
||||
public String phone;
|
||||
public String sn;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,10 @@
|
||||
package com.mogo.och.biz.login.callback;
|
||||
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginRespBean;
|
||||
import com.mogo.och.biz.login.bean.f2a.RestPwdRespBean;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/8
|
||||
*
|
||||
@@ -9,5 +14,8 @@ public interface ITaxiLoginCallback {
|
||||
default void getPhoneCodeSuccess(){}
|
||||
|
||||
default void netErrorCallback(){}
|
||||
default void stopAutoLogin(){}
|
||||
|
||||
default void loginfirstSuccess(@Nullable LoginRespBean.Result data,String oldPwd){}
|
||||
|
||||
default void restPwdSuccess(){}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.mogo.och.biz.login.model
|
||||
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.util.Log
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener
|
||||
import com.mogo.commons.module.intent.IntentManager
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.login.LoginServiceManager
|
||||
import com.mogo.och.biz.login.bean.DriverStatusQueryRespBean
|
||||
import com.mogo.och.biz.login.bean.LoginInfo
|
||||
import com.mogo.och.biz.login.callback.ITaxiLoginCallback
|
||||
import com.mogo.och.biz.login.net.OchCommonServiceManager
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.cache.ISpCallback
|
||||
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
open class CommonLoginModel {
|
||||
|
||||
protected val TAG = M_OCHCOMMON + this.javaClass.simpleName
|
||||
|
||||
protected var mContext: Context? = null
|
||||
|
||||
open var iTaxiLoginCallback: ITaxiLoginCallback? = null
|
||||
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, _ ->
|
||||
d(TAG, "onIntentReceived = %s", intentStr)
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)
|
||||
&& AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
// 网络链接成功可以先读取本地再获取服务器
|
||||
queryCarStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val snChangeListener = object : ISpCallback {
|
||||
override fun snChange() {
|
||||
d(TAG, "sn 发生变化${OchSPManager.getSn()}")
|
||||
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
queryCarStatus(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
mContext = AbsMogoApplication.getApp()
|
||||
IntentManager.getInstance()
|
||||
.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
}
|
||||
|
||||
protected var subscribe: Disposable? = null
|
||||
|
||||
protected val loginInfoKey = "LOGININFOKEY"
|
||||
|
||||
fun hasInit(): Boolean {
|
||||
return iTaxiLoginCallback != null
|
||||
}
|
||||
|
||||
fun setiTaxiLoginCallback(iTaxiLoginCallback: ITaxiLoginCallback?) {
|
||||
d(TAG, "setiTaxiLoginCallback")
|
||||
OchSPManager.addListener(TAG, snChangeListener)
|
||||
this.iTaxiLoginCallback = iTaxiLoginCallback
|
||||
}
|
||||
|
||||
fun release() {
|
||||
d(TAG, "release")
|
||||
OchSPManager.remove(TAG)
|
||||
iTaxiLoginCallback = null
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun go2LoginInfo(data: LoginInfo?, source: String) {
|
||||
d(TAG, "设置源:${source}")
|
||||
data?.let {
|
||||
LoginServiceManager.setLoginInfo(data)
|
||||
loginSuccess(data)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单状态和登录状态查询
|
||||
* 1、司机端登录成功后开启2分钟定时请求登录状态
|
||||
* 2、对外提供查询登录状态
|
||||
* 3、网络状态发生变化后查询
|
||||
* 4、sn 发生变化后查询
|
||||
* 5、登录成功后主动查询
|
||||
* 6、错误重试
|
||||
* 7、错误重试
|
||||
* 8、登出后重试
|
||||
*/
|
||||
fun queryCarStatus(readCatche: Boolean = true) {
|
||||
mContext?.let {
|
||||
Log.d(TAG, "设置源:queryCarStatus")
|
||||
if (readCatche) {
|
||||
val loginInfo = LoginServiceManager.getLoginInfo()
|
||||
go2LoginInfo(loginInfo,"缓存获取")
|
||||
}
|
||||
OchCommonServiceManager.queryDriverServiceStatus(
|
||||
it,
|
||||
object : OchCommonServiceCallback<DriverStatusQueryRespBean> {
|
||||
override fun onSuccess(data: DriverStatusQueryRespBean) {
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["msg"] = data.toString()
|
||||
MogoAnalyticUtils.track("QueryCarStatus", map)
|
||||
go2LoginInfo(data.data, "接口获取")
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["msg"] = "网络错误"
|
||||
MogoAnalyticUtils.track("QueryCarStatus", map)
|
||||
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastCharterUtils.showToastShort(mContext!!.getString(R.string.biz_login_network_error_tip))
|
||||
} else {
|
||||
ToastCharterUtils.showToastShort(mContext!!.getString(R.string.biz_login_request_error_tip))
|
||||
}
|
||||
// LoginStatusManager.setLoginError(-10012, "网络错误")
|
||||
LoginStatusManager.setLoginError(-10012, StringUtils.getString(R.string.module_och_network_mistake))
|
||||
// 依赖参数
|
||||
subscribe = Observable.timer(5, TimeUnit.SECONDS)
|
||||
.subscribe { _: Long? -> queryCarStatus(readCatche) }
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["msg"] = msg
|
||||
map["code"] = code
|
||||
MogoAnalyticUtils.track("QueryCarStatus", map)
|
||||
|
||||
LoginStatusManager.setLoginError(code, "msg:${msg}")
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
// 依赖参数
|
||||
subscribe = Observable.timer(3, TimeUnit.SECONDS)
|
||||
.subscribe { _: Long? -> queryCarStatus(readCatche) }
|
||||
// if (code == OchCommonConst.WAIT_TAKEN) {
|
||||
//
|
||||
// } else {
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun loginSuccess(data: LoginInfo?) {
|
||||
d(TAG, "loginSuccess:${LoginServiceManager.isLogin()}")
|
||||
if (LoginServiceManager.isLogin()) {
|
||||
CallerDevaToolsFuncConfigListenerManager
|
||||
SharedPrefsMgr.getInstance().putString("och_account", data?.phone)
|
||||
} else {
|
||||
SharedPrefsMgr.getInstance().putString("och_account", "")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun gotoOfflineMode() {
|
||||
FunctionBuildConfig.isOffLine = true
|
||||
var loginInfo = LoginServiceManager.getLoginInfo()
|
||||
if(loginInfo==null){
|
||||
loginInfo = LoginInfo()
|
||||
}
|
||||
LoginServiceManager.setLoginInfo(loginInfo)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,166 @@
|
||||
package com.mogo.och.biz.login.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.login.LoginServiceManager
|
||||
import com.mogo.och.biz.login.bean.LoginInfo
|
||||
import com.mogo.och.biz.login.bean.TaxiLogoutReqBean
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginF2aReqBean
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginRespBean
|
||||
import com.mogo.och.biz.login.net.OchCommonServiceManager
|
||||
import com.mogo.och.bridge.autopilot.location.OchLocationManager
|
||||
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
*
|
||||
* 网约车 - 出租车业务逻辑处理
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object F2aLoginModel: CommonLoginModel() {
|
||||
|
||||
fun gotoLogin(phone: String, pwd: String) {
|
||||
mContext?.let {
|
||||
OchCommonServiceManager.gotoLoginBypwd(it, phone, pwd,
|
||||
object : OchCommonServiceCallback<LoginRespBean> {
|
||||
override fun onSuccess(data: LoginRespBean?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 登录成功需要新的值
|
||||
queryCarStatus(false)
|
||||
iTaxiLoginCallback?.loginfirstSuccess(data.data,pwd)
|
||||
} else {
|
||||
if (data != null) {
|
||||
ToastCharterUtils.showToastShort(data.msg.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_network_error_tip))
|
||||
} else {
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_request_error_tip_unmanned))
|
||||
}
|
||||
iTaxiLoginCallback?.netErrorCallback()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun gotoLoginByF2aCode(phone: String?, f2aCode: String) {
|
||||
mContext?.let {
|
||||
val location = OchLocationManager.getWgs02Location()
|
||||
val location4Login = LoginF2aReqBean.Location4Login(location.latitude, location.longitude,"WGS84")
|
||||
OchCommonServiceManager.gotoLoginByf2aCode(it, phone, f2aCode, location4Login,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 登录成功需要新的值
|
||||
queryCarStatus(false)
|
||||
} else {
|
||||
if (data != null) {
|
||||
ToastCharterUtils.showToastShort(data.msg.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_network_error_tip))
|
||||
} else {
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_request_error_tip_unmanned))
|
||||
}
|
||||
iTaxiLoginCallback?.netErrorCallback()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fun gotoRestPwd(driverId:Long,pwd: String,oldPwd:String) {
|
||||
mContext?.let {
|
||||
OchCommonServiceManager.gotoRestPwd(it,driverId, pwd,oldPwd,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 登录成功需要新的值
|
||||
queryCarStatus(false)
|
||||
iTaxiLoginCallback?.restPwdSuccess()
|
||||
} else {
|
||||
if (data != null) {
|
||||
ToastCharterUtils.showToastShort(data.msg.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_network_error_tip))
|
||||
} else {
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_request_error_tip_unmanned))
|
||||
}
|
||||
iTaxiLoginCallback?.netErrorCallback()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Synchronized
|
||||
private fun go2LoginInfo(data: LoginInfo?, source: String) {
|
||||
d(TAG, "设置源:${source}")
|
||||
data?.let {
|
||||
LoginServiceManager.setLoginInfo(data)
|
||||
loginSuccess(data)
|
||||
}
|
||||
}
|
||||
|
||||
// 登出
|
||||
fun logout() {
|
||||
val location4Login = TaxiLogoutReqBean.Location4Login()
|
||||
OchCommonServiceManager.logout(
|
||||
mContext!!, location4Login,
|
||||
object : OchCommonServiceCallback<BaseData> {
|
||||
override fun onSuccess(data: BaseData?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
OchSPManager.remove(loginInfoKey)
|
||||
// 退出登录成功需要查询新的
|
||||
queryCarStatus(false)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastCharterUtils.showToastShort(mContext!!.getString(R.string.biz_login_network_error_tip))
|
||||
} else {
|
||||
ToastCharterUtils.showToastShort(mContext!!.getString(R.string.biz_login_request_error_tip))
|
||||
}
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
@@ -45,56 +45,7 @@ import java.util.concurrent.TimeUnit
|
||||
* 网约车 - 出租车业务逻辑处理
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object LoginModel {
|
||||
|
||||
private const val TAG = "${M_OCHCOMMON}LoginModel"
|
||||
private var mContext: Context? = null
|
||||
var iTaxiLoginCallback: ITaxiLoginCallback? = null
|
||||
private var subscribe: Disposable? = null
|
||||
|
||||
private val loginInfoKey = "LOGININFOKEY"
|
||||
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, _ ->
|
||||
d(TAG, "onIntentReceived = %s", intentStr)
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)
|
||||
&& AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
// 网络链接成功可以先读取本地再获取服务器
|
||||
queryCarStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val snChangeListener = object : ISpCallback {
|
||||
override fun snChange() {
|
||||
d(TAG, "sn 发生变化${OchSPManager.getSn()}")
|
||||
if(AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||
queryCarStatus(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
mContext = AbsMogoApplication.getApp()
|
||||
IntentManager.getInstance()
|
||||
.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
}
|
||||
|
||||
fun hasInit(): Boolean {
|
||||
return iTaxiLoginCallback != null
|
||||
}
|
||||
|
||||
fun setiTaxiLoginCallback(iTaxiLoginCallback: ITaxiLoginCallback?) {
|
||||
d(TAG, "setiTaxiLoginCallback")
|
||||
OchSPManager.addListener(TAG, snChangeListener)
|
||||
LoginModel.iTaxiLoginCallback = iTaxiLoginCallback
|
||||
}
|
||||
|
||||
fun release() {
|
||||
d(TAG, "release")
|
||||
OchSPManager.remove(TAG)
|
||||
iTaxiLoginCallback = null
|
||||
}
|
||||
object LoginModel: CommonLoginModel() {
|
||||
|
||||
/**
|
||||
* 获取手机验证码
|
||||
@@ -137,7 +88,7 @@ object LoginModel {
|
||||
|
||||
}
|
||||
|
||||
fun gotoLogin(phone: String, code: String, isAutoLoginMode: Boolean) {
|
||||
fun gotoLogin(phone: String, code: String) {
|
||||
mContext?.let {
|
||||
val location = OchLocationManager.getGCJ02Location()
|
||||
val location4Login = TaxiLoginReqBean.Location4Login(location.latitude, location.longitude)
|
||||
@@ -145,12 +96,7 @@ object LoginModel {
|
||||
object : OchCommonServiceCallback<TaxiLoginRespBean> {
|
||||
override fun onSuccess(data: TaxiLoginRespBean?) {
|
||||
if (null != data && 0 == data.code) {
|
||||
// 获取验证码成功
|
||||
if (isAutoLoginMode){
|
||||
iTaxiLoginCallback?.stopAutoLogin()
|
||||
}else{
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_login_success))
|
||||
}
|
||||
// 登录成功需要新的值
|
||||
queryCarStatus(false)
|
||||
} else {
|
||||
@@ -164,12 +110,7 @@ object LoginModel {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_network_error_tip))
|
||||
} else {
|
||||
if (isAutoLoginMode){
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_request_error_tip_unmanned))
|
||||
}else{
|
||||
ToastCharterUtils.showToastShort(mContext?.getString(R.string.biz_login_request_error_tip))
|
||||
}
|
||||
|
||||
}
|
||||
iTaxiLoginCallback?.netErrorCallback()
|
||||
}
|
||||
@@ -181,80 +122,6 @@ object LoginModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 接单状态和登录状态查询
|
||||
* 1、司机端登录成功后开启2分钟定时请求登录状态
|
||||
* 2、对外提供查询登录状态
|
||||
* 3、网络状态发生变化后查询
|
||||
* 4、sn 发生变化后查询
|
||||
* 5、登录成功后主动查询
|
||||
* 6、错误重试
|
||||
* 7、错误重试
|
||||
* 8、登出后重试
|
||||
*/
|
||||
fun queryCarStatus(readCatche: Boolean = true) {
|
||||
mContext?.let {
|
||||
Log.d(TAG, "设置源:queryCarStatus")
|
||||
if (readCatche) {
|
||||
val loginInfo = LoginServiceManager.getLoginInfo()
|
||||
go2LoginInfo(loginInfo,"缓存获取")
|
||||
}
|
||||
OchCommonServiceManager.queryDriverServiceStatus(
|
||||
it,
|
||||
object : OchCommonServiceCallback<DriverStatusQueryRespBean> {
|
||||
override fun onSuccess(data: DriverStatusQueryRespBean) {
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["msg"] = data.toString()
|
||||
MogoAnalyticUtils.track("QueryCarStatus", map)
|
||||
go2LoginInfo(data.data, "接口获取")
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["msg"] = "网络错误"
|
||||
MogoAnalyticUtils.track("QueryCarStatus", map)
|
||||
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastCharterUtils.showToastShort(mContext!!.getString(R.string.biz_login_network_error_tip))
|
||||
} else {
|
||||
ToastCharterUtils.showToastShort(mContext!!.getString(R.string.biz_login_request_error_tip))
|
||||
}
|
||||
// LoginStatusManager.setLoginError(-10012, "网络错误")
|
||||
LoginStatusManager.setLoginError(-10012, StringUtils.getString(R.string.module_och_network_mistake))
|
||||
// 依赖参数
|
||||
subscribe = Observable.timer(5, TimeUnit.SECONDS)
|
||||
.subscribe { _: Long? -> queryCarStatus(readCatche) }
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
val map: MutableMap<String, Any> = HashMap()
|
||||
map["msg"] = msg
|
||||
map["code"] = code
|
||||
MogoAnalyticUtils.track("QueryCarStatus", map)
|
||||
|
||||
LoginStatusManager.setLoginError(code, "msg:${msg}")
|
||||
ToastUtilsOch.showWithCodeMessage(code, msg)
|
||||
// 依赖参数
|
||||
subscribe = Observable.timer(3, TimeUnit.SECONDS)
|
||||
.subscribe { _: Long? -> queryCarStatus(readCatche) }
|
||||
// if (code == OchCommonConst.WAIT_TAKEN) {
|
||||
//
|
||||
// } else {
|
||||
// }
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@Synchronized
|
||||
private fun go2LoginInfo(data: LoginInfo?, source: String) {
|
||||
d(TAG, "设置源:${source}")
|
||||
data?.let {
|
||||
LoginServiceManager.setLoginInfo(data)
|
||||
loginSuccess(data)
|
||||
}
|
||||
}
|
||||
|
||||
// 登出
|
||||
fun logout() {
|
||||
val location4Login = TaxiLogoutReqBean.Location4Login()
|
||||
@@ -283,23 +150,4 @@ object LoginModel {
|
||||
})
|
||||
}
|
||||
|
||||
fun loginSuccess(data: LoginInfo?) {
|
||||
d(TAG, "loginSuccess:${LoginServiceManager.isLogin()}")
|
||||
if (LoginServiceManager.isLogin()) {
|
||||
SharedPrefsMgr.getInstance().putString("och_account", data?.phone)
|
||||
} else {
|
||||
SharedPrefsMgr.getInstance().putString("och_account", "")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fun gotoOfflineMode() {
|
||||
FunctionBuildConfig.isOffLine = true
|
||||
var loginInfo = LoginServiceManager.getLoginInfo()
|
||||
if(loginInfo==null){
|
||||
loginInfo = LoginInfo()
|
||||
}
|
||||
LoginServiceManager.setLoginInfo(loginInfo)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.mogo.och.biz.login.model
|
||||
|
||||
import com.mogo.och.common.module.manager.EnvManager
|
||||
|
||||
object SwitchLoginModel {
|
||||
fun logout() {
|
||||
if (EnvManager.isPhoneCodeMode()) {
|
||||
F2aLoginModel.logout()
|
||||
}else{
|
||||
LoginModel.logout()
|
||||
}
|
||||
}
|
||||
|
||||
fun release() {
|
||||
LoginModel.release()
|
||||
F2aLoginModel.release()
|
||||
}
|
||||
|
||||
fun queryCarStatus(readCatche:Boolean){
|
||||
if (EnvManager.isPhoneCodeMode()) {
|
||||
F2aLoginModel.queryCarStatus(readCatche)
|
||||
}else{
|
||||
LoginModel.queryCarStatus(readCatche)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,25 +2,28 @@ package com.mogo.och.biz.login.net
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||
import com.mogo.commons.env.ProjectUtils
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.och.biz.login.bean.DriverStatusQueryRespBean
|
||||
import com.mogo.och.biz.login.bean.TaxiLoginReqBean
|
||||
import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.biz.login.bean.DriverStatusQueryRespBean
|
||||
import com.mogo.och.biz.login.bean.TaxiLoginReqBean
|
||||
import com.mogo.och.biz.login.bean.TaxiLoginRespBean
|
||||
import com.mogo.och.biz.login.bean.TaxiLoginSmsReqBean
|
||||
import com.mogo.och.biz.login.bean.TaxiLogoutReqBean
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginF2aReqBean
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginReqBean
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginRespBean
|
||||
import com.mogo.och.biz.login.bean.f2a.RestPwdReqBean
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||
import com.mogo.och.common.module.network.interceptor.transformTry
|
||||
import com.mogo.commons.env.ProjectUtils
|
||||
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
|
||||
object OchCommonServiceManager {
|
||||
|
||||
@@ -168,4 +171,64 @@ object OchCommonServiceManager {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过密码半登录
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun gotoLoginBypwd(
|
||||
context: Context, phone: String?, pwd: String?,
|
||||
callback: OchCommonServiceCallback<LoginRespBean>?
|
||||
) {
|
||||
CallerLogger.d(TAG, "gotoLoginBycode:通过手机验证码登录:${phone}---${pwd}")
|
||||
val sn = OchSPManager.getSn()
|
||||
ochLoginServiceSaasEh.gotoLoginBypwd(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
LoginReqBean(phone, pwd, sn)
|
||||
).transformTry().subscribe(OchCommonSubscribeImpl(context, callback, "login"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新设置密码
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun gotoRestPwd(
|
||||
context: Context, driverId: Long?, pwd: String?,oldPwd:String,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
CallerLogger.d(TAG, "gotoLoginBycode:重置密码")
|
||||
val sn = OchSPManager.getSn()
|
||||
ochLoginServiceSaasEh.gotoresetPwd(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
RestPwdReqBean(driverId, pwd,oldPwd)
|
||||
).transformTry().subscribe(OchCommonSubscribeImpl(context, callback, "gotoRestPwd"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新设置密码
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun gotoLoginByf2aCode(
|
||||
context: Context, phone: String?, mfaCode: String?,
|
||||
location4Login: LoginF2aReqBean.Location4Login,
|
||||
callback: OchCommonServiceCallback<BaseData>?
|
||||
) {
|
||||
CallerLogger.d(TAG, "gotoLoginBycode:重置密码")
|
||||
val sn = OchSPManager.getSn()
|
||||
ochLoginServiceSaasEh.gotoLogByf2aCode(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
LoginF2aReqBean(phone, mfaCode,sn,location4Login)
|
||||
).transformTry().subscribe(OchCommonSubscribeImpl(context, callback, "gotoRestPwd"))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,6 +6,10 @@ import com.mogo.och.biz.login.bean.TaxiLoginReqBean;
|
||||
import com.mogo.och.biz.login.bean.TaxiLoginRespBean;
|
||||
import com.mogo.och.biz.login.bean.TaxiLoginSmsReqBean;
|
||||
import com.mogo.och.biz.login.bean.TaxiLogoutReqBean;
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginF2aReqBean;
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginReqBean;
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginRespBean;
|
||||
import com.mogo.och.biz.login.bean.f2a.RestPwdReqBean;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
@@ -63,4 +67,45 @@ interface OchLoginServiceSaasEhApi {
|
||||
Observable<DriverStatusQueryRespBean> queryDriverServiceStatusAndLoginStatus(@Header("appId") String appId
|
||||
, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过验证码登录
|
||||
*
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/l4r-vehicle/api/tnt/driver/auth/v2/loginNext")
|
||||
Observable<LoginRespBean> gotoLoginBypwd(@Header("appId") String appId
|
||||
, @Header("ticket") String ticket, @Body LoginReqBean data);
|
||||
|
||||
/**
|
||||
* 通过验证码登录
|
||||
*
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/l4r-vehicle/api/tnt/driver/auth/v2/resetPwd")
|
||||
Observable<BaseData> gotoresetPwd(@Header("appId") String appId
|
||||
, @Header("ticket") String ticket, @Body RestPwdReqBean data);
|
||||
|
||||
/**
|
||||
* 通过验证码登录
|
||||
*
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
@POST("/l4r-vehicle/api/tnt/driver/auth/v2/login")
|
||||
Observable<BaseData> gotoLogByf2aCode(@Header("appId") String appId
|
||||
, @Header("ticket") String ticket, @Body LoginF2aReqBean data);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.mogo.och.biz.login.presenter
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.biz.login.callback.ITaxiLoginCallback
|
||||
import com.mogo.och.biz.login.model.LoginModel
|
||||
import com.mogo.och.biz.login.ui.LoginPassengerFragment
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
@@ -15,7 +13,7 @@ import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class LoginPassengerPresenter(view: LoginPassengerFragment?) : Presenter<LoginPassengerFragment?>(view), ITaxiLoginCallback {
|
||||
class LoginPassengerPresenter(view: LoginPassengerFragment?) : Presenter<LoginPassengerFragment?>(view) {
|
||||
|
||||
private val TAG = LoginPassengerPresenter::class.java.simpleName
|
||||
|
||||
@@ -25,7 +23,6 @@ class LoginPassengerPresenter(view: LoginPassengerFragment?) : Presenter<LoginPa
|
||||
}
|
||||
|
||||
private fun initListeners() {
|
||||
LoginModel.setiTaxiLoginCallback(this)
|
||||
BizLoopManager.setLoopFunction(TAG, LoopInfo(2,::showStatus))
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,10 @@ import com.mogo.eagle.core.utilcode.mogo.Product
|
||||
import com.mogo.eagle.core.utilcode.mogo.Vehicle
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_OCHCOMMON
|
||||
import com.mogo.och.biz.login.callback.ITaxiLoginCallback
|
||||
import com.mogo.och.biz.login.ui.LoginFragment
|
||||
import com.mogo.och.biz.login.model.LoginModel
|
||||
import com.mogo.och.biz.login.model.SwitchLoginModel
|
||||
import com.mogo.och.common.module.biz.login.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import io.reactivex.disposables.Disposable
|
||||
import java.util.concurrent.atomic.AtomicBoolean
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -21,22 +17,17 @@ import java.util.concurrent.atomic.AtomicBoolean
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class LoginPresenter(view: LoginFragment?) : Presenter<LoginFragment?>(view), ITaxiLoginCallback,
|
||||
class LoginPresenter(view: LoginFragment?) : Presenter<LoginFragment?>(view),
|
||||
ILoginCallback {
|
||||
|
||||
private var countDownDisposable: Disposable? = null
|
||||
|
||||
private val TAG = M_OCHCOMMON+LoginPresenter::class.java.simpleName
|
||||
|
||||
private var autoLoginDisposable: Disposable? = null
|
||||
private var isAutoLoginMode = AtomicBoolean(false) // 标记是否处于自动登录模式
|
||||
init {
|
||||
initListeners()
|
||||
CallerLogger.d(TAG, "登录-Init")
|
||||
}
|
||||
|
||||
private fun initListeners() {
|
||||
LoginModel.setiTaxiLoginCallback(this)
|
||||
LoginStatusManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
@@ -53,33 +44,10 @@ class LoginPresenter(view: LoginFragment?) : Presenter<LoginFragment?>(view), IT
|
||||
CallerLogger.d(TAG, "登录-初始化")
|
||||
}
|
||||
|
||||
|
||||
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
LoginModel.release()
|
||||
countDownDisposable?.let {
|
||||
if (!it.isDisposed) {
|
||||
it.dispose()
|
||||
}
|
||||
}
|
||||
stopAutoLogin()
|
||||
SwitchLoginModel.release()
|
||||
|
||||
}
|
||||
|
||||
override fun stopAutoLogin() {
|
||||
isAutoLoginMode.set(false)
|
||||
autoLoginDisposable?.let {
|
||||
if (!it.isDisposed) {
|
||||
it.dispose()
|
||||
}
|
||||
}
|
||||
autoLoginDisposable = null
|
||||
OchChainLogManager.writeChainLog(TAG, "登录成功,停止自动登录循环")
|
||||
}
|
||||
|
||||
override fun netErrorCallback() {
|
||||
if (!isAutoLoginMode.get()) {
|
||||
mView?.showLoginOffLineModel()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,9 +33,6 @@ import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.login.LoginConst
|
||||
import com.mogo.och.biz.login.callback.ILoginViewCallback
|
||||
import com.mogo.och.biz.login.presenter.LoginPresenter
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
|
||||
import com.mogo.skin.utils.SkinResources
|
||||
import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
|
||||
import com.shuyu.gsyvideoplayer.listener.GSYSampleCallBack
|
||||
@@ -206,14 +203,6 @@ class LoginFragment : MvpFragment<LoginFragment?, LoginPresenter?>(), ILoginView
|
||||
biz_login_svp?.setBackgroundResource(R.drawable.biz_login_bg_bus_end)
|
||||
}
|
||||
}
|
||||
// if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
||||
// cl_welcome_info?.visibility = View.VISIBLE
|
||||
// UiThreadHandler.postDelayed({
|
||||
// mPresenter?.autoLogin()
|
||||
// }, 2_000, UiThreadHandler.MODE.QUEUE)
|
||||
// } else {
|
||||
// cl_login_info?.visibility = View.VISIBLE
|
||||
// }
|
||||
login_view_info?.visibility = View.VISIBLE
|
||||
}else{
|
||||
viewColdStart.setColdStartResultListener(object: ColdStartView.ColdStartResultListener{
|
||||
@@ -302,26 +291,4 @@ class LoginFragment : MvpFragment<LoginFragment?, LoginPresenter?>(), ILoginView
|
||||
viewColdStart.setColdStartResultListener(null)
|
||||
}
|
||||
|
||||
fun showLoginOffLineModel() {
|
||||
context?.let {
|
||||
val builder = CommonDialogStatus.Builder()
|
||||
val closeLineConfirmDialog = builder
|
||||
.title(ResourcesUtils.getString(R.string.biz_login_net_error_title))
|
||||
.tips(ResourcesUtils.getString(R.string.biz_login_net_error_tip))
|
||||
.confirmStr(ResourcesUtils.getString(R.string.biz_login_offline_login))
|
||||
.status(CommonDialogStatus.Status.neterror)
|
||||
.build(it)
|
||||
closeLineConfirmDialog.setClickListener(object : CommonDialogStatus.ClickListener {
|
||||
override fun confirm() {
|
||||
|
||||
login_view_info?.gotoLogin4Fragment(LoginConst.OFFLINEPHONE, LoginConst.OFFLINECODE)
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
closeLineConfirmDialog.dismiss()
|
||||
}
|
||||
})
|
||||
closeLineConfirmDialog.show()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,14 @@ import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.KeyboardUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.login.LoginConst
|
||||
import com.mogo.och.biz.login.ui.LoginFragment
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.wigets.dialog.CommonDialogStatus
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_acbtn_login
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_acet_phone_code_value
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_ace_login_phone_value
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_acet_phone_code_value
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_actv_login_get_code
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_actv_welcome_login_title
|
||||
|
||||
@@ -107,10 +110,6 @@ class LoginView : ConstraintLayout, LoginViewModel.IErrorInfoViewCallback {
|
||||
}
|
||||
}
|
||||
|
||||
fun gotoLogin4Fragment(phone: String, code: String){
|
||||
viewModel?.gotoLogin(phone, code)
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
@@ -128,10 +127,6 @@ class LoginView : ConstraintLayout, LoginViewModel.IErrorInfoViewCallback {
|
||||
|
||||
}
|
||||
|
||||
fun getBottomInfo(){
|
||||
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
initView()
|
||||
@@ -170,4 +165,26 @@ class LoginView : ConstraintLayout, LoginViewModel.IErrorInfoViewCallback {
|
||||
}
|
||||
}
|
||||
|
||||
override fun showLoginOffLineModel() {
|
||||
context?.let {
|
||||
val builder = CommonDialogStatus.Builder()
|
||||
val closeLineConfirmDialog = builder
|
||||
.title(ResourcesUtils.getString(R.string.biz_login_net_error_title))
|
||||
.tips(ResourcesUtils.getString(R.string.biz_login_net_error_tip))
|
||||
.confirmStr(ResourcesUtils.getString(R.string.biz_login_offline_login))
|
||||
.status(CommonDialogStatus.Status.neterror)
|
||||
.build(it)
|
||||
closeLineConfirmDialog.setClickListener(object : CommonDialogStatus.ClickListener {
|
||||
override fun confirm() {
|
||||
viewModel?.gotoLogin(LoginConst.OFFLINEPHONE, LoginConst.OFFLINECODE)
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
closeLineConfirmDialog.dismiss()
|
||||
}
|
||||
})
|
||||
closeLineConfirmDialog.show()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -27,11 +27,6 @@ class LoginViewModel : ViewModel(), ITaxiLoginCallback, ILoginCallback {
|
||||
|
||||
private var countDownDisposable: Disposable? = null
|
||||
|
||||
|
||||
init {
|
||||
|
||||
}
|
||||
|
||||
fun setDistanceCallback(viewCallback: IErrorInfoViewCallback) {
|
||||
this.viewCallback = viewCallback
|
||||
initListeners()
|
||||
@@ -69,7 +64,7 @@ class LoginViewModel : ViewModel(), ITaxiLoginCallback, ILoginCallback {
|
||||
gotoOfflineMode()
|
||||
return
|
||||
}
|
||||
LoginModel.gotoLogin(phone, code, false)
|
||||
LoginModel.gotoLogin(phone, code)
|
||||
viewCallback?.closeSoftInput()
|
||||
}
|
||||
|
||||
@@ -112,10 +107,16 @@ class LoginViewModel : ViewModel(), ITaxiLoginCallback, ILoginCallback {
|
||||
LoginModel.gotoOfflineMode()
|
||||
}
|
||||
|
||||
override fun netErrorCallback() {
|
||||
super.netErrorCallback()
|
||||
viewCallback?.showLoginOffLineModel()
|
||||
}
|
||||
|
||||
interface IErrorInfoViewCallback {
|
||||
fun inputPhoneError()
|
||||
fun closeSoftInput()
|
||||
fun setCountDownText(text: String, enable: Boolean)
|
||||
fun showLoginOffLineModel()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.och.biz.login.ui.loginf2a
|
||||
|
||||
import android.content.Context
|
||||
import android.os.SystemClock
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
@@ -11,15 +13,35 @@ import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.findViewTreeViewModelStoreOwner
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ImageUtils
|
||||
import com.mogo.eagle.core.utilcode.util.KeyboardUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.login.ui.LoginFragment
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_acbtn_login
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_acet_phone_code_value
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_ace_login_phone_value
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_actv_login_get_code
|
||||
import kotlinx.android.synthetic.main.biz_login_view_old.view.biz_actv_welcome_login_title
|
||||
import com.mogo.och.common.module.utils.createQRCode
|
||||
import com.mogo.och.common.module.utils.createQRCodeWithPicture
|
||||
import com.mogo.skin.utils.SkinResources
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.acet_f2a_code
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.acet_input_number_1
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.acet_input_number_2
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.acet_input_number_3
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.acet_input_number_4
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.acet_input_number_5
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.acet_input_number_6
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.aciv_get_f2a_code
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.biz_acbtn_f2a_login_first
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.biz_acbtn_f2a_login_normal
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.biz_acbtn_login
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.biz_acbtn_reset_passwrod
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.biz_ace_login_phone_value
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.biz_acet_phone_pwd_value
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.biz_actv_welcome_login_title
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.biz_reset_password_first_value
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.biz_reset_password_secode_value
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.group_bind_sec_code
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.group_f2a_login
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.group_password_login
|
||||
import kotlinx.android.synthetic.main.biz_login_view_f2a.view.group_reset_password
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
|
||||
class LoginF2aView : ConstraintLayout, LoginF2aViewModel.IErrorInfoViewCallback {
|
||||
@@ -52,20 +74,24 @@ class LoginF2aView : ConstraintLayout, LoginF2aViewModel.IErrorInfoViewCallback
|
||||
private fun initListener(){
|
||||
biz_acbtn_login.onClick {
|
||||
val phone = biz_ace_login_phone_value.text.toString()
|
||||
val code = biz_acet_phone_code_value.text.toString()
|
||||
viewModel?.gotoLogin(phone, code)
|
||||
val pwd = biz_acet_phone_pwd_value.text.toString()
|
||||
viewModel?.gotoLogin(phone, pwd)
|
||||
}
|
||||
|
||||
biz_acbtn_reset_passwrod.onClick {
|
||||
val pwd = biz_reset_password_first_value.text.toString()
|
||||
val pwdSecod = biz_reset_password_secode_value.text.toString()
|
||||
viewModel?.gotoRestPwd(pwd,pwdSecod)
|
||||
}
|
||||
|
||||
biz_acbtn_f2a_login_first.onClick {
|
||||
val f2aCode = acet_f2a_code.text.toString()
|
||||
viewModel?.gotoLogin4F2a(f2aCode)
|
||||
}
|
||||
|
||||
biz_actv_welcome_login_title.setOnClickListener {
|
||||
continuousClick()
|
||||
}
|
||||
biz_actv_login_get_code.setOnClickListener {
|
||||
OchChainLogManager.writeChainLog("登录页面","点击获取验证码")
|
||||
if(viewModel==null){
|
||||
OchChainLogManager.writeChainLog("司机登录页面","mPresenter=${viewModel}")
|
||||
}else{
|
||||
viewModel?.getPhoneCode(biz_ace_login_phone_value.text.toString())
|
||||
}
|
||||
}
|
||||
|
||||
biz_ace_login_phone_value.addTextChangedListener {
|
||||
it?.let { itEditable ->
|
||||
@@ -74,6 +100,43 @@ class LoginF2aView : ConstraintLayout, LoginF2aViewModel.IErrorInfoViewCallback
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val etList = listOf(acet_input_number_1, acet_input_number_2, acet_input_number_3, acet_input_number_4, acet_input_number_5, acet_input_number_6)
|
||||
|
||||
etList.forEachIndexed { index, editText ->
|
||||
editText.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
if (!s.isNullOrEmpty()) {
|
||||
// 输入了内容,跳到下一格
|
||||
if (index < etList.size - 1) {
|
||||
etList[index + 1].requestFocus()
|
||||
} else {
|
||||
// 最后一格,收集验证码
|
||||
val code = etList.joinToString("") { it.text.toString() }
|
||||
}
|
||||
} else {
|
||||
// 删除了内容,跳到上一格
|
||||
if (index > 0) {
|
||||
etList[index - 1].requestFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
biz_acbtn_f2a_login_normal.onClick {
|
||||
val stringBuilder = StringBuilder()
|
||||
etList.forEach {
|
||||
stringBuilder.append(it.text)
|
||||
}
|
||||
if(stringBuilder.length==6){
|
||||
viewModel?.gotoLogin4F2a(stringBuilder.toString())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -91,7 +154,7 @@ class LoginF2aView : ConstraintLayout, LoginF2aViewModel.IErrorInfoViewCallback
|
||||
mHits[mHits.size - 1] = SystemClock.uptimeMillis()
|
||||
if (mHits[0] >= (SystemClock.uptimeMillis() - DURATION)) {
|
||||
mHits = LongArray(COUNTS) //重新初始化数组
|
||||
viewModel?.gotoLogin("13288888888", "8888")
|
||||
viewModel?.gotoLogin4Code("13288888888", "8888")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,6 +185,11 @@ class LoginF2aView : ConstraintLayout, LoginF2aViewModel.IErrorInfoViewCallback
|
||||
viewModel?.setDistanceCallback(this)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
|
||||
}
|
||||
|
||||
|
||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
||||
super.onVisibilityAggregated(isVisible)
|
||||
@@ -160,14 +228,42 @@ class LoginF2aView : ConstraintLayout, LoginF2aViewModel.IErrorInfoViewCallback
|
||||
KeyboardUtils.hideSoftInput(ActivityUtils.getTopActivity())
|
||||
}
|
||||
|
||||
override fun setCountDownText(text: String, enable: Boolean) {
|
||||
if (enable) {
|
||||
biz_actv_login_get_code.setText(R.string.biz_login_get_code)
|
||||
biz_actv_login_get_code.isEnabled = true
|
||||
} else {
|
||||
biz_actv_login_get_code.text = text
|
||||
biz_actv_login_get_code.isEnabled = false
|
||||
override fun showLoginView() {
|
||||
group_password_login.visibility = VISIBLE
|
||||
group_reset_password.visibility = GONE
|
||||
group_bind_sec_code.visibility = GONE
|
||||
group_f2a_login.visibility = GONE
|
||||
}
|
||||
|
||||
override fun showRestPassword() {
|
||||
group_password_login.visibility = GONE
|
||||
group_reset_password.visibility = VISIBLE
|
||||
group_bind_sec_code.visibility = GONE
|
||||
group_f2a_login.visibility = GONE
|
||||
}
|
||||
|
||||
override fun showF2aLoginViewSecod() {
|
||||
group_password_login.visibility = GONE
|
||||
group_reset_password.visibility = GONE
|
||||
group_bind_sec_code.visibility = GONE
|
||||
group_f2a_login.visibility = VISIBLE
|
||||
}
|
||||
|
||||
override fun showQrLoginView(otpAuthUrl: String?) {
|
||||
group_password_login.visibility = GONE
|
||||
group_reset_password.visibility = GONE
|
||||
group_bind_sec_code.visibility = VISIBLE
|
||||
group_f2a_login.visibility = GONE
|
||||
otpAuthUrl?.let {
|
||||
val qrCenterLogoDrawable =
|
||||
SkinResources.getInstance().getDrawable(R.drawable.icon_qr_center_logo)
|
||||
val qrCenterLogoBitmap = ImageUtils.drawable2Bitmap(qrCenterLogoDrawable)
|
||||
val bmQr = createQRCodeWithPicture(qrCenterLogoBitmap,otpAuthUrl, AutoSizeUtils.dp2px(context, 360f),
|
||||
AutoSizeUtils.dp2px(context, 360f), true
|
||||
)
|
||||
aciv_get_f2a_code.setImageBitmap(bmQr)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,32 +1,31 @@
|
||||
package com.mogo.och.biz.login.ui.loginf2a
|
||||
|
||||
import androidx.lifecycle.ViewModel
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.util.Md5Util
|
||||
import com.mogo.eagle.core.utilcode.util.RegexUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.biz.R
|
||||
import com.mogo.och.biz.login.LoginConst
|
||||
import com.mogo.och.biz.login.bean.f2a.LoginRespBean
|
||||
import com.mogo.och.biz.login.bean.f2a.RestPwdRespBean
|
||||
import com.mogo.och.biz.login.callback.ITaxiLoginCallback
|
||||
import com.mogo.och.biz.login.model.F2aLoginModel
|
||||
import com.mogo.och.biz.login.model.LoginModel
|
||||
import com.mogo.och.biz.login.ui.debugview.BusinessViewModel
|
||||
import com.mogo.och.common.module.biz.login.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||
import com.mogo.och.common.module.utils.CallerLoggerUtils
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.wigets.toast.ToastCharterUtils
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
class LoginF2aViewModel : ViewModel(), ITaxiLoginCallback, ILoginCallback {
|
||||
|
||||
private val TAG = BusinessViewModel::class.java.simpleName
|
||||
private val TAG = LoginF2aViewModel::class.java.simpleName
|
||||
|
||||
private var viewCallback: IErrorInfoViewCallback? = null
|
||||
|
||||
private var countDownDisposable: Disposable? = null
|
||||
|
||||
private var loginRespBean: LoginRespBean.Result?=null;
|
||||
private var oldPwd: String?=null;
|
||||
|
||||
init {
|
||||
|
||||
@@ -39,21 +38,44 @@ class LoginF2aViewModel : ViewModel(), ITaxiLoginCallback, ILoginCallback {
|
||||
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
CallerLogger.d(TAG,"LoginF2aViewModel:onCleared")
|
||||
this.viewCallback = null
|
||||
countDownDisposable?.let {
|
||||
if (!it.isDisposed) {
|
||||
it.dispose()
|
||||
}
|
||||
}
|
||||
F2aLoginModel.setiTaxiLoginCallback(null)
|
||||
LoginStatusManager.removeListener(TAG)
|
||||
}
|
||||
|
||||
private fun initListeners() {
|
||||
LoginModel.setiTaxiLoginCallback(this)
|
||||
CallerLogger.d(TAG,"LoginF2aViewModel:initListeners")
|
||||
F2aLoginModel.setiTaxiLoginCallback(this)
|
||||
LoginStatusManager.addListener(TAG,this)
|
||||
}
|
||||
|
||||
fun gotoLogin(phone: String, code: String) {
|
||||
if(!LoginModel.hasInit()){
|
||||
fun gotoRestPwd(pwd: String, pwdSecod: String) {
|
||||
if(!F2aLoginModel.hasInit()){
|
||||
initListeners()
|
||||
}
|
||||
if(pwd!=pwdSecod){
|
||||
ToastCharterUtils.showToastShort(R.string.biz_login_reset_passwrod_different)
|
||||
return
|
||||
}
|
||||
if(pwd.isBlank()){
|
||||
ToastCharterUtils.showToastShort(R.string.biz_login_reset_passwrod_non_input)
|
||||
return
|
||||
}
|
||||
if(pwd.length<14||pwd.length>20){
|
||||
ToastCharterUtils.showToastShort(R.string.biz_login_reset_passwrod_non_compliant)
|
||||
return
|
||||
}
|
||||
loginRespBean?.let {
|
||||
oldPwd?.let { old->
|
||||
val mD5Result = Md5Util.getMD5Result(pwd)
|
||||
F2aLoginModel.gotoRestPwd(it.driverId,mD5Result,old)
|
||||
}
|
||||
}
|
||||
viewCallback?.closeSoftInput()
|
||||
}
|
||||
fun gotoLogin(phone: String, pwd: String) {
|
||||
if(!F2aLoginModel.hasInit()){
|
||||
initListeners()
|
||||
}
|
||||
if (!RegexUtils.isMobileExact(phone)) {
|
||||
@@ -61,61 +83,77 @@ class LoginF2aViewModel : ViewModel(), ITaxiLoginCallback, ILoginCallback {
|
||||
viewCallback?.inputPhoneError()
|
||||
return
|
||||
}
|
||||
if(code.isBlank()||code.length<4){
|
||||
ToastCharterUtils.showToastShort(R.string.biz_login_code_error)
|
||||
if(pwd.isBlank()){
|
||||
ToastCharterUtils.showToastShort(R.string.biz_login_pwd_error)
|
||||
return
|
||||
}
|
||||
if(phone== LoginConst.OFFLINEPHONE&&code== LoginConst.OFFLINECODE){
|
||||
if(phone== LoginConst.OFFLINEPHONE&&pwd== LoginConst.OFFLINECODE){
|
||||
gotoOfflineMode()
|
||||
return
|
||||
}
|
||||
LoginModel.gotoLogin(phone, code, false)
|
||||
val mD5Result = Md5Util.getMD5Result(pwd)
|
||||
F2aLoginModel.gotoLogin(phone,mD5Result)
|
||||
viewCallback?.closeSoftInput()
|
||||
}
|
||||
|
||||
fun getPhoneCode(phone: String) {
|
||||
OchChainLogManager.writeChainLog("登录页面","获取验证码${phone}")
|
||||
if(!LoginModel.hasInit()){
|
||||
OchChainLogManager.writeChainLog("登录页面","LoginModel没有初始化去初始化")
|
||||
initListeners()
|
||||
}
|
||||
if (!RegexUtils.isMobileExact(phone)) {
|
||||
ToastCharterUtils.showToastShort(R.string.biz_login_phone_error)
|
||||
viewCallback?.inputPhoneError()
|
||||
OchChainLogManager.writeChainLog("登录页面","获取验证码 手机号输入错误")
|
||||
fun gotoLogin4F2a(f2aCode: String) {
|
||||
if(f2aCode.length!=6){
|
||||
ToastCharterUtils.showToastShort(R.string.biz_login_code_error)
|
||||
return
|
||||
}
|
||||
LoginModel.getPhoneCode(phone)
|
||||
loginRespBean?.let {
|
||||
F2aLoginModel.gotoLoginByF2aCode(it.phone,f2aCode)
|
||||
}
|
||||
|
||||
override fun getPhoneCodeSuccess() {
|
||||
super.getPhoneCodeSuccess()
|
||||
val countDownSeconds = 60L;
|
||||
countDownDisposable = Observable.intervalRange(0, countDownSeconds, 0, 1, TimeUnit.SECONDS)
|
||||
.map { aLong -> countDownSeconds - aLong }
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe({
|
||||
viewCallback?.setCountDownText("${it}s",false)
|
||||
CallerLogger.d(TAG, "倒计时:$it")
|
||||
}, {
|
||||
CallerLogger.d(TAG, "倒计时onError:${it}")
|
||||
it.printStackTrace()
|
||||
viewCallback?.setCountDownText(AbsMogoApplication.getApp().getString(R.string.biz_login_get_code),true)
|
||||
}, {
|
||||
CallerLogger.d(TAG, "倒计时onComplete")
|
||||
viewCallback?.setCountDownText(AbsMogoApplication.getApp().getString(R.string.biz_login_get_code),true)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
override fun loginfirstSuccess(data: LoginRespBean.Result?,oldPwd:String) {
|
||||
data?.let {
|
||||
loginRespBean = it
|
||||
this.oldPwd = oldPwd
|
||||
if (it.needInitPassword) {
|
||||
// 修改密码去
|
||||
viewCallback?.showRestPassword()
|
||||
}else{
|
||||
if(it.isPasswordExpired){// 已经超过365天了
|
||||
// 修改密码去
|
||||
viewCallback?.showRestPassword()
|
||||
return
|
||||
}
|
||||
if(it.isPasswordExpiringSoon){// 还有特定日期就超过365天
|
||||
ToastUtils.showShort(ResourcesUtils.getString(R.string.biz_login_password_will_out_day))
|
||||
}
|
||||
if(it.isFirstLogin){
|
||||
viewCallback?.showQrLoginView(it.otpAuthUrl)
|
||||
}else{
|
||||
viewCallback?.showF2aLoginViewSecod()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun restPwdSuccess() {
|
||||
loginRespBean = null
|
||||
oldPwd = null
|
||||
viewCallback?.showLoginView()
|
||||
}
|
||||
|
||||
private fun gotoOfflineMode() {
|
||||
LoginModel.gotoOfflineMode()
|
||||
F2aLoginModel.gotoOfflineMode()
|
||||
}
|
||||
|
||||
fun gotoLogin4Code(phone: String, code: String) {
|
||||
LoginModel.gotoLogin(phone,code)
|
||||
}
|
||||
|
||||
interface IErrorInfoViewCallback {
|
||||
fun inputPhoneError()
|
||||
fun closeSoftInput()
|
||||
fun setCountDownText(text: String, enable: Boolean)
|
||||
fun showRestPassword()
|
||||
fun showF2aLoginViewSecod()
|
||||
fun showQrLoginView(otpAuthUrl: String?)
|
||||
fun showLoginView()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package com.mogo.och.biz.login.ui.loginswitch
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import com.mogo.och.biz.login.ui.login.LoginView
|
||||
import com.mogo.och.biz.login.ui.loginf2a.LoginF2aView
|
||||
import com.mogo.och.common.module.manager.EnvManager
|
||||
import com.mogo.och.common.module.manager.transform.OchTransform
|
||||
import com.mogo.och.common.module.manager.transform.OchTransformDispatch
|
||||
|
||||
|
||||
class LoginSwitchView : FrameLayout, OchTransformDispatch {
|
||||
|
||||
constructor(context: Context) : super(context)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet) : super(context, attributeSet)
|
||||
|
||||
constructor(context: Context, attributeSet: AttributeSet, defStyleAttr: Int) : super(
|
||||
context,
|
||||
attributeSet,
|
||||
defStyleAttr
|
||||
)
|
||||
|
||||
constructor(
|
||||
context: Context,
|
||||
attributeSet: AttributeSet,
|
||||
defStyleAttr: Int,
|
||||
defStyleRes: Int
|
||||
) : super(context, attributeSet, defStyleAttr, defStyleRes)
|
||||
|
||||
companion object {
|
||||
val TAG = LoginSwitchView::class.java.simpleName
|
||||
}
|
||||
|
||||
private var loginView:LoginView?=null
|
||||
private var loginF2aView:LoginF2aView?=null
|
||||
|
||||
override fun onLoginModeChange() {
|
||||
super.onLoginModeChange()
|
||||
loadView()
|
||||
}
|
||||
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
OchTransform.addListener(TAG,this)
|
||||
super.onAttachedToWindow()
|
||||
loadView()
|
||||
}
|
||||
|
||||
private fun loadView(){
|
||||
if (EnvManager.isPhoneCodeMode()) {
|
||||
handleLoginView(LoginView::class.java, ::loginView){
|
||||
this.loginView = it
|
||||
}
|
||||
} else {
|
||||
handleLoginView(LoginF2aView::class.java, ::loginF2aView){
|
||||
loginF2aView = it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 统一处理
|
||||
private fun <T : View> handleLoginView(
|
||||
viewClass: Class<T>,
|
||||
getView: () -> T?,
|
||||
setView: (T) -> Unit
|
||||
) {
|
||||
val child = getChildAt(0)
|
||||
if (child != null && viewClass.isInstance(child)) return
|
||||
|
||||
removeAllViews()
|
||||
|
||||
val view = getView() ?: run {
|
||||
// 关键修复:两个 View 都统一强转为泛型 T
|
||||
val newView: T = if (viewClass == LoginView::class.java) {
|
||||
LoginView(context) as T
|
||||
} else {
|
||||
LoginF2aView(context) as T
|
||||
}
|
||||
setView(newView)
|
||||
newView
|
||||
}
|
||||
|
||||
addViewSafely(view)
|
||||
}
|
||||
|
||||
// 安全添加,必加!防止崩溃
|
||||
private fun addViewSafely(view: View) {
|
||||
(view.parent as? ViewGroup)?.removeView(view)
|
||||
addView(view)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
OchTransform.removeListener(TAG)
|
||||
}
|
||||
|
||||
|
||||
override fun onVisibilityAggregated(isVisible: Boolean) {
|
||||
super.onVisibilityAggregated(isVisible)
|
||||
|
||||
}
|
||||
|
||||
init {
|
||||
try {
|
||||
|
||||
} catch (e: Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<com.mogo.och.biz.login.ui.login.LoginView
|
||||
<com.mogo.och.biz.login.ui.loginswitch.LoginSwitchView
|
||||
android:id="@+id/login_view_info"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -38,8 +38,8 @@
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_password_login"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="biz_actv_welcome_login_title,actv_login_phone_title,biz_ace_login_phone_value,actv_phone_code_title,v_phone_code_bg,biz_acet_phone_code_value,biz_acbtn_login"
|
||||
android:visibility="visible"
|
||||
app:constraint_referenced_ids="biz_actv_welcome_login_title,actv_login_phone_title,biz_ace_login_phone_value,actv_phone_code_title,v_phone_code_bg,biz_acet_phone_pwd_value,biz_acbtn_login"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/group_f2a_login"
|
||||
android:visibility="visible"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="biz_actv_f2a_login_title_big,biz_actv_f2a_login_title,biz_actv_f2a_login_title_samll,acet_input_number_1,acet_input_number_2,acet_input_number_3,acet_input_number_4,acet_input_number_5,acet_input_number_6,biz_acbtn_f2a_login_normal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
@@ -128,23 +128,22 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/actv_phone_code_title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/biz_acet_phone_code_value"
|
||||
android:id="@+id/biz_acet_phone_pwd_value"
|
||||
android:layout_width="@dimen/dp_760"
|
||||
android:layout_height="136dp"
|
||||
android:background="@null"
|
||||
android:gravity="center_vertical"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="textPassword"
|
||||
android:maxLength="4"
|
||||
android:maxLines="1"
|
||||
android:hint="@string/biz_login_pwd_hint_text"
|
||||
android:paddingStart="30dp"
|
||||
android:textColor="@color/white"
|
||||
android:textColorHint="@color/white"
|
||||
android:textSize="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/v_phone_code_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/v_phone_code_bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/v_phone_code_bg"
|
||||
tools:text="1881" />
|
||||
app:layout_constraintTop_toTopOf="@+id/v_phone_code_bg" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/biz_acbtn_login"
|
||||
@@ -195,8 +194,8 @@
|
||||
android:background="@drawable/biz_login_phone_normal"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="@string/biz_login_reset_password_first_text_hide"
|
||||
android:inputType="numberSigned"
|
||||
android:maxLength="11"
|
||||
android:inputType="text"
|
||||
android:maxLength="20"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="30dp"
|
||||
android:textColor="@color/white"
|
||||
@@ -224,8 +223,8 @@
|
||||
android:background="@drawable/biz_login_phone_normal"
|
||||
android:gravity="center_vertical"
|
||||
android:hint="@string/biz_login_reset_password_first_text_hide"
|
||||
android:inputType="numberSigned"
|
||||
android:maxLength="11"
|
||||
android:inputType="text"
|
||||
android:maxLength="20"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="30dp"
|
||||
android:textColor="@color/white"
|
||||
@@ -271,8 +270,9 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:background="@color/white"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:layout_width="@dimen/dp_369"
|
||||
android:layout_height="@dimen/dp_360"/>
|
||||
android:layout_height="@dimen/dp_369"/>
|
||||
|
||||
|
||||
<View
|
||||
@@ -293,7 +293,7 @@
|
||||
android:gravity="center_vertical"
|
||||
android:imeOptions="actionDone"
|
||||
android:inputType="numberSigned"
|
||||
android:maxLength="4"
|
||||
android:maxLength="6"
|
||||
android:maxLines="1"
|
||||
android:paddingStart="30dp"
|
||||
android:textColor="@color/white"
|
||||
@@ -375,6 +375,9 @@
|
||||
app:layout_constraintTop_toBottomOf="@+id/biz_actv_f2a_login_title_samll"
|
||||
app:layout_constraintEnd_toStartOf="@+id/acet_input_number_2"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginTop="@dimen/dp_39"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
@@ -387,6 +390,9 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/acet_input_number_3"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toBottomOf="@+id/biz_actv_f2a_login_title_samll"
|
||||
android:layout_marginTop="@dimen/dp_39"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
@@ -399,11 +405,13 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/acet_input_number_4"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toBottomOf="@+id/biz_actv_f2a_login_title_samll"
|
||||
android:layout_marginTop="@dimen/dp_39"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
android:layout_height="@dimen/dp_135"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
android:id="@+id/acet_input_number_4"
|
||||
android:background="@drawable/biz_login_phone_normal"
|
||||
@@ -411,6 +419,9 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/acet_input_number_5"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toBottomOf="@+id/biz_actv_f2a_login_title_samll"
|
||||
android:layout_marginTop="@dimen/dp_39"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
@@ -423,6 +434,9 @@
|
||||
app:layout_constraintEnd_toStartOf="@+id/acet_input_number_6"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toBottomOf="@+id/biz_actv_f2a_login_title_samll"
|
||||
android:layout_marginTop="@dimen/dp_39"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
@@ -434,6 +448,9 @@
|
||||
app:layout_constraintStart_toEndOf="@+id/acet_input_number_5"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textColor="@color/white"
|
||||
app:layout_constraintTop_toBottomOf="@+id/biz_actv_f2a_login_title_samll"
|
||||
android:layout_marginTop="@dimen/dp_39"
|
||||
android:layout_width="@dimen/dp_110"
|
||||
|
||||
@@ -10,15 +10,21 @@
|
||||
<string name="biz_login_login_success">Login successful</string>
|
||||
<string name="biz_login_phone_error">Please enter a correct phone number</string>
|
||||
<string name="biz_login_code_error">Please enter a correct verification code</string>
|
||||
<string name="biz_login_pwd_error">Please enter a correct verification password</string>
|
||||
<string name="biz_login_phone_hint_text">Please enter phone number</string>
|
||||
<string name="biz_login_get_phone_title">Please enter phone number</string>
|
||||
<string name="biz_login_pwd_hint_text">Please enter password</string>
|
||||
|
||||
|
||||
<string name="biz_login_reset_password_title_big">Set a new password</string>
|
||||
<string name="biz_login_reset_password_title">Please set a new password</string>
|
||||
<string name="biz_login_reset_password_first_text_hide">Positions 14-20, containing numbers and English letters (upper and lower case)</string>
|
||||
<string name="biz_login_reset_password_second_title">请确认新密码</string>
|
||||
<string name="biz_login_reset_password_next">Next step</string>
|
||||
|
||||
<string name="biz_login_password_will_out_day">The password is about to expire, and it needs to be changed</string>
|
||||
<string name="biz_login_reset_passwrod_different">The passwords entered twice do not match. Please re-enter</string>
|
||||
<string name="biz_login_reset_passwrod_non_compliant">The password does not meet the requirements. Please re-enter</string>
|
||||
<string name="biz_login_reset_passwrod_non_input">Please enter a new password</string>
|
||||
|
||||
<string name="biz_login_f2a_title_big">Welcome to sign in</string>
|
||||
<string name="biz_login_f2a_title">Please open the MFA authenticator and enter the 6-digit verification code. If you are unable to obtain the verification code, please contact the administrator</string>
|
||||
|
||||
@@ -10,14 +10,20 @@
|
||||
<string name="biz_login_login_success">登录成功</string>
|
||||
<string name="biz_login_phone_error">请输入正确的手机号</string>
|
||||
<string name="biz_login_code_error">请输入正确的验证码</string>
|
||||
<string name="biz_login_pwd_error">请输入正确的密码</string>
|
||||
<string name="biz_login_phone_hint_text">请输入手机号</string>
|
||||
<string name="biz_login_get_phone_title">请输入手机号</string>
|
||||
<string name="biz_login_pwd_hint_text">请输入密码</string>
|
||||
|
||||
<string name="biz_login_reset_password_title_big">设置新密码</string>
|
||||
<string name="biz_login_reset_password_title">请设置新密码</string>
|
||||
<string name="biz_login_reset_password_first_text_hide">14-20位,包含数字、英文大小写</string>
|
||||
<string name="biz_login_reset_password_second_title">请确认新密码</string>
|
||||
<string name="biz_login_reset_password_next">下一步</string>
|
||||
<string name="biz_login_password_will_out_day">密码即将到期,需更改密码</string>
|
||||
<string name="biz_login_reset_passwrod_different">两次输入的密码不一致,请重新输入</string>
|
||||
<string name="biz_login_reset_passwrod_non_compliant">密码不符合要求,请重新输入</string>
|
||||
<string name="biz_login_reset_passwrod_non_input">请输入新密码</string>
|
||||
|
||||
|
||||
<string name="biz_login_f2a_title_big">欢迎登录</string>
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.zhjt.mogo.adas.data.bean.ReceivedAck
|
||||
import com.zhjt.mogo.adas.data.bean.ReceivedAck.Status
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskArrivalNotification
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStartNotification
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStationStop
|
||||
import fsm.Fsm2024
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
@@ -291,6 +292,18 @@ object OchAutoPilotStatusListenerManager : CallerBase<IOchAutopilotStatusListene
|
||||
_orderIdFromFSM = fsmState.orderId
|
||||
}
|
||||
|
||||
override fun onMiddleDoorOpenState(state: Boolean) {
|
||||
OchChainLogManager.writeChainLogDevice("车门状态","车门开闭状态:${state}")
|
||||
}
|
||||
|
||||
override fun onSeatedMenSafetyBeltNotFasten(state: Boolean) {
|
||||
OchChainLogManager.writeChainLogDevice("安全带","是否有人没有系安全带:${state}")
|
||||
}
|
||||
|
||||
override fun onTaskStationStop(newValue: TaskStationStop?) {
|
||||
OchChainLogManager.writeChainLogDevice("stop按钮","stop按钮信息:${newValue}")
|
||||
}
|
||||
|
||||
/**
|
||||
* 消息发送 5s后超时回执
|
||||
*
|
||||
|
||||
@@ -150,12 +150,16 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCallb
|
||||
}
|
||||
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {
|
||||
if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
||||
this.viewCallback?.canStartAutopilot()
|
||||
}else{
|
||||
if (CallerAutoPilotControlManager.isCanStartAutopilot(false) && OchAutoPilotStatusListenerManager.canStartAutopilotFromFSM) {// 不可用
|
||||
this.viewCallback?.canStartAutopilot()
|
||||
} else {// 部分可用
|
||||
this.viewCallback?.canStartAutopilot()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {// 自驾中
|
||||
this.viewCallback?.stopAutopilotAnimation()
|
||||
@@ -203,12 +207,16 @@ class AutopilotStateModel : ViewModel(), IOchAutopilotStatusListener, ILineCallb
|
||||
}
|
||||
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE -> {
|
||||
if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
||||
this.viewCallback?.canStartAutopilot()
|
||||
}else{
|
||||
if (CallerAutoPilotControlManager.isCanStartAutopilot(false) && OchAutoPilotStatusListenerManager.canStartAutopilotFromFSM) {// 不可用
|
||||
this.viewCallback?.canStartAutopilot()
|
||||
} else {// 部分可用
|
||||
this.viewCallback?.autopilotDisable()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING -> {// 自驾中
|
||||
this.viewCallback?.stopAutopilotAnimation()
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.mogo.eagle.core.function.call.hmi.CallerHmiManager
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapRomaListener
|
||||
import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
|
||||
import com.mogo.eagle.core.function.call.och.CallerOchBizFunctionCall4EagleManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
@@ -46,8 +47,11 @@ import com.mogo.och.common.module.biz.birdge.BridgeManager
|
||||
import com.mogo.och.common.module.biz.media.MediaManager
|
||||
import com.mogo.och.common.module.biz.media.data.MediaItem
|
||||
import com.mogo.och.common.module.biz.order.OrderManager
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.debug.location.MogoLocationExit
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
|
||||
import com.mogo.och.common.module.view.DebugFloatWindow
|
||||
import com.zhjt.mogo.adas.data.bean.AutopilotStatistics
|
||||
import mogo.telematics.pad.MessagePad
|
||||
@@ -88,6 +92,7 @@ object DebugDataDispatch {
|
||||
const val mediaStationMedia = "stationMedia"
|
||||
const val startAutopilot = "startAutopilot"
|
||||
const val taskManager = "taskManager"
|
||||
const val mockLanSocketRecycler = "mockLanSocketRecycler"
|
||||
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "video" --ei add 2 --es url "rtmp://liteavapp.qcloud.com/live/liteavdemoplayerstreamid"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "location" --es path "1111/11111"
|
||||
@@ -110,6 +115,7 @@ object DebugDataDispatch {
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "vlmMessage" --es message "前方100米有道路施工,施工长度100米,影响第1、2车道通行。" --ei id 128 --ef time 1880.0
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "vlmImage" --ef time 1880.0
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "stationMedia"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "mockLanSocketRecycler"
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "startAutopilot" --ei startType 0
|
||||
// adb shell am broadcast -a com.mogo.launcher.debug -f 0x011000000 --es type "taskManager" --ei startType 0 --ei indexStation 3
|
||||
|
||||
@@ -126,6 +132,15 @@ object DebugDataDispatch {
|
||||
|
||||
}
|
||||
when (type) {
|
||||
mockLanSocketRecycler -> {
|
||||
val test = """
|
||||
{"loginStatus":1,"routesResult":{"carModel":"","contrailSaveTime":0,"contrailSaveTimeDPQP":0,"csvFileMd5":"","csvFileMd5DPQP":"","csvFileUrl":"","csvFileUrlDPQP":"","description":null,"lineId":599,"lineType":0,"name":"日照路线","runningDur":null,"sites":[{"blackPoints":[],"drivingStatus":1,"gcjLat":35.415598215570135,"gcjLon":119.5672437999642,"introduction":"","isLeaving":false,"isPlayTts":false,"lat":35.4159636,"lon":119.5619282,"name":"万平口二号门","nameKr":null,"passPoints":[],"pointType":0,"seq":1,"siteId":2237,"tag":0,"videoList":null},{"blackPoints":[],"drivingStatus":1,"gcjLat":35.42508993381021,"gcjLon":119.57061731633829,"introduction":"","isLeaving":false,"isPlayTts":true,"lat":35.425452664666736,"lon":119.56530882358173,"name":"万平口三号门","nameKr":null,"passPoints":[],"pointType":0,"seq":2,"siteId":2230,"tag":0,"videoList":null},{"blackPoints":[],"drivingStatus":1,"gcjLat":35.42789752698308,"gcjLon":119.57172358693678,"introduction":"","isLeaving":false,"isPlayTts":true,"lat":35.42825955320252,"lon":119.56641733292894,"name":"开元森泊乐园东门","nameKr":null,"passPoints":[],"pointType":0,"seq":3,"siteId":2231,"tag":0,"videoList":null},{"blackPoints":[],"drivingStatus":1,"gcjLat":35.42965006565593,"gcjLon":119.57241326575509,"introduction":"","isLeaving":false,"isPlayTts":true,"lat":35.43001162948568,"lon":119.56710837593442,"name":"海洋公园","nameKr":null,"passPoints":[],"pointType":0,"seq":4,"siteId":2232,"tag":0,"videoList":null},{"blackPoints":[],"drivingStatus":1,"gcjLat":35.4298883896066,"gcjLon":119.5673148330974,"introduction":"","isLeaving":false,"isPlayTts":true,"lat":35.43024230685599,"lon":119.56199792414594,"name":"啤酒海鲜演艺广场","nameKr":null,"passPoints":[],"pointType":0,"seq":5,"siteId":2233,"tag":0,"videoList":null},{"blackPoints":[],"drivingStatus":2,"gcjLat":35.423815445495705,"gcjLon":119.56504380207225,"introduction":"","isLeaving":true,"isPlayTts":true,"lat":35.424170582431444,"lon":119.55972176882035,"name":"七彩活力乐园","nameKr":null,"passPoints":[],"pointType":0,"seq":6,"siteId":2234,"tag":0,"videoList":null},{"blackPoints":[],"drivingStatus":3,"gcjLat":35.414575023544536,"gcjLon":119.56483592968372,"introduction":"","isLeaving":false,"isPlayTts":false,"lat":35.414937342862615,"lon":119.55951431818669,"name":"开元名都大酒店","nameKr":null,"passPoints":[],"pointType":0,"seq":7,"siteId":2235,"tag":0,"videoList":null},{"blackPoints":[],"drivingStatus":3,"gcjLat":35.41507372147241,"gcjLon":119.56679371308033,"introduction":"","isLeaving":false,"isPlayTts":false,"lat":35.41543882408331,"lon":119.56147704544072,"name":"万平口二号门","nameKr":null,"passPoints":[],"pointType":0,"seq":8,"siteId":2236,"tag":0,"videoList":null}],"status":0,"taskId":8784531,"taskTime":1776328254000,"txtFileMd5":"","txtFileMd5DPQP":"","txtFileUrl":"","txtFileUrlDPQP":"","writeVersion":1776329091789}} """.trimIndent()
|
||||
val msg = TaskDetailsMsg(test, BusinessType.shuttle)
|
||||
val message = GsonUtils.toJson(msg)
|
||||
ThreadUtils.getIoPool().submit{
|
||||
CallerTelematicListenerManager.invokeReceivedMsg(OchCommonConst.BUSINESS_STRING,message.toByteArray())
|
||||
}
|
||||
}
|
||||
taskManager -> {
|
||||
val type = intent.getIntExtra("startType", 0)
|
||||
val indexStation = intent.getIntExtra("indexStation", 0)
|
||||
|
||||
@@ -54,6 +54,10 @@ object EnvManager {
|
||||
return isT1T2() && AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)
|
||||
}
|
||||
|
||||
fun isPhoneCodeMode():Boolean{
|
||||
return FunctionBuildConfig.loginMode==0
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -77,6 +77,14 @@ object OchChainLogManager {
|
||||
|
||||
const val EVENT_KEY_INFO_MEDIA = "analytics_event_och_media"
|
||||
|
||||
const val EVENT_KEY_INFO_DEVICE = "analytics_event_och_device"
|
||||
|
||||
|
||||
fun writeChainLogDevice(title: String, info: String) {
|
||||
writeChainLog(title, info, true, EVENT_KEY_INFO_DEVICE)
|
||||
}
|
||||
|
||||
|
||||
fun writeChainLogMedia(title: String,info: String) {
|
||||
writeChainLog(title, info, true, EVENT_KEY_INFO_MEDIA)
|
||||
}
|
||||
@@ -169,6 +177,7 @@ object OchChainLogManager {
|
||||
fun writeChainLog(title: String, info: String){
|
||||
writeChainLog(title,info,true,EVENT_KEY_INFE_WITH_CHANGE)
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun writeChainLog(title: String, info: String, upload:Boolean = true, eventID:String=EVENT_KEY_INFE_WITH_CHANGE) {
|
||||
writeChainLog(title,info,upload,eventID,null)
|
||||
|
||||
@@ -30,4 +30,10 @@ object OchTransform : CallerBase<OchTransformDispatch>(), IOchBizFunctionCall4Ea
|
||||
it.value.setVideoView(target)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLoginStateChange() {
|
||||
M_LISTENERS.forEach{
|
||||
it.value.onLoginModeChange()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,4 +6,5 @@ interface OchTransformDispatch {
|
||||
|
||||
fun logout(){}
|
||||
fun setVideoView(target: View?){}
|
||||
fun onLoginModeChange(){}
|
||||
}
|
||||
@@ -288,14 +288,14 @@ public class BusPassengerRouteFragment extends
|
||||
return;
|
||||
}
|
||||
if (isArrived){
|
||||
mCurrentArriveStationTitle.setText(ResourcesUtils.getString(R.string.shuttle_p_jl_cur_next_station_title));
|
||||
mCurrentArriveTip.setBackgroundResource(R.drawable.shuttle_p_jl_cur_station_un_arrived_bg);
|
||||
handleArrivingSpeakIconDrawable();
|
||||
}else {
|
||||
mCurrentArriveStationTitle.setText(ResourcesUtils.getString(R.string.shuttle_p_jl_cur_station_title));
|
||||
mCurrentArriveTip.setText(ResourcesUtils.getString(R.string.shuttle_p_jl_cur_station_arrived_tip));
|
||||
mCurrentArriveTip.setBackgroundResource(R.drawable.shuttle_p_jl_cur_station_arrived_bg);
|
||||
handleArrivedSpeakIconDrawable();
|
||||
}else {
|
||||
mCurrentArriveStationTitle.setText(ResourcesUtils.getString(R.string.shuttle_p_jl_cur_next_station_title));
|
||||
mCurrentArriveTip.setBackgroundResource(R.drawable.shuttle_p_jl_cur_station_un_arrived_bg);
|
||||
handleArrivingSpeakIconDrawable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -70,22 +70,22 @@ class PM2DrivingInfoFragment :
|
||||
return PM2DrivingPresenter(this)
|
||||
}
|
||||
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean) {
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isLeave: Boolean) {
|
||||
if(stations.isEmpty()){
|
||||
emptyView.visibility = View.VISIBLE
|
||||
arriveView.visibility = View.GONE
|
||||
lineView.visibility = View.GONE
|
||||
lineView.clear()
|
||||
}else{
|
||||
if(isArrived&&i!=0){
|
||||
if(isLeave&&i!=0){
|
||||
emptyView.visibility = View.GONE
|
||||
arriveView.visibility = View.GONE
|
||||
lineView.visibility = View.VISIBLE
|
||||
}else{
|
||||
emptyView.visibility = View.GONE
|
||||
arriveView.visibility = View.VISIBLE
|
||||
lineView.visibility = View.GONE
|
||||
arriveView.setArrivedStation(stations.get(i))
|
||||
}else{
|
||||
emptyView.visibility = View.GONE
|
||||
arriveView.visibility = View.GONE
|
||||
lineView.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ import com.zhjt.mogo.adas.data.sweeper.task.status.SweeperTaskStatus;
|
||||
import com.zhjt.mogo.adas.data.sweeper.task.stop.SweeperTaskStop;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskArrivalNotification;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStartNotification;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStationStop;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
@@ -815,4 +816,18 @@ public class SweeperCloudTaskModel implements IMoGoSweeperFutianCloudTaskListene
|
||||
public void onArriveAtStationByTaskManager(@Nullable Long taskId, @Nullable TaskArrivalNotification taskArrivalNotification) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMiddleDoorOpenState(boolean state) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSeatedMenSafetyBeltNotFasten(boolean state) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskStationStop(@Nullable TaskStationStop newValue) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import com.mogo.och.sweeper.operate.util.SweeperTrajectoryManager;
|
||||
import com.zhjt.mogo.adas.data.AdasConstants;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskArrivalNotification;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStartNotification;
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStationStop;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
@@ -495,4 +496,19 @@ public class SweeperOperatePresenter extends Presenter<SweeperOperateFragment>
|
||||
public void onArriveAtStationByTaskManager(@Nullable Long taskId, @Nullable TaskArrivalNotification taskArrivalNotification) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMiddleDoorOpenState(boolean state) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSeatedMenSafetyBeltNotFasten(boolean state) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTaskStationStop(@Nullable TaskStationStop newValue) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,6 +90,11 @@ public class TaxiPresenter extends Presenter<TaxiFragment> implements ITaxiADASS
|
||||
public void logout() {
|
||||
TaxiTaskModel.INSTANCE.logout();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoginModeChange() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
//导航去订单目的地
|
||||
|
||||
@@ -6,6 +6,7 @@ project.android.productFlavors {
|
||||
dimension "project"
|
||||
buildConfigField 'boolean', 'secure', "true"
|
||||
buildConfigField 'int', 'ttsLanguage', "1" // 仅中文
|
||||
buildConfigField 'int', 'loginMode', "0" // 手机号验证码登录
|
||||
buildConfigField 'String', 'URLs', "\"${readFileToJson("mogo").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'mediaUrlConfig', "\"${readMediaUrlConfigFromJsonFile("mogo").replace("\"", "\\\"")}\""
|
||||
}
|
||||
@@ -13,6 +14,7 @@ project.android.productFlavors {
|
||||
dimension "project"
|
||||
buildConfigField 'boolean', 'secure', "false"
|
||||
buildConfigField 'int', 'ttsLanguage', "1 << 1" // 中英韩
|
||||
buildConfigField 'int', 'loginMode', "0" // 手机号验证码登录
|
||||
buildConfigField 'String', 'URLs', "\"${readFileToJson("yantai").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'mediaUrlConfig', "\"${readMediaUrlConfigFromJsonFile("yantai").replace("\"", "\\\"")}\""
|
||||
}
|
||||
@@ -21,6 +23,7 @@ project.android.productFlavors {
|
||||
dimension "project"
|
||||
buildConfigField 'boolean', 'secure', "true"
|
||||
buildConfigField 'int', 'ttsLanguage', "1" // 仅中文
|
||||
buildConfigField 'int', 'loginMode', "0" // 手机号验证码登录
|
||||
buildConfigField 'String', 'URLs', "\"${readFileToJson("dali").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'mediaUrlConfig', "\"${readMediaUrlConfigFromJsonFile("dali").replace("\"", "\\\"")}\""
|
||||
}
|
||||
@@ -28,6 +31,7 @@ project.android.productFlavors {
|
||||
dimension "project"
|
||||
buildConfigField 'boolean', 'secure', "true"
|
||||
buildConfigField 'int', 'ttsLanguage', "1" // 仅中文
|
||||
buildConfigField 'int', 'loginMode', "1" // 手机号验证码登录
|
||||
buildConfigField 'String', 'URLs', "\"${readFileToJson("saas").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'mediaUrlConfig', "\"${readMediaUrlConfigFromJsonFile("saas").replace("\"", "\\\"")}\""
|
||||
}
|
||||
@@ -35,6 +39,7 @@ project.android.productFlavors {
|
||||
dimension "project"
|
||||
buildConfigField 'boolean', 'secure', "true"
|
||||
buildConfigField 'int', 'ttsLanguage', "1" // 仅中文
|
||||
buildConfigField 'int', 'loginMode', "1" // 手机号验证码登录
|
||||
buildConfigField 'String', 'URLs', "\"${readFileToJson("singapore").replace("\"", "\\\"")}\""
|
||||
buildConfigField 'String', 'mediaUrlConfig', "\"${readMediaUrlConfigFromJsonFile("singapore").replace("\"", "\\\"")}\""
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ object ConfigStartUp {
|
||||
// 演示模式,上一次勾选的数据
|
||||
FunctionBuildConfig.isDemoMode = BuildConfig.IS_DEMO_MODE
|
||||
FunctionBuildConfig.ttsLanguage = BuildConfig.ttsLanguage
|
||||
FunctionBuildConfig.loginMode = BuildConfig.loginMode
|
||||
// 各个module需要的url
|
||||
FunctionBuildConfig.urlJson = GsonUtils.fromJson(BuildConfig.URLs, UrlConfig::class.java)
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ internal class V2XRefreshModel {
|
||||
handled
|
||||
})
|
||||
this["netType"] = CommonUtils.getNetworkType(AbsMogoApplication.getApp())
|
||||
this["cellId"] = DeviceUtils.getCellId() ?: ""
|
||||
this["cellId"] = ""
|
||||
this["sn"] = SharedPrefsMgr.getInstance().sn
|
||||
this["ticket"] = SharedPrefsMgr.getInstance().token
|
||||
this["sig"] = SignUtil.createSign(this, "JGjZx6")
|
||||
|
||||
@@ -50,6 +50,8 @@ import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotDockerInfo
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotStatus
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutoPilotStatusFromCan
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateMiddleDoorOpen
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateSeatedMenSafetyBeltNotFasten
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotActionsListenerManager.invokeAutopilotAbility
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager.invokeAutopilotCarConfigData
|
||||
@@ -159,6 +161,7 @@ import prediction2025.Prediction2025
|
||||
import record_cache.RecordPanelOuterClass
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo
|
||||
import taskmgr.TmInfo
|
||||
import vllm.Vlm
|
||||
import java.io.PrintWriter
|
||||
import java.io.StringWriter
|
||||
@@ -344,6 +347,8 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
) {
|
||||
if (autopilotState != null) {
|
||||
updateAutoPilotStatusFromCan(autopilotState.state)
|
||||
updateMiddleDoorOpen(autopilotState.middleDoorOpen)
|
||||
updateSeatedMenSafetyBeltNotFasten(autopilotState.seatedMenSafetyBeltNotFasten)
|
||||
if (AdasManager.getInstance()
|
||||
.getNodeStateInfo(AdasConstants.NodeName.FSM2024).existState != NodeExistState.NODE_EXIST_NORMAL
|
||||
) {
|
||||
@@ -1689,6 +1694,10 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
taskManagerOriginal(header, data)
|
||||
}
|
||||
|
||||
override fun onAdasTaskManagerStationStopOriginal(header: MessagePad.Header, data: String) {
|
||||
taskManagerOriginal(header, data)
|
||||
}
|
||||
|
||||
@ChainLog(
|
||||
linkChainLog = CHAIN_TYPE_SOCKET_AUTOPILOT,
|
||||
linkCode = CHAIN_SOURCE_ADAS,
|
||||
@@ -1717,6 +1726,13 @@ class MoGoAdasListenerImpl : OnAdasListener {
|
||||
CallerTaskListenerManager.invokeRunningTaskInfo(taskId,lineId,taskLocationQueryResponse)
|
||||
}
|
||||
|
||||
/**
|
||||
* 站点停车消息
|
||||
*/
|
||||
override fun onAdasTaskManagerStationStop(stationStopInfo: TmInfo.StationStopInfo?) {
|
||||
CallerAutoPilotStatusListenerManager.taskmanagerStationStop(stationStopInfo)
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否可以启动自动驾驶
|
||||
* 使用方法查看:app_ipc_monitoring/uiMainActivity/onAutopilotAbility
|
||||
|
||||
@@ -32,13 +32,13 @@ object IotManager : IMoGoCloudListener, IWriteChainLogListener {
|
||||
CallerCloudListenerManager.addListener(TAG, this)
|
||||
DevicesManager.registerWriteChainLogListener(this)
|
||||
hardwareDeviceBind(SharedPrefsMgr.getInstance().sn)
|
||||
} else {
|
||||
LedSourceManager.registerWriteChainLogListener(this)
|
||||
LedSourceManager.init(true, isB2)
|
||||
if(isB4){
|
||||
CuLedManager.init()
|
||||
CuLedManager.registerWriteChainLogListener(this)
|
||||
}
|
||||
} else {
|
||||
LedSourceManager.registerWriteChainLogListener(this)
|
||||
LedSourceManager.init(true, isB2)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ import com.mogo.eagle.core.data.constants.MoGoConfig
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_BAG_RECORD
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_BEAUTY_MODE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_LOGIN_MODE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_FULL_LOG
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_RAIN_MODE
|
||||
import com.mogo.eagle.core.data.deva.bizconfig.FuncBizConfig.Companion.BIZ_WARNING_UPLOAD
|
||||
@@ -97,6 +98,7 @@ import com.mogo.eagle.core.function.call.map.CallerVisualAngleManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuApiManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuConnectListenerManager
|
||||
import com.mogo.eagle.core.function.call.obu.CallerObuInfoListenerManager
|
||||
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
|
||||
import com.mogo.eagle.core.function.call.och.CallerOchBizFunctionCall4EagleManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerMapShowNameManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerMoGoUiSettingManager
|
||||
@@ -263,6 +265,7 @@ import kotlinx.android.synthetic.main.view_debug_setting.view.tbLanguage
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbLogCatch
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbLogcatCenter
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbLoginLogout
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbLoginMode
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbNetLog
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbObuController
|
||||
import kotlinx.android.synthetic.main.view_debug_setting.view.tbObuLog
|
||||
@@ -1152,6 +1155,18 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
tbLoginMode.isChecked = FunctionBuildConfig.loginMode == 0
|
||||
tbLoginMode.setOnCheckedChangeListener { compoundButton, isChecked ->
|
||||
if (!compoundButton.isPressed) {
|
||||
return@setOnCheckedChangeListener
|
||||
}
|
||||
CallerOchBizFunctionCall4EagleManager.onLoginStateChange()
|
||||
}
|
||||
if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)) {
|
||||
tbLoginMode.visibility = View.GONE
|
||||
}
|
||||
|
||||
// 雨天模式,上一次勾选的数据
|
||||
tbIsRainMode.isChecked = FunctionBuildConfig.isRainMode
|
||||
//雨天模式
|
||||
@@ -2453,6 +2468,12 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
tbIsRainMode?.text = "开启雨天模式"
|
||||
}
|
||||
|
||||
if(FunctionBuildConfig.loginMode==0){
|
||||
tbLoginMode?.text = "手机号验证码登录"
|
||||
}else{
|
||||
tbLoginMode?.text = "二次验证登录"
|
||||
}
|
||||
|
||||
obuConnectStatusTv.text = Html.fromHtml(
|
||||
"OBU连接状态:${
|
||||
if (AppConfigInfo.isConnectObu) {
|
||||
@@ -2545,6 +2566,19 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
tbIsDemoMode.setPadding(left, top, right, bottom)
|
||||
}
|
||||
|
||||
BIZ_LOGIN_MODE -> {
|
||||
tbLoginMode.isClickable = !lock
|
||||
val (left, top, right, bottom) = tbLoginMode.currentPadding()
|
||||
if (lock) {
|
||||
tbLoginMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_lock_background)
|
||||
} else {
|
||||
tbLoginMode.background =
|
||||
resources.getDrawable(R.drawable.radio_button_normal_background_right)
|
||||
}
|
||||
tbLoginMode.setPadding(left, top, right, bottom)
|
||||
}
|
||||
|
||||
BIZ_RAIN_MODE -> {
|
||||
tbIsRainMode.isClickable = !lock
|
||||
val (left, top, right, bottom) = tbIsRainMode.currentPadding()
|
||||
@@ -2897,6 +2931,10 @@ internal class DebugSettingView @JvmOverloads constructor(
|
||||
tbIsRainMode.isChecked = status
|
||||
}
|
||||
|
||||
override fun onLoginModeClickEvent(status: Boolean) {
|
||||
tbLoginMode.isChecked = status
|
||||
}
|
||||
|
||||
/**
|
||||
* 点云模式
|
||||
*/
|
||||
|
||||
@@ -331,6 +331,18 @@
|
||||
android:textOn="关闭美化模式"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbLoginMode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
android:background="@drawable/radio_button_normal_background_right"
|
||||
android:textColor="#000"
|
||||
android:padding="@dimen/dp_20"
|
||||
android:textOff="二次验证登录"
|
||||
android:textOn="手机号验证码登录"
|
||||
android:textSize="@dimen/dp_24" />
|
||||
|
||||
<ToggleButton
|
||||
android:id="@+id/tbIsRainMode"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -161,6 +161,11 @@ object FunctionBuildConfig {
|
||||
@JvmField
|
||||
var ttsLanguage = 1
|
||||
|
||||
@Volatile
|
||||
@JvmField
|
||||
var loginMode = 0
|
||||
|
||||
|
||||
/**
|
||||
* 各车型宣传视频本地配置
|
||||
* 广告json
|
||||
|
||||
@@ -32,6 +32,7 @@ class FuncBizConfig {
|
||||
const val BIZ_DNPW = "BIZ_DNPW" // 逆向超车预警
|
||||
// Foundation
|
||||
const val BIZ_BEAUTY_MODE = "BIZ_BEAUTY_MODE" // 美化模式
|
||||
const val BIZ_LOGIN_MODE = "BIZ_LOGIN_MODE" // 登录模式
|
||||
const val BIZ_RAIN_MODE = "BIZ_RAIN_MODE" // 雨天模式
|
||||
const val BIZ_FULL_LOG = "BIZ_FULL_LOG" // 全量日志
|
||||
const val BIZ_TRACE_LOG = "BIZ_TRACE_LOG" // 链路日志 todo 暂未有场景,未实现
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskArrivalNotification
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStartNotification
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStationStop
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import system_master.*
|
||||
@@ -29,6 +30,22 @@ interface IMoGoAutopilotStatusListener {
|
||||
*/
|
||||
fun onAutopilotStatusResponseFromCan(state: Int) {}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息 中门开启状态
|
||||
*
|
||||
* @param state 状态信息
|
||||
*/
|
||||
fun onMiddleDoorOpenState(state: Boolean) {}
|
||||
|
||||
/**
|
||||
* 自动驾驶状态信息 是否有人没有系安全带
|
||||
*
|
||||
* @param state 状态信息
|
||||
*/
|
||||
fun onSeatedMenSafetyBeltNotFasten(state: Boolean) {}
|
||||
|
||||
fun onTaskStationStop(newValue: TaskStationStop?) {}
|
||||
|
||||
/**
|
||||
* 自动驾驶docker信息
|
||||
*
|
||||
|
||||
@@ -14,4 +14,6 @@ interface IOchBizFunctionCall4Eagle {
|
||||
fun isLogin(): Boolean
|
||||
|
||||
fun setVideoView(target: View?)
|
||||
|
||||
fun onLoginStateChange()
|
||||
}
|
||||
@@ -10,6 +10,12 @@ interface ISopSettingListener {
|
||||
*/
|
||||
fun onDemoModeClickEvent(status: Boolean){}
|
||||
|
||||
/**
|
||||
* 美化模式
|
||||
*/
|
||||
fun onLoginModeClickEvent(status: Boolean){}
|
||||
|
||||
|
||||
/**
|
||||
* 雨天模式
|
||||
*/
|
||||
|
||||
@@ -14,10 +14,12 @@ import com.mogo.eagle.core.utilcode.util.ParseVersionUtils
|
||||
import com.zhjt.mogo.adas.data.AdasConstants
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskArrivalNotification
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStartNotification
|
||||
import com.zhjt.mogo.adas.unmanned.task.dto.cmd.TaskStationStop
|
||||
import mogo.telematics.pad.MessagePad
|
||||
import mogo_msg.MogoReportMsg
|
||||
import system_master.SsmInfo
|
||||
import system_master.SystemStatusInfo
|
||||
import taskmgr.TmInfo
|
||||
import java.util.concurrent.atomic.AtomicInteger
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
@@ -187,10 +189,72 @@ object CallerAutoPilotStatusListenerManager : CallerBase<IMoGoAutopilotStatusLis
|
||||
}
|
||||
}
|
||||
|
||||
private var middleDoorState: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
CallerTrace.write("MiddleDoorStateFromState", mapOf("MiddleDoorStateFromState" to newValue))
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onMiddleDoorOpenState(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var seatedMenSafetyBeltNotFasten: Boolean by Delegates.observable(false) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
CallerTrace.write("seatedMenSafetyBeltNotFasten", mapOf("seatedMenSafetyBeltNotFasten" to newValue))
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onSeatedMenSafetyBeltNotFasten(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var taskStationStop: TaskStationStop? by Delegates.observable(null) { _, oldValue, newValue ->
|
||||
if (oldValue != newValue) {
|
||||
CallerTrace.write("taskStationStop", mapOf("taskStationStop" to newValue))
|
||||
M_LISTENERS.forEach {
|
||||
val listener = it.value
|
||||
listener.onTaskStationStop(newValue)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
fun updateAutoPilotStatusFromCan(autopilotState: Int) {
|
||||
this.autopilotStateFromCan = autopilotState
|
||||
}
|
||||
|
||||
|
||||
fun updateSeatedMenSafetyBeltNotFasten(seatedMenSafetyBeltNotFasten: Boolean) {
|
||||
this.seatedMenSafetyBeltNotFasten = seatedMenSafetyBeltNotFasten
|
||||
}
|
||||
|
||||
fun updateMiddleDoorOpen(middleDoorOpen: Boolean) {
|
||||
this.middleDoorState = middleDoorOpen
|
||||
}
|
||||
|
||||
fun taskmanagerStationStop(stationStopInfo: TmInfo.StationStopInfo?) {
|
||||
if(this.taskStationStop==null){
|
||||
if(stationStopInfo!=null) {
|
||||
this.taskStationStop = TaskStationStop.toTaskStationStop(stationStopInfo)
|
||||
}
|
||||
}else{
|
||||
if(stationStopInfo==null){
|
||||
this.taskStationStop = null
|
||||
}else{
|
||||
taskStationStop?.let {
|
||||
if ((it.isStop!=stationStopInfo.stop
|
||||
|| it.stopStation.stationId!=it.stopStation.stationId)
|
||||
) {
|
||||
this.taskStationStop = TaskStationStop.toTaskStationStop(stationStopInfo)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAutoPilotStatus(autopilotStateSource: Int, autopilotState: Int, autopilotMode: Int) {
|
||||
mAutopilotStatusInfo.state = autopilotState
|
||||
mAutopilotStatusInfo.autopilotStateSource = autopilotStateSource
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.mogo.eagle.core.function.call.och
|
||||
|
||||
import android.view.View
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.och.IOchBizFunctionCall4Eagle
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsFuncConfigListenerManager
|
||||
|
||||
/**
|
||||
* 实现提供给 鹰眼底层 调用的接口
|
||||
@@ -33,4 +35,13 @@ object CallerOchBizFunctionCall4EagleManager : IOchBizFunctionCall4Eagle {
|
||||
override fun setVideoView(target: View?) {
|
||||
ochBizFunctionCall4EagleInstance?.setVideoView(target)
|
||||
}
|
||||
|
||||
override fun onLoginStateChange() {
|
||||
if(FunctionBuildConfig.loginMode==0){
|
||||
FunctionBuildConfig.loginMode = 1
|
||||
}else{
|
||||
FunctionBuildConfig.loginMode = 0
|
||||
}
|
||||
ochBizFunctionCall4EagleInstance?.onLoginStateChange()
|
||||
}
|
||||
}
|
||||
@@ -121,6 +121,7 @@ public enum MessageType {
|
||||
TYPE_RECEIVE_FSM_EVENT(MessagePad.MessageType.MsgTypeFsmEvent, R.string.adas_data_MsgTypeFsmEvent),
|
||||
TYPE_SEND_TASK_MANAGER(MessagePad.MessageType.MsgTypeTaskMgrAndPad, R.string.adas_data_MsgTypeTaskMgrAndPad_SEND),
|
||||
TYPE_RECEIVE_TASK_MANAGER(MessagePad.MessageType.MsgTypeTaskMgrAndPad, R.string.adas_data_MsgTypeTaskMgrAndPad_RECEIVE),
|
||||
TYPE_RECEIVE_TASK_MANAGER_StationStop(MessagePad.MessageType.MsgTypeTaskMgrAndPad, R.string.adas_data_MsgTypeTaskMgrAndPad_RECEIVE),
|
||||
|
||||
//TODO 透传原始pb文件中不存在以下type。由于Java中无法强转,所以在mogo-adas-data/message_pad.proto中放开注释
|
||||
TYPE_RECEIVE_PLANNING_DECISION_STATE(MessagePad.MessageType.MsgTypePlanningDecisionState, R.string.adas_data_MsgTypePlanningDecisionState),
|
||||
|
||||
@@ -126,12 +126,11 @@ public class TaskStartNotification {
|
||||
}
|
||||
|
||||
public boolean isCloseDoorStartAuto(){
|
||||
if(Objects.equals(lastTaskCmdType, MessageCmdEnum.TaskStartNotification.getCode()) ||
|
||||
Objects.equals(lastTaskCmdType, MessageCmdEnum.TaskContinueNotification.getCode()) ){
|
||||
return false;
|
||||
}
|
||||
if(Objects.equals(lastTaskCmdType, MessageCmdEnum.TaskContinueByDoorClosed.getCode())){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.zhjt.mogo.adas.unmanned.task.dto.cmd;
|
||||
|
||||
import taskmgr.TmInfo;
|
||||
|
||||
public class TaskStationStop {
|
||||
/**
|
||||
* 停靠站信息, 仅stop=true时候有效, 否则会变更
|
||||
*/
|
||||
private VehicleSite stopStation;
|
||||
/**
|
||||
* 下一站是否停车, true 停车,false 不停车
|
||||
*/
|
||||
private boolean stop;
|
||||
/**
|
||||
* 停车原因,0:未定义原因,1:底盘stop信号,2:站点挥手拦停
|
||||
*/
|
||||
private int stopReason;
|
||||
/**
|
||||
* 到停靠站的距离,单位m
|
||||
*/
|
||||
private Double stopDistance;
|
||||
|
||||
public VehicleSite getStopStation() {
|
||||
return stopStation;
|
||||
}
|
||||
|
||||
public void setStopStation(VehicleSite stopStation) {
|
||||
this.stopStation = stopStation;
|
||||
}
|
||||
|
||||
public boolean isStop() {
|
||||
return stop;
|
||||
}
|
||||
|
||||
public void setStop(boolean stop) {
|
||||
this.stop = stop;
|
||||
}
|
||||
|
||||
public int getStopReason() {
|
||||
return stopReason;
|
||||
}
|
||||
|
||||
public void setStopReason(int stopReason) {
|
||||
this.stopReason = stopReason;
|
||||
}
|
||||
|
||||
public Double getStopDistance() {
|
||||
return stopDistance;
|
||||
}
|
||||
|
||||
public void setStopDistance(Double stopDistance) {
|
||||
this.stopDistance = stopDistance;
|
||||
}
|
||||
|
||||
public static TaskStationStop toTaskStationStop(TmInfo.StationStopInfo stationStopInfo){
|
||||
if(stationStopInfo==null){
|
||||
return null;
|
||||
}
|
||||
TaskStationStop taskStationStop = new TaskStationStop();
|
||||
taskStationStop.setStop(stationStopInfo.getStop());
|
||||
taskStationStop.setStopReason(stationStopInfo.getStopReason());
|
||||
taskStationStop.setStopDistance(stationStopInfo.getStopDistance());
|
||||
TmInfo.Location stopStation = stationStopInfo.getStopStation();
|
||||
if(stopStation!=null){
|
||||
VehicleSite vehicleSite = VehicleSite.builder()
|
||||
.coordinateType(stopStation.getCoordinateType())
|
||||
.point(new AutopilotPoint(stopStation.getPoint().getX(), stopStation.getPoint().getY()))
|
||||
.station(stopStation.getStation())
|
||||
.stationId(stopStation.getStationId())
|
||||
.stationName(stopStation.getStationName())
|
||||
.stationSeq(Math.toIntExact(stopStation.getStationSeq()))
|
||||
.build();
|
||||
taskStationStop.setStopStation(vehicleSite);
|
||||
}
|
||||
return taskStationStop;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,8 @@ public enum MessageCmdEnum {
|
||||
|
||||
TaskStartNotification("TaskStartNotification", "自驾/离站结果回执"),
|
||||
|
||||
TaskContinueByDoorClosed("TaskContinueByDoorClosed", "通过关门来出发"),
|
||||
|
||||
TaskArrivalNotification("TaskArrivalNotification", "到站通知"),
|
||||
|
||||
TaskAbortNotification("TaskAbortNotification", "任务终止"),
|
||||
|
||||
@@ -51,6 +51,7 @@ enum MessageType
|
||||
MsgTypePredictionObjects2025 = 0x10015; //自车他车轨迹预测2025 定频10hz
|
||||
MsgTypevllm = 0x10016; //vllm 定频 5秒一条 T1-2025(东风Taxi),map是在5.1.0routing
|
||||
MsgTypeVllmImage60 = 0x10017; //vllm图像 定频 5秒一条 T1-2025(东风Taxi),map是在5.1.0routing
|
||||
MsgTypeTaskMgrAndPadStationStop = 0x10018; //是否有人按停车
|
||||
|
||||
//### 以下消息全部不定频 ###
|
||||
MsgTypeBasicInfoReq = 0x10100; //自动驾驶设备基础信息请求
|
||||
@@ -414,6 +415,8 @@ message AutopilotState
|
||||
uint32 autopilotMode = 5; //自动驾驶状态 0: 非自动驾驶,1: 自动驾驶, 6:平行驾驶
|
||||
double speed = 6; //惯导车速 m/s
|
||||
string reason = 7; //不可用原因(abandoned)
|
||||
bool middle_door_open = 8;//小巴中部乘客门
|
||||
bool seated_men_safety_belt_not_fasten = 9;//至少一人未系安全带
|
||||
}
|
||||
|
||||
// message definition for MessageType: MsgTypeReportMessage
|
||||
|
||||
124
libraries/mogo-adas-data/src/main/proto/tm_info.proto
Normal file
124
libraries/mogo-adas-data/src/main/proto/tm_info.proto
Normal file
@@ -0,0 +1,124 @@
|
||||
syntax = "proto2";
|
||||
package taskmgr;
|
||||
|
||||
import "geometry.proto";
|
||||
import "header.proto";
|
||||
|
||||
message TaskQueryRequest {
|
||||
required uint32 taskId = 1; //任务ID
|
||||
required uint32 lineId = 2; //轨迹id
|
||||
}
|
||||
message Location {
|
||||
optional uint32 coordinateType = 1 [default = 0]; //坐标类型 0:WGS84 1:GCJ02 2:UTM
|
||||
optional geometry.Point point = 2; //经纬度
|
||||
optional uint32 station = 3; // 判断此点是站点还是途径点 ------- 0:站点, 1:简单的途径点
|
||||
optional uint64 stationId = 4; //站点编号,对应云平台数据库固定值
|
||||
optional string stationName = 5; //站点名称
|
||||
optional uint64 stationSeq = 6; //站点序号,对应列表里站点流程,从1开始,1为起始点,途径点填写0
|
||||
}
|
||||
message TaskQueryResponse {
|
||||
required Location curLocation = 1;
|
||||
// required Location preStation = 2; //前一站站点信息,用于过站同步
|
||||
// required Location nextStation = 3; //下一站站点信息
|
||||
required double accumulatedStationDis = 4; //从前一站点到目前的总距离(单位m)
|
||||
required double reversedAccumulatedStationDis = 5; //从当前到下一站点的距离(单位m)
|
||||
required double stationTimeLeft = 6; //到达下一站需要的时间(单位s)
|
||||
// optional double velocity = 7; //速度, m/s
|
||||
// optional double acceleration = 8; //加速度, m/s^2
|
||||
// optional double theta = 9; //速度方向
|
||||
// optional double kappa = 10; //曲率
|
||||
optional double accumulatedTaskDis = 11; //任务全程的行进里程
|
||||
optional double reversedAccumulatedTaskDis = 12; //任务全程的剩余里程
|
||||
optional double taskTimeLeft = 13; //到达终点需要的时间(单位s)
|
||||
}
|
||||
|
||||
enum TaskState {
|
||||
NONE = 0; //无任务
|
||||
WAITING = 10; //任务待执行Waiting, 轨迹下载完成,算路请求完成,等待发车
|
||||
RUNNING = 20; //任务行进中running,收到发车名称,自驾成功,多站点多次进入该状态
|
||||
STOPED = 30; //到站停车,到达中间站点站点,上报了到站提醒
|
||||
FINISH = 40; //任务结束,收到任务结束指令或者到达终点后5秒,要主动发出停止自驾
|
||||
ABORT = 50; //任务中止,存在故障或者异常,无法自驾
|
||||
CANCEL = 60; //任务取消,收到取消指令
|
||||
}
|
||||
|
||||
|
||||
message TaskStationsQueryRequest {
|
||||
optional string src = 1; //查询来源,建议填写为rosnode名称
|
||||
}
|
||||
|
||||
message TaskStationsQueryResponse {
|
||||
required TaskState state = 1; //任务状态
|
||||
repeated Location stations = 2; //站点列表
|
||||
}
|
||||
|
||||
|
||||
message StationStopInfo { //2Hz定频上报
|
||||
required bool stop = 1; //下一站是否停车, true 停车,false 不停车
|
||||
optional uint32 stopReason = 2; //停车原因,0:未定义原因,1:底盘stop信号,2:站点挥手拦停
|
||||
optional Location stopStation = 3; //停靠站信息, 仅stop=true时候有效, 否则会变更
|
||||
optional double stopDistance = 4; //到停靠站的距离,单位m
|
||||
}
|
||||
|
||||
message TaskInfo {
|
||||
required uint64 taskId = 1; //任务ID, 同原接口的orderid
|
||||
required TaskState task_state = 2; //任务状态
|
||||
required uint64 lineId = 3; //轨迹id
|
||||
required Location curLocation = 4;
|
||||
required Location preStation = 5; //前一站站点信息
|
||||
required Location nextStation = 6; //下一站站点信息
|
||||
optional uint64 taskStartTime = 7; //任务开始时间
|
||||
optional double taskTimeLeft = 8; //任务结束剩余时间, 可用于升级提示
|
||||
}
|
||||
|
||||
message TaskEndNotify { //任务结束通知
|
||||
required bool normal= 1; //true:正常结束 false: 异常中止
|
||||
optional string order_id = 2; //订单号
|
||||
}
|
||||
|
||||
message TaskStartOrContinueNotify { //任务开始或继续通知,给规划
|
||||
optional common.Header header = 1;
|
||||
optional string order_id = 2; //任务ID, 同原接口的orderid
|
||||
optional geometry.Point start_pos = 3; //起始站点utm坐标
|
||||
required geometry.Point end_pos = 4; //结束站点utm坐标
|
||||
optional geometry.Point end_pos_lon_lat = 5; //结束站点信息, 经纬度坐标
|
||||
}
|
||||
|
||||
message TaskStopNotify { //任务停止通知,给规划,当前用于站点停止发车
|
||||
optional common.Header header = 1;
|
||||
optional string order_id = 2; //任务ID, 同原接口的orderid
|
||||
optional uint32 stop_reason = 3; //停止原因, 1: 底盘stop信号 2: 站点挥手拦停,0:未定义原因
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum VoiceEvent {
|
||||
UNKNOWN = 0;
|
||||
//这里只罗列目前需要收集的语音事件,后续扩展按需增加
|
||||
ENTER_STATION = 3001; //进站
|
||||
LEAVE_STATION = 3002; //出站
|
||||
AVOIDANCE = 3103; //绕障
|
||||
TURN_LEFT = 3204; //左转
|
||||
TURN_RIGHT = 3205; //右转
|
||||
|
||||
PEDESTRIAN_AVOIDANCE = 2001; //行人避让
|
||||
CROSSWALK_AVOIDANCE = 2002; //过人行横道,礼让
|
||||
STUCK = 2101; //陷入困境
|
||||
CROSSROAD = 2102; //路口通行\
|
||||
|
||||
COLLISION = 1001; //碰撞事故
|
||||
}
|
||||
|
||||
message VoiceEventItems {
|
||||
required uint32 event = 1; //语音事件码, 同产品语音播发类型需求,定义uint32 便于扩展。 目前定义参考VoiceEvent
|
||||
optional string action = 2; //自驾行为或者环境示警描述,目前主要有:进出站,绕障,左/右转,行人避让,路口通信
|
||||
optional string extra = 3; //额外信息补充,如进站时候站点名称,开门操作对应得门的信息等,便于语音播报准确扩展
|
||||
}
|
||||
|
||||
message VoiceEventReport {
|
||||
required string src = 1; //语音事件来源,填写模块名称,rosnode 填写node名称即可
|
||||
repeated VoiceEventItems items = 2; //语音事件列表,当前模块的需要播报的行为列表
|
||||
optional Location curLocation = 3; //事件上报时候,车辆当前位置
|
||||
optional uint64 millisecond = 4; //毫秒时间戳
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ import prediction2025.Prediction2025;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
import taskmgr.TmInfo;
|
||||
import vllm.Vlm;
|
||||
|
||||
/**
|
||||
@@ -809,16 +810,20 @@ public interface OnAdasListener {
|
||||
*/
|
||||
void onAdasTaskManagerOriginal(@NonNull MessagePad.Header header, @NonNull String data);
|
||||
|
||||
/**
|
||||
* 域控任务管理站点停车原始数据
|
||||
*
|
||||
* @param header 头
|
||||
* @param data 数据
|
||||
*/
|
||||
void onAdasTaskManagerStationStopOriginal(@NonNull MessagePad.Header header, @NonNull String data);
|
||||
|
||||
|
||||
/**
|
||||
* 域控任务管理离站通知
|
||||
*
|
||||
* @param taskId
|
||||
* @param siteId
|
||||
* @param sequence
|
||||
* @param ack
|
||||
* @param reason
|
||||
* @param stationTimeLeft
|
||||
* @param closeDoorStartAuto
|
||||
* @param taskStartNotification
|
||||
*/
|
||||
void onAdasTaskManagerDeparture(Long taskId, TaskStartNotification taskStartNotification);
|
||||
|
||||
@@ -826,9 +831,7 @@ public interface OnAdasListener {
|
||||
* 域控任务管理到站通知
|
||||
*
|
||||
* @param taskId 任务ID, 同原接口的orderid, 首次和头部校验
|
||||
* @param siteId 站点编号,对应云平台固定值
|
||||
* @param sequence 站点序号,对应顺序列表里站点流程,从1开始,1为起始点,最大值为终点。 途径点填写0
|
||||
* @param mileage 任务全程的已经行进的里程
|
||||
* @param taskArrivalNotification 到站信息
|
||||
*/
|
||||
void onAdasTaskManagerArrival(Long taskId, TaskArrivalNotification taskArrivalNotification);
|
||||
|
||||
@@ -852,6 +855,12 @@ public interface OnAdasListener {
|
||||
*/
|
||||
void onAdasTaskManagerRunning(Long taskId, Long lineId, TaskLocationQueryResponse taskLocationQueryResponse);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param stationStopInfo 到站的信息
|
||||
*/
|
||||
void onAdasTaskManagerStationStop(TmInfo.StationStopInfo stationStopInfo);
|
||||
/**
|
||||
* 是否有能力启动自动驾驶
|
||||
*
|
||||
|
||||
@@ -66,6 +66,7 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
private IMsg planningStopLineMessage;//决策停止线
|
||||
private IMsg fSMEventMessage;//FSM事件
|
||||
private IMsg taskMgrAndPadMessage;//任务管理消息
|
||||
private IMsg taskMgrAndPadStationStopMessage;//任务管理消息
|
||||
|
||||
private final AutopilotReview autopilotReview;
|
||||
private final TurnLightState lightLeft = new TurnLightState();
|
||||
@@ -388,6 +389,12 @@ public class MyMessageFactory implements IMyMessageFactory {
|
||||
fSMEventMessage = new FSMEventMessage();
|
||||
}
|
||||
return fSMEventMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_TASK_MANAGER_StationStop.typeCode) {
|
||||
//任务管理消息发出的站点停车
|
||||
if (taskMgrAndPadStationStopMessage == null) {
|
||||
taskMgrAndPadStationStopMessage = new TaskManagerStationStopMessage();
|
||||
}
|
||||
return taskMgrAndPadStationStopMessage;
|
||||
} else if (messageType == MessageType.TYPE_RECEIVE_TASK_MANAGER.typeCode) {
|
||||
//任务管理消息
|
||||
if (taskMgrAndPadMessage == null) {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zhidao.support.adas.high.msg;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.OnAdasListener;
|
||||
import com.zhidao.support.adas.high.protocol.RawData;
|
||||
|
||||
import taskmgr.TmInfo;
|
||||
|
||||
/**
|
||||
* 任务管理消息
|
||||
*/
|
||||
public class TaskManagerStationStopMessage extends MyAbstractMessageHandler {
|
||||
private static final String TAG = TaskManagerStationStopMessage.class.getSimpleName();
|
||||
|
||||
public TaskManagerStationStopMessage() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlerMsg(RawData raw, OnAdasListener adasListener) throws InvalidProtocolBufferException {
|
||||
TmInfo.StationStopInfo stationStopInfo = TmInfo.StationStopInfo.parser().parseFrom(raw.originalData.toByteArray(), raw.getOffsetValue(), raw.getPackageLengthValue() - raw.getOffsetValue());
|
||||
AdasChannel.calculateTimeConsumingOnDispatchRaw("底盘信息", raw.receiveTime);
|
||||
long nowTime = 0;
|
||||
adasListener.onAdasTaskManagerStationStop(stationStopInfo);
|
||||
AdasChannel.calculateTimeConsumingBusiness("底盘信息", nowTime);
|
||||
}
|
||||
|
||||
private void parse(OnAdasListener adasListener, String data) {
|
||||
Log.i(TAG, "任务管理接收原始数据=" + data);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user