File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed
src/main/java/de/taimos/gpsd4java/backend Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,16 @@ public void start() {
122122 */
123123 public void stop () {
124124 try {
125- this .listenThread .halt ();
125+ socket .close ();
126+ } catch (final IOException e1 ) {
127+ GPSdEndpoint .LOG .debug ("Close forced: " + e1 .getMessage ());
128+ }
129+
130+ try {
131+ this .listeners .clear ();
132+ if (listenThread != null ) {
133+ this .listenThread .halt ();
134+ }
126135 } catch (final Exception e ) {
127136 GPSdEndpoint .LOG .debug ("Interrupted while waiting for listenThread to stop" , e );
128137 }
@@ -295,4 +304,20 @@ void handle(final IGPSObject object) {
295304 }
296305 }
297306 }
307+
308+ /**
309+ * Attempt to kick a failed device back into life on gpsd server.
310+ *
311+ * @see https://lists.gnu.org/archive/html/gpsd-dev/2015-06/msg00001.html
312+ *
313+ * @param path Path of device known to gpsd
314+ * @throws IOException
315+ * @throws JSONException
316+ */
317+ public void kickDevice (String path ) throws IOException , JSONException {
318+ final JSONObject d = new JSONObject ();
319+ d .put ("class" , "DEVICE" );
320+ d .put ("path" , path );
321+ voidCommand ("?DEVICE=" +d );
322+ }
298323}
You can’t perform that action at this time.
0 commit comments