diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2011-06-16 07:56:59 +0000 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2011-06-16 07:56:59 +0000 |
commit | 7bc80dc78894b2cbe241fcaea2838673150fcef1 (patch) | |
tree | dd5893fb7325f2e3966297dc60c01ca99e103f47 | |
parent | dcbaac71303e606662c8274d5b936fd8323a01b0 (diff) | |
download | trackermap-server-7bc80dc78894b2cbe241fcaea2838673150fcef1.tar.gz trackermap-server-7bc80dc78894b2cbe241fcaea2838673150fcef1.tar.bz2 trackermap-server-7bc80dc78894b2cbe241fcaea2838673150fcef1.zip |
5 files changed, 22 insertions, 87 deletions
diff --git a/src/net/sourceforge/opentracking/TrackerEventHandler.java b/src/net/sourceforge/opentracking/TrackerEventHandler.java index 28a8c8fad..18a15480f 100644 --- a/src/net/sourceforge/opentracking/TrackerEventHandler.java +++ b/src/net/sourceforge/opentracking/TrackerEventHandler.java @@ -43,16 +43,20 @@ public class TrackerEventHandler extends SimpleChannelHandler { if (e.getMessage() instanceof Position) { Position position = (Position) e.getMessage(); - - System.out.println( - "id: " + position.getId() + - ", deviceId: " + position.getDeviceId() + - ", valid: " + position.getValid() + - ", time: " + position.getTime() + - ", latitude: " + position.getLatitude() + - ", longitude: " + position.getLongitude() + - ", speed: " + position.getSpeed() + - ", course: " + position.getCourse()); + + if (position == null) { + System.out.println("null message"); + } else { + System.out.println( + "id: " + position.getId() + + ", deviceId: " + position.getDeviceId() + + ", valid: " + position.getValid() + + ", time: " + position.getTime() + + ", latitude: " + position.getLatitude() + + ", longitude: " + position.getLongitude() + + ", speed: " + position.getSpeed() + + ", course: " + position.getCourse()); + } // Write position to database try { diff --git a/src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java b/src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java index 30fdcb06f..92d54b551 100644 --- a/src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java +++ b/src/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoder.java @@ -80,10 +80,15 @@ public class Gps103ProtocolDecoder extends OneToOneDecoder { String sentence = (String) msg; - // Send response + // Send response #1 if (sentence.contains("##")) { channel.write("LOAD"); } + + // Send response #2 + if (sentence.length() == 15 && Character.isDigit(sentence.charAt(0))) { + channel.write("ON"); + } // Parse message Matcher parser = pattern.matcher(sentence); diff --git a/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java b/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java index 895cbb534..9e958b23a 100644 --- a/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java +++ b/test/net/sourceforge/opentracking/protocol/gps103/Gps103ProtocolDecoderTest.java @@ -42,7 +42,8 @@ public class Gps103ProtocolDecoderTest { // NEW MESSAGE: imei:359587017470280,tracker,0000000000,03184511405,L,; String testMsg2 = //"imei:10000000000000,help me,1004171910,,F,010203.000,A,0102.0003,N,00102.0003,E,1.02,"; - "imei:353451040164707,tracker,1105182344,+36304665439,F,214418.000,A,4804.2222,N,01916.7593,E,0.37,"; + //"imei:353451040164707,tracker,1105182344,+36304665439,F,214418.000,A,4804.2222,N,01916.7593,E,0.37,"; + "imei:353451042861763,tracker,1106132241,,F,144114.000,A,2301.9052,S,04909.3676,W,0.13,"; Gps103ProtocolDecoder decoder = new Gps103ProtocolDecoder(new TestDataManager(), 0); //assertNull(decoder.decode(null, null, testMsg1)); diff --git a/tracker-server.log b/tracker-server.log deleted file mode 100755 index e77fde97c..000000000 --- a/tracker-server.log +++ /dev/null @@ -1,75 +0,0 @@ -May 2, 2010 9:51:59 PM net.sourceforge.opentracking.Server init -WARNING: test -May 2, 2010 9:51:59 PM net.sourceforge.opentracking.Server init -WARNING: test2 -May 2, 2010 9:54:20 PM net.sourceforge.opentracking.Server init -WARNING: test -May 2, 2010 9:54:20 PM net.sourceforge.opentracking.Server init -WARNING: test2 -May 2, 2010 10:14:26 PM net.sourceforge.opentracking.Server init -FINE: test fine -May 2, 2010 10:14:47 PM net.sourceforge.opentracking -FINE: [id: 0x01148603, /0:0:0:0:0:0:0:1:49581 => /0:0:0:0:0:0:0:1:5000] BOUND: /0:0:0:0:0:0:0:1:5000 -May 2, 2010 10:14:47 PM net.sourceforge.opentracking -FINE: [id: 0x01148603, /0:0:0:0:0:0:0:1:49581 => /0:0:0:0:0:0:0:1:5000] CONNECTED: /0:0:0:0:0:0:0:1:49581 -May 2, 2010 10:14:49 PM net.sourceforge.opentracking -FINE: [id: 0x01148603, /0:0:0:0:0:0:0:1:49581 => /0:0:0:0:0:0:0:1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=3, cap=1024) - (HEXDUMP: 730d0a) -May 2, 2010 10:14:49 PM net.sourceforge.opentracking -FINE: [id: 0x01148603, /0:0:0:0:0:0:0:1:49581 => /0:0:0:0:0:0:0:1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=3, cap=1024) - (HEXDUMP: 610d0a) -May 2, 2010 10:14:50 PM net.sourceforge.opentracking -FINE: [id: 0x01148603, /0:0:0:0:0:0:0:1:49581 => /0:0:0:0:0:0:0:1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=3, cap=960) - (HEXDUMP: 620d0a) -May 2, 2010 10:14:51 PM net.sourceforge.opentracking -FINE: [id: 0x01148603, /0:0:0:0:0:0:0:1:49581 => /0:0:0:0:0:0:0:1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=6, cap=960) - (HEXDUMP: 313131310d0a) -May 2, 2010 10:14:57 PM net.sourceforge.opentracking -FINE: [id: 0x01148603, /0:0:0:0:0:0:0:1:49581 => /0:0:0:0:0:0:0:1:5000] DISCONNECTED -May 2, 2010 10:14:57 PM net.sourceforge.opentracking -FINE: [id: 0x01148603, /0:0:0:0:0:0:0:1:49581 => /0:0:0:0:0:0:0:1:5000] UNBOUND -May 2, 2010 10:14:58 PM net.sourceforge.opentracking -FINE: [id: 0x01148603, /0:0:0:0:0:0:0:1:49581 => /0:0:0:0:0:0:0:1:5000] CLOSED -May 2, 2010 10:18:07 PM net.sourceforge.opentracking.Server init -FINE: test fine -May 2, 2010 10:18:14 PM net.sourceforge.opentracking -FINE: [id: 0x012b3349, /0:0:0:0:0:0:0:1:55726 => /0:0:0:0:0:0:0:1:5000] BOUND: /0:0:0:0:0:0:0:1:5000 -May 2, 2010 10:18:15 PM net.sourceforge.opentracking -FINE: [id: 0x012b3349, /0:0:0:0:0:0:0:1:55726 => /0:0:0:0:0:0:0:1:5000] CONNECTED: /0:0:0:0:0:0:0:1:55726 -May 2, 2010 10:18:16 PM net.sourceforge.opentracking -FINE: [id: 0x012b3349, /0:0:0:0:0:0:0:1:55726 => /0:0:0:0:0:0:0:1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=6, cap=1024) - (HEXDUMP: 68656c6c0d0a) -May 2, 2010 10:18:18 PM net.sourceforge.opentracking -FINE: [id: 0x012b3349, /0:0:0:0:0:0:0:1:55726 => /0:0:0:0:0:0:0:1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=3, cap=1024) - (HEXDUMP: 6f0d0a) -May 2, 2010 10:18:21 PM net.sourceforge.opentracking -FINE: [id: 0x012b3349, /0:0:0:0:0:0:0:1:55726 => /0:0:0:0:0:0:0:1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=7, cap=960) - (HEXDUMP: 31323334350d0a) -May 2, 2010 10:18:26 PM net.sourceforge.opentracking -FINE: [id: 0x012b3349, /0:0:0:0:0:0:0:1:55726 => /0:0:0:0:0:0:0:1:5000] DISCONNECTED -May 2, 2010 10:18:27 PM net.sourceforge.opentracking -FINE: [id: 0x012b3349, /0:0:0:0:0:0:0:1:55726 => /0:0:0:0:0:0:0:1:5000] UNBOUND -May 2, 2010 10:18:27 PM net.sourceforge.opentracking -FINE: [id: 0x012b3349, /0:0:0:0:0:0:0:1:55726 => /0:0:0:0:0:0:0:1:5000] CLOSED -May 2, 2010 10:42:28 PM net.sourceforge.opentracking -FINE: [id: 0x006db33c, /127.0.0.1:45082 => /127.0.0.1:5000] BOUND: /127.0.0.1:5000 -May 2, 2010 10:42:28 PM net.sourceforge.opentracking -FINE: [id: 0x006db33c, /127.0.0.1:45082 => /127.0.0.1:5000] CONNECTED: /127.0.0.1:45082 -May 2, 2010 10:42:30 PM net.sourceforge.opentracking -FINE: [id: 0x006db33c, /127.0.0.1:45082 => /127.0.0.1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=3, cap=1024) - (HEXDUMP: 610d0a) -May 2, 2010 10:42:31 PM net.sourceforge.opentracking -FINE: [id: 0x006db33c, /127.0.0.1:45082 => /127.0.0.1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=3, cap=1024) - (HEXDUMP: 620d0a) -May 2, 2010 10:42:34 PM net.sourceforge.opentracking -FINE: [id: 0x006db33c, /127.0.0.1:45082 => /127.0.0.1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=3, cap=960) - (HEXDUMP: 1b0d0a) -May 2, 2010 10:42:39 PM net.sourceforge.opentracking -FINE: [id: 0x006db33c, /127.0.0.1:45082 => /127.0.0.1:5000] DISCONNECTED -May 2, 2010 10:42:39 PM net.sourceforge.opentracking -FINE: [id: 0x006db33c, /127.0.0.1:45082 => /127.0.0.1:5000] UNBOUND -May 2, 2010 10:42:39 PM net.sourceforge.opentracking -FINE: [id: 0x006db33c, /127.0.0.1:45082 => /127.0.0.1:5000] CLOSED -[id: 0x0158689a, /0:0:0:0:0:0:0:1:45776 => /0:0:0:0:0:0:0:1:5000] BOUND: /0:0:0:0:0:0:0:1:5000[id: 0x0158689a, /0:0:0:0:0:0:0:1:45776 => /0:0:0:0:0:0:0:1:5000] CONNECTED: /0:0:0:0:0:0:0:1:45776[id: 0x0158689a, /0:0:0:0:0:0:0:1:45776 => /0:0:0:0:0:0:0:1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=8, cap=1024) - (HEXDUMP: 7177657274790d0a)[id: 0x0158689a, /0:0:0:0:0:0:0:1:45776 => /0:0:0:0:0:0:0:1:5000] DISCONNECTED[id: 0x0158689a, /0:0:0:0:0:0:0:1:45776 => /0:0:0:0:0:0:0:1:5000] UNBOUND[id: 0x0158689a, /0:0:0:0:0:0:0:1:45776 => /0:0:0:0:0:0:0:1:5000] CLOSED[id: 0x0158689a, /127.0.0.1:33077 => /127.0.0.1:5000] BOUND: /127.0.0.1:5000 -[id: 0x0158689a, /127.0.0.1:33077 => /127.0.0.1:5000] CONNECTED: /127.0.0.1:33077 -[id: 0x0158689a, /127.0.0.1:33077 => /127.0.0.1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=3, cap=1024) - (HEXDUMP: 310d0a) -[id: 0x0158689a, /127.0.0.1:33077 => /127.0.0.1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=5, cap=1024) - (HEXDUMP: 3233340d0a) -[id: 0x0158689a, /127.0.0.1:33077 => /127.0.0.1:5000] DISCONNECTED -[id: 0x0158689a, /127.0.0.1:33077 => /127.0.0.1:5000] UNBOUND -[id: 0x0158689a, /127.0.0.1:33077 => /127.0.0.1:5000] CLOSED -[id: 0x0158689a, /127.0.0.1:35718 => /127.0.0.1:5000] BOUND: /127.0.0.1:5000 -[id: 0x0158689a, /127.0.0.1:35718 => /127.0.0.1:5000] CONNECTED: /127.0.0.1:35718 -[id: 0x0158689a, /127.0.0.1:35718 => /127.0.0.1:5000] RECEIVED: BigEndianHeapChannelBuffer(ridx=0, widx=59, cap=1024) - (HEXDUMP: 6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161610d0a) -[id: 0x0158689a, /127.0.0.1:35718 => /127.0.0.1:5000] DISCONNECTED -[id: 0x0158689a, /127.0.0.1:35718 => /127.0.0.1:5000] UNBOUND -[id: 0x0158689a, /127.0.0.1:35718 => /127.0.0.1:5000] CLOSED diff --git a/tracker-server.log.lck b/tracker-server.log.lck deleted file mode 100755 index e69de29bb..000000000 --- a/tracker-server.log.lck +++ /dev/null |