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

Материал из TK
Перейти к: навигация, поиск
(Новая страница: «Get device list and groups in specified schema (like EnumGeoFences for geofences). You can restore hierarchy by matching I…»)
 
 
(не показаны 2 промежуточные версии этого же участника)
Строка 1: Строка 1:
Get device list and groups in specified schema (like [[AutoGRAPH.NET Service EnumGeoFences|EnumGeoFences]] for geofences). You can restore hierarchy by matching ID ⇔ ParentID, starting from top level (root node have ParentID=null).
+
Get device list and groups in specified schema (like [[AutoGRAPH.NET Service EnumGeoFences (EN)|EnumGeoFences]] for geofences). You can restore hierarchy by matching ID ⇔ ParentID, starting from top level (root node have ParentID==null).
   
 
== WCF ==
 
== WCF ==
   
Definition: <syntaxhighlight lang="csharp">
+
Definition:
REnumDevices EnumDevices(string schemaName)
+
<pre>REnumDevices EnumDevices(string schemaID)</pre>
</syntaxhighlight>
 
   
  +
Result:
Result: <syntaxhighlight lang="csharp">
 
  +
<pre>
 
public class REnumDevices
 
public class REnumDevices
 
{
 
{
Строка 27: Строка 27:
 
public RProperty[] Properties { get; set; } // list of device property (inherited properties also included)
 
public RProperty[] Properties { get; set; } // list of device property (inherited properties also included)
 
public RPoint FixedLocation { get; set; } // if this device is stationary, this field contain coordinates
 
public RPoint FixedLocation { get; set; } // if this device is stationary, this field contain coordinates
  +
public string Img { get;set; } // image file name with device image (.png)
  +
public RTripSplitter[] TripSplitters { get; set; } // configured trip splitters for this device
 
}
 
}
  +
</syntaxhighlight>
 
  +
public class RProperty
  +
{
  +
public bool Inherited { get; set; } // if true - property inherited from parent
  +
public RPropType Type { get; set; } // property type
  +
public string Name { get; set; } // property name
  +
public object Value { get; set; } // property value (depend from Type field)
  +
}
  +
  +
public enum RPropType : int // property types
  +
{
  +
String = 0,
  +
Number = 1,
  +
Date = 2,
  +
TareTable = 3,
  +
Time = 4,
  +
Memo = 5,
  +
Color = 6,
  +
Bool = 7,
  +
Radio = 8,
  +
Image = 9,
  +
File = 10,
  +
ProgressBar = 11,
  +
Combobox = 12,
  +
FileLink = 13,
  +
Device = 14,
  +
GeoFence = 15
  +
}
  +
</pre>
   
 
== JSON ==
 
== JSON ==
   
  +
Calling:
Calling: <syntaxhighlight lang="html4strict">
 
  +
<pre>
 
http://localhost:8300/EnumDevices/Demo
 
http://localhost:8300/EnumDevices/Demo
  +
http://localhost:8300/EnumDevices?schemaID=Demo
</syntaxhighlight>
 
  +
</pre>
   
Parameter Demo – schema name [[AutoGRAPH.NET Service EnumSchemas|EnumSchemas]].
+
Parameter Demo – schema name [[AutoGRAPH.NET Service EnumSchemas (EN)|EnumSchemas]].
   
 
Result: [[Media:EnumDevices-result.json.txt|download file]]
 
Result: [[Media:EnumDevices-result.json.txt|download file]]

Текущая версия на 11:47, 11 февраля 2016

Get device list and groups in specified schema (like EnumGeoFences for geofences). You can restore hierarchy by matching ID ⇔ ParentID, starting from top level (root node have ParentID==null).

WCF

Definition:

REnumDevices EnumDevices(string schemaID)

Result:

public class REnumDevices
{
   public RGroupItem[] Groups { get; set; } // groups
   public RDeviceItem[] Items { get; set; } // devices
}

public class RGroupItem
{
   public Guid ID { get; set; }             // unique device ID in schema
   public Guid? ParentID { get; set; }      // ID of parent group
   public string Name { get; set; }         // group name
}

public class RDeviceItem : RGroupItem
{
   public int Serial { get; set; }          // device serial number
   public bool Allowed { get; set; }        // allowed or not ( = included this device in .agkey file)
   public RProperty[] Properties { get; set; } // list of device property (inherited properties also included)
   public RPoint FixedLocation { get; set; }   // if this device is stationary, this field contain coordinates
   public string Img { get;set; }             // image file name with device image (.png)
   public RTripSplitter[] TripSplitters { get; set; } // configured trip splitters for this device
}

public class RProperty
{
    public bool Inherited { get; set; }     // if true - property inherited from parent
    public RPropType Type { get; set; }     // property type
    public string Name { get; set; }        // property name
    public object Value { get; set; }       // property value (depend from Type field)
}

public enum RPropType : int                 // property types
{
    String = 0,
    Number = 1,
    Date = 2,
    TareTable = 3,
    Time = 4,
    Memo = 5,
    Color = 6,
    Bool = 7,
    Radio = 8,
    Image = 9,
    File = 10,
    ProgressBar = 11,
    Combobox = 12,
    FileLink = 13,
    Device = 14,
    GeoFence = 15
}

JSON

Calling:

http://localhost:8300/EnumDevices/Demo
http://localhost:8300/EnumDevices?schemaID=Demo

Parameter Demo – schema name EnumSchemas.

Result: download file

AutoGRAPHNET Service EnumDevices.png