Central heating example
-
Hello and welcome to the GUI-O "Central heating" example!
NOTE: All images are copyrighted and should not be used for commercial purposes!
This example shows how to control and monitor temperature of your central heating system. The example is applicable for all connection types supported by the GUI-O application (i.e., Bluetooth, Bluetooth LE, IoT and Usb).
The final result is shown below. During the example, you can always consult the GUI-O developer manual for more information.
First, the following image must be copied onto your Android device under /Android/data/com.guio.guioapp/files/Pictures
Alternatively, the image can be loaded during run-time within the GUI-O application by specifying the corresponding url path in the parameter list (see the code example below).
NOTE: Since Android 11, the /Android/data/com.guio.guioapp/files/Pictures path is no longer accessible directly from the device due to Google's security restrictions. You can, however, access the path by connecting the Android device to a PC and transfer the image.
The GUI initialization procedure is shown in the following code block:
// set ASR (aspect ratio) parameter of the "development" device (see "Developer mode" section in the manual) @guis BGC:#000000 ASR:0.449671 // show load screen - hide GUI, clear widgets and hardware instances and set display settings @sls @cls @clh // create widgets specifying custom parameters // |IM - image // |LB - label // |CB - circular bar // |TG - toggle // |SL - slider |IM UID:im1 X:50 Y:17 W:100 H:100 ROT:0 SHE:0 IP:"CentHeat.jpg" |LB UID:lb1 X:40 Y:31 ROT:0 SHE:1 FGC:#FFFFFF FSZ:4 ALP:1 FFA:"font6" TXT:"Central Heating System" |CB UID:cb1 X:50 Y:82 W:50 ROT:0 SHE:1 BGC:#585A60 FGC:#6D9DC5 VAL:25 LVAL:1 HVAL:200 STA:-245 ENA:65 BTH:4 SHN:0 NC:#A0A0A4 NT:0.3 CE:1 SHT:0 XTC:10 FSZ:0.1 UD:1 HAW:7 HAH:7 |TG UID:tgt X:50 Y:72 W:15 H:1.5 ROT:270 SHE:1 BGC:#585A60 FGC:#6D9DC5 EN:1 HAW:7 HAH:7 RAD:0.7 |LB UID:lbsl X:50 Y:82 SHE:1 ROT:0 SHE:1 FGC:#FFFFFF FSZ:3.5 FFA:"font6" TXT:"Timer" |LB UID:lbtim X:50 Y:85 SHE:1 ROT:0 SHE:1 FGC:#FFFFFF FSZ:3.5 FFA:"font6" TXT:"35" |LB UID:lbst X:5 Y:7 SHE:1 ROT:0 SHE:1 ALP:1 FGC:#FFFFFF FSZ:4 FFA:"font6" TXT:"Temperature" |LB UID:lbstn X:50 Y:7 SHE:1 ROT:0 SHE:1 ALP:1 FGC:#FFFFFF FSZ:4 FFA:"font6" TXT:"40°" |TG UID:tg1 X:80 Y:40 W:15 H:1.8 ROT:180 SHE:1 BGC:#585A60 FGC:#148F77 EN:1 HAW:6 HAH:6 RAD:1 |TG UID:tg2 X:80 Y:50 W:15 H:1.8 ROT:180 SHE:1 BGC:#585A60 FGC:#148F77 EN:1 HAW:6 HAH:6 RAD:1 |TG UID:tg3 X:80 Y:60 W:15 H:1.8 ROT:180 SHE:1 BGC:#585A60 FGC:#148F77 EN:1 HAW:6 HAH:6 RAD:1 |SL UID:sltemp X:20 Y:50 W:60 H:10 RAD:0 ROT:270 HAH:0 HAW:0 VAL:35 FGC:#751601 SFGC:#FFFF00 LVAL:1 HVAL:60 |LB UID:lbstn1 X:20 Y:50 SHE:1 ROT:0 SHE:1 ALP:0 FGC:#FFFFFF FSZ:4 FFA:"font6" TXT:"40°" |SI UID:si1 X:65 Y:40 W:5 VIS:1 ROT:0 BGC:#585A60 FGC:#922B21 SHE:1 EN:1 |SI UID:si2 X:65 Y:50 W:5 VIS:1 ROT:0 BGC:#585A60 FGC:#922B21 SHE:1 EN:1 |SI UID:si3 X:65 Y:60 W:5 VIS:1 ROT:0 BGC:#585A60 FGC:#922B21 SHE:1 EN:1 |LB UID:lbs1 X:50 Y:40 SHE:1 ROT:0 SHE:1 FGC:#FFFFFF FSZ:3.5 FFA:"font6" TXT:"Oven" |LB UID:lbs2 X:50 Y:50 SHE:1 ROT:0 SHE:1 FGC:#FFFFFF FSZ:3.5 FFA:"font6" TXT:"Pump" |LB UID:lbs3 X:50 Y:60 SHE:1 ROT:0 SHE:1 FGC:#FFFFFF FSZ:3.5 FFA:"font6" TXT:"Floor" |LB UID:lbt1 X:20 Y:32 ROT:0 ALP:0 SHE:1 VIS:0 FGC:#FFFFFF FSZ:1.8 TXT:"--" // hide load screen (show GUI) @hls 250
Note that the image can also be loaded at run-time (within the GUI-O application) from the specified url. For example:
|IM UID:im1 X:50 Y:17 W:100 H:100 ROT:0 SHE:0 IP:"https://i.imgur.com/xq5fJQq.jpg"
This invokes the GUI-O application downloader and displays the image after successful transfer. Downloaded images are saved locally. All subsequent initialization requests trigger loading such images from the local resource, even if the image path is specified as an url.
Reacting to user input and updating widgets is thoroughly described in the GUI-O developer manual in the "Widgets API" section.
Feel free to leave any questions or comments below.