AutoGRAPH.NET Service GetTrips (EN) — различия между версиями

Материал из TK
Перейти к: навигация, поиск
(Новая страница: «Get trips of device(s) for period. == WCF == Definition: <syntaxhighlight lang="csharp"> Dictionary<Guid,RTrips> GetTrips(string schemaName, Guid[] deviceI…»)
 
Строка 3: Строка 3:
 
== WCF ==
 
== WCF ==
   
Definition: <syntaxhighlight lang="csharp">
+
Definition:
Dictionary<Guid,RTrips> GetTrips(string schemaName, Guid[] deviceIDs, DateTime SD, DateTime ED)
+
<pre>Dictionary<Guid,RTrips> GetTrips(string schemaName, Guid[] deviceIDs, DateTime SD, DateTime ED)</pre>
</syntaxhighlight>
 
   
 
*schemaName – schema name from EnumSchemas
 
*schemaName – schema name from EnumSchemas
Строка 11: Строка 10:
 
*SD / ED – date/time of start and end period. Date/time must be local.
 
*SD / ED – date/time of start and end period. Date/time must be local.
   
  +
Result:
Result: <syntaxhighlight lang="csharp">
 
  +
<pre>
 
public class RTrips
 
public class RTrips
 
{
 
{
Строка 51: Строка 51:
 
public object[] Values { get; set; } // values for columns (count and order of columns is same of RTripStage.Params)
 
public object[] Values { get; set; } // values for columns (count and order of columns is same of RTripStage.Params)
 
}
 
}
  +
</pre>
</syntaxhighlight>
 
   
Returned data matching&nbsp;with [[AutoGRAPH.NET]]:
+
Returned data matching with [[AutoGRAPH.NET]]:
   
 
{| border="0" cellspacing="0" cellpadding="0" style="width: 100%;"
 
{| border="0" cellspacing="0" cellpadding="0" style="width: 100%;"
Строка 65: Строка 65:
 
http://localhost:8300/GetTrips/Demo/25f86189-adc9-445d-940c-abf860874622,d090286c-1fd6-4ef2-ae44-8091d04408d1/20150413-0000/20150413-2359</pre>
 
http://localhost:8300/GetTrips/Demo/25f86189-adc9-445d-940c-abf860874622,d090286c-1fd6-4ef2-ae44-8091d04408d1/20150413-0000/20150413-2359</pre>
   
Date/time must be passed&nbsp;in&nbsp;'''yyyyMMdd-HHmm''' format<br/>If you want pass many device IDs&nbsp;- you must pass this ID's as comma-separated.
+
Date/time must be passed in '''yyyyMMdd-HHmm''' format<br/>If you want pass many device IDs&nbsp;- you must pass this ID's as comma-separated.
   
 
Result: [[Media:GetTrips-result.json.txt|download file]]
 
Result: [[Media:GetTrips-result.json.txt|download file]]

Версия 22:13, 27 сентября 2015

Get trips of device(s) for period.

WCF

Definition:

Dictionary<Guid,RTrips> GetTrips(string schemaName, Guid[] deviceIDs, DateTime SD, DateTime ED)
  • schemaName – schema name from EnumSchemas
  • deviceIDs – device ID list (from EnumDevices – ID field in RGroupItem class)
  • SD / ED – date/time of start and end period. Date/time must be local.

Result:

public class RTrips
{
   public Guid ID { get; set; }               // device ID
   public string Name { get; set; }           // device name
   public RTrip[] Trips { get; set; }         // trips
   public Dictionary<string,object> Total { get; set; } // final data
}

public class RTrip
{
   public int Index { get; set; }             // trip index, starting from 0
   public DateTime SD { get; set; }           // UTC date/time of trip start
   public DateTime ED { get; set; }           // UTC date/time of trip end
   public RPoint PointStart { get; set; }     // location of trip start
   public RPoint PointEnd { get; set; }       // location of trip end
   public RTripStage[] Stages { get; set; }   // trip stages (fuel, geofeofences, sensors switching, etc)
   public Dictionary<string,object> Total { get; set; } // trips parameters (=columns)
}

public class RTripStage // trip stage (fuel pumping, stops, geofences, etc)
{
   public string Name { get; set; }                      // internal stage name (for example, Stops for stops and GeoFence1 for geofences)
   public string[] Params { get; set; }                  // list of columns in stage - for example "Motion", "Daylight", "Speed", "Speed Avg" 
   public RTripStageItem[] Items { get; set; }           // rows(=items) of stage
   public RParameterStatus[] Statuses { get; set; }      // list of available statuses for this stage ("Flight", "Stopped", "Motion" for "Motion" stage for example)
   public Dictionary<string,object> Total { get; set; }  // final data for stage (=summary data for all items)
}

public class RTripStageItem
{
   public int Index { get; set; }                      // stage item index, starting from 0
   public DateTime SD { get; set; }                    // UTC date/time of item start
   public DateTime ED { get; set; }                    // UTC date/time of item end
   public int Status { get; set; }                     // status ID (0 = of status (or between switchings), >0 = index of status in Statuses RTripStage.field)
   public Guid StatusID { get; set; }                  // ID of geofence (if stage for geofence)
   public Guid[] StatusIDs { get; set; }               // ID of additional geofences (if schema has overlapped geofences and device in some geofences in one time)
   public string Caption { get; set; }                 // UI friendly status name (Move, Park, ...), geofence name, driver first/last name, ...
   public object[] Values { get; set; }                // values for columns (count and order of columns is same of RTripStage.Params)
}

Returned data matching with AutoGRAPH.NET:

AutoGRAPHNET_Service_GetTrips_table.png

JSON

Calling:

http://localhost:8300/GetTrips/Demo/25f86189-adc9-445d-940c-abf860874622/20150413-0000/20150413-2359
http://localhost:8300/GetTrips/Demo/25f86189-adc9-445d-940c-abf860874622,d090286c-1fd6-4ef2-ae44-8091d04408d1/20150413-0000/20150413-2359

Date/time must be passed in yyyyMMdd-HHmm format
If you want pass many device IDs - you must pass this ID's as comma-separated.

Result: download file

AutoGRAPHNET Service GetTrips.png