gui_app_fwk.h
gui_app_fwk.h
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, n)
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 n - group id/sytle id
-
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)
-
GUI_APP_TRANS_PROGRESS_MAX
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 lv_baseanim_para_t gui_app_trans_anim_t
-
typedef uint8_t gui_script_type_t
Enums
-
enum gui_app_type_t
application types
Values:
-
enumerator GUI_APP_BUILTIN
built-in applications.
-
enumerator GUI_APP_DYNAMIC
Dynamic applications.
-
enumerator GUI_APP_QJS
Applications written by QuickJS.
-
enumerator GUI_APP_PYTHON
Applications written by python.
-
enumerator GUI_APP_TOOLS
Applications generated by tools.
-
enumerator GUI_APP_RESERVE
Reserved, user-defined.
-
enumerator GUI_APP_BUILTIN
Functions
-
int gui_app_regist_msg_handler_ext(const char *id, gui_page_msg_cb_t handler, void *usr_data, uint32_t mem_size)
register an application’s root page message handler
- Parameters:
id – [in] Identification of application
handler – [in] The main subpage message handler.
usr_data – [in] User data of this app
- Return values:
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.
- Parameters:
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
- Return values:
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 *user_data, uint32_t mem_size)
Create a subgpage for specified app, and present it.
- Parameters:
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
- Return values:
RT_EOK – if successful, otherwise return error number < 0.
-
void gui_app_set_finsh_cb(lv_switchanim_finish_cb cb)
-
void gui_app_init_anim(gui_app_trans_anim_t *anim)
-
void gui_app_set_anim_prior(int16_t enter_prior, int16_t exit_prior)
-
void gui_app_set_anim_user_data(void *enter_user, void *exit_user)
-
void gui_app_set_enter_anim_type(uint16_t major, uint16_t minor, int16_t minor_aux)
-
void gui_app_set_exit_anim_type(uint16_t major, uint16_t minor, int16_t minor_aux)
-
void gui_app_close_anim()
-
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)
-
const builtin_app_desc_t *gui_script_app_list_get_next(const builtin_app_desc_t *desc, gui_script_type_t type)
Get script app(js/mpy) desc, this func will malloc memory internal, must release memory when desc is not used.
- Parameters:
desc – [in] NULL for get first app, -1 for close internal fd.
type – [in] script type, see gui_script_type_t.
- Return values:
NULL – if get end, otherwise return success.
-
void gui_script_app_list_free_desc(const builtin_app_desc_t *app, bool icon_release, gui_script_type_t type)
Free script desc.
- Parameters:
desc – [in] for free.
icon_release – [in] true for release, false for ignore.
type – [in] script type, see gui_script_type_t.
- Return values:
None. –
-
void gui_script_watch_face_register(gui_script_type_t type)
-
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
-
gui_app_type_t type
app types
-
char name[16]
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(uint16_t style)
Initialize application framework.
-
int gui_app_run(const char *cmd)
run an app
- Parameters:
cmd – [in] application command - format:[app_id] [param0] [param1] [param2] …
- Return values:
RT_EOK – if successful, otherwise return error number < 0.
-
int gui_app_exit(const char *id)
exit specified app by it’s id
- Parameters:
id – [in] The id of app
- Return values:
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)
- Parameters:
id – [in] Identification of application
- Return values:
FALSE – - if app is paused, or not even started, TRUE if app is active.
-
bool gui_page_is_actived(const char *app_id, const char *pg_id)
check whether the app’s page is active(or running)
- Parameters:
app_id – [in] Identification of application
pg_id – [in] Identification of page
- Return values:
FALSE – - if app/page is paused, or not even started, TRUE if page is active.
-
bool gui_app_is_page_present(char *id)
check whether the subpage is present in cur app
- Parameters:
id – [in] Identification of subpage
- Return values:
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.
- Parameters:
pg_id – [in] Subpage id (should be unique in app )
- Return values:
RT_EOK – if successful, otherwise return error number < 0.
-
void gui_app_refr_page(const char *pg_id)
Refresh subgpage(pause then resume)
- Parameters:
pg_id – [in] Subpage id (should be unique in app )
- Return values:
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.
- Parameters:
pg_id – [in] Subpage id (should be unique in app )
- Return values:
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.
- Return values:
RT_EOK – if successful, otherwise return error number < 0.
-
int gui_app_manual_goback_anim(void)
Goback current page manual.
- Return values:
RT_EOK – if successful, otherwise return error number < 0.
-
void gui_app_cleanup(void)
Close all app.
- Return values:
void –
-
void gui_app_cleanup_bg_apps(void)
Close all background app.
- Return values:
void –
-
void gui_app_cleanup_now(void)
Close all app synchronously, must been call while all gui app task is NOT running.
- Return values:
void –
-
void gui_app_run_now(const char *cmd)
Run app immediately, no animation.
- Parameters:
cmd – [in] application command - format:[app_id] [param0] [param1] [param2] …
- Return values:
void –
-
bool gui_app_is_all_closed(void)
Check whether all app has been closed.
- Return values:
true – all app is closed, false: not closed yet
-
intent_t gui_app_get_intent(void)
Get current actived app’s intent.
- Returns:
Current active app’s intent
-
void *gui_app_get_page_userdata(const char *pg_id)
Get subpage’s user data.
- Parameters:
pg_id – - Subpage id (should be unique in app )
- Returns:
NULL if not found pg_id
-
int gui_app_set_page_userdata(const char *pg_id, void *usr_data)
Set subpage’s user data.
- Parameters:
pg_id – - Subpage id (should be unique in app )
usr_data – - user data
- Returns:
RT_EOK if successful, otherwise return error number < 0.
-
void *gui_app_this_page_userdata(void)
Get current subpage’s user data.
- Returns:
NULL if no data
-
void *gui_app_this_page_memory(void)
Get current subpage’s customize memory pointer.
- Returns:
NULL if no data
-
uint32_t gui_app_get_running_apps(void)
Get all runing apps numbers
.
See also
- Returns:
The number of running apps
-
lv_obj_t *gui_app_get_clock_parent()
Get current clock parent
.
See also
- Returns:
clock parent object
-
void gui_app_exec_now(void)
Execute gui app schedule immediately util finish all job.
.
See also
- Returns:
none
-
int gui_app_fwk_suspend(void)
suspend gui_app framework asynchronized, append ‘gui_app_exec_now’ after if you want suspend synchronized.
- Returns:
RT_EOK if successful, otherwise return error number < 0.
-
int gui_app_fwk_resume(void)
resume gui_app framework asynchronized
- Returns:
RT_EOK if successful, otherwise return error number < 0.
-
int gui_app_is_active(const char *app)
app is active
- Returns:
1 if active, otherwise return 0.