Merge branch 'qa_adas_och' into dev_hengyang_base
This commit is contained in:
@@ -38,7 +38,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 15:24
|
||||
*/
|
||||
public class AdasConstant {
|
||||
public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
|
||||
public static final String HOST_DEMO = "http://dzt-show.zhidaohulian.com";
|
||||
public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
|
||||
}
|
||||
@@ -1,7 +1,14 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotArriveModel;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
@@ -18,6 +25,18 @@ import com.zhidao.support.adas.high.bean.WarnMessageInfo;
|
||||
import com.zhidao.support.adas.high.common.MsgActionType;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import io.reactivex.Flowable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.RequestBody;
|
||||
|
||||
import static com.mogo.commons.context.ContextHolderUtil.getContext;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/4/25 14:43
|
||||
@@ -25,14 +44,22 @@ import java.util.ArrayList;
|
||||
public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusListener {
|
||||
|
||||
private final String TAG = "AdasEventManager";
|
||||
|
||||
private final Gson gson;
|
||||
|
||||
private final ArrayList<AdasDataListener> iAdasEventListeners = new ArrayList<>();
|
||||
private final ArrayList<AdasStatusListener> iAdasStatusListeners = new ArrayList<>();
|
||||
private IAdasApiService mAdasApiService;
|
||||
private Disposable uploadAutopilotStatus;
|
||||
//自动驾驶状态
|
||||
private int mCurrentAutopilotStatus = -1;
|
||||
//自动驾驶车速度
|
||||
private float mCurrentAutopilotSpeed = 0;
|
||||
private Disposable mdDisposable;
|
||||
//自动驾驶状态
|
||||
private AutopilotStatus.ValuesBean mAutopilotStatus = null;
|
||||
|
||||
public AdasEventManager() {
|
||||
gson = GsonUtil.getGson();
|
||||
mAdasApiService = MogoApisHandler.getInstance().getApis().getNetworkApi().create( IAdasApiService.class, AdasConstant.HOST_PRODUCT );
|
||||
}
|
||||
|
||||
public void addEventListener(AdasDataListener listener) {
|
||||
@@ -65,6 +92,11 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
}
|
||||
}
|
||||
|
||||
public void removeStatusListener() {
|
||||
Logger.d(TAG,"注销adas状态事件监听");
|
||||
iAdasStatusListeners.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWarnMessage(WarnMessageInfo warnMessageInfo) {
|
||||
Logger.d(TAG,"onWarnMessage " + warnMessageInfo);
|
||||
@@ -145,7 +177,6 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
AutopilotStatus.ValuesBean autopilotStatusValues = autopilotStatus.getValues();
|
||||
AutopilotStatus.ValuesBean mAutopilotStatus;
|
||||
|
||||
|
||||
if (autopilotStatusValues != null) {
|
||||
AdasAIDLAutopilotStateModel adasAIDLAutopilotStateModel=new AdasAIDLAutopilotStateModel();
|
||||
adasAIDLAutopilotStateModel.setReason(autopilotStatusValues.getReason());
|
||||
@@ -154,14 +185,15 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
float speed = autopilotStatusValues.getSpeed();
|
||||
adasAIDLAutopilotStateModel.setState(state);
|
||||
adasAIDLAutopilotStateModel.setSpeed(speed);
|
||||
|
||||
mCurrentAutopilotStatus = state;
|
||||
mCurrentAutopilotSpeed = speed;
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.notifyAutopilotState(adasAIDLAutopilotStateModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,8 +206,12 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
if (endLatLon != null) {
|
||||
AdasAIDLAutopilotArriveModel adasAIDLAutopilotArriveModel = new AdasAIDLAutopilotArriveModel();
|
||||
adasAIDLAutopilotArriveModel.setCarType(result.getCarType());
|
||||
adasAIDLAutopilotArriveModel.setLat(endLatLon.getLat());
|
||||
adasAIDLAutopilotArriveModel.setLon(endLatLon.getLon());
|
||||
double lon = endLatLon.getLon();
|
||||
double lat = endLatLon.getLat();
|
||||
adasAIDLAutopilotArriveModel.setLat(lat);
|
||||
adasAIDLAutopilotArriveModel.setLon(lon);
|
||||
Logger.d(TAG,"autopilotArrive reportSite");
|
||||
reportSite(lon, lat);
|
||||
for (AdasDataListener listener:iAdasEventListeners) {
|
||||
if (listener != null) {
|
||||
listener.autopilotArrive(adasAIDLAutopilotArriveModel);
|
||||
@@ -197,6 +233,7 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
for (AdasStatusListener listener :iAdasStatusListeners) {
|
||||
listener.onServiceConnected();
|
||||
}
|
||||
updateDriveStatusTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,4 +243,78 @@ public class AdasEventManager implements OnAdasListener, OnAdasMsgConnectStatusL
|
||||
listener.onServiceDisconnected();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateDriveStatusTask() {
|
||||
Logger.d(TAG,"updateDriveStatusTask");
|
||||
mdDisposable = Flowable.interval(0,5, TimeUnit.SECONDS)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.unsubscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new Consumer<Long>() {
|
||||
@Override
|
||||
public void accept(@NonNull Long aLong) throws Exception {
|
||||
updateDriveStatus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void updateDriveStatus() {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
AutonomousDriveStatusBean request = new AutonomousDriveStatusBean(sn, mCurrentAutopilotStatus, mCurrentAutopilotSpeed);
|
||||
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
|
||||
mAdasApiService.updateAutonomousDriveStatus(requestBody).
|
||||
subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG,"updateDriveStatus success");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void reportSite( double lon, double lat) {
|
||||
String sn = MoGoAiCloudClientConfig.getInstance().getSn();
|
||||
ReportSiteBean reportSiteBean = new ReportSiteBean(sn, lon, lat);
|
||||
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( reportSiteBean ) );
|
||||
mAdasApiService.updateReportSite(requestBody).
|
||||
subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG,"autopilotArrive success");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public AdasAIDLAutopilotStateModel autopilotStateCall() {
|
||||
AdasAIDLAutopilotStateModel adasAIDLAutopilotStateModel=new AdasAIDLAutopilotStateModel();
|
||||
if (mAutopilotStatus != null) {
|
||||
adasAIDLAutopilotStateModel.setSpeed(mAutopilotStatus.getSpeed());
|
||||
adasAIDLAutopilotStateModel.setState(mAutopilotStatus.getState());
|
||||
adasAIDLAutopilotStateModel.setReason(mAutopilotStatus.getReason());
|
||||
}
|
||||
return adasAIDLAutopilotStateModel;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,8 @@ import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
|
||||
import com.zhidao.autopilotservice.model.AdasAIDLAutopilotStateModel;
|
||||
import com.zhidao.support.adas.high.AdasManager;
|
||||
|
||||
|
||||
@@ -51,8 +53,46 @@ public class AdasProvider implements IProvider {
|
||||
adasEventManager.removeStatusListener(listener);
|
||||
}
|
||||
|
||||
public void removeAdasStatusListener() {
|
||||
adasEventManager.removeStatusListener();
|
||||
}
|
||||
|
||||
public void sendWsMessage(String msg) {
|
||||
AdasManager.getInstance().aiCloudToAdasData(msg);
|
||||
}
|
||||
|
||||
public void cancelPolit() {
|
||||
if (AdasManager.getInstance().isSocketConnect()) {
|
||||
AdasManager.getInstance().controlAutopilotCarHead();
|
||||
}
|
||||
}
|
||||
|
||||
public void hideAdas() {
|
||||
|
||||
}
|
||||
|
||||
public void showAdas() {
|
||||
|
||||
}
|
||||
|
||||
public void killAdas() {
|
||||
|
||||
}
|
||||
|
||||
//原ADAS sdk中为空实现
|
||||
public void settingCarModelListInfo(String msg) {
|
||||
|
||||
}
|
||||
|
||||
//原ADAS sdk中为空实现
|
||||
public void setSettingStatus(boolean show) {
|
||||
}
|
||||
|
||||
//原ADAS sdk中为空实现
|
||||
public void setUseAlgorithm(boolean open) {
|
||||
}
|
||||
|
||||
public AdasAIDLAutopilotStateModel autopilotStateCall() {
|
||||
return adasEventManager.autopilotStateCall();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 16:12
|
||||
*/
|
||||
public class AutonomousDriveStatusBean {
|
||||
|
||||
private String sn;
|
||||
private int status;
|
||||
private float vehicleSpeed;
|
||||
|
||||
public AutonomousDriveStatusBean(String sn, int status, float vehicleSpeed) {
|
||||
this.sn = sn;
|
||||
this.status = status;
|
||||
this.vehicleSpeed = vehicleSpeed;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public float getVehicleSpeed() {
|
||||
return vehicleSpeed;
|
||||
}
|
||||
|
||||
public void setVehicleSpeed(float vehicleSpeed) {
|
||||
this.vehicleSpeed = vehicleSpeed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
import retrofit2.http.Body;
|
||||
import retrofit2.http.Headers;
|
||||
import retrofit2.http.POST;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/28 14:24
|
||||
*/
|
||||
public interface IAdasApiService {
|
||||
|
||||
//上传自动驾驶状态接口
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-carDataService/autonomousDrive/updateAutonomousDriveStatus" )
|
||||
Observable<BaseData> updateAutonomousDriveStatus(@Body RequestBody requestBody );
|
||||
//站点上报
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-carDataService/autonomousDrive/reportSite" )
|
||||
Observable<BaseData> updateReportSite(@Body RequestBody requestBody );
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.module.adas;
|
||||
|
||||
/**
|
||||
* Created by XuYong on 2021/5/31 16:24
|
||||
*/
|
||||
public class ReportSiteBean {
|
||||
private String sn;
|
||||
private double lon;
|
||||
private double lat;
|
||||
|
||||
public ReportSiteBean(String sn, double lon, double lat) {
|
||||
this.sn = sn;
|
||||
this.lon = lon;
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,14 @@
|
||||
<!-- <stroke-->
|
||||
<!-- android:width="1dp"-->
|
||||
<!-- android:color="#182155" />-->
|
||||
<!-- <corners-->
|
||||
<!-- android:bottomLeftRadius="@dimen/dp_100"-->
|
||||
<!-- android:bottomRightRadius="@dimen/dp_20"-->
|
||||
<!-- android:topLeftRadius="@dimen/dp_20"-->
|
||||
<!-- android:topRightRadius="@dimen/dp_100" />-->
|
||||
<corners
|
||||
android:bottomLeftRadius="@dimen/dp_100"
|
||||
android:bottomRightRadius="@dimen/dp_20"
|
||||
android:topLeftRadius="@dimen/dp_20"
|
||||
android:topRightRadius="@dimen/dp_100" />
|
||||
android:bottomLeftRadius="130px"
|
||||
android:bottomRightRadius="30px"
|
||||
android:topLeftRadius="30px"
|
||||
android:topRightRadius="130px" />
|
||||
</shape>
|
||||
@@ -5,7 +5,7 @@
|
||||
<dimen name="module_ext_speed_height">460px</dimen>
|
||||
<dimen name="module_ext_arcView_width">320px</dimen>
|
||||
<dimen name="module_ext_arcView_height">320px</dimen>
|
||||
<dimen name="module_ext_arcView_stroke_with">15px</dimen>
|
||||
<dimen name="module_ext_arcView_stroke_with">20px</dimen>
|
||||
<dimen name="module_ext_arcView_center_text_size">110px</dimen>
|
||||
<dimen name="module_ext_arcView_des_text_size">40px</dimen>
|
||||
<dimen name="module_switch_map">279px</dimen>
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<item>提前看看出行路况,试试唤醒小智说,“中关村路况怎么样”</item>
|
||||
</string-array>
|
||||
|
||||
<string name="module_map_model_normal">默认视角</string>
|
||||
<string name="module_map_model_normal">近距视角</string>
|
||||
<string name="module_map_model_faster">远距视角</string>
|
||||
|
||||
</resources>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
Reference in New Issue
Block a user