1 package com.smartdevicelink.proxy.rpc;
\r
3 import java.util.Hashtable;
\r
5 import com.smartdevicelink.proxy.RPCStruct;
\r
6 import com.smartdevicelink.proxy.constants.Names;
\r
7 import com.smartdevicelink.proxy.rpc.enums.CompassDirection;
\r
8 import com.smartdevicelink.proxy.rpc.enums.Dimension;
\r
9 import com.smartdevicelink.proxy.rpc.enums.DisplayType;
\r
10 import com.smartdevicelink.util.DebugTool;
\r
13 * Describes the GPS data. Not all data will be available on all carlines.
\r
14 * <p><b>Parameter List
\r
15 * <table border="1" rules="all">
\r
19 * <th>Description</th>
\r
20 * <th>SmartDeviceLink Ver. Available</th>
\r
23 * <td>longitudeDegrees</td>
\r
25 * <td>Minvalue: - 180
\r
28 * <td>SmartDeviceLink 2.0</td>
\r
31 * <td>latitudeDegrees</td>
\r
33 * <td>Minvalue: - 90<b>Maxvalue: 90
\r
35 * <td>SmartDeviceLink 2.0</td>
\r
40 * <td>Minvalue: 2010<b>Maxvalue: 2100
\r
42 * <td>SmartDeviceLink 2.0</td>
\r
47 * <td>Minvalue: 1<b>Maxvalue: 12
\r
49 * <td>SmartDeviceLink 2.0</td>
\r
54 * <td>Minvalue: 1<b>Maxvalue: 31
\r
56 * <td>SmartDeviceLink 2.0</td>
\r
61 * <td>Minvalue: 1<b>Maxvalue: 23
\r
63 * <td>SmartDeviceLink 2.0</td>
\r
66 * <td>utcMinutes</td>
\r
68 * <td>Minvalue: 1<b>Maxvalue: 59
\r
70 * <td>SmartDeviceLink 2.0</td>
\r
73 * <td>utcSeconds</td>
\r
75 * <td>Minvalue: 1<b>Maxvalue: 59
\r
77 * <td>SmartDeviceLink 2.0</td>
\r
82 * <td>Positional Dilution of Precision<b>Minvalue: 0<b>Maxvalue: 31
\r
84 * <td>SmartDeviceLink 2.0</td>
\r
89 * <td>Horizontal Dilution of Precision<b>Minvalue: 0<b>Maxvalue: 31
\r
91 * <td>SmartDeviceLink 2.0</td>
\r
96 * <td>Vertical Dilution of Precision<b>Minvalue: 0<b>Maxvalue: 31
\r
98 * <td>SmartDeviceLink 2.0</td>
\r
103 * <td>True, if coordinates are based on satellites.
\r
104 * False, if based on dead reckoning
\r
106 * <td>SmartDeviceLink 2.0</td>
\r
109 * <td>satellites</td>
\r
111 * <td>Number of satellites in view
\r
115 * <td>SmartDeviceLink 2.0</td>
\r
118 * <td>altitude</td>
\r
120 * <td>Altitude in meters
\r
121 * <b>Minvalue: -10000
\r
122 * <b>Maxvalue: 10000
\r
124 * <td>SmartDeviceLink 2.0</td>
\r
129 * <td>The heading. North is 0, East is 90, etc.
\r
131 * <b>Maxvalue: 359.99
\r
132 * <b>Resolution is 0.01
\r
134 * <td>SmartDeviceLink 2.0</td>
\r
139 * <td>The speed in KPH
\r
143 * <td>SmartDeviceLink 2.0</td>
\r
146 * @since SmartDeviceLink 2.0
\r
148 public class GPSData extends RPCStruct {
\r
151 * Constructs a newly allocated GPSData object
\r
153 public GPSData() { }
\r
156 * Constructs a newly allocated GPSData object indicated by the Hashtable parameter
\r
157 * @param hash The Hashtable to use
\r
159 public GPSData(Hashtable hash) {
\r
164 * set longitude degrees
\r
165 * @param longitudeDegrees
\r
167 public void setLongitudeDegrees(Double longitudeDegrees) {
\r
168 if (longitudeDegrees != null) {
\r
169 store.put(Names.longitudeDegrees, longitudeDegrees);
\r
171 store.remove(Names.longitudeDegrees);
\r
176 * get longitude degrees
\r
177 * @return longitude degrees
\r
179 public Double getLongitudeDegrees() {
\r
180 return (Double) store.get(Names.longitudeDegrees);
\r
184 * set latitude degrees
\r
185 * @param latitudeDegrees latitude degrees
\r
187 public void setLatitudeDegrees(Double latitudeDegrees) {
\r
188 if (latitudeDegrees != null) {
\r
189 store.put(Names.latitudeDegrees, latitudeDegrees);
\r
191 store.remove(Names.latitudeDegrees);
\r
196 * get latitude degrees
\r
197 * @return latitude degrees
\r
199 public Double getLatitudeDegrees() {
\r
200 return (Double) store.get(Names.latitudeDegrees);
\r
205 * @param utcYear utc year
\r
207 public void setUtcYear(Integer utcYear) {
\r
208 if (utcYear != null) {
\r
209 store.put(Names.utcYear, utcYear);
\r
211 store.remove(Names.utcYear);
\r
219 public Integer getUtcYear() {
\r
220 return (Integer) store.get(Names.utcYear);
\r
225 * @param utcMonth utc month
\r
227 public void setUtcMonth(Integer utcMonth) {
\r
228 if (utcMonth != null) {
\r
229 store.put(Names.utcMonth, utcMonth);
\r
231 store.remove(Names.utcMonth);
\r
237 * @return utc month
\r
239 public Integer getUtcMonth() {
\r
240 return (Integer) store.get(Names.utcMonth);
\r
245 * @param utcDay utc day
\r
247 public void setUtcDay(Integer utcDay) {
\r
248 if (utcDay != null) {
\r
249 store.put(Names.utcDay, utcDay);
\r
251 store.remove(Names.utcDay);
\r
259 public Integer getUtcDay() {
\r
260 return (Integer) store.get(Names.utcDay);
\r
265 * @param utcHours utc hours
\r
267 public void setUtcHours(Integer utcHours) {
\r
268 if (utcHours != null) {
\r
269 store.put(Names.utcHours, utcHours);
\r
271 store.remove(Names.utcHours);
\r
277 * @return utc hours
\r
279 public Integer getUtcHours() {
\r
280 return (Integer) store.get(Names.utcHours);
\r
285 * @param utcMinutes utc minutes
\r
287 public void setUtcMinutes(Integer utcMinutes) {
\r
288 if (utcMinutes != null) {
\r
289 store.put(Names.utcMinutes, utcMinutes);
\r
291 store.remove(Names.utcMinutes);
\r
297 * @return utc minutes
\r
299 public Integer getUtcMinutes() {
\r
300 return (Integer) store.get(Names.utcMinutes);
\r
305 * @param utcSeconds utc seconds
\r
307 public void setUtcSeconds(Integer utcSeconds) {
\r
308 if (utcSeconds != null) {
\r
309 store.put(Names.utcSeconds, utcSeconds);
\r
311 store.remove(Names.utcSeconds);
\r
317 * @return utc seconds
\r
319 public Integer getUtcSeconds() {
\r
320 return (Integer) store.get(Names.utcSeconds);
\r
322 public void setCompassDirection(CompassDirection compassDirection) {
\r
323 if (compassDirection != null) {
\r
324 store.put(Names.compassDirection, compassDirection);
\r
326 store.remove(Names.compassDirection);
\r
329 public CompassDirection getCompassDirection() {
\r
330 Object obj = store.get(Names.compassDirection);
\r
331 if (obj instanceof CompassDirection) {
\r
332 return (CompassDirection) obj;
\r
333 } else if (obj instanceof String) {
\r
334 CompassDirection theCode = null;
\r
336 theCode = CompassDirection.valueForString((String) obj);
\r
337 } catch (Exception e) {
\r
338 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.compassDirection, e);
\r
346 * set the positional dilution of precision
\r
347 * @param pdop the positional dilution of precision
\r
349 public void setPdop(Double pdop) {
\r
350 if (pdop != null) {
\r
351 store.put(Names.pdop, pdop);
\r
353 store.remove(Names.pdop);
\r
358 * get the positional dilution of precision
\r
360 public Double getPdop() {
\r
361 return (Double) store.get(Names.pdop);
\r
365 * set the horizontal dilution of precision
\r
366 * @param hdop the horizontal dilution of precision
\r
368 public void setHdop(Double hdop) {
\r
369 if (hdop != null) {
\r
370 store.put(Names.hdop, hdop);
\r
372 store.remove(Names.hdop);
\r
377 * get the horizontal dilution of precision
\r
378 * @return the horizontal dilution of precision
\r
380 public Double getHdop() {
\r
381 return (Double) store.get(Names.hdop);
\r
385 * set the vertical dilution of precision
\r
386 * @param vdop the vertical dilution of precision
\r
388 public void setVdop(Double vdop) {
\r
389 if (vdop != null) {
\r
390 store.put(Names.vdop, vdop);
\r
392 store.remove(Names.vdop);
\r
397 * get the vertical dilution of precision
\r
398 * @return the vertical dilution of precision
\r
400 public Double getVdop() {
\r
401 return (Double) store.get(Names.vdop);
\r
405 * set what coordinates based on
\r
406 * @param actual True, if coordinates are based on satellites.False, if based on dead reckoning
\r
408 public void setActual(Boolean actual) {
\r
409 if (actual != null) {
\r
410 store.put(Names.actual, actual);
\r
412 store.remove(Names.actual);
\r
417 * get what coordinates based on
\r
418 * @return True, if coordinates are based on satellites.False, if based on dead reckoning
\r
420 public Boolean getActual() {
\r
421 return (Boolean) store.get(Names.actual);
\r
425 * set the number of satellites in view
\r
426 * @param satellites the number of satellites in view
\r
428 public void setSatellites(Integer satellites) {
\r
429 if (satellites != null) {
\r
430 store.put(Names.satellites, satellites);
\r
432 store.remove(Names.satellites);
\r
437 * get the number of satellites in view
\r
438 * @return the number of satellites in view
\r
440 public Integer getSatellites() {
\r
441 return (Integer) store.get(Names.satellites);
\r
443 public void setDimension(Dimension dimension) {
\r
444 if (dimension != null) {
\r
445 store.put(Names.dimension, dimension);
\r
447 store.remove(Names.dimension);
\r
450 public Dimension getDimension() {
\r
451 Object obj = store.get(Names.dimension);
\r
452 if (obj instanceof Dimension) {
\r
453 return (Dimension) obj;
\r
454 } else if (obj instanceof String) {
\r
455 Dimension theCode = null;
\r
457 theCode = Dimension.valueForString((String) obj);
\r
458 } catch (Exception e) {
\r
459 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.dimension, e);
\r
467 * set altitude in meters
\r
468 * @param altitude altitude in meters
\r
470 public void setAltitude(Double altitude) {
\r
471 if (altitude != null) {
\r
472 store.put(Names.altitude, altitude);
\r
474 store.remove(Names.altitude);
\r
479 * get altitude in meters
\r
480 * @return altitude in meters
\r
482 public Double getAltitude() {
\r
483 return (Double) store.get(Names.altitude);
\r
487 * set the heading.North is 0, East is 90, etc.
\r
488 * @param heading the heading.
\r
490 public void setHeading(Double heading) {
\r
491 if (heading != null) {
\r
492 store.put(Names.heading, heading);
\r
494 store.remove(Names.heading);
\r
501 public Double getHeading() {
\r
502 return (Double) store.get(Names.heading);
\r
507 * @param speed the speed
\r
509 public void setSpeed(Double speed) {
\r
510 if (speed != null) {
\r
511 store.put(Names.speed, speed);
\r
513 store.remove(Names.speed);
\r
518 * get the speed in KPH
\r
519 * @return the speed in KPH
\r
521 public Double getSpeed() {
\r
522 return (Double) store.get(Names.speed);
\r