Appendix, Ppendix, Cgi (common gateway interface) – IDEC MicroSmart Pentra User Manual

Page 155

Advertising
background image

W

EB

S

ERVER

CPU M

ODULE

U

SER

S

M

ANUAL

FC9Y-B1278

A-1

A

PPENDIX

CGI (Common Gateway Interface)

The device data can be read from or written to the Web server CPU module via CGI using JavaScript. This section
describes the CGI formats. The CGI format described here may not operate properly if they are not used with JavaScript.

Request Format (Reading Device Data)

Device data can be read from the Web server CPU module with the following format using the GET method.

/system/device_read.cgi?device=DEV&address=XXXX&length=XXXX&driver=XX&net_no=XX

The CGI parameters are as follows:

Example: When reading two consecutive data registers from D2058, the format for CGI is as follows:
/system/device_read.cgi?device=D&address=080A&length=0002&driver=00&net_no=00

Reply Format (Reading Device Data)

The Web server CPU module returns the following reply after receiving above request.

Content-type: text/javascript+json; charset=utf-8
{
"STATUS":"0",
"DEVICE":"D",
"ADDRESS":"080A",
"LENGTH":"0002",
"DRIVER":"00",
"NET_NO":"00"
“DATA”:”C2F6_E978”
}

STATUS: 0 indicates normal reply. Any other values indicate an error.
DEVICE, ADDRESS, LENGTH, DRIVER, and NET_NO: The parameters in the request are stored.
DATA: Values of the specified devices are stored. When the length is bigger than or equal to 2, “_“ is inserted between
device values.

/system/device_read.cgi

: CGI file name

device

: Specify the device type of the target device using a character. "D" (Data Register) is supported.

address

: Specify the device number of the target device in hexadecimal.

length

: Specify the number of data registers to read in hexadecimal. The valid range is 1 to 64 (0001h to

0040h).

driver

: Reserved for the system. Specify “00”.

net_no

: Reserved for the system. Specify “00”.

Advertising