Jump to content

Device Info Packet: Difference between revisions

From Transight Wiki
No edit summary
No edit summary
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:
{| class="wikitable"
{| class="wikitable"
|-
! style="background-color:#680022; color:white;" | Field
! style="background-color:#680022; color:white;" | Field
! style="background-color:#680022; color:white;" | Size (bits)
! style="background-color:#680022; color:white;" | Size (bits)
Line 43: Line 44:


|-
|-
! colspan="5" style="background:#D3D3D3;" | Data
! colspan="5" style="background:#D3D3D3;" | Data (110 Bytes)
|-
|-
| Time
| Time
| 32
| 32
|  
| 80-111
| UTC Timestamp
| UTC Timestamp
| UTC time in seconds
| UTC time in seconds
Line 54: Line 55:
| Time Zone
| Time Zone
| 8
| 8
|  
| 112-119
| Timezone in quarter-hours (e.g., 22 = +5:30), quarter-hour increment means each unit represents 15 minutes. The value 22 represents 22 quarter hours. Ranges from -48 to 56, negative timezone to 2's complement representation
| Timezone in quarter-hours (e.g., 22 = +5:30), quarter-hour increment means each unit represents 15 minutes. The value 22 represents 22 quarter hours. Ranges from -48 to 56, negative timezone to 2's complement representation
| eg: 22 (+5:30) → 22×15=330 minutes → 330÷60=5.5 hours → 5 hours and 30 minutes
| eg: 22 (+5:30) → 22×15=330 minutes → 330÷60=5.5 hours → 5 hours and 30 minutes
Line 61: Line 62:
| ICCID
| ICCID
| 160
| 160
|  
| 120-279
| 20 Bytes, Character string
| 20 Bytes, Character string
| 8991000903297069053F
| 8991000903297069053F
Line 68: Line 69:
| VID
| VID
| 32
| 32
|  
| 280-311
| 4 Bytes, Character string
| 4 Bytes, Character string
| TRAN
| TRAN
Line 75: Line 76:
| CELLULAR_MODULE_FV NAME
| CELLULAR_MODULE_FV NAME
| 40
| 40
|  
| 312-351
| 5 Bytes, Character string
| 5 Bytes, Character string
| TSPJT
| TSPJT
Line 82: Line 83:
| CELLULAR_MODULE_FV VERSION
| CELLULAR_MODULE_FV VERSION
| 80
| 80
|  
| 352-431
| 10 Bytes, Character string
| 10 Bytes, Character string
| XX.YY.ZZZZ
| XX.YY.ZZZZ
Line 89: Line 90:
| CELLULAR_MODULE_FV BUILD NO
| CELLULAR_MODULE_FV BUILD NO
| 40
| 40
|  
| 432-471
| 5 Bytes, Character string
| 5 Bytes, Character string
| YYDDD
| YYDDD
Line 96: Line 97:
| MCU_APP_MODULE_FV NAME
| MCU_APP_MODULE_FV NAME
| 40
| 40
|  
| 472-511
| 5 Bytes, Character string
| 5 Bytes, Character string
| TSPJT
| TSPJT
Line 103: Line 104:
| MCU_APP_MODULE_FV VERSION
| MCU_APP_MODULE_FV VERSION
| 80
| 80
|  
| 512-591
| 10 Bytes, Character string
| 10 Bytes, Character string
| XX.YY.ZZZZ
| XX.YY.ZZZZ
Line 110: Line 111:
| MCU_APP_MODULE_FV BUILD NO
| MCU_APP_MODULE_FV BUILD NO
| 40
| 40
|  
| 592-631
| 5 Bytes, Character string
| 5 Bytes, Character string
| YYDDD
| YYDDD
Line 117: Line 118:
| MCU_BTL_MODULE_FV NAME
| MCU_BTL_MODULE_FV NAME
| 40
| 40
|  
| 632-671
| 5 Bytes, Character string
| 5 Bytes, Character string
| TSPJT
| TSPJT
Line 124: Line 125:
| MCU_BTL_MODULE_FV VERSION
| MCU_BTL_MODULE_FV VERSION
| 80
| 80
|  
| 672-751
| 10 Bytes, Character string
| 10 Bytes, Character string
| XX.YY.ZZZZ
| XX.YY.ZZZZ
Line 131: Line 132:
| MCU_BTL_MODULE_FV BUILD NO
| MCU_BTL_MODULE_FV BUILD NO
| 40
| 40
|  
| 752-791
| 5 Bytes, Character string
| 5 Bytes, Character string
| YYDDD
| YYDDD
Line 138: Line 139:
| VN
| VN
| 80
| 80
|  
| 792-871
| 10 Bytes, Character string
| 10 Bytes, Character string
| KL07CP8490
| KL07CP8490
Line 145: Line 146:
| HWINFO
| HWINFO
| 88
| 88
|  
| 872-959
| 11 Bytes, Character string
| 11 Bytes, Character string
| PCB-0220-AB
| PCB-0220-AB
Line 170: Line 171:
==Sample Packet==
==Sample Packet==


<pre>
{ HEX: "2406e0e21aeb7abfd58068abec441638393931343632313630353131303436363837465452414e545344344720332e20302e20202035202020203054532d443420332e20302e20202035323532313154532d445220332e20302e202020323235323131585858585858585858585043422d303236312d41412a44" "imei": 862942074896044, "packet_type": 0, "no_packets": 1, "dateTime": 1756097604, "timezone": 22, "dateTime_tz": "2025-08-25 10:23:24", "iccid": "8991462160511046687F", "vid": "TRAN", "cmfv_name": "TSD4G", "cmfv_version": " 3. 0. 5", "cmfv_build": " 0", "mcua_name": "TS-D4", "mcua_version": " 3. 0. 5", "mcua_build": "25211", "mcub_name": "TS-DR", "mcub_version": " 3. 0. 2", "mcub_build": "25211", "vn": "XXXXXXXXXX", "hwinfo_build": "PCB-0261-AA", "error_code": 0 }
</pre>                                                                                             


"HEX":                                                                                                "2406e0e1cabd09208ca06822dac31638393931393530393132393633373932393630000000000545344324720322e20302e202020312020202030545344324e20312e20312e202020313235303935545344324220302e20302e2020203020202020305e0100005e0100005e015043422d303232302d41422a1c",
  "cmfv_build": "0",
  "cmfv_name": "TSD2G",
  "cmfv_version": "2. 0. 1",
  "dateTime": 1747114691,
  "dateTime_tz": "2025-05-13 11:08:11.000",
  "hwinfo_build": "PCB-0220-AB",
  "iccid": "8991950912963792962\u0000",
  "imei": 860187062240357,
  "insert_time": "Tue, 13 May 2025 05:38:15 GMT",
  "mcua_build": "25095",
  "mcua_name": "TSD2N",
  "mcua_version": "1. 1.1",
  "mcub_build": "0",
  "mcub_name": "TSD2B",
  "mcub_version": "0.0.0",
  "packetType": 0,
  "send_time": "2025-05-13 11:08:11",
  "timezone": 22,
  "vid": "\u0000\u0000\u0000\u0000",
  "vn": "^\u0001\u0000\u0000^\u0001\u0000\u0000^\u0001"


<html lang="en">
<html lang="en">
Line 201: Line 184:
     textarea { width: 100%; height: 100px; font-family: monospace; }
     textarea { width: 100%; height: 100px; font-family: monospace; }
     button {
     button {
       padding: 10px 20px;
       padding: 5px 15px;
       border-radius: 20px;
       border-radius: 20px;
       margin-top: 10px;
       margin-top: 10px;
Line 221: Line 204:


<h2>Device Info Packet Parser</h2>
<h2>Device Info Packet Parser</h2>
<textarea id="hexInput" placeholder="Paste Device Info Packet here..."></textarea><br>
<textarea id="packetInput" placeholder="Paste packet here..."></textarea><br>
<button onclick="parseDeviceInfo()">Parse Packet</button>
<button onclick="parsePacket()">Parse Packet</button>


<h3>Parsed Output:</h3>
<h3>Parsed Output:</h3>
Line 232: Line 215:
<script>
<script>
function hexToBits(hex) {
function hexToBits(hex) {
   return hex.match(/.{1,2}/g).map(b => parseInt(b, 16).toString(2).padStart(8, '0')).join('');
   return hex.match(/.{1,2}/g).map(byte =>
    parseInt(byte, 16).toString(2).padStart(8, '0')).join('');
}
}


Line 240: Line 224:


function bitsToSignedInt(bits) {
function bitsToSignedInt(bits) {
   const val = parseInt(bits, 2);
   const value = parseInt(bits, 2);
   return val >= 2 ** (bits.length - 1) ? val - 2 ** bits.length : val;
   const max = Math.pow(2, bits.length);
  return value >= max / 2 ? value - max : value;
}
}


function bitsToAscii(bits) {
function bitsToAscii(bits) {
   return bits.match(/.{1,8}/g).map(b => String.fromCharCode(parseInt(b, 2))).join('').replace(/\0/g, '');
   return bits.match(/.{8}/g).map(b => String.fromCharCode(parseInt(b, 2))).join('').trim();
}
}


Line 252: Line 237:
}
}


function parseDeviceInfo() {
function parsePacket() {
   const hex = document.getElementById("hexInput").value.trim().toLowerCase();
   const hex = document.getElementById('packetInput').value.trim().toLowerCase();
   const resultBody = document.querySelector("#resultTable tbody");
   const resultBody = document.querySelector("#resultTable tbody");
   resultBody.innerHTML = "";
   resultBody.innerHTML = "";


   if (!hex || !hex.startsWith("24")) {
   if (!hex || !hex.startsWith("24")) {
     alert("Invalid packet! Must start with 24 (hex for $)");
     alert("Invalid packet");
     return;
     return;
   }
   }
Line 269: Line 254:
   };
   };


def get_precise_device_info_packet_fields():
  // Corrected IMEI extraction using bit-level parsing
    return [
  const imei = bigIntFromBits(bits.slice(25, 75));
        ("Start Character", 0, 8),
  output("IMEI", imei);
        ("Length", 8, 20),
 
        ("No of Packets", 20, 25),
  const packetType = bitsToInt(bits.slice(75, 80));
        ("IMEI", 25, 75),
  output("Packet Type", packetType);
        ("Packet Type", 75, 80),
 
        ("Time", 80, 112),
  const tsBits = bits.slice(80, 112);
        ("Time Zone", 112, 119),
   const timezoneBits = bits.slice(112, 120);
        ("ICCID", 120, 279),    # 20 bytes = 160 bits
  const ts = bitsToInt(tsBits);
        ("VID", 280, 311),      # 4 bytes = 32 bits
  const timezoneRaw = bitsToSignedInt(timezoneBits);
        ("CELLULAR_MODULE_FV NAME", 312, 351),    # 5 bytes = 40 bits
  const offsetMin = timezoneRaw * 15;
        ("CELLULAR_MODULE_FV VERSION", 352, 431), # 10 bytes = 80 bits
  const sign = offsetMin >= 0 ? "+" : "-";
        ("CELLULAR_MODULE_FV BUILD NO", 432, 471),# 5 bytes = 40 bits
  const h = Math.floor(Math.abs(offsetMin) / 60);
        ("MCU_APP_MODULE_FV NAME", 472, 511),    # 5 bytes = 40 bits
  const m = Math.abs(offsetMin % 60);
        ("MCU_APP_MODULE_FV VERSION", 512, 591),  # 10 bytes = 80 bits
  const localDate = new Date((ts + offsetMin * 60) * 1000);
        ("MCU_APP_MODULE_FV BUILD NO", 592, 631), # 5 bytes = 40 bits
  const localStr = localDate.toISOString().replace("T", " ").replace(".000Z", "");
        ("MCU_BTL_MODULE_FV NAME", 632, 671),    # 5 bytes = 40 bits
 
        ("MCU_BTL_MODULE_FV VERSION", 672, 751),  # 10 bytes = 80 bits
  output("DateTime (Epoch)", ts);
        ("MCU_BTL_MODULE_FV BUILD NO", 752, 791), # 5 bytes = 40 bits
  output("TimeZone", `${offsetMin} mins = UTC${sign}${h}:${m.toString().padStart(2, '0')}`);
        ("VN", 792, 871),                        # 11 bytes = 88 bits
  output("DateTime (Local Time)", localStr);
        ("HWINFO", 872, 959),                    # 10 bytes = 80 bits
 
        ("End Character", 0, 7),
  const asciiFields = [
        ("CRC", 8, 15)
    ["ICCID", 120, 279],
    ];
    ["VID", 280, 311],
   for (const [label, start, end] of fields) {
    ["CMFV Name", 312, 351],
    const val = bits.slice(start, end);
    ["CMFV Version", 352, 431],
    switch (label) {
    ["CMFV Build", 432, 471],
      case "IMEI":
    ["MCUA Name", 472, 511],
        output(label, bigIntFromBits(val));
    ["MCUA Version", 512, 591],
        break;
    ["MCUA Build", 592, 631],
      case "Time":
    ["MCUB Name", 632, 671],
        const timestamp = bitsToInt(val);
    ["MCUB Version", 672, 751],
        output(label, new Date(timestamp * 1000).toISOString());
    ["MCUB Build", 752, 791],
        break;
    ["VN", 792, 871],
      case "Time Zone":
    ["HWINFO", 872, 959]
        const tz = bitsToSignedInt(val);
  ];
        const mins = tz * 15;
 
        const sign = mins >= 0 ? "+" : "-";
  for (const [label, start, end] of asciiFields) {
        const h = Math.floor(Math.abs(mins) / 60);
    const value = bitsToAscii(bits.slice(start, end + 1));
        const m = Math.abs(mins % 60);
    output(label, value);
        output("Time Zone", `${mins} mins (UTC${sign}${h}:${m.toString().padStart(2, '0')})`);
        break;
      case "ICCID":
      case "VID":
      case "CELLULAR_MODULE_FV NAME":
      case "CELLULAR_MODULE_FV VERSION":
      case "CELLULAR_MODULE_FV BUILD NO":
      case "MCU_APP_MODULE_FV NAME":
      case "MCU_APP_MODULE_FV VERSION":
      case "MCU_APP_MODULE_FV BUILD NO":
      case "MCU_BTL_MODULE_FV NAME":
      case "MCU_BTL_MODULE_FV VERSION":
      case "MCU_BTL_MODULE_FV BUILD NO":
      case "VN":
      case "HWINFO":
        output(label, bitsToAscii(val).trim());
        break;
      case "Start Character":
        output(label, String.fromCharCode(bitsToInt(val)));
        break;
      case "End Character":
        output(label, String.fromCharCode(bitsToInt(val)));
        break;
      case "CRC":
        output(label, bitsToInt(val).toString(16).toUpperCase().padStart(2, '0'));
        break;
      default:
        output(label, bitsToInt(val));
    }
   }
   }
  output("Error Code", 0); // Optional placeholder
}
}
</script>
</script>

Latest revision as of 05:21, 18 December 2025

Field Size (bits) Bit Range Description Breakdown
Header (10 Bytes)
Start byte 8 0–7 Starting character $ (ASCII value 36)
Data length 12 08–19 2-byte length of the data following the header
Number of data packets 5 20–24 Number of packets (0–32) 0–32
IMEI 50 25–74 Unique device identifier
Packet type 5 75–79 Type of packet 00 - Device Info
Data (110 Bytes)
Time 32 80-111 UTC Timestamp UTC time in seconds
Time Zone 8 112-119 Timezone in quarter-hours (e.g., 22 = +5:30), quarter-hour increment means each unit represents 15 minutes. The value 22 represents 22 quarter hours. Ranges from -48 to 56, negative timezone to 2's complement representation eg: 22 (+5:30) → 22×15=330 minutes → 330÷60=5.5 hours → 5 hours and 30 minutes
ICCID 160 120-279 20 Bytes, Character string 8991000903297069053F
VID 32 280-311 4 Bytes, Character string TRAN
CELLULAR_MODULE_FV NAME 40 312-351 5 Bytes, Character string TSPJT
CELLULAR_MODULE_FV VERSION 80 352-431 10 Bytes, Character string XX.YY.ZZZZ
CELLULAR_MODULE_FV BUILD NO 40 432-471 5 Bytes, Character string YYDDD
MCU_APP_MODULE_FV NAME 40 472-511 5 Bytes, Character string TSPJT
MCU_APP_MODULE_FV VERSION 80 512-591 10 Bytes, Character string XX.YY.ZZZZ
MCU_APP_MODULE_FV BUILD NO 40 592-631 5 Bytes, Character string YYDDD
MCU_BTL_MODULE_FV NAME 40 632-671 5 Bytes, Character string TSPJT
MCU_BTL_MODULE_FV VERSION 80 672-751 10 Bytes, Character string XX.YY.ZZZZ
MCU_BTL_MODULE_FV BUILD NO 40 752-791 5 Bytes, Character string YYDDD
VN 80 792-871 10 Bytes, Character string KL07CP8490
HWINFO 88 872-959 11 Bytes, Character string PCB-0220-AB
Tail(2 Bytes)
End Character 8 0–7 Starting character * (ASCII value 42)
CRC 8 8–15 8-bit XOR CRC of data starting from $ to * (excluding $ and *)


Sample Packet

{ HEX: "2406e0e21aeb7abfd58068abec441638393931343632313630353131303436363837465452414e545344344720332e20302e20202035202020203054532d443420332e20302e20202035323532313154532d445220332e20302e202020323235323131585858585858585858585043422d303236312d41412a44" "imei": 862942074896044, "packet_type": 0, "no_packets": 1, "dateTime": 1756097604, "timezone": 22, "dateTime_tz": "2025-08-25 10:23:24", "iccid": "8991462160511046687F", "vid": "TRAN", "cmfv_name": "TSD4G", "cmfv_version": " 3. 0. 5", "cmfv_build": " 0", "mcua_name": "TS-D4", "mcua_version": " 3. 0. 5", "mcua_build": "25211", "mcub_name": "TS-DR", "mcub_version": " 3. 0. 2", "mcub_build": "25211", "vn": "XXXXXXXXXX", "hwinfo_build": "PCB-0261-AA", "error_code": 0 }


Device Info Packet Parser

Device Info Packet Parser


Parsed Output:

FieldValue