see: https://lists.gnu.org/archive/html/gpsd-dev/2015-06/msg00001.html
336 | *
337 | * @param path Path of device known to gpsd
338 | * @throws IOException
339 | * @throws JSONException
340 | */
341 | public void kickDevice(String path) throws IOException, JSONException {
342 | final JSONObject d = new JSONObject();
343 | d.put("class", "DEVICE");
344 | d.put("path", path);
345 | this.voidCommand("?DEVICE=" + d);
346 | }
347 |
348 | /** Our socket thread got disconnect and is exiting. */
349 | void handleDisconnected() throws IOException {
350 | synchronized (this.asyncMutex) {
351 | if (socket != null) {
352 | socket.close();
353 | }
354 | this.socket = new Socket(server, port);
355 | this.in = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
356 | this.out = new BufferedWriter(new OutputStreamWriter(this.socket.getOutputStream()));
357 |
358 | this.listenThread = new SocketThread(this.in, this, this.resultParser, this.daemon);
359 | this.listenThread.start();
360 | if (lastWatch != null) { // restore watch if we had one.
361 | this.syncCommand(lastWatch, WatchObject.class);
362 | }
363 | }
364 | }
365 |
366 | /**
367 | * Set a retry interval for reconnecting to GPSD if the socket closes. Default value is 1000ms.
368 | *
369 | * @param millis how long to wait between each reconnection attempts.
370 | */
371 | public void setRetryInterval(long millis) {
372 | retryInterval.set(millis);
373 | }
374 |
375 | /**
376 | * Returns the retry interval for reconnecting to GPSD if the socket closes. Default value is
377 | * 1000ms.
378 | *
379 | * @return retry interval
380 | */
381 | public long getRetryInterval() {
382 | return retryInterval.get();
383 | }
384 | }
385 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/backend/LegacyResultParser.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.backend;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 | import de.taimos.gpsd4java.types.ParseException;
25 | import de.taimos.gpsd4java.types.PollObject;
26 | import de.taimos.gpsd4java.types.SKYObject;
27 | import de.taimos.gpsd4java.types.TPVObject;
28 | import org.json.JSONObject;
29 |
30 | /**
31 | * This class is used to parse responses from GPSd
32 | *
33 | * @deprecated use ResultParser; it handles old fields correctly
34 | * @author thoeger
35 | */
36 | @Deprecated
37 | public class LegacyResultParser extends ResultParser {
38 |
39 | @Override
40 | protected IGPSObject parsePOLL(final JSONObject json) throws ParseException {
41 | IGPSObject gps;
42 | // check this for gpsd version <= 3.5
43 | final PollObject poll = new PollObject();
44 | poll.setTimestamp(this.parseTimestamp(json, "time"));
45 | poll.setActive(json.optInt("active", 0));
46 | poll.setFixes(this.parseObjectArray(json.optJSONArray("fixes"), TPVObject.class));
47 | poll.setSkyviews(this.parseObjectArray(json.optJSONArray("skyviews"), SKYObject.class));
48 | gps = poll;
49 | return gps;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/backend/SocketThread.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.backend;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import java.io.BufferedReader;
24 | import java.io.IOException;
25 | import java.net.SocketException;
26 | import org.slf4j.Logger;
27 | import org.slf4j.LoggerFactory;
28 |
29 | /**
30 | * thread reading input from GPSd server
31 | *
32 | * @author thoeger
33 | */
34 | public class SocketThread extends Thread {
35 |
36 | private static final Logger LOG = LoggerFactory.getLogger(SocketThread.class);
37 |
38 | private final BufferedReader reader;
39 |
40 | private final GPSdEndpoint endpoint;
41 |
42 | private final AbstractResultParser resultParser;
43 |
44 | private final WaitableBoolean running = new WaitableBoolean(true);
45 |
46 | /**
47 | * @param reader the socket input
48 | * @param endpoint the endpoint
49 | * @param resultParser the result parser
50 | * @param daemon whether to configure the thread as a daemon, as defined in {@link
51 | * Thread#setDaemon}
52 | */
53 | public SocketThread(
54 | final BufferedReader reader,
55 | final GPSdEndpoint endpoint,
56 | final AbstractResultParser resultParser,
57 | final boolean daemon) {
58 |
59 | if (resultParser == null) {
60 | throw new IllegalArgumentException("resultParser can not be null!");
61 | }
62 |
63 | this.reader = reader;
64 | this.endpoint = endpoint;
65 | this.resultParser = resultParser;
66 |
67 | this.setDaemon(daemon);
68 | this.setName("GPS Socket Thread");
69 | }
70 |
71 | /**
72 | * @param reader the socket input
73 | * @param endpoint the endpoint
74 | * @param resultParser the result parser
75 | */
76 | public SocketThread(
77 | final BufferedReader reader,
78 | final GPSdEndpoint endpoint,
79 | final AbstractResultParser resultParser) {
80 | this(reader, endpoint, resultParser, true);
81 | }
82 |
83 | @Override
84 | public void run() {
85 | if (this.reader != null) {
86 | while (this.running.get()) {
87 | try {
88 | // read line from socket
89 | final String s = this.reader.readLine();
90 | if (s == null) {
91 | break;
92 | }
93 | if (!s.isEmpty()) {
94 | // parse line and handle it accordingly
95 | this.endpoint.handle(this.resultParser.parse(s));
96 | }
97 | } catch (final SocketException e) {
98 | break; // stop
99 | } catch (final Exception e) {
100 | // TODO handle this better
101 | SocketThread.LOG.warn("Problem encountered while reading/parsing/handling line", e);
102 | }
103 | }
104 | }
105 | if (this.running.get() && !Thread.interrupted()) {
106 | if (this.reader != null) {
107 | SocketThread.LOG.warn(
108 | "Problem encountered while reading/parsing/handling line, attempting restart");
109 | }
110 | retry();
111 | }
112 | }
113 |
114 | protected void retry() {
115 | if (this.reader != null) {
116 | SocketThread.LOG.debug("Disconnected from GPS socket, retrying connection");
117 | } else {
118 | SocketThread.LOG.debug("Connecting to GPSD socket");
119 | }
120 |
121 | while (this.running.get()) {
122 | try {
123 | this.running.waitFor(this.endpoint.getRetryInterval());
124 | this.endpoint.handleDisconnected();
125 | SocketThread.LOG.debug("Connected to GPS socket");
126 | this.running.set(false);
127 | } catch (InterruptedException ix) {
128 | break;
129 | } catch (IOException e) {
130 | SocketThread.LOG.debug("Still disconnected from GPS socket, retrying connection again");
131 | }
132 | }
133 | }
134 |
135 | /** Halts the socket thread. */
136 | public void halt() {
137 | this.running.set(false);
138 |
139 | if (this.reader != null) {
140 | try {
141 | this.reader.close();
142 | } catch (final IOException e) {
143 | // ignore
144 | }
145 | }
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/backend/WaitableBoolean.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.backend;
2 |
3 | /**
4 | * Not as efficient as AtomicBoolean but you can wait on it.
5 | *
6 | * @author TimW
7 | */
8 | class WaitableBoolean {
9 |
10 | private boolean val;
11 |
12 | public WaitableBoolean(boolean b) {
13 | this.val = b;
14 | }
15 |
16 | synchronized void set(boolean value) {
17 | this.val = value;
18 | notifyAll();
19 | }
20 |
21 | synchronized boolean get() {
22 | return this.val;
23 | }
24 |
25 | public synchronized void waitFor(long millis) throws InterruptedException {
26 | super.wait(millis);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/ATTObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | /**
24 | * An ATT object is a vehicle-attitude report. It is returned by digital-compass and gyroscope
25 | * sensors; depending on device, it may include: heading, pitch, roll, yaw, gyroscope, and
26 | * magnetic-field readings. Because such sensors are often bundled as part of marine-navigation
27 | * systems, the ATT response may also include water depth.
28 | *
29 | *
30 | *
all getters for double values may return created: 17.01.2011
41 | */
42 | public class Tester {
43 |
44 | static final Logger log = LoggerFactory.getLogger(Tester.class);
45 |
46 | private Tester() {}
47 |
48 | /**
49 | * @param args the args
50 | */
51 | public static void main(final String[] args) {
52 | try {
53 | String host = "localhost";
54 | int port = 2947;
55 |
56 | switch (args.length) {
57 | case 0:
58 | // Nothing to do, use default
59 | break;
60 | case 1:
61 | // only server specified
62 | host = args[0];
63 | break;
64 | case 2:
65 | // Server and port specified
66 | host = args[0];
67 | if (args[1].matches("\\d+")) {
68 | port = Integer.parseInt(args[1]);
69 | }
70 | break;
71 | default:
72 | break;
73 | }
74 |
75 | final GPSdEndpoint ep = new GPSdEndpoint(host, port, new ResultParser());
76 |
77 | ep.addListener(
78 | new ObjectListener() {
79 |
80 | @Override
81 | public void handleTPV(final TPVObject tpv) {
82 | Tester.log.info("TPV: {}", tpv);
83 | }
84 |
85 | @Override
86 | public void handleSKY(final SKYObject sky) {
87 | Tester.log.info("SKY: {}", sky);
88 | for (final SATObject sat : sky.getSatellites()) {
89 | Tester.log.info(" SAT: {}", sat);
90 | }
91 | }
92 |
93 | @Override
94 | public void handleSUBFRAME(final SUBFRAMEObject subframe) {
95 | Tester.log.info("SUBFRAME: {}", subframe);
96 | }
97 |
98 | @Override
99 | public void handleATT(final ATTObject att) {
100 | Tester.log.info("ATT: {}", att);
101 | }
102 |
103 | @Override
104 | public void handleDevice(final DeviceObject device) {
105 | Tester.log.info("Device: {}", device);
106 | }
107 |
108 | @Override
109 | public void handleDevices(final DevicesObject devices) {
110 | for (final DeviceObject d : devices.getDevices()) {
111 | Tester.log.info("Device: {}", d);
112 | }
113 | }
114 | });
115 |
116 | ep.start();
117 |
118 | Tester.log.info("Version: {}", ep.version());
119 |
120 | Tester.log.info("Watch: {}", ep.watch(true, true));
121 |
122 | Tester.log.info("Poll: {}", ep.poll());
123 |
124 | Thread.sleep(60000);
125 | } catch (final Exception e) {
126 | Tester.log.error("Problem encountered", e);
127 | }
128 | }
129 | }
130 |
--------------------------------------------------------------------------------
Double.NaN
if value is not present
31 | * other getters may return null
32 | *
33 | * @author thoeger
34 | */
35 | public class ATTObject implements IGPSObject {
36 |
37 | /** the GPSd internal name */
38 | public static final String NAME = "ATT";
39 |
40 | private String tag = null;
41 |
42 | private String device = null;
43 |
44 | private double timestamp = Double.NaN;
45 |
46 | private double heading = Double.NaN;
47 |
48 | private double pitch = Double.NaN;
49 |
50 | private double yaw = Double.NaN;
51 |
52 | private double roll = Double.NaN;
53 |
54 | private double dip = Double.NaN;
55 |
56 | private double mag_len = Double.NaN;
57 |
58 | private double mag_x = Double.NaN;
59 |
60 | private double mag_y = Double.NaN;
61 |
62 | private double mag_z = Double.NaN;
63 |
64 | private double acc_len = Double.NaN;
65 |
66 | private double acc_x = Double.NaN;
67 |
68 | private double acc_y = Double.NaN;
69 |
70 | private double acc_z = Double.NaN;
71 |
72 | private double gyro_x = Double.NaN;
73 |
74 | private double gyro_y = Double.NaN;
75 |
76 | private double depth = Double.NaN;
77 |
78 | private double temperature = Double.NaN;
79 |
80 | private String magState = null;
81 |
82 | private String pitchState = null;
83 |
84 | private String yawState = null;
85 |
86 | private String rollState = null;
87 |
88 | /**
89 | * Type tag associated with this GPS sentence; from an NMEA device this is just the NMEA sentence
90 | * type.
91 | *
92 | * @return the tag
93 | */
94 | public String getTag() {
95 | return this.tag;
96 | }
97 |
98 | /**
99 | * Type tag associated with this GPS sentence; from an NMEA device this is just the NMEA sentence
100 | * type.
101 | *
102 | * @param tag the tag to set
103 | */
104 | public void setTag(final String tag) {
105 | this.tag = tag;
106 | }
107 |
108 | /**
109 | * Name of originating device
110 | *
111 | * @return the device
112 | */
113 | public String getDevice() {
114 | return this.device;
115 | }
116 |
117 | /**
118 | * Name of originating device
119 | *
120 | * @param device the device to set
121 | */
122 | public void setDevice(final String device) {
123 | this.device = device;
124 | }
125 |
126 | /**
127 | * Seconds since the Unix epoch, UTC. May have a fractional part of up to .001sec precision.
128 | *
129 | * @return the timestamp
130 | */
131 | public double getTimestamp() {
132 | return this.timestamp;
133 | }
134 |
135 | /**
136 | * Seconds since the Unix epoch, UTC. May have a fractional part of up to .001sec precision.
137 | *
138 | * @param timestamp the timestamp to set
139 | */
140 | public void setTimestamp(final double timestamp) {
141 | this.timestamp = timestamp;
142 | }
143 |
144 | /**
145 | * Heading, degrees from true north.
146 | *
147 | * @return the heading
148 | */
149 | public double getHeading() {
150 | return this.heading;
151 | }
152 |
153 | /**
154 | * Heading, degrees from true north.
155 | *
156 | * @param heading the heading to set
157 | */
158 | public void setHeading(final double heading) {
159 | this.heading = heading;
160 | }
161 |
162 | /**
163 | * Pitch in degrees.
164 | *
165 | * @return the pitch
166 | */
167 | public double getPitch() {
168 | return this.pitch;
169 | }
170 |
171 | /**
172 | * Pitch in degrees.
173 | *
174 | * @param pitch the pitch to set
175 | */
176 | public void setPitch(final double pitch) {
177 | this.pitch = pitch;
178 | }
179 |
180 | /**
181 | * Yaw in degrees
182 | *
183 | * @return the yaw
184 | */
185 | public double getYaw() {
186 | return this.yaw;
187 | }
188 |
189 | /**
190 | * Yaw in degrees
191 | *
192 | * @param yaw the yaw to set
193 | */
194 | public void setYaw(final double yaw) {
195 | this.yaw = yaw;
196 | }
197 |
198 | /**
199 | * Roll in degrees.
200 | *
201 | * @return the roll
202 | */
203 | public double getRoll() {
204 | return this.roll;
205 | }
206 |
207 | /**
208 | * Roll in degrees.
209 | *
210 | * @param roll the roll to set
211 | */
212 | public void setRoll(final double roll) {
213 | this.roll = roll;
214 | }
215 |
216 | /**
217 | * Roll in degrees.
218 | *
219 | * @return the dip
220 | */
221 | public double getDip() {
222 | return this.dip;
223 | }
224 |
225 | /**
226 | * Roll in degrees.
227 | *
228 | * @param dip the dip to set
229 | */
230 | public void setDip(final double dip) {
231 | this.dip = dip;
232 | }
233 |
234 | /**
235 | * Scalar magnetic field strength.
236 | *
237 | * @return the mag_len
238 | */
239 | public double getMag_len() {
240 | return this.mag_len;
241 | }
242 |
243 | /**
244 | * Scalar magnetic field strength.
245 | *
246 | * @param mag_len the mag_len to set
247 | */
248 | public void setMag_len(final double mag_len) {
249 | this.mag_len = mag_len;
250 | }
251 |
252 | /**
253 | * X component of magnetic field strength.
254 | *
255 | * @return the mag_x
256 | */
257 | public double getMag_x() {
258 | return this.mag_x;
259 | }
260 |
261 | /**
262 | * X component of magnetic field strength.
263 | *
264 | * @param mag_x the mag_x to set
265 | */
266 | public void setMag_x(final double mag_x) {
267 | this.mag_x = mag_x;
268 | }
269 |
270 | /**
271 | * Y component of magnetic field strength.
272 | *
273 | * @return the mag_y
274 | */
275 | public double getMag_y() {
276 | return this.mag_y;
277 | }
278 |
279 | /**
280 | * Y component of magnetic field strength.
281 | *
282 | * @param mag_y the mag_y to set
283 | */
284 | public void setMag_y(final double mag_y) {
285 | this.mag_y = mag_y;
286 | }
287 |
288 | /**
289 | * Z component of magnetic field strength.
290 | *
291 | * @return the mag_z
292 | */
293 | public double getMag_z() {
294 | return this.mag_z;
295 | }
296 |
297 | /**
298 | * Z component of magnetic field strength.
299 | *
300 | * @param mag_z the mag_z to set
301 | */
302 | public void setMag_z(final double mag_z) {
303 | this.mag_z = mag_z;
304 | }
305 |
306 | /**
307 | * Scalar acceleration.
308 | *
309 | * @return the acc_len
310 | */
311 | public double getAcc_len() {
312 | return this.acc_len;
313 | }
314 |
315 | /**
316 | * Scalar acceleration.
317 | *
318 | * @param acc_len the acc_len to set
319 | */
320 | public void setAcc_len(final double acc_len) {
321 | this.acc_len = acc_len;
322 | }
323 |
324 | /**
325 | * X component of acceleration.
326 | *
327 | * @return the acc_x
328 | */
329 | public double getAcc_x() {
330 | return this.acc_x;
331 | }
332 |
333 | /**
334 | * X component of acceleration.
335 | *
336 | * @param acc_x the acc_x to set
337 | */
338 | public void setAcc_x(final double acc_x) {
339 | this.acc_x = acc_x;
340 | }
341 |
342 | /**
343 | * Y component of acceleration.
344 | *
345 | * @return the acc_y
346 | */
347 | public double getAcc_y() {
348 | return this.acc_y;
349 | }
350 |
351 | /**
352 | * Y component of acceleration.
353 | *
354 | * @param acc_y the acc_y to set
355 | */
356 | public void setAcc_y(final double acc_y) {
357 | this.acc_y = acc_y;
358 | }
359 |
360 | /**
361 | * Z component of acceleration.
362 | *
363 | * @return the acc_z
364 | */
365 | public double getAcc_z() {
366 | return this.acc_z;
367 | }
368 |
369 | /**
370 | * Z component of acceleration.
371 | *
372 | * @param acc_z the acc_z to set
373 | */
374 | public void setAcc_z(final double acc_z) {
375 | this.acc_z = acc_z;
376 | }
377 |
378 | /**
379 | * X component of acceleration.
380 | *
381 | * @return the gyro_x
382 | */
383 | public double getGyro_x() {
384 | return this.gyro_x;
385 | }
386 |
387 | /**
388 | * X component of acceleration.
389 | *
390 | * @param gyro_x the gyro_x to set
391 | */
392 | public void setGyro_x(final double gyro_x) {
393 | this.gyro_x = gyro_x;
394 | }
395 |
396 | /**
397 | * Y component of acceleration.
398 | *
399 | * @return the gyro_y
400 | */
401 | public double getGyro_y() {
402 | return this.gyro_y;
403 | }
404 |
405 | /**
406 | * Y component of acceleration.
407 | *
408 | * @param gyro_y the gyro_y to set
409 | */
410 | public void setGyro_y(final double gyro_y) {
411 | this.gyro_y = gyro_y;
412 | }
413 |
414 | /**
415 | * Water depth in meters.
416 | *
417 | * @return the depth
418 | */
419 | public double getDepth() {
420 | return this.depth;
421 | }
422 |
423 | /**
424 | * Water depth in meters.
425 | *
426 | * @param depth the depth to set
427 | */
428 | public void setDepth(final double depth) {
429 | this.depth = depth;
430 | }
431 |
432 | /**
433 | * Temperature at sensor, degrees centigrade.
434 | *
435 | * @return the temperature
436 | */
437 | public double getTemperature() {
438 | return this.temperature;
439 | }
440 |
441 | /**
442 | * Temperature at sensor, degrees centigrade.
443 | *
444 | * @param temperature the temperature to set
445 | */
446 | public void setTemperature(final double temperature) {
447 | this.temperature = temperature;
448 | }
449 |
450 | /**
451 | * Magnetometer status.
452 | *
453 | * @return the magState
454 | */
455 | public String getMagState() {
456 | return this.magState;
457 | }
458 |
459 | /**
460 | * Magnetometer status.
461 | *
462 | * @param magState the magState to set
463 | */
464 | public void setMagState(final String magState) {
465 | this.magState = magState;
466 | }
467 |
468 | /**
469 | * Pitch sensor status.
470 | *
471 | * @return the pitchState
472 | */
473 | public String getPitchState() {
474 | return this.pitchState;
475 | }
476 |
477 | /**
478 | * Pitch sensor status.
479 | *
480 | * @param pitchState the pitchState to set
481 | */
482 | public void setPitchState(final String pitchState) {
483 | this.pitchState = pitchState;
484 | }
485 |
486 | /**
487 | * Yaw sensor status.
488 | *
489 | * @return the yawState
490 | */
491 | public String getYawState() {
492 | return this.yawState;
493 | }
494 |
495 | /**
496 | * Yaw sensor status.
497 | *
498 | * @param yawState the yawState to set
499 | */
500 | public void setYawState(final String yawState) {
501 | this.yawState = yawState;
502 | }
503 |
504 | /**
505 | * Roll sensor status.
506 | *
507 | * @return the rollState
508 | */
509 | public String getRollState() {
510 | return this.rollState;
511 | }
512 |
513 | /**
514 | * Roll sensor status.
515 | *
516 | * @param rollState the rollState to set
517 | */
518 | public void setRollState(final String rollState) {
519 | this.rollState = rollState;
520 | }
521 |
522 | @Override
523 | public String toString() {
524 | final StringBuilder sb = new StringBuilder();
525 | sb.append("ATTObject{tag=");
526 | sb.append(this.tag);
527 | sb.append(", device=");
528 | sb.append(this.device);
529 | sb.append(", timestamp=");
530 | sb.append(this.timestamp);
531 | sb.append(", heading=");
532 | sb.append(this.heading);
533 | sb.append(", mag_st=");
534 | sb.append(this.magState);
535 | sb.append(", pitch=");
536 | sb.append(this.pitch);
537 | sb.append(", pitch_st=");
538 | sb.append(this.pitchState);
539 | sb.append(", yaw=");
540 | sb.append(this.yawState);
541 | sb.append(", roll=");
542 | sb.append(this.roll);
543 | sb.append(", roll_st=");
544 | sb.append(this.rollState);
545 | sb.append(", dip=");
546 | sb.append(this.dip);
547 | sb.append(", mag_len=");
548 | sb.append(this.mag_len);
549 | sb.append(", mag_x=");
550 | sb.append(this.mag_x);
551 | sb.append(", mag_y=");
552 | sb.append(this.mag_y);
553 | sb.append(", mag_z=");
554 | sb.append(this.mag_z);
555 | sb.append(", acc_len=");
556 | sb.append(this.acc_len);
557 | sb.append(", acc_x=");
558 | sb.append(this.acc_x);
559 | sb.append(", acc_y=");
560 | sb.append(this.acc_y);
561 | sb.append(", acc_z=");
562 | sb.append(this.acc_z);
563 | sb.append(", gyro_x=");
564 | sb.append(this.gyro_x);
565 | sb.append(", gyro_y=");
566 | sb.append(this.gyro_y);
567 | sb.append(", depth=");
568 | sb.append(this.depth);
569 | sb.append(", temperature=");
570 | sb.append(this.temperature);
571 | sb.append("}");
572 | return sb.toString();
573 | }
574 | }
575 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/DeviceObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | /**
24 | * @author thoeger
25 | */
26 | public class DeviceObject implements IGPSObject {
27 |
28 | /** the GPSd internal name */
29 | public static final String NAME = "DEVICE";
30 |
31 | private String path;
32 |
33 | private double activated;
34 |
35 | private String driver;
36 |
37 | private int bps;
38 |
39 | private EParity parity;
40 |
41 | private int stopbit;
42 |
43 | private boolean nativeMode;
44 |
45 | private double cycle;
46 |
47 | private double mincycle;
48 |
49 | /**
50 | * Name the device for which the control bits are being reported
51 | *
52 | * @return the path
53 | */
54 | public String getPath() {
55 | return this.path;
56 | }
57 |
58 | /**
59 | * Name the device for which the control bits are being reported
60 | *
61 | * @param path the path to set
62 | */
63 | public void setPath(final String path) {
64 | this.path = path;
65 | }
66 |
67 | /**
68 | * Time the device was activated, or 0 if it is being closed.
69 | *
70 | * @return the activated
71 | */
72 | public double getActivated() {
73 | return this.activated;
74 | }
75 |
76 | /**
77 | * Time the device was activated, or 0 if it is being closed.
78 | *
79 | * @param activated the activated to set
80 | */
81 | public void setActivated(final double activated) {
82 | this.activated = activated;
83 | }
84 |
85 | /**
86 | * GPSD's name for the device driver type. Won't be reported before gpsd has seen identifiable
87 | * packets from the device.
88 | *
89 | * @return the driver
90 | */
91 | public String getDriver() {
92 | return this.driver;
93 | }
94 |
95 | /**
96 | * GPSD's name for the device driver type. Won't be reported before gpsd has seen identifiable
97 | * packets from the device.
98 | *
99 | * @param driver the driver to set
100 | */
101 | public void setDriver(final String driver) {
102 | this.driver = driver;
103 | }
104 |
105 | /**
106 | * Device speed in bits per second.
107 | *
108 | * @return the bps
109 | */
110 | public int getBps() {
111 | return this.bps;
112 | }
113 |
114 | /**
115 | * Device speed in bits per second.
116 | *
117 | * @param bps the bps to set
118 | */
119 | public void setBps(final int bps) {
120 | this.bps = bps;
121 | }
122 |
123 | /**
124 | * Device parity
125 | *
126 | * @return the parity
127 | */
128 | public EParity getParity() {
129 | return this.parity;
130 | }
131 |
132 | /**
133 | * Device parity
134 | *
135 | * @param parity the parity to set
136 | */
137 | public void setParity(final EParity parity) {
138 | this.parity = parity;
139 | }
140 |
141 | /**
142 | * Device Stopbits
143 | *
144 | * @return the stopbit
145 | */
146 | public int getStopbit() {
147 | return this.stopbit;
148 | }
149 |
150 | /**
151 | * Device Stopbits
152 | *
153 | * @param stopbit the stopbit to set
154 | */
155 | public void setStopbit(final int stopbit) {
156 | this.stopbit = stopbit;
157 | }
158 |
159 | /**
160 | * false means NMEA mode and true means alternate mode (binary if it has one, for SiRF and
161 | * Evermore chipsets in particular).
162 | *
163 | * @return the nativeMode
164 | */
165 | public boolean isNativeMode() {
166 | return this.nativeMode;
167 | }
168 |
169 | /**
170 | * false means NMEA mode and true means alternate mode (binary if it has one, for SiRF and
171 | * Evermore chipsets in particular).
172 | *
173 | * @param nativeMode the nativeMode to set
174 | */
175 | public void setNativeMode(final boolean nativeMode) {
176 | this.nativeMode = nativeMode;
177 | }
178 |
179 | /**
180 | * Device cycle time in seconds.
181 | *
182 | * @return the cycle
183 | */
184 | public double getCycle() {
185 | return this.cycle;
186 | }
187 |
188 | /**
189 | * Device cycle time in seconds.
190 | *
191 | * @param cycle the cycle to set
192 | */
193 | public void setCycle(final double cycle) {
194 | this.cycle = cycle;
195 | }
196 |
197 | /**
198 | * Device minimum cycle time in seconds.
199 | *
200 | * @return the mincycle
201 | */
202 | public double getMincycle() {
203 | return this.mincycle;
204 | }
205 |
206 | /**
207 | * Device minimum cycle time in seconds.
208 | *
209 | * @param mincycle the mincycle to set
210 | */
211 | public void setMincycle(final double mincycle) {
212 | this.mincycle = mincycle;
213 | }
214 |
215 | @Override
216 | public int hashCode() {
217 | final int prime = 31;
218 | int result = 1;
219 | long temp;
220 | temp = Double.doubleToLongBits(this.activated);
221 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
222 | result = (prime * result) + this.bps;
223 | temp = Double.doubleToLongBits(this.cycle);
224 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
225 | result = (prime * result) + ((this.driver == null) ? 0 : this.driver.hashCode());
226 | temp = Double.doubleToLongBits(this.mincycle);
227 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
228 | result = (prime * result) + (this.nativeMode ? 1231 : 1237);
229 | result = (prime * result) + ((this.parity == null) ? 0 : this.parity.hashCode());
230 | result = (prime * result) + ((this.path == null) ? 0 : this.path.hashCode());
231 | result = (prime * result) + this.stopbit;
232 | return result;
233 | }
234 |
235 | @Override
236 | public boolean equals(final Object obj) {
237 | if (this == obj) {
238 | return true;
239 | }
240 | if (obj == null) {
241 | return false;
242 | }
243 | if (this.getClass() != obj.getClass()) {
244 | return false;
245 | }
246 | final DeviceObject other = (DeviceObject) obj;
247 | if (Double.doubleToLongBits(this.activated) != Double.doubleToLongBits(other.activated)) {
248 | return false;
249 | }
250 | if (this.bps != other.bps) {
251 | return false;
252 | }
253 | if (Double.doubleToLongBits(this.cycle) != Double.doubleToLongBits(other.cycle)) {
254 | return false;
255 | }
256 | if (this.driver == null) {
257 | if (other.driver != null) {
258 | return false;
259 | }
260 | } else if (!this.driver.equals(other.driver)) {
261 | return false;
262 | }
263 | if (Double.doubleToLongBits(this.mincycle) != Double.doubleToLongBits(other.mincycle)) {
264 | return false;
265 | }
266 | if (this.nativeMode != other.nativeMode) {
267 | return false;
268 | }
269 | if (this.parity != other.parity) {
270 | return false;
271 | }
272 | if (this.path == null) {
273 | if (other.path != null) {
274 | return false;
275 | }
276 | } else if (!this.path.equals(other.path)) {
277 | return false;
278 | }
279 | if (this.stopbit != other.stopbit) {
280 | return false;
281 | }
282 | return true;
283 | }
284 |
285 | @Override
286 | public String toString() {
287 | final StringBuilder sb = new StringBuilder();
288 | sb.append("DeviceObject{path=");
289 | sb.append(this.path);
290 | sb.append(", driver=");
291 | sb.append(this.driver);
292 | sb.append(", activated=");
293 | sb.append((long) this.activated);
294 | sb.append(", bps=");
295 | sb.append(this.bps);
296 | sb.append(", parity=");
297 | sb.append(this.parity);
298 | sb.append(", stopbit=");
299 | sb.append(this.stopbit);
300 | sb.append(", nativeMode=");
301 | sb.append(this.nativeMode);
302 | sb.append(", cycle=");
303 | sb.append(this.cycle);
304 | sb.append(", minCycle=");
305 | sb.append(this.mincycle);
306 | sb.append("}");
307 | return sb.toString();
308 | }
309 | }
310 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/DevicesObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import java.util.List;
24 |
25 | /**
26 | * @author thoeger
27 | */
28 | public class DevicesObject implements IGPSObject {
29 |
30 | /** the GPSd internal name */
31 | public static final String NAME = "DEVICES";
32 |
33 | private List
25 | * all getters for double values may return Double.NaN
if value is not present
26 | * other getters may return null
27 | *
28 | * @author thoeger
29 | */
30 | public class GSTObject implements IGPSObject {
31 |
32 | /** the GPSd internal name */
33 | public static final String NAME = "GST";
34 |
35 | private String tag = null;
36 |
37 | private String device = null;
38 |
39 | private double timestamp = Double.NaN;
40 |
41 | private double rms = Double.NaN;
42 |
43 | private double major = Double.NaN;
44 |
45 | private double minor = Double.NaN;
46 |
47 | private double orient = Double.NaN;
48 |
49 | private double lat = Double.NaN;
50 |
51 | private double lon = Double.NaN;
52 |
53 | private double alt = Double.NaN;
54 |
55 | /**
56 | * Type tag associated with this GPS sentence; from an NMEA device this is just the NMEA sentence
57 | * type.
58 | *
59 | * @return the tag
60 | */
61 | public String getTag() {
62 | return this.tag;
63 | }
64 |
65 | /**
66 | * Type tag associated with this GPS sentence; from an NMEA device this is just the NMEA sentence
67 | * type.
68 | *
69 | * @param tag the tag to set
70 | */
71 | public void setTag(final String tag) {
72 | this.tag = tag;
73 | }
74 |
75 | /**
76 | * Name of originating device
77 | *
78 | * @return the device
79 | */
80 | public String getDevice() {
81 | return this.device;
82 | }
83 |
84 | /**
85 | * Name of originating device
86 | *
87 | * @param device the device to set
88 | */
89 | public void setDevice(final String device) {
90 | this.device = device;
91 | }
92 |
93 | /**
94 | * Seconds since the Unix epoch, UTC. May have a fractional part of up to .001sec precision.
95 | *
96 | * @return the timestamp
97 | */
98 | public double getTimestamp() {
99 | return this.timestamp;
100 | }
101 |
102 | /**
103 | * Seconds since the Unix epoch, UTC. May have a fractional part of up to .001sec precision.
104 | *
105 | * @param timestamp the timestamp to set
106 | */
107 | public void setTimestamp(final double timestamp) {
108 | this.timestamp = timestamp;
109 | }
110 |
111 | /**
112 | * Value of the standard deviation of the range inputs to the navigation process (range inputs
113 | * include pseudoranges and DGPS corrections).
114 | *
115 | * @return the rms
116 | */
117 | public double getRms() {
118 | return this.rms;
119 | }
120 |
121 | /**
122 | * Value of the standard deviation of the range inputs to the navigation process (range inputs
123 | * include pseudoranges and DGPS corrections).
124 | *
125 | * @param rms the rms to set
126 | */
127 | public void setRms(final double rms) {
128 | this.rms = rms;
129 | }
130 |
131 | /**
132 | * Standard deviation of semi-major axis of error ellipse, in meters.
133 | *
134 | * @return the major
135 | */
136 | public double getMajor() {
137 | return this.major;
138 | }
139 |
140 | /**
141 | * Standard deviation of semi-major axis of error ellipse, in meters.
142 | *
143 | * @param major the major to set
144 | */
145 | public void setMajor(final double major) {
146 | this.major = major;
147 | }
148 |
149 | /**
150 | * Standard deviation of semi-minor axis of error ellipse, in meters.
151 | *
152 | * @return the minor
153 | */
154 | public double getMinor() {
155 | return this.minor;
156 | }
157 |
158 | /**
159 | * Standard deviation of semi-minor axis of error ellipse, in meters.
160 | *
161 | * @param minor the minor to set
162 | */
163 | public void setMinor(final double minor) {
164 | this.minor = minor;
165 | }
166 |
167 | /**
168 | * Orientation of semi-major axis of error ellipse, in degrees from true north.
169 | *
170 | * @return the orient
171 | */
172 | public double getOrient() {
173 | return this.orient;
174 | }
175 |
176 | /**
177 | * Orientation of semi-major axis of error ellipse, in degrees from true north.
178 | *
179 | * @param orient the orient to set
180 | */
181 | public void setOrient(final double orient) {
182 | this.orient = orient;
183 | }
184 |
185 | /**
186 | * Standard deviation of latitude error, in meters.
187 | *
188 | * @return the lat
189 | */
190 | public double getLat() {
191 | return this.lat;
192 | }
193 |
194 | /**
195 | * Standard deviation of latitude error, in meters.
196 | *
197 | * @param lat the lat to set
198 | */
199 | public void setLat(final double lat) {
200 | this.lat = lat;
201 | }
202 |
203 | /**
204 | * Standard deviation of longitude error, in meters.
205 | *
206 | * @return the lon
207 | */
208 | public double getLon() {
209 | return this.lon;
210 | }
211 |
212 | /**
213 | * Standard deviation of longitude error, in meters.
214 | *
215 | * @param lon the lon to set
216 | */
217 | public void setLon(final double lon) {
218 | this.lon = lon;
219 | }
220 |
221 | /**
222 | * Standard deviation of altitude error, in meters.
223 | *
224 | * @return the alt
225 | */
226 | public double getAlt() {
227 | return this.alt;
228 | }
229 |
230 | /**
231 | * Standard deviation of altitude error, in meters.
232 | *
233 | * @param alt the alt to set
234 | */
235 | public void setAlt(final double alt) {
236 | this.alt = alt;
237 | }
238 |
239 | @Override
240 | public int hashCode() {
241 | final int prime = 31;
242 | int result = 1;
243 | long temp;
244 | temp = Double.doubleToLongBits(this.alt);
245 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
246 | result = (prime * result) + ((this.device == null) ? 0 : this.device.hashCode());
247 | temp = Double.doubleToLongBits(this.lat);
248 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
249 | temp = Double.doubleToLongBits(this.lon);
250 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
251 | temp = Double.doubleToLongBits(this.major);
252 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
253 | temp = Double.doubleToLongBits(this.minor);
254 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
255 | temp = Double.doubleToLongBits(this.orient);
256 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
257 | temp = Double.doubleToLongBits(this.rms);
258 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
259 | result = (prime * result) + ((this.tag == null) ? 0 : this.tag.hashCode());
260 | temp = Double.doubleToLongBits(this.timestamp);
261 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
262 | return result;
263 | }
264 |
265 | @Override
266 | public boolean equals(final Object obj) {
267 | if (this == obj) {
268 | return true;
269 | }
270 | if (obj == null) {
271 | return false;
272 | }
273 | if (this.getClass() != obj.getClass()) {
274 | return false;
275 | }
276 | final GSTObject other = (GSTObject) obj;
277 | if (Double.doubleToLongBits(this.alt) != Double.doubleToLongBits(other.alt)) {
278 | return false;
279 | }
280 | if (this.device == null) {
281 | if (other.device != null) {
282 | return false;
283 | }
284 | } else if (!this.device.equals(other.device)) {
285 | return false;
286 | }
287 | if (Double.doubleToLongBits(this.lat) != Double.doubleToLongBits(other.lat)) {
288 | return false;
289 | }
290 | if (Double.doubleToLongBits(this.lon) != Double.doubleToLongBits(other.lon)) {
291 | return false;
292 | }
293 | if (Double.doubleToLongBits(this.major) != Double.doubleToLongBits(other.major)) {
294 | return false;
295 | }
296 | if (Double.doubleToLongBits(this.minor) != Double.doubleToLongBits(other.minor)) {
297 | return false;
298 | }
299 | if (Double.doubleToLongBits(this.orient) != Double.doubleToLongBits(other.orient)) {
300 | return false;
301 | }
302 | if (Double.doubleToLongBits(this.rms) != Double.doubleToLongBits(other.rms)) {
303 | return false;
304 | }
305 | if (this.tag == null) {
306 | if (other.tag != null) {
307 | return false;
308 | }
309 | } else if (!this.tag.equals(other.tag)) {
310 | return false;
311 | }
312 | if (Double.doubleToLongBits(this.timestamp) != Double.doubleToLongBits(other.timestamp)) {
313 | return false;
314 | }
315 | return true;
316 | }
317 |
318 | @Override
319 | public String toString() {
320 | final StringBuilder sb = new StringBuilder();
321 | sb.append("GSTObject{tag=");
322 | sb.append(this.tag);
323 | sb.append(", device=");
324 | sb.append(this.device);
325 | sb.append(", timestamp=");
326 | sb.append(this.timestamp);
327 | sb.append(", rms=");
328 | sb.append(this.rms);
329 | sb.append(", major=");
330 | sb.append(this.major);
331 | sb.append(", minor=");
332 | sb.append(this.minor);
333 | sb.append(", orient=");
334 | sb.append(this.orient);
335 | sb.append(", lat=");
336 | sb.append(this.lat);
337 | sb.append(", lon=");
338 | sb.append(this.lon);
339 | sb.append(", alt=");
340 | sb.append(this.alt);
341 | sb.append("}");
342 | return sb.toString();
343 | }
344 | }
345 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/IGPSObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | /**
24 | * Interface for generic GPSd object
25 | *
26 | * @author thoeger
27 | */
28 | public interface IGPSObject {
29 |
30 | // this is only a marker interface
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/ParseException.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | /**
24 | * {@link Exception} indication an error while parsing the GPSd line
25 | *
26 | * @author thoeger
27 | */
28 | public class ParseException extends Exception {
29 |
30 | private static final long serialVersionUID = 7747422116792199432L;
31 |
32 | /** */
33 | public ParseException() {
34 | super();
35 | }
36 |
37 | /**
38 | * @param message the message
39 | */
40 | public ParseException(final String message) {
41 | super(message);
42 | }
43 |
44 | /**
45 | * @param message the message
46 | * @param cause the cause
47 | */
48 | public ParseException(final String message, final Throwable cause) {
49 | super(message, cause);
50 | }
51 |
52 | /**
53 | * @param cause the cause
54 | */
55 | public ParseException(final Throwable cause) {
56 | super(cause);
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/PollObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import java.util.List;
24 |
25 | /**
26 | * @author thoeger
27 | */
28 | public class PollObject implements IGPSObject {
29 |
30 | /** the GPSd internal name */
31 | public static final String NAME = "POLL";
32 |
33 | private double timestamp;
34 |
35 | private int active;
36 |
37 | private List
25 | *
26 | * all getters for double values may return Double.NaN
if value is not present
27 | * other getters may return null
28 | *
29 | * @author thoeger
30 | */
31 | public class TPVObject implements IGPSObject {
32 |
33 | /** the GPSd internal name */
34 | public static final String NAME = "TPV";
35 |
36 | private String tag = null;
37 |
38 | private String device = null;
39 |
40 | private double timestamp = Double.NaN;
41 |
42 | private double timestampError = Double.NaN;
43 |
44 | private double latitude = Double.NaN;
45 |
46 | private double longitude = Double.NaN;
47 |
48 | private double altitude = Double.NaN;
49 |
50 | private double latitudeError = Double.NaN;
51 |
52 | private double longitudeError = Double.NaN;
53 |
54 | private double altitudeError = Double.NaN;
55 |
56 | private double course = Double.NaN;
57 |
58 | private double speed = Double.NaN;
59 |
60 | private double climbRate = Double.NaN;
61 |
62 | private double courseError = Double.NaN;
63 |
64 | private double speedError = Double.NaN;
65 |
66 | private double climbRateError = Double.NaN;
67 |
68 | private ENMEAMode mode;
69 |
70 | /**
71 | * Type tag associated with this GPS sentence; from an NMEA device this is just the NMEA sentence
72 | * type.
73 | *
74 | * @return the tag
75 | */
76 | public String getTag() {
77 | return this.tag;
78 | }
79 |
80 | /**
81 | * Type tag associated with this GPS sentence; from an NMEA device this is just the NMEA sentence
82 | * type.
83 | *
84 | * @param tag the tag to set
85 | */
86 | public void setTag(final String tag) {
87 | this.tag = tag;
88 | }
89 |
90 | /**
91 | * Name of originating device
92 | *
93 | * @return the device
94 | */
95 | public String getDevice() {
96 | return this.device;
97 | }
98 |
99 | /**
100 | * Name of originating device
101 | *
102 | * @param device the device to set
103 | */
104 | public void setDevice(final String device) {
105 | this.device = device;
106 | }
107 |
108 | /**
109 | * Seconds since the Unix epoch, UTC. May have a fractional part of up to .01sec precision.
110 | *
111 | * @return the timestamp
112 | */
113 | public double getTimestamp() {
114 | return this.timestamp;
115 | }
116 |
117 | /**
118 | * Seconds since the Unix epoch, UTC. May have a fractional part of up to .01sec precision.
119 | *
120 | * @param timestamp the timestamp to set
121 | */
122 | public void setTimestamp(final double timestamp) {
123 | this.timestamp = timestamp;
124 | }
125 |
126 | /**
127 | * Estimated timestamp error (%f, seconds, 95% confidence).
128 | *
129 | * @return the timestampError
130 | */
131 | public double getTimestampError() {
132 | return this.timestampError;
133 | }
134 |
135 | /**
136 | * Estimated timestamp error (%f, seconds, 95% confidence).
137 | *
138 | * @param timestampError the timestampError to set
139 | */
140 | public void setTimestampError(final double timestampError) {
141 | this.timestampError = timestampError;
142 | }
143 |
144 | /**
145 | * Latitude in degrees: +/- signifies North/South
146 | *
147 | * @return the latitude
148 | */
149 | public double getLatitude() {
150 | return this.latitude;
151 | }
152 |
153 | /**
154 | * Latitude in degrees: +/- signifies North/South
155 | *
156 | * @param latitude the latitude to set
157 | */
158 | public void setLatitude(final double latitude) {
159 | this.latitude = latitude;
160 | }
161 |
162 | /**
163 | * Longitude in degrees: +/- signifies East/West
164 | *
165 | * @return the longitude
166 | */
167 | public double getLongitude() {
168 | return this.longitude;
169 | }
170 |
171 | /**
172 | * Longitude in degrees: +/- signifies East/West
173 | *
174 | * @param longitude the longitude to set
175 | */
176 | public void setLongitude(final double longitude) {
177 | this.longitude = longitude;
178 | }
179 |
180 | /**
181 | * Altitude in meters.
182 | *
183 | * @return the altitude
184 | */
185 | public double getAltitude() {
186 | return this.altitude;
187 | }
188 |
189 | /**
190 | * Altitude in meters.
191 | *
192 | * @param altitude the altitude to set
193 | */
194 | public void setAltitude(final double altitude) {
195 | this.altitude = altitude;
196 | }
197 |
198 | /**
199 | * Latitude error estimate in meters, 95% confidence.
200 | *
201 | * @return the latitudeError
202 | */
203 | public double getLatitudeError() {
204 | return this.latitudeError;
205 | }
206 |
207 | /**
208 | * Latitude error estimate in meters, 95% confidence.
209 | *
210 | * @param latitudeError the latitudeError to set
211 | */
212 | public void setLatitudeError(final double latitudeError) {
213 | this.latitudeError = latitudeError;
214 | }
215 |
216 | /**
217 | * Longitude error estimate in meters, 95% confidence.
218 | *
219 | * @return the longitudeError
220 | */
221 | public double getLongitudeError() {
222 | return this.longitudeError;
223 | }
224 |
225 | /**
226 | * Longitude error estimate in meters, 95% confidence.
227 | *
228 | * @param longitudeError the longitudeError to set
229 | */
230 | public void setLongitudeError(final double longitudeError) {
231 | this.longitudeError = longitudeError;
232 | }
233 |
234 | /**
235 | * Estimated vertical error in meters, 95% confidence.
236 | *
237 | * @return the altitudeError
238 | */
239 | public double getAltitudeError() {
240 | return this.altitudeError;
241 | }
242 |
243 | /**
244 | * Estimated vertical error in meters, 95% confidence.
245 | *
246 | * @param altitudeError the altitudeError to set
247 | */
248 | public void setAltitudeError(final double altitudeError) {
249 | this.altitudeError = altitudeError;
250 | }
251 |
252 | /**
253 | * Course over ground, degrees from true north.
254 | *
255 | * @return the course
256 | */
257 | public double getCourse() {
258 | return this.course;
259 | }
260 |
261 | /**
262 | * Course over ground, degrees from true north.
263 | *
264 | * @param course the course to set
265 | */
266 | public void setCourse(final double course) {
267 | this.course = course;
268 | }
269 |
270 | /**
271 | * Speed over ground, meters per second.
272 | *
273 | * @return the speed
274 | */
275 | public double getSpeed() {
276 | return this.speed;
277 | }
278 |
279 | /**
280 | * Speed over ground, meters per second.
281 | *
282 | * @param speed the speed to set
283 | */
284 | public void setSpeed(final double speed) {
285 | this.speed = speed;
286 | }
287 |
288 | /**
289 | * Climb (positive) or sink (negative) rate, meters per second.
290 | *
291 | * @return the climbRate
292 | */
293 | public double getClimbRate() {
294 | return this.climbRate;
295 | }
296 |
297 | /**
298 | * Climb (positive) or sink (negative) rate, meters per second.
299 | *
300 | * @param climbRate the climbRate to set
301 | */
302 | public void setClimbRate(final double climbRate) {
303 | this.climbRate = climbRate;
304 | }
305 |
306 | /**
307 | * Direction error estimate in degrees, 95% confidence.
308 | *
309 | * @return the courseError
310 | */
311 | public double getCourseError() {
312 | return this.courseError;
313 | }
314 |
315 | /**
316 | * Direction error estimate in degrees, 95% confidence.
317 | *
318 | * @param courseError the courseError to set
319 | */
320 | public void setCourseError(final double courseError) {
321 | this.courseError = courseError;
322 | }
323 |
324 | /**
325 | * Speed error estimate in meters/sec, 95% confidence.
326 | *
327 | * @return the speedError
328 | */
329 | public double getSpeedError() {
330 | return this.speedError;
331 | }
332 |
333 | /**
334 | * Speed error estimate in meters/sec, 95% confidence.
335 | *
336 | * @param speedError the speedError to set
337 | */
338 | public void setSpeedError(final double speedError) {
339 | this.speedError = speedError;
340 | }
341 |
342 | /**
343 | * Climb/sink error estimate in meters/sec, 95% confidence.
344 | *
345 | * @return the climbRateError
346 | */
347 | public double getClimbRateError() {
348 | return this.climbRateError;
349 | }
350 |
351 | /**
352 | * Climb/sink error estimate in meters/sec, 95% confidence.
353 | *
354 | * @param climbRateError the climbRateError to set
355 | */
356 | public void setClimbRateError(final double climbRateError) {
357 | this.climbRateError = climbRateError;
358 | }
359 |
360 | /**
361 | * NMEA mode
362 | *
363 | * @return the mode
364 | */
365 | public ENMEAMode getMode() {
366 | return this.mode;
367 | }
368 |
369 | /**
370 | * NMEA mode
371 | *
372 | * @param mode the mode to set
373 | */
374 | public void setMode(final ENMEAMode mode) {
375 | this.mode = mode;
376 | }
377 |
378 | @Override
379 | public int hashCode() {
380 | final int prime = 31;
381 | int result = 1;
382 | long temp;
383 | temp = Double.doubleToLongBits(this.altitude);
384 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
385 | temp = Double.doubleToLongBits(this.altitudeError);
386 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
387 | temp = Double.doubleToLongBits(this.climbRate);
388 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
389 | temp = Double.doubleToLongBits(this.climbRateError);
390 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
391 | temp = Double.doubleToLongBits(this.course);
392 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
393 | temp = Double.doubleToLongBits(this.courseError);
394 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
395 | result = (prime * result) + ((this.device == null) ? 0 : this.device.hashCode());
396 | temp = Double.doubleToLongBits(this.latitude);
397 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
398 | temp = Double.doubleToLongBits(this.latitudeError);
399 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
400 | temp = Double.doubleToLongBits(this.longitude);
401 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
402 | temp = Double.doubleToLongBits(this.longitudeError);
403 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
404 | result = (prime * result) + ((this.mode == null) ? 0 : this.mode.hashCode());
405 | temp = Double.doubleToLongBits(this.speed);
406 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
407 | temp = Double.doubleToLongBits(this.speedError);
408 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
409 | result = (prime * result) + ((this.tag == null) ? 0 : this.tag.hashCode());
410 | temp = Double.doubleToLongBits(this.timestamp);
411 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
412 | temp = Double.doubleToLongBits(this.timestampError);
413 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
414 | return result;
415 | }
416 |
417 | @Override
418 | public boolean equals(final Object obj) {
419 | if (this == obj) {
420 | return true;
421 | }
422 | if (obj == null) {
423 | return false;
424 | }
425 | if (this.getClass() != obj.getClass()) {
426 | return false;
427 | }
428 | final TPVObject other = (TPVObject) obj;
429 | if (Double.doubleToLongBits(this.altitude) != Double.doubleToLongBits(other.altitude)) {
430 | return false;
431 | }
432 | if (Double.doubleToLongBits(this.altitudeError)
433 | != Double.doubleToLongBits(other.altitudeError)) {
434 | return false;
435 | }
436 | if (Double.doubleToLongBits(this.climbRate) != Double.doubleToLongBits(other.climbRate)) {
437 | return false;
438 | }
439 | if (Double.doubleToLongBits(this.climbRateError)
440 | != Double.doubleToLongBits(other.climbRateError)) {
441 | return false;
442 | }
443 | if (Double.doubleToLongBits(this.course) != Double.doubleToLongBits(other.course)) {
444 | return false;
445 | }
446 | if (Double.doubleToLongBits(this.courseError) != Double.doubleToLongBits(other.courseError)) {
447 | return false;
448 | }
449 | if (this.device == null) {
450 | if (other.device != null) {
451 | return false;
452 | }
453 | } else if (!this.device.equals(other.device)) {
454 | return false;
455 | }
456 | if (Double.doubleToLongBits(this.latitude) != Double.doubleToLongBits(other.latitude)) {
457 | return false;
458 | }
459 | if (Double.doubleToLongBits(this.latitudeError)
460 | != Double.doubleToLongBits(other.latitudeError)) {
461 | return false;
462 | }
463 | if (Double.doubleToLongBits(this.longitude) != Double.doubleToLongBits(other.longitude)) {
464 | return false;
465 | }
466 | if (Double.doubleToLongBits(this.longitudeError)
467 | != Double.doubleToLongBits(other.longitudeError)) {
468 | return false;
469 | }
470 | if (this.mode != other.mode) {
471 | return false;
472 | }
473 | if (Double.doubleToLongBits(this.speed) != Double.doubleToLongBits(other.speed)) {
474 | return false;
475 | }
476 | if (Double.doubleToLongBits(this.speedError) != Double.doubleToLongBits(other.speedError)) {
477 | return false;
478 | }
479 | if (this.tag == null) {
480 | if (other.tag != null) {
481 | return false;
482 | }
483 | } else if (!this.tag.equals(other.tag)) {
484 | return false;
485 | }
486 | if (Double.doubleToLongBits(this.timestamp) != Double.doubleToLongBits(other.timestamp)) {
487 | return false;
488 | }
489 | if (Double.doubleToLongBits(this.timestampError)
490 | != Double.doubleToLongBits(other.timestampError)) {
491 | return false;
492 | }
493 | return true;
494 | }
495 |
496 | @Override
497 | public String toString() {
498 | final StringBuilder sb = new StringBuilder();
499 | sb.append("TPVObject{tag=");
500 | sb.append(this.tag);
501 | sb.append(", device=");
502 | sb.append(this.device);
503 | sb.append(", timestamp=");
504 | sb.append(this.timestamp);
505 | sb.append(", timestampError=");
506 | sb.append(this.timestampError);
507 | sb.append(", latitude=");
508 | sb.append(this.latitude);
509 | sb.append(", longitude=");
510 | sb.append(this.longitude);
511 | sb.append(", altitude=");
512 | sb.append(this.altitude);
513 | sb.append(", latitudeError=");
514 | sb.append(this.latitudeError);
515 | sb.append(", longitudeError=");
516 | sb.append(this.longitudeError);
517 | sb.append(", altitudeError=");
518 | sb.append(this.altitudeError);
519 | sb.append(", course=");
520 | sb.append(this.course);
521 | sb.append(", speed=");
522 | sb.append(this.speed);
523 | sb.append(", climbRate=");
524 | sb.append(this.climbRate);
525 | sb.append(", courseError=");
526 | sb.append(this.courseError);
527 | sb.append(", speedError=");
528 | sb.append(this.speedError);
529 | sb.append(", climbRateError=");
530 | sb.append(this.climbRateError);
531 | if (mode != null) {
532 | sb.append(", mode=");
533 | sb.append(this.mode.name());
534 | }
535 | sb.append("}");
536 | return sb.toString();
537 | }
538 | }
539 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/ToffObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types;
2 |
3 | /**
4 | * This message is emitted on each cycle and reports the offset between the host's clock time and
5 | * the GPS time at top of second (actually, when the first data for the reporting cycle is
6 | * received). This message exactly mirrors the PPS message except for two details. TOFF emits no NTP
7 | * precision, this is assumed to be -2. See the NTP documentation for their definition of precision.
8 | * The TOFF message reports the GPS time as derived from the GPS serial data stream. The PPS message
9 | * reports the GPS time as derived from the GPS PPS pulse.
10 | *
11 | * @author dpishchukhin
12 | */
13 | public class ToffObject implements IGPSObject {
14 | /** the TOFF internal name */
15 | public static final String NAME = "TOFF";
16 |
17 | private String device = null;
18 |
19 | private double realSec = Double.NaN;
20 |
21 | private double realNsec = Double.NaN;
22 |
23 | private double clockSec = Double.NaN;
24 |
25 | private double clockNsec = Double.NaN;
26 |
27 | /**
28 | * Name of originating device
29 | *
30 | * @return device
31 | */
32 | public String getDevice() {
33 | return device;
34 | }
35 |
36 | /**
37 | * Name of originating device
38 | *
39 | * @param device device
40 | */
41 | public void setDevice(String device) {
42 | this.device = device;
43 | }
44 |
45 | /**
46 | * seconds from the GPS clock
47 | *
48 | * @return seconds
49 | */
50 | public double getRealSec() {
51 | return realSec;
52 | }
53 |
54 | /**
55 | * seconds from the GPS clock
56 | *
57 | * @param realSec seconds
58 | */
59 | public void setRealSec(double realSec) {
60 | this.realSec = realSec;
61 | }
62 |
63 | /**
64 | * nanoseconds from the GPS clock
65 | *
66 | * @return nanoseconds
67 | */
68 | public double getRealNsec() {
69 | return realNsec;
70 | }
71 |
72 | /**
73 | * nanoseconds from the GPS clock
74 | *
75 | * @param realNsec nanoseconds
76 | */
77 | public void setRealNsec(double realNsec) {
78 | this.realNsec = realNsec;
79 | }
80 |
81 | /**
82 | * seconds from the system clock
83 | *
84 | * @return seconds
85 | */
86 | public double getClockSec() {
87 | return clockSec;
88 | }
89 |
90 | /**
91 | * seconds from the system clock
92 | *
93 | * @param clockSec seconds
94 | */
95 | public void setClockSec(double clockSec) {
96 | this.clockSec = clockSec;
97 | }
98 |
99 | /**
100 | * nanoseconds from the system clock
101 | *
102 | * @return nanoseconds
103 | */
104 | public double getClockNsec() {
105 | return clockNsec;
106 | }
107 |
108 | /**
109 | * nanoseconds from the system clock
110 | *
111 | * @param clockNsec nanoseconds
112 | */
113 | public void setClockNsec(double clockNsec) {
114 | this.clockNsec = clockNsec;
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/VersionObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | /**
24 | * @author thoeger
25 | */
26 | public class VersionObject implements IGPSObject {
27 |
28 | /** the GPSd internal name */
29 | public static final String NAME = "VERSION";
30 |
31 | private String release;
32 |
33 | private String rev;
34 |
35 | private double protocolMajor;
36 |
37 | private double protocolMinor;
38 |
39 | /**
40 | * @return the release
41 | */
42 | public String getRelease() {
43 | return this.release;
44 | }
45 |
46 | /**
47 | * @param release the release to set
48 | */
49 | public void setRelease(final String release) {
50 | this.release = release;
51 | }
52 |
53 | /**
54 | * @return the rev
55 | */
56 | public String getRev() {
57 | return this.rev;
58 | }
59 |
60 | /**
61 | * @param rev the rev to set
62 | */
63 | public void setRev(final String rev) {
64 | this.rev = rev;
65 | }
66 |
67 | /**
68 | * @return the protocolMajor
69 | */
70 | public double getProtocolMajor() {
71 | return this.protocolMajor;
72 | }
73 |
74 | /**
75 | * @param protocolMajor the protocolMajor to set
76 | */
77 | public void setProtocolMajor(final double protocolMajor) {
78 | this.protocolMajor = protocolMajor;
79 | }
80 |
81 | /**
82 | * @return the protocolMinor
83 | */
84 | public double getProtocolMinor() {
85 | return this.protocolMinor;
86 | }
87 |
88 | /**
89 | * @param protocolMinor the protocolMinor to set
90 | */
91 | public void setProtocolMinor(final double protocolMinor) {
92 | this.protocolMinor = protocolMinor;
93 | }
94 |
95 | @Override
96 | public int hashCode() {
97 | final int prime = 31;
98 | int result = 1;
99 | long temp;
100 | temp = Double.doubleToLongBits(this.protocolMajor);
101 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
102 | temp = Double.doubleToLongBits(this.protocolMinor);
103 | result = (prime * result) + (int) (temp ^ (temp >>> 32));
104 | result = (prime * result) + ((this.release == null) ? 0 : this.release.hashCode());
105 | result = (prime * result) + ((this.rev == null) ? 0 : this.rev.hashCode());
106 | return result;
107 | }
108 |
109 | @Override
110 | public boolean equals(final Object obj) {
111 | if (this == obj) {
112 | return true;
113 | }
114 | if (obj == null) {
115 | return false;
116 | }
117 | if (this.getClass() != obj.getClass()) {
118 | return false;
119 | }
120 | final VersionObject other = (VersionObject) obj;
121 | if (Double.doubleToLongBits(this.protocolMajor)
122 | != Double.doubleToLongBits(other.protocolMajor)) {
123 | return false;
124 | }
125 | if (Double.doubleToLongBits(this.protocolMinor)
126 | != Double.doubleToLongBits(other.protocolMinor)) {
127 | return false;
128 | }
129 | if (this.release == null) {
130 | if (other.release != null) {
131 | return false;
132 | }
133 | } else if (!this.release.equals(other.release)) {
134 | return false;
135 | }
136 | if (this.rev == null) {
137 | if (other.rev != null) {
138 | return false;
139 | }
140 | } else if (!this.rev.equals(other.rev)) {
141 | return false;
142 | }
143 | return true;
144 | }
145 |
146 | @Override
147 | public String toString() {
148 | final StringBuilder sb = new StringBuilder();
149 |
150 | sb.append("VersionObject{release=");
151 | sb.append(this.release);
152 | sb.append(", rev=");
153 | sb.append(this.rev);
154 | sb.append(", protocolMajor=");
155 | sb.append(this.protocolMajor);
156 | sb.append(", protocolMinor=");
157 | sb.append(this.protocolMinor);
158 | sb.append("}");
159 | return sb.toString();
160 | }
161 | }
162 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/WatchObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | /**
24 | * @author thoeger
25 | */
26 | public class WatchObject implements IGPSObject {
27 |
28 | /** the GPSd internal name */
29 | public static final String NAME = "WATCH";
30 |
31 | private boolean enable = true;
32 |
33 | private boolean dump = false;
34 |
35 | /**
36 | * Enable (true) or disable (false) watcher mode. Default is true.
37 | *
38 | * @return the enable
39 | */
40 | public boolean isEnable() {
41 | return this.enable;
42 | }
43 |
44 | /**
45 | * Enable (true) or disable (false) watcher mode. Default is true.
46 | *
47 | * @param enable the enable to set
48 | */
49 | public void setEnable(final boolean enable) {
50 | this.enable = enable;
51 | }
52 |
53 | /**
54 | * Enable (true) or disable (false) dumping of JSON reports. Default is false.
55 | *
56 | * @return the json
57 | */
58 | public boolean isDump() {
59 | return this.dump;
60 | }
61 |
62 | /**
63 | * Enable (true) or disable (false) dumping of JSON reports. Default is false.
64 | *
65 | * @param dump the dump to set
66 | */
67 | public void setDump(final boolean dump) {
68 | this.dump = dump;
69 | }
70 |
71 | @Override
72 | public int hashCode() {
73 | final int prime = 31;
74 | int result = 1;
75 | result = (prime * result) + (this.dump ? 1231 : 1237);
76 | result = (prime * result) + (this.enable ? 1231 : 1237);
77 | return result;
78 | }
79 |
80 | @Override
81 | public boolean equals(final Object obj) {
82 | if (this == obj) {
83 | return true;
84 | }
85 | if (obj == null) {
86 | return false;
87 | }
88 | if (this.getClass() != obj.getClass()) {
89 | return false;
90 | }
91 | final WatchObject other = (WatchObject) obj;
92 | if (this.dump != other.dump) {
93 | return false;
94 | }
95 | if (this.enable != other.enable) {
96 | return false;
97 | }
98 | return true;
99 | }
100 |
101 | @Override
102 | public String toString() {
103 | return "WatchObject{enable=" + this.enable + ", dump=" + this.dump + "}";
104 | }
105 | }
106 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/subframes/ALMANACObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types.subframes;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 |
25 | /**
26 | * @author aevdokimov
27 | */
28 | public class ALMANACObject implements IGPSObject {
29 |
30 | /** the GPSd internal name */
31 | public static final String NAME = "ALMANAC";
32 |
33 | private int ID = -1;
34 |
35 | private int Health = -1;
36 |
37 | private double e = Double.NaN;
38 |
39 | private int toa = -1;
40 |
41 | private double deltai = Double.NaN;
42 |
43 | private double Omegad = Double.NaN;
44 |
45 | private double sqrtA = Double.NaN;
46 |
47 | private double Omega0 = Double.NaN;
48 |
49 | private double omega = Double.NaN;
50 |
51 | private double M0 = Double.NaN;
52 |
53 | private double af0 = Double.NaN;
54 |
55 | private double af1 = Double.NaN;
56 |
57 | /**
58 | * @return the iD
59 | */
60 | public int getID() {
61 | return this.ID;
62 | }
63 |
64 | /**
65 | * @param iD the iD to set
66 | */
67 | public void setID(final int iD) {
68 | this.ID = iD;
69 | }
70 |
71 | /**
72 | * @return the health
73 | */
74 | public int getHealth() {
75 | return this.Health;
76 | }
77 |
78 | /**
79 | * @param health the health to set
80 | */
81 | public void setHealth(final int health) {
82 | this.Health = health;
83 | }
84 |
85 | /**
86 | * @return the e
87 | */
88 | public double getE() {
89 | return this.e;
90 | }
91 |
92 | /**
93 | * @param e the e to set
94 | */
95 | public void setE(final double e) {
96 | this.e = e;
97 | }
98 |
99 | /**
100 | * @return the toa
101 | */
102 | public int getToa() {
103 | return this.toa;
104 | }
105 |
106 | /**
107 | * @param toa the toa to set
108 | */
109 | public void setToa(final int toa) {
110 | this.toa = toa;
111 | }
112 |
113 | /**
114 | * @return the deltai
115 | */
116 | public double getDeltai() {
117 | return this.deltai;
118 | }
119 |
120 | /**
121 | * @param deltai the deltai to set
122 | */
123 | public void setDeltai(final double deltai) {
124 | this.deltai = deltai;
125 | }
126 |
127 | /**
128 | * @return the omegad
129 | */
130 | public double getOmegad() {
131 | return this.Omegad;
132 | }
133 |
134 | /**
135 | * @param omegad the omegad to set
136 | */
137 | public void setOmegad(final double omegad) {
138 | this.Omegad = omegad;
139 | }
140 |
141 | /**
142 | * @return the sqrtA
143 | */
144 | public double getSqrtA() {
145 | return this.sqrtA;
146 | }
147 |
148 | /**
149 | * @param sqrtA the sqrtA to set
150 | */
151 | public void setSqrtA(final double sqrtA) {
152 | this.sqrtA = sqrtA;
153 | }
154 |
155 | /**
156 | * @return the omega0
157 | */
158 | public double getOmega0() {
159 | return this.Omega0;
160 | }
161 |
162 | /**
163 | * @param omega0 the omega0 to set
164 | */
165 | public void setOmega0(final double omega0) {
166 | this.Omega0 = omega0;
167 | }
168 |
169 | /**
170 | * @return the omega
171 | */
172 | public double getOmega() {
173 | return this.omega;
174 | }
175 |
176 | /**
177 | * @param omega the omega to set
178 | */
179 | public void setOmega(final double omega) {
180 | this.omega = omega;
181 | }
182 |
183 | /**
184 | * @return the m0
185 | */
186 | public double getM0() {
187 | return this.M0;
188 | }
189 |
190 | /**
191 | * @param m0 the m0 to set
192 | */
193 | public void setM0(final double m0) {
194 | this.M0 = m0;
195 | }
196 |
197 | /**
198 | * @return the af0
199 | */
200 | public double getAf0() {
201 | return this.af0;
202 | }
203 |
204 | /**
205 | * @param af0 the af0 to set
206 | */
207 | public void setAf0(final double af0) {
208 | this.af0 = af0;
209 | }
210 |
211 | /**
212 | * @return the af1
213 | */
214 | public double getAf1() {
215 | return this.af1;
216 | }
217 |
218 | /**
219 | * @param af1 the af1 to set
220 | */
221 | public void setAf1(final double af1) {
222 | this.af1 = af1;
223 | }
224 |
225 | @Override
226 | public boolean equals(final Object o) {
227 | if (this == o) {
228 | return true;
229 | }
230 | if (!(o instanceof ALMANACObject)) {
231 | return false;
232 | }
233 |
234 | final ALMANACObject that = (ALMANACObject) o;
235 |
236 | if (this.Health != that.Health) {
237 | return false;
238 | }
239 | if (this.ID != that.ID) {
240 | return false;
241 | }
242 | if (Double.compare(that.M0, this.M0) != 0) {
243 | return false;
244 | }
245 | if (Double.compare(that.Omega0, this.Omega0) != 0) {
246 | return false;
247 | }
248 | if (Double.compare(that.Omegad, this.Omegad) != 0) {
249 | return false;
250 | }
251 | if (Double.compare(that.af0, this.af0) != 0) {
252 | return false;
253 | }
254 | if (Double.compare(that.af1, this.af1) != 0) {
255 | return false;
256 | }
257 | if (Double.compare(that.deltai, this.deltai) != 0) {
258 | return false;
259 | }
260 | if (Double.compare(that.e, this.e) != 0) {
261 | return false;
262 | }
263 | if (Double.compare(that.omega, this.omega) != 0) {
264 | return false;
265 | }
266 | if (Double.compare(that.sqrtA, this.sqrtA) != 0) {
267 | return false;
268 | }
269 | if (this.toa != that.toa) {
270 | return false;
271 | }
272 |
273 | return true;
274 | }
275 |
276 | @Override
277 | public int hashCode() {
278 | int result;
279 | long temp;
280 | result = this.ID;
281 | result = (31 * result) + this.Health;
282 | temp = this.e != +0.0d ? Double.doubleToLongBits(this.e) : 0L;
283 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
284 | result = (31 * result) + this.toa;
285 | temp = this.deltai != +0.0d ? Double.doubleToLongBits(this.deltai) : 0L;
286 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
287 | temp = this.Omegad != +0.0d ? Double.doubleToLongBits(this.Omegad) : 0L;
288 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
289 | temp = this.sqrtA != +0.0d ? Double.doubleToLongBits(this.sqrtA) : 0L;
290 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
291 | temp = this.Omega0 != +0.0d ? Double.doubleToLongBits(this.Omega0) : 0L;
292 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
293 | temp = this.omega != +0.0d ? Double.doubleToLongBits(this.omega) : 0L;
294 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
295 | temp = this.M0 != +0.0d ? Double.doubleToLongBits(this.M0) : 0L;
296 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
297 | temp = this.af0 != +0.0d ? Double.doubleToLongBits(this.af0) : 0L;
298 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
299 | temp = this.af1 != +0.0d ? Double.doubleToLongBits(this.af1) : 0L;
300 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
301 | return result;
302 | }
303 |
304 | @Override
305 | public String toString() {
306 | final StringBuilder sb = new StringBuilder();
307 | sb.append("ALMANACObject{ID=");
308 | sb.append(this.ID);
309 | sb.append(", Health=");
310 | sb.append(this.Health);
311 | sb.append(", e=");
312 | sb.append(this.e);
313 | sb.append(", toa=");
314 | sb.append(this.toa);
315 | sb.append(", deltai=");
316 | sb.append(this.deltai);
317 | sb.append(", Omegad=");
318 | sb.append(this.Omegad);
319 | sb.append(", sqrtA=");
320 | sb.append(this.sqrtA);
321 | sb.append(", Omega0=");
322 | sb.append(this.Omega0);
323 | sb.append(", omega=");
324 | sb.append(this.omega);
325 | sb.append(", M0=");
326 | sb.append(this.M0);
327 | sb.append(", af0=");
328 | sb.append(this.af0);
329 | sb.append(", af1=");
330 | sb.append(this.af1);
331 | sb.append("}");
332 | return sb.toString();
333 | }
334 | }
335 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/subframes/EPHEM1Object.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types.subframes;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 |
25 | /**
26 | * @author aevdokimov
27 | */
28 | public class EPHEM1Object implements IGPSObject {
29 |
30 | /** the GPSd internal name */
31 | public static final String NAME = "EPHEM1";
32 |
33 | private int WN = -1;
34 |
35 | private int IODC = -1;
36 |
37 | private int L2 = -1;
38 |
39 | private double ura = Double.NaN;
40 |
41 | private double hlth = Double.NaN;
42 |
43 | private int L2P = -1;
44 |
45 | private double Tgd = Double.NaN;
46 |
47 | private int toc = -1;
48 |
49 | private double af2 = Double.NaN;
50 |
51 | private double af1 = Double.NaN;
52 |
53 | private double af0 = Double.NaN;
54 |
55 | /**
56 | * @return the wN
57 | */
58 | public int getWN() {
59 | return this.WN;
60 | }
61 |
62 | /**
63 | * @param wN the wN to set
64 | */
65 | public void setWN(final int wN) {
66 | this.WN = wN;
67 | }
68 |
69 | /**
70 | * @return the iODC
71 | */
72 | public int getIODC() {
73 | return this.IODC;
74 | }
75 |
76 | /**
77 | * @param iODC the iODC to set
78 | */
79 | public void setIODC(final int iODC) {
80 | this.IODC = iODC;
81 | }
82 |
83 | /**
84 | * @return the l2
85 | */
86 | public int getL2() {
87 | return this.L2;
88 | }
89 |
90 | /**
91 | * @param l2 the l2 to set
92 | */
93 | public void setL2(final int l2) {
94 | this.L2 = l2;
95 | }
96 |
97 | /**
98 | * @return the ura
99 | */
100 | public double getUra() {
101 | return this.ura;
102 | }
103 |
104 | /**
105 | * @param ura the ura to set
106 | */
107 | public void setUra(final double ura) {
108 | this.ura = ura;
109 | }
110 |
111 | /**
112 | * @return the hlth
113 | */
114 | public double getHlth() {
115 | return this.hlth;
116 | }
117 |
118 | /**
119 | * @param hlth the hlth to set
120 | */
121 | public void setHlth(final double hlth) {
122 | this.hlth = hlth;
123 | }
124 |
125 | /**
126 | * @return the l2P
127 | */
128 | public int getL2P() {
129 | return this.L2P;
130 | }
131 |
132 | /**
133 | * @param l2p the l2P to set
134 | */
135 | public void setL2P(final int l2p) {
136 | this.L2P = l2p;
137 | }
138 |
139 | /**
140 | * @return the tgd
141 | */
142 | public double getTgd() {
143 | return this.Tgd;
144 | }
145 |
146 | /**
147 | * @param tgd the tgd to set
148 | */
149 | public void setTgd(final double tgd) {
150 | this.Tgd = tgd;
151 | }
152 |
153 | /**
154 | * @return the toc
155 | */
156 | public int getToc() {
157 | return this.toc;
158 | }
159 |
160 | /**
161 | * @param toc the toc to set
162 | */
163 | public void setToc(final int toc) {
164 | this.toc = toc;
165 | }
166 |
167 | /**
168 | * @return the af2
169 | */
170 | public double getAf2() {
171 | return this.af2;
172 | }
173 |
174 | /**
175 | * @param af2 the af2 to set
176 | */
177 | public void setAf2(final double af2) {
178 | this.af2 = af2;
179 | }
180 |
181 | /**
182 | * @return the af1
183 | */
184 | public double getAf1() {
185 | return this.af1;
186 | }
187 |
188 | /**
189 | * @param af1 the af1 to set
190 | */
191 | public void setAf1(final double af1) {
192 | this.af1 = af1;
193 | }
194 |
195 | /**
196 | * @return the af0
197 | */
198 | public double getAf0() {
199 | return this.af0;
200 | }
201 |
202 | /**
203 | * @param af0 the af0 to set
204 | */
205 | public void setAf0(final double af0) {
206 | this.af0 = af0;
207 | }
208 |
209 | @Override
210 | public boolean equals(final Object o) {
211 | if (this == o) {
212 | return true;
213 | }
214 | if ((o == null) || (this.getClass() != o.getClass())) {
215 | return false;
216 | }
217 |
218 | final EPHEM1Object that = (EPHEM1Object) o;
219 |
220 | if (this.IODC != that.IODC) {
221 | return false;
222 | }
223 | if (this.L2 != that.L2) {
224 | return false;
225 | }
226 | if (this.L2P != that.L2P) {
227 | return false;
228 | }
229 | if (Double.compare(that.Tgd, this.Tgd) != 0) {
230 | return false;
231 | }
232 | if (this.WN != that.WN) {
233 | return false;
234 | }
235 | if (Double.compare(that.af0, this.af0) != 0) {
236 | return false;
237 | }
238 | if (Double.compare(that.af1, this.af1) != 0) {
239 | return false;
240 | }
241 | if (Double.compare(that.af2, this.af2) != 0) {
242 | return false;
243 | }
244 | if (Double.compare(that.hlth, this.hlth) != 0) {
245 | return false;
246 | }
247 | if (this.toc != that.toc) {
248 | return false;
249 | }
250 | if (Double.compare(that.ura, this.ura) != 0) {
251 | return false;
252 | }
253 |
254 | return true;
255 | }
256 |
257 | @Override
258 | public int hashCode() {
259 | int result;
260 | long temp;
261 | result = this.WN;
262 | result = (31 * result) + this.IODC;
263 | result = (31 * result) + this.L2;
264 | temp = this.ura != +0.0d ? Double.doubleToLongBits(this.ura) : 0L;
265 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
266 | temp = this.hlth != +0.0d ? Double.doubleToLongBits(this.hlth) : 0L;
267 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
268 | result = (31 * result) + this.L2P;
269 | temp = this.Tgd != +0.0d ? Double.doubleToLongBits(this.Tgd) : 0L;
270 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
271 | result = (31 * result) + this.toc;
272 | temp = this.af2 != +0.0d ? Double.doubleToLongBits(this.af2) : 0L;
273 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
274 | temp = this.af1 != +0.0d ? Double.doubleToLongBits(this.af1) : 0L;
275 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
276 | temp = this.af0 != +0.0d ? Double.doubleToLongBits(this.af0) : 0L;
277 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
278 | return result;
279 | }
280 |
281 | @Override
282 | public String toString() {
283 | final StringBuilder sb = new StringBuilder();
284 | sb.append("EPHEM1Object{WN=");
285 | sb.append(this.WN);
286 | sb.append(", IODC=");
287 | sb.append(this.IODC);
288 | sb.append(", ura=");
289 | sb.append(this.ura);
290 | sb.append(", L2=");
291 | sb.append(this.L2);
292 | sb.append(", hlth=");
293 | sb.append(this.hlth);
294 | sb.append(", L2P=");
295 | sb.append(this.L2P);
296 | sb.append(", Tgd=");
297 | sb.append(this.Tgd);
298 | sb.append(", toc=");
299 | sb.append(this.toc);
300 | sb.append(", af2=");
301 | sb.append(this.af2);
302 | sb.append(", af0=");
303 | sb.append(this.af0);
304 | sb.append(", af1=");
305 | sb.append(this.af1);
306 | sb.append("}");
307 | return sb.toString();
308 | }
309 | }
310 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/subframes/EPHEM2Object.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types.subframes;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 |
25 | /**
26 | * @author aevdokimov
27 | */
28 | public class EPHEM2Object implements IGPSObject {
29 |
30 | /** the GPSd internal name */
31 | public static final String NAME = "EPHEM2";
32 |
33 | private int IODE = -1;
34 |
35 | private double Crs = Double.NaN;
36 |
37 | private double deltan = Double.NaN;
38 |
39 | private double M0 = Double.NaN;
40 |
41 | private double Cuc = Double.NaN;
42 |
43 | private double e = Double.NaN;
44 |
45 | private double Cus = Double.NaN;
46 |
47 | private double sqrtA = Double.NaN;
48 |
49 | private int toe = -1;
50 |
51 | private int FIT = -1;
52 |
53 | private int AODO = -1;
54 |
55 | /**
56 | * @return the iODE
57 | */
58 | public int getIODE() {
59 | return this.IODE;
60 | }
61 |
62 | /**
63 | * @param iODE the iODE to set
64 | */
65 | public void setIODE(final int iODE) {
66 | this.IODE = iODE;
67 | }
68 |
69 | /**
70 | * @return the crs
71 | */
72 | public double getCrs() {
73 | return this.Crs;
74 | }
75 |
76 | /**
77 | * @param crs the crs to set
78 | */
79 | public void setCrs(final double crs) {
80 | this.Crs = crs;
81 | }
82 |
83 | /**
84 | * @return the deltan
85 | */
86 | public double getDeltan() {
87 | return this.deltan;
88 | }
89 |
90 | /**
91 | * @param deltan the deltan to set
92 | */
93 | public void setDeltan(final double deltan) {
94 | this.deltan = deltan;
95 | }
96 |
97 | /**
98 | * @return the m0
99 | */
100 | public double getM0() {
101 | return this.M0;
102 | }
103 |
104 | /**
105 | * @param m0 the m0 to set
106 | */
107 | public void setM0(final double m0) {
108 | this.M0 = m0;
109 | }
110 |
111 | /**
112 | * @return the cuc
113 | */
114 | public double getCuc() {
115 | return this.Cuc;
116 | }
117 |
118 | /**
119 | * @param cuc the cuc to set
120 | */
121 | public void setCuc(final double cuc) {
122 | this.Cuc = cuc;
123 | }
124 |
125 | /**
126 | * @return the e
127 | */
128 | public double getE() {
129 | return this.e;
130 | }
131 |
132 | /**
133 | * @param e the e to set
134 | */
135 | public void setE(final double e) {
136 | this.e = e;
137 | }
138 |
139 | /**
140 | * @return the cus
141 | */
142 | public double getCus() {
143 | return this.Cus;
144 | }
145 |
146 | /**
147 | * @param cus the cus to set
148 | */
149 | public void setCus(final double cus) {
150 | this.Cus = cus;
151 | }
152 |
153 | /**
154 | * @return the sqrtA
155 | */
156 | public double getSqrtA() {
157 | return this.sqrtA;
158 | }
159 |
160 | /**
161 | * @param sqrtA the sqrtA to set
162 | */
163 | public void setSqrtA(final double sqrtA) {
164 | this.sqrtA = sqrtA;
165 | }
166 |
167 | /**
168 | * @return the toe
169 | */
170 | public int getToe() {
171 | return this.toe;
172 | }
173 |
174 | /**
175 | * @param toe the toe to set
176 | */
177 | public void setToe(final int toe) {
178 | this.toe = toe;
179 | }
180 |
181 | /**
182 | * @return the fIT
183 | */
184 | public int getFIT() {
185 | return this.FIT;
186 | }
187 |
188 | /**
189 | * @param fIT the fIT to set
190 | */
191 | public void setFIT(final int fIT) {
192 | this.FIT = fIT;
193 | }
194 |
195 | /**
196 | * @return the aODO
197 | */
198 | public int getAODO() {
199 | return this.AODO;
200 | }
201 |
202 | /**
203 | * @param aODO the aODO to set
204 | */
205 | public void setAODO(final int aODO) {
206 | this.AODO = aODO;
207 | }
208 |
209 | @Override
210 | public boolean equals(final Object o) {
211 | if (this == o) {
212 | return true;
213 | }
214 | if ((o == null) || (this.getClass() != o.getClass())) {
215 | return false;
216 | }
217 |
218 | final EPHEM2Object that = (EPHEM2Object) o;
219 |
220 | if (this.AODO != that.AODO) {
221 | return false;
222 | }
223 | if (Double.compare(that.Crs, this.Crs) != 0) {
224 | return false;
225 | }
226 | if (Double.compare(that.Cuc, this.Cuc) != 0) {
227 | return false;
228 | }
229 | if (Double.compare(that.Cus, this.Cus) != 0) {
230 | return false;
231 | }
232 | if (this.FIT != that.FIT) {
233 | return false;
234 | }
235 | if (this.IODE != that.IODE) {
236 | return false;
237 | }
238 | if (Double.compare(that.M0, this.M0) != 0) {
239 | return false;
240 | }
241 | if (Double.compare(that.deltan, this.deltan) != 0) {
242 | return false;
243 | }
244 | if (Double.compare(that.e, this.e) != 0) {
245 | return false;
246 | }
247 | if (Double.compare(that.sqrtA, this.sqrtA) != 0) {
248 | return false;
249 | }
250 | if (this.toe != that.toe) {
251 | return false;
252 | }
253 |
254 | return true;
255 | }
256 |
257 | @Override
258 | public int hashCode() {
259 | int result;
260 | long temp;
261 | result = this.IODE;
262 | temp = this.Crs != +0.0d ? Double.doubleToLongBits(this.Crs) : 0L;
263 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
264 | temp = this.deltan != +0.0d ? Double.doubleToLongBits(this.deltan) : 0L;
265 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
266 | temp = this.M0 != +0.0d ? Double.doubleToLongBits(this.M0) : 0L;
267 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
268 | temp = this.Cuc != +0.0d ? Double.doubleToLongBits(this.Cuc) : 0L;
269 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
270 | temp = this.e != +0.0d ? Double.doubleToLongBits(this.e) : 0L;
271 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
272 | temp = this.Cus != +0.0d ? Double.doubleToLongBits(this.Cus) : 0L;
273 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
274 | temp = this.sqrtA != +0.0d ? Double.doubleToLongBits(this.sqrtA) : 0L;
275 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
276 | result = (31 * result) + this.toe;
277 | result = (31 * result) + this.FIT;
278 | result = (31 * result) + this.AODO;
279 | return result;
280 | }
281 |
282 | @Override
283 | public String toString() {
284 | final StringBuilder sb = new StringBuilder();
285 | sb.append("EPHEM2Object{IODE=");
286 | sb.append(this.IODE);
287 | sb.append(", Crs=");
288 | sb.append(this.Crs);
289 | sb.append(", deltan=");
290 | sb.append(this.deltan);
291 | sb.append(", M0=");
292 | sb.append(this.M0);
293 | sb.append(", Cuc=");
294 | sb.append(this.Cuc);
295 | sb.append(", e=");
296 | sb.append(this.e);
297 | sb.append(", Cus=");
298 | sb.append(this.Cus);
299 | sb.append(", sqrtA=");
300 | sb.append(this.sqrtA);
301 | sb.append(", toe=");
302 | sb.append(this.toe);
303 | sb.append(", FIT=");
304 | sb.append(this.FIT);
305 | sb.append(", AODO=");
306 | sb.append(this.AODO);
307 | sb.append("}");
308 | return sb.toString();
309 | }
310 | }
311 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/subframes/EPHEM3Object.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types.subframes;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 |
25 | /**
26 | * @author aevdokimov
27 | */
28 | public class EPHEM3Object implements IGPSObject {
29 |
30 | /** the GPSd internal name */
31 | public static final String NAME = "EPHEM3";
32 |
33 | private int IODE = -1;
34 |
35 | private double IDOT = Double.NaN;
36 |
37 | private double Cic = Double.NaN;
38 |
39 | private double Omega0 = Double.NaN;
40 |
41 | private double Cis = Double.NaN;
42 |
43 | private double i0 = Double.NaN;
44 |
45 | private double Crc = Double.NaN;
46 |
47 | private double omega = Double.NaN;
48 |
49 | private double Omegad = Double.NaN;
50 |
51 | /**
52 | * @return the iODE
53 | */
54 | public int getIODE() {
55 | return this.IODE;
56 | }
57 |
58 | /**
59 | * @param iODE the iODE to set
60 | */
61 | public void setIODE(final int iODE) {
62 | this.IODE = iODE;
63 | }
64 |
65 | /**
66 | * @return the iDOT
67 | */
68 | public double getIDOT() {
69 | return this.IDOT;
70 | }
71 |
72 | /**
73 | * @param iDOT the iDOT to set
74 | */
75 | public void setIDOT(final double iDOT) {
76 | this.IDOT = iDOT;
77 | }
78 |
79 | /**
80 | * @return the cic
81 | */
82 | public double getCic() {
83 | return this.Cic;
84 | }
85 |
86 | /**
87 | * @param cic the cic to set
88 | */
89 | public void setCic(final double cic) {
90 | this.Cic = cic;
91 | }
92 |
93 | /**
94 | * @return the omega0
95 | */
96 | public double getOmega0() {
97 | return this.Omega0;
98 | }
99 |
100 | /**
101 | * @param omega0 the omega0 to set
102 | */
103 | public void setOmega0(final double omega0) {
104 | this.Omega0 = omega0;
105 | }
106 |
107 | /**
108 | * @return the cis
109 | */
110 | public double getCis() {
111 | return this.Cis;
112 | }
113 |
114 | /**
115 | * @param cis the cis to set
116 | */
117 | public void setCis(final double cis) {
118 | this.Cis = cis;
119 | }
120 |
121 | /**
122 | * @return the i0
123 | */
124 | public double getI0() {
125 | return this.i0;
126 | }
127 |
128 | /**
129 | * @param i0 the i0 to set
130 | */
131 | public void setI0(final double i0) {
132 | this.i0 = i0;
133 | }
134 |
135 | /**
136 | * @return the crc
137 | */
138 | public double getCrc() {
139 | return this.Crc;
140 | }
141 |
142 | /**
143 | * @param crc the crc to set
144 | */
145 | public void setCrc(final double crc) {
146 | this.Crc = crc;
147 | }
148 |
149 | /**
150 | * @return the omega
151 | */
152 | public double getOmega() {
153 | return this.omega;
154 | }
155 |
156 | /**
157 | * @param omega the omega to set
158 | */
159 | public void setOmega(final double omega) {
160 | this.omega = omega;
161 | }
162 |
163 | /**
164 | * @return the omegad
165 | */
166 | public double getOmegad() {
167 | return this.Omegad;
168 | }
169 |
170 | /**
171 | * @param omegad the omegad to set
172 | */
173 | public void setOmegad(final double omegad) {
174 | this.Omegad = omegad;
175 | }
176 |
177 | @Override
178 | public boolean equals(final Object o) {
179 | if (this == o) {
180 | return true;
181 | }
182 | if (!(o instanceof EPHEM3Object)) {
183 | return false;
184 | }
185 |
186 | final EPHEM3Object that = (EPHEM3Object) o;
187 |
188 | if (Double.compare(that.Cic, this.Cic) != 0) {
189 | return false;
190 | }
191 | if (Double.compare(that.Cis, this.Cis) != 0) {
192 | return false;
193 | }
194 | if (Double.compare(that.Crc, this.Crc) != 0) {
195 | return false;
196 | }
197 | if (Double.compare(that.IDOT, this.IDOT) != 0) {
198 | return false;
199 | }
200 | if (this.IODE != that.IODE) {
201 | return false;
202 | }
203 | if (Double.compare(that.Omega0, this.Omega0) != 0) {
204 | return false;
205 | }
206 | if (Double.compare(that.Omegad, this.Omegad) != 0) {
207 | return false;
208 | }
209 | if (Double.compare(that.i0, this.i0) != 0) {
210 | return false;
211 | }
212 | if (Double.compare(that.omega, this.omega) != 0) {
213 | return false;
214 | }
215 |
216 | return true;
217 | }
218 |
219 | @Override
220 | public int hashCode() {
221 | int result;
222 | long temp;
223 | result = this.IODE;
224 | temp = this.IDOT != +0.0d ? Double.doubleToLongBits(this.IDOT) : 0L;
225 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
226 | temp = this.Cic != +0.0d ? Double.doubleToLongBits(this.Cic) : 0L;
227 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
228 | temp = this.Omega0 != +0.0d ? Double.doubleToLongBits(this.Omega0) : 0L;
229 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
230 | temp = this.Cis != +0.0d ? Double.doubleToLongBits(this.Cis) : 0L;
231 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
232 | temp = this.i0 != +0.0d ? Double.doubleToLongBits(this.i0) : 0L;
233 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
234 | temp = this.Crc != +0.0d ? Double.doubleToLongBits(this.Crc) : 0L;
235 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
236 | temp = this.omega != +0.0d ? Double.doubleToLongBits(this.omega) : 0L;
237 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
238 | temp = this.Omegad != +0.0d ? Double.doubleToLongBits(this.Omegad) : 0L;
239 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
240 | return result;
241 | }
242 |
243 | @Override
244 | public String toString() {
245 | final StringBuilder sb = new StringBuilder();
246 | sb.append("EPHEM3Object{IODE=");
247 | sb.append(this.IODE);
248 | sb.append(", IDOT=");
249 | sb.append(this.IDOT);
250 | sb.append(", Cic=");
251 | sb.append(this.Cic);
252 | sb.append(", Omega0=");
253 | sb.append(this.Omega0);
254 | sb.append(", Cis=");
255 | sb.append(this.Cis);
256 | sb.append(", i0=");
257 | sb.append(this.i0);
258 | sb.append(", Crc=");
259 | sb.append(this.Crc);
260 | sb.append(", omega=");
261 | sb.append(this.omega);
262 | sb.append(", Omegad=");
263 | sb.append(this.Omegad);
264 | sb.append("}");
265 | return sb.toString();
266 | }
267 | }
268 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/subframes/ERDObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types.subframes;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 | import java.util.Arrays;
25 |
26 | /**
27 | * @author aevdokimov
28 | */
29 | public class ERDObject implements IGPSObject {
30 |
31 | /** the GPSd internal name */
32 | public static final String NAME = "ERD";
33 |
34 | private int[] ERD = new int[30];
35 |
36 | private int ai = -1;
37 |
38 | /**
39 | * @return the eRD
40 | */
41 | public int[] getERD() {
42 | return this.ERD;
43 | }
44 |
45 | /**
46 | * @param eRD the eRD to set
47 | */
48 | public void setERD(final int[] eRD) {
49 | this.ERD = eRD;
50 | }
51 |
52 | /**
53 | * @return the ai
54 | */
55 | public int getAi() {
56 | return this.ai;
57 | }
58 |
59 | /**
60 | * @param ai the ai to set
61 | */
62 | public void setAi(final int ai) {
63 | this.ai = ai;
64 | }
65 |
66 | /**
67 | * @param index
68 | * @return the ERD
69 | */
70 | public int getERDbyIndex(final int index) {
71 | return this.ERD[index];
72 | }
73 |
74 | /**
75 | * @param index the index
76 | * @param ERDvalue the ERD
77 | */
78 | public void setERDbyIndex(final int index, final int ERDvalue) {
79 | this.ERD[index] = ERDvalue;
80 | }
81 |
82 | @Override
83 | public boolean equals(final Object o) {
84 | if (this == o) {
85 | return true;
86 | }
87 | if (!(o instanceof ERDObject)) {
88 | return false;
89 | }
90 |
91 | final ERDObject erdObject = (ERDObject) o;
92 |
93 | if (this.ai != erdObject.ai) {
94 | return false;
95 | }
96 | if (!Arrays.equals(this.ERD, erdObject.ERD)) {
97 | return false;
98 | }
99 |
100 | return true;
101 | }
102 |
103 | @Override
104 | public int hashCode() {
105 | int result = this.ERD != null ? Arrays.hashCode(this.ERD) : 0;
106 | result = (31 * result) + this.ai;
107 | return result;
108 | }
109 |
110 | @Override
111 | public String toString() {
112 | final StringBuilder sb = new StringBuilder();
113 | sb.append("ERDObject{ai=");
114 | sb.append(this.ai);
115 | for (int index = 1; index <= 30; index++) {
116 | sb.append(", ERD");
117 | sb.append(index);
118 | sb.append("=");
119 | sb.append(this.ERD[index - 1]);
120 | }
121 | sb.append("}");
122 | return sb.toString();
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/subframes/HEALTH2Object.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types.subframes;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 | import java.util.Arrays;
25 |
26 | /**
27 | * @author aevdokimov
28 | */
29 | public class HEALTH2Object implements IGPSObject {
30 |
31 | /** the GPSd internal name */
32 | public static final String NAME = "HEALTH2";
33 |
34 | private final int[] SV = new int[24];
35 |
36 | private int toa = -1;
37 |
38 | private int WNa = -1;
39 |
40 | /**
41 | * @return the toa
42 | */
43 | public int getToa() {
44 | return this.toa;
45 | }
46 |
47 | /**
48 | * @param toa the toa to set
49 | */
50 | public void setToa(final int toa) {
51 | this.toa = toa;
52 | }
53 |
54 | /**
55 | * @return the wNa
56 | */
57 | public int getWNa() {
58 | return this.WNa;
59 | }
60 |
61 | /**
62 | * @param wNa the wNa to set
63 | */
64 | public void setWNa(final int wNa) {
65 | this.WNa = wNa;
66 | }
67 |
68 | /**
69 | * @param index the index
70 | * @return the SV
71 | */
72 | public int getSVbyIndex(final int index) {
73 | return this.SV[index];
74 | }
75 |
76 | /**
77 | * @param index the index
78 | * @param SVvalue the SV
79 | */
80 | public void setSVbyIndex(final int index, final int SVvalue) {
81 | this.SV[index] = SVvalue;
82 | }
83 |
84 | @Override
85 | public boolean equals(final Object o) {
86 | if (this == o) {
87 | return true;
88 | }
89 | if (!(o instanceof HEALTH2Object)) {
90 | return false;
91 | }
92 |
93 | final HEALTH2Object that = (HEALTH2Object) o;
94 |
95 | if (this.WNa != that.WNa) {
96 | return false;
97 | }
98 | if (this.toa != that.toa) {
99 | return false;
100 | }
101 | if (!Arrays.equals(this.SV, that.SV)) {
102 | return false;
103 | }
104 |
105 | return true;
106 | }
107 |
108 | @Override
109 | public int hashCode() {
110 | int result = this.SV != null ? Arrays.hashCode(this.SV) : 0;
111 | result = (31 * result) + this.toa;
112 | result = (31 * result) + this.WNa;
113 | return result;
114 | }
115 |
116 | @Override
117 | public String toString() {
118 | final StringBuilder sb = new StringBuilder();
119 | sb.append("HEALTH2Object{toa=");
120 | sb.append(this.toa);
121 | sb.append(", WNa=");
122 | sb.append(this.WNa);
123 | for (int index = 1; index <= 24; index++) {
124 | sb.append(", SV");
125 | sb.append(index);
126 | sb.append("=");
127 | sb.append(this.SV[index - 1]);
128 | }
129 | sb.append("}");
130 | return sb.toString();
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/subframes/HEALTHObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types.subframes;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 | import java.util.Arrays;
25 |
26 | /**
27 | * @author aevdokimov
28 | */
29 | public class HEALTHObject implements IGPSObject {
30 |
31 | /** the GPSd internal name */
32 | public static final String NAME = "HEALTH";
33 |
34 | private final int[] SV = new int[32];
35 |
36 | private final int[] SVH = new int[8];
37 |
38 | private int data_id = -1;
39 |
40 | /**
41 | * @return the data_id
42 | */
43 | public int getData_id() {
44 | return this.data_id;
45 | }
46 |
47 | /**
48 | * @param data_id the data_id to set
49 | */
50 | public void setData_id(final int data_id) {
51 | this.data_id = data_id;
52 | }
53 |
54 | /**
55 | * @param index the index
56 | * @return the SV
57 | */
58 | public int getSVbyIndex(final int index) {
59 | return this.SV[index];
60 | }
61 |
62 | /**
63 | * @param index the index
64 | * @param SVvalue the SV
65 | */
66 | public void setSVbyIndex(final int index, final int SVvalue) {
67 | this.SV[index] = SVvalue;
68 | }
69 |
70 | /**
71 | * @param index the index
72 | * @return the SVH
73 | */
74 | public int getSVHbyIndex(final int index) {
75 | return this.SVH[index];
76 | }
77 |
78 | /**
79 | * @param index the index
80 | * @param SVHvalue the SVH
81 | */
82 | public void setSVHbyIndex(final int index, final int SVHvalue) {
83 | this.SVH[index] = SVHvalue;
84 | }
85 |
86 | @Override
87 | public boolean equals(final Object o) {
88 | if (this == o) {
89 | return true;
90 | }
91 | if (!(o instanceof HEALTHObject)) {
92 | return false;
93 | }
94 |
95 | final HEALTHObject that = (HEALTHObject) o;
96 |
97 | if (this.data_id != that.data_id) {
98 | return false;
99 | }
100 | if (!Arrays.equals(this.SV, that.SV)) {
101 | return false;
102 | }
103 | if (!Arrays.equals(this.SVH, that.SVH)) {
104 | return false;
105 | }
106 |
107 | return true;
108 | }
109 |
110 | @Override
111 | public int hashCode() {
112 | int result = this.SV != null ? Arrays.hashCode(this.SV) : 0;
113 | result = (31 * result) + (this.SVH != null ? Arrays.hashCode(this.SVH) : 0);
114 | result = (31 * result) + this.data_id;
115 | return result;
116 | }
117 |
118 | @Override
119 | public String toString() {
120 | final StringBuilder sb = new StringBuilder();
121 | sb.append("HEALTHObject{data_id=");
122 | sb.append(this.data_id);
123 | for (int index = 1; index <= 32; index++) {
124 | sb.append(", SV");
125 | sb.append(index);
126 | sb.append("=");
127 | sb.append(this.SV[index - 1]);
128 | }
129 | for (int index = 0; index <= 7; index++) {
130 | sb.append(", SVH");
131 | sb.append(index + 25);
132 | sb.append("=");
133 | sb.append(this.SVH[index]);
134 | }
135 | sb.append("}");
136 | return sb.toString();
137 | }
138 | }
139 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/subframes/IONOObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types.subframes;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 |
25 | /**
26 | * @author aevdokimov
27 | */
28 | public class IONOObject implements IGPSObject {
29 |
30 | /** the GPSd internal name */
31 | public static final String NAME = "IONO";
32 |
33 | private double alpha0 = Double.NaN;
34 |
35 | private double alpha1 = Double.NaN;
36 |
37 | private double alpha2 = Double.NaN;
38 |
39 | private double alpha3 = Double.NaN;
40 |
41 | private double beta0 = Double.NaN;
42 |
43 | private double beta1 = Double.NaN;
44 |
45 | private double beta2 = Double.NaN;
46 |
47 | private double beta3 = Double.NaN;
48 |
49 | private double A0 = Double.NaN;
50 |
51 | private double A1 = Double.NaN;
52 |
53 | private double tot = Double.NaN;
54 |
55 | private int WNt = -1;
56 |
57 | private int leap = -1;
58 |
59 | private int WNlsf = -1;
60 |
61 | private int DN = -1;
62 |
63 | private int lsf = -1;
64 |
65 | /**
66 | * @return the alpha0
67 | */
68 | public double getAlpha0() {
69 | return this.alpha0;
70 | }
71 |
72 | /**
73 | * @param alpha0 the alpha0 to set
74 | */
75 | public void setAlpha0(final double alpha0) {
76 | this.alpha0 = alpha0;
77 | }
78 |
79 | /**
80 | * @return the alpha1
81 | */
82 | public double getAlpha1() {
83 | return this.alpha1;
84 | }
85 |
86 | /**
87 | * @param alpha1 the alpha1 to set
88 | */
89 | public void setAlpha1(final double alpha1) {
90 | this.alpha1 = alpha1;
91 | }
92 |
93 | /**
94 | * @return the alpha2
95 | */
96 | public double getAlpha2() {
97 | return this.alpha2;
98 | }
99 |
100 | /**
101 | * @param alpha2 the alpha2 to set
102 | */
103 | public void setAlpha2(final double alpha2) {
104 | this.alpha2 = alpha2;
105 | }
106 |
107 | /**
108 | * @return the alpha3
109 | */
110 | public double getAlpha3() {
111 | return this.alpha3;
112 | }
113 |
114 | /**
115 | * @param alpha3 the alpha3 to set
116 | */
117 | public void setAlpha3(final double alpha3) {
118 | this.alpha3 = alpha3;
119 | }
120 |
121 | /**
122 | * @return the beta0
123 | */
124 | public double getBeta0() {
125 | return this.beta0;
126 | }
127 |
128 | /**
129 | * @param beta0 the beta0 to set
130 | */
131 | public void setBeta0(final double beta0) {
132 | this.beta0 = beta0;
133 | }
134 |
135 | /**
136 | * @return the beta1
137 | */
138 | public double getBeta1() {
139 | return this.beta1;
140 | }
141 |
142 | /**
143 | * @param beta1 the beta1 to set
144 | */
145 | public void setBeta1(final double beta1) {
146 | this.beta1 = beta1;
147 | }
148 |
149 | /**
150 | * @return the beta2
151 | */
152 | public double getBeta2() {
153 | return this.beta2;
154 | }
155 |
156 | /**
157 | * @param beta2 the beta2 to set
158 | */
159 | public void setBeta2(final double beta2) {
160 | this.beta2 = beta2;
161 | }
162 |
163 | /**
164 | * @return the beta3
165 | */
166 | public double getBeta3() {
167 | return this.beta3;
168 | }
169 |
170 | /**
171 | * @param beta3 the beta3 to set
172 | */
173 | public void setBeta3(final double beta3) {
174 | this.beta3 = beta3;
175 | }
176 |
177 | /**
178 | * @return the a0
179 | */
180 | public double getA0() {
181 | return this.A0;
182 | }
183 |
184 | /**
185 | * @param a0 the a0 to set
186 | */
187 | public void setA0(final double a0) {
188 | this.A0 = a0;
189 | }
190 |
191 | /**
192 | * @return the a1
193 | */
194 | public double getA1() {
195 | return this.A1;
196 | }
197 |
198 | /**
199 | * @param a1 the a1 to set
200 | */
201 | public void setA1(final double a1) {
202 | this.A1 = a1;
203 | }
204 |
205 | /**
206 | * @return the tot
207 | */
208 | public double getTot() {
209 | return this.tot;
210 | }
211 |
212 | /**
213 | * @param tot the tot to set
214 | */
215 | public void setTot(final double tot) {
216 | this.tot = tot;
217 | }
218 |
219 | /**
220 | * @return the wNt
221 | */
222 | public int getWNt() {
223 | return this.WNt;
224 | }
225 |
226 | /**
227 | * @param wNt the wNt to set
228 | */
229 | public void setWNt(final int wNt) {
230 | this.WNt = wNt;
231 | }
232 |
233 | /**
234 | * @return the leap
235 | */
236 | public int getLeap() {
237 | return this.leap;
238 | }
239 |
240 | /**
241 | * @param leap the leap to set
242 | */
243 | public void setLeap(final int leap) {
244 | this.leap = leap;
245 | }
246 |
247 | /**
248 | * @return the wNlsf
249 | */
250 | public int getWNlsf() {
251 | return this.WNlsf;
252 | }
253 |
254 | /**
255 | * @param wNlsf the wNlsf to set
256 | */
257 | public void setWNlsf(final int wNlsf) {
258 | this.WNlsf = wNlsf;
259 | }
260 |
261 | /**
262 | * @return the dN
263 | */
264 | public int getDN() {
265 | return this.DN;
266 | }
267 |
268 | /**
269 | * @param dN the dN to set
270 | */
271 | public void setDN(final int dN) {
272 | this.DN = dN;
273 | }
274 |
275 | /**
276 | * @return the lsf
277 | */
278 | public int getLsf() {
279 | return this.lsf;
280 | }
281 |
282 | /**
283 | * @param lsf the lsf to set
284 | */
285 | public void setLsf(final int lsf) {
286 | this.lsf = lsf;
287 | }
288 |
289 | @Override
290 | public boolean equals(final Object o) {
291 | if (this == o) {
292 | return true;
293 | }
294 | if (!(o instanceof IONOObject)) {
295 | return false;
296 | }
297 |
298 | final IONOObject that = (IONOObject) o;
299 |
300 | if (Double.compare(that.A0, this.A0) != 0) {
301 | return false;
302 | }
303 | if (Double.compare(that.A1, this.A1) != 0) {
304 | return false;
305 | }
306 | if (this.DN != that.DN) {
307 | return false;
308 | }
309 | if (this.WNlsf != that.WNlsf) {
310 | return false;
311 | }
312 | if (this.WNt != that.WNt) {
313 | return false;
314 | }
315 | if (Double.compare(that.alpha0, this.alpha0) != 0) {
316 | return false;
317 | }
318 | if (Double.compare(that.alpha1, this.alpha1) != 0) {
319 | return false;
320 | }
321 | if (Double.compare(that.alpha2, this.alpha2) != 0) {
322 | return false;
323 | }
324 | if (Double.compare(that.alpha3, this.alpha3) != 0) {
325 | return false;
326 | }
327 | if (Double.compare(that.beta0, this.beta0) != 0) {
328 | return false;
329 | }
330 | if (Double.compare(that.beta1, this.beta1) != 0) {
331 | return false;
332 | }
333 | if (Double.compare(that.beta2, this.beta2) != 0) {
334 | return false;
335 | }
336 | if (Double.compare(that.beta3, this.beta3) != 0) {
337 | return false;
338 | }
339 | if (this.leap != that.leap) {
340 | return false;
341 | }
342 | if (this.lsf != that.lsf) {
343 | return false;
344 | }
345 | if (Double.compare(that.tot, this.tot) != 0) {
346 | return false;
347 | }
348 |
349 | return true;
350 | }
351 |
352 | @Override
353 | public int hashCode() {
354 | int result;
355 | long temp;
356 | temp = this.alpha0 != +0.0d ? Double.doubleToLongBits(this.alpha0) : 0L;
357 | result = (int) (temp ^ (temp >>> 32));
358 | temp = this.alpha1 != +0.0d ? Double.doubleToLongBits(this.alpha1) : 0L;
359 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
360 | temp = this.alpha2 != +0.0d ? Double.doubleToLongBits(this.alpha2) : 0L;
361 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
362 | temp = this.alpha3 != +0.0d ? Double.doubleToLongBits(this.alpha3) : 0L;
363 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
364 | temp = this.beta0 != +0.0d ? Double.doubleToLongBits(this.beta0) : 0L;
365 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
366 | temp = this.beta1 != +0.0d ? Double.doubleToLongBits(this.beta1) : 0L;
367 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
368 | temp = this.beta2 != +0.0d ? Double.doubleToLongBits(this.beta2) : 0L;
369 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
370 | temp = this.beta3 != +0.0d ? Double.doubleToLongBits(this.beta3) : 0L;
371 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
372 | temp = this.A0 != +0.0d ? Double.doubleToLongBits(this.A0) : 0L;
373 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
374 | temp = this.A1 != +0.0d ? Double.doubleToLongBits(this.A1) : 0L;
375 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
376 | temp = this.tot != +0.0d ? Double.doubleToLongBits(this.tot) : 0L;
377 | result = (31 * result) + (int) (temp ^ (temp >>> 32));
378 | result = (31 * result) + this.WNt;
379 | result = (31 * result) + this.leap;
380 | result = (31 * result) + this.WNlsf;
381 | result = (31 * result) + this.DN;
382 | result = (31 * result) + this.lsf;
383 | return result;
384 | }
385 |
386 | @Override
387 | public String toString() {
388 | final StringBuilder sb = new StringBuilder();
389 | sb.append("IONOObject{alpha0=");
390 | sb.append(this.alpha0);
391 | sb.append(", alpha1=");
392 | sb.append(this.alpha1);
393 | sb.append(", alpha2=");
394 | sb.append(this.alpha2);
395 | sb.append(", alpha3=");
396 | sb.append(this.alpha3);
397 | sb.append(", beta0=");
398 | sb.append(this.beta0);
399 | sb.append(", beta1=");
400 | sb.append(this.beta1);
401 | sb.append(", beta2=");
402 | sb.append(this.beta2);
403 | sb.append(", beta3=");
404 | sb.append(this.beta3);
405 | sb.append(", A0=");
406 | sb.append(this.A0);
407 | sb.append(", A1=");
408 | sb.append(this.A1);
409 | sb.append(", tot=");
410 | sb.append(this.tot);
411 | sb.append(", WNt=");
412 | sb.append(this.WNt);
413 | sb.append(", leap=");
414 | sb.append(this.leap);
415 | sb.append(", WNlsf=");
416 | sb.append(this.WNlsf);
417 | sb.append(", DN=");
418 | sb.append(this.DN);
419 | sb.append(", lsf=");
420 | sb.append(this.lsf);
421 | sb.append("}");
422 | return sb.toString();
423 | }
424 | }
425 |
--------------------------------------------------------------------------------
/src/main/java/de/taimos/gpsd4java/types/subframes/SUBFRAMEObject.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.types.subframes;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.types.IGPSObject;
24 |
25 | /**
26 | * @author aevdokimov
27 | */
28 | public class SUBFRAMEObject implements IGPSObject {
29 |
30 | /** the GPSd internal name */
31 | public static final String NAME = "SUBFRAME";
32 |
33 | private String device = null;
34 |
35 | private int subframeNumber = -1;
36 |
37 | private int satelliteNumber = -1;
38 |
39 | private int MSBs = -1;
40 |
41 | private boolean scaled = false;
42 |
43 | private int pageid = -1;
44 |
45 | private String systemMessage = null;
46 |
47 | private ALMANACObject almanac;
48 |
49 | private EPHEM1Object ephem1;
50 |
51 | private EPHEM2Object ephem2;
52 |
53 | private EPHEM3Object ephem3;
54 |
55 | private ERDObject erd;
56 |
57 | private HEALTHObject health;
58 |
59 | private HEALTH2Object health2;
60 |
61 | private IONOObject iono;
62 |
63 | /**
64 | * Name of originating device
65 | *
66 | * @return the device
67 | */
68 | public String getDevice() {
69 | return this.device;
70 | }
71 |
72 | /**
73 | * Name of originating device
74 | *
75 | * @param device the device to set
76 | */
77 | public void setDevice(final String device) {
78 | this.device = device;
79 | }
80 |
81 | /**
82 | * Subframe number
83 | *
84 | * @return the subframe number
85 | */
86 | public int getSubFrameNumber() {
87 | return this.subframeNumber;
88 | }
89 |
90 | /**
91 | * Subframe number
92 | *
93 | * @param subframeNumber to set
94 | */
95 | public void setSubframeNumber(final int subframeNumber) {
96 | this.subframeNumber = subframeNumber;
97 | }
98 |
99 | /**
100 | * Satellite number
101 | *
102 | * @return the satellite number
103 | */
104 | public int getSatelliteNumber() {
105 | return this.satelliteNumber;
106 | }
107 |
108 | /**
109 | * Satellite number
110 | *
111 | * @param satelliteNumber satellite number to set
112 | */
113 | public void setSatelliteNumber(final int satelliteNumber) {
114 | this.satelliteNumber = satelliteNumber;
115 | }
116 |
117 | /**
118 | * TOW17 field containing the 17 MSBs of the start of the next 12-second message
119 | *
120 | * @return TOW17
121 | */
122 | public int getMSBs() {
123 | return this.MSBs;
124 | }
125 |
126 | /**
127 | * TOW17 field containing the 17 MSBs of the start of the next 12-second message
128 | *
129 | * @param MSBs TOW17 to set
130 | */
131 | public void setMSBs(final int MSBs) {
132 | this.MSBs = MSBs;
133 | }
134 |
135 | /**
136 | * field telling whether the remainder of the fields are dumped in scaled or unscaled form
137 | *
138 | * @return scaled
139 | */
140 | public boolean getScaled() {
141 | return this.scaled;
142 | }
143 |
144 | /**
145 | * field telling whether the remainder of the fields are dumped in scaled or unscaled form
146 | *
147 | * @param scaled scaled to set
148 | */
149 | public void setScaled(final boolean scaled) {
150 | this.scaled = scaled;
151 | }
152 |
153 | /**
154 | * optional pageid for ERD, IONO, HEALTH and system message
155 | *
156 | * @return pageid
157 | */
158 | public int getPageid() {
159 | return this.pageid;
160 | }
161 |
162 | /**
163 | * optional pageid for ERD, IONO, HEALTH and system message
164 | *
165 | * @param pageid page id to set
166 | */
167 | public void setPageid(final int pageid) {
168 | this.pageid = pageid;
169 | }
170 |
171 | /**
172 | * optional system message
173 | *
174 | * @return system message
175 | */
176 | public String getSystemMessage() {
177 | return this.systemMessage;
178 | }
179 |
180 | /**
181 | * optional system message
182 | *
183 | * @param systemMessage system message to set
184 | */
185 | public void setSystemMessage(final String systemMessage) {
186 | this.systemMessage = systemMessage;
187 | }
188 |
189 | /**
190 | * Optional ALMANAC object
191 | *
192 | * @return ALMANAC
193 | */
194 | public ALMANACObject getAlmanac() {
195 | return this.almanac;
196 | }
197 |
198 | /**
199 | * Optional ALMANAC object
200 | *
201 | * @param almanac ALMANAC to set
202 | */
203 | public void setAlmanac(final ALMANACObject almanac) {
204 | this.almanac = almanac;
205 | }
206 |
207 | /**
208 | * Optional EPHEM1 object
209 | *
210 | * @return EPHEM1
211 | */
212 | public EPHEM1Object getEphem1() {
213 | return this.ephem1;
214 | }
215 |
216 | /**
217 | * Optional EPHEM1 object
218 | *
219 | * @param ephem1 EPHEM1 to set
220 | */
221 | public void setEphem1(final EPHEM1Object ephem1) {
222 | this.ephem1 = ephem1;
223 | }
224 |
225 | /**
226 | * Optional EPHEM2 object
227 | *
228 | * @return EPHEM2
229 | */
230 | public EPHEM2Object getEphem2() {
231 | return this.ephem2;
232 | }
233 |
234 | /**
235 | * Optional EPHEM2 object
236 | *
237 | * @param ephem2 EPHEM2 to set
238 | */
239 | public void setEphem2(final EPHEM2Object ephem2) {
240 | this.ephem2 = ephem2;
241 | }
242 |
243 | /**
244 | * Optional EPHEM3 object
245 | *
246 | * @return EPHEM3
247 | */
248 | public EPHEM3Object getEphem3() {
249 | return this.ephem3;
250 | }
251 |
252 | /**
253 | * Optional EPHEM3 object
254 | *
255 | * @param ephem3 EPHEM3 to set
256 | */
257 | public void setEphem3(final EPHEM3Object ephem3) {
258 | this.ephem3 = ephem3;
259 | }
260 |
261 | /**
262 | * Optional ERD object
263 | *
264 | * @return ERD
265 | */
266 | public ERDObject getErd() {
267 | return this.erd;
268 | }
269 |
270 | /**
271 | * Optional ERD object
272 | *
273 | * @param erd ERD to set
274 | */
275 | public void setErd(final ERDObject erd) {
276 | this.erd = erd;
277 | }
278 |
279 | /**
280 | * Optional HEALTH object
281 | *
282 | * @return HEALTH
283 | */
284 | public HEALTHObject getHealth() {
285 | return this.health;
286 | }
287 |
288 | /**
289 | * Optional HEALTH object
290 | *
291 | * @param health HEALTH to set
292 | */
293 | public void setHealth(final HEALTHObject health) {
294 | this.health = health;
295 | }
296 |
297 | /**
298 | * Optional HEALTH2 object
299 | *
300 | * @return HEALTH2
301 | */
302 | public HEALTH2Object getHealth2() {
303 | return this.health2;
304 | }
305 |
306 | /**
307 | * Optional HEALTH2 object
308 | *
309 | * @param health2 HEALTH2 to set
310 | */
311 | public void setHealth2(final HEALTH2Object health2) {
312 | this.health2 = health2;
313 | }
314 |
315 | /**
316 | * Optional IONO object
317 | *
318 | * @return IONO
319 | */
320 | public IONOObject getIono() {
321 | return this.iono;
322 | }
323 |
324 | /**
325 | * Optional IONO object
326 | *
327 | * @param iono IONO to set
328 | */
329 | public void setIono(final IONOObject iono) {
330 | this.iono = iono;
331 | }
332 |
333 | @Override
334 | public boolean equals(final Object o) {
335 | if (this == o) {
336 | return true;
337 | }
338 | if (!(o instanceof SUBFRAMEObject)) {
339 | return false;
340 | }
341 |
342 | final SUBFRAMEObject that = (SUBFRAMEObject) o;
343 |
344 | if (this.MSBs != that.MSBs) {
345 | return false;
346 | }
347 | if (this.pageid != that.pageid) {
348 | return false;
349 | }
350 | if (this.satelliteNumber != that.satelliteNumber) {
351 | return false;
352 | }
353 | if (this.scaled != that.scaled) {
354 | return false;
355 | }
356 | if (this.subframeNumber != that.subframeNumber) {
357 | return false;
358 | }
359 | if (this.almanac != null ? !this.almanac.equals(that.almanac) : that.almanac != null) {
360 | return false;
361 | }
362 | if (this.device != null ? !this.device.equals(that.device) : that.device != null) {
363 | return false;
364 | }
365 | if (this.ephem1 != null ? !this.ephem1.equals(that.ephem1) : that.ephem1 != null) {
366 | return false;
367 | }
368 | if (this.ephem2 != null ? !this.ephem2.equals(that.ephem2) : that.ephem2 != null) {
369 | return false;
370 | }
371 | if (this.ephem3 != null ? !this.ephem3.equals(that.ephem3) : that.ephem3 != null) {
372 | return false;
373 | }
374 | if (this.erd != null ? !this.erd.equals(that.erd) : that.erd != null) {
375 | return false;
376 | }
377 | if (this.health != null ? !this.health.equals(that.health) : that.health != null) {
378 | return false;
379 | }
380 | if (this.health2 != null ? !this.health2.equals(that.health2) : that.health2 != null) {
381 | return false;
382 | }
383 | if (this.iono != null ? !this.iono.equals(that.iono) : that.iono != null) {
384 | return false;
385 | }
386 | if (this.systemMessage != null
387 | ? !this.systemMessage.equals(that.systemMessage)
388 | : that.systemMessage != null) {
389 | return false;
390 | }
391 |
392 | return true;
393 | }
394 |
395 | @Override
396 | public int hashCode() {
397 | int result = this.device != null ? this.device.hashCode() : 0;
398 | result = (31 * result) + this.subframeNumber;
399 | result = (31 * result) + this.satelliteNumber;
400 | result = (31 * result) + this.MSBs;
401 | result = (31 * result) + (this.scaled ? 1 : 0);
402 | result = (31 * result) + this.pageid;
403 | result = (31 * result) + (this.systemMessage != null ? this.systemMessage.hashCode() : 0);
404 | result = (31 * result) + (this.almanac != null ? this.almanac.hashCode() : 0);
405 | result = (31 * result) + (this.ephem1 != null ? this.ephem1.hashCode() : 0);
406 | result = (31 * result) + (this.ephem2 != null ? this.ephem2.hashCode() : 0);
407 | result = (31 * result) + (this.ephem3 != null ? this.ephem3.hashCode() : 0);
408 | result = (31 * result) + (this.erd != null ? this.erd.hashCode() : 0);
409 | result = (31 * result) + (this.health != null ? this.health.hashCode() : 0);
410 | result = (31 * result) + (this.health2 != null ? this.health2.hashCode() : 0);
411 | result = (31 * result) + (this.iono != null ? this.iono.hashCode() : 0);
412 | return result;
413 | }
414 |
415 | @Override
416 | public String toString() {
417 | final StringBuilder sb = new StringBuilder();
418 | sb.append("SUBFRAMEObject{device=");
419 | sb.append(this.device);
420 | sb.append(", subframeNumber=");
421 | sb.append(this.subframeNumber);
422 | sb.append(", satelliteNumber=");
423 | sb.append(this.satelliteNumber);
424 | sb.append(", TOW17=");
425 | sb.append(this.MSBs);
426 | sb.append(", scaled=");
427 | sb.append(this.scaled);
428 | sb.append(", pageid=");
429 | sb.append(this.pageid);
430 | if (this.almanac != null) {
431 | sb.append(", almanac={");
432 | sb.append(this.almanac.toString());
433 | sb.append("}");
434 | } else if (this.ephem1 != null) {
435 | sb.append(", ephem1={");
436 | sb.append(this.ephem1.toString());
437 | sb.append("}");
438 | } else if (this.ephem2 != null) {
439 | sb.append(", ephem2={");
440 | sb.append(this.ephem2.toString());
441 | sb.append("}");
442 | } else if (this.ephem3 != null) {
443 | sb.append(", ephem3={");
444 | sb.append(this.ephem3.toString());
445 | sb.append("}");
446 | } else if (this.erd != null) {
447 | sb.append(", erd={");
448 | sb.append(this.erd.toString());
449 | sb.append("}");
450 | } else if (this.health != null) {
451 | sb.append(", health={");
452 | sb.append(this.health.toString());
453 | sb.append("}");
454 | } else if (this.health2 != null) {
455 | sb.append(", health2={");
456 | sb.append(this.health2.toString());
457 | sb.append("}");
458 | } else if (this.systemMessage != null) {
459 | sb.append(", systemMessage=");
460 | sb.append(this.systemMessage);
461 | } else if (this.iono != null) {
462 | sb.append(", iono={");
463 | sb.append(this.iono.toString());
464 | sb.append("}");
465 | }
466 | sb.append("}");
467 | return sb.toString();
468 | }
469 | }
470 |
--------------------------------------------------------------------------------
/src/test/java/de/taimos/gpsd4java/backend/ResultParserTest.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.backend;
2 |
3 | import de.taimos.gpsd4java.types.ENMEAMode;
4 | import de.taimos.gpsd4java.types.SATObject;
5 | import de.taimos.gpsd4java.types.SKYObject;
6 | import de.taimos.gpsd4java.types.TPVObject;
7 | import de.taimos.gpsd4java.types.subframes.IONOObject;
8 | import org.json.JSONArray;
9 | import org.json.JSONObject;
10 | import org.junit.Assert;
11 | import org.junit.Before;
12 | import org.junit.Test;
13 |
14 | public class ResultParserTest {
15 |
16 | private ResultParser resultParser;
17 |
18 | @Before
19 | public void before() {
20 | this.resultParser = new ResultParser();
21 | }
22 |
23 | @Test
24 | public void testSatObject() {
25 | final JSONObject json = new JSONObject();
26 | json.put("PRN", 12);
27 | json.put("gnssid", 44);
28 | json.put("svid", 12);
29 | json.put("az", 229);
30 | json.put("el", 24);
31 | json.put("prRes", 22.9);
32 | json.put("qual", 1);
33 | json.put("ss", 0);
34 | json.put("used", false);
35 | json.put("health", 1);
36 | final SATObject satObject = (SATObject) this.resultParser.parsePRN(json);
37 | Assert.assertEquals(12, satObject.getPRN());
38 | Assert.assertEquals(44, satObject.getGnssId());
39 | Assert.assertEquals(229, satObject.getAzimuth());
40 | Assert.assertEquals(24, satObject.getElevation());
41 | Assert.assertFalse(satObject.getUsed());
42 | Assert.assertEquals(0, satObject.getSignalStrength());
43 | }
44 |
45 | @Test
46 | public void testIonoObject() {
47 | final JSONObject json = new JSONObject();
48 | json.put("a0", 1.0);
49 | json.put("a1", 2.0);
50 | json.put("a2", 3.0);
51 | json.put("b0", 11.0);
52 | json.put("b1", 12.0);
53 | json.put("b2", 13.0);
54 | json.put("b3", 14.0);
55 | json.put("A0", 21.0);
56 | json.put("A1", 22.0);
57 | json.put("tot", 31.0);
58 | json.put("WNt", 100);
59 | json.put("ls", 101);
60 | json.put("WNlsf", 102);
61 | json.put("DN", 103);
62 | json.put("lsf", 104);
63 | final IONOObject ionoObject = (IONOObject) this.resultParser.parseIONO(json);
64 | Assert.assertEquals(1.0, ionoObject.getAlpha0(), 0);
65 | Assert.assertEquals(2.0, ionoObject.getAlpha1(), 0);
66 | Assert.assertEquals(3.0, ionoObject.getAlpha2(), 0);
67 | Assert.assertEquals(11.0, ionoObject.getBeta0(), 0);
68 | Assert.assertEquals(12.0, ionoObject.getBeta1(), 0);
69 | Assert.assertEquals(13.0, ionoObject.getBeta2(), 0);
70 | Assert.assertEquals(14.0, ionoObject.getBeta3(), 0);
71 | Assert.assertEquals(21.0, ionoObject.getA0(), 0);
72 | Assert.assertEquals(22.0, ionoObject.getA1(), 0);
73 | Assert.assertEquals(31.0, ionoObject.getTot(), 0);
74 | Assert.assertEquals(100, ionoObject.getWNt());
75 | Assert.assertEquals(101, ionoObject.getLeap());
76 | Assert.assertEquals(102, ionoObject.getWNlsf());
77 | Assert.assertEquals(103, ionoObject.getDN());
78 | Assert.assertEquals(104, ionoObject.getLsf());
79 | }
80 |
81 | @Test
82 | public void testSkyObject() throws Exception {
83 |
84 | final JSONObject json = new JSONObject();
85 | json.put("device", "/dev/ttyUSB0");
86 | json.put("time", "2025-02-11T08:39:29.000Z");
87 | json.put("gdop", 1.29);
88 | json.put("hdop", 0.61);
89 | json.put("pdop", 1.16);
90 | json.put("tdop", 0.56);
91 | json.put("xdop", 0.38);
92 | json.put("ydop", 0.49);
93 | json.put("vdop", 0.99);
94 | json.put("nSat", 2);
95 |
96 | final JSONArray satellites = new JSONArray();
97 | json.put("satellites", satellites);
98 |
99 | final JSONObject sat1 = new JSONObject();
100 | sat1.put("PRN", 6);
101 | sat1.put("gnssid", 0);
102 | sat1.put("svid", 6);
103 | sat1.put("az", 110.0);
104 | sat1.put("el", 2.0);
105 | sat1.put("prRes", 11.0);
106 | sat1.put("qual", 1);
107 | sat1.put("ss", 0.0);
108 | sat1.put("used", false);
109 | sat1.put("health", 1);
110 |
111 | final JSONObject sat2 = new JSONObject();
112 | sat2.put("PRN", 10);
113 | sat2.put("gnssid", 0);
114 | sat2.put("svid", 10);
115 | sat2.put("az", 303.0);
116 | sat2.put("el", 14.0);
117 | sat2.put("prRes", 30.3);
118 | sat2.put("qual", 7);
119 | sat2.put("ss", 48.0);
120 | sat2.put("used", true);
121 | sat2.put("health", 1);
122 |
123 | satellites.put(sat1);
124 | satellites.put(sat2);
125 |
126 | final SKYObject skyObject = (SKYObject) this.resultParser.parseSKY(json);
127 |
128 | Assert.assertEquals("/dev/ttyUSB0", skyObject.getDevice());
129 | Assert.assertEquals(1739263169.0, skyObject.getTimestamp(), 0.0);
130 | Assert.assertEquals(1.29, skyObject.getHypersphericalDOP(), 0.0);
131 | Assert.assertEquals(0.61, skyObject.getHorizontalDOP(), 0.0);
132 | Assert.assertEquals(1.16, skyObject.getSphericalDOP(), 0.0);
133 | Assert.assertEquals(0.56, skyObject.getTimestampDOP(), 0.0);
134 | Assert.assertEquals(0.38, skyObject.getLongitudeDOP(), 0.0);
135 | Assert.assertEquals(0.49, skyObject.getLatitudeDOP(), 0.0);
136 | Assert.assertEquals(0.99, skyObject.getAltitudeDOP(), 0.0);
137 | Assert.assertEquals(2, skyObject.getSatellites().size());
138 |
139 | final SATObject satObject1 = skyObject.getSatellites().get(0);
140 | Assert.assertEquals(6, satObject1.getPRN());
141 | Assert.assertEquals(0, satObject1.getGnssId());
142 | Assert.assertEquals(110.0, satObject1.getAzimuth(), 0.0);
143 | Assert.assertEquals(2.0, satObject1.getElevation(), 0.0);
144 | Assert.assertEquals(0.0, satObject1.getSignalStrength(), 0.0);
145 | Assert.assertFalse(satObject1.getUsed());
146 |
147 | final SATObject satObject2 = skyObject.getSatellites().get(1);
148 | Assert.assertEquals(10, satObject2.getPRN());
149 | Assert.assertEquals(0, satObject2.getGnssId());
150 | Assert.assertEquals(303.0, satObject2.getAzimuth(), 0.0);
151 | Assert.assertEquals(14.0, satObject2.getElevation(), 0.0);
152 | Assert.assertEquals(48.0, satObject2.getSignalStrength(), 0.0);
153 | Assert.assertTrue(satObject2.getUsed());
154 | }
155 |
156 | @Test
157 | public void testTpvObject() {
158 |
159 | final JSONObject json = new JSONObject();
160 | json.put("tag", "tag");
161 | json.put("alt", 136.054);
162 | json.put("epv", 0.835);
163 | json.put("device", "/dev/ttyUSB0");
164 | json.put("time", "2025-02-11T08:39:29.000Z");
165 | json.put("ept", 0.005);
166 | json.put("lat", 42.7045841);
167 | json.put("lon", 12.1588884);
168 | json.put("alt", 136.054);
169 | json.put("epx", 1.411);
170 | json.put("epy", 1.822);
171 | json.put("epv", 0.835);
172 | json.put("track", 144.6175);
173 | json.put("speed", 22.693);
174 | json.put("climb", 0.023);
175 | json.put("epd", 9.1852);
176 | json.put("eps", 3.51);
177 | json.put("epc", 1.68);
178 | json.put("mode", 3);
179 |
180 | final TPVObject tpvObject = (TPVObject) this.resultParser.parseTPV(json);
181 | Assert.assertEquals(136.054, tpvObject.getAltitude(), 0);
182 | Assert.assertEquals(0.835, tpvObject.getAltitudeError(), 0);
183 | Assert.assertEquals(0.023, tpvObject.getClimbRate(), 0);
184 | Assert.assertEquals(1.68, tpvObject.getClimbRateError(), 0);
185 | Assert.assertEquals(144.6175, tpvObject.getCourse(), 0);
186 | Assert.assertEquals(9.1852, tpvObject.getCourseError(), 0);
187 | Assert.assertEquals("/dev/ttyUSB0", tpvObject.getDevice());
188 | Assert.assertEquals(42.7045841, tpvObject.getLatitude(), 0);
189 | Assert.assertEquals(1.822, tpvObject.getLatitudeError(), 0);
190 | Assert.assertEquals(12.1588884, tpvObject.getLongitude(), 0);
191 | Assert.assertEquals(1.411, tpvObject.getLongitudeError(), 0);
192 | Assert.assertEquals(ENMEAMode.ThreeDimensional, tpvObject.getMode());
193 | Assert.assertEquals(22.693, tpvObject.getSpeed(), 0);
194 | Assert.assertEquals(3.51, tpvObject.getSpeedError(), 0);
195 | Assert.assertEquals("tag", tpvObject.getTag());
196 | Assert.assertEquals(1739263169.0, tpvObject.getTimestamp(), 0);
197 | Assert.assertEquals(0.005, tpvObject.getTimestampError(), 0);
198 | }
199 | }
200 |
--------------------------------------------------------------------------------
/src/test/java/de/taimos/gpsd4java/test/Tester.java:
--------------------------------------------------------------------------------
1 | package de.taimos.gpsd4java.test;
2 |
3 | /*
4 | * #%L
5 | * GPSd4Java
6 | * %%
7 | * Copyright (C) 2011 - 2012 Taimos GmbH
8 | * %%
9 | * Licensed under the Apache License, Version 2.0 (the "License");
10 | * you may not use this file except in compliance with the License.
11 | * You may obtain a copy of the License at
12 | *
13 | * http://www.apache.org/licenses/LICENSE-2.0
14 | *
15 | * Unless required by applicable law or agreed to in writing, software
16 | * distributed under the License is distributed on an "AS IS" BASIS,
17 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 | * See the License for the specific language governing permissions and
19 | * limitations under the License.
20 | * #L%
21 | */
22 |
23 | import de.taimos.gpsd4java.api.ObjectListener;
24 | import de.taimos.gpsd4java.backend.GPSdEndpoint;
25 | import de.taimos.gpsd4java.backend.ResultParser;
26 | import de.taimos.gpsd4java.types.ATTObject;
27 | import de.taimos.gpsd4java.types.DeviceObject;
28 | import de.taimos.gpsd4java.types.DevicesObject;
29 | import de.taimos.gpsd4java.types.SATObject;
30 | import de.taimos.gpsd4java.types.SKYObject;
31 | import de.taimos.gpsd4java.types.TPVObject;
32 | import de.taimos.gpsd4java.types.subframes.SUBFRAMEObject;
33 | import org.slf4j.Logger;
34 | import org.slf4j.LoggerFactory;
35 |
36 | /**
37 | * This class provides tests during the startup phase of GPSd4Java
38 | * It will later be replaced by JUnit Tests
39 | *
40 | *