{"id":19723,"date":"2026-08-07T13:40:38","date_gmt":"2026-08-07T05:40:38","guid":{"rendered":"https:\/\/www.lansitec.com\/?post_type=docs&#038;p=19723"},"modified":"2026-08-07T14:17:42","modified_gmt":"2026-08-07T06:17:42","password":"","slug":"decoder-lte-container-tracker","status":"publish","type":"docs","link":"https:\/\/www.lansitec.com\/ko\/docs\/decoders\/decoder-lte-container-tracker\/","title":{"rendered":"LTE \ub514\ucf54\ub354 \u2013 \ucee8\ud14c\uc774\ub108 \ucd94\uc801\uae30"},"content":{"rendered":"<div class=\"wp-block-file\"><a id=\"wp-block-file--media-e442671c-945c-4b6d-a992-04dacace2648\" href=\"https:\/\/www.lansitec.com\/wp-content\/uploads\/2026\/08\/decode-lte-container-tracker.js.zip\">decode-lte-container-tracker.js<\/a><a href=\"https:\/\/www.lansitec.com\/wp-content\/uploads\/2026\/08\/decode-lte-container-tracker.js.zip\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-e442671c-945c-4b6d-a992-04dacace2648\">\ub2e4\uc6b4\ub85c\ub4dc<\/a><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">To create automatically uplink and downlink messages, please refer to this page:<br><a href=\"https:\/\/www.lansitec.com\/ko\/lansitec-decoder-live-calculator\/\">Lansitec Decoder &#8211; Live Calculator &#8211; Lansitec<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Below the full decoder code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ Decode uplink function.\n\/\/\n\/\/ Input is an object with the following fields:\n\/\/ - bytes = Byte array containing the uplink payload, e.g. &#91;255, 230, 255, 0]\n\/\/ - fPort = Uplink fPort.\n\/\/ - variables = Object containing the configured device variables.\n\/\/\n\/\/ Output must be an object with the following fields:\n\/\/ - data = Object representing the decoded payload.\n\n\/\/ <a href=\"https:\/\/www.lansitec.com\/products\/nb-iot-container-tracker\/\">NB-IoT Container Tracker<\/a>\nfunction decodeUplink(input) {\n  \/\/ bytes\n  var bytes = input.bytes;\n  \/\/ ascii -&gt; hexString -&gt; byteArray\n  var uplinkType = (bytes&#91;0] &gt;&gt; 4) &amp; 0x0f;\n\n  switch (uplinkType) {\n    case 0x01:\n      return { data: decodeRegistration(bytes) };\n\n    case 0x02:\n      return { data: decodeHeartbeat(bytes) };\n\n    case 0x03:\n      return { data: decodeGNSSPosition(bytes) };\n\n    case 0x04:\n      return { data: decodeBeacon(bytes) };\n\n    case 0x05:\n      return { data: decodeAlarm(bytes) };\n\n    case 0x06:\n      return { data: decodeConfigParameterResponse(bytes) };\n\n    default:\n      return;\n  }\n}\n\n\/\/ type: 0x01 Registration\nfunction decodeRegistration(bytes) {\n  var data = {};\n  data.type = \"RegistrationMessage\";\n  data.bleEnable = (bytes&#91;1] &gt;&gt; 7) &amp; 0x01;\n  data.gnssEnable = (bytes&#91;1] &gt;&gt; 6) &amp; 0x01;\n  data.networkStatusCheckEnable = (bytes&#91;1] &gt;&gt; 5) &amp; 0x01;\n  data.powerSwitchEnable = (bytes&#91;1] &gt;&gt; 4) &amp; 0x01;\n  data.assetBeaconSortEnable = (bytes&#91;1] &gt;&gt; 1) &amp; 0x01;\n  data.gnssFailureReportEnable = bytes&#91;1] &amp; 0x01;\n  data.assetManagementEnable = (bytes&#91;2] &gt;&gt; 7) &amp; 0x01;\n  data.positionReportMode = (bytes&#91;3] &lt;&lt; 6) &amp; 0x0f;\n  data.sosAlarmEnable = (bytes&#91;3] &gt;&gt; 5) &amp; 0x01;\n  data.fallDetectionAlarmEnable = (bytes&#91;3] &gt;&gt; 4) &amp; 0x01;\n  data.specialBeaconnable = (bytes&#91;3] &gt;&gt; 3) &amp; 0x01;\n  data.searchAlarmEnable = (bytes&#91;3] &gt;&gt; 1) &amp; 0x01;\n\n  data.fallDetectionThreshold = bytes&#91;5] &amp; 0xff;\n  data.heartbeatPeriod = ((bytes&#91;6] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;7] &amp; 0xff);\n  data.blePositionReportInterval =\n    ((bytes&#91;8] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;9] &amp; 0xff);\n  data.blePositionBeaconReceivingDuration = bytes&#91;10] &amp; 0xff;\n  data.gnssPositionReportInterval =\n    ((bytes&#91;11] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;12] &amp; 0xff);\n  data.gnssReceivingDuration = bytes&#91;13] &amp; 0xff;\n  data.assetBeaconReportInterval =\n    ((bytes&#91;14] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;15] &amp; 0xff);\n  data.assetBeaconReceivingDuration = bytes&#91;16] &amp; 0xff;\n  data.softwareVersion = ((bytes&#91;17] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;18] &amp; 0xff);\n  var imsi = \"\";\n  for (let i = 0; i &lt; 8; i++) {\n    imsi = imsi + bytes&#91;19 + i].toString(16).toUpperCase().padStart(2, \"0\");\n  }\n  data.imsi = imsi.substring(0, 15);\n  data.messageId = ((bytes&#91;27] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;28] &amp; 0xff);\n  return data;\n}\n\n\/\/ type: 0x02 Heartbeat\nfunction decodeHeartbeat(bytes) {\n  var data = {};\n  data.type = \"HeartbeatMessage\";\n  var stateBitField = {};\n  stateBitField.bleEnable = (bytes&#91;1] &gt;&gt; 7) &amp; 0x01;\n  stateBitField.gnssEnable = (bytes&#91;1] &gt;&gt; 6) &amp; 0x01;\n  stateBitField.networkStatusCheck = (bytes&#91;1] &gt;&gt; 5) &amp; 0x01;\n  stateBitField.powerSwitchEnable = (bytes&#91;1] &gt;&gt; 4) &amp; 0x01;\n  stateBitField.assetBeaconSortEnable = (bytes&#91;1] &gt;&gt; 1) &amp; 0x01;\n  stateBitField.gnssFailureReportEnable = bytes&#91;1] &amp; 0x01;\n  stateBitField.assetManagementEnable = (bytes&#91;2] &gt;&gt; 7) &amp; 0x01;\n  stateBitField.posMode = (bytes&#91;3] &lt;&lt; 6) &amp; 0x0f;\n  stateBitField.sosAlarmEnable = (bytes&#91;3] &gt;&gt; 5) &amp; 0x01;\n  stateBitField.fallDetectionAlarmEnable = (bytes&#91;3] &gt;&gt; 4) &amp; 0x01;\n  stateBitField.specialBeaconnable = (bytes&#91;3] &gt;&gt; 3) &amp; 0x01;\n  stateBitField.searchAlarmEnable = (bytes&#91;3] &gt;&gt; 1) &amp; 0x01;\n  data.stateBitField = stateBitField;\n\n  data.batteryVoltage = ((bytes&#91;5] &amp; 0xff) * 0.01 + 2.00) + \"V\";\n  data.batteryLevel = (bytes&#91;6] &amp; 0xff) + \"%\";\n  data.bleReceivingCount = bytes&#91;7] &amp; 0xff;\n  data.gnssOnCount = bytes&#91;8] &amp; 0xff;\n  data.temperature =\n    (((bytes&#91;9] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;10] &amp; 0xff)) \/ 100 + \"\u00b0C\";\n  data.movement = ((bytes&#91;11] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;12] &amp; 0xff);\n  data.chargeDuration = ((bytes&#91;15] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;16] &amp; 0xff);\n  data.messageId = ((bytes&#91;17] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;18] &amp; 0xff);\n  return data;\n}\n\n\/\/ type: 0x03 GNSS Position\nfunction decodeGNSSPosition(bytes) {\n  var data = {};\n  data.type = \"GNSSPositionMessage\";\n  data.gnssStatus = bytes&#91;0] &amp; 0x01;\n  \/\/ longitude\n  var longitude = (bytes&#91;1] &lt;&lt; 24) &amp; 0xff000000;\n  longitude |= (bytes&#91;2] &lt;&lt; 16) &amp; 0xff0000;\n  longitude |= (bytes&#91;3] &lt;&lt; 8) &amp; 0xff00;\n  longitude |= bytes&#91;4] &amp; 0xff;\n  data.longitude = hex2float(longitude);\n  \/\/ latitude\n  var latitude = (bytes&#91;5] &lt;&lt; 24) &amp; 0xff000000;\n  latitude |= (bytes&#91;6] &lt;&lt; 16) &amp; 0xff0000;\n  latitude |= (bytes&#91;7] &lt;&lt; 8) &amp; 0xff00;\n  latitude |= bytes&#91;8] &amp; 0xff;\n  data.latitude = hex2float(latitude);\n  \/\/ time\n  var time = (bytes&#91;9] &lt;&lt; 24) &amp; 0xff000000;\n  time |= (bytes&#91;10] &lt;&lt; 16) &amp; 0xff0000;\n  time |= (bytes&#91;11] &lt;&lt; 8) &amp; 0xff00;\n  time |= bytes&#91;12] &amp; 0xff;\n  data.time = timestampToTime((time + 8 * 60 * 60) * 1000);\n  return data;\n}\n\n\/\/ type: 0x04 Beacon\nfunction decodeBeacon(bytes) {\n  var data = {};\n  data.type = \"BeaconMessage\";\n  data.beaconType =\n    (bytes&#91;0] &amp; 0x01) == 0 ? \"PositioningBeacon\" : \"AssetBeacon\";\n  data.beaconCount = bytes&#91;1] &amp; 0x0f;\n  for (let i = 0; i &lt; data.beaconCount; i++) {\n    var index = 2 + 5 * i;\n    var major = (((bytes&#91;index] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;index + 1] &amp; 0xff))\n      .toString(16)\n      .toUpperCase()\n      .padStart(4, \"0\");\n    var minor = (((bytes&#91;index + 2] &lt;&lt; 8) &amp; 0xff00) | (bytes&#91;index + 3] &amp; 0xff))\n      .toString(16)\n      .toUpperCase()\n      .padStart(4, \"0\");\n    var <a href=\"https:\/\/www.lansitec.com\/blogs\/rssi-indoor-positioning\/\">rssi<\/a> = bytes&#91;index + 4] - 256 + \"dBm\";\n\n    data&#91;\"beacon\" + (i + 1)] = major + minor;\n    data&#91;\"<a href=\"https:\/\/www.lansitec.com\/blogs\/rssi-indoor-positioning\/\">rssi<\/a>\" + (i + 1)] = <a href=\"https:\/\/www.lansitec.com\/blogs\/rssi-indoor-positioning\/\">rssi<\/a>;\n  }\n\n  return data;\n}\n\n\/\/ type: 0x05 Alarm\nfunction decodeAlarm(bytes) {\n  var data = {};\n  data.type = \"AlarmMessage\";\n  var alarmValue = bytes&#91;1] &amp; 0x0f;\n  if (alarmValue == 5) {\n    data.alarm = \"TamperDetection\";\n  }\n  return data;\n}\n\n\/\/ type: 0x06 Configuration Parameter Response\nfunction decodeConfigParameterResponse(bytes) {\n  var data = {};\n  data.type = \"ConfigurationParameterResponse\";\n  var parameter = &#91;];\n  let byteLength = bytes.length;\n  var index = 0;\n  while (index + 1 &lt; byteLength) {\n    var commandBitField = {};\n    var parameterType = bytes&#91;index + 1] &amp; 0xff;\n    commandBitField.parameterType = parameterType;\n    var commandBitFieldLength = getCommandBitFieldLength(parameterType);\n    var parameterValue = getParameterValue(bytes, index, commandBitFieldLength);\n    commandBitField.parameterValue = parameterValue;\n    commandBitField.name = getParameterName(parameterType);\n    commandBitField.parameterDefinition = getParameterDefinition(\n      parameterType,\n      parameterValue\n    );\n    index = index + commandBitFieldLength;\n    parameter.push(commandBitField);\n  }\n  data.parameter = parameter;\n  return data;\n}\n\n\/\/ getParameterValue hexString\nfunction getParameterValue(bytes, index, length) {\n  var hexString = \"\";\n  for (var i = 2; i &lt;= length; i++) {\n    var hex = (bytes&#91;index + i] &amp; 0xff).toString(16).toUpperCase();\n    hexString += hex.padStart(2, \"0\");\n  }\n  return hexString;\n}\n\n\/\/ getCommandBitFieldLength\nfunction getCommandBitFieldLength(parameterType) {\n  let lengths = {\n    0x00: 3,\n    0x01: 3,\n    0x02: 3,\n    0x03: 3,\n    0x04: 3,\n    0x05: 2,\n    0x06: 2,\n    0x07: 2,\n    0x0a: 17,\n    0x0b: 17,\n    0x0e: 9,\n    0x1c: 2,\n    0x20: 2,\n    0x29: 2,\n    0x2a: 2,\n    0x2b: 2,\n    0x2e: 2,\n    0x2f: 2,\n    0x30: 2,\n    0x31: 2,\n  };\n  return lengths&#91;parameterType] ?? 0;\n}\n\n\/\/ Parameter Name\nfunction getParameterName(parameterType) {\n  let name = {\n    0x00: \"SoftwareVersion\",\n    0x01: \"HBPeriod\",\n    0x02: \"BlePositionReportInterval\",\n    0x03: \"GNSSPositionReportInterval\",\n    0x04: \"AssetBeaconReportInterval\",\n    0x05: \"BlePositionReceivingDuration\",\n    0x06: \"GNSSPositionReceivingDuration\",\n    0x07: \"AssetBleReceivingDuration\",\n    0x0a: \"PosBeaconUUID\",\n    0x0b: \"AssetBeaconUUID\",\n    0x0e: \"ISMI\",\n    0x1c: \"TamperDetectionEnable\",\n    0x20: \"PositionReportMode\",\n    0x29: \"AssetManagementEnable\",\n    0x2a: \"GNSSFailureReportEnable\",\n    0x2b: \"AssetBeaconSortEnable\",\n    0x2e: \"PowerSwitchEnable\",\n    0x2f: \"NetworkStatusCheck\",\n    0x30: \"GNSSEnableState\",\n    0x31: \"BleEnable\",\n  };\n  return name&#91;parameterType] ?? \"No matching parameter names\";\n}\n\n\/\/ Parameter Definition\nfunction getParameterDefinition(parameterType, parameterValue) {\n  var val = parseInt(parameterValue, 16);\n  let name = {\n    0x00: \"SoftwareVersion\",\n    0x01: val * 30 + \"s, The interval of the heartbeat message, unit: 30s\",\n    0x02: val * 5 + \"s, The interval of Bluetooth position repor, unit: 5s\",\n    0x03: val * 5 + \"s, The interval of GNSS position report, unit: 5s\",\n    0x04: val * 5 + \"s, The interval of asset <a href=\"https:\/\/www.lansitec.com\/bluetooth-beacons\/\">beacons<\/a> report, unit: 5s\",\n    0x05:\n      val * 1 + \"s, The duration of BLE position beacon receiving, unit: 1s\",\n    0x06: val * 5 + \"s, The duration of GNSS position receiving, unit: 5s\",\n    0x07: val * 1 + \"s, The duration of asset beacon receiving, unit 1s\",\n    0x0a: \"PosBeaconUUIDFilter\",\n    0x0b: \"AssetBeaconUUIDFilter\",\n    0x0e: \"ISMI\",\n    0x1c: val == 0 ? \"Disable\" : \"Enable\",\n    0x20:\n      val == 0\n        ? \"Period Mode\"\n        : val == 1\n        ? \" Autonomous Mode\"\n        : \"On-demand Mode\",\n    0x29: val == 0 ? \"Disable\" : \"Enable\",\n    0x2a: val == 0 ? \"Disable\" : \"Enable\",\n    0x2b: val == 0 ? \"Disable\" : \"Enable\",\n    0x2e: val == 0 ? \"Disable\" : \"Enable\",\n    0x2f: val == 0 ? \"Disable\" : \"Enable\",\n    0x30: val == 0 ? \"Disable\" : \"Enable\",\n    0x31: val == 0 ? \"Disable\" : \"Enable\",\n  };\n  return name&#91;parameterType] ?? \"No matching parameter names\";\n}\n\nfunction getDeviceState(val) {\n  var byteArray = hexStringToByteArray(val);\n  var data = {};\n  data.bleEnable = (byteArray&#91;0] &gt;&gt; 7) &amp; 0x01;\n  data.gnssEnable = (byteArray&#91;0] &gt;&gt; 6) &amp; 0x01;\n  data.networkStatusCheck = (byteArray&#91;0] &gt;&gt; 5) &amp; 0x01;\n  data.powerSwitchEnable = (byteArray&#91;0] &gt;&gt; 4) &amp; 0x01;\n  data.assetBeaconSortEnable = (byteArray&#91;0] &gt;&gt; 1) &amp; 0x01;\n  data.gnssFailureReportEnable = byteArray&#91;0] &amp; 0x01;\n  data.assetManagementEnable = (byteArray&#91;1] &gt;&gt; 7) &amp; 0x01;\n  data.posMode = (byteArray&#91;2] &lt;&lt; 6) &amp; 0x0f;\n  data.sosAlarmEnable = (byteArray&#91;2] &gt;&gt; 5) &amp; 0x01;\n  data.fallDetectionAlarmEnable = (byteArray&#91;2] &gt;&gt; 4) &amp; 0x01;\n  data.specialBeaconnable = (byteArray&#91;2] &gt;&gt; 3) &amp; 0x01;\n  data.searchAlarmEnable = (byteArray&#91;2] &gt;&gt; 1) &amp; 0x01;\n  return data;\n}\n\n\/\/ Floating point conversion\nfunction hex2float(num) {\n  var sign = num &amp; 0x80000000 ? -1 : 1;\n  var exponent = ((num &gt;&gt; 23) &amp; 0xff) - 127;\n  var mantissa = 1 + (num &amp; 0x7fffff) \/ 0x7fffff;\n  return sign * mantissa * Math.pow(2, exponent);\n}\n\nfunction asciiToHex(str) {\n  var hexString = \"\";\n  for (let i = 0; i &lt; str.length; i++) {\n    var hex = str.charCodeAt(i).toString(16);\n    hexString += hex.padStart(2, \"0\");\n  }\n  return hexString;\n}\n\nfunction hexStringToByteArray(hexString) {\n  var byteArray = &#91;];\n  for (let i = 0; i &lt; hexString.length; i += 2) {\n    byteArray.push(parseInt(hexString.substr(i, 2), 16));\n  }\n  return new Uint8Array(byteArray);\n}\n\nfunction timestampToTime(timestamp) {\n  const date = new Date(timestamp);\n  const year = date.getFullYear();\n  const month = (date.getMonth() + 1).toString().padStart(2, \"0\");\n  const day = date.getDate().toString().padStart(2, \"0\");\n  const hour = date.getHours().toString().padStart(2, \"0\");\n  const minute = date.getMinutes().toString().padStart(2, \"0\");\n  const second = date.getSeconds().toString().padStart(2, \"0\");\n  return `${year}-${month}-${day} ${hour}:${minute}:${second}`;\n}\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>","protected":false},"excerpt":{"rendered":"<p>To create automatically uplink and downlink messages, please refer to this page:Lansitec Decoder &#8211; Live Calculator &#8211; Lansitec Below the full decoder code:<\/p>","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"doc_category":[338],"doc_tag":[],"class_list":["post-19723","docs","type-docs","status-publish","hentry","doc_category-decoders"],"year_month":"2026-08","word_count":1290,"total_views":"6","reactions":{"happy":"0","normal":"0","sad":"0"},"author_info":{"name":"\ub9c8\uc774\uc9c0","author_nicename":"maizi","author_url":"https:\/\/www.lansitec.com\/ko\/author\/maizi\/"},"doc_category_info":[{"term_name":"Decoders","term_url":"https:\/\/www.lansitec.com\/ko\/doc\/decoders\/"}],"doc_tag_info":[],"knowledge_base_info":[],"knowledge_base_slug":[],"_links":{"self":[{"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/docs\/19723","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/comments?post=19723"}],"version-history":[{"count":2,"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/docs\/19723\/revisions"}],"predecessor-version":[{"id":19735,"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/docs\/19723\/revisions\/19735"}],"wp:attachment":[{"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/media?parent=19723"}],"wp:term":[{"taxonomy":"doc_category","embeddable":true,"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/doc_category?post=19723"},{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.lansitec.com\/ko\/wp-json\/wp\/v2\/doc_tag?post=19723"}],"curies":[{"name":"\uc6cc\ub4dc\ud504\ub808\uc2a4","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}