This commit is contained in:
lixiaopeng
2022-05-18 15:39:35 +08:00
parent 431cd44f74
commit a5a6ff96f4
5 changed files with 50 additions and 27 deletions

View File

@@ -15,7 +15,6 @@ import com.mogo.eagle.core.data.deva.chain.ChainConstant
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_ALIAS_CODE_MULTI_CONNECT
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_ADAS
import com.mogo.eagle.core.data.deva.chain.ChainConstant.Companion.CHAIN_LINK_LOG_WEB_SOCKET_AUTOPILOT
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
import com.mogo.eagle.core.data.trafficlight.TrafficLightResult
import com.mogo.eagle.core.data.trafficlight.toTrafficLightDetail
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener
@@ -27,9 +26,11 @@ import com.mogo.eagle.core.function.autopilot.adapter.MoGoHandAdasMsgManager
import com.mogo.eagle.core.function.autopilot.server.AsyncDataToAutopilotServer
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotManager
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotCarConfigListenerManager
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
import com.mogo.eagle.core.function.call.map.CallerMapDataCollectorManager
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_ADAS_IMPL
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import com.mogo.eagle.core.utilcode.util.ThreadUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
@@ -144,7 +145,7 @@ class MoGoAutopilotProvider :
}
override fun onReceiveClientSign(channel: Channel?, sn: String?) {
// CallerBindingcarManager.getBindingcarProvider().getBindingcarInfo("", sn)
}
}, MoGoAiCloudClientConfig.getInstance().sn)
} else {

View File

@@ -6,6 +6,7 @@ import android.util.Log;
import androidx.annotation.Nullable;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.constants.MoGoConfig;
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotCarConfigListener;
@@ -18,6 +19,7 @@ import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import org.jetbrains.annotations.NotNull;
@@ -102,12 +104,12 @@ 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());
CallerBindingcarManager.getBindingcarProvider().getBindingcarInfo(carConfigResp.getMacAddress());
SharedPrefsMgr.getInstance(mContext).putString(SharedPrefsConstants.MAC_ADDRESS, carConfigResp.getMacAddress());
// CallerBindingcarManager.getBindingcarProvider().getBindingcarInfo(carConfigResp.getMacAddress(), "");
}
}

View File

@@ -1,8 +1,13 @@
package com.mogo.eagle.core.function.bindingcar;
import android.content.Context;
import android.text.TextUtils;
import android.util.Log;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
import com.mogo.eagle.core.data.config.HmiBuildConfig;
import com.mogo.eagle.core.data.constants.MogoServicePaths;
@@ -11,6 +16,8 @@ import com.mogo.eagle.core.function.api.bindingcar.IMoGoBindingcarProvider;
import com.mogo.eagle.core.function.bindingcar.network.BindingcarNetWorkManager;
import com.mogo.eagle.core.function.ipcupgrade.IPCUpgradeManager;
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.DeviceIdUtils;
import org.jetbrains.annotations.NotNull;
@@ -25,6 +32,8 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
private Context mContext;
private volatile String mAddress;
private volatile String mWidevineIDWithMd5; //google 数字版权
private volatile int mScreenType = -1;
@NotNull
@Override
@@ -49,16 +58,33 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
* @param macAddress
*/
@Override
public void getBindingcarInfo(String macAddress) {
mAddress = macAddress;
if (HmiBuildConfig.isShowSnBindingView) { //TODO 需要验证
// BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, getScreenType());
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);
if (HmiBuildConfig.isShowSnBindingView) {
BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, mWidevineIDWithMd5, mScreenType);
}
}
@Override
public void modifyCarInfo(BindingcarCallBack callBack) {
// BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, callBack, getScreenType());
BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, mWidevineIDWithMd5,callBack, mScreenType);
}

View File

@@ -3,11 +3,8 @@ package com.mogo.eagle.core.function.bindingcar.network;
import android.content.Context;
import android.util.Log;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.AbsMogoApplication;
import com.mogo.commons.constants.SharedPrefsConstants;
import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
import com.mogo.eagle.core.data.bindingcar.CarInfo;
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo;
import com.mogo.eagle.core.function.api.bindingcar.BindingcarCallBack;
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
@@ -15,7 +12,6 @@ import com.mogo.eagle.core.network.MoGoRetrofitFactory;
import com.mogo.eagle.core.network.utils.GsonUtil;
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
import com.mogo.eagle.core.utilcode.util.DeviceIdUtils;
import com.mogo.eagle.core.utilcode.util.GsonUtils;
import com.mogo.module.common.constants.HostConst;
@@ -39,7 +35,7 @@ public class BindingcarNetWorkManager {
private static final String TAG = "BindingcarNetWorkManager";
private BindingcarNetWorkManager() {
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.BINDING_SN_HOST_TEST)
mBindingcarApiService = MoGoRetrofitFactory.getInstance(HostConst.BINDING_SN_HOST_TEST) //TODO
.create(BindingcarApiService.class);
}
@@ -60,14 +56,13 @@ public class BindingcarNetWorkManager {
*
* @param macAddress mac地址
*/
public void getBindingcarInfo(Context context, String macAddress1, int screenType1) {
// String sn = DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp());
String macAddress = "48:b0:2d:3a:bc:7";
String sn = "X20202203105S688HZ";
int screenType = 1;
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 -- sn = " + sn + "--macAddress = " +macAddress + "--screenType = " + screenType);
BindingcarRequest request = new BindingcarRequest(macAddress, sn, screenType);
Log.d("liyz", "getBindingcarInfo -- 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));
mBindingcarApiService.getBindingcarInfo(token, requestBody)
.subscribeOn(Schedulers.io())
@@ -109,11 +104,10 @@ public class BindingcarNetWorkManager {
* 绑定和修改绑定车辆
* mac: 48:b0:2d:3a:9c:19
*/
public void modifyBindingcar(String macAddress, BindingcarCallBack callBack, int screenType) {
public void modifyBindingcar(String macAddress, String widevineIDWithMd5, BindingcarCallBack callBack, int screenType) {
// String sn = MoGoAiCloudClientConfig.getInstance().getSn();
String sn = DeviceIdUtils.getWidevineIDWithMd5(AbsMogoApplication.getApp());
Log.d("liyz", "modifyBindingcar --- sn = " + sn + "---macAddress = " + macAddress);
BindingcarRequest request = new BindingcarRequest(macAddress, sn, screenType);
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));
mBindingcarApiService.modifyBindingcarInfo(token, requestBody)
.subscribeOn(Schedulers.io())

View File

@@ -9,5 +9,5 @@ import com.mogo.eagle.core.function.api.base.IMoGoFunctionServerProvider;
*/
public interface IMoGoBindingcarProvider extends IMoGoFunctionServerProvider {
void modifyCarInfo(BindingcarCallBack callBack);
void getBindingcarInfo(String macAddress);
void getBindingcarInfo(String macAddress, String widevineIDWithMd5);
}