VehicleLocationData.java
1.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package com.bsth.entity;
import com.bsth.socket.protocol.Message0205;
public class VehicleLocationData extends Data {
/**
* 信息类型
* 默认应该为0x05
*/
private byte infoType;
/**
* 定位状态
* 位0 0有效 1无效
* 位1 0北纬 1南纬
* 位2 0东经 1西经
* 位3-7 保留
*/
private byte locationState;
/**
* 经度
* 分辨率0.000001
*/
private int lon;
/**
* 纬度
* 分辨率0.000001
*/
private int lat;
public VehicleLocationData(Message0205 message0205){
Byte infoTypeValue = message0205.getInfoType();
this.infoType = (infoTypeValue == null || infoTypeValue == (byte) 0xFF) ? (byte) 0x05 : infoTypeValue;
// 定位状态
this.locationState = message0205.getLocationState();
// 经度
this.lon = message0205.getLon();
// 纬度
this.lat = message0205.getLat();
}
public byte getInfoType() {
return infoType;
}
public void setInfoType(byte infoType) {
this.infoType = infoType;
}
public byte getLocationState() {
return locationState;
}
public void setLocationState(byte locationState) {
this.locationState = locationState;
}
public int getLon() {
return lon;
}
public void setLon(int lon) {
this.lon = lon;
}
public int getLat() {
return lat;
}
public void setLat(int lat) {
this.lat = lat;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(" 信息类型: ").append(String.format("%02x", infoType))
.append(" 定位状态: ").append(locationState)
.append(" 经度: ").append(lon)
.append(" 纬度: ").append(lat);
return sb.toString();
}
@Override
public String getType() {
return "VehicleLocation_data";
}
}