LLExec Web Server

From Axel Public Wiki
Revision as of 10:07, 9 May 2019 by Axelpwiki (talk | contribs) (Created page with "__TOC__ =Summary= This article describes the API that LLExec integrated Web Sever offers to access plc variables and parameters. =Variables access= To access variables (also...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Summary

This article describes the API that LLExec integrated Web Sever offers to access plc variables and parameters.

Variables access

To access variables (also called symbols) web server offes two http methods: GET to read simple variables and PUT to write simple variables.
The symbols that can be accessed are global variables of symple types (numeric, boolean, string).
That symbols can also be structured query of the type my_arr[123].my_field, with the constraint that the value of the expression must be simple typed.

GET symbols method syntax

The syntax of the url to do the GET method:

http://1.2.3.4/api/sym?sym_name1&sym_name2&sym_name3

The content value of any symbol will be written on a single line.

PUT symbols method syntax

The syntax of the url to do the PUT method:

http://1.2.3.4/api/sym?sym_name1=value1&sym_name2=value2&sym_name3=value3

Where the valueN is the value of the variable N. String values doesn't need limiters, and spaces must be coded in the URL with the string %20 . For example:

PUT http://1.2.3.4/api/sym?var_bool=true&var_int=123&var_string=hello%20world

Parameters access

To access parameters web server offes two http methods: GET to read parameters and PUT to write parameters.
To access parameters their index must be known, eventually with subindex (this indexes are called IPA): IPA examples are 10000.12' or 60000 .

GET symbols method syntax

The syntax of the url to do the GET method:

http://1.2.3.4/api/par?ipa1&ipa2&ipa3

The content value of any parameter will be written on a single line.

PUT symbols method syntax

The syntax of the url to do the PUT method:

http://1.2.3.4/api/par?ipa1=value1&ipa2=value2&ipa3=value3

Where the valueN is the value of the variable N. String values doesn't need limiters, and spaces must be coded in the URL with the string %20 . For example:

PUT http://1.2.3.4/api/par?10000=true&10010=123&10021=Hello%20world

Browsing variables

The Web Server offers a method to obtain information about variables on the system.
The url for browsing symbols have to be colled with http GET method and is as follows:

http://1.2.3.4/api/symlist?name=pattern

The pattern can be a variable name, the jolly * character, or a name with the jolly character prefixed or suffixed.
Examples are

http://1.2.3.4/api/symlist?name=*
http://1.2.3.4/api/symlist?name=my_variable_name
http://1.2.3.4/api/symlist?name=count*
http://1.2.3.4/api/symlist?name=*substr*

The output of the query is a JSON containing the list of the symbols that matches the pattern, with attributes like name, type and description.
For example, if in my system i do the query

http://127.0.0.1/api/symlist?name=*

I obtain the following output:

[
   { name:"$$STKLIMIT$$", type:"DWORD", descr:""},
   { name:"$$STKPOINTER$$", type:"DWORD", descr:""},
   { name:"$$DEBUGID$$", type:"DWORD", descr:""},
   { name:"CNT", type:"INT", descr:""},
   { name:"STR", type:"STRING", descr:""},
   { name:"SYSPLCSTATUS", type:"PLC_STATUS", descr:"Internal PLC Status"},
   { name:"SYSTIMER", type:"UDINT", descr:"System timer [ms]"},
   { name:"SYSPLUGINSDATARO", type:"BYTE", descr:"RO allocation area for plugins"},
   { name:"SYSPLUGINSDATARW", type:"BYTE", descr:"RW allocation area for plugins"},
   { name:"SYSUSERDATABLOCK", type:"BYTE", descr:"Data block available for user data mapping"},
   { name:"SYSUSERDATABLOCKRETAIN", type:"BYTE", descr:"Data block available for user data mapping - Retain DB"},
   { name:"SYSHOURS", type:"USINT", descr:"Values 0-23"},
   { name:"SYSMINUTES", type:"USINT", descr:"Values 0-59"},
   { name:"SYSSECONDS", type:"USINT", descr:"Values 0-59"},
   { name:"SYSDAY", type:"USINT", descr:"Values 1-31"},
   { name:"SYSDAYOFWEEK", type:"USINT", descr:"Values 0-6 where 0 is Sunday "},
   { name:"SYSMONTH", type:"USINT", descr:"Values 1-12"},
   { name:"SYSYEAR", type:"UINT", descr:"Values 4 digit"},
   { name:"SYSCOPMSDOFAILEVENT", type:"COPMSDOFAIL", descr:"This struct is filled just before an occurred parametrization SDO fail is signaled to PLC task"},
   { name:"SYSCOPMNODESTATUSCHANGEDEVENT", type:"COPMNODESTATUSCHANGED", descr:"This struct is filled just before a node status change is signaled to PLC task"},
   { name:"SYSCOPMEMERGENCYEVENT", type:"COPMEMERGENCY", descr:"This struct is filled just before an occurred emergency event is signaled to PLC task"},
   { name:"SYSCOPMPDOERREVENT", type:"COPMPDOERR", descr:"This struct is filled just before a malformed PDO RX event is signaled to PLC task"},
   { name:"SYSCOPMEVENTID", type:"DINT", descr:"This value is set with the event ID value. The struct corresponding to the ID set can be used in the notify event task when it is executed"},
   { name:"SYSCOPMRESYNCINFO", type:"COPMRESYNC", descr:"This struct is filled just before a master/slave resync event"},
   { name:"SYSCOPMMASTERSTATUS", type:"COPMMASTERSTATUS", descr:"System CANOpen Master Diagno. It is a structure of type COPMMASTERSTATUS composed ..."},
   { name:"SYSCOPMNODESTATUS", type:"COPMNODESTATUS", descr:"System CANOpen Master communication status. It is a structure of type COPMNODESTATUS composed ..."},
   { name:"SYSCOPMSDOSCHEDULINGDIAGNO", type:"COPMSDOSCHEDULINGDIAGNO_SLAVE", descr:"This structure show for each node the last SDO scheduled succeded and failed"},
   { name:"SYSMBMRTUNODESTATUS", type:"MBMNODESTATUS", descr:"System Modbus Master RTU communication status for network with id MB_RTU_NETWORK_0. ..."},
   { name:"SYSMBMRTUNODESTATUS_1", type:"MBMNODESTATUS", descr:"System Modbus Master RTU communication status for network with id MB_RTU_NETWORK_1. ..."},
   { name:"SYSMBMRTUNODESTATUS_2", type:"MBMNODESTATUS", descr:"System Modbus Master RTU communication status for network with id MB_RTU_NETWORK_2. ..."},
   { name:"SYSMBMRTUNODESTATUS_3", type:"MBMNODESTATUS", descr:"System Modbus Master RTU communication status for network with id MB_RTU_NETWORK_3. ..."},
   { name:"SYSMBMTCPNODESTATUS", type:"MBMTCPNODESTATUS", descr:"System Modbus Master TCP communication status. It is a structure of type MBMTCPNODESTATUS composed ..."},
   { name:"SYSALARMCFGOK", type:"BOOL", descr:"Alarm manager properly configured"},
   { name:"SYSALARMACTIVE", type:"BOOL", descr:"At least one alarm is active (associated condition holds true)"},
   { name:"SYSALARMWAITACK", type:"BOOL", descr:"No alarm is active but at least one alarm is waiting for acknowledgement"},
   { name:"SYSALARMCOUNT", type:"UINT", descr:"Number of active alarms"},
   { name:"$$CODEBASE$$", type:"UDINT", descr:""},
   { name:"$$CODESTART$$", type:"UDINT", descr:""},
   { name:"$$CODESIZE$$", type:"UDINT", descr:""},
   { name:"$$CODEEND$$", type:"UDINT", descr:""},
   { name:"$$DATASIZE$$", type:"UDINT", descr:""},
   { name:"$$AUXDATASIZE$$", type:"UDINT", descr:""},
   { name:"$$BITDATASIZE$$", type:"UDINT", descr:""},
   { name:"$$RITDATASIZE$$", type:"UDINT", descr:""}
]