aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-07-13 22:44:40 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-07-13 22:44:40 +1200
commit3eec82b5db78e8b9418230a368138fb7b14d4b3b (patch)
tree1f1db129b3db577c03a7bf60bf5f18acba058d85
parentabb2f8614b7fbc25892e277b55fa216c7d81fd54 (diff)
downloadtraccar-server-3eec82b5db78e8b9418230a368138fb7b14d4b3b.tar.gz
traccar-server-3eec82b5db78e8b9418230a368138fb7b14d4b3b.tar.bz2
traccar-server-3eec82b5db78e8b9418230a368138fb7b14d4b3b.zip
Use java binary literals
-rw-r--r--src/org/traccar/protocol/Gt06ProtocolDecoder.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
index 06c3985dc..3bbe87e36 100644
--- a/src/org/traccar/protocol/Gt06ProtocolDecoder.java
+++ b/src/org/traccar/protocol/Gt06ProtocolDecoder.java
@@ -156,7 +156,7 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
// GPS length and Satellites count
int gpsLength = buf.readUnsignedByte();
- position.set(Event.KEY_SATELLITES, gpsLength & 0xf);
+ position.set(Event.KEY_SATELLITES, gpsLength & 0b0000_1111);
gpsLength >>= 4;
// Latitude
@@ -170,16 +170,16 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder {
// Course and flags
int union = buf.readUnsignedShort();
- position.setCourse(union & 0x03FF);
- position.setValid((union & 0x1000) != 0);
- if ((union & 0x0400) == 0) latitude = -latitude;
- if ((union & 0x0800) != 0) longitude = -longitude;
+ position.setCourse(union & 0b0000_0011_1111_1111);
+ position.setValid((union & 0b0001_0000_0000_0000) != 0);
+ if ((union & 0b0000_0100_0000_0000) == 0) latitude = -latitude;
+ if ((union & 0b0000_1000_0000_0000) != 0) longitude = -longitude;
position.setLatitude(latitude);
position.setLongitude(longitude);
- if ((union & 0x4000) != 0) {
- position.set("acc", (union & 0x8000) != 0);
+ if ((union & 0b0100_0000_0000_0000) != 0) {
+ position.set("acc", (union & 0b1000_0000_0000_0000) != 0);
}
buf.skipBytes(gpsLength - 12); // skip reserved