Skip to content

Instantly share code, notes, and snippets.

@tcha-tcho
Created November 7, 2024 15:36
Show Gist options
  • Save tcha-tcho/71fb106136b48baf52ab15bf61d7cc8b to your computer and use it in GitHub Desktop.
Save tcha-tcho/71fb106136b48baf52ab15bf61d7cc8b to your computer and use it in GitHub Desktop.
// Shorten names
// types:
export const STRING = "STRING";
export const BYTES = "BYTES";
export const INTEGER = "INTEGER";
export const FLOAT = "FLOAT";
export const NUMERIC = "NUMERIC";
export const BOOLEAN = "BOOLEAN";
export const TIMESTAMP = "TIMESTAMP";
export const DATE = "DATE";
export const TIME = "TIME";
export const TIMESTAMP = "TIMESTAMP";
export const DATETIME = "DATETIME";
export const GEOGRAPHY = "GEOGRAPHY";
export const INTERVAL = "INTERVAL";
export const JSON = "JSON";
export const RANGE = "RANGE";
export const STRUCT = "STRUCT";
export const SHORTEN_NAMES = {
"deviceId": ["imei", STRING]
,"uniqueId": ["imei", STRING]
,"in1": ["in1", BOOLEAN] // – ign: ignition
,"out1": ["out1", JSON]
,"blocked": ["out1", BOOLEAN] // realocation
,"engine_hours": ["eh", NUMERIC]
,"engineHours": ["eh", NUMERIC]
,"odometer": ["odo", NUMERIC] // meters
,"power": ["pwr", NUMERIC] // vols –> use getPower – batteryVolts
,"sat": ["sat", NUMERIC] // in use -> é o gps
,"latitude": ["lat", NUMERIC]
,"longitude": ["lng", NUMERIC]
,"position": ["pos", GEOGRAPHY]
,"speed": ["spd", NUMERIC] // -> use getSpeed
,"valid": ["ok", BOOLEAN]
,"time": ["t", TIMESTAMP]
,"deviceTime": ["dt", TIMESTAMP]
,"serverTime": ["st", TIMESTAMP]
,"fixTime": ["ft", TIMESTAMP]
,"alarm": ["alrm", STRING]
,"alert": ["alrt", STRING]
,"angle": ["angle", NUMERIC]
,"outdated": ["old", BOOLEAN]
,"network": ["net", NUMERIC]
,"event": ["evt", STRING]
,"status": ["stat", STRING]
,"batteryLevel": ["battlvl", NUMERIC] // percentage
,"ignition": ["ign", BOOLEAN] // ign
,"result": ["res", STRING]
,"driverUniqueId": ["drvuid", STRING]
,"sos": ["sos", BOOLEAN]
,"vibration": ["vib", BOOLEAN]
,"powerCut": ["pcut", BOOLEAN]
,"temperature": ["temp", NUMERIC]
// recorded in 'data' KEY
,"": ["ssid", JSON]
,"tid": ["id", JSON]
,"in2": ["in2", JSON]
,"in3": ["in3", JSON]
,"out2": ["out2", JSON]
,"out3": ["out3", JSON]
,"distance": ["dis", JSON] // meters -> validar qual é o usado distance|tdis
,"totalDistance": ["tdis", JSON] // meters ,"type": "tp","versionFw": "vf"
,"versionHw": ["vh", JSON]
,"protocol": ["prot", JSON]
,"sequence": ["seq", JSON]
,"altitude": ["alt", JSON]
,"course": ["cs", JSON]
,"address": ["adr", JSON]
,"accuracy": ["accu", JSON]
,"raw": ["raw", JSON]
,"index": ["idx", JSON]
,"hdop": ["hdop", JSON]
,"vdop": ["vdop", JSON]
,"pdop": ["pdop", JSON]
,"satVisible": ["satv", JSON]
,"rssi": ["rssi", JSON]
,"gps": ["gps", JSON]
,"roaming": ["roam", JSON]
,"serviceOdometer": ["srvodo", JSON] // meters
,"tripOdometer": ["tripodo", JSON] // meters
,"hours": ["hs", JSON]
,"steps": ["steps", JSON]
,"heartRate": ["heart", JSON]
,"input": ["inpt", JSON]
,"output": ["outpt", JSON]
,"image": ["img", JSON]
,"video": ["vid", JSON]
,"audio": ["aud", JSON]
// The units for the below four KEYs currently vary.
// The preferred units of measure are specified in the comment for each.
,"battery": ["batt", JSON] // volts
,"fuel": ["fuel", JSON] // liters
,"fuelUsed": ["fuelu", JSON] // liters
,"fuelConsumption": ["fuelc", JSON] // liters/hour
,"flags": ["flags", JSON]
,"antenna": ["ant", JSON]
,"charge": ["chg", JSON]
,"ip": ["ip", JSON]
,"archive": ["arch", JSON]
,"rpm": ["rpm", JSON]
,"vin": ["vin", JSON]
,"approximate": ["approx", JSON]
,"throttle": ["throttle", JSON]
,"motion": ["mot", JSON]
,"armed": ["armed", JSON]
,"geofence": ["geofc", JSON]
,"acceleration": ["acc", JSON]
,"deviceTemp": ["devtmp", JSON] // celsius
,"coolantTemp": ["cooltmp", JSON] // celsius
,"engineLoad": ["engload", JSON]
,"operator": ["op", JSON]
,"command": ["comm", JSON]
// ,"blocked": ["blkd", JSON] // out1
,"door": ["door", JSON]
,"axleWeight": ["axlwt", JSON]
,"gSensor": ["gsnsr", JSON]
,"iccid": ["iccid", JSON]
,"phone": ["phone", JSON]
,"speedLimit": ["spdlmt", JSON]
,"dtcs": ["dtcs", JSON]
,"obdSpeed": ["obdspd", JSON] // knots
,"obdOdometer": ["obdodo", JSON] // meters
// Start with 1 not 0
,"temp": ["temp", JSON]
,"adc": ["adc", JSON]
,"io": ["io", JSON]
,"count": ["cnt", JSON]
,"in": ["in", JSON]
,"out": ["out", JSON]
,"general": ["gen", JSON]
,"movement": ["mov", JSON]
,"lowspeed": ["lspd", JSON]
,"overspeed": ["ospd", JSON]
,"fallDown": ["fdwn", JSON]
,"lowPower": ["lpwr", JSON]
,"lowBattery": ["lbatt", JSON]
,"fault": ["flt", JSON]
,"powerOff": ["poff", JSON]
,"powerOn": ["pon", JSON]
,"lock": ["lck", JSON]
,"unlock": ["ulck", JSON]
,"geofenceEnter": ["geoin", JSON]
,"geofenceExit": ["geoout", JSON]
,"gpsAntennaCut": ["antcut", JSON]
,"accident": ["accdnt", JSON]
,"tow": ["tow", JSON]
,"idle": ["idle", JSON]
,"highRpm": ["hrpm", JSON]
,"hardAcceleration": ["hrdacc", JSON]
,"hardBraking": ["hrdbrk", JSON]
,"hardCornering": ["hrdcorn", JSON]
,"laneChange": ["lanec", JSON]
,"fatigueDriving": ["ftgue", JSON]
,"powerRestored": ["pres", JSON]
,"jamming": ["jamm", JSON]
,"parking": ["park", JSON]
,"bonnet": ["bonn", JSON]
,"footBrake": ["brake", JSON]
,"fuelLeak": ["fleak", JSON]
,"tampering": ["tamp", JSON]
,"removing": ["rem", JSON]
,"test": ["tst", JSON]
} as Record<string, string>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment