AutoGRAPH.NET Service (EN)
AutoGRAPH.NET Service provide different protocols for integration with external systems. Currently we have two protocols for this: WCF (Windows communication foundation) and JSON for accessing to AutoGRAPH.NET core. Schemas configuration can be changed by AutoGRAPH.NET software. AutoGRAPH.NET Service can be run in two modes: as console application and as system service.
Содержание
Minimal requirements for hardware and software environment
- RAM – from 1 GB
- Windows 2003 or latest
- .NET Framework 4.0 or latest
- Installed (AutoGRAPH DataLoader) or AutoGRAPH Server 3.x or 4.x or 5.x
Download links
Last version: 2015.7.18.1, Download
Console mode
This mode designed for debugging and testing. Simply run AutoGRAPHNETService.exe in console.
Service mode
Installed as system Windows service and working autonomous. Command line for installing:
sc create AutoGRAPHNETService binPath= "C:\TK\WebMapK\Build-Svc\AutoGRAPHNETService.exe"
Don't forget space between binPath= and full path
Configuring
1. Extracting archive with AutoGRAPH.NET Service in some directory 2. Open AutoGRAPHNETService.exe.config in Notepad. You can see next keys in .config file:
<add key="key-file" value="N:\AGServer\AutoGRAPHServer_3.0\30008_4x4_magnitka.agkey"/> <add key="address" value="http://localhost:800/"/> <add key="address-json" value="http://localhost:810/"/> <add key="common-directory" value="C:\ProgramData\AutoGRAPH Shell"/> <add key="data-directory" value="C:\Users\denisio\AppData\Roaming\AutoGRAPH Shell\Data"/>
key-file | .agkey licensing file (from AutoGRAPH.Server), this file contain allowed devices. Required parameter! |
address | local address end point for working with WCF (protocol (httpBinding mode). Uri can be set in url:port format Also, you can use next variations:
|
address-json | local address end point for working with JSON. Uri can be set in url:port format Also, you can use next variations:
|
common-directory |
directory with common data files (directory structure same with directory of AutoGRAPH.NET software – with Schemes, GeoFences, Devices subdirectories with files) |
data-directory |
devices data directory AutoGRAPH DataLoader or AutoGRAPH Server 3.x or 4.x or 5.x |
Save .config file after editing and run service or run in command line. Run next command line for generate .cs file with proxy-class:
svcutil.exe http://localhost:800/?wsdl /async /tcv:Version35 /ser:DataContractSerializer
AutoGRAPHSvc.cs and output.config file will created in current directory. This file configured for use WCF-endpoint of AutGRAPH.NET Service.
Service methods
- EnumSchemas – enumerate allowed schemas
- EnumDevices – enumerate devices in schema
- EnumDrivers – enumerate drivers in schema
- EnumGeoFences – enumerate geofences in schema
- GetGeoFences – get information about geofences (points, polygons, etc)
- GetDevicesInfo – get information about devices in schema
- EnumParameters – get schema parameters
- GetOnlineInfo – get device(s) last position and last date/time information
- GetOnlineInfoAll - get device(s) last position and last date/time information (for ALL devices in schema)
- GetDataRanges – get allowed data files from devices
- GetTrips – get trips information for specified device(s)
- GetTripsCustom – get trips information with custom geofences
- GetStage – get single stage information of specified device(s)
- GetTrack – get track information (date/time/coordinates/speed/...) of specified device(s)
- GetProperties – get property and values list of specified device(s)
- GetProperty – get single property value of specified device(s)
- GetRoute – calculate route between specified points
- WaitData - wait for new device data
- EnumReports - get allowed reports
- GetReports - run reports and download in XML/PDF/DOCX/XLS/.../ZIP-file
- ExecuteReports - run report asynchronously
- GetReportsStatus - get report executing status (for asynchronous executing)
- CancelReports - cancel report creating
Examples
using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Text; using AutoGRAPHService; namespace AutoGRAPHSvcTest { class Program { static void Main(string[] args) { var svc = new AutoGRAPHSvcClient(); // make proxy class with default end points RSchema[] schemas; using (var f = new TimeCalc("EnumSchemas")) // get schemas list schemas = svc.EnumSchemas(); REnumDevices devices; using (var f = new TimeCalc("EnumDevices")) devices = svc.EnumDevices(schemas[0].Name); // get device list for first allowed schema foreach (var item in devices.Items) Console.WriteLine("\t" + item.Name); using (var f = new TimeCalc("EnumGeoFences")) // get geofences list svc.EnumGeoFences(schemas[0].Name); using (var f = new TimeCalc("GetDevicesInfo")) svc.GetDevicesInfo(schemas[0].Name); using (var f = new TimeCalc("EnumParameters")) // get parameter list for all devices in schema svc.EnumParameters(schemas[0].Name, devices.Items.Select(p => p.ID).ToArray()); using (var f = new TimeCalc("GetOnlineInfo")) // get online status of devices svc.GetOnlineInfo(schemas[0].Name, devices.Items.Select(p => p.ID).ToArray()); using (var f = new TimeCalc("GetTrips")) // get trips list for last 5 days of all devices with numbers more than 9999998 svc.GetTrips(schemas[0].Name, devices.Items.Where(p => p.Serial >= 9999998).Select(p => p.ID).ToArray(), DateTime.Now.AddDays(-5), DateTime.Now); using (var f = new TimeCalc("GetTrack")) // get tracks for last 5 days of all devices with numbers more than 9999998 { var t1 = svc.GetTrack(schemas[0].Name, devices.Items.Where(p => p.Serial >= 9999998).Select(p => p.ID).ToArray(), DateTime.Now.AddDays(-5), DateTime.Now); } Console.ReadLine(); } } // simple class for calculating running time class TimeCalc:IDisposable { readonly DateTime DT; readonly string name; internal TimeCalc(string name) { DT = DateTime.Now; this.name = name; } void IDisposable.Dispose() { Console.WriteLine(name+": "+DateTime.Now.Subtract(DT).TotalSeconds.ToString("F3", CultureInfo.InvariantCulture)); } } }
.exe.config of this example
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <bindings> <basicHttpBinding> <binding name="BasicHttpBinding_IAutoGRAPHSvc" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"> <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="16348" maxBytesPerRead="4096" maxNameTableCharCount="16384" /> <security mode="None"> <transport clientCredentialType="None" proxyCredentialType="None" realm="" /> <message clientCredentialType="UserName" algorithmSuite="Default" /> </security> </binding> </basicHttpBinding> </bindings> <client> <endpoint address="http://localhost:800/" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAutoGRAPHSvc" contract="IAutoGRAPHSvc" name="BasicHttpBinding_IAutoGRAPHSvc" /> </client> </system.serviceModel> </configuration>