Merge remote-tracking branch 'origin/dev2_aiSdk' into dev2_aiSdk
# Conflicts: # modules/mogo-module-v2x/src/main/res/values/colors.xml
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -8,7 +8,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="12" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -54,7 +54,6 @@ public class OchBusProvider implements IMogoOCH {
|
||||
public void init(Context context) {
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus", StatusDescriptor.VR_MODE, statusChangedListener);
|
||||
MogoApisHandler.getInstance().getApis().getStatusManagerApi().registerStatusChangedListener("OchBus", StatusDescriptor.TOP_VIEW, statusChangedListener);
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi(context).registerOnMessageListener(401017, messageListener);
|
||||
}
|
||||
|
||||
private void showFragment() {
|
||||
@@ -92,17 +91,4 @@ public class OchBusProvider implements IMogoOCH {
|
||||
}
|
||||
};
|
||||
|
||||
private final IMogoOnMessageListener<List<OchBusStation>> messageListener = new IMogoOnMessageListener<List<OchBusStation>>() {
|
||||
@Override
|
||||
public Class<List<OchBusStation>> target() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(List<OchBusStation> obj) {
|
||||
// 刷新列表
|
||||
busFragment.getPresenter().getStationListFromSocket(obj);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class OchBusStationAdapter extends RecyclerView.Adapter<OchBusStationAdap
|
||||
this.stationList.addAll(stationList);
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
OchBusStation station = stationList.get(i);
|
||||
if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING || station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPED) {
|
||||
if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING || station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPPED ) {
|
||||
currentStation = i;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/23
|
||||
* <p>
|
||||
* 小巴达到站点,推送需要下车的乘客列表
|
||||
*/
|
||||
class OchBusArriveAtStationMsg {
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.utils.network.utils.Util;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class OchBusOperationStatusRequest {
|
||||
|
||||
public String sn;
|
||||
// 0 - 关闭、1 - 启动
|
||||
public String status;
|
||||
|
||||
public OchBusOperationStatusRequest() {
|
||||
this.sn = Utils.getSn();
|
||||
}
|
||||
|
||||
public OchBusOperationStatusRequest shutdown() {
|
||||
status = "0";
|
||||
return this;
|
||||
}
|
||||
|
||||
public OchBusOperationStatusRequest launch() {
|
||||
status = "1";
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class OchBusOperationStatusResponse extends BaseData {
|
||||
|
||||
public Result result;
|
||||
|
||||
public static class Result {
|
||||
public String id;
|
||||
public String sn;
|
||||
public String areaCode;
|
||||
public String plateNumber;
|
||||
public int status;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/23
|
||||
* <p>
|
||||
* 小巴订单
|
||||
*/
|
||||
class OchBusOrder {
|
||||
|
||||
/**
|
||||
* _id : bf014b186a0d417e8086f324e5cbcd1d
|
||||
* orderNo : XB20210324000002
|
||||
* orderType : 10
|
||||
* userName : 星期一
|
||||
* userPhone : 15555555555
|
||||
* startStationId : 1
|
||||
* startStation : 万集东门站
|
||||
* startStationCoordinate : [116.7354579447,40.1974932972]
|
||||
* endStationId : 2
|
||||
* endStation : 顺密路口站
|
||||
* endStationCoordinate : [116.7215386924,40.194019209]
|
||||
* orderDispatchType : 1
|
||||
* carNum : 京NB007
|
||||
* sn : F803BB2037EZD00088
|
||||
* orderStartTime : Mar 24, 2021 12:51:51 PM
|
||||
* orderEndTime : Mar 24, 2021 1:38:13 PM
|
||||
* cityCode : 010
|
||||
* areaCode : 1001
|
||||
* createTime : Mar 24, 2021 12:51:51 PM
|
||||
* updateTime : Mar 24, 2021 1:38:13 PM
|
||||
* travelDistance : 1.2
|
||||
*/
|
||||
|
||||
private String _id;
|
||||
private String orderNo;
|
||||
private int orderType;
|
||||
private String userName;
|
||||
private String userPhone;
|
||||
private int startStationId;
|
||||
private String startStation;
|
||||
private int endStationId;
|
||||
private String endStation;
|
||||
private int orderDispatchType;
|
||||
private String carNum;
|
||||
private String sn;
|
||||
private String orderStartTime;
|
||||
private String orderEndTime;
|
||||
private String cityCode;
|
||||
private String areaCode;
|
||||
private String createTime;
|
||||
private String updateTime;
|
||||
private double travelDistance;
|
||||
private List< Double > startStationCoordinate;
|
||||
private List< Double > endStationCoordinate;
|
||||
|
||||
public String get_id() {
|
||||
return _id;
|
||||
}
|
||||
|
||||
public void set_id( String _id ) {
|
||||
this._id = _id;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public void setOrderNo( String orderNo ) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public int getOrderType() {
|
||||
return orderType;
|
||||
}
|
||||
|
||||
public void setOrderType( int orderType ) {
|
||||
this.orderType = orderType;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName( String userName ) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getUserPhone() {
|
||||
return userPhone;
|
||||
}
|
||||
|
||||
public void setUserPhone( String userPhone ) {
|
||||
this.userPhone = userPhone;
|
||||
}
|
||||
|
||||
public int getStartStationId() {
|
||||
return startStationId;
|
||||
}
|
||||
|
||||
public void setStartStationId( int startStationId ) {
|
||||
this.startStationId = startStationId;
|
||||
}
|
||||
|
||||
public String getStartStation() {
|
||||
return startStation;
|
||||
}
|
||||
|
||||
public void setStartStation( String startStation ) {
|
||||
this.startStation = startStation;
|
||||
}
|
||||
|
||||
public int getEndStationId() {
|
||||
return endStationId;
|
||||
}
|
||||
|
||||
public void setEndStationId( int endStationId ) {
|
||||
this.endStationId = endStationId;
|
||||
}
|
||||
|
||||
public String getEndStation() {
|
||||
return endStation;
|
||||
}
|
||||
|
||||
public void setEndStation( String endStation ) {
|
||||
this.endStation = endStation;
|
||||
}
|
||||
|
||||
public int getOrderDispatchType() {
|
||||
return orderDispatchType;
|
||||
}
|
||||
|
||||
public void setOrderDispatchType( int orderDispatchType ) {
|
||||
this.orderDispatchType = orderDispatchType;
|
||||
}
|
||||
|
||||
public String getCarNum() {
|
||||
return carNum;
|
||||
}
|
||||
|
||||
public void setCarNum( String carNum ) {
|
||||
this.carNum = carNum;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn( String sn ) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getOrderStartTime() {
|
||||
return orderStartTime;
|
||||
}
|
||||
|
||||
public void setOrderStartTime( String orderStartTime ) {
|
||||
this.orderStartTime = orderStartTime;
|
||||
}
|
||||
|
||||
public String getOrderEndTime() {
|
||||
return orderEndTime;
|
||||
}
|
||||
|
||||
public void setOrderEndTime( String orderEndTime ) {
|
||||
this.orderEndTime = orderEndTime;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode( String cityCode ) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getAreaCode() {
|
||||
return areaCode;
|
||||
}
|
||||
|
||||
public void setAreaCode( String areaCode ) {
|
||||
this.areaCode = areaCode;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime( String createTime ) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime( String updateTime ) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public double getTravelDistance() {
|
||||
return travelDistance;
|
||||
}
|
||||
|
||||
public void setTravelDistance( double travelDistance ) {
|
||||
this.travelDistance = travelDistance;
|
||||
}
|
||||
|
||||
public List< Double > getStartStationCoordinate() {
|
||||
return startStationCoordinate;
|
||||
}
|
||||
|
||||
public void setStartStationCoordinate( List< Double > startStationCoordinate ) {
|
||||
this.startStationCoordinate = startStationCoordinate;
|
||||
}
|
||||
|
||||
public List< Double > getEndStationCoordinate() {
|
||||
return endStationCoordinate;
|
||||
}
|
||||
|
||||
public void setEndStationCoordinate( List< Double > endStationCoordinate ) {
|
||||
this.endStationCoordinate = endStationCoordinate;
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,15 @@ public class OchBusStation {
|
||||
private int isCurrentSite;
|
||||
private int siteColor;
|
||||
private String peoples;
|
||||
private int ifStop; // 是否需要停靠、1需要、0不需要
|
||||
|
||||
public int getIfStop() {
|
||||
return ifStop;
|
||||
}
|
||||
|
||||
public void setIfStop( int ifStop ) {
|
||||
this.ifStop = ifStop;
|
||||
}
|
||||
|
||||
public int getLineId() {
|
||||
return lineId;
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/25
|
||||
*
|
||||
* 小巴站点信息变更:停靠状态等
|
||||
*/
|
||||
class OchBusStationsChangedMsg {
|
||||
|
||||
public List< OchBusStation > data;
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.commons.network.Utils;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class QueryOchBusOperationStatusRequest {
|
||||
|
||||
public String sn;
|
||||
|
||||
public QueryOchBusOperationStatusRequest() {
|
||||
this.sn = Utils.getSn();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.commons.network.Utils;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class UpdateSiteStatusRequest {
|
||||
|
||||
public String sn;
|
||||
// 0 - 关闭、1 - 启动
|
||||
public int siteId;
|
||||
|
||||
public UpdateSiteStatusRequest( int siteId ) {
|
||||
this.sn = Utils.getSn();
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,11 +6,12 @@ package com.mogo.och.bus.constant;
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusConst {
|
||||
// 无状态
|
||||
public static final int STATION_STATUS_IDLE = 0;
|
||||
public static final int STATION_STATUS_STOPED = 1;
|
||||
// 到站
|
||||
public static final int STATION_STATUS_STOPPED = 1;
|
||||
// 离开某一站
|
||||
public static final int STATION_STATUS_LEAVING = 2;
|
||||
/**
|
||||
* 服务端没有记录此状态,由本地直接维护此状态,方便使用
|
||||
*/
|
||||
// 下一站
|
||||
public static final int STATION_STATUS_ARRIVING = 3;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.och.bus.fragment;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
@@ -7,6 +8,7 @@ import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.BaseOchFragment;
|
||||
import com.mogo.och.bus.R;
|
||||
@@ -19,7 +21,6 @@ import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -28,135 +29,55 @@ import java.util.List;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresenter> implements SlidePanelView.OnSlidePanelMoveToEndListener {
|
||||
public class OchBusFragment extends BaseOchFragment< OchBusFragment, OchBusPresenter > implements SlidePanelView.OnSlidePanelMoveToEndListener {
|
||||
private static final String TAG = "OchBusFragment";
|
||||
|
||||
private TextView tvStationNotice;
|
||||
private TextView tvStationName;
|
||||
private RecyclerView rvStationList;
|
||||
private TextView mCurrentStationName;
|
||||
private TextView mStartStationFlag;
|
||||
private TextView mNextStationName;
|
||||
private TextView mEndStationFlag;
|
||||
|
||||
private OchBusStationAdapter adapter;
|
||||
private View mBus;
|
||||
|
||||
private int stationSizeLevel = 2;
|
||||
// private OchBusStationAdapter adapter;
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
tvStationNotice = findViewById(R.id.module_mogo_och_bus_current_station_notice);
|
||||
tvStationName = findViewById(R.id.module_mogo_och_bus_current_station_name);
|
||||
rvStationList = findViewById(R.id.module_mogo_och_bus_rv_station_list);
|
||||
mBus = findViewById( R.id.module_och_bus_tag );
|
||||
mCurrentStationName = findViewById( R.id.module_och_bus_current_station );
|
||||
mStartStationFlag = findViewById( R.id.module_och_bus_start_station_tag );
|
||||
mNextStationName = findViewById( R.id.module_och_bus_order_end_station );
|
||||
mEndStationFlag = findViewById( R.id.module_och_bus_end_station_tag );
|
||||
|
||||
adapter = new OchBusStationAdapter(getContext());
|
||||
rvStationList.setAdapter(adapter);
|
||||
rvStationList.setLayoutManager(new LinearLayoutManager(getContext()));
|
||||
// adapter = new OchBusStationAdapter( getContext() );
|
||||
// rvStationList.setAdapter( adapter );
|
||||
// rvStationList.setLayoutManager( new LinearLayoutManager( getContext() ) );
|
||||
|
||||
tvStationName.setOnLongClickListener(view -> {
|
||||
TipToast.shortTip("重置了车站状态");
|
||||
mPresenter.debugResetStationStatus();
|
||||
return true;
|
||||
});
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
mBus.setOnClickListener( view -> {
|
||||
TipToast.shortTip( "重置了车站状态" );
|
||||
mPresenter.debugResetStationStatus();
|
||||
} );
|
||||
|
||||
tvStationNotice.setOnLongClickListener(view -> {
|
||||
getActivity().finish();
|
||||
return true;
|
||||
});
|
||||
// tvStationNotice.setOnClickListener(view -> {
|
||||
// // todo debug code
|
||||
// List<OchBusStation> stationList = new ArrayList<>();
|
||||
// OchBusStation station;
|
||||
// switch (stationSizeLevel) {
|
||||
// case 2:
|
||||
// stationSizeLevel++;
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第一站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第二站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// break;
|
||||
// case 3:
|
||||
// stationSizeLevel++;
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第一站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第二站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第三站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// break;
|
||||
// case 4:
|
||||
// stationSizeLevel++;
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第一站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第二站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第三站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第四站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// break;
|
||||
// default:
|
||||
// stationSizeLevel = 2;
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第一站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_STOPED);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第二站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第三站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第四站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第五站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第五站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// station = new OchBusStation();
|
||||
// station.setSiteName("第五站");
|
||||
// station.setIsCurrentSite(OchBusConst.STATION_STATUS_IDLE);
|
||||
// stationList.add(station);
|
||||
// break;
|
||||
// }
|
||||
// refreshBusStations(stationList);
|
||||
// });
|
||||
mBus.setOnLongClickListener( view -> {
|
||||
getActivity().finish();
|
||||
return true;
|
||||
} );
|
||||
}
|
||||
|
||||
Logger.d(TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus());
|
||||
switch (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus()) {
|
||||
Logger.d( TAG, "initView: " + MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() );
|
||||
switch ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() ) {
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE:
|
||||
hideAutopilotBiz();
|
||||
break;
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
|
||||
showAutopilotBiz();
|
||||
onAutopilotStatusChanged(false);
|
||||
onAutopilotStatusChanged( false );
|
||||
break;
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
|
||||
showAutopilotBiz();
|
||||
onAutopilotStatusChanged(true);
|
||||
onAutopilotStatusChanged( true );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -166,27 +87,12 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
|
||||
@NonNull
|
||||
@Override
|
||||
protected OchBusPresenter createPresenter() {
|
||||
return new OchBusPresenter(this);
|
||||
}
|
||||
|
||||
public void showOchBus() {
|
||||
MogoApisHandler.getInstance().getApis().getTopViewManager().removeAllViewInVrMode();
|
||||
return new OchBusPresenter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
queryStationListIfNecessary();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHiddenChanged(boolean hidden) {
|
||||
super.onHiddenChanged(hidden);
|
||||
Logger.d(TAG, "onHiddenChanged: " + hidden);
|
||||
if (!hidden) {
|
||||
// 判断是否需要请求接口
|
||||
queryStationListIfNecessary();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,87 +100,84 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
|
||||
*
|
||||
* @param stationList 车站列表信息
|
||||
*/
|
||||
public void refreshBusStations(List<OchBusStation> stationList) {
|
||||
if (getActivity() == null) {
|
||||
public void refreshBusStations( List< OchBusStation > stationList, int currentStation, int nextStation ) {
|
||||
if ( getActivity() == null ) {
|
||||
return;
|
||||
}
|
||||
getActivity().runOnUiThread(() -> {
|
||||
if (stationList == null) {
|
||||
getActivity().runOnUiThread( () -> {
|
||||
if ( stationList == null ) {
|
||||
// 获取小巴数据失败
|
||||
return;
|
||||
}
|
||||
// 根据车站数量,调整面板高度,分为2,3,>3
|
||||
ViewGroup.LayoutParams params = rvStationList.getLayoutParams();
|
||||
switch (stationList.size()) {
|
||||
case 2:
|
||||
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_two_station_list_height);
|
||||
break;
|
||||
case 3:
|
||||
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_three_station_list_height);
|
||||
break;
|
||||
default:
|
||||
params.height = getResources().getDimensionPixelSize(R.dimen.module_mogo_och_bus_station_list_height);
|
||||
break;
|
||||
}
|
||||
rvStationList.setLayoutParams(params);
|
||||
// 渲染小巴路线数据
|
||||
adapter.refreshStationList(stationList);
|
||||
int currPos = -1;
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
OchBusStation station = stationList.get(i);
|
||||
if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_STOPED) {
|
||||
currPos = i;
|
||||
tvStationNotice.setText("当前车站");
|
||||
tvStationName.setText(station.getSiteName());
|
||||
if (i == stationList.size() - 1) {
|
||||
showNotice("行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!");
|
||||
tvStationNotice.setText("终点");
|
||||
showSlidePanle("单程结束");
|
||||
} else if (i == 0) {
|
||||
hideNotice();
|
||||
showSlidePanle("准备出发");
|
||||
} else {
|
||||
showNotice("行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!");
|
||||
showSlidePanle("乘客已上车,准备出发");
|
||||
}
|
||||
break;
|
||||
}else if (station.getIsCurrentSite() == OchBusConst.STATION_STATUS_ARRIVING) {
|
||||
tvStationName.setText(station.getSiteName());
|
||||
tvStationNotice.setText("下一站");
|
||||
currPos = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// smoothMove
|
||||
if (stationList.size() < 5) {
|
||||
//数量太少,不进行smooth move
|
||||
return;
|
||||
}
|
||||
int moveTo = currPos + 1;
|
||||
if (currPos < 3) {
|
||||
moveTo = 0;
|
||||
}
|
||||
if (currPos >= stationList.size() - 3) {
|
||||
moveTo = stationList.size() - 1;
|
||||
}
|
||||
if (moveTo >= stationList.size()) {
|
||||
moveTo = stationList.size() - 1;
|
||||
}
|
||||
rvStationList.smoothScrollToPosition(moveTo);
|
||||
});
|
||||
// 渲染小巴路线数据
|
||||
renderCurrentStationStatus( stationList, currentStation, nextStation );
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新刷新站点信息
|
||||
*/
|
||||
private void renderCurrentStationStatus( List< OchBusStation > stationList, int currentStation, int nextStation ) {
|
||||
|
||||
String currentStationName = null;
|
||||
String nextStationName = null;
|
||||
int startStationFlagVisibility = View.INVISIBLE;
|
||||
int endStationFlagVisibility = View.INVISIBLE;
|
||||
|
||||
boolean isArriveEndStation = false;
|
||||
boolean isArriveAtStation = false;
|
||||
boolean isArriveAtStartStation = false;
|
||||
|
||||
for ( OchBusStation ochBusStation : stationList ) {
|
||||
int index = stationList.indexOf( ochBusStation );
|
||||
switch ( ochBusStation.getIsCurrentSite() ) {
|
||||
case OchBusConst.STATION_STATUS_STOPPED:
|
||||
isArriveEndStation = index == stationList.size() - 1;
|
||||
isArriveAtStation = true;
|
||||
case OchBusConst.STATION_STATUS_LEAVING:
|
||||
break;
|
||||
case OchBusConst.STATION_STATUS_ARRIVING:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( currentStation == 0 ) {
|
||||
startStationFlagVisibility = View.VISIBLE;
|
||||
isArriveAtStartStation = true;
|
||||
}
|
||||
|
||||
if ( nextStation == stationList.size() - 1 ) {
|
||||
endStationFlagVisibility = View.VISIBLE;
|
||||
}
|
||||
|
||||
currentStationName = stationList.get( currentStation ).getSiteName();
|
||||
|
||||
if ( nextStation < stationList.size() ) {
|
||||
nextStationName = stationList.get( nextStation ).getSiteName();
|
||||
}
|
||||
|
||||
if ( isArriveEndStation ) {
|
||||
showNotice( "行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!" );
|
||||
showSlidePanle( "单程结束" );
|
||||
} else if ( isArriveAtStartStation ) {
|
||||
showSlidePanle( "准备出发" );
|
||||
} else if ( isArriveAtStation ) {
|
||||
showNotice( "行程结束,请携带好随身物品,注意侧后方来车,感谢体验蘑菇智行自动驾驶车!" );
|
||||
showSlidePanle( "乘客已上车,准备出发" );
|
||||
}
|
||||
|
||||
mCurrentStationName.setText( currentStationName );
|
||||
mNextStationName.setText( nextStationName );
|
||||
mStartStationFlag.setVisibility( startStationFlagVisibility );
|
||||
mEndStationFlag.setVisibility( endStationFlagVisibility );
|
||||
}
|
||||
|
||||
|
||||
public void hideOchBus() {
|
||||
// tvNotice.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void queryStationListIfNecessary() {
|
||||
if (adapter.getItemCount() == 0) {
|
||||
mPresenter.queryBusRoutes();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStationPanelViewId() {
|
||||
return R.layout.fragment_och_bus;
|
||||
@@ -283,7 +186,7 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
|
||||
@Override
|
||||
public void restartAutopilot() {
|
||||
// 如果能自动驾驶,就自动驾驶,不能就提示
|
||||
if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE) {
|
||||
if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE ) {
|
||||
mPresenter.restartAutopilot();
|
||||
}
|
||||
}
|
||||
@@ -298,12 +201,25 @@ public class OchBusFragment extends BaseOchFragment<OchBusFragment, OchBusPresen
|
||||
mPresenter.autoDriveToNextStation();
|
||||
}
|
||||
|
||||
public void onAutopilotEnableChange(boolean isEnable) {
|
||||
if (isEnable) {
|
||||
public void onAutopilotEnableChange( boolean isEnable ) {
|
||||
if ( isEnable ) {
|
||||
showAutopilotBiz();
|
||||
} else {
|
||||
hideAutopilotBiz();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onChangeOperationStatus() {
|
||||
super.onChangeOperationStatus();
|
||||
mPresenter.onChangeOperationStatus();
|
||||
}
|
||||
|
||||
public void changeOperationStatus( boolean launch ) {
|
||||
if ( launch ) {
|
||||
tvOperationStatus.setText( "关闭" );
|
||||
} else {
|
||||
tvOperationStatus.setText( "开启" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
package com.mogo.och.bus.net;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.QueryOchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.UpdateSiteStatusRequest;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import okhttp3.RequestBody;
|
||||
@@ -13,38 +17,70 @@ import retrofit2.http.POST;
|
||||
* 小巴车相关接口
|
||||
*
|
||||
* @author tongchenfei
|
||||
* <p>
|
||||
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||
*/
|
||||
public interface IOchBusApiService {
|
||||
|
||||
/**
|
||||
* 根据车机坐标获取所在区域全部站点信息
|
||||
* <p>
|
||||
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||
*
|
||||
* @param requestBody 请求参数
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
@POST("/yycp-onlinecar-hailing/onlineCarHailing/site/querySiteByCoordinate/v1")
|
||||
Observable<OchBusRoutesResponse> querySiteByCoordinate(@Body RequestBody requestBody);
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/querySiteByCoordinate/v1" )
|
||||
Observable< OchBusRoutesResponse > querySiteByCoordinate( @Body RequestBody requestBody );
|
||||
|
||||
|
||||
/**
|
||||
* 公交车驶离车站时,通知服务端
|
||||
*
|
||||
* @param requestBody 请求参数 {"sn":"","siteId":"车站id"}
|
||||
* @return 无返回值
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
@POST("/yycp-onlinecar-hailing/onlineCarHailing/site/siteCrashCheck/v1")
|
||||
Observable<BaseData> leaveStation(@Body RequestBody requestBody);
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/siteCrashCheck/v1" )
|
||||
Observable< BaseData > leaveStation( @Body RequestBody requestBody );
|
||||
|
||||
/**
|
||||
* 调试用重置接口
|
||||
*
|
||||
* @param requestBody 请求参数{"siteId":1,"sn":"F803EB2046PZD00229"}
|
||||
* @return 返回值是重置后的车站列表
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
@POST("/yycp-onlinecar-hailing/onlineCarHailing/site/resetSiteByCoordinate/v1")
|
||||
Observable<OchBusRoutesResponse> debugResetStationStatus(@Body RequestBody requestBody);
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/resetSiteByCoordinate/v1" )
|
||||
Observable< OchBusRoutesResponse > debugResetStationStatus( @Body RequestBody requestBody );
|
||||
|
||||
/**
|
||||
* 修改小巴运营状态
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/updateBusStatus/v1" )
|
||||
Observable< BaseData > changeOperationStatus( @Body OchBusOperationStatusRequest request );
|
||||
|
||||
/**
|
||||
* 查询小巴运营状态
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/busOrder/queryBusStatus/v1" )
|
||||
Observable< OchBusOperationStatusResponse > queryOperationStatus( @Body QueryOchBusOperationStatusRequest request );
|
||||
|
||||
/**
|
||||
* 更新到站信息
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/yycp-onlinecar-hailing/onlineCarHailing/site/siteDynamic/v1" )
|
||||
Observable< OchBusRoutesResponse > updateSiteStation( @Body UpdateSiteStatusRequest request );
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,156 @@
|
||||
package com.mogo.och.bus.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Looper;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.och.bus.bean.OchBusArriveAtStationMsg;
|
||||
import com.mogo.och.bus.bean.OchBusOrder;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.bean.OchBusStationsChangedMsg;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/23
|
||||
*
|
||||
* 小巴订单管理
|
||||
*/
|
||||
class OchBusOrderModel {
|
||||
|
||||
private static volatile OchBusOrderModel sInstance;
|
||||
|
||||
public static OchBusOrderModel getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( OchBusOrderModel.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new OchBusOrderModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public void init() {
|
||||
mContext = AbsMogoApplication.getApp();
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi( mContext ).registerOnMessageListener( 401021, mOnOrderListener );
|
||||
MogoApisHandler.getInstance().getApis().getSocketManagerApi( mContext ).registerOnMessageListener( 401020, mOnBusStationsChangedMsg );
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Context mContext;
|
||||
|
||||
/**
|
||||
* 小巴订单
|
||||
* <p>
|
||||
* 1. 新订单
|
||||
*/
|
||||
private IMogoOnMessageListener< OchBusOrder > mOnOrderListener = new IMogoOnMessageListener< OchBusOrder >() {
|
||||
@Override
|
||||
public Class< OchBusOrder > target() {
|
||||
return OchBusOrder.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( OchBusOrder obj ) {
|
||||
if ( obj == null ) {
|
||||
return;
|
||||
}
|
||||
runOnUiThread( () -> {
|
||||
if ( mOnBusOrderChangedListener != null ) {
|
||||
mOnBusOrderChangedListener.onBusOrderChanged( obj );
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 小巴达到站点,推送需要下车的乘客列表
|
||||
*/
|
||||
private IMogoOnMessageListener< OchBusArriveAtStationMsg > mOnBusArriveAtStationMsg = new IMogoOnMessageListener< OchBusArriveAtStationMsg >() {
|
||||
@Override
|
||||
public Class< OchBusArriveAtStationMsg > target() {
|
||||
return OchBusArriveAtStationMsg.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( OchBusArriveAtStationMsg obj ) {
|
||||
onArriveAtStation();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 站点信息变更推送
|
||||
*/
|
||||
private IMogoOnMessageListener< OchBusStationsChangedMsg > mOnBusStationsChangedMsg = new IMogoOnMessageListener< OchBusStationsChangedMsg >() {
|
||||
@Override
|
||||
public Class< OchBusStationsChangedMsg > target() {
|
||||
return OchBusStationsChangedMsg.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived( OchBusStationsChangedMsg obj ) {
|
||||
if ( obj == null ) {
|
||||
return;
|
||||
}
|
||||
runOnUiThread( () -> {
|
||||
if ( mOnBusStationsChangedListener != null ) {
|
||||
mOnBusStationsChangedListener.onBusStationsChanged( obj.data );
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
|
||||
private OnBusStationsChangedListener mOnBusStationsChangedListener;
|
||||
private OnBusOrderChangedListener mOnBusOrderChangedListener;
|
||||
|
||||
private OchBusOrderModel() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 小巴到站
|
||||
*/
|
||||
public void onArriveAtStation() {
|
||||
|
||||
}
|
||||
|
||||
public void setOnBusStationsChangedListener( OnBusStationsChangedListener onBusStationsChangedListener ) {
|
||||
this.mOnBusStationsChangedListener = onBusStationsChangedListener;
|
||||
}
|
||||
|
||||
public void setOnBusOrderChangedListener( OnBusOrderChangedListener mOnBusOrderChangedListener ) {
|
||||
this.mOnBusOrderChangedListener = mOnBusOrderChangedListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* 站点信息
|
||||
*/
|
||||
public interface OnBusStationsChangedListener {
|
||||
void onBusStationsChanged( List< OchBusStation > data );
|
||||
}
|
||||
|
||||
/**
|
||||
* 站点信息
|
||||
*/
|
||||
public interface OnBusOrderChangedListener {
|
||||
void onBusOrderChanged( OchBusOrder order );
|
||||
}
|
||||
|
||||
private void runOnUiThread( Runnable runnable ) {
|
||||
if ( Looper.myLooper() == Looper.getMainLooper() ) {
|
||||
runnable.run();
|
||||
} else {
|
||||
UiThreadHandler.postDelayed( runnable, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,19 +2,29 @@ package com.mogo.och.bus.presenter;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.commons.network.SubscribeImpl;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.HostConst;
|
||||
import com.mogo.och.bus.bean.OchBusLeaveStationRequest;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.OchBusOperationStatusResponse;
|
||||
import com.mogo.och.bus.bean.OchBusOrder;
|
||||
import com.mogo.och.bus.bean.OchBusResetRequest;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesRequest;
|
||||
import com.mogo.och.bus.bean.OchBusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.OchBusStation;
|
||||
import com.mogo.och.bus.bean.QueryOchBusOperationStatusRequest;
|
||||
import com.mogo.och.bus.bean.UpdateSiteStatusRequest;
|
||||
import com.mogo.och.bus.fragment.OchBusFragment;
|
||||
import com.mogo.och.bus.net.IOchBusApiService;
|
||||
import com.mogo.service.adas.IMogoAdasOCHCallback;
|
||||
@@ -35,309 +45,464 @@ import okhttp3.RequestBody;
|
||||
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_ARRIVING;
|
||||
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_IDLE;
|
||||
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_LEAVING;
|
||||
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_STOPED;
|
||||
import static com.mogo.och.bus.constant.OchBusConst.STATION_STATUS_STOPPED;
|
||||
|
||||
/**
|
||||
* 网约车小巴
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class OchBusPresenter extends Presenter<OchBusFragment> implements IMogoAdasOCHCallback, Handler.Callback {
|
||||
public class OchBusPresenter extends Presenter< OchBusFragment > implements IMogoAdasOCHCallback,
|
||||
Handler.Callback,
|
||||
OchBusOrderModel.OnBusStationsChangedListener,
|
||||
OchBusOrderModel.OnBusOrderChangedListener {
|
||||
private static final String TAG = "OchBusPresenter";
|
||||
private static final int VEHICAL_TYPE = 10;
|
||||
private static final int MSG_REQUERY_BUS_STATION = 1001;
|
||||
private static final long REQUERY_BUS_STATION_DELAY = 5000;
|
||||
|
||||
// 运营类型
|
||||
private static final int VEHICLE_TYPE = 10;
|
||||
private static final int MSG_QUERY_BUS_STATION = 1001;
|
||||
private static final long QUERY_BUS_STATION_DELAY = 5000;
|
||||
|
||||
/**
|
||||
* 用来表示是否正在开往下一站
|
||||
*/
|
||||
private boolean isGoingToNextStation = false;
|
||||
|
||||
public OchBusPresenter(OchBusFragment view) {
|
||||
super(view);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasOCHCallback(this);
|
||||
private IOchBusApiService mService;
|
||||
|
||||
/**
|
||||
* 运营状态
|
||||
*/
|
||||
private boolean mIsWorking = false;
|
||||
|
||||
public OchBusPresenter( OchBusFragment view ) {
|
||||
super( view );
|
||||
mService = MogoApisHandler.getInstance().getApis().getNetworkApi().create( IOchBusApiService.class, HostConst.OCH_DOMAIN );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().addAdasOCHCallback( this );
|
||||
OchBusOrderModel.getInstance().init();
|
||||
OchBusOrderModel.getInstance().setOnBusStationsChangedListener( this );
|
||||
OchBusOrderModel.getInstance().setOnBusOrderChangedListener( this );
|
||||
}
|
||||
|
||||
private final Handler handler = new Handler(this);
|
||||
private final Handler handler = new Handler( this );
|
||||
|
||||
private final List<OchBusStation> stationList = new ArrayList<>();
|
||||
private final List< OchBusStation > stationList = new ArrayList<>();
|
||||
|
||||
private int currentStationIndex = 0;
|
||||
|
||||
@Override
|
||||
public void onCreate( @NonNull LifecycleOwner owner ) {
|
||||
super.onCreate( owner );
|
||||
queryOperationStatus();
|
||||
queryBusRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小巴路线
|
||||
*/
|
||||
public void queryBusRoutes() {
|
||||
double lat = 0;
|
||||
double lon = 0;
|
||||
MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient(getContext()).getLastKnowLocation();
|
||||
if (lastLocation != null) {
|
||||
lat = lastLocation.getLatitude();
|
||||
lon = lastLocation.getLongitude();
|
||||
double lat = 40.1974932972;
|
||||
double lon = 116.7354579447;
|
||||
MogoLocation lastLocation = MogoApisHandler.getInstance().getApis().getMapServiceApi().getSingletonLocationClient( getContext() ).getLastKnowLocation();
|
||||
if ( lastLocation != null ) {
|
||||
// lat = lastLocation.getLatitude();
|
||||
// lon = lastLocation.getLongitude();
|
||||
}
|
||||
OchBusRoutesRequest request = new OchBusRoutesRequest(Utils.getSn(), lat, lon);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(IOchBusApiService.class, HostConst.OCH_DOMAIN)
|
||||
.querySiteByCoordinate(requestBody)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<OchBusRoutesResponse>(RequestOptions.create(getContext())) {
|
||||
OchBusRoutesRequest request = new OchBusRoutesRequest( Utils.getSn(), lat, lon );
|
||||
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
|
||||
mService.querySiteByCoordinate( requestBody )
|
||||
.subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
|
||||
|
||||
@Override
|
||||
public void onSuccess(OchBusRoutesResponse o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "获取到小巴路线数据: " + o);
|
||||
if (mView != null && o.getResult() != null && o.getResult().getSite() != null) {
|
||||
stationList.clear();
|
||||
stationList.addAll(o.getResult().getSite());
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
OchBusStation s = stationList.get(i);
|
||||
if (s.getIsCurrentSite() == STATION_STATUS_LEAVING) {
|
||||
// 服务端只记录了leaving状态,没有记录arriving状态,此处端上自己增加一个arriving状态
|
||||
isGoingToNextStation = true;
|
||||
currentStationIndex = i;
|
||||
if (i < stationList.size() - 1) {
|
||||
// 将其下一站置为arriving状态
|
||||
stationList.get(i + 1).setIsCurrentSite(STATION_STATUS_ARRIVING);
|
||||
}
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
}
|
||||
refreshCurrentStation();
|
||||
mView.refreshBusStations(stationList);
|
||||
public void onSuccess( OchBusRoutesResponse o ) {
|
||||
super.onSuccess( o );
|
||||
if ( o == null
|
||||
|| o.getResult() == null
|
||||
|| o.getResult().getSite() == null
|
||||
|| o.getResult().getSite().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "获取到小巴路线数据: " + o );
|
||||
renderBusStationsStatus( o.getResult().getSite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG, e, "获取小巴路线图失败");
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "获取小巴路线图失败" );
|
||||
// 重复请求小巴路线,直至成功
|
||||
requeryBusStation();
|
||||
queryBusStationDelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.e(TAG, "获取小巴路线失败 code: " + code + " msg: " + message);
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.e( TAG, "获取小巴路线失败 code: " + code + " msg: " + message );
|
||||
// 重复请求小巴路线,直至成功
|
||||
requeryBusStation();
|
||||
queryBusStationDelay();
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
public void getStationListFromSocket(List<OchBusStation> stations) {
|
||||
// 接收长连接消息好像没啥用
|
||||
/**
|
||||
* 渲染站点信息
|
||||
*
|
||||
* @param site
|
||||
*/
|
||||
private void renderBusStationsStatus( List< OchBusStation > site ) {
|
||||
stationList.clear();
|
||||
stationList.addAll( site );
|
||||
for ( int i = 0; i < stationList.size(); i++ ) {
|
||||
OchBusStation s = stationList.get( i );
|
||||
if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING ) {
|
||||
isGoingToNextStation = true;
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
|
||||
if ( s.getIsCurrentSite() == STATION_STATUS_LEAVING
|
||||
|| s.getIsCurrentSite() == STATION_STATUS_STOPPED ) {
|
||||
currentStationIndex = i;
|
||||
}
|
||||
}
|
||||
|
||||
mView.refreshBusStations( stationList, currentStationIndex, getNextStopStation() );
|
||||
}
|
||||
|
||||
private void requeryBusStation() {
|
||||
handler.sendEmptyMessageDelayed(MSG_REQUERY_BUS_STATION, REQUERY_BUS_STATION_DELAY);
|
||||
/**
|
||||
* 根据订单状态、获取下一站靠站的的站点
|
||||
*
|
||||
* @return -1 当前已是最后一个站点
|
||||
*/
|
||||
private int getNextStopStation() {
|
||||
if ( currentStationIndex >= stationList.size() - 1 ) {
|
||||
return -1;
|
||||
}
|
||||
int nextStationIndex = currentStationIndex + 1;
|
||||
for ( ; nextStationIndex < stationList.size() - 1; nextStationIndex++ ) {
|
||||
if ( stationList.get( nextStationIndex ).getIfStop() == 1 ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return nextStationIndex;
|
||||
}
|
||||
|
||||
private void queryBusStationDelay() {
|
||||
handler.sendEmptyMessageDelayed( MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY );
|
||||
}
|
||||
|
||||
public void restartAutopilot() {
|
||||
Logger.d(TAG, "重启自动驾驶===" + isGoingToNextStation);
|
||||
if (isGoingToNextStation) {
|
||||
Logger.d( TAG, "重启自动驾驶===" + isGoingToNextStation );
|
||||
if ( isGoingToNextStation ) {
|
||||
autoDriveToNextStation();
|
||||
}
|
||||
}
|
||||
|
||||
public void debugResetStationStatus(){
|
||||
OchBusResetRequest request = new OchBusResetRequest(Utils.getSn(), 1);
|
||||
RequestBody requestBody = RequestBody.create(MediaType.get("application/json;charset=UTF-8"), GsonUtil.jsonFromObject(request));
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(IOchBusApiService.class, HostConst.OCH_DOMAIN)
|
||||
.debugResetStationStatus(requestBody)
|
||||
.subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<OchBusRoutesResponse>(RequestOptions.create(getContext())) {
|
||||
/**
|
||||
* 测试
|
||||
*/
|
||||
public void debugResetStationStatus() {
|
||||
OchBusResetRequest request = new OchBusResetRequest( Utils.getSn(), 1 );
|
||||
RequestBody requestBody = RequestBody.create( MediaType.get( "application/json;charset=UTF-8" ), GsonUtil.jsonFromObject( request ) );
|
||||
mService.debugResetStationStatus( requestBody )
|
||||
.subscribeOn( Schedulers.io() ).observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
|
||||
|
||||
@Override
|
||||
public void onSuccess(OchBusRoutesResponse o) {
|
||||
super.onSuccess(o);
|
||||
Logger.d(TAG, "获取到小巴路线数据: " + o);
|
||||
public void onSuccess( OchBusRoutesResponse o ) {
|
||||
super.onSuccess( o );
|
||||
Logger.d( TAG, "获取到小巴路线数据: " + o );
|
||||
isGoingToNextStation = false;
|
||||
if (mView != null && o.getResult() != null && o.getResult().getSite() != null) {
|
||||
stationList.clear();
|
||||
stationList.addAll(o.getResult().getSite());
|
||||
for (int i = 0; i < stationList.size(); i++) {
|
||||
OchBusStation s = stationList.get(i);
|
||||
if (s.getIsCurrentSite() == STATION_STATUS_LEAVING) {
|
||||
// 服务端只记录了leaving状态,没有记录arriving状态,此处端上自己增加一个arriving状态
|
||||
isGoingToNextStation = true;
|
||||
currentStationIndex = i;
|
||||
if (i < stationList.size() - 1) {
|
||||
// 将其下一站置为arriving状态
|
||||
stationList.get(i + 1).setIsCurrentSite(STATION_STATUS_ARRIVING);
|
||||
}
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
}
|
||||
refreshCurrentStation();
|
||||
mView.refreshBusStations(stationList);
|
||||
if ( o.getResult() == null || o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
renderBusStationsStatus( o.getResult().getSite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG, e, "获取小巴路线图失败");
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "获取小巴路线图失败" );
|
||||
// 重复请求小巴路线,直至成功
|
||||
requeryBusStation();
|
||||
queryBusStationDelay();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.e(TAG, "获取小巴路线失败 code: " + code + " msg: " + message);
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.e( TAG, "获取小巴路线失败 code: " + code + " msg: " + message );
|
||||
// 重复请求小巴路线,直至成功
|
||||
requeryBusStation();
|
||||
queryBusStationDelay();
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 开启自动驾驶到下一站
|
||||
*/
|
||||
public void autoDriveToNextStation() {
|
||||
if (currentStationIndex >= stationList.size() - 1) {
|
||||
if ( currentStationIndex >= stationList.size() - 1 ) {
|
||||
// 当前站是最后一站,结束当前行程
|
||||
travelOver();
|
||||
return;
|
||||
}
|
||||
OchBusStation currentStation = stationList.get(currentStationIndex);
|
||||
OchBusStation nextStation = stationList.get(currentStationIndex + 1);
|
||||
currentStation.setIsCurrentSite(STATION_STATUS_LEAVING);
|
||||
nextStation.setIsCurrentSite(STATION_STATUS_ARRIVING);
|
||||
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
|
||||
currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(currentStation.getLat(), currentStation.getLon());
|
||||
currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat(nextStation.getLat(), nextStation.getLon());
|
||||
currentAutopilot.vehicleType = VEHICAL_TYPE;
|
||||
Logger.d(TAG, "开启自动驾驶====" + currentAutopilot);
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData(currentAutopilot);
|
||||
OchBusStation currentStation = stationList.get( currentStationIndex );
|
||||
|
||||
if (mView != null) {
|
||||
mView.refreshBusStations(stationList);
|
||||
int nextStationIndex = getNextStopStation();
|
||||
|
||||
OchBusStation nextStation = stationList.get( nextStationIndex );
|
||||
currentStation.setIsCurrentSite( STATION_STATUS_LEAVING );
|
||||
nextStation.setIsCurrentSite( STATION_STATUS_ARRIVING );
|
||||
|
||||
RemoteControlAutoPilotParameters currentAutopilot = new RemoteControlAutoPilotParameters();
|
||||
currentAutopilot.startLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( currentStation.getLat(), currentStation.getLon() );
|
||||
currentAutopilot.endLatLon = new RemoteControlAutoPilotParameters.AutoPilotLonLat( nextStation.getLat(), nextStation.getLon() );
|
||||
currentAutopilot.vehicleType = VEHICLE_TYPE;
|
||||
Logger.d( TAG, "开启自动驾驶====" + currentAutopilot );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().aiCloudToAdasData( currentAutopilot );
|
||||
|
||||
if ( mView != null ) {
|
||||
mView.refreshBusStations( stationList, currentStationIndex, getNextStopStation() );
|
||||
}
|
||||
mView.hideSlidePanel();
|
||||
mView.hideNotice();
|
||||
|
||||
if (isGoingToNextStation) {
|
||||
if ( isGoingToNextStation ) {
|
||||
// 为了避免恢复自动驾驶时重复的接口请求
|
||||
return;
|
||||
}
|
||||
isGoingToNextStation = true;
|
||||
RequestBody request = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(new OchBusLeaveStationRequest(Utils.getSn(), stationList.get(currentStationIndex).getSiteId())));
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(IOchBusApiService.class, HostConst.OCH_DOMAIN)
|
||||
.leaveStation(request).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "欢迎乘坐蘑菇智行无人驾驶小巴车,请您坐好,注意乘车安全,行程即将开始" );
|
||||
RequestBody request = RequestBody.create( MediaType.get( "application/json" ), GsonUtil.jsonFromObject( new OchBusLeaveStationRequest( Utils.getSn(), stationList.get( currentStationIndex ).getSiteId() ) ) );
|
||||
mService.leaveStation( request ).subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
public void onSuccess( BaseData o ) {
|
||||
super.onSuccess( o );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.d(TAG, "leave station error: " + message);
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG, e, "leave station exception");
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void refreshCurrentStation() {
|
||||
currentStationIndex = 0;
|
||||
for (OchBusStation station : stationList) {
|
||||
// 如果数据表发生更新,获取当前所在车站
|
||||
if (station.getIsCurrentSite() == STATION_STATUS_STOPED || station.getIsCurrentSite() == STATION_STATUS_LEAVING) {
|
||||
// 处于停靠或驶离时,是当前车站
|
||||
break;
|
||||
}
|
||||
currentStationIndex++;
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArriveAt(AdasOCHData data) {
|
||||
if (currentStationIndex >= stationList.size() - 1) {
|
||||
Logger.e(TAG,"到站异常,取消后续操作");
|
||||
public void onArriveAt( AdasOCHData data ) {
|
||||
if ( currentStationIndex >= stationList.size() - 1 ) {
|
||||
Logger.e( TAG, "到站异常,取消后续操作" );
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "到站====");
|
||||
// 当前站改为IDLE,下一站改为STATION_STATUS_STOPED,currentStationIndex增加1
|
||||
Logger.d( TAG, "到站====" );
|
||||
isGoingToNextStation = false;
|
||||
stationList.get(currentStationIndex++).setIsCurrentSite(STATION_STATUS_IDLE);
|
||||
stationList.get(currentStationIndex).setIsCurrentSite(STATION_STATUS_STOPED);
|
||||
if (mView != null) {
|
||||
mView.refreshBusStations(stationList);
|
||||
}
|
||||
// 到达站点后,更新站点状态
|
||||
currentStationIndex = getNextStopStation();
|
||||
mService.updateSiteStation( new UpdateSiteStatusRequest( stationList.get( currentStationIndex ).getSiteId() ) )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OchBusRoutesResponse >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess( OchBusRoutesResponse o ) {
|
||||
super.onSuccess( o );
|
||||
if ( o.getResult() == null && o.getResult().getSite() == null || o.getResult().getSite().isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
renderBusStationsStatus( o.getResult().getSite() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
} );
|
||||
|
||||
// stationList.get( nextStation ).setIsCurrentSite( STATION_STATUS_STOPPED );
|
||||
// stationList.get( currentStationIndex ).setIsCurrentSite( STATION_STATUS_IDLE );
|
||||
// if ( mView != null ) {
|
||||
// mView.refreshBusStations( stationList, currentStationIndex, nextStation );
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 行程结束
|
||||
*/
|
||||
private void travelOver() {
|
||||
if (currentStationIndex >= stationList.size()) {
|
||||
Logger.e(TAG, "travel over index out of station list");
|
||||
if ( currentStationIndex >= stationList.size() ) {
|
||||
Logger.e( TAG, "travel over index out of station list" );
|
||||
return;
|
||||
}
|
||||
Logger.d(TAG, "单程结束====");
|
||||
Logger.d( TAG, "单程结束====" );
|
||||
MogoApisHandler.getInstance().getApis().getAdasControllerApi().cancelAutopilot();
|
||||
RequestBody request = RequestBody.create(MediaType.get("application/json"), GsonUtil.jsonFromObject(new OchBusLeaveStationRequest(Utils.getSn(), stationList.get(currentStationIndex).getSiteId())));
|
||||
MogoApisHandler.getInstance().getApis().getNetworkApi()
|
||||
.create(IOchBusApiService.class, HostConst.OCH_DOMAIN)
|
||||
.leaveStation(request).subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<BaseData>(RequestOptions.create(getContext())) {
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "感谢您体验蘑菇出行无人驾驶小巴车,请您携带好随身物品,我们下次再见" );
|
||||
RequestBody request = RequestBody.create( MediaType.get( "application/json" ), GsonUtil.jsonFromObject( new OchBusLeaveStationRequest( Utils.getSn(), stationList.get( currentStationIndex ).getSiteId() ) ) );
|
||||
mService.leaveStation( request ).subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess(BaseData o) {
|
||||
super.onSuccess(o);
|
||||
public void onSuccess( BaseData o ) {
|
||||
super.onSuccess( o );
|
||||
// 始发站改为Stoped,其他站改为Idle
|
||||
Logger.d(TAG, "单程真的结束了====");
|
||||
stationList.get(currentStationIndex).setIsCurrentSite(STATION_STATUS_IDLE);
|
||||
Logger.d( TAG, "单程真的结束了====" );
|
||||
stationList.get( currentStationIndex ).setIsCurrentSite( STATION_STATUS_IDLE );
|
||||
currentStationIndex = 0;
|
||||
stationList.get(currentStationIndex).setIsCurrentSite(STATION_STATUS_STOPED);
|
||||
if (mView != null) {
|
||||
mView.refreshBusStations(stationList);
|
||||
stationList.get( currentStationIndex ).setIsCurrentSite( STATION_STATUS_STOPPED );
|
||||
stationList.get( currentStationIndex++ ).setIsCurrentSite( STATION_STATUS_ARRIVING );
|
||||
if ( mView != null ) {
|
||||
mView.refreshBusStations( stationList, currentStationIndex, getNextStopStation() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(String message, int code) {
|
||||
super.onError(message, code);
|
||||
Logger.d(TAG, "leave station error: " + message);
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable e) {
|
||||
super.onError(e);
|
||||
Logger.e(TAG, e, "leave station exception");
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
});
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStateChanged(int state, String reason) {
|
||||
Logger.d(TAG, "onStateChange: " + state);
|
||||
switch (state) {
|
||||
public void onStateChanged( int state, String reason ) {
|
||||
Logger.d( TAG, "onStateChange: " + state );
|
||||
switch ( state ) {
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE:
|
||||
mView.onAutopilotEnableChange(true);
|
||||
mView.onAutopilotStatusChanged(false);
|
||||
if (isGoingToNextStation) {
|
||||
mView.onAutopilotEnableChange( true );
|
||||
mView.onAutopilotStatusChanged( false );
|
||||
if ( isGoingToNextStation ) {
|
||||
mView.hideSlidePanel();
|
||||
}
|
||||
break;
|
||||
case IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING:
|
||||
mView.onAutopilotStatusChanged(true);
|
||||
mView.onAutopilotStatusChanged( true );
|
||||
break;
|
||||
default:
|
||||
mView.onAutopilotEnableChange(false);
|
||||
mView.onAutopilotEnableChange( false );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg) {
|
||||
if (msg.what == MSG_REQUERY_BUS_STATION) {
|
||||
public boolean handleMessage( Message msg ) {
|
||||
if ( msg.what == MSG_QUERY_BUS_STATION ) {
|
||||
queryBusRoutes();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isWorking() {
|
||||
return mIsWorking;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改小巴运营状态
|
||||
*/
|
||||
public void onChangeOperationStatus() {
|
||||
mService.changeOperationStatus( isWorking() ? new OchBusOperationStatusRequest().shutdown() : new OchBusOperationStatusRequest().launch() )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< BaseData >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess( BaseData o ) {
|
||||
super.onSuccess( o );
|
||||
mIsWorking = !mIsWorking;
|
||||
if ( mIsWorking ) {
|
||||
if ( stationList != null && stationList.size() > 0 ) {
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "车辆已整备完毕,请前往" + stationList.get( 0 ).getSiteName() + "站点" );
|
||||
}
|
||||
}
|
||||
if ( mView != null ) {
|
||||
mView.changeOperationStatus( isWorking() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询运营状态
|
||||
*/
|
||||
public void queryOperationStatus() {
|
||||
mService.queryOperationStatus( new QueryOchBusOperationStatusRequest() )
|
||||
.subscribeOn( Schedulers.io() )
|
||||
.observeOn( AndroidSchedulers.mainThread() )
|
||||
.subscribe( new SubscribeImpl< OchBusOperationStatusResponse >( RequestOptions.create( getContext() ) ) {
|
||||
@Override
|
||||
public void onSuccess( OchBusOperationStatusResponse o ) {
|
||||
super.onSuccess( o );
|
||||
if ( o.result != null ) {
|
||||
mIsWorking = o.result.status == 1;
|
||||
}
|
||||
if ( mView != null ) {
|
||||
mView.changeOperationStatus( isWorking() );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( String message, int code ) {
|
||||
super.onError( message, code );
|
||||
Logger.d( TAG, "leave station error: " + message );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError( Throwable e ) {
|
||||
super.onError( e );
|
||||
Logger.e( TAG, e, "leave station exception" );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onBusStationsChanged( List< OchBusStation > data ) {
|
||||
renderBusStationsStatus( data );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBusOrderChanged( OchBusOrder order ) {
|
||||
if ( order == null ) {
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.isEmpty( order.getUserPhone() ) ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String tailNum = order.getUserPhone().substring( order.getUserPhone().length() - 4 );
|
||||
AIAssist.getInstance( getContext() ).speakTTSVoice( "接到新订单,尾号" + tailNum + "上车站点为" + order.getStartStation() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 323 B |
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="#2B6EFF"/>
|
||||
<corners android:radius="33px"/>
|
||||
</shape>
|
||||
@@ -3,10 +3,7 @@
|
||||
<item>
|
||||
<shape>
|
||||
<corners android:radius="17px" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#FF1C306F"
|
||||
android:startColor="#FF354E8A" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item
|
||||
@@ -16,10 +13,7 @@
|
||||
android:top="3px">
|
||||
<shape>
|
||||
<corners android:radius="17px" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#FF162552"
|
||||
android:startColor="#FF2C3B71" />
|
||||
<solid android:color="#3B4577"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,60 +1,143 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.mogo.och.bus.view.NoTouchConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="@dimen/module_mogo_och_bus_station_panel_width"
|
||||
android:layout_height="wrap_content"
|
||||
android:clickable="true"
|
||||
android:maxHeight="@dimen/module_mogo_och_bus_station_panel_height"
|
||||
android:background="@drawable/module_och_bus_panel_bkg">
|
||||
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="@dimen/module_och_bus_panel_width"
|
||||
android:layout_height="@dimen/module_och_bus_panel_height"
|
||||
android:background="@drawable/module_och_bus_panel_bkg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_mogo_och_bus_current_station_name"
|
||||
android:id="@+id/module_och_bus_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/module_mogo_och_bus_station_panel_guide_offset_left"
|
||||
android:layout_marginTop="@dimen/module_mogo_och_bus_station_panel_padding_top"
|
||||
android:text="顺义政府站"
|
||||
android:textColor="@color/module_mogo_och_bus_current_station_name_text_color"
|
||||
android:textSize="@dimen/module_mogo_och_bus_current_station_name_text_size"
|
||||
app:layout_constraintLeft_toLeftOf="@id/vGuide"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginTop="16px"
|
||||
android:layout_marginRight="16px"
|
||||
android:background="@drawable/module_och_bus_panel_anchor_bkg"
|
||||
android:paddingLeft="8px"
|
||||
android:paddingTop="1px"
|
||||
android:paddingRight="8px"
|
||||
android:paddingBottom="1px"
|
||||
android:text="小巴车"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="16px"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<View
|
||||
android:id="@+id/vGuide"
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:id="@+id/module_och_bus_order_status_stationInfo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1px"
|
||||
android:layout_marginStart="@dimen/module_mogo_och_bus_station_panel_padding_left"
|
||||
android:layout_marginTop="@dimen/module_mogo_och_bus_station_panel_guide_offset_top"
|
||||
android:layout_marginEnd="@dimen/module_mogo_och_bus_station_panel_padding_right"
|
||||
android:background="#FF151B37"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_bus_current_station_name" />
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/module_och_bus_order_status_stationInfo_paddingLeft"
|
||||
android:paddingTop="@dimen/module_och_bus_order_status_stationInfo_paddingTop"
|
||||
android:paddingRight="@dimen/module_och_bus_order_status_stationInfo_paddingRight"
|
||||
android:paddingBottom="@dimen/module_och_bus_order_status_stationInfo_paddingBottom">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_mogo_och_bus_current_station_notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/module_mogo_och_bus_station_panel_guide_offset_right"
|
||||
android:text="站点信息"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/module_mogo_och_bus_station_notice_text_size"
|
||||
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_bus_current_station_name"
|
||||
app:layout_constraintRight_toRightOf="@id/vGuide"
|
||||
app:layout_constraintTop_toTopOf="@id/module_mogo_och_bus_current_station_name" />
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_current_station_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="14px"
|
||||
android:text="当前站点:"
|
||||
android:textColor="#8E9DD4"
|
||||
android:textSize="20px"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toRightOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/module_mogo_och_bus_rv_station_list"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginStart="@dimen/module_mogo_och_bus_station_panel_guide_offset_left"
|
||||
android:layout_marginTop="@dimen/module_mogo_och_bus_station_panel_guide_offset_top"
|
||||
android:layout_marginEnd="@dimen/module_mogo_och_bus_station_panel_guide_offset_right"
|
||||
android:layout_marginBottom="@dimen/module_mogo_och_bus_station_panel_padding_bottom"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="@id/vGuide"
|
||||
app:layout_constraintRight_toRightOf="@id/vGuide"
|
||||
app:layout_constraintTop_toBottomOf="@id/vGuide" />
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_current_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="6px"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="26px"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station_anchor"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station_anchor"
|
||||
tools:text="后路站" />
|
||||
|
||||
</com.mogo.och.bus.view.NoTouchConstraintLayout>
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_start_station_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="始"
|
||||
android:textColor="#8E9DD4"
|
||||
android:textSize="20px"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_next_station_anchor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="27px"
|
||||
android:text="下一站:"
|
||||
android:textColor="#8E9DD4"
|
||||
android:textSize="20px"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_current_station"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_current_station" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_order_end_station"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="#FFF"
|
||||
android:textSize="@dimen/module_och_bus_order_start_station_textSize"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_och_bus_next_station_anchor"
|
||||
app:layout_constraintTop_toBottomOf="@+id/module_och_bus_next_station_anchor"
|
||||
tools:text="后路站1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_och_bus_end_station_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="终"
|
||||
android:textColor="#8E9DD4"
|
||||
android:textSize="20px"
|
||||
android:textStyle="bold"
|
||||
android:visibility="invisible"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/greenDot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="14px"
|
||||
android:src="@drawable/module_mogo_och_bus_icon_arrived_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_current_station"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_current_station" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/dotLine"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_och_bus_dot_line"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
|
||||
app:layout_constraintRight_toRightOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toBottomOf="@+id/greenDot" />
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/blueDot"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/module_mogo_och_bus_icon_arriving_station"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_och_bus_order_end_station"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/greenDot"
|
||||
app:layout_constraintTop_toTopOf="@+id/module_och_bus_order_end_station" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- 本套资源适配分体机xhdpi -->
|
||||
<dimen name="module_mogo_och_bus_station_panel_width">464px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_width">300px</dimen>
|
||||
<dimen name="module_mogo_och_bus_station_panel_height">348px</dimen>
|
||||
<dimen name="module_mogo_och_bus_two_station_panel_height">211px</dimen>
|
||||
<dimen name="module_mogo_och_bus_three_station_panel_height">276px</dimen>
|
||||
@@ -29,4 +29,29 @@
|
||||
<dimen name="module_mogo_och_bus_station_panel_guide_offset_bottom">17px</dimen>
|
||||
|
||||
|
||||
<dimen name="module_och_bus_panel_width">300px</dimen>
|
||||
<dimen name="module_och_bus_panel_height">270px</dimen>
|
||||
<dimen name="module_och_bus_order_status_marginLeft">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_marginTop">24px</dimen>
|
||||
<dimen name="module_och_bus_order_status_textSize">24px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_height">1px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_marginLeft">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_marginTop">23px</dimen>
|
||||
<dimen name="module_och_bus_order_status_divider_marginRight">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_height">146px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingLeft">20px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingTop">23px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingRight">30px</dimen>
|
||||
<dimen name="module_och_bus_order_status_stationInfo_paddingBottom">23px</dimen>
|
||||
<dimen name="module_och_bus_order_start_station_textSize">26px</dimen>
|
||||
<dimen name="module_och_bus_order_start_station_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_bus_order_end_station_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_container_height">80px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_container_marginLeft">3px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_anchor_marginLeft">27px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_anchor_textSize">20px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_textSize">28px</dimen>
|
||||
<dimen name="module_och_bus_order_distance_marginRight">27px</dimen>
|
||||
|
||||
|
||||
</resources>
|
||||
@@ -35,6 +35,7 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
private View tvNoticeContainer;
|
||||
private TextView tvNotice;
|
||||
private CheckedTextView ctvAutopilotStatus;
|
||||
protected TextView tvOperationStatus;
|
||||
private FrameLayout flStationPanelContainer;
|
||||
|
||||
private FrameAnimImageView fivNoticeHead;
|
||||
@@ -60,6 +61,8 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
|
||||
fivNoticeHead = findViewById(R.id.module_mogo_och_notice_head);
|
||||
|
||||
tvOperationStatus = findViewById( R.id.module_mogo_och_operation_status );
|
||||
|
||||
panelView = LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
|
||||
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
|
||||
fivNoticeHead.setAnimRes(sHappy1);
|
||||
@@ -68,8 +71,6 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
// 如果能自动驾驶,就自动驾驶,不能就提示
|
||||
// if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_ENABLE) {
|
||||
// }
|
||||
restartAutopilot();
|
||||
}
|
||||
});
|
||||
@@ -86,6 +87,14 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
findViewById(R.id.btnAutopilotRunning).setOnClickListener(view -> MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockOchStatus(IMogoAdasOCHCallback.STATUS_AUTOPILOT_RUNNING, "Running"));
|
||||
|
||||
findViewById(R.id.btnAutopilotArrive).setOnClickListener(view -> MogoApisHandler.getInstance().getApis().getAdasControllerApi().mockOchStatus(-1, "Running"));
|
||||
|
||||
tvOperationStatus.setOnClickListener( view -> {
|
||||
onChangeOperationStatus();
|
||||
} );
|
||||
}
|
||||
|
||||
protected void onChangeOperationStatus(){
|
||||
|
||||
}
|
||||
|
||||
private void checkCallView(boolean isShown) {
|
||||
@@ -102,9 +111,6 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
public void showSlidePanle(String text) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
slidePanelView.setText(text);
|
||||
if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE) {
|
||||
return;
|
||||
}
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
});
|
||||
}
|
||||
@@ -118,9 +124,6 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
public void showNotice(String notice) {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
tvNotice.setText(notice);
|
||||
if (MogoApisHandler.getInstance().getApis().getAdasControllerApi().getAutopilotStatus() == IMogoAdasOCHCallback.STATUS_AUTOPILOT_DISABLE) {
|
||||
return;
|
||||
}
|
||||
AIAssist.getInstance(getContext()).speakTTSVoice(notice);
|
||||
tvNoticeContainer.setVisibility(View.VISIBLE);
|
||||
fivNoticeHead.setVisibility(View.VISIBLE);
|
||||
@@ -149,8 +152,8 @@ public abstract class BaseOchFragment<V extends IView, P extends Presenter<V>> e
|
||||
|
||||
public void hideAutopilotBiz() {
|
||||
getActivity().runOnUiThread(() -> {
|
||||
ctvAutopilotStatus.setVisibility(View.GONE);
|
||||
slidePanelView.setVisibility(View.GONE);
|
||||
// ctvAutopilotStatus.setVisibility(View.GONE);
|
||||
// slidePanelView.setVisibility(View.GONE);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/module_mogo_och_autopilot_status_bg_corner" />
|
||||
<corners
|
||||
android:bottomLeftRadius="20px"
|
||||
android:bottomRightRadius="45px"
|
||||
android:topLeftRadius="45px"
|
||||
android:topRightRadius="20px" />
|
||||
<gradient
|
||||
android:startColor="#FF405591"
|
||||
android:angle="315"
|
||||
android:endColor="#FF28376B"
|
||||
android:angle="315"/>
|
||||
android:startColor="#FF405591" />
|
||||
|
||||
</shape>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="@dimen/module_mogo_och_autopilot_status_bg_corner" />
|
||||
<gradient
|
||||
android:startColor="#FF405591"
|
||||
android:endColor="#FF28376B"
|
||||
android:angle="315"/>
|
||||
|
||||
</shape>
|
||||
@@ -1,34 +1,53 @@
|
||||
<?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"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:paddingStart="@dimen/module_mogo_och_margin_left"
|
||||
android:paddingTop="@dimen/module_mogo_och_margin_top"
|
||||
android:paddingEnd="@dimen/module_mogo_och_margin_right"
|
||||
android:paddingBottom="@dimen/module_mogo_och_margin_bottom">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_mogo_och_station_panel_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/module_mogo_och_autopilot_status"
|
||||
android:layout_width="@dimen/module_mogo_och_autopilot_status_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_och_autopilot_status_bg_height"
|
||||
android:layout_marginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call"
|
||||
android:background="@drawable/module_mogo_och_autopilot_status_bg"
|
||||
android:drawableTop="@drawable/module_mogo_och_base_autopilot_status_icon_selector"
|
||||
android:drawableLeft="@drawable/module_mogo_och_base_autopilot_status_icon_selector"
|
||||
android:gravity="center"
|
||||
android:paddingLeft="35px"
|
||||
android:text="自动驾驶"
|
||||
android:textAlignment="center"
|
||||
android:paddingTop="@dimen/module_mogo_och_autopilot_status_text_padding_top"
|
||||
android:text="自动"
|
||||
android:textColor="@color/module_mogo_och_autopilot_text_color_selector"
|
||||
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_mogo_och_station_panel_container"
|
||||
android:layout_width="300px"
|
||||
android:layout_height="270px"
|
||||
android:layout_marginTop="10px"
|
||||
app:layout_constraintLeft_toLeftOf="@+id/module_mogo_och_autopilot_status"
|
||||
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status"
|
||||
app:layout_goneMarginTop="@dimen/module_mogo_och_station_panel_container_margin_top_no_call" />
|
||||
|
||||
<CheckedTextView
|
||||
android:id="@+id/module_mogo_och_operation_status"
|
||||
android:layout_width="@dimen/module_mogo_och_operation_status_bg_width"
|
||||
android:layout_height="@dimen/module_mogo_och_operation_status_bg_height"
|
||||
android:layout_marginBottom="10px"
|
||||
android:background="@drawable/module_mogo_och_operation_status_bg"
|
||||
android:gravity="center"
|
||||
android:text="开启"
|
||||
android:textAlignment="center"
|
||||
android:textColor="@color/module_mogo_och_autopilot_text_color_selector"
|
||||
android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
@@ -43,84 +62,86 @@
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_mogo_och_notice_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_mogo_och_base_notice_box_bg"
|
||||
android:visibility="gone"
|
||||
tools:visibility = "visible"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:background="@drawable/module_mogo_och_base_notice_box_bg"
|
||||
android:layout_height="wrap_content">
|
||||
tools:visibility="visible">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_mogo_och_notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:lineSpacingExtra="5px"
|
||||
android:maxWidth="@dimen/module_mogo_och_notice_text_max_width"
|
||||
android:text="请携带好随身物品\n注意侧后方来车\n感谢体验蘑菇智行自动驾驶车!"
|
||||
android:textColor="#fff"
|
||||
android:textSize="@dimen/module_mogo_och_notice_text_size"
|
||||
android:textStyle="bold"
|
||||
android:lineSpacingExtra="5px" />
|
||||
android:textStyle="bold" />
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<com.mogo.och.view.FrameAnimImageView
|
||||
android:id="@+id/module_mogo_och_notice_head"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/module_mogo_och_notice_head"
|
||||
android:layout_marginTop="185px"
|
||||
android:src="@drawable/ic_happy1_00000"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="185px"
|
||||
app:layout_constraintRight_toRightOf="@id/module_mogo_och_notice_container"
|
||||
app:layout_constraintTop_toTopOf="@id/module_mogo_och_notice_container"/>
|
||||
app:layout_constraintTop_toTopOf="@id/module_mogo_och_notice_container" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btnAutopilotDisable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#f00"
|
||||
android:text="Disable"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:textSize="30sp"
|
||||
android:background="#f00" />
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btnAutopilotEnable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#0f0"
|
||||
android:text="Enable"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotDisable"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:textSize="30sp"
|
||||
android:background="#0f0" />
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotDisable" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btnAutopilotRunning"
|
||||
android:text="Running"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotEnable"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:textSize="30sp"
|
||||
android:background="#00f" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/btnAutopilotArrive"
|
||||
android:text="Arrived"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:background="#00f"
|
||||
android:text="Running"
|
||||
android:textSize="30sp"
|
||||
android:background="#f00" />
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotEnable" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAutopilotArrive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#f00"
|
||||
android:text="Arrived"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable,btnAutopilotRunning"
|
||||
android:visibility="gone" />
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable,btnAutopilotRunning" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="module_mogo_och_autopilot_text_color_normal">#B2FFFFFF</color>
|
||||
<color name="module_mogo_och_autopilot_text_color_normal">#FFFFFF</color>
|
||||
<color name="module_mogo_och_autopilot_text_color_checked">#FF52BBFF</color>
|
||||
</resources>
|
||||
@@ -6,14 +6,16 @@
|
||||
<dimen name="module_mogo_och_margin_bottom">40px</dimen>
|
||||
<dimen name="module_mogo_och_margin_top">24px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_station_panel_container_margin_top_no_call">346px</dimen>
|
||||
<dimen name="module_mogo_och_station_panel_container_margin_top_no_call">400px</dimen>
|
||||
<dimen name="module_mogo_och_station_panel_container_margin_top_with_call">492px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_status_bg_corner">24px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_bg_width">120px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_bg_height">120px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_bg_width">300px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_bg_height">100px</dimen>
|
||||
<dimen name="module_mogo_och_operation_status_bg_width">108px</dimen>
|
||||
<dimen name="module_mogo_och_operation_status_bg_height">108px</dimen>
|
||||
|
||||
<dimen name="module_mogo_och_autopilot_status_text_size">20px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_text_size">30px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_text_padding_top">13px</dimen>
|
||||
<dimen name="module_mogo_och_autopilot_status_text_drawable_padding">12px</dimen>
|
||||
|
||||
|
||||
@@ -105,6 +105,8 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
|
||||
// 小地图模块
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SMALL_MAP, "IMogoSmallMapProvider" ) );
|
||||
//前方碰撞预警
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_V2X_FRONT_CRASH_WARNING, "IV2XManagerProvider" ) );
|
||||
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_GLOBAL_UNWAKE, "GlobalUnwake" ) );
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ dependencies {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.4.2'
|
||||
implementation 'com.zhidaoauto.machine:map:1.0.0-vr-8.4.6'
|
||||
// implementation 'com.zhidaoauto.machine:map:1.0.0-vr-test-3.4'
|
||||
}
|
||||
|
||||
|
||||
@@ -1002,7 +1002,6 @@ public class AMapViewWrapper implements IMogoMapView,
|
||||
}
|
||||
if (data == null) {
|
||||
Logger.d(TAG, "停止使用rtk定位数据");
|
||||
mMapView.getLocationClient().stopAutoPilotRTK();
|
||||
return;
|
||||
}
|
||||
double lon = data.optDouble("lon", -1);
|
||||
|
||||
@@ -43,9 +43,11 @@ dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
api rootProject.ext.dependencies.modulemain
|
||||
implementation rootProject.ext.dependencies.mogooch
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
} else {
|
||||
api project(":modules:mogo-module-main")
|
||||
implementation project(":OCH:mogo-och")
|
||||
implementation project(':modules:mogo-module-service')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,10 +2,13 @@ package com.zhidao.mogo.module.main.launcher;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
@@ -13,26 +16,42 @@ import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.och.IMogoOCH;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.service.v2x.IV2XListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_BOTTOM;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_LEFT;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_RIGHT;
|
||||
import static com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP;
|
||||
|
||||
/**
|
||||
* 针对作为Launcher的情况,做个性化操作
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMogoStatusChangedListener {
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMogoStatusChangedListener, IV2XListener {
|
||||
private static final String TAG = "MainLauncherActivity";
|
||||
protected boolean mIsHomeKeyDown = false;
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
private static final int COUNT_DOWN_TIMER = 1_000;
|
||||
private static final int ALL_EXPIRE_TIMER = 3_000;
|
||||
private static int EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
DebugConfig.setNeedRequestUserInfo( true );
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
DebugConfig.setNeedRequestUserInfo(true);
|
||||
Log.d(TAG, "onCreate");
|
||||
mServiceApis.getV2XListenerManager().registerIntentListener(MogoReceiver.ACTION_V2X_FRONT_WARNING, this);
|
||||
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG,
|
||||
StatusDescriptor.VR_MODE, this);
|
||||
}
|
||||
@@ -43,10 +62,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
// 显示左边遮罩
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
}else {
|
||||
} else {
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
MogoModulesManager.getInstance().loadAppsListModule( com.mogo.module.main.R.id.module_main_id_apps_fragment_container );
|
||||
MogoModulesManager.getInstance().loadAppsListModule(com.mogo.module.main.R.id.module_main_id_apps_fragment_container);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,21 +76,21 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void hideLayout() {
|
||||
super.hideLayout();
|
||||
mApps.setVisibility( View.GONE );
|
||||
mLeftShadowFrame.setVisibility( View.GONE );
|
||||
mApps.setVisibility(View.GONE);
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showLayout() {
|
||||
super.showLayout();
|
||||
mApps.setVisibility( View.VISIBLE );
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
mApps.setVisibility(View.VISIBLE);
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
getApis().getIntentManagerApi().registerIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
|
||||
getApis().getIntentManagerApi().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,13 +102,13 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getApis().getIntentManagerApi().unregisterIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
|
||||
getApis().getIntentManagerApi().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
if ( TextUtils.equals( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentStr ) ) {
|
||||
mIsHomeKeyDown = intent.getBooleanExtra( "isHomeKeyDown", true );
|
||||
public void onIntentReceived(String intentStr, Intent intent) {
|
||||
if (TextUtils.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentStr)) {
|
||||
mIsHomeKeyDown = intent.getBooleanExtra("isHomeKeyDown", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,10 +126,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
/**
|
||||
* 加载网约车模块
|
||||
*/
|
||||
private void loadOCHModule(){
|
||||
IMogoOCH och = ARouter.getInstance().navigation( IMogoOCH.class );
|
||||
if ( och != null ) {
|
||||
och.init( this, R.id.module_main_id_och_fragment );
|
||||
private void loadOCHModule() {
|
||||
IMogoOCH och = ARouter.getInstance().navigation(IMogoOCH.class);
|
||||
if (och != null) {
|
||||
och.init(this, R.id.module_main_id_och_fragment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,40 +138,108 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
super.onDestroy();
|
||||
mServiceApis.getStatusManagerApi().unregisterStatusChangedListener(TAG,
|
||||
StatusDescriptor.VR_MODE, this);
|
||||
mServiceApis.getV2XListenerManager().unregisterIntentListener(TAG, this);
|
||||
stopCountDown();
|
||||
try {
|
||||
// acc off 之后会出现进程还在,但是页面被杀的情况,这个直接杀掉进程,然后让整个进程重启
|
||||
Process.killProcess( Process.myPid() );
|
||||
} catch ( Exception e ) {
|
||||
Process.killProcess(Process.myPid());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged( EnumMapUI mapUI ) {
|
||||
super.onMapUiModeChanged( mapUI );
|
||||
Intent intent = new Intent( "com.mogo.style.SKIN_CHANGED" );
|
||||
intent.putExtra( "type", -1 );
|
||||
if ( mapUI == EnumMapUI.Type_Light ) {
|
||||
intent.putExtra( "type", 1 );
|
||||
} else if( mapUI == EnumMapUI.Type_Night ){
|
||||
intent.putExtra( "type", 0 );
|
||||
public void onMapUiModeChanged(EnumMapUI mapUI) {
|
||||
super.onMapUiModeChanged(mapUI);
|
||||
Intent intent = new Intent("com.mogo.style.SKIN_CHANGED");
|
||||
intent.putExtra("type", -1);
|
||||
if (mapUI == EnumMapUI.Type_Light) {
|
||||
intent.putExtra("type", 1);
|
||||
} else if (mapUI == EnumMapUI.Type_Night) {
|
||||
intent.putExtra("type", 0);
|
||||
}
|
||||
sendBroadcast( intent );
|
||||
Logger.d( TAG, "send msg to AI Voice" );
|
||||
sendBroadcast(intent);
|
||||
Logger.d(TAG, "send msg to AI Voice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() );
|
||||
FrameLayout.LayoutParams entranceParams = ((FrameLayout.LayoutParams) mEntrance.getLayoutParams());
|
||||
if (isTrue) {
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode );
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode);
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
mApps.setVisibility(View.GONE);
|
||||
}else{
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_id_entrance_fragment_container_marginLeft );
|
||||
} else {
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_id_entrance_fragment_container_marginLeft);
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
mApps.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mEntrance.setLayoutParams( entranceParams );
|
||||
mEntrance.setLayoutParams(entranceParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warningChangedWithDirection(int type) {
|
||||
Log.d(TAG, "显示红色预警蒙层");
|
||||
switch (type) {
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_TOP:
|
||||
mWarningTop.setVisibility(View.VISIBLE);
|
||||
mWarningLeft.setVisibility(View.GONE);
|
||||
mWarningRight.setVisibility(View.GONE);
|
||||
mWarningBottom.setVisibility(View.GONE);
|
||||
startCountDownWithView(mWarningTop);
|
||||
break;
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_LEFT:
|
||||
mWarningLeft.setVisibility(View.VISIBLE);
|
||||
mWarningTop.setVisibility(View.GONE);
|
||||
mWarningRight.setVisibility(View.GONE);
|
||||
mWarningBottom.setVisibility(View.GONE);
|
||||
startCountDownWithView(mWarningLeft);
|
||||
break;
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_RIGHT:
|
||||
mWarningRight.setVisibility(View.VISIBLE);
|
||||
mWarningTop.setVisibility(View.GONE);
|
||||
mWarningLeft.setVisibility(View.GONE);
|
||||
mWarningBottom.setVisibility(View.GONE);
|
||||
startCountDownWithView(mWarningRight);
|
||||
break;
|
||||
case ALERT_THE_FRONT_CRASH_WARNING_BOTTOM:
|
||||
mWarningBottom.setVisibility(View.VISIBLE);
|
||||
mWarningRight.setVisibility(View.GONE);
|
||||
mWarningTop.setVisibility(View.GONE);
|
||||
mWarningLeft.setVisibility(View.GONE);
|
||||
startCountDownWithView(mWarningBottom);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 预警蒙层显示时间为3秒
|
||||
* */
|
||||
private void startCountDownWithView(ImageView view) {
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER;
|
||||
Logger.d(TAG, "当前蒙层显示时间为 :" + EXPIRE_TIMER / COUNT_DOWN_TIMER + " 秒");
|
||||
if (EXPIRE_TIMER > 0) {
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
} else {
|
||||
view.setVisibility(View.GONE);
|
||||
stopCountDown();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
}
|
||||
|
||||
private void stopCountDown() {
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,11 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
marker.setRotateAngle( ( ( float ) recognizedListResult.heading ) );
|
||||
marker.setPosition( recognizedListResult.lat, recognizedListResult.lon );
|
||||
}
|
||||
marker.setAnchorColor( getModelRenderColor( recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading ) );
|
||||
String carColor = recognizedListResult.color;
|
||||
if ( TextUtils.isEmpty( carColor ) ) {
|
||||
carColor = getModelRenderColor( recognizedListResult.type, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading );
|
||||
}
|
||||
marker.setAnchorColor( carColor );
|
||||
|
||||
if ( shouldShowSpeed( recognizedListResult.type ) ) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
@@ -243,12 +247,17 @@ class AdasRecognizedResultDrawer extends BaseDrawer {
|
||||
String resIdVal = null;
|
||||
int resId = getModelRes( recognizedListResult.type );
|
||||
resIdVal = resId + "";
|
||||
|
||||
String carColor = recognizedListResult.color;
|
||||
if ( TextUtils.isEmpty( carColor ) ) {
|
||||
carColor = getModelRenderColor( recognizedListResult.type, recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading );
|
||||
}
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.owner( DataTypes.TYPE_MARKER_ADAS )
|
||||
.anchor( 0.5f, 0.5f )
|
||||
.set3DMode( true )
|
||||
.gps( true )
|
||||
.anchorColor( getModelRenderColor( recognizedListResult.speed, recognizedListResult.lon, recognizedListResult.lat, recognizedListResult.heading ) )
|
||||
.anchorColor( carColor )
|
||||
.controlAngle( true )
|
||||
.resName( mMarkerCachesResMd5Values.get( resIdVal ) )
|
||||
.icon3DRes( resId )
|
||||
|
||||
@@ -10,24 +10,17 @@ import android.util.Log;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.cloud.commons.utils.CoordinateUtils;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.R;
|
||||
import com.mogo.module.common.constants.AdasRecognizedType;
|
||||
import com.mogo.module.common.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@@ -226,15 +219,16 @@ class BaseDrawer {
|
||||
/**
|
||||
* 获取3D锚点模型资源
|
||||
*
|
||||
* @param type
|
||||
* @param type {@link AdasRecognizedType}
|
||||
* @return
|
||||
*/
|
||||
public int getModelRes( int type ) {
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
|
||||
if ( recognizedType == AdasRecognizedType.classIdCar
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficBus
|
||||
|| recognizedType == AdasRecognizedType.classIdTrafficTruck ) {
|
||||
return R.raw.othercar2;
|
||||
return R.raw.othercar;
|
||||
} else if ( recognizedType == AdasRecognizedType.classIdTrafficBus ) {
|
||||
return R.raw.bus;
|
||||
} else if ( recognizedType == AdasRecognizedType.classIdBicycle
|
||||
|| recognizedType == AdasRecognizedType.classIdMoto ) {
|
||||
return R.raw.motorbike;
|
||||
@@ -250,29 +244,33 @@ class BaseDrawer {
|
||||
* @param lat 纬度
|
||||
* @return 实际车辆颜色
|
||||
*/
|
||||
protected String getModelRenderColor( double speed, double lon, double lat, double angle ) {
|
||||
protected String getModelRenderColor( int type, double speed, double lon, double lat, double angle ) {
|
||||
|
||||
// 距离策略
|
||||
double coordinates[] = getCurCoordinates();
|
||||
double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100;
|
||||
if ( distance < 50 ) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
} else if ( distance < 100 && distance >= 50 ) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
AdasRecognizedType recognizedType = AdasRecognizedType.valueFrom( type );
|
||||
if ( recognizedType == AdasRecognizedType.classIdTrafficBus ) {
|
||||
return "#D8D8D8FF";
|
||||
}
|
||||
// 距离策略
|
||||
// double coordinates[] = getCurCoordinates();
|
||||
// double distance = CoordinateUtils.calculateLineDistance( lon, lat, coordinates[0], coordinates[1] ) * 100;
|
||||
// if ( distance < 50 ) {
|
||||
// return Car3DModelColor.Dangerous.color;
|
||||
// } else if ( distance < 100 && distance >= 50 ) {
|
||||
// return Car3DModelColor.Warming.color;
|
||||
// }
|
||||
|
||||
// 他车车速和自车车速对比速度策略
|
||||
// 自车速度 >= 50% 危险
|
||||
// 10% < 自车速度 < 50% 警告
|
||||
double curSpeed = getCurSpeed();
|
||||
if ( curSpeed > 0 && speed > curSpeed ) {
|
||||
double rate = ( ( speed - curSpeed ) / curSpeed ) * 100;
|
||||
if ( rate >= 50 ) {
|
||||
return Car3DModelColor.Dangerous.color;
|
||||
} else if ( rate > 10 && rate < 50 ) {
|
||||
return Car3DModelColor.Warming.color;
|
||||
}
|
||||
}
|
||||
// double curSpeed = getCurSpeed();
|
||||
// if ( curSpeed > 0 && speed > curSpeed ) {
|
||||
// double rate = ( ( speed - curSpeed ) / curSpeed ) * 100;
|
||||
// if ( rate >= 50 ) {
|
||||
// return Car3DModelColor.Dangerous.color;
|
||||
// } else if ( rate > 10 && rate < 50 ) {
|
||||
// return Car3DModelColor.Warming.color;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 默认颜色
|
||||
return Car3DModelColor.Normal.color;
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
package com.mogo.module.common.drawer;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.constants.DataTypes;
|
||||
import com.mogo.module.common.drawer.marker.MapVrMarkerView;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
@@ -20,11 +9,10 @@ import java.util.List;
|
||||
*/
|
||||
public class PushRoadConditionDrawer {
|
||||
|
||||
private static final String TAG = "OnlineCarDrawer";
|
||||
private static final String TAG = "PushRoadConditionDrawer";
|
||||
private static volatile PushRoadConditionDrawer sInstance;
|
||||
|
||||
private static IMogoPolyline mMogoPolyline;
|
||||
private static IMogoMarker mMogoMarker;
|
||||
|
||||
private PushRoadConditionDrawer() {
|
||||
}
|
||||
@@ -41,57 +29,11 @@ public class PushRoadConditionDrawer {
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
clearMarker();
|
||||
clearPolyline();
|
||||
mMogoPolyline = null;
|
||||
mMogoMarker = null;
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绘制路况事件Marker移动轨迹
|
||||
*/
|
||||
public void drawRoadConditionMarker(V2XPushMessageEntity entity) {
|
||||
// 道路事件
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.object(entity)
|
||||
.latitude(entity.getLat())
|
||||
.longitude(entity.getLon());
|
||||
options.anchor(0.5f, 0.5f);
|
||||
|
||||
options.icon(MapVrMarkerView.getInstance().getBitmap(entity.getSceneId()));
|
||||
|
||||
mMogoMarker =
|
||||
MogoApisHandler
|
||||
.getInstance()
|
||||
.getApis()
|
||||
.getMapServiceApi()
|
||||
.getMarkerManager(AbsMogoApplication.getApp())
|
||||
.addMarker(DataTypes.TYPE_MARKER_PUSH_DATA, options);
|
||||
|
||||
List<MogoLatLng> points = new ArrayList<>();
|
||||
|
||||
for (double[] doubles : entity.getMoveTrack()) {
|
||||
points.add(new MogoLatLng(doubles[1], doubles[0]));
|
||||
}
|
||||
|
||||
mMogoMarker.startSmooth(points, 10);
|
||||
}
|
||||
|
||||
|
||||
public void clearMarker() {
|
||||
if (mMogoMarker != null) {
|
||||
mMogoMarker.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearPolyline() {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
|
||||
@@ -290,7 +290,8 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
marker.setPosition( cloudRoadData.getWgslat(), cloudRoadData.getWgslon() );
|
||||
}
|
||||
|
||||
marker.setAnchorColor( getModelRenderColor( cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading() ) );
|
||||
// TODO: 2021/3/23 后端算法提供显示颜色
|
||||
marker.setAnchorColor( getModelRenderColor( cloudRoadData.getType(), cloudRoadData.getSpeed(), cloudRoadData.getWgslon(), cloudRoadData.getWgslat(), cloudRoadData.getHeading() ) );
|
||||
|
||||
if ( shouldShowSpeed( cloudRoadData.getType() ) ) {
|
||||
Message msg = mRenderThreadHandler.obtainMessage();
|
||||
@@ -370,7 +371,8 @@ public class SnapshotSetDataDrawer extends BaseDrawer implements IMogoMarkerClic
|
||||
String resIdVal = null;
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
options.set3DMode( true );
|
||||
options.anchorColor( getModelRenderColor( data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
|
||||
// TODO: 2021/3/23 后端算法提供显示颜色
|
||||
options.anchorColor( getModelRenderColor( data.getType(), data.getSpeed(), data.getWgslon(), data.getWgslat(), data.getHeading() ) );
|
||||
int resId = getModelRes( data.getType() );
|
||||
resIdVal = resId + "";
|
||||
options.resName( mMarkerCachesResMd5Values.get( resIdVal ) );
|
||||
|
||||
@@ -145,6 +145,14 @@ public class V2XMessageEntity<T> implements Serializable {
|
||||
int ALERT_RECOMMEND_ROUTE = 1_011;
|
||||
// 基于预判目的地违章高发停车场推荐
|
||||
int ALERT_RECOMMEND_PARKING = 1_012;
|
||||
// 前方碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_TOP = 1_0013;
|
||||
// 左前方碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_LEFT = 1_0014;
|
||||
// 右前方碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_RIGHT = 1_0015;
|
||||
// 后方碰撞预警
|
||||
int ALERT_THE_FRONT_CRASH_WARNING_BOTTOM = 1_0016;
|
||||
// 推送VR消息展示
|
||||
int ALERT_PUSH_VR_SHOW = 2_000;
|
||||
// 自车求助
|
||||
|
||||
@@ -48,8 +48,6 @@ public class V2XPushMessageEntity implements Serializable {
|
||||
|
||||
private List<double[]> polyline;
|
||||
|
||||
private List<double[]> moveTrack;
|
||||
|
||||
private List<double[]> recommendPolyline;
|
||||
|
||||
public int getViewType() {
|
||||
@@ -283,14 +281,6 @@ public class V2XPushMessageEntity implements Serializable {
|
||||
this.polyline = polyline;
|
||||
}
|
||||
|
||||
public List<double[]> getMoveTrack() {
|
||||
return moveTrack;
|
||||
}
|
||||
|
||||
public void setMoveTrack(List<double[]> moveTrack) {
|
||||
this.moveTrack = moveTrack;
|
||||
}
|
||||
|
||||
public List<double[]> getRecommendPolyline() {
|
||||
return recommendPolyline;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,188 @@
|
||||
package com.mogo.module.common.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 预警目标物数据模型
|
||||
* @since: 2021/3/26
|
||||
*/
|
||||
public class V2XWarningEntity implements Serializable {
|
||||
|
||||
//事件类型 行人0/自行车1/摩托车2/小汽车3/公交车4
|
||||
private int type;
|
||||
//目标物位置
|
||||
private double lat;
|
||||
private double lon;
|
||||
//距离
|
||||
private double distance;
|
||||
//预测碰撞点位置
|
||||
private double collisionLat;
|
||||
private double collisionLon;
|
||||
//来源 ADAS/云端
|
||||
private int from;
|
||||
//朝向 角度
|
||||
private double angle;
|
||||
//方位 前 后 左 右
|
||||
private int direction;
|
||||
//速度
|
||||
private float speed;
|
||||
|
||||
//以下为自组字段
|
||||
//预警文案
|
||||
private String tipContent;
|
||||
//tts播报
|
||||
private String tts;
|
||||
|
||||
public void setTipContent(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
this.tipContent = "行人碰撞预警";
|
||||
break;
|
||||
case 1:
|
||||
case 3:
|
||||
case 4:
|
||||
this.tipContent = "前车碰撞预警";
|
||||
break;
|
||||
case 2:
|
||||
this.tipContent = "摩托车碰撞预警";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTts(int type) {
|
||||
switch (type) {
|
||||
case 0:
|
||||
this.tts = "注意行人";
|
||||
break;
|
||||
case 1:
|
||||
this.tts = "注意自行车";
|
||||
break;
|
||||
case 2:
|
||||
this.tts = "注意摩托车";
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
this.tts = "注意前方车辆";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public void setDistance(double distance) {
|
||||
this.distance = distance;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setCollisionLat(double collisionLat) {
|
||||
this.collisionLat = collisionLat;
|
||||
}
|
||||
|
||||
public void setCollisionLon(double collisionLon) {
|
||||
this.collisionLon = collisionLon;
|
||||
}
|
||||
|
||||
public void setFrom(int from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
public void setAngle(double angle) {
|
||||
this.angle = angle;
|
||||
}
|
||||
|
||||
public void setDirection(int direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public void setSpeed(float speed) {
|
||||
this.speed = speed;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getCollisionLat() {
|
||||
return collisionLat;
|
||||
}
|
||||
|
||||
public double getCollisionLon() {
|
||||
return collisionLon;
|
||||
}
|
||||
|
||||
public double getDistance() {
|
||||
return distance;
|
||||
}
|
||||
|
||||
public int getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
public double getAngle() {
|
||||
return angle;
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
}
|
||||
|
||||
public String getTipContent() {
|
||||
if (this.tipContent == null) {
|
||||
setTipContent(type);
|
||||
}
|
||||
return tipContent;
|
||||
}
|
||||
|
||||
public String getTts() {
|
||||
if (tts == null) {
|
||||
setTts(type);
|
||||
}
|
||||
return tts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "V2XWarningEntity{" +
|
||||
"type=" + type +
|
||||
", lat=" + lat +
|
||||
", lon=" + lon +
|
||||
", distance=" + distance +
|
||||
", collisionLat=" + collisionLat +
|
||||
", collisionLon=" + collisionLon +
|
||||
", from=" + from +
|
||||
", angle=" + angle +
|
||||
", direction=" + direction +
|
||||
", speed=" + speed +
|
||||
", tipContent='" + tipContent + '\'' +
|
||||
", tts='" + tts + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
BIN
modules/mogo-module-common/src/main/res/raw/bus.n3d
Normal file
BIN
modules/mogo-module-common/src/main/res/raw/bus.n3d
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -5,6 +5,7 @@ import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
@@ -29,6 +30,7 @@ import com.mogo.service.fragmentmanager.FragmentStackTransactionListener;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.v2x.IV2XListener;
|
||||
import com.mogo.skin.support.SkinMode;
|
||||
import com.mogo.utils.NetworkUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -64,6 +66,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
protected FrameLayout mLeftPanelLayout;
|
||||
protected View mLeftShadowFrame;
|
||||
|
||||
protected ImageView mWarningTop;
|
||||
protected ImageView mWarningLeft;
|
||||
protected ImageView mWarningRight;
|
||||
protected ImageView mWarningBottom;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
if ( !DebugConfig.isMapBased() ) {
|
||||
@@ -103,6 +110,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mLeftPanelLayout = findViewById( R.id.module_main_id_left_panel_fragment_container );
|
||||
mHistoryMessagePanel = findViewById( R.id.module_main_id_message_history_fragment_container );
|
||||
|
||||
mWarningTop = findViewById(R.id.warning_top);
|
||||
mWarningLeft = findViewById(R.id.warning_left);
|
||||
mWarningRight = findViewById(R.id.warning_right);
|
||||
mWarningBottom = findViewById(R.id.warning_bottom);
|
||||
|
||||
// 避免事件穿透导致地图被滑动
|
||||
mLeftShadowFrame.setOnClickListener( view -> {
|
||||
} );
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="90"
|
||||
android:endColor="#00F03232"
|
||||
android:startColor="#A5F03232"
|
||||
android:type="linear"></gradient>
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="0"
|
||||
android:endColor="#00F03232"
|
||||
android:startColor="#A5F03232"
|
||||
android:type="linear"></gradient>
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="180"
|
||||
android:endColor="#00F03232"
|
||||
android:startColor="#A5F03232"
|
||||
android:type="linear"></gradient>
|
||||
</shape>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#00FF0606"
|
||||
android:startColor="#8CFF0606"
|
||||
android:type="linear"></gradient>
|
||||
</shape>
|
||||
@@ -2,8 +2,8 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@color/module_main_window_background_color"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/module_main_window_background_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 地图-->
|
||||
@@ -12,6 +12,36 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/warning_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_390"
|
||||
android:background="@drawable/module_main_warning_bkg_top"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/warning_left"
|
||||
android:layout_width="@dimen/dp_390"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/module_main_warning_bkg_left"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/warning_right"
|
||||
android:layout_width="@dimen/dp_390"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/module_main_id_warning_view_marginLeft"
|
||||
android:background="@drawable/module_main_warning_bkg_right"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/warning_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_390"
|
||||
android:layout_marginTop="@dimen/dp_690"
|
||||
android:background="@drawable/module_main_warning_bkg_bottom"
|
||||
android:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_map_left_shadow_frame"
|
||||
android:layout_width="@dimen/module_main_map_left_shadow_frame_width"
|
||||
|
||||
@@ -32,4 +32,6 @@
|
||||
<dimen name="module_main_event_panel_fragment_paddingBottom">18px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingLeft">18px</dimen>
|
||||
<dimen name="module_main_event_panel_fragment_paddingRight">18px</dimen>
|
||||
|
||||
<dimen name="module_main_id_warning_view_marginLeft">1530px</dimen>
|
||||
</resources>
|
||||
150
modules/mogo-module-service/src/main/assets/LocParse.java
Normal file
150
modules/mogo-module-service/src/main/assets/LocParse.java
Normal file
@@ -0,0 +1,150 @@
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/26
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class LocParse {
|
||||
|
||||
public static void main( String[] args ) {
|
||||
new Thread( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
LocParse.run();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} ).run();
|
||||
|
||||
}
|
||||
|
||||
private static void run() throws Exception {
|
||||
InputStreamReader isr = new InputStreamReader( new FileInputStream( "loc.csv" ) );
|
||||
BufferedReader br = new BufferedReader( isr );
|
||||
File loc = new File( "loc.txt" );
|
||||
if ( loc.exists() ) {
|
||||
loc.delete();
|
||||
}
|
||||
loc.createNewFile();
|
||||
OutputStreamWriter locOsw = new OutputStreamWriter( new FileOutputStream( loc ) );
|
||||
BufferedWriter locWr = new BufferedWriter( locOsw );
|
||||
|
||||
final int adasRecAmount = 10;
|
||||
final int intervalLineAmount = 50;
|
||||
|
||||
BufferedWriter writers[] = new BufferedWriter[adasRecAmount];
|
||||
|
||||
for ( int i = 0; i < adasRecAmount; i++ ) {
|
||||
File file = new File( "adas" + i + ".txt" );
|
||||
if ( file.exists() ) {
|
||||
file.delete();
|
||||
}
|
||||
file.createNewFile();
|
||||
OutputStreamWriter osw = new OutputStreamWriter( new FileOutputStream( file ) );
|
||||
writers[i] = new BufferedWriter( osw );
|
||||
}
|
||||
|
||||
String line = null;
|
||||
final int pLon = 1;
|
||||
final int pLat = 2;
|
||||
final int pAlt = 3;
|
||||
final int pHeading = 4;
|
||||
final int pSpeed = 6;
|
||||
final int pDistance = 7;
|
||||
final int pReceiverDataTime = 8;
|
||||
final int pAdasSatelliteTime = 9;
|
||||
final int pSystemTime = 10;
|
||||
final int pSatelliteTime = 11;
|
||||
|
||||
int counter = 0;
|
||||
while ( ( line = br.readLine() ) != null ) {
|
||||
line = line.replace( " ", "" );
|
||||
String seg[] = line.split( "," );
|
||||
|
||||
double lon = Double.parseDouble( seg[pLon] );
|
||||
double lat = Double.parseDouble( seg[pLat] );
|
||||
double alt = Double.parseDouble( seg[pAlt] );
|
||||
double heading = Double.parseDouble( seg[pHeading] );
|
||||
double speed = Double.parseDouble( seg[pSpeed] );
|
||||
double distance = Double.parseDouble( seg[pDistance] );
|
||||
long receiverDataTime = Long.parseLong( seg[pReceiverDataTime] );
|
||||
long adasSatelliteTime = Long.parseLong( seg[pAdasSatelliteTime] );
|
||||
long systemTime = Long.parseLong( seg[pSystemTime] );
|
||||
long satelliteTime = Long.parseLong( seg[pSatelliteTime] );
|
||||
|
||||
// 定位
|
||||
StringBuilder locJson = new StringBuilder( "{" );
|
||||
locJson.append( "\"lon\":" + lon );
|
||||
locJson.append( ",\"lat\":" + lat );
|
||||
locJson.append( ",\"alt\":" + alt );
|
||||
locJson.append( ",\"heading\":" + heading );
|
||||
locJson.append( ",\"speed\":" + speed );
|
||||
locJson.append( ",\"systemTime\":" + systemTime );
|
||||
locJson.append( ",\"receiverDataTime\":" + receiverDataTime );
|
||||
locJson.append( ",\"adasSatelliteTime\":" + adasSatelliteTime );
|
||||
locJson.append( ",\"satelliteTime\":" + satelliteTime );
|
||||
locJson.append( "}\n" );
|
||||
locWr.write( locJson.toString() );
|
||||
|
||||
int writersCount = counter++ / intervalLineAmount;
|
||||
if ( writersCount > adasRecAmount ) {
|
||||
writersCount = adasRecAmount;
|
||||
}
|
||||
for ( int i = 0; i < writersCount; i++ ) {
|
||||
|
||||
int type = 3;
|
||||
switch ( i ) {
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
case 4:
|
||||
case 6:
|
||||
type = i;
|
||||
break;
|
||||
case 0:
|
||||
case 5:
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
type = 3;
|
||||
break;
|
||||
}
|
||||
|
||||
StringBuilder adasJson = new StringBuilder( "{" );
|
||||
adasJson.append( "\"type\":" + type );
|
||||
adasJson.append( ",\"uuid\":" + "\"2_" + i + "\"" );
|
||||
adasJson.append( ",\"lon\":" + lon );
|
||||
adasJson.append( ",\"lat\":" + lat );
|
||||
adasJson.append( ",\"alt\":" + alt );
|
||||
adasJson.append( ",\"heading\":" + heading );
|
||||
adasJson.append( ",\"distance\":" + distance );
|
||||
adasJson.append( ",\"speed\":" + speed );
|
||||
adasJson.append( ",\"systemTime\":" + systemTime );
|
||||
adasJson.append( ",\"satelliteTime\":" + satelliteTime );
|
||||
adasJson.append( ",\"dataAccuracy\":" + 1 );
|
||||
adasJson.append( "}\n" );
|
||||
writers[i].write( adasJson.toString() );
|
||||
}
|
||||
// adas
|
||||
}
|
||||
|
||||
locWr.flush();
|
||||
locWr.close();
|
||||
|
||||
for ( BufferedWriter writer : writers ) {
|
||||
writer.flush();
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}
|
||||
@@ -0,0 +1 @@
|
||||
{"systemTime":1615529718585,"satelliteTime":1615529718585,"lon":116.411411222501,"lat":39.9753341630918,"alt":34.4018669128417,"heading":0.342695406938048,"speed":0.003303937,"type":3,"uuid":"2_1"}
|
||||
15415
modules/mogo-module-service/src/main/assets/loc.csv
Normal file
15415
modules/mogo-module-service/src/main/assets/loc.csv
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -26,6 +26,7 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.service.module.IMogoActionManager;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
import com.mogo.service.v2x.IV2XProvider;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
@@ -59,6 +60,8 @@ public class MarkerServiceHandler {
|
||||
private static IMogoLauncher sLauncher;
|
||||
private static IMogoFragmentManager sFragmentManager;
|
||||
private static ICarsChattingProvider sCarChatting;
|
||||
private static IV2XProvider sIV2XProvider;
|
||||
|
||||
// private static IMogoGpsSimulatorManager sGpsSimulatorManager;
|
||||
|
||||
public static synchronized void init( final Context context ) {
|
||||
@@ -86,6 +89,7 @@ public class MarkerServiceHandler {
|
||||
sFragmentManager = sApis.getFragmentManagerApi();
|
||||
|
||||
sCarChatting = ( ICarsChattingProvider ) ARouter.getInstance().build( CallChattingProviderConstant.CAR_CALL_PROVIDER ).navigation( context );
|
||||
sIV2XProvider = sApis.getV2XListenerManager();
|
||||
|
||||
MapMarkerManager.getInstance().init( context );
|
||||
|
||||
|
||||
@@ -558,14 +558,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( GsonUtil.objectFromJson( json, MogoSnapshotSetData.class ) );
|
||||
break;
|
||||
case 47:
|
||||
// mLocationMockHandler1.sendEmptyMessageDelayed( 1, 4000L );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 2, 0 );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 21, 200 );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 3, 0L );
|
||||
|
||||
mTimeTickHandler.sendEmptyMessageDelayed( 1, 0L );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 31, 2000L );
|
||||
// mLocationMockHandler.sendEmptyMessageDelayed( 5, 0L );
|
||||
break;
|
||||
case 48:
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
@@ -629,7 +622,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
break;
|
||||
case 53:
|
||||
boolean isUseAdasRecognize = intent.getBooleanExtra( "status", false );
|
||||
DebugConfig.setUseAdasRecognize(isUseAdasRecognize);
|
||||
DebugConfig.setUseAdasRecognize( isUseAdasRecognize );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -703,17 +696,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
}
|
||||
br = null;
|
||||
}
|
||||
} else if ( msg.what == 2 ) {
|
||||
try {
|
||||
handleMockSnapshotIntent();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
br2.close();
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
br2 = null;
|
||||
}
|
||||
} else if ( msg.what == 21 ) {
|
||||
try {
|
||||
handleMockSnapshotIntent2();
|
||||
@@ -730,51 +712,15 @@ public class MockIntentHandler implements IntentHandler {
|
||||
handleMockAdasIntent();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
br3.close();
|
||||
br31.close();
|
||||
br32.close();
|
||||
br33.close();
|
||||
br34.close();
|
||||
br35.close();
|
||||
br36.close();
|
||||
br37.close();
|
||||
br38.close();
|
||||
br39.close();
|
||||
if ( readers != null ) {
|
||||
for ( BufferedReader reader : readers ) {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
br3 = null;
|
||||
br31 = null;
|
||||
br32 = null;
|
||||
br33 = null;
|
||||
br34 = null;
|
||||
br35 = null;
|
||||
br36 = null;
|
||||
br37 = null;
|
||||
br38 = null;
|
||||
br39 = null;
|
||||
}
|
||||
} else if ( msg.what == 31 ) {
|
||||
try {
|
||||
handleMockAdasIntent3();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
br31.close();
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
br31 = null;
|
||||
}
|
||||
} else if ( msg.what == 48 ) {
|
||||
try {
|
||||
handleMockLocationIntent48();
|
||||
} catch ( Exception e ) {
|
||||
try {
|
||||
br48.close();
|
||||
} catch ( IOException ex ) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
br48 = null;
|
||||
readers = null;
|
||||
}
|
||||
} else if ( msg.what == 100 ) {
|
||||
try {
|
||||
@@ -837,7 +783,7 @@ public class MockIntentHandler implements IntentHandler {
|
||||
|
||||
private boolean handleMockLocationIntent() throws Exception {
|
||||
if ( br == null ) {
|
||||
br = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "loc5.txt" ) ) );
|
||||
br = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "loc.txt" ) ) );
|
||||
}
|
||||
final long start = System.currentTimeMillis();
|
||||
String line = br.readLine();
|
||||
@@ -845,8 +791,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
throw new Exception( "end of file." );
|
||||
}
|
||||
JSONObject jo = new JSONObject( line );
|
||||
jo.put( "satelliteTime", System.currentTimeMillis() );
|
||||
jo.put( "systemTime", System.currentTimeMillis() );
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo );
|
||||
Log.i( "mock-timer-loc-map", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
SnapshotLocationController.getInstance().syncAdasLocationInfo( jo );
|
||||
@@ -854,59 +798,6 @@ public class MockIntentHandler implements IntentHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br48;
|
||||
int count = 0;
|
||||
|
||||
private boolean handleMockLocationIntent48() throws Exception {
|
||||
if ( br48 == null ) {
|
||||
br48 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "loc3.txt" ) ) );
|
||||
}
|
||||
final long start = System.currentTimeMillis();
|
||||
String line = br48.readLine();
|
||||
if ( line == null ) {
|
||||
throw new Exception( "end of file." );
|
||||
}
|
||||
JSONObject jo = new JSONObject( line );
|
||||
MarkerServiceHandler.getApis().getMapServiceApi().getMapUIController().syncLocation2Map( jo );
|
||||
Logger.i( "mock-timer-loc", "cost " + ( System.currentTimeMillis() - start ) + "ms: count=%s", ++count );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 48, 100L );
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br2;
|
||||
|
||||
private long last = 0;
|
||||
|
||||
private boolean handleMockSnapshotIntent() throws Exception {
|
||||
if ( br2 == null ) {
|
||||
br2 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas6.txt" ) ) );
|
||||
}
|
||||
String line = br2.readLine();
|
||||
if ( line == null ) {
|
||||
throw new Exception( "end of file 2." );
|
||||
}
|
||||
MogoSnapshotSetData data = new MogoSnapshotSetData();
|
||||
List< CloudRoadData > allList = new ArrayList<>();
|
||||
CloudRoadData cloudRoadData = GsonUtil.objectFromJson( line, CloudRoadData.class );
|
||||
if ( cloudRoadData == null ) {
|
||||
return false;
|
||||
}
|
||||
cloudRoadData.setWgslat( cloudRoadData.getLat() );
|
||||
cloudRoadData.setWgslon( cloudRoadData.getLon() );
|
||||
allList.add( cloudRoadData );
|
||||
data.setAllList( allList );
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData( data );
|
||||
Log.i( "mock-timer-snapshot", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
long delay = 100;
|
||||
if ( last != 0 ) {
|
||||
delay = cloudRoadData.getSystemTime() - last;
|
||||
}
|
||||
last = cloudRoadData.getSystemTime();
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 2, 50L );
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br4;
|
||||
|
||||
@@ -937,278 +828,29 @@ public class MockIntentHandler implements IntentHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
private BufferedReader br3;
|
||||
private BufferedReader br31;
|
||||
private BufferedReader[] readers = null;
|
||||
|
||||
private boolean handleMockAdasIntent() throws Exception {
|
||||
final long start = System.currentTimeMillis();
|
||||
if ( br3 == null ) {
|
||||
br3 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas2.txt" ) ) );
|
||||
}
|
||||
if ( br31 == null ) {
|
||||
br31 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas3.txt" ) ) );
|
||||
}
|
||||
if ( br32 == null ) {
|
||||
br32 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas4.txt" ) ) );
|
||||
}
|
||||
if ( br33 == null ) {
|
||||
br33 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas5.txt" ) ) );
|
||||
}
|
||||
if ( br34 == null ) {
|
||||
br34 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas6.txt" ) ) );
|
||||
|
||||
if ( readers == null ) {
|
||||
readers = new BufferedReader[10];
|
||||
for ( int i = 0; i < 10; i++ ) {
|
||||
readers[i] = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas" + i + ".txt" ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( br35 == null ) {
|
||||
br35 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas3-2.txt" ) ) );
|
||||
}
|
||||
if ( br36 == null ) {
|
||||
br36 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas4-2.txt" ) ) );
|
||||
}
|
||||
if ( br37 == null ) {
|
||||
br37 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas4-4.txt" ) ) );
|
||||
}
|
||||
if ( br38 == null ) {
|
||||
br38 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas5-2.txt" ) ) );
|
||||
}
|
||||
if ( br39 == null ) {
|
||||
br39 = new BufferedReader( new InputStreamReader( AbsMogoApplication.getApp().getAssets().open( "adas5-4.txt" ) ) );
|
||||
}
|
||||
String line = br3.readLine();
|
||||
if ( line == null ) {
|
||||
throw new Exception( "end of file 3." );
|
||||
}
|
||||
List< ADASRecognizedResult > allList = new ArrayList<>();
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return false;
|
||||
}
|
||||
allList.add( adasRecognizedResult );
|
||||
ADASRecognizedResult next = handleMockAdasIntent3();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent4();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent5();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent6();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
|
||||
next = handleMockAdasIntent7();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent8();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent9();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent10();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
}
|
||||
next = handleMockAdasIntent11();
|
||||
if ( next != null ) {
|
||||
allList.add( next );
|
||||
for ( BufferedReader reader : readers ) {
|
||||
String line = reader.readLine();
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult != null ) {
|
||||
allList.add( adasRecognizedResult );
|
||||
}
|
||||
}
|
||||
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( allList );
|
||||
Log.i( "mock-timer-adas", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
long delay = 100;
|
||||
if ( last != 0 ) {
|
||||
delay = adasRecognizedResult.satelliteTime - last;
|
||||
}
|
||||
last = adasRecognizedResult.satelliteTime;
|
||||
|
||||
Log.d( "send-delay", "delay: " + delay );
|
||||
return true;
|
||||
}
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent3() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br31.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_2";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br32;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent4() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br32.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_3";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br33;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent5() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br33.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_4";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br34;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent6() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br34.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_5";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br35;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent7() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br35.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_6";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br36;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent8() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br36.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_7";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br37;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent9() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br37.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_8";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br38;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent10() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br38.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_9";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
private BufferedReader br39;
|
||||
|
||||
private ADASRecognizedResult handleMockAdasIntent11() {
|
||||
String line = null;
|
||||
try {
|
||||
line = br39.readLine();
|
||||
} catch ( IOException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if ( line == null ) {
|
||||
return null;
|
||||
}
|
||||
ADASRecognizedResult adasRecognizedResult = GsonUtil.objectFromJson( line, ADASRecognizedResult.class );
|
||||
if ( adasRecognizedResult == null ) {
|
||||
return null;
|
||||
}
|
||||
adasRecognizedResult.uuid = "2_10";
|
||||
return adasRecognizedResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,10 +26,16 @@ public interface RefreshApiService {
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotAsync" )
|
||||
Observable< BaseData > refreshData( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
/*
|
||||
* 大而全
|
||||
* */
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/launcherSnapshot/querySnapshotSync" )
|
||||
Observable< MarkerResponse > refreshDataSync( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
/*
|
||||
* 周边在线车辆
|
||||
* */
|
||||
@FormUrlEncoded
|
||||
@POST( "/yycp-launcherSnapshot/user/queryOnLineCarWithRoute" )
|
||||
Observable< MarkerResponse > queryOnLineCarWithRoute( @FieldMap Map< String, Object > parameters );
|
||||
|
||||
@@ -63,6 +63,9 @@ public class MogoReceiver extends BroadcastReceiver {
|
||||
// 同行者 查询xxx堵不堵发送的广播
|
||||
public static final String ACTION_TXZ_BLOCK_SEARCH = "com.zhidao.roadcondition.roadinfo";
|
||||
|
||||
//车路云—场景预警
|
||||
public static final String ACTION_V2X_FRONT_WARNING = "ACTION_V2X_FRONT_WARNING";
|
||||
|
||||
private IMogoIntentManager mMogoIntentManager;
|
||||
|
||||
public MogoReceiver(Context context) {
|
||||
|
||||
@@ -24,6 +24,14 @@
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<!--adas数据-->
|
||||
<receiver android:name=".receiver.AdasDataBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.v2x.adas_data_broadcast" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -31,4 +31,12 @@ public class MoGoV2XServicePaths {
|
||||
@Keep
|
||||
public static final String PATH_V2X_POLYLINE_MANAGER = "/v2xPolylineManager/api";
|
||||
|
||||
/**
|
||||
* V2X 道路事件与车辆的连接线
|
||||
*/
|
||||
@Keep
|
||||
public static final String PATH_V2X_WARN_POLYLINE_MANAGER = "/v2xWarnPolylineManager/api";
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -36,6 +36,12 @@ public class V2XConst {
|
||||
public static final String BROADCAST_SCENE_HANDLER_ACTION = "com.v2x.scene_handler_broadcast";
|
||||
public static final String BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity";
|
||||
|
||||
/**
|
||||
* V2X ADASData Action
|
||||
*/
|
||||
public static final String BROADCAST_ADAS_SCENE_HANDLER_ACTION = "com.v2x.adas_data_broadcast";
|
||||
public static final String BROADCAST_ADAS_EXTRA_KEY = "ADASData";
|
||||
|
||||
/**
|
||||
* V2X 测试控制面板广播Action
|
||||
*/
|
||||
|
||||
@@ -3,18 +3,25 @@ package com.mogo.module.v2x;
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.v2x.alarm.V2XCalculateServer;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XMarkerManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XPolylineManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoV2XStatusManager;
|
||||
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
|
||||
import com.mogo.module.v2x.network.V2XRefreshModel;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.adas.IMogoADASController;
|
||||
@@ -40,6 +47,9 @@ import com.mogo.service.windowview.IMogoWindowManager;
|
||||
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
|
||||
import com.zhidao.carchattingprovider.ICarsChattingProvider;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* author : donghongyu
|
||||
* e-mail : 1358506549@qq.com
|
||||
@@ -96,6 +106,10 @@ public class V2XServiceManager {
|
||||
private static IMoGoV2XMarkerManager moGoV2XMarkerManager;
|
||||
private static IMoGoV2XPolylineManager moGoV2XPolylineManager;
|
||||
private static IMoGoV2XStatusManager moGoV2XStatusManager;
|
||||
private static IMoGoWarnPolylineManager moGoWarnPolylineManager;
|
||||
|
||||
List<ADASRecognizedResult> resultList = new ArrayList<>();
|
||||
|
||||
|
||||
private V2XServiceManager() {
|
||||
|
||||
@@ -147,10 +161,41 @@ public class V2XServiceManager {
|
||||
|
||||
moGoV2XMarkerManager = (IMoGoV2XMarkerManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_MARKER_MANAGER).navigation(context);
|
||||
moGoV2XPolylineManager = (IMoGoV2XPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_POLYLINE_MANAGER).navigation(context);
|
||||
moGoWarnPolylineManager = (IMoGoWarnPolylineManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER).navigation(context);
|
||||
|
||||
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(context);
|
||||
|
||||
List<MogoLatLng> lonLats = new ArrayList<>();
|
||||
|
||||
// adas 每隔一秒传递的他车或行人数据
|
||||
mIMogoADASController.addAdasRecognizedDataCallback(resultList -> {
|
||||
// 绘制近景识别到的车辆,行人和二轮车 TODO
|
||||
AdasRecognizedResultDrawer.getInstance().renderAdasRecognizedResult( resultList );
|
||||
|
||||
//清理
|
||||
V2XServiceManager.getMoGoWarnPolylineManager().clearLine();
|
||||
|
||||
// 绘制连接线 TODO 来的是列表数据
|
||||
// V2XServiceManager.getMoGoWarnPolylineManager().drawableWarnPolyline(context, roadEventEntity);
|
||||
|
||||
//更新数据
|
||||
for (ADASRecognizedResult result : resultList) {
|
||||
MogoLatLng latLng = new MogoLatLng(result.lat, result.lon);
|
||||
lonLats.add(latLng);
|
||||
}
|
||||
|
||||
IMogoPolyline mMogoPolyline = V2XServiceManager.getMoGoWarnPolylineManager().getMogoWarnPolyline();
|
||||
mMogoPolyline.setPoints(lonLats);
|
||||
|
||||
} );
|
||||
|
||||
//绘制自车数据 liyz
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static Context getContext() {
|
||||
return mContext;
|
||||
}
|
||||
@@ -239,6 +284,10 @@ public class V2XServiceManager {
|
||||
return moGoV2XPolylineManager;
|
||||
}
|
||||
|
||||
public static IMoGoWarnPolylineManager getMoGoWarnPolylineManager() {
|
||||
return moGoWarnPolylineManager;
|
||||
}
|
||||
|
||||
public static IMoGoV2XStatusManager getMoGoV2XStatusManager() {
|
||||
if (moGoV2XStatusManager == null) {
|
||||
moGoV2XStatusManager = (IMoGoV2XStatusManager) ARouter.getInstance().build(MoGoV2XServicePaths.PATH_V2X_STATUS_MANAGER).navigation(V2XUtils.getApp());
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.mogo.module.v2x.entity.model;
|
||||
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
|
||||
/**
|
||||
* @author lixiaopeng
|
||||
* @description
|
||||
* @since 2020/7/29
|
||||
*/
|
||||
public class DrawLineInfo {
|
||||
//报警类型
|
||||
private String type;
|
||||
|
||||
// 起点位置
|
||||
private MogoLatLng startLocation;
|
||||
//结束点位置
|
||||
private MogoLatLng endLocation;
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public MogoLatLng getStartLocation() {
|
||||
return startLocation;
|
||||
}
|
||||
|
||||
public void setStartLocation(MogoLatLng startLocation) {
|
||||
this.startLocation = startLocation;
|
||||
}
|
||||
|
||||
public MogoLatLng getEndLocation() {
|
||||
return endLocation;
|
||||
}
|
||||
|
||||
public void setEndLocation(MogoLatLng endLocation) {
|
||||
this.endLocation = endLocation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.module.v2x.manager;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
/**
|
||||
* 绘制可变宽度和渐变的线
|
||||
*/
|
||||
public interface IMoGoWarnPolylineManager extends IProvider {
|
||||
/**
|
||||
* 绘制连接线,目标车,与当前车辆间连线
|
||||
*
|
||||
* @param context
|
||||
* @param info
|
||||
*/
|
||||
void drawableWarnPolyline(Context context, DrawLineInfo info);
|
||||
|
||||
/**
|
||||
* 移除连接线
|
||||
*/
|
||||
void clearLine();
|
||||
|
||||
IMogoPolyline getMogoWarnPolyline();
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.mogo.module.v2x.manager.impl;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.MoGoV2XServicePaths;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.model.DrawLineInfo;
|
||||
import com.mogo.module.v2x.manager.IMoGoWarnPolylineManager;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 当前车辆与道路事件的连接线
|
||||
*/
|
||||
@Route(path = MoGoV2XServicePaths.PATH_V2X_WARN_POLYLINE_MANAGER)
|
||||
public class MoGoWarnPolylineManager implements IMoGoWarnPolylineManager {
|
||||
private static final String TAG = "MoGoWarnPolylineManager";
|
||||
private static IMogoPolyline mMogoPolyline;
|
||||
|
||||
|
||||
@Override
|
||||
public void drawableWarnPolyline(Context context, DrawLineInfo info) {
|
||||
try {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
}
|
||||
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
|
||||
if (info.getType().equals("1")) { //预警 TODO
|
||||
colors.add(0xFFFFA31A);
|
||||
colors.add(0xFFFFA31A);
|
||||
} else {
|
||||
colors.add(0xFFE32F46);
|
||||
colors.add(0xFFE32F46);
|
||||
}
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(30).useGradient(true).colorValues(colors);
|
||||
|
||||
// 当前车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
|
||||
// 目标车辆位置
|
||||
options.add(info.getStartLocation());
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearLine() {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
mMogoPolyline = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(Context context) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return 绘制连接线的对象
|
||||
*/
|
||||
@Override
|
||||
public IMogoPolyline getMogoWarnPolyline() {
|
||||
return mMogoPolyline;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.mogo.module.v2x.receiver;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
|
||||
/**
|
||||
* 单车预警,车辆盲区预警,弱势交通参与者预警
|
||||
*/
|
||||
public class AdasDataBroadcastReceiver extends BroadcastReceiver {
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
ADASRecognizedResult adasResult = (ADASRecognizedResult) intent.getSerializableExtra(V2XConst.BROADCAST_ADAS_EXTRA_KEY);
|
||||
Logger.d("AdasDataBroadcastReceiver", "adasResult:" + GsonUtil.jsonFromObject(adasResult));
|
||||
|
||||
// V2XScenarioManager.getInstance().handlerMessage(adasResult);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.module.v2x.scenario.impl;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
|
||||
@@ -21,6 +20,7 @@ import com.mogo.module.v2x.scenario.scene.pushVR.V2XPushVREventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.ugc.V2XEventUgcScenario;
|
||||
import com.mogo.module.v2x.scenario.scene.warning.V2XFrontWarningScenario;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -75,8 +75,8 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
|
||||
mV2XScenario = new V2XSeekHelpScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING :
|
||||
case ALERT_RECOMMEND_PARKING :
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
|
||||
case ALERT_RECOMMEND_PARKING:
|
||||
mV2XScenario = new V2XFatigueDrivingScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
|
||||
@@ -106,6 +106,12 @@ public class V2XScenarioManager implements IV2XScenarioManager {
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_VR_SHOW:
|
||||
mV2XScenario = new V2XPushVREventScenario();
|
||||
break;
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_LEFT:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_RIGHT:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_BOTTOM:
|
||||
mV2XScenario = new V2XFrontWarningScenario();
|
||||
break;
|
||||
default:
|
||||
mV2XScenario = null;
|
||||
Logger.e(MODULE_NAME, "当前V2X消息类型未定义。");
|
||||
|
||||
@@ -36,7 +36,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* e-mail : 1358506549@qq.com
|
||||
* date : 2020/4/14 2:37 PM
|
||||
* desc :
|
||||
* TODO 目前睡前瞻推送使用的消息都在这里展示
|
||||
* TODO 目前前瞻推送使用的消息都在这里展示
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushEventWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.mogo.module.v2x.scenario.scene.pushVR;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.module.common.drawer.PushRoadConditionDrawer;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
@@ -25,7 +23,6 @@ public class V2XPushVREventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
private final String TAG = "V2XPushVREventMarker";
|
||||
|
||||
private static IMogoPolyline mMogoPolyline;
|
||||
private static IMogoMarker mAlarmInfoMarker;
|
||||
|
||||
@Override
|
||||
public void drawPOI(V2XPushMessageEntity entity) {
|
||||
@@ -39,44 +36,13 @@ public class V2XPushVREventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
}
|
||||
|
||||
// 绘制事件点Marker
|
||||
PushRoadConditionDrawer.getInstance().drawRoadConditionMarker(entity);
|
||||
|
||||
// 绘制引导线
|
||||
drawablePloyLine(entity);
|
||||
drawableRecommendPolyline(entity);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制引导线
|
||||
*
|
||||
* @param entity
|
||||
*/
|
||||
void drawablePloyLine(V2XPushMessageEntity entity) {
|
||||
// 连接线参数
|
||||
MogoPolylineOptions options = new MogoPolylineOptions();
|
||||
|
||||
// 渐变色
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
colors.add(0xFFFA8C34);
|
||||
colors.add(0xFFBD6D36);
|
||||
colors.add(0xFFFA8C34);
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(15).useGradient(true).color(0xFF1F7EFF);
|
||||
|
||||
for (double[] doubles : entity.getPolyline()) {
|
||||
options.add(doubles[0], doubles[1]);
|
||||
}
|
||||
|
||||
// 绘制线的对象
|
||||
mMogoPolyline = V2XServiceManager.getMogoOverlayManager().addPolyline(options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制推荐引导线
|
||||
*
|
||||
@@ -93,7 +59,7 @@ public class V2XPushVREventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
colors.add(0xFFCB253A);
|
||||
|
||||
// 线条粗细,渐变,渐变色值
|
||||
options.width(15).useGradient(true).color(0xFFEF3A3A);
|
||||
options.width(15).useGradient(true).color(0xFFF95959);
|
||||
|
||||
for (double[] doubles : entity.getRecommendPolyline()) {
|
||||
options.add(doubles[0], doubles[1]);
|
||||
@@ -109,18 +75,10 @@ public class V2XPushVREventMarker implements IV2XMarker<V2XPushMessageEntity> {
|
||||
MarkerUtils.resetMapZoom(16);
|
||||
// 移除线
|
||||
clearLine();
|
||||
// 移除事件POI
|
||||
clearAlarmPOI();
|
||||
// 绘制上次的数据
|
||||
V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI();
|
||||
}
|
||||
|
||||
void clearAlarmPOI() {
|
||||
if (mAlarmInfoMarker != null) {
|
||||
mAlarmInfoMarker.remove();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearLine() {
|
||||
if (mMogoPolyline != null) {
|
||||
mMogoPolyline.remove();
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.mogo.module.v2x.scenario.scene.pushVR;
|
||||
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
@@ -32,7 +35,7 @@ public class V2XPushVREventScenario
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity) {
|
||||
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR场景:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
Logger.w(V2XConst.MODULE_NAME + "_" + TAG, "处理推送VR:" + GsonUtil.jsonFromObject(v2XMessageEntity));
|
||||
|
||||
if (!isSameScenario(v2XMessageEntity)
|
||||
&& V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
|
||||
@@ -58,7 +61,15 @@ public class V2XPushVREventScenario
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null) {
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height_ground));
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
getV2XWindow().show(getV2XMessageEntity().getContent());
|
||||
V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
package com.mogo.module.v2x.scenario.scene.pushVR;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
|
||||
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.service.entrance.IMogoEntranceButtonController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
@@ -21,7 +24,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
* TODO 只有VR演示场景使用
|
||||
* version: 1.0
|
||||
*/
|
||||
public class V2XPushVREventWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
public class V2XPushVREventWindow extends V2XBasWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
private String TAG = "V2XPushVREventWindow";
|
||||
|
||||
// 处理道路事件,30秒倒计时
|
||||
@@ -29,6 +32,26 @@ public class V2XPushVREventWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
private Runnable runnableV2XEvent;
|
||||
private int mExpireTime = 30000;
|
||||
|
||||
public V2XPushVREventWindow() {
|
||||
this(V2XServiceManager.getContext());
|
||||
}
|
||||
|
||||
public V2XPushVREventWindow(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public V2XPushVREventWindow(Context context, AttributeSet attrs) {
|
||||
this(V2XServiceManager.getContext(), null, 0);
|
||||
}
|
||||
|
||||
public V2XPushVREventWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
// 填充布局
|
||||
LayoutInflater.from(context).inflate(V2XServiceManager.getMoGoStatusManager().isVrMode() ?
|
||||
R.layout.window_road_event_detail_vr : R.layout.window_road_event_detail, this);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示道路事件详情Windows
|
||||
*/
|
||||
@@ -36,13 +59,7 @@ public class V2XPushVREventWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
public void show(V2XPushMessageEntity entity) {
|
||||
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=推送消息:展示 Window=\n" + entity);
|
||||
|
||||
V2XServiceManager
|
||||
.getMogoEntranceButtonController()
|
||||
.showLeftNoticeByType(
|
||||
IMogoEntranceButtonController.NOTICE_TYPE_CONGESTION_RECOMMENDED,
|
||||
R.drawable.module_v2x_left_notice_seek_help,
|
||||
entity.getAlarmContent());
|
||||
//countDownV2XEvent();
|
||||
countDownV2XEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -51,21 +68,22 @@ public class V2XPushVREventWindow implements IV2XWindow<V2XPushMessageEntity> {
|
||||
@Override
|
||||
public void close() {
|
||||
Logger.d(MODULE_NAME + "_" + TAG, "V2X==VR=关闭Window");
|
||||
V2XServiceManager
|
||||
.getMogoEntranceButtonController()
|
||||
.hideLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_CONGESTION_RECOMMENDED);
|
||||
|
||||
// 停止倒计时
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
}
|
||||
|
||||
//移除窗体
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.removeView(this);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return null;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -7,7 +7,9 @@ import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ToggleButton;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
||||
@@ -17,6 +19,7 @@ import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
@@ -51,6 +54,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerRoadEvent;
|
||||
private Button mBtnClearRoadEvent;
|
||||
private Button mBtnTriggerPushEvent;
|
||||
private Button mBtnTriggerWarningEvent;
|
||||
private Button mBtnTriggerPushLiveCarEvent;
|
||||
private Button mBtnTriggerAnimationEvent;
|
||||
private Button mBtnbtnFrontCarLiveEvent;
|
||||
@@ -61,7 +65,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
private Button mBtnTriggerEventUgc;
|
||||
private Button mBtnTriggerTrafficSearch;
|
||||
private Button mBtnTriggerRecommendRouteEvent;
|
||||
private Button nBtnTriggerVR;
|
||||
private ToggleButton nBtnTriggerVR;
|
||||
|
||||
private Button btnTriggerRearVIPCarTip,
|
||||
btnTriggerVehicleBrakes,
|
||||
@@ -112,6 +116,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
mBtnTriggerOpen = findViewById(R.id.btnTriggerOpen);
|
||||
mBtnClearRoadEvent = findViewById(R.id.btnClearRoadEvent);
|
||||
mBtnTriggerRoadEvent = findViewById(R.id.btnTriggerRoadEvent);
|
||||
mBtnTriggerWarningEvent = findViewById(R.id.btnTriggerWarningEvent);
|
||||
mBtnTriggerPushEvent = findViewById(R.id.btnTriggerPushEvent);
|
||||
mBtnTriggerPushLiveCarEvent = findViewById(R.id.btnTriggerPushLiveCarEvent);
|
||||
mBtnTriggerAnimationEvent = findViewById(R.id.btnTriggerAnimationEvent);
|
||||
@@ -138,10 +143,11 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
break;
|
||||
}
|
||||
|
||||
nBtnTriggerVR.setOnClickListener(new OnClickListener() {
|
||||
nBtnTriggerVR.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
V2XServiceManager.getMoGoStatusManager().setVrMode("nBtnTriggerVR", true);
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
V2XServiceManager.getMoGoStatusManager().setVrMode("nBtnTriggerVR", isChecked);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -213,6 +219,16 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
|
||||
|
||||
});
|
||||
|
||||
//车路云—场景预警-V1.0 碰撞预警
|
||||
mBtnTriggerWarningEvent.setOnClickListener(v->{
|
||||
V2XMessageEntity<V2XWarningEntity> v2XMessageEntity =
|
||||
TestOnLineCarUtils.getV2XScenarioPushFrontWarningEventData();
|
||||
|
||||
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
|
||||
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);
|
||||
LocalBroadcastManager.getInstance(getContext()).sendBroadcast(intent);
|
||||
});
|
||||
|
||||
mBtnTriggerPushEvent.setOnClickListener(v -> {
|
||||
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
|
||||
TestOnLineCarUtils.getV2XScenarioPushEventData();
|
||||
|
||||
@@ -0,0 +1,128 @@
|
||||
package com.mogo.module.v2x.scenario.scene.warning;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPoiTypeEnum;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.MogoServices;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
|
||||
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
|
||||
import com.mogo.module.v2x.utils.ADASUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.impl.MogoServiceApis;
|
||||
import com.mogo.service.impl.v2x.V2XManager;
|
||||
import com.mogo.service.v2x.IV2XListener;
|
||||
import com.mogo.service.v2x.IV2XProvider;
|
||||
import com.mogo.service.windowview.IMogoTopViewStatusListener;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 车路云—场景预警-V1.0 前车/行人/摩托车/盲区碰撞预警
|
||||
* @since: 2021/3/24
|
||||
*/
|
||||
public class V2XFrontWarningScenario extends AbsV2XScenario implements IMogoTopViewStatusListener {
|
||||
private int direction;
|
||||
private V2XWarningEntity mMarkerEntity;
|
||||
|
||||
public V2XFrontWarningScenario() {
|
||||
setV2XWindow(new V2XWarningWindow());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(@Nullable V2XMessageEntity v2XMessageEntity) {
|
||||
try {
|
||||
if (v2XMessageEntity != null && V2XServiceManager.getMoGoStatusManager().isMainPageOnResume()) {
|
||||
mMarkerEntity = (V2XWarningEntity) v2XMessageEntity.getContent();
|
||||
direction = mMarkerEntity.getDirection();
|
||||
MarkerServiceHandler.getApis().getV2XListenerManager().warningChangedForListenerWithDirection(direction, MogoReceiver.ACTION_V2X_FRONT_WARNING);
|
||||
show();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show() {
|
||||
showWindow();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showWindow() {
|
||||
if (getV2XWindow() != null && mMarkerEntity != null) {
|
||||
View view = getV2XWindow().getView();
|
||||
//Logger.d(MODULE_NAME, "添加window= " + view);
|
||||
ViewGroup.LayoutParams layoutParams =
|
||||
new ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.addView(getV2XWindow().getView(), layoutParams, this);
|
||||
getV2XWindow().show(mMarkerEntity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeWindow() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showButton() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeButton() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawPOI() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearPOI() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewAdded(View view) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewRemoved(View view) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewAddAnim(View view) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeViewRemoveAnim(View view) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.mogo.module.v2x.scenario.scene.warning;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.VoicePreemptType;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
|
||||
import com.mogo.module.v2x.scenario.scene.V2XBasWindow;
|
||||
import com.mogo.module.v2x.scenario.view.IV2XWindow;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 车路云—场景预警 http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=52829799
|
||||
* @since: 2021/3/25
|
||||
*/
|
||||
public class V2XWarningWindow extends V2XBasWindow implements IV2XWindow {
|
||||
|
||||
private ImageView typeImage;
|
||||
private TextView warningTextView;
|
||||
private TextView distance;
|
||||
private V2XWarningEntity mV2XWarningEntity;
|
||||
|
||||
//倒计时3s弹框取消
|
||||
private static Handler handlerV2XEvent = new Handler();
|
||||
private static Runnable runnableV2XEvent;
|
||||
private static final int COUNT_DOWN_TIMER = 1_000;
|
||||
private static final int ALL_EXPIRE_TIMER = 3_000;
|
||||
private static int EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
|
||||
public V2XWarningWindow() {
|
||||
this(V2XServiceManager.getContext(), null);
|
||||
}
|
||||
|
||||
public V2XWarningWindow(Context context, AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public V2XWarningWindow(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
initView(context);
|
||||
}
|
||||
|
||||
private void initView(Context context) {
|
||||
LayoutInflater.from(context).inflate(R.layout.v2x_road_front_warning_vr, this);
|
||||
typeImage = findViewById(R.id.warning_type_image);
|
||||
warningTextView = findViewById(R.id.warning_content_text);
|
||||
distance = findViewById(R.id.warning_distance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void show(Object entity) {
|
||||
if (entity != null) {
|
||||
mV2XWarningEntity = (V2XWarningEntity) entity;
|
||||
//行人0/自行车1/摩托车2/小汽车3/公交车4
|
||||
switch (mV2XWarningEntity.getType()) {
|
||||
case 0:
|
||||
typeImage.setImageResource(R.drawable.v2x_road_front_p_warning);
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
typeImage.setImageResource(R.drawable.v2x_road_front_p_warning);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
distance.setText(String.valueOf(mV2XWarningEntity.getDistance()) + "米");
|
||||
warningTextView.setText(mV2XWarningEntity.getTipContent());
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice(mV2XWarningEntity.getTts());
|
||||
}
|
||||
if (runnableV2XEvent == null) {
|
||||
runnableV2XEvent = () -> {
|
||||
EXPIRE_TIMER = EXPIRE_TIMER - COUNT_DOWN_TIMER;
|
||||
if (EXPIRE_TIMER > 0) {
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
} else {
|
||||
stopCountDown();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
}
|
||||
handlerV2XEvent.postDelayed(runnableV2XEvent, COUNT_DOWN_TIMER);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
stopCountDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWindowStatusListener(V2XWindowStatusListener listener) {
|
||||
|
||||
}
|
||||
|
||||
private void stopCountDown() {
|
||||
if (handlerV2XEvent != null && runnableV2XEvent != null) {
|
||||
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
|
||||
runnableV2XEvent = null;
|
||||
EXPIRE_TIMER = ALL_EXPIRE_TIMER;
|
||||
}
|
||||
//移除窗体
|
||||
V2XServiceManager
|
||||
.getMogoTopViewManager()
|
||||
.removeView(this);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.mogo.module.common.entity.MarkerResponse;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XPushMessageEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.common.entity.V2XWarningEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
@@ -156,6 +157,35 @@ public class TestOnLineCarUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static V2XMessageEntity<V2XWarningEntity> getV2XScenarioPushFrontWarningEventData() {
|
||||
try {
|
||||
InputStream inputStream = V2XUtils.getApp()
|
||||
.getResources()
|
||||
.openRawResource(R.raw.scenario_warning_event_data);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
int len = -1;
|
||||
byte[] buffer = new byte[1024];
|
||||
while ((len = inputStream.read(buffer)) != -1) {
|
||||
baos.write(buffer, 0, len);
|
||||
}
|
||||
inputStream.close();
|
||||
|
||||
// 加载数据源
|
||||
V2XWarningEntity warningEntity = GsonUtil.objectFromJson(baos.toString(), V2XWarningEntity.class);
|
||||
|
||||
V2XMessageEntity<V2XWarningEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_THE_FRONT_CRASH_WARNING_TOP);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(warningEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
return v2xMessageEntity;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟H5推送直播数据
|
||||
@@ -398,7 +428,7 @@ public class TestOnLineCarUtils {
|
||||
try {
|
||||
InputStream inputStream = V2XUtils.getApp()
|
||||
.getResources()
|
||||
.openRawResource(R.raw.scenario_push_vr_event_data_yongdu);
|
||||
.openRawResource(R.raw.scenario_push_vr_event_data_yongdu_gongsi);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
int len = -1;
|
||||
byte[] buffer = new byte[1024];
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 4.6 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.3 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><!--<selector xmlns:android="http://schemas.android.com/apk/res/android">-->
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:angle="135"
|
||||
android:endColor="#CC000000"
|
||||
android:startColor="#CC000000"
|
||||
android:type="linear" />
|
||||
<corners android:radius="@dimen/dp_20" />
|
||||
</shape>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/dp_470"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:layout_marginLeft="@dimen/dp_190"
|
||||
android:background="@drawable/v2x_front_warning_bg"
|
||||
android:layout_marginTop="@dimen/dp_20">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/warning_type_image"
|
||||
android:layout_width="@dimen/dp_100"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
android:layout_marginLeft="@dimen/dp_28"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:src="@drawable/v2x_road_front_car_warning" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/warning_distance"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginRight="@dimen/dp_28"
|
||||
android:maxWidth="@dimen/dp_100"
|
||||
android:text="1.2米"
|
||||
android:textColor="@color/v2x_FF3036"
|
||||
android:textSize="@dimen/dp_32" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/warning_content_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignEnd="@+id/warning_distance"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginLeft="@dimen/dp_20"
|
||||
android:layout_marginRight="@dimen/dp_20"
|
||||
android:layout_toRightOf="@+id/warning_type_image"
|
||||
android:text="前车碰撞预警"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_32" />
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -20,6 +20,7 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:orientation="horizontal"
|
||||
app:alignContent="flex_start"
|
||||
app:alignItems="center"
|
||||
@@ -30,9 +31,8 @@
|
||||
<Button
|
||||
android:id="@+id/btnTriggerOpen"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#FFF"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="隐藏测试按钮面板"
|
||||
@@ -44,9 +44,8 @@
|
||||
<Button
|
||||
android:id="@+id/btnClearRoadEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#6BCF23"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="清除缓存播报"
|
||||
@@ -55,16 +54,16 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
<ToggleButton
|
||||
android:id="@+id/btnTriggerVR"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#6BCF23"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="开启VR模式"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textOff="开启VR模式"
|
||||
android:textOn="关闭VR模式"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
@@ -239,6 +238,20 @@
|
||||
android:textSize="@dimen/dp_22"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTriggerWarningEvent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/dp_10"
|
||||
android:layout_marginBottom="@dimen/dp_10"
|
||||
android:background="#FF0606"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:text="前车碰撞预警"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_22"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnTriggerPushEvent"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -575,171 +575,5 @@
|
||||
116.72509,
|
||||
40.195228
|
||||
]
|
||||
],
|
||||
"moveTrack": [
|
||||
[
|
||||
116.731239,
|
||||
40.196264
|
||||
],
|
||||
[
|
||||
116.731082,
|
||||
40.19622
|
||||
],
|
||||
[
|
||||
116.730919,
|
||||
40.196173
|
||||
],
|
||||
[
|
||||
116.730762,
|
||||
40.196125
|
||||
],
|
||||
[
|
||||
116.730596,
|
||||
40.196069
|
||||
],
|
||||
[
|
||||
116.730437,
|
||||
40.196013
|
||||
],
|
||||
[
|
||||
116.730296,
|
||||
40.195959
|
||||
],
|
||||
[
|
||||
116.730122,
|
||||
40.19589
|
||||
],
|
||||
[
|
||||
116.729956,
|
||||
40.195823
|
||||
],
|
||||
[
|
||||
116.729841,
|
||||
40.195777
|
||||
],
|
||||
[
|
||||
116.729797,
|
||||
40.195759
|
||||
],
|
||||
[
|
||||
116.729696,
|
||||
40.195721
|
||||
],
|
||||
[
|
||||
116.729624,
|
||||
40.195695
|
||||
],
|
||||
[
|
||||
116.729498,
|
||||
40.195649
|
||||
],
|
||||
[
|
||||
116.729464,
|
||||
40.195637
|
||||
],
|
||||
[
|
||||
116.729366,
|
||||
40.195604
|
||||
],
|
||||
[
|
||||
116.729294,
|
||||
40.195583
|
||||
],
|
||||
[
|
||||
116.729122,
|
||||
40.195533
|
||||
],
|
||||
[
|
||||
116.728954,
|
||||
40.195489
|
||||
],
|
||||
[
|
||||
116.728781,
|
||||
40.195448
|
||||
],
|
||||
[
|
||||
116.728616,
|
||||
40.195412
|
||||
],
|
||||
[
|
||||
116.728442,
|
||||
40.195376
|
||||
],
|
||||
[
|
||||
116.728269,
|
||||
40.195341
|
||||
],
|
||||
[
|
||||
116.728087,
|
||||
40.195311
|
||||
],
|
||||
[
|
||||
116.727909,
|
||||
40.195283
|
||||
],
|
||||
[
|
||||
116.727746,
|
||||
40.195263
|
||||
],
|
||||
[
|
||||
116.727561,
|
||||
40.195242
|
||||
],
|
||||
[
|
||||
116.727386,
|
||||
40.195226
|
||||
],
|
||||
[
|
||||
116.727213,
|
||||
40.195217
|
||||
],
|
||||
[
|
||||
116.727036,
|
||||
40.19521
|
||||
],
|
||||
[
|
||||
116.726865,
|
||||
40.195206
|
||||
],
|
||||
[
|
||||
116.72669,
|
||||
40.195206
|
||||
],
|
||||
[
|
||||
116.726512,
|
||||
40.195207
|
||||
],
|
||||
[
|
||||
116.726333,
|
||||
40.195209
|
||||
],
|
||||
[
|
||||
116.726144,
|
||||
40.195211
|
||||
],
|
||||
[
|
||||
116.725959,
|
||||
40.195214
|
||||
],
|
||||
[
|
||||
116.725771,
|
||||
40.195217
|
||||
],
|
||||
[
|
||||
116.725588,
|
||||
40.195221
|
||||
],
|
||||
[
|
||||
116.725411,
|
||||
40.195225
|
||||
],
|
||||
[
|
||||
116.725201,
|
||||
40.195228
|
||||
],
|
||||
[
|
||||
116.72509,
|
||||
40.195228
|
||||
]
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
{
|
||||
"sceneId": "200008",
|
||||
"alarmContent": "拥堵路线推荐",
|
||||
"expireTime": 20000,
|
||||
"sceneCategory": 0,
|
||||
"sceneDescription": "拥堵路线推荐",
|
||||
"sceneName": "拥堵路线推荐",
|
||||
"sceneLevel": 0,
|
||||
"videoUrl": "",
|
||||
"videoChannel": "",
|
||||
"videoSn": "",
|
||||
"tts": "发现前方拥堵,最优路线快6分钟",
|
||||
"zoom": false,
|
||||
"zoomScale": 15,
|
||||
"userHead": "",
|
||||
"msgImgUrl": "",
|
||||
"lat":39.969088,
|
||||
"lon":116.41808,
|
||||
"polyline": [
|
||||
[
|
||||
116.408012,39.968598
|
||||
],
|
||||
[
|
||||
116.408784,39.968688
|
||||
],
|
||||
[
|
||||
116.409632,39.968688
|
||||
],
|
||||
[
|
||||
116.410168,39.968688
|
||||
],
|
||||
[
|
||||
116.410898,39.968795
|
||||
],
|
||||
[
|
||||
116.412143,39.968812
|
||||
],
|
||||
[
|
||||
116.414481,39.968919
|
||||
],
|
||||
[
|
||||
116.41681,39.969025
|
||||
],
|
||||
[
|
||||
116.417947,39.96905
|
||||
],
|
||||
[
|
||||
116.418011,39.968179
|
||||
],
|
||||
[
|
||||
116.418033,39.967644
|
||||
],
|
||||
[
|
||||
116.417947,39.967225
|
||||
]
|
||||
],
|
||||
"recommendPolyline": [
|
||||
[
|
||||
116.408012,39.968598
|
||||
],
|
||||
[
|
||||
116.408784,39.968688
|
||||
],
|
||||
[
|
||||
116.409632,39.968688
|
||||
],
|
||||
[
|
||||
116.410168,39.968688
|
||||
],
|
||||
[
|
||||
116.410898,39.968795
|
||||
],
|
||||
[
|
||||
116.412143,39.968812
|
||||
],
|
||||
[
|
||||
116.414481,39.968919
|
||||
],
|
||||
[
|
||||
116.41681,39.969025
|
||||
],
|
||||
[
|
||||
116.417947,39.96905
|
||||
],
|
||||
[
|
||||
116.418011,39.968179
|
||||
],
|
||||
[
|
||||
116.418033,39.967644
|
||||
],
|
||||
[
|
||||
116.417947,39.967225
|
||||
]
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"type":0,
|
||||
"targetType": "1",
|
||||
"lat":39.9760799115428,
|
||||
"lon":116.411360351446,
|
||||
"distance": 2.22,
|
||||
"collisionLat": 39.9760799115429,
|
||||
"collisionLon": 116.411360351446,
|
||||
"from": 1,
|
||||
"angle": 120,
|
||||
"direction": 10014,
|
||||
"speed":11.108121
|
||||
|
||||
}
|
||||
@@ -19,4 +19,5 @@
|
||||
<color name="v2x_share_des_title_color">#4DFFFFFF</color>
|
||||
<color name="v2x_event_play_text">#4C83FF</color>
|
||||
|
||||
<color name="v2x_FF3036">#FF3036</color>
|
||||
</resources>
|
||||
@@ -38,6 +38,7 @@ import com.mogo.service.strategy.IMogoOnlineCarListPanelProvider;
|
||||
import com.mogo.service.strategy.IMogoRefreshStrategyController;
|
||||
import com.mogo.service.share.IMogoTanluProvider;
|
||||
import com.mogo.service.share.IMogoTanluUiProvider;
|
||||
import com.mogo.service.v2x.IV2XProvider;
|
||||
import com.mogo.service.windowview.IMogoTopViewManager;
|
||||
import com.mogo.service.windowview.IMogoWindowManager;
|
||||
import com.mogo.skin.support.IMogoSkinSupportInstaller;
|
||||
@@ -71,12 +72,12 @@ public interface IMogoServiceApis extends IProvider {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoSocketManager getSocketManagerApi( Context context );
|
||||
IMogoSocketManager getSocketManagerApi(Context context);
|
||||
|
||||
/**
|
||||
* 获取WebSocket操作api
|
||||
*/
|
||||
IMogoWebSocketManager getWebSocketManagerApi( Context context );
|
||||
IMogoWebSocketManager getWebSocketManagerApi(Context context);
|
||||
|
||||
/**
|
||||
* 大而全的数据管理接口
|
||||
@@ -297,6 +298,7 @@ public interface IMogoServiceApis extends IProvider {
|
||||
|
||||
/**
|
||||
* 获取交通状况服务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoTrafficUploadProvider getTrafficUploadApi();
|
||||
@@ -314,4 +316,9 @@ public interface IMogoServiceApis extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoSmallMapProvider getSmallMapProviderApi();
|
||||
|
||||
/*
|
||||
*V2X
|
||||
* */
|
||||
IV2XProvider getV2XListenerManager();
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ public class MogoServicePaths {
|
||||
public static final String PATH_TANLU_UI_API = "/tanlu/ui";
|
||||
|
||||
/**
|
||||
* 碰撞报警模块
|
||||
* 碰撞报警模块 已碰撞
|
||||
*/
|
||||
@Deprecated
|
||||
public static final String PATH_CRASH_WARNING = "/crash/warning";
|
||||
@@ -304,4 +304,9 @@ public class MogoServicePaths {
|
||||
* 小地图控件
|
||||
*/
|
||||
public static final String PATH_SMALL_MAP = "/small_map/api";
|
||||
|
||||
/*
|
||||
*前方碰撞预警 未碰撞
|
||||
* */
|
||||
public static final String PATH_V2X_FRONT_CRASH_WARNING = "/front/crashwarning";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.mogo.service.v2x;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
* @description 描述
|
||||
* @since: 2021/3/24
|
||||
*/
|
||||
public interface IV2XListener {
|
||||
void warningChangedWithDirection(int direction);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user