Rev 1559 | Rev 1563 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1559 | Rev 1562 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | this.altitude = altitude; |
29 | this.altitude = altitude; |
30 | } |
30 | } |
31 | public void setStatus(int status) { |
31 | public void setStatus(int status) { |
32 | this.status = status; |
32 | this.status = status; |
33 | } |
33 | } |
- | 34 | ||
- | 35 | public String toXML() { |
|
- | 36 | double latitude = Math.abs(this.latitude); |
|
- | 37 | String result = "latitude=\"" + latitude/1E7; |
|
- | 38 | if (this.latitude < 0) result+= "S"; else result+="N"; |
|
- | 39 | result += "\""; |
|
- | 40 | double longitude= Math.abs(this.longitude); |
|
- | 41 | result += " longitude=\"" + longitude/1E7; |
|
- | 42 | if (this.longitude < 0) result+= "W"; else result+="E"; |
|
- | 43 | result += "\""; |
|
- | 44 | return result; |
|
- | 45 | } |
|
- | 46 | ||
- | 47 | public String toString() { |
|
- | 48 | double latitude = Math.abs(this.latitude); |
|
- | 49 | String result = "" + latitude/1E7; |
|
- | 50 | if (this.latitude < 0) result+= "S"; else result+="N"; |
|
- | 51 | result += " "; |
|
- | 52 | double longitude= Math.abs(this.longitude); |
|
- | 53 | result += "" + longitude/1E7; |
|
- | 54 | if (this.longitude < 0) result+= "W"; else result+="E"; |
|
- | 55 | return result; |
|
- | 56 | } |
|
34 | } |
57 | } |
Line 35... | Line 58... | ||
35 | 58 | ||
36 | public static class GPSDistanceAndBearing { |
59 | public static class GPSDistanceAndBearing { |
37 | int distance; // in m/10. 16 bit unsigned. |
60 | int distance; // in m/10. 16 bit unsigned. |
Line 46... | Line 69... | ||
46 | this.distance = distance; |
69 | this.distance = distance; |
47 | } |
70 | } |
48 | public void setBearing(int bearing) { |
71 | public void setBearing(int bearing) { |
49 | this.bearing = bearing; |
72 | this.bearing = bearing; |
50 | } |
73 | } |
- | 74 | public String toXML() { |
|
- | 75 | String result = "distance=\"" + ((double)this.distance)/10; |
|
- | 76 | result += "\" bearing=\""; |
|
- | 77 | result += this.bearing; |
|
- | 78 | result += "\""; |
|
- | 79 | return result; |
|
- | 80 | } |
|
- | 81 | public String toString() { |
|
- | 82 | String result = "" + ((double)this.distance)/10; |
|
- | 83 | result += "m @"; |
|
- | 84 | result += this.bearing; |
|
- | 85 | result += "deg"; |
|
- | 86 | return result; |
|
- | 87 | } |
|
51 | } |
88 | } |
Line 52... | Line 89... | ||
52 | 89 | ||
53 | private int version; |
90 | private int version; |
54 | private GPSPosition currentPosition; |
91 | private GPSPosition currentPosition; |
Line 66... | Line 103... | ||
66 | 103 | ||
67 | private int flightTime; // in secs. 16 bit unsigned. |
104 | private int flightTime; // in secs. 16 bit unsigned. |
Line 68... | Line 105... | ||
68 | private int batteryVoltage; // in 0.1 volts. |
105 | private int batteryVoltage; // in 0.1 volts. |
69 | 106 | ||
70 | private int groundSpeed; // in cm/s. 16 bit unsigned. |
107 | private int groundSpeed; // in cm/s. 16 bit unsigned. |
Line 71... | Line 108... | ||
71 | private int heading; // of movement. 16 bit signed. |
108 | private int directionOfFlight; // of movement. 16 bit signed. |
72 | private int compassHeading;// 16 bit signed. |
109 | private int compassHeading;// 16 bit signed. |
Line 134... | Line 171... | ||
134 | return batteryVoltage; |
171 | return batteryVoltage; |
135 | } |
172 | } |
136 | public int getGroundSpeed() { |
173 | public int getGroundSpeed() { |
137 | return groundSpeed; |
174 | return groundSpeed; |
138 | } |
175 | } |
139 | public int getHeading() { |
176 | public int getDirectionOfFlight() { |
140 | return heading; |
177 | return directionOfFlight; |
141 | } |
178 | } |
142 | public int getCompassHeading() { |
179 | public int getCompassHeading() { |
143 | return compassHeading; |
180 | return compassHeading; |
144 | } |
181 | } |
145 | public int getPitchAngle() { |
182 | public int getPitchAngle() { |
Line 224... | Line 261... | ||
224 | this.batteryVoltage = batteryVoltage; |
261 | this.batteryVoltage = batteryVoltage; |
225 | } |
262 | } |
226 | public void setGroundSpeed(int groundSpeed) { |
263 | public void setGroundSpeed(int groundSpeed) { |
227 | this.groundSpeed = groundSpeed; |
264 | this.groundSpeed = groundSpeed; |
228 | } |
265 | } |
229 | public void setHeading(int heading) { |
266 | public void setDirectionOfFlight(int heading) { |
230 | this.heading = heading; |
267 | this.directionOfFlight = heading; |
231 | } |
268 | } |
232 | public void setCompassHeading(int compassHeading) { |
269 | public void setCompassHeading(int compassHeading) { |
233 | this.compassHeading = compassHeading; |
270 | this.compassHeading = compassHeading; |
234 | } |
271 | } |
235 | public void setPitchAngle(int pitchAngle) { |
272 | public void setPitchAngle(int pitchAngle) { |
Line 272... | Line 309... | ||
272 | this.current = current; |
309 | this.current = current; |
273 | } |
310 | } |
274 | public void setCapacityUsed(int capacityUsed) { |
311 | public void setCapacityUsed(int capacityUsed) { |
275 | this.capacityUsed = capacityUsed; |
312 | this.capacityUsed = capacityUsed; |
276 | } |
313 | } |
- | 314 | ||
- | 315 | @Override |
|
- | 316 | public boolean isResponseTo(RequestFrame r) { |
|
- | 317 | return r instanceof OSDDataRequestFrame; |
|
- | 318 | } |
|
- | 319 | ||
- | 320 | public String toString() { |
|
- | 321 | StringBuilder result = new StringBuilder(); |
|
- | 322 | result.append("OSDData version=" + this.version + "\n"); |
|
- | 323 | result.append("currentPosition: " + this.currentPosition + "\n"); |
|
- | 324 | result.append("targetPosition: " + this.targetPosition + " (" + this.currentToTarget + ")" + "\n"); |
|
- | 325 | result.append("homePosition: " + this.homePosition + " (" + this.currentToHome + ")" + "\n"); |
|
- | 326 | result.append("heightByPressure: " + this.heightByPressure + "\n"); |
|
- | 327 | result.append("verticalVelocityByPressure: " + this.verticalVelocityByPressure + "\n"); |
|
- | 328 | result.append("verticalVelocityByGPS: " + this.verticalVelocityByGPS + "\n"); |
|
- | 329 | result.append("direction of flight: " + this.directionOfFlight + "\n"); |
|
- | 330 | result.append("compassHeading: " + this.compassHeading + "\n"); |
|
- | 331 | result.append("pitchAngle: " + this.pitchAngle + "\n"); |
|
- | 332 | result.append("rollAngle: " + this.rollAngle + "\n"); |
|
- | 333 | result.append("battery voltage: " + ((double)this.batteryVoltage)/10 + "\n"); |
|
- | 334 | result.append("throttle: " + this.throttle + "\n"); |
|
- | 335 | return result.toString(); |
|
- | 336 | } |
|
277 | } |
337 | } |