Webserver Tags

Tags

Data can be requested from the target board via Tags. Tags can be:

  • Placed in Dynamic Web Pages

  • Requested via a UDP messages - This feature has not been implemented yet! Will be implemented in a future version!

  • Requested via the HTTP GET or POST method - This feature has not been implemented yet! Will be implemented in a future version!



An example tag is "ix7". This tag will be replaced by a '1' or '0' character representing the current value of SBC Port X7. If this tag is placed on a Dynamic Web page, it will be shown in the Web Browser as a '1' or '0'.


For an up to date list of Tags, see online documentation at www.netcruzer.com/project-webserver-tags

13.1 Dynamic Web Pages

Any of the Tags listed below can be placed in “Dynamic file”, and will be replaced by the requested data when sent to the HTTP Client (Web Browser for example). Web pages are compiled and uploaded to the target board via the “Modtronix Webpage Generator”, see www.netcruzer.com/webpagegen. The “Advanced Options” button is used to define what files are “Dynamic files”. By default the following files are defined as “Dynamic files”: *.htm, *.html, *.cgi, *.xml

The HTTP Server can dynamically alter pages and substitute real-time information, such as input/output status. The web server will parse “Dynamic files” files for special tags, and replace them with user defined strings.

To incorporate this real-time information, the corresponding Dynamic file must contain a text string with the format: "~#tag~".



When the HTTP Server encounters this text string, it calls the cmdExecNameValueCmd() function. This function has been implemented by the Netcruzer Webserver in the "cmd.c" file. All tags implemented by the Web Server are listed below.

13.2 Tags via UDP command

This feature has not been implemented yet! Will be implemented in a future version! Any of the Tags listed below can be executed on the target by sending them to UDP port 54123. This port is configurable, and can be changed. The reply (requested data) will be returned to the UDP Socket that sent this Request Command.

13.3 Tags via HTTP GET method

This feature has not been implemented yet! Will be implemented in a future version! Any of the Tags listed below can be executed on the target by sending them via the HTTP GET method. The reply (requested data) will be returned to the UDP Request Command Port (54124 by default).

13.4 Defined Tags

The following tags are currently defined.

c - Configuration Tag

The following configuration tags are defined.

Command Syntax

Description

cs[0,1]

Port S0 to S1 Configuration - The following example tag will return the configuration of port S0: cs0

The returned value can be one of the following:

  • od: Digital output

  • oc: Open collector (open drain) digital output

  • id: Digital input

  • iu: Digital input with pull-up resistor enabled

  • iw: Digital input with pull-down resistor enabled

  • w1 - w9: PWM output channel 1 to 9 (only valid for RP ports)

  • an: Analog input (only valid for Analog ports)

ct[0-7]

Port T0 to T7 Configuration - The following example tag will return the configuration of port T1: ct1

See “cs” tag above for details on the returned value.

cx[0-11]

Port X0 to X11 Configuration - The following example tag will return the configuration of port X10: cx10

See “cs” tag above for details on the returned value.

cy[0-11]

Port Y0 to Y11 Configuration - The following example tag will return the configuration of port Y5: cy5

See “cs” tag above for details on the returned value.



g - General Tag

The general Tag returns various values. The following Tags are defined:

Command Syntax

Description

gc:cookie

Get cookie with given name – Returns cookie with given name, else NA.

gf:filename

Include the given file – The contents of the given file will be included. For example, “lf_hdr.inc” will included “hdr.inc” file.

gun

Get the User Name – Returns the current User Name

gpw

Get the Password – Returns the current Password



i - Input Tag

The following input tags are defined.

Command Syntax

Description

ii[0-9]p[0-9]

Not available yet, in future version!

iMod Port Value - The following example tag will return the value of iMod 2, port 4: ii2p4

See “is” tag above for details on the returned value.

is[0,1]

Port S0 to S1 Value - The following example tag will return the value of port S0: is0

The returned value depends on the configuration of the port, and can be '0' or '1', or a value from '0' to '1023':

  • od: Digital output, a '0' or '1' will be returned

  • oc: Open collector (open drain) digital output, a '0' or '1' will be returned

  • id: Digital input, a '0' or '1' will be returned

  • iu: Digital input with pull-up resistor enabled, a '0' or '1' will be returned

  • iw: Digital input with pull-down resistor enabled, a '0' or '1' will be returned

  • w1 - w9: PWM output channel 1 to 9 (only valid for RP ports), a value from '0' to '1023' will be returned

  • an: Analog input (only valid for Analog ports), a value from '0' to '1023' will be returned

it[0-7]

Port T0 to T7 Value - The following example tag will return the value of port T1: it1

See “is” tag above for details on the returned value.

ix[0-11]

Port X0 to X11 Value - The following example tag will return the value of port X10: ix10

See “is” tag above for details on the returned value.

iy[0-11]

Port Y0 to Y11 Value - The following example tag will return the value of port Y5: iy5

See “is” tag above for details on the returned value.



k - Configuration Block Tag

This feature has not been implemented yet! Will be implemented in a future version!

The following Tags are used for requesting application properties stored in CFG_BLOCKs. The following Tags are defined:

Command Syntax

Description

k[0-f][00-ff][0-fff]

Return 1-16 CFG_BLOCK Bytes

  • The first [0-f] is the number of bytes to write

  • The second [00-ff] is the offset in CFG_BLOCK

  • The third [00-ff] is the CFG_BLOCK id (add 0x0100)

For example:

k52010 - Will return 5 bytes at offset 0x20, from CFG_BLOCK with id 0x0110 (0x0100+10)

kA06220 - Will return 10 bytes (0xA) at offset 0x06, from CFG_BLOCK with id 0x0320 (0x0100+220)

 

The following are the Tag codes for some common CFG_BLOCK data

Command Syntax

Description

k100000

Return 1-16 CFG_BLOCK Bytes

  • The first [0-f] is the number of bytes to write

  • The second [00-ff] is the offset in CFG_BLOCK

  • The third [00-ff] is the CFG_BLOCK id (add 0x0100)

For example:

k52010 - Will return 5 bytes at offset 0x20, from CFG_BLOCK with id 0x0110 (0x0100+10)

kA06220 - Will return 10 bytes (0xA) at offset 0x06, from CFG_BLOCK with id 0x0320 (0x0100+220)



p - PLC Process Image Tag

This feature has not been implemented yet! Will be implemented in a future version!

The following Tags are defined:

Command Syntax

Description

p[0-F,Z][0-FF]f

Return bit/word from PLC Ram

  • [0-F,Z] is node address (0-F=nodes, Z=SBC board)

  • [0-FF] is bit/word address, f is format (t=bit, w=word)

 

Some examples:

  • p305t - Will return bit at address 0x05 of node 3

  • p2C0w - Will return word at address 0xC0 of node 2

pt[0-F,Z][0-FF]

Return temperature from PLC Ram

  • [0-F,Z] is node address (0-F=nodes, Z=SBC board)

  • [0-FF] is temperature address.

For examples:

  • ptZ01 - Will return the second temperature value (00=first, 01=second,...) of the SBC board.



u - User Memory Tags

The following Tags are used to return a value from User Memory. TheUser Memory is a section in RAM that can be used by the user for storing variables. There are also Commands (see Command chapter above) for updating the contents of the User Memory. By default, 256 bytes of user memory is available! This means the address part of the Tag must be in the range 0-FF (0-255 decimal). The User Memory can be increased by adding the following line to the projdefs.h file in the source code. This example increases it to 1024 bytes:
#define USER_RAM_SIZE 1024

The address[adr] part of the Tag can be in decimal or hex format. Default is hex format. The 'd' format specifiers can be used to specify decimal format. For example:

uA0 - Will return the contents of User Memory at address 0xA0 (decimal 160), for example “F8”

ud150 - Will return the contents of User Memory at address 60 (decimal 60), for example “9A”



The following tags are defined:

Command Syntax

Description

u(d)[adr](d)

Byte in User Memory - Returns a byte(decimal or hex format) located at given address in User Memory(decimal or hex address).
An optional 'd' preceding the [adr] indicates address is in decimal format (default is hex).
An optional 'd' after the [adr] indicates requested value should be decimal (default is hex).
Some examples:

  • uA0 - Returns 1 byte (2 character upper case hex format) located at address 0xA0 (hex formatted address), ex. 0A

  • uA0d - Returns 1 byte (decimal format) located at address 0xA0 (hex formatted address), ex 190

  • u1B2 - Returns 1 byte (2 character upper case hex format) located at address 0x1B2 (hex formatted address), ex. 19

  • ud150 - Returns 1 byte (2 character upper case hex format) located at address 150 (decimal formatted address), ex. B5

u(d)[adr]w(d)

Word(2 bytes) in User Memory - Returns a word(decimal or hex format) located at given address in User Memory(decimal or hex address).
An optional 'd' preceding the [adr] indicates address is in decimal format (default is hex).
An optional 'd' after the [adr] indicates requested value should be decimal (default is hex).
Some examples:

  • uA0w - Returns 2 bytes (4 character upper case hex format) located at address 0xA0 (hex formatted address), ex. 0F9A

  • uA0wd - Returns 2 bytes (decimal format) located at address 0xA0 (hex formatted address), ex. 200

  • u1B2w - Returns 2 bytes (4 character upper case hex format) located at address 0x1B2 (hex formatted address), ex. 10BC

u(d)[adr]s

String in User Memory - Returns a string located at given address in User Memory (decimal or hex address). Everything is returned until a terminating NULL(0) is encountered. For example, if the given address contains the string “Hello”, 6 bytes will be returned. The 5 bytes for “Hello”, and a 0 (NULL termination).

  • uB0s - Returns the string located at address 0xB0

  • ud176s - Returns the string located at address 176 (hex 0xB0)

u(d)[adr]aN

Byte Array in User Memory - Returns a byte array (2 character upper case hex format) located at given address in user Memory(decimal or hex address). An optional 'd' preceding the [adr] indicates address is in decimal format (default is hex). The 'N' part is the length of the array in upper case hex format(0-9, A-F), and can be a value from 0 to 15 bytes. The returned value is in “2 character upper case hex” format. There will be 2 characters for each byte of the array! The first 2 characters of the returned value represents the first byte in the requested range in User Memory.
For example:

  • uA0b5 - Returns 5 bytes located at address 0xA0 (hex formatted address) to 0xA4. First to bytes represents value of address 0xA0....



v - User EEPROM Memory Tags

This feature has not been implemented yet! Will be implemented in a future version!

The following Tags are used to return a value from User EEPROM Memory. TheUser EEPROM Memory is a section in the external EEPROM that can be used by the user for storing variables. There are also Commands (see Command chapter above) for updating the contents of the User EEPROM Memory. By default, 250 bytes of user EEPROM memory is available! This means the address part of the Tag must be in the range 0-FA (0-250 decimal). The format is exactly the same as for the “u - User Memory Tags”, except that all Tags start with a 'v' and not 'u' character!