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.

Unit flags:

Value Description
0x00000001 base flag
0x00000002 custom properties
0x00000004 billing properties
0x00000008 custom fields
0x00000010 image
0x00000020 messages
0x00000040 GUID
0x00000080 administrative fields
0x00000100 advanced properties
0x00000200 available for current moment commands
0x00000400 last message and position
0x00001000 sensors
0x00002000 counters
0x00008000 maintenance
0x00020000 unit configuration in reports: trip detector and fuel consumption
0x00080000 list of all possible commands for current unit
0x00100000 message parameters
0x00400000 position
0x3FFFFFFFFFFFFFFF set all possible flags to unit

General properties

Flag - 0x00000001

{
	"mu":<uint>,	/* measure units: 0 - si, 1 - us, 2 - imperial */
	"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 */
		"dehr":<text>,			/* daily engine hours rate, in seconds */
		"img_rot":<text>,		/* rotate images: "1" - yes, "0" - no */
		"mcoef":<text>,			/* mileage coefficient */
		"mmi":<text>,			/* maximum interval between messages, in seconds */
		"monitoring_sensor":<text>,	/* table of colors for track by sensor */
		"monitoring_sensor_id":<text>,	/* sensor ID which will be shown in monitoring panel */
		"msl":<text>,			/* speed limit, km/h */
		"mus":<text>,			/* urban speed limit, k/h */
		"sensors_colors_id":<text>,	/* sensor ID for sensor based track colors */
		...
	}
}

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

{
	"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) */
	"hw":<long>,	/* hardware type */
	"ph":<text>,	/* phone number */
	"ph2":<text>,	/* second phone number */
	"psw":<text>	/* password */
}

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 */
			"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":<int>		/* filter quality (0..255) */
		},
		"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 */
			"loadCoef":<double>		/* coefficient when moving under load */
		},
		"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 */
		},
		...
	}
}

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 */
	}
}
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam