Merge branch 'merge644_2_master' into 'master'
Merge644 2 master See merge request SCA/L4HA/AndroidApp/MoGoEagleEye!867
@@ -2,14 +2,6 @@
|
||||
package="com.mogo.och.bus">
|
||||
|
||||
<application>
|
||||
<!--这里是为了测试增加的广播-->
|
||||
<receiver android:name=".receiver.TestBusBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="com.bus.test_control" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<activity android:name=".ui.BusSwitchLineActivity"
|
||||
android:theme="@style/SwitchLineDialogStyle"
|
||||
android:launchMode="singleTask"
|
||||
|
||||
@@ -6,7 +6,6 @@ import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.och.bus.fragment.BusFragment
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.biz.provider.CommonService
|
||||
import com.mogo.och.common.module.biz.provider.CommonServiceImpl
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车运营状态请求参数
|
||||
*/
|
||||
class BusOperationStatusRequest {
|
||||
|
||||
private String sn;
|
||||
private double lat;
|
||||
private double lon;
|
||||
public BusOperationStatusRequest(double lon, double lat) {
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/23
|
||||
* <p>
|
||||
* 小巴订单
|
||||
*/
|
||||
public class BusOrderBean {
|
||||
|
||||
/**
|
||||
* orderNo number
|
||||
* passengerPhone string 下单用户电话
|
||||
* startStationId integer 开始站点
|
||||
* startStationName string
|
||||
* endStationId integer 结束站点
|
||||
* endStationName string
|
||||
*/
|
||||
|
||||
private String orderNo;
|
||||
private String passengerPhone;
|
||||
private int startStationId;//乘客上车点
|
||||
private String startStationName;
|
||||
private String endStationName;
|
||||
private int endStationId;//乘客下车点
|
||||
|
||||
public void setOrderNo(String orderNo) {
|
||||
this.orderNo = orderNo;
|
||||
}
|
||||
|
||||
public void setPassengerPhone(String passengerPhone) {
|
||||
this.passengerPhone = passengerPhone;
|
||||
}
|
||||
|
||||
public void setStartStationId(int startStationId) {
|
||||
this.startStationId = startStationId;
|
||||
}
|
||||
|
||||
public void setStartStationName(String startStationName) {
|
||||
this.startStationName = startStationName;
|
||||
}
|
||||
|
||||
public void setEndStationName(String endStationName) {
|
||||
this.endStationName = endStationName;
|
||||
}
|
||||
|
||||
public void setEndStationId(int endStationId) {
|
||||
this.endStationId = endStationId;
|
||||
}
|
||||
|
||||
public String getOrderNo() {
|
||||
return orderNo;
|
||||
}
|
||||
|
||||
public String getPassengerPhone() {
|
||||
return passengerPhone;
|
||||
}
|
||||
|
||||
public int getStartStationId() {
|
||||
return startStationId;
|
||||
}
|
||||
|
||||
public String getStartStationName() {
|
||||
return startStationName;
|
||||
}
|
||||
|
||||
public String getEndStationName() {
|
||||
return endStationName;
|
||||
}
|
||||
|
||||
public int getEndStationId() {
|
||||
return endStationId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusOrderBean{" +
|
||||
"orderNo=" + orderNo +
|
||||
", passengerPhone='" + passengerPhone + '\'' +
|
||||
", startStationId=" + startStationId +
|
||||
", startStationName='" + startStationName + '\'' +
|
||||
", endStationName='" + endStationName + '\'' +
|
||||
", endStationId=" + endStationId +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/19
|
||||
*/
|
||||
public class BusOrdersResponse extends BaseData {
|
||||
public Result data;
|
||||
public static class Result{
|
||||
public List<BusOrderBean> orders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusOrdersResponse{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/19
|
||||
*/
|
||||
public class BusQueryWriteOffPassengersResponse extends BaseData {
|
||||
public List<WriteOffPassenger> data;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/22
|
||||
*
|
||||
* 小巴车重置路线状态请求参数
|
||||
*/
|
||||
class BusResetLineStatusRequest {
|
||||
|
||||
private String sn;
|
||||
public BusResetLineStatusRequest() {
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by pangfan on 2021/8/19
|
||||
*
|
||||
* 订单状态更新请求数据结构
|
||||
*/
|
||||
public class BusRoutePlanningUpdateReqBean {
|
||||
public String sn;
|
||||
public int lineId;
|
||||
public int startSiteId;
|
||||
public int endSiteId;
|
||||
public List<Result> points;
|
||||
|
||||
public static class Result {
|
||||
public Double latitude;
|
||||
public Double longitude;
|
||||
}
|
||||
|
||||
public BusRoutePlanningUpdateReqBean(String sn, int lineId, int startSiteId
|
||||
, int endSiteId, List<Result> points) {
|
||||
this.sn = sn;
|
||||
this.lineId = lineId;
|
||||
this.startSiteId = startSiteId;
|
||||
this.endSiteId = endSiteId;
|
||||
this.points = points;
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口返回接口数据封装
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusRoutesResult {
|
||||
private List<BusStationBean> sites;
|
||||
private int lineId;
|
||||
private String name;
|
||||
private int lineType; //线路类型,0:环形
|
||||
private String description;
|
||||
private int status;
|
||||
private long taskTime; //线路时间班次
|
||||
private int taskId;// 线路班次id
|
||||
|
||||
//线路轨迹相关字段
|
||||
public String csvFileUrl = ""; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public String txtFileUrl = ""; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5 = ""; //轨迹文件md5,默认“”
|
||||
public long contrailSaveTime; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
public String carModel = ""; //[optional] 车型号(如红旗H9),默认“”,暂不加入校验逻辑、用于人工排查问题
|
||||
public String csvFileUrlDPQP = ""; //轨迹文件下载的cos url,默认“”
|
||||
public String csvFileMd5DPQP = ""; //轨迹文件md5,默认“”
|
||||
public String txtFileUrlDPQP = ""; //打点文件下载的cos url,默认“”
|
||||
public String txtFileMd5DPQP = ""; //轨迹文件md5,默认“”
|
||||
public long contrailSaveTimeDPQP; //上传轨迹完成时间戳ms:用于MEC本地手动导入轨迹验证时不会被云端轨迹覆盖
|
||||
|
||||
public int getLineId() {
|
||||
return lineId;
|
||||
}
|
||||
|
||||
public int getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public List<BusStationBean> getSites() {
|
||||
return sites;
|
||||
}
|
||||
|
||||
public void setSites(List<BusStationBean> sites) {
|
||||
this.sites = sites;
|
||||
}
|
||||
|
||||
public long getTaskTime() {
|
||||
return taskTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusRoutesResult{" +
|
||||
"sites=" + sites +
|
||||
", lineId=" + lineId +
|
||||
", name='" + name + '\'' +
|
||||
", taskTime='" + taskTime + '\'' +
|
||||
", lineType=" + lineType +
|
||||
", description='" + description + '\'' +
|
||||
", status=" + status +
|
||||
", csvFileUrl='" + csvFileUrl + '\'' +
|
||||
", csvFileMd5='" + csvFileMd5 + '\'' +
|
||||
", txtFileUrl='" + txtFileUrl + '\'' +
|
||||
", txtFileMd5='" + txtFileMd5 + '\'' +
|
||||
", contrailSaveTime=" + contrailSaveTime +
|
||||
", carModel='" + carModel + '\'' +
|
||||
", csvFileUrlDPQP='" + csvFileUrlDPQP + '\'' +
|
||||
", csvFileMd5DPQP='" + csvFileMd5DPQP + '\'' +
|
||||
", txtFileUrlDPQP='" + txtFileUrlDPQP + '\'' +
|
||||
", txtFileMd5DPQP='" + txtFileMd5DPQP + '\'' +
|
||||
", contrailSaveTimeDPQP=" + contrailSaveTimeDPQP +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusStationBean {
|
||||
private int siteId;
|
||||
private String name;
|
||||
private String nameKr;
|
||||
private int seq;
|
||||
private double gcjLon; //高德
|
||||
private double gcjLat; //高德
|
||||
private double lon; //高精坐标
|
||||
private double lat; //高精坐标
|
||||
private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
private boolean leaving;
|
||||
private String description;
|
||||
private String cityCode;
|
||||
private int businessType; //站点类型,9:taxi,10:bus
|
||||
private int status;
|
||||
private int ifStop = 1; // 是否需要停靠、1需要、0不需要 // TODO: 2021/10/19 原来站点里有设计是否需要停靠字段,现设计暂无,默认都需要停靠
|
||||
|
||||
public String getNameKr() {
|
||||
return nameKr;
|
||||
}
|
||||
|
||||
public double getGcjLon() {
|
||||
return gcjLon;
|
||||
}
|
||||
|
||||
public double getGcjLat() {
|
||||
return gcjLat;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setBusinessType(int businessType) {
|
||||
this.businessType = businessType;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setDrivingStatus(int drivingStatus) {
|
||||
this.drivingStatus = drivingStatus;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
|
||||
public int getBusinessType() {
|
||||
return businessType;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public int getDrivingStatus() {
|
||||
return drivingStatus;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setIfStop(int ifStop) {
|
||||
this.ifStop = ifStop;
|
||||
}
|
||||
|
||||
public int getIfStop() {
|
||||
return ifStop;
|
||||
}
|
||||
|
||||
public void setLeaving(boolean leaving) {
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
public boolean isLeaving() {
|
||||
return leaving;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusStationBean{" +
|
||||
"name='" + name + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", businessType=" + businessType +
|
||||
", status=" + status +
|
||||
", siteId=" + siteId +
|
||||
", seq=" + seq +
|
||||
", drivingStatus=" + drivingStatus +
|
||||
", ifStop=" + ifStop +
|
||||
", leaving=" + leaving +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询核销乘客
|
||||
*/
|
||||
public class BusWriteOffPassengersQueryRequest {
|
||||
|
||||
private String sn;
|
||||
private int taskId;
|
||||
private int siteId;
|
||||
private long verificationTime;
|
||||
public BusWriteOffPassengersQueryRequest(int taskId, int siteId,long prePassengerTime) {
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
this.taskId = taskId;
|
||||
this.siteId = siteId;
|
||||
this.verificationTime = prePassengerTime;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2021/10/19
|
||||
*/
|
||||
public static class BusOrdersResponse extends BaseData {
|
||||
public com.mogo.och.bus.bean.BusOrdersResponse.Result data;
|
||||
public static class Result{
|
||||
public List<BusOrderBean> orders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusOrdersResponse{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public static class BusRoutesResponse extends BaseData {
|
||||
private BusRoutesResult data;
|
||||
|
||||
public BusRoutesResult getResult() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setResult(BusRoutesResult data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusRoutesResponse{" +
|
||||
"data=" + data +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 单个网约车小巴车站信息
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public static class BusStationBean {
|
||||
private int siteId;
|
||||
private String name;
|
||||
private int seq;
|
||||
private double gcjLon; //高德
|
||||
private double gcjLat; //高德
|
||||
private double lon; //高精坐标
|
||||
private double lat; //高精坐标
|
||||
private int drivingStatus;//行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||
private boolean leaving;
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public double getGcjLon() {
|
||||
return gcjLon;
|
||||
}
|
||||
|
||||
public double getGcjLat() {
|
||||
return gcjLat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public int getDrivingStatus() {
|
||||
return drivingStatus;
|
||||
}
|
||||
|
||||
public boolean isLeaving() {
|
||||
return leaving;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setGcjLon(double gcjLon) {
|
||||
this.gcjLon = gcjLon;
|
||||
}
|
||||
|
||||
public void setGcjLat(double gcjLat) {
|
||||
this.gcjLat = gcjLat;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public void setDrivingStatus(int drivingStatus) {
|
||||
this.drivingStatus = drivingStatus;
|
||||
}
|
||||
|
||||
public void setLeaving(boolean leaving) {
|
||||
this.leaving = leaving;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BusStationBean{" +
|
||||
"siteId=" + siteId +
|
||||
", name='" + name + '\'' +
|
||||
", seq=" + seq +
|
||||
", gcjLon=" + gcjLon +
|
||||
", gcjLat=" + gcjLat +
|
||||
", lon=" + lon +
|
||||
", lat=" + lat +
|
||||
", drivingStatus=" + drivingStatus +
|
||||
", leaving=" + leaving +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
/**
|
||||
* 查询下车乘客请求参数
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class QueryLeaveAwayPassengersRequest {
|
||||
private String sn;
|
||||
private int seq; //站点在线路中的序号
|
||||
private int siteId; //站点id
|
||||
|
||||
public QueryLeaveAwayPassengersRequest(int seq, int siteId) {
|
||||
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||
this.seq = seq;
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public void setSeq(int seq) {
|
||||
this.seq = seq;
|
||||
}
|
||||
|
||||
public void setSiteId(int siteId) {
|
||||
this.siteId = siteId;
|
||||
}
|
||||
|
||||
public int getSeq() {
|
||||
return seq;
|
||||
}
|
||||
|
||||
public int getSiteId() {
|
||||
return siteId;
|
||||
}
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/26
|
||||
*
|
||||
* 到站查询下车乘客
|
||||
*/
|
||||
class QueryLeaveAwayPassengersResponse extends BaseData {
|
||||
|
||||
public Result data;
|
||||
|
||||
public static class Result {
|
||||
|
||||
public List< LeaveAwayPassenger > orders;
|
||||
}
|
||||
|
||||
public static class LeaveAwayPassenger {
|
||||
/**
|
||||
* orderNo: 订单no
|
||||
* orderStatus: 订单状态
|
||||
* orderType:订单类型:0及时,1预约
|
||||
* bookingTime:预计用车时间
|
||||
* businessType:订单运营类型 9:taxi,10:bus
|
||||
* startSiteId: 起点站点id
|
||||
* userPhone: 乘客联系方式
|
||||
* startSitePoint:开始站点坐标
|
||||
* startSiteAddr:开始地址
|
||||
* endSiteId:结束站点id
|
||||
* endSitePoint:结束站点坐标
|
||||
* carNumber:车牌号
|
||||
* createTime: 创建时间
|
||||
* startTime:开始时间
|
||||
* startSiteGcjPoint:高精坐标
|
||||
* endSiteGcjPoint:
|
||||
*/
|
||||
//todo 目前是需要乘客电话来通知乘客下车 目前后台没有乘客信息userPhone
|
||||
public String orderNo;
|
||||
public int orderStatus;
|
||||
public int orderType;
|
||||
public long bookingTime;
|
||||
public int businessType;
|
||||
public int startSiteId;
|
||||
public String passengerPhone;
|
||||
public List<Double> startSitePoint;
|
||||
public String startSiteAddr;
|
||||
public int endSiteId;
|
||||
public List<Double> endSitePoint;
|
||||
public String carNumber;
|
||||
public long createTime;
|
||||
public long startTime;
|
||||
public List< Double > startSiteGcjPoint;
|
||||
public List< Double > endSiteGcjPoint;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.bus.bean.request;
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.bus.bean.request;
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.bus.bean.request;
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.shuttle.bean;
|
||||
package com.mogo.och.bus.bean.request;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.bus.bean.request;
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.bus.bean.request;
|
||||
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.bus.bean.response;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.bus.bean.response;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.och.bus.bean;
|
||||
package com.mogo.och.bus.bean.response;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
|
||||
/**
|
||||
* 网约车小巴路线接口请求响应结果
|
||||
@@ -1,15 +1,11 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2021/9/10
|
||||
*
|
||||
* Model->Presenter回调:状态控制器监听(accOn、adas ui show、voice ui show、push ui show、v2x ui show等等)
|
||||
*/
|
||||
public interface IBusControllerStatusCallback {
|
||||
// 自车定位
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
//开始开启自动驾驶
|
||||
void startOpenAutopilot();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.mogo.och.bus.callback;
|
||||
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.mogo.och.bus.constant
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
|
||||
/**
|
||||
* Created on 2021/12/6
|
||||
*/
|
||||
@@ -38,25 +36,6 @@ class BusConst {
|
||||
//终点UUID
|
||||
const val BUS_END_MAP_MAKER = "bus_end_map_maker";
|
||||
|
||||
// 埋点key:接管后点击'自动驾驶'按钮启动
|
||||
const val EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_bus_restart_autopilot"
|
||||
// 埋点key:开始服务开启自动驾驶(成功/失败)
|
||||
const val EVENT_KEY_START_SERVICE = "event_key_och_bus_start_service"
|
||||
const val EVENT_PARAM_SN = "sn"
|
||||
const val EVENT_PARAM_TIME = "time"
|
||||
const val EVENT_PARAM_START_NAME = "start_name"
|
||||
const val EVENT_PARAM_END_NAME = "end_name"
|
||||
const val EVENT_PARAM_LINE_ID = "line_id"
|
||||
const val EVENT_PARAM_MAP_ORIGINAL_DATA = "map_original_data" // 域控原始状态信息
|
||||
const val EVENT_PARAM_AUTOPILOT_STATE = "autopilot_state" //原始的自动驾驶状态
|
||||
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
|
||||
const val EVENT_PARAM_START_FAILURE_CODE = "start_autopilot_failure_code" // 启动自驾失败code
|
||||
const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
|
||||
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
|
||||
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境:true/false
|
||||
// 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾
|
||||
const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_bus_ap_unable_start_reason"
|
||||
const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason";
|
||||
|
||||
/**
|
||||
* 订单起终点Marker类型
|
||||
|
||||
@@ -1,632 +0,0 @@
|
||||
package com.mogo.och.bus.fragment;
|
||||
|
||||
import static com.mogo.och.bus.constant.BusConst.TIMER_START_AUTOPILOT_INTERVAL;
|
||||
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Bundle;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.LinearInterpolator;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager;
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager;
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager;
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView;
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView;
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView;
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.TrafficDataView;
|
||||
import com.mogo.eagle.core.function.smp.view.SmallMapView;
|
||||
import com.mogo.eagle.core.function.view.MapBizView;
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.VisualAngleMode;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
import com.mogo.och.bus.util.BDRouteDataTestUtils;
|
||||
import com.mogo.och.bus.view.BizMapView;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper;
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import bag_manager.BagManagerOuterClass;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import record_cache.RecordPanelOuterClass;
|
||||
|
||||
/**
|
||||
* 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况
|
||||
* <p>
|
||||
* 部分业务放在了此处处理
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public abstract class BaseBusTabFragment<V extends IView, P extends Presenter<V>> extends MvpFragment<V, P> implements IMogoMapListener {
|
||||
|
||||
private static final String TAG = "BaseBusTabFragment";
|
||||
|
||||
protected SlidePanelView slidePanelView;
|
||||
private RelativeLayout ctvAutopilotStatus;
|
||||
private ImageView ctvAutopilotStatusIv;
|
||||
private TextView ctvAutopilotStatusTv;
|
||||
protected TextView tvArrived;
|
||||
protected RelativeLayout mSettingBtn;
|
||||
protected RelativeLayout mBadcaseBtn;
|
||||
private FrameLayout flStationPanelContainer;
|
||||
private BizMapView mapBizView;
|
||||
private Group groupTestPanel;
|
||||
// private TrafficDataView mTrafficDataView;
|
||||
// private BusTrafficLightView mTrafficLightView;
|
||||
|
||||
//远景和中景的切换
|
||||
private ImageView mSwitchMapModeImage;
|
||||
private LinearLayout mSwitchMapModeLayout;
|
||||
|
||||
protected SmallMapView smallMapView;
|
||||
|
||||
//消息盒子
|
||||
private DriverMsgBoxButtonView viewDriverMsgBoxButton;
|
||||
private DriverMsgBoxListView viewDriverMsgBoxList;
|
||||
private DriverMsgBoxBubbleView viewDriverMsgBoxBubble;
|
||||
|
||||
private ObjectAnimator autopilotLoadingAnimator;
|
||||
|
||||
public boolean isAnimateRunning = false;
|
||||
|
||||
|
||||
/**
|
||||
* 滑动按钮触发的事件
|
||||
*/
|
||||
private final SlidePanelView.OnSlidePanelMoveToEndListener onSlideToEndListener = () -> {
|
||||
// 此处做一个代理,处理一下共有情况
|
||||
if (getSlidePanelOnEndListener() != null) {
|
||||
getSlidePanelOnEndListener().moveToEnd();
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.bus_base_fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mapBizView = findViewById(R.id.mapBizView);
|
||||
groupTestPanel = findViewById(R.id.groupTestPanel);
|
||||
slidePanelView = findViewById(R.id.module_mogo_och_slide_panel);
|
||||
ctvAutopilotStatus = findViewById(R.id.module_mogo_och_autopilot_status);
|
||||
ctvAutopilotStatusIv = findViewById(R.id.bus_autopilot_btn_iv);
|
||||
ctvAutopilotStatusTv = findViewById(R.id.bus_autopolot_btn_tv);
|
||||
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container);
|
||||
|
||||
// mTrafficLightView = findViewById(R.id.bus_traffic_light_view);
|
||||
// CallerHmiManager.INSTANCE.setProxyTrafficLightView(mTrafficLightView);
|
||||
|
||||
// tvOperationStatus = findViewById(R.id.module_mogo_och_operation_status);
|
||||
tvArrived = findViewById(R.id.module_mogo_och_arrived_tv);
|
||||
|
||||
// mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc);
|
||||
|
||||
|
||||
FrameLayout flSpeed = findViewById(R.id.fl_speed);
|
||||
if (flSpeed != null) {
|
||||
CallerDevaToolsManager.INSTANCE.attachAutopilotBeforeLaunchView(flSpeed.getContext(), flSpeed);
|
||||
}
|
||||
|
||||
|
||||
|
||||
LayoutInflater.from(getContext()).inflate(getStationPanelViewId(), flStationPanelContainer);
|
||||
slidePanelView.setOnSlidePanelMoveToEndListener(onSlideToEndListener);
|
||||
|
||||
mSwitchMapModeLayout = findViewById(R.id.bus_switch_model_layout);
|
||||
mSwitchMapModeImage = findViewById(R.id.bus_switch_model_icon);
|
||||
updateSwitchMapIcon();
|
||||
|
||||
mSwitchMapModeLayout.setOnClickListener(new OnPreventFastClickListener() {
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
if(mapBizView != null){
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
//切换地图的远近视图
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
uiController.setLockMode(true);
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
uiController.setLockMode(false);
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else {
|
||||
uiController.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null);
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
initListener();
|
||||
setAutopilotBtnStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState(), CallerAutoPilotControlManager.INSTANCE.isCanStartAutopilot(false, 0));
|
||||
ctvAutopilotStatus.setOnClickListener(new OnPreventFastClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClickImpl(View v) {
|
||||
restartAutopilot();
|
||||
}
|
||||
});
|
||||
|
||||
// 模拟 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接
|
||||
findViewById(R.id.btnAutopilotDisable).setOnClickListener(view ->
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE)
|
||||
);
|
||||
|
||||
// 模拟 可自动驾驶,工控机连接正常,且处于人工干预状态
|
||||
findViewById(R.id.btnAutopilotEnable).setOnClickListener(view ->
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE)
|
||||
);
|
||||
|
||||
// 模拟 自动驾驶能力,自动驾驶中,可能是停车,可能是行进,但是是机器在处理车的前进后退,不是人
|
||||
findViewById(R.id.btnAutopilotRunning).setOnClickListener(view ->
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING)
|
||||
);
|
||||
|
||||
findViewById(R.id.btnAutopilotPingxing).setOnClickListener(view ->
|
||||
debugAutoPilotStatus(IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING)
|
||||
);
|
||||
|
||||
// 模拟 自动驾驶网约车回调数据
|
||||
findViewById(R.id.btnAutopilotArrive).setOnClickListener(view ->
|
||||
debugArrivedStation()
|
||||
);
|
||||
|
||||
findViewById(R.id.btnAutopilotRoute).setOnClickListener(view -> debugArrivedRoute());
|
||||
|
||||
tvArrived.setOnClickListener(view -> {
|
||||
onArriveStation();
|
||||
});
|
||||
|
||||
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout);
|
||||
mSettingBtn.setOnClickListener(v -> {
|
||||
CallerHmiManager.INSTANCE.showToolsView();
|
||||
});
|
||||
|
||||
// mBadcaseBtn的visible显示逻辑在showBadcaseEntrance内处理
|
||||
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_rl);
|
||||
|
||||
if (mBadcaseBtn != null) {
|
||||
CallerDevaToolsManager.INSTANCE.reportWorkOrder(mBadcaseBtn);
|
||||
}
|
||||
|
||||
//消息盒子
|
||||
viewDriverMsgBoxButton = findViewById(R.id.viewDriverMsgBoxButton);
|
||||
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList);
|
||||
viewDriverMsgBoxBubble = findViewById(R.id.viewDriverMsgBoxBubble);
|
||||
viewDriverMsgBoxButton.setClickListener(show -> {
|
||||
if (show) {
|
||||
viewDriverMsgBoxList.setVisibility(View.VISIBLE);
|
||||
viewDriverMsgBoxList.notifyData();
|
||||
viewDriverMsgBoxBubble.setVisibility(View.GONE);
|
||||
viewDriverMsgBoxBubble.isShowData(false);
|
||||
} else {
|
||||
viewDriverMsgBoxList.setVisibility(View.GONE);
|
||||
viewDriverMsgBoxBubble.setVisibility(View.VISIBLE);
|
||||
viewDriverMsgBoxBubble.isShowData(true);
|
||||
}
|
||||
});
|
||||
|
||||
smallMapView = findViewById(R.id.smallMapView);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews(Bundle savedInstanceState) {
|
||||
super.initViews(savedInstanceState);
|
||||
mapBizView.onCreate(savedInstanceState);
|
||||
smallMapView.onCreateView(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mapBizView.onResume();
|
||||
smallMapView.onResume();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container
|
||||
, @Nullable Bundle savedInstanceState) {
|
||||
EventBus.getDefault().register(this);
|
||||
return super.onCreateView(inflater, container, savedInstanceState);
|
||||
}
|
||||
|
||||
protected abstract void onArriveStation();
|
||||
|
||||
private void updateSwitchMapIcon() {
|
||||
if(mapBizView != null){
|
||||
IMogoMapUIController uiController = mapBizView.getUI();
|
||||
if(uiController != null){
|
||||
if (uiController.getCurrentMapVisualAngle().isLongSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_long);
|
||||
} else if (uiController.getCurrentMapVisualAngle().isMediumSight()) {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
} else {
|
||||
mSwitchMapModeImage.setImageResource(R.drawable.bus_switch_map_medium);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void debugArrivedRoute() {
|
||||
BDRouteDataTestUtils.converToRouteData();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapBizView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapBizView.onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
mapBizView.onPause();
|
||||
smallMapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
mapBizView.onDestroy();
|
||||
if(smallMapView != null){
|
||||
smallMapView.onDestroy();
|
||||
}
|
||||
CallerAutopilotRecordListenerManager.INSTANCE.removeListener(TAG);
|
||||
EventBus.getDefault().unregister(this);
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试到站
|
||||
*/
|
||||
protected abstract void debugArrivedStation();
|
||||
|
||||
private void initListener() {
|
||||
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().registerHostMapListener(TAG, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示滑动按钮
|
||||
*
|
||||
* @param text 指定的文字
|
||||
*/
|
||||
public void showSlidePanel(String text) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
slidePanelView.setText(text);
|
||||
slidePanelView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
setArrivedClickable(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置进站按钮状态
|
||||
*
|
||||
* @param isClickable
|
||||
*/
|
||||
public void setArrivedClickable(boolean isClickable) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tvArrived.setEnabled(isClickable);
|
||||
if (isClickable) {
|
||||
tvArrived.setTextColor(ResourcesUtils.getColor(R.color.bus_white));
|
||||
} else {
|
||||
tvArrived.setTextColor(ResourcesUtils.getColor(R.color.bus_arrived_btn_un_clickable_color));
|
||||
}
|
||||
}
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏滑动按钮
|
||||
*/
|
||||
public void hideSlidePanel() {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
slidePanelView.setVisibility(View.GONE);
|
||||
}
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public void playDI() {
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(getContext(), R.raw.bus_di);
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
|
||||
*/
|
||||
public void onAutopilotStatusChanged(int autopilotStatus,boolean canStartAutopilt) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
changeAutopilotBtnView(autopilotStatus, isAnimateRunning,canStartAutopilt);
|
||||
}
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
public void setAutopilotBtnStatus(int autopilotStatus,boolean canStartAutopilt) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
== autopilotStatus) {//0不可用
|
||||
ctvAutopilotStatusTv.setTextColor(AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_disable));
|
||||
ctvAutopilotStatusTv.setText(getResources().getString(R.string.bus_loading_autopilot_runnig_tv));
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_disable_autopilot_icon);
|
||||
ctvAutopilotStatus.setClickable(true);
|
||||
ctvAutopilotStatus.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg);
|
||||
} else {
|
||||
ctvAutopilotStatusTv.setTextColor(AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_ic_autopilot);
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
|
||||
ctvAutopilotStatusTv.setText(ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv));
|
||||
if(canStartAutopilt){
|
||||
ctvAutopilotStatus.setClickable(true);
|
||||
ctvAutopilotStatus.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg);
|
||||
}else {
|
||||
ctvAutopilotStatusTv.setTextColor(AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_disable));
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_disable_autopilot_icon);
|
||||
ctvAutopilotStatus.setClickable(true);
|
||||
ctvAutopilotStatus.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg);
|
||||
}
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
|
||||
ctvAutopilotStatusTv.setText(R.string.bus_loading_autopilot_runnig_tv);
|
||||
ctvAutopilotStatus.setClickable(true);
|
||||
ctvAutopilotStatus.setBackgroundResource(R.drawable.bus_autopilot_2_status_bg);
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
|
||||
== autopilotStatus) {
|
||||
ctvAutopilotStatusTv.setText(R.string.bus_pingxing_driver);
|
||||
ctvAutopilotStatus.setClickable(false);
|
||||
ctvAutopilotStatus.setBackgroundResource(R.drawable.common_autopilot_pxjs);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void updateAutopilotStatus(int autopilotStatus) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== autopilotStatus) {//2 running
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_right_autopilot_icon);
|
||||
ctvAutopilotStatusTv.setTextColor(ResourcesUtils.getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatusTv.setText(ResourcesUtils.getString(R.string.bus_loading_autopilot_success_tv));
|
||||
// ctvAutopilotStatus.setSelected(false);
|
||||
ctvAutopilotStatus.setClickable(false);
|
||||
} else {
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_wrong_autopilot_icon);
|
||||
ctvAutopilotStatusTv.setTextColor(ResourcesUtils.getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatusTv.setText(ResourcesUtils.getString(R.string.bus_loading_autopilot_failure_tv));
|
||||
ctvAutopilotStatus.setClickable(false);
|
||||
// ctvAutopilotStatus.setSelected(false);
|
||||
}
|
||||
UiThreadHandler.postDelayed(() -> setAutopilotBtnStatus(autopilotStatus,CallerAutoPilotControlManager.INSTANCE.isCanStartAutopilot(false, 0)), 1000);
|
||||
}
|
||||
|
||||
private void changeAutopilotBtnView(int autopilotStatus, boolean isAnimateRunning, boolean canStartAutopilt) {
|
||||
if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
!= autopilotStatus) {
|
||||
// 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return;
|
||||
}
|
||||
if (isAnimateRunning) {
|
||||
stopAnimAndUpdateBtnStatus();
|
||||
} else {
|
||||
setAutopilotBtnStatus(autopilotStatus,canStartAutopilt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void stopAnimAndUpdateBtnStatus() {
|
||||
stopAutopilotAnimation();
|
||||
updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState());
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏【自动驾驶】按钮
|
||||
*/
|
||||
public void hideAutopilotBiz() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 展示【自动驾驶】按钮
|
||||
*/
|
||||
public void showAutopilotBiz() {
|
||||
}
|
||||
|
||||
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取站点面板view,在{@link #initViews()}时候添加到container中
|
||||
*
|
||||
* @return 站点面板view
|
||||
*/
|
||||
public abstract int getStationPanelViewId();
|
||||
|
||||
/**
|
||||
* 重新开启自动驾驶
|
||||
*/
|
||||
public abstract void restartAutopilot();
|
||||
|
||||
/**
|
||||
* 模拟自动驾驶返回状态
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
public abstract void debugAutoPilotStatus(int status);
|
||||
|
||||
/**
|
||||
* 开启自动驾驶中间动画
|
||||
*/
|
||||
public void startAutopilotAnimation() {
|
||||
isAnimateRunning = true;
|
||||
ctvAutopilotStatusTv.setText(ResourcesUtils.getString(R.string.bus_loading_autopilot_tv));
|
||||
ctvAutopilotStatusTv.setTextColor(ResourcesUtils.getColor(R.color.bus_autopilot_text_color_normal));
|
||||
ctvAutopilotStatus.setClickable(true);
|
||||
ctvAutopilotStatusIv.setImageResource(R.drawable.bus_loading_autopilot_icon);
|
||||
if (autopilotLoadingAnimator == null) {
|
||||
autopilotLoadingAnimator = ObjectAnimator.ofFloat(ctvAutopilotStatusIv, "rotation", 0f, 360f);
|
||||
autopilotLoadingAnimator.setInterpolator(new LinearInterpolator());
|
||||
autopilotLoadingAnimator.setRepeatCount(-1);//无限循环
|
||||
autopilotLoadingAnimator.setDuration(1000);//设置持续时间
|
||||
}
|
||||
autopilotLoadingAnimator.start();//动画开始
|
||||
|
||||
startingAutoApilotCountDown();
|
||||
|
||||
}
|
||||
|
||||
private void startingAutoApilotCountDown() {
|
||||
//10s 若自动驾驶没有开启,则结束动画
|
||||
UiThreadHandler.postDelayed(() -> { //未启动成功做处理
|
||||
if (isAnimateRunning) {// 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
|
||||
stopAutopilotAnimation();
|
||||
updateAutopilotStatus(CallerAutoPilotStatusListenerManager.INSTANCE.getState());
|
||||
}
|
||||
}, TIMER_START_AUTOPILOT_INTERVAL);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止自动驾驶中间动画
|
||||
*/
|
||||
protected void stopAutopilotAnimation() {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator.end();
|
||||
ctvAutopilotStatusIv.clearAnimation();
|
||||
autopilotLoadingAnimator = null;
|
||||
isAnimateRunning = false;
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 迈速表实时更新
|
||||
// */
|
||||
// public void updateSpeedView(float newSpeed) {
|
||||
// int speed = (int) (Math.abs(newSpeed) * 3.6F); // 倒车时工控机反馈定位信息中speed为负值
|
||||
// if (mTrafficDataView != null) {
|
||||
// mTrafficDataView.updateSpeedWithValue(speed);
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
MogoMapListenerHandler.Companion.getMogoMapListenerHandler().unregisterHostMapListener(TAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapVisualAngleChanged(VisualAngleMode visualAngleMode) {
|
||||
if (visualAngleMode.isMediumSight()) {
|
||||
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
|
||||
} else if (visualAngleMode.isLongSight()) {
|
||||
mSwitchMapModeLayout.setVisibility(View.VISIBLE);
|
||||
} else if (visualAngleMode.isCloseSight()) {
|
||||
mSwitchMapModeLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* bus调试面板打开关闭
|
||||
*/
|
||||
public void debugTestBar() {
|
||||
if (groupTestPanel.getVisibility() == View.VISIBLE) {
|
||||
groupTestPanel.setVisibility(View.GONE);
|
||||
} else {
|
||||
groupTestPanel.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bus调试信息:线路、轨迹等信息
|
||||
* <p>
|
||||
* START
|
||||
*/
|
||||
private View busTestBar;
|
||||
private TextView lineIdTV;
|
||||
private TextView lineNameTV;
|
||||
private TextView trajMd5TV;
|
||||
private TextView stopMd5TV;
|
||||
private TextView trajMd5DPQPTV;
|
||||
private TextView stopMd5DPQPTV;
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void showHideTestBar() {
|
||||
if (busTestBar == null) {
|
||||
busTestBar = findViewById(R.id.module_mogo_och_bus_test_bar);
|
||||
lineIdTV = findViewById(R.id.bus_test_bar_current_line_id);
|
||||
lineNameTV = findViewById(R.id.bus_test_bar_current_line_name);
|
||||
trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5);
|
||||
stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5);
|
||||
trajMd5DPQPTV = findViewById(R.id.bus_test_bar_current_traj_md5_dpqp);
|
||||
stopMd5DPQPTV = findViewById(R.id.bus_test_bar_current_stop_md5_dpqp);
|
||||
}
|
||||
|
||||
if (busTestBar.getVisibility() == View.VISIBLE) {
|
||||
busTestBar.setVisibility(View.GONE);
|
||||
} else {
|
||||
BusRoutesResult routesResult = OrderModel.getInstance().getBusRoutesResult();
|
||||
lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId())));
|
||||
lineNameTV.setText("lineName:" + (routesResult == null ? "" : routesResult.getName()));
|
||||
trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5));
|
||||
stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5));
|
||||
trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP));
|
||||
stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP));
|
||||
busTestBar.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
public void updateBusTestBarInfo() {
|
||||
if (busTestBar != null && busTestBar.getVisibility() == View.VISIBLE) {
|
||||
BusRoutesResult routesResult = OrderModel.getInstance().getBusRoutesResult();
|
||||
lineIdTV.setText("lineId:" + (routesResult == null ? "" : String.valueOf(routesResult.getLineId())));
|
||||
lineNameTV.setText("lineName:" + (routesResult == null ? "" : routesResult.getName()));
|
||||
trajMd5TV.setText("TMd5:" + (routesResult == null ? "" : routesResult.csvFileMd5));
|
||||
stopMd5TV.setText("SMd5:" + (routesResult == null ? "" : routesResult.txtFileMd5));
|
||||
trajMd5DPQPTV.setText("TMd5DPQP:" + (routesResult == null ? "" : routesResult.csvFileMd5DPQP));
|
||||
stopMd5DPQPTV.setText("SMd5DPQP:" + (routesResult == null ? "" : routesResult.txtFileMd5DPQP));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,440 @@
|
||||
package com.mogo.och.bus.fragment
|
||||
|
||||
import android.animation.ObjectAnimator
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.TextView
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager.isCanStartAutopilot
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.attachAutopilotBeforeLaunchView
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.constant.BusConst
|
||||
import com.mogo.och.bus.model.OrderModel
|
||||
import com.mogo.och.bus.view.SlidePanelView
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils.getColor
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.bus_autopilot_btn_iv
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.bus_autopolot_btn_tv
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.fl_speed
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.mapBizView
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_arrived_tv
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_autopilot_status
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_slide_panel
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.module_mogo_och_station_panel_container
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.smallMapView
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.viewDriverMsgBoxBubble
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.viewDriverMsgBoxButton
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.viewDriverMsgBoxList
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
|
||||
/**
|
||||
* 网约车基础Fragment,主要负责布局通用界面,处理站点面板和通话面板互斥情况
|
||||
*
|
||||
*
|
||||
* 部分业务放在了此处处理
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
abstract class BaseBusTabFragment<V : IView?, P : Presenter<V>?> : MvpFragment<V, P>() {
|
||||
|
||||
//启动自驾动画
|
||||
private var autopilotLoadingAnimator: ObjectAnimator? = null
|
||||
var isAnimateRunning = false
|
||||
|
||||
private val TAG = "BaseBusTabFragment"
|
||||
|
||||
/**
|
||||
* 滑动按钮触发的事件
|
||||
*/
|
||||
private val onSlideToEndListener = SlidePanelView.OnSlidePanelMoveToEndListener {
|
||||
// 此处做一个代理,处理一下共有情况
|
||||
if (slidePanelOnEndListener != null) {
|
||||
slidePanelOnEndListener!!.moveToEnd()
|
||||
}
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.bus_base_fragment
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
attachAutopilotBeforeLaunchView(fl_speed.context, fl_speed)
|
||||
LayoutInflater.from(context).inflate(stationPanelViewId, module_mogo_och_station_panel_container)
|
||||
module_mogo_och_slide_panel!!.setOnSlidePanelMoveToEndListener(onSlideToEndListener)
|
||||
initListener()
|
||||
setAutopilotBtnStatus(getState(), isCanStartAutopilot(false, 0))
|
||||
module_mogo_och_autopilot_status!!.setOnClickListener(object : OnPreventFastClickListener() {
|
||||
override fun onClickImpl(v: View) {
|
||||
restartAutopilot()
|
||||
}
|
||||
})
|
||||
|
||||
module_mogo_och_arrived_tv.setOnClickListener { onArriveStation() }
|
||||
|
||||
//消息盒子
|
||||
viewDriverMsgBoxButton!!.setClickListener(object :DriverMsgBoxButtonView.ClickListener{
|
||||
override fun showMsgBoxList(show: Boolean) {
|
||||
if (show) {
|
||||
viewDriverMsgBoxList!!.visibility = View.VISIBLE
|
||||
viewDriverMsgBoxList!!.notifyData()
|
||||
viewDriverMsgBoxBubble!!.visibility = View.GONE
|
||||
viewDriverMsgBoxBubble!!.isShowData(false)
|
||||
} else {
|
||||
viewDriverMsgBoxList!!.visibility = View.GONE
|
||||
viewDriverMsgBoxBubble!!.visibility = View.VISIBLE
|
||||
viewDriverMsgBoxBubble!!.isShowData(true)
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
override fun initViews(savedInstanceState: Bundle?) {
|
||||
super.initViews(savedInstanceState)
|
||||
mapBizView!!.onCreate(savedInstanceState)
|
||||
smallMapView!!.onCreateView(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
mapBizView!!.onResume()
|
||||
smallMapView!!.onResume()
|
||||
}
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View? {
|
||||
EventBus.getDefault().register(this)
|
||||
return super.onCreateView(inflater, container, savedInstanceState)
|
||||
}
|
||||
|
||||
protected abstract fun onArriveStation()
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
mapBizView!!.onSaveInstanceState(outState)
|
||||
}
|
||||
|
||||
override fun onLowMemory() {
|
||||
super.onLowMemory()
|
||||
mapBizView!!.onLowMemory()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
mapBizView!!.onPause()
|
||||
smallMapView!!.onPause()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
mapBizView!!.onDestroy()
|
||||
if (smallMapView != null) {
|
||||
smallMapView!!.onDestroy()
|
||||
}
|
||||
EventBus.getDefault().unregister(this)
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
/**
|
||||
* 测试到站
|
||||
*/
|
||||
protected abstract fun debugArrivedStation()
|
||||
private fun initListener() {}
|
||||
|
||||
/**
|
||||
* 展示滑动按钮
|
||||
*
|
||||
* @param text 指定的文字
|
||||
*/
|
||||
fun showSlidePanel(text: String?) {
|
||||
UiThreadHandler.post({
|
||||
module_mogo_och_slide_panel!!.setText(text)
|
||||
module_mogo_och_slide_panel!!.visibility = View.VISIBLE
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
setArrivedClickable(false)
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置进站按钮状态
|
||||
*
|
||||
* @param isClickable
|
||||
*/
|
||||
fun setArrivedClickable(isClickable: Boolean) {
|
||||
UiThreadHandler.post({
|
||||
module_mogo_och_arrived_tv!!.isEnabled = isClickable
|
||||
if (isClickable) {
|
||||
module_mogo_och_arrived_tv!!.setTextColor(getColor(R.color.bus_white))
|
||||
} else {
|
||||
module_mogo_och_arrived_tv!!.setTextColor(getColor(R.color.bus_arrived_btn_un_clickable_color))
|
||||
}
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏滑动按钮
|
||||
*/
|
||||
fun hideSlidePanel() {
|
||||
UiThreadHandler.post(
|
||||
{ module_mogo_och_slide_panel!!.visibility = View.GONE },
|
||||
UiThreadHandler.MODE.QUEUE
|
||||
)
|
||||
}
|
||||
|
||||
fun playDI() {
|
||||
SoundPoolHelper.getSoundPoolHelper().playSoundWithRedId(context, R.raw.bus_di)
|
||||
}
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param autopilotStatus 0:不可用 1:可用状态 2:自动驾驶中
|
||||
*/
|
||||
fun onAutopilotStatusChanged(autopilotStatus: Int, canStartAutopilt: Boolean) {
|
||||
UiThreadHandler.post({
|
||||
changeAutopilotBtnView(
|
||||
autopilotStatus,
|
||||
isAnimateRunning,
|
||||
canStartAutopilt
|
||||
)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
fun setAutopilotBtnStatus(autopilotStatus: Int, canStartAutopilt: Boolean) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE
|
||||
== autopilotStatus
|
||||
) { //0不可用
|
||||
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_disable))
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv)
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg)
|
||||
} else {
|
||||
bus_autopolot_btn_tv!!.setTextColor(
|
||||
AbsMogoApplication.getApp().getColor(R.color.bus_autopilot_text_color_normal)
|
||||
)
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_ic_autopilot)
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE == autopilotStatus) { //1可用
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_runnig_tv)
|
||||
if (canStartAutopilt) {
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg)
|
||||
} else {
|
||||
bus_autopolot_btn_tv!!.setTextColor(
|
||||
AbsMogoApplication.getApp()
|
||||
.getColor(R.color.bus_autopilot_text_color_disable)
|
||||
)
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_disable_autopilot_icon)
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_0_1_status_bg)
|
||||
}
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == autopilotStatus) {
|
||||
bus_autopolot_btn_tv!!.setText(R.string.bus_loading_autopilot_runnig_tv)
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.bus_autopilot_2_status_bg)
|
||||
} else if (IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING
|
||||
== autopilotStatus
|
||||
) {
|
||||
bus_autopolot_btn_tv!!.setText(R.string.bus_pingxing_driver)
|
||||
module_mogo_och_autopilot_status!!.isClickable = false
|
||||
module_mogo_och_autopilot_status!!.setBackgroundResource(R.drawable.common_autopilot_pxjs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateAutopilotStatus(autopilotStatus: Int) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
== autopilotStatus
|
||||
) { //2 running
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_right_autopilot_icon)
|
||||
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_success_tv)
|
||||
// ctvAutopilotStatus.setSelected(false);
|
||||
module_mogo_och_autopilot_status!!.isClickable = false
|
||||
} else {
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_wrong_autopilot_icon)
|
||||
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_failure_tv)
|
||||
module_mogo_och_autopilot_status!!.isClickable = false
|
||||
// ctvAutopilotStatus.setSelected(false);
|
||||
}
|
||||
UiThreadHandler.postDelayed({
|
||||
setAutopilotBtnStatus(
|
||||
autopilotStatus,
|
||||
isCanStartAutopilot(false, 0)
|
||||
)
|
||||
}, 1000)
|
||||
}
|
||||
|
||||
private fun changeAutopilotBtnView(
|
||||
autopilotStatus: Int,
|
||||
isAnimateRunning: Boolean,
|
||||
canStartAutopilt: Boolean
|
||||
) {
|
||||
if (isAnimateRunning && IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
!= autopilotStatus
|
||||
) {
|
||||
// 主动开启自动驾驶中,不为2(为0、1)则继续loading
|
||||
return
|
||||
}
|
||||
if (isAnimateRunning) {
|
||||
stopAnimAndUpdateBtnStatus()
|
||||
} else {
|
||||
setAutopilotBtnStatus(autopilotStatus, canStartAutopilt)
|
||||
}
|
||||
}
|
||||
|
||||
fun stopAnimAndUpdateBtnStatus() {
|
||||
stopAutopilotAnimation()
|
||||
updateAutopilotStatus(getState())
|
||||
}
|
||||
|
||||
/**
|
||||
* 隐藏【自动驾驶】按钮
|
||||
*/
|
||||
fun hideAutopilotBiz() {}
|
||||
|
||||
/**
|
||||
* 展示【自动驾驶】按钮
|
||||
*/
|
||||
fun showAutopilotBiz() {}
|
||||
open val slidePanelOnEndListener: SlidePanelView.OnSlidePanelMoveToEndListener?
|
||||
get() = null
|
||||
|
||||
/**
|
||||
* 获取站点面板view,在[.initViews]时候添加到container中
|
||||
*
|
||||
* @return 站点面板view
|
||||
*/
|
||||
abstract val stationPanelViewId: Int
|
||||
|
||||
/**
|
||||
* 重新开启自动驾驶
|
||||
*/
|
||||
abstract fun restartAutopilot()
|
||||
|
||||
/**
|
||||
* 模拟自动驾驶返回状态
|
||||
*
|
||||
* @param status
|
||||
*/
|
||||
abstract fun debugAutoPilotStatus(status: Int)
|
||||
|
||||
/**
|
||||
* 开启自动驾驶中间动画
|
||||
*/
|
||||
fun startAutopilotAnimation() {
|
||||
isAnimateRunning = true
|
||||
bus_autopolot_btn_tv!!.text =
|
||||
ResourcesUtils.getString(R.string.bus_loading_autopilot_tv)
|
||||
bus_autopolot_btn_tv!!.setTextColor(getColor(R.color.bus_autopilot_text_color_normal))
|
||||
module_mogo_och_autopilot_status!!.isClickable = true
|
||||
bus_autopilot_btn_iv!!.setImageResource(R.drawable.bus_loading_autopilot_icon)
|
||||
if (autopilotLoadingAnimator == null) {
|
||||
autopilotLoadingAnimator =
|
||||
ObjectAnimator.ofFloat(bus_autopilot_btn_iv, "rotation", 0f, 360f)
|
||||
autopilotLoadingAnimator!!.interpolator = LinearInterpolator()
|
||||
autopilotLoadingAnimator!!.repeatCount = -1 //无限循环
|
||||
autopilotLoadingAnimator!!.setDuration(1000) //设置持续时间
|
||||
}
|
||||
autopilotLoadingAnimator!!.start() //动画开始
|
||||
startingAutoApilotCountDown()
|
||||
}
|
||||
|
||||
private fun startingAutoApilotCountDown() {
|
||||
//10s 若自动驾驶没有开启,则结束动画
|
||||
UiThreadHandler.postDelayed({ //未启动成功做处理
|
||||
if (isAnimateRunning) { // 只判断动画是否在进行,根据自动驾驶当前状态去设置自动驾驶状态
|
||||
stopAutopilotAnimation()
|
||||
updateAutopilotStatus(getState())
|
||||
}
|
||||
}, BusConst.TIMER_START_AUTOPILOT_INTERVAL)
|
||||
}
|
||||
|
||||
/**
|
||||
* 停止自动驾驶中间动画
|
||||
*/
|
||||
protected fun stopAutopilotAnimation() {
|
||||
if (autopilotLoadingAnimator != null) {
|
||||
autopilotLoadingAnimator!!.end()
|
||||
bus_autopilot_btn_iv!!.clearAnimation()
|
||||
autopilotLoadingAnimator = null
|
||||
isAnimateRunning = false
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
/**
|
||||
* Bus调试信息:线路、轨迹等信息
|
||||
*
|
||||
*
|
||||
* START
|
||||
*/
|
||||
private var busTestBar: View? = null
|
||||
private var lineIdTV: TextView? = null
|
||||
private var lineNameTV: TextView? = null
|
||||
private var trajMd5TV: TextView? = null
|
||||
private var stopMd5TV: TextView? = null
|
||||
private var trajMd5DPQPTV: TextView? = null
|
||||
private var stopMd5DPQPTV: TextView? = null
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun showHideTestBar() {
|
||||
if (busTestBar == null) {
|
||||
busTestBar = findViewById(R.id.module_mogo_och_bus_test_bar)
|
||||
lineIdTV = findViewById(R.id.bus_test_bar_current_line_id)
|
||||
lineNameTV = findViewById(R.id.bus_test_bar_current_line_name)
|
||||
trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5)
|
||||
stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5)
|
||||
trajMd5DPQPTV = findViewById(R.id.bus_test_bar_current_traj_md5_dpqp)
|
||||
stopMd5DPQPTV = findViewById(R.id.bus_test_bar_current_stop_md5_dpqp)
|
||||
}
|
||||
if (busTestBar!!.visibility == View.VISIBLE) {
|
||||
busTestBar!!.visibility = View.GONE
|
||||
} else {
|
||||
val routesResult = OrderModel.getInstance().busRoutesResult
|
||||
lineIdTV!!.text = "lineId:" + (routesResult?.lineId?.toString() ?: "")
|
||||
lineNameTV!!.text = "lineName:" + if (routesResult == null) "" else routesResult.name
|
||||
trajMd5TV!!.text = "TMd5:" + if (routesResult == null) "" else routesResult.csvFileMd5
|
||||
stopMd5TV!!.text = "SMd5:" + if (routesResult == null) "" else routesResult.txtFileMd5
|
||||
trajMd5DPQPTV!!.text =
|
||||
"TMd5DPQP:" + if (routesResult == null) "" else routesResult.csvFileMd5DPQP
|
||||
stopMd5DPQPTV!!.text =
|
||||
"SMd5DPQP:" + if (routesResult == null) "" else routesResult.txtFileMd5DPQP
|
||||
busTestBar!!.visibility = View.VISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
fun updateBusTestBarInfo() {
|
||||
if (busTestBar != null && busTestBar!!.visibility == View.VISIBLE) {
|
||||
val routesResult = OrderModel.getInstance().busRoutesResult
|
||||
lineIdTV!!.text = "lineId:" + (routesResult?.lineId?.toString() ?: "")
|
||||
lineNameTV!!.text = "lineName:" + if (routesResult == null) "" else routesResult.name
|
||||
trajMd5TV!!.text = "TMd5:" + if (routesResult == null) "" else routesResult.csvFileMd5
|
||||
stopMd5TV!!.text = "SMd5:" + if (routesResult == null) "" else routesResult.txtFileMd5
|
||||
trajMd5DPQPTV!!.text =
|
||||
"TMd5DPQP:" + if (routesResult == null) "" else routesResult.csvFileMd5DPQP
|
||||
stopMd5DPQPTV!!.text =
|
||||
"SMd5DPQP:" + if (routesResult == null) "" else routesResult.txtFileMd5DPQP
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,547 +0,0 @@
|
||||
package com.mogo.och.bus.fragment;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
import static com.mogo.map.MogoMap.DEFAULT;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
import androidx.constraintlayout.widget.Group;
|
||||
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.temp.EventLogout;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant;
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.map.overlay.IMoGoOverlayManager;
|
||||
import com.mogo.map.overlay.core.Level;
|
||||
import com.mogo.map.overlay.point.Point;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.presenter.BusPresenter;
|
||||
import com.mogo.och.bus.ui.BusStationCommonItem;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity;
|
||||
import com.mogo.och.bus.view.SlidePanelView;
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil;
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager;
|
||||
import com.mogo.och.common.module.utils.QRUtilsKt;
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils;
|
||||
import com.mogo.och.common.module.wigets.BindQRCodeDialog;
|
||||
import com.mogo.och.common.module.wigets.MarqueeTextView;
|
||||
import com.mogo.och.common.module.wigets.OCHCommitDialog;
|
||||
|
||||
import org.greenrobot.eventbus.Subscribe;
|
||||
import org.greenrobot.eventbus.ThreadMode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils;
|
||||
|
||||
|
||||
/**
|
||||
* 网约车小巴界面
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class BusFragment extends BaseBusTabFragment<BusFragment, BusPresenter>
|
||||
implements SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
|
||||
public static final String TAG = "BusFragment";
|
||||
|
||||
private TextView mSwitchLine; //切换路线
|
||||
private MarqueeTextView mLineName;
|
||||
private TextView mTaskTime;
|
||||
private Group groupStationsPanel;
|
||||
private ConstraintLayout noDataView;
|
||||
|
||||
private BusStationBean startStation = null;
|
||||
private BusStationBean endStation = null;
|
||||
private BusStationCommonItem firstStationItem;
|
||||
private BusStationCommonItem secondStationItem;
|
||||
private BusStationCommonItem thirdStationItem;
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return "BusFragment";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if (mPresenter != null) {
|
||||
mPresenter.onDestroy(this);
|
||||
}
|
||||
IMoGoOverlayManager overlayManager = CallerMapUIServiceManager.INSTANCE.getOverlayManager();
|
||||
if(overlayManager!=null) {
|
||||
overlayManager.removeAllLines();
|
||||
overlayManager.removeAllPoints();
|
||||
}
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
super.initViews();
|
||||
|
||||
mSwitchLine = findViewById(R.id.switch_line_btn);
|
||||
mSwitchLine.setTag(0);
|
||||
mLineName = findViewById(R.id.module_och_bus_line_name);
|
||||
|
||||
firstStationItem = findViewById(R.id.bus_panel_first_station);
|
||||
secondStationItem = findViewById(R.id.bus_panel_second_station);
|
||||
thirdStationItem = findViewById(R.id.bus_panel_third_station);
|
||||
mTaskTime = findViewById(R.id.bus_task_time_tv);
|
||||
groupStationsPanel = findViewById(R.id.group_stations_panel);
|
||||
noDataView = findViewById(R.id.no_line_data_view);
|
||||
|
||||
CallerLogger.d(M_BUS + TAG, "initView: " + CallerAutoPilotStatusListenerManager.INSTANCE.getState());
|
||||
// 初始化的时候设置 UI 按钮状态
|
||||
showAutopilotBiz();
|
||||
|
||||
mSwitchLine.setOnClickListener(this);
|
||||
|
||||
mLineName.setOnLongClickListener(v -> {
|
||||
showHideTestBar();
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void changeOverview(EventLogout eventLogout){
|
||||
if (eventLogout.getMessgae() == EventLogout.LOGOUT_TYPE){
|
||||
CallerLogger.d(M_BUS + TAG,"changeOverview Event消息去登出");
|
||||
mPresenter.logout();
|
||||
}else if (eventLogout.getMessgae() == EventLogout.SHOW_QR_TYPE){ //显示二维码
|
||||
CallerLogger.d(M_BUS + TAG,"changeOverview Event qrcode");
|
||||
String qrUrl = String.format(FunctionBuildConfig.urlJson.getBindDriverQRUrl(),
|
||||
SharedPrefsMgr.getInstance().getSn());
|
||||
Bitmap bmQr = QRUtilsKt.createQRCodeWithPicture(
|
||||
BitmapFactory.decodeResource(getResources(), R.drawable.icon_qr_center_logo)
|
||||
,qrUrl, AutoSizeUtils.dp2px(getContext(),340f),
|
||||
AutoSizeUtils.dp2px(getContext(),340f),true);
|
||||
if (bmQr != null){
|
||||
BindQRCodeDialog.Builder builder = new BindQRCodeDialog.Builder();
|
||||
builder.title(getString(R.string.bind_driver_qr_title))
|
||||
.cancelStr(getString(R.string.qr_cancel))
|
||||
.qrBm(bmQr).build(getContext()).show();
|
||||
}else {
|
||||
CallerLogger.d(M_BUS + TAG,"bmQr = null ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onArriveStation() {
|
||||
mPresenter.arriveStation(null,"点击进站触发进站操作");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void debugArrivedStation() {
|
||||
mPresenter.arriveStation(null,"点击debug进站按钮触发进站操作");
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected BusPresenter createPresenter() {
|
||||
return new BusPresenter(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
public void hideStationsPanel(){
|
||||
groupStationsPanel.setVisibility(View.GONE);
|
||||
noDataView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
public void showStationsPanel(){
|
||||
groupStationsPanel.setVisibility(View.VISIBLE);
|
||||
noDataView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
public void updateLineEmptyUI(){
|
||||
setArrivedClickable(false);
|
||||
showOrHideSwitchLineBtn(true);
|
||||
hideStationsPanel();
|
||||
hideSlidePanel();
|
||||
resetStationBlinkAnim();
|
||||
}
|
||||
|
||||
private void resetStationBlinkAnim() {
|
||||
BlinkAnimationUtil.clearAnimation(firstStationItem.getCircleImageView());
|
||||
BlinkAnimationUtil.clearAnimation(secondStationItem.getCircleImageView());
|
||||
BlinkAnimationUtil.clearAnimation(thirdStationItem.getCircleImageView());
|
||||
}
|
||||
|
||||
public void updateBusTaskStatus(String lineName, String lineTime,
|
||||
List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived){
|
||||
|
||||
if (getActivity() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (stationList == null) {
|
||||
// 获取小巴数据失败
|
||||
return;
|
||||
}
|
||||
|
||||
showStationsPanel();
|
||||
showOrHideSwitchLineBtn(false);
|
||||
|
||||
mLineName.setText(lineName);
|
||||
mTaskTime.setText(getString(R.string.bus_line_time_tag)+ lineTime);
|
||||
// 渲染小巴路线数据
|
||||
updateBusStationStatus(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
}
|
||||
},UiThreadHandler.MODE.QUEUE);
|
||||
}
|
||||
|
||||
private void updateBusStationStatus(List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived) {
|
||||
|
||||
startStation = stationList.get(0);
|
||||
endStation = stationList.get(stationList.size() - 1);
|
||||
|
||||
if (arrivingOrArrivedIndex == stationList.size() - 1 && isArrived){
|
||||
//切换路线和结束路线按钮切换
|
||||
showSlidePanel("单程结束");
|
||||
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
}else if (arrivingOrArrivedIndex == 0 && isArrived){
|
||||
|
||||
showSlidePanel("滑动出发");
|
||||
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_START_MAP_MAKER,
|
||||
startStation.getLat(), startStation.getLon(),R.raw.star_marker);
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER,
|
||||
endStation.getLat(), endStation.getLon(),R.raw.end_marker);
|
||||
}else{
|
||||
if (isArrived){
|
||||
// 重置滑动按钮文字
|
||||
showSlidePanel("滑动出发");
|
||||
}
|
||||
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(),R.raw.star_marker);
|
||||
setOrRemoveMapMaker(true, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
}
|
||||
|
||||
if (stationList.size() > 2){ //只有两个站点
|
||||
updateMoreThanTwoStationsUI(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
}else {
|
||||
updateTwoStationsUI(stationList,arrivingOrArrivedIndex,isArrived);
|
||||
}
|
||||
|
||||
updateBusTestBarInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* 有两个以上站点的路线
|
||||
* @param stationList
|
||||
* @param arrivingOrArrivedIndex
|
||||
* @param isArrived
|
||||
*/
|
||||
private void updateMoreThanTwoStationsUI(List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived) {
|
||||
secondStationItem.setStationTag("");
|
||||
secondStationItem.showOrHideStationArrowBg(true);
|
||||
thirdStationItem.setStationTag("");
|
||||
secondStationItem.setVisibility(View.VISIBLE);
|
||||
thirdStationItem.showOrHideStationArrowBg(false);
|
||||
|
||||
if (arrivingOrArrivedIndex == 0 || arrivingOrArrivedIndex -1 == 0
|
||||
|| (arrivingOrArrivedIndex -2 == 0 && stationList.size() == 3)){
|
||||
firstStationItem.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start));
|
||||
}else {
|
||||
firstStationItem.setStationTag("");
|
||||
}
|
||||
|
||||
if (arrivingOrArrivedIndex + 1 == stationList.size() - 1 || arrivingOrArrivedIndex == stationList.size() - 1
|
||||
|| (arrivingOrArrivedIndex == 0 && arrivingOrArrivedIndex + 2 == stationList.size() - 1)){ //确认是否显示 "终"
|
||||
thirdStationItem.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end));
|
||||
}else {
|
||||
thirdStationItem.setStationTag("");
|
||||
}
|
||||
|
||||
//圆点: 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
if (arrivingOrArrivedIndex == 0 && isArrived){
|
||||
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
|
||||
secondStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_arrived_station_name_text_color));
|
||||
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_arrived_station_name_text_color));
|
||||
|
||||
firstStationItem.setStationName(stationList.get(0).getName());
|
||||
secondStationItem.setStationName(stationList.get(1).getName());
|
||||
thirdStationItem.setStationName(stationList.get(2).getName());
|
||||
|
||||
firstStationItem.setStationPointBg(1);
|
||||
secondStationItem.setStationPointBg(2);
|
||||
thirdStationItem.setStationPointBg(2);
|
||||
|
||||
firstStationItem.setStationArrowBg(2);
|
||||
secondStationItem.setStationArrowBg(2);
|
||||
|
||||
}else if (arrivingOrArrivedIndex == stationList.size() - 1){
|
||||
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_station_tag_txt_un_color));
|
||||
secondStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_station_tag_txt_un_color));
|
||||
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
|
||||
|
||||
firstStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -2).getName());
|
||||
secondStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -1).getName());
|
||||
thirdStationItem.setStationName(stationList.get(arrivingOrArrivedIndex).getName());
|
||||
|
||||
firstStationItem.setStationPointBg(0);
|
||||
secondStationItem.setStationPointBg(0);
|
||||
thirdStationItem.setStationPointBg(1);
|
||||
|
||||
firstStationItem.setStationArrowBg(0);
|
||||
if (isArrived){
|
||||
secondStationItem.setStationArrowBg(0);
|
||||
}else {
|
||||
secondStationItem.setStationArrowBg(1);
|
||||
}
|
||||
|
||||
}else {
|
||||
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_station_tag_txt_un_color));
|
||||
secondStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
|
||||
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_arrived_station_name_text_color));
|
||||
|
||||
firstStationItem.setStationName(stationList.get(arrivingOrArrivedIndex -1).getName());
|
||||
secondStationItem.setStationName(stationList.get(arrivingOrArrivedIndex).getName());
|
||||
thirdStationItem.setStationName(stationList.get(arrivingOrArrivedIndex + 1).getName());
|
||||
|
||||
firstStationItem.setStationPointBg(0);
|
||||
secondStationItem.setStationPointBg(1);
|
||||
thirdStationItem.setStationPointBg(2);
|
||||
|
||||
secondStationItem.setStationArrowBg(2);
|
||||
if (isArrived){
|
||||
firstStationItem.setStationArrowBg(0);
|
||||
}else {
|
||||
firstStationItem.setStationArrowBg(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 只有两个站点的路线
|
||||
* @param stationList
|
||||
* @param arrivingOrArrivedIndex
|
||||
* @param isArrived
|
||||
*/
|
||||
private void updateTwoStationsUI(List<BusStationBean> stationList,
|
||||
int arrivingOrArrivedIndex,
|
||||
boolean isArrived) {
|
||||
|
||||
secondStationItem.setVisibility(View.GONE);
|
||||
secondStationItem.showOrHideStationArrowBg(false);
|
||||
thirdStationItem.showOrHideStationArrowBg(false);
|
||||
|
||||
firstStationItem.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start));
|
||||
thirdStationItem.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end));
|
||||
|
||||
firstStationItem.setStationName(stationList.get(0).getName());
|
||||
thirdStationItem.setStationName(stationList.get(1).getName());
|
||||
|
||||
//圆点: 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
if (arrivingOrArrivedIndex == 0 && isArrived){//到站
|
||||
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
|
||||
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_arrived_station_name_text_color));
|
||||
firstStationItem.setStationPointBg(1);
|
||||
firstStationItem.setStationArrowBg(2);
|
||||
thirdStationItem.setStationPointBg(0);
|
||||
|
||||
}else {
|
||||
firstStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_station_tag_txt_un_color));
|
||||
thirdStationItem.setStationNameColor(ResourcesUtils.getColor(R.color.bus_line_station_color_selected));
|
||||
if (isArrived){ //到终点
|
||||
firstStationItem.setStationPointBg(0);
|
||||
firstStationItem.setStationArrowBg(0);
|
||||
thirdStationItem.setStationPointBg(1);
|
||||
|
||||
}else { //到终点途中
|
||||
firstStationItem.setStationPointBg(0);
|
||||
firstStationItem.setStationArrowBg(1);
|
||||
thirdStationItem.setStationPointBg(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showOrHideSwitchLineBtn(boolean isShow) {
|
||||
if (isShow){//显示切换路线
|
||||
mSwitchLine.setTag(0);
|
||||
mSwitchLine.setText(ResourcesUtils.getString(R.string.bus_switch_line_btn));
|
||||
}else {//显示结束路线
|
||||
mSwitchLine.setTag(1);
|
||||
mSwitchLine.setText(ResourcesUtils.getString(R.string.bus_close_line_btn));
|
||||
}
|
||||
}
|
||||
|
||||
public void hideOchBus() {
|
||||
// tvNotice.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStationPanelViewId() {
|
||||
return R.layout.bug_fragment_och;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restartAutopilot() {
|
||||
if (!isAnimateRunning) {
|
||||
mPresenter.restartAutopilot();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SlidePanelView.OnSlidePanelMoveToEndListener getSlidePanelOnEndListener() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToEnd() {
|
||||
// 开启自动驾驶到下一站
|
||||
if (isAnimateRunning){
|
||||
stopAutopilotAnimation();
|
||||
}
|
||||
mPresenter.autoDriveToNextStation();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶可用状态
|
||||
*/
|
||||
public void onAutopilotEnableChange(boolean isEnable) {
|
||||
if (isEnable) {
|
||||
showAutopilotBiz();
|
||||
} else {
|
||||
hideAutopilotBiz();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearBusStationsMarkers(){
|
||||
CallerLogger.d(M_BUS + TAG,"clearBusStationsMarkers()");
|
||||
if (null != startStation) {
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_START_MAP_MAKER, startStation.getLat()
|
||||
, startStation.getLon(),R.raw.star_marker);
|
||||
}
|
||||
if (null != endStation) {
|
||||
setOrRemoveMapMaker(false, BusConst.BUS_END_MAP_MAKER, endStation.getLat()
|
||||
, endStation.getLon(),R.raw.end_marker);
|
||||
}
|
||||
|
||||
//清除鹰眼右下角小地图轨迹
|
||||
CallerLogger.d(SceneConstant.M_BUS, "clearBusStationsMarkers --------->");
|
||||
smallMapView.clearPolyline();
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制地图起点终点
|
||||
*
|
||||
* @param isAdd
|
||||
* @param uuid
|
||||
*/
|
||||
private void setOrRemoveMapMaker(boolean isAdd, String uuid, double lat, double longi,int resourceId) {
|
||||
if (isAdd) {
|
||||
Runnable setMapMarkerRunnable = () -> {
|
||||
CallerLogger.d(M_BUS + "setMapMaker= "+Thread.currentThread().getName(),
|
||||
uuid + "=latitude=" + lat + ",longitude=" + longi);
|
||||
|
||||
Point.Options.Builder builder = new Point.Options.Builder(BusConst.TYPE_MARKER_BUS_ORDER, Level.MAP_MARKER)
|
||||
.setId(uuid)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.isUseGps(true)
|
||||
.controlAngle(false)
|
||||
.icon3DRes(resourceId)
|
||||
.latitude(lat)
|
||||
.longitude(longi);
|
||||
IMoGoOverlayManager overlayManager = CallerMapUIServiceManager.INSTANCE.getOverlayManager();
|
||||
if (overlayManager != null) {
|
||||
overlayManager.showOrUpdatePoint(builder.build(), DEFAULT);
|
||||
}
|
||||
};
|
||||
|
||||
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable);
|
||||
|
||||
} else {
|
||||
Runnable removeMapMarkerRunnable = () -> {
|
||||
CallerLogger.d(M_BUS + "RemoveMapMaker="+Thread.currentThread().getName(),
|
||||
uuid+"=latitude="+lat+",longitude="+longi);
|
||||
IMoGoOverlayManager overlayManager = CallerMapUIServiceManager.INSTANCE.getOverlayManager();
|
||||
if (overlayManager != null) {
|
||||
overlayManager.removePoint(uuid);
|
||||
}
|
||||
};
|
||||
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void debugAutoPilotStatus(int status) {
|
||||
mPresenter.debugAutoPilotStatus(status);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (v.getId() == R.id.switch_line_btn) {//切换路线条件: 自动驾驶过程中,点击则toast提示:自动驾驶中,不可切换路线
|
||||
//本次行程未结束,不支持切换路线。点击则toast提示:当前行程未完成,不可切换路线
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
ToastUtils.showLong(ResourcesUtils.getString(R.string.bus_switch_line_btn_warning1));
|
||||
return;
|
||||
}
|
||||
if ((int)mSwitchLine.getTag() == 0){//切换路线
|
||||
Intent intent = new Intent(getContext(), BusSwitchLineActivity.class);
|
||||
ActivityUtils.startActivity(intent);
|
||||
}else {//结束任务
|
||||
OCHCommitDialog.Builder builder = new OCHCommitDialog.Builder();
|
||||
OCHCommitDialog closeLineConfirmDialog = builder
|
||||
.title(getString(R.string.bus_dialog_title))
|
||||
.tips(getString(R.string.bus_dialog_tips))
|
||||
.confirmStr(getString(R.string.bus_dialog_confirm))
|
||||
.cancelStr(getString(R.string.bus_dialog_cancel))
|
||||
.build(getContext());
|
||||
closeLineConfirmDialog.setClickListener(new OCHCommitDialog.ClickListener() {
|
||||
@Override
|
||||
public void confirm() {
|
||||
mPresenter.abortTask();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancel() {
|
||||
closeLineConfirmDialog.dismiss();
|
||||
}
|
||||
});
|
||||
closeLineConfirmDialog.show();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
package com.mogo.och.bus.fragment
|
||||
|
||||
import android.content.Intent
|
||||
import android.graphics.BitmapFactory
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.temp.EventLogout
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.getState
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager.getOverlayManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import com.mogo.map.MogoMap
|
||||
import com.mogo.map.overlay.core.Level
|
||||
import com.mogo.map.overlay.point.Point
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.constant.BusConst
|
||||
import com.mogo.och.bus.presenter.BusPresenter
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity
|
||||
import com.mogo.och.bus.view.SlidePanelView
|
||||
import com.mogo.och.common.module.utils.BlinkAnimationUtil
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils.getColor
|
||||
import com.mogo.och.common.module.utils.createQRCodeWithPicture
|
||||
import com.mogo.och.common.module.wigets.BindQRCodeDialog
|
||||
import com.mogo.och.common.module.wigets.OCHCommitDialog
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.bus_panel_first_station
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.bus_panel_second_station
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.bus_panel_third_station
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.bus_task_time_tv
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.group_stations_panel
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.module_och_bus_line_name
|
||||
import kotlinx.android.synthetic.main.bug_fragment_och.switch_line_btn
|
||||
import kotlinx.android.synthetic.main.bus_base_fragment.smallMapView
|
||||
import kotlinx.android.synthetic.main.bus_no_line_view.no_line_data_view
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
import org.greenrobot.eventbus.ThreadMode
|
||||
|
||||
/**
|
||||
* 网约车小巴界面
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
class BusFragment : BaseBusTabFragment<BusFragment?, BusPresenter?>(),
|
||||
SlidePanelView.OnSlidePanelMoveToEndListener, View.OnClickListener {
|
||||
private var startStation: BusStationBean? = null
|
||||
private var endStation: BusStationBean? = null
|
||||
override fun getTagName(): String {
|
||||
return "BusFragment"
|
||||
}
|
||||
|
||||
override fun onActivityCreated(savedInstanceState: Bundle?) {
|
||||
super.onActivityCreated(savedInstanceState)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
if (mPresenter != null) {
|
||||
mPresenter!!.onDestroy(this)
|
||||
}
|
||||
val overlayManager = getOverlayManager()
|
||||
if (overlayManager != null) {
|
||||
overlayManager.removeAllLines()
|
||||
overlayManager.removeAllPoints()
|
||||
}
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
super.initViews()
|
||||
switch_line_btn!!.tag = 0
|
||||
d(SceneConstant.M_BUS + TAG, "initView: " + getState())
|
||||
// 初始化的时候设置 UI 按钮状态
|
||||
showAutopilotBiz()
|
||||
switch_line_btn!!.setOnClickListener(this)
|
||||
module_och_bus_line_name!!.setOnLongClickListener { v: View? ->
|
||||
showHideTestBar()
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun changeOverview(eventLogout: EventLogout) {
|
||||
if (eventLogout.messgae == EventLogout.LOGOUT_TYPE) {
|
||||
d(SceneConstant.M_BUS + TAG, "changeOverview Event消息去登出")
|
||||
mPresenter!!.logout()
|
||||
} else if (eventLogout.messgae == EventLogout.SHOW_QR_TYPE) { //显示二维码
|
||||
d(SceneConstant.M_BUS + TAG, "changeOverview Event qrcode")
|
||||
val qrUrl = String.format(
|
||||
FunctionBuildConfig.urlJson.bindDriverQRUrl,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
val bmQr = createQRCodeWithPicture(
|
||||
BitmapFactory.decodeResource(resources, R.drawable.icon_qr_center_logo),
|
||||
qrUrl,
|
||||
AutoSizeUtils.dp2px(context, 340f),
|
||||
AutoSizeUtils.dp2px(context, 340f),
|
||||
true
|
||||
)
|
||||
if (bmQr != null) {
|
||||
context?.let {
|
||||
val builder = BindQRCodeDialog.Builder()
|
||||
builder.title(ResourcesUtils.getString(R.string.bind_driver_qr_title))
|
||||
.cancelStr(ResourcesUtils.getString(R.string.qr_cancel))
|
||||
.qrBm(bmQr).build(it)!!.show()
|
||||
}
|
||||
|
||||
} else {
|
||||
d(SceneConstant.M_BUS + TAG, "bmQr = null ")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onArriveStation() {
|
||||
mPresenter!!.arriveStation(null, "点击进站触发进站操作")
|
||||
}
|
||||
|
||||
override fun debugArrivedStation() {
|
||||
mPresenter!!.arriveStation(null, "点击debug进站按钮触发进站操作")
|
||||
}
|
||||
|
||||
override val stationPanelViewId: Int
|
||||
get() = R.layout.bug_fragment_och
|
||||
|
||||
override fun createPresenter(): BusPresenter {
|
||||
return BusPresenter(this)
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
}
|
||||
|
||||
fun hideStationsPanel() {
|
||||
group_stations_panel!!.visibility = View.GONE
|
||||
no_line_data_view!!.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
fun showStationsPanel() {
|
||||
group_stations_panel!!.visibility = View.VISIBLE
|
||||
no_line_data_view!!.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun updateLineEmptyUI() {
|
||||
setArrivedClickable(false)
|
||||
showOrHideSwitchLineBtn(true)
|
||||
hideStationsPanel()
|
||||
hideSlidePanel()
|
||||
resetStationBlinkAnim()
|
||||
}
|
||||
|
||||
private fun resetStationBlinkAnim() {
|
||||
BlinkAnimationUtil.clearAnimation(bus_panel_first_station!!.getCircleImageView())
|
||||
BlinkAnimationUtil.clearAnimation(bus_panel_second_station!!.getCircleImageView())
|
||||
BlinkAnimationUtil.clearAnimation(bus_panel_third_station!!.getCircleImageView())
|
||||
}
|
||||
|
||||
fun updateBusTaskStatus(
|
||||
lineName: String?, lineTime: String,
|
||||
stationList: List<BusStationBean>?,
|
||||
arrivingOrArrivedIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
if (activity == null) {
|
||||
return
|
||||
}
|
||||
UiThreadHandler.post(Runnable {
|
||||
if (stationList == null) {
|
||||
// 获取小巴数据失败
|
||||
return@Runnable
|
||||
}
|
||||
showStationsPanel()
|
||||
showOrHideSwitchLineBtn(false)
|
||||
module_och_bus_line_name!!.text = lineName
|
||||
bus_task_time_tv!!.text = ResourcesUtils.getString(R.string.bus_line_time_tag) + lineTime
|
||||
// 渲染小巴路线数据
|
||||
updateBusStationStatus(stationList, arrivingOrArrivedIndex, isArrived)
|
||||
}, UiThreadHandler.MODE.QUEUE)
|
||||
}
|
||||
|
||||
private fun updateBusStationStatus(
|
||||
stationList: List<BusStationBean>,
|
||||
arrivingOrArrivedIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
startStation = stationList[0]
|
||||
endStation = stationList[stationList.size - 1]
|
||||
if (arrivingOrArrivedIndex == stationList.size - 1 && isArrived) {
|
||||
//切换路线和结束路线按钮切换
|
||||
showSlidePanel("单程结束")
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
BusConst.BUS_END_MAP_MAKER,
|
||||
endStation!!.lat,
|
||||
endStation!!.lon,
|
||||
R.raw.end_marker
|
||||
)
|
||||
} else if (arrivingOrArrivedIndex == 0 && isArrived) {
|
||||
showSlidePanel("滑动出发")
|
||||
setOrRemoveMapMaker(
|
||||
true, BusConst.BUS_START_MAP_MAKER,
|
||||
startStation!!.lat, startStation!!.lon, R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
true, BusConst.BUS_END_MAP_MAKER,
|
||||
endStation!!.lat, endStation!!.lon, R.raw.end_marker
|
||||
)
|
||||
} else {
|
||||
if (isArrived) {
|
||||
// 重置滑动按钮文字
|
||||
showSlidePanel("滑动出发")
|
||||
}
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
BusConst.BUS_START_MAP_MAKER,
|
||||
startStation!!.lat,
|
||||
startStation!!.lon,
|
||||
R.raw.star_marker
|
||||
)
|
||||
setOrRemoveMapMaker(
|
||||
true,
|
||||
BusConst.BUS_END_MAP_MAKER,
|
||||
endStation!!.lat,
|
||||
endStation!!.lon,
|
||||
R.raw.end_marker
|
||||
)
|
||||
}
|
||||
if (stationList.size > 2) { //只有两个站点
|
||||
updateMoreThanTwoStationsUI(stationList, arrivingOrArrivedIndex, isArrived)
|
||||
} else {
|
||||
updateTwoStationsUI(stationList, arrivingOrArrivedIndex, isArrived)
|
||||
}
|
||||
updateBusTestBarInfo()
|
||||
}
|
||||
|
||||
/**
|
||||
* 有两个以上站点的路线
|
||||
* @param stationList
|
||||
* @param arrivingOrArrivedIndex
|
||||
* @param isArrived
|
||||
*/
|
||||
private fun updateMoreThanTwoStationsUI(
|
||||
stationList: List<BusStationBean>,
|
||||
arrivingOrArrivedIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
bus_panel_second_station!!.setStationTag("")
|
||||
bus_panel_second_station!!.showOrHideStationArrowBg(true)
|
||||
bus_panel_third_station!!.setStationTag("")
|
||||
bus_panel_second_station!!.visibility = View.VISIBLE
|
||||
bus_panel_third_station!!.showOrHideStationArrowBg(false)
|
||||
if (arrivingOrArrivedIndex == 0 || arrivingOrArrivedIndex - 1 == 0 || arrivingOrArrivedIndex - 2 == 0 && stationList.size == 3) {
|
||||
bus_panel_first_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start))
|
||||
} else {
|
||||
bus_panel_first_station!!.setStationTag("")
|
||||
}
|
||||
if (arrivingOrArrivedIndex + 1 == stationList.size - 1 || arrivingOrArrivedIndex == stationList.size - 1 || arrivingOrArrivedIndex == 0 && arrivingOrArrivedIndex + 2 == stationList.size - 1) { //确认是否显示 "终"
|
||||
bus_panel_third_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end))
|
||||
} else {
|
||||
bus_panel_third_station!!.setStationTag("")
|
||||
}
|
||||
|
||||
//圆点: 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
if (arrivingOrArrivedIndex == 0 && isArrived) {
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
bus_panel_second_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
|
||||
bus_panel_first_station!!.setStationName(stationList[0].name)
|
||||
bus_panel_second_station!!.setStationName(stationList[1].name)
|
||||
bus_panel_third_station!!.setStationName(stationList[2].name)
|
||||
bus_panel_first_station!!.setStationPointBg(1)
|
||||
bus_panel_second_station!!.setStationPointBg(2)
|
||||
bus_panel_third_station!!.setStationPointBg(2)
|
||||
bus_panel_first_station!!.setStationArrowBg(2)
|
||||
bus_panel_second_station!!.setStationArrowBg(2)
|
||||
} else if (arrivingOrArrivedIndex == stationList.size - 1) {
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
|
||||
bus_panel_second_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
bus_panel_first_station!!.setStationName(stationList[arrivingOrArrivedIndex - 2].name)
|
||||
bus_panel_second_station!!.setStationName(stationList[arrivingOrArrivedIndex - 1].name)
|
||||
bus_panel_third_station!!.setStationName(stationList[arrivingOrArrivedIndex].name)
|
||||
bus_panel_first_station!!.setStationPointBg(0)
|
||||
bus_panel_second_station!!.setStationPointBg(0)
|
||||
bus_panel_third_station!!.setStationPointBg(1)
|
||||
bus_panel_first_station!!.setStationArrowBg(0)
|
||||
if (isArrived) {
|
||||
bus_panel_second_station!!.setStationArrowBg(0)
|
||||
} else {
|
||||
bus_panel_second_station!!.setStationArrowBg(1)
|
||||
}
|
||||
} else {
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
|
||||
bus_panel_second_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
|
||||
bus_panel_first_station!!.setStationName(stationList[arrivingOrArrivedIndex - 1].name)
|
||||
bus_panel_second_station!!.setStationName(stationList[arrivingOrArrivedIndex].name)
|
||||
bus_panel_third_station!!.setStationName(stationList[arrivingOrArrivedIndex + 1].name)
|
||||
bus_panel_first_station!!.setStationPointBg(0)
|
||||
bus_panel_second_station!!.setStationPointBg(1)
|
||||
bus_panel_third_station!!.setStationPointBg(2)
|
||||
bus_panel_second_station!!.setStationArrowBg(2)
|
||||
if (isArrived) {
|
||||
bus_panel_first_station!!.setStationArrowBg(0)
|
||||
} else {
|
||||
bus_panel_first_station!!.setStationArrowBg(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 只有两个站点的路线
|
||||
* @param stationList
|
||||
* @param arrivingOrArrivedIndex
|
||||
* @param isArrived
|
||||
*/
|
||||
private fun updateTwoStationsUI(
|
||||
stationList: List<BusStationBean>,
|
||||
arrivingOrArrivedIndex: Int,
|
||||
isArrived: Boolean
|
||||
) {
|
||||
bus_panel_second_station!!.visibility = View.GONE
|
||||
bus_panel_second_station!!.showOrHideStationArrowBg(false)
|
||||
bus_panel_third_station!!.showOrHideStationArrowBg(false)
|
||||
bus_panel_first_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_start))
|
||||
bus_panel_third_station!!.setStationTag(ResourcesUtils.getString(R.string.bus_station_txt_tag_end))
|
||||
bus_panel_first_station!!.setStationName(stationList[0].name)
|
||||
bus_panel_third_station!!.setStationName(stationList[1].name)
|
||||
|
||||
//圆点: 0:灰色 过站 1:绿色 到站或者即将到站 2:蓝色:未到站
|
||||
if (arrivingOrArrivedIndex == 0 && isArrived) { //到站
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_arrived_station_name_text_color))
|
||||
bus_panel_first_station!!.setStationPointBg(1)
|
||||
bus_panel_first_station!!.setStationArrowBg(2)
|
||||
bus_panel_third_station!!.setStationPointBg(0)
|
||||
} else {
|
||||
bus_panel_first_station!!.setStationNameColor(getColor(R.color.bus_station_tag_txt_un_color))
|
||||
bus_panel_third_station!!.setStationNameColor(getColor(R.color.bus_line_station_color_selected))
|
||||
if (isArrived) { //到终点
|
||||
bus_panel_first_station!!.setStationPointBg(0)
|
||||
bus_panel_first_station!!.setStationArrowBg(0)
|
||||
bus_panel_third_station!!.setStationPointBg(1)
|
||||
} else { //到终点途中
|
||||
bus_panel_first_station!!.setStationPointBg(0)
|
||||
bus_panel_first_station!!.setStationArrowBg(1)
|
||||
bus_panel_third_station!!.setStationPointBg(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showOrHideSwitchLineBtn(isShow: Boolean) {
|
||||
if (isShow) { //显示切换路线
|
||||
switch_line_btn!!.tag = 0
|
||||
switch_line_btn!!.text = ResourcesUtils.getString(R.string.bus_switch_line_btn)
|
||||
} else { //显示结束路线
|
||||
switch_line_btn!!.tag = 1
|
||||
switch_line_btn!!.text = ResourcesUtils.getString(R.string.bus_close_line_btn)
|
||||
}
|
||||
}
|
||||
|
||||
override fun restartAutopilot() {
|
||||
if (!isAnimateRunning) {
|
||||
mPresenter!!.restartAutopilot()
|
||||
}
|
||||
}
|
||||
|
||||
override fun moveToEnd() {
|
||||
// 开启自动驾驶到下一站
|
||||
if (isAnimateRunning) {
|
||||
stopAutopilotAnimation()
|
||||
}
|
||||
mPresenter!!.autoDriveToNextStation()
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置自动驾驶可用状态
|
||||
*/
|
||||
fun onAutopilotEnableChange(isEnable: Boolean) {
|
||||
if (isEnable) {
|
||||
showAutopilotBiz()
|
||||
} else {
|
||||
hideAutopilotBiz()
|
||||
}
|
||||
}
|
||||
|
||||
fun clearBusStationsMarkers() {
|
||||
d(SceneConstant.M_BUS + TAG, "clearBusStationsMarkers()")
|
||||
if (null != startStation) {
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
BusConst.BUS_START_MAP_MAKER,
|
||||
startStation!!.lat,
|
||||
startStation!!.lon,
|
||||
R.raw.star_marker
|
||||
)
|
||||
}
|
||||
if (null != endStation) {
|
||||
setOrRemoveMapMaker(
|
||||
false,
|
||||
BusConst.BUS_END_MAP_MAKER,
|
||||
endStation!!.lat,
|
||||
endStation!!.lon,
|
||||
R.raw.end_marker
|
||||
)
|
||||
}
|
||||
|
||||
//清除鹰眼右下角小地图轨迹
|
||||
d(SceneConstant.M_BUS, "clearBusStationsMarkers --------->")
|
||||
smallMapView.clearPolyline()
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制地图起点终点
|
||||
*
|
||||
* @param isAdd
|
||||
* @param uuid
|
||||
*/
|
||||
private fun setOrRemoveMapMaker(
|
||||
isAdd: Boolean,
|
||||
uuid: String,
|
||||
lat: Double,
|
||||
longi: Double,
|
||||
resourceId: Int
|
||||
) {
|
||||
if (isAdd) {
|
||||
val setMapMarkerRunnable = Runnable {
|
||||
d(
|
||||
SceneConstant.M_BUS + "setMapMaker= " + Thread.currentThread().name,
|
||||
"$uuid=latitude=$lat,longitude=$longi"
|
||||
)
|
||||
val builder =
|
||||
Point.Options.Builder(BusConst.TYPE_MARKER_BUS_ORDER, Level.MAP_MARKER)
|
||||
.setId(uuid)
|
||||
.anchor(0.5f, 0.5f)
|
||||
.set3DMode(true)
|
||||
.isUseGps(true)
|
||||
.controlAngle(false)
|
||||
.icon3DRes(resourceId)
|
||||
.latitude(lat)
|
||||
.longitude(longi)
|
||||
val overlayManager = getOverlayManager()
|
||||
overlayManager?.showOrUpdatePoint(builder.build(), MogoMap.DEFAULT)
|
||||
}
|
||||
OCHThreadPoolManager.getsInstance().execute(setMapMarkerRunnable)
|
||||
} else {
|
||||
val removeMapMarkerRunnable = Runnable {
|
||||
d(
|
||||
SceneConstant.M_BUS + "RemoveMapMaker=" + Thread.currentThread().name,
|
||||
"$uuid=latitude=$lat,longitude=$longi"
|
||||
)
|
||||
val overlayManager = getOverlayManager()
|
||||
overlayManager?.removePoint(uuid)
|
||||
}
|
||||
OCHThreadPoolManager.getsInstance().execute(removeMapMarkerRunnable)
|
||||
}
|
||||
}
|
||||
|
||||
override fun debugAutoPilotStatus(status: Int) {
|
||||
mPresenter!!.debugAutoPilotStatus(status)
|
||||
}
|
||||
|
||||
override fun onClick(v: View) {
|
||||
if (v.id == R.id.switch_line_btn) { //切换路线条件: 自动驾驶过程中,点击则toast提示:自动驾驶中,不可切换路线
|
||||
//本次行程未结束,不支持切换路线。点击则toast提示:当前行程未完成,不可切换路线
|
||||
if (getState()
|
||||
== IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
) {
|
||||
ToastUtils.showLong(ResourcesUtils.getString(R.string.bus_switch_line_btn_warning1))
|
||||
return
|
||||
}
|
||||
if (switch_line_btn!!.tag as Int == 0) { //切换路线
|
||||
val intent = Intent(context, BusSwitchLineActivity::class.java)
|
||||
ActivityUtils.startActivity(intent)
|
||||
} else { //结束任务
|
||||
context?.let {
|
||||
val builder = OCHCommitDialog.Builder()
|
||||
val closeLineConfirmDialog = builder
|
||||
.title(ResourcesUtils.getString(R.string.bus_dialog_title))
|
||||
.tips(ResourcesUtils.getString(R.string.bus_dialog_tips))
|
||||
.confirmStr(ResourcesUtils.getString(R.string.bus_dialog_confirm))
|
||||
.cancelStr(ResourcesUtils.getString(R.string.bus_dialog_cancel))
|
||||
.build(it)
|
||||
closeLineConfirmDialog!!.setClickListener(object : OCHCommitDialog.ClickListener {
|
||||
override fun confirm() {
|
||||
mPresenter!!.abortTask()
|
||||
}
|
||||
|
||||
override fun cancel() {
|
||||
closeLineConfirmDialog.dismiss()
|
||||
}
|
||||
})
|
||||
closeLineConfirmDialog.show()
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override val slidePanelOnEndListener: SlidePanelView.OnSlidePanelMoveToEndListener
|
||||
get() = this
|
||||
|
||||
companion object {
|
||||
const val TAG = "BusFragment"
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,9 @@ import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.response.BusRoutesResponse;
|
||||
import com.mogo.och.bus.callback.IBusLinesCallback;
|
||||
import com.mogo.och.bus.net.OrderServiceManager;
|
||||
import com.mogo.och.bus.ui.BusSwitchLineActivity;
|
||||
|
||||
@@ -6,7 +6,6 @@ import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_ARRIVING;
|
||||
import static com.mogo.och.bus.constant.BusConst.STATION_STATUS_STOPPED;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -15,9 +14,6 @@ import androidx.annotation.Nullable;
|
||||
import com.elegant.network.utils.GsonUtil;
|
||||
import com.mogo.aicloud.services.socket.IMogoOnMessageListener;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener;
|
||||
import com.mogo.commons.module.status.MogoStatusManager;
|
||||
import com.mogo.commons.module.status.StatusDescriptor;
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
@@ -27,10 +23,9 @@ import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Liste
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager;
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.eagle.core.utilcode.util.CoordinateUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils;
|
||||
@@ -38,9 +33,7 @@ import com.mogo.eagle.core.utilcode.util.StringUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.R;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.bus.bean.response.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
import com.mogo.och.bus.callback.IBusADASStatusCallback;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
@@ -55,12 +48,17 @@ import com.mogo.och.bus.util.BusSendTripInfoManager;
|
||||
import com.mogo.och.bus.util.BusTrajectoryManager;
|
||||
import com.mogo.och.bus.util.BusVoiceManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotManager;
|
||||
import com.mogo.och.common.module.manager.socket.lan.ILanMessageListener;
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.AppConnectMsg;
|
||||
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager;
|
||||
import com.mogo.och.common.module.manager.socket.cloud.data.OCHOperationalMessage;
|
||||
import com.mogo.och.common.module.constant.OchCommonConst;
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusCacheKey;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.LoginCacheStatus;
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg;
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback;
|
||||
import com.mogo.och.common.module.callback.OchAdasStartFailureCallback;
|
||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager;
|
||||
@@ -78,6 +76,10 @@ import com.mogo.och.common.module.utils.OCHThreadPoolManager;
|
||||
import com.mogo.och.common.module.utils.PinYinUtil;
|
||||
import com.mogo.och.common.module.utils.ToastUtilsOch;
|
||||
import com.mogo.och.common.module.voice.VoiceNotice;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
import com.mogo.och.data.bean.BusTransferData;
|
||||
import com.mogo.och.data.manager.cache.CacheDataManager;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -111,8 +113,6 @@ public class OrderModel {
|
||||
private boolean isGoingToNextStation = false;
|
||||
// 运营类型
|
||||
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 IRefreshBusStationsCallback refreshBusStationsCallback;
|
||||
private ISlidePannelHideCallback slidePanelHideCallback;
|
||||
@@ -125,14 +125,6 @@ public class OrderModel {
|
||||
//0: 代表没有启动过 1代表是启动第一次,当>=1 代表是重试 每次到站/路线结束清空置为0
|
||||
private volatile int firstStartAutopilot = 0;
|
||||
|
||||
private final Handler handler = new Handler(msg -> {
|
||||
if (msg.what == MSG_QUERY_BUS_STATION) {
|
||||
queryBusRoutes();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
private OrderModel() {
|
||||
}
|
||||
|
||||
@@ -168,6 +160,7 @@ public class OrderModel {
|
||||
AbnormalFactorsLoopManager.INSTANCE.startLoopAbnormalFactors(mContext);
|
||||
|
||||
TrajectoryAndDistanceManager.INSTANCE.addTrajectoryListener(TAG,trajectoryListener);
|
||||
LanSocketManager.INSTANCE.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.getType(),taskDetailsMsgListener);
|
||||
|
||||
//2022.1.28
|
||||
// 调用Disposable.dispose() 时候会出现InterruptedException 导致出现崩溃
|
||||
@@ -204,6 +197,85 @@ public class OrderModel {
|
||||
});
|
||||
}
|
||||
|
||||
public void queryBusCacheRoutes(){
|
||||
|
||||
String loginStr = CacheDataManager.Companion.getInstance().getCacheData(
|
||||
mContext, BusCacheKey.BUS_LOGIN_STATUS_CACHE);
|
||||
if (!loginStr.isEmpty()){
|
||||
LoginCacheStatus status = GsonUtils.fromJson(loginStr,LoginCacheStatus.class);
|
||||
LoginStatusManager.setLoginStatus(status.getLoginStatus());
|
||||
if (status.getUpdateTime() > DateTimeUtil.getTodayStartTime() &&
|
||||
status.getLoginStatus() == 1){//登陆
|
||||
|
||||
String cacheData = CacheDataManager.Companion.getInstance().getCacheData(mContext,
|
||||
BusCacheKey.BUS_LINE_CACHE);
|
||||
|
||||
if (cacheData == null || cacheData.isEmpty()){
|
||||
queryBusRoutes();
|
||||
}else {
|
||||
BusTransferData data = GsonUtils.fromJson(cacheData,BusTransferData.class);
|
||||
getCacheRouteSuccess(data.getRoutesResult());
|
||||
}
|
||||
}else{ // 未登陆
|
||||
CacheDataManager.Companion.getInstance().clearCacheData(mContext,BusCacheKey.BUS_LOGIN_STATUS_CACHE);
|
||||
sendTaskDetailsToClients();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sendTaskDetailsToClients() {
|
||||
|
||||
BusTransferData data = new BusTransferData(LoginStatusManager.isLogin() ? 1:0,busRoutesResult);
|
||||
TaskDetailsMsg msg = new TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.bus);
|
||||
CallerLogger.d(M_BUS + TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg));
|
||||
LanSocketManager.sendMsgToClient(msg);
|
||||
}
|
||||
|
||||
|
||||
private void getCacheRouteSuccess(BusRoutesResult data){
|
||||
if (data == null || data.getSites() == null
|
||||
|| data.getSites().isEmpty()
|
||||
|| data.getWriteVersion() < DateTimeUtil.getTodayStartTime()) {
|
||||
//当为空时,显示无绑定路线图
|
||||
queryBusRoutes();
|
||||
CacheDataManager.Companion.getInstance().clearCacheData(mContext, BusCacheKey.BUS_LINE_CACHE);
|
||||
return;
|
||||
}
|
||||
CallerLogger.d(M_BUS + TAG, "获取到小巴路线数据: " + GsonUtils.toJson(data));
|
||||
updateBusStatus(data);
|
||||
}
|
||||
|
||||
private void reBuildCacheRouteData(int currentIndex, int currentDrivingStatus, boolean isLeaving
|
||||
, long writeVersion) {
|
||||
if (busRoutesResult != null){
|
||||
busRoutesResult.setWriteVersion(writeVersion);
|
||||
List<BusStationBean> sites = busRoutesResult.getSites();
|
||||
BusStationBean bean = sites.get(currentIndex);
|
||||
bean.setDrivingStatus(currentDrivingStatus);
|
||||
bean.setLeaving(isLeaving);
|
||||
sites.set(currentIndex,bean);
|
||||
if (currentDrivingStatus == STATION_STATUS_STOPPED && !isLeaving){
|
||||
BusStationBean beanPre = sites.get(currentIndex -1);
|
||||
beanPre.setDrivingStatus(BusConst.STATION_STATUS_LEAVING);
|
||||
beanPre.setLeaving(false);
|
||||
sites.set(currentIndex -1,beanPre);
|
||||
}
|
||||
//busRoutesResult.setSite(sites);
|
||||
|
||||
pushCacheTransferData(busRoutesResult);
|
||||
|
||||
updateBusStatus(busRoutesResult);
|
||||
}
|
||||
}
|
||||
|
||||
private void pushCacheTransferData(BusRoutesResult result) {
|
||||
BusTransferData data = new BusTransferData(LoginStatusManager.isLogin() ? 1:0,result);
|
||||
CallerLogger.d(M_BUS + TAG, "pushCacheTransferData = " + GsonUtils.toJson(data));
|
||||
CacheDataManager.Companion.getInstance().putCacheData(mContext,
|
||||
BusCacheKey.BUS_LINE_CACHE,
|
||||
GsonUtils.toJson(data));
|
||||
}
|
||||
|
||||
private final IMogoOnMessageListener<OCHOperationalMessage> mMogoOnMessageListener =
|
||||
new IMogoOnMessageListener<OCHOperationalMessage>() {
|
||||
@Override
|
||||
@@ -265,6 +337,19 @@ public class OrderModel {
|
||||
|
||||
};
|
||||
|
||||
private final ILanMessageListener taskDetailsMsgListener = new ILanMessageListener<TaskDetailsMsg>(){
|
||||
@Override
|
||||
public Class<TaskDetailsMsg> target() {
|
||||
return TaskDetailsMsg.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(TaskDetailsMsg obj) {
|
||||
sendTaskDetailsToClients();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
private final ITrajectoryListListener iTrajectoryListener = new ITrajectoryListListener() {
|
||||
|
||||
@@ -305,7 +390,6 @@ public class OrderModel {
|
||||
public void release() {
|
||||
|
||||
startOrStopOrderLoop(false);
|
||||
//startOrStopQueryPassengerWriteOff(false);
|
||||
|
||||
// 注销定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.INSTANCE.removeListener(TAG);
|
||||
@@ -332,7 +416,7 @@ public class OrderModel {
|
||||
|
||||
@Override
|
||||
public void onStartAutopilotFailure(@NotNull String startFailedCode, @NonNull String startFailedMessage) {
|
||||
BusAnalyticsManager.INSTANCE.triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage);
|
||||
BusAnalyticsManager.INSTANCE.triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage, System.currentTimeMillis());
|
||||
if (mADASStatusCallback != null && !FunctionBuildConfig.isDemoMode){
|
||||
CallerLogger.e( M_BUS + TAG, "mAdasStartFailureListener = "+startFailedMessage );
|
||||
mADASStatusCallback.onStartAdasFailure();
|
||||
@@ -345,9 +429,6 @@ public class OrderModel {
|
||||
@Override
|
||||
public void onChassisLocationGCJ02(@Nullable MogoLocation gnssInfo) {
|
||||
if (null == gnssInfo) return;
|
||||
if (mControllerStatusCallback != null) {
|
||||
mControllerStatusCallback.onCarLocationChanged(gnssInfo);
|
||||
}
|
||||
|
||||
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
|
||||
if (isGoingToNextStation && !isArrivedStation) {
|
||||
@@ -419,10 +500,16 @@ public class OrderModel {
|
||||
closeBeautificationMode();
|
||||
clearStartAutopilotTag();
|
||||
removeTipRunnables();
|
||||
|
||||
CacheDataManager.Companion.getInstance().clearCacheData(mContext, BusCacheKey.BUS_LINE_CACHE);
|
||||
return;
|
||||
}
|
||||
CallerLogger.d(M_BUS + TAG, "获取到小巴路线数据: " + data);
|
||||
updateBusStatus(data.getResult());
|
||||
|
||||
if (busRoutesResult == null || busRoutesResult.getWriteVersion() < data.getResult().getWriteVersion()){
|
||||
CallerLogger.d(M_BUS + TAG, "更新小巴路线数据: " + data);
|
||||
updateBusStatus(data.getResult());
|
||||
pushCacheTransferData(data.getResult());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -557,6 +644,9 @@ public class OrderModel {
|
||||
, ""
|
||||
, false);
|
||||
}
|
||||
|
||||
CacheDataManager.Companion.getInstance().clearCacheData(mContext, BusCacheKey.BUS_LINE_CACHE);
|
||||
busRoutesResult = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -565,7 +655,8 @@ public class OrderModel {
|
||||
* 车机端展示是离开当前站,下一站设置为当前站, 所以服务端数据回来要做处理,不能直接渲染
|
||||
*/
|
||||
private void leaveStationSuccess(int leaveIndex, String leaveStation,
|
||||
String nextStation, String nextStationKr) {
|
||||
String nextStation, String nextStationKr,
|
||||
long writeVersion) {
|
||||
|
||||
onStartAutopilot(leaveIndex);
|
||||
|
||||
@@ -581,6 +672,8 @@ public class OrderModel {
|
||||
, isLastStop);
|
||||
}
|
||||
|
||||
reBuildCacheRouteData(leaveIndex,BusConst.STATION_STATUS_STOPPED,true,writeVersion);
|
||||
|
||||
}
|
||||
|
||||
private void onStartAutopilot(int leaveIndex) {
|
||||
@@ -601,6 +694,7 @@ public class OrderModel {
|
||||
*/
|
||||
private void startAutopilot(boolean isRestart, int leaveIndex) {
|
||||
|
||||
BusAnalyticsManager.INSTANCE.triggerClickStartAutopilotTime(System.currentTimeMillis());
|
||||
|
||||
// 非自驾状态---->预写日志----> 启动自驾 ---> 自驾启动成功 ----> 上报日志
|
||||
// 自驾状态---->启动自驾 ---> 自驾启动成功
|
||||
@@ -697,6 +791,12 @@ public class OrderModel {
|
||||
String departureStopName = stationList.get(backgroundCurrentStationIndex).getName();
|
||||
CallerLogger.d(M_BUS + TAG, "arriveSiteStation-currentStationIndex = " + arrivedStationIndex);
|
||||
|
||||
isArrivedStation = true;
|
||||
isGoingToNextStation = false;
|
||||
long writeVersion = DateTimeUtil.getCurrentTimeStamp();
|
||||
arriveStationSuccess(arrivedStationIndex, departureStopName,
|
||||
arriveStation,arriveStationKr,writeVersion);
|
||||
|
||||
String requestId = MultiRequestLimitChecker.Companion.generateRequestId(TAG + "-arriveSiteStation"
|
||||
, String.valueOf(stationList.get(arrivedStationIndex).getSiteId())
|
||||
, String.valueOf(currentTaskId));
|
||||
@@ -713,15 +813,6 @@ public class OrderModel {
|
||||
public void onSuccess(BaseData o) {
|
||||
CallerLogger.d(M_BUS + TAG, "行程日志-arriveSiteStation success");
|
||||
MultiRequestLimitChecker.Companion.getInstance().decreaseRequestCount(requestId);
|
||||
if (o != null && o.code == 0){
|
||||
queryBusRoutes();
|
||||
isArrivedStation = true;
|
||||
isGoingToNextStation = false;
|
||||
arriveStationSuccess(arrivedStationIndex, departureStopName,
|
||||
arriveStation,arriveStationKr);
|
||||
}
|
||||
//5s轮询核销乘客
|
||||
// startOrStopQueryPassengerWriteOff(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -750,7 +841,7 @@ public class OrderModel {
|
||||
}
|
||||
|
||||
private void arriveStationSuccess(int arrivedStationIndex, String departureStopName,
|
||||
String arriveStation, String arriveStationKr) {
|
||||
String arriveStation, String arriveStationKr,long writeVersion) {
|
||||
if (busRoutesResult != null) {
|
||||
boolean isLastStop = arrivedStationIndex == busRoutesResult.getSites().size() - 1;
|
||||
//给bus外屏发送
|
||||
@@ -761,6 +852,9 @@ public class OrderModel {
|
||||
, isLastStop);
|
||||
}
|
||||
BusVoiceManager.INSTANCE.arrivedStationBus(arriveStation,arriveStationKr);
|
||||
|
||||
reBuildCacheRouteData(arrivedStationIndex, BusConst.STATION_STATUS_STOPPED,false,writeVersion);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -785,6 +879,15 @@ public class OrderModel {
|
||||
MogoLocation currentStationPoint = new MogoLocation();
|
||||
currentStationPoint.setLongitude(busStationBean.getGcjLon());
|
||||
currentStationPoint.setLatitude(busStationBean.getGcjLat());
|
||||
|
||||
isArrivedStation = false;
|
||||
CallerLogger.d(M_BUS + TAG, "行程日志-离站成功开往下一站====");
|
||||
|
||||
long writeVersion = DateTimeUtil.getCurrentTimeStamp();
|
||||
leaveStationSuccess(backgroundCurrentStationIndex, currentStationName,
|
||||
finalNextStationName,finalNextStationNameKr,writeVersion);
|
||||
setTrajectoryStation(currentStationPoint,nextStationPoint, (long) currentLineId);
|
||||
|
||||
String changeInfo = "taskId:" + currentTaskId + "--lineId:" + currentLineId +
|
||||
"--currentStationName:"+currentStationName+"--finalNextStationName:"+finalNextStationName;
|
||||
OchChainLogManager.writeChainLog("滑动出发", changeInfo,
|
||||
@@ -798,14 +901,6 @@ public class OrderModel {
|
||||
public void onSuccess(BaseData o) {
|
||||
OchChainLogManager.writeChainLog("滑动出发成功", changeInfo,
|
||||
true,OchChainLogManager.EVENT_KEY_INFE_WITH_BUS);
|
||||
isArrivedStation = false;
|
||||
CallerLogger.d(M_BUS + TAG, "行程日志-离站成功开往下一站====");
|
||||
//需要更改当前站和下一站的状态 然后渲染
|
||||
//startOrStopQueryPassengerWriteOff(false);
|
||||
queryBusRoutes();
|
||||
leaveStationSuccess(backgroundCurrentStationIndex, currentStationName,
|
||||
finalNextStationName,finalNextStationNameKr);
|
||||
setTrajectoryStation(currentStationPoint,nextStationPoint, (long) currentLineId);
|
||||
}
|
||||
|
||||
|
||||
@@ -904,7 +999,6 @@ public class OrderModel {
|
||||
if (busRoutesResult != null){
|
||||
beforeTaskTips();
|
||||
}
|
||||
// startOrStopQueryPassengerWriteOff(true);
|
||||
}else {
|
||||
removeTipRunnables();
|
||||
}
|
||||
@@ -938,6 +1032,8 @@ public class OrderModel {
|
||||
slidePanelHideCallback.hideSlidePanel();
|
||||
}
|
||||
|
||||
sendTaskDetailsToClients();
|
||||
|
||||
//更新bus路线面板
|
||||
updateBusTaskStatus(stationList);
|
||||
|
||||
@@ -1015,13 +1111,6 @@ public class OrderModel {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 延时查询站点信心
|
||||
*/
|
||||
private void queryBusStationDelay() {
|
||||
handler.sendEmptyMessageDelayed(MSG_QUERY_BUS_STATION, QUERY_BUS_STATION_DELAY);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在踩刹车、控制方向盘等操作后,会停止自动驾驶,重启自动驾驶的话相当于重新设置自动驾驶目的地
|
||||
*/
|
||||
@@ -1065,7 +1154,6 @@ public class OrderModel {
|
||||
clearBusStationDatas();
|
||||
queryBusRoutes();// 重新获取任务
|
||||
removeTipRunnables();
|
||||
// startOrStopQueryPassengerWriteOff(false);
|
||||
ttsEndTask();
|
||||
}
|
||||
}
|
||||
@@ -1185,7 +1273,7 @@ public class OrderModel {
|
||||
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
|
||||
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
BusAnalyticsManager.INSTANCE.triggerStartAutopilotEvent(isRestart, send,
|
||||
currentStation.getName(), nextStation.getName(), currentLineId);
|
||||
currentStation.getName(), nextStation.getName(), currentLineId,"",System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public void triggerUnableStartAPReasonEvent() {
|
||||
@@ -1195,7 +1283,7 @@ public class OrderModel {
|
||||
BusStationBean currentStation = stationList.get(backgroundCurrentStationIndex);
|
||||
BusStationBean nextStation = stationList.get(backgroundCurrentStationIndex + 1);
|
||||
BusAnalyticsManager.INSTANCE.triggerUnableStartAPReasonEvent(
|
||||
currentStation.getName(), nextStation.getName(), currentLineId,
|
||||
currentStation.getName(), nextStation.getName(), String.valueOf(currentLineId),"",
|
||||
OCHAdasAbilityManager.getInstance().getAutopilotUnAbilityReason());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,19 +1,15 @@
|
||||
package com.mogo.och.bus.net;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.bus.bean.BusCloseTaskRequest;
|
||||
import com.mogo.och.bus.bean.BusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryWriteOffPassengersResponse;
|
||||
import com.mogo.och.bus.bean.BusWriteOffPassengersQueryRequest;
|
||||
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
|
||||
import com.mogo.och.bus.bean.BusQueryLineStationsRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
|
||||
import com.mogo.och.bus.bean.BusResetDrivingLineRequest;
|
||||
import com.mogo.och.bus.bean.BusUpdateSiteStatusRequest;
|
||||
import com.mogo.och.bus.bean.request.BusCloseTaskRequest;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.request.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.response.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.request.CarHeartbeatReqBean;
|
||||
import com.mogo.och.bus.bean.request.BusQueryLineStationsRequest;
|
||||
import com.mogo.och.bus.bean.request.BusResetDrivingLineRequest;
|
||||
import com.mogo.och.bus.bean.request.BusUpdateSiteStatusRequest;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
@@ -38,9 +34,7 @@ public interface IBascApiService {
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/line/v2/lineDataWithDriver/query" )
|
||||
@POST( "/autopilot-car-hailing/line/v2/driver/bus/lineDataWithDriver/query" )
|
||||
// @POST( "/mock/268/autopilot-car-hailing/bus/api/lineDataWithDriver/query" )
|
||||
Observable<BusRoutesResponse> queryBusRoutes(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request);
|
||||
|
||||
/**
|
||||
@@ -58,10 +52,7 @@ public interface IBascApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/car/v2/bus/driving/away")
|
||||
// @POST("/autopilot-car-hailing/car/v2/driver/bus/driving/away")
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/leave")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/away")
|
||||
Observable<BaseData> leaveStation(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusUpdateSiteStatusRequest request);
|
||||
|
||||
/**
|
||||
@@ -70,37 +61,16 @@ public interface IBascApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/order/v2/bus/driving/attachSite")
|
||||
// @POST("/autopilot-car-hailing/order/v2/driver/bus/driving/attachSite")
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/arrive")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/attachSite")
|
||||
Observable< BaseData > arriveSiteStation(@Header ("appId") String appId,@Header("ticket") String ticket,@Body BusUpdateSiteStatusRequest request);
|
||||
|
||||
|
||||
/**
|
||||
* 到站查询下车乘客
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/order/v2/bus/driving/siteArrivedOrders")
|
||||
@POST("/autopilot-car-hailing/order/v2/driver/bus/driving/siteArrivedOrders")
|
||||
// @POST("/mock/268/autopilot-car-hailing/bus/api/driving/siteArrivedOrders")
|
||||
Observable< QueryLeaveAwayPassengersResponse > queryStationLeaveAwayPassengers(@Header ("appId") String appId,@Header("ticket") String ticket,@Body QueryLeaveAwayPassengersRequest request);
|
||||
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @GET("/autopilot-car-hailing/order/v2/bus/servicingOrders/query")
|
||||
@GET("/autopilot-car-hailing/order/v2/driver/bus/servicingOrders/query")
|
||||
// @GET("/mock/268/autopilot-car-hailing/bus/api/servicingOrders/query")
|
||||
Observable<BusOrdersResponse> queryBusOrders(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/location/v2/driver/heartbeat" )
|
||||
@POST( "/autopilot-car-hailing/location/v2/driver/bus/heartbeat" )
|
||||
Observable<BaseData> runCarHeartbeat(@Header ("appId") String appId,@Header("ticket") String ticket,@Body CarHeartbeatReqBean data);
|
||||
|
||||
@@ -125,6 +95,13 @@ public interface IBascApiService {
|
||||
Observable<BusQueryLineTaskResponse> queryBusTaskByLineId(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("lineId") String lineId);
|
||||
|
||||
|
||||
/**
|
||||
* 上传轨迹信息
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/location/v2/driver/bus/saveLineCoordinate" )
|
||||
Observable<BaseData> updateOrderRoute(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusRoutePlanningUpdateReqBean data);
|
||||
@@ -149,16 +126,5 @@ public interface IBascApiService {
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/endTask")
|
||||
Observable<BaseData> endTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
|
||||
|
||||
/**
|
||||
* 查询核销乘客,目前不再使用,改为后台下发核销的乘客
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST("/autopilot-car-hailing/operation/v1/driver/order/verificationResult")
|
||||
Observable<BusQueryWriteOffPassengersResponse> queryWriteOffPassengers(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusWriteOffPassengersQueryRequest data);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +1,13 @@
|
||||
package com.mogo.och.bus.net;
|
||||
|
||||
import com.mogo.eagle.core.data.BaseData;
|
||||
import com.mogo.och.bus.bean.BusCloseTaskRequest;
|
||||
import com.mogo.och.bus.bean.BusOrdersResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLineStationsRequest;
|
||||
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryWriteOffPassengersResponse;
|
||||
import com.mogo.och.bus.bean.BusResetDrivingLineRequest;
|
||||
import com.mogo.och.bus.bean.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.BusUpdateSiteStatusRequest;
|
||||
import com.mogo.och.bus.bean.BusWriteOffPassengersQueryRequest;
|
||||
import com.mogo.och.bus.bean.CarHeartbeatReqBean;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersRequest;
|
||||
import com.mogo.och.bus.bean.QueryLeaveAwayPassengersResponse;
|
||||
import com.mogo.och.bus.bean.request.BusCloseTaskRequest;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.request.BusResetDrivingLineRequest;
|
||||
import com.mogo.och.bus.bean.request.BusRoutePlanningUpdateReqBean;
|
||||
import com.mogo.och.bus.bean.response.BusRoutesResponse;
|
||||
import com.mogo.och.bus.bean.request.BusUpdateSiteStatusRequest;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import retrofit2.http.Body;
|
||||
@@ -34,12 +27,8 @@ import retrofit2.http.Query;
|
||||
public interface ISAASApiService {
|
||||
/**
|
||||
* 根据车机坐标获取所在区域全部站点信息
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/line/v2/driver/bus/lineDataWithDriver/query" )
|
||||
@GET( "/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query" )
|
||||
Observable<BusRoutesResponse> queryBusRoutes(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
@@ -49,64 +38,28 @@ public interface ISAASApiService {
|
||||
* 开始路线
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/startTask" )
|
||||
@POST( "/och-bus-cabin/cab/flow/v1/bus/driver/startTask" )
|
||||
Observable<BusRoutesResponse> switchLine(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusResetDrivingLineRequest request);
|
||||
|
||||
/**
|
||||
* 离站,通知服务器
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/leave")
|
||||
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/leave")
|
||||
Observable<BaseData> leaveStation(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusUpdateSiteStatusRequest request);
|
||||
|
||||
/**
|
||||
* 到站 更新到站信息
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/arrive")
|
||||
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/arrive")
|
||||
Observable< BaseData > arriveSiteStation(@Header ("appId") String appId,@Header("ticket") String ticket,@Body BusUpdateSiteStatusRequest request);
|
||||
|
||||
|
||||
/**
|
||||
* 到站查询下车乘客
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @POST("/autopilot-car-hailing/order/v2/driver/bus/driving/siteArrivedOrders")
|
||||
@POST("/och-bus-cabin/api/business/v1/siteArrivedOrders")
|
||||
Observable< QueryLeaveAwayPassengersResponse > queryStationLeaveAwayPassengers(@Header ("appId") String appId,@Header("ticket") String ticket,@Body QueryLeaveAwayPassengersRequest request);
|
||||
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @GET("/autopilot-car-hailing/order/v2/driver/bus/servicingOrders/query")
|
||||
@GET("/och-bus-cabin/api/business/v1/servicingOrders/query")
|
||||
Observable<BusOrdersResponse> queryBusOrders(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/location/v2/driver/bus/heartbeat" )
|
||||
Observable<BaseData> runCarHeartbeat(@Header ("appId") String appId,@Header("ticket") String ticket,@Body CarHeartbeatReqBean data);
|
||||
|
||||
/**
|
||||
* 查询车辆配置的所有路线
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @GET("/autopilot-car-hailing/line/v2/driver/bus/bindLine/query")
|
||||
@GET("/och-bus-cabin/api/business/v1/driver/BusBindLine")
|
||||
Observable<BusQueryLinesResponse> queryBusLines(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
@@ -118,11 +71,13 @@ public interface ISAASApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @GET("/autopilot-car-hailing/line/v2/driver/bus/task/query")
|
||||
@GET("/och-bus-cabin/api/business/v1/driver/bus/task/query")
|
||||
Observable<BusQueryLineTaskResponse> queryBusTaskByLineId(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("lineId") String lineId);
|
||||
|
||||
|
||||
/**
|
||||
* 上传轨迹信息
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST( "/autopilot-car-hailing/location/v2/driver/bus/saveLineCoordinate" )
|
||||
Observable<BaseData> updateOrderRoute(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusRoutePlanningUpdateReqBean data);
|
||||
@@ -135,7 +90,6 @@ public interface ISAASApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/abortTask")
|
||||
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/abortTask")
|
||||
Observable<BaseData> abortTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
|
||||
|
||||
@@ -147,19 +101,8 @@ public interface ISAASApiService {
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
// @POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/endTask")
|
||||
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/endTask")
|
||||
Observable<BaseData> endTask(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
|
||||
|
||||
/**
|
||||
* 查询核销乘客,目前不再使用,改为后台下发核销的乘客
|
||||
* @param appId
|
||||
* @param ticket
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Headers( {"Content-type:application/json;charset=UTF-8"} )
|
||||
@POST("/autopilot-car-hailing/operation/v1/driver/order/verificationResult")
|
||||
Observable<BusQueryWriteOffPassengersResponse> queryWriteOffPassengers(@Header ("appId") String appId, @Header("ticket") String ticket, @Body BusWriteOffPassengersQueryRequest data);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,15 @@ import com.mogo.eagle.core.data.BaseData
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.och.bus.bean.*
|
||||
import com.mogo.och.bus.bean.request.BusCloseTaskRequest
|
||||
import com.mogo.och.bus.bean.request.BusQueryLineStationsRequest
|
||||
import com.mogo.och.bus.bean.request.BusResetDrivingLineRequest
|
||||
import com.mogo.och.bus.bean.request.BusRoutePlanningUpdateReqBean
|
||||
import com.mogo.och.bus.bean.request.BusUpdateSiteStatusRequest
|
||||
import com.mogo.och.bus.bean.request.CarHeartbeatReqBean
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.bean.response.BusRoutesResponse
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||
@@ -209,77 +217,6 @@ object OrderServiceManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询下车乘客
|
||||
* @param context
|
||||
* @param seq
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryStationLeaveAwayPassengers(
|
||||
context: Context,
|
||||
seq: Int,
|
||||
siteId: Int,
|
||||
callback: OchCommonServiceCallback<QueryLeaveAwayPassengersResponse>?
|
||||
) {
|
||||
M_SERVICE.queryStationLeaveAwayPassengers(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
QueryLeaveAwayPassengersRequest(seq, siteId)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryStationLeaveAwayPassengers"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前到站点核销乘客
|
||||
* @param context
|
||||
* @param siteId
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryStationWriteOffPassengers(
|
||||
context: Context,
|
||||
taskId: Int,
|
||||
siteId: Int,
|
||||
prePassengerTime: Long,
|
||||
callback: OchCommonServiceCallback<BusQueryWriteOffPassengersResponse>?
|
||||
) {
|
||||
M_SERVICE.queryWriteOffPassengers(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusWriteOffPassengersQueryRequest(taskId, siteId, prePassengerTime)
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryStationWriteOffPassengers"))
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询小巴车订单
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryBusOrders(context: Context, callback: OchCommonServiceCallback<BusOrdersResponse>?) {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
M_SAAS_SERVICE.queryBusOrders(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusOrders"))
|
||||
}else{
|
||||
M_SERVICE.queryBusOrders(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
SharedPrefsMgr.getInstance().sn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryBusOrders"))
|
||||
}
|
||||
}
|
||||
@JvmStatic
|
||||
fun queryBusLines(context: Context, callback: OchCommonServiceCallback<BusQueryLinesResponse>?) {
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
|
||||
@@ -7,8 +7,8 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.callback.IBusLinesCallback;
|
||||
import com.mogo.och.bus.model.BusLineModel;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
|
||||
@@ -31,28 +31,6 @@ public class BusModelLoopManager {
|
||||
}
|
||||
|
||||
private Disposable mHeartbeatDisposable; //心跳轮询
|
||||
// private Disposable mQueryPassengerDisposable; //查询核销乘客
|
||||
|
||||
// public void startQueryPassengerWriteOffLoop() {
|
||||
// if (mQueryPassengerDisposable != null && !mQueryPassengerDisposable.isDisposed()) {
|
||||
// return;
|
||||
// }
|
||||
// CallerLogger.i(M_BUS + TAG, "startQueryPassengerWriteOffLoop()");
|
||||
// mQueryPassengerDisposable = Observable.interval(LOOP_DELAY_500,
|
||||
// LOOP_PASSENGER_5S, TimeUnit.MILLISECONDS)
|
||||
// .map((aLong -> aLong + 1))
|
||||
// .subscribeOn(Schedulers.io())
|
||||
// .observeOn(AndroidSchedulers.mainThread())
|
||||
// .subscribe(aLong -> BusOrderModel.getInstance().queryPassengerWriteOff());
|
||||
// }
|
||||
|
||||
// public void stopQueryPassengerWriteOffLoop() {
|
||||
// if (mQueryPassengerDisposable != null) {
|
||||
// CallerLogger.i(M_BUS + TAG, "stopQueryPassengerWriteOffLoop()");
|
||||
// mQueryPassengerDisposable.dispose();
|
||||
// mQueryPassengerDisposable = null;
|
||||
// }
|
||||
// }
|
||||
|
||||
public void startHeartbeatLoop() {
|
||||
if (mHeartbeatDisposable != null && !mHeartbeatDisposable.isDisposed()) {
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.mogo.och.bus.presenter;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
|
||||
import android.os.Looper;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
@@ -11,13 +9,12 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.bean.BusStationBean;
|
||||
import com.mogo.och.bus.bean.WriteOffPassenger;
|
||||
import com.mogo.och.bus.callback.IBusADASStatusCallback;
|
||||
import com.mogo.och.bus.callback.IBusControllerStatusCallback;
|
||||
@@ -35,15 +32,13 @@ import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager;
|
||||
import com.zhjt.mogo.adas.data.AdasConstants;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
import mogo_msg.MogoReportMsg;
|
||||
import system_master.SsmInfo;
|
||||
import system_master.SystemStatusInfo;
|
||||
|
||||
/**
|
||||
* 网约车小巴
|
||||
@@ -69,6 +64,8 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
public void onCreate(@NonNull LifecycleOwner owner) {
|
||||
super.onCreate(owner);
|
||||
initModelListener();
|
||||
|
||||
OrderModel.getInstance().queryBusCacheRoutes();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,11 +237,6 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startOpenAutopilot() {
|
||||
//非美化模式下启动动画
|
||||
@@ -283,7 +275,7 @@ public class BusPresenter extends Presenter<BusFragment>
|
||||
CallerLogger.d(M_BUS + TAG, " loginStatus =" + LoginStatusManager.isLogin());
|
||||
if (LoginStatusManager.isLogin()) {
|
||||
OrderModel.getInstance().startOrStopOrderLoop(true);
|
||||
OrderModel.getInstance().queryBusRoutes();
|
||||
OrderModel.getInstance().queryBusCacheRoutes();
|
||||
} else {
|
||||
BusTrajectoryManager.getInstance().stopTrajReqLoop();
|
||||
OrderModel.getInstance().startOrStopOrderLoop(false);
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.mogo.och.bus.receiver;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
|
||||
/**
|
||||
* 测试小巴车的场景
|
||||
*
|
||||
* @author donghongyu
|
||||
* @date 4/26/21 12:08 PM
|
||||
*/
|
||||
public class TestBusBroadcastReceiver extends BroadcastReceiver {
|
||||
private static final String TAG = "TestBusBroadcastReceiver";
|
||||
|
||||
private Context mContext;
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
try {
|
||||
this.mContext = context;
|
||||
int sceneType = intent.getIntExtra(BusConst.BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY, 0);
|
||||
CallerLogger.d(M_BUS + TAG, "sceneType:" + sceneType);
|
||||
|
||||
// 分发场景
|
||||
dispatchSceneTest(sceneType);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void dispatchSceneTest(int sceneType) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -15,12 +15,13 @@ import com.mogo.commons.mvp.MvpActivity
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.och.bus.presenter.BusLinePresenter
|
||||
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.ui.adapter.OpenItemAnimator
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.SpacesItemDecoration
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.bean.BusQueryLineTaskResponse
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import java.util.ArrayList
|
||||
|
||||
/**
|
||||
@@ -139,14 +140,14 @@ class BusSwitchLineActivity : MvpActivity<BusSwitchLineView?, BusLinePresenter?>
|
||||
}
|
||||
|
||||
override fun onChangeLineIdSuccess() {
|
||||
ToastUtils.showLong(resources.getString(R.string.bus_change_line_commit_tip_s))
|
||||
ToastUtils.showLong(ResourcesUtils.getString(R.string.bus_change_line_commit_tip_s))
|
||||
mPresenter?.queryBusRoutes()
|
||||
mAdapter.setOnLineItemClickListener(null)
|
||||
mPresenter?.removeListener()
|
||||
finish()
|
||||
}
|
||||
|
||||
override fun onBusLineTasks(lineTaskInfo: BusQueryLineTaskResponse?, position: Int,autoRefresh:Boolean) {
|
||||
override fun onBusLineTasks(lineTaskInfo: BusQueryLineTaskResponse?, position: Int, autoRefresh:Boolean) {
|
||||
val result = mData[position]
|
||||
if (result.taskList == null) {
|
||||
result.taskList = ArrayList()
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.mogo.och.bus.ui;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.och.bus.bean.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse;
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
|
||||
@@ -10,7 +10,7 @@ import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.bean.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.bean.response.BusQueryLinesResponse
|
||||
import com.mogo.och.bus.ui.adapter.SwitchLineAdapter.SwitchLineViewHolder
|
||||
import java.lang.Exception
|
||||
import kotlin.text.StringBuilder
|
||||
|
||||
@@ -8,7 +8,7 @@ import android.widget.TextView
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.utilcode.util.TimeUtils
|
||||
import com.mogo.och.bus.R
|
||||
import com.mogo.och.bus.bean.BusQueryLineTaskResponse
|
||||
import com.mogo.och.bus.bean.response.BusQueryLineTaskResponse
|
||||
import com.mogo.och.bus.ui.adapter.SwitchLineTaskAdapter.SwitchLineTaskViewHolder
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,115 +1,37 @@
|
||||
package com.mogo.och.bus.util
|
||||
|
||||
import android.text.TextUtils
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils
|
||||
import com.mogo.och.bus.constant.BusConst
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager
|
||||
import com.mogo.och.common.module.utils.RxUtils
|
||||
import io.reactivex.disposables.Disposable
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutopilotAnalytics
|
||||
|
||||
/**
|
||||
* OCH Bus埋点工具
|
||||
*
|
||||
* Created on 2022/3/24
|
||||
*/
|
||||
object BusAnalyticsManager {
|
||||
object BusAnalyticsManager: OchAutopilotAnalytics() {
|
||||
|
||||
private var mStartAutopilotKey: String? = null
|
||||
private val mStartAutopilotParams = HashMap<String, Any>()
|
||||
// 埋点key:接管后点击'自动驾驶'按钮启动
|
||||
private const val EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_bus_restart_autopilot"
|
||||
// 埋点key:开始服务开启自动驾驶(成功/失败)
|
||||
private const val EVENT_KEY_START_SERVICE = "event_key_och_bus_start_service"
|
||||
// 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾
|
||||
private const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_bus_ap_unable_start_reason"
|
||||
// 埋点key:点击启动自驾
|
||||
private const val EVENT_KEY_CLICK_START_AUTOPILOT = "event_key_och_bus_click_start_autopilot"
|
||||
|
||||
var startAutopiloTimeOut: Disposable? = null
|
||||
|
||||
fun triggerStartAutopilotFailureEventByAdas(failCode: String, failMsg: String) {
|
||||
RxUtils.disposeSubscribe(startAutopiloTimeOut)
|
||||
triggerStartAutopilotFailureEvent(failCode, failMsg)
|
||||
override fun getEventKeyStartService(): String {
|
||||
return EVENT_KEY_START_SERVICE
|
||||
}
|
||||
|
||||
private fun clearStartAutopilotParams() {
|
||||
mStartAutopilotParams.clear()
|
||||
override fun getEventKeyRestartService(): String {
|
||||
return EVENT_KEY_RESTART_AUTOPILOT
|
||||
}
|
||||
|
||||
private fun triggerStartAutopilotFailureEvent(failCode: String, failMsg: String) {
|
||||
if (mStartAutopilotParams.isEmpty()) return
|
||||
CallerLogger.e(SceneConstant.M_BUS + "triggerStartAutopilotFailureEvent", failMsg)
|
||||
if (CallerAutoPilotStatusListenerManager.getState() != IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_CODE] = failCode
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_MSG] = failMsg
|
||||
}
|
||||
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_MAP_ORIGINAL_DATA] =
|
||||
OCHAdasAbilityManager.getInstance().originalData
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_AUTOPILOT_STATE] =
|
||||
CallerAutoPilotStatusListenerManager.getState()
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_RESULT] =
|
||||
CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||
|
||||
MogoAnalyticUtils.track(mStartAutopilotKey, mStartAutopilotParams)
|
||||
clearStartAutopilotParams() //清空参数数据,防止误传
|
||||
override fun getEventKeyApUnableStartReason(): String {
|
||||
return EVENT_KEY_AP_UNABLE_START_REASON
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发'开启自动驾驶'埋点流程
|
||||
* 开启自动驾驶,15s内成功则发送成功埋点,否则发送失败埋点
|
||||
* @param restart false(点击'滑动出发'启动)/true(接管后点击'自动驾驶'按钮启动)
|
||||
* @param send 是否直接发送埋点(15s内开启成功则直接发送成功埋点)
|
||||
*/
|
||||
fun triggerStartAutopilotEvent(
|
||||
restart: Boolean, send: Boolean, startName: String, endName: String, lineId: Int
|
||||
) {
|
||||
mStartAutopilotKey = if (restart) BusConst.EVENT_KEY_RESTART_AUTOPILOT else BusConst.EVENT_KEY_START_SERVICE
|
||||
if (send) {
|
||||
if (mStartAutopilotParams.isEmpty()) return
|
||||
// 开启成功,上报埋点
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_CODE] = ""
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_FAILURE_MSG] = ""
|
||||
RxUtils.disposeSubscribe(startAutopiloTimeOut)
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_RESULT] = true
|
||||
MogoAnalyticUtils.track(mStartAutopilotKey, mStartAutopilotParams)
|
||||
clearStartAutopilotParams() //清空参数数据,防止误传
|
||||
} else {
|
||||
val plateNum = AppConfigInfo.plateNumber
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_SN] = SharedPrefsMgr.getInstance().sn
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_PLATE_NUM] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_TIME] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_START_NAME] = startName
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_END_NAME] = endName
|
||||
mStartAutopilotParams[BusConst.EVENT_PARAM_LINE_ID] = lineId
|
||||
startAutopiloTimeOut = RxUtils.createSubscribeOnOwnThread(BusConst.LOOP_PERIOD_15S) {
|
||||
// 15s内未开启,上报失败埋点
|
||||
triggerStartAutopilotFailureEvent("", "15s后app等待超时")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发"无法开启自驾已知异常"埋点
|
||||
* @param startName
|
||||
* @param endName
|
||||
* @param lineId
|
||||
*/
|
||||
fun triggerUnableStartAPReasonEvent(
|
||||
startName: String, endName: String, lineId: Int,
|
||||
reason: String
|
||||
) {
|
||||
val plateNum = AppConfigInfo.plateNumber
|
||||
val params = HashMap<String, Any>()
|
||||
params[BusConst.EVENT_PARAM_SN] = SharedPrefsMgr.getInstance().sn
|
||||
params[BusConst.EVENT_PARAM_PLATE_NUM] = if (TextUtils.isEmpty(plateNum)) "" else plateNum
|
||||
params[BusConst.EVENT_PARAM_ENV_ONLINE] = DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE
|
||||
params[BusConst.EVENT_PARAM_TIME] = DateTimeUtils.getTimeText(DateTimeUtils.yyyy_MM_dd_HH_mm_ss)
|
||||
params[BusConst.EVENT_PARAM_START_NAME] = startName
|
||||
params[BusConst.EVENT_PARAM_END_NAME] = endName
|
||||
params[BusConst.EVENT_PARAM_LINE_ID] = lineId
|
||||
params[BusConst.EVENT_PARAM_UNABLE_START_REASON] = reason
|
||||
MogoAnalyticUtils.track(BusConst.EVENT_KEY_AP_UNABLE_START_REASON, params)
|
||||
override fun getEventKeyClickStartAutopilot(): String {
|
||||
return EVENT_KEY_CLICK_START_AUTOPILOT
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,11 @@ import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils;
|
||||
import com.mogo.och.bus.bean.BusRoutesResult;
|
||||
import com.mogo.och.bus.constant.BusConst;
|
||||
import com.mogo.och.bus.model.OrderModel;
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager;
|
||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager;
|
||||
import com.mogo.och.data.bean.BusRoutesResult;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
package com.mogo.och.bus.view;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.och.bus.R;
|
||||
|
||||
/**
|
||||
* created by wujifei on 2021/3/24 16:20
|
||||
* describe:
|
||||
*/
|
||||
public class BusArcView extends View {
|
||||
|
||||
//中心的文字描述
|
||||
private final String mDes = "KM/H";
|
||||
//根据数据显示的圆弧Paint
|
||||
private Paint mArcPaint;
|
||||
//圆弧颜色
|
||||
private int mArcColor;
|
||||
//圆弧的画笔的宽度
|
||||
private final float mStrokeWith = getResources().getDimension(R.dimen.bus_ext_arcView_stroke_with);
|
||||
//文字描述的paint
|
||||
private Paint mTextPaint;
|
||||
|
||||
//当前进度夹角大小
|
||||
private float mIncludedAngle = 0;
|
||||
//当前数据
|
||||
private int currentValue;
|
||||
//最大数据
|
||||
private final int maxValue = 240;
|
||||
//圆弧背景的开始和结束间的夹角大小
|
||||
private final float mAngle = 270;
|
||||
//上次绘制圆弧夹角
|
||||
private float lastAngle = 0;
|
||||
|
||||
public BusArcView(Context context) {
|
||||
this(context, null);
|
||||
}
|
||||
|
||||
public BusArcView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs, 0);
|
||||
}
|
||||
|
||||
public BusArcView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
//初始化paint
|
||||
initPaint();
|
||||
//绘制弧度
|
||||
drawArc(canvas);
|
||||
//绘制文本
|
||||
drawText(canvas);
|
||||
}
|
||||
|
||||
private void drawText(Canvas canvas) {
|
||||
Rect mRect = new Rect();
|
||||
String mValue = String.valueOf(currentValue);
|
||||
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.BOLD));
|
||||
//绘制中心的数值
|
||||
mTextPaint.getTextBounds(mValue, 0, mValue.length(), mRect);
|
||||
canvas.drawText(mValue, getWidth() / 2.0f, getHeight() / 2.0f + mRect.height() / 2.0f - 10, mTextPaint);
|
||||
|
||||
mTextPaint.setTypeface(Typeface.defaultFromStyle(Typeface.NORMAL));
|
||||
//绘制中心文字描述
|
||||
mTextPaint.setTextSize(getResources().getDimension(R.dimen.bus_ext_arcView_des_text_size));
|
||||
mTextPaint.getTextBounds(mDes, 0, mDes.length(), mRect);
|
||||
canvas.drawText(mDes, getWidth() / 2.0f, getHeight() * 17.0f / 20.0f + mRect.height() / 2.0f, mTextPaint);
|
||||
}
|
||||
|
||||
private void drawArc(Canvas canvas) {
|
||||
//绘制圆弧背景
|
||||
RectF mRectF = new RectF(mStrokeWith, mStrokeWith, getWidth() - mStrokeWith, getHeight() - mStrokeWith);
|
||||
canvas.drawArc(mRectF, 135, mAngle, false, mArcPaint);
|
||||
|
||||
//绘制当前数值对应的圆弧
|
||||
mArcPaint.setColor(mArcColor);
|
||||
//根据当前数据绘制对应的圆弧
|
||||
canvas.drawArc(mRectF, 135, mIncludedAngle, false, mArcPaint);
|
||||
}
|
||||
|
||||
private void initPaint() {
|
||||
//圆弧的paint
|
||||
mArcPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
//抗锯齿
|
||||
mArcPaint.setAntiAlias(true);
|
||||
mArcPaint.setColor(Color.parseColor("#151D4C"));
|
||||
//设置透明度(数值为0-255)
|
||||
mArcPaint.setAlpha(100);
|
||||
//设置画笔的画出的形状
|
||||
mArcPaint.setStrokeJoin(Paint.Join.ROUND);
|
||||
mArcPaint.setStrokeCap(Paint.Cap.ROUND);
|
||||
//设置画笔类型
|
||||
mArcPaint.setStyle(Paint.Style.STROKE);
|
||||
//画笔宽度
|
||||
mArcPaint.setStrokeWidth(mStrokeWith);
|
||||
|
||||
//中心文字的paint
|
||||
mTextPaint = new Paint();
|
||||
mTextPaint.setAntiAlias(true);
|
||||
mTextPaint.setColor(Color.parseColor("#FFFFFF"));
|
||||
//设置文本的对齐方式
|
||||
mTextPaint.setTextAlign(Paint.Align.CENTER);
|
||||
//mTextPaint.setTextSize(getResources().getDimensionPixelSize(R.dimen.dp_12));
|
||||
mTextPaint.setTextSize(getResources().getDimension(R.dimen.bus_ext_arcView_center_text_size));
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 为绘制弧度及数据设置动画
|
||||
*
|
||||
* @param startAngle 开始的弧度
|
||||
* @param currentAngle 需要绘制的弧度
|
||||
* @param time 动画执行的时长
|
||||
*/
|
||||
private void setAnimation(float startAngle, float currentAngle, int time) {
|
||||
//绘制当前数据对应的圆弧的动画效果
|
||||
ValueAnimator progressAnimator = ValueAnimator.ofFloat(startAngle, currentAngle);
|
||||
progressAnimator.setDuration(time);
|
||||
progressAnimator.setTarget(mIncludedAngle);
|
||||
progressAnimator.addUpdateListener(animation -> {
|
||||
mIncludedAngle = (float) animation.getAnimatedValue();
|
||||
//重新绘制,不然不会出现效果
|
||||
postInvalidate();
|
||||
});
|
||||
//开始执行动画
|
||||
progressAnimator.start();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置弧形颜色
|
||||
*
|
||||
* @param value 颜色值
|
||||
*/
|
||||
public void setArcColor(int value) {
|
||||
mArcColor = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置数据
|
||||
*
|
||||
* @param value 当前绘制的值
|
||||
*/
|
||||
public void setValues(int value) {
|
||||
//完全覆盖
|
||||
if (value > maxValue) {
|
||||
value = maxValue;
|
||||
}
|
||||
if (value < 0) {
|
||||
value = 0;
|
||||
}
|
||||
currentValue = value;
|
||||
//计算弧度比重
|
||||
float scale = (float) currentValue / maxValue;
|
||||
//计算弧度
|
||||
float currentAngle = scale * mAngle;
|
||||
//开始执行动画
|
||||
setAnimation(lastAngle, currentAngle, 1000);
|
||||
lastAngle = currentAngle;
|
||||
//重新绘制
|
||||
postInvalidate();
|
||||
}
|
||||
|
||||
|
||||
private float dp2px(float dp) {
|
||||
DisplayMetrics metrics = Resources.getSystem().getDisplayMetrics();
|
||||
return dp * metrics.density;
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.mogo.och.bus.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
|
||||
/**
|
||||
* 强制拦截所有touch时间的约束布局
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class NoTouchConstraintLayout extends ConstraintLayout {
|
||||
public NoTouchConstraintLayout(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public NoTouchConstraintLayout(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public NoTouchConstraintLayout(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onInterceptTouchEvent(MotionEvent ev) {
|
||||
if(DebugConfig.isDebug()){
|
||||
return super.onInterceptTouchEvent(ev);
|
||||
}else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.mogo.och.bus.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.DashPathEffect;
|
||||
import android.graphics.LinearGradient;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.Shader;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* 垂直虚线
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class VerticalDashLineView extends View {
|
||||
public VerticalDashLineView(Context context) {
|
||||
this(context,null);
|
||||
}
|
||||
|
||||
public VerticalDashLineView(Context context, @Nullable AttributeSet attrs) {
|
||||
this(context, attrs,0);
|
||||
}
|
||||
|
||||
public VerticalDashLineView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
init();
|
||||
}
|
||||
|
||||
private final Paint linePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
|
||||
private final Path dashPath = new Path();
|
||||
|
||||
private void init(){
|
||||
linePaint.setColor(Color.GREEN);
|
||||
linePaint.setStyle(Paint.Style.STROKE);
|
||||
linePaint.setStrokeWidth(2);
|
||||
linePaint.setPathEffect(new DashPathEffect(new float[]{5, 5}, 0));
|
||||
}
|
||||
|
||||
public void setGradient(int startColor, int endColor) {
|
||||
LinearGradient linearGradient = new LinearGradient(0, 0, getWidth(), getHeight(), startColor, endColor, Shader.TileMode.CLAMP);
|
||||
linePaint.setShader(linearGradient);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
linePaint.setShader(null);
|
||||
linePaint.setColor(color);
|
||||
invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
dashPath.reset();
|
||||
dashPath.moveTo((float) getWidth()/2, 0);
|
||||
dashPath.lineTo((float) getWidth()/2,getHeight());
|
||||
canvas.drawPath(dashPath,linePaint);
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 20 KiB |
|
Before Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 4.7 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
Before Width: | Height: | Size: 5.7 KiB |
|
Before Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 7.4 KiB |
|
Before Width: | Height: | Size: 102 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 21 KiB |
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/icon_ai_select" android:state_focused="true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/icon_ai_select" android:state_focused="false" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/icon_ai_select" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/icon_ai_select" android:state_focused="true" />
|
||||
<item android:drawable="@drawable/icon_ai_normal" />
|
||||
</selector>
|
||||
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/icon_bad_case_select" android:state_focused="true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/icon_bad_case_select" android:state_focused="false" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/icon_bad_case_select" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/icon_bad_case_select" android:state_focused="true" />
|
||||
<item android:drawable="@drawable/icon_bad_case_normal" />
|
||||
</selector>
|
||||
@@ -1,5 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/bus_base_icon_in_autopilot" android:state_checked="true" />
|
||||
<item android:drawable="@drawable/bus_base_icon_not_in_autopilot" />
|
||||
</selector>
|
||||
@@ -6,11 +6,13 @@
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginTop="@dimen/dp_72">
|
||||
|
||||
<!-- 高精地图 -->
|
||||
<com.mogo.och.bus.view.BizMapView
|
||||
android:id="@+id/mapBizView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<!-- 打开调试窗口 -->
|
||||
<com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugViewTrigger
|
||||
android:layout_width="@dimen/dp_400"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
@@ -19,6 +21,7 @@
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<!-- 展示速度、档位、方向盘、刹车、加速度 -->
|
||||
<FrameLayout
|
||||
android:id="@+id/fl_speed"
|
||||
android:layout_width="@dimen/dp_618"
|
||||
@@ -57,6 +60,7 @@
|
||||
|
||||
<!--APP、MAP版本-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.VersionNameView
|
||||
android:id="@+id/viewVersionName"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="45dp"
|
||||
@@ -106,8 +110,8 @@
|
||||
<!--消息盒子选择入口-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
|
||||
android:id="@+id/viewDriverMsgBoxButton"
|
||||
android:layout_width="150dp"
|
||||
android:layout_height="150dp"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
android:layout_marginTop="15dp"
|
||||
android:layout_marginEnd="25dp"
|
||||
app:layout_constraintRight_toLeftOf="@id/viewLimitingVelocity"
|
||||
@@ -152,6 +156,7 @@
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<!-- 自动驾驶状态 -->
|
||||
<RelativeLayout
|
||||
android:id="@+id/module_mogo_och_autopilot_status"
|
||||
android:layout_width="@dimen/dp_616"
|
||||
@@ -187,16 +192,17 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<!-- 站点信息页面 -->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_mogo_och_station_panel_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/dp_13"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_marginTop="-24dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_autopilot_status"
|
||||
/>
|
||||
|
||||
<!--订单调试页面-->
|
||||
<include
|
||||
android:id="@+id/module_mogo_och_bus_test_bar"
|
||||
layout="@layout/bus_test_bar_view"
|
||||
@@ -207,96 +213,59 @@
|
||||
app:layout_constraintTop_toBottomOf="@id/module_mogo_och_station_panel_container"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<!--切换地图远近事件 @dimen/module_switch_map -->
|
||||
<LinearLayout
|
||||
android:id="@+id/bus_switch_model_layout"
|
||||
android:layout_width="@dimen/dp_172"
|
||||
android:layout_height="@dimen/dp_172"
|
||||
android:background="@drawable/bus_operation_status_bg"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/module_mogo_och_arrived_tv"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_mogo_och_arrived_tv"
|
||||
app:layout_goneMarginBottom="@dimen/module_mogo_och_margin_bottom"
|
||||
app:layout_goneMarginLeft="@dimen/module_mogo_och_margin_left">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/bus_switch_model_icon"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80" />
|
||||
</LinearLayout>
|
||||
<!-- <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:background="@drawable/bus_operation_status_bg"-->
|
||||
<!-- android:elevation="@dimen/dp_10"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:text="出车"-->
|
||||
<!-- android:textAlignment="center"-->
|
||||
<!-- android:textColor="@color/bus_autopilot_text_color_selector"-->
|
||||
<!-- android:textSize="@dimen/module_mogo_och_autopilot_status_text_size"-->
|
||||
<!-- android:textStyle="bold"-->
|
||||
<!-- android:layout_marginLeft="@dimen/module_mogo_och_margin_left"-->
|
||||
<!-- android:layout_marginBottom="@dimen/module_mogo_och_margin_bottom"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintLeft_toLeftOf="parent"/>-->
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_mogo_och_arrived_tv"
|
||||
android:layout_width="@dimen/dp_172"
|
||||
android:layout_height="@dimen/dp_172"
|
||||
android:background="@drawable/bus_operation_status_bg"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
android:layout_marginBottom="@dimen/dp_16"
|
||||
android:layout_marginStart="@dimen/dp_19"
|
||||
android:background="@drawable/common_arrive_station_selector"
|
||||
android:elevation="@dimen/dp_10"
|
||||
android:gravity="center"
|
||||
android:text="@string/bus_arrived_str"
|
||||
android:textColor="@color/bus_autopilot_text_color_selector"
|
||||
android:textSize="@dimen/module_mogo_och_arrived_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent" />
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/module_mogo_och_setting_layout"
|
||||
android:layout_width="@dimen/dp_172"
|
||||
android:layout_height="@dimen/dp_172"
|
||||
android:background="@drawable/bus_operation_status_bg"
|
||||
android:elevation="@dimen/dp_10"
|
||||
<com.mogo.och.common.module.wigets.map.toolsview.ToolsView
|
||||
android:id="@+id/toolsView"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/bus_switch_model_layout">
|
||||
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_arrived_tv"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/bus_setting_btn_bg" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/module_mogo_och_badcase_rl"
|
||||
android:layout_width="@dimen/dp_172"
|
||||
android:layout_height="@dimen/dp_172"
|
||||
android:background="@drawable/bus_operation_status_bg_selector"
|
||||
<!--切换地图远近事件 @dimen/module_switch_map -->
|
||||
<com.mogo.och.common.module.wigets.map.switchvisual.VisualView
|
||||
android:id="@+id/switch_visual_view"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_setting_layout">
|
||||
app:layout_constraintLeft_toRightOf="@id/toolsView"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_gravity="center"
|
||||
android:src="@drawable/icon_bad_case" />
|
||||
</RelativeLayout>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.RomaBusView
|
||||
android:layout_width="@dimen/dp_172"
|
||||
android:layout_height="@dimen/dp_172"
|
||||
app:layout_constraintBottom_toBottomOf="@id/module_mogo_och_badcase_rl"
|
||||
app:layout_constraintLeft_toRightOf="@id/module_mogo_och_badcase_rl"
|
||||
app:layout_constraintTop_toTopOf="@id/module_mogo_och_badcase_rl"
|
||||
app:roma_close_bg="@drawable/bus_operation_status_bg"
|
||||
app:roma_open_bg="@drawable/bus_operation_status_select_bg" />
|
||||
<com.mogo.och.common.module.wigets.map.reportworkorder.ReportWorkOrderView
|
||||
android:id="@+id/reportworkorderview"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@id/switch_visual_view"
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.RomaTaxiView
|
||||
android:layout_width="@dimen/dp_142"
|
||||
android:layout_height="@dimen/dp_142"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
android:layout_marginStart="-10dp"
|
||||
android:layout_marginBottom="@dimen/dp_17"
|
||||
app:layout_constraintLeft_toRightOf="@id/reportworkorderview"
|
||||
app:roma_close_bg="@drawable/common_driverroma_normal"
|
||||
app:roma_open_bg="@drawable/common_driver_roma_press" />
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.RomaDistanceView
|
||||
android:layout_width="wrap_content"
|
||||
@@ -324,76 +293,6 @@
|
||||
app:textSize="@dimen/module_mogo_och_slide_panel_textSize"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAutopilotDisable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#f00"
|
||||
android:text="Disable"
|
||||
android:textSize="@dimen/dp_60"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAutopilotEnable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#0f0"
|
||||
android:text="Enable"
|
||||
android:textSize="@dimen/dp_60"
|
||||
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotDisable" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAutopilotRunning"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00f"
|
||||
android:text="Running"
|
||||
android:textSize="@dimen/dp_60"
|
||||
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotEnable" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAutopilotPingxing"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#00f"
|
||||
android:text="pingxingjiashi"
|
||||
android:textSize="@dimen/dp_60"
|
||||
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotRunning" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAutopilotArrive"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#f00"
|
||||
android:text="Arrived"
|
||||
android:textSize="@dimen/dp_60"
|
||||
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotPingxing" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnAutopilotRoute"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="#023D35"
|
||||
android:text="上传全路径"
|
||||
android:textSize="@dimen/dp_60"
|
||||
app:layout_constraintRight_toRightOf="@id/btnAutopilotDisable"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnAutopilotArrive"
|
||||
tools:ignore="TextContrastCheck" />
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:id="@+id/groupTestPanel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"
|
||||
app:constraint_referenced_ids="btnAutopilotArrive,btnAutopilotDisable,btnAutopilotEnable
|
||||
,btnAutopilotRunning,btnAutopilotRoute,btnAutopilotPingxing"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<com.mogo.eagle.core.function.smp.view.SmallMapView
|
||||
android:id="@+id/smallMapView"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -408,5 +307,14 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"/>
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.ConnectionProcessView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_18"
|
||||
app:layout_constraintBottom_toTopOf="@id/viewVersionName"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -9,6 +9,7 @@ import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.ActivityUtils
|
||||
import com.mogo.eagle.core.utilcode.util.DeviceUtils
|
||||
import com.mogo.eagle.core.utilcode.util.MultiDisplayUtils
|
||||
import com.mogo.och.bus.passenger.passenger.ui.PM2BaseFragment
|
||||
import com.mogo.och.bus.passenger.passenger.ui.widget.M2StatusBarView
|
||||
@@ -31,7 +32,7 @@ class BusPassengerProvider : CommonServiceImpl() {
|
||||
private var mPM2Fragment: Fragment?=null
|
||||
|
||||
override fun getFragment(): Fragment {
|
||||
if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode)) {
|
||||
if (AppIdentityModeUtils.isB1(FunctionBuildConfig.appIdentityMode) && DeviceUtils.isEB5Model()) {
|
||||
MultiDisplayUtils.startActWithSecond(ActivityUtils.getTopActivity(), MediaPlayerActivity::class.java)
|
||||
}
|
||||
if(mPM2Fragment==null){
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等)
|
||||
*/
|
||||
public interface IAutopilotStatusCallback {
|
||||
|
||||
void updateAutoStatus(boolean isOpen);
|
||||
}
|
||||
@@ -5,7 +5,5 @@ package com.mogo.och.bus.passenger.callback;
|
||||
* @date: 2021/10/22
|
||||
*/
|
||||
public interface IBusPassegerDriverStatusCallback {
|
||||
void changeOperationStatus(boolean changeStatus);
|
||||
void updatePlateNumber(String plateNumber);
|
||||
void updateDriverSn(String sn);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.mogo.och.bus.passenger.passenger.callback
|
||||
package com.mogo.och.bus.passenger.callback
|
||||
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
|
||||
@@ -6,14 +6,12 @@ import com.mogo.och.data.bean.BusStationBean
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/2
|
||||
*/
|
||||
interface DrivingInfoCallback {
|
||||
fun updateSpeed(speed: Int)
|
||||
fun updatePlateNumber(carNum: String)
|
||||
interface IDrivingInfoCallback {
|
||||
fun updateLine(lineName: String, lineDuring: String)
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, currentStationIndex: Int, isArrived: Boolean)
|
||||
fun updateRemainMT(meters : Long, timeInSecond : Long) // 米,秒
|
||||
fun changeOperationStatus(loginStatus : Boolean)
|
||||
fun showNoTaskView(isTrue : Boolean)
|
||||
fun updateLineStations(stations: MutableList<BusStationBean>)
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean)
|
||||
fun clearCustomPolyline()
|
||||
|
||||
fun showNoTaskView();
|
||||
fun hideNoTaskView();
|
||||
}
|
||||
@@ -1,15 +1,12 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Model->Presenter回调:状态控制器监听(accOn、adas ui show、voice ui show、push ui show、v2x ui show等等)
|
||||
*/
|
||||
public interface IBusPassengerControllerStatusCallback {
|
||||
// 是否vr map模式
|
||||
void onVRModeChanged(boolean isVRMode);
|
||||
public interface ISpeedCallback {
|
||||
|
||||
// 自车定位
|
||||
void onCarLocationChanged(MogoLocation location);
|
||||
void onCarLocationChanged(float location);
|
||||
}
|
||||
@@ -0,0 +1,450 @@
|
||||
package com.mogo.och.bus.passenger.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.och.bus.passenger.callback.IAutopilotStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.IDrivingInfoCallback
|
||||
import com.mogo.och.bus.passenger.callback.ISpeedCallback
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager
|
||||
import com.mogo.och.common.module.biz.lansocket.IOchLanPassengerStatusListener
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
||||
import com.mogo.och.common.module.biz.login.ILoginCallback
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusEnum
|
||||
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||
import com.mogo.och.common.module.biz.login.OpenOrderStatusEnum
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.common.module.manager.distance.IDistanceListener
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.ILanMessageListener
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.BusTransferData
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object OrderModel {
|
||||
|
||||
private val TAG = OrderModel::class.java.simpleName
|
||||
|
||||
private val TAG_LOOP_QUERY_BIND_LINE = "${TAG}_TAG_LOOP_QUERY_BIND_LINE"
|
||||
|
||||
private var mContext: Context? = null
|
||||
|
||||
private var routesResult: BusRoutesResult? = null
|
||||
private var mNextStationIndex = 0 // A-B要到达站的index
|
||||
|
||||
|
||||
var mDrivingInfoCallback: IDrivingInfoCallback? = null //行程信息
|
||||
var mADASStatusCallback: IAutopilotStatusCallback? = null//Model->Presenter:自动驾驶状态相关
|
||||
var mSpeedCallback: ISpeedCallback? = null //行程信息
|
||||
var mDriverStatusCallback: IBusPassegerDriverStatusCallback? = null //出车收车状态
|
||||
|
||||
fun init(context: Context){
|
||||
mContext = context
|
||||
initListeners()
|
||||
queryDriverByLocalDriver()
|
||||
queryDriverOperationStatus()
|
||||
BizLoopManager.setLoopFunction(
|
||||
TAG_LOOP_QUERY_BIND_LINE,
|
||||
LoopInfo(2, ::queryDriverSiteByCoordinate)
|
||||
)
|
||||
}
|
||||
|
||||
private fun initListeners() {
|
||||
//自动驾驶状态监听
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 3, mMapLocationListener)
|
||||
// 距离终点站距离监听
|
||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
||||
AbnormalFactorsLoopManager.startLoopAbnormalFactors(mContext!!)
|
||||
//司乘屏通信监听
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_COMMON.type,LanSocketManager.commonListener)
|
||||
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,taskDetailsMsgListener)
|
||||
LoginLanPassengerSocket.addListener(TAG,driverSnListener)
|
||||
}
|
||||
|
||||
fun releaseListeners(){
|
||||
//自动驾驶状态监听
|
||||
OchAutoPilotStatusListenerManager.removeListener(mGoAutopilotStatusListener)
|
||||
// 注销定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
// 距离终点站距离监听
|
||||
TrajectoryAndDistanceManager.removeListener(TAG)
|
||||
|
||||
AbnormalFactorsLoopManager.stopLoopAbnormalFactors()
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
BizLoopManager.removeLoopFunction(TAG_LOOP_QUERY_BIND_LINE)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_COMMON.type,LanSocketManager.commonListener)
|
||||
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_TASK_DETAILS.type,taskDetailsMsgListener)
|
||||
LoginLanPassengerSocket.removeListener(TAG)
|
||||
|
||||
cleanStation("release")
|
||||
}
|
||||
|
||||
fun setDrivingInfoCallback(drivingInfoCallback: IDrivingInfoCallback?) {
|
||||
mDrivingInfoCallback = drivingInfoCallback
|
||||
}
|
||||
|
||||
fun setADASStatusCallback(callback: IAutopilotStatusCallback?) {
|
||||
mADASStatusCallback = callback
|
||||
}
|
||||
|
||||
fun setSpeedCallback(mSpeedCallback: ISpeedCallback?) {
|
||||
this.mSpeedCallback = mSpeedCallback
|
||||
}
|
||||
|
||||
fun setDriverStatusCallback(callback: IBusPassegerDriverStatusCallback?) {
|
||||
mDriverStatusCallback = callback
|
||||
}
|
||||
|
||||
private val mGoAutopilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state) {
|
||||
//美化模式下且行程中
|
||||
if (FunctionBuildConfig.isDemoMode && routesResult !=null
|
||||
) {
|
||||
mADASStatusCallback?.updateAutoStatus(true)
|
||||
} else {//非美化模式下
|
||||
mADASStatusCallback?.updateAutoStatus(false)
|
||||
}
|
||||
} else {//自驾状态 2
|
||||
mADASStatusCallback?.updateAutoStatus(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
OCHThreadPoolManager.getsInstance().locationExecute {
|
||||
mSpeedCallback?.onCarLocationChanged(mogoLocation.gnssSpeed)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
||||
override fun distanceCallback(distance: Float) {
|
||||
val lastTime = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"轨迹排查==lastSumLength = $distance"
|
||||
)
|
||||
if (routesResult != null) {
|
||||
for (site in routesResult!!.sites) {
|
||||
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
mDrivingInfoCallback?.updateRemainMT(distance.toLong(), lastTime.toLong())
|
||||
}
|
||||
}
|
||||
|
||||
private val taskDetailsMsgListener = object : ILanMessageListener<TaskDetailsMsg> {
|
||||
override fun target(): Class<TaskDetailsMsg> {
|
||||
return TaskDetailsMsg::class.java
|
||||
}
|
||||
|
||||
override fun onMsgReceived(taskDetailsMsg: TaskDetailsMsg?) {
|
||||
taskDetailsMsg?.let {
|
||||
if (it.msg?.isEmpty() == true){
|
||||
clearLocalRouteResult()
|
||||
return
|
||||
}
|
||||
|
||||
val result = GsonUtils.fromJson(it.msg, BusTransferData::class.java)
|
||||
mDrivingInfoCallback?.changeOperationStatus(result.loginStatus == 1)
|
||||
if (result != null && result.routesResult == null) {
|
||||
clearLocalRouteResult()
|
||||
}
|
||||
if (routesResult == null ||
|
||||
(result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion)
|
||||
) { //已司机端传来的为准
|
||||
routesResult = result.routesResult
|
||||
updatePassengerRouteInfo(routesResult)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private val driverSnListener = object :IOchLanPassengerStatusListener{
|
||||
override fun onDriverSnChagneListner(sn: String?) {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"onReceivedServerSn = $sn"
|
||||
)
|
||||
mDriverStatusCallback?.updateDriverSn(sn)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
fun queryDriverByLocalDriver() {
|
||||
//本地去请求司机端
|
||||
val msg = TaskDetailsMsg("task", BusinessType.bus)
|
||||
LanSocketManager.sendMsgToServer(msg)
|
||||
}
|
||||
|
||||
|
||||
private fun queryDriverOperationStatus() {
|
||||
LoginStatusManager.addListener(TAG,object: ILoginCallback{
|
||||
override fun onStatusChange(currentStatus: LoginStatusEnum?) {
|
||||
|
||||
}
|
||||
|
||||
override fun onOpenOrderStatusEnumChange(businessEnum: OpenOrderStatusEnum?) {
|
||||
when (businessEnum) {
|
||||
OpenOrderStatusEnum.Ordering -> {
|
||||
mDrivingInfoCallback?.changeOperationStatus(true)
|
||||
}
|
||||
else -> {
|
||||
mDrivingInfoCallback?.changeOperationStatus(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onLoginErrorInfo(code: Int, msg: String?) {
|
||||
super.onLoginErrorInfo(code, msg)
|
||||
if(code==-10012){// 网络错误
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun queryDriverSiteByCoordinate() {
|
||||
mContext?.let {
|
||||
BusPassengerServiceManager.queryDriverSiteByCoordinate(it,
|
||||
object : OchCommonServiceCallback<PM2RoutesResponse> {
|
||||
override fun onSuccess(data: PM2RoutesResponse?) {
|
||||
if (data == null || data.result == null) {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"order = queryDriverSiteByCoordinate = null"
|
||||
)
|
||||
clearLocalRouteResult()
|
||||
return
|
||||
}
|
||||
if (data.result != null && routesResult != null && data.result.equals(
|
||||
routesResult
|
||||
)) {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"order = queryDriverSiteByCoordinate = not update"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
if (routesResult != null &&
|
||||
routesResult!!.writeVersion < data.result.writeVersion
|
||||
) {
|
||||
routesResult = data.result
|
||||
}
|
||||
|
||||
if (routesResult == null) {
|
||||
routesResult = data.result
|
||||
}
|
||||
|
||||
updatePassengerRouteInfo(data.result)
|
||||
}
|
||||
override fun onError() {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"queryDriverSiteByCoordinate = onError = sn = " + LoginLanPassengerSocket.driverSn
|
||||
)
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"queryDriverSiteByCoordinate = $msg sn = ${LoginLanPassengerSocket.driverSn}"
|
||||
)
|
||||
if (code == 1003) {
|
||||
LoginStatusManager.queryLoginStatusByNet()
|
||||
cleanStation("queryDriverSiteByCoordinate 1003")
|
||||
}
|
||||
if (LoginLanPassengerSocket.driverSn.isEmpty()) {
|
||||
//此处拦截是为了防止过程中乘客屏和司机端断连,拿不到司机端sn, 造成请求失败去刷新了界面
|
||||
return
|
||||
}
|
||||
if (code == 1003) {
|
||||
routesResult = null
|
||||
cleanStation("queryDriverSiteByCoordinate 1003")
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTrajectoryStation(
|
||||
startStationInfo: BusStationBean,
|
||||
endStationInfo: BusStationBean,
|
||||
lineId: Int
|
||||
) {
|
||||
val startStation = MogoLocation()
|
||||
startStation.longitude = startStationInfo.gcjLon
|
||||
startStation.latitude = startStationInfo.gcjLat
|
||||
val endStation = MogoLocation()
|
||||
endStation.longitude = endStationInfo.gcjLon
|
||||
endStation.latitude = endStationInfo.gcjLat
|
||||
TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong())
|
||||
}
|
||||
|
||||
fun cleanStation(type: String) {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "清理站点 $type")
|
||||
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)
|
||||
}
|
||||
|
||||
fun clearLocalRouteResult() {
|
||||
routesResult = null
|
||||
mNextStationIndex = 0
|
||||
cleanStation("queryDriverSiteByCoordinate")
|
||||
mDrivingInfoCallback?.showNoTaskView()
|
||||
}
|
||||
|
||||
private fun updateAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
) {
|
||||
val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex)
|
||||
if (null == parameters) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is update.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(parameters)
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
): AutopilotControlParameters? {
|
||||
if (busRoutesResult.sites == null) {
|
||||
return null
|
||||
}
|
||||
val stations = busRoutesResult.sites
|
||||
if (leaveIndex + 1 > stations.size - 1) {
|
||||
CallerLogger.e(SceneConstant.M_BUS_P + TAG, "行程日志-mismatch condition1.")
|
||||
return null
|
||||
}
|
||||
val currentStation = stations[leaveIndex]
|
||||
val nextStation = stations[leaveIndex + 1]
|
||||
val parameters = AutopilotControlParameters()
|
||||
parameters.routeID = busRoutesResult.lineId
|
||||
parameters.routeName = busRoutesResult.name
|
||||
parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.name)
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(nextStation.name)
|
||||
parameters.startLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(currentStation.lat, currentStation.lon)
|
||||
parameters.endLatLon =
|
||||
AutopilotControlParameters.AutoPilotLonLat(nextStation.lat, nextStation.lon)
|
||||
parameters.vehicleType = 10
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutopilotControlParameters.AutoPilotLine(
|
||||
busRoutesResult.lineId.toLong(), busRoutesResult.name,
|
||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
|
||||
busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP,
|
||||
busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP,
|
||||
busRoutesResult.contrailSaveTimeDPQP
|
||||
)
|
||||
}
|
||||
return parameters
|
||||
}
|
||||
|
||||
|
||||
private fun clearAutopilotControlParameters() {
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "AutopilotControlParameters is clear.")
|
||||
CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
fun updatePassengerRouteInfo(result: BusRoutesResult?) {
|
||||
if (result == null) {
|
||||
clearLocalRouteResult()
|
||||
return
|
||||
}
|
||||
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "queryDriverSiteByCoordinate= update")
|
||||
routesResult = result
|
||||
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "order = BusPassengerRoutesResult= " + GsonUtil.jsonFromObject(result))
|
||||
mDrivingInfoCallback?.updateLine(result.name, result.runningDur)
|
||||
if (result.sites != null) {
|
||||
mDrivingInfoCallback?.hideNoTaskView()
|
||||
|
||||
val stations = result.sites
|
||||
for (i in stations.indices) {
|
||||
val station = stations[i]
|
||||
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && station.isLeaving && i + 1 < stations.size) { //离站
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"order = station= leave"
|
||||
)
|
||||
mDrivingInfoCallback?.updateStationsInfo(stations, i + 1, false)
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i"
|
||||
)
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"och-rotting--start "
|
||||
)
|
||||
mNextStationIndex = i + 1
|
||||
val startStation = stations[i]
|
||||
val endStation = stations[i + 1]
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
updateAutopilotControlParameters(result, i)
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { //到站
|
||||
CallerLogger.d(
|
||||
SceneConstant.M_BUS_P + TAG,
|
||||
"och-rotting--mNextStationIndex = $mNextStationIndex , i = $i"
|
||||
)
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "och-rotting--arrived ")
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
|
||||
TrajectoryAndDistanceManager.suspendCalculate()
|
||||
|
||||
CallerLogger.d(SceneConstant.M_BUS_P + TAG, "order = station= arrive")
|
||||
|
||||
mDrivingInfoCallback?.updateStationsInfo(stations, i, true)
|
||||
clearAutopilotControlParameters()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import com.mogo.och.bus.passenger.bean.BusPassengerQueryLineRequest
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
|
||||
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||
import com.mogo.commons.storage.SharedPrefsMgr
|
||||
import com.mogo.och.common.module.biz.lansocket.LoginLanPassengerSocket
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||
@@ -19,27 +20,12 @@ import com.mogo.och.common.module.network.interceptor.transformTry
|
||||
*/
|
||||
object BusPassengerServiceManager {
|
||||
|
||||
private var driverSnCache = ""
|
||||
|
||||
private var mBusPassengerSaasServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(PassengerSAASServiceApi::class.java)
|
||||
|
||||
private var mBusPassengerServiceApi =
|
||||
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(PassengerServiceApi::class.java)
|
||||
|
||||
/**
|
||||
* 获取Bus司机端的sn
|
||||
* @return
|
||||
*/
|
||||
public val driverAppSn: String
|
||||
get() {
|
||||
val serverToken = getServerToken()
|
||||
if (serverToken != driverSnCache && serverToken.isNotEmpty()) {
|
||||
driverSnCache = serverToken
|
||||
}
|
||||
return driverSnCache
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询绑定行驶的小巴车路线
|
||||
* @param context
|
||||
@@ -53,48 +39,17 @@ object BusPassengerServiceManager {
|
||||
mBusPassengerSaasServiceApi.queryDriverSiteByCoordinate(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
driverAppSn
|
||||
LoginLanPassengerSocket.driverSn
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate"))
|
||||
}else{
|
||||
mBusPassengerServiceApi.queryDriverSiteByCoordinate(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
BusPassengerQueryLineRequest(
|
||||
driverAppSn
|
||||
)
|
||||
BusPassengerQueryLineRequest(LoginLanPassengerSocket.driverSn)
|
||||
).transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverSiteByCoordinate"))
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询司机端出车收车状态,以及车牌号
|
||||
* @param context
|
||||
* @param callback
|
||||
*/
|
||||
@JvmStatic
|
||||
fun queryDriverOperationStatus(
|
||||
context: Context,
|
||||
callback: OchCommonServiceCallback<BusPassengerOperationStatusResponse>?
|
||||
) {
|
||||
|
||||
if (DebugConfig.getProjectFlavor().contains("saas")){
|
||||
mBusPassengerSaasServiceApi.queryDriverOperationStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
driverAppSn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus"))
|
||||
}else{
|
||||
mBusPassengerServiceApi.queryDriverOperationStatus(
|
||||
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||
SharedPrefsMgr.getInstance().token,
|
||||
driverAppSn
|
||||
)
|
||||
.transformTry()
|
||||
.subscribe(OchCommonSubscribeImpl(context, callback, "queryDriverOperationStatus"))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,19 +23,7 @@ public interface PassengerSAASServiceApi {
|
||||
* @return 接口返回数据
|
||||
*/
|
||||
@Headers( {"Content-Type:application/json;charset=UTF-8"} )
|
||||
// @POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" )
|
||||
@GET( "/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query" )
|
||||
Observable<PM2RoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
/**
|
||||
* 查询司机端的登陆状态
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @GET("/autopilot-car-hailing/operation/v1/driver/bus/passenger/loginStatus")
|
||||
@GET("/och-bus-cabin/api/business/v1/loginStatus")
|
||||
Observable<BusPassengerOperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -26,15 +26,4 @@ public interface PassengerServiceApi {
|
||||
@POST( "/autopilot-car-hailing/line/v2/driver/bus/passenger/lineDataWithDriver/query" )
|
||||
Observable<PM2RoutesResponse> queryDriverSiteByCoordinate(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusPassengerQueryLineRequest request);
|
||||
|
||||
/**
|
||||
* 查询司机端的登陆状态
|
||||
* @param sn
|
||||
* @return
|
||||
*/
|
||||
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||
// @GET("/autopilot-car-hailing/car/v2/driver/bus/passenger/takeOrderStatus/query")
|
||||
@GET("/autopilot-car-hailing/operation/v1/driver/bus/passenger/loginStatus")
|
||||
Observable<BusPassengerOperationStatusResponse> queryDriverOperationStatus(@Header ("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,64 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.utils;
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @date 12/18/20 5:37 PM
|
||||
*/
|
||||
public class BusPassengerMapAssetStyleUtil {
|
||||
|
||||
public static byte[] getAssetsStyle(Context context,String fileName) {
|
||||
byte[] buffer1 = null;
|
||||
InputStream is1 = null;
|
||||
try {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
int count = 0;
|
||||
while ((count = is1.read(buffer1)) > 0) {
|
||||
is1.read(buffer1);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (is1 != null) {
|
||||
is1.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return buffer1;
|
||||
}
|
||||
|
||||
|
||||
public static byte[] getAssetsExtraStyle(Context context, String fileName) {
|
||||
byte[] buffer1 = null;
|
||||
InputStream is1 = null;
|
||||
try {
|
||||
is1 = context.getResources().getAssets().open(fileName); //eg. over_view_style_extra.data
|
||||
int lenght1 = is1.available();
|
||||
buffer1 = new byte[lenght1];
|
||||
is1.read(buffer1);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (is1 != null) {
|
||||
is1.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return buffer1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.utils
|
||||
|
||||
import android.content.res.Resources
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/1/21
|
||||
*/
|
||||
object DimenUtil{
|
||||
fun dp2px(value:Float):Float{
|
||||
return (0.5f + value * Resources.getSystem().displayMetrics.density)
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*
|
||||
* Model->Presenter回调:ADAS相关(自动驾驶状态回调,到达终点等等)
|
||||
*/
|
||||
public interface IBusPassengerADASStatusCallback {
|
||||
|
||||
// 自动驾驶可用状态
|
||||
void onAutopilotEnable();
|
||||
|
||||
// 自动驾驶不可用状态
|
||||
void onAutopilotDisable();
|
||||
|
||||
// 自动驾驶运行中
|
||||
void onAutopilotRunning();
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public interface IBusPassengerAutopilotPlanningCallback {
|
||||
void routeResult(List<LatLng> routeArrivied, List<LatLng> routeArriving, MogoLocation location);
|
||||
void routePlanningToNextStationChanged(long meters, long timeInSecond);
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/3/10
|
||||
*/
|
||||
public interface IBusPassengerMapViewCallback {
|
||||
void onCameraChange(float bearing);
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.callback;
|
||||
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2022/4/6
|
||||
*/
|
||||
public interface IBusPassengerRouteLineInfoCallback {
|
||||
void updateLineInfo(String lineName, String lineDurTime);
|
||||
void updateStationsInfo(List<BusStationBean> stations, int currentStationIndex, boolean isArrived);
|
||||
void showNoTaskView();
|
||||
void hideNoTaskView();
|
||||
}
|
||||
@@ -1,533 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.model
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import android.net.ConnectivityManager
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.aicloud.services.socket.MogoAiCloudSocketManager
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener
|
||||
import com.mogo.commons.module.intent.IntentManager
|
||||
import com.mogo.commons.module.status.IMogoStatusChangedListener
|
||||
import com.mogo.commons.module.status.MogoStatusManager
|
||||
import com.mogo.commons.module.status.StatusDescriptor
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLine
|
||||
import com.mogo.eagle.core.data.autopilot.AutopilotControlParameters.AutoPilotLonLat
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager.updateAutopilotControlParameters
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager.addListener
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.network.utils.GsonUtil
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils.isPassenger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
|
||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.och.bus.passenger.callback.*
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager.driverAppSn
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.AppConnectMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BaseDPMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
||||
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager
|
||||
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager.pushAppOperationalMsgBox
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.ArrivedStation
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager.startLoopAbnormalFactors
|
||||
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager.stopLoopAbnormalFactors
|
||||
import com.mogo.och.common.module.manager.distance.IDistanceListener
|
||||
import com.mogo.och.common.module.manager.distance.ITrajectoryListener
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager.addDistanceListener
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager.addTrajectoryListener
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager.setStationPoint
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager.suspendCalculate
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import com.mogo.och.common.module.utils.PinYinUtil
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import mogo.telematics.pad.MessagePad.ArrivalNotification
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
/**
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object BusPassengerModel {
|
||||
|
||||
private val TAG = BusPassengerModel::class.java.simpleName
|
||||
private val TAG_LOOP_QUERY_BIND_LINE = "${TAG}_TAG_LOOP_QUERY_BIND_LINE"
|
||||
private const val MSG_QUERY_BUS_P_STATION = 1001
|
||||
|
||||
private var mContext: Context? = null
|
||||
private var mADASStatusCallback: IBusPassengerADASStatusCallback? =
|
||||
null//Model->Presenter:自动驾驶状态相关
|
||||
private var mAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback? =
|
||||
null//Model->Presenter:自动驾驶线路规划
|
||||
private val mControllerStatusCallbackMap: MutableMap<String, IBusPassengerControllerStatusCallback> =
|
||||
ConcurrentHashMap()
|
||||
private var mDriverStatusCallback: IBusPassegerDriverStatusCallback? = null//出车收车状态
|
||||
private var mRouteLineInfoCallback: IBusPassengerRouteLineInfoCallback? = null// bus路线信息更新
|
||||
private var mLocation: MogoLocation? = null
|
||||
private var routesResult: BusRoutesResult? = null
|
||||
var mStations: MutableList<BusStationBean> = ArrayList()
|
||||
private var mNextStationIndex = 0 // 要到达站的index
|
||||
private val mTwoStationsRouts: MutableList<MogoLocation> = ArrayList()
|
||||
private val handler = Handler(Looper.getMainLooper(), Handler.Callback { msg ->
|
||||
if (msg.what == MSG_QUERY_BUS_P_STATION) {
|
||||
queryDriverOperationStatus()
|
||||
return@Callback true
|
||||
}
|
||||
false
|
||||
})
|
||||
|
||||
@Volatile
|
||||
private var isGoingToNextStation = false
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context.applicationContext
|
||||
initListeners()
|
||||
queryDriverOperationStatus()
|
||||
BizLoopManager.setLoopFunction(
|
||||
TAG_LOOP_QUERY_BIND_LINE,
|
||||
LoopInfo(2, ::queryDriverSiteByCoordinate, scheduler = Schedulers.io())
|
||||
)
|
||||
}
|
||||
|
||||
fun setDriverStatusCallback(callback: IBusPassegerDriverStatusCallback?) {
|
||||
mDriverStatusCallback = callback
|
||||
}
|
||||
|
||||
fun setRouteLineInfoCallback(callback: IBusPassengerRouteLineInfoCallback?) {
|
||||
mRouteLineInfoCallback = callback
|
||||
}
|
||||
|
||||
private fun queryDriverOperationDelay() {
|
||||
handler.sendEmptyMessageDelayed(
|
||||
MSG_QUERY_BUS_P_STATION,
|
||||
BusPassengerConst.QUERY_BUS_P_STATION_DELAY
|
||||
)
|
||||
}
|
||||
|
||||
private fun queryDriverOperationStatus() {
|
||||
BusPassengerServiceManager.queryDriverOperationStatus(
|
||||
mContext!!, object : OchCommonServiceCallback<BusPassengerOperationStatusResponse> {
|
||||
override fun onSuccess(data: BusPassengerOperationStatusResponse?) {
|
||||
if (data?.data == null) return
|
||||
if (mDriverStatusCallback != null) {
|
||||
d(
|
||||
M_BUS_P + TAG,
|
||||
"queryDriverOperationStatus = %s",
|
||||
data.data.plateNumber
|
||||
)
|
||||
mDriverStatusCallback?.changeOperationStatus(data.data.driverStatus == 1)
|
||||
mDriverStatusCallback?.updatePlateNumber(data.data.plateNumber)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
}
|
||||
queryDriverOperationDelay()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
//延迟3s再次查询
|
||||
queryDriverOperationDelay()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun queryDriverSiteByCoordinate() {
|
||||
BusPassengerServiceManager.queryDriverSiteByCoordinate(
|
||||
mContext!!, object : OchCommonServiceCallback<PM2RoutesResponse> {
|
||||
override fun onSuccess(data: PM2RoutesResponse) {
|
||||
if (data.result == null) {
|
||||
d(M_BUS_P + TAG, "order = queryDriverSiteByCoordinate = null")
|
||||
if (routesResult != null) {
|
||||
routesResult = null
|
||||
mNextStationIndex = 0
|
||||
}
|
||||
cleanStation("queryDriverSiteByCoordinate")
|
||||
mRouteLineInfoCallback?.showNoTaskView()
|
||||
return
|
||||
}
|
||||
if (routesResult != null && data.result.equals(routesResult)) {
|
||||
d(M_BUS_P + TAG, "order = queryDriverSiteByCoordinate = not update")
|
||||
return
|
||||
}
|
||||
routesResult = data.result
|
||||
updatePassengerRouteInfo(data.result)
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
d(
|
||||
M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg
|
||||
+ ", sn = " + driverAppSn
|
||||
)
|
||||
if (code == 1003) {
|
||||
queryDriverOperationDelay()
|
||||
}
|
||||
if (driverAppSn.isEmpty()) {
|
||||
//此处拦截是为了防止过程中乘客屏和司机端断连,拿不到司机端sn, 造成请求失败去刷新了界面
|
||||
return
|
||||
}
|
||||
if (code == 1003) {
|
||||
routesResult = null
|
||||
cleanStation("queryDriverSiteByCoordinate 1003")
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private fun updatePassengerRouteInfo(result: BusRoutesResult) {
|
||||
if (mRouteLineInfoCallback != null) {
|
||||
d(
|
||||
M_BUS_P + TAG,
|
||||
"order = BusPassengerRoutesResult= " + GsonUtil.jsonFromObject(result)
|
||||
)
|
||||
mRouteLineInfoCallback?.updateLineInfo(result.name, result.runningDur)
|
||||
mRouteLineInfoCallback?.hideNoTaskView()
|
||||
if (result.sites != null) {
|
||||
val stations = result.sites
|
||||
mStations.clear()
|
||||
mStations.addAll(stations)
|
||||
for (i in stations.indices) {
|
||||
val station = stations[i]
|
||||
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && station.isLeaving && i + 1 < stations.size) { //离站
|
||||
d(M_BUS_P + TAG, "order = station= leave")
|
||||
isGoingToNextStation = true
|
||||
mRouteLineInfoCallback?.updateStationsInfo(stations, i + 1, false)
|
||||
if (mNextStationIndex != i + 1) {
|
||||
mTwoStationsRouts.clear()
|
||||
}
|
||||
mNextStationIndex = i + 1
|
||||
val startStation = mStations[i]
|
||||
val endStation = mStations[i + 1]
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
updateAutopilotControlParameters(result, i)
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) { //到站
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
|
||||
isGoingToNextStation = false
|
||||
|
||||
suspendCalculate()
|
||||
|
||||
d(M_BUS_P + TAG, "order = station= arrive")
|
||||
|
||||
mRouteLineInfoCallback?.updateStationsInfo(stations, i, true)
|
||||
clearAutopilotControlParameters()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
) {
|
||||
val parameters = initAutopilotControlParameters(busRoutesResult, leaveIndex)
|
||||
if (null == parameters) {
|
||||
e(M_BUS_P + TAG, "AutopilotControlParameters is empty.")
|
||||
return
|
||||
}
|
||||
d(M_BUS_P + TAG, "AutopilotControlParameters is update.")
|
||||
updateAutopilotControlParameters(parameters)
|
||||
}
|
||||
|
||||
private fun clearAutopilotControlParameters() {
|
||||
d(M_BUS_P + TAG, "AutopilotControlParameters is clear.")
|
||||
updateAutopilotControlParameters(null)
|
||||
}
|
||||
|
||||
private fun initAutopilotControlParameters(
|
||||
busRoutesResult: BusRoutesResult,
|
||||
leaveIndex: Int
|
||||
): AutopilotControlParameters? {
|
||||
if (busRoutesResult.sites == null) {
|
||||
return null
|
||||
}
|
||||
val stations = busRoutesResult.sites
|
||||
if (leaveIndex + 1 > stations.size - 1) {
|
||||
e(M_BUS_P + TAG, "行程日志-mismatch condition1.")
|
||||
return null
|
||||
}
|
||||
val currentStation = stations[leaveIndex]
|
||||
val nextStation = stations[leaveIndex + 1]
|
||||
val parameters = AutopilotControlParameters()
|
||||
parameters.routeID = busRoutesResult.lineId
|
||||
parameters.routeName = busRoutesResult.name
|
||||
parameters.startName = PinYinUtil.getPinYinHeadChar(currentStation.name)
|
||||
parameters.endName = PinYinUtil.getPinYinHeadChar(nextStation.name)
|
||||
parameters.startLatLon = AutoPilotLonLat(currentStation.lat, currentStation.lon)
|
||||
parameters.endLatLon = AutoPilotLonLat(nextStation.lat, nextStation.lon)
|
||||
parameters.vehicleType = 10
|
||||
if (parameters.autoPilotLine == null) {
|
||||
parameters.autoPilotLine = AutoPilotLine(
|
||||
busRoutesResult.lineId.toLong(), busRoutesResult.name,
|
||||
busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||
busRoutesResult.contrailSaveTime, busRoutesResult.carModel,
|
||||
busRoutesResult.csvFileUrlDPQP, busRoutesResult.csvFileMd5DPQP,
|
||||
busRoutesResult.txtFileUrlDPQP, busRoutesResult.txtFileMd5DPQP,
|
||||
busRoutesResult.contrailSaveTimeDPQP
|
||||
)
|
||||
}
|
||||
return parameters
|
||||
}
|
||||
|
||||
fun release() {
|
||||
releaseListeners()
|
||||
cleanStation("release")
|
||||
BizLoopManager.removeLoopFunction(TAG_LOOP_QUERY_BIND_LINE)
|
||||
}
|
||||
|
||||
fun setMoGoAutopilotPlanningListener(moGoAutopilotPlanningCallback: IBusPassengerAutopilotPlanningCallback?) {
|
||||
mAutopilotPlanningCallback = moGoAutopilotPlanningCallback
|
||||
}
|
||||
|
||||
fun setADASStatusCallback(callback: IBusPassengerADASStatusCallback?) {
|
||||
mADASStatusCallback = callback
|
||||
}
|
||||
|
||||
fun setControllerStatusCallback(
|
||||
tag: String?,
|
||||
callback: IBusPassengerControllerStatusCallback?
|
||||
) {
|
||||
if (tag == null || "" == tag) return
|
||||
if (callback == null) {
|
||||
mControllerStatusCallbackMap.remove(tag)
|
||||
return
|
||||
}
|
||||
mControllerStatusCallbackMap[tag] = callback
|
||||
}
|
||||
|
||||
private fun initListeners() {
|
||||
|
||||
// 2021.11.1重构自动驾驶 实现接口 IMoGoAutopilotStatusListener 注册监听 替换IMogoAdasOCHCallback接口
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mGoAutopilotStatusListener)
|
||||
IntentManager.getInstance()
|
||||
.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
MogoStatusManager.getInstance().registerStatusChangedListener(
|
||||
TAG,
|
||||
StatusDescriptor.VR_MODE,
|
||||
mMogoStatusChangedListener
|
||||
)
|
||||
// 定位监听
|
||||
addListener(TAG, 3, mMapLocationListener)
|
||||
|
||||
//监听司机端消息
|
||||
CallerTelematicListenerManager.addListener(TAG, mReceivedMsgListener)
|
||||
startLoopAbnormalFactors(mContext!!)
|
||||
addDistanceListener(TAG, distanceListener)
|
||||
addTrajectoryListener(TAG, trajectoryListener)
|
||||
}
|
||||
|
||||
private fun releaseListeners() {
|
||||
MogoStatusManager.getInstance().unregisterStatusChangedListener(
|
||||
TAG,
|
||||
StatusDescriptor.VR_MODE,
|
||||
mMogoStatusChangedListener
|
||||
)
|
||||
|
||||
// 注销定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
MogoAiCloudSocketManager.getInstance(mContext)
|
||||
.unregisterLifecycleListener(10010)
|
||||
OchAutoPilotStatusListenerManager.removeListener(mGoAutopilotStatusListener)
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
stopLoopAbnormalFactors()
|
||||
}
|
||||
|
||||
private val distanceListener: IDistanceListener = object : IDistanceListener {
|
||||
override fun distanceCallback(distance: Float) {
|
||||
val lastTime: Double = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
|
||||
d(M_BUS_P + TAG, "轨迹排查==lastSumLength = $distance")
|
||||
routesResult?.let {
|
||||
for (site in it.sites) {
|
||||
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
mAutopilotPlanningCallback?.routePlanningToNextStationChanged(
|
||||
distance.toLong(),
|
||||
lastTime.toLong()
|
||||
)
|
||||
}
|
||||
}
|
||||
private val trajectoryListener: ITrajectoryListener =
|
||||
object : ITrajectoryListener {
|
||||
override fun trajectoryCallback(
|
||||
routeArrivied: MutableList<MogoLocation>,
|
||||
routeArriving: MutableList<MogoLocation>,
|
||||
location: MogoLocation
|
||||
) {
|
||||
if (mAutopilotPlanningCallback != null) {
|
||||
val routeArrivedTemp: MutableList<LatLng> = ArrayList()
|
||||
val routeArrivingTemp: MutableList<LatLng> = ArrayList()
|
||||
var temp: LatLng
|
||||
for (mogoLocation in routeArrivied) {
|
||||
temp = LatLng(mogoLocation.latitude, mogoLocation.longitude)
|
||||
routeArrivedTemp.add(temp)
|
||||
}
|
||||
for (mogoLocation in routeArriving) {
|
||||
temp = LatLng(mogoLocation.latitude, mogoLocation.longitude)
|
||||
routeArrivingTemp.add(temp)
|
||||
}
|
||||
mAutopilotPlanningCallback?.routeResult(
|
||||
routeArrivedTemp,
|
||||
routeArrivingTemp,
|
||||
location
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
private val mReceivedMsgListener: IReceivedMsgListener = object : IReceivedMsgListener {
|
||||
override fun onReceivedServerSn(sn: String?) {
|
||||
d(M_BUS_P + TAG, "onReceivedServerSn = $sn")
|
||||
mDriverStatusCallback?.updateDriverSn(sn)
|
||||
}
|
||||
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {
|
||||
if (OchCommonConst.BUSINESS_STRING == type) {
|
||||
val baseMsg = GsonUtils.fromJson(String(byteArray), BaseDPMsg::class.java)
|
||||
d(
|
||||
M_BUS_P + TAG,
|
||||
"onReceivedMsg = " + GsonUtils.toJson(baseMsg)
|
||||
)
|
||||
if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_COMMON.type) {
|
||||
val (isViewShow, _, msg1) = GsonUtils.fromJson(
|
||||
String(byteArray),
|
||||
AppConnectMsg::class.java
|
||||
)
|
||||
if (isViewShow) { //消息盒子显示内容
|
||||
pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(), msg1,
|
||||
OCHSocketMessageManager.OPERATION_SYSTEM
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//监听网络变化,避免启动机器时无网导致无法更新订单信息
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, intent ->
|
||||
d(M_BUS_P + TAG, "onIntentReceived = %s", intentStr)
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
queryDriverOperationStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// VR mode变更回调
|
||||
private val mMogoStatusChangedListener =
|
||||
IMogoStatusChangedListener { descriptor: StatusDescriptor, isTrue: Boolean ->
|
||||
if (StatusDescriptor.VR_MODE == descriptor) {
|
||||
if (mControllerStatusCallbackMap.isNotEmpty()) {
|
||||
for (callback in mControllerStatusCallbackMap.values) {
|
||||
callback.onVRModeChanged(isTrue)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
mLocation = mogoLocation
|
||||
OCHThreadPoolManager.getsInstance().locationExecute {
|
||||
for (callback in mControllerStatusCallbackMap.values) {
|
||||
callback.onCarLocationChanged(mogoLocation)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private val mGoAutopilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
private var arriveAtEnd = false //乘客app专用字段
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||
mADASStatusCallback?.onAutopilotRunning()
|
||||
} else {
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex >= 0 && mNextStationIndex <= mStations.size - 1
|
||||
&& isGoingToNextStation
|
||||
) {
|
||||
d(M_BUS_P + TAG, "FunctionBuildConfig.isDemoMode is true")
|
||||
return
|
||||
}
|
||||
|
||||
if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE) {
|
||||
mTwoStationsRouts.clear()
|
||||
mADASStatusCallback?.onAutopilotEnable()
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE) {
|
||||
mTwoStationsRouts.clear()
|
||||
mADASStatusCallback?.onAutopilotDisable()
|
||||
} else if (state == IMoGoAutopilotStatusListener.STATUS_PARALLEL_DRIVING) {
|
||||
mTwoStationsRouts.clear()
|
||||
mADASStatusCallback?.onAutopilotRunning()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onAutopilotArriveAtStation(arrivalNotification: ArrivedStation?) {
|
||||
if (FunctionBuildConfig.isDemoMode
|
||||
&& isPassenger(FunctionBuildConfig.appIdentityMode)
|
||||
) {
|
||||
arriveAtEnd = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun setTrajectoryStation(
|
||||
startStationInfo: BusStationBean,
|
||||
endStationInfo: BusStationBean,
|
||||
lineId: Int
|
||||
) {
|
||||
val startStation = MogoLocation()
|
||||
startStation.longitude = startStationInfo.gcjLon
|
||||
startStation.latitude = startStationInfo.gcjLat
|
||||
val endStation = MogoLocation()
|
||||
endStation.longitude = endStationInfo.gcjLon
|
||||
endStation.latitude = endStationInfo.gcjLat
|
||||
setStationPoint(startStation, endStation, lineId.toLong())
|
||||
}
|
||||
|
||||
fun cleanStation(type: String) {
|
||||
d(M_BUS_P + TAG, "清理站点 $type")
|
||||
setStationPoint(null, null, -1L)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,19 +7,15 @@ import android.os.Looper;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassegerDriverStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerADASStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerAutopilotPlanningCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerControllerStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IBusPassengerRouteLineInfoCallback;
|
||||
import com.mogo.och.bus.passenger.model.BusPassengerModel;
|
||||
import com.mogo.och.bus.passenger.callback.IAutopilotStatusCallback;
|
||||
import com.mogo.och.bus.passenger.callback.IDrivingInfoCallback;
|
||||
import com.mogo.och.bus.passenger.callback.ISpeedCallback;
|
||||
import com.mogo.och.bus.passenger.model.OrderModel;
|
||||
import com.mogo.och.bus.passenger.ui.BusPassengerRouteFragment;
|
||||
import com.mogo.och.data.bean.BusStationBean;
|
||||
|
||||
@@ -29,12 +25,12 @@ import java.util.List;
|
||||
* Created on 2022/3/31
|
||||
*/
|
||||
public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragment> implements
|
||||
IBusPassengerADASStatusCallback, IBusPassengerControllerStatusCallback, IBusPassegerDriverStatusCallback, IBusPassengerRouteLineInfoCallback, IBusPassengerAutopilotPlanningCallback {
|
||||
IAutopilotStatusCallback, ISpeedCallback, IBusPassegerDriverStatusCallback, IDrivingInfoCallback {
|
||||
private static final String TAG = BaseBusPassengerPresenter.class.getSimpleName();
|
||||
|
||||
public BaseBusPassengerPresenter(BusPassengerRouteFragment view) {
|
||||
super(view);
|
||||
BusPassengerModel.INSTANCE.init(AbsMogoApplication.getApp());
|
||||
OrderModel.INSTANCE.init(getContext());
|
||||
initListeners();
|
||||
}
|
||||
|
||||
@@ -49,23 +45,21 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
super.onDestroy( owner );
|
||||
|
||||
releaseListeners();
|
||||
BusPassengerModel.INSTANCE.release();
|
||||
OrderModel.INSTANCE.releaseListeners();
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
BusPassengerModel.INSTANCE.setADASStatusCallback(this);
|
||||
BusPassengerModel.INSTANCE.setControllerStatusCallback(TAG, this);
|
||||
BusPassengerModel.INSTANCE.setDriverStatusCallback(this);
|
||||
BusPassengerModel.INSTANCE.setRouteLineInfoCallback(this);
|
||||
BusPassengerModel.INSTANCE.setMoGoAutopilotPlanningListener(this);
|
||||
OrderModel.INSTANCE.setADASStatusCallback(this);
|
||||
OrderModel.INSTANCE.setSpeedCallback( this);
|
||||
OrderModel.INSTANCE.setDriverStatusCallback(this);
|
||||
OrderModel.INSTANCE.setDrivingInfoCallback(this);
|
||||
}
|
||||
|
||||
private void releaseListeners() {
|
||||
BusPassengerModel.INSTANCE.setADASStatusCallback(null);
|
||||
BusPassengerModel.INSTANCE.setControllerStatusCallback(TAG, null);
|
||||
BusPassengerModel.INSTANCE.setDriverStatusCallback(null);
|
||||
BusPassengerModel.INSTANCE.setRouteLineInfoCallback(null);
|
||||
BusPassengerModel.INSTANCE.setMoGoAutopilotPlanningListener(null);
|
||||
OrderModel.INSTANCE.setADASStatusCallback(null);
|
||||
OrderModel.INSTANCE.setSpeedCallback(null);
|
||||
OrderModel.INSTANCE.setDriverStatusCallback(null);
|
||||
OrderModel.INSTANCE.setDrivingInfoCallback(null);
|
||||
}
|
||||
|
||||
private void runOnUIThread( Runnable executor ) {
|
||||
@@ -80,45 +74,17 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotEnable() {
|
||||
public void updateAutoStatus(boolean isOpen){
|
||||
if(mView!=null) {
|
||||
mView.onAutopilotStatusChanged(isOpen);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(float speed) {
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_ENABLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotDisable() {
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAutopilotRunning() {
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.onAutopilotStatusChanged(
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVRModeChanged(boolean isVRMode) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null&&location!=null) {
|
||||
mView.onCarLocationChanged(location);
|
||||
mView.onCarLocationChanged(speed);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -132,11 +98,6 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePlateNumber(String plateNumber) {
|
||||
// runOnUIThread(() -> mView.updatePlateNum(plateNumber));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDriverSn(String sn) {
|
||||
runOnUIThread(() -> {
|
||||
@@ -147,7 +108,7 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLineInfo(String lineName, String lineDurTime) {
|
||||
public void updateLine(String lineName, String lineDurTime) {
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.updateLineInfo(lineName, lineDurTime);
|
||||
@@ -176,23 +137,14 @@ public class BaseBusPassengerPresenter extends Presenter<BusPassengerRouteFragme
|
||||
@Override
|
||||
public void hideNoTaskView() {
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
if (mView != null) {
|
||||
mView.hideNoTaskView();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routeResult(List<LatLng> routeArrived,List<LatLng> routeArriving,MogoLocation location) {
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.routeResult(routeArrived, routeArriving, location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void routePlanningToNextStationChanged(long meters, long timeInSecond) {
|
||||
public void updateRemainMT(long meters, long timeInSecond) {
|
||||
runOnUIThread(() -> {
|
||||
if(mView!=null) {
|
||||
mView.updateRoutePlanningToNextStation(meters, timeInSecond);
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.mogo.och.bus.passenger.ui;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Bundle;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
@@ -16,9 +18,11 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.elegant.utils.UiThreadHandler;
|
||||
import com.mogo.eagle.core.data.enums.SidePattern;
|
||||
import com.mogo.eagle.core.data.map.MogoLocation;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.map.CallerMapUIServiceManager;
|
||||
import com.mogo.eagle.core.function.hmi.ui.setting.ToggleDebugView;
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.DriverMonitorView;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.map.overlay.IMoGoOverlayManager;
|
||||
@@ -71,13 +75,6 @@ public class BusPassengerRouteFragment extends
|
||||
private MapAndLiveVideoView mapAndLiveVideoView;
|
||||
List<View> views = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 改变自动驾驶状态
|
||||
*
|
||||
* @param status 2 - running 1 - enable 2 - disable
|
||||
*/
|
||||
private int mPrevAPStatus = -1;
|
||||
|
||||
@Override
|
||||
public int getStationPanelViewId() {
|
||||
return R.layout.bus_p_route_fragment;
|
||||
@@ -131,6 +128,18 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
});
|
||||
|
||||
mSpeedTv.setOnLongClickListener(new View.OnLongClickListener() {
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
Context context = getContext();
|
||||
if(context!=null){
|
||||
ToggleDebugView.Companion.
|
||||
getToggleDebugView().toggle(context, Gravity.RIGHT, SidePattern.RIGHT);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
mapAndLiveVideoView = findViewById(R.id.mapAndLiveVideoView);
|
||||
|
||||
initLiveView();
|
||||
@@ -242,33 +251,9 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
}
|
||||
|
||||
public void routeResult(List<LatLng> routeArrived,List<LatLng> routeArriving,MogoLocation location) {
|
||||
if (routeArrived.size() > 0||routeArriving.size()>0) {
|
||||
drawablePolyline(routeArrived,routeArriving,location);
|
||||
} else {
|
||||
clearMapView();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制
|
||||
*/
|
||||
private void drawablePolyline(List<LatLng> routeArrived,List<LatLng> routeArriving,MogoLocation location) {
|
||||
if (mMapDirectionView != null) {
|
||||
mMapDirectionView.setCoordinatesLatLng(routeArrived,routeArriving,location);
|
||||
UiThreadHandler.post(() -> mMapDirectionView.drawablePolyline());
|
||||
}
|
||||
}
|
||||
|
||||
public void clearMapView() {
|
||||
if (mMapDirectionView != null) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.clearPolyline();
|
||||
mMapDirectionView.clearCoordinatesLatLng();
|
||||
}
|
||||
});
|
||||
mMapDirectionView.clearMapView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +263,6 @@ public class BusPassengerRouteFragment extends
|
||||
@Override
|
||||
public void run() {
|
||||
mMapDirectionView.clearLineMarkers();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -311,6 +295,8 @@ public class BusPassengerRouteFragment extends
|
||||
public void hideNoTaskView(){
|
||||
if (mNoLineInfoView.getVisibility() == View.VISIBLE){
|
||||
mNoLineInfoView.setVisibility(View.GONE);
|
||||
}
|
||||
if (mRouteInfoView.getVisibility() == View.GONE){
|
||||
mRouteInfoView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
@@ -337,8 +323,7 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
|
||||
if (currentStationIndex == 0 && isArrived){ //到达始发站且并未出发, 恢复站点marker 清楚路径 清空路径点
|
||||
SharedPrefsMgr.getInstance()
|
||||
.remove(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS);
|
||||
SharedPrefsMgr.getInstance().remove(BusPassengerConst.BUS_SP_KEY_ORDER_SUM_DIS);
|
||||
clearMapView();
|
||||
}
|
||||
|
||||
@@ -364,11 +349,7 @@ public class BusPassengerRouteFragment extends
|
||||
}
|
||||
}
|
||||
|
||||
public void onCarLocationChanged(MogoLocation location) {
|
||||
updateSpeedView((float) location.getGnssSpeed());
|
||||
}
|
||||
|
||||
public void updateSpeedView(float speed){
|
||||
public void onCarLocationChanged(float speed) {
|
||||
int speedKM = (int) (Math.abs(speed) * 3.6F);
|
||||
mSpeedTv.setText(String.valueOf(speedKM));
|
||||
}
|
||||
@@ -440,21 +421,17 @@ public class BusPassengerRouteFragment extends
|
||||
mCurrentArriveTip.setText(str);
|
||||
}
|
||||
|
||||
public void onAutopilotStatusChanged(int status) {
|
||||
public void onAutopilotStatusChanged(boolean isInAutopilot) {
|
||||
UiThreadHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
// 3. 其他过程直接更新
|
||||
if (mPrevAPStatus != status){
|
||||
AutopilotStatusChanged(status);
|
||||
}
|
||||
mPrevAPStatus = status;
|
||||
AutopilotStatusChanged(isInAutopilot);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void AutopilotStatusChanged(int status) {
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING == status) {
|
||||
public void AutopilotStatusChanged(boolean isInAutopilot) {
|
||||
if (isInAutopilot) {
|
||||
mAutopilotIv.setImageResource(R.drawable.auto_open);
|
||||
} else {
|
||||
mAutopilotIv.setImageResource(R.drawable.auto_close);
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.callback
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/13
|
||||
*/
|
||||
interface AutoPilotStatusCallback {
|
||||
/**
|
||||
* false: 未开启自驾, true : 开启自驾
|
||||
*/
|
||||
fun updateAutoStatus(isOpen: Boolean)
|
||||
|
||||
fun updateAutoStatus(status: Int)
|
||||
}
|
||||
@@ -1,482 +0,0 @@
|
||||
package com.mogo.och.bus.passenger.passenger.model
|
||||
|
||||
import android.content.Context
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioFocusRequest
|
||||
import android.media.AudioManager
|
||||
import android.net.ConnectivityManager
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.mogo.commons.module.intent.IMogoIntentListener
|
||||
import com.mogo.commons.module.intent.IntentManager
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.data.map.MogoLocation
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoChassisLocationGCJ02Listener
|
||||
import com.mogo.eagle.core.function.api.telematic.IReceivedMsgListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerChassisLocationGCJ02ListenerManager
|
||||
import com.mogo.eagle.core.function.call.telematic.CallerTelematicListenerManager
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS_P
|
||||
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||
import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.bean.BusPassengerOperationStatusResponse
|
||||
import com.mogo.och.bus.passenger.constant.BusPassengerConst
|
||||
import com.mogo.och.bus.passenger.passenger.callback.AutoPilotStatusCallback
|
||||
import com.mogo.och.bus.passenger.passenger.callback.DrivingInfoCallback
|
||||
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager.pushAppOperationalMsgBox
|
||||
import com.mogo.och.common.module.constant.OchCommonConst
|
||||
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||
import com.mogo.och.data.bean.BusRoutesResult
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import com.mogo.och.data.bean.BusTransferData
|
||||
import com.mogo.och.bus.passenger.bean.PM2RoutesResponse
|
||||
import com.mogo.och.bus.passenger.network.BusPassengerServiceManager
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.IOchAutopilotStatusListener
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||
import com.mogo.och.common.module.manager.distance.IDistanceListener
|
||||
import com.mogo.och.common.module.manager.distance.TrajectoryAndDistanceManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.AppConnectMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.BaseDPMsg
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
||||
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
|
||||
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||
import kotlin.math.abs
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/1/31
|
||||
*/
|
||||
class PM2DrivingModel private constructor() {
|
||||
|
||||
private var mContext: Context? = null
|
||||
private var mLocation: MogoLocation? = null
|
||||
|
||||
private var mRoutePoints = mutableListOf<MogoLocation>()
|
||||
private var routesResult: BusRoutesResult? = null
|
||||
|
||||
var mStations = mutableListOf<BusStationBean>()
|
||||
private var mNextStationIndex = 0 // A-B要到达站的index
|
||||
private var isGoingToNextStation = false //是否前往下一站过程中
|
||||
|
||||
private var mDrivingInfoCallback: DrivingInfoCallback? = null //行程信息
|
||||
private var mAutoStatusCallback: AutoPilotStatusCallback? = null //自动驾驶状态
|
||||
|
||||
private var operationStatus: BusPassengerOperationStatusResponse.Result? = null
|
||||
|
||||
private val handler = Handler(Handler.Callback { msg ->
|
||||
if (msg.what == MSG_QUERY_BUS_P_STATION) {
|
||||
queryDriverOperationStatus()
|
||||
return@Callback true
|
||||
}
|
||||
false
|
||||
})
|
||||
|
||||
companion object {
|
||||
val TAG = PM2DrivingModel::class.java.simpleName
|
||||
val TAG_LOOP_QUERY_BIND_LINE = "${TAG}_TAG_LOOP_QUERY_BIND_LINE"
|
||||
const val MSG_QUERY_BUS_P_STATION = 1001
|
||||
val INSTANCE: PM2DrivingModel by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED) {
|
||||
PM2DrivingModel()
|
||||
}
|
||||
}
|
||||
|
||||
fun init(context: Context) {
|
||||
mContext = context
|
||||
initListener()
|
||||
queryDriverByLocalDriver()
|
||||
queryDriverOperationStatus()
|
||||
BizLoopManager.setLoopFunction(
|
||||
TAG_LOOP_QUERY_BIND_LINE,
|
||||
LoopInfo(2, ::queryDriverSiteByCoordinate)
|
||||
)
|
||||
}
|
||||
|
||||
private fun queryDriverByLocalDriver() {
|
||||
//本地去请求司机端
|
||||
val msg = TaskDetailsMsg("task")
|
||||
LanSocketManager.sendMsgToServer(msg)
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
//自动驾驶状态监听
|
||||
OchAutoPilotStatusListenerManager.addListener(TAG, mAutoPilotStatusListener)
|
||||
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.addListener(TAG, 3, mMapLocationListener)
|
||||
|
||||
//司乘屏通信监听
|
||||
CallerTelematicListenerManager.addListener(TAG, mReceivedMsgListener)
|
||||
|
||||
//网络监听
|
||||
IntentManager.getInstance()
|
||||
.registerIntentListener(ConnectivityManager.CONNECTIVITY_ACTION, mNetWorkIntentListener)
|
||||
|
||||
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
||||
}
|
||||
|
||||
fun releaseListener() {
|
||||
//自动驾驶状态监听
|
||||
CallerAutoPilotStatusListenerManager.removeListener(TAG)
|
||||
|
||||
// 定位监听
|
||||
CallerChassisLocationGCJ02ListenerManager.removeListener(TAG)
|
||||
|
||||
CallerTelematicListenerManager.removeListener(TAG)
|
||||
|
||||
TrajectoryAndDistanceManager.removeListener(TAG)
|
||||
|
||||
BizLoopManager.removeLoopFunction(TAG_LOOP_QUERY_BIND_LINE)
|
||||
|
||||
cleanStation("release")
|
||||
}
|
||||
|
||||
fun setDrivingInfoCallback(drivingInfoCallback: DrivingInfoCallback?) {
|
||||
mDrivingInfoCallback = drivingInfoCallback
|
||||
}
|
||||
|
||||
fun setAutoStatusCallback(autoPilotStatusCallback: AutoPilotStatusCallback?) {
|
||||
mAutoStatusCallback = autoPilotStatusCallback
|
||||
}
|
||||
|
||||
private val mNetWorkIntentListener = IMogoIntentListener { intentStr, _ ->
|
||||
if (ConnectivityManager.CONNECTIVITY_ACTION == intentStr) {
|
||||
if (NetworkUtils.isConnected(mContext)) {
|
||||
queryDriverOperationStatus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val mReceivedMsgListener: IReceivedMsgListener =
|
||||
object : IReceivedMsgListener {
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
override fun onReceivedMsg(type: Int, byteArray: ByteArray) {//接收司机端发来的信息
|
||||
if (OchCommonConst.BUSINESS_STRING == type) {
|
||||
val baseMsg = GsonUtils.fromJson(String(byteArray), BaseDPMsg::class.java)
|
||||
Logger.d(
|
||||
M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(baseMsg)
|
||||
)
|
||||
|
||||
if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_COMMON.type) {
|
||||
val msg = GsonUtils.fromJson(String(byteArray), AppConnectMsg::class.java)
|
||||
|
||||
if (msg != null && msg.isPlay) { //播报
|
||||
speakTTS(msg.msg)
|
||||
}
|
||||
|
||||
if (msg != null && msg.isViewShow) { //消息盒子显示内容
|
||||
pushAppOperationalMsgBox(
|
||||
DateTimeUtil.getCurrentTimeStamp(), msg.msg
|
||||
)
|
||||
}
|
||||
} else if (baseMsg != null && baseMsg.type == DPMsgType.TYPE_TASK_DETAILS.type) {
|
||||
val msg = GsonUtils.fromJson(String(byteArray), TaskDetailsMsg::class.java)
|
||||
Logger.d(M_BUS_P + TAG, "onReceivedMsg = " + GsonUtils.toJson(msg))
|
||||
if (msg == null || msg.msg?.isEmpty() == true) {
|
||||
updateLocalOrder()
|
||||
return
|
||||
}
|
||||
val result = GsonUtils.fromJson(msg.msg, BusTransferData::class.java)
|
||||
mDrivingInfoCallback?.changeOperationStatus(result.loginStatus == 1)
|
||||
if (result != null && result.routesResult == null) {
|
||||
updateLocalOrder()
|
||||
}
|
||||
|
||||
if (routesResult == null ||
|
||||
(result != null && result.routesResult?.writeVersion!! > routesResult!!.writeVersion)
|
||||
) {
|
||||
routesResult = result.routesResult
|
||||
updatePassengerRouteInfo(routesResult!!)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.O)
|
||||
private fun speakTTS(msg: String) {
|
||||
|
||||
val mAudioManager = mContext?.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
val mAudioAttributes = AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA) //设置声音的用途
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MUSIC) //设置声音的类型
|
||||
.build()
|
||||
val mAudioFocusRequest =
|
||||
AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK) //设置焦点类型
|
||||
.setAudioAttributes(mAudioAttributes) //设置声音属性
|
||||
.setAcceptsDelayedFocusGain(false) //设置接受延迟获取焦点,需要设置OnAudioFocusChangeListener来监听焦点的获取
|
||||
.build()
|
||||
mAudioManager.requestAudioFocus(mAudioFocusRequest) //抢占焦点
|
||||
|
||||
AIAssist.getInstance(mContext)
|
||||
.speakTTSVoiceWithLevel(msg, AIAssist.LEVEL0, object : IMogoVoiceCmdCallBack {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
|
||||
override fun onSpeakError(speakText: String?, errorMsg: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
|
||||
override fun onSpeakSelectTimeOut(speakText: String?) {
|
||||
mAudioManager.abandonAudioFocusRequest(mAudioFocusRequest)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
||||
override fun distanceCallback(distance: Float) {
|
||||
val lastTime = distance / BusPassengerConst.BUS_AVERAGE_SPEED * 3.6 //秒
|
||||
d(M_BUS_P + TAG, "轨迹排查==lastSumLength = $distance")
|
||||
if (routesResult != null) {
|
||||
for (site in routesResult!!.sites) {
|
||||
if (site.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !site.isLeaving) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
mDrivingInfoCallback?.updateRemainMT(distance.toLong(), lastTime.toLong())
|
||||
}
|
||||
}
|
||||
|
||||
private val mMapLocationListener: IMoGoChassisLocationGCJ02Listener =
|
||||
object : IMoGoChassisLocationGCJ02Listener {
|
||||
override fun onChassisLocationGCJ02(mogoLocation: MogoLocation?) {
|
||||
if (null == mogoLocation) return
|
||||
mLocation = mogoLocation
|
||||
OCHThreadPoolManager.getsInstance().locationExecute {
|
||||
updateSpeed(mogoLocation)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateSpeed(mogoLocation: MogoLocation) {
|
||||
// km/h
|
||||
val speedKM = (abs(mogoLocation.gnssSpeed) * 3.6f).toInt()
|
||||
|
||||
mDrivingInfoCallback?.updateSpeed(speedKM)
|
||||
}
|
||||
|
||||
private val mAutoPilotStatusListener: IOchAutopilotStatusListener =
|
||||
object : IOchAutopilotStatusListener {
|
||||
|
||||
override fun onAutopilotStatusResponse(state: Int) {
|
||||
super.onAutopilotStatusResponse(state)
|
||||
d(M_BUS_P + TAG, "onAutopilotStatusResponse ===== $state")
|
||||
if (IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING != state) {
|
||||
//美化模式下且行程中
|
||||
if (FunctionBuildConfig.isDemoMode &&
|
||||
mNextStationIndex >= 0 && mNextStationIndex <= mStations.size - 1
|
||||
&& isGoingToNextStation
|
||||
) {
|
||||
mAutoStatusCallback?.updateAutoStatus(true)
|
||||
} else {//非美化模式下
|
||||
mAutoStatusCallback?.updateAutoStatus(false)
|
||||
}
|
||||
} else {//自驾状态 2
|
||||
mAutoStatusCallback?.updateAutoStatus(true)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun queryDriverOperationDelay() {
|
||||
handler.sendEmptyMessageDelayed(
|
||||
MSG_QUERY_BUS_P_STATION,
|
||||
BusPassengerConst.QUERY_BUS_P_STATION_DELAY
|
||||
)
|
||||
}
|
||||
|
||||
private fun queryDriverOperationStatus() {
|
||||
mContext?.let {
|
||||
BusPassengerServiceManager.queryDriverOperationStatus(
|
||||
it,
|
||||
object : OchCommonServiceCallback<BusPassengerOperationStatusResponse> {
|
||||
override fun onSuccess(data: BusPassengerOperationStatusResponse?) {
|
||||
if (data?.data == null) return
|
||||
if (data.data.driverStatus != operationStatus?.driverStatus
|
||||
|| data.data.plateNumber != operationStatus?.plateNumber
|
||||
) {
|
||||
d(
|
||||
M_BUS_P + TAG,
|
||||
"queryDriverOperationStatus ===== 车牌或者登陆状态有变更"
|
||||
)
|
||||
mDrivingInfoCallback?.changeOperationStatus(data.data.driverStatus == 1)
|
||||
}
|
||||
operationStatus = data.data as BusPassengerOperationStatusResponse.Result
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
if (!NetworkUtils.isConnected(mContext)) {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.network_error_tip))
|
||||
} else {
|
||||
ToastUtils.showShort(mContext!!.getString(R.string.request_error_tip))
|
||||
}
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String) {
|
||||
//延迟3s再次查询
|
||||
queryDriverOperationDelay()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun queryDriverSiteByCoordinate() {
|
||||
mContext?.let {
|
||||
BusPassengerServiceManager.queryDriverSiteByCoordinate(it,
|
||||
object : OchCommonServiceCallback<PM2RoutesResponse> {
|
||||
override fun onSuccess(data: PM2RoutesResponse?) {
|
||||
|
||||
if (data == null || data.result == null) {
|
||||
if (routesResult != null) {
|
||||
routesResult = null
|
||||
updateLocalOrder()
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate= result is null")
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
if (data.result != null && data.result.equals(routesResult)) {
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate= not update")
|
||||
return
|
||||
}
|
||||
|
||||
if (routesResult != null &&
|
||||
routesResult!!.writeVersion < data.result.writeVersion
|
||||
) {
|
||||
routesResult = data.result
|
||||
}
|
||||
|
||||
if (routesResult == null) {
|
||||
routesResult = data.result
|
||||
}
|
||||
updatePassengerRouteInfo(data.result)
|
||||
}
|
||||
|
||||
override fun onError() {
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate = onError = sn = " + BusPassengerServiceManager.driverAppSn)
|
||||
queryDriverByLocalDriver()
|
||||
}
|
||||
|
||||
override fun onFail(code: Int, msg: String?) {
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate = %s", msg)
|
||||
if (code == 1003) {
|
||||
queryDriverOperationDelay()
|
||||
cleanStation("queryDriverSiteByCoordinate 1003")
|
||||
}
|
||||
if (BusPassengerServiceManager.driverAppSn.isEmpty()) {
|
||||
return
|
||||
}
|
||||
if (code == 1003) {
|
||||
routesResult = null
|
||||
isGoingToNextStation = false
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateLocalOrder() {
|
||||
mRoutePoints.clear()
|
||||
routesResult = null
|
||||
mNextStationIndex = 0
|
||||
cleanStation("queryDriverSiteByCoordinate")
|
||||
isGoingToNextStation = false
|
||||
mDrivingInfoCallback?.showNoTaskView(true)
|
||||
}
|
||||
|
||||
private fun updatePassengerRouteInfo(result: BusRoutesResult?) {
|
||||
|
||||
if (result == null) {
|
||||
updateLocalOrder()
|
||||
return
|
||||
}
|
||||
|
||||
if (routesResult != null && routesResult!!.lineId != result.lineId) {
|
||||
d(M_BUS_P + TAG, "lineId change= clearCustomPolyline")
|
||||
mDrivingInfoCallback?.clearCustomPolyline()
|
||||
}
|
||||
|
||||
d(M_BUS_P + TAG, "queryDriverSiteByCoordinate= update")
|
||||
routesResult = result
|
||||
|
||||
mDrivingInfoCallback?.updateLine(result.name, result.runningDur)
|
||||
if (result.sites != null) {
|
||||
mDrivingInfoCallback?.showNoTaskView(false)
|
||||
val stations: List<BusStationBean> = result.sites
|
||||
mStations.clear()
|
||||
mStations.addAll(stations)
|
||||
mDrivingInfoCallback?.updateLineStations(mStations)
|
||||
for (i in stations.indices) {
|
||||
val station: BusStationBean = stations[i]
|
||||
if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED
|
||||
&& station.isLeaving && i + 1 < stations.size
|
||||
) {
|
||||
mDrivingInfoCallback?.updateStationsInfo(
|
||||
stations as MutableList<BusStationBean>,
|
||||
i + 1,
|
||||
false
|
||||
)
|
||||
d(M_BUS_P + TAG, "och-rotting--mNextStationIndex = $mNextStationIndex , i = $i")
|
||||
d(M_BUS_P + TAG, "och-rotting--start ")
|
||||
isGoingToNextStation = true
|
||||
mNextStationIndex = i + 1
|
||||
val startStation = mStations[i]
|
||||
val endStation = mStations[i + 1]
|
||||
setTrajectoryStation(startStation, endStation, result.lineId)
|
||||
return
|
||||
} else if (station.drivingStatus == BusPassengerConst.STATION_STATUS_STOPPED && !station.isLeaving) {
|
||||
d(M_BUS_P + TAG, "och-rotting--mNextStationIndex = $mNextStationIndex , i = $i")
|
||||
d(M_BUS_P + TAG, "och-rotting--arrived ")
|
||||
if (i == stations.size - 1) {
|
||||
cleanStation("updatePassengerRouteInfo最后一个站点")
|
||||
}
|
||||
isGoingToNextStation = false
|
||||
mDrivingInfoCallback?.updateStationsInfo(
|
||||
stations as MutableList<BusStationBean>,
|
||||
i,
|
||||
true
|
||||
)
|
||||
return
|
||||
} else {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun setTrajectoryStation(
|
||||
startStationInfo: BusStationBean,
|
||||
endStationInfo: BusStationBean,
|
||||
lineId: Int
|
||||
) {
|
||||
val startStation = MogoLocation()
|
||||
startStation.longitude = startStationInfo.gcjLon
|
||||
startStation.latitude = startStationInfo.gcjLat
|
||||
val endStation = MogoLocation()
|
||||
endStation.longitude = endStationInfo.gcjLon
|
||||
endStation.latitude = endStationInfo.gcjLat
|
||||
TrajectoryAndDistanceManager.setStationPoint(startStation, endStation, lineId.toLong())
|
||||
}
|
||||
|
||||
private fun cleanStation(type: String) {
|
||||
d(M_BUS_P + TAG, "清理站点:$type")
|
||||
TrajectoryAndDistanceManager.setStationPoint(null, null, -1L)
|
||||
}
|
||||
}
|
||||
@@ -4,18 +4,20 @@ import androidx.lifecycle.LifecycleOwner
|
||||
import com.amap.api.maps.model.LatLng
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.bus.passenger.passenger.callback.AutoPilotStatusCallback
|
||||
import com.mogo.och.bus.passenger.passenger.callback.DrivingInfoCallback
|
||||
import com.mogo.och.bus.passenger.callback.IAutopilotStatusCallback
|
||||
import com.mogo.och.bus.passenger.callback.ISpeedCallback
|
||||
import com.mogo.och.bus.passenger.callback.IDrivingInfoCallback
|
||||
import com.mogo.och.bus.passenger.model.OrderModel
|
||||
import com.mogo.och.bus.passenger.passenger.model.PM2ADASModel
|
||||
import com.mogo.och.bus.passenger.passenger.model.PM2DrivingModel
|
||||
import com.mogo.och.bus.passenger.passenger.ui.PM2DrivingInfoFragment
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
|
||||
class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
Presenter<PM2DrivingInfoFragment?>(view), DrivingInfoCallback, AutoPilotStatusCallback {
|
||||
Presenter<PM2DrivingInfoFragment?>(view), IDrivingInfoCallback, IAutopilotStatusCallback,
|
||||
ISpeedCallback {
|
||||
|
||||
init {
|
||||
PM2DrivingModel.INSTANCE.init(context)
|
||||
OrderModel.init(context)
|
||||
PM2ADASModel.INSTANCE.init(context)
|
||||
initListener()
|
||||
}
|
||||
@@ -23,32 +25,19 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
override fun onDestroy(owner: LifecycleOwner) {
|
||||
super.onDestroy(owner)
|
||||
destroyListener()
|
||||
PM2DrivingModel.INSTANCE.releaseListener()
|
||||
OrderModel.releaseListeners()
|
||||
}
|
||||
|
||||
private fun initListener(){
|
||||
PM2DrivingModel.INSTANCE.setDrivingInfoCallback(this)
|
||||
PM2DrivingModel.INSTANCE.setAutoStatusCallback(this)
|
||||
OrderModel.setDrivingInfoCallback(this)
|
||||
OrderModel.setSpeedCallback(this)
|
||||
OrderModel.setADASStatusCallback(this)
|
||||
}
|
||||
|
||||
private fun destroyListener(){
|
||||
PM2DrivingModel.INSTANCE.setDrivingInfoCallback(null)
|
||||
PM2DrivingModel.INSTANCE.setAutoStatusCallback(null)
|
||||
}
|
||||
|
||||
override fun updateSpeed(speed: Int) {
|
||||
// CallerLogger.d(
|
||||
// SceneConstant.M_BUS_P + "speed = ",speed.toString()
|
||||
// )
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateSpeed(speed)
|
||||
}
|
||||
}
|
||||
|
||||
override fun updatePlateNumber(carNum: String) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateCarPlateNum(carNum)
|
||||
}
|
||||
OrderModel.setDrivingInfoCallback(null)
|
||||
OrderModel.setSpeedCallback(null)
|
||||
OrderModel.setADASStatusCallback(null)
|
||||
}
|
||||
|
||||
override fun updateLine(lineName: String, lineDuring: String) {
|
||||
@@ -70,16 +59,18 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun showNoTaskView(isTrue: Boolean) {
|
||||
override fun showNoTaskView() {
|
||||
PM2ADASModel.INSTANCE.removeHDMapStations()
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.showNoTaskView(!isTrue)
|
||||
}
|
||||
if (isTrue){
|
||||
PM2ADASModel.INSTANCE.removeHDMapStations()
|
||||
mView?.showNoTaskView()
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateLineStations(stations: MutableList<BusStationBean>) {
|
||||
override fun hideNoTaskView() {
|
||||
|
||||
}
|
||||
|
||||
private fun updateLineStations(stations: MutableList<BusStationBean>) {
|
||||
|
||||
val stationsList = mutableListOf<LatLng>()
|
||||
val stationsListPass = mutableListOf<LatLng>()
|
||||
@@ -117,16 +108,11 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
PM2ADASModel.INSTANCE.updateHDMapStations(stations)
|
||||
}
|
||||
|
||||
override fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean) {
|
||||
override fun updateStationsInfo(stations: MutableList<BusStationBean>, currentStationIndex: Int, isArrived: Boolean) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateStationsInfo(stations,i,isArrived)
|
||||
}
|
||||
}
|
||||
|
||||
override fun clearCustomPolyline() {
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.clearCustomPolyline()
|
||||
mView?.updateStationsInfo(stations,currentStationIndex,isArrived)
|
||||
}
|
||||
updateLineStations(stations)
|
||||
}
|
||||
|
||||
override fun updateAutoStatus(isOpen: Boolean) {
|
||||
@@ -135,9 +121,11 @@ class PM2DrivingPresenter(view: PM2DrivingInfoFragment?) :
|
||||
}
|
||||
}
|
||||
|
||||
override fun updateAutoStatus(status: Int) {
|
||||
|
||||
override fun onCarLocationChanged(speed: Float) {
|
||||
val speedKM: Int = (Math.abs(speed) * 3.6f).toInt()
|
||||
ThreadUtils.runOnUiThread {
|
||||
mView?.updateSpeed(speedKM)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -27,23 +27,11 @@ class PM2BaseFragment :
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
//横竖屏
|
||||
// setScreenDirection()
|
||||
tv_bug_b2_p_version.text = "版本:${AppUtils.getAppVersionName()}"
|
||||
//隐藏小地图
|
||||
initFragment()
|
||||
}
|
||||
|
||||
// private fun setScreenDirection() {
|
||||
// var ro = Settings.System.getInt(context?.contentResolver,
|
||||
// Settings.System.USER_ROTATION,Surface.ROTATION_270)
|
||||
// if (ro != Surface.ROTATION_270){
|
||||
// ro = Surface.ROTATION_270
|
||||
// }
|
||||
// Settings.System.putInt(context?.contentResolver,
|
||||
// Settings.System.USER_ROTATION,ro)
|
||||
// }
|
||||
|
||||
/**
|
||||
* 初始化行程信息,高静地图,宣传 三个fragment
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.och.bus.passenger.R
|
||||
import com.mogo.och.bus.passenger.passenger.presenter.PM2DrivingPresenter
|
||||
import com.mogo.och.common.module.utils.DateTimeUtil.*
|
||||
import com.mogo.och.common.module.utils.NumberFormatUtil
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.data.bean.BusStationBean
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.auto_tv
|
||||
import kotlinx.android.synthetic.main.bus_p_m2_driving_info_fragment.clg_distance_left_time
|
||||
@@ -66,12 +67,12 @@ class PM2DrivingInfoFragment :
|
||||
true
|
||||
}
|
||||
|
||||
line_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_line_name_tv_color))
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_line_name_tv_color))
|
||||
line_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_line_name_tv_color))
|
||||
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_line_name_tv_color))
|
||||
speed_tv.setVertrial(true)
|
||||
val intArrayOf = intArrayOf(
|
||||
requireContext().resources.getColor(R.color.bus_p_m2_color_43cefe),
|
||||
requireContext().resources.getColor(R.color.bus_p_m2_color_1466fb)
|
||||
ResourcesUtils.getColor(R.color.bus_p_m2_color_43cefe),
|
||||
ResourcesUtils.getColor(R.color.bus_p_m2_color_1466fb)
|
||||
)
|
||||
speed_tv.setmColorList(intArrayOf)
|
||||
|
||||
@@ -136,10 +137,6 @@ class PM2DrivingInfoFragment :
|
||||
speed_tv.text = speed.toString()
|
||||
}
|
||||
|
||||
fun updateCarPlateNum(plateNum : String){
|
||||
|
||||
}
|
||||
|
||||
fun updateTaskName(name: String){
|
||||
line_name_tv.text = name
|
||||
}
|
||||
@@ -150,22 +147,13 @@ class PM2DrivingInfoFragment :
|
||||
|
||||
fun changeOperationStatus(status:Boolean){
|
||||
if (!status){
|
||||
updateNoOrderUI()
|
||||
showNoTaskView()
|
||||
clearCustomPolyline()
|
||||
}
|
||||
}
|
||||
|
||||
fun showNoTaskView(haveTask: Boolean){
|
||||
setLineInfoView(haveTask)
|
||||
}
|
||||
|
||||
private fun setLineInfoView(isShow: Boolean){
|
||||
if (!isShow){
|
||||
updateNoOrderUI()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateNoOrderUI() {
|
||||
line_name_tv.text = resources.getString(R.string.bus_p_m2_not_select_line_content)
|
||||
fun showNoTaskView(){
|
||||
line_name_tv.text = ResourcesUtils.getString(R.string.bus_p_m2_not_select_line_content)
|
||||
updateNoStationView()
|
||||
overMapView?.let {
|
||||
it.clearSiteMarkers()
|
||||
@@ -179,10 +167,10 @@ class PM2DrivingInfoFragment :
|
||||
}
|
||||
}
|
||||
private fun updateNoStationView(){
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_next_tv_color))
|
||||
station_name_tv.text = resources.getString(R.string.bus_p_m2_empty_tv)
|
||||
tv_distance.text = resources.getString(R.string.bus_p_m2_empty_remain_km)
|
||||
tv_left_time.text = resources.getString(R.string.bus_p_m2_empty_remain_minute)
|
||||
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_next_tv_color))
|
||||
station_name_tv.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_tv)
|
||||
tv_distance.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_km)
|
||||
tv_left_time.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_minute)
|
||||
noLineShow()
|
||||
}
|
||||
|
||||
@@ -224,19 +212,22 @@ class PM2DrivingInfoFragment :
|
||||
}
|
||||
}
|
||||
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, i: Int, isArrived: Boolean){
|
||||
fun updateStationsInfo(stations: MutableList<BusStationBean>, currentStationIndex: Int, isArrived: Boolean){
|
||||
if (stations.size == 0) return
|
||||
if (0<= i && i<stations.size){
|
||||
station_name_tv.setTextColor(resources.getColor(R.color.bus_p_m2_next_tv_color))
|
||||
station_name_tv.text = stations[i].name
|
||||
if (0<= currentStationIndex && currentStationIndex<stations.size){
|
||||
station_name_tv.setTextColor(ResourcesUtils.getColor(R.color.bus_p_m2_next_tv_color))
|
||||
station_name_tv.text = stations[currentStationIndex].name
|
||||
}
|
||||
if (currentStationIndex == 0 && isArrived){
|
||||
clearCustomPolyline()
|
||||
}
|
||||
if (isArrived){//到站
|
||||
tv_distance.text = resources.getString(R.string.bus_p_m2_empty_remain_km)
|
||||
tv_left_time.text = resources.getString(R.string.bus_p_m2_empty_remain_minute)
|
||||
tv_next_station_title.text = resources.getString(R.string.bus_p_m2_station_title_arrived_tv)
|
||||
tv_distance.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_km)
|
||||
tv_left_time.text = ResourcesUtils.getString(R.string.bus_p_m2_empty_remain_minute)
|
||||
tv_next_station_title.text = ResourcesUtils.getString(R.string.bus_p_m2_station_title_arrived_tv)
|
||||
haveLineAndArrivedStation()
|
||||
}else{ //前往目的地中
|
||||
tv_next_station_title.text = resources.getString(R.string.bus_p_m2_next_station_title)
|
||||
tv_next_station_title.text = ResourcesUtils.getString(R.string.bus_p_m2_next_station_title)
|
||||
haveLineAndArriveingStation()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:ellipsize="marquee"
|
||||
android:text="@string/bus_p_m2_not_select_line_content"
|
||||
android:marqueeRepeatLimit="marquee_forever"
|
||||
android:maxWidth="@dimen/dp_600"
|
||||
android:singleLine="true"
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
app:wifi_size="@dimen/dp_18"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
|
||||
@@ -6,9 +6,6 @@ import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.FrameLayout
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.RelativeLayout
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.Group
|
||||
import com.magic.mogo.och.charter.R
|
||||
@@ -17,13 +14,9 @@ import com.magic.mogo.och.charter.view.autopilot.AutopilotStatusView
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotRecordListener
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutopilotRecordListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.attachAutopilotBeforeLaunchView
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.initAiCollect
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager.reportWorkOrder
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiManager.showToolsView
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxBubbleView
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView
|
||||
import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxButtonView.ClickListener
|
||||
@@ -31,10 +24,7 @@ import com.mogo.eagle.core.function.hmi.ui.msgbox.DriverMsgBoxListView
|
||||
import com.mogo.eagle.core.function.smp.view.SmallMapView
|
||||
import com.mogo.eagle.core.function.view.MapBizView
|
||||
import com.mogo.eagle.core.utilcode.kotlin.onClick
|
||||
import com.mogo.eagle.core.utilcode.mogo.view.OnPreventFastClickListener
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.listener.MogoMapListenerHandler.Companion.mogoMapListenerHandler
|
||||
import com.mogo.map.uicontroller.VisualAngleMode
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.common.module.utils.SoundPoolHelper
|
||||
import kotlinx.android.synthetic.main.charter_base_fragment.module_mogo_och_arrived_tv
|
||||
import org.greenrobot.eventbus.EventBus
|
||||
@@ -48,21 +38,15 @@ import org.greenrobot.eventbus.EventBus
|
||||
* @author tongchenfei
|
||||
*/
|
||||
abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
MvpFragment<V, P>(), IMogoMapListener, IMoGoAutopilotRecordListener {
|
||||
MvpFragment<V, P>() {
|
||||
|
||||
private val TAG = "BaseBusTabFragment"
|
||||
|
||||
private var ctvAutopilotStatus: AutopilotStatusView? = null
|
||||
protected var mSettingBtn: RelativeLayout? = null
|
||||
protected var mBadcaseBtn: RelativeLayout? = null
|
||||
protected var mAICollectBtn: RelativeLayout? = null
|
||||
private var flStationPanelContainer: FrameLayout? = null
|
||||
private var mapBizView: MapBizView? = null
|
||||
private var groupTestPanel: Group? = null
|
||||
protected var slidePanelView: SlidePanelView? = null
|
||||
//远景和中景的切换
|
||||
private var mSwitchMapModeImage: ImageView? = null
|
||||
private var mSwitchMapModeLayout: LinearLayout? = null
|
||||
|
||||
protected var smallMapView: SmallMapView? = null
|
||||
|
||||
@@ -86,40 +70,17 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
flStationPanelContainer = findViewById(R.id.module_mogo_och_station_panel_container)
|
||||
|
||||
slidePanelView = findViewById(R.id.charter_slide_panel)
|
||||
slidePanelView?.setText(resources.getString(R.string.charter_back_car))
|
||||
slidePanelView?.setText(ResourcesUtils.getString(R.string.charter_back_car))
|
||||
slidePanelView?.setOnSlidePanelMoveToEndListener(onSlideToEndListener)
|
||||
|
||||
|
||||
// mTrafficDataView = (TrafficDataView) findViewById(R.id.bus_arc);
|
||||
val flSpeed = findViewById<FrameLayout>(R.id.fl_speed)
|
||||
if (flSpeed != null) {
|
||||
attachAutopilotBeforeLaunchView(flSpeed.context, flSpeed)
|
||||
}
|
||||
|
||||
LayoutInflater.from(context).inflate(getStationPanelViewId(), flStationPanelContainer)
|
||||
mSwitchMapModeLayout = findViewById(R.id.bus_switch_model_layout)
|
||||
mSwitchMapModeImage = findViewById(R.id.bus_switch_model_icon)
|
||||
updateSwitchMapIcon()
|
||||
mSwitchMapModeLayout!!.setOnClickListener(object : OnPreventFastClickListener() {
|
||||
override fun onClickImpl(v: View) {
|
||||
mapBizView?.let {
|
||||
it.getUI()?.let { ui ->
|
||||
if (ui.currentMapVisualAngle.isLongSight) {
|
||||
ui.setLockMode(true)
|
||||
ui.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_medium)
|
||||
} else if (ui.currentMapVisualAngle.isMediumSight) {
|
||||
ui.setLockMode(false)
|
||||
ui.changeMapVisualAngle(VisualAngleMode.MODE_LONG_SIGHT, null)
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_long)
|
||||
} else {
|
||||
ui.changeMapVisualAngle(VisualAngleMode.MODE_MEDIUM_SIGHT, null)
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_medium)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
initListener()
|
||||
|
||||
// 模拟 不可自动驾驶,目前场景是刚开机,adas还未和工控机连接
|
||||
@@ -153,21 +114,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
onArriveStation()
|
||||
}
|
||||
|
||||
mSettingBtn = findViewById(R.id.module_mogo_och_setting_layout)
|
||||
mSettingBtn!!.setOnClickListener { v: View? ->
|
||||
showToolsView()
|
||||
}
|
||||
|
||||
// mBadcaseBtn的visible显示逻辑在showBadcaseEntrance内处理
|
||||
mBadcaseBtn = findViewById(R.id.module_mogo_och_badcase_rl)
|
||||
if (mBadcaseBtn != null) {
|
||||
reportWorkOrder(mBadcaseBtn!!)
|
||||
CallerAutopilotRecordListenerManager.addListener(TAG, this)
|
||||
}
|
||||
mAICollectBtn = findViewById(R.id.module_mogo_och_ai_collet_rl)
|
||||
if (mAICollectBtn != null) {
|
||||
initAiCollect(mAICollectBtn!!)
|
||||
}
|
||||
//消息盒子
|
||||
viewDriverMsgBoxButton = findViewById(R.id.viewDriverMsgBoxButton)
|
||||
viewDriverMsgBoxList = findViewById(R.id.viewDriverMsgBoxList)
|
||||
@@ -246,9 +192,9 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
requireActivity().runOnUiThread {
|
||||
module_mogo_och_arrived_tv.isEnabled = isClickable
|
||||
if (isClickable) {
|
||||
module_mogo_och_arrived_tv.setTextColor(resources.getColor(android.R.color.white))
|
||||
module_mogo_och_arrived_tv.setTextColor(ResourcesUtils.getColor(android.R.color.white))
|
||||
} else {
|
||||
module_mogo_och_arrived_tv.setTextColor(resources.getColor(R.color.charter_arrived_btn_un_clickable_color))
|
||||
module_mogo_och_arrived_tv.setTextColor(ResourcesUtils.getColor(R.color.charter_arrived_btn_un_clickable_color))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -260,20 +206,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
requireActivity().runOnUiThread { slidePanelView?.visibility = View.GONE }
|
||||
}
|
||||
|
||||
private fun updateSwitchMapIcon() {
|
||||
mapBizView?.let {
|
||||
it.getUI()?.let { ui ->
|
||||
if (ui.currentMapVisualAngle.isLongSight) {
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_long)
|
||||
} else if (ui.currentMapVisualAngle.isMediumSight) {
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_medium)
|
||||
} else {
|
||||
mSwitchMapModeImage!!.setImageResource(R.drawable.charter_switch_map_medium)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSaveInstanceState(outState: Bundle) {
|
||||
super.onSaveInstanceState(outState)
|
||||
mapBizView!!.onSaveInstanceState(outState)
|
||||
@@ -299,7 +231,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
}
|
||||
|
||||
private fun initListener() {
|
||||
mogoMapListenerHandler.registerHostMapListener(TAG, this)
|
||||
}
|
||||
|
||||
|
||||
@@ -334,17 +265,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
mogoMapListenerHandler.unregisterHostMapListener(TAG)
|
||||
}
|
||||
|
||||
override fun onMapVisualAngleChanged(visualAngleMode: VisualAngleMode) {
|
||||
if (visualAngleMode.isMediumSight) {
|
||||
mSwitchMapModeLayout!!.visibility = View.VISIBLE
|
||||
} else if (visualAngleMode.isLongSight) {
|
||||
mSwitchMapModeLayout!!.visibility = View.VISIBLE
|
||||
} else if (visualAngleMode.isCloseSight) {
|
||||
mSwitchMapModeLayout!!.visibility = View.GONE
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -370,43 +290,6 @@ abstract class CharterBaseFragment<V : IView?, P : Presenter<V>?>() :
|
||||
private var stopMd5TV: TextView? = null
|
||||
private var trajMd5DPQPTV: TextView? = null
|
||||
private var stopMd5DPQPTV: TextView? = null
|
||||
|
||||
// open fun showHideTestBar() {
|
||||
// if (busTestBar == null) {
|
||||
// busTestBar = findViewById(R.id.module_mogo_och_bus_test_bar)
|
||||
// lineIdTV = findViewById(R.id.bus_test_bar_current_line_id)
|
||||
// trajMd5TV = findViewById(R.id.bus_test_bar_current_traj_md5)
|
||||
// stopMd5TV = findViewById(R.id.bus_test_bar_current_stop_md5)
|
||||
// trajMd5DPQPTV = findViewById(R.id.bus_test_bar_current_traj_md5_dpqp)
|
||||
// stopMd5DPQPTV = findViewById(R.id.bus_test_bar_current_stop_md5_dpqp)
|
||||
// }
|
||||
// if (busTestBar!!.visibility == View.VISIBLE) {
|
||||
// busTestBar!!.visibility = View.GONE
|
||||
// } else {
|
||||
// val routesResult: BusRoutesResult = BusOrderModel.getInstance().getBusRoutesResult()
|
||||
// lineIdTV!!.text = "lineId:" + (routesResult.lineId.toString() ?: "")
|
||||
// trajMd5TV!!.text = "TMd5:" + routesResult.csvFileMd5
|
||||
// stopMd5TV!!.text = "SMd5:" + routesResult.txtFileMd5
|
||||
// trajMd5DPQPTV!!.text =
|
||||
// "TMd5DPQP:" + routesResult.csvFileMd5DPQP
|
||||
// stopMd5DPQPTV!!.text =
|
||||
// "SMd5DPQP:" + routesResult.txtFileMd5DPQP
|
||||
// busTestBar!!.visibility = View.VISIBLE
|
||||
// }
|
||||
// }
|
||||
|
||||
// open fun updateBusTestBarInfo() {
|
||||
// if (busTestBar != null && busTestBar!!.visibility == View.VISIBLE) {
|
||||
// val routesResult: BusRoutesResult = BusOrderModel.getInstance().busRoutesResult
|
||||
// lineIdTV!!.text = "lineId:" + (routesResult?.lineId?.toString() ?: "")
|
||||
// trajMd5TV!!.text = "TMd5:" + if (routesResult == null) "" else routesResult.csvFileMd5
|
||||
// stopMd5TV!!.text = "SMd5:" + if (routesResult == null) "" else routesResult.txtFileMd5
|
||||
// trajMd5DPQPTV!!.text =
|
||||
// "TMd5DPQP:" + if (routesResult == null) "" else routesResult.csvFileMd5DPQP
|
||||
// stopMd5DPQPTV!!.text =
|
||||
// "SMd5DPQP:" + if (routesResult == null) "" else routesResult.txtFileMd5DPQP
|
||||
// }
|
||||
// }
|
||||
/**
|
||||
* END
|
||||
*/
|
||||
|
||||
@@ -4,6 +4,4 @@ package com.magic.mogo.och.charter.bean
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/2/23
|
||||
*/
|
||||
data class Station(var siteId: Int, var siteName: String, var seq: Int)
|
||||
|
||||
data class ArriveDestRequest(val sn:String, val lineId:Long,val writeVersion:Long)
|
||||
|
||||
@@ -21,26 +21,6 @@ class CharterConst {
|
||||
// 尝试下发给MEC轨迹最多10次
|
||||
const val LOOP_SEND_TRAJ_TIMES = 10
|
||||
|
||||
// 埋点key:接管后点击'自动驾驶'按钮启动
|
||||
const val EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_charter_restart_autopilot"
|
||||
// 埋点key:开始服务开启自动驾驶(成功/失败)
|
||||
const val EVENT_KEY_START_SERVICE = "event_key_och_charter_start_service"
|
||||
const val EVENT_PARAM_SN = "sn"
|
||||
const val EVENT_PARAM_TIME = "time"
|
||||
const val EVENT_PARAM_START_NAME = "start_name"
|
||||
const val EVENT_PARAM_END_NAME = "end_name"
|
||||
const val EVENT_PARAM_LINE_ID = "line_id"
|
||||
const val EVENT_PARAM_MAP_ORIGINAL_DATA = "map_original_data" // 域控原始状态信息
|
||||
const val EVENT_PARAM_AUTOPILOT_STATE = "autopilot_state" //原始的自动驾驶状态
|
||||
const val EVENT_PARAM_START_RESULT = "start_autopilot" // true/false
|
||||
const val EVENT_PARAM_START_FAILURE_CODE = "start_autopilot_failure_code" // 启动自驾失败code
|
||||
const val EVENT_PARAM_START_FAILURE_MSG = "start_autopilot_failure_msg" // 启动自驾失败原因
|
||||
const val EVENT_PARAM_PLATE_NUM = "plate_number" // 车牌号
|
||||
const val EVENT_PARAM_ENV_ONLINE = "env_online" // 是否线上环境:true/false
|
||||
// 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾
|
||||
const val EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_charter_ap_unable_start_reason"
|
||||
const val EVENT_PARAM_UNABLE_START_REASON = "unable_start_reason"
|
||||
|
||||
/**
|
||||
* 订单起终点Marker类型
|
||||
*/
|
||||
|
||||
@@ -1,28 +1,18 @@
|
||||
package com.magic.mogo.och.charter.manager;
|
||||
|
||||
import static com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.M_BUS;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.mogo.och.common.module.manager.autopilot.autopilot.OchAutopilotAnalytics;
|
||||
|
||||
import android.text.TextUtils;
|
||||
public class CharterAnalyticsManager extends OchAutopilotAnalytics {
|
||||
|
||||
import com.magic.mogo.och.charter.constant.CharterConst;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||
import com.mogo.commons.utils.MogoAnalyticUtils;
|
||||
import com.mogo.eagle.core.data.app.AppConfigInfo;
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener;
|
||||
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger;
|
||||
import com.mogo.eagle.core.utilcode.util.DateTimeUtils;
|
||||
import com.mogo.eagle.core.utilcode.util.UiThreadHandler;
|
||||
import com.mogo.och.common.module.manager.autopilot.OCHAdasAbilityManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author: wangmingjun
|
||||
* @date: 2023/3/1
|
||||
*/
|
||||
public class CharterAnalyticsManager {
|
||||
// 埋点key:接管后点击'自动驾驶'按钮启动
|
||||
private static final String EVENT_KEY_RESTART_AUTOPILOT = "event_key_och_charter_restart_autopilot";
|
||||
// 埋点key:开始服务开启自动驾驶(成功/失败)
|
||||
private static final String EVENT_KEY_START_SERVICE = "event_key_och_charter_start_service";
|
||||
// 埋点key:开启自动驾驶前已识别的异常,会导致无法开启自驾
|
||||
private static final String EVENT_KEY_AP_UNABLE_START_REASON = "event_key_och_charter_ap_unable_start_reason";
|
||||
// 埋点key:点击启动自驾
|
||||
private static final String EVENT_KEY_CLICK_START_AUTOPILOT = "event_key_och_charter_click_start_autopilot";
|
||||
|
||||
private static final class SingletonHolder {
|
||||
private static final CharterAnalyticsManager INSTANCE = new CharterAnalyticsManager();
|
||||
@@ -32,120 +22,28 @@ public class CharterAnalyticsManager {
|
||||
return CharterAnalyticsManager.SingletonHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private String mStartAutopilotKey;
|
||||
private HashMap<String, Object> mStartAutopilotParams = new HashMap<>();
|
||||
|
||||
private Runnable startAutopilotRunnable = () -> {
|
||||
// 15s内未开启,上报失败埋点
|
||||
triggerStartAutopilotFailureEvent("", "15s后app等待超时");
|
||||
};
|
||||
|
||||
public void triggerStartAutopilotFailureEventByAdas(String failCode, String failMsg){
|
||||
removeWaitingCallback();
|
||||
triggerStartAutopilotFailureEvent(failCode, failMsg);
|
||||
@NonNull
|
||||
@Override
|
||||
public String getEventKeyStartService() {
|
||||
return EVENT_KEY_START_SERVICE;
|
||||
}
|
||||
|
||||
private void triggerStartAutopilotFailureEvent(String failCode, String failMsg){
|
||||
if (mStartAutopilotParams.isEmpty()) return;
|
||||
|
||||
CallerLogger.e( M_BUS + "triggerStartAutopilotFailureEvent", failMsg );
|
||||
|
||||
if (CallerAutoPilotStatusListenerManager.INSTANCE.getState() !=
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING){
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_START_FAILURE_CODE, failCode);
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_START_FAILURE_MSG, failMsg);
|
||||
}
|
||||
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_MAP_ORIGINAL_DATA,
|
||||
OCHAdasAbilityManager.getInstance().getOriginalData());
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_AUTOPILOT_STATE,
|
||||
CallerAutoPilotStatusListenerManager.INSTANCE.getState());
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_START_RESULT
|
||||
, CallerAutoPilotStatusListenerManager.INSTANCE.getState() ==
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING);
|
||||
|
||||
MogoAnalyticUtils.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
@NonNull
|
||||
@Override
|
||||
public String getEventKeyRestartService() {
|
||||
return EVENT_KEY_RESTART_AUTOPILOT;
|
||||
}
|
||||
|
||||
private void removeWaitingCallback() {
|
||||
if (startAutopilotRunnable != null) {
|
||||
UiThreadHandler.removeCallbacks(startAutopilotRunnable);
|
||||
}
|
||||
@NonNull
|
||||
@Override
|
||||
public String getEventKeyApUnableStartReason() {
|
||||
return EVENT_KEY_AP_UNABLE_START_REASON;
|
||||
}
|
||||
|
||||
public void clearStartAutopilotFailureMSG(){
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_START_FAILURE_CODE, "");
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_START_FAILURE_MSG, "");
|
||||
@NonNull
|
||||
@Override
|
||||
public String getEventKeyClickStartAutopilot() {
|
||||
return EVENT_KEY_CLICK_START_AUTOPILOT;
|
||||
}
|
||||
|
||||
private void clearStartAutopilotParams(){
|
||||
mStartAutopilotParams.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发'开启自动驾驶'埋点流程
|
||||
* 开启自动驾驶,15s内成功则发送成功埋点,否则发送失败埋点
|
||||
* @param restart false(点击'滑动出发'启动)/true(接管后点击'自动驾驶'按钮启动)
|
||||
* @param send 是否直接发送埋点(15s内开启成功则直接发送成功埋点)
|
||||
*/
|
||||
public void triggerStartAutopilotEvent(
|
||||
boolean restart, boolean send, String startName, String endName, int lineId) {
|
||||
mStartAutopilotKey = restart ?
|
||||
CharterConst.EVENT_KEY_RESTART_AUTOPILOT : CharterConst.EVENT_KEY_START_SERVICE;
|
||||
String sn = SharedPrefsMgr.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_SN, sn);
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_TIME, dateTime);
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_START_NAME, startName);
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_END_NAME, endName);
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_LINE_ID, lineId);
|
||||
|
||||
if (send) {
|
||||
if (mStartAutopilotParams.isEmpty()) return;
|
||||
// 开启成功,上报埋点
|
||||
clearStartAutopilotFailureMSG();
|
||||
removeWaitingCallback();
|
||||
mStartAutopilotParams.put(CharterConst.EVENT_PARAM_START_RESULT, true);
|
||||
MogoAnalyticUtils.INSTANCE.track(mStartAutopilotKey, mStartAutopilotParams);
|
||||
|
||||
clearStartAutopilotParams();//清空参数数据,防止误传
|
||||
} else {
|
||||
UiThreadHandler.postDelayed(startAutopilotRunnable, CharterConst.LOOP_PERIOD_15S);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 触发"无法开启自驾已知异常"埋点
|
||||
* @param startName
|
||||
* @param endName
|
||||
* @param lineId
|
||||
*/
|
||||
public void triggerUnableStartAPReasonEvent(String startName, String endName, int lineId,
|
||||
String reason) {
|
||||
String sn = SharedPrefsMgr.getInstance().getSn();
|
||||
String plateNum = AppConfigInfo.INSTANCE.getPlateNumber();
|
||||
String dateTime = DateTimeUtils.getTimeText(
|
||||
System.currentTimeMillis(), DateTimeUtils.yyyy_MM_dd_HH_mm_ss);
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
|
||||
params.put(CharterConst.EVENT_PARAM_SN, sn);
|
||||
params.put(CharterConst.EVENT_PARAM_PLATE_NUM, TextUtils.isEmpty(plateNum) ? "" : plateNum);
|
||||
params.put(CharterConst.EVENT_PARAM_ENV_ONLINE,
|
||||
DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE ? true : false);
|
||||
params.put(CharterConst.EVENT_PARAM_TIME, dateTime);
|
||||
params.put(CharterConst.EVENT_PARAM_START_NAME, startName);
|
||||
params.put(CharterConst.EVENT_PARAM_END_NAME, endName);
|
||||
params.put(CharterConst.EVENT_PARAM_LINE_ID, lineId);
|
||||
params.put(CharterConst.EVENT_PARAM_UNABLE_START_REASON, reason);
|
||||
MogoAnalyticUtils.INSTANCE.track(CharterConst.EVENT_KEY_AP_UNABLE_START_REASON, params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ class DriverM1Model {
|
||||
startFailedMessage: String
|
||||
) {
|
||||
CharterAnalyticsManager.getInstance()
|
||||
.triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage)
|
||||
.triggerStartAutopilotFailureEventByAdas(startFailedCode, startFailedMessage,System.currentTimeMillis())
|
||||
if (mControllerStatusCallback != null) {
|
||||
|
||||
d(SceneConstant.M_CHARTER_D + TAG,
|
||||
@@ -479,6 +479,9 @@ class DriverM1Model {
|
||||
* @param isRestart
|
||||
*/
|
||||
private fun startAutopilot() {
|
||||
|
||||
CharterAnalyticsManager.getInstance().triggerClickStartAutopilotTime(System.currentTimeMillis());
|
||||
|
||||
//判断轨迹Id是否可用
|
||||
mCurrentRoute?.let {
|
||||
//根据开关和后台是否发布轨迹启动自驾
|
||||
@@ -510,6 +513,7 @@ class DriverM1Model {
|
||||
}
|
||||
|
||||
triggerStartServiceEvent(false, false)
|
||||
|
||||
val parameters = initAutopilotControlParameters()
|
||||
if (null == parameters) {
|
||||
d(SceneConstant.M_CHARTER_D + TAG, "行程日志-AutopilotControlParameters is empty.")
|
||||
@@ -550,10 +554,16 @@ class DriverM1Model {
|
||||
return
|
||||
}
|
||||
mCurrentOrder?.lineId?.let {
|
||||
CharterAnalyticsManager.getInstance().triggerStartAutopilotEvent(
|
||||
isRestart, send,
|
||||
mCurrentOrder?.startSiteName, mCurrentOrder?.siteName, it
|
||||
)
|
||||
val startSiteName = mCurrentOrder?.startSiteName
|
||||
val endSiteName = mCurrentOrder?.siteName
|
||||
val orderNo = mCurrentOrder?.orderNo
|
||||
if(startSiteName!=null&&endSiteName!=null) {
|
||||
|
||||
CharterAnalyticsManager.getInstance().triggerStartAutopilotEvent(
|
||||
isRestart, send,
|
||||
startSiteName, endSiteName, it, orderNo?:"", System.currentTimeMillis()
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -562,10 +572,14 @@ class DriverM1Model {
|
||||
return
|
||||
}
|
||||
mCurrentOrder?.lineId?.let {
|
||||
CharterAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
mCurrentOrder?.startSiteName, mCurrentOrder?.siteName, it,
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
|
||||
)
|
||||
val startSiteName = mCurrentOrder?.startSiteName
|
||||
val endSiteName = mCurrentOrder?.siteName
|
||||
if (startSiteName != null && endSiteName != null) {
|
||||
CharterAnalyticsManager.getInstance().triggerUnableStartAPReasonEvent(
|
||||
startSiteName, endSiteName, it.toString(),"",
|
||||
OCHAdasAbilityManager.getInstance().autopilotUnAbilityReason
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ class DriverM1Presenter(view: DriverM1Fragment?) :
|
||||
//
|
||||
// }
|
||||
IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING ->{
|
||||
DriverM1Model.get().triggerStartServiceEvent(isRestart = false, send = true)
|
||||
DriverM1Model.get().triggerStartServiceEvent(false,true)
|
||||
}
|
||||
// IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_DISABLE ->{
|
||||
//
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |