aboutsummaryrefslogtreecommitdiff
path: root/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2013-01-17 21:22:24 +1300
committerAnton Tananaev <anton.tananaev@gmail.com>2013-01-17 21:22:24 +1300
commit234be1a3df650a3ff5bd3d4773f85093ff9bf32e (patch)
tree82e8fef5c7cdde600493deda0ad8a69ff3ec7522 /src/org/traccar/protocol/MeiligaoProtocolDecoder.java
parent2276cfdcf4c2cedf5bef33ca0a68446b70aacb33 (diff)
downloadtrackermap-server-234be1a3df650a3ff5bd3d4773f85093ff9bf32e.tar.gz
trackermap-server-234be1a3df650a3ff5bd3d4773f85093ff9bf32e.tar.bz2
trackermap-server-234be1a3df650a3ff5bd3d4773f85093ff9bf32e.zip
Add meiligao optional fields to xml
Diffstat (limited to 'src/org/traccar/protocol/MeiligaoProtocolDecoder.java')
-rw-r--r--src/org/traccar/protocol/MeiligaoProtocolDecoder.java52
1 files changed, 47 insertions, 5 deletions
diff --git a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
index a3e065f2d..98e4b5ef1 100644
--- a/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
+++ b/src/org/traccar/protocol/MeiligaoProtocolDecoder.java
@@ -48,9 +48,10 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
/**
* Regular expressions pattern
*/
- //"191020.000,A,2438.1016,S,02553.3551,E,0.00,,150113,,,A*69|1.7|1009|"
+ // | HDOP | Altitude | State | AD| BASE ID | CSQ | Journey
+ //"191020.000,A,2438.1016,S,02553.3551,E,0.00,,150113,,,A*69 |1.7|1009|"
//"020600.930,A,2309.2051,N,11318.8449,E,0.00,0.00,090710,,,A*6A|2.6|96.7|0000|0000,3FFF|000000000"
- //"155422.000,V,2230.7623,N,11403.4218,E,0.00,0,060211,,*1A|0.0|26|0000|0000,0000|0000000000000000|63|00000000"
+ //"155422.000,V,2230.7623,N,11403.4218,E,0.00,0,060211,,*1A |0.0|26 |0000|0000,0000|0000000000000000|63|00000000"
static private Pattern pattern = Pattern.compile(
"(\\d{2})(\\d{2})(\\d{2})\\.(\\d{3})," + // Time (HHMMSS.SSS)
"([AV])," + // Validity
@@ -64,6 +65,10 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
"[^\\|]+\\|(\\d+\\.\\d)\\|" + // Dilution of precision
"(\\d+\\.?\\d*)\\|" + // Altitude
"([0-9a-fA-F]+)?" + // State
+ "(?:\\|([0-9a-fA-F]+),([0-9a-fA-F]+))?" + // ADC
+ "(?:\\|([0-9a-fA-F]+))?" + // Cell
+ "(?:\\|([0-9a-fA-F]+))?" + // Signal
+ "(?:\\|([0-9a-fA-F]+))?" + // Milage
".*"); // TODO: parse ADC
/**
@@ -212,9 +217,46 @@ public class MeiligaoProtocolDecoder extends BaseProtocolDecoder {
}
// State
- extendedInfo.append("<state>");
- extendedInfo.append(parser.group(index++));
- extendedInfo.append("</state>");
+ String state = parser.group(index++);
+ if (state != null) {
+ extendedInfo.append("<state>");
+ extendedInfo.append(state);
+ extendedInfo.append("</state>");
+ }
+
+ // ADC
+ for (int i = 1; i <= 2; i++) {
+ String adc = parser.group(index++);
+ if (adc != null) {
+ extendedInfo.append("<adc").append(i).append(">");
+ extendedInfo.append(Integer.parseInt(adc, 16));
+ extendedInfo.append("</adc").append(i).append(">");
+ }
+ }
+
+ // Cell identifier
+ String cell = parser.group(index++);
+ if (cell != null) {
+ extendedInfo.append("<cell>");
+ extendedInfo.append(cell);
+ extendedInfo.append("</cell>");
+ }
+
+ // GSM signal
+ String gsm = parser.group(index++);
+ if (gsm != null) {
+ extendedInfo.append("<gsm>");
+ extendedInfo.append(Integer.parseInt(gsm, 16));
+ extendedInfo.append("</gsm>");
+ }
+
+ // Milage
+ String milage = parser.group(index++);
+ if (milage != null) {
+ extendedInfo.append("<milage>");
+ extendedInfo.append(Integer.parseInt(milage, 16));
+ extendedInfo.append("</milage>");
+ }
// Extended info
position.setExtendedInfo(extendedInfo.toString());