Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit fed53d1

Browse files
committed
enable listener
1 parent 528f38c commit fed53d1

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

src/test/java/de/taimos/gpsd4java/test/Tester.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* you may not use this file except in compliance with the License.
1111
* You may obtain a copy of the License at
1212
*
13-
* http://www.apache.org/licenses/LICENSE-2.0
13+
* http://www.apache.org/licenses/LICENSE-2.0
1414
*
1515
* Unless required by applicable law or agreed to in writing, software
1616
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -42,12 +42,13 @@
4242
*
4343
*/
4444
public class Tester {
45-
45+
4646
static final Logger log = Logger.getLogger(Tester.class.getName());
47-
47+
48+
4849
private Tester() {
4950
}
50-
51+
5152
/**
5253
* @param args
5354
* the args
@@ -56,7 +57,7 @@ public static void main(final String[] args) {
5657
try {
5758
String host = "localhost";
5859
int port = 2947;
59-
60+
6061
switch (args.length) {
6162
case 0:
6263
// Nothing to do, use default
@@ -75,55 +76,55 @@ public static void main(final String[] args) {
7576
default:
7677
break;
7778
}
78-
79+
7980
final GPSdEndpoint ep = new GPSdEndpoint(host, port, new ResultParser());
80-
81+
8182
ep.addListener(new ObjectListener() {
82-
83+
8384
@Override
8485
public void handleTPV(final TPVObject tpv) {
8586
Tester.log.log(Level.INFO, "TPV: {0}", tpv);
8687
}
87-
88+
8889
@Override
8990
public void handleSKY(final SKYObject sky) {
9091
Tester.log.log(Level.INFO, "SKY: {0}", sky);
9192
for (final SATObject sat : sky.getSatellites()) {
9293
Tester.log.log(Level.INFO, " SAT: {0}", sat);
9394
}
9495
}
95-
96+
9697
@Override
9798
public void handleSUBFRAME(final SUBFRAMEObject subframe) {
9899
Tester.log.log(Level.INFO, "SUBFRAME: {0}", subframe);
99100
}
100-
101+
101102
@Override
102103
public void handleATT(final ATTObject att) {
103104
Tester.log.log(Level.INFO, "ATT: {0}", att);
104105
}
105-
106+
106107
@Override
107108
public void handleDevice(final DeviceObject device) {
108109
Tester.log.log(Level.INFO, "Device: {0}", device);
109110
}
110-
111+
111112
@Override
112113
public void handleDevices(final DevicesObject devices) {
113114
for (final DeviceObject d : devices.getDevices()) {
114115
Tester.log.log(Level.INFO, "Device: {0}", d);
115116
}
116117
}
117118
});
118-
119+
119120
ep.start();
120-
121+
121122
Tester.log.log(Level.INFO, "Version: {0}", ep.version());
122-
123-
Tester.log.log(Level.INFO, "Watch: {0}", ep.watch(true, false));
124-
123+
124+
Tester.log.log(Level.INFO, "Watch: {0}", ep.watch(true, true));
125+
125126
Tester.log.log(Level.INFO, "Poll: {0}", ep.poll());
126-
127+
127128
Thread.sleep(60000);
128129
} catch (final Exception e) {
129130
Tester.log.log(Level.SEVERE, null, e);

0 commit comments

Comments
 (0)