Access control example
-
Hello and welcome to the GUI-O "Access control" example!
NOTE: All images are copyrighted and should not be used for commercial purposes!
This example shows how to control access to a (secure) physical location. 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:#051029 ASR:0.449671 // show load screen - hide GUI, clear widgets and hardware objects and set display settings @sls @cls @clh // create widgets and hardware instances specifying custom parameters // |IM - image // |LB - label // |BT - button // |SI - status indicator // |RTC - real time clock // |EXTF - external file writer |IM UID:imx X:50 Y:28 W:95 H:50 ROT:0 SHE:0 VIS:1 OPA:1 SCM:3 IP:"RFID5.png" |LB UID:lb1 X:10 Y:6 ALP:1 ROT:0 SHE:1 FGC:#FFFFFF FSZ:5 FFA:"font6" TXT:"ACCESS" |LB UID:lb2 X:75 Y:6 ROT:0 SHE:1 FGC:#FFFFFF FSZ:5 FFA:"font6" TXT:"CONTROL" |BT UID:bt3 X:75 Y:91 W:35 H:8 ROT:0 RAD:2 BGC:#3c3939 FGC:#11a8d0 FSZ:5 FFA:"font6" TXT:"Open" |LB UID:lb3 X:50 Y:78 ROT:0 SHE:1 FGC:#FFFFFF FSZ:2.5 TXT:"543212345123" FFA:"font5" |LB UID:lb4 X:50 Y:61 ROT:0 SHE:1 FGC:#FFFF00 ALP:0 FSZ:7 FFA:"font6" TXT:"James" |LB UID:lb5 X:53 Y:50 ROT:0 SHE:1 FGC:#FFFFFF ALP:1 FSZ:3 FFA:"font6" TXT:"2021-03-25" |LB UID:lb6 X:77 Y:50 ROT:0 SHE:1 FGC:#FFFFFF ALP:1 FSZ:3 FFA:"font6" TXT:"21:35:59" |LB UID:lb7 X:75 Y:78 ROT:0 SHE:1 FGC:#FFFFFF FSZ:2.5 TXT:"24" FFA:"font5" |RTC UID:rtc1 HID:rtc RTCR:0.1 RTCE:1 RTCF:"yy-MM-dd hh:mm:ss" |SI UID:si1 X:50 Y:70 W:5 BGC:#B0C4DE FGC:#009900 EN:0 |LB UID:lbpis X:50 Y:55 ROT:0 SHE:1 FGC:#FFFFFF FSZ:4 TXT:"My home door" FFA:"font6" |EXTF UID:extf1 HID:extf FAC:0 FNA:"RFID-1.CSV" // 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:imx X:50 Y:28 W:95 H:50 ROT:0 SHE:0 VIS:1 OPA:1 SCM:3 IP:"https://i.imgur.com/5R57tKc.png"
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 (and hardware objects) is thoroughly described in the GUI-O developer manual in the "Widgets API" section.
Feel free to leave any questions or comments below.
-
Here is the new RFID access control screen.
https://i.imgur.com/8NE7gvC.png