Merge branch 'dev_hengyang_base' into feature/feature_mogo_obu

# Conflicts:
#	.idea/misc.xml
#	modules/mogo-module-service/src/main/java/com/mogo/module/service/status/EnvStatusManager.java
#	modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XObuManager.java
This commit is contained in:
董宏宇
2021-08-20 16:19:23 +08:00
5 changed files with 72 additions and 83 deletions

View File

@@ -186,43 +186,40 @@ public class MogoApplication extends AbsMogoApplication {
// Log.d("TEST-SOCKET","socketTestData cityCode: " + socketTestData.getCityCode());
// return new HttpDnsSimpleLocation(socketTestData.getCityCode(),socketTestData.getLat(),socketTestData.getLon()); //todo 对象唯一实例优化
// });
clientConfig.setIHttpDnsCurrentLocation(new IHttpDnsCurrentLocation() {
@Override
public HttpDnsSimpleLocation getCurrentLocation() {
MogoLocation mogoLocation =
MogoApisHandler.getInstance()
.getApis().getMapServiceApi()
.getSingletonLocationClient(getApp())
.getLastKnowLocation();
HttpDnsSimpleLocation httpDnsSimpleLocation;
if (mogoLocation != null
&& mogoLocation.getLatitude() != 0
&& mogoLocation.getLongitude() != 0) {
clientConfig.setIHttpDnsCurrentLocation(() -> {
MogoLocation mogoLocation =
MogoApisHandler.getInstance()
.getApis().getMapServiceApi()
.getSingletonLocationClient(getApp())
.getLastKnowLocation();
HttpDnsSimpleLocation httpDnsSimpleLocation;
if (mogoLocation != null
&& mogoLocation.getLatitude() != 0
&& mogoLocation.getLongitude() != 0) {
httpDnsSimpleLocation = new HttpDnsSimpleLocation(
mogoLocation.getCityCode(),
mogoLocation.getLatitude(),
mogoLocation.getLongitude());
Logger.i(TAG, "使用实时GPS信息" + httpDnsSimpleLocation);
} else {
String ciyCode = SharedPrefsMgr.getInstance(getApp())
.getString(SharedPrefsConstants.LOCATION_CITY_CODE);
String latitude = SharedPrefsMgr.getInstance(getApp())
.getString(SharedPrefsConstants.LOCATION_LATITUDE);
String longitude = SharedPrefsMgr.getInstance(getApp())
.getString(SharedPrefsConstants.LOCATION_LONGITUDE);
try {
httpDnsSimpleLocation = new HttpDnsSimpleLocation(
mogoLocation.getCityCode(),
mogoLocation.getLatitude(),
mogoLocation.getLongitude());
Logger.i(TAG, "使用实时GPS信息" + httpDnsSimpleLocation);
} else {
String ciyCode = SharedPrefsMgr.getInstance(getApp())
.getString(SharedPrefsConstants.LOCATION_CITY_CODE);
String latitude = SharedPrefsMgr.getInstance(getApp())
.getString(SharedPrefsConstants.LOCATION_LATITUDE);
String longitude = SharedPrefsMgr.getInstance(getApp())
.getString(SharedPrefsConstants.LOCATION_LONGITUDE);
try {
httpDnsSimpleLocation = new HttpDnsSimpleLocation(
ciyCode,
Double.parseDouble(latitude),
Double.parseDouble(longitude));
} catch (NumberFormatException e) {
e.printStackTrace();
httpDnsSimpleLocation = new HttpDnsSimpleLocation("010", 1, 1);
}
Logger.i(TAG, "使用缓存GPS信息" + httpDnsSimpleLocation);
ciyCode,
Double.parseDouble(latitude),
Double.parseDouble(longitude));
} catch (NumberFormatException e) {
e.printStackTrace();
httpDnsSimpleLocation = new HttpDnsSimpleLocation("010", 1, 1);
}
return httpDnsSimpleLocation;
Logger.i(TAG, "使用缓存GPS信息" + httpDnsSimpleLocation);
}
return httpDnsSimpleLocation;
});
// 初始化SDK可以设置状态回调来监听
@@ -257,7 +254,7 @@ public class MogoApplication extends AbsMogoApplication {
}
}
private void prepareSocketAndLocationServices() {
private void startSocketService() {
IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
// 关闭长链服务
apis.getSocketManagerApi(getApplicationContext()).destroy();
@@ -268,7 +265,7 @@ public class MogoApplication extends AbsMogoApplication {
@Override
protected void socketTTL() {
// 鉴权成功后开启socket长链服务
prepareSocketAndLocationServices();
startSocketService();
}
private void initModules() {