[dev_arch_opt_3.0]
[Change] [ 1、完成工控机数据和高德GPS地图数据的数据中心,以及工控机数据超时后的自动切换为高德地图GPS数据 定位监听已重构,CallerChassisLocationGCJ20ListenerManager---高的坐标系,CallerChassisLocationWGS84ListenerManager--高精坐标系,之前代码已修改,大家后续项目中根据需要进行订阅,如需控制频率可在订阅时 // 设置数据回调频率,单位HZ,1HZ的周期是1秒;50HZ的周期是1/50=0.02秒;10HZ的周期是1/10=0.1秒。 CallerChassisLocationWGS84ListenerManager.setListenerHz(Companion.functionName, 20) CallerChassisLocationGCJ20ListenerManagersetListenerHz(Companion.functionName, 20) ] Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
@@ -1,17 +1,12 @@
|
||||
package com.mogo.eagle.core.data.map;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import mogo.telematics.pad.MessagePad;
|
||||
|
||||
public class MogoLocation implements Cloneable, Parcelable {
|
||||
public class MogoLocation implements Cloneable {
|
||||
|
||||
private MessagePad.GnssInfo gnssInfo = MessagePad.GnssInfo.newBuilder().build();
|
||||
private int locType = 0;
|
||||
private double latitude = 0;
|
||||
private double longitude = 0;
|
||||
private double altitude = 0;
|
||||
private long time = 0;
|
||||
private float bearing = 0;
|
||||
private float accuracy = 0;
|
||||
private float speed = 0;
|
||||
private String cityName = "";
|
||||
private String cityCode = "";
|
||||
private String provider = "";
|
||||
@@ -22,29 +17,45 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
private String locationDetail = "";
|
||||
private String poiName = "";
|
||||
private String aoiName = "";
|
||||
private int errCode = 0;
|
||||
private String errInfo = "";
|
||||
private String street = "";
|
||||
private String streetNum = "";
|
||||
private String description = "";
|
||||
private String buildingId = "";
|
||||
private String floor = "";
|
||||
private int errorCode = 0;
|
||||
private String errorInfo = "";
|
||||
private int gpsAccuracyStatus = 0;
|
||||
private int satellite = 0;
|
||||
|
||||
public float getBearing() {
|
||||
return bearing;
|
||||
// 记录最后一次收到的时间戳,ms,用于计算是否要切换GPS数据源
|
||||
private long lastReceiveTime;
|
||||
|
||||
public MessagePad.GnssInfo getGnssInfo() {
|
||||
return gnssInfo;
|
||||
}
|
||||
|
||||
public void setBearing( float bearing ) {
|
||||
this.bearing = bearing;
|
||||
public void setGnssInfo(MessagePad.GnssInfo gnssInfo) {
|
||||
this.gnssInfo = gnssInfo;
|
||||
}
|
||||
|
||||
public double getHeading() {
|
||||
if (gnssInfo != null) {
|
||||
return gnssInfo.getHeading();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setHeading(double bearing) {
|
||||
if (gnssInfo != null) {
|
||||
gnssInfo = gnssInfo.toBuilder().setHeading(bearing).build();
|
||||
}
|
||||
}
|
||||
|
||||
public float getAccuracy() {
|
||||
return accuracy;
|
||||
}
|
||||
|
||||
public void setAccuracy( float accuracy ) {
|
||||
public void setAccuracy(float accuracy) {
|
||||
this.accuracy = accuracy;
|
||||
}
|
||||
|
||||
@@ -52,23 +63,41 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
return provider;
|
||||
}
|
||||
|
||||
public void setProvider( String provider ) {
|
||||
public void setProvider(String provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
public float getSpeed() {
|
||||
return speed;
|
||||
public float getGnssSpeed() {
|
||||
if (gnssInfo != null) {
|
||||
return (float) gnssInfo.getGnssSpeed();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setSpeed( float speed ) {
|
||||
this.speed = speed;
|
||||
public void setGnssSpeed(float speed) {
|
||||
if (gnssInfo != null) {
|
||||
gnssInfo = gnssInfo.toBuilder().setGnssSpeed(speed).build();
|
||||
}
|
||||
}
|
||||
|
||||
public float getAcceleration() {
|
||||
if (gnssInfo != null) {
|
||||
return (float) gnssInfo.getAcceleration();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setAcceleration(double acceleration) {
|
||||
if (gnssInfo != null) {
|
||||
gnssInfo = gnssInfo.toBuilder().setAcceleration(acceleration).build();
|
||||
}
|
||||
}
|
||||
|
||||
public String getLocationDetail() {
|
||||
return locationDetail;
|
||||
}
|
||||
|
||||
public void setLocationDetail( String locationDetail ) {
|
||||
public void setLocationDetail(String locationDetail) {
|
||||
this.locationDetail = locationDetail;
|
||||
}
|
||||
|
||||
@@ -76,7 +105,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
return poiName;
|
||||
}
|
||||
|
||||
public void setPoiName( String poiName ) {
|
||||
public void setPoiName(String poiName) {
|
||||
this.poiName = poiName;
|
||||
}
|
||||
|
||||
@@ -84,24 +113,24 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
return aoiName;
|
||||
}
|
||||
|
||||
public void setAoiName( String aoiName ) {
|
||||
public void setAoiName(String aoiName) {
|
||||
this.aoiName = aoiName;
|
||||
}
|
||||
|
||||
public int getErrCode() {
|
||||
return errCode;
|
||||
public int getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public void setErrCode( int errCode ) {
|
||||
this.errCode = errCode;
|
||||
public void setErrorCode(int errorCode) {
|
||||
this.errorCode = errorCode;
|
||||
}
|
||||
|
||||
public String getErrInfo() {
|
||||
return errInfo;
|
||||
public String getErrorInfo() {
|
||||
return errorInfo;
|
||||
}
|
||||
|
||||
public void setErrInfo( String errInfo ) {
|
||||
this.errInfo = errInfo;
|
||||
public void setErrorInfo(String errorInfo) {
|
||||
this.errorInfo = errorInfo;
|
||||
}
|
||||
|
||||
public String getStreet() {
|
||||
@@ -116,7 +145,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
return streetNum;
|
||||
}
|
||||
|
||||
public void setStreetNum( String streetNum ) {
|
||||
public void setStreetNum(String streetNum) {
|
||||
this.streetNum = streetNum;
|
||||
}
|
||||
|
||||
@@ -124,7 +153,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription( String description ) {
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
@@ -132,7 +161,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
return buildingId;
|
||||
}
|
||||
|
||||
public void setBuildingId( String buildingId ) {
|
||||
public void setBuildingId(String buildingId) {
|
||||
this.buildingId = buildingId;
|
||||
}
|
||||
|
||||
@@ -140,7 +169,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
return floor;
|
||||
}
|
||||
|
||||
public void setFloor( String floor ) {
|
||||
public void setFloor(String floor) {
|
||||
this.floor = floor;
|
||||
}
|
||||
|
||||
@@ -148,7 +177,7 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
return gpsAccuracyStatus;
|
||||
}
|
||||
|
||||
public void setGpsAccuracyStatus( int gpsAccuracyStatus ) {
|
||||
public void setGpsAccuracyStatus(int gpsAccuracyStatus) {
|
||||
this.gpsAccuracyStatus = gpsAccuracyStatus;
|
||||
}
|
||||
|
||||
@@ -156,24 +185,151 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
return satellite;
|
||||
}
|
||||
|
||||
public void setSatellite( int satellite ) {
|
||||
public void setSatellite(int satellite) {
|
||||
this.satellite = satellite;
|
||||
}
|
||||
|
||||
public MogoLocation() {
|
||||
}
|
||||
|
||||
public double getAltitude() {
|
||||
if (gnssInfo != null) {
|
||||
return gnssInfo.getAltitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setAltitude(double altitude) {
|
||||
if (gnssInfo != null) {
|
||||
gnssInfo = gnssInfo.toBuilder().setAltitude(altitude).build();
|
||||
}
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getAdCode() {
|
||||
return adCode;
|
||||
}
|
||||
|
||||
public void setAdCode(String adCode) {
|
||||
this.adCode = adCode;
|
||||
}
|
||||
|
||||
public int getLocType() {
|
||||
return locType;
|
||||
}
|
||||
|
||||
public void setLocType(int locType) {
|
||||
this.locType = locType;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
if (gnssInfo != null) {
|
||||
return gnssInfo.getLatitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setLatitude(double latitude) {
|
||||
if (gnssInfo != null) {
|
||||
gnssInfo = gnssInfo.toBuilder().setLatitude(latitude).build();
|
||||
}
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
if (gnssInfo != null) {
|
||||
return gnssInfo.getLongitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setLongitude(double longitude) {
|
||||
if (gnssInfo != null) {
|
||||
gnssInfo = gnssInfo.toBuilder().setLongitude(longitude).build();
|
||||
}
|
||||
}
|
||||
|
||||
public long getSatelliteTime() {
|
||||
if (gnssInfo != null) {
|
||||
return (long) gnssInfo.getSatelliteTime();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void setSatelliteTime(long time) {
|
||||
if (gnssInfo != null) {
|
||||
gnssInfo = gnssInfo.toBuilder().setSatelliteTime(time).build();
|
||||
}
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode(String cityCode) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
public void setCityName(String cityName) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MogoLocation clone() {
|
||||
try {
|
||||
return (MogoLocation) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getLastReceiveTime() {
|
||||
return lastReceiveTime;
|
||||
}
|
||||
|
||||
public void setLastReceiveTime(long lastReceiveTime) {
|
||||
this.lastReceiveTime = lastReceiveTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoLocation{" +
|
||||
"locType=" + locType +
|
||||
", latitude=" + latitude +
|
||||
", longitude=" + longitude +
|
||||
", altitude=" + altitude +
|
||||
", time=" + time +
|
||||
", bearing=" + bearing +
|
||||
", latitude=" + getLatitude() +
|
||||
", longitude=" + getLongitude() +
|
||||
", altitude=" + getAltitude() +
|
||||
", time=" + getSatelliteTime() +
|
||||
", bearing=" + getHeading() +
|
||||
", accuracy=" + accuracy +
|
||||
", speed=" + speed +
|
||||
", speed=" + getGnssSpeed() +
|
||||
", cityName='" + cityName + '\'' +
|
||||
", cityCode='" + cityCode + '\'' +
|
||||
", provider='" + provider + '\'' +
|
||||
@@ -184,8 +340,8 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
", locationDetail='" + locationDetail + '\'' +
|
||||
", poiName='" + poiName + '\'' +
|
||||
", aoiName='" + aoiName + '\'' +
|
||||
", errCode=" + errCode +
|
||||
", errInfo='" + errInfo + '\'' +
|
||||
", errCode=" + errorCode +
|
||||
", errInfo='" + errorInfo + '\'' +
|
||||
", street='" + street + '\'' +
|
||||
", streetNum='" + streetNum + '\'' +
|
||||
", description='" + description + '\'' +
|
||||
@@ -195,180 +351,4 @@ public class MogoLocation implements Cloneable, Parcelable {
|
||||
", satellite=" + satellite +
|
||||
'}';
|
||||
}
|
||||
|
||||
public double getAltitude() {
|
||||
return altitude;
|
||||
}
|
||||
|
||||
public void setAltitude( double altitude ) {
|
||||
this.altitude = altitude;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress( String address ) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict( String district ) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
|
||||
public void setProvince( String province ) {
|
||||
this.province = province;
|
||||
}
|
||||
|
||||
public String getAdCode() {
|
||||
return adCode;
|
||||
}
|
||||
|
||||
public void setAdCode( String adCode ) {
|
||||
this.adCode = adCode;
|
||||
}
|
||||
|
||||
public int getLocType() {
|
||||
return locType;
|
||||
}
|
||||
|
||||
public void setLocType( int locType ) {
|
||||
this.locType = locType;
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude( double latitude ) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
public double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude( double longitude ) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
public long getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public void setTime( long time ) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
public String getCityCode() {
|
||||
return cityCode;
|
||||
}
|
||||
|
||||
public void setCityCode( String cityCode ) {
|
||||
this.cityCode = cityCode;
|
||||
}
|
||||
|
||||
public String getCityName() {
|
||||
return cityName;
|
||||
}
|
||||
|
||||
public void setCityName( String cityName ) {
|
||||
this.cityName = cityName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLocation clone() {
|
||||
try {
|
||||
return ( MogoLocation ) super.clone();
|
||||
} catch ( CloneNotSupportedException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel( Parcel dest, int flags ) {
|
||||
dest.writeInt( this.locType );
|
||||
dest.writeDouble( this.latitude );
|
||||
dest.writeDouble( this.longitude );
|
||||
dest.writeDouble( this.altitude );
|
||||
dest.writeLong( this.time );
|
||||
dest.writeFloat( this.bearing );
|
||||
dest.writeFloat( this.accuracy );
|
||||
dest.writeFloat( this.speed );
|
||||
dest.writeString( this.cityName );
|
||||
dest.writeString( this.cityCode );
|
||||
dest.writeString( this.provider );
|
||||
dest.writeString( this.address );
|
||||
dest.writeString( this.district );
|
||||
dest.writeString( this.province );
|
||||
dest.writeString( this.adCode );
|
||||
dest.writeString( this.locationDetail );
|
||||
dest.writeString( this.poiName );
|
||||
dest.writeString( this.aoiName );
|
||||
dest.writeInt( this.errCode );
|
||||
dest.writeString( this.errInfo );
|
||||
dest.writeString( this.street );
|
||||
dest.writeString( this.streetNum );
|
||||
dest.writeString( this.description );
|
||||
dest.writeString( this.buildingId );
|
||||
dest.writeString( this.floor );
|
||||
dest.writeInt( this.gpsAccuracyStatus );
|
||||
dest.writeInt( this.satellite );
|
||||
}
|
||||
|
||||
protected MogoLocation( Parcel in ) {
|
||||
this.locType = in.readInt();
|
||||
this.latitude = in.readDouble();
|
||||
this.longitude = in.readDouble();
|
||||
this.altitude = in.readDouble();
|
||||
this.time = in.readLong();
|
||||
this.bearing = in.readFloat();
|
||||
this.accuracy = in.readFloat();
|
||||
this.speed = in.readFloat();
|
||||
this.cityName = in.readString();
|
||||
this.cityCode = in.readString();
|
||||
this.provider = in.readString();
|
||||
this.address = in.readString();
|
||||
this.district = in.readString();
|
||||
this.province = in.readString();
|
||||
this.adCode = in.readString();
|
||||
this.locationDetail = in.readString();
|
||||
this.poiName = in.readString();
|
||||
this.aoiName = in.readString();
|
||||
this.errCode = in.readInt();
|
||||
this.errInfo = in.readString();
|
||||
this.street = in.readString();
|
||||
this.streetNum = in.readString();
|
||||
this.description = in.readString();
|
||||
this.buildingId = in.readString();
|
||||
this.floor = in.readString();
|
||||
this.gpsAccuracyStatus = in.readInt();
|
||||
this.satellite = in.readInt();
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator< MogoLocation > CREATOR = new Parcelable.Creator< MogoLocation >() {
|
||||
@Override
|
||||
public MogoLocation createFromParcel( Parcel source ) {
|
||||
return new MogoLocation( source );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLocation[] newArray( int size ) {
|
||||
return new MogoLocation[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user