opt sn binding and modify obu sdk version
This commit is contained in:
@@ -51,22 +51,35 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
|
||||
@Override
|
||||
public void getBindingcarInfo(String macAddress) {
|
||||
mAddress = macAddress;
|
||||
BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, getScreenType());
|
||||
long currentHour = System.currentTimeMillis() / (1000 * 60 * 60);
|
||||
long oldHour = SharedPrefsMgr.getInstance(mContext).getLong("type", 0);
|
||||
Log.d("liyz", "getBindingcarInfo currentHour = " + currentHour + "---oldHour = " + oldHour);
|
||||
//12小时内只调用一次,防止用户不点击修改绑定导致的频繁提示,用户第一次点击修改成功后,就不会再提示了
|
||||
if (currentHour - oldHour > 12) {
|
||||
if (getScreenType() == 1) {
|
||||
Log.d("liyz", "getBindingcarInfo getScreenType() -----> ");
|
||||
SharedPrefsMgr.getInstance(mContext).putLong("type", System.currentTimeMillis() / (1000 * 60 * 60));
|
||||
BindingcarNetWorkManager.getInstance().getBindingcarInfo(mContext, macAddress, getScreenType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyCarInfo(BindingcarCallBack callBack) {
|
||||
BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, callBack, getScreenType());
|
||||
if (getScreenType() == 1) {
|
||||
BindingcarNetWorkManager.getInstance().modifyBindingcar(mAddress, callBack, getScreenType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private int getScreenType () {
|
||||
private int getScreenType() {
|
||||
int screenType = -1;
|
||||
if (FunctionBuildConfig.appIdentityMode == 0 || FunctionBuildConfig.appIdentityMode == 0xA0) {
|
||||
screenType = 1; //司机屏
|
||||
screenType = 1; //司机屏
|
||||
} else if (FunctionBuildConfig.appIdentityMode == 1 || FunctionBuildConfig.appIdentityMode == 0xA1) {
|
||||
screenType = 2; //乘客屏
|
||||
}
|
||||
Log.d("liyz", "mode = " + FunctionBuildConfig.appIdentityMode + "--screenType = " + screenType);
|
||||
return screenType;
|
||||
}
|
||||
|
||||
|
||||
@@ -57,11 +57,8 @@ public class BindingcarNetWorkManager {
|
||||
* @param macAddress mac地址
|
||||
*/
|
||||
public void getBindingcarInfo(Context context, String macAddress, int screenType) {
|
||||
if (screenType == 2) {
|
||||
return;
|
||||
}
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, sn);
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, sn, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.getBindingcarInfo(token, requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -75,6 +72,7 @@ public class BindingcarNetWorkManager {
|
||||
public void onNext(@NonNull BindingcarInfo info) {
|
||||
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() == 0) {
|
||||
CallerHmiManager.INSTANCE.showBindingcarDialog();
|
||||
} else if (info.getData().getCompare() == 3) {
|
||||
@@ -88,6 +86,7 @@ public class BindingcarNetWorkManager {
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "getBindingcarInfo onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
Log.e("liyz", "getBindingcarInfo onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,14 +101,8 @@ public class BindingcarNetWorkManager {
|
||||
* mac: 48:b0:2d:3a:9c:19
|
||||
*/
|
||||
public void modifyBindingcar(String macAddress, BindingcarCallBack callBack, int screenType) {
|
||||
Log.d("liyz", "modifyBindingcar screenType = " + screenType);
|
||||
if (screenType == 2) {
|
||||
return;
|
||||
}
|
||||
Log.d("liyz", "modifyBindingcar --------1----------- ");
|
||||
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, sn);
|
||||
BindingcarRequest request = new BindingcarRequest(macAddress, sn, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mBindingcarApiService.modifyBindingcarInfo(token, requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
@@ -124,11 +117,13 @@ public class BindingcarNetWorkManager {
|
||||
if (info != null) {
|
||||
callBack.callBackResult(info);
|
||||
CallerLogger.INSTANCE.d(TAG, "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
|
||||
Log.d("liyz", "modifyBindingcar onNext code = " + info.code + "---msg = " + info.msg + "--info.toString() = " + info.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
Log.e("liyz", "modifyBindingcar onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
CallerLogger.INSTANCE.e(TAG, "modifyBindingcar onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -8,10 +8,12 @@ package com.mogo.eagle.core.function.bindingcar.network;
|
||||
public class BindingcarRequest {
|
||||
private String mac;
|
||||
private String sn;
|
||||
private int type;
|
||||
|
||||
public BindingcarRequest(String mac, String sn) {
|
||||
public BindingcarRequest(String mac, String sn, int type) {
|
||||
this.mac = mac;
|
||||
this.sn = sn;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getMac() {
|
||||
@@ -30,11 +32,20 @@ public class BindingcarRequest {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BindingcarRequest{" +
|
||||
"mac='" + mac + '\'' +
|
||||
", sn='" + sn + '\'' +
|
||||
", type=" + type +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user