Ignore:
Timestamp:
2017-10-28T16:44:03+02:00 (8 years ago)
Author:
donvip
Message:

update to JOSM 12987

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/livegps/src/livegps/LiveGpsAcquirer.java

    r33419 r33739  
    2222
    2323import org.openstreetmap.josm.Main;
     24import org.openstreetmap.josm.tools.Logging;
    2425
    2526public class LiveGpsAcquirer implements Runnable {
     
    4748
    4849        gpsdHost = Main.pref.get(C_HOST, DEFAULT_HOST);
    49         gpsdPort = Main.pref.getInteger(C_PORT, DEFAULT_PORT);
     50        gpsdPort = Main.pref.getInt(C_PORT, DEFAULT_PORT);
    5051        // put the settings back in to the preferences, makes keys appear.
    5152        Main.pref.put(C_HOST, gpsdHost);
    52         Main.pref.putInteger(C_PORT, gpsdPort);
     53        Main.pref.putInt(C_PORT, gpsdPort);
    5354    }
    5455
     
    133134                        Thread.sleep(1000);
    134135                    } catch (InterruptedException ignore) {
    135                         Main.trace(ignore);
     136                        Logging.trace(ignore);
    136137                    }
    137138                }
     
    162163                oldGpsData = gpsData;
    163164            } catch (IOException iox) {
    164                 Main.warn(iox, "LiveGps: lost connection to gpsd");
     165                Logging.log(Logging.LEVEL_WARN, "LiveGps: lost connection to gpsd", iox);
    165166                fireGpsStatusChangeEvent(
    166167                        LiveGpsStatus.GpsStatus.CONNECTION_FAILED,
     
    170171                    Thread.sleep(1000);
    171172                } catch (InterruptedException ignore) {
    172                     Main.trace(ignore);
     173                    Logging.trace(ignore);
    173174                }
    174175                // send warning to layer
     
    176177        }
    177178
    178         Main.info("LiveGps: Disconnected from gpsd");
     179        Logging.info("LiveGps: Disconnected from gpsd");
    179180        fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.DISCONNECTED,
    180181                tr("Not connected"));
     
    190191        String line, type, release;
    191192
    192         Main.info("LiveGps: trying to connect to gpsd at " + gpsdHost + ":" + gpsdPort);
     193        Logging.info("LiveGps: trying to connect to gpsd at " + gpsdHost + ":" + gpsdPort);
    193194        fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTING, tr("Connecting"));
    194195
     
    199200                break;
    200201            } 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);
    202203                gpsdSocket = null;
    203204            }
     
    222223            if (type.equals("VERSION")) {
    223224                release = greeting.getString("release");
    224                 Main.info("LiveGps: Connected to gpsd " + release);
     225                Logging.info("LiveGps: Connected to gpsd " + release);
    225226            } else
    226                 Main.info("LiveGps: Unexpected JSON in gpsd greeting: " + line);
     227                Logging.info("LiveGps: Unexpected JSON in gpsd greeting: " + line);
    227228        } catch (JsonException jex) {
    228229            if (line.startsWith("GPSD,")) {
    229230                connected = true;
    230231                JSONProtocol = false;
    231                 Main.info("LiveGps: Connected to old gpsd protocol version.");
     232                Logging.info("LiveGps: Connected to old gpsd protocol version.");
    232233                fireGpsStatusChangeEvent(LiveGpsStatus.GpsStatus.CONNECTED, tr("Connected"));
    233234            }
     
    257258            gpsdSocket = null;
    258259        } 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");
    260261        }
    261262    }
     
    272273            report = Json.createReader(new StringReader(line)).readObject();
    273274        } 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);
    275276            return null;
    276277        }
     
    332333                        course = Float.parseFloat(status[8]);
    333334                    } catch (NumberFormatException nex) {
    334                         Main.debug(nex);
     335                        Logging.debug(nex);
    335336                    }
    336337                    return new LiveGpsData(lat, lon, course, speed);
Note: See TracChangeset for help on using the changeset viewer.