1
2 #include "demo_guix_home_automation.h"
3
4 /* Define controller information structure. */
5 typedef struct TITLE_INFO_STRUCT{
6 CONTROLLER_BASE_CONTROL_BLOCK *base; /* Pointer of the controller widget. */
7 GX_RESOURCE_ID title_id; /* Title of the controller. */
8 }TITLE_INFO;
9
10 /* "controller base" widget is a template that contains only one child to show title text.
11 "locks door base" widget is a template that derived from "controller base", which contains
12 other child widgets for lock settings. This is a list of lock controller widgets and title text
13 to assign to those widgets. */
14 TITLE_INFO locks_title_list[] = {
15 { &locks_page_1.locks_page_1_security_alarm, GX_STRING_ID_SECURITY_ALARM },
16 { &locks_page_1.locks_page_1_front_door.base, GX_STRING_ID_FRONT_DOOR },
17 { &locks_page_2.locks_page_2_patio_door.base, GX_STRING_ID_PATIO_DOOR },
18 { &locks_page_2.locks_page_2_upper_deck_door.base, GX_STRING_ID_UPPER_DECK_DOOR },
19 { &locks_page_3.locks_page_3_lower_deck_door.base, GX_STRING_ID_LOWER_DECK_DOOR },
20 { &locks_page_3.locks_page_3_add_lock.base, GX_STRING_ID_ADD_LOCK },
21 { GX_NULL, 0 }
22 };
23
24 /* "controller base" widget is a template that contains only one child to show title text.
25 "lights base" widget is a template that derived from "controller base", which contains
26 other child widgets for light settings. This is a list of light controller widgets and title text
27 to assign to those widgets. */
28 TITLE_INFO lights_title_list[] = {
29 { &lights_page_1.lights_page_1_kitchen.base, GX_STRING_ID_KITCHEN},
30 { &lights_page_1.lights_page_1_master_bedroom.base, GX_STRING_ID_MASTER_BEDROOM },
31 { &lights_page_2.lights_page_2_kids_bedroom.base, GX_STRING_ID_KIDS_BEDRROM },
32 { &lights_page_2.lights_page_2_living_room.base, GX_STRING_ID_LIVING_ROOM },
33 { &lights_page_3.lights_page_3_dinning_room.base, GX_STRING_ID_DINNING_ROOM },
34 { &lights_page_3.lights_page_3_outdoor_patio.base, GX_STRING_ID_OUTDOOR_PATIO },
35 { &lights_page_4.lights_page_4_office.base, GX_STRING_ID_OFFICE },
36 { &lights_page_4.lights_page_4_add_light.base, GX_STRING_ID_ADD_LIGHT },
37 { GX_NULL, 0 }
38 };
39
40 /* "controller base" widget is a template that contains only one child to show title text.
41 "thermostat base" widget is a template that derived from "controller base", which contains
42 other child widgets for thermostat settings. This is a list of thermostat controller widgets and title text
43 to assign to those widgets. */
44 TITLE_INFO thermostat_title_list[] = {
45 { &thermostat_page_1.thermostat_page_1_kitchen.base, GX_STRING_ID_KITCHEN },
46 { &thermostat_page_1.thermostat_page_1_master_bedroom.base, GX_STRING_ID_MASTER_BEDROOM },
47 { &thermostat_page_2.thermostat_page_2_kids_bedroom.base, GX_STRING_ID_KIDS_BEDRROM },
48 { &thermostat_page_2.thermostat_page_2_living_room.base, GX_STRING_ID_LIVING_ROOM },
49 { &thermostat_page_3.thermostat_page_3_dinning_room.base, GX_STRING_ID_DINNING_ROOM },
50 { &thermostat_page_3.thermostat_page_3_outdoor_patio.base, GX_STRING_ID_OUTDOOR_PATIO },
51 { &thermostat_page_4.thermostat_page_4_office.base, GX_STRING_ID_OFFICE },
52 { &thermostat_page_4.thermostat_page_4_add_room.base, GX_STRING_ID_ADD_ROOM },
53 { GX_NULL, 0 }
54 };
55
56 /******************************************************************************************/
57 /* Initiate title of templates based on "controller_base". */
58 /******************************************************************************************/
controller_title_init(TITLE_INFO * info)59 static VOID controller_title_init(TITLE_INFO *info)
60 {
61 while (info->base)
62 {
63 /* Set title text for the specified controller widget. */
64 gx_prompt_text_id_set(&info->base->controller_base_title, info->title_id);
65 info++;
66 }
67 }
68
69 /******************************************************************************************/
70 /* Initiate title of lights. */
71 /******************************************************************************************/
lights_title_init()72 VOID lights_title_init()
73 {
74 controller_title_init(lights_title_list);
75 }
76
77 /******************************************************************************************/
78 /* Initiate title of rooms. */
79 /******************************************************************************************/
thermostat_title_init()80 VOID thermostat_title_init()
81 {
82 controller_title_init(thermostat_title_list);
83 }
84
85 /******************************************************************************************/
86 /* Initiate title of locks. */
87 /******************************************************************************************/
locks_title_init()88 VOID locks_title_init()
89 {
90 controller_title_init(locks_title_list);
91 }
92
93