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 groups of a unit
0x00000010 custom fields
0x00000020 GUID
0x00000040 messages
0x00000100 advanced properties
0x00000200 commands
0x00000400 last message and position
0x00000800 unit state
0x00001000 unit image
0x00010000 routes

General properties

Flag - 0x00000001

{
	"nm":<text>,	/* name */
	"cls":<uint>,	/* superclass ID: "avl_unit" */
	"id":<uint>	/* unit ID */
}

Custom properties

Flag - 0x00000002

You can store any data you need in custom properties.

{
	"prp":{		/* custom properties */
		<text>:<text>,	/* name: value */
		...
	},
	"pup":{		/* private and public properties */
		<text>:<text>,	/* name: value */
		...
	}
}

Billing

Flag - 0x00000004

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

Groups of a unit

Flag - 0x00000008

{
	"ugs":[]	/* IDs of groups, into which unit is included */
}

Custom fields

Flag - 0x00000010

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

GUID

Flag - 0x00000020

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

Messages

Flag - 0x00000040

After setting this flag you can receive messages from unit.

{}

Advanced properties

Flag - 0x00000100

{
	"uid":<text>,	/* unique ID (hardware) */
	"hw":<long>,	/* hardware type */
	"ph":<text>,	/* phone number */
	"psw":<text>	/* password */
}

Commands

Flag - 0x00000200

{
	"cmds":{		/* commands */
		<text>:[<text>]		/* link type: array of available command types */
	},
	"cml":{
		<text>:{	/* command ID */
			"nm":<text>,	/* command name */
			"cn":<text>	/* command type */
			"lt":<text>,	/* link type */
			"cp":<text>,	/* parameters */
		},
		...
	},
	"cml_max":<uint>	/* maximal count of commands (-1 - unlimited) */
}

ТTypes of commands and links are described in the chapter Command parameters.

Last message and position

Flag - 0x00000400

{
	"pos":{			/* last known position */
		"t":<uint>,		/* time UTC */
		"f":<uint>,		/* message flags */
		"tp":<text>,		/* message type */
		"l":<text>,		/* location */
		"y":<double>,		/* latitude */
		"x":<double>,		/* longitude */
		"z":<int>,		/* altitude */
		"s":<int>,		/* speed */
		"c":<int>,		/* course */
		"sc":<int>		/* satellites count */
		"y2":<double>,		/* latitude, locked to road */
		"x2":<double>,		/* longitude, locked to road */
		"i":<uint>,		/* digital input state */
		"o":<uint>,		/* diggital output state */
		"p":{			/* parameters */
			<text>:<double>		/* parameter name: value */
		}
	},
	"lmsg":<text>|{}		/* last known message, if it's coordinates match coordinates from "pos" than value of this field will be equals to "dup" */
}

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

Unit state

Flag - 0x00000800

{
	"drv":<text>,		/* driver code */
	"sens":{		/* sensors */
		<text>:{		/* sequence number of sensor */
			"nm":<text>,	/* name */
			"tp":<text>,	/* type */
			"de":<text>,	/* description */
			"me":<text>,	/* metrics */
			"pn":<text>,	/* parameter */
			"fl":<uint>,	/* sensor flags */ 
			"tbl":[		/* calculation table */
				{		/* parameters */
					"x":<double>, 
					"a":<double>,
					"b":<double>
				}
			],
			"vt":<uint>,	/* validation type */
			"vs":<uint>	/* Ivalidation sensor ID */
		}
	},
	"sens_max":<long>	/* maximal count of sensors (-1 - unlimited) */
	"cfl":<uint>,		/* calculation flags */
	"cnm":<uint>,		/* mileage counter, m */
	"cneh":<uint>,		/* engine hours counter, s */
	"si":{			/* service intervals */
		<text>:{		/* equence number of service interval */
			"id":<uint>,	/* ID */
			"nm":<text>,	/* name */
			"txt":<text>,	/* description */
			"im":<uint>,	/* mileage interval */
			"ids":<uint>,	/* days interval */
			"ie":<uint>,	/* engine hours interval */
			"pm":<uint>,	/* last service for mileage interval, km */
			"pd":<uint>,	/* last service for days interval, sec (UTC) */
			"pe":<uint>,	/* last service for engine hours interval, h */
			"sc":<uint>	/* done times */
		}
	},
	"simax":<long>		 /* maximal count of service intervals (-1 - unlimited) */
}
}

Sensor flags, types of sensors and validation are examined in the chapter Sensors.

Unit image

Flag - 0x00001000

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

Routes

Flag - 0x00010000

{
	"rc":{		/* state of route, on which unit is assigned */
		<text>:{	/* route ID */
			"i":<uint>, 	/* route ID */
			"nm":<text>, 	/* name */
			"de":<text>,	/* description */
			"at":<uint>,	/* activation time */
			"fl":<long>,	/* route flags */
			"st":<long>,	/* route state */
			"pt":<uint>,	/* idex of last visited check point of route */
			"tm":<uint>,	/* time of state changing */
			"ri":<long>,	/* resource ID */
			"z":<long>	/* geofence ID */
		}
	},
 
	"rcmax":<long>	/* maximal count of routes (-1 - unlimited) */
}

Route and state flags are described in chapter Routes: create, edit, delete.

Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam