gui_app_fwk.h
gui_app_fwk.h
Sifli GUI application framework, provide basic functions for user to start/stop/pause/resume application. It also provide navigation among applications and transition of GUI.
- Author
Sifli software development team
Defines
-
GUI_APP_NAME_MAX_LEN
App display name max length.
-
GUI_APP_ID_MAX_LEN
An unique character id of an app (both bult-in app and dl app)
-
GUI_DL_APP_MAX_FILE_PATH_LEN
Max file path length for dynamic loading applications.
-
BUILTIN_APP_EXPORT(name, icon, id, entry)
Define a build-in GUI applications: name - name which will display on mainmenu icon - icon which will display on mainmenu too. id - let other app find this app by id entry- app’s entry function
-
gui_app_regist_msg_handler(id, handler)
-
gui_app_create_page(pg_id, pg_handler)
-
gui_app_create_page_for_app(app_id, pg_id, pg_handler)
-
MANUAL_TRAN_ANIM_MAX_PROCESS
-
FLAG_TRANS_ANIM_REVERSE
-
FLAG_TRANS_ANIM_FG
-
gui_script_app_list_get_next(app)
-
gui_script_watch_face_register()
Typedefs
-
typedef int (*gui_app_entry_func_ptr_t)(intent_t i)
-
typedef int16_t gui_anim_value_t
-
typedef lv_obj_t *gui_anim_obj_t
-
typedef int16_t gui_coord_t
-
typedef void (*gui_page_msg_cb_t)(gui_app_msg_type_t msg, void *param)
-
typedef void (*cust_anim_cb_t)(gui_anim_obj_t img, void *user_data, uint32_t flag, gui_anim_value_t process)
Enums
-
enum gui_app_trans_anim_type_t
Values:
-
enumerator GUI_APP_TRANS_ANIM_NONE
Disable app’s trans anim.
-
enumerator GUI_APP_TRANS_ANIM_PUSH_RIGHT_IN
-
enumerator GUI_APP_TRANS_ANIM_PUSH_RIGHT_OUT
-
enumerator GUI_APP_TRANS_ANIM_PUSH_LEFT_IN
-
enumerator GUI_APP_TRANS_ANIM_PUSH_LEFT_OUT
-
enumerator GUI_APP_TRANS_ANIM_ZOOM_IN
-
enumerator GUI_APP_TRANS_ANIM_ZOOM_OUT
-
enumerator GUI_APP_TRANS_ANIM_CUSTOM
Customized tansform animation.
-
enumerator GUI_APP_TRANS_ANIM_ENTER_DEFAULT
Use system default animation.
-
enumerator GUI_APP_TRANS_ANIM_EXIT_DEFAULT
Use system default animation.
-
enumerator GUI_APP_TRANS_ANIM_NONE
Functions
-
int gui_app_regist_msg_handler_ext(const char *id, gui_page_msg_cb_t handler, void *usr_data)
register an application’s root page message handler
- 参数:
id – [in] Identification of application
handler – [in] The main subpage message handler.
usr_data – [in] User data of this app
- 返回值:
RT_EOK – if successful, otherwise return error number < 0.
-
int gui_app_create_page_ext(const char *pg_id, gui_page_msg_cb_t handler, void *usr_data)
Create a subgpage in current actived app, and present it.
- 参数:
pg_id – [in] Subpage id (should be unique in one app )
handler – [in] This subpage message handler
usr_data – [in] User data of this subpage
- 返回值:
RT_EOK – if successful, otherwise return error number < 0.
-
int gui_app_create_page_for_app_ext(const char *app_id, const char *pg_id, gui_page_msg_cb_t handler, void *usr_data)
Create a subgpage for specified app, and present it.
- 参数:
app_id – [in] Identification of an application
pg_id – [in] Subpage id (should be unique in one app )
handler – [in] This subpage message handler
usr_data – [in] User data of this subpage
- 返回值:
RT_EOK – if successful, otherwise return error number < 0.
-
void gui_app_trans_anim_init_cfg(gui_app_trans_anim_t *cfg, gui_app_trans_anim_type_t type)
get default configuration of type animation
参见
- 参数:
cfg – - output config
type – - animation type id
-
void gui_app_set_enter_trans_anim(gui_app_trans_anim_t *cfg)
set app’s enter transform animation
参见
- 参数:
cfg
-
void gui_app_set_exit_trans_anim(gui_app_trans_anim_t *cfg)
set app’s exit transform animation
参见
- 参数:
cfg
-
void gui_app_set_trans_anim_prio(int8_t up, int8_t down)
-
rt_err_t gui_app_manual_animation_start(uint32_t process)
-
rt_err_t gui_app_manual_animation_update(uint32_t process)
-
rt_err_t gui_app_manual_animation_stop(uint32_t process)
-
const builtin_app_desc_t *gui_builtin_app_list_open(void)
-
const builtin_app_desc_t *gui_builtin_app_list_get_next(const builtin_app_desc_t *ptr_app)
-
void gui_builtin_app_list_close(const builtin_app_desc_t *ptr_app)
-
struct gui_point_t
-
struct builtin_app_desc_t
- #include <gui_app_fwk.h>
built-in app description
Public Members
-
char name[16]
app display name
-
const void *icon
app display icon
-
char id[16]
an unique character id of an app (both bult-in app and dl app)
-
gui_app_entry_func_ptr_t entry
app entry function
-
char name[16]
-
struct gui_app_trans_anim_zoom_t
Public Members
-
gui_point_t pivot
Animation zoom pivot.
-
gui_anim_value_t zoom_start
zoom start value
-
gui_anim_value_t zoom_end
zoom end value
-
gui_anim_value_t opa_start
opaque start value
-
gui_anim_value_t opa_end
opaque end value
-
gui_point_t pivot
-
struct gui_app_trans_anim_push_t
Public Members
-
gui_anim_value_t opa_start
opaque start value
-
gui_anim_value_t opa_end
opaque end value
-
gui_coord_t x_start
push start x-coordinate
-
gui_coord_t x_end
push end x-coordinate
-
gui_anim_value_t opa_start
-
struct gui_app_trans_anim_custom_t
-
struct gui_app_trans_anim_t
Public Members
-
gui_app_trans_anim_type_t type
Animation type.
-
gui_app_trans_anim_zoom_t zoom
Configuration of zoom animation.
-
gui_app_trans_anim_push_t push
Configuration of psuh animation.
-
gui_app_trans_anim_custom_t cust
Configuration of customized animation.
-
union gui_app_trans_anim_t.[anonymous] cfg
-
gui_app_trans_anim_type_t type
-
struct gui_app_trans_anim_group_t
Public Members
-
gui_app_trans_anim_t a_enter
-
gui_app_trans_anim_t a_exit
-
int8_t prio_up
-
int8_t prio_down
-
gui_app_trans_anim_t a_enter
gui_app_fwk2.h
Enums
-
enum gui_app_msg_type_t
Page state notification messages.
Messages be send to page’s msg handler by firmware while page’s state changed
Values:
-
enumerator GUI_APP_MSG_ONSTART
Page was started.
Recieve this msg only once after the page created.
-
enumerator GUI_APP_MSG_ONRESUME
Page was bring to foreground.
The page’s state can be paused or started before.
-
enumerator GUI_APP_MSG_ONPAUSE
Page was bring to background.
The page’s state must be resumed when recieve this message.
-
enumerator GUI_APP_MSG_ONSTOP
Page was being destory.
The page’s state must be paused when recieve this message, and will recieve once.
-
enumerator GUI_APP_MSG_USER_END
last user application message
-
enumerator GUI_APP_MSG_ONSTART
Functions
-
void gui_app_init(void)
Initialize application framework.
-
int gui_app_run(const char *cmd)
run an app
- 参数:
cmd – [in] application command - format:[app_id] [param0] [param1] [param2] …
- 返回值:
RT_EOK – if successful, otherwise return error number < 0.
-
int gui_app_exit(const char *id)
exit specified app by it’s id
- 参数:
id – [in] The id of app
- 返回值:
RT_EOK – if successful, otherwise return error number < 0.
-
void gui_app_self_exit(void)
exit current app
-
bool gui_app_is_actived(char *id)
check whether the app is active(or running)
- 参数:
id – [in] Identification of application
- 返回值:
FALSE – - if app is paused, or not even started, TRUE if app is active.
-
bool gui_app_is_page_present(char *id)
check whether the subpage is present in cur app
- 参数:
id – [in] Identification of subpage
- 返回值:
FALSE – - if subpage is not started, TRUE if subpage is active, paused, or resumed.
-
void gui_app_remove_page(const char *pg_id)
Remove a subgpage from this app.
- 参数:
pg_id – [in] Subpage id (should be unique in app )
- 返回值:
RT_EOK – if successful, otherwise return error number < 0.
-
void gui_app_refr_page(const char *pg_id)
Refresh subgpage(pause then resume)
- 参数:
pg_id – [in] Subpage id (should be unique in app )
- 返回值:
RT_EOK – if successful, otherwise return error number < 0.
-
int gui_app_goback_to_page(const char *pg_id)
Goback to specified subpage in this app.
- 参数:
pg_id – [in] Subpage id (should be unique in app )
- 返回值:
RT_EOK – if pg_id is existent, otherwise return error number < 0.
-
int gui_app_goback(void)
Destory current page, and destory app if it’s having no page.
- 返回值:
RT_EOK – if successful, otherwise return error number < 0.
-
int gui_app_manual_goback_anim(void)
Goback current page manual.
- 返回值:
RT_EOK – if successful, otherwise return error number < 0.
-
void gui_app_cleanup(void)
Close all app.
- 返回值:
void –
-
void gui_app_cleanup_bg_apps(void)
Close all background app.
- 返回值:
void –
-
void gui_app_cleanup_now(void)
Close all app synchronously, must been call while all gui app task is NOT running.
- 返回值:
void –
-
void gui_app_run_now(const char *cmd)
Run app immediately, no animation.
- 参数:
cmd – [in] application command - format:[app_id] [param0] [param1] [param2] …
- 返回值:
void –
-
bool gui_app_is_all_closed(void)
Check whether all app has been closed.
- 返回值:
true – all app is closed, false: not closed yet
-
intent_t gui_app_get_intent(void)
Get current actived app’s intent.
- 返回:
Current active app’s intent
-
void *gui_app_get_page_userdata(const char *pg_id)
Get subpage’s user data.
- 参数:
pg_id – - Subpage id (should be unique in app )
- 返回:
NULL if not found pg_id
-
int gui_app_set_page_userdata(const char *pg_id, void *usr_data)
Set subpage’s user data.
- 参数:
pg_id – - Subpage id (should be unique in app )
usr_data – - user data
- 返回:
RT_EOK if successful, otherwise return error number < 0.
-
void *gui_app_this_page_userdata(void)
Get current subpage’s user data.
- 返回:
NULL if no data
-
uint32_t gui_app_get_running_apps(void)
Get all runing apps numbers
.
参见
- 返回:
The number of running apps
-
lv_obj_t *gui_app_get_clock_parent()
Get current clock parent
.
参见
- 返回:
clock parent object
-
void gui_app_exec_now(void)
Execute gui app schedule immediately util finish all job.
.
参见
- 返回:
none
-
int gui_app_fwk_suspend(void)
suspend gui_app framework asynchronized, append ‘gui_app_exec_now’ after if you want suspend synchronized.
- 返回:
RT_EOK if successful, otherwise return error number < 0.
-
int gui_app_fwk_resume(void)
resume gui_app framework asynchronized
- 返回:
RT_EOK if successful, otherwise return error number < 0.