aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-11-19 08:26:10 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2015-11-19 08:26:10 +1300
commit9b2b2da4d0568a50298cedfb07329f3eedb15d46 (patch)
tree872e5b7e1ec6b65f953b4e8636441fbd4d586bf2 /src/org/traccar
parenta7f7df0ebdf56a6dbaa5a17600c05c5b6d3033a4 (diff)
downloadtraccar-server-9b2b2da4d0568a50298cedfb07329f3eedb15d46.tar.gz
traccar-server-9b2b2da4d0568a50298cedfb07329f3eedb15d46.tar.bz2
traccar-server-9b2b2da4d0568a50298cedfb07329f3eedb15d46.zip
Check for missing LBS information
Diffstat (limited to 'src/org/traccar')
-rw-r--r--src/org/traccar/location/BaseLocationProvider.java15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/org/traccar/location/BaseLocationProvider.java b/src/org/traccar/location/BaseLocationProvider.java
index d6eddc1cd..c422ed50a 100644
--- a/src/org/traccar/location/BaseLocationProvider.java
+++ b/src/org/traccar/location/BaseLocationProvider.java
@@ -15,6 +15,7 @@
*/
package org.traccar.location;
+import org.traccar.Config;
import org.traccar.Context;
import org.traccar.model.Event;
@@ -25,20 +26,24 @@ public abstract class BaseLocationProvider implements LocationProvider {
@Override
public void getLocation(Map<String, Object> attributes, LocationProviderCallback callback) {
+ Config config = Context.getConfig();
+
Number mcc = (Number) attributes.get(Event.KEY_MCC);
- if (mcc == null) {
- mcc = Context.getConfig().getInteger("location.mcc");
+ if (mcc == null && config.hasKey("location.mcc")) {
+ mcc = config.getInteger("location.mcc");
}
Number mnc = (Number) attributes.get(Event.KEY_MNC);
- if (mnc == null) {
- mnc = Context.getConfig().getInteger("location.mnc");
+ if (mnc == null && config.hasKey("location.mnc")) {
+ mnc = config.getInteger("location.mnc");
}
Number lac = (Number) attributes.get(Event.KEY_LAC);
Number cid = (Number) attributes.get(Event.KEY_CID);
- getLocation(mcc.intValue(), mnc.intValue(), lac.longValue(), cid.longValue(), callback);
+ if (mcc != null && mnc != null && lac != null && cid != null) {
+ getLocation(mcc.intValue(), mnc.intValue(), lac.longValue(), cid.longValue(), callback);
+ }
}