Merge branch 'dev/dev_eagle_architecture_upgrade' into dev/dev_eagle_wuhan_sikua_obu

This commit is contained in:
董宏宇
2021-10-18 11:13:01 +08:00
62 changed files with 483 additions and 685 deletions

View File

@@ -16,6 +16,11 @@ import com.zhidao.support.adas.high.AdasManager
*/
@Route(path = MogoServicePaths.PATH_AUTO_PILOT)
class MoGoAutoPilotProvider : IMoGoAutoPilotProvider {
private val TAG = "MoGoAutoPilotProvider"
override val functionName: String
get() = TAG
override fun init(context: Context) {
// 初始化ADAS 域控制器
@@ -66,7 +71,4 @@ class MoGoAutoPilotProvider : IMoGoAutoPilotProvider {
return AdasManager.getInstance().recordPackage()
}
companion object {
private const val TAG = "MogoAutoPilotProvider"
}
}

View File

@@ -5,7 +5,6 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Rect;
import android.os.Bundle;
import android.util.Log;
@@ -17,25 +16,15 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.elegant.network.ParamsBuilder;
import com.mogo.cloud.passport.MoGoAiCloudClientConfig;
import com.mogo.commons.network.SubscribeImpl;
import com.mogo.eagle.core.function.check.R;
import com.mogo.eagle.core.function.check.api.ICheckResultCallBack;
import com.mogo.eagle.core.function.check.net.CheckApiServiceFactory;
import com.mogo.eagle.core.function.check.net.CheckNetWork;
import com.mogo.eagle.core.function.check.net.CheckResultData;
import com.mogo.eagle.core.utilcode.util.ThreadUtils;
import com.mogo.module.common.view.ImageViewClipBounds;
import com.mogo.module.common.view.SpacesItemDecoration;
import com.mogo.utils.network.RequestOptions;
import com.mogo.utils.network.utils.NetworkStatusUtil;
import java.math.BigDecimal;
import java.util.Map;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
/**
* @author liujing
@@ -102,6 +91,7 @@ public class CheckActivity extends AppCompatActivity {
mRecyclerView.setAdapter(mCheckAdapter);
}
private void checkAction() {
CheckNetWork.INSTANCE.checkNetWork(this.getApplicationContext(), new ICheckResultCallBack() {
@Override

View File

@@ -5,8 +5,8 @@ import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo
import com.mogo.eagle.core.data.autopilot.AutoPilotControlParameters
import com.mogo.eagle.core.data.autopilot.AutoPilotStationInfo
import com.mogo.eagle.core.function.call.hmi.CallerHmiListenerManager
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.util.LogUtils
@@ -64,14 +64,14 @@ class AutoPilotStatusView @JvmOverloads constructor(
CallerHmiListenerManager.invokeCheckAutoPilotBtnListener(false)
}
}
// startAutoPilot();
startAutoPilot();
}
private fun startAutoPilot() {
val currentAutopilot =
AutoPilotControlParameters()
currentAutopilot.isSpeakVoice = false
currentAutopilot.startLatLon = AutoPilotControlParameters.AutoPilotLonLat(40.194795425,116.724476409);
currentAutopilot.endLatLon = AutoPilotControlParameters.AutoPilotLonLat(40.199730,116.735687);
currentAutopilot.startLatLon = AutoPilotControlParameters.AutoPilotLonLat(40.199157289445921,116.73675895051454);
currentAutopilot.endLatLon = AutoPilotControlParameters.AutoPilotLonLat(40.199255159538758,116.73274535677977);
currentAutopilot.vehicleType = 10
MogoApisHandler.getInstance().apis.adasControllerApi.aiCloudToAdasData(currentAutopilot)
}

View File

@@ -0,0 +1,25 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import android.widget.FrameLayout
import com.mogo.eagle.core.function.hmi.R
/**
*@author xiaoyuzhou
*@date 2021/10/15 11:34 上午
* 视角切换按钮
*/
class PerspectiveSwitchView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : FrameLayout(context, attrs, defStyleAttr) {
init {
LayoutInflater.from(context).inflate(R.layout.view_perspective_switch, this, true)
}
}

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/module_switch_model_layout"
android:layout_width="@dimen/module_switch_map"
android:layout_height="@dimen/module_switch_map_height"
android:background="@drawable/module_switch_map_bg"
android:elevation="@dimen/dp_10"
android:padding="@dimen/dp_20">
<LinearLayout
android:id="@+id/module_switch_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:orientation="horizontal">
<ImageView
android:id="@+id/module_switch_model_icon"
android:layout_width="@dimen/module_switch_image"
android:layout_height="@dimen/module_switch_image"
android:layout_gravity="left|center_vertical"
android:paddingLeft="@dimen/module_switch_margin_left"
android:src="@drawable/module_switch_map_angle" />
<TextView
android:id="@+id/module_switch_model_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right|center"
android:paddingLeft="@dimen/module_switch_margin_left"
android:text="@string/module_map_model_normal"
android:textColor="@color/module_ext_color_voice_text"
android:textSize="@dimen/module_switch_text_size" />
</LinearLayout>
</FrameLayout>

View File

@@ -1,17 +0,0 @@
package com.mogo.eagle.core.function.notice;
import android.content.Context;
import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider;
/**
* @author xiaoyuzhou
* @date 2021/9/18 11:44 上午
* 处理云端下发通知、公告类的逻辑的接口
*/
public class MoGoNoticeProvider implements IMoGoNoticeProvider {
@Override
public void init(Context context) {
}
}

View File

@@ -0,0 +1,18 @@
package com.mogo.eagle.core.function.notice
import android.content.Context
import com.mogo.eagle.core.function.api.notice.IMoGoNoticeProvider
/**
* @author xiaoyuzhou
* @date 2021/9/18 11:44 上午
* 处理云端下发通知、公告类的逻辑的接口
*/
class MoGoNoticeProvider : IMoGoNoticeProvider {
private val TAG = "MoGoNoticeProvider"
override val functionName: String
get() = TAG
override fun init(context: Context) {}
}

View File

@@ -18,6 +18,10 @@ class MoGoObuProvider : IMoGoObuProvider {
private var mContext: Context? = null
override val functionName: String
get() = TAG
override fun init(context: Context) {
LogUtils.dTag(TAG, "初始化蘑菇自研OBU……")
mContext = context
@@ -34,4 +38,5 @@ class MoGoObuProvider : IMoGoObuProvider {
}
}
}

View File

@@ -16,6 +16,7 @@ import androidx.annotation.Nullable;
import com.amap.api.maps.AMap;
import com.amap.api.maps.CameraUpdate;
import com.amap.api.maps.CameraUpdateFactory;
import com.amap.api.maps.CoordinateConverter;
import com.amap.api.maps.TextureMapView;
import com.amap.api.maps.UiSettings;
import com.amap.api.maps.model.BitmapDescriptorFactory;
@@ -67,7 +68,7 @@ public class SmallMapDirectionView
private List<MogoLatLng> mCoordinatesLatLngCurrent = new ArrayList<>();
private Polyline mPolyline;
private CameraUpdate mCameraUpdate;
private Context mContext;
public SmallMapDirectionView(Context context) {
this(context, null);
}
@@ -86,6 +87,7 @@ public class SmallMapDirectionView
}
private void initView(Context context) {
mContext = context;
View smpView = LayoutInflater.from(context).inflate(R.layout.module_small_map_view, this);
mAMapNaviView = (TextureMapView)smpView.findViewById(R.id.aMapNaviView);
@@ -110,6 +112,7 @@ public class SmallMapDirectionView
);
return false;
});
}
@Override
@@ -188,36 +191,36 @@ public class SmallMapDirectionView
}
if (mCoordinatesLatLng.size() > 1) {
mCoordinatesLatLngCurrent.clear();
for (LatLng lng : mCoordinatesLatLng) {
MogoLatLng mogoLatLng = new MogoLatLng(lng.latitude, lng.longitude);
mCoordinatesLatLngCurrent.add(mogoLatLng);
}
// 结束位置
LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
// 与结束位置进行 GeoHash 0-12
// GeoHash endGeoHash = GeoHash.withCharacterPrecision(endLatLng.latitude, endLatLng.longitude, 7);
// GeoHash currentGeoHash = GeoHash.withCharacterPrecision(currentLatLng.latitude, currentLatLng.longitude, 7);
// Log.d(MODULE_NAME, "currentGeoHash=" + currentGeoHash);
// Log.d(MODULE_NAME, "endGeoHash=" + endGeoHash);
float calculateDistance = CoordinateUtils.calculateLineDistance(
endLatLng.latitude, endLatLng.longitude,
currentLatLng.latitude, currentLatLng.longitude
);
Log.d(MODULE_NAME, "calculateDistance=" + calculateDistance);
if (calculateDistance <= 20) {
clearPolyline();
} else {
drawablePolyline(mCoordinatesLatLngCurrent);
}
} else {
//设置希望展示的地图缩放级别
mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLng, zoomLevel));
}
// if (mCoordinatesLatLng.size() > 1) {
// mCoordinatesLatLngCurrent.clear();
// for (LatLng lng : mCoordinatesLatLng) {
// MogoLatLng mogoLatLng = new MogoLatLng(lng.latitude, lng.longitude);
// mCoordinatesLatLngCurrent.add(mogoLatLng);
// }
//
// // 结束位置
// LatLng endLatLng = mCoordinatesLatLng.get(mCoordinatesLatLng.size() - 1);
// // 与结束位置进行 GeoHash 0-12
//// GeoHash endGeoHash = GeoHash.withCharacterPrecision(endLatLng.latitude, endLatLng.longitude, 7);
//// GeoHash currentGeoHash = GeoHash.withCharacterPrecision(currentLatLng.latitude, currentLatLng.longitude, 7);
//// Log.d(MODULE_NAME, "currentGeoHash=" + currentGeoHash);
//// Log.d(MODULE_NAME, "endGeoHash=" + endGeoHash);
//
// float calculateDistance = CoordinateUtils.calculateLineDistance(
// endLatLng.latitude, endLatLng.longitude,
// currentLatLng.latitude, currentLatLng.longitude
// );
//
// Log.d(MODULE_NAME, "calculateDistance=" + calculateDistance);
// if (calculateDistance <= 20) {
// clearPolyline();
// } else {
// drawablePolyline(mCoordinatesLatLngCurrent);
// }
// } else {
// //设置希望展示的地图缩放级别
// mAMap.moveCamera(CameraUpdateFactory.newLatLngZoom(currentLatLng, zoomLevel));
// }
CameraPosition cameraPosition = new CameraPosition.Builder().target(mCarMarker.getPosition()).bearing(latLng.getBearing()).tilt(0).zoom(zoomLevel).build();
mAMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}
@@ -230,12 +233,13 @@ public class SmallMapDirectionView
@Override
public void drawablePolyline(List<MogoLatLng> coordinates) {
clearPolyline();
mCoordinatesLatLng.clear();
for (MogoLatLng coordinate : coordinates) {
mCoordinatesLatLng.add(new LatLng(coordinate.getLat(), coordinate.getLon()));
}
// mCoordinatesLatLng.clear();
List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext,coordinates);
mCoordinatesLatLng.addAll(latLngs);
// for (LatLng coordinate : mCoordinatesLatLng) {
//// mCoordinatesLatLng.add(new LatLng(coordinate.getLat(), coordinate.getLon()));
//// Log.e("",coordinate.latitude+":"+coordinate.longitude);
// }
if (mAMap != null) {
if (mCoordinatesLatLng.size() > 2) {
// 设置开始结束Marker位置
@@ -253,7 +257,6 @@ public class SmallMapDirectionView
}
//第二个参数为四周留空宽度
mAMap.animateCamera(CameraUpdateFactory.newLatLngBoundsRect(boundsBuilder.build(), 65, 65, 65, 65));
// 绘制线
mPolyline = mAMap.addPolyline(
new PolylineOptions()
@@ -268,6 +271,23 @@ public class SmallMapDirectionView
}
}
public LatLng CoordinateConverterFrom84(Context mContext, MogoLatLng mogoLatLng){
CoordinateConverter mCoordinateConverter = new CoordinateConverter(mContext);
mCoordinateConverter.from(CoordinateConverter.CoordType.GPS);
mCoordinateConverter.coord(new LatLng(mogoLatLng.lat,mogoLatLng.lon));
LatLng latLng = mCoordinateConverter.convert();
return latLng;
}
public List<LatLng> CoordinateConverterFrom84ForList(Context mContext, List<MogoLatLng> mogoLatLngList){
List<LatLng> list = new ArrayList<>();
for (MogoLatLng m:mogoLatLngList) {
LatLng mogoLatLng = CoordinateConverterFrom84(mContext,m);
list.add(mogoLatLng);
}
return list;
}
@Override
public void clearPolyline() {
mCoordinatesLatLng.clear();
@@ -305,4 +325,10 @@ public class SmallMapDirectionView
mAMapNaviView.onDestroy();
}
}
public void setRouteList(List<MogoLatLng> coordinates) {
// mCoordinatesLatLng.clear();
// List<LatLng> latLngs = CoordinateConverterFrom84ForList(mContext,coordinates);
// mCoordinatesLatLng.addAll(latLngs);
}
}

View File

@@ -45,6 +45,7 @@ public class SmallMapFragment extends Fragment {
public void drawablePolyline(List<MogoLatLng> coordinates) {
if (mSmallMapDirectionView != null) {
mSmallMapDirectionView.setRouteList(coordinates);
mSmallMapDirectionView.drawablePolyline(coordinates);
}
}

View File

@@ -40,7 +40,7 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
mActivity = activity;
mContainerId = containerId;
SmpServiceManager.init(mActivity);
//MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
}
@Override
@@ -63,7 +63,7 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
MogoServicePaths.PATH_SMALL_MAP,
StatusDescriptor.MAIN_PAGE_RESUME,
this);
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
// MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasAutopilotRouteCallBack(this);
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
showPanel();
@@ -132,6 +132,7 @@ public class SmallMapProvider implements IMogoSmallMapProvider, IMogoStatusChang
@Override
public void routeResult(List<MogoLatLng> routeList) {
Log.e("lianglihui","SmallMapProvider");
if (routeList != null && routeList.size() > 0) {
drawablePolyline(routeList);
} else {