Add new protocol

hariro25 days ago

It is possible to add?

Névtelen.jpg

The payload send by the software is in Little Endian.

From the device we have received "012EDB583C07DACE1E1F7E941803DFFF0000920601" on our server.

Timestamp
Take the first 4 bytes "012EDB58"
Change endianness
01 2E DB 58 -> 58 DB 2E 01
When you convert 58DB2E01 to decimal you will get: "1490759169"
Timestamp: 1490759169
Battery
Take the next byte, multiply by 10 and add 3000 to get the millivolts
Battery: 3600
Temperature
Take the next byte, and convert hex to decimal
Temperature: 7
GPS
Take the next 4 bytes for Latitude and another 4 for the Longitude, change endianness, convert hex to decimal and divide by 10000000
GPS: 52.211273,5.1942526
Altitude
Altitude: -32
Speed
speed: 0
Course
course: 146
Satellite
Satellite count: 6
Time to Fix
Time to fix: 1

Kaloyan Kanev25 days ago

Yes, it's possible.
The details about it, is here

Anton Tananaev24 days ago
hariro22 days ago

Could it be that it is already added? What kind of protocol can this be?

Anton Tananaev21 days ago

You can check this if you think it might already be supported:

https://www.traccar.org/identify-protocol/

hariro19 days ago

Maybe good

{
  "name": "SODAQ Uplink data converter",
  "type": "UPLINK",
  "debugMode": true,
  "configuration": {
    "decoder": "// Decode an uplink message from a buffer\n// payload - array of bytes\n// metadata - key/value object\n\n/** Decoder **/\n \n// decode payload to string\n// var payloadStr = decodeToString(payload);\n\n// decode payload to JSON\nvar data = decodeToJson(payload);\n\nvar reports = data.reports;\nvar deviceName = data.devName;\n\n// Result object with device attributes/telemetry data\nvar result = {\n   deviceName: {},\n   deviceType: \"tracker\",\n   telemetry: []\n};\n\nfor (var i = 0; i < reports.length; i++) {\n   result.deviceName = reports[i].serialNumber.replace(\"IMEI:\", \"\");\n   var telemetryObj = {\n       ts: {},\n       values: {}\n   };\n   //timestamp = parseInt(stringToInt(reports[i].value.substring(32,40)) + \"000\");\n   timestamp = stringToInt(reports[i].value.substring(32,40))*1000;\n   v = stringToInt(reports[i].value.substring(40,42))/100 + 3;\n   t = stringToInt(reports[i].value.substring(42,44));\n   lat = stringToInt(reports[i].value.substring(44,52))/10000000;\n   lon = stringToInt(reports[i].value.substring(52,60))/10000000;\n   alt = stringToInt(reports[i].value.substring(60, 64));\n   speed = stringToInt(reports[i].value.substring(64, 68));\n   sat = stringToInt(reports[i].value.substring(68, 70));\n   ttf = stringToInt(reports[i].value.substring(70, 72));\n   \n   telemetryObj.ts = timestamp;\n   telemetryObj.values.batteryVoltage = v;\n   telemetryObj.values.temperature = t;\n   if(lat !== 0) {\n        telemetryObj.values.latitude = lat;      \n   }\n   if(lon !== 0) {\n        telemetryObj.values.longitude = lon;      \n   }\n   if(alt !== 0) {\n        telemetryObj.values.altitude = alt;      \n   }\n   telemetryObj.values.speed = speed;\n   telemetryObj.values.satellitesObserved = sat;\n   telemetryObj.values.timetToFirstFix = ttf;\n   result.telemetry.push(telemetryObj);\n}\n\n/** Helper functions **/\n\nfunction stringToInt(hex) {\n    return parseInt('0x'+hex.match(/../g).reverse().join(''));\n}\n\nfunction decodeToString(payload) {\n   return String.fromCharCode.apply(String, payload);\n}\n\nfunction decodeToJson(payload) {\n   // covert payload to string.\n   var str = decodeToString(payload);\n\n   // parse string to JSON\n   var data = JSON.parse(str);\n   return data;\n}\n\nreturn result;\n"
  },
  "additionalInfo": null
}
hariro18 days ago
/** Decoder **/

        // The field of input json
        var reports = decodeToJson(payload).reports;

        // Result object with device attributes/telemetry data
        var result = {
           deviceName: {},
           deviceType: "tracker",
           telemetry: []
        };

        for (var i = 0; i < reports.length; i++) {
          result.deviceName = parseInt(reports[i].value.substring(2, 16), 16);
          var telemetryObj = {
              ts: {},
              values: {}
          };
          timestamp = stringToInt(reports[i].value.substring(32,40))*1000;
          v = stringToInt(reports[i].value.substring(40,42))/100 + 3;
          t = stringToInt(reports[i].value.substring(42,44));
          lat = stringToInt(reports[i].value.substring(44,52))/10000000;
          lon = stringToInt(reports[i].value.substring(52,60))/10000000;
          alt = stringToInt(reports[i].value.substring(60, 64));
          speed = stringToInt(reports[i].value.substring(64, 68));
          sat = stringToInt(reports[i].value.substring(68, 70));
          ttf = stringToInt(reports[i].value.substring(70, 72));

          telemetryObj.ts = timestamp;
          telemetryObj.values.batteryVoltage = v;
          telemetryObj.values.temperature = t;
          if(lat !== 0) {
                telemetryObj.values.latitude = lat;
          }
          if(lon !== 0) {
                telemetryObj.values.longitude = lon;
          }
          if(alt !== 0) {
                telemetryObj.values.altitude = alt;
          }
          telemetryObj.values.speed = speed;
          telemetryObj.values.satellitesObserved = sat;
          telemetryObj.values.timetToFirstFix = ttf;
          result.telemetry.push(telemetryObj);
        }

        /** Helper functions **/

        function stringToInt(hex) {
            return parseInt('0x' + hex.match(/../g).reverse().join(''));
        }

        function decodeToString(payload) {
           return String.fromCharCode.apply(String, payload);
        }

        function decodeToJson(payload) {
          // convert payload to string.
          var str = decodeToString(payload);

          // parse string to JSON
          var data = JSON.parse(str);
          return data;
        }

        return result;