XML-RPC API

XML-RPC (Remote Procedure Calls using XML) is the API technology for GI.bench and Q.series controllers

Introduction

The XML-RPC API allows bidirectional transport of complex structured data between different software processes over device and technology boundaries. The XML-RPC API allows full access to the functionality provided by GI.config (device configuration) and GI.com (device communication).

GI.bench communication structure

XML-RPC client development

XML-RPC client source files are provided in

  • C++
  • C#
  • Pascal (upon request)

Getting started with the API

1) Source code

Common XML-RPC and networking source code are available for C++ and C#. There are no third-party libraries required. This set of common source code is provided as GInsCommon and has to be added to each project as external code and to the project's include path.

Some simple programming examples in C# and C++ are provided with the GI.bench installation in the directory: C:\Users\Public\Documents\Gantner Instruments\GI.bench\api


👉
In this example, we use Visual Studio 2013.


C++ :

Including source files of GInsCommon (Source files -> Add -> existing elements):


Add common paths to your project properties

  • GInsCommon
  • GInsCommon\GInsXmlRpc
  • GInsCommon\GInsXmlRpcStdAPI

Right-click on the project name in Solution Explorer, choose Properties, drill down to Configuration Properties -> C/C++ -> General, and add the necessary paths:



In source code:

//Gantner Instruments common source code
#include "ginsstate.h"
#include "GInsXmlRpc.h"
#include "GInsXmlRpcClient.h"
#include "GInsXmlRpcClientTransportHTTP.h"


C# :

To include source files of GInsCommon or other header files into your project create a GInsCommon (or other) folder in your Project -> Add -> existing elements -> Select files and Add As Link:

2) Using GI.monitor

GI.monitor allows the usage of the API in exactly the same way as within a custom software project, it is recommended to use GI.monitor during the development phase.

Since an XML-RPC server can handle multiple clients at the same time, GI.monitor can also be used in parallel on the same project that is accessed from a debugging session in Visual Studio or Eclipse.

A method that is available in GI.monitor should also be available from the IntelliSense suggestion of the IDE:


Also, methods for all parameter values in the request/response field can be used in a similar way in the code:


To find all needed options:


GI.monitor also recognizes different structure types, and converts them into more user-friendly GUI elements, like for example ElementListSelectionList (-> setting “Struct recognition enabled” needs to be active):

3) Client configuration

How to configure the client and connect to the server.

C++ :

//global instances
GInsXmlRpc::XmlRpcClientTransportHTTP XmlRpcTransport;
GInsXmlRpc::XmlRpcClient XmlRpcClient(XmlRpcTransport);
//main()
char HostName[1024] = "192.168.5.24"; //server IP-address. use 127.0.0.1 for localhost
int PortXMLRpc = 1200; //server XML-RPC Port
TGInsState Ret = GINSSTATE_BuildNone();
 
//Configure HTTP Transport
GInsXmlRpc::XmlRpcValue XmlRpcTransportCfg;
XmlRpcTransportCfg[GInsXmlRpc::XmlRpcClientTransportHTTP::CfgParam_ServerIP] = std::string(HostName);
XmlRpcTransportCfg[GInsXmlRpc::XmlRpcClientTransportHTTP::CfgParam_ServerPort] = (int)PortXMLRpc;
 
XmlRpcTransport.SetCfg(XmlRpcTransportCfg);
 
Ret = XmlRpcTransport.Connect();


C# :

GIns.XmlRpc.GInsXmlRpcClient client = new GIns.XmlRpc.GInsXmlRpcClient();
//main()
string HostName = "192.168.5.24"; //server IP-address. use 127.0.0.1 for localhost
int PortXMLRpc = 1200; //server XML-RPC Port
GInsState.TGInsState Ret = GInsState.CGInsStateHandler.GetInstance.BuildNone();
 
//connect
Ret = client.Connect(HostName, PortXMLRpc);

4) Execute methods

The XmlRpcClient provides an execute function to call methods on an XML-RPC server.

 int XmlRpcClient::execute(const std::string& methodName, const XmlRpcValue& params, XmlRpcValue& result, uint32_t TimeoutMs) 


To execute a method on the XML-RPC server provided by the APIs first the structure for the Parameters, as well as the structure of the Results, have to be defined. Therefore the API provides also predefined classes of both. For example:

C++ :

SummaryAPI::GetModules::CParams Params;
SummaryAPI::GetModules::CResults Results;


The elements of the CParams object can then be filled with values, using the given “Set_” methods of the class. The argument types of the methods are the same types as also seen with GI.monitor.


If the argument is a list type, then a valid value of the list is mandatory (see for example ElementSelectionList). Only the value of the list will be transferred to the master, not the full list.

Let's continue with the previous example and set the parameter in Params:

C++ :

Params.Set_ModuleIndex(-1); //here -1 means: list all modules


Since the parameters are valid, the client can now execute the method:

C++ :

TGInsState Ret = XmlRpcClient.execute(Results.MethodName(), Params, Results); //execute the method
//TGInsState is an int64_t type = States, consisting of level and type parts (see "ginsstate.h")


If the execution of the method was successful, the return code of the function will be 0, and all the method results are available in the struct of the Results object and accessible with the CResults Get- methods. The result can be compared with the Response section in GI.monitor:

C++ :

int count = Results.GetSize_ModuleList(); //get the size of the array
for (int i = 0; i < count; i++)
{
SummaryAPI::CTypeModuleInfo Info;
Results.Get_ModuleList(i, Info); //read Array-Elements of struct "CTypeModuleInfo"
std::cout << Info.Get_DeviceType() << std::endl;
}

5) GetParams method

The XmlRpcClient provides a getParams function, to call a method's help function on an XML-RPC server.

 int XmlRpcClient::getParams(const std::string& methodName, XmlRpcValue& params, uint32_t TimeoutMs=5000); 


With this function, you can pre-fill your method parameters for the next execute call. This method is also called in GI.monitor on selecting any method out of the list, and all available parameters are filled into the Request form.

6) Example

GInsXmlRpcStdAPI

1) Enums

1.1) GIns_Enum_NotifyReason

Name

Value

Comment

GINS_NOTIFY_REASON_UNKNOWN

0

Reason not known or not specified

GINS_NOTIFY_REASON_ADDED

1

Object added

GINS_NOTIFY_REASON_REMOVED

2

Object removed

GINS_NOTIFY_REASON_CHANGED

3

Property changed

GINS_NOTIFY_REASON_DEFAULTED

4

Property defaulted

Types

Each XML-RPC parameter does have a defined type. Most types are standard, for example booleanstring, or array. For better handling of more complex parameters, some new standard types were introduced.

For a better understanding and more comfortable user handling, the types are recognized by GI.monitor automatically and visualized in the user interface as a graphical element. Some of the element types are combinations of other types.


2.1) Base

All Base types have as prefix GIns_Base_.


2.1.1) Image

Internal type:

class CGIns_Base_Image : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Name

std::string

 

Data

std::string

 

Text

std::string

 


2.1.2) ElementValue

Internal type:

class CGIns_Base_ElementValue : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Description

std::string

Optional

Value

std::string

Unique string, mandatory

Image

CGIns_Base_Image

Optional

👉 It represents for example an element of an Edit_ElementSelectionList or Edit_ElementListSelectionList. The ElementValue provides Set and Get methods to read and write the structure elements.

GInsXmlRpcStdAPI::CGIns_Base_ElementValue ElementValue;
 
ElementValue.Set_Value("123");
ElementValue.Set_Description("this is a demo");
 
std::string ReadValue;
 
if(ElementValue.Get_Value(ReadValue))
{
//Value successfully read
}


2.1.3) Point

Internal type:
class CGIns_Base_Point : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

ValueX

double

Default: 0.0

ValueY

double

Default: 0.0


2.1.4) Range

Internal type:

class CGIns_Base_Range : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

ValueMin

double

Default: 0.0

ValueMax

double

Default: 0.0

 
2.1.5) Message

Universal Message Type

Internal type:

class CGIns_Base_Message : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Sender

std::string

Name of the message source

Type

std::string

Message type; can be WARNING, INFO, ERROR, DEBUG

ID

std::string

Message-ID; can be numeric or UUID

Topic

std::string

Message topic/type as short string, machine-readable message text

Text

std::string

Human-readable message text; maybe localized

Args

array of std::string

Additional topic depending on arguments, like filenames, codes, ...

Timestamp

struct tm

Default: {0} (the time when the message was thrown)

 
2.1.6) RawValue

Internal type:

class CGIns_Base_RawValue : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Description

std::string

 

Value

std::string

 


2.1.7) PDF

Internal type:

class CGIns_Base_PDF : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Name

std::string

 

Data

std::string

 

2.2) Info
All Info types have as prefix GIns_Info_.

2.2.1) Message
Message in a GIns_Info_Notification.
Internal type:
class CGIns_Info_Message : public GInsXmlRpc::XmlRpcValue

Name

Type

Comment

Reason

GIns_Enum_NotifyReason

Reason for message, default: GINS_NOTIFY_REASON_UNKNOWN

Location

std::string

Location of the message source

Text

std::string

Description text about the message


2.2.2) Notification

Internal type:

class CGIns_Info_Notification : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Text

std::string

description text about notification source

ID

std::string

UUID of the notification source

CoreID

std::string

UUID of the application

Messages

array of CGIns_Info_Message

list of messages

 
2.2.3) Event (0.118)

A system event.

Internal type:

class CGIns_Info_Event : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Type

std::string

 

Timestamp

struct tm

Default: {0}

Object

std::string

 

Code

int32_t

Default: 0

Message

std::string

 

Count

int32_t

Default: 0


2.2.4) State

Internal type:

class CGIns_Info_State : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Description

std::string

State description text

Value

int64_t

Coded as a state defined in file ginsstate, default: 0


Example: create ReturnState “no error”:

GInsXmlRpcStdAPI::CGIns_Info_State State;
State.Set_Value(GINSSTATE_BuildNone());
State.Set_Description(CGInsState::GetTypeText(eGInsStateType__NONE));
MethodResults.Set_ReturnState(State);


2.2.5) ItemState

Internal type:
class CGIns_Info_ItemState : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Name

std::string

 

RefID

std::string

UUID of referenced element (optional)

State

CGIns_Info_State

 
 
2.2.6) States
Internal type:
class CGIns_Info_States : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

ID

std::string

UUID of the source element

List

array of CGIns_Info_ItemState

 
 
2.2.7) TraceItem

Internal type:

class CGIns_Info_TraceItem : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Text

std::string

 

ThreadID

int32_t

Default: 0

Time

struct tm

Default: {0}

Priority

int32_t

Default: 0


2.2.8) DeviceType

Internal type:

class CGIns_Info_DeviceType : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Main

int32_t

Default: 0

Sub

int32_t

Default: 0

Function

int32_t

Default: 0

Casing

int32_t

Default: 0

MID

std::string

 

UniqueType

std::string

 

VendorName

std::string

 

SeriesName

std::string

 
 
2.2.9) StringValue (0.107)

Internal type:

class CGIns_Info_StringValue : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Value

std::string

 

PresType

std::string

Use type: COptions::CCommon::CPresentationType::…


2.2.10) DateTimeValue

Internal type:

class CGIns_Info_DateTimeValue : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Value

struct tm

Default: {0}


2.2.11) Version_Source

Internal type:

class CGIns_Info_Version_Source : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Name

std::string

 

Revision

std::string

 

AddInfo

std::string

 
 
2.2.12) Version

Internal type:

class CGIns_Info_Version : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Name

std::string

 

Major

std::string

 

Minor

std::string

 

Build

std::string

 

IsRelease

bool

Default: false

Sources

array of CGIns_Info_Version_Source

 

Copyright

std::string

 

BuildDateTime

struct tm

Default: {0}

 
2.2.13) PointList
Internal type:
class CGIns_Info_PointList : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of CGIns_Base_Point

 

UnitX

std::string

 

UnitY

std::string

 
 
2.2.14) RangeList

Internal type:

class CGIns_Info_RangeList : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of CGIns_Base_Range

 

Value

CGIns_Base_Range

 

Unit

std::string

 
 
2.2.15 ElementList
Short: tyInElLi
Internal type:
class CGIns_Info_ElementList : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of CGIns_Base_ElementValue

Can hold multiple ElementValues

 
2.2.16) StateValue

Short: tyInStaVa

Internal type:

class CGIns_Info_StateValue : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Value

bool

Default: false

 
2.2.17) OptionList

Internal type:

class CGIns_Info_OptionList : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of CGIns_Base_ElementValue

 


2.2.18) Integer

Internal type:

class CGIns_Info_Value_Integer : public GInsXmlRpc::XmlRpcValue

Name

Type

Comment

Value

int64_t

Default: 0

Unit

std::string

 
 
2.2.19) Value_Float

Internal type:

class CGIns_Info_Value_Float : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Value

double

Default: 0.0

Unit

std::string

 


2.2.20) NetworkTrafficValue (0.119)

Internal type:

class CGIns_Info_NetworkTrafficValue : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Total_MB

double

Default: 0.0

LastDay_MB

double

Default: 0.0

LastHour_MB

double

Default: 0.0

LastMinute_MB

double

Default: 0.0

 
2.2.21 NetworkBandwidthValue (0.120)

Internal type:

class CGIns_Info_NetworkBandwidthValue : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Total_kBps

double

Default: 0.0

LastDay_kBps

double

Default: 0.0

LastHour_kBps

double

Default: 0.0

LastMinute_kBps

double

Default: 0.0

 
2.2.22 NetworkTraffic (0.121)

Internal type:

class CGIns_Info_NetworkTraffic : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Start

GInsXmlRpcStdAPI::CGIns_Info_DateTimeValue

 

Stop

GInsXmlRpcStdAPI::CGIns_Info_DateTimeValue

 

LastRestart

GInsXmlRpcStdAPI::CGIns_Info_DateTimeValue

 

RestartCount

int32_t

Default: 0

NetworkTrafficIn

CGIns_Info_NetworkTrafficValue

 

NetworkTrafficOut

CGIns_Info_NetworkTrafficValue

 

NetworkBandwidthIn

CGIns_Info_NetworkBandwidthValue

 

NetworkBandwidthOut

CGIns_Info_NetworkBandwidthValue

 

Port

int32_t

Default: 0

 
2.2.23) Device_Location (0.122)

Internal type:

class CGIns_Info_Device_Location : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Long

double

Default: 0.0

Lat

double

Default: 0.0

Alt

double

Default: 0.0

 
2.2.24) Device_SystemHealth (0.123)

Internal type:

class CGIns_Info_Device_SystemHealth : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

User

int32_t

Default: 0

UserAverage

int32_t

Default: 0

Realtime

int32_t

Default: 0

RealtimeAverage

int32_t

Default: 0

RealtimeOverloads

int32_t

Default: 0

MemTotal

int32_t

Default: 0, total memory in MB

MemUsed

int32_t

Default: 0, used memory in MB

MemFree

int32_t

Default: 0, free memory in MB


2.2.25) Device_TimeInfo (0.124)

Internal type:

class CGIns_Info_Device_TimeInfo : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

SystemTime

std::string

 

SyncMode

std::string

 

SignalPresent

int32_t

Default: 0

SignalTracked

int32_t

Default: 0

SignalLostCount

int32_t

Default: 0

 
2.2.26) SlaveModuleState (0.314)
Internal type:
class CGIns_Info_SlaveModuleState : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Id

std::string

 

Address

int32_t

Default: 0

ErrorCount

int64_t

Default: 0


2.2.27) UartState (0.315)

Internal type:

class CGIns_Info_UartState : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Id

std::string

 

Index

int32_t

Default: 0

Cycles

int64_t

Default: 0

SlaveStates

array of CGIns_Info_SlaveModuleState

Error counter for slave modules

 

2.2.28) Device_SystemState (0.125)

Internal type:

class CGIns_Info_Device_SystemState : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

State

std::string

 

Time

CGIns_Info_Device_TimeInfo

 

UpTime

int64_t

Default: 0

Health

CGIns_Info_Device_SystemHealth

 

RunStates

array of std::string

 

ErrorStates

array of CGIns_Info_Event

List as Sys event struct

Location

CGIns_Info_Device_Location

 

UartStates

array of CGIns_Info_UartState

Communication and error counter for every Localbus UART

 
2.3) Edit

All Edit types have as prefix GIns_Edit_.


2.3.1) ElementSelectionList (0.200)

Short: tyEdElSeLi

Internal type:

class CGIns_Edit_ElementSelectionList : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of CGIns_Base_ElementValue

Can hold multiple ElementValues with unique ID

Value

CGIns_Base_ElementValue

Represents the selected element of the list

PresType

std::string

Use Type: COptions::CCommon::CPresentationType::…

Hint

CGIns_Info_StringValue

 

  • The result is a list of Base_ElementValues that all have unique values (or IDs). The selected item can be only one single Base_ElementValue (= value )
  • The ElementSelectionList provides methods to handle multiple values in a list (add elements, read elements, read selected value, set value, clear, get size, …)
 
Example: Parameter ConnectionType in giservice_ConfigAPI -> AddDevice (see code example 1)

GInsXmlRpcStdAPI::CGIns_Base_ElementValue ElementValue1;
//fill ElementValue1
GInsXmlRpcStdAPI::CGIns_Base_ElementValue ElementValue2;
//fill ElementValue2
GInsXmlRpcStdAPI::CGIns_Base_ElementValue ElementValue3;
//fill ElementValue3
 
GInsXmlRpcStdAPI::CGIns_Edit_ElementSelectionList ElementSelectionList;
ElementSelectionList.Set_List(0, ElementValue1);
ElementSelectionList.Set_List(1, ElementValue2);
ElementSelectionList.Set_List(2, ElementValue3);
 
ElementSelectionList.Set_Value(ElementValue2); // -> this is the selected "value" of the list
 
//read value of list
GInsXmlRpcStdAPI::CGIns_Base_ElementValue ElementValue4;
if(ElementSelectionList.Get_Value(ElementValue4))
{
//successfully read value, ElementValue4 == ElementValue2
}

2.3.2) ElementListSelectionList
Short: tyEdElLiSeLi
Internal type:
class CGIns_Edit_ElementListSelectionList : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of CGIns_Base_ElementValue

Can represent available elements for selection

Value

array of CGIns_Base_ElementValue

Represents a list of “selected” elements

MinValueCount

int32_t

Default: -1

MaxValueCount

int32_t

Default: -1

Hint

CGIns_Info_StringValue

 

  • The result is a list of Base_ElementValues that all have unique values (or IDs). The selected item can be only one single Base_ElementValue (= value )
  • The ElementSelectionList provides methods to handle multiple values in a list (add elements, read elements, read selected value, set value, clear, get size, …)


Example
: Parameter IDs in giconfig_ConfigAPI -> GetInfosFromIDs (see code example 2)



2.3.3) RangeValue_Integer (0.202)

Internal type:

class CGIns_Edit_RangeValue_Integer : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Value

int64_t

Default: 0

Min

int64_t

Default: 0

Max

int64_t

Default: 0

Unit

std::string

 

PresType

std::string

Use type: COptions::CCommon::CPresentationType::…

Hint

CGIns_Info_StringValue

 

2.3.4) RangeValue_Float (0.203)
Internal type:
class CGIns_Edit_RangeValue_Float : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Value

double

Default: 0.0

Min

double

Default: 0.0

Max

double

Default: 0.0

Unit

std::string

 

Hint

CGIns_Info_StringValue

 


2.3.5) RangeValueSelectionList_Float

Internal type:

class CGIns_Edit_RangeValueSelectionList_Float : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of CGIns_Edit_RangeValue_Float

 

Value

CGIns_Edit_RangeValue_Float

 

Hint

CGIns_Info_StringValue

 


2.3.6) RangeValueSelectionList_Integer

Internal type:

class CGIns_Edit_RangeValueSelectionList_Integer : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of CGIns_Edit_RangeValue_Integer

 

Value

CGIns_Edit_RangeValue_Integer

 

Hint

CGIns_Info_StringValue

 
 
2.3.7) StateValue

Internal type:

class CGIns_Edit_StateValue : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

Value

bool

Default: false

Hint

CGIns_Info_StringValue

 
 
2.3.8) StringSelectionListWithManualModify (0.207)

Short: tyEdStSeLiWiMaMo

Internal type:

class CGIns_Edit_StringSelectionListWithManualModify : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of std::string

 

Value

std::string

 

MinSize

int32_t

Default: 0

MaxSize

int32_t

Default: 0

Validator

CGIns_Base_RawValue

 

Hint

CGIns_Info_StringValue

 

 

  • The result is a list of strings. The selected item (= value) is a string -> no struct element with UID (compare with ElementSelectionLists).
  • The StringSelectionListWithManualModify provides methods to handle the list, for example, Set_List(), Set_Value(), Clear_List(), GetSize_List(), Get_List(), Get_Value(), … as well as Set_MaxSize() and Set_MinSize() to set the min/max string length of an element.


Example: Parameter AdapterAddress in giservice_ConfigAPI -> AddDevice (see code example 1)

GInsXmlRpcStdAPI::CGIns_Edit_StringSelectionListWithManualModify StringSelectionList;
StringSelectionList.Set_List(0, "string 1");
StringSelectionList.Set_List(1, "string 2");
StringSelectionList.Set_List(2, "string 3");
StringSelectionList.Set_Value("test");
 
for (int i = 0; i < StringSelectionList.GetSize_List(); i++)
{
std::cout << StringSelectionList.Get_List(i) << std::endl;
}
 
std::string result;
if (StringSelectionList.Get_Value(result))
{
std::cout << result << std::endl;
}
 
//result output:
//string 1
//string 2
//string 3
//test


2.3.9) StringListSelectionListWithManualModify (0.208)

Internal type:

class CGIns_Edit_StringListSelectionListWithManualModify : public GInsXmlRpc::XmlRpcValue 

Name

Type

Comment

List

array of std::string

 

Value

array of std::string

 

MinValueCount

int32_t

Deft: -1

MaxValueCount

int32_t

Default: -1

MinSize

int32_t

Default: 0

MaxSize

int32_t

Default: 0

Validator

CGIns_Base_RawValue

 

Hint

CGIns_Info_StringValue

 

EnableEdit

CGIns_Info_StateValue

 
 
2.3.10) StringValue (0.209)

Internal type:

class CGIns_Edit_StringValue : public GInsXmlRpc::XmlRpcValue

    Name

    Type

    Comment

    Value

    std::string

     

    MinSize

    int32_t

    Default: 0

    MaxSize

    int32_t

    Default: 0

    Validator

    CGIns_Base_RawValue

     

    PresType

    std::string

    Default: "GInsXmlRpc::XmlRpcValue()"

    Use type: COptions::CCommon::CPresentationType::…

    Hint

    CGIns_Info_StringValue

     

    EnableEdit

    CGIns_Info_StateValue

     
     
    2.3.11) DeviceType (0.210)

    Internal type:

    class CGIns_Edit_DeviceType : public GInsXmlRpc::XmlRpcValue

      Name

      Type

      Comment

      Info

      CGIns_Info_DeviceType

       

      NameFilterSeries

      CGIns_Edit_ElementSelectionList

       

      NameFilterMain

      CGIns_Edit_ElementSelectionList

       

      Name

      CGIns_Edit_ElementSelectionList

       

      Hint

      CGIns_Info_StringValue

       

      EnableEdit

      CGIns_Info_StateValue

       
       
      2.3.12) PointList (0.211)

      Internal type:

      class CGIns_Edit_PointList : public GInsXmlRpc::XmlRpcValue

        Name

        Type

        Comment

        List

        array of CGIns_Base_Point

         

        MinX

        double

        Default: 0.0

        MaxX

        double

        Default: 0.0

        UnitX

        std::string

         

        MinY

        double

        Default: 0.0

        MaxY

        double

        Default: 0.0

        UnitY

        std::string

         

        MinCount

        int32_t

        Default: 0

        MaxCount

        int32_t

        Default: 0

        StartIndex

        int32_t

        Default: 0

        Length

        int32_t

        Default: 0

        Command

        CGIns_Edit_ElementSelectionList

         

        Hint

        CGIns_Info_StringValue

         

        EnableEdit

        CGIns_Info_StateValue

         


        2.3.13) ValueList_Integer (0.212)

        Internal type:

        class CGIns_Edit_ValueList_Integer : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        List

        array of int64_t

        Default: 0

        Min

        int64_t

        Default: 0

        Max

        int64_t

        Default: 0

        Unit

        std::string

         

        MinCount

        int32_t

        Default: 0

        MaxCount

        int32_t

        Default: 0

        StartIndex

        int32_t

        Default: 0

        Length

        int32_t

        Default: 0

        Command

        CGIns_Edit_ElementSelectionList

         

        Hint

        CGIns_Info_StringValue

         

        EnableEdit

        CGIns_Info_StateValue

         


        2.3.14) ValueList_Float (0.213)

        Internal type:

        class CGIns_Edit_ValueList_Float : public GInsXmlRpc::XmlRpcValue

        Name

        Type

        Comment

        List

        array of double

        Default: 0.0

        Min

        double

        Default: 0.0

        Max

        double

        Default: 0.0

        Unit

        std::string

         

        MinCount

        int32_t

        Default: 0

        MaxCount

        int32_t

        Default: 0

        StartIndex

        int32_t

        Default: 0

        Length

        int32_t

        Default: 0

        Command

        CGIns_Edit_ElementSelectionList

         

        Hint

        CGIns_Info_StringValue

         

        EnableEdit

        CGIns_Info_StateValue

         
         
        2.3.15) StringList (0.214)

        Internal type:

        class CGIns_Edit_StringList : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        List

        array of std::string

         

        MinSize

        int32_t

        Default: 0

        MaxSize

        int32_t

        Default: 0

        Validator

        CGIns_Base_RawValue

         

        MinCount

        int32_t

        Default: 0

        MaxCount

        int32_t

        Default: 0

        StartIndex

        int32_t

        Default: 0

        Length

        int32_t

        Default: 0

        Command

        CGIns_Edit_ElementSelectionList

         

        Hint

        CGIns_Info_StringValue

         

        EnableEdit

        CGIns_Info_StateValue

         
         
        2.3.16 GIns_LoggerConfig_Trigger (0.300)

        Internal type:

        class CGIns_LoggerConfig_Trigger : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        Enabled

        CGIns_Edit_StateValue

         

        Variable

        CGIns_Edit_ElementSelectionList

         

        Condition

        CGIns_Edit_ElementSelectionList

         

        TriggerLevel

        CGIns_Edit_RangeValue_Float

         

        AddDurationValueType

        CGIns_Edit_ElementSelectionList

         

        AddDuration

        CGIns_Edit_RangeValue_Float

         


        2.3.17) GIns_LoggerConfig_SendMail (0.301)

        Internal type:

        class CGIns_LoggerConfig_SendMail : public GInsXmlRpc::XmlRpcValue

        Name

        Type

        Comment

        MailServer

        CGIns_Edit_ElementSelectionList

         

        Subject

        CGIns_Edit_StringValue

         

        Body

        CGIns_Edit_StringValue

         


        2.3.18) GIns_LoggerConfig_EventBased (0.302)

        Internal type:

        class CGIns_LoggerConfig_EventBased : public GInsXmlRpc::XmlRpcValue 
        Name Type Comment
        TriggerEvent CGIns_LoggerConfig_Trigger  


        2.3.19 GIns_LoggerConfig_Triggered (0.303)

        Internal type:

        class CGIns_LoggerConfig_Triggered : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        TriggerStart

        CGIns_LoggerConfig_Trigger

         

        TriggerStop

        CGIns_LoggerConfig_Trigger

         

        LogDurationValueType

        CGIns_Edit_ElementSelectionList

         

        LogDuration

        CGIns_Edit_RangeValue_Float

         
         
        2.3.20) GIns_LoggerConfig_CSVStorage (0.304)

        Internal type:

        class CGIns_LoggerConfig_CSVStorage : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        AddHeader

        CGIns_Edit_StateValue

         

        HeaderText

        CGIns_Edit_StringValue

         

        DateTimeHeader

        CGIns_Edit_StringValue

         

        DateTimeFormat

        CGIns_Edit_StringValue

         

        ColumnSeparator

        CGIns_Edit_StringValue

         

        DecSeparator

        CGIns_Edit_StringValue

         
         
        2.3.21) GIns_LoggerConfig_Storage (0.305)

        Internal type:

        class CGIns_LoggerConfig_Storage : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        StorageMode

        CGIns_Edit_ElementSelectionList

         

        Destinations

        CGIns_Edit_ElementListSelectionList

         

        FileSaveMode

        CGIns_Edit_ElementSelectionList

         

        MaxFilesDest

        CGIns_Edit_RangeValue_Integer

         

        MaxFilesDir

        CGIns_Edit_RangeValue_Integer

         

        MaxBytes

        CGIns_Edit_RangeValue_Integer

         

        AutoDeleteFiles

        CGIns_Edit_StateValue

         

        Compress

        CGIns_Edit_StateValue

         

        FileNameExt

        CGIns_Edit_StringValue

         

        FileFormat

        CGIns_Edit_ElementSelectionList

         

        FileFormatSettings_CSV

        CGIns_LoggerConfig_CSVStorage

         


        2.3.22 GIns_LoggerConfig (0.306)

        Internal type:

        class CGIns_LoggerConfig : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        Type

        CGIns_Edit_ElementSelectionList

         

        Name

        CGIns_Edit_StringValue

         

        SubDirectory

        CGIns_Edit_StringValue

         

        DataSource

        CGIns_Edit_ElementSelectionList

         

        InitState

        CGIns_Edit_ElementSelectionList

         

        Variables

        CGIns_Edit_ElementListSelectionList

         

        LoggingRateValueType

        CGIns_Edit_ElementSelectionList

         

        LoggingRate

        CGIns_Edit_RangeValue_Float

         

        FileDurationValueType

        CGIns_Edit_ElementSelectionList

         

        FileDuration

        CGIns_Edit_RangeValue_Float

         

        SendFTP

        CGIns_Edit_ElementSelectionList

         

        SendMail

        CGIns_LoggerConfig_SendMail

         

        DeleteAfterSent

        CGIns_Edit_StateValue

         

        EventBased

        CGIns_LoggerConfig_EventBased

         

        Triggered

        CGIns_LoggerConfig_Triggered

         

        Storage

        CGIns_LoggerConfig_Storage

         
         
        2.3.23) GIns_PortMapping (0.307)
        Internal type:
        class CGIns_PortMapping : public GInsXmlRpc::XmlRpcValue

        Name

        Type

        Comment

        Name

        std::string

         

        Port

        int32_t

        Default: 0

         
        2.3.24 GIns_DeviceInfo (0.308)

        Internal type:

        class CGIns_DeviceInfo : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        ID

        std::string

        Default: "-"

        Name

        std::string

        Default: "Undef"

        IPAddress

        std::string

        Default: "-"

        Serialnumber

        std::string

        Default: "-"

        Routes

        array of std::string

        Default: "-"

        Ports

        array of CGIns_PortMapping

         

        HeartbeatTimeSec

        int32_t

        Default: -1

        LastHeartbeatTime

        std::string

        Default: "-"

        MessageCount

        int32_t

        Default: 0

        Connected

        bool

        Default: false

        Firmware

        std::string

        Default: "-"

        DeviceType

        std::string

        Default: "-"

         
        2.3.25) GIns_UDBFHeaderInfo (0.309)

        Internal type:

        class CGIns_UDBFHeaderInfo : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        DeviceID

        std::string

         

        DeviceLocation

        std::string

         

        DeviceSerialNumber

        std::string

         

        DeviceAppVersion

        std::string

         

        SourceID

        std::string

         

        SourceName

        std::string

         

        MeasID

        std::string

         

        MeasName

        std::string

         
         
        2.3.26) GIns_UDBFHeaderVariableInfo (0.313)

        Internal type:

        class CGIns_UDBFHeaderVariableInfo : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        UUID

        std::string

         

        RangeMin

        double

        Default: 0

        RangeMax

        double

        Default: 0

        ValueType

        std::string

         


        2.3.27) GIns_StreamMeasurementInfo (0.310)

        Internal type:

        class CGIns_StreamMeasurementInfo : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        MID

        std::string

         

        Name

        std::string

         

        StartTimeEpochMS

        double

        Default: 0

        EndTimeEpochMS

        double

        Default: 0

        DataRateHz

        double

        Default: 0

         
        2.3.28) GIns_StreamSourceInfo (0.311)

        Internal type:

        class CGIns_StreamSourceInfo : public GInsXmlRpc::XmlRpcValue 

        Name

        Type

        Comment

        SID

        std::string

         

        Partition

        int32_t

        Default: 0

        Topic

        std::string

         

        Name

        std::string

         

        MeasurementInfos

        array of CGIns_StreamMeasurementInfo

         
         
        2.3.29) GIns_StreamInfo (0.312)

        Internal type:

        class CGIns_StreamInfo : public GInsXmlRpc::XmlRpcValue 
        Name Type Comment
        SourceInfos array of CGIns_StreamSourceInfo  

        Code examples

        Client example

        // XmlRpc_Demo.cpp : 
        //
         
         
         
        #include "stdafx.h"
        #include <string>
        #include <sstream>
        #include <vector>
        #include <iostream>
         
        #ifdef WIN32
        #include <winsock2.h>
        #endif
         
         
        //Gantner Instruments common source code
        #include "ginsstate.h"
        #include "GInsXmlRpc.h"
        #include "GInsXmlRpcClient.h"
        #include "GInsXmlRpcClientTransportHTTP.h"
         
        //Q.station XML-RPC API
        #include "SummaryAPI_Types.h"
         
         
         
        GInsXmlRpc::XmlRpcClientTransportHTTP XmlRpcTransport;
        GInsXmlRpc::XmlRpcClient XmlRpcClient(XmlRpcTransport);
         
         
        bool GetModules(std::vector<SummaryAPI::CTypeModuleInfo> &ModuleInfo)
        {
         
        SummaryAPI::GetModules::CParams Params;
        SummaryAPI::GetModules::CResults Results;
         
        Params.Set_ModuleIndex(-1); //the Index of the Module we want to read. -1 -> all modules
         
        TGInsState Ret = XmlRpcClient.execute(Results.MethodName(), Params, Results); //execute the method
         
        if (!GINSSTATE_IsLevel_Error(Ret))
        {
        int count = Results.GetSize_ModuleList(); //get the size of the array
        for (int i = 0; i < count; i++)
        {
        SummaryAPI::CTypeModuleInfo Info;
        Results.Get_ModuleList(i, Info);
        ModuleInfo.push_back(Info);
        }
        return true;
        }
        return false;
         
        }
         
        int _tmain(int argc, _TCHAR* argv[])
        {
         
        char HostName[1024] = "192.168.5.24";
        int PortXMLRpc = 1200;
         
        //Configure HTTP Transport
        GInsXmlRpc::XmlRpcValue XmlRpcTransportCfg;
        XmlRpcTransportCfg[GInsXmlRpc::XmlRpcClientTransportHTTP::CfgParam_ServerIP] = std::string(HostName);
        XmlRpcTransportCfg[GInsXmlRpc::XmlRpcClientTransportHTTP::CfgParam_ServerPort] = (int)PortXMLRpc;
         
        XmlRpcTransport.SetCfg(XmlRpcTransportCfg);
         
        TGInsState Ret = XmlRpcTransport.Connect();
         
        if (GINSSTATE_IsLevel_Error(Ret))
        {
        return 1;
        }
         
         
        std::cout << "XmlRpc Demo" << std::endl;
         
        std::vector<SummaryAPI::CTypeModuleInfo> ModuleInfo;
         
        if (GetModules(ModuleInfo))
        {
        for (std::vector<SummaryAPI::CTypeModuleInfo>::iterator ModuleID = ModuleInfo.begin(); ModuleID != ModuleInfo.end(); ++ModuleID)
        {
        std::cout << ModuleID->Get_DeviceType() << std::endl;
        }
        }
         
        getchar();
         
        XmlRpcTransport.Disconnect();
         
        return 0;
        }

        Example 1

        This example shows the usage of

        • StringSelectionListWithManualModify
        • ElementSelectionList

        with the call of giservice_ConfigAPI::AddDevice method.

        bool AddDeviceToGiService(const std::string &ConnectionString)
        {
        giservice_ConfigAPI::AddDevice::CParams Params;
        giservice_ConfigAPI::AddDevice::CResults Results;
         
        //Method Parameters:
        GInsXmlRpcStdAPI::CGIns_Edit_StringSelectionListWithManualModify AdapterAddresses_StringSelectionList;
        GInsXmlRpcStdAPI::CGIns_Edit_ElementSelectionList ConnectionType_ElementSelectionList;
         
        GInsXmlRpcStdAPI::CGIns_Base_ElementValue ConnectionType_ElementValue; //ElementValue = single element of an ElementSelectionList
         
        //Set ElementValue
        ConnectionType_ElementValue.Set_Value("IP"); //the values of ElementValues in a List are unique!
        ConnectionType_ElementValue.Set_Description("IP Address"); //to set a value, description would not be necessary here
         
        //set the ElementValue as Value of the ElementSelectionList -> this is the selected item
        ConnectionType_ElementSelectionList.Set_Value(ConnectionType_ElementValue);
         
        XmlRpcClient.getParams(Results.MethodName(), Params); //calls "MethodHelp" of the Method, to get a preset of parameters
         
        if (Params.Get_AdapterAddress(AdapterAddresses_StringSelectionList))
        {
        for (int i = 0; i < AdapterAddresses_StringSelectionList.GetSize_List(); i++)
        {
        std::string Adapter;
        if (AdapterAddresses_StringSelectionList.Get_List(i, Adapter))
        {
        std::cout << "Adapter found: " << Adapter << std::endl;
        AdapterAddresses_StringSelectionList.Set_Value(Adapter); //Set Adapter as selected value
         
        //Set Method Parameters
        Params.Set_AdapterAddress(AdapterAddresses_StringSelectionList);
        Params.Set_ConnectionString(ConnectionString);
        Params.Set_ConnectionType(ConnectionType_ElementSelectionList);
         
        TGInsState Ret = XmlRpcClient.execute(Results.MethodName(), Params, Results);
         
        if (!GINSSTATE_IsLevel_Error(Ret))//return code is not of type error -> also warning/info severity possible!
        {
        if (!GINSSTATE_IsLevel_Error(Results.Get_ReturnState().Get_Value()))
        {
        return true;
        }
        else
        {
        std::cout
        << Results.Get_ReturnState().Get_Description()
        << " - Code: "
        << Results.Get_ReturnState().Get_Value()
        << std::endl;
        }
        }
        }
        }
        }
         
        return false;
        }

        Example 2

        This example shows the usage of

        • ElementListSelectionList
        • Call Methods via Routes
        with the call of giconfig_ConfigAPI::GetInfosFromIDs method.
        bool GetInfosFromIDs(const std::string &Route)
        {
        //std::string Route = "192.168.5.24/GI.config/";
        giconfig_ConfigAPI::GetInfosFromIDs::CParams Params;
        giconfig_ConfigAPI::GetInfosFromIDs::CResults Results;
         
        GInsXmlRpcStdAPI::CGIns_Edit_ElementListSelectionList IDs_ElementListSelectionList;
         
         
        XmlRpcClient.getParams(Route + Results.MethodName(), Params); //add "Route" to method-name, get ElementListSelectionList
         
         
        if (Params.Get_IDs(IDs_ElementListSelectionList))
        {
        int count = IDs_ElementListSelectionList.GetSize_List(); //size of complete list
         
        IDs_ElementListSelectionList.Clear_Value(); //clear value list -> element can have multiple (list) of selected elements
         
        for (int i = 0; i < count; i++)
        {
        GInsXmlRpcStdAPI::CGIns_Base_ElementValue element;
        IDs_ElementListSelectionList.Get_List(i, element);
         
        if (element.Get_Description().find("Variable/") != std::string::npos)
        {
        std::cout << element.Get_Description() << " - ID: " << element.Get_Value() << std::endl;
        IDs_ElementListSelectionList.Set_Value(IDs_ElementListSelectionList.GetSize_Value(), element);
        }
        }
         
        int valuesCnt = IDs_ElementListSelectionList.GetSize_Value();
        std::cout << "Values set in ElemenListSelectionList: " << valuesCnt << std::endl;
         
        if (Params.Set_IDs(IDs_ElementListSelectionList))
        {
        TGInsState Ret = XmlRpcClient.execute(Route + Results.MethodName(), Params, Results);
        if (!GINSSTATE_IsLevel_Error(Ret))
        {
        if (!GINSSTATE_IsLevel_Error(Results.Get_ReturnState().Get_Value()))
        {
        std::cout << "Infos loaded: " << Results.GetSize_Infos() << std::endl;
        return true;
        }
        }
        else
        {
        std::cout << GInsStateHandler().GetTypeText(GInsStateHandler().GetType(Ret),false)
        << " - "
        << GInsStateHandler().GetSeverity(Ret)
        << std::endl;
        }
        }
        }
         
        return false;
        }