opt and fixed obu ip bug
This commit is contained in:
@@ -6,6 +6,7 @@ import android.util.Log;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.constants.SharedPrefsConstants;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig;
|
||||
@@ -106,10 +107,9 @@ public class MoGoHandAdasMsgManager implements
|
||||
|
||||
@Override
|
||||
public void onAutopilotCarConfig(@NotNull MessagePad.CarConfigResp carConfigResp) {
|
||||
if (carConfigResp != null && !TextUtils.isEmpty(carConfigResp.getMacAddress())) {
|
||||
Log.d("liyz", "onAutopilotCarConfig ---------" + carConfigResp.getMacAddress() + "--lateNumber() = " + carConfigResp.getPlateNumber());
|
||||
SharedPrefsMgr.getInstance(mContext).putString(SharedPrefsConstants.MAC_ADDRESS, carConfigResp.getMacAddress());
|
||||
// CallerBindingcarManager.getBindingcarProvider().getBindingcarInfo(carConfigResp.getMacAddress(), "");
|
||||
if (carConfigResp != null && !TextUtils.isEmpty(carConfigResp.getMacAddress())) { //TODO 这里判断
|
||||
Log.d("liyz", "司机端 onAutopilotCarConfig ---" + carConfigResp.getMacAddress());
|
||||
// CallerBindingcarManager.getBindingcarProvider().getBindingcarInfo(carConfigResp.getMacAddress(), MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -59,32 +59,17 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
|
||||
*/
|
||||
@Override
|
||||
public void getBindingcarInfo(String macAddress, String widevineIDWithMd5) {
|
||||
Log.d("liyz", "getBindingcarInfo ---1--- mAddress = " + mAddress + "--mWidevineIDWithMd5 = " + mWidevineIDWithMd5 + "--mScreenType = " + mScreenType);
|
||||
if (!TextUtils.isEmpty(macAddress)) { //司机
|
||||
mAddress = macAddress;
|
||||
} else {
|
||||
//乘客
|
||||
mAddress = SharedPrefsMgr.getInstance(mContext).getString(SharedPrefsConstants.MAC_ADDRESS);
|
||||
}
|
||||
|
||||
//widevineIDWithMd5
|
||||
if (!TextUtils.isEmpty(widevineIDWithMd5)) { //乘客
|
||||
mWidevineIDWithMd5 = widevineIDWithMd5;
|
||||
mScreenType = 2;
|
||||
} else { //司机
|
||||
mWidevineIDWithMd5 = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
mScreenType = 1;
|
||||
}
|
||||
|
||||
Log.d("liyz", "getBindingcarInfo ---2--- mAddress = " + mAddress + "--mWidevineIDWithMd5 = " + mWidevineIDWithMd5 + "--mScreenType = " + mScreenType);
|
||||
mAddress = macAddress;
|
||||
mWidevineIDWithMd5 = widevineIDWithMd5;
|
||||
Log.d("liyz", "getBindingcarInfo ------ mAddress = " + mAddress + "--mWidevineIDWithMd5 = " + mWidevineIDWithMd5 + "--getScreenType() = " + getScreenType());
|
||||
if (HmiBuildConfig.isShowSnBindingView) {
|
||||
BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, mWidevineIDWithMd5, mScreenType);
|
||||
BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, mWidevineIDWithMd5, getScreenType());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyCarInfo(BindingcarCallBack callBack) {
|
||||
BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, mWidevineIDWithMd5,callBack, mScreenType);
|
||||
BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, mWidevineIDWithMd5, callBack, getScreenType());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -52,14 +52,13 @@ public class BindingcarNetWorkManager {
|
||||
|
||||
|
||||
/**
|
||||
* 获取绑定的车辆信息 TODO
|
||||
* 获取绑定的车辆信息
|
||||
*
|
||||
* @param macAddress mac地址
|
||||
*/
|
||||
public void getBindingcarInfo(Context context, String macAddress, String widevineIDWithMd5, int screenType) {
|
||||
// String macAddress = "48:b0:2d:3a:bc:78";
|
||||
// String sn = "X20202203105S688HZ";
|
||||
// int screenType = 1;
|
||||
|
||||
Log.d("liyz", "getBindingcarInfo -- widevineIDWithMd5 = " + widevineIDWithMd5 + "--macAddress = " +macAddress + "--screenType = " + screenType);
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
|
||||
@@ -77,9 +76,9 @@ public class BindingcarNetWorkManager {
|
||||
if (info != null && info.getData() != null) {
|
||||
CallerLogger.INSTANCE.d(TAG, "getBindingcarInfo onNext info.getData() =" + info.getData().toString());
|
||||
Log.d("liyz", "getBindingcarInfo onNext info.getData() =" + info.getData().toString() + "--compare = " + info.getData().getCompare());
|
||||
if (info.getData().getCompare().equals(0)) {
|
||||
if (info.getData().getCompare().equals("0")) {
|
||||
CallerHmiManager.INSTANCE.showBindingcarDialog();
|
||||
} else if (info.getData().getCompare().equals(3)) {
|
||||
} else if (info.getData().getCompare().equals("3")) {
|
||||
CallerHmiManager.INSTANCE.showModifyBindingcarDialog();
|
||||
}
|
||||
|
||||
@@ -105,7 +104,6 @@ public class BindingcarNetWorkManager {
|
||||
* mac: 48:b0:2d:3a:9c:19
|
||||
*/
|
||||
public void modifyBindingcar(String macAddress, String widevineIDWithMd5, BindingcarCallBack callBack, int screenType) {
|
||||
// String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
Log.d("liyz", "modifyBindingcar --- widevineIDWithMd5 = " + widevineIDWithMd5 + "---macAddress = " + macAddress + "--screenType = " + screenType);
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, widevineIDWithMd5, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
|
||||
@@ -47,12 +47,11 @@ class ModifyBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifec
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改绑定车机 TODO
|
||||
* 修改绑定车机
|
||||
*/
|
||||
fun modifyBindingcar() {
|
||||
CallerBindingcarManager.getBindingcarProvider().modifyCarInfo {
|
||||
Log.e("liyz", "it.code == ${it.code}" )
|
||||
if (it.code != 205) {
|
||||
if (it.code == 200) {
|
||||
TipToast.shortTip("修改绑定成功")
|
||||
} else {
|
||||
TipToast.shortTip("修改绑定失败")
|
||||
|
||||
@@ -50,7 +50,7 @@ class ToBindingCarDialog(context: Context) : BaseFloatDialog(context), Lifecycle
|
||||
*/
|
||||
fun toBindingcar() {
|
||||
CallerBindingcarManager.getBindingcarProvider().modifyCarInfo {
|
||||
if (it.code != 205) {
|
||||
if (it.code == 200) {
|
||||
TipToast.shortTip("绑定成功")
|
||||
} else {
|
||||
TipToast.shortTip("绑定失败")
|
||||
|
||||
@@ -9,6 +9,7 @@ import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import androidx.annotation.RequiresApi
|
||||
@@ -517,7 +518,7 @@ class DebugSettingView @JvmOverloads constructor(
|
||||
|
||||
btnSetObuIP.setOnClickListener {
|
||||
val obuIP = etObuIP.text.toString()
|
||||
if (obuIP.isNotEmpty()) {
|
||||
if (StringUtils.isValidIPAddress(obuIP)) {
|
||||
CallerOBUManager.resetObuIpAddress(obuIP)
|
||||
} else {
|
||||
ToastUtils.showShort("请输入正确的IP地址")
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
* @since 3/16/22
|
||||
*/
|
||||
public class CarInfo implements Serializable {
|
||||
// compare为0 是表示车辆未绑定ipad sn
|
||||
// compare为0 是表示车辆未绑定ipad sn
|
||||
// compare为1 是表示车辆已绑定ipad sn 并且 与所传appsn一致
|
||||
// compare为2 是表示cmdb车辆没有真实绑定ipad
|
||||
// compare为3 是表示车辆已绑定ipad sn 并且 与所传appsn不一致
|
||||
|
||||
@@ -6,6 +6,7 @@ import androidx.annotation.Nullable;
|
||||
import androidx.annotation.StringRes;
|
||||
|
||||
import java.util.IllegalFormatException;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@@ -259,4 +260,17 @@ public final class StringUtils {
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ip校验
|
||||
* @param ipAddress 单个ip
|
||||
* @return
|
||||
*/
|
||||
public static boolean isValidIPAddress(String ipAddress) {
|
||||
if ((ipAddress != null) && (!ipAddress.isEmpty())) {
|
||||
return Pattern.matches("^([1-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])(\\.(\\d|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])){3}$", ipAddress);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user