Merge branch 'dev_robotaxi-d-app-module_280_220608_2.8.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_robotaxi-d-app-module_280_220608_2.8.0
This commit is contained in:
@@ -16,12 +16,12 @@ public class BusRoutesResult {
|
||||
private int status;
|
||||
|
||||
//线路轨迹相关字段
|
||||
public String csvFileUrl; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5; //轨迹文件md5,默认“”
|
||||
public String txtFileUrl; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5; //轨迹文件md5,默认“”
|
||||
public String csvFileUrl = ""; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public String txtFileUrl = ""; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public long contrailSaveTime; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
public String carModel; //[optional] 车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题
|
||||
public String carModel = ""; //[optional] 车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题
|
||||
|
||||
public int getLineId() {
|
||||
return lineId;
|
||||
@@ -48,6 +48,12 @@ public class BusRoutesResult {
|
||||
", lineType=" + lineType +
|
||||
", description='" + description + '\'' +
|
||||
", status=" + status +
|
||||
", csvFileUrl='" + csvFileUrl + '\'' +
|
||||
", csvFileMd5='" + csvFileMd5 + '\'' +
|
||||
", txtFileUrl='" + txtFileUrl + '\'' +
|
||||
", txtFileMd5='" + txtFileMd5 + '\'' +
|
||||
", contrailSaveTime=" + contrailSaveTime +
|
||||
", carModel='" + carModel + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import android.text.TextUtils;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -508,20 +509,27 @@ public class BusOrderModel {
|
||||
// == CallerAutoPilotStatusListenerManager.INSTANCE.getAutoPilotStatusInfo().getState()) {
|
||||
// ToastUtils.showShort("自动驾驶状态为不可用!");
|
||||
// }
|
||||
AutopilotControlParameters currentAutopilot = new AutopilotControlParameters();
|
||||
currentAutopilot.isSpeakVoice = !isRestart;
|
||||
currentAutopilot.routeID = busRoutesResult.getLineId();
|
||||
currentAutopilot.routeName = busRoutesResult.getName();
|
||||
currentAutopilot.startName = PinYinUtil.getPinYinHeadChar(currentStation.getName());
|
||||
currentAutopilot.endName = PinYinUtil.getPinYinHeadChar(nextStation.getName());
|
||||
currentAutopilot.startLatLon = new AutopilotControlParameters
|
||||
AutopilotControlParameters parameters = new AutopilotControlParameters();
|
||||
parameters.isSpeakVoice = !isRestart;
|
||||
parameters.routeID = busRoutesResult.getLineId();
|
||||
parameters.routeName = busRoutesResult.getName();
|
||||
parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.getName());
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(nextStation.getName());
|
||||
parameters.startLatLon = new AutopilotControlParameters
|
||||
.AutoPilotLonLat( currentStation.getLat(), currentStation.getLon() );
|
||||
currentAutopilot.endLatLon = new AutopilotControlParameters
|
||||
parameters.endLatLon = new AutopilotControlParameters
|
||||
.AutoPilotLonLat( nextStation.getLat(), nextStation.getLon() );
|
||||
currentAutopilot.vehicleType = VEHICLE_TYPE;
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "开启自动驾驶====" + currentAutopilot.toString()
|
||||
parameters.vehicleType = VEHICLE_TYPE;
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
busRoutesResult.getLineId(),
|
||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel);
|
||||
}
|
||||
CallerLogger.INSTANCE.d( M_BUS + TAG, "开启自动驾驶====" + GsonUtil.jsonFromObject(parameters)
|
||||
+" startLatLon="+currentStation.getName()+",endLatLon="+nextStation.getName());
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(currentAutopilot);
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
|
||||
|
||||
triggerStartServiceEvent(isRestart, false);
|
||||
|
||||
|
||||
@@ -51,13 +51,13 @@ public class OrderQueryRespBean extends BaseData {
|
||||
public String passengerNum;
|
||||
|
||||
//线路轨迹相关字段
|
||||
public long lineId; //路线id,默认-1
|
||||
public String csvFileUrl; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5; //轨迹文件md5,默认“”
|
||||
public String txtFileUrl; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5; //轨迹文件md5,默认“”
|
||||
public long lineId = -1; //路线id,默认-1
|
||||
public String csvFileUrl = ""; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public String txtFileUrl = ""; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public long contrailSaveTime; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
public String carModel; //[optional] 车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题
|
||||
public String carModel = ""; //[optional] 车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题
|
||||
|
||||
// !!!接口中暂无此字段,仅用于本地实现逻辑使用:起始站目的站距离km
|
||||
public double travelDistance;
|
||||
|
||||
@@ -884,6 +884,13 @@ public class TaxiModel {
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(mCurrentOCHOrder.endSiteAddr); // 终点名称拼音首字母大写:科学城C区三号门(KXCCQSHM)
|
||||
parameters.startLatLon = new AutopilotControlParameters.AutoPilotLonLat(startWgsLat, startWgsLon);
|
||||
parameters.endLatLon = new AutopilotControlParameters.AutoPilotLonLat(endWgsLat, endWgsLon);
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = new AutopilotControlParameters.AutoPilotLine(
|
||||
mCurrentOCHOrder.lineId,
|
||||
mCurrentOCHOrder.csvFileUrl, mCurrentOCHOrder.csvFileMd5,
|
||||
mCurrentOCHOrder.txtFileUrl, mCurrentOCHOrder.txtFileMd5,
|
||||
mCurrentOCHOrder.contrailSaveTime, mCurrentOCHOrder.carModel);
|
||||
}
|
||||
CallerAutoPilotManager.INSTANCE.startAutoPilot(parameters);
|
||||
CallerLogger.INSTANCE.d(M_TAXI + TAG, "start autopilot with parameter: %s", GsonUtil.jsonFromObject(parameters)
|
||||
+ " ,startSiteName=" + mCurrentOCHOrder.startSiteAddr + " ,endSiteName=" + mCurrentOCHOrder.endSiteAddr);
|
||||
|
||||
29
app/src/main/java/com/mogo/launcher/stageone/APMStartup.kt
Normal file
29
app/src/main/java/com/mogo/launcher/stageone/APMStartup.kt
Normal file
@@ -0,0 +1,29 @@
|
||||
package com.mogo.launcher.stageone
|
||||
|
||||
import android.content.Context
|
||||
import com.rousetime.android_startup.AndroidStartup
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.test.crashreport.upgrade.UpgradeReportConstants
|
||||
import com.mogo.test.crashreport.CrashReportConstants
|
||||
|
||||
class APMStartup : AndroidStartup<Boolean?>() {
|
||||
override fun create(context: Context): Boolean? {
|
||||
// bugly
|
||||
ARouter.getInstance().build(UpgradeReportConstants.PATH).navigation()
|
||||
// apm
|
||||
ARouter.getInstance().build(CrashReportConstants.PATH).navigation()
|
||||
return true
|
||||
}
|
||||
|
||||
override fun callCreateOnMainThread(): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
override fun waitOnMainThread(): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
override fun dependenciesByName(): List<String> {
|
||||
return listOf("com.mogo.launcher.stageone.ARouterStartUp")
|
||||
}
|
||||
}
|
||||
@@ -62,7 +62,7 @@ class HttpDnsStartUp : AndroidStartup<Boolean>() {
|
||||
override fun waitOnMainThread() = false
|
||||
|
||||
override fun dependenciesByName(): List<String> {
|
||||
return listOf("com.mogo.launcher.stageone.ARouterStartUp", "com.mogo.launcher.stageone.ConfigStartUp")
|
||||
return listOf("com.mogo.launcher.stageone.APMStartup", "com.mogo.launcher.stageone.ConfigStartUp")
|
||||
}
|
||||
|
||||
override fun create(context: Context): Boolean {
|
||||
|
||||
@@ -69,8 +69,8 @@ dependencies {
|
||||
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
|
||||
implementation rootProject.ext.dependencies.gson
|
||||
implementation project(':libraries:mogo-adas')
|
||||
implementation project(':libraries:mogo-adas-backgrounder-permission')
|
||||
// implementation 'com.zhidao.support.adas:high:2.6.6.0'
|
||||
implementation project(':libraries:mogo-adas-other')
|
||||
// implementation 'com.zhidao.support.adas:high:2.7.0.0'
|
||||
// implementation 'com.zhjt.mogo.adas.data:adas-data:2.6.6.0'
|
||||
compileOnly project(':core:mogo-core-data')
|
||||
implementation project(':core:mogo-core-utils')
|
||||
|
||||
@@ -309,22 +309,23 @@ public class AutopilotConfigActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
private void onBack() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("退出提示")
|
||||
.setMessage("是否配置页面")
|
||||
.setNegativeButton("取消",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
}
|
||||
})
|
||||
.setPositiveButton("确认",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
finish();
|
||||
}
|
||||
}).show();
|
||||
finish();
|
||||
// new AlertDialog.Builder(this)
|
||||
// .setTitle("退出提示")
|
||||
// .setMessage("是否配置页面")
|
||||
// .setNegativeButton("取消",
|
||||
// new DialogInterface.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// dialog.cancel();
|
||||
// }
|
||||
// })
|
||||
// .setPositiveButton("确认",
|
||||
// new DialogInterface.OnClickListener() {
|
||||
// public void onClick(DialogInterface dialog, int whichButton) {
|
||||
// finish();
|
||||
// }
|
||||
// }).show();
|
||||
}
|
||||
|
||||
//返回键处理
|
||||
|
||||
@@ -78,6 +78,7 @@ import com.zhidao.adas.client.bean.Warn;
|
||||
import com.zhidao.adas.client.log.ConnectStatusSave;
|
||||
import com.zhidao.adas.client.log.LogSave;
|
||||
import com.zhidao.adas.client.utils.Constants;
|
||||
import com.zhidao.adas.client.utils.PreferencesUtils;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
import com.zhidao.support.adas.high.AdasOptions;
|
||||
import com.zhidao.support.adas.high.OnAdasConnectStatusListener;
|
||||
@@ -89,6 +90,9 @@ import com.zhidao.support.adas.high.common.Constants.IPC_CONNECTION_STATUS;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.ProtocolStatus;
|
||||
import com.zhidao.support.adas.high.common.ReceiveTimeoutManager;
|
||||
import com.zhidao.support.adas.high.other.permission.BackgrounderPermission;
|
||||
import com.zhidao.support.adas.high.other.permission.OnAdasPermissionListener;
|
||||
import com.zhidao.support.adas.high.other.router.RouterActivity;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
@@ -191,6 +195,7 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
onUpdateConnectStateView();
|
||||
showIPCIP();
|
||||
canDrawOverlays();
|
||||
showHint();
|
||||
// PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE);
|
||||
// wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG);
|
||||
// wakeLock.acquire();
|
||||
@@ -206,6 +211,28 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
// wifiLock.acquire();
|
||||
}
|
||||
|
||||
private void showHint() {
|
||||
boolean isShowHint = PreferencesUtils.getBoolean(this, "show_hint", true);
|
||||
if (isShowHint) {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle("警告")
|
||||
.setMessage("本应用运行时会影响鹰眼司机、乘客端的连接。\n使用完成后请彻底杀掉本应用并重启鹰眼")
|
||||
.setNegativeButton("不再提示",
|
||||
new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.cancel();
|
||||
PreferencesUtils.putBoolean(MainActivity.this, "show_hint", false);
|
||||
}
|
||||
})
|
||||
.setPositiveButton("知道了",
|
||||
new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int whichButton) {
|
||||
}
|
||||
}).show();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
@@ -282,7 +309,12 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
tvConnectState = findViewById(R.id.tv_connect_state);
|
||||
ipcIp = findViewById(R.id.ipc_ip);
|
||||
localIp = findViewById(R.id.local_ip);
|
||||
|
||||
findViewById(R.id.btn_router).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
RouterActivity.newInstance(MainActivity.this, false);
|
||||
}
|
||||
});
|
||||
|
||||
role.setSelected(BuildConfig.IS_CLIENT);
|
||||
if (BuildConfig.IS_CLIENT) {
|
||||
@@ -527,21 +559,25 @@ public class MainActivity extends BaseActivity implements OnAdasListener, OnAdas
|
||||
}
|
||||
});
|
||||
|
||||
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
// String str = "后台运行:" + (AdasManager.getInstance().isPermissionLongBackgroundRunning(this) ? "<font color='red'>已优化</font>" : "<font color='red'>未优化</font>");
|
||||
// background.setText(Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY));
|
||||
// background.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
//
|
||||
//// Permission.requestAddDataSaverWhite(MainActivity.this);
|
||||
//// AdasManager.getInstance().requestIgnoreBatteryOptimizations(MainActivity.this);
|
||||
// AdasManager.getInstance().showPermissionLongBackgroundRunningDialog(MainActivity.this);
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
// background.setVisibility(View.GONE);
|
||||
// }
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
String str = "后台运行:" + (BackgrounderPermission.getInstance().isPermissionLongBackgroundRunning(this) ? "<font color='green'>已优化</font>" : "<font color='red'>未优化</font>");
|
||||
background.setText(Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY));
|
||||
background.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
BackgrounderPermission.getInstance().showPermissionLongBackgroundRunningDialog(MainActivity.this);
|
||||
}
|
||||
});
|
||||
BackgrounderPermission.getInstance().setListener(new OnAdasPermissionListener() {
|
||||
@Override
|
||||
public void onBackgrounderPermission(boolean isAllow) {
|
||||
String str = "后台运行:" + (isAllow ? "<font color='green'>已优化</font>" : "<font color='red'>未优化</font>");
|
||||
background.setText(Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY));
|
||||
}
|
||||
});
|
||||
} else {
|
||||
background.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
private void showListPopupWindow() {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/icon_dev_status_net_disable" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/icon_dev_status_net_enable" />
|
||||
|
||||
</selector>
|
||||
@@ -283,6 +283,14 @@
|
||||
android:layout_marginStart="-42dp"
|
||||
android:scaleType="centerInside"
|
||||
android:src="@drawable/selector_history_ip" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/btn_router"
|
||||
android:layout_width="40dp"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginStart="18dp"
|
||||
android:src="@drawable/selector_router" />
|
||||
</LinearLayout>
|
||||
</HorizontalScrollView>
|
||||
</RelativeLayout>
|
||||
@@ -96,6 +96,7 @@ public class MoGoHandAdasMsgManager implements
|
||||
CallerHmiManager.INSTANCE.showTurnLight(state);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.mogo.eagle.core.function.appupgrade.network;
|
||||
|
||||
import com.mogo.eagle.core.data.bindingcar.BindingcarInfo;
|
||||
import com.mogo.eagle.core.data.bindingcar.ModifyBindingcarInfo;
|
||||
import com.mogo.eagle.core.data.bindingcar.UpgradeAppInfo;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.Header;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
import retrofit2.http.Query;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
@@ -19,11 +17,11 @@ import retrofit2.http.POST;
|
||||
public interface UpgradeApiService {
|
||||
/**
|
||||
* 获取升级信息
|
||||
*
|
||||
* , @Query("resources") String i
|
||||
* @return {@link UpgradeAppInfo}
|
||||
*/
|
||||
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||
@POST("pad/selectPadByMac")
|
||||
Observable<UpgradeAppInfo> getUpgradeInfo(@Body RequestBody requestBody);
|
||||
@POST("unify/selectResources")
|
||||
Observable<UpgradeAppInfo> getUpgradeInfo(@Query("resources") String res, @Body RequestBody requestBody);
|
||||
|
||||
}
|
||||
|
||||
@@ -58,39 +58,39 @@ public class UpgradeAppNetWorkManager {
|
||||
/**
|
||||
* 获取app升级信息
|
||||
*/
|
||||
public void getAppUpgradeInfo(Context context, int screenType) {
|
||||
String sn = "X20202203105S688HZ";
|
||||
String versionCode = "2070000";
|
||||
String versionName = "2.7.0";
|
||||
int screenType1 = 1;
|
||||
public void getAppUpgradeInfo(Context context, String screenType) {
|
||||
// String sn = "X20202203105S688HZ";
|
||||
// int versionCode = 2070000;
|
||||
// String versionName = "2.7.0";
|
||||
|
||||
// String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
// String versionCode = AppUtils.getAppVersionCode();
|
||||
// String versionName = AppUtils.getAppVersionName();
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
int versionCode = AppUtils.getAppVersionCode();
|
||||
String versionName = AppUtils.getAppVersionName();
|
||||
|
||||
UpgradeAppRequest request = new UpgradeAppRequest("apps_control", sn, versionCode, versionName, screenType1);
|
||||
UpgradeAppRequest request = new UpgradeAppRequest(sn, versionCode, versionName, screenType);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
mUpgradeApiService.getUpgradeInfo(requestBody)
|
||||
mUpgradeApiService.getUpgradeInfo("apps_control", requestBody)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Observer<UpgradeAppInfo>() {
|
||||
@Override
|
||||
public void onSubscribe(@NonNull Disposable d) {
|
||||
Log.d("liyz", "UpgradeAppInfo ------> ");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNext(@NonNull UpgradeAppInfo info) {
|
||||
if (info != null && info.getData() != null) {
|
||||
Log.d("liyz", "UpgradeAppInfo url = " + info.getData().getApp_url() + "----code = " + info.getData().getVersion_code());
|
||||
//TODO 弹框
|
||||
|
||||
if (info != null && info.getData() != null && info.getData().size() > 0) {
|
||||
CallerLogger.INSTANCE.e(TAG, "UpgradeAppInfo url = " + info.getData().get(0).getApp_url() + "---info.getData().get(0).getVersion_code() = " + info.getData().get(0).getVersion_code());
|
||||
Log.d("liyz", "UpgradeAppInfo url = " + info.getData().get(0).getApp_url() + "----code = " + info.getData().get(0).getVersion_code());
|
||||
if (info.getData().get(0).getVersion_code() > versionCode) {
|
||||
CallerHmiManager.INSTANCE.showUpgradeDialog(info.getData().get(0).getApp_url().substring(info.getData().get(0).getApp_url().lastIndexOf("/")+1), info.getData().get(0).getApp_url());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(@NonNull Throwable e) {
|
||||
CallerLogger.INSTANCE.e(TAG, "getBindingcarInfo onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
CallerLogger.INSTANCE.e(TAG, "UpgradeAppInfo onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
Log.e("liyz", "UpgradeAppInfo onError e = " + e.toString() + "---e.getMessage = " + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
@@ -6,27 +6,26 @@ package com.mogo.eagle.core.function.appupgrade.network;
|
||||
* @since: 11/15/21
|
||||
*/
|
||||
public class UpgradeAppRequest {
|
||||
private String resources;
|
||||
// private String resources;
|
||||
private String sn;
|
||||
private String version_code;
|
||||
private int version_code;
|
||||
private String version_name;
|
||||
private int screen_type;
|
||||
private String screen_type;
|
||||
|
||||
public UpgradeAppRequest(String resources, String sn, String versionCode, String versionName, int type) {
|
||||
this.resources = resources;
|
||||
public UpgradeAppRequest(/*String resources,*/ String sn, int versionCode, String versionName, String type) {
|
||||
this.sn = sn;
|
||||
this.version_code = versionCode;
|
||||
this.version_name = versionName;
|
||||
this.screen_type = type;
|
||||
}
|
||||
|
||||
public String getResources() {
|
||||
return resources;
|
||||
}
|
||||
|
||||
public void setResources(String resources) {
|
||||
this.resources = resources;
|
||||
}
|
||||
// public String getResources() {
|
||||
// return resources;
|
||||
// }
|
||||
//
|
||||
// public void setResources(String resources) {
|
||||
// this.resources = resources;
|
||||
// }
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
@@ -36,11 +35,11 @@ public class UpgradeAppRequest {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getVersion_code() {
|
||||
public int getVersion_code() {
|
||||
return version_code;
|
||||
}
|
||||
|
||||
public void setVersion_code(String version_code) {
|
||||
public void setVersion_code(int version_code) {
|
||||
this.version_code = version_code;
|
||||
}
|
||||
|
||||
@@ -52,11 +51,11 @@ public class UpgradeAppRequest {
|
||||
this.version_name = version_name;
|
||||
}
|
||||
|
||||
public int getScreen_type() {
|
||||
public String getScreen_type() {
|
||||
return screen_type;
|
||||
}
|
||||
|
||||
public void setScreen_type(int screen_type) {
|
||||
public void setScreen_type(String screen_type) {
|
||||
this.screen_type = screen_type;
|
||||
}
|
||||
|
||||
@@ -64,7 +63,7 @@ public class UpgradeAppRequest {
|
||||
public String toString() {
|
||||
return "UpgradeAppRequest{" +
|
||||
"sn='" + sn + '\'' +
|
||||
", version_code='" + version_code + '\'' +
|
||||
", version_code=" + version_code +
|
||||
", version_name='" + version_name + '\'' +
|
||||
", screen_type=" + screen_type +
|
||||
'}';
|
||||
|
||||
@@ -133,7 +133,7 @@ public class BindingcarProvider implements IMoGoBindingcarProvider {
|
||||
*/
|
||||
@Override
|
||||
public void queryAppUpgrade() {
|
||||
UpgradeAppNetWorkManager.getInstance().getAppUpgradeInfo(mContext, getScreenType());
|
||||
UpgradeAppNetWorkManager.getInstance().getAppUpgradeInfo(mContext, String.valueOf(getScreenType()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.eagle.core.function.ipcupgrade
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClient
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.mogo.toast.TipToast
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.module.common.dialog.BaseFloatDialog
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener
|
||||
@@ -49,9 +50,11 @@ class UpgradeAppDialog(context: Context) : BaseFloatDialog(context), LifecycleOb
|
||||
}
|
||||
|
||||
/**
|
||||
* 去下载 TODO 成功或者失败
|
||||
* 去下载
|
||||
*/
|
||||
fun downloadApp() {
|
||||
Log.d("liyz", "UpgradeAppDialog tag = $tag ---- downloarUrl = $downloarUrl")
|
||||
ToastUtils.showLong("开始下载APK,稍后可前往downloads文件夹查看")
|
||||
tag?.let { downloarUrl?.let { it1 -> CallerDevaToolsManager.downLoadPackage(it, it1) } }
|
||||
|
||||
dismiss()
|
||||
@@ -67,7 +70,6 @@ class UpgradeAppDialog(context: Context) : BaseFloatDialog(context), LifecycleOb
|
||||
}
|
||||
tag = name
|
||||
downloarUrl = url
|
||||
Log.d("liyz", "tag = $tag ---- downloarUrl = $downloarUrl")
|
||||
show()
|
||||
}
|
||||
|
||||
|
||||
@@ -61,10 +61,7 @@ class SystemVersionView @JvmOverloads constructor(
|
||||
//鹰眼版本视图点击事件
|
||||
ivPadVersion.setOnClickListener {
|
||||
CallerLogger.i("$M_HMI$$TAG", "pad version view clicked")
|
||||
// CallerBindingcarManager.getBindingcarProvider().queryAppUpgrade()
|
||||
|
||||
Logger.d("liyz", "ivPadVersion --click ")
|
||||
|
||||
CallerBindingcarManager.getBindingcarProvider().queryAppUpgrade()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ public class MainActivity extends MvpActivity<MainView, MainPresenter> implement
|
||||
}
|
||||
new StartupManager.Builder()
|
||||
.addStartup(new AutopilotStartup())
|
||||
.addStartup(new APMStartup())
|
||||
// .addStartup(new APMStartup())
|
||||
.setConfig(config)
|
||||
.build(this)
|
||||
.start()
|
||||
|
||||
@@ -6,6 +6,7 @@ import android.content.Context;
|
||||
import android.os.Process;
|
||||
|
||||
import com.bytedance.boost_multidex.BoostMultiDex;
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.cloud.socket.SocketBuildConfig;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
@@ -13,6 +14,7 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.constants.MoGoConfig;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.eagle.core.function.api.chat.biz.ChatConsts;
|
||||
import com.mogo.eagle.core.function.call.bindingcar.CallerBindingcarManager;
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.mogo.eagle.core.function.notice.PushUIConstants;
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils;
|
||||
@@ -51,6 +53,9 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
initLogConfig();
|
||||
initTipToast();
|
||||
initModules();
|
||||
|
||||
//查询是否有版本的更新
|
||||
queryAppUpgrade();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -59,6 +64,15 @@ public abstract class MainMoGoApplication extends AbsMogoApplication {
|
||||
return ProcessUtils.isMainProcess(this);
|
||||
}
|
||||
|
||||
private void queryAppUpgrade() {
|
||||
UiThreadHandler.postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
CallerBindingcarManager.getBindingcarProvider().queryAppUpgrade();
|
||||
}
|
||||
},3000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化异常采集配置
|
||||
*/
|
||||
|
||||
@@ -30,11 +30,11 @@ public class AutopilotStartup extends AndroidStartup<Boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> dependenciesByName() {
|
||||
List<String> deps = new ArrayList<>();
|
||||
deps.add("com.mogo.eagle.core.function.main.stagetwo.APMStartup");
|
||||
return deps;
|
||||
}
|
||||
// @Nullable
|
||||
// @Override
|
||||
// public List<String> dependenciesByName() {
|
||||
// List<String> deps = new ArrayList<>();
|
||||
// deps.add("com.mogo.eagle.core.function.main.stagetwo.APMStartup");
|
||||
// return deps;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ public class MapStartup extends AndroidStartup<Boolean> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> dependenciesByName() {
|
||||
List<String> deps = new ArrayList<>();
|
||||
deps.add("com.mogo.eagle.core.function.main.stagetwo.APMStartup");
|
||||
return deps;
|
||||
}
|
||||
// @Nullable
|
||||
// @Override
|
||||
// public List<String> dependenciesByName() {
|
||||
// List<String> deps = new ArrayList<>();
|
||||
// deps.add("com.mogo.eagle.core.function.main.stagetwo.APMStartup");
|
||||
// return deps;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
android:textSize="43px"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_bindingcar_title" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_upgrade_title" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_horizontal_line"
|
||||
@@ -38,7 +38,7 @@
|
||||
android:background="#66B8BFE8"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_bindingcar_tips" />
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_upgrade_tips" />
|
||||
|
||||
<View
|
||||
android:id="@+id/view_vertical_line"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.eagle.core.function.map.identify
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import androidx.collection.ArraySet
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum
|
||||
@@ -37,7 +38,7 @@ class IdentifyOriginDataDrawer : Identify {
|
||||
/**
|
||||
* 记录每次实际绘制的交通元素UUID
|
||||
*/
|
||||
private val trafficDataUuidList = ArrayList<String>()
|
||||
private val trafficDataUuidList = ArraySet<String>()
|
||||
|
||||
/**
|
||||
* 过滤后的数据集合
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -32,8 +31,6 @@ public class TrackManager {
|
||||
return TrackOwner.trackManager;
|
||||
}
|
||||
|
||||
public static final DecimalFormat DF = new DecimalFormat("0.000000");
|
||||
public static final int DISTANCE = 6371000;
|
||||
public static double LIMIT_SPEED = 0.5;
|
||||
|
||||
/**
|
||||
@@ -46,7 +43,7 @@ public class TrackManager {
|
||||
*/
|
||||
private final BiMap<String, Long> cellIdCaches = HashBiMap.create();
|
||||
|
||||
private final ArrayMap<String, TrackObj> recentCaches = new ArrayMap<>();
|
||||
// private final ArrayMap<String, TrackObj> recentCaches = new ArrayMap<>();
|
||||
|
||||
/**
|
||||
* 记录每次实际绘制的交通元素UUID
|
||||
@@ -78,16 +75,25 @@ public class TrackManager {
|
||||
mFilterTrafficData.add(data);
|
||||
} else {
|
||||
trackObj = new TrackObj(data);
|
||||
// 判断是否有重合元素 google s2
|
||||
// 融合逻辑 : 判断是否有重合元素 google s2
|
||||
if (cellIdCaches.containsValue(trackObj.getCellIdPos())) {
|
||||
String findSameValue = cellIdCaches.inverse().get(trackObj.getCellIdPos());
|
||||
if (data.getUuid() - Integer.parseInt(findSameValue) > 0) {
|
||||
// Log.d("0609", "uuid : " + findSameValue + " 与新感知物 : " + uuid + " , 出现相同pos : " + trackObj.getCellIdPos());
|
||||
uuid = findSameValue;
|
||||
data = data.toBuilder().setUuid(Integer.parseInt(findSameValue)).build();
|
||||
data = trackObj.updateObj(data);
|
||||
mFilterTrafficData.add(data);
|
||||
Log.d("hy uuid : " + findSameValue, " 与新感知物 : " + uuid + "相同");
|
||||
//uuid处理
|
||||
data = data.toBuilder().setUuid(Integer.parseInt(findSameValue)).build();
|
||||
MessagePad.TrackedObject cache = mMarkersCaches.get(findSameValue).getCache();
|
||||
if (cache != null) {
|
||||
//相对静止物体不改变
|
||||
TrackObj cacheTrack = mMarkersCaches.get(findSameValue);
|
||||
if (cacheTrack.relativeStatic()) {
|
||||
data = cache;
|
||||
trackObj = cacheTrack;
|
||||
}
|
||||
//todo OBU相关后面通过增加字段判断数据来源进行融合,不融合衡阳验收分支功能
|
||||
}
|
||||
uuid = findSameValue;
|
||||
data = trackObj.updateObj(data);
|
||||
mFilterTrafficData.add(data);
|
||||
}
|
||||
}
|
||||
cellIdCaches.forcePut(uuid, trackObj.getCellIdPos());
|
||||
@@ -126,10 +132,7 @@ public class TrackManager {
|
||||
}
|
||||
trafficDataUuidList.forEach(uuid -> {
|
||||
Log.d("hy uuid : " + uuid, " 移除物体");
|
||||
mMarkersCaches.remove(uuid);
|
||||
cellIdCaches.remove(uuid);
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(uuid);
|
||||
removeKey(uuid);
|
||||
});
|
||||
//todo bus存在时间回溯,将id重置,会有id复用问题,导致鹰眼展示元素缺少
|
||||
// Iterator it = mMarkersCaches.keySet().iterator();
|
||||
@@ -149,16 +152,20 @@ public class TrackManager {
|
||||
// }
|
||||
}
|
||||
|
||||
public void removeKey(String key) {
|
||||
mMarkersCaches.remove(key);
|
||||
cellIdCaches.remove(key);
|
||||
// recentCaches.remove(key);
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(key);
|
||||
}
|
||||
|
||||
public void clearAll() {
|
||||
trafficDataUuidList.clear();
|
||||
Iterator it = mMarkersCaches.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
String key = (String) it.next();
|
||||
mMarkersCaches.remove(key);
|
||||
cellIdCaches.remove(key);
|
||||
recentCaches.remove(key);
|
||||
MogoMarkerManager.getInstance(AbsMogoApplication.getApp())
|
||||
.removeMarker(key);
|
||||
removeKey(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,14 +1,19 @@
|
||||
package com.mogo.eagle.core.function.map.identify;
|
||||
|
||||
import static com.mogo.eagle.core.function.map.identify.TrackManager.DISTANCE;
|
||||
import static com.mogo.eagle.core.function.map.identify.TrackManager.LIMIT_SPEED;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.eagle.core.function.call.map.CallerHDMapManager;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
|
||||
import com.mogo.module.service.Utils;
|
||||
import com.mogo.eagle.core.data.map.CenterLine;
|
||||
import com.mogo.map.utils.PointInterpolatorUtil;
|
||||
import com.zhidaoauto.map.sdk.open.data.MapDataApi;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
@@ -22,12 +27,12 @@ public class TrackObj {
|
||||
private long recentlyTime; //用于缓存帧数判断,暂定缓存1秒数据,中间如果有物体未出现,1秒后删除
|
||||
private double roadAngle; //道路航向
|
||||
private double headingDelta; //航向角德尔塔
|
||||
private int[] typeArray = new int[5];
|
||||
private double typeWeight; //类型权重
|
||||
private double lat;
|
||||
private double lon;
|
||||
private double speedAverage;
|
||||
// private SinglePointRoadInfo singlePointRoadInfo;
|
||||
// private double[] matchedPoint;
|
||||
private com.zhidaoauto.map.sdk.open.road.CenterLine centerLineInfo = null;
|
||||
|
||||
public TrackObj(MessagePad.TrackedObject data) {
|
||||
kalmanFilter = new KalmanFilter(data.getLongitude(), data.getLatitude(), 0.0000005);
|
||||
@@ -58,93 +63,72 @@ public class TrackObj {
|
||||
}
|
||||
|
||||
private void correct() {
|
||||
calAverageSpeed();
|
||||
calAverageSpeedAndType();
|
||||
calLoc();
|
||||
calHeading();
|
||||
calType();
|
||||
}
|
||||
|
||||
private void calAverageSpeed() {
|
||||
//计算平均速度
|
||||
@SuppressLint("NewApi")
|
||||
private void calAverageSpeedAndType() {
|
||||
|
||||
if (circleQueue.size() >= 5) {
|
||||
//计算平均速度
|
||||
List<ObjQueue> objQueueList = circleQueue.getLastFiveFrame();
|
||||
speedAverage = (objQueueList.get(0).getSpeed() + objQueueList.get(1).getSpeed() + objQueueList.get(2).getSpeed() + objQueueList.get(3).getSpeed() + objQueueList.get(4).getSpeed()) / 5;
|
||||
//计算类型
|
||||
typeArray[0] = objQueueList.get(0).getType();
|
||||
typeArray[1] = objQueueList.get(1).getType();
|
||||
typeArray[2] = objQueueList.get(2).getType();
|
||||
typeArray[3] = objQueueList.get(3).getType();
|
||||
typeArray[4] = objQueueList.get(4).getType();
|
||||
} else {
|
||||
double cal = 0;
|
||||
List<ObjQueue> objQueueList = circleQueue.getPreFrame();
|
||||
for (ObjQueue obj : objQueueList) {
|
||||
cal += obj.getSpeed();
|
||||
for (int i = 0; i < objQueueList.size() - 1; i++) {
|
||||
cal += objQueueList.get(i).getSpeed();
|
||||
typeArray[i] = objQueueList.get(i).getType();
|
||||
}
|
||||
speedAverage = cal / objQueueList.size();
|
||||
// speedAverage = circleQueue.getLastFrame().getSpeed();
|
||||
}
|
||||
Log.d("hy uuid : " + cacheData.getUuid()," 类型 : " + Arrays.toString(typeArray));
|
||||
typeArray = Arrays.stream(typeArray).sorted().toArray();
|
||||
typeWeight = typeArray[typeArray.length / 2];
|
||||
}
|
||||
|
||||
private void calLoc() {
|
||||
//距离计算,位置修正
|
||||
//todo bus250 taxi上测试下面注释掉内容
|
||||
//double[] lonLat = kalmanFilter.filter(cacheData.getLongitude(), cacheData.getLatitude());
|
||||
// double distance = s2LatLng.getDistance(S2LatLng.fromDegrees(lonLat[1], lonLat[0])).distance(DISTANCE);
|
||||
// double distance = s2LatLng.getDistance(S2LatLng.fromDegrees(cacheData.getLatitude(), cacheData.getLongitude())).distance(DISTANCE);
|
||||
//todo 重新计算速度值(如果连续几帧distance累加到一定值,速度没变化,需要重新计算速度,防止锁死)
|
||||
// if (relativeStatic()) {
|
||||
// double tempDis = distance;
|
||||
// if (distance >= 4) { //(150km/h) 41.6m/s x 0.1s = 4.16m 约等于 4
|
||||
// tempDis = 4;
|
||||
// }
|
||||
// double calSpeed = cacheData.getSpeed();
|
||||
// if (cacheData.getSpeed() != 0.0) {
|
||||
// calSpeed = tempDis / ((Double.valueOf(cacheData.getSatelliteTime() * 1000).longValue() - recentlyTime) / 1000.0);
|
||||
//// Log.d("calSpeed uuid : " + cacheData.getUuid(), " tempDis : " + tempDis + " , 重新赋值 calSpeed : " + DF.format(calSpeed) + " , time : " + (Double.valueOf(cacheData.getSatelliteTime() * 1000).longValue() - recentlyTime) + " , 原速度 : " + cacheData.getSpeed());
|
||||
// if (calSpeed > cacheData.getSpeed()) {
|
||||
// calSpeed = cacheData.getSpeed();
|
||||
//// Log.d("calSpeed uuid : " + cacheData.getUuid(), " 二次重新赋值 calSpeed : " + DF.format(calSpeed));
|
||||
// }
|
||||
//// if (calSpeed > 2) {
|
||||
//// calSpeed = 2;
|
||||
////// Log.d("calSpeed uuid : " + cacheData.getUuid(), " 三次重新赋值 calSpeed : " + DF.format(calSpeed));
|
||||
//// }
|
||||
// }
|
||||
// cacheData = cacheData.toBuilder().setSpeed(calSpeed).build();
|
||||
// }
|
||||
//todo 等后序速度优化结果值可用,使用计算结果
|
||||
// double calDistance = (cacheData.getSpeed() * (Double.valueOf(cacheData.getSatelliteTime() * 1000).longValue() - recentlyTime)) / 1000.0;
|
||||
// double calDistance = Utils.calculateLineDistance(lon, lat, cacheData.getLongitude(), cacheData.getLatitude());
|
||||
// Log.d("calLoc uuid : " + cacheData.getUuid() + " calDistance : " + DF.format(calDistance), (calDistance * 2 < distance) ? "超出范围" : "正常值");
|
||||
//速度小于0.5m/s,并且距离在计算合理范围内超出2倍,则认为是相对静止状态(注意调整阈值),不更新缓存点信息
|
||||
// if (cacheData.getSpeed() < LIMIT_SPEED || relativeStatic() || calDistance * 2 < distance) {
|
||||
if (relativeStatic()) {
|
||||
// if (singlePointRoadInfo == null) {
|
||||
// double angle = roadAngle != 0 ? roadAngle : cacheData.getHeading();
|
||||
// long cost = System.nanoTime();
|
||||
// singlePointRoadInfo = MapDataApi.INSTANCE.getSinglePointMatchRoad(lon, lat, (float) angle, true, true);
|
||||
// Log.d("hy create cost", " " + (System.nanoTime() - cost) / 1000000);
|
||||
// }
|
||||
// if (singlePointRoadInfo != null && singlePointRoadInfo.getCoords() != null && !singlePointRoadInfo.getCoords().isEmpty()) {
|
||||
// if(matchedPoint == null || matchedPoint.length == 0){
|
||||
// long cost = System.nanoTime();
|
||||
// matchedPoint = PointInterpolatorUtil.mergeToRoad(cacheData.getLongitude(), cacheData.getLatitude(), singlePointRoadInfo.getCoords());
|
||||
// Log.d("hy matchedPoint cost", " " + (System.nanoTime() - cost) / 1000000);
|
||||
// Log.d("hy uuid : " + cacheData.getUuid(), "道路经纬度 lon : " + matchedPoint[0] + " lat : " + matchedPoint[1] + " distance : " + matchedPoint[2] + " , 原数据 lon : " + lon + " lat : " + lat);
|
||||
// }else{
|
||||
// if(matchedPoint[0] == 0 || matchedPoint[1] == 0){
|
||||
// cacheData = cacheData.toBuilder().setLongitude(lon).setLatitude(lat).build();
|
||||
// }else{
|
||||
// cacheData = cacheData.toBuilder().setLongitude(matchedPoint[0]).setLatitude(matchedPoint[1]).build();
|
||||
// }
|
||||
// }
|
||||
// lat = matchedPoint[1];
|
||||
// lon = matchedPoint[0];
|
||||
// } else {
|
||||
// Log.d("hy uuid : " + cacheData.getUuid(), "未匹配到道路数据,使用原数据 lon : " + lon + " lat : " + lat);
|
||||
// }
|
||||
cacheData = cacheData.toBuilder().setLongitude(lon).setLatitude(lat).build();
|
||||
double angle = roadAngle != 0 ? roadAngle : cacheData.getHeading();
|
||||
if (centerLineInfo == null && isFourWheelType()) {
|
||||
centerLineInfo = MapDataApi.INSTANCE.getCenterLineInfo(lon, lat, (float) angle);
|
||||
if (centerLineInfo != null && centerLineInfo.getPoints() != null && !centerLineInfo.getPoints().isEmpty()) {
|
||||
double[] matchedPoint = PointInterpolatorUtil.mergeToRoad(cacheData.getLongitude(), cacheData.getLatitude(), centerLineInfo.getPoints());
|
||||
if (matchedPoint[0] > 0 || matchedPoint[1] > 0) {
|
||||
lon = matchedPoint[0];
|
||||
lat = matchedPoint[1];
|
||||
s2LatLng = S2LatLng.fromDegrees(cacheData.getLatitude(), cacheData.getLongitude());
|
||||
s2CellId = S2CellId.fromLatLng(s2LatLng).parent(22);
|
||||
Log.d("hy uuid : " + cacheData.getUuid(), " 更新定位 lon : " + matchedPoint[0] + " , lat : " + matchedPoint[1]);
|
||||
} else {
|
||||
centerLineInfo = null;
|
||||
Log.d("hy uuid : " + cacheData.getUuid(), "计算结果出现问题 : " + matchedPoint[0] + " , " + matchedPoint[1]);
|
||||
}
|
||||
} else {
|
||||
centerLineInfo = null;
|
||||
Log.d("hy uuid : " + cacheData.getUuid(), "未获取到道路数据");
|
||||
}
|
||||
}
|
||||
Log.d("hy uuid : " + cacheData.getUuid(), " 静止使用定位数据 lon : " + lon + " , lat : " + lat);
|
||||
cacheData = cacheData.toBuilder().setLongitude(lon).setLatitude(lat).build();
|
||||
} else {
|
||||
centerLineInfo = null;
|
||||
//不在阈值内则更新,代表物体移动,使用卡尔曼滤波经纬度数据
|
||||
//double[] lonLat = kalmanFilter.filter(cacheData.getLongitude(), cacheData.getLatitude());
|
||||
lat = cacheData.getLatitude();
|
||||
lon = cacheData.getLongitude();
|
||||
s2LatLng = S2LatLng.fromDegrees(cacheData.getLatitude(), cacheData.getLongitude());
|
||||
s2CellId = S2CellId.fromLatLng(s2LatLng).parent(22);
|
||||
Log.d("hy uuid : " + cacheData.getUuid(), " 开始移动 lon : " + lon + " , lat : " + lat);
|
||||
// cacheData = cacheData.toBuilder().setLongitude(lonLat[0]).setLatitude(lonLat[1]).build();
|
||||
}
|
||||
}
|
||||
@@ -193,15 +177,11 @@ public class TrackObj {
|
||||
}
|
||||
//速度大于LIMIT_SPEED并出现大幅度转向使用缓存帧和delta数据
|
||||
if (cacheData.getSpeed() >= LIMIT_SPEED && newDelta > 10 && headingDelta != 0.0) {
|
||||
// Log.i("0609", "uuid : " + cacheData.getUuid() + " 修正航向角 last : " + lastObj.getHeading() + " , 增益 : " + headingDelta);
|
||||
// Log.i("hy uuid : " + cacheData.getUuid() , " 修正航向角 last : " + lastObj.getHeading() + " , 增益 : " + headingDelta);
|
||||
cacheData = cacheData.toBuilder().setHeading(lastObj.getHeading() + headingDelta).build();
|
||||
}
|
||||
}
|
||||
|
||||
private void calType() {
|
||||
|
||||
}
|
||||
|
||||
public long getRecentlyTime() {
|
||||
return recentlyTime;
|
||||
}
|
||||
@@ -218,6 +198,12 @@ public class TrackObj {
|
||||
return speedAverage < LIMIT_SPEED;
|
||||
}
|
||||
|
||||
public boolean isFourWheelType() {
|
||||
return typeWeight != TrafficTypeEnum.TYPE_TRAFFIC_ID_PEOPLE.getType()
|
||||
|| typeWeight != TrafficTypeEnum.TYPE_TRAFFIC_ID_BICYCLE.getType()
|
||||
|| typeWeight != TrafficTypeEnum.TYPE_TRAFFIC_ID_MOTO.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TrackObj{" +
|
||||
|
||||
@@ -9,17 +9,17 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class AppInfo implements Serializable {
|
||||
private IdInfo _id;
|
||||
private String bk_inst_id;
|
||||
private int bk_inst_id;
|
||||
private String bk_inst_name;
|
||||
private String bk_supplier_account;
|
||||
private int screen_type; //1,司机屏,2乘客屏
|
||||
private String screen_type; //1,司机屏,2乘客屏
|
||||
private String sn;
|
||||
private long last_time;
|
||||
private String last_time;
|
||||
private String app_url;
|
||||
private String bk_obj_id;
|
||||
private String version_code;
|
||||
private int version_code;
|
||||
private String version_name;
|
||||
private long create_time;
|
||||
private String create_time;
|
||||
|
||||
public IdInfo get_id() {
|
||||
return _id;
|
||||
@@ -29,11 +29,11 @@ public class AppInfo implements Serializable {
|
||||
this._id = _id;
|
||||
}
|
||||
|
||||
public String getBk_inst_id() {
|
||||
public int getBk_inst_id() {
|
||||
return bk_inst_id;
|
||||
}
|
||||
|
||||
public void setBk_inst_id(String bk_inst_id) {
|
||||
public void setBk_inst_id(int bk_inst_id) {
|
||||
this.bk_inst_id = bk_inst_id;
|
||||
}
|
||||
|
||||
@@ -53,11 +53,11 @@ public class AppInfo implements Serializable {
|
||||
this.bk_supplier_account = bk_supplier_account;
|
||||
}
|
||||
|
||||
public int getScreen_type() {
|
||||
public String getScreen_type() {
|
||||
return screen_type;
|
||||
}
|
||||
|
||||
public void setScreen_type(int screen_type) {
|
||||
public void setScreen_type(String screen_type) {
|
||||
this.screen_type = screen_type;
|
||||
}
|
||||
|
||||
@@ -69,14 +69,6 @@ public class AppInfo implements Serializable {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public long getLast_time() {
|
||||
return last_time;
|
||||
}
|
||||
|
||||
public void setLast_time(long last_time) {
|
||||
this.last_time = last_time;
|
||||
}
|
||||
|
||||
public String getApp_url() {
|
||||
return app_url;
|
||||
}
|
||||
@@ -93,11 +85,11 @@ public class AppInfo implements Serializable {
|
||||
this.bk_obj_id = bk_obj_id;
|
||||
}
|
||||
|
||||
public String getVersion_code() {
|
||||
public int getVersion_code() {
|
||||
return version_code;
|
||||
}
|
||||
|
||||
public void setVersion_code(String version_code) {
|
||||
public void setVersion_code(int version_code) {
|
||||
this.version_code = version_code;
|
||||
}
|
||||
|
||||
@@ -109,11 +101,19 @@ public class AppInfo implements Serializable {
|
||||
this.version_name = version_name;
|
||||
}
|
||||
|
||||
public long getCreate_time() {
|
||||
public String getLast_time() {
|
||||
return last_time;
|
||||
}
|
||||
|
||||
public void setLast_time(String last_time) {
|
||||
this.last_time = last_time;
|
||||
}
|
||||
|
||||
public String getCreate_time() {
|
||||
return create_time;
|
||||
}
|
||||
|
||||
public void setCreate_time(long create_time) {
|
||||
public void setCreate_time(String create_time) {
|
||||
this.create_time = create_time;
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class AppInfo implements Serializable {
|
||||
", last_time=" + last_time +
|
||||
", app_url='" + app_url + '\'' +
|
||||
", bk_obj_id='" + bk_obj_id + '\'' +
|
||||
", version_code='" + version_code + '\'' +
|
||||
", version_code=" + version_code +
|
||||
", version_name='" + version_name + '\'' +
|
||||
", create_time=" + create_time +
|
||||
'}';
|
||||
|
||||
@@ -9,8 +9,7 @@ import java.util.List;
|
||||
* @since 6/21/22
|
||||
*/
|
||||
public class IdInfo implements Serializable {
|
||||
private String timestamp;
|
||||
private long timestamp;
|
||||
private String date;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -2,19 +2,21 @@ package com.mogo.eagle.core.data.bindingcar;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description app升级管理
|
||||
* @since: 6/21/22
|
||||
*/
|
||||
public class UpgradeAppInfo extends BaseData {
|
||||
public AppInfo data;
|
||||
public ArrayList<AppInfo> data;
|
||||
|
||||
public AppInfo getData() {
|
||||
public ArrayList<AppInfo> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(AppInfo data) {
|
||||
public void setData(ArrayList<AppInfo> data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ HOOK_LOG_VERSION=1.6.1
|
||||
SERVICE_CHAIN_VERSION=1.1.0
|
||||
################ 外部依赖引用 ################
|
||||
# loglib
|
||||
LOGLIB_VERSION=1.3.1
|
||||
LOGLIB_VERSION=1.3.2
|
||||
######## MogoAiCloudSDK Version ########
|
||||
# 网络请求LOGLIB_VERSION
|
||||
MOGO_NETWORK_VERSION=1.4.3.6
|
||||
|
||||
@@ -1,463 +0,0 @@
|
||||
#### 说明
|
||||
# ADAS LIB
|
||||
## 与工控机交互LIB
|
||||
|
||||
# 使用方法参见【app_ipc_monitoring】中的代码
|
||||
|
||||
## 可用接口
|
||||
~~~java
|
||||
/**
|
||||
* 设置多设备监听
|
||||
*
|
||||
* @param l 监听
|
||||
*/
|
||||
AdasManager.getInstance().setOnMultiDeviceListener(OnMultiDeviceListener l);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 设置工控机数据监听
|
||||
*
|
||||
* @param l 监听
|
||||
*/
|
||||
AdasManager.getInstance().setOnAdasListener(OnAdasListener l);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 创建一个连接
|
||||
*
|
||||
* @param options 连接参数
|
||||
* @param onAdasConnectStatusListener 连接状态监听
|
||||
*/
|
||||
AdasManager.getInstance().create(AdasOptions options, OnAdasConnectStatusListener onAdasConnectStatusListener);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* ADAS LIB 版本
|
||||
*
|
||||
* @return 版本
|
||||
*/
|
||||
AdasManager.getInstance().getAdasVersion();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取协议版本
|
||||
*
|
||||
* @return 版本
|
||||
*/
|
||||
AdasManager.getInstance().getProtocolVersion();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取工控机配置信息
|
||||
*
|
||||
* @return 配置信息 未连接为null 断开连接会清空
|
||||
*/
|
||||
AdasManager.getInstance().getCarConfig();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 连接工控机
|
||||
*/
|
||||
AdasManager.getInstance().connect();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 与工控机断开连接
|
||||
*/
|
||||
AdasManager.getInstance().disconnect();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取当前工控机的链接状态
|
||||
*
|
||||
* @return {@link Constants.IPC_CONNECTION_STATUS}
|
||||
*/
|
||||
AdasManager.getInstance().getIpcConnectionStatus();
|
||||
~~~
|
||||
~~~java
|
||||
|
||||
/**
|
||||
* Log是否开启打印
|
||||
*/
|
||||
AdasManager.getInstance().setEnableLog(boolean isEnableLog);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 系统命令请求, 比如系统重启,启用新镜像
|
||||
*
|
||||
* @param type SystemCmdType。SYSTEMCMD_REBOOT 重启所有节点
|
||||
* SystemCmdType。SYSTEMCMD_EMPLOY_NEW_IMAGE 使用新镜像(推镜像)
|
||||
* SystemCmdType。SYSTEMCMD_SHUT_DOWN 关机
|
||||
* @return boolean
|
||||
*/
|
||||
AdasManager.getInstance().sendSystemCmdReq(@NonNull MessagePad.SystemCmdType type);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 解析工控机发送过来的数据
|
||||
* 多设备时使用
|
||||
*
|
||||
* @param bytes 数据
|
||||
*/
|
||||
AdasManager.getInstance().parseIPCData(byte[] bytes);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取工控机链接配置
|
||||
*
|
||||
* @return 工控机链接参数
|
||||
*/
|
||||
AdasManager.getInstance().getAdasOptions();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取已经链接成功的工控机IP 未连接为null
|
||||
*
|
||||
* @return ip null:表示未连接
|
||||
*/
|
||||
AdasManager.getInstance().getIpcConnectedIp();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取已经链接成功的工控机端口
|
||||
*
|
||||
* @return 端口 未连接为默认端口
|
||||
*/
|
||||
AdasManager.getInstance().getIpcConnectedPort();
|
||||
~~~
|
||||
~~~java
|
||||
|
||||
/**
|
||||
* 自动驾驶设备基础信息应答
|
||||
*
|
||||
* @param sn SN
|
||||
* @param environment 1: 研发环境, 2:测试环境, 3:生产环境 4:演示环境
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendBasicInfoResp(@NonNull String sn, int environment);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 设置自动驾驶模式 启动自动驾驶
|
||||
*
|
||||
* @param mode 1: enter autopilot mode, 0: quit autopilot mode
|
||||
* @param source 命令来源: 0: pad模拟(模拟时routeInfo传null), 1: AICloud业务
|
||||
* @param routeInfo 自动驾驶路径信息
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendAutoPilotModeReq(int mode, int source, MessagePad.RouteInfo routeInfo);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 设置演示模式
|
||||
*
|
||||
* @param enable 1: enable, 0: disable
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendDemoModeReq(int enable);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 车机基础信息请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendCarConfigReq();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 记录人工接管原因
|
||||
*
|
||||
* @param key bag key 唯一标识
|
||||
* @param filename 文件路径
|
||||
* @param reasonID 接管原因id
|
||||
* @param reason 接管原因
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendRecordCause(long key, @NonNull String filename, @NonNull String reasonID, @NonNull String reason);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().startRecordPackage(int id, int type);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().startRecordPackage(int id, int duration, int type);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 同下
|
||||
*
|
||||
* @param id
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
|
||||
AdasManager.getInstance().stopRecordPackage(int id, int type);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 数据采集请求 主动录制Bag包
|
||||
*
|
||||
* @param id 采集id
|
||||
* @param duration 采集时间长
|
||||
* @param type 采集类型, 1:badcase, 2: map; 3: rests
|
||||
* @param isRecord 采集指令, true: 采集, false: 停止采集
|
||||
* @param sustain 是否持续采集
|
||||
* @return
|
||||
*/
|
||||
|
||||
AdasManager.getInstance().sendRecordData(int id, int duration, int type, boolean isRecord);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 设置自动驾驶最大速度
|
||||
*
|
||||
* @param speedLimit 最大车辆速度 m/s
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendAutopilotSpeedReq(double speedLimit);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 发送红绿灯数据到工控机
|
||||
*
|
||||
* @param crossID roadID
|
||||
* @param latitude
|
||||
* @param longitude
|
||||
* @param heading 红绿灯方向
|
||||
* @param direction 路的航向角
|
||||
* @param lightId 红绿灯ID
|
||||
* @param laneNo 车道号
|
||||
* @param arrowNo 当前车道对应地面要素转向
|
||||
* @param flashYellow 黄灯总时间
|
||||
* @param laneDetail 灯态具体信息
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendTrafficLightData(@NonNull String crossID, double latitude, double longitude, @NonNull String heading, @NonNull String direction, int lightId, int laneNo, int arrowNo, int flashYellow, MessagePad.TrafficLightDetail laneDetail);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶路径请求
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
AdasManager.getInstance().sendGlobalPathReq();
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 获取工控机固定IP列表
|
||||
*
|
||||
* @return 返回默认工控机IP列表
|
||||
*/
|
||||
AdasManager.getInstance().getIPCFixationIPList(Context context);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 增加工控机固定IP
|
||||
*
|
||||
* @param ipcIP IP
|
||||
*/
|
||||
AdasManager.getInstance().addIPCFixationIP(Context context, String ipcIP);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 删除指定的工控机固定IP
|
||||
*
|
||||
* @param ipcIP IP
|
||||
*/
|
||||
AdasManager.getInstance().delIPCFixationIP(Context context, String ipcIP);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 删除所有工控机固定IP
|
||||
*/
|
||||
AdasManager.getInstance().delIPCFixationIP(Context context);
|
||||
~~~
|
||||
|
||||
|
||||
## OnAdasListener
|
||||
### 工控机数据回调
|
||||
#### 回调中对象的字段详情参见各个proto文件
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶局部轨迹 前车引导线
|
||||
*
|
||||
* @param header 头
|
||||
* @param trajectory 数据
|
||||
*/
|
||||
void onTrajectory(MessagePad.Header header, MessagePad.Trajectory trajectory);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 障碍物 他车数据
|
||||
*
|
||||
* @param header 头
|
||||
* @param trackedObjects 数据
|
||||
*/
|
||||
void onTrackedObjects(MessagePad.Header header, MessagePad.TrackedObjects trackedObjects);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 惯导信息
|
||||
*
|
||||
* @param header 头
|
||||
* @param gnssInfo 数据
|
||||
*/
|
||||
void onGnssInfo(MessagePad.Header header, MessagePad.GnssInfo gnssInfo);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 底盘信息, 透传底盘状态,pb参考底盘
|
||||
*
|
||||
* @param header 头
|
||||
* @param vehicleState 数据
|
||||
*/
|
||||
void onVehicleState(MessagePad.Header header, VehicleStateOuterClass.VehicleState vehicleState);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶状态
|
||||
*
|
||||
* @param header 头
|
||||
* @param autopilotState 数据
|
||||
*/
|
||||
void onAutopilotState(MessagePad.Header header, MessagePad.AutopilotState autopilotState);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 监控事件报告
|
||||
*
|
||||
* @param header 头
|
||||
* @param mogoReportMessage 数据
|
||||
*/
|
||||
void onReportMessage(MessagePad.Header header, MogoReportMsg.MogoReportMessage mogoReportMessage);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 感知红绿灯
|
||||
*
|
||||
* @param header 头
|
||||
* @param trafficLights 感知红绿灯
|
||||
*/
|
||||
void onPerceptionTrafficLight(MessagePad.Header header, TrafficLightOuterClass.TrafficLights trafficLights);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 他车轨迹预测
|
||||
*
|
||||
* @param header 头
|
||||
* @param predictionObjects 他车轨迹预测数据
|
||||
*/
|
||||
void onPredictionObstacleTrajectory(MessagePad.Header header, Prediction.mPredictionObjects predictionObjects);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶设备基础信息请求
|
||||
*
|
||||
* @param header 头
|
||||
* @param basicInfoReq 数据 目前没有任何参数
|
||||
*/
|
||||
void onBasicInfoReq(MessagePad.Header header, MessagePad.BasicInfoReq basicInfoReq);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 车机基础信息应答
|
||||
*
|
||||
* @param header 头
|
||||
* @param carConfigResp 数据
|
||||
*/
|
||||
void onCarConfigResp(MessagePad.Header header, MessagePad.CarConfigResp carConfigResp);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 数据采集结果
|
||||
*
|
||||
* @param header 头
|
||||
* @param recordPanel 数据
|
||||
*/
|
||||
void onRecordResult(MessagePad.Header header, RecordPanelOuterClass.RecordPanel recordPanel);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 自动驾驶路径应答
|
||||
*
|
||||
* @param header 头
|
||||
* @param globalPathResp 数据
|
||||
*/
|
||||
void onGlobalPathResp(MessagePad.Header header, MessagePad.GlobalPathResp globalPathResp);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 报警信息
|
||||
* 暂时保留,目前没有使用
|
||||
*
|
||||
* @param header 头
|
||||
* @param warn 数据
|
||||
*/
|
||||
@Deprecated
|
||||
void onWarn(MessagePad.Header header, MessagePad.Warn warn);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 到站提醒 自动驾驶站点
|
||||
*
|
||||
* @param header 头
|
||||
* @param arrivalNotification 数据
|
||||
*/
|
||||
void onArrivalNotification(MessagePad.Header header, MessagePad.ArrivalNotification arrivalNotification);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 向IPC发送命令返回结果
|
||||
*
|
||||
* @param info
|
||||
*/
|
||||
void onSSHResult(SSHResult info);
|
||||
~~~
|
||||
~~~java
|
||||
/**
|
||||
* 数据错误
|
||||
*
|
||||
* @param status 错误原因
|
||||
* @param bytes 原始数据
|
||||
*/
|
||||
void onError(ProtocolStatus status, byte[] bytes);
|
||||
~~~
|
||||
|
||||
## OnAdasConnectStatusListener
|
||||
### 连接状态监听
|
||||
~~~java
|
||||
/**
|
||||
* 与工控机链接状态变化
|
||||
*
|
||||
* @param ipcConnectionStatus {@link Constants.IPC_CONNECTION_STATUS}
|
||||
* @param reason 连接信息 需要判null
|
||||
* 如果ipcConnectionStatus==Constants.IPC_CONNECTION_STATUS.DISCONNECTED&&reason==null 表示主动断开连接
|
||||
*/
|
||||
void onConnectionIPCStatus(@Define.IPCConnectionStatus int ipcConnectionStatus, @Nullable String reason);
|
||||
~~~
|
||||
|
||||
## OnMultiDeviceListener
|
||||
### 多设备链接监听
|
||||
~~~java
|
||||
/**
|
||||
* 转发工控机消息
|
||||
* 如果是客户端此回调不会被调用
|
||||
*
|
||||
* @param bytes 数据
|
||||
*/
|
||||
void onForwardingIPCMessage(byte[] bytes);
|
||||
~~~
|
||||
@@ -1,41 +0,0 @@
|
||||
package com.zhidao.support.adas.high.permission.dialog;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.zhidao.support.adas.high.permission.R;
|
||||
|
||||
/**
|
||||
* 数据用量及电池优化 权限申请
|
||||
* 高版本Android系统会针对熄屏、休眠或后台 对电池WiFi等进行优化,长时间网络可能会断开连接
|
||||
*/
|
||||
public class PermissionLongBackgroundRunningDialog extends AppCompatActivity {
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
overridePendingTransition(R.anim.dialog_in, R.anim.dialog_out);
|
||||
setContentView(R.layout.dialog_adas_permission_long_background_running);
|
||||
// //设置弹出窗口与屏幕对齐
|
||||
// Window win = this.getWindow();
|
||||
// int density = (int) (getResources().getDisplayMetrics().density + 0.5f);
|
||||
////设置内边距,这里设置为10dp
|
||||
// win.getDecorView().setPadding(10 * density, 10 * density, 10 * density, 10 * density);
|
||||
// WindowManager.LayoutParams lp = win.getAttributes();
|
||||
////设置窗口宽度
|
||||
// lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
////设置窗口高度
|
||||
// lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
////设置Dialog位置
|
||||
// lp.gravity = Gravity.TOP;
|
||||
// win.setAttributes(lp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
super.finish();
|
||||
//在此时设置转场动画
|
||||
overridePendingTransition(R.anim.dialog_out, R.anim.dialog_in);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_adas_dialog"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="由于系统默认启动了电池优化功能,此功会影响熄屏或休眠后网络连接"
|
||||
android:textColor="#000000" />
|
||||
</LinearLayout>
|
||||
7
libraries/mogo-adas-other/README.md
Normal file
7
libraries/mogo-adas-other/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
#### 说明
|
||||
# ADAS LIB 其他功能
|
||||
## 与工控机交互LIB
|
||||
|
||||
# 申请后台运行权限《关闭电池优化》
|
||||
|
||||
# 路由器管理
|
||||
@@ -32,5 +32,6 @@ android {
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.material
|
||||
|
||||
}
|
||||
@@ -1,14 +1,19 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.support.adas.high.permission">
|
||||
package="com.zhidao.support.adas.high.other">
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
|
||||
|
||||
<application>
|
||||
<application
|
||||
|
||||
android:usesCleartextTraffic="true">
|
||||
|
||||
<activity
|
||||
android:name=".dialog.PermissionLongBackgroundRunningDialog"
|
||||
android:name=".permission.PermissionLongBackgroundRunningDialog"
|
||||
android:theme="@style/PermissionLongBackgroundRunningDialogStyle" />
|
||||
|
||||
<activity
|
||||
android:name=".router.RouterActivity"
|
||||
android:theme="@style/NoActionBar" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -1,22 +1,43 @@
|
||||
package com.zhidao.support.adas.high.permission;
|
||||
package com.zhidao.support.adas.high.other.permission;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.zhidao.support.adas.high.permission.dialog.PermissionLongBackgroundRunningDialog;
|
||||
import androidx.annotation.RequiresApi;
|
||||
|
||||
|
||||
/**
|
||||
* 长时间后台运行权限检查
|
||||
*/
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public class BackgrounderPermission {
|
||||
private static volatile BackgrounderPermission INSTANCE;
|
||||
private OnAdasPermissionListener listener;
|
||||
|
||||
private BackgrounderPermission() {
|
||||
}
|
||||
|
||||
public static BackgrounderPermission getInstance() {
|
||||
if (INSTANCE == null) {
|
||||
synchronized (BackgrounderPermission.class) {
|
||||
if (INSTANCE == null) {
|
||||
INSTANCE = new BackgrounderPermission();
|
||||
}
|
||||
}
|
||||
}
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
public void setListener(OnAdasPermissionListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void showPermissionLongBackgroundRunningDialog(Context context) {
|
||||
Intent intent = new Intent(context, PermissionLongBackgroundRunningDialog.class);
|
||||
@@ -24,6 +45,12 @@ public class BackgrounderPermission {
|
||||
|
||||
}
|
||||
|
||||
void onBackgrounderPermission(boolean isBackgrounderPermission) {
|
||||
if (listener != null) {
|
||||
listener.onBackgrounderPermission(isBackgrounderPermission);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前是否开启电池优化
|
||||
@@ -31,7 +58,7 @@ public class BackgrounderPermission {
|
||||
* @param context 上下文
|
||||
* @return 否在设备的电源白名单上 true 表示未优化
|
||||
*/
|
||||
public boolean isIgnoringBatteryOptimizations(Context context) {
|
||||
boolean isIgnoringBatteryOptimizations(Context context) {
|
||||
boolean isIgnoring = false;
|
||||
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
if (powerManager != null) {
|
||||
@@ -45,10 +72,11 @@ public class BackgrounderPermission {
|
||||
*
|
||||
* @param context
|
||||
*/
|
||||
public void requestIgnoreBatteryOptimizations(Context context) {
|
||||
|
||||
void requestIgnoreBatteryOptimizations(Activity context) {
|
||||
Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
|
||||
intent.setData(Uri.parse("package:" + context.getPackageName()));
|
||||
context.startActivity(intent);
|
||||
context.startActivityForResult(intent, PermissionLongBackgroundRunningDialog.REQUEST_CODE_BATTERY_OPTIMIZATIONS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -59,7 +87,7 @@ public class BackgrounderPermission {
|
||||
* @return
|
||||
*/
|
||||
|
||||
public boolean isIgnoringMeteredNetworkRestrictions(Context context) {
|
||||
private boolean isIgnoringMeteredNetworkRestrictions(Context context) {
|
||||
ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
// 检查设备是否在计费网络
|
||||
// if (connMgr.isActiveNetworkMetered()) {
|
||||
@@ -90,7 +118,7 @@ public class BackgrounderPermission {
|
||||
/**
|
||||
* 除非应用的核心功能受到不利影响,否则 Google Play 政策禁止应用请求直接豁免 Android 6.0+ 中的电源管理功能(低电耗模式和应用待机模式)
|
||||
*/
|
||||
public static void requestAddDataSaverWhite(Context context) {
|
||||
private static void requestAddDataSaverWhite(Context context) {
|
||||
// ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
// if (connMgr != null && connMgr.getRestrictBackgroundStatus() == ConnectivityManager.RESTRICT_BACKGROUND_STATUS_ENABLED) {
|
||||
Intent intent = new Intent(Settings.ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS);
|
||||
@@ -101,11 +129,15 @@ public class BackgrounderPermission {
|
||||
|
||||
/**
|
||||
* 是否允许长时间后台运行
|
||||
* 目前测试得出:电池优化会影响后台运行
|
||||
*
|
||||
* @param context 上下文
|
||||
* @return
|
||||
*/
|
||||
public boolean isPermissionLongBackgroundRunning(Context context) {
|
||||
return isIgnoringBatteryOptimizations(context) && isIgnoringMeteredNetworkRestrictions(context);
|
||||
// return isIgnoringBatteryOptimizations(context) && isIgnoringMeteredNetworkRestrictions(context);
|
||||
return isIgnoringBatteryOptimizations(context);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.zhidao.support.adas.high.other.permission;
|
||||
|
||||
public interface OnAdasPermissionListener {
|
||||
/**
|
||||
* 是否允许后台运行
|
||||
* 目前只检查了是否关闭电池优化
|
||||
* @param isAllow 是否允许后台运行
|
||||
*/
|
||||
void onBackgrounderPermission(boolean isAllow);
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.zhidao.support.adas.high.other.permission;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.annotation.RequiresApi;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
|
||||
import com.zhidao.support.adas.high.other.R;
|
||||
|
||||
|
||||
/**
|
||||
* 数据用量及电池优化 权限申请
|
||||
* 高版本Android系统会针对熄屏、休眠或后台 对电池WiFi等进行优化,长时间网络可能会断开连接
|
||||
*/
|
||||
@RequiresApi(api = Build.VERSION_CODES.N)
|
||||
public class PermissionLongBackgroundRunningDialog extends AppCompatActivity {
|
||||
public static final int REQUEST_CODE_BATTERY_OPTIMIZATIONS = 0x01;
|
||||
private TextView hint_battery;
|
||||
private Button btn_close_battery_optimizations;
|
||||
private BackgrounderPermission listener;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
overridePendingTransition(R.anim.dialog_in, R.anim.dialog_out);
|
||||
setContentView(R.layout.dialog_adas_permission_long_background_running);
|
||||
initView();
|
||||
setBatteryHint();
|
||||
// //设置弹出窗口与屏幕对齐
|
||||
// Window win = this.getWindow();
|
||||
// int density = (int) (getResources().getDisplayMetrics().density + 0.5f);
|
||||
////设置内边距,这里设置为10dp
|
||||
// win.getDecorView().setPadding(10 * density, 10 * density, 10 * density, 10 * density);
|
||||
// WindowManager.LayoutParams lp = win.getAttributes();
|
||||
////设置窗口宽度
|
||||
// lp.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
////设置窗口高度
|
||||
// lp.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
////设置Dialog位置
|
||||
// lp.gravity = Gravity.TOP;
|
||||
// win.setAttributes(lp);
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
hint_battery = findViewById(R.id.hint_battery);
|
||||
btn_close_battery_optimizations = findViewById(R.id.btn_close_battery_optimizations);
|
||||
btn_close_battery_optimizations.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
BackgrounderPermission.getInstance().requestIgnoreBatteryOptimizations(PermissionLongBackgroundRunningDialog.this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private boolean setBatteryHint() {
|
||||
boolean isIgnoringBatteryOptimizations = BackgrounderPermission.getInstance().isIgnoringBatteryOptimizations(this);
|
||||
btn_close_battery_optimizations.setVisibility(isIgnoringBatteryOptimizations ? View.INVISIBLE : View.VISIBLE);
|
||||
String str = "电池优化:" + (isIgnoringBatteryOptimizations ? "<font color='green'>不优化</font>" : "<font color='red'>优化</font>");
|
||||
hint_battery.setText(Html.fromHtml(str, Html.FROM_HTML_MODE_LEGACY));
|
||||
return isIgnoringBatteryOptimizations;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (resultCode == RESULT_OK) {
|
||||
if (requestCode == REQUEST_CODE_BATTERY_OPTIMIZATIONS) {
|
||||
BackgrounderPermission.getInstance().onBackgrounderPermission(setBatteryHint());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finish() {
|
||||
super.finish();
|
||||
//在此时设置转场动画
|
||||
overridePendingTransition(R.anim.dialog_out, R.anim.dialog_in);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,190 @@
|
||||
package com.zhidao.support.adas.high.other.router;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.JsResult;
|
||||
import android.webkit.WebChromeClient;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
import android.widget.ProgressBar;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.zhidao.support.adas.high.other.R;
|
||||
|
||||
|
||||
/**
|
||||
* A placeholder fragment containing a simple view.
|
||||
*/
|
||||
public class PlaceholderFragment extends Fragment {
|
||||
private static final String TAG = PlaceholderFragment.class.getSimpleName();
|
||||
private static final String ROUTER_URL = "router_url";
|
||||
private static final String ROUTER_COOKIE = "router_cookie";
|
||||
private String url;
|
||||
private ProgressBar progressBar;
|
||||
private WebView webView;
|
||||
private CookieManager cookieManager;
|
||||
|
||||
private SharedPreferences sharedPreferences;
|
||||
|
||||
public static PlaceholderFragment newInstance(String url) {
|
||||
PlaceholderFragment fragment = new PlaceholderFragment();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString(ROUTER_URL, url);
|
||||
fragment.setArguments(bundle);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
url = getArguments().getString(ROUTER_URL);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.fragment_router, container, false);
|
||||
webView = view.findViewById(R.id.web_view);
|
||||
progressBar = view.findViewById(R.id.progressbar);//进度条
|
||||
if (getActivity() != null)
|
||||
sharedPreferences = getActivity().getSharedPreferences("adas_config", Context.MODE_PRIVATE);
|
||||
cookieManager = CookieManager.getInstance();
|
||||
cookieManager.setAcceptCookie(true);
|
||||
initWebView();
|
||||
return view;
|
||||
}
|
||||
|
||||
public void onRefresh() {
|
||||
webView.reload();
|
||||
}
|
||||
|
||||
private void initWebView() {
|
||||
String cokkie = null;
|
||||
if (sharedPreferences != null)
|
||||
cokkie = sharedPreferences.getString(ROUTER_COOKIE, null);
|
||||
if (cokkie != null && cokkie.length() > 0 && cokkie.contains(url)) {
|
||||
int index = cokkie.indexOf("##");
|
||||
cookieManager.setCookie(this.url, cokkie.substring(index));
|
||||
}
|
||||
webView.loadUrl(url);//加载url
|
||||
webView.addJavascriptInterface(this, "android");//添加js监听 这样html就能调用客户端
|
||||
webView.setWebChromeClient(webChromeClient);
|
||||
webView.setWebViewClient(webViewClient);
|
||||
WebSettings webSettings = webView.getSettings();
|
||||
webSettings.setJavaScriptEnabled(true);//允许使用js
|
||||
|
||||
/**
|
||||
* LOAD_CACHE_ONLY: 不使用网络,只读取本地缓存数据
|
||||
* LOAD_DEFAULT: (默认)根据cache-control决定是否从网络上取数据。
|
||||
* LOAD_NO_CACHE: 不使用缓存,只从网络获取数据.
|
||||
* LOAD_CACHE_ELSE_NETWORK,只要本地有,无论是否过期,或者no-cache,都使用缓存中的数据。
|
||||
*/
|
||||
webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);//不使用缓存,只从网络获取数据.
|
||||
//支持屏幕缩放
|
||||
webSettings.setSupportZoom(true);
|
||||
webSettings.setBuiltInZoomControls(true);
|
||||
//不显示webview缩放按钮
|
||||
webSettings.setDisplayZoomControls(false);
|
||||
// webSettings.setUseWideViewPort(true);//自适应屏幕
|
||||
webSettings.setLoadWithOverviewMode(true);
|
||||
webSettings.setAllowFileAccess(true);
|
||||
webSettings.setAppCacheEnabled(true);
|
||||
webSettings.setDomStorageEnabled(true);
|
||||
webSettings.setDatabaseEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
//WebViewClient主要帮助WebView处理各种通知、请求事件
|
||||
private final WebViewClient webViewClient = new WebViewClient() {
|
||||
@Override
|
||||
public void onPageFinished(WebView view, String url) {//页面加载完成
|
||||
progressBar.setVisibility(View.GONE);
|
||||
String oldCookie = cookieManager.getCookie(url);
|
||||
if (!TextUtils.isEmpty(oldCookie)) {
|
||||
String cokkie = null;
|
||||
if (sharedPreferences != null)
|
||||
cokkie = sharedPreferences.getString(ROUTER_COOKIE, null);
|
||||
if (!TextUtils.equals(cokkie, oldCookie)) {
|
||||
sharedPreferences.edit().putString(url + "##" + ROUTER_COOKIE, oldCookie).apply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageStarted(WebView view, String url, Bitmap favicon) {//页面开始加载
|
||||
progressBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
//返回true 拦截
|
||||
return super.shouldOverrideUrlLoading(view, url);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
//WebChromeClient主要辅助WebView处理Javascript的对话框、网站图标、网站title、加载进度等
|
||||
private final WebChromeClient webChromeClient = new WebChromeClient() {
|
||||
//不支持js的alert弹窗,需要自己监听然后通过dialog弹窗
|
||||
@Override
|
||||
public boolean onJsAlert(WebView webView, String url, String message, JsResult result) {
|
||||
AlertDialog.Builder localBuilder = new AlertDialog.Builder(webView.getContext());
|
||||
localBuilder.setMessage(message).setPositiveButton("确定", null);
|
||||
localBuilder.setCancelable(false);
|
||||
localBuilder.create().show();
|
||||
|
||||
//注意:
|
||||
//必须要这一句代码:result.confirm()表示:
|
||||
//处理结果为确定状态同时唤醒WebCore线程
|
||||
//否则不能继续点击按钮
|
||||
result.confirm();
|
||||
return true;
|
||||
}
|
||||
|
||||
//获取网页标题
|
||||
@Override
|
||||
public void onReceivedTitle(WebView view, String title) {
|
||||
super.onReceivedTitle(view, title);
|
||||
Log.i(TAG, "网页标题:" + title);
|
||||
}
|
||||
|
||||
//加载进度回调
|
||||
@Override
|
||||
public void onProgressChanged(WebView view, int newProgress) {
|
||||
progressBar.setProgress(newProgress);
|
||||
}
|
||||
};
|
||||
|
||||
public boolean onKeyDownChild(int keyCode) {
|
||||
Log.i(TAG, "是否有上一个页面:" + webView.canGoBack());
|
||||
if (webView.canGoBack() && keyCode == KeyEvent.KEYCODE_BACK) {//点击返回按钮的时候判断有没有上一页
|
||||
webView.goBack(); // goBack()表示返回webView的上一页面
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
//释放资源
|
||||
webView.destroy();
|
||||
webView = null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.zhidao.support.adas.high.other.router;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.viewpager2.widget.ViewPager2;
|
||||
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.zhidao.support.adas.high.other.R;
|
||||
|
||||
|
||||
public class RouterActivity extends AppCompatActivity {
|
||||
private static final String[] TAB_TITLES = new String[]{"Bus", "Taxi"};
|
||||
private boolean isBus;
|
||||
private int currentPosition = 0;//默认选中bus
|
||||
|
||||
public static void newInstance(Context context, boolean isBus) {
|
||||
Intent intent = new Intent(context, RouterActivity.class);
|
||||
intent.putExtra("is_bus", isBus);
|
||||
context.startActivity(intent);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_router);
|
||||
SectionsPagerAdapter sectionsPagerAdapter = new SectionsPagerAdapter(this, TAB_TITLES);
|
||||
ViewPager2 viewPager = findViewById(R.id.view_pager);
|
||||
|
||||
viewPager.setAdapter(sectionsPagerAdapter);
|
||||
TabLayout tabs = findViewById(R.id.tabs);
|
||||
viewPager.setOffscreenPageLimit(1);
|
||||
TabLayoutMediator mediator = new TabLayoutMediator(tabs, viewPager, new TabLayoutMediator.TabConfigurationStrategy() {
|
||||
@Override
|
||||
public void onConfigureTab(@NonNull TabLayout.Tab tab, int position) {
|
||||
tab.setText(TAB_TITLES[position]);
|
||||
}
|
||||
});
|
||||
mediator.attach();
|
||||
viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
super.onPageScrolled(position, positionOffset, positionOffsetPixels);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
super.onPageSelected(position);
|
||||
currentPosition = position;
|
||||
Log.i("dddd", "当前 Pos=" + currentPosition);
|
||||
}
|
||||
});
|
||||
findViewById(R.id.close).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (!isClose(KeyEvent.KEYCODE_BACK))
|
||||
finish();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.refresh).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
PlaceholderFragment fragment = (PlaceholderFragment) getViewPagerFragment(currentPosition);
|
||||
if (fragment != null) {
|
||||
fragment.onRefresh();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Intent intent = getIntent();
|
||||
if (intent != null) {
|
||||
isBus = intent.getBooleanExtra("is_bus", true);
|
||||
}
|
||||
currentPosition = isBus ? 0 : 1;
|
||||
viewPager.setCurrentItem(currentPosition, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param position fragment 的位置
|
||||
* @return
|
||||
*/
|
||||
private Fragment getViewPagerFragment(int position) {
|
||||
return getSupportFragmentManager().findFragmentByTag("f" + position);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
return isClose(keyCode) || super.onKeyDown(keyCode, event);
|
||||
}
|
||||
|
||||
private boolean isClose(int keyCode) {
|
||||
PlaceholderFragment fragment = (PlaceholderFragment) getViewPagerFragment(currentPosition);
|
||||
if (fragment != null) {
|
||||
return fragment.onKeyDownChild(keyCode);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.zhidao.support.adas.high.other.router;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class SectionsPagerAdapter extends FragmentStateAdapter {
|
||||
|
||||
private final String[] TAB_TITLES;
|
||||
public final Map<String, PlaceholderFragment> fragments = new HashMap<>();
|
||||
private final FragmentActivity fragmentActivity;
|
||||
|
||||
public SectionsPagerAdapter(@NonNull FragmentActivity fragmentActivity, String[] TAB_TITLES) {
|
||||
super(fragmentActivity);
|
||||
this.fragmentActivity = fragmentActivity;
|
||||
this.TAB_TITLES = TAB_TITLES;
|
||||
}
|
||||
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment createFragment(int position) {
|
||||
String url = "192.168.1.1";
|
||||
if ("Bus".equals(TAB_TITLES[position])) {
|
||||
url = "192.168.8.1";
|
||||
}
|
||||
return PlaceholderFragment.newInstance(url);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return TAB_TITLES.length;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".router.RouterActivity">
|
||||
|
||||
<com.google.android.material.tabs.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent">
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/close"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="返回" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/refresh"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="刷新" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="10dp"
|
||||
android:text="输入路由器用户名/密码->点击“登录”->点击“连接用户”查看当前列表中是否存在IP是“192.168.X.102”的设备"
|
||||
android:textColor="#000000"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/view_pager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
app:layout_constraintBottom_toTopOf="@id/view"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tabs" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/bg_adas_dialog"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/hint_battery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="电池优化:优化"
|
||||
android:textColor="#000000" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_close_battery_optimizations"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:text="关闭" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="3dp"
|
||||
android:text="开启池优化功能,会影响熄屏或休眠后网络连接"
|
||||
android:textColor="#696969" />
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/constraintLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".router.PlaceholderFragment">
|
||||
|
||||
<WebView
|
||||
android:id="@+id/web_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
|
||||
tools:layout_constraintLeft_creator="1"
|
||||
tools:layout_constraintTop_creator="1" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progressbar"
|
||||
style="@android:style/Widget.ProgressBar.Horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="3dip"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/constraintLayout"
|
||||
tools:layout_constraintLeft_creator="1"
|
||||
tools:layout_constraintTop_creator="1" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -18,4 +18,8 @@
|
||||
<item name="android:backgroundDimEnabled">true</item>
|
||||
</style>
|
||||
|
||||
<style name="NoActionBar" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.zhidao.support.adas.high.common;
|
||||
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* 重连管理器
|
||||
*/
|
||||
public class ReconnectManager {
|
||||
private static final String TAG = ReconnectManager.class.getSimpleName();
|
||||
private static final long RECONNECT_INTERVAL = 4 * 1000L;//重连间隔
|
||||
private final AtomicBoolean isReconnection = new AtomicBoolean(false);//是否正在重连
|
||||
private final OnReconnectListener listener;
|
||||
private volatile Timer timer;
|
||||
|
||||
public interface OnReconnectListener {
|
||||
void onReconnection();
|
||||
}
|
||||
|
||||
|
||||
public ReconnectManager(OnReconnectListener listener) {
|
||||
this.listener = listener;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 是否正在重连
|
||||
*/
|
||||
public boolean isReconnection() {
|
||||
return isReconnection.get();
|
||||
}
|
||||
|
||||
|
||||
public synchronized void start() {
|
||||
if (!isReconnection.get()) {
|
||||
CupidLogUtils.i(TAG, "开始重连");
|
||||
isReconnection.set(true);
|
||||
if (timer == null) {
|
||||
timer = new Timer();
|
||||
timer.schedule(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isReconnection.get()) {
|
||||
if (listener != null)
|
||||
listener.onReconnection();
|
||||
}
|
||||
}
|
||||
}, 0, RECONNECT_INTERVAL);//延时
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void stop() {
|
||||
CupidLogUtils.i(TAG, "停止重连");
|
||||
isReconnection.set(false);
|
||||
if (timer != null) {
|
||||
timer.cancel();
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -14,8 +14,10 @@ import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.zhidao.support.adas.high.AdasChannel;
|
||||
import com.zhidao.support.adas.high.common.ByteUtil;
|
||||
import com.zhidao.support.adas.high.common.CupidLogUtils;
|
||||
import com.zhidao.support.adas.high.common.ReceiveTimeoutManager;
|
||||
import com.zhidao.support.adas.high.common.ReconnectManager;
|
||||
import com.zhidao.support.adas.high.queue.WSByteQueueManager;
|
||||
import com.zhidao.support.adas.high.queue.WebSocketQueueManager;
|
||||
import com.zhjt.service.chain.ChainLog;
|
||||
@@ -52,7 +54,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
|
||||
private EchoWebSocketListener listener;
|
||||
private IWebSocketConnectListener mWebSocketConnectListener;
|
||||
|
||||
private ReconnectManager reconnectManager;
|
||||
|
||||
private String wsHost;
|
||||
private String ipAddress;
|
||||
@@ -66,10 +68,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
* 是否是被动关闭
|
||||
*/
|
||||
private final AtomicBoolean isPassiveClose = new AtomicBoolean(false);
|
||||
/**
|
||||
* 是否启用自动重连
|
||||
*/
|
||||
private boolean isReconnect = true;
|
||||
|
||||
/**
|
||||
* 接收数据超时原因 null时表示不是接收数据超时的原因
|
||||
*/
|
||||
@@ -92,6 +91,12 @@ public class FpgaSocket implements IWebSocket {
|
||||
onPassiveClose(1001, receiveTimeoutReason);
|
||||
}
|
||||
});
|
||||
reconnectManager = new ReconnectManager(new ReconnectManager.OnReconnectListener() {
|
||||
@Override
|
||||
public void onReconnection() {
|
||||
connect("重连中");
|
||||
}
|
||||
});
|
||||
client = okBuilder.build();
|
||||
}
|
||||
|
||||
@@ -113,25 +118,18 @@ public class FpgaSocket implements IWebSocket {
|
||||
Request request = new Request.Builder()
|
||||
.url(wsHost)
|
||||
.build();
|
||||
mWebSocket = client.newWebSocket(request, listener);
|
||||
client.newWebSocket(request, listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重连
|
||||
*/
|
||||
public void reconnect() {
|
||||
if (isReconnect) {
|
||||
if (!isUserClose.get()) {
|
||||
try {
|
||||
Thread.sleep(2000L);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
connect("重连中");
|
||||
} else {
|
||||
isUserClose.set(false);
|
||||
}
|
||||
private void reconnect() {
|
||||
if (!isUserClose.get()) {
|
||||
reconnectManager.start();
|
||||
} else {
|
||||
isUserClose.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -143,6 +141,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
}
|
||||
isUserClose.set(true);
|
||||
isPassiveClose.set(false);
|
||||
reconnectManager.stop();
|
||||
if (mWebSocket != null) {
|
||||
close(true, 1000);
|
||||
} else {
|
||||
@@ -164,17 +163,12 @@ public class FpgaSocket implements IWebSocket {
|
||||
public boolean sendDataWebSocket(ByteString data) {
|
||||
if (mWebSocket != null) {
|
||||
boolean result = mWebSocket.send(data);
|
||||
CupidLogUtils.i(TAG, "WebSocket send ByteString= " + data + ", result= " + result);
|
||||
CupidLogUtils.i(TAG, "WebSocket send ByteString=" + ByteUtil.byteArrToHex(data.toByteArray()) + ", result= " + result);
|
||||
return result;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsReconnect(boolean isReconnect) {
|
||||
this.isReconnect = isReconnect;
|
||||
}
|
||||
|
||||
|
||||
public interface IWebSocketConnectListener {
|
||||
/**
|
||||
@@ -209,8 +203,9 @@ public class FpgaSocket implements IWebSocket {
|
||||
mWebSocket = webSocket;
|
||||
boolean isConnect = response.code() == 101;
|
||||
if (!isConnect) {
|
||||
reconnect();
|
||||
onPassiveClose(1001, "協議不匹配");
|
||||
} else {
|
||||
reconnectManager.stop();
|
||||
ReceiveTimeoutManager.getInstance().start();
|
||||
CupidLogUtils.i(TAG, "WebSocket 连接成功");
|
||||
if (mWebSocketConnectListener != null)
|
||||
@@ -330,7 +325,7 @@ public class FpgaSocket implements IWebSocket {
|
||||
}
|
||||
|
||||
/**
|
||||
* 被动关闭 包含:服务断开 心跳超时 异常断开 等
|
||||
* 被动关闭 包含:服务断开 心跳超时 等
|
||||
*
|
||||
* @param reason
|
||||
*/
|
||||
|
||||
@@ -34,13 +34,6 @@ public interface IWebSocket {
|
||||
|
||||
boolean sendDataWebSocket(ByteString data);
|
||||
|
||||
/**
|
||||
* 是否启用自动重连
|
||||
*
|
||||
* @param isReconnect
|
||||
*/
|
||||
void setIsReconnect(boolean isReconnect);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,6 @@ public class HostConst {
|
||||
public static final String BINDING_SN_HOST = "https://mygateway.zhidaozhixing.com/cmdbapi/"; //中台提供的接口服务
|
||||
public static final String BINDING_SN_HOST_TEST = "https://mygateway.zhidaozhixing.com/cmdbapitest/"; //中台提供的接口服务测试
|
||||
|
||||
public static final String UPGRADE_APP_HOST = "http://10.0.200.12:32423/unify/selectResources/";
|
||||
public static final String UPGRADE_APP_HOST = "http://10.0.200.12:32423?/";
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ include ':libraries:mogo-map-api'
|
||||
include ':libraries:mogo-map'
|
||||
include ':libraries:mogo-adas'
|
||||
include ':libraries:mogo-adas-data'
|
||||
include ':libraries:mogo-adas-backgrounder-permission'
|
||||
include ':libraries:mogo-adas-other'
|
||||
|
||||
// OLD业务模块
|
||||
include ':modules:mogo-module-common'
|
||||
|
||||
@@ -11,7 +11,6 @@ import com.apm.insight.log.VLog;
|
||||
import com.bytedance.apm.insight.ApmInsight;
|
||||
import com.bytedance.apm.insight.ApmInsightAgent;
|
||||
import com.bytedance.apm.insight.ApmInsightInitConfig;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.constants.SharedPrefsConstants;
|
||||
import com.mogo.eagle.core.data.bindingcar.CarInfo;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
@@ -54,7 +53,10 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
//车辆信息
|
||||
String carInfoString = SharedPrefsMgr.getInstance(context).getString(SharedPrefsConstants.CAR_INFO);
|
||||
CarInfo info = GsonUtils.fromJson(carInfoString, CarInfo.class);
|
||||
CarInfo info = null;
|
||||
if (carInfoString != null && !carInfoString.isEmpty()) {
|
||||
info = GsonUtils.fromJson(carInfoString, CarInfo.class);
|
||||
}
|
||||
|
||||
//地图版本
|
||||
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
|
||||
@@ -71,16 +73,21 @@ public class ApmCrashReportProvider implements ITestCrashReportProvider {
|
||||
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
|
||||
crash.config().setChannel("MAP_SDK_VERSION:"+mapSDKVersion);
|
||||
//可选,可以设置自定义did,不设置会使用内部默认的
|
||||
crash.config().setDeviceId(MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
String sn = SharedPrefsMgr.getInstance(context).getString("sn");
|
||||
if (sn != null && !sn.isEmpty()) {
|
||||
crash.config().setDeviceId(sn);
|
||||
} else {
|
||||
crash.config().setDeviceId(DeviceIdUtils.getDeviceId(context));
|
||||
}
|
||||
crash.addTags(MAP_SDK_VERSION, mapSDKVersion);
|
||||
// crash.setReportUrl("www.xxx.com"); // 私有化部署:私有化部署才配置上报地址
|
||||
// crash.addTags("key", "value"); // 自定义筛选tag, 按需添加、可多次覆盖
|
||||
|
||||
HashMap<String, String> dimension = new HashMap<>();
|
||||
//维度值
|
||||
dimension.put("Devices_SN_DeviceId", MoGoAiCloudClientConfig.getInstance().getSn() + "__" + DeviceIdUtils.getDeviceId(context));
|
||||
dimension.put("Devices_SN_WidevineID_MD5", MoGoAiCloudClientConfig.getInstance().getSn() + "__" + DeviceIdUtils.getWidevineIDWithMd5(context));
|
||||
dimension.put("Devices_SN_WidevineID", MoGoAiCloudClientConfig.getInstance().getSn() + "__" + DeviceIdUtils.getWidevineID(context));
|
||||
dimension.put("Devices_SN_DeviceId", sn + "__" + DeviceIdUtils.getDeviceId(context));
|
||||
dimension.put("Devices_SN_WidevineID_MD5", sn + "__" + DeviceIdUtils.getWidevineIDWithMd5(context));
|
||||
dimension.put("Devices_SN_WidevineID", sn + "__" + DeviceIdUtils.getWidevineID(context));
|
||||
dimension.put(MAP_SDK_VERSION, mapSDKVersion);
|
||||
HashMap<String, Double> metric = new HashMap<>();
|
||||
//指标值
|
||||
|
||||
@@ -5,8 +5,8 @@ import android.text.TextUtils;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.AppUtils;
|
||||
import com.mogo.test.crashreport.CrashReportConstants;
|
||||
import com.tencent.bugly.Bugly;
|
||||
@@ -38,7 +38,10 @@ public class UpgradeReportProvider implements IProvider {
|
||||
String productFlavor = DebugConfig.getProductFlavor();
|
||||
strategy.setAppChannel(productFlavor);
|
||||
Bugly.init(context, CrashReportConstants.buglyAppID, true, strategy);
|
||||
Bugly.putUserData(context, "serial", MoGoAiCloudClientConfig.getInstance().getSn());
|
||||
String sn = SharedPrefsMgr.getInstance(context).getString("sn");
|
||||
if (sn != null && !sn.isEmpty()) {
|
||||
Bugly.putUserData(context, "serial", sn);
|
||||
}
|
||||
String mapSDKVersion = AppUtils.getCustomMapSDKVersion(context);
|
||||
Bugly.putUserData(context, "MAP_SDK_VERSION", mapSDKVersion);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user