Changeset 6709 in osm for applications/editors/josm/plugins/livegps/livegps/LiveGpsAcquirer.java
- Timestamp:
- 2008-01-29T19:15:15+01:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/livegps/livegps/LiveGpsAcquirer.java
r6417 r6709 5 5 import java.beans.PropertyChangeListener; 6 6 import java.io.BufferedReader; 7 import java.io.FileInputStream; 8 import java.io.FileNotFoundException; 7 9 import java.io.IOException; 8 10 import java.io.InputStreamReader; … … 11 13 import java.util.ArrayList; 12 14 import java.util.List; 15 import java.util.Properties; 13 16 14 17 import org.openstreetmap.josm.data.coor.LatLon; … … 20 23 String gpsdHost = "localhost"; 21 24 int gpsdPort = 2947; 25 String configFile = "liveGPS.conf"; 22 26 boolean shutdownFlag = false; 23 27 private List<PropertyChangeListener> propertyChangeListener = new ArrayList<PropertyChangeListener>(); … … 25 29 private PropertyChangeEvent lastDataEvent; 26 30 27 public LiveGpsAcquirer() { 31 public LiveGpsAcquirer(String pluginDir) { 32 33 Properties liveGPSconfig = new Properties(); 34 35 FileInputStream fis = null; 36 37 try { 38 fis = new FileInputStream(pluginDir + configFile); 39 } catch (FileNotFoundException e) { 40 System.err.println("No liveGPS.conf found, using defaults"); 41 } 42 43 if(fis != null) 44 { 45 try { 46 liveGPSconfig.load(fis); 47 this.gpsdHost = liveGPSconfig.getProperty("host"); 48 this.gpsdPort = Integer.parseInt(liveGPSconfig.getProperty("port")); 49 50 } catch (IOException e) { 51 System.err.println("Error while loading liveGPS.conf, using defaults"); 52 } 53 54 if(this.gpsdHost == null || this.gpsdPort == 0) 55 { 56 System.err.println("Error in liveGPS.conf, using defaults"); 57 this.gpsdHost = "localhost"; 58 this.gpsdPort = 2947; 59 } 60 } 28 61 29 62 }
Note:
See TracChangeset
for help on using the changeset viewer.