Skip to content

XML Interface

Dario Di Maio edited this page Jan 6, 2020 · 9 revisions

Introduction


SUPERSEEDED

This function is no longer updated. It actually works on some AVR microcontroller (see below in Hardware Compatibility) and in specific cases.


A raw (without any schema) HTML/XML interface can be added in the sketch, this is a polling based and works either with or without Persistance mode active. It can be used with every external interface that allow the parsing of the HTTP/XML data. It can provide data from the whole network enabling the Persistance mode.

To enable the interface use #include "conf/XMLinterface.h"

Application Programming Interface

Once included the configuration file, you need to add the Init and Interface API to your sketch

In the setup() after the Set of the typical logic used in the sketch

Init_XMLServer();

In the loop() into a FAST phase that runs as Souliss API

Run_XMLServer();

Interaction

The following HTTP GET request are accepted:

  • GET /typicals?id=id_num
  • GET /status?id=id_num
  • GET /force?id=id_num&slot=slot_num&val=val_num
  • GET /force?typ=typ_val&val=val_num

The response is always an HTTP OK 200 followed by the XML:

<id_n_><s_m_>_val_</s_m_><s_m+1_>_val_</s_m+1_>...<s_nodes_>_val_</s_nodes_></id_n_>

Examples

Some examples of valid URLs and response for a Gateway node with Persistance mode active and IP address 192.168.1.17

Request typical logic data definition, node 0
http://192.168.1.17/typicals?id=0
<id0><s0>21</s0><s1>11</s1></id0>
Request typical logic data definition, node 1
http://192.168.1.17/typicals?id=1
<id1><s0>11</s0><s1>11</s1><s2>11</s2><s3>11</s3></id1>
Request actual state and then force the first logic, for node 0
http://192.168.1.17/status?id=0
<id0><s0>0</s0><s1>0</s1></id0>
http://192.168.1.17/force?id=0&slot=0&val=1
http://192.168.1.17/status?id=0
<id0><s0>1</s0><s1>0</s1></id0>
Request actual state and then force the first logic, for node 1
http://192.168.1.17/status?id=1
<id1><s0>0</s0><s1>0</s1><s2>0</s2><s3>0</s3></id1>
http://192.168.1.17/force?id=0&slot=0&val=1
http://192.168.1.17/status?id=1
<id1><s0>0</s0><s1>0</s1><s2>0</s2><s3>0</s3></id1
A request for a node that hasn't been connected
http://192.168.1.17/status?id=2
<id2></id2>
Set Brightness intensity for T19 typical
At slot 0 we have a T19. This command will set the brightness at 150
http://192.168.1.17/force?id=1?slot=0?val=34,150

NB. All command and value, must send in decimal. SET command are 0x22 # 34 dec
	command and value must be comma separated

Hardware Compatiblity

The HTTP/XML interface runs either on Ethernet boards with embedded TCP/IP support or boards with uIP software TCP/IP stack. In most of the cases this interface cannot run over a standard ATmega328 microcontroller for either short availability of RAM and FLASH.

There are several cases, a summary is reported in the following table:

(Nodes, Slot) Persistance Mode Enabled Persistance Mode Disabled
Default (45, 24) Not supported Supported
Small (8, 10) Supported Supported
Microcontroller ATmega328 with embedded TCP/IP stack
(Nodes, Slot) Persistance Mode Enabled Persistance Mode Disabled
Default (45, 24) Not supported Not supported
Small (8, 10) Not supported Not supported
Microcontroller ATmega328 with software TCP/IP stack
(Nodes, Slot) Persistance Mode Enabled Persistance Mode Disabled
Default (45, 24) Supported Supported
Small (8, 10) Supported Supported
Microcontroller ATmega2560 with embedded or software TCP/IP stack

The RAM and FLASH usage is increased either due Persistance mode and the needs of the Interface itself.

Clone this wiki locally