Units

The format of the response can differ depending on set flags.

This chapter describes flags that can be applied to units and parts of resulting JSON which they are responsible for. If you specify several flags, then parts will be gathered into one JSON.

:!: All flags are only used in DEC format.

Unit flags:

Value HEX Value DEC Description
0x00000001 1 base flag
0x00000002 2 custom properties
0x00000004 4 billing properties
0x00000008 8 custom fields
0x00000010 16 image
0x00000020 32 messages
0x00000040 64 GUID
0x00000080 128 administrative fields
0x00000100 256 advanced properties
0x00000200 512 available for current moment commands
0x00000400 1024 last message and position
0x00001000 4096 sensors
0x00002000 8192 counters
0x00008000 32768 maintenance
0x00020000 131072 unit configuration in reports: trip detector and fuel consumption
0x00080000 524288 list of all possible commands for current unit
0x00100000 1048576 message parameters
0x00200000 2097152 unit connection status
0x00400000 4194304 position
0x00800000 8388608 profile fields
0x3FFFFFFFFFFFFFFF 4611686018427387903 set all possible flags to unit

General properties

Flag - 0x00000001

{
	"mu":<uint>,	/* measure units: 0 - si, 1 - us, 2 - imperial, 3 - metric with gallons */
	"nm":<text>,	/* name */
	"cls":<uint>,	/* superclass ID: "avl_unit" */
	"id":<uint>,	/* unit ID */
	"uacl":<uint>	/* current user access level for unit */
}

Custom properties

Flag - 0x00000002

You can store any data you need in custom properties.

{
	"prp":{					/* custom properties */
		"img_rot":<text>,		/* rotate images: "1" - yes, "0" - no */
		"monitoring_sensor_id":<text>,	/* sensor ID which will be shown in monitoring panel */
		"motion_state_sensor_id":<text>,/* sensor - source of motion state ID */
		"sensors_colors_id":<text>,	/* sensor - source of track colour */
		"use_sensor_color":<text>, 	/* use sensor color in monitoring panel: "1" - yes, "0" - no */
		/* used one of parameters to choose source of color for track */
		"sensors_colors":<text>,	/* table of colors for track by sensor */
		"label_color":<text>, 	/* unit label color */
		"solid_colors":<text>,		/* color for track */	
		"speed_colors":<text>,		/* table of colors for track by speed */
		/* used for storage last used colors */
		"track_sensor":<text>,		/* table of colors for track by sensor */
		"track_solid":<text>,		/* color for track */
		"track_speed":<text>,		/* table of colors for track by speed */
"monitoring_battery_id":<text>,          /* sensor ID which shows battery status */
		...
	},
	"ct":<uint>			/* creation time */
}

Billing

Flag - 0x00000004

{
	"crt":<uint>,	/* creator ID */
	"bact":<uint>	/* account ID */
}

Custom fields

Flag - 0x00000008

{
	"flds":{	/* custom fields */		
		<text>:{	/* sequence number */
			"id":<uint>,	/* ID */
			"n":<text>,	/* name */
			"v":<text>	/* value */
		},
		...
	},
	"fldsmax":<long>,	/* maximal count of custom fields (-1 - unlimited) */
}

Unit image

Flag - 0x00000010

{
	"uri":<text>	/* image link */
	"ugi":<uint>	/* image changes counter */
}

Messages

Flag - 0x00000020

After setting this flag you can receive messages from unit.

{}

GUID

Flag - 0x00000040

{
	"gd":<text>	/* unit GUID */
}

Administrative fields

Flag - 0x00000080

{
	"aflds":{	/* administrative fields */		
		<text>:{	/* sequence number */
			"id":<uint>,	/* ID */
			"n":<text>,	/* name */
			"v":<text>	/* value */
		},
		...
	},
	"afldsmax":<long>,	/* maximal count of administrative fields (-1 - unlimited) */
}

Advanced properties

Flag - 0x00000100

{
	"uid":<text>,	/* unique ID (hardware) */
	"uid2":<text>,	/* second unique ID (hardware) */
	"hw":<long>,	/* hardware type */
	"ph":<text>,	/* phone number */
	"ph2":<text>,	/* second phone number */
	"psw":<text>	/* password */
	"act":<bool>	/* unit deactivated - 0, activated - 1 */
	"dactt":<long>	/* deactivation time UNIX, 0 - unit is activated */
	"vp":{		/* video properties */
		"packets": <int>,		/* number of purchased traffic packages */
		"bytes_in": <long>,		/* consumed traffic */
		"bytes_limit": <long>,		/* traffic limit */
		"hdd_used": <long>,		/* total size of files in storage */
		"hdd_limit": <long>,		/* storage limit */
		"autopay": <int>,		/* set limit for auto-purchase of traffic packages */
		"status_flags": <int>,		/* billing status in bits. 1 - active by the system, 2 - active by the user */
		"available_traffic": <long>,	/* available traffic */
		"status_ch_ts": <long>		/* last time the traffic count was updated */
		}
 
}

Available commands

Flag - 0x00000200

{
	"cmds":[		/* array of commands */
		{			
			"n":<text>,	/* name */
			"a":<uint>,	/* access level (access rights that user must have to execute current command) */
			"t":<text>,	/* link type */
			"c":<text>	/* command type */
		}
	]
}

Types of commands and links are described in the chapter Commands: create, edit, delete, list of access flags for units are given in the chapters Access flags: General and Access flags: Units and unit groups.

Last message and position

Flag - 0x00000400

{
	"pos":{			/* last known position */
		"t":<uint>,		/* time (UTC) */
		"y":<double>,		/* latitude */
		"x":<double>,		/* longitude */
		"z":<double>,		/* altitude */
		"s":<int>,		/* speed */
		"c":<int>,		/* course */
		"sc":<int>		/* satellites count */
	},
	"lmsg":{		/* last known message */
		...
	}
}

Message format depends on its type, all types are described in the chapter Data format: Messages.

Sensors

Flag - 0x00001000

{
	"sens":{		/* sensors */
		<text>:{		/* sequence number of sensor */
			"id":<long>,		/* ID */
			"n":<text>,		/* name */
			"t":<text>,		/* type */
			"d":<text>,		/* description */
			"m":<text>,		/* metrics */
			"p":<text>,		/* parameter */
			"f":<uint>,		/* sensor flags */ 
			"c":<text>,		/* configuration */
			"vt":<uint>,		/* validation type */
			"vs":<uint>,		/* validation sensor ID */
			"ct":<uint>, 		/* sensor creation time*/
			"mt":<uint>, 		/* sensor modification time*/
			"tbl":[			/* calculation table */
				{			/* parameters */
					"x":<double>, 
					"a":<double>,
					"b":<double>
				}
			]
		},
		...
	},
	"sens_max":<long>	/*  maximal count of sensors (-1 - unlimited) */
}

Sensor flags, types of sensors and validation, also examples of configuration are examined in the chapter Sensors: create, update and delete.

Counters

Flag - 0x00002000

{
	"cfl":<uint>,	/* calculation flags */
	"cnm":<uint>,	/* mileage counter, km or miles */
	"cneh":<uint>,	/* engine hours counter, h */
	"cnkb":<uint>	/* GPRS traffic counter, KB */
}

Calculation flags are described in the chapter Counter calculation parameters.

Maintenance

Flag - 0x00008000

{
	"si":{		/* service intervals */
		<text>:{	/* sequence number of service interval */
			"id":<uint>,	/* ID */
			"n":<text>,	/* name */
			"t":<text>,	/* description */
			"im":<uint>,	/* mileage interval */
			"it":<uint>,	/* days interval */
			"ie":<uint>,	/* engine hours interval */
			"pm":<uint>,	/* last service for mileage interval, km */
			"pt":<uint>,	/* last service for days interval, sec (UTC) */
			"pe":<uint>,	/* last service for engine hours interval, h */
			"c":<uint>	/* done times */
		},
		...
	},
	"simax":<long>		 /* maximal count of service intervals (-1 - unlimited) */
}

Trip detector and fuel consumption

Flag - 0x00020000

{
	"rtd":{				/* trip detector */
		"type":<uint>,			/* type of movement detection */
		"gpsCorrection":<int>,		/* allow GPS correction: 0 - no, 1 - yes */
		"minSat":<uint>,		/* min satellites count */
		"minMovingSpeed":<uint>,	/* min moving speed, km/h */
		"minStayTime":<uint>,		/* min parking time, seconds */
		"maxMessagesDistance":<uint>,	/* max distance between messages, meters */
		"minTripTime":<uint>,		/* min trip time, seconds */
		"minTripDistance":<uint>	/* min trip distance, meters */
	},
	"rfc":{				/* fuel consumption */
		"calcTypes":<uint>,		/* type of calculation */
		"fuelLevelParams":{		/* detection of fuel fillings/thefts */
			"flags":<uint>,			/* flags of fillings and thefts */ 
			"ignoreStayTimeout":<uint>,	/* ignore the messages after the start of motion, sec */
			"minFillingVolume":<uint>,	/* minimum fuel filling volume, litres */
			"minTheftTimeout":<uint>,	/* minimum stay timeout to detect fuel theft, sec */
			"minTheftVolume":<uint>,	/* minimum fuel theft volume, litres */
			"filterQuality":<ubyte>,	/* filter quality (0..255) */
			"fillingsJoinInterval":<uint>,	/* timeout to separate consecutive fillings, sec */
			"theftsJoinInterval":<uint>,	/* timeout to separate consecutive thefts, sec */
			"extraFillingTimeout":<uint>	/* timeout to detect final filling volume, sec */
		},
		"fuelConsMath":{		/* consumption math */
			"idling":<double>,		/* idling, litres per hour */
			"urban":<double>,		/* urban cycle, litres per 100 km */
			"suburban":<double>		/* suburban cycle, litres per 100 km */
		},
		"fuelConsRates":{		/* consumption by rates */
			"consSummer":<int>,		/* summer consumption, litres per 100 km */
			"consWinter":<int>,		/* winter consumption, litres per 100 km */
			"winterMonthFrom":<int>,	/* winter from (month: 0-11) */
			"winterDayFrom":<int>,		/* winter from (day 1-31) */
			"winterMonthTo":<int>,		/* winter to (month 0-11) */
			"winterDayTo":<int>		/* winter to (day 1-31) */
		},
		"fuelConsImpulse":{		/* impulse fuel consumption sensors */
			"maxImpulses":<int>,		/* max impulses */
			"skipZero":<int>		/* skip first zero value */
		}
	}
}

Type of movement detection are described in the chapter Trip detection, types of calculation of fuel consumption and fillings/thefts flags are described in the chapter Fuel consumption.

Commands

Flag - 0x00080000

{
	"cml":{			/* list of commands */
		<text>:{		/* sequence number of command */
			"id":<uint>,		/* ID */
			"n":<text>,		/* name */
			"c":<text>,		/* type */
			"l":<text>,		/* link type */
			"p":<text>,		/* parameters */
			"a":<uint>,		/* access level (access rights that user must have to execute current command) */
			"f":<uint>		/* phone number flags: 0-any (primary, then secondary), 0x1-primary, 0x2-secondary */
		},
		...
	},
	"cml_max":<long>	/* maximal count of commands (-1 - unlimited)  */
}

Types of commands and links are described in the chapter Commands: create, edit, delete, list of access flags for units are given in the chapters Access flags: General and Access flags: Units and unit groups.

Message parameters

Allows usage of accumulative system of parameters values. Parameters will store in specified section of unit object, which will contain not only values presented in last message but in previous ones also.

Flag - 0x00100000

{
	"prms":{	/* list of message parameters */
		<text>:{	/* parameter name */
			"v":<any>,	/* parameter value */
			"ct":<uint>,	/* time of last value change */
			"at":<uint>	/* time of last message with such parameter */
		},
		...
	}
}

Connection

Unit connection status.

Flag - 0x00200000

{
	"item":{
		"netconn":<bool>
	}
}

Position

Flag - 0x00400000

{
	"pos":{			/* last known position */
		"t":<uint>,		/* time (UTC) */
		"y":<double>,		/* latitude */
		"x":<double>,		/* longitude */
		"z":<double>,		/* altitude */
		"s":<int>,		/* speed */
		"c":<int>,		/* course */
		"sc":<int>		/* satellites count */
	}
}

Profile fields

Flag - 0x00800000

{
	"pflds":{
		"<long>":{		/* field ID */
			"id":<long>,	/* field ID */
			"n":<text>,	/* field name */
			"v":<text>	/* field value */
	}
}
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam