From 8030d39ca0522bc8be69e017fa9fc06900d1a7bc Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 14 Aug 2016 16:41:04 +0300 Subject: Use lower camel-case for attributes --- src/org/traccar/helper/ObdDecoder.java | 8 ++--- src/org/traccar/model/Position.java | 5 ++- .../traccar/protocol/AplicomProtocolDecoder.java | 38 +++++++++++----------- src/org/traccar/protocol/FoxProtocolDecoder.java | 2 +- src/org/traccar/protocol/Gl200ProtocolDecoder.java | 10 +++--- .../traccar/protocol/MeitrackProtocolDecoder.java | 2 +- src/org/traccar/protocol/TzoneProtocolDecoder.java | 4 +-- .../traccar/protocol/UlbotechProtocolDecoder.java | 24 +++++++------- 8 files changed, 46 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/org/traccar/helper/ObdDecoder.java b/src/org/traccar/helper/ObdDecoder.java index a98408e05..4686aa682 100644 --- a/src/org/traccar/helper/ObdDecoder.java +++ b/src/org/traccar/helper/ObdDecoder.java @@ -82,9 +82,9 @@ public final class ObdDecoder { int intValue = Integer.parseInt(value, 16); switch (pid) { case PID_ENGINE_LOAD: - return createEntry("engine-load", intValue * 100 / 255); + return createEntry("engineLoad", intValue * 100 / 255); case PID_COOLANT_TEMPERATURE: - return createEntry("coolant-temperature", intValue - 40); + return createEntry("coolantTemperature", intValue - 40); case PID_ENGINE_RPM: return createEntry(Position.KEY_RPM, intValue / 4); case PID_VEHICLE_SPEED: @@ -92,11 +92,11 @@ public final class ObdDecoder { case PID_THROTTLE_POSITION: return createEntry("throttle", intValue * 100 / 255); case PID_MIL_DISTANCE: - return createEntry("mil-distance", intValue); + return createEntry("milDistance", intValue); case PID_FUEL_LEVEL: return createEntry(Position.KEY_FUEL, intValue * 100 / 255); case PID_DISTANCE_CLEARED: - return createEntry("cleared-distance", intValue); + return createEntry("clearedDistance", intValue); default: return null; } diff --git a/src/org/traccar/model/Position.java b/src/org/traccar/model/Position.java index 680a6ae8f..9f8a9692d 100644 --- a/src/org/traccar/model/Position.java +++ b/src/org/traccar/model/Position.java @@ -19,7 +19,6 @@ import java.util.Date; public class Position extends Message { - // Words separated by dashes (word-second-third) public static final String KEY_ORIGINAL = "raw"; public static final String KEY_INDEX = "index"; public static final String KEY_HDOP = "hdop"; @@ -57,8 +56,8 @@ public class Position extends Message { public static final String KEY_MOTION = "motion"; public static final String KEY_ARMED = "armed"; - public static final String KEY_OBD_SPEED = "obd-speed"; - public static final String KEY_OBD_ODOMETER = "obd-odometer"; + public static final String KEY_OBD_SPEED = "obdSpeed"; + public static final String KEY_OBD_ODOMETER = "obdOdometer"; public static final String KEY_RESULT = "result"; diff --git a/src/org/traccar/protocol/AplicomProtocolDecoder.java b/src/org/traccar/protocol/AplicomProtocolDecoder.java index ff5a1aa20..23397b51c 100644 --- a/src/org/traccar/protocol/AplicomProtocolDecoder.java +++ b/src/org/traccar/protocol/AplicomProtocolDecoder.java @@ -133,52 +133,52 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { switch (buf.readInt()) { case 0x20D: position.set(Position.KEY_RPM, ChannelBuffers.swapShort(value.readShort())); - position.set("diesel-temperature", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("battery-voltage", ChannelBuffers.swapShort(value.readShort()) * 0.01); - position.set("supply-air-temp-dep1", ChannelBuffers.swapShort(value.readShort()) * 0.1); + position.set("dieselTemperature", ChannelBuffers.swapShort(value.readShort()) * 0.1); + position.set("batteryVoltage", ChannelBuffers.swapShort(value.readShort()) * 0.01); + position.set("supplyAirTempDep1", ChannelBuffers.swapShort(value.readShort()) * 0.1); break; case 0x30D: - position.set("active-alarm", ChannelBuffers.hexDump(value)); + position.set("activeAlarm", ChannelBuffers.hexDump(value)); break; case 0x40C: - position.set("air-temp-dep1", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("air-temp-dep2", ChannelBuffers.swapShort(value.readShort()) * 0.1); + position.set("airTempDep1", ChannelBuffers.swapShort(value.readShort()) * 0.1); + position.set("airTempDep2", ChannelBuffers.swapShort(value.readShort()) * 0.1); break; case 0x40D: - position.set("cold-unit-state", ChannelBuffers.hexDump(value)); + position.set("coldUnitState", ChannelBuffers.hexDump(value)); break; case 0x50C: - position.set("defrost-temp-dep1", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("defrost-temp-dep2", ChannelBuffers.swapShort(value.readShort()) * 0.1); + position.set("defrostTempDep1", ChannelBuffers.swapShort(value.readShort()) * 0.1); + position.set("defrostTempDep2", ChannelBuffers.swapShort(value.readShort()) * 0.1); break; case 0x50D: - position.set("condenser-pressure", ChannelBuffers.swapShort(value.readShort()) * 0.1); - position.set("suction-pressure", ChannelBuffers.swapShort(value.readShort()) * 0.1); + position.set("condenserPressure", ChannelBuffers.swapShort(value.readShort()) * 0.1); + position.set("suctionPressure", ChannelBuffers.swapShort(value.readShort()) * 0.1); break; case 0x58C: value.readByte(); value.readShort(); // index switch (value.readByte()) { case 0x01: - position.set("setpoint-zone1", ChannelBuffers.swapInt(value.readInt()) * 0.1); + position.set("setpointZone1", ChannelBuffers.swapInt(value.readInt()) * 0.1); break; case 0x02: - position.set("setpoint-zone2", ChannelBuffers.swapInt(value.readInt()) * 0.1); + position.set("setpointZone2", ChannelBuffers.swapInt(value.readInt()) * 0.1); break; case 0x05: - position.set("unit-type", ChannelBuffers.swapInt(value.readInt())); + position.set("unitType", ChannelBuffers.swapInt(value.readInt())); break; case 0x13: - position.set("diesel-hours", ChannelBuffers.swapInt(value.readInt()) / 60 / 60); + position.set("dieselHours", ChannelBuffers.swapInt(value.readInt()) / 60 / 60); break; case 0x14: - position.set("electric-hours", ChannelBuffers.swapInt(value.readInt()) / 60 / 60); + position.set("electricHours", ChannelBuffers.swapInt(value.readInt()) / 60 / 60); break; case 0x17: - position.set("service-indicator", ChannelBuffers.swapInt(value.readInt())); + position.set("serviceIndicator", ChannelBuffers.swapInt(value.readInt())); break; case 0x18: - position.set("software-version", ChannelBuffers.swapInt(value.readInt()) * 0.01); + position.set("softwareVersion", ChannelBuffers.swapInt(value.readInt()) * 0.01); break; default: break; @@ -223,7 +223,7 @@ public class AplicomProtocolDecoder extends BaseProtocolDecoder { int event = buf.readUnsignedByte(); position.set(Position.KEY_EVENT, event); - position.set("event-info", buf.readUnsignedByte()); + position.set("eventInfo", buf.readUnsignedByte()); if ((selector & 0x0008) != 0) { position.setValid((buf.readUnsignedByte() & 0x40) != 0); diff --git a/src/org/traccar/protocol/FoxProtocolDecoder.java b/src/org/traccar/protocol/FoxProtocolDecoder.java index fa14e7029..0a47f7ed1 100644 --- a/src/org/traccar/protocol/FoxProtocolDecoder.java +++ b/src/org/traccar/protocol/FoxProtocolDecoder.java @@ -117,7 +117,7 @@ public class FoxProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_OUTPUT, parser.nextInt(2)); position.set(Position.KEY_ODOMETER, parser.nextInt()); - position.set("status-data", parser.next()); + position.set("statusData", parser.next()); return position; diff --git a/src/org/traccar/protocol/Gl200ProtocolDecoder.java b/src/org/traccar/protocol/Gl200ProtocolDecoder.java index 670b9fa96..cadc188d6 100644 --- a/src/org/traccar/protocol/Gl200ProtocolDecoder.java +++ b/src/org/traccar/protocol/Gl200ProtocolDecoder.java @@ -329,11 +329,11 @@ public class Gl200ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_RPM, parser.next()); position.set(Position.KEY_OBD_SPEED, parser.next()); position.set(Position.PREFIX_TEMP + 1, parser.next()); - position.set("fuel-consumption", parser.next()); - position.set("dtcs-cleared-distance", parser.next()); - position.set("odb-connect", parser.next()); - position.set("dtcs-number", parser.next()); - position.set("dtcs-codes", parser.next()); + position.set("fuelConsumption", parser.next()); + position.set("dtcsClearedDistance", parser.next()); + position.set("odbConnect", parser.next()); + position.set("dtcsNumber", parser.next()); + position.set("dtcsCodes", parser.next()); position.set(Position.KEY_THROTTLE, parser.next()); position.set(Position.KEY_FUEL, parser.next()); position.set(Position.KEY_OBD_ODOMETER, parser.next()); diff --git a/src/org/traccar/protocol/MeitrackProtocolDecoder.java b/src/org/traccar/protocol/MeitrackProtocolDecoder.java index 81b6b8f76..f2208984c 100644 --- a/src/org/traccar/protocol/MeitrackProtocolDecoder.java +++ b/src/org/traccar/protocol/MeitrackProtocolDecoder.java @@ -146,7 +146,7 @@ public class MeitrackProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_RFID, eventData); break; default: - position.set("event-data", eventData); + position.set("eventData", eventData); break; } } diff --git a/src/org/traccar/protocol/TzoneProtocolDecoder.java b/src/org/traccar/protocol/TzoneProtocolDecoder.java index be4919dc2..9caf77b0c 100644 --- a/src/org/traccar/protocol/TzoneProtocolDecoder.java +++ b/src/org/traccar/protocol/TzoneProtocolDecoder.java @@ -174,8 +174,8 @@ public class TzoneProtocolDecoder extends BaseProtocolDecoder { if (blockLength > 0) { - position.set("passengers-on", buf.readUnsignedMedium()); - position.set("passengers-off", buf.readUnsignedMedium()); + position.set("passengersOn", buf.readUnsignedMedium()); + position.set("passengersOff", buf.readUnsignedMedium()); } diff --git a/src/org/traccar/protocol/UlbotechProtocolDecoder.java b/src/org/traccar/protocol/UlbotechProtocolDecoder.java index 36fb23f9a..d97e8b339 100644 --- a/src/org/traccar/protocol/UlbotechProtocolDecoder.java +++ b/src/org/traccar/protocol/UlbotechProtocolDecoder.java @@ -90,28 +90,28 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { int value = buf.readUnsignedByte(); if (BitUtil.check(value, 0)) { - position.set("rapid-acceleration", true); + position.set("rapidAcceleration", true); } if (BitUtil.check(value, 1)) { - position.set("rough-braking", true); + position.set("roughBraking", true); } if (BitUtil.check(value, 2)) { - position.set("harsh-course", true); + position.set("harshCourse", true); } if (BitUtil.check(value, 3)) { - position.set("no-warm-up", true); + position.set("noWarmUp", true); } if (BitUtil.check(value, 4)) { - position.set("long-idle", true); + position.set("longIdle", true); } if (BitUtil.check(value, 5)) { - position.set("fatigue-driving", true); + position.set("fatigueDriving", true); } if (BitUtil.check(value, 6)) { - position.set("rough-terrain", true); + position.set("roughTerrain", true); } if (BitUtil.check(value, 7)) { - position.set("high-rpm", true); + position.set("highRpm", true); } } @@ -215,8 +215,8 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { break; case DATA_GEOFENCE: - position.set("geofence-in", buf.readUnsignedInt()); - position.set("geofence-alarm", buf.readUnsignedInt()); + position.set("geofenceIn", buf.readUnsignedInt()); + position.set("geofenceAlarm", buf.readUnsignedInt()); break; case DATA_OBD2: @@ -224,7 +224,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { break; case DATA_FUEL: - position.set("fuel-consumption", buf.readUnsignedInt() / 10000.0); + position.set("fuelConsumption", buf.readUnsignedInt() / 10000.0); break; case DATA_OBD2_ALARM: @@ -255,7 +255,7 @@ public class UlbotechProtocolDecoder extends BaseProtocolDecoder { case DATA_EVENT: position.set(Position.KEY_EVENT, buf.readUnsignedByte()); if (length > 1) { - position.set("event-mask", buf.readUnsignedInt()); + position.set("eventMask", buf.readUnsignedInt()); } break; -- cgit v1.2.3