1 /* This is a small demo of the high-performance GUIX graphics framework. */
2 
3 #include <stdio.h>
4 #include "gx_api.h"
5 
6 #include "demo_guix_home_automation_resources.h"
7 #include "demo_guix_home_automation_specifications.h"
8 
9 /* Define animation IDs. */
10 #define ANIMATION_ID_DRAG_SLIDE       GX_NEXT_ANIMATION_ID
11 #define ANIMATION_ID_PAGE_SLIDE       GX_NEXT_ANIMATION_ID + 1
12 #define ANIMATION_ID_FOOTER_HOME      GX_NEXT_ANIMATION_ID + 2
13 #define ANIMATION_ID_FOOTER_ADD       GX_NEXT_ANIMATION_ID + 3
14 #define ANIMATION_ID_FOOTER_SETTING   GX_NEXT_ANIMATION_ID + 4
15 #define ANIMATION_ID_SCREEN_CHILDREN  GX_NEXT_ANIMATION_ID + 5
16 
17 /* Define maximum power value. */
18 #define MAX_POWER 11489
19 
20 /* Define minimum radial slider angle that correspond to maximum power value. */
21 #define MIN_ANGLE -50
22 
23 /* Define maximum radial slider angle that correspond to minumum power value. */
24 #define MAX_ANGLE 230
25 
26 /* Define application information structure. */
27 typedef struct APP_INFO_STRUCT{
28     GX_WIDGET *current_screen; /* Pointer to current screen. */
29     GX_WIDGET *previous_screen; /* Pointer to previous screen. */
30     INT        overall_energy_today; /* Overall energy used today. */
31 }APP_INFO;
32 
33 VOID title_animation_start(CONTROLLER_BASE_CONTROL_BLOCK *base);
34 
35 VOID toggle_screen(GX_WIDGET *new_screen);
36 VOID on_footer_menu_clicked(INT button_id);
37 
38 VOID lights_screen_init();
39 VOID lights_title_init();
40 VOID lights_screen_reset();
41 VOID lights_screen_animation_start();
42 VOID lights_screen_animation_stop();
43 GX_RESOURCE_ID light_selected_map_id_get(GX_RADIAL_SLIDER *slider);
44 
45 VOID thermostat_screen_init();
46 VOID thermostat_title_init();
47 VOID thermostat_screen_reset();
48 VOID thermostat_screen_animation_start();
49 VOID thermostat_screen_animation_stop();
50 
51 VOID locks_screen_init();
52 VOID locks_title_init();
53 VOID locks_screen_reset();
54 VOID locks_screen_animation_start();
55 VOID locks_screen_animation_stop();
56 
57 VOID weather_screen_init();
58 VOID weather_screen_reset();
59 VOID weather_screen_animation_start();
60 VOID weather_screen_animation_stop();
61 
62 VOID pagination_button_enable_disable(GX_WINDOW *window, GX_BOOL enabled);