284 lines
8.7 KiB
C
284 lines
8.7 KiB
C
|
|
/*
|
||
|
|
* Copyright (c) Quaming Intelligent Technology Co., Ltd.
|
||
|
|
* (C) Copyright All Rights Reserved.
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
/**
|
||
|
|
* @file launcher.c
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
|
||
|
|
/*********************
|
||
|
|
* INCLUDES
|
||
|
|
*********************/
|
||
|
|
#include "lvgl/lvgl.h"
|
||
|
|
#include "xos_app_conf.h"
|
||
|
|
|
||
|
|
#ifdef CONFIG_XOS_USE_APP_LAUNCHER
|
||
|
|
|
||
|
|
#include <stdio.h>
|
||
|
|
#include "launcher.h"
|
||
|
|
#include "lang/xos_strid.h"
|
||
|
|
#include "xos_misc.h"
|
||
|
|
#ifdef CONFIG_XOS_FWK_APPMANAGER
|
||
|
|
#include "appcommon.h"
|
||
|
|
#include "appmanager.h"
|
||
|
|
#endif
|
||
|
|
#include "qua_font.h"
|
||
|
|
#include "home.h"
|
||
|
|
#include "home_setting.h"
|
||
|
|
#include "view/home_statusbar.h"
|
||
|
|
#include "config/launcher_conf.h"
|
||
|
|
|
||
|
|
#if CONFIG_XOS_USE_APP_SCREEN_PROTECT
|
||
|
|
#include "lcd_service.h"
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifdef CONFIG_XOS_USE_APP_STUDYPILOT
|
||
|
|
#include "../studypilot/inc/studypilot.h"
|
||
|
|
#endif
|
||
|
|
/**********************
|
||
|
|
* GLOBAL DECLARATION
|
||
|
|
**********************/
|
||
|
|
extern int more_sys_para_init(void);
|
||
|
|
|
||
|
|
/*********************
|
||
|
|
* DEFINES
|
||
|
|
*********************/
|
||
|
|
|
||
|
|
/**********************
|
||
|
|
* TYPEDEFS
|
||
|
|
**********************/
|
||
|
|
|
||
|
|
/**********************
|
||
|
|
* STATIC PROTOTYPES
|
||
|
|
**********************/
|
||
|
|
|
||
|
|
/**********************
|
||
|
|
* STATIC VARIABLES
|
||
|
|
**********************/
|
||
|
|
|
||
|
|
/**********************
|
||
|
|
* MACROS
|
||
|
|
**********************/
|
||
|
|
|
||
|
|
/**********************
|
||
|
|
* STATIC FUNCTIONS
|
||
|
|
**********************/
|
||
|
|
#ifdef CONFIG_XOS_FWK_APPMANAGER
|
||
|
|
static app_data_ptr launcher_ui_init(void *start_data);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
static int s_launcher_init_flag = 0;
|
||
|
|
void launcher_entry(lv_obj_t *active_screen) {
|
||
|
|
#if defined(BUILD_SIMULATOR) && BUILD_SIMULATOR
|
||
|
|
lv_obj_set_style_bg_color(active_screen, lv_color_hex(0x00ffff), 0);
|
||
|
|
#else
|
||
|
|
lv_obj_set_style_bg_opa(active_screen, LV_OPA_TRANSP, 0);
|
||
|
|
#endif
|
||
|
|
//init font
|
||
|
|
#ifdef CONFIG_XOS_FWK_FONT
|
||
|
|
qua_los_ft_font_init();
|
||
|
|
#endif
|
||
|
|
//read language id
|
||
|
|
init_home_setting();
|
||
|
|
|
||
|
|
#if (defined(CONFIG_PRODUCT_KIDCAMERA) || defined(CONFIG_PRODUCT_CAMERA) || defined(CONFIG_PRODUCT_DEMO_LV)) && defined(CONFIG_XOS_APP_GRID_STYLE)
|
||
|
|
more_sys_para_init();
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#if !defined(CONFIG_PRODUCT_SMARTDOOR) && !defined(CONFIG_XOS_USE_APP_SMARTHOME_NEW)
|
||
|
|
launcher_body_init(active_screen);
|
||
|
|
#else
|
||
|
|
|
||
|
|
#ifdef CONFIG_XOS_USE_APP_SMARTHOME_NEW
|
||
|
|
extern void init_homesamrt_page(void);
|
||
|
|
init_homesamrt_page();
|
||
|
|
|
||
|
|
#elif defined(CONFIG_PRODUCT_SMARTDOOR)
|
||
|
|
extern void start_smartdoor_function(void);
|
||
|
|
start_smartdoor_function();
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif
|
||
|
|
}
|
||
|
|
static int simulator_one = 1;
|
||
|
|
static void xos_open_first_app(void) {
|
||
|
|
#ifdef CONFIG_XOS_USE_APP_AICAMERA
|
||
|
|
#ifndef CONFIG_XOS_USE_APP_STUDYPILOT
|
||
|
|
#ifdef CONFIG_XOS_USE_APP_PHOTO
|
||
|
|
app_manager_start("photo_camera", NULL);
|
||
|
|
#endif
|
||
|
|
#else
|
||
|
|
//studypilot_init();
|
||
|
|
if (param_get_int("system:navigation", 0)) {
|
||
|
|
app_manager_start("studypilot", NULL);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
#endif //not CONFIG_XOS_USE_APP_STUDYPILOT
|
||
|
|
|
||
|
|
#if defined(CONFIG_PRODUCT_IPC) || defined(CONFIG_PRODUCT_MOMOTALK)
|
||
|
|
#ifdef CONFIG_XOS_FWK_CADP_AGORA
|
||
|
|
#ifndef CONFIG_XOS_USE_APP_MOMO_TALK
|
||
|
|
|
||
|
|
mqtt_register(); // 注册mqtt回调函数 声网支持
|
||
|
|
#if !defined(BUILD_SIMULATOR) || BUILD_SIMULATOR == 0
|
||
|
|
char *app_name = NULL;
|
||
|
|
app_name = param_get_string("system:launch_app", NULL);
|
||
|
|
LV_LOG_USER("11111111111111app_name %s", app_name);
|
||
|
|
if (app_name != NULL && strlen(app_name) > 0) {
|
||
|
|
app_manager_start(app_name, NULL);
|
||
|
|
}
|
||
|
|
else
|
||
|
|
{
|
||
|
|
qua_camera_init("1", NULL);
|
||
|
|
pre_videocall();
|
||
|
|
}
|
||
|
|
#else
|
||
|
|
if (simulator_one == 1){
|
||
|
|
app_manager_start("scanner", NULL);
|
||
|
|
simulator_one++;
|
||
|
|
}else{
|
||
|
|
pre_videocall();
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
#else //CONFIG_XOS_USE_APP_MOMO_TALK
|
||
|
|
#ifdef CONFIG_XOS_USE_APP_MOMO_TALK
|
||
|
|
app_manager_start("momotalk", NULL);
|
||
|
|
return;
|
||
|
|
#endif
|
||
|
|
char *app_name = param_get_string("system:launch_app", NULL);
|
||
|
|
if (app_name != NULL && strlen(app_name) > 0) {
|
||
|
|
app_manager_start(app_name, NULL);
|
||
|
|
}
|
||
|
|
#endif //not CONFIG_XOS_USE_APP_MOMO_TALK
|
||
|
|
#endif //CONFIG_XOS_FWK_CADP_AGORA
|
||
|
|
//
|
||
|
|
#endif //CONFIG_PRODUCT_IPC
|
||
|
|
|
||
|
|
#ifdef CONFIG_PRODUCT_PETROBOT
|
||
|
|
qua_camera_init("1", NULL);
|
||
|
|
app_manager_start("scanner", NULL);
|
||
|
|
#endif //CONFIG_PRODUCT_PETROBOT
|
||
|
|
#endif //CONFIG_XOS_USE_APP_AICAMERA
|
||
|
|
}
|
||
|
|
|
||
|
|
#ifdef CONFIG_XOS_FWK_APPMANAGER
|
||
|
|
static app_data_ptr launcher_ui_init(void *start_data) {
|
||
|
|
lv_obj_t *active_screen = lv_scr_act();
|
||
|
|
launcher_entry(active_screen);
|
||
|
|
|
||
|
|
#ifdef CONFIG_XOS_USE_APP_STATUS_BAR
|
||
|
|
#if CONFIG_PRODUCT_IPC
|
||
|
|
#define kSBarCnt 3
|
||
|
|
home_statusbar_t status_bar_objs[kSBarCnt] = {
|
||
|
|
{ .ctn.text = "晴", .is_icon = 0, .enable_datetime = false, .enable_battery = false },
|
||
|
|
{ .ctn.text = NULL, .is_icon = 0, .enable_datetime = true, .enable_battery = false },
|
||
|
|
{
|
||
|
|
#ifdef CONFIG_XOS_DARK_MODE
|
||
|
|
.ctn.icon = k_path_statusbar_wifi,
|
||
|
|
#else
|
||
|
|
.ctn.icon = k_path_statusbar_wifi_blk,
|
||
|
|
#endif
|
||
|
|
.is_icon = 1, .enable_datetime = false, .enable_battery = false,
|
||
|
|
}
|
||
|
|
};
|
||
|
|
int k_statusbar_height = 28;
|
||
|
|
#elif (defined(CONFIG_PRODUCT_KIDCAMERA) || defined(CONFIG_PRODUCT_MOMOTALK) || \
|
||
|
|
defined(CONFIG_PRODUCT_CAMERA) || defined(CONFIG_PRODUCT_DEMO_LV))
|
||
|
|
#define kSBarCnt 3
|
||
|
|
home_statusbar_t status_bar_objs[kSBarCnt] = {
|
||
|
|
#ifndef CONFIG_PRODUCT_MOMOTALK
|
||
|
|
{ .ctn.text = NULL, .is_icon = 0, .enable_datetime = true, .enable_battery = false },
|
||
|
|
#endif
|
||
|
|
{
|
||
|
|
.ctn.icon = k_path_statusbar_battery,
|
||
|
|
.is_icon = 0,
|
||
|
|
.enable_datetime = false,
|
||
|
|
.enable_battery = true,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
#ifdef CONFIG_XOS_DARK_MODE
|
||
|
|
.ctn.icon = k_path_statusbar_wifi_dis,
|
||
|
|
#else
|
||
|
|
.ctn.icon = k_path_statusbar_wifi_dis_blk,
|
||
|
|
#endif
|
||
|
|
.is_icon = 1, .icon_type = 0, .enable_datetime = false, .enable_battery = false,
|
||
|
|
},
|
||
|
|
{
|
||
|
|
.ctn.icon = k_path_statusbar_cat1_off,
|
||
|
|
.is_icon = 1, .icon_type = 1, .enable_datetime = false, .enable_battery = false,
|
||
|
|
}
|
||
|
|
};
|
||
|
|
int k_statusbar_height = 24;
|
||
|
|
#elif (defined(CONFIG_PRODUCT_STUDYPILOT))
|
||
|
|
#define kSBarCnt 3
|
||
|
|
home_statusbar_t status_bar_objs[kSBarCnt] = {
|
||
|
|
{ .ctn.text = NULL, .is_icon = 0, .icon_type = 0, .enable_datetime = true, .enable_battery = false },
|
||
|
|
{ .ctn.icon = k_path_statusbar_battery, .is_icon = 0, .icon_type = 0, .enable_datetime = false, .enable_battery = true },
|
||
|
|
{ .ctn.icon = k_path_statusbar_wifi_dis, .is_icon = 1, .icon_type = 0, .enable_datetime = false, .enable_battery = false },
|
||
|
|
};
|
||
|
|
int k_statusbar_height = 40;
|
||
|
|
#elif CONFIG_PRODUCT_SMARTDOOR
|
||
|
|
#define kSBarCnt 2
|
||
|
|
home_statusbar_t status_bar_objs[kSBarCnt] = {
|
||
|
|
{ .ctn.text = NULL, .is_icon = 0, .enable_datetime = true, .enable_battery = false },
|
||
|
|
{
|
||
|
|
#ifdef CONFIG_XOS_DARK_MODE
|
||
|
|
.ctn.icon = k_path_statusbar_wifi,
|
||
|
|
#else
|
||
|
|
.ctn.icon = k_path_statusbar_wifi_blk,
|
||
|
|
#endif
|
||
|
|
.is_icon = 1, .enable_datetime = false, .enable_battery = false,
|
||
|
|
}
|
||
|
|
};
|
||
|
|
int k_statusbar_height = 24;
|
||
|
|
#else
|
||
|
|
#define kSBarCnt 1
|
||
|
|
home_statusbar_t status_bar_objs[kSBarCnt] = {
|
||
|
|
{ .ctn.text = NULL, .is_icon = 0, .enable_datetime = true, .enable_battery = false },
|
||
|
|
};
|
||
|
|
int k_statusbar_height = 24;
|
||
|
|
#endif
|
||
|
|
|
||
|
|
init_home_statusbar(active_screen, status_bar_objs, kSBarCnt, k_statusbar_height);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#ifdef CONFIG_XOS_USE_APP_STATUS_BAR
|
||
|
|
extern void start_monitor_home_statusbar_wifi();
|
||
|
|
start_monitor_home_statusbar_wifi();
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#if CONFIG_XOS_USE_APP_SCREEN_PROTECT
|
||
|
|
// LV_LOG_USER("inited screen time: %d", lcd_service_get_cust_timeout());
|
||
|
|
lcd_service_init(lcd_service_get_cust_timeout(), 0);
|
||
|
|
lcd_service_set_always_light();
|
||
|
|
lcd_service_reset();
|
||
|
|
#endif
|
||
|
|
#if !defined(CONFIG_PRODUCT_DEMO_LD) && !defined(CONFIG_PRODUCT_DEMO_LH)
|
||
|
|
xos_open_first_app();
|
||
|
|
#endif
|
||
|
|
s_launcher_init_flag = 1;
|
||
|
|
|
||
|
|
return NULL;
|
||
|
|
}
|
||
|
|
|
||
|
|
void launcher_init(void) {
|
||
|
|
qua_app_ops *ops = malloc(sizeof(qua_app_ops));
|
||
|
|
if (ops) {
|
||
|
|
memset(ops, 0x0, sizeof(qua_app_ops));
|
||
|
|
ops->on_create = launcher_ui_init;
|
||
|
|
ops->on_sleep = xos_home_sleep;
|
||
|
|
ops->on_wakeup = xos_home_wakeup;
|
||
|
|
app_manager_register("launcher", ops);
|
||
|
|
free(ops);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
bool launcher_is_inited(void) {
|
||
|
|
return s_launcher_init_flag? true : false;
|
||
|
|
}
|
||
|
|
|
||
|
|
#endif/* CONFIG_XOS_USE_APP_LAUNCHER*/
|