Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
en:sidebar:remoteapi:apiref:events:get [03/10/2016 13:35]
stan
en:sidebar:remoteapi:apiref:events:get [03/10/2016 13:44]
stan
Line 39: Line 39:
 | timeFrom | interval start, UNIX-time | | timeFrom | interval start, UNIX-time |
 | timeTo | interval end, UNIX-time | | timeTo | interval end, UNIX-time |
-| detalization ​| [[./​check_updates#​output_flags|output flags]] |+| detalization | output flags (see below) ​|
 | indexFrom | index of the first event requested | | indexFrom | index of the first event requested |
 | indexTo | index of the last event requested | | indexTo | index of the last event requested |
Line 54: Line 54:
 | 0x80 | add summary | | 0x80 | add summary |
  
-=====Response===== +===== Custom events intervals =====
-Reponse depends on ''​type''​ specified.\\ +
-Look at [[./​check_updates#​response|events/​check_updates]] response. +
- +
-====== Custom events intervals ​======+
 To get custom events intervals use expression in **%%"​expr":<​text>​%%** param instead **type** param. To get custom events intervals use expression in **%%"​expr":<​text>​%%** param instead **type** param.
  
Line 72: Line 68:
  
 =====Response===== =====Response=====
 +Reponse depends on ''​type''​ specified.\\
 +
 +==== 0x1 flag ====
 +Returns basic JSON (equal to all sensor groups)
 +<code javascript>​
 +"<​type_name>":​ {
 + "<​sensor_id>":​ {
 + "​from":​ {
 + "​t":<​uint>,​ /​* time (UNIX-time) */
 + "​y":<​double>,​ /​* latitude */
 + "​x":<​double>​ /​* longitude */
 + },
 + "​to":​ {
 + "​t":<​uint>,​ /​* time (UNIX-time) */
 + "​y":<​double>,​ /​* latitude */
 + "​x":<​double>​ /​* longitude */
 + },
 + "​m":<​uint>,​ /​* last message received time */
 + "​f":<​uint>​ /* service flag */
 + }
 +}
 +</​code>​
 +
 +==== 0x2 flag ====
 +Returns specified detector data
 +<code javascript>​
 +
 +"​ignition":​ {
 + "<​sensor_id>": ​
 + {
 +     "​state":<​uint>,​ /​* state: 0 - off, 1 - on */
 +     "​type":​ 1, /* sensor type: switcher sensor */
 +     "​hours":<​uint>,​ /​* engine hours for all history, sec */
 +     "​switches":<​uint>,​ /​* number of swithes for all hoistory */
 +     "​value":<​bool>​ /​* current value */
 + }
 + ...
 +}
 +</​code>​
 +Here are listed all sensor types for **sensors**:​
 +<code javascript>​
 +"​sensors":​ {
 + "<​sensor_id1>": ​
 + {
 +     "​state":<​uint>,​ /​* state: 0 - off, 1 - on */
 +     "​type":​ 1, /* sensor type: switcher sensor */
 +     "​hours":<​uint>,​ /​* engine hours for all history, sec */
 +     "​switches":<​uint>,​ /​* number of swithes for all hoistory */
 +     "​value":<​bool>​ /​* current value */
 + },
 + "<​sensor_id2>": ​
 + {
 +     "​type":​ 2, /* sensor type: instant sensor */
 +     "​counter":<​uint>,​ /​* message sequence conuter in event */
 +     "​summary":<​uint>,​ /​* value summary in event */
 +     "​total_counter":<​uint>,​ /​* number of messages in history */
 +     "​total_summary"<​uint>,​ /​* value summary in history */
 +     "​value":<​double>​ /* last value; if -348201.3876 -- value unknown */
 + },
 + "<​sensor_id3>": ​
 + {
 +     "​type":​ 3, /* sensor type: differential sensor */
 +     "​counter":<​uint>,​ /​* value sum in event */
 +     "​total_counter":<​uint>,​ /​* value sum in history */
 +     "​value":<​double>​ /* last value; if -348201.3876 -- value unknown */
 + },
 + "<​sensor_id4>": ​
 + {
 +     "​type":​ 4, /* sensor type: analog sensor */
 +     "​value":<​double>​ /* last value; if -348201.3876 -- value unknown */
 + }
 +}
 +</​code>​
 +
 +
 +<code javascript>​
 +"​lls":​ {
 + "<​sensor_id>":​
 + {
 +     "​value":<​double>,​ /* last message value with calculated level */
 +     "​level":<​double>,​ /* average median value  (FLS filtration value is used) */
 +     "​filled":<​double>​ /* fuel filled */
 + }
 +}
 +</​code>​
 +
 +
 +<code javascript>​
 +"​trips":​ {
 + "​state":<​bool>,​ /​* state: 0 - parking, 1 - trip, 2 - stop */
 + "​max_speed":<​uint>,​ /​* max speed in trip */
 + "​curr_speed":<​uint>,​ /​* current speed */
 + "​avg_speed":<​uint>,​ /​* average speed according to distance */
 + "​distance":<​uint>,​ /​* GPS mileage in trip */
 + "​odometer":<​uint>,​ /​* distance for all trips */
 + "​course":<​uint>,​ /​* course */
 + "​altitude":<​uint>​ /​* altitude */
 +}
 +</​code>​
 +
 +<code javascript>​
 +"​counters":​ {
 + "​engine_hours":​ <​uint>, ​  /* engine hours counter */
 + "​mileage":​ <​uint>, ​       /* mileage counter */
 + "​bytes":​ <​uint> ​          /* GPRS traffic counter */ 
 +}
 +</​code>​
 +
 +
 +==== 0x4 flag ====
 +Returns user parameters
 +Response depends on user definitions for current event.
 +<code javascript>​
 +"<​type_name>":​ {
 + "<​sensor_id>":​ {
 + "​p":​{ /​* user-defined object content */
 + "​test":​2,​
 + "​foo":"​bar",​
 + "​trips":​1
 + }
 + }
 +}
 +</​code>​
 +==== 0x10 flag ====
 +Returns full JSON
 +For sensors with both ''​type=2''​ and ''​type=3''​ (except FLS):
 +<code javascript>​
 +"​sensors":​ {
 + "<​sensor_id>": ​
 + {
 +     "​msgs":​ [
 + {
 +     "​tm":<​uint>,​ /​* message time, UNIX-time */
 +     "​v":<​double>​ /​* value */
 + },
 + ...
 +     ]
 + },
 + ...
 +}
 +</​code>​
 +For FLS:
 +<code javascript>​
 +"​lls":​ {
 + "<​sensor_id>":​ {
 + "​msgs":​ [
 +     {
 + "​tm":<​uint>,​ /​* message time, UNIX-time */
 + "​v":<​double>,​ /​* value */
 + "​l":<​double>​ /​* average median value  (FLS filtration value is used) */
 +     },
 +     ...
 + ]
 + }
 + },
 + ...
 +}
 +</​code>​
 +==== 0x20 flag ====
 +Returns formatted values
 +<code javascript>​
 +"​ignition":​ {
 + "​sensor_id":​ {
 + "​format":​ {
 +     "​value":<​text>​ /​* formatted value  (usually "​On"/"​Off"​) */
 + }
 + }
 +}
 +</​code>​
 +
 +<code javascript>​
 +"​sensors":​ {
 + "​sensor_id":​ {
 + "​format":​ {
 +     "​value":<​text>​ /​* formatted value, depends on sensor type and format */
 + }
 + }
 +}
 +</​code>​
 +
 +<code javascript>​
 +"​trips":​ {
 + "​format":​ {
 + "​distance":<​text>,​ /​* distance according to prev message */
 + "​avg_speed":<​text>​ /​* average speed according to "​distance" ​ */
 + }
 +}
 +</​code>​
 +
 +<code javascript>​
 +"​lls":​ {
 + "​sensor_id":​ {
 + "​format":​ {
 +     "​value":<​text>,​ /​* formatted value, depends on sensor type and format */
 +     "​filled":<​text>​ /​* fuel filled */
 + }
 + }
 +}
 +</​code>​
 +
 +<code javascript>​
 +"​counters":​ {
 + "​format":​ {
 + "​engine_hours":<​uint>, ​  /* formatted value of engine hours counter */
 + "​mileage":<​text>, ​       /* formatted value of mileage counter */
 + "​bytes":<​uint> ​          /* formatted value of GPRS traffic counter */ 
 + }
 +}
 +</​code>​
  
 ====0x40 flag==== ====0x40 flag====
Follow us on Facebook Gurtam Wialon Twitter Gurtam Wialon info@gurtam.com   |   Copyright © 2002-2024 Gurtam