Changeset 33739 in osm for applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java
- Timestamp:
- 2017-10-28T16:44:03+02:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java
r33419 r33739 22 22 23 23 import org.openstreetmap.josm.Main; 24 import org.openstreetmap.josm.tools.Logging; 24 25 25 26 public class LiveGpsAcquirer implements Runnable { … … 47 48 48 49 gpsdHost = Main.pref.get(C_HOST, DEFAULT_HOST); 49 gpsdPort = Main.pref.getInt eger(C_PORT, DEFAULT_PORT);50 gpsdPort = Main.pref.getInt(C_PORT, DEFAULT_PORT); 50 51 // put the settings back in to the preferences, makes keys appear. 51 52 Main.pref.put(C_HOST, gpsdHost); 52 Main.pref.putInt eger(C_PORT, gpsdPort);53 Main.pref.putInt(C_PORT, gpsdPort); 53 54 } 54 55 … … 133 134 Thread.sleep(1000); 134 135 } catch (InterruptedException ignore) { 135 Main.trace(ignore);136 Logging.trace(ignore); 136 137 } 137 138 } … … 162 163 oldGpsData = gpsData; 163 164 } catch (IOException iox) { 164 Main.warn(iox, "LiveGps: lost connection to gpsd");165 Logging.log(Logging.LEVEL_WARN, "LiveGps: lost connection to gpsd", iox); 165 166 fireGpsStatusChangeEvent( 166 167 LiveGpsStatus.GpsStatus.CONNECTION_FAILED, … … 170 171 Thread.sleep(1000); 171 172 } catch (InterruptedException ignore) { 172 Main.trace(ignore);173 Logging.trace(ignore); 173 174 } 174 175 // send warning to layer … … 176 177 } 177 178 178 Main.info("LiveGps: Disconnected from gpsd");179 Logging.info("LiveGps: Disconnected from gpsd"); 179 180 fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.DISCONNECTED, 180 181 tr("Not connected")); … … 190 191 String line, type, release; 191 192 192 Main.info("LiveGps: trying to connect to gpsd at " + gpsdHost + ":" + gpsdPort);193 Logging.info("LiveGps: trying to connect to gpsd at " + gpsdHost + ":" + gpsdPort); 193 194 fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting")); 194 195 … … 199 200 break; 200 201 } catch (IOException e) { 201 Main.warn("LiveGps: Could not open connection to gpsd: " + e);202 Logging.warn("LiveGps: Could not open connection to gpsd: " + e); 202 203 gpsdSocket = null; 203 204 } … … 222 223 if (type.equals("VERSION")) { 223 224 release = greeting.getString("release"); 224 Main.info("LiveGps: Connected to gpsd " + release);225 Logging.info("LiveGps: Connected to gpsd " + release); 225 226 } else 226 Main.info("LiveGps: Unexpected JSON in gpsd greeting: " + line);227 Logging.info("LiveGps: Unexpected JSON in gpsd greeting: " + line); 227 228 } catch (JsonException jex) { 228 229 if (line.startsWith("GPSD,")) { 229 230 connected = true; 230 231 JSONProtocol = false; 231 Main.info("LiveGps: Connected to old gpsd protocol version.");232 Logging.info("LiveGps: Connected to old gpsd protocol version."); 232 233 fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTED, tr("Connected")); 233 234 } … … 257 258 gpsdSocket = null; 258 259 } catch (Exception e) { 259 Main.warn("LiveGps: Unable to close socket; reconnection may not be possible");260 Logging.warn("LiveGps: Unable to close socket; reconnection may not be possible"); 260 261 } 261 262 } … … 272 273 report = Json.createReader(new StringReader(line)).readObject(); 273 274 } catch (JsonException jex) { 274 Main.warn("LiveGps: line read from gpsd is not a JSON object:" + line);275 Logging.warn("LiveGps: line read from gpsd is not a JSON object:" + line); 275 276 return null; 276 277 } … … 332 333 course = Float.parseFloat(status[8]); 333 334 } catch (NumberFormatException nex) { 334 Main.debug(nex);335 Logging.debug(nex); 335 336 } 336 337 return new LiveGpsData(lat, lon, course, speed);
Note:
See TracChangeset
for help on using the changeset viewer.