Programming - First steps
P.
76 of 349
What you can configure everything
Three basic rules for building the
web server
Query button
Buttons and text change
Floating-point numbers are directly
converted to strings by the function.
Dates, e.g. the return of settime()
etc., as well.
First the elements must be configured. This is done in the user program as follows:
[EibPC]
[WebServer]
button(1)[CLOCK]$Time$ none button(2)[DATE]$Date$
line
button(3)[INFO]$Rooming$
shifter(4)[PLUS,MINUS,UP,DOWN]$Timer Heating$ chart(5)[$16$,$20$,$24$]
line
button(6)[TEMPERATURE]$Indoor$ button(7)[TEMPERATURE]$Outdoor$ \\
button(8)[WIND]$Wind$ button(9)[WEATHER]$Light$
line
button(10)[LIGHT]$Light$
The following elements are available:
•
button
: single length, a graphic symbol (icon), pretending a fixed and a variable line of text,
symbol dynamically changeable
•
shifter
: twofold length, one to four graphic symbols (icon), a fixed and a variable line of
text, one symbol is dynamically changeable
•
chart
: twofold length, is used for display of curves (XY diagrams)
•
none
: empty element
•
line
: thin separation line
•
In the overview on page 291 we find the possible symbols which can be addressed either
by indices (numbers) or by the predefined constants.
Let us look again at the specification for the generation of the webserver:
1.
Each element has an ID (up to 39 elements).
2.
Each line of the configuration corresponds to a row of visualisation.
3.
Elements are separated by one or more spaces.
4.
Empty elements (
none
) will be automatically generated (e.g . the last line of the web
server).
5.
The webserver consists of a maximum of ten columns. Each line of the configuration
corresponds to a row of visualization.
Thus we are already be able to “design“ the web server.
But now the question arises: How can we respond to the user's input in the user program?
The attentive reader will already have noticed the numbers in parentheses within the definitions of
the elements. These are used for the allocation in the application program, in which the elements
button,
shifter
and
chart
can be addressed by the functions
webbutton
,
webdisplay
and
webchart
,
respectively.
The function
webbutton
(ID{u08})
returns for the duration of one processing pass a non-zero value, when pressing the push button on
a web button (
button
or
shifter
) with the
ID
(number between 0 and 255). In case of the activation of a
button
element, the return value changes from 0 to 1 (u08) and back to 0. In case of a
shifter-
element, the return changes to 1,2,3 or 4 (u08) depending on the activated switching element of
shifter
. The
shifter
may variably show one, two, three or four icon. Here the numbers refer to the
arrangement of circuit elements from left to right. If
button
or
shifter
have the same
ID
, then, in both
cases of the activity, the function webbutton also reacts twice.
ID
may be randomly allocated and
must not be consecutively numbered. However, only numbers between 0 and 39 are allowed.
As shown in Figure 34, each button and shifter consist of graphics and two lines of text. The first line
of text has already been indicated in the above configuration at the end of the element and cannot be
changed at runtime.
webdisplay(
ID{u08},Text{any data type},Icon{u08},State{u08},TextStyle{u08})
HandbuchEibPC_USA-30.odt, 2017-05-11
Enertex
®
Bayern GmbH - Erlachstraße 13 - 91301 Forchheim - [email protected]