Help With Bofan pt600

freebie8 years ago

Hi,

I have successfully connected my bofan pt600 to my traccar server but it is not working as well as it should. I'm new to this but from the server logs, I see that it connects as instructed every 120 seconds but after the initial ping which the server recognizes, it send data that the server doesn't recognize. I think these are short updates to its position that need interpretation as this unit was built to save data transmission.

Is there any way to configure the server to recognize these small updates?

A short snippet of the server log is below:

2017-02-28 02:24:47  INFO: [7AEF5C05] connected
2017-02-28 02:24:49 DEBUG: [7AEF5C05: 5017 < 196.102.152.93] HEX: 24504f532c333531313332303333372c3037323434362e3030302c412c303131312e393837362c532c30333635302e313330312c452c302e302c3130342e382c3238303231372c2c2c412f30303030302c30303030302f302c302c302c302f31393431343530302f2f0d0a
2017-02-28 02:24:49  INFO: [7AEF5C05] id: 3511320337, time: 2017-02-28 02:24:46, lat: -1.19979, lon: 36.83550, speed: 0.0, course: 104.8
2017-02-28 02:26:41 DEBUG: [7AEF5C05: 5017 < 196.102.152.93] HEX: 405a0203073633392e303030
2017-02-28 02:28:41 DEBUG: [7AEF5C05: 5017 < 196.102.152.93] HEX: 40500203073833392e303030
2017-02-28 02:30:41 DEBUG: [7AEF5C05: 5017 < 196.102.152.93] HEX: 405e020208333033392e303030
2017-02-28 02:32:41 DEBUG: [7AEF5C05: 5017 < 196.102.152.93] HEX: 40570203073233392e303030
2017-02-28 02:34:40 DEBUG: [7AEF5C05: 5017 < 196.102.152.93] HEX: 40550203073433392e303030
2017-02-28 02:36:40 DEBUG: [7AEF5C05: 5017 < 196.102.152.93] HEX: 40530203073633392e303030
2017-02-28 02:38:40 DEBUG: [7AEF5C05: 5017 < 196.102.152.93] HEX: 40510203073833382e303030
2017-02-28 02:40:40 DEBUG: [7AEF5C05: 5017 < 196.102.152.93] HEX: 405e020208343033382e303030
freebie8 years ago

I also found this code from opengts TrackClientPacketHandlerjava file for the pt600. Maybe it can help to identify how the unit send data?

 1153     /* parse and insert data record */
 1154     // this format supports some Bofan devices (PT600/PT502/PT300X) 
 1155     private byte[] parseInsertRecord_Device_1(String s)
 1156     {
 1157         // Format:
 1158         //   $<EventCode>,<MobileID>,<HHMMSS>,<GPSValid>,<NMEALat>,<N|S>,<NMEALon>,<E|W>,<SpeedKnots>,<Heading>,<DDMMYY>
 1159         // Example:
 1160         //   $POS,10000,102215.000,V,2233.8171,N,14205.6367,W,0.0,0.0,250411
 1161         //   0--- 1---- 2--------- 3 4-------- 5 6--------- 7 8-- 9-- A-----
 1162         //   |    |     |          | |         | |          | |   |   |>DDMMYY
 1163         //   |    |     |          | |         | |          | |   |>Heading
 1164         //   |    |     |          | |         | |          | |>Speed Knots
 1165         //   |    |     |          | |         | |          |>E|W
 1166         //   |    |     |          | |         | |>Longitude DDDmm.mmmm
 1167         //   |    |     |          | |         |>N|S
 1168         //   |    |     |          | |>Latitude DDmm.mmmm
 1169         //   |    |     |          |>A=ValidGPS, V=InvalidGPS
 1170         //   |    |     |>HHMMSS
 1171         //   |    |>MobileID
 1172         //   |>$POS: POS=PositionData
 1173         Print.logInfo("Parsing: " + s);
 1174 
 1175         /* pre-validate */
 1176         if (StringTools.isBlank(s)) {
 1177             Print.logError("Packet string is blank/null");
 1178             return null;
 1179         } else 
 1180         if (!s.startsWith("$")) {
 1181             Print.logError("Packet string does not start with '$'");
 1182             return null;
 1183         }
 1184 
 1185         /* separate into fields */
 1186         String fld[] = StringTools.parseStringArray(s.substring(1), ',');
 1187         if ((fld == null) || (fld.length < 11)) {
 1188             Print.logWarn("Invalid number of fields");
 1189             return null;
 1190         }
 1191 
 1192         /* parse individual fields */
 1193         String   eventCode  = fld[0];
 1194         String   modemID    = fld[1].toLowerCase();
 1195         long     fixtime    = Nmea0183.parseFixtime  (fld[10], fld[2], true);
 1196         boolean  validGPS   = fld[3].equalsIgnoreCase("A");
 1197         double   latitude   = validGPS? Nmea0183.ParseLatitude (fld[ 4], fld[5],  90.0) : 0.0;
 1198         double   longitude  = validGPS? Nmea0183.ParseLongitude(fld[ 6], fld[7], 180.0) : 0.0;
 1199         double   speedKnot  = validGPS? StringTools.parseDouble(fld[ 8], 0.0) : 0.0;
 1200         double   speedKPH   = validGPS? (speedKnot * KILOMETERS_PER_KNOT) : 0.0;
 1201         double   heading    = validGPS? StringTools.parseDouble(fld[ 9], 0.0) : 0.0;
 1202         double   altitudeM  = 0.0;  // 
 1203 
 1204         /* status code */
 1205         int      statusCode = StatusCodes.STATUS_LOCATION;
 1206         if (StringTools.isBlank(eventCode)) {
 1207             // -- blank, leave as-is
 1208         } else
 1209         if (eventCode.equalsIgnoreCase("POS")) {
 1210             // -- "Position" event
 1211             statusCode = StatusCodes.STATUS_LOCATION;
 1212         } else
 1213         if (eventCode.equalsIgnoreCase("IN1")) {
 1214             // -- "SOS" button
 1215             statusCode = StatusCodes.STATUS_WAYMARK_1;
 1216         } else
 1217         if (eventCode.equalsIgnoreCase("IN2")) {
 1218             // -- "KEY2" alarm
 1219             statusCode = StatusCodes.STATUS_WAYMARK_2;
 1220         } else
 1221         if (eventCode.equalsIgnoreCase("IN3")) {
 1222             // -- "KEY2" alarm
 1223             statusCode = StatusCodes.STATUS_WAYMARK_3;
 1224         } else
 1225         if (eventCode.equalsIgnoreCase("LPA")) {
 1226             // -- "Low Power" alarm
 1227             statusCode = StatusCodes.STATUS_LOW_BATTERY;
 1228         } else
 1229         if (eventCode.equalsIgnoreCase("CPA")) {
 1230             // -- "Cut Power" alarm
 1231             statusCode = StatusCodes.STATUS_POWER_FAILURE;
 1232         } else
 1233         if (eventCode.equalsIgnoreCase("SPD")) {
 1234             // -- "Speeding" alarm
 1235             statusCode = StatusCodes.STATUS_MOTION_EXCESS_SPEED;
 1236         } else
 1237         if (eventCode.equalsIgnoreCase("GOF")) {
 1238             // -- "Geofence" alarm
 1239             statusCode = StatusCodes.STATUS_GEOFENCE_VIOLATION;
 1240         } else
 1241         if (eventCode.startsWith("0x") || eventCode.startsWith("0X")) {
 1242             // -- specific status code (specified as a hex value)
 1243             int sc = StringTools.parseInt(eventCode,-1);
 1244             if ((sc > 0) && (sc <= 0xFFFF)) {
 1245                 statusCode = sc;
 1246             }
 1247         } else
 1248         if (Character.isDigit(eventCode.charAt(0))) {
 1249             // -- specific status code (specified as a decimal value)
 1250             int sc = StringTools.parseInt(eventCode,-1);
 1251             if ((sc > 0) && (sc <= 0xFFFF)) {
 1252                 statusCode = sc;
 1253             }
 1254         } else {
 1255             // -- leave as-is
 1256         }
 1257 
 1258         /* GPS Event */
 1259         this.gpsEvent = this.createGPSEvent(modemID);
 1260         if (this.gpsEvent == null) {
 1261             // errors already displayed
 1262             return null;
 1263         }
 1264 
 1265         /* populate GPS event fields */
 1266         this.gpsEvent.setTimestamp(fixtime);
 1267         this.gpsEvent.setStatusCode(statusCode);
 1268         this.gpsEvent.setLatitude(latitude);
 1269         this.gpsEvent.setLongitude(longitude);
 1270         this.gpsEvent.setSpeedKPH(speedKPH);
 1271         this.gpsEvent.setHeading(heading);
 1272         this.gpsEvent.setAltitude(altitudeM);
 1273 
 1274         /* insert/return */
 1275         if (this.parseInsertRecord_Common(this.gpsEvent)) {
 1276             // change this to return any required acknowledgement (ACK) packets back to the Device
 1277             return null;
 1278         } else {
 1279             return null;
 1280         }
 1281 
 1282     }
Anton Tananaev8 years ago

I'm not sure what those short messages are. We need protocol documentation to implement it.

freebie8 years ago

Does this document help? I asked bofan to send me their protocol and this is what I got.

https://www.dropbox.com/s/ug66qf5ffifvcmq/BOFAN%20Protocol-V1.2.pdf?dl=0

Does this help in the configuration?

Anton Tananaev8 years ago

It does not describe those messages. Either documentation is not full, or it's just a device issue.