From: SnickerSun Date: Tue, 28 May 2024 07:11:12 +0000 (+0800) Subject: 更新SDK到 patch_602_base_to_0521 ,只验证了nativeapp,fd230app 还未升级验证 X-Git-Tag: release_V1.2.70_20241020_135402~1104 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=8d726942bb19cd1b5684f5ad0fad88961d5f5d7c;p=mirrors%2FFD230.git 更新SDK到 patch_602_base_to_0521 ,只验证了nativeapp,fd230app 还未升级验证 --- diff --git a/SDK_1.1.10.522.txt b/SDK_1.1.10.522.txt deleted file mode 100644 index 8b589cb01..000000000 --- a/SDK_1.1.10.522.txt +++ /dev/null @@ -1,2 +0,0 @@ -SDK version: -1.1.10.522 \ No newline at end of file diff --git a/SDK_1.1.10.602.txt b/SDK_1.1.10.602.txt new file mode 100644 index 000000000..a28a1c30b --- /dev/null +++ b/SDK_1.1.10.602.txt @@ -0,0 +1,3 @@ +SDK version:1.1.10.602 + + diff --git a/code/sdk/application/audio/vendor/CMakeLists.txt b/code/sdk/application/audio/vendor/CMakeLists.txt index c21954786..f95767922 100755 --- a/code/sdk/application/audio/vendor/CMakeLists.txt +++ b/code/sdk/application/audio/vendor/CMakeLists.txt @@ -69,3 +69,4 @@ set(COMPONENT_DEF ) #=================================================================================== include(${SAP_TOP_DIR}/build/cmake/audio_common.cmake) +install_sdk(${CMAKE_CURRENT_SOURCE_DIR}/aw88166 "*") diff --git a/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/16bit/aw883xx_acf.bin b/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/16bit/aw883xx_acf.bin new file mode 100644 index 000000000..64b893a34 --- /dev/null +++ b/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/16bit/aw883xx_acf.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:06e21c25050a4d3a2ec8fefaca895819c29069419d6cbaaeec80be65ed44449c +size 12960 diff --git a/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/32bit/aw883xx_acf.bin b/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/32bit/aw883xx_acf.bin new file mode 100644 index 000000000..c35c186a2 --- /dev/null +++ b/code/sdk/application/audio/vendor/aw88166/config/aw88166/mono/32bit/aw883xx_acf.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8c1322983afa5fa8e0eaea9b81440dd699e9ed3f9692669b4020e4b9a12e1f5e +size 12960 diff --git a/code/sdk/application/audio/vendor/aw88166/config/aw88166/stereo/16bit/aw883xx_acf.bin b/code/sdk/application/audio/vendor/aw88166/config/aw88166/stereo/16bit/aw883xx_acf.bin new file mode 100644 index 000000000..02fa3df5f --- /dev/null +++ b/code/sdk/application/audio/vendor/aw88166/config/aw88166/stereo/16bit/aw883xx_acf.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8295817c2a752a835a6310d6e6b9da9987985e40bc8a147f6f3acc2de005594e +size 25840 diff --git a/code/sdk/application/audio/vendor/aw88166/config/aw88166/stereo/32bit/aw883xx_acf.bin b/code/sdk/application/audio/vendor/aw88166/config/aw88166/stereo/32bit/aw883xx_acf.bin new file mode 100644 index 000000000..4d6ea4804 --- /dev/null +++ b/code/sdk/application/audio/vendor/aw88166/config/aw88166/stereo/32bit/aw883xx_acf.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:14090a51dd7eea5862b101ee8d01cfe6dcbf88d32b436b2e094de47a769aafe5 +size 25840 diff --git a/code/sdk/application/brandy/brandy_recovery/main.c b/code/sdk/application/brandy/brandy_recovery/main.c index c9a2b2b6a..3f761f3c5 100755 --- a/code/sdk/application/brandy/brandy_recovery/main.c +++ b/code/sdk/application/brandy/brandy_recovery/main.c @@ -279,7 +279,6 @@ static void chip_init(void) cpu_trace_enable_mcpu_repeat(); - otp_init(); uapi_pm_control(PM_SDIO_POWER_UP_AND_RUN); } diff --git a/code/sdk/application/brandy/brandy_standard/chip_init.c b/code/sdk/application/brandy/brandy_standard/chip_init.c index 8de3e7b16..bf42362a5 100755 --- a/code/sdk/application/brandy/brandy_standard/chip_init.c +++ b/code/sdk/application/brandy/brandy_standard/chip_init.c @@ -12,7 +12,6 @@ #include "rtc.h" #include "gpio.h" #include "ipc.h" -#include "otp.h" #include "cpu_trace.h" #include "uart_porting.h" #include "log_memory_region.h" @@ -182,7 +181,6 @@ void chip_init(void) log_memory_region_init(); - otp_init(); #if ENABLE_LOW_POWER == YES copy_from_flash_to_pm_text(); #endif diff --git a/code/sdk/application/brandy/brandy_standard/input_app.c b/code/sdk/application/brandy/brandy_standard/input_app.c index 49db40e54..5fbbcdc28 100755 --- a/code/sdk/application/brandy/brandy_standard/input_app.c +++ b/code/sdk/application/brandy/brandy_standard/input_app.c @@ -166,29 +166,23 @@ uint32_t button_close(void) return ERRCODE_SUCC; } -void button_report_event_to_gui(int state) +void button_report_event_to_gui(button_id_t id, uint16_t state) { input_dev_data_t data; if (g_button_event_cb != NULL) { data.type = INDEV_TYPE_KEY; - data.keyId = INDEV_KEY_POWER; - data.state = state; // 1:press 0:release + if (id == BUTTON_PWR) { + data.keyId = INDEV_KEY_POWER; + } else { + data.keyId = INDEV_KEY_FUNC; + } + data.state = state; // 2:longpress 1:press 0:release g_button_event_cb(&data); } } -void button_report_funckey_event_to_gui(int state) -{ - input_dev_data_t data; - if (g_button_event_cb != NULL) { - data.type = INDEV_TYPE_KEY; - data.keyId = INDEV_KEY_FUNC; - data.state = state; // 1:press 0:release - g_button_event_cb(&data); - } -} -static void button_report_event(event_button_t event) +void button_report_event(button_id_t id, event_button_t event) { input_dev_data_t data; @@ -201,18 +195,19 @@ static void button_report_event(event_button_t event) } button_report_event_to_pms(); #endif - button_report_event_to_gui(1); + button_report_event_to_gui(id, 1); // 1:press break; case BUTTON_PWR_CLICKUP: - button_report_event_to_gui(0); + button_report_event_to_gui(id, 0); // 0:release + break; + case BUTTON_PWR_LONGPRESS_3S: + button_report_event_to_gui(id, 2); // 2:longpress break; - case BUTTON1_PRESS: - button_report_funckey_event_to_gui(1); + button_report_event_to_gui(id, 1); // 1:press break; case BUTTON1_CLICKUP: - button_report_funckey_event_to_gui(0); - + button_report_event_to_gui(id, 0); // 0:release default: break; } @@ -300,7 +295,7 @@ static void button_send_event_to_ui(button_id_t id, button_report_state_t state) event_button_t event = BUTTON_BUTT; event = button_event_get(id, state); #if defined(ENABLE_UIKIT) || defined(ENABLE_LVGL) - button_report_event(event); + button_report_event(id, event); #endif if (g_button_common_event_cb[event] != NULL) { g_button_common_event_cb[event](); diff --git a/code/sdk/application/brandy/brandy_standard/thread_init.c b/code/sdk/application/brandy/brandy_standard/thread_init.c index 5aecd9e12..d3868bd55 100755 --- a/code/sdk/application/brandy/brandy_standard/thread_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_init.c @@ -22,12 +22,8 @@ #include "pm_sleep.h" #include "pm_lpc.h" #include "pm_control.h" -#include "upg.h" -#include "upg_definitions.h" -#include "nv.h" #include "dfx_system_init.h" #include "cpu_load.h" -#include "nv_upg.h" #ifdef SUPPORT_AT_CMD #include "at_cmd_api.h" @@ -73,13 +69,11 @@ #ifdef SUPPORT_MEDIA_AUDIO_MANAGER #include "audio_manager_c_wrapper.h" #endif - -#ifdef CONFIG_OTA_UPDATE_SUPPORT -#include "graphic_service_wrapper.h" -#endif #include "clocks_config.h" #include "sys/time.h" #include "time.h" +#include "log_panic.h" +#include "nandflash_config.h" #define EMMC_BASE_ADDR 0x52062000 @@ -92,6 +86,7 @@ #define TASK_PRIORITY_SDK (osPriority_t)(31) #define TASK_PRIORITY_DFX_MSG (osPriority_t)(18) #define TASK_PRIORITY_TRANSMIT (osPriority_t)(20) +#define TASK_PRIORITY_SAVE_FILE (osPriority_t)(36) #define BTH_SDK_STACK_SIZE 0xC00 #define AT_GRAPHIC_STACK_SIZE 0xC00 @@ -103,10 +98,7 @@ #define PM_DISPLAY_MSG_STACK_SIZE 0xc00 #define AT_OHOSFWK_STACK_SIZE 0xC00 #define APP_MAIN_STACK_SIZE 0xC00 - -#define UPG_HEAD_MAGIC 0x55AA55AA -#define UPG_END_MAGIC 0xAA55AA55 -#define UPG_FLAG_MAGIC 0xFFFFFFFF +#define SAVE_FILE_STACK_SIZE 0xC00 #define TIME_MAX 64 #define USEC_TO_MILLI 1000 @@ -124,6 +116,8 @@ void system_time_cali(void); #ifdef SUPPORT_32K_MEAS void uapi_32k_systick_measurements(void); #endif +osSemaphoreId_t g_semaphore_save = NULL; +void save_file_main(void); static uint32_t g_app_delay_ms = TASK_COMMON_APP_DELAY_MS; app_task_definition_t g_app_tasks[] = { @@ -180,8 +174,41 @@ app_task_definition_t g_app_tasks[] = { (osThreadFunc_t)power_display_msg_thread, NULL, (CreateQueueFunction_t)power_display_task_init, USE_DTCM_MEM }, #endif + { { "save_file", 0, NULL, 0, NULL, SAVE_FILE_STACK_SIZE, TASK_PRIORITY_SAVE_FILE, 0, 0 }, + (osThreadFunc_t)save_file_main, NULL, NULL, USE_EXTEND_MEM }, }; +osSemaphoreId_t get_save_file_semaphore(void) +{ + return g_semaphore_save; +} + +void save_file_main(void) +{ + g_semaphore_save = osSemaphoreNew(1, 0, NULL); + if (!g_semaphore_save) { + panic(PANIC_LOG, LOG_PANIC_MUTEX_NOT_READY); + return; + } + for (;;) { + // If there has been log indicator get run again + if (osKernelGetState() == osKernelRunning) { + if (osSemaphoreAcquire(g_semaphore_save, osWaitForever) != osOK) { + panic(PANIC_LOG, LOG_PANIC_MUTEX_NOT_READY); + } + nand_driver_init(SPEED_SLOW); + set_trans_type(TRANS_BY_CPU_SINGLE_LINE); +#if defined SAVE_EXC_INFO + save_preserve_file_to_nand(); + save_btram_file_to_nand(); + save_btrace_file_to_nand(); +#endif + hal_reboot_chip(); + } + osDelay(1000); + } +} + void set_app_delay_time(uint32_t time) { g_app_delay_ms = time; @@ -246,51 +273,6 @@ static void print_system_sleep_info(void) #endif } -#ifdef CONFIG_OTA_UPDATE_SUPPORT - -bool upg_check_upgrade_need_upgrade(void) -{ - - uint32_t fota_address = 0; - errcode_t ret_val = (errcode_t)upg_get_upgrade_flag_flash_start_addr(&fota_address); - if (ret_val != ERRCODE_SUCC) { - return false; - } - - fota_upgrade_flag_area_t upg_flag_info; - ret_val = (errcode_t)upg_flash_read(fota_address, sizeof(fota_upgrade_flag_area_t), (uint8_t *)(&upg_flag_info)); - if (ret_val != ERRCODE_SUCC) { - return false; - } - - if (!(upg_flag_info.head_magic == UPG_HEAD_MAGIC && - upg_flag_info.head_end_magic == UPG_END_MAGIC && - upg_flag_info.complete_flag == UPG_FLAG_MAGIC)) { - /* 不需要升级直接返回 */ - PRINT("No need to upgrade...\r\n"); - return false; - } - return true; -} -static void upg_check_upgrade(void) -{ - - errcode_t ret_val ; - if (upg_check_upgrade_need_upgrade() == false) - { - return ; - } - PRINT("upgrading.......\r\n"); - ret_val = uapi_upg_start(); - if (ret_val != ERRCODE_SUCC) { - PRINT("upgrade failed, ret = 0x%x\r\n", ret_val); - } else { - PRINT("upgrade success\r\n"); - } - upg_reboot(); -} -#endif - #ifdef SUPPORT_32K_MEAS /* 使用32M tcxo 测量 systick的32K频率值 */ void uapi_32k_systick_measurements(void) @@ -327,12 +309,7 @@ void system_time_cali(void) static void app_main(const void *unused) { unused(unused); -#ifdef CONFIG_OTA_UPDATE_SUPPORT - upg_check_upgrade(); -#endif dfx_set_log_enable(); - /* nv init and file system init must be before nv_upg_upgrade_task_process */ - (void)nv_upg_upgrade_task_process(); #ifdef SUPPORT_MEDIA_AUDIO_MANAGER bool success = AudioManagerInit(); PRINT("audio manager init %s\r\n", success ? "ok" : "error"); diff --git a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c index 7826e0872..ea69e476a 100755 --- a/code/sdk/application/brandy/brandy_standard/thread_pri_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_pri_init.c @@ -61,6 +61,12 @@ #ifdef SUPPORT_AT_OHOSFWK #include "ohosfwk_startup.h" #endif + +#ifdef CONFIG_OTA_UPDATE_SUPPORT +#include "graphic_service_wrapper.h" +#include "upg_definitions.h" +#endif + #ifdef SUPPORT_AT_VIBRATOR #include "vibrator_service.h" #endif @@ -99,6 +105,9 @@ #define TASK_PRIORITY_APP (osPriority_t)(17) #define TICK_TEN_MS (10U) #define WAIT_BT_BOOTUP_TIME 200U +#define UPG_HEAD_MAGIC 0x55AA55AA +#define UPG_END_MAGIC 0xAA55AA55 +#define UPG_FLAG_MAGIC 0xFFFFFFFF static void thread_main(const void *unused); void bt_acore_btc_ipc_receive_init(void); @@ -286,6 +295,51 @@ static void force_to_sleep(void) } } +#ifdef CONFIG_OTA_UPDATE_SUPPORT + + +bool upg_check_upgrade_need_upgrade(void) +{ + uint32_t fota_address = 0; + errcode_t ret_val = (errcode_t)upg_get_upgrade_flag_flash_start_addr(&fota_address); + if (ret_val != ERRCODE_SUCC) { + return false; + } + + fota_upgrade_flag_area_t upg_flag_info; + ret_val = (errcode_t)upg_flash_read(fota_address, sizeof(fota_upgrade_flag_area_t), (uint8_t *)(&upg_flag_info)); + if (ret_val != ERRCODE_SUCC) { + return false; + } + + if (!(upg_flag_info.head_magic == UPG_HEAD_MAGIC && + upg_flag_info.head_end_magic == UPG_END_MAGIC && + upg_flag_info.complete_flag == UPG_FLAG_MAGIC)) { + /* 不需要升级直接返回 */ + PRINT("No need to upgrade...\r\n"); + return false; + } + return true; +} +static void upg_check_upgrade(void) +{ + errcode_t ret_val ; + if (upg_check_upgrade_need_upgrade() == false) + { + return ; + } + + PRINT("upgrading.......\r\n"); + ret_val = uapi_upg_start(); + if (ret_val != ERRCODE_SUCC) { + PRINT("upgrade failed, ret = 0x%x\r\n", ret_val); + } else { + PRINT("upgrade success\r\n"); + } + upg_reboot(); +} +#endif + static void thread_main(const void *unused) { PRINT("thread_main start "NEWLINE); @@ -337,6 +391,11 @@ static void thread_main(const void *unused) init_btaddr_btname(); board_version_class_print(); uapi_watchdog_kick(); +#ifdef CONFIG_OTA_UPDATE_SUPPORT + upg_check_upgrade(); +#endif + /* nv init and file system init must be before nv_upg_upgrade_task_process */ + (void)nv_upg_upgrade_task_process(); thread_init(); button_app_init(); uapi_calendar_init(); diff --git a/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.cpp b/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.cpp index 0c0d6f8b3..0f5ea0439 100644 --- a/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.cpp +++ b/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.cpp @@ -9,6 +9,11 @@ #include namespace OHOS { + + // 定义按键颜色宏 +#define DEFAULT_BACKGROUND_COLOR 0xff191919 +#define PRESSED_BACKGROUND_COLOR 0xff249115 +#define PRESSED_BORDER_COLOR 0xff0b1928 /*** * @description: 初始化标签 * @param {UILabel} * @@ -52,7 +57,7 @@ namespace OHOS // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabelExt is succeed"); return true; } - +#ifdef FD230 /*** * @description: * @param {UILabelExt} * @@ -97,38 +102,8 @@ namespace OHOS // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabelExt is succeed"); return true; } - /*** - * @description: - * @param {UIButton} * - * @param {int} left - * @param {int} top - * @param {int} width - * @param {int} height - * @param {char} *viewId - * @return - * @brief 初始化按钮 - */ - bool InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId) - { - // 创建新按钮(如果当前按钮为空) - if (button == nullptr) - { - button = new UIButton(); - } - if (button == nullptr) - { - return false; // 内存分配失败,返回false - } - button->SetPosition(left, top); - button->Resize(width, height); - button->SetViewId(viewId); - button->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BACKGROUND_COLOR); - button->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BACKGROUND_COLOR, UIButton::PRESSED); - button->SetStyleForState(STYLE_BORDER_COLOR, PRESSED_BORDER_COLOR, UIButton::PRESSED); - button->SetVisible(true); - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButton is succeed"); - return true; - } + + /*** * @description: * @param {UILabelButtonExt} * @@ -168,43 +143,7 @@ namespace OHOS // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButton is succeed"); return true; } - /*** - * @description: - * @param {UIImageView} * - * @param {int} left - * @param {int} top - * @param {int} width - * @param {int} height - * @param {char} *viewId - * @param {char} *imagePath - * @return {*} - * @brief 初始化图片 - */ - bool InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath) - { - if (imageView == nullptr) - { - imageView = new UIImageView(); - } - if (imageView == nullptr) - { - return false; // 内存分配失败,返回false - } - imageView->SetPosition(left, top); - imageView->SetAutoEnable(true); - // imageView->Resize(width, height); - imageView->SetViewId(viewId); - imageView->SetSrc(imagePath); - // imageView->SetVisible(true); - // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitImageView is succeed"); - return true; - } - /*带默认参数的初始化label*/ - void InitLabelDefault(UILabelExt *&label, int x, int y, int width, int height, const char *viewId, const char *text, int fontSize, const char *fontName) - { - InitLabel(label, x, y, width, height, viewId, text, fontName, fontSize); - } - /* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ /*替换字符串中的变量*/ std::string UpdateLabelText(UILabelExt *&label, const std::string &newText, UIResourceTextId id) { @@ -282,6 +221,77 @@ namespace OHOS delete labelext; } +#endif + /*** + * @description: + * @param {UIButton} * + * @param {int} left + * @param {int} top + * @param {int} width + * @param {int} height + * @param {char} *viewId + * @return + * @brief 初始化按钮 + */ + bool InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId) + { + // 创建新按钮(如果当前按钮为空) + if (button == nullptr) + { + button = new UIButton(); + } + if (button == nullptr) + { + return false; // 内存分配失败,返回false + } + button->SetPosition(left, top); + button->Resize(width, height); + button->SetViewId(viewId); + button->SetStyle(STYLE_BACKGROUND_COLOR, DEFAULT_BACKGROUND_COLOR); + button->SetStyleForState(STYLE_BACKGROUND_COLOR, DEFAULT_BACKGROUND_COLOR, UIButton::PRESSED); + button->SetStyleForState(STYLE_BORDER_COLOR, PRESSED_BORDER_COLOR, UIButton::PRESSED); + button->SetVisible(true); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitButton is succeed"); + return true; + } + + /*** + * @description: + * @param {UIImageView} * + * @param {int} left + * @param {int} top + * @param {int} width + * @param {int} height + * @param {char} *viewId + * @param {char} *imagePath + * @return {*} + * @brief 初始化图片 + */ + bool InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath) + { + if (imageView == nullptr) + { + imageView = new UIImageView(); + } + if (imageView == nullptr) + { + return false; // 内存分配失败,返回false + } + imageView->SetPosition(left, top); + imageView->SetAutoEnable(true); + // imageView->Resize(width, height); + imageView->SetViewId(viewId); + imageView->SetSrc(imagePath); + // imageView->SetVisible(true); + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitImageView is succeed"); + return true; + } + /*带默认参数的初始化label*/ + void InitLabelDefault(UILabelExt *&label, int x, int y, int width, int height, const char *viewId, const char *text, int fontSize, const char *fontName) + { + InitLabel(label, x, y, width, height, viewId, text, fontName, fontSize); + } + /* -------------------------------------------------------------------------- */ /** * 创建包含图片文件路径的数组 diff --git a/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.h b/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.h index 4602c3635..869e038ce 100644 --- a/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.h +++ b/code/sdk/application/wearable/CustomUIComponentTool/uicomponents/UIComponents.h @@ -25,20 +25,20 @@ #include "wearable_log.h" #include "ohos_types.h" #include "components/ui_card_page.h" +#ifdef FD230 #include "traing/include/TraingModel.h" #include "language/font/ui_resource_string.h" +#endif #include "common/image_cache_manager.h" namespace OHOS { /*初始化label[可使用text]*/ bool InitLabel(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, const char *text, const char *fontName, int fontSize); - /*初始化labelExt*/ - bool InitLabelExt(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, UIResourceTextId id, const char *fontName, int fontSize); + /*初始化button*/ bool InitButton(UIButton *&button, int left, int top, int width, int height, const char *viewId); /*初始化buttonExt*/ - bool InitButtonExt(UILabelButtonExt *&button, int left, int top, int width, int height, const char *viewId, UIResourceTextId id, int fontSize); /*初始化image*/ bool InitImageView(UIImageView *&imageView, int left, int top, int width, int height, const char *viewId, const char *imagePath); /*生成动画资源数组*/ @@ -47,7 +47,10 @@ namespace OHOS void InitImageAnimatorSource(UIImageAnimatorView *&imageAnimator, const char **imagePaths, int numFrames, int left, int top, int width, int height, const char *viewId, int time); /*InitLabel[默认参数]*/ void InitLabelDefault(UILabelExt *&label, int x, int y, int width, int height, const char *viewId, const char *text, int fontSize = 30, const char *fontName = DEFAULT_VECTOR_FONT_FILENAME); - +#ifdef FD230 + /*初始化labelExt*/ + bool InitLabelExt(UILabelExt *&label, int left, int top, int width, int height, const char *viewId, UIResourceTextId id, const char *fontName, int fontSize); + bool InitButtonExt(UILabelButtonExt *&button, int left, int top, int width, int height, const char *viewId, UIResourceTextId id, int fontSize); /*通用替换*/ std::string UpdateLabelText(UILabelExt *&label, const std::string &newText, UIResourceTextId id); /*更新label的数字*/ @@ -56,6 +59,7 @@ namespace OHOS std::string UpdateLabel(UILabelExt *&label, const std::string &updatestr, UIResourceTextId id); /*通过labelext获取Id设置label*/ void SetLabelId(UILabel *&label, UIResourceTextId id); +#endif /*解析动画资源数组 imageche*/ std::vector AnalysisArray(const char *filename, uint32_t startId, uint32_t lastId); } diff --git a/code/sdk/application/wearable/alipay/service/CMakeLists.txt b/code/sdk/application/wearable/alipay/service/CMakeLists.txt index 7bf23a649..f6a8a07d3 100755 --- a/code/sdk/application/wearable/alipay/service/CMakeLists.txt +++ b/code/sdk/application/wearable/alipay/service/CMakeLists.txt @@ -1,4 +1,6 @@ set(COMPONENT_NAME "alipay_service") +set(MODULE_NAME "app") +set(AUTO_DEF_FILE_ID TRUE) set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR} diff --git a/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c b/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c index 4656be53a..0d0072a87 100644 --- a/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c +++ b/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c @@ -14,7 +14,9 @@ #include "osal_task.h" #include "alipay_feature.h" #include "securec.h" - +#ifdef JS_ENABLE +#include "msg_center_msg.h" +#endif #include "wearable_log.h" #ifdef SUPPORT_ALIPAY_SEC #include "bleService.h" @@ -182,11 +184,18 @@ static void svr_alipay_ble_connstate_change_cb(unsigned short conn_id, bd_addr_t conn_state, pair_state); g_alipay_conn_id = conn_id; if (GAP_BLE_STATE_DISCONNECTED == conn_state) { // restart ble adv when disconnected + #ifdef JS_ENABLE + /* 通知msg_center,ble状态仍用bt状态,此处不区分 */ + SendMsgToMsgCenterService(BT_DISCONNECTED_TO_MSGCENTER, 0, NULL, 0); + #endif // svr_alipay_ble_adv_start(); // svr_alipay_reset_init(); gap_ble_start_adv(ALIPAY_BLE_ADV_ID); } else { svr_alipay_set_adv_start_state(false); + #ifdef JS_ENABLE + SendMsgToMsgCenterService(BT_CONNECTED_TO_MSGCENTER, 0, NULL, 0); + #endif } } diff --git a/code/sdk/application/wearable/alipay/service/alipay_feature.h b/code/sdk/application/wearable/alipay/service/alipay_feature.h index e933c02ac..a2f014740 100755 --- a/code/sdk/application/wearable/alipay/service/alipay_feature.h +++ b/code/sdk/application/wearable/alipay/service/alipay_feature.h @@ -18,16 +18,26 @@ extern "C" { #include #include "stdbool.h" #include "errcode.h" +#if !defined(SW_UART_DEBUG) && !defined(SW_RTT_DEBUG) +#include "soc_diag_util.h" +#include "log_oam_logger.h" +#include "log_def.h" +#else #include "debug_print.h" +#endif #define APP_SUCCESS 0 #define APP_FAILURE (-1) -#ifdef ALIPAY_HSO_DEBUG_LOG -#define ALIPAY_PRINT_ERR(log_num, fmt, args...) uapi_diag_error_log(0, fmt, ##arg) -#define ALIPAY_PRINT_WARN(log_num, fmt, args...) uapi_diag_warning_log(0, fmt, ##arg) -#define ALIPAY_PRINT_INFO(log_num, fmt, args...) uapi_diag_info_log(0, fmt, ##arg) -#define ALIPAY_PRINT_DEBUG(log_num, fmt, args...) +#if !defined(SW_UART_DEBUG) && !defined(SW_RTT_DEBUG) +#define ALIPAY_PRINT_ERR(log_num, fmt, arg...) uapi_diag_error_log(0, fmt, ##arg) +#define ALIPAY_PRINT_WARN(log_num, fmt, arg...) uapi_diag_warning_log(0, fmt, ##arg) +#define ALIPAY_PRINT_INFO(log_num, fmt, arg...) uapi_diag_info_log(0, fmt, ##arg) +#ifdef WEARABLE_LOG_DEBUG +#define ALIPAY_PRINT_DEBUG(log_num, fmt, arg...) uapi_diag_debug_log(0, fmt, ##arg) +#else +#define ALIPAY_PRINT_DEBUG(log_num, fmt, arg...) +#endif #else #define ALIPAY_PRINT_ERR(log_num, fmt, arg...) PRINT("[ALIPAY SVR E/] %s: " fmt "\r\n", __FUNCTION__, ##arg) #define ALIPAY_PRINT_WARN(log_num, fmt, arg...) PRINT("[ALIPAY SVR W/] %s: " fmt "\r\n", __FUNCTION__, ##arg) @@ -52,7 +62,6 @@ extern "C" { #define ALIPAY_TRANS_CARD_MAX_LENGTH 20 #define ALIPAY_TRANS_CARD_MIN_VALID_NUM 3 - typedef enum { PAYMENT_UNSUPPORTED = 1, /* NOT support payment */ PAYMENT_UNBIND, /* support but not bind */ @@ -392,7 +401,6 @@ mc_alipay_trans_context_t * svr_alipay_get_trans_context(void); */ uint32_t svr_alipay_register_cb(alipay_msgf_event_callback_func callback); - #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 0703faae8..58bf3bfdf 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -331,7 +331,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/motionrecognition/src/MotionRecognitionView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/language/LanguageInit.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/config/src/ConfigModel.cpp #查找手机 ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/findphone/src/FindPhonePresenter.cpp diff --git a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp index 8b72fe4c8..8553ced2d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-23 09:59:32 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-24 14:27:03 + * @LastEditors: SnickerSun snickersun@163.com + * @LastEditTime: 2024-05-28 15:07:45 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/networkandcall/src/NetworkAndCallPresenter.cpp */ #include "AppViewIDs.h" @@ -166,20 +166,8 @@ extern "C" #endif /* __cplusplus */ #endif /* __cplusplus */ - uint32_t uapi_cat1_power_on(uint32_t pwron); - uint32_t uapi_cat1_reset(uint32_t pwron); + - void power_on_cat1(void) - { - uapi_cat1_power_on(1); - uapi_cat1_reset(0); - } - - void power_off_cat1(void) - { - uapi_cat1_reset(1); - uapi_cat1_power_on(0); - } #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/fd230app/nativeui/traing/Training_UiConfig.h b/code/sdk/application/wearable/fd230app/nativeui/traing/Training_UiConfig.h index 190cb4b00..228b8dac6 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/traing/Training_UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativeui/traing/Training_UiConfig.h @@ -8,10 +8,7 @@ namespace OHOS { -// 定义按键颜色宏 -#define DEFAULT_BACKGROUND_COLOR 0xff191919 -#define PRESSED_BACKGROUND_COLOR 0xff249115 -#define PRESSED_BORDER_COLOR 0xff0b1928 + // Paths for different icons in the Training folder #define ICON36 "/user/res/Training/icon_36x36" diff --git a/code/sdk/application/wearable/nativeabilityfwk/CMakeLists.txt b/code/sdk/application/wearable/nativeabilityfwk/CMakeLists.txt index ae350bcb1..93f05aa2e 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/CMakeLists.txt +++ b/code/sdk/application/wearable/nativeabilityfwk/CMakeLists.txt @@ -19,6 +19,7 @@ set(PRIVATE_HEADER ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits ${ROOT_DIR}/middleware/services/gui/uikit/ui/frameworks + ${ROOT_DIR}/application/wearable/nativeapp/nativeui/applist/include/ ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include ) @@ -30,6 +31,8 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/SliceTransition.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/TransitionManager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/transition/ZoomTransition.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/transition/HexagonsTransition.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/transition/BackToHexagonsTransition.cpp ) set(COMPONENT_PUBLIC_CCFLAGS diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h b/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h index 0b0d62edd..069aed3e3 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/Ability.h @@ -23,10 +23,10 @@ #include "Slice.h" #include "wearable_log.h" -#include "TransitionManager.h" +#include "TransitionType.h" #include "SliceTransition.h" +#include "soc_osal.h" #include "stack" -#include namespace OHOS { const static uint16_t gSliceInvalid = 0; const static uint16_t gSliceDefaultPriority = 4; // 页面默认是最低优先级 @@ -34,16 +34,14 @@ const static uint16_t gMaxHistorySlices = 10; // 默认最多保存三个历史 class Ability { public: - Ability() {}; - ~Ability() {}; - void AddSliceProxy(const uint16_t sliceId, SliceProxy* proxy); - void ChangeSlice(const uint16_t targetSliceId, const uint16_t transitionId = TRANSITION_INVALID, + void ChangeSlice(const uint16_t targetSliceId, TransitionType type = TransitionType::TRANSITION_INVALID, const uint16_t priority = gSliceDefaultPriority); void SetDefaultSliceId(const uint16_t defaultSliceId) { defaultSliceId_ = defaultSliceId; } + void OnTransitionEnd(); uint16_t GetCurSliceId(void) { if (allSlices_.empty()) { @@ -70,7 +68,7 @@ public: } // 当从一个Slice进入另一个Slice时调用 - void EnterSlice(uint16_t sliceId,const uint16_t transitionId = TRANSITION_INVALID, + void EnterSlice(uint16_t sliceId,const TransitionType transitionId = TransitionType::TRANSITION_INVALID, const uint16_t priority = gSliceDefaultPriority) { // 获取当前SliceID uint16_t curSliceId = GetCurSliceId(); @@ -81,7 +79,7 @@ public: } // 处理后退操作 - bool Back(const uint16_t transitionId = TRANSITION_INVALID, + bool Back(const TransitionType transitionId = TransitionType::TRANSITION_INVALID, const uint16_t priority = gSliceDefaultPriority) { /* if (backStack_.empty()) { @@ -102,6 +100,8 @@ public: } } protected: + Ability() = default; + virtual ~Ability() = default; struct ProxyStruct { uint16_t sliceId; SliceProxy* proxy; @@ -120,17 +120,18 @@ protected: std::vector allSlices_; SliceStruct curSlice_; + SliceStruct prevSlice_; uint16_t defaultSliceId_ = gSliceInvalid; uint16_t curSlicePriority_ = gSliceDefaultPriority; SliceTransition sliceTransition_; + osal_atomic transitionCount_{0}; void ResumeSlice(const uint16_t priority = gSliceDefaultPriority); void StartSlice(const uint16_t sliceId, const uint16_t priority); void StopSlice(); - void ReleaseCurSlice(); - void PostChangeSlice(const uint16_t targetSliceId, const uint16_t transitionId, const uint16_t priority); + void PostChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority); ListsNode* Find(const uint16_t sliceId); private: diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/NativeAbility.h b/code/sdk/application/wearable/nativeabilityfwk/include/NativeAbility.h index e846865fd..f03c2da9a 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/include/NativeAbility.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/NativeAbility.h @@ -58,7 +58,7 @@ public: int GetNativeAbilityState() const; private: NativeAbility() {} - ~NativeAbility() {} + ~NativeAbility() override {} int nativeAbilityState_ = 0; }; } diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h b/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h index cb5ebf1e1..e7b25f52e 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h @@ -9,60 +9,46 @@ #define SLICE_TRANSITION_H #include "Slice.h" #include "TransitionCallback.h" +#include "TransitionType.h" #include "animator/animator.h" namespace OHOS { -struct TransitionInfo { - uint32_t duration; - TransitionCallback* transitionCallback; - UIImageView* current; - UIImageView* target; -}; class SliceTransition; class TransitionAnimatorCallback : public AnimatorCallback { public: - TransitionAnimatorCallback(SliceTransition* transition) : transition_(transition) {} + TransitionAnimatorCallback(SliceTransition* transition) : sliceTransition_(transition) {} virtual ~TransitionAnimatorCallback() {} void Callback(UIView* view) override; void OnStop(UIView& view) override; - bool SetAnimationInfo(TransitionInfo info); - private: + bool isStarted_ = false; uint32_t startTime_ = 0; - uint32_t elapseTime_ = 0; - TransitionInfo info_ = {0}; - SliceTransition* transition_ = nullptr; + SliceTransition* sliceTransition_ = nullptr; }; class SliceTransition : public HeapBase { public: - SliceTransition(); + friend class TransitionAnimatorCallback; + SliceTransition() {}; ~SliceTransition(); - void Transition(Slice* targetSlice, TransitionCallback* transition, uint32_t duration = 800); - void TransitionEnd(); + bool SetTransitionType(TransitionType type); + void Transition(UIView* current, UIView* target); + bool IsCurrentSnapshotEnabled(); bool SaveCurrentSnapshot(UIView* view); void StopAnimator(); - bool IsRunning() - { - return isAnimatorRunning_; - } - - bool needWaitFirstVideoFrame_ = false; private: - bool initialized_ = false; - bool isAnimatorRunning_ = false; Animator* animator_ = nullptr; TransitionAnimatorCallback* animatorCallback_ = nullptr; - UIImageView currentSnapshot_; - UIImageView targetSnapshot_; - UIView* targetContainer_ = nullptr; - - void clearImgs(); + UIImageView* currentSnapshot_ = nullptr; + UIImageView* targetSnapshot_ = nullptr; + UIView* currentView_ = nullptr; + UIView* targetView_ = nullptr; + TransitionCallback* transitionCallback_ = nullptr; + void ClearTransitionResource(); void TransitionStart(TransitionCallback* transition, uint32_t duration); - bool GetTargetSnapshot(UIView* view); + bool SaveTargetSnapshot(UIView* view); ImageInfo RectifySnapshot(ImageInfo& dstInfo); - bool IsVideoContained(UIView* view); }; } // namespace OHOS #endif // SLICE_TRANSITION_H diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/TransitionCallback.h b/code/sdk/application/wearable/nativeabilityfwk/include/TransitionCallback.h index 8e0d2f3a7..3c5adce3e 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/include/TransitionCallback.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/TransitionCallback.h @@ -12,19 +12,92 @@ namespace OHOS { class TransitionCallback : public HeapBase { public: - TransitionCallback() {} - virtual ~TransitionCallback() {} + /** + * @brief constructor of base class for Transition algorithm + * Note that: + * 1. The transition parameters will impact process flow: + * if enableCurrentSnapshot is true and enableTargetSnapshot is true + * Snap (current slice) -> OnStop(current slice) -> OnStart(target slice) -> OnResume(target slice) + * -> Snap (target slice) -> Add snapshot views -> Transition animator -> Destroy Snapshots + * if enableCurrentSnapshot is true and enableTargetSnapshot is false + * Snap (current slice) -> OnStop(current slice) -> OnStart(target slice) -> OnResume(target slice) + * -> Add snapshot view -> Transition animator -> Destroy Snapshot + * if enableCurrentSnapshot is false and enableTargetSnapshot is true + * OnStart(target slice) -> OnResume(target slice) -> Snap (target slice) + * -> Add snapshot view -> Transition animator -> Destroy Snapshots -> OnStop(current slice) + * if enableCurrentSnapshot is true and enableTargetSnapshot is true + * OnStart(target slice) -> OnResume(target slice) + * -> Transition animator -> OnStop(current slice) + * 2. Memory usage is diffrent when using different transition parameters refer to above process flow + * - Snapshot will cost memory: stride (of screen) * height (of screen) * 3 (RGB888) + * - Start slice will cost new memory usage + * - Stop slice will release its memory usage + * 3. Diffrent methods are invoked when using different parameters, refer to comments of below methods + * @param time Snapshot of current slice + * @param enableCurrentSnapshot Whether use snapshot for current slice in the transition + * @param enableTargetSnapshot Whether use snapshot for target slice in the transition + */ + TransitionCallback(uint32_t time, bool enableCurrentSnapshot, bool enableTargetSnapshot) + { + duration_ = time; + enableCurrentSnapshot_ = enableCurrentSnapshot; + enableTargetSnapshot_ = enableTargetSnapshot; + } + + virtual ~TransitionCallback() = default; + + /* * + * @brief Invoked when transition start if enableCurrentSnapshot is true and enableTargetSnapshot is true + * @param current Snapshot of current slice + * @param target Snapshot of target slice + * @param time Elapse milliseconds since start time of the transition + * Note that:Both current and target UIImageViews are full screen and have aleady been added into Root View, + * and target view is on top of current UIImageView. you can modify it in this function if necessary + */ + virtual void OnTransitionStart(UIImageView* current, UIImageView* target) {}; /* * - * @brief Switch algorithm when slice switching. - * @param current Snapshot for current slice. - * @param target Snapshot for target slice. - * @param time Time elapse to animator start. - * @param duration Time duration for animation. - * @since 1.0 - * @version 1.0 + * @brief Invoked when transition start if enableCurrentSnapshot is true and enableTargetSnapshot is false + * @param current Snapshot of current slice + * @param target Container view of target slice + * @param time Elapse milliseconds since start time of the transition + * Note that: Both current and target views have aleady been added into Root View, current UIImageView is full + * screen, and current view is on top of target view. you can modify it in this function if necessary */ - virtual void TransitionAlg(UIImageView* current, UIImageView* target, uint32_t time, uint32_t duration) {} + virtual void OnTransitionStart(UIImageView* current, UIView* target) {}; + + /* * + * @brief Invoked when transition start if enableCurrentSnapshot is false and enableTargetSnapshot is true + * @param current Container view of current slice + * @param target Snapshot of target slice + * @param time Elapse milliseconds since start time of the transition + * Note that: Both current and target views have aleady been added into Root View, target UIImageView is full + * screen, and target view is on top of current view. you can modify it in this function if necessary + */ + virtual void OnTransitionStart(UIView* current, UIImageView* target) {}; + + /* * + * @brief Invoked when transition start if enableCurrentSnapshot is false and enableTargetSnapshot is false + * @param current Container view of current slice + * @param target Container view of target slice + * Note that: Both current and target views have aleady been added into Root View, + * and target view is on top of current view. you can modify it in this function if necessary + */ + virtual void OnTransitionStart(UIView* current, UIView* target) {}; + + /* * + * @brief Invoked in the transition animator + * @param time Elapse milliseconds since start time of the transition + */ + virtual void TransitionAlg(uint32_t time) {}; + /* * + * @brief Invoked when the transition ends + */ + virtual void OnTransitionEnd() {}; + + uint32_t duration_ = 0; + bool enableCurrentSnapshot_ = true; + bool enableTargetSnapshot_ = true; }; } // namespace OHOS #endif // SLICE_SWITCH_CALLBACK_H diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/TransitionManager.h b/code/sdk/application/wearable/nativeabilityfwk/include/TransitionManager.h index 18006d5e0..1ac16365f 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/include/TransitionManager.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/TransitionManager.h @@ -8,18 +8,45 @@ #ifndef TRANSITION_MANAGER_H #define TRANSITION_MANAGER_H +#include "gfx_utils/vector.h" #include "TransitionCallback.h" +#include "TransitionType.h" namespace OHOS { -typedef enum : uint16_t { - TRANSITION_INVALID = 0, - TRANSITION_ZOOM = 1, - TRANSITION_MAX, -} TransitionId; +struct TransitionMap { + TransitionType type; + TransitionCallback* transition; +}; class TransitionManager : public HeapBase { public: - static TransitionCallback* GetTransition(uint16_t id); + static TransitionManager& GetInstance() + { + static TransitionManager instance; + return instance; + } + TransitionCallback* GetTransition(TransitionType type); + void RegisterTransition(TransitionType type, TransitionCallback* transition); + +private: + TransitionManager() {}; + ~TransitionManager(); + TransitionManager(const TransitionManager &) = delete; + TransitionManager &operator=(const TransitionManager &) = delete; + TransitionManager(TransitionManager &&) = delete; + TransitionManager &operator=(TransitionManager &&) = delete; + Graphic::Vector transitions_; +}; + +class TransitionRegister : public HeapBase { +public: + TransitionRegister(TransitionType type, TransitionCallback* transition) + { + TransitionManager::GetInstance().RegisterTransition(type, transition); + } }; } // namespace OHOS + +#define REGIST_TRANSITION(type, func, time, enableCurSnapShot, enableTargetSnapShot) \ + const static OHOS::TransitionRegister (STATIC_VAR)(type, new func(time, enableCurSnapShot, enableTargetSnapShot)) #endif // TRANSITION_MANAGER_H \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/TransitionType.h b/code/sdk/application/wearable/nativeabilityfwk/include/TransitionType.h new file mode 100644 index 000000000..092c452a5 --- /dev/null +++ b/code/sdk/application/wearable/nativeabilityfwk/include/TransitionType.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: Transition + * Author: + * Create: 2024-03 + */ + +#ifndef TRANSITION_TYPES_H +#define TRANSITION_TYPES_H +namespace OHOS { +enum class TransitionType { + TRANSITION_INVALID = 0, + TRANSITION_ZOOM, + TRANSITION_HEXAGONS, + TRANSITION_BACK_TO_HEXAGONS, + TRANSITION_MAX +}; +} +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp index 77c32d26e..75376b1f4 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp @@ -16,6 +16,7 @@ #include "Ability.h" #include "graphic_service.h" #include "abilityms_slite_client.h" +#include "common/input_device_manager.h" namespace OHOS { /* @@ -55,7 +56,7 @@ void Ability::StartSlice(const uint16_t sliceId, const uint16_t priority) if (node == nullptr) { return; } - + InputDeviceManager::GetInstance()->ClearPressableViews(); Slice* nextSlice = node->value_.proxy->CreateSlice(); if (nextSlice == nullptr) { return; @@ -68,6 +69,10 @@ void Ability::StartSlice(const uint16_t sliceId, const uint16_t priority) } /* -------------- 4.设置当前Slice的相关信息,并调用Slice的OnStart和OnResume方法。 ------------- */ allSlices_.push_back(sliceId); + if (curSlice_.slice != nullptr) { + prevSlice_.sliceId = curSlice_.sliceId; + prevSlice_.slice = curSlice_.slice; + } curSlice_.sliceId = sliceId; curSlice_.slice = nextSlice; @@ -77,20 +82,6 @@ void Ability::StartSlice(const uint16_t sliceId, const uint16_t priority) nextSlice->OnResume(); } -/* - * @brief 释放当前的Slice,将当前Slice对象设置为nullptr,并重置当前Slice ID和优先级 - */ -void Ability::ReleaseCurSlice() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "Ability::ReleaseCurSlice"); - if (curSlice_.slice != nullptr) { - curSlice_.sliceId = gSliceInvalid; - delete curSlice_.slice; - curSlice_.slice = nullptr; - } - - curSlicePriority_ = gSliceDefaultPriority; -} /* * @brief 在allSlicesProxy_列表中寻找与给定sliceId相符合的ProxyStruct节点。如果找到则返回该节点,否则返回nullptr。 @@ -123,33 +114,42 @@ ListsNode* Ability::Find(const uint16_t sliceId) * @param {uint16_t} priority * @return {*} */ -void Ability::ChangeSlice(const uint16_t targetSliceId, const uint16_t transitionId, const uint16_t priority) +void Ability::ChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority) { - if (sliceTransition_.IsRunning()) { - return; - } + if (osal_atomic_read(&transitionCount_) <= 0) { + osal_atomic_inc(&transitionCount_); // onStop释放当前页面需要和当前页面的事件监听异步执行,否则会出现自己杀掉自己的情况 //使用图形服务的PostGraphicEvent方法异步执行PostChangeSlice,以避免在页面事件监听时出现当前页面自我销毁的情况。 - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&Ability::PostChangeSlice, this, targetSliceId, - transitionId, priority)); + GraphicService::GetInstance()->PostGraphicEvent(std::bind(&Ability::PostChangeSlice, this, targetSliceId, + type, priority)); + } } -void Ability::PostChangeSlice(const uint16_t targetSliceId, const uint16_t transitionId, const uint16_t priority) +void Ability::PostChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority) { /* 1.首先检查当前Slice是否存在,并验证transitionId的有效性。 如果当前存在一个有效的Slice,并且transitionId合法,则调用sliceTransition_的SaveCurrentSnapshot方法保存当前Slice的快照, 主要是为了后续可能使用的页面转场效果。 */ - if (curSlice_.slice != nullptr && transitionId > TRANSITION_INVALID && transitionId < TRANSITION_MAX) { - sliceTransition_.SaveCurrentSnapshot(curSlice_.slice->GetSliceContainer()); - } + bool useTransition = sliceTransition_.SetTransitionType(type); + bool isCurSnapshotEnabled = sliceTransition_.IsCurrentSnapshotEnabled(); + + if (!useTransition) { + StopSlice(); + } else if (isCurSnapshotEnabled) { + if (!sliceTransition_.SaveCurrentSnapshot(curSlice_.slice->GetSliceContainer())) { + useTransition = false; + } // slice页面跳转,先onstop,再onstart.在一个线程同步执行绘制,不会出现闪屏现象 /* 2.调用StopSlice函数停止当前Slice的运行。在StopSlice中,会调用当前Slice的OnStop方法,并释放当前Slice占用的资源。 */ - StopSlice(); + StopSlice(); + } + + // slice页面跳转,先onstop,再onstart.在一个线程同步执行绘制,不会出现闪屏现象 #ifdef JS_ENABLE ElementName *elementName = OHOS::AbilityMsClient::GetInstance().GetTopAbility(); if (strcmp(elementName->bundleName, "com.huawei.launcher") != 0) { @@ -162,12 +162,33 @@ void Ability::PostChangeSlice(const uint16_t targetSliceId, const uint16_t trans 记录Slice ID到历史记录中,并调用该Slice的OnStart和OnResume方法开始运行新的Slice。 */ StartSlice(targetSliceId, priority); - if (transitionId > TRANSITION_INVALID && transitionId < TRANSITION_MAX) { - sliceTransition_.Transition(curSlice_.slice, TransitionManager::GetTransition(transitionId)); - } + if (useTransition) { + if (isCurSnapshotEnabled) { + sliceTransition_.Transition(nullptr, curSlice_.slice->GetSliceContainer()); + } else { + sliceTransition_.Transition(prevSlice_.slice->GetSliceContainer(), curSlice_.slice->GetSliceContainer()); + } + } else { + osal_atomic_dec(&transitionCount_); + } } +void Ability::OnTransitionEnd() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "Ability::OnTransitionEnd"); + if (!sliceTransition_.IsCurrentSnapshotEnabled()) { + if (prevSlice_.slice != nullptr) { + prevSlice_.slice->OnStop(); + if (prevSlice_.slice != nullptr) { + prevSlice_.sliceId = gSliceInvalid; + delete prevSlice_.slice; + prevSlice_.slice = nullptr; + } + } + } + osal_atomic_dec(&transitionCount_); +} /* * @brief 重新启动当前或默认Slice。根据当前记录的切片历史来决定重启哪个Slice。 */ @@ -188,10 +209,16 @@ void Ability::ResumeSlice(const uint16_t priority) */ void Ability::StopSlice() { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "Ability::StopSlice"); if (curSlice_.slice != nullptr) { curSlice_.slice->OnStop(); - ReleaseCurSlice(); + if (curSlice_.slice != nullptr) { + curSlice_.sliceId = gSliceInvalid; + delete curSlice_.slice; + curSlice_.slice = nullptr; + } + + curSlicePriority_ = gSliceDefaultPriority; } } - } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp index 540c39fe0..20226e665 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp @@ -10,56 +10,40 @@ #include "draw/clip_img.h" #include "components/root_view.h" #include "SliceTransition.h" +#include "TransitionManager.h" +#include "NativeAbility.h" namespace OHOS { static UILiteSurfaceView* g_surface = nullptr; void TransitionAnimatorCallback::Callback(UIView* view) { - elapseTime_ = HALTick::GetInstance().GetElapseTime(startTime_); - if (elapseTime_ > info_.duration) { - elapseTime_ = info_.duration; - } - if (transition_->needWaitFirstVideoFrame_) { - if ((g_surface == nullptr) || ((g_surface != nullptr) && g_surface->IsFirstFrameCame())) { - transition_->StopAnimator(); + TransitionCallback* callback = sliceTransition_->transitionCallback_; + if (!isStarted_) { + if (callback->enableCurrentSnapshot_ && callback->enableTargetSnapshot_) { + callback->OnTransitionStart(sliceTransition_->currentSnapshot_, sliceTransition_->targetSnapshot_); + } else if (callback->enableCurrentSnapshot_ && !callback->enableTargetSnapshot_) { + callback->OnTransitionStart(sliceTransition_->currentSnapshot_, sliceTransition_->targetView_); + } else if (!callback->enableCurrentSnapshot_ && callback->enableTargetSnapshot_) { + callback->OnTransitionStart(sliceTransition_->currentView_, sliceTransition_->targetSnapshot_); + } else { + callback->OnTransitionStart(sliceTransition_->currentView_, sliceTransition_->targetView_); } - } else { - info_.transitionCallback->TransitionAlg(info_.current, info_.target, elapseTime_, info_.duration); + startTime_ = HALTick::GetInstance().GetTime(); + isStarted_ = true; } -} -void TransitionAnimatorCallback::OnStop(UIView& view) -{ - transition_->TransitionEnd(); -} - -bool TransitionAnimatorCallback::SetAnimationInfo(TransitionInfo info) -{ - if (info.current == nullptr || info.target == nullptr) { - return false; + uint32_t elapseTime = HALTick::GetInstance().GetElapseTime(startTime_); + if (elapseTime > callback->duration_) { + sliceTransition_->StopAnimator(); + return; } - - info_ = info; - startTime_ = HALTick::GetInstance().GetTime(); - return true; + callback->TransitionAlg(elapseTime); } -SliceTransition::SliceTransition() +void TransitionAnimatorCallback::OnStop(UIView& view) { - animatorCallback_ = new TransitionAnimatorCallback(this); - if (animatorCallback_ == nullptr) { - return; - } - animator_ = new Animator(animatorCallback_, nullptr, 0, false); - if (animator_ == nullptr) { - delete animatorCallback_; - animatorCallback_ = nullptr; - return; - } - - currentSnapshot_.SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - targetSnapshot_.SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - initialized_ = true; + isStarted_ = false; + sliceTransition_->transitionCallback_->OnTransitionEnd(); } SliceTransition::~SliceTransition() @@ -73,18 +57,48 @@ SliceTransition::~SliceTransition() delete animatorCallback_; animatorCallback_ = nullptr; } - clearImgs(); + ClearTransitionResource(); } -void SliceTransition::clearImgs() +void SliceTransition::ClearTransitionResource() { - if (currentSnapshot_.GetImageInfo() != nullptr && currentSnapshot_.GetImageInfo()->data != nullptr) { - ImageCacheFree(*const_cast(currentSnapshot_.GetImageInfo())); + if (currentSnapshot_ != nullptr && currentSnapshot_->GetImageInfo() != nullptr && + currentSnapshot_->GetImageInfo()->data != nullptr) { + ImageCacheFree(*const_cast(currentSnapshot_->GetImageInfo())); + } + + if (targetSnapshot_ != nullptr && targetSnapshot_->GetImageInfo() != nullptr && + targetSnapshot_->GetImageInfo()->data != nullptr) { + ImageCacheFree(*const_cast(targetSnapshot_->GetImageInfo())); } + if (currentSnapshot_ != nullptr) { + delete currentSnapshot_; + currentSnapshot_ = nullptr; + } + if (targetSnapshot_ != nullptr) { + delete targetSnapshot_; + targetSnapshot_ = nullptr; + } + currentView_ = nullptr; + targetView_ = nullptr; + transitionCallback_ = nullptr; +} - if (targetSnapshot_.GetImageInfo() != nullptr && targetSnapshot_.GetImageInfo()->data != nullptr) { - ImageCacheFree(*const_cast(targetSnapshot_.GetImageInfo())); +bool SliceTransition::SetTransitionType(TransitionType type) +{ + transitionCallback_ = TransitionManager::GetInstance().GetTransition(type); + if (transitionCallback_ == nullptr) { + return false; } + return true; +} + +bool SliceTransition::IsCurrentSnapshotEnabled() +{ + if (transitionCallback_ == nullptr) { + return false; + } + return transitionCallback_->enableCurrentSnapshot_; } ImageInfo SliceTransition::RectifySnapshot(ImageInfo& srcInfo) @@ -104,32 +118,19 @@ ImageInfo SliceTransition::RectifySnapshot(ImageInfo& srcInfo) } } -bool SliceTransition::IsVideoContained(UIView* view) -{ - while (view != nullptr) { - UIView* tempView = view; - view = view->GetNextSibling(); - if (tempView->GetViewType() == UI_LITE_SURFACE_VIEW) { - g_surface = dynamic_cast(tempView); - return true; - } - if (tempView->IsViewGroup()) { - if (IsVideoContained(static_cast(tempView)->GetChildrenHead())) { - return true; - } - } - } - return false; -} - bool SliceTransition::SaveCurrentSnapshot(UIView* view) { - if (!initialized_ || view == nullptr) { + if (view == nullptr) { + return false; + } + currentSnapshot_ = new UIImageView(); + if (currentSnapshot_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "currentSnapshot new failed"); return false; } ImageInfo info = {{0}}; - if (RootView::GetInstance()->isSystemViewEmpty() && !IsVideoContained(view)) { + if (RootView::GetInstance()->isSystemViewEmpty() && !view->IsVideoContained()) { if (!Screen::GetInstance().GetCurrentScreenBitmap(info)) { return false; } @@ -139,79 +140,83 @@ bool SliceTransition::SaveCurrentSnapshot(UIView* view) } } ImageInfo rectifiedInfo = RectifySnapshot(info); - currentSnapshot_.SetSrc(&rectifiedInfo); + currentSnapshot_->SetSrc(&rectifiedInfo); return true; } -bool SliceTransition::GetTargetSnapshot(UIView* view) +bool SliceTransition::SaveTargetSnapshot(UIView* view) { ImageInfo info = {{0}}; if (!view->GetBitmap(info)) { return false; } ImageInfo rectifiedInfo = RectifySnapshot(info); - targetSnapshot_.SetSrc(&rectifiedInfo); + targetSnapshot_ = new UIImageView(); + if (targetSnapshot_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "targetSnapshot new failed"); + return false; + } + targetSnapshot_->SetSrc(&rectifiedInfo); return true; } -void SliceTransition::Transition(Slice* targetSlice, TransitionCallback* transition, uint32_t duration) +void SliceTransition::Transition(UIView* current, UIView* target) { - if (targetSlice == nullptr || targetSlice->GetSliceContainer() == nullptr || transition == nullptr || !initialized_ || - (currentSnapshot_.GetImageInfo() != nullptr && currentSnapshot_.GetImageInfo()->data == nullptr)) { - clearImgs(); + if (animatorCallback_ == nullptr) { + animatorCallback_ = new TransitionAnimatorCallback(this); + } + + if (animator_ == nullptr) { + animator_ = new Animator(animatorCallback_, nullptr, 0, true); + } + + if ((target == nullptr || transitionCallback_ == nullptr) || + (!transitionCallback_->enableCurrentSnapshot_ && (current == nullptr))) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "SliceTransition::Transition curV:%d tarV:%d", + current != nullptr, target != nullptr); + NativeAbility::GetInstance().OnTransitionEnd(); + ClearTransitionResource(); return; } + currentView_ = current; + targetView_ = target; - targetContainer_ = targetSlice->GetSliceContainer(); - if (IsVideoContained(targetContainer_)) { - needWaitFirstVideoFrame_ = true; - } else { - if (!GetTargetSnapshot(targetContainer_)) { - clearImgs(); + if (transitionCallback_->enableTargetSnapshot_) { + if (!SaveTargetSnapshot(target)) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "SliceTransition target snap failed"); + NativeAbility::GetInstance().OnTransitionEnd(); + ClearTransitionResource(); return; } } + animator_->Start(); - TransitionStart(transition, duration); + if (transitionCallback_->enableCurrentSnapshot_) { + currentSnapshot_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), + Screen::GetInstance().GetHeight()); + RootView::GetInstance()->Add(currentSnapshot_); + } + + if (transitionCallback_->enableTargetSnapshot_) { + targetView_->SetVisible(false); + targetSnapshot_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), + Screen::GetInstance().GetHeight()); + RootView::GetInstance()->Add(targetSnapshot_); + } } void SliceTransition::StopAnimator() { animator_->Stop(); -} - -void SliceTransition::TransitionStart(TransitionCallback* transition, uint32_t duration) -{ - TransitionInfo info; - info.current = ¤tSnapshot_; - info.target = &targetSnapshot_; - info.duration = (duration != 0) ? duration : 800; // 800: default duration - info.transitionCallback = transition; - if (animatorCallback_->SetAnimationInfo(info)) { - animator_->SetTime(info.duration); - animator_->Start(); - isAnimatorRunning_ = true; - } else { - clearImgs(); - return; + NativeAbility::GetInstance().OnTransitionEnd(); + if (transitionCallback_->enableCurrentSnapshot_) { + RootView::GetInstance()->Remove(currentSnapshot_); } - targetContainer_->SetVisible(false); - RootView::GetInstance()->Add(¤tSnapshot_); - if (!needWaitFirstVideoFrame_) { - RootView::GetInstance()->Add(&targetSnapshot_); - } -} -void SliceTransition::TransitionEnd(void) -{ - clearImgs(); - isAnimatorRunning_ = false; - RootView::GetInstance()->Remove(¤tSnapshot_); - if (!needWaitFirstVideoFrame_) { - RootView::GetInstance()->Remove(&targetSnapshot_); - } - needWaitFirstVideoFrame_ = false; - g_surface = nullptr; - targetContainer_->SetVisible(true); + if (transitionCallback_->enableTargetSnapshot_) { + RootView::GetInstance()->Remove(targetSnapshot_); + targetView_->SetVisible(true); + } + ClearTransitionResource(); } } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/TransitionManager.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/TransitionManager.cpp index 739013498..06a30ed19 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/src/TransitionManager.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/TransitionManager.cpp @@ -7,25 +7,43 @@ #include "TransitionManager.h" #include "ZoomTransition.h" +#include "gfx_utils/vector.h" namespace OHOS { -struct TransitionMapper { - uint16_t id; - TransitionCallback* obj; -}; - -static const TransitionMapper TRANSITION_MAPPER[] = { - {TRANSITION_ZOOM, new ZoomTransition()}, -}; +TransitionManager::~TransitionManager() +{ + for(uint16_t i =0; i < transitions_.Size(); i++) { + if (transitions_[i].transition != nullptr) { + delete transitions_[i].transition; + transitions_[i].transition = nullptr; + } + } +} -TransitionCallback* TransitionManager::GetTransition(uint16_t id) +TransitionCallback* TransitionManager::GetTransition(TransitionType type) { - uint16_t size = sizeof(TRANSITION_MAPPER) / sizeof(TRANSITION_MAPPER[0]); - for (int index = 0; index < size; index++) { - if ((TRANSITION_MAPPER[index].id == id)) { - return TRANSITION_MAPPER[index].obj; + for(uint16_t i =0; i < transitions_.Size(); i++) { + if (transitions_[i].type == type) { + return transitions_[i].transition; } } return nullptr; } + +void TransitionManager::RegisterTransition(TransitionType type, TransitionCallback* transition) +{ + if (transition == nullptr) { + GRAPHIC_LOGE("transition can't be nullptr"); + return; + } + for(uint16_t i =0; i < transitions_.Size(); i++) { + if (transitions_[i].type == type) { + GRAPHIC_LOGE("RegisterTransition failed because type %d already registered", type); + return; + } + } + GRAPHIC_LOGI("register transition %d", type); + TransitionMap map = {type, transition}; + transitions_.PushBack(map); +} } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.cpp new file mode 100644 index 000000000..fd7b9ba08 --- /dev/null +++ b/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.cpp @@ -0,0 +1,76 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: ZoomTransition + * Author: + * Create: 2024-04 + */ + +#include "BackToHexagonsTransition.h" +#include "TransitionManager.h" +#include "NativeAbility.h" +#include "components/root_view.h" +#include "AppItemView.h" +#include "hal_tick.h" +#include "wearable_log.h" + +namespace OHOS { +REGIST_TRANSITION(TransitionType::TRANSITION_BACK_TO_HEXAGONS, BackToHexagonsTransition, 300, true, false); +static const float CURRENT_SCALE_START = 1.0f; +static const float TARGET_SCALE_END = 1.0f; + +void BackToHexagonsTransition::OnTransitionStart(UIImageView* current, UIView* target) +{ + current_ = current; + target_ = dynamic_cast(target); + if ((target_ == nullptr) || (current_ == nullptr)) { + return; + } + + uint16_t sliceId = NativeAbility::GetInstance().GetPreSliceId(); + UIView* childView = target_->GetChildrenHead(); + while (childView != nullptr) { + HexagonsItemView* itemView = dynamic_cast(childView); + if ((itemView != nullptr) && (itemView->GetViewId() == sliceId)) { + focusIndex_ = itemView->GetViewIndex(); + focusView_ = itemView; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "BackToHexagonsTransition focus %d", focusIndex_); + break; + } + childView = childView->GetNextSibling(); + } + + if (focusView_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "BackToHexagonsTransition no focus view, use default\n"); + focusView_ = target_->GetViewByIndex(0); + } + target_->Scale(1.0f, focusIndex_); + Vector2 pos = target_->GetCurrentPosition(focusIndex_); + int16_t deltaX = MATH_ROUND(target_->GetWidth() / 2.0f - pos.x_); + int16_t deltaY = MATH_ROUND(target_->GetHeight() / 2.0f - pos.y_); + target_->ScrollBy(deltaX, deltaY); + target_->ReMeasure(); + Rect rect = focusView_->GetRect(); + float xScale = current->GetWidth() * 1.0f / rect.GetWidth(); + float yScale = current->GetHeight() * 1.0f / rect.GetHeight(); + tarScaleStart_ = FloatLessEqual(xScale, yScale) ? xScale : yScale; + curScaleEnd_ = 1.0f / tarScaleStart_; +} + +void BackToHexagonsTransition::TransitionAlg(uint32_t time) +{ + if ((current_ == nullptr) || (target_== nullptr) || (focusView_ == nullptr)) { + return; + } + float timeRatio = time * 1.0f / duration_; + + float curScale = timeRatio * (curScaleEnd_ - CURRENT_SCALE_START) + CURRENT_SCALE_START; + current_->Scale(Vector2(curScale, curScale), Vector2(current_->GetWidth() / 2.0f, + current_->GetHeight() / 2.0f)); + uint8_t opa = OPA_OPAQUE + timeRatio * (OPA_TRANSPARENT - OPA_OPAQUE); + current_->SetOpaScale(opa); + + float targetScale = tarScaleStart_ + timeRatio * (TARGET_SCALE_END - tarScaleStart_); + target_->Scale(targetScale, focusIndex_); + focusView_->SetOpaScale(OPA_OPAQUE - opa); +} +} // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.h b/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.h new file mode 100644 index 000000000..2e261b2c2 --- /dev/null +++ b/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: ZoomTransition + * Author: + * Create: 2024-04 + */ + +#ifndef HEXAGONS_TRASITION_H +#define HEXAGONS_TRASITION_H +#include "TransitionCallback.h" +#include "components/ui_custom_hexagons_list.h" + +namespace OHOS { +class BackToHexagonsTransition : public TransitionCallback { +public: + BackToHexagonsTransition(uint32_t time, bool enableCurrentSnapshot, bool enableTargetSnapshot) : + TransitionCallback(time, enableCurrentSnapshot, enableTargetSnapshot) {} + ~BackToHexagonsTransition() override {} + void OnTransitionStart(UIImageView* current, UIView* target) override; + void TransitionAlg(uint32_t time) override; +private: + UIImageView* current_ = nullptr; + UICustomHexagonsList* target_ = nullptr; + UIView* focusView_ = nullptr; + uint8_t focusIndex_ = 0; + float curScaleEnd_ = 1.0f; + float tarScaleStart_ = 1.0f; +}; +} // namespace OHOS +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.cpp new file mode 100644 index 000000000..80953611b --- /dev/null +++ b/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.cpp @@ -0,0 +1,101 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: ZoomTransition + * Author: + * Create: 2024-04 + */ + +#include "HexagonsTransition.h" +#include "animator/easing_equation.h" +#include "components/root_view.h" +#include "TransitionManager.h" +#include "wearable_log.h" + +namespace OHOS { +REGIST_TRANSITION(TransitionType::TRANSITION_HEXAGONS, HexagonsTransition, 300, false, true); +static constexpr int16_t RANGE = 1000; +static const float HEXAGONS_SCALE_INIT = 1.0f; +static const float HEXAGONS_SCALE_TRANSPARENT = 2.5f; +static const float TARGET_SCALE_END = 1.0f; + +void HexagonsTransition::OnTransitionStart(UIView* current, UIImageView* target) +{ + current_ = dynamic_cast(current); + if (current_ == nullptr) { + return; + } + target_ = target; + int8_t index = current_->GetFocusedImgIndex(); + if (index <= 0) { + focusIndex_ = 0; + } else { + focusIndex_ = static_cast(index); + } + focusView_ = dynamic_cast(current_->GetViewByIndex(focusIndex_)); + if (focusView_ == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "HexagonsTransition no focus view\n"); + return; + } + current_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); + Vector2 delta = Vector2(current_->GetWidth() / 2, current_->GetHeight() / 2) - + current_->GetCurrentPosition(focusIndex_); + opaStart_ = current->GetOpaScale(); + scaleStart_ = current_->GetGlobalScale(); + Rect rect = focusView_->GetRect(); + float xScale = target_->GetWidth() * 1.0f / rect.GetWidth(); + float yScale = target_->GetHeight() * 1.0f / rect.GetHeight(); + scaleEnd_ = FloatLessEqual(xScale, yScale) ? xScale : yScale; + + targetXStart_ = rect.GetX(); + targetYStart_ = rect.GetY(); + targetScaleStart_ = 1.0f / scaleEnd_; + + uint32_t offsetTime = static_cast((scaleStart_ - HEXAGONS_SCALE_INIT) / + (scaleEnd_ - HEXAGONS_SCALE_INIT) * duration_); + durationBackup_ = duration_; + duration_ = duration_ - offsetTime; + thresholdTime_ = static_cast((HEXAGONS_SCALE_TRANSPARENT - scaleStart_) / (scaleEnd_ - scaleStart_) + * duration_); + xDistance_ = delta.x_; + yDistance_ = delta.y_; + prevX_ = 0; + prevY_ = 0; + + // put target image view in the background + RootView::GetInstance()->Remove(target); + RootView::GetInstance()->Insert(nullptr, target); +} + +void HexagonsTransition::TransitionAlg(uint32_t time) +{ + if ((current_ == nullptr) || (target_== nullptr) || (focusView_ == nullptr)) { + return; + } + float timeRatio = time * 1.0f / duration_; + float opaRatio = time * 1.0f / thresholdTime_; + opaRatio = FloatMore(opaRatio, 1.0f) ? 1.0f : opaRatio; + int16_t curX = static_cast(timeRatio * xDistance_); + int16_t curY = static_cast(timeRatio * yDistance_); + current_->ScrollBy(curX - prevX_, curY - prevY_); + prevX_ = curX; + prevY_ = curY; + + float curScale = timeRatio * (scaleEnd_ - scaleStart_) + scaleStart_; + uint8_t opa = opaRatio * (OPA_TRANSPARENT - opaStart_) + opaStart_; + focusView_->SetOpaScale(opa); + current_->Scale(curScale, focusIndex_); + + int16_t targetXPos = static_cast((1.0f - timeRatio) * targetXStart_); + int16_t targetYPos = static_cast((1.0f - timeRatio) * targetYStart_); + target_->SetPosition(targetXPos, targetYPos); + float targetScale = targetScaleStart_ + timeRatio * (1.0f - targetScaleStart_); + target_->Scale(Vector2(targetScale, targetScale), Vector2(0.0f, 0.0f)); + uint8_t targetOpa = timeRatio * (OPA_OPAQUE - OPA_TRANSPARENT) + OPA_TRANSPARENT; + target_->SetOpaScale(targetOpa); +} + +void HexagonsTransition::OnTransitionEnd() +{ + duration_ = durationBackup_; +} +} // namespace OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.h b/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.h new file mode 100644 index 000000000..46dd72ec2 --- /dev/null +++ b/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: ZoomTransition + * Author: + * Create: 2024-04 + */ + +#ifndef HEXAGONS_TRASITION_H +#define HEXAGONS_TRASITION_H +#include "TransitionCallback.h" +#include "components/ui_custom_hexagons_list.h" + +namespace OHOS { +class HexagonsTransition : public TransitionCallback { +public: + HexagonsTransition(uint32_t time, bool enableCurrentSnapshot, bool enableTargetSnapshot) : + TransitionCallback(time, enableCurrentSnapshot, enableTargetSnapshot) {} + ~HexagonsTransition() override {} + void OnTransitionStart(UIView* current, UIImageView* target) override; + void TransitionAlg(uint32_t time) override; + void OnTransitionEnd() override; +private: + uint32_t durationBackup_ = 0; + UICustomHexagonsList* current_ = nullptr; + UIImageView* target_ = nullptr; + UIImageView* focusView_ = nullptr; + uint8_t focusIndex_ = 0; + float scaleStart_ = 1.0f; + float scaleEnd_ = 1.0f; + uint8_t opaStart_ = 255; + int16_t xDistance_ = 0; + int16_t yDistance_ = 0; + int16_t prevX_ = 0; + int16_t prevY_ = 0; + float thresholdTime_ = 0.0f; + int16_t targetXStart_ = 0; + int16_t targetYStart_ = 0; + float targetScaleStart_ = 1.0f; +}; +} // namespace OHOS +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/transition/ZoomTransition.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/transition/ZoomTransition.cpp index 993c0b2eb..a6531459f 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/src/transition/ZoomTransition.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/transition/ZoomTransition.cpp @@ -5,15 +5,28 @@ * Create: 2023-11 */ -#include "animator/easing_equation.h" #include "ZoomTransition.h" +#include "animator/easing_equation.h" +#include "TransitionManager.h" namespace OHOS { static constexpr int16_t RANGE = 1000; -void ZoomTransition::TransitionAlg(UIImageView* current, UIImageView* target, uint32_t time, uint32_t duration) +REGIST_TRANSITION(TransitionType::TRANSITION_ZOOM, ZoomTransition, 800, true, true); + +void ZoomTransition::OnTransitionStart(UIImageView* current, UIImageView* target) +{ + current_ = current; + target_ = target; +} + +void ZoomTransition::TransitionAlg(uint32_t time) { + if ((current_ == nullptr) || (target_ == nullptr)) { + return; + } + float scale; - uint32_t half = duration / 2; // 2: half of duration + uint32_t half = duration_ / 2; // 2: half of duration if (time < half) { scale = 1 - EasingEquation::QuadEaseOut(0, RANGE, time, half) / static_cast(RANGE); } else { @@ -21,19 +34,19 @@ void ZoomTransition::TransitionAlg(UIImageView* current, UIImageView* target, ui } uint8_t opa = scale * OPA_OPAQUE; if (time < half) { - int16_t centerX = current->GetX() + current->GetWidth() / 2; // 2: half of width - int16_t centerY = current->GetY() + current->GetHeight() / 2; // 2: half of height - current->SetVisible(true); - target->SetVisible(false); - current->Scale(Vector2{scale, scale}, Vector2{centerX, centerY}); - current->SetOpaScale(opa); + int16_t centerX = current_->GetX() + current_->GetWidth() / 2; // 2: half of width + int16_t centerY = current_->GetY() + current_->GetHeight() / 2; // 2: half of height + current_->SetVisible(true); + target_->SetVisible(false); + current_->Scale(Vector2{scale, scale}, Vector2{centerX, centerY}); + current_->SetOpaScale(opa); } else { - int16_t centerX = target->GetX() + target->GetWidth() / 2; // 2: half of width - int16_t centerY = target->GetY() + target->GetHeight() / 2; // 2: half of height - target->SetVisible(true); - current->SetVisible(false); - target->Scale(Vector2{scale, scale}, Vector2{centerX, centerY}); - target->SetOpaScale(opa); + int16_t centerX = target_->GetX() + target_->GetWidth() / 2; // 2: half of width + int16_t centerY = target_->GetY() + target_->GetHeight() / 2; // 2: half of height + target_->SetVisible(true); + current_->SetVisible(false); + target_->Scale(Vector2{scale, scale}, Vector2{centerX, centerY}); + target_->SetOpaScale(opa); } } } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/transition/ZoomTransition.h b/code/sdk/application/wearable/nativeabilityfwk/src/transition/ZoomTransition.h index a5e3fbb20..419f2c086 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/src/transition/ZoomTransition.h +++ b/code/sdk/application/wearable/nativeabilityfwk/src/transition/ZoomTransition.h @@ -12,9 +12,14 @@ namespace OHOS { class ZoomTransition : public TransitionCallback { public: - ZoomTransition(void) {} - virtual ~ZoomTransition() override {} - void TransitionAlg(UIImageView* current, UIImageView* target, uint32_t time, uint32_t duration) override; + ZoomTransition(uint32_t time, bool enableCurrentSnapshot, bool enableTargetSnapshot) : + TransitionCallback(time, enableCurrentSnapshot, enableTargetSnapshot) {} + ~ZoomTransition() override {} + void OnTransitionStart(UIImageView* current, UIImageView* target) override; + void TransitionAlg(uint32_t time) override; +private: + UIImageView* current_ = nullptr; + UIImageView* target_ = nullptr; }; } // namespace OHOS #endif // ZOOM_TRANSITION_H \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/CMakeLists.txt b/code/sdk/application/wearable/nativeapp/CMakeLists.txt index 38ebe73c7..0e72a0e7e 100755 --- a/code/sdk/application/wearable/nativeapp/CMakeLists.txt +++ b/code/sdk/application/wearable/nativeapp/CMakeLists.txt @@ -57,8 +57,8 @@ set(PRIVATE_HEADER ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/frameworks ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/innerkits -c - + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/events + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/innerkits @@ -111,7 +111,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelHeartRate.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelSteps.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/main/src/dial/DialModelPower.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodoxygen/src/BloodOxygenView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodoxygen/src/BloodBandoffView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp @@ -266,6 +265,7 @@ set(SOURCES ${UI_SAMPLE_ROOT}/components/ui_test_cube_rotate/cube_rotate_view.cpp ${UI_SAMPLE_ROOT}/components/ui_test_cube_rotate/ui_test_cube_rotate.cpp ${UI_SAMPLE_ROOT}/components/ui_test_video_play/ui_test_video_play.cpp + ${UI_SAMPLE_ROOT}/components/ui_test_keyboard/ui_test_keyboard.cpp ${UI_SAMPLE_ROOT}/components/ui_test_hexagons_list/ui_test_hexagons_list.cpp ${UI_SAMPLE_ROOT}/components/ui_test_coverflow/ui_test_coverflow.cpp ${UI_SAMPLE_ROOT}/components/ui_test_kaleidoscope/ui_test_kaleidoscope.cpp @@ -336,6 +336,8 @@ set(COMPONENT_CCFLAGS -nostdlib -Wno-c++11-narrowing -Wno-error=unused-function + -Wno-missing-field-initializers + -Werror=return-type ) set(WHOLE_LINK diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainPresenter.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainPresenter.h index 7e25bbdbe..6aa7d468f 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainPresenter.h @@ -23,7 +23,7 @@ class MainView; class MainPresenter : public Presenter { public: MainPresenter(); - virtual ~MainPresenter(); + ~MainPresenter() override; void OnStart() override; void OnPause() override; diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainView.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainView.h index 6a13caea8..818dd6822 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainView.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/slices/main/MainView.h @@ -42,7 +42,7 @@ class MainPresenter; class MainView : public View { public: MainView(); - virtual ~MainView(); + ~MainView() override; void OnStart() override; void OnSetUpView() override; diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp index 0d578dfe2..a1e55d1bf 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -79,14 +79,12 @@ #endif namespace OHOS { -struct AppViewMapper -{ +struct AppViewMapper { AppViewId id; void (NativeLauncher::*func)(void); }; -struct ViewIdToString -{ +struct ViewIdToString { AppViewId id; char idForUikit[256]; }; @@ -100,8 +98,8 @@ static const AppViewMapper SLICE_MAPPER[] = { {VIEW_ALARM_POP_UP, &NativeLauncher::InitAlarmPopUpSlice}, {VIEW_BLOODOXY_SAMPLE, &NativeLauncher::InitMainBloodOxyView}, {VIEW_MAIN_ACTIVITY, &NativeLauncher::InitActivitySlice}, - {VIEW_CALLER_SAMPLE,&NativeLauncher::InitMainCallerLogView}, - {VIEW_MAEKPHONE_SAMPLE,&NativeLauncher::InitMainMakePhoneView}, + {VIEW_CALLER_SAMPLE, &NativeLauncher::InitMainCallerLogView}, + {VIEW_MAEKPHONE_SAMPLE, &NativeLauncher::InitMainMakePhoneView}, {VIEW_BLUETOOTH_EARPHONE, &NativeLauncher::InitBluetoothSlice}, {VIEW_COMPASS, &NativeLauncher::InitCompassSlice}, {VIEW_OFFLINEVOICE, &NativeLauncher::InitOfflineVoice}, @@ -161,7 +159,8 @@ void NativeLauncher::InitNativeLauncher() #ifdef JS_ENABLE ACELite::ProductAdapter::SetScreenSize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); #endif - GraphicStartUp::InitFontEngine(MEM_POOL_UI_FONT, MEM_POOL_UI_FONT_SIZE, OHOS::VECTOR_FONT_DIR, DEFAULT_VECTOR_FONT_FILENAME); + GraphicStartUp::InitFontEngine(MEM_POOL_UI_FONT, MEM_POOL_UI_FONT_SIZE, + OHOS::VECTOR_FONT_DIR, DEFAULT_VECTOR_FONT_FILENAME); WEARABLE_LOGI(WEARABLE_LOG_MODULE_LAUNCHER_FWK, "NativeLauncher::InitNativeLauncher"); // 初始化所有预加载slice InitBtHeadsetEvent(); // 蓝牙ct和tg适配初始化 diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainView.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainView.cpp index 3e79969e1..4f492bb85 100644 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/src/slices/main/MainView.cpp @@ -15,14 +15,13 @@ #include "MainView.h" #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "wearable_log.h" namespace OHOS { -MainView::MainView(){} +MainView::MainView() {} -MainView::~MainView(){} +MainView::~MainView() {} void MainView::OnStart() { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityModel.h b/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityModel.h index 7bf138e32..7c694f9f8 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityModel.h @@ -10,8 +10,8 @@ #define NUM_7 7 -#include -#include "stdio.h" +#include +#include #include "ohos_types.h" #include "RtcService.h" #include "samgr_lite.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityPresenter.h index a65060de4..1842d3ba7 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityPresenter.h @@ -9,7 +9,7 @@ #define ACTIVITY_PRESENTER_H #include -#include +#include #include "BaseView.h" #include "Presenter.h" #include "MainActivityView.h" @@ -27,7 +27,7 @@ public: void OnResume() override; void OnStop() override; static ActivityPresenter *GetInstance(); - virtual bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnDrag(UIView& view, const DragEvent& event) override; }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityWeekView.h b/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityWeekView.h index 5ecbb1b5f..5377a9012 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityWeekView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/activity/include/ActivityWeekView.h @@ -26,7 +26,7 @@ namespace OHOS { class ActivityWeekView : public UICardPage { public: ActivityWeekView(); - virtual ~ActivityWeekView(); + ~ActivityWeekView() override; static ActivityWeekView *GetInstance(void); int GetDigits(int stepValue); void InitSteps(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/activity/src/ActivityModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/activity/src/ActivityModel.cpp index fa6e6ed00..61cc52b76 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/activity/src/ActivityModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/activity/src/ActivityModel.cpp @@ -21,8 +21,6 @@ #include "ActivityWeekView.h" #include "graphic_service.h" -using namespace std; - #ifdef __cplusplus extern "C" { #endif @@ -32,22 +30,22 @@ using namespace OHOS; static void Notify(void *args, const Topic topic, Request* request); Subscriber subscirber = { - .identity = NULL, - .args = NULL, + .identity = nullptr, + .args = nullptr, .Notify = Notify, }; void StepSubscribeTopic(Topic topic) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "StepSubscribeTopic, topic=%u", topic); - BroadcastApi *broadcastApi = NULL; + BroadcastApi *broadcastApi = nullptr; IUnknown *api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); - if (api == NULL) { + if (api == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StepSubscribeTopic, GetFeatureApi failed"); return; } int result = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi); - if (result != 0 || broadcastApi == NULL) { + if (result != 0 || broadcastApi == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StepSubscribeTopic, QueryInterface failed"); return; } @@ -58,14 +56,14 @@ void StepSubscribeTopic(Topic topic) void StepUnsubscribeTopic(Topic topic) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "StepUnsubscribeTopic, topic=%u", topic); - BroadcastApi *broadcastApi = NULL; + BroadcastApi *broadcastApi = nullptr; IUnknown *api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); - if (api == NULL) { + if (api == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StepUnsubscribeTopic, GetFeatureApi failed"); return; } int result = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi); - if (result != 0 || broadcastApi == NULL) { + if (result != 0 || broadcastApi == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StepUnsubscribeTopic, QueryInterface failed"); return; } @@ -77,31 +75,32 @@ static void RefreshStepControls(const uint32_t &value, const uint16 &msgId) { MainClockView *mainClockView = OHOS::MainClockView::GetInstance(); if (mainClockView != nullptr) { - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&MainClockView::RefreshStep, mainClockView, value)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&MainClockView::RefreshStep, mainClockView, value)); } IndoorWalkPresenter *indoorWalkPresenter = OHOS::IndoorWalkPresenter::GetInstance(); if (indoorWalkPresenter != nullptr) { - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&IndoorWalkPresenter::ModifiesSteps, - indoorWalkPresenter, value)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&IndoorWalkPresenter::ModifiesSteps, indoorWalkPresenter, value)); } ActivityWeekView *activityWeekView = OHOS::ActivityWeekView::GetInstance(); if (activityWeekView == nullptr) { return; } - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&ActivityWeekView::RefreshSteps, - activityWeekView, value)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&ActivityWeekView::RefreshSteps, activityWeekView, value)); if (msgId == TOPIC_EVENT_STEPDATA_UPDATE) { - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&ActivityWeekView::RefreshTodayView, - activityWeekView, value)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&ActivityWeekView::RefreshTodayView, activityWeekView, value)); } else if (msgId == TOPIC_EVENT_NEXTDAY_UPDATE) { - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&ActivityWeekView::InitAvgStep, - activityWeekView)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&ActivityWeekView::InitAvgStep, activityWeekView)); if (OHOS::ActivityModel::GetInstance()->GetWeekToday() == MONDAY_STEP_COUNTER) { - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&ActivityWeekView::InitWeekView, - activityWeekView)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&ActivityWeekView::InitWeekView, activityWeekView)); } } } @@ -110,12 +109,12 @@ static void Notify(void *args, const Topic topic, Request* request) { UNUSED(args); UNUSED(topic); - if (request == NULL) { + if (request == nullptr) { return; } if (request->msgId == TOPIC_EVENT_STEPDATA_UPDATE) { - if (request->data == NULL) { + if (request->data == nullptr) { return; } // 计步数据累加 @@ -123,8 +122,8 @@ static void Notify(void *args, const Topic topic, Request* request) counter += *(uint32_t *)request->data; OHOS::ActivityModel::GetInstance()->ReviseStepCounter(counter); - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&ActivityModel::SetStepData, - ActivityModel::GetInstance(), counter)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&ActivityModel::SetStepData, ActivityModel::GetInstance(), counter)); RefreshStepControls(counter, TOPIC_EVENT_STEPDATA_UPDATE); } @@ -146,7 +145,7 @@ static constexpr const char *STEP_DATA_PATH = "/user/data/step_"; static constexpr uint32_t SECONDS_ONEDAY = 86400; static constexpr uint16_t ONT_MIN_STEP_CONTER = 120; -osTimerId_t g_saveEveryMinHandle = NULL; +osTimerId_t g_saveEveryMinHandle = nullptr; void SaveEveryMinCallback(int data); ActivityModel::ActivityModel() @@ -159,13 +158,13 @@ ActivityModel::~ActivityModel() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ActivityModel::~ActivityModel"); StepUnsubscribeTopic(TOPIC_EVENT_STEPDATA_UPDATE); StepUnsubscribeTopic(TOPIC_EVENT_NEXTDAY_UPDATE); - if (g_saveEveryMinHandle != NULL) { + if (g_saveEveryMinHandle != nullptr) { osStatus_t ret = osTimerDelete(g_saveEveryMinHandle); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "~ActivityModel osTimerDelete failed, ret = %lx!!", ret); return; } - g_saveEveryMinHandle = NULL; + g_saveEveryMinHandle = nullptr; } } @@ -209,8 +208,7 @@ static void SaveEveryMinCallbackProc(int data) uint32 savedValue = ActivityModel::GetInstance()->GetLastSavedValue(); if (savedValue != g_stepData1.weekSteps[today]) { struct tm curTime; - time_t second; - second = time(NULL); + time_t second = time(nullptr); (void)gmtime_r((const time_t *)&second, &curTime); ActivityModel::GetInstance()->SaveStepToFile(&curTime); } @@ -225,11 +223,11 @@ void ActivityModel::SetStepData(uint32_t &value) { g_stepData1.weekSteps[weekToday] = value; // 第一次上报数据后打开定时器 - if (g_saveEveryMinHandle != NULL) { + if (g_saveEveryMinHandle != nullptr) { return; } - g_saveEveryMinHandle = osTimerNew((osTimerFunc_t)SaveEveryMinCallback, osTimerPeriodic, NULL, NULL); - if (g_saveEveryMinHandle == NULL) { + g_saveEveryMinHandle = osTimerNew((osTimerFunc_t)SaveEveryMinCallback, osTimerPeriodic, nullptr, nullptr); + if (g_saveEveryMinHandle == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ActivityModel::SetStepData osTimerNew failed!!"); return; } @@ -237,13 +235,13 @@ void ActivityModel::SetStepData(uint32_t &value) osStatus_t retTimer = osTimerStart(g_saveEveryMinHandle, tick); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ActivityModel::SetStepData osTimerStart failed, ret = %lx!!", retTimer); - if (g_saveEveryMinHandle != NULL) { + if (g_saveEveryMinHandle != nullptr) { retTimer = osTimerDelete(g_saveEveryMinHandle); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ActivityModel::SetStepData osTimerDelete ret = %lx!!", retTimer); return; } - g_saveEveryMinHandle = NULL; + g_saveEveryMinHandle = nullptr; } return; } @@ -272,8 +270,7 @@ uint32_t ActivityModel::ZeroHourStepHandle(void) { g_stepData1.weekSteps[weekToday] = stepCounter; struct tm historyTime; - time_t second; - second = time(NULL) - SECONDS_ONEDAY; + time_t second = time(nullptr) - SECONDS_ONEDAY; (void)gmtime_r((const time_t *)&second, &historyTime); SaveStepToFile(&historyTime); stepCounter = 0; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/activity/src/ActivityWeekView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/activity/src/ActivityWeekView.cpp index 3eb986e41..3e880d409 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/activity/src/ActivityWeekView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/activity/src/ActivityWeekView.cpp @@ -69,7 +69,7 @@ ActivityWeekView::ActivityWeekView() ActivityWeekView::~ActivityWeekView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ActivityWeekView::~ActivityWeekView"); - if (viewiInitStatus == true) { + if (viewiInitStatus) { RemoveAll(); for (int i = 0; i < DAYS; i++) { delete view[i]; @@ -110,27 +110,27 @@ ActivityWeekView *ActivityWeekView::GetInstance(void) UIView *ActivityWeekView::CreateUIView(int16_t x, int16_t y) { - UIView *view = new UIView(); - if (view == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ActivityWeekView::InitView view is nullptr"); + UIView *uiView = new UIView(); + if (uiView == nullptr) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ActivityWeekView::InitView uiView is nullptr"); return nullptr; } - view->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x00, 165, 230).full); - view->SetStyle(STYLE_BACKGROUND_OPA, 127); // 127 : background opacity - view->SetStyle(STYLE_BORDER_COLOR, Color::Gray().full); - view->SetStyle(STYLE_BORDER_OPA, 127); // 127 : border opacity - view->SetStyle(STYLE_BORDER_WIDTH, 0); // 0 : border width - view->SetStyle(STYLE_PADDING_LEFT, 0); - view->SetStyle(STYLE_PADDING_RIGHT, 0); - view->SetStyle(STYLE_PADDING_TOP, 0); - view->SetStyle(STYLE_PADDING_BOTTOM, 0); - view->SetStyle(STYLE_MARGIN_LEFT, 0); - view->SetStyle(STYLE_MARGIN_RIGHT, 0); - view->SetStyle(STYLE_MARGIN_TOP, 0); - view->SetStyle(STYLE_MARGIN_BOTTOM, 0); - view->SetPosition(x, y); - view->SetStyle(STYLE_BORDER_RADIUS, UIVIEW_WIDTH / 2 + 10); // 2 : half width 10 : offset - return view; + uiView->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x00, 165, 230).full); + uiView->SetStyle(STYLE_BACKGROUND_OPA, 127); // 127 : background opacity + uiView->SetStyle(STYLE_BORDER_COLOR, Color::Gray().full); + uiView->SetStyle(STYLE_BORDER_OPA, 127); // 127 : border opacity + uiView->SetStyle(STYLE_BORDER_WIDTH, 0); // 0 : border width + uiView->SetStyle(STYLE_PADDING_LEFT, 0); + uiView->SetStyle(STYLE_PADDING_RIGHT, 0); + uiView->SetStyle(STYLE_PADDING_TOP, 0); + uiView->SetStyle(STYLE_PADDING_BOTTOM, 0); + uiView->SetStyle(STYLE_MARGIN_LEFT, 0); + uiView->SetStyle(STYLE_MARGIN_RIGHT, 0); + uiView->SetStyle(STYLE_MARGIN_TOP, 0); + uiView->SetStyle(STYLE_MARGIN_BOTTOM, 0); + uiView->SetPosition(x, y); + uiView->SetStyle(STYLE_BORDER_RADIUS, UIVIEW_WIDTH / 2 + 10); // 2 : half width 10 : offset + return uiView; } void ActivityWeekView::InitSteps() diff --git a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardAdapter.h b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardAdapter.h index 34882c939..8f18d42be 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardAdapter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardAdapter.h @@ -23,13 +23,13 @@ namespace OHOS { class AddCardAdapter : public AbstractAdapter { public: explicit AddCardAdapter(); - virtual ~AddCardAdapter(); + ~AddCardAdapter() override; - virtual uint16 GetCount(void) override; + uint16 GetCount(void) override; - virtual UIView *GetView(UIView *inView, int16 index) override; + UIView *GetView(UIView *inView, int16 index) override; - virtual void AddListItem(const AddCardInfo &item); + void AddListItem(const AddCardInfo &item); void SetItemClickListener(UIView::OnClickListener *itemClickListener) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardItem.h b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardItem.h index 5ce44d585..5325f4e22 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardItem.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardItem.h @@ -23,10 +23,10 @@ typedef struct { const char *cardImg; } AddCardInfo; -class AddCardItem :public UIViewGroup { +class AddCardItem : public UIViewGroup { public: AddCardItem(); - virtual ~AddCardItem(); + ~AddCardItem() override; void SetItemInfo(const AddCardInfo &cardInfo); void SetOnClickListener(OnClickListener *onClickListener); void UpdateItemInfo(bool addFlag); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardModel.h b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardModel.h index ae17e1a0f..9bdf0e41d 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardModel.h @@ -28,7 +28,6 @@ namespace OHOS { AddCardModel &operator=(const AddCardModel &); virtual ~AddCardModel(); uint8_t selectedCardIndex{0}; - }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardPresenter.h index f8e6f885b..ffaebdf7c 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardPresenter.h @@ -12,31 +12,37 @@ #include "components/ui_list.h" #include "components/ui_view.h" #include "KeyInputListener.h" +#include "ModelListenerSample.h" + +#define TOAST_KEEP_TIME 1000 namespace OHOS { static const char *ADD_CARD_ADD = "addcardadd"; + class AddCardView; class AddCardModel; -class AddCardPresenter : public Presenter, +class AddCardPresenter : public Presenter, public ModelListenerSample, public UIView::OnClickListener, public UIView::OnDragListener, public ListScrollListener { public: AddCardPresenter(); - virtual ~AddCardPresenter(); - - virtual void OnStart() override; - virtual void OnResume() override; - virtual void OnStop() override; + ~AddCardPresenter() override; + void OnStart() override; + void OnResume() override; + void OnStop() override; + void OnTickEvent() override; + void Notify() override {} bool OnClick(UIView &view, const ClickEvent &event) override; - virtual void OnScrollStart(int16_t index, UIView *view) override; - virtual void OnScrollEnd(int16_t index, UIView *view) override; - virtual void OnItemSelected(int16_t index, UIView* view) override; - virtual bool OnDrag(UIView& view, const DragEvent& event) override; + void OnScrollStart(int16_t index, UIView *view) override; + void OnScrollEnd(int16_t index, UIView *view) override; + void OnItemSelected(int16_t index, UIView* view) override; + bool OnDrag(UIView& view, const DragEvent& event) override; private: - KeyInputListener *keyActListenr{nullptr}; + void ResetTickTimer(void); AddCardModel *model{nullptr}; - + uint64_t startTime{0}; + bool cardCountEvent{false}; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardView.h b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardView.h index 63d51bba5..6f7e9c34f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/add_card/include/AddCardView.h @@ -26,7 +26,7 @@ class AddCardPresenter; class AddCardView : public View { public: AddCardView(); - virtual ~AddCardView(); + ~AddCardView() override; static AddCardView *GetInstance() { @@ -34,15 +34,18 @@ public: return &instance; } - virtual void OnStart() override; - virtual void OnSetUpView() override; - virtual void OnTearDownView() override; - virtual void OnStop() override; + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; void RefreshCardList(void); + void ExceedsCardCountEvent(bool isVisible); private: void SetUpListInfo(void); void SetUpListView(void); + void SetUpToast(void); UIList contentList_; + UILabel toastLabel_; AddCardAdapter *addCardAdapter_{nullptr}; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/add_card/src/AddCardPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/add_card/src/AddCardPresenter.cpp index 73044d546..158157961 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/add_card/src/AddCardPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/add_card/src/AddCardPresenter.cpp @@ -47,9 +47,15 @@ namespace OHOS { bool AddCardPresenter::OnClick(UIView &view, const ClickEvent &event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AddCardPresenter::OnClick"); - model->AddCardSetting(); - view_->RefreshCardList(); - return true; + if (MainModel::GetInstance().GetCardSettingCount() >= CARD_SETTING_COUNT_MAX) { + cardCountEvent = true; + view_->ExceedsCardCountEvent(true); + ResetTickTimer(); + } else { + model->AddCardSetting(); + view_->RefreshCardList(); + } + return true; } void AddCardPresenter::OnScrollStart(int16_t index, UIView *view) @@ -67,12 +73,30 @@ namespace OHOS { model->SetSelectedCardIndex(index); } - void AddCardPresenter::OnItemSelected(int16_t index, UIView* view) + void AddCardPresenter::OnItemSelected(int16_t index, UIView* view) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AddCardPresenter::OnItemSelected index = %d", index); if (view == nullptr) { return; - } + } + } + + void AddCardPresenter::OnTickEvent() + { + if (cardCountEvent) { + uint64_t current_time = osKernelGetTick2ms(); + if (current_time - startTime > TOAST_KEEP_TIME) { + view_->ExceedsCardCountEvent(false); + cardCountEvent = false; + } + } + return; + } + + void AddCardPresenter::ResetTickTimer(void) + { + startTime = osKernelGetTick2ms(); + return; } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/add_card/src/AddCardView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/add_card/src/AddCardView.cpp index a696032d2..6e87bde5e 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/add_card/src/AddCardView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/add_card/src/AddCardView.cpp @@ -34,6 +34,7 @@ void AddCardView::OnStart() addCardAdapter_->SetItemClickListener(presenter_); SetUpListInfo(); SetUpListView(); + SetUpToast(); } void AddCardView::OnSetUpView() @@ -104,10 +105,31 @@ void AddCardView::SetUpListView(void) container_->Add(&contentList_); } +void AddCardView::SetUpToast(void) +{ + toastLabel_.SetPosition(77, 220); + toastLabel_.Resize(454, 60); + toastLabel_.SetViewId("toast"); + toastLabel_.SetText("卡片数量已经到达上限"); + toastLabel_.SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); + toastLabel_.SetStyle(STYLE_BACKGROUND_OPA, 255); + toastLabel_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); + toastLabel_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + toastLabel_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); + toastLabel_.SetVisible(false); + container_->Add(&toastLabel_); +} + void AddCardView::RefreshCardList(void) { SetUpListInfo(); contentList_.RefreshList(); } +void AddCardView::ExceedsCardCountEvent(bool isVisible) +{ + toastLabel_.SetVisible(isVisible); + toastLabel_.Invalidate(); +} + } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmPopUpPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmPopUpPresenter.h index b842fb41b..27e6bc761 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmPopUpPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmPopUpPresenter.h @@ -54,7 +54,7 @@ class AlarmPopUpPresenter : public Presenter, public UIView::OnC public UIView::OnDragListener, public ModelListenerSample { public: AlarmPopUpPresenter(); - virtual ~AlarmPopUpPresenter(); + ~AlarmPopUpPresenter() override; void OnStart() override; void OnPause() override; void OnResume() override; @@ -63,7 +63,7 @@ public: bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView& view, const DragEvent& event) override; bool OnDragEnd(UIView& view, const DragEvent& event) override; - virtual void Notify() override; + void Notify() override; void CancelAlarmRing(void); void DelayAlarmRing(void); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmPresenter.h index 0c92d5ed1..51730af0b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmPresenter.h @@ -92,9 +92,10 @@ typedef enum { CHANGE_INTERFACE_MAXCLOCK, } InterfacesId; -class AlarmStatusBtnChangeListener : public OHOS::UICheckBox::OnChangeListener { +class AlarmStatusBtnChangeListener : public OHOS::UICheckBox::OnChangeListener +{ public: - AlarmStatusBtnChangeListener(UIView *uiView) + explicit AlarmStatusBtnChangeListener(UIView *uiView) { std::string alarmStatusId = uiView->GetViewId(); std::string alarmCmpId; @@ -117,7 +118,7 @@ class AlarmPresenter : public Presenter, public UIView::OnClickLi public UITimePicker::SelectedListener, public UIView::OnDragListener { public: AlarmPresenter(); - virtual ~AlarmPresenter(); + ~AlarmPresenter() override; void OnStart() override; void OnPause() override; void OnResume() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmSetWeekView.h b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmSetWeekView.h index abf2f3745..1e79d4f63 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmSetWeekView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/AlarmSetWeekView.h @@ -34,7 +34,6 @@ private: UIScrollView *group{nullptr}; UILabelButton *weekImage{nullptr}; UILabel *labelRespeat{nullptr}; - UILabelButton *labelButton{nullptr}; UILabelButton *buttonWeek[7]{nullptr}; // 星期一共有7天,因此设置了七个星期的按钮 void CreateWeekButton1(void); void CreateWeekButton2(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/MainAlarmView.h b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/MainAlarmView.h index 0c6731563..9140a477e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/MainAlarmView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/include/MainAlarmView.h @@ -39,7 +39,7 @@ class AlarmPresenter; class MainAlarmView : public View { public: MainAlarmView(); - virtual ~MainAlarmView(); + ~MainAlarmView() override; static MainAlarmView *GetInstance(void); void OnStart() override; void OnSetUpView() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmClockModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmClockModel.cpp index 3981bf1fb..1941e6096 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmClockModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmClockModel.cpp @@ -90,8 +90,8 @@ int32_t AlarmClockModel::SaveGlobalAlarmToFile(void) int32_t AlarmClockModel::GetAlarmGlobalData(uint8 id, AlarmClockInfo *info) { int32_t ret; - if (info == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetAlarmGlobalData info NULL!!"); + if (info == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetAlarmGlobalData info nullptr!!"); return -1; } if (g_alarmClockData[id].alarmClockId != id) { @@ -120,11 +120,11 @@ void AlarmClockModel::PushAlarmClockData(AlarmClockQueueMsg alarmClockMsg) int32_t AlarmClockModel::FetchedAlarmClockData(AlarmClockQueueMsg *alarmClockMsg) { - if (alarmClockMsg == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FetchedAlarmClockData alarmClockMsg NULL!!"); + if (alarmClockMsg == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FetchedAlarmClockData alarmClockMsg nullptr!!"); return -1; } - if (listAlarmClock.IsEmpty() == true) { + if (listAlarmClock.IsEmpty()) { return -1; } else { MUTEX_Lock(g_alarmClockDataMutex); @@ -299,17 +299,17 @@ bool AlarmClockModel::GetClockListenerTime(uint32_t &alarmGetTime) return true; } -bool AlarmClockModel::GetListenClockId(uint8_t *alarmId) +bool AlarmClockModel::GetListenClockId(uint8_t *alarm) { - if (alarmId == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::GetClockStatus alarmId == nullptr error!"); + if (alarm == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::GetClockStatus alarm == nullptr error!"); } if (currentAlarm[clockListener] == nullptr) { return false; } else if (currentAlarm[clockListener]->alarmType == TYPE_INVALID_ALARM_CLOCK) { return false; } - *alarmId = currentAlarm[clockListener]->alarmClockId; + *alarm = currentAlarm[clockListener]->alarmClockId; return true; } @@ -434,9 +434,9 @@ bool AlarmClockModel::ButtonStatusRing(int16_t num, bool alarmStatus) return false; } uint8 tempAlarmEnable = currentAlarm[num]->alarmClockEnable; - if (alarmStatus == true) { + if (alarmStatus) { currentAlarm[num]->alarmClockEnable = 1; - } else if (alarmStatus == false) { + } else if (!alarmStatus) { currentAlarm[num]->alarmClockEnable = 0; } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::ButtonStatusRing alarm[%d] status is %u", num, @@ -449,7 +449,7 @@ bool AlarmClockModel::ButtonStatusRing(int16_t num, bool alarmStatus) return true; } -void AlarmClockModel::SetDelayAlarm(uint8_t alarmId) +void AlarmClockModel::SetDelayAlarm(uint8_t alarm) { AlarmClockQueueMsg *clockQueueMsg = new AlarmClockQueueMsg(); if (clockQueueMsg == nullptr) { @@ -460,12 +460,12 @@ void AlarmClockModel::SetDelayAlarm(uint8_t alarmId) clockQueueMsg->eventType = EVENT_ALARM_RING_DELAY; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::ButtonStatusRing clockQueueMsg->eventType is %u", clockQueueMsg->eventType); - (clockQueueMsg->data).value = alarmId; + (clockQueueMsg->data).value = alarm; AlmmgrAlarmClockEventProcess(clockQueueMsg); return; } -void AlarmClockModel::SetCancelAlarm(uint8_t alarmId) +void AlarmClockModel::SetCancelAlarm(uint8_t alarm) { AlarmClockQueueMsg *clockQueueMsg = new AlarmClockQueueMsg(); if (clockQueueMsg == nullptr) { @@ -475,7 +475,7 @@ void AlarmClockModel::SetCancelAlarm(uint8_t alarmId) clockQueueMsg->eventType = EVENT_ALARM_RING_CANCEL; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::ButtonStatusRing clockQueueMsg->eventType is %u", clockQueueMsg->eventType); - (clockQueueMsg->data).value = alarmId; + (clockQueueMsg->data).value = alarm; AlmmgrAlarmClockEventProcess(clockQueueMsg); return; } @@ -620,8 +620,6 @@ void AlarmClockModel::GetPopTimeData(int16 *hour, int16 *min) void AlarmClockModel::AlarmGetClockNum() { struct tm curTime; - int32 hour, min; - if (AlarmGetCurrentTimeInfo(&curTime) != 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmTimerCallback AlarmGetCurrentTimeInfo failed!!"); return; @@ -634,8 +632,8 @@ void AlarmClockModel::AlarmGetClockNum() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::AlarmGetClockNum get num(%d)fail!", num); return; } - hour = currentAlarm[num]->alarmTime >> TWO_BYTES_BITS; - min = ((currentAlarm[num]->alarmTime & AND_FOR_LOW_TWO_BYTES) + (currentAlarm[num]->delayNum * DELAY_TEM_MIN)); + int32_t hour = currentAlarm[num]->alarmTime >> TWO_BYTES_BITS; + int32_t min = ((currentAlarm[num]->alarmTime & AND_FOR_LOW_TWO_BYTES) + (currentAlarm[num]->delayNum * DELAY_TEM_MIN)); hour = (hour + min / ONE_HOUR_MIN) % TWENTY_FOUR_HOUR; min = min % ONE_HOUR_MIN; if (curTime.tm_hour == hour && curTime.tm_min == min) { @@ -650,15 +648,14 @@ void AlarmClockModel::AlarmGetClockNum() } } -void AlarmClockModel::GetAlarmCallId(uint8_t *alarmId) +void AlarmClockModel::GetAlarmCallId(uint8_t *alarm) { - if (alarmId == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::alarmId is nullptr!"); + if (alarm == nullptr) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::alarm is nullptr!"); return; } struct tm curTime; - int32 hour, min; if (AlarmGetCurrentTimeInfo(&curTime) != 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmTimerCallback AlarmGetCurrentTimeInfo failed!!"); return; @@ -670,14 +667,14 @@ void AlarmClockModel::GetAlarmCallId(uint8_t *alarmId) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::AlarmGetClockNum get num fail!"); return; } - hour = currentAlarm[num]->alarmTime >> TWO_BYTES_BITS; - min = ((currentAlarm[num]->alarmTime & AND_FOR_LOW_TWO_BYTES) + (currentAlarm[num]->delayNum * DELAY_TEM_MIN)); + int32_t hour = currentAlarm[num]->alarmTime >> TWO_BYTES_BITS; + int32_t min = ((currentAlarm[num]->alarmTime & AND_FOR_LOW_TWO_BYTES) + (currentAlarm[num]->delayNum * DELAY_TEM_MIN)); hour = (hour + min / ONE_HOUR_MIN) % TWENTY_FOUR_HOUR; min = min % ONE_HOUR_MIN; if (curTime.tm_hour == hour && curTime.tm_min == min) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::AlarmGetClockNum %d:%d!", currentAlarm[num]->alarmTime >> TWO_BYTES_BITS, currentAlarm[num]->alarmTime & AND_FOR_LOW_TWO_BYTES); - *alarmId = currentAlarm[num]->alarmClockId; + *alarm = currentAlarm[num]->alarmClockId; return; } } @@ -685,7 +682,7 @@ void AlarmClockModel::GetAlarmCallId(uint8_t *alarmId) void AlarmClockModel::PopInterCancelMusic() { - SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, NULL, 0); + SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, nullptr, 0); GraphicService::GetInstance()->PostGraphicEvent( std::bind(&AlarmClockModel::AlarmPlayerStop, AlarmClockModel::GetInstance())); } @@ -762,7 +759,6 @@ int AlarmClockModel::AlarmPlayerInit(void) std::string strSongName = sliceId; std::string pureName = strSongName.substr(0, strSongName.rfind(".")); // 播放音乐的路径需要引用.号 - const char *songName = pureName.c_str(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayerInit, url:%s ", sliceId); std::string strSrcMusic(APP_MUSIC_PATH); std::string tempStr("/"); @@ -837,14 +833,14 @@ uint16_t AlarmClockModel::JudgePreSlice(void) void AlarmClockModel::DeactAudioInter(void) { bool alarmStatus; - uint8_t alarmId = 0; - alarmStatus = AlarmClockModel::GetInstance()->GetListenClockId(&alarmId); - if (alarmStatus == false) { + uint8_t alarm = 0; + alarmStatus = AlarmClockModel::GetInstance()->GetListenClockId(&alarm); + if (!alarmStatus) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPopUpPresenter::CancelAlarmRing get alarm Id false!"); return; } AlarmClockModel::GetInstance()->ResetRingClockStatus(); - AlarmClockModel::GetInstance()->SetDelayAlarm(alarmId); + AlarmClockModel::GetInstance()->SetDelayAlarm(alarm); PopInterCancelMusic(); } @@ -870,7 +866,7 @@ void AlarmClockModel::AlarmNextDayNotify() { for (uint8_t num = 0; num < CLOCK_MAX; num++) { if (currentAlarm[num] == nullptr || currentAlarm[num]->alarmType == TYPE_INVALID_ALARM_CLOCK) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::currentAlarm[%u] is NULL"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::currentAlarm[%u] is nullptr"); return; } currentAlarm[num]->delayNum = 0; @@ -883,23 +879,23 @@ void AlarmClockModel::AlarmClockNotify() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::AlarmClockNotify"); - if (PlayersModel::GetInstance()->GetAudioInitStatus() == false) { + if (!PlayersModel::GetInstance()->GetAudioInitStatus()) { PlayersModel::GetInstance()->AudioInit(); } int32_t timeout = -1; SendMsgToUIService(SCREEN_TURN_ON_TO_UI, 0, &timeout, sizeof(int32_t)); AlarmGetClockNum(); - NativeAbility::GetInstance().ChangeSlice(VIEW_ALARM_POP_UP, TRANSITION_INVALID, PRIORITY_TWO); + NativeAbility::GetInstance().ChangeSlice(VIEW_ALARM_POP_UP, TransitionType::TRANSITION_INVALID, PRIORITY_TWO); return; } void AlarmClockModel::PhoneCallAlarm() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::PhoneCallAlarm"); - uint8_t alarmId = 0; + uint8_t alarm = 0; OHOS::AlarmClockModel::GetInstance()->AlarmGetClockNum(); - OHOS::AlarmClockModel::GetInstance()->GetAlarmCallId(&alarmId); - OHOS::AlarmClockModel::GetInstance()->SetDelayAlarm(alarmId); + OHOS::AlarmClockModel::GetInstance()->GetAlarmCallId(&alarm); + OHOS::AlarmClockModel::GetInstance()->SetDelayAlarm(alarm); } uint32 AlarmClockModel::GetAlarmData() @@ -948,7 +944,7 @@ static void Stop(void) bool alarmStatus; AlarmClockModel::GetInstance()->PopInterCancelMusic(); alarmStatus = AlarmClockModel::GetInstance()->GetListenClockId(&alarmId); - if (alarmStatus == false) { + if (!alarmStatus) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPlayerListener::CancelAlarmRing get alarm Id false!"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmCloseRingView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmCloseRingView.cpp index ccf0f649d..a2ef8afca 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmCloseRingView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmCloseRingView.cpp @@ -17,7 +17,7 @@ namespace OHOS { #define CLOSE "关闭" -osTimerId_t g_stopAlarmCloseHandle = NULL; +osTimerId_t g_stopAlarmCloseHandle = nullptr; static AlarmCloseRingView *g_pAlarmCloseRingView = nullptr; constexpr int16_t MAX_SET_ZERO_LEN = 0; constexpr int16_t MAX_SET_SRC_LEN = 90; @@ -99,13 +99,13 @@ UIViewGroup *AlarmCloseRingView::InitCloseRingView(void) void AlarmCloseRingView::CancelCloseHandle(void) { - if (g_stopAlarmCloseHandle != NULL) { + if (g_stopAlarmCloseHandle != nullptr) { osStatus_t ret = osTimerDelete(g_stopAlarmCloseHandle); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CloseTimerCallback osTimerDelete failed, ret = %lx!!", ret); return; } - g_stopAlarmCloseHandle = NULL; + g_stopAlarmCloseHandle = nullptr; } } @@ -134,8 +134,8 @@ void CloseTimerCallback(int data) void AlarmCloseRingView::AlarmCloseShowTimer(void) { - g_stopAlarmCloseHandle = osTimerNew((osTimerFunc_t)CloseTimerCallback, osTimerPeriodic, NULL, NULL); - if (g_stopAlarmCloseHandle == NULL) { + g_stopAlarmCloseHandle = osTimerNew((osTimerFunc_t)CloseTimerCallback, osTimerPeriodic, nullptr, nullptr); + if (g_stopAlarmCloseHandle == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock::AlarmCloseShowTimer osTimerNew failed!!"); return; } @@ -143,13 +143,13 @@ void AlarmCloseRingView::AlarmCloseShowTimer(void) osStatus_t retTimer = osTimerStart(g_stopAlarmCloseHandle, tick); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock::AlarmCloseShowTimer osTimerStart failed, ret = %lx!!", retTimer); - if (g_stopAlarmCloseHandle != NULL) { + if (g_stopAlarmCloseHandle != nullptr) { retTimer = osTimerDelete(g_stopAlarmCloseHandle); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock::AlarmCloseShowTimer osTimerDelete failed, ret = %lx!!", retTimer); return; } - g_stopAlarmCloseHandle = NULL; + g_stopAlarmCloseHandle = nullptr; } return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmConfigView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmConfigView.cpp index b5d4e8f99..171caef71 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmConfigView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmConfigView.cpp @@ -112,13 +112,13 @@ AlarmConfigView *AlarmConfigView::GetInstance(void) UILabel *AlarmConfigView::CreateConfigLabel(const char *buttonText, int16_t labelFont, int16_t x, int16_t y, int16_t width) { if (buttonText == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: buttonText NULL!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: buttonText nullptr!"); return nullptr; } UILabel *label = nullptr; label = new UILabel(); if (label == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: CreateConfigLabel return NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView:: CreateConfigLabel return nullptr"); return nullptr; } label->SetFont(DEFAULT_VECTOR_FONT_FILENAME, labelFont); @@ -175,7 +175,7 @@ void AlarmConfigView::CreateConfigButton(void) configScroll->Add(editLabel); UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::AlarmPresenter::GetInstance(); if (clickListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView::OnStart clickListener NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmConfigView::OnStart clickListener nullptr"); return; } labelTime = new UIDigitalClock(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmMaxClock.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmMaxClock.cpp index 85028b183..823ff674f 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmMaxClock.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmMaxClock.cpp @@ -16,7 +16,7 @@ namespace OHOS { #define MAX_INETERFACES "当前闹钟个数已达上限" #define INTERFACE_ID "maxclock" -osTimerId_t g_stopAlarmMaxHandle = NULL; +osTimerId_t g_stopAlarmMaxHandle = nullptr; static AlarmMaxClock *g_AlarmMaxClock = nullptr; static constexpr uint64_t MS_THREE_SECONDS = 3000; void ScanTimerCallback(int data); @@ -59,7 +59,7 @@ AlarmMaxClock *AlarmMaxClock::GetInstance(void) return g_AlarmMaxClock; } -UIScrollView * AlarmMaxClock::InitAlarmMax(void) +UIScrollView *AlarmMaxClock::InitAlarmMax(void) { container = new UIScrollView(); if (container == nullptr) { @@ -83,7 +83,7 @@ UIScrollView * AlarmMaxClock::InitAlarmMax(void) container->SetDraggable(true); UIView::OnDragListener *maxClockDragListener = (UIView::OnDragListener *)OHOS::AlarmPresenter::GetInstance(); if (maxClockDragListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock:: maxClockDragListener is NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock:: maxClockDragListener is nullptr"); return container; } container->SetOnDragListener(maxClockDragListener); @@ -94,13 +94,13 @@ UIScrollView * AlarmMaxClock::InitAlarmMax(void) void CancelScanHandle(void) { - if (g_stopAlarmMaxHandle != NULL) { + if (g_stopAlarmMaxHandle != nullptr) { osStatus_t ret = osTimerDelete(g_stopAlarmMaxHandle); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret); return; } - g_stopAlarmMaxHandle = NULL; + g_stopAlarmMaxHandle = nullptr; } } @@ -124,8 +124,8 @@ void ScanTimerCallback(int data) void AlarmMaxClock::AlarmMaxDelayExit(void) { - g_stopAlarmMaxHandle = osTimerNew((osTimerFunc_t)ScanTimerCallback, osTimerPeriodic, NULL, NULL); - if (g_stopAlarmMaxHandle == NULL) { + g_stopAlarmMaxHandle = osTimerNew((osTimerFunc_t)ScanTimerCallback, osTimerPeriodic, nullptr, nullptr); + if (g_stopAlarmMaxHandle == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock::AlarmMaxDelayExit osTimerNew failed!!"); return; } @@ -133,13 +133,13 @@ void AlarmMaxClock::AlarmMaxDelayExit(void) osStatus_t retTimer = osTimerStart(g_stopAlarmMaxHandle, tick); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock::AlarmMaxDelayExit osTimerStart failed, ret = %lx!!", retTimer); - if (g_stopAlarmMaxHandle != NULL) { + if (g_stopAlarmMaxHandle != nullptr) { retTimer = osTimerDelete(g_stopAlarmMaxHandle); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock::AlarmMaxDelayExit osTimerDelete failed, ret = %lx!!", retTimer); return; } - g_stopAlarmMaxHandle = NULL; + g_stopAlarmMaxHandle = nullptr; } return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmNewTimeView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmNewTimeView.cpp index dda985dd1..93a205b55 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmNewTimeView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmNewTimeView.cpp @@ -104,7 +104,7 @@ void AlarmNewTimeView::CreateLabelTime(void) UITimePicker::SelectedListener *selectedListener = (UITimePicker::SelectedListener *)OHOS::AlarmPresenter::GetInstance(); if (selectedListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateLabelTime:: selectedListener is NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateLabelTime:: selectedListener is nullptr"); return; } picker->EnableSecond(false); @@ -167,13 +167,13 @@ void AlarmNewTimeView::RefreshNewTime(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmNewTimeView::RefreshStep"); struct tm local_time; - time_t seconds = time(NULL); - - if (localtime_r(&seconds, &local_time) == NULL) { + time_t seconds = time(nullptr); + if (localtime_r(&seconds, &local_time) == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmClockModel::AlarmGetClockNum get localtime error!"); return; } - std::ostringstream ostrHour, ostMin; + std::ostringstream ostrHour; + std::ostringstream ostMin; ostrHour << local_time.tm_hour; ostMin << local_time.tm_min; std::string weekStr = ostrHour.str() + ":" + ostMin.str(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPopUpPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPopUpPresenter.cpp index 04327b6f4..6b1f76ba1 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPopUpPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPopUpPresenter.cpp @@ -56,7 +56,7 @@ void AlarmPopUpPresenter::CancelAlarmRing() bool alarmStatus; AlarmClockModel::GetInstance()->PopInterCancelMusic(); alarmStatus = AlarmClockModel::GetInstance()->GetListenClockId(&alarmId); - if (alarmStatus == false) { + if (!alarmStatus) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPopUpPresenter::CancelAlarmRing get alarm Id false!"); return; } @@ -70,7 +70,7 @@ void AlarmPopUpPresenter::DelayAlarmRing() bool alarmStatus; AlarmClockModel::GetInstance()->PopInterCancelMusic(); alarmStatus = AlarmClockModel::GetInstance()->GetListenClockId(&alarmId); - if (alarmStatus == false) { + if (!alarmStatus) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmPopUpPresenter::DelayAlarmRing get alarm Id false!"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPopUpView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPopUpView.cpp index 396017984..da6b88b8d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPopUpView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPopUpView.cpp @@ -78,8 +78,7 @@ void AlarmPopUpView::AlarmCreateLabel(void) return; } struct tm local_time; - time_t seconds = time(NULL); - int16 thisHour, thisMin; + time_t seconds = time(nullptr); labelPopup->SetPosition(LABEL_X, LABEL_Y, LABEL_WIDTH, LABEL_HEIGHT); labelPopup->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); @@ -94,10 +93,13 @@ void AlarmPopUpView::AlarmCreateLabel(void) dClock->SetPosition(CLOCK_X, CLOCK_Y); dClock->Resize(DIGITAL_CLOCK_WIDTH, DIGITAL_CLOCK_HEIGHT); dClock->SetFont(DEFAULT_VECTOR_FONT_FILENAME, CLOCK_FONT); - if (localtime_r(&seconds, &local_time) == NULL) { + if (localtime_r(&seconds, &local_time) == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPopUpView::AlarmCreateLabel get localtime error!"); return; } + + int16_t thisHour; + int16_t thisMin; AlarmClockModel::GetInstance()->GetPopTimeData(&thisHour, &thisMin); dClock->SetDisplayMode(UIDigitalClock::DISPLAY_24_HOUR_NO_SECONDS); dClock->SetTime24Hour(thisHour, thisMin, 0); @@ -243,4 +245,4 @@ void AlarmPopUpView::ChangeView(int16_t hideView, int16_t showView) } } - }// namespace OHOS +} diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp index 976a2695b..193680182 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmPresenter.cpp @@ -109,7 +109,7 @@ void AlarmPresenter::ClickSetTime(uint16_t num) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter VIEW_ALARM_SET_TIME"); UNUSED(num); uint32_t clockTime; - if ((AlarmClockModel::GetInstance()->GetClockTime(alarmListener, &clockTime)) == false) { + if (!(AlarmClockModel::GetInstance()->GetClockTime(alarmListener, &clockTime))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickSetTime error"); return; } @@ -130,7 +130,7 @@ void AlarmPresenter::ClickSetWeek(uint16_t num) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter VIEW_ALARM_SET_WEEK"); UNUSED(num); uint8_t clockWeek; - if ((AlarmClockModel::GetInstance()->GetClockWeek(alarmListener, &clockWeek)) == false) { + if (!(AlarmClockModel::GetInstance()->GetClockWeek(alarmListener, &clockWeek))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickSetWeek error"); return; } @@ -184,7 +184,7 @@ void AlarmPresenter::ClickJudgeTrue(uint16_t num) MainAlarmView::GetInstance()->RefreshAlarm(); clockQty--; for (uint16_t alarmNum = 0; alarmNum < clockQty; alarmNum++) { - if ((AlarmClockModel::GetInstance()->GetClockTime(alarmNum, &clockTime)) == false) { + if (!(AlarmClockModel::GetInstance()->GetClockTime(alarmNum, &clockTime))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickJudgeTrue error"); return; } @@ -201,7 +201,7 @@ void AlarmPresenter::ClickAlarmTimeOk(uint16_t num) AlarmClockModel::GetInstance()->SetAlarmTime(timeHour, timeMin, alarmListener); uint32_t clockTime = ((timeHour << 16) | timeMin); // 闹钟时间小时的存储位需要右移16位 uint8_t clockWeek; - if ((AlarmClockModel::GetInstance()->GetClockWeek(alarmListener, &clockWeek)) == false) { + if (!(AlarmClockModel::GetInstance()->GetClockWeek(alarmListener, &clockWeek))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickAlarmTimeOk error"); return; } @@ -232,11 +232,11 @@ void AlarmPresenter::ClickAlarmClock(uint16_t num) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter alarmListener = %u", alarmListener); uint32_t clockTime; uint8_t clockWeek; - if ((AlarmClockModel::GetInstance()->GetClockTime(alarmListener, &clockTime)) == false) { + if (!(AlarmClockModel::GetInstance()->GetClockTime(alarmListener, &clockTime))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickAlarmClock error"); return; } - if ((AlarmClockModel::GetInstance()->GetClockWeek(alarmListener, &clockWeek)) == false) { + if (!(AlarmClockModel::GetInstance()->GetClockWeek(alarmListener, &clockWeek))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickAlarmClock error"); return; } @@ -263,7 +263,7 @@ void AlarmPresenter::ClickAlarmWeekOk(uint16_t num) if (setListener == SET_TIME_LISTENER) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClickAlarmWeekOk set time!"); - if ((AlarmClockModel::GetInstance()->GetClockTime(alarmListener, &clockTime)) == false) { + if (!(AlarmClockModel::GetInstance()->GetClockTime(alarmListener, &clockTime))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickAlarmWeekOk error"); return; } @@ -285,7 +285,7 @@ void AlarmPresenter::ClickAlarmWeekOk(uint16_t num) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "******************ClickAlarmWeekOk alarmListener = %d***************", alarmListener); AlarmClockModel::GetInstance()->SetSerialAdd(); AlarmClockModel::GetInstance()->SetAlarmInfo(timeHour, timeMin, clockWeek, alarmListener, setListener); - if ((AlarmClockModel::GetInstance()->GetClockTime(alarmListener, &clockTime)) == false) { + if (!(AlarmClockModel::GetInstance()->GetClockTime(alarmListener, &clockTime))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter ClickAlarmWeekOk error"); return; } @@ -433,7 +433,7 @@ bool AlarmPresenter::OnClick(UIView &view, const ClickEvent &event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmPresenter::OnClick "); bool jug = ClickFuncId(view.GetViewId()); - if (jug == false) { + if (!jug) { ClickFuncView(view); } return true; @@ -441,7 +441,7 @@ bool AlarmPresenter::OnClick(UIView &view, const ClickEvent &event) bool AlarmStatusBtnChangeListener::OnChange(UICheckBox::UICheckBoxState state) { - if (MainAlarmView::GetInstance()->GetRefreshStatus() == true) { + if (MainAlarmView::GetInstance()->GetRefreshStatus()) { return true; } switch (state) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmRingView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmRingView.cpp index 1c063fbc8..726a58797 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmRingView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmRingView.cpp @@ -17,7 +17,7 @@ namespace OHOS { #define RING_AGAIN "响铃将在十分钟后再次响起" -osTimerId_t g_stopAlarmRingHandle = NULL; +osTimerId_t g_stopAlarmRingHandle = nullptr; static AlarmRingView *g_pAlarmRingView = nullptr; constexpr int16_t SET_ZERO = 0; constexpr int16_t SET_SRC = 150; @@ -97,13 +97,13 @@ UIViewGroup *AlarmRingView::InitRingView(void) void AlarmRingView::CancelTimerHandle(void) { - if (g_stopAlarmRingHandle != NULL) { + if (g_stopAlarmRingHandle != nullptr) { osStatus_t ret = osTimerDelete(g_stopAlarmRingHandle); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret); return; } - g_stopAlarmRingHandle = NULL; + g_stopAlarmRingHandle = nullptr; } } @@ -123,8 +123,8 @@ void RingTimerCallbacks(int data) void AlarmRingView::AlarmRingDelayShowtimer(void) { - g_stopAlarmRingHandle = osTimerNew((osTimerFunc_t)RingTimerCallbacks, osTimerPeriodic, NULL, NULL); - if (g_stopAlarmRingHandle == NULL) { + g_stopAlarmRingHandle = osTimerNew((osTimerFunc_t)RingTimerCallbacks, osTimerPeriodic, nullptr, nullptr); + if (g_stopAlarmRingHandle == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock::AlarmRingDelayShowtimer osTimerNew failed!!"); return; } @@ -132,13 +132,13 @@ void AlarmRingView::AlarmRingDelayShowtimer(void) osStatus_t retTimer = osTimerStart(g_stopAlarmRingHandle, tick); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock::AlarmRingDelayShowtimer osTimerStart failed, ret = %lx!!", retTimer); - if (g_stopAlarmRingHandle != NULL) { + if (g_stopAlarmRingHandle != nullptr) { retTimer = osTimerDelete(g_stopAlarmRingHandle); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmMaxClock::AlarmRingDelayShowtimer osTimerDelete failed, ret = %lx!!", retTimer); return; } - g_stopAlarmRingHandle = NULL; + g_stopAlarmRingHandle = nullptr; } return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmSetTimeView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmSetTimeView.cpp index b462b75c9..6d04e328f 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmSetTimeView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmSetTimeView.cpp @@ -132,7 +132,7 @@ UIScrollView *AlarmSetTimeView::InitSetTimeView(void) UITimePicker::SelectedListener *selectedListener = (UITimePicker::SelectedListener *)OHOS::AlarmPresenter::GetInstance(); if (selectedListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetTimeView:: selectedListener is NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetTimeView:: selectedListener is nullptr"); return nullptr; } picker->EnableSecond(false); @@ -152,7 +152,7 @@ UIScrollView *AlarmSetTimeView::InitSetTimeView(void) group->SetDraggable(true); UIView::OnDragListener *setTimeDragListener = (UIView::OnDragListener *)OHOS::AlarmPresenter::GetInstance(); if (setTimeDragListener == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetTimeView:: setTimeDragListener is NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetTimeView:: setTimeDragListener is nullptr"); return group; } group->SetOnDragListener(setTimeDragListener); @@ -172,7 +172,7 @@ void AlarmSetTimeView::RefreshSetTime(uint32_t time) } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetTimeView::RefreshStep 35353535!"); picker->SetSelected(pickerTime.c_str()); - if (picker->SetSelected(pickerTime.c_str()) == false) { + if (!picker->SetSelected(pickerTime.c_str())) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmSetTimeView::RefreshStep Timepicker error!"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmSetWeekView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmSetWeekView.cpp index df9e819d2..397430b78 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmSetWeekView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/AlarmSetWeekView.cpp @@ -77,8 +77,6 @@ AlarmSetWeekView::~AlarmSetWeekView() group->RemoveAll(); delete labelRespeat; labelRespeat = nullptr; - delete labelButton; - labelButton = nullptr; delete weekImage; weekImage = nullptr; for (int16_t alarmNum = 0; alarmNum < 7; alarmNum++) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/MainAlarmView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/MainAlarmView.cpp index 45532fe06..f6da8212c 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/MainAlarmView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarm/src/MainAlarmView.cpp @@ -164,7 +164,6 @@ void MainAlarmView::NewClockCtl(int16_t alarmNum) statusButton[0]->SetPosition(STATUS_BUTTON_X, alarmPositionY, STATUS_BUTTON_W, STATUS_BUTTON_H); } else { statusButton[alarmNum]->SetPosition(STATUS_BUTTON_X, statusButton[0]->GetY() + (alarmInterval * alarmNum), STATUS_BUTTON_W, STATUS_BUTTON_H); - } statusButton[alarmNum]->SetStyle(STYLE_BACKGROUND_OPA, alarmNum); UICheckBox::OnChangeListener *statusListener{nullptr}; @@ -301,17 +300,17 @@ void MainAlarmView::RefreshAlarm(void) int16_t i; for (i = 0; i < CLOCK_MAX_NUM; i++) { alarmStatus = AlarmClockModel::GetInstance()->GetClockTime(i, &alarmTime); - if (alarmStatus == false) { + if (!alarmStatus) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: GetClockTime fail! i = %d", i); break; } alarmStatus = AlarmClockModel::GetInstance()->GetClockWeek(i, &alarmWeek); - if (alarmStatus == false) { + if (!alarmStatus) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: GetClockWeek fail! i = %d", i); break; } alarmStatus = AlarmClockModel::GetInstance()->GetClockStatus(i, &alarmEnable); - if (alarmStatus == false) { + if (!alarmStatus) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: GetClockStatus fail! i = %d", i); break; } @@ -509,7 +508,7 @@ bool MainAlarmView::ClickFunc(int16_t interface) for (int i = 0; i < funcSize; i++) { if (interface == ViewMapper[i].viewId) { bool jug = (this->*(ViewMapper[i].func))(interface); - if (jug == false) { + if (!jug) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: ChangeInterFace[%d] false", interface); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarmclockmanage/include/AlarmClockManage.h b/code/sdk/application/wearable/nativeapp/nativeui/alarmclockmanage/include/AlarmClockManage.h index c2336587f..869857e5e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarmclockmanage/include/AlarmClockManage.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarmclockmanage/include/AlarmClockManage.h @@ -7,10 +7,10 @@ #ifndef ALARM_CLOCK_MANAGE_H #define ALARM_CLOCK_MANAGE_H -#include -#include -#include -#include +#include +#include +#include +#include #include "ohos_types.h" #include "AlarmClockTimerConfig.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarmclockmanage/src/AlarmClockManage.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarmclockmanage/src/AlarmClockManage.cpp index 8c99e8e7e..5ce9f8636 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarmclockmanage/src/AlarmClockManage.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarmclockmanage/src/AlarmClockManage.cpp @@ -6,11 +6,11 @@ #include #include -#include -#include +#include +#include #include #include -#include +#include #include #include "wearable_log.h" @@ -137,8 +137,8 @@ static int32 CreateListAlarmTodaySmart(void) if (g_alarmClockManagement.smartAlarmCnt > 0) { /* 该闹钟今天是否使能判断 */ - if (IsAlarmClockValidToday(&g_alarmClockManagement.smartAlarmInfo) == true && - g_alarmClockManagement.smartAlarmInfo.alarmClockEnable == true) { + if (IsAlarmClockValidToday(&g_alarmClockManagement.smartAlarmInfo) && + g_alarmClockManagement.smartAlarmInfo.alarmClockEnable) { (void)memset_s(&info, size, 0, size); info.alarmType = g_alarmClockManagement.smartAlarmInfo.alarmType; @@ -168,8 +168,8 @@ static int32 CreateListAlarmTodayEvent(void) for (i = 0; i < EVENT_ALARM_CLOCK_MAX; i++) { /* 该闹钟今天是否使能判断 */ - if (IsAlarmClockValidToday(&g_alarmClockManagement.eventAlarmInfo[i]) == true && - g_alarmClockManagement.eventAlarmInfo[i].alarmClockEnable == true) { + if (IsAlarmClockValidToday(&g_alarmClockManagement.eventAlarmInfo[i]) && + g_alarmClockManagement.eventAlarmInfo[i].alarmClockEnable) { (void)memset_s(&info, size, 0, size); info.alarmType = g_alarmClockManagement.eventAlarmInfo[i].alarmType; @@ -221,8 +221,8 @@ static int32 AlarmInfoCheck(const AlarmClockInfo *alarmInfo) uint16 hour; uint16 min; - if (alarmInfo == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmInfoCheck alarmInfo NULL!!"); + if (alarmInfo == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmInfoCheck alarmInfo nullptr!!"); return STATUS_POINTER_NULL; } @@ -256,7 +256,7 @@ static int32 AddAndUpdataListAlarmToday(const AlarmClockInfo *alarmInfo) return ret; } /* 将指定闹钟信息加入当天闹钟列表 */ - if (IsAlarmClockValidToday(alarmInfo) == false || alarmInfo->alarmClockEnable == false) { + if (!IsAlarmClockValidToday(alarmInfo) || (!alarmInfo->alarmClockEnable)) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AddAndUpdataListAlarmToday alarmInfo invalid today!!"); return STATUS_OK; } @@ -293,7 +293,7 @@ static int32 UpdataListAlarmToday(const AlarmClockInfo *alarmInfo) /* 将指定ID的闹钟信息刷新 */ for (node = g_alarmTodayList.begin(); node != g_alarmTodayList.end(); node++) { if (node->alarmClockId == alarmInfo->alarmClockId) { - if (IsAlarmClockValidToday(alarmInfo) == true && alarmInfo->alarmClockEnable == true) { + if (IsAlarmClockValidToday(alarmInfo) && alarmInfo->alarmClockEnable) { node->alarmTime = alarmInfo->alarmTime + alarmInfo->delayNum * MINS_EVERY_DELAY; node->alarmTime = (((node->alarmTime >> TWO_BYTES_BITS) + (node->alarmTime & AND_FOR_LOW_TWO_BYTES) / MINUTES_PER_HOUR) << TWO_BYTES_BITS) + @@ -367,10 +367,10 @@ static void EventAlarmRingProcess(void) static int32 SetFirstAlarmToday(FirstAlarmTodaySetType type) { - int32 ret; struct tm curTime; FirstAlarmTodaySetType tempType = type; - std::list< AlarmClockInfoToday>::iterator node, tempNode; + std::list< AlarmClockInfoToday>::iterator node; + std::list< AlarmClockInfoToday>::iterator tempNode; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetFirstAlarmToday !!"); if (AlarmGetCurrentTimeInfo(&curTime) != 0) { @@ -498,7 +498,7 @@ void AlmmgrInitManagement(void) void AlmmgrAlarmClockEventProcess(const AlarmClockQueueMsg *alarmClockMsg) { - if (alarmClockMsg == NULL) { + if (alarmClockMsg == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlmmgrAlarmClockEventProcess alarmClockMsg is invalid!!"); return; } @@ -683,8 +683,8 @@ int32 AlmmgrGetManagement(AlarmClockManagement *management) int32 ret; uint32 size = sizeof(AlarmClockManagement); - if (management == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlmmgrGetManagement management NULL!!"); + if (management == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlmmgrGetManagement management nullptr!!"); return STATUS_POINTER_NULL; } @@ -715,8 +715,8 @@ int32 GetEventAlarmInfo(uint8 id, AlarmClockInfo *info) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetEventAlarmInfo id invalid!!"); return STATUS_ALARM_ID_INVALID; } - if (info == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetEventAlarmInfo info NULL!!"); + if (info == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetEventAlarmInfo info nullptr!!"); return STATUS_POINTER_NULL; } @@ -733,8 +733,8 @@ int32 GetSmartAlarmInfo(AlarmClockInfo *info) int32 ret; uint32 size = sizeof(AlarmClockInfo); - if (info == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetSmartAlarmInfo info NULL!!"); + if (info == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetSmartAlarmInfo info nullptr!!"); return STATUS_POINTER_NULL; } @@ -785,12 +785,12 @@ int32 SetDatetime(int32 argc, char *argv[]) struct tm setTime; struct timeval timeVal; struct timezone timeZone; - char *endPtr = NULL; + char *endPtr = nullptr; int32 trans[DATETIME_PARA_NUM]; /* 0, 5, 8, 11, 14, 17 are offset of year, month, day, hour, minute, second */ uint32 offset[DATETIME_PARA_NUM] = {0, 5, 8, 11, 14, 17}; - if (argc != 1 || argv[0] == NULL) { + if (argc != 1 || argv[0] == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "set_datetime para invalid!!"); goto help; } @@ -850,7 +850,7 @@ int32 DispDatetime(void) struct tm curTime; time_t second; - second = time(NULL); + second = time(nullptr); (void)gmtime_r((const time_t *)&second, &curTime); ret = strftime(buff, sizeof(buff), "%A %c", &curTime); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp index 2e557750c..56ba901ed 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp @@ -4,9 +4,9 @@ * Create: 2021-09-22 */ -#include +#include #include -#include +#include #include "wearable_log.h" #include "securec.h" #include "broadcast_service.h" @@ -24,21 +24,21 @@ extern "C" { static AlarmCtrl g_alarmCtrA; static AlarmCtrl g_alarmCtrB; -static osTimerId_t g_AlarmHandle = NULL; +static osTimerId_t g_AlarmHandle = nullptr; void AlarmTimerEventPublish(uint16 topic, AlarmClockEventData data) { int32 ret; uint32 size = sizeof(AlarmClockEventData); - Request *request = NULL; - BroadcastApi *broadcastApi = NULL; - IUnknown *api = NULL; + Request *request = nullptr; + BroadcastApi *broadcastApi = nullptr; + IUnknown *api = nullptr; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmTimerEventPublish topic=%u!!", topic); /* alloc request */ request = SAMGR_AllocRequestMsg(0, PLATFORM_CORE, BROADCAST_SVR_ID, size); - if (request == NULL) { + if (request == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SAMGR_AllocRequestMsg failed"); return; } @@ -53,13 +53,13 @@ void AlarmTimerEventPublish(uint16 topic, AlarmClockEventData data) /* public request */ api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); - if (api == NULL) { + if (api == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetFeatureApi failed"); SAMGR_FreeRequestMsg(request); return; } ret = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi); - if (ret != 0 || broadcastApi == NULL) { + if (ret != 0 || broadcastApi == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QueryInterface failed"); SAMGR_FreeRequestMsg(request); return; @@ -97,7 +97,7 @@ void AlarmScan(void *arg) } if (g_alarmCtrA.state == ALARM_STATUS_RUNNING) { - if ((g_alarmCtrA.callback != NULL) && + if ((g_alarmCtrA.callback != nullptr) && (g_alarmCtrA.info.hour == curTime.tm_hour) && (g_alarmCtrA.info.minute == curTime.tm_min)) { g_alarmCtrA.callback(); @@ -106,7 +106,7 @@ void AlarmScan(void *arg) } if (g_alarmCtrB.state == ALARM_STATUS_RUNNING) { - if ((g_alarmCtrB.callback != NULL) && + if ((g_alarmCtrB.callback != nullptr) && (g_alarmCtrB.info.week == curTime.tm_wday) && (g_alarmCtrB.info.hour == curTime.tm_hour) && (g_alarmCtrB.info.minute == curTime.tm_min)) { @@ -118,7 +118,7 @@ void AlarmScan(void *arg) static int32_t AlarmCreate(AlarmCtrl *alarmCtrl, AlarmCallBack callback) { - if (alarmCtrl == NULL) { + if (alarmCtrl == nullptr) { return ERRCODE_FAIL; } if (alarmCtrl->state == ALARM_STATUS_UNUSED) { @@ -135,8 +135,8 @@ int32_t AlarmTimerInit(void) g_alarmCtrA.state = ALARM_STATUS_UNUSED; g_alarmCtrB.state = ALARM_STATUS_UNUSED; - g_AlarmHandle = osTimerNew(AlarmScan, osTimerPeriodic, NULL, NULL); - if (g_AlarmHandle == NULL) { + g_AlarmHandle = osTimerNew(AlarmScan, osTimerPeriodic, nullptr, nullptr); + if (g_AlarmHandle == nullptr) { return ERRCODE_FAIL; } timerStatus = osTimerStart(g_AlarmHandle, ALARM_INTERVAL_MS); @@ -185,10 +185,10 @@ int32_t SetZeroAlarm(void) int32_t AlarmGetCurrentTimeInfo(struct tm *timeInfo) { - if (timeInfo == NULL) { + if (timeInfo == nullptr) { return ERRCODE_FAIL; } - time_t sec = time(NULL); + time_t sec = time(nullptr); localtime_r(&sec, timeInfo); return ERRCODE_SUCC; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBarCode.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBarCode.h index 67cacbbec..12426d62e 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBarCode.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBarCode.h @@ -17,8 +17,8 @@ namespace OHOS { class AlipayBarCode : public UIViewGroup { public: - AlipayBarCode(AlipayPresenter *presenter); - virtual ~AlipayBarCode(); + explicit AlipayBarCode(AlipayPresenter *presenter); + ~AlipayBarCode() override; static AlipayBarCode *GetInstance(); bool InitView(); void AlipayRefreshBarcode(const char *refreshStr); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBind.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBind.h index 9adcaeecc..bfe2153e8 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBind.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBind.h @@ -17,8 +17,8 @@ namespace OHOS { class AlipayBind : public UIViewGroup { public: - AlipayBind(AlipayPresenter *presenter); - virtual ~AlipayBind(); + explicit AlipayBind(AlipayPresenter *presenter); + ~AlipayBind() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBindAni.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBindAni.h index 959709d4a..ea2cc5820 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBindAni.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBindAni.h @@ -19,8 +19,8 @@ namespace OHOS { class AlipayBindAni : public UIViewGroup { public: - AlipayBindAni(AlipayPresenter *presenter); - virtual ~AlipayBindAni(); + explicit AlipayBindAni(AlipayPresenter *presenter); + ~AlipayBindAni() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBindRes.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBindRes.h index 9d4585959..5b7f9a6a0 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBindRes.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayBindRes.h @@ -16,8 +16,8 @@ namespace OHOS { class AlipayBindRes : public UIViewGroup { public: - AlipayBindRes(AlipayPresenter *presenter); - virtual ~AlipayBindRes(); + explicit AlipayBindRes(AlipayPresenter *presenter); + ~AlipayBindRes() override; bool InitView(); void AlipayRefreshBindRes(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayExitBind.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayExitBind.h index 48233ff7f..4b9321a60 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayExitBind.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayExitBind.h @@ -16,8 +16,8 @@ namespace OHOS { class AlipayExitBind : public UIViewGroup { public: - AlipayExitBind(AlipayPresenter *presenter); - virtual ~AlipayExitBind(); + explicit AlipayExitBind(AlipayPresenter *presenter); + ~AlipayExitBind() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayHelp.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayHelp.h index a1802fdfe..350da2143 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayHelp.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayHelp.h @@ -17,8 +17,8 @@ namespace OHOS { class AlipayHelp : public UIViewGroup { public: - AlipayHelp(AlipayPresenter *presenter); - virtual ~AlipayHelp(); + explicit AlipayHelp(AlipayPresenter *presenter); + ~AlipayHelp() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListAdapter.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListAdapter.h index 8a6235055..c28ddc4be 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListAdapter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListAdapter.h @@ -23,7 +23,7 @@ namespace OHOS { class AlipayListAdapter : public AbstractAdapter { public: explicit AlipayListAdapter(); - virtual ~AlipayListAdapter(); + ~AlipayListAdapter() override; /* * * @brief Sets the UIView adapter data, which is a AlipayListItem linked list. @@ -41,11 +41,11 @@ public: * @since 1.0 * @version 1.0 */ - virtual uint16_t GetCount(void) override; + uint16_t GetCount(void) override; - virtual UIView *GetView(UIView *inView, int16_t index) override; + UIView *GetView(UIView *inView, int16_t index) override; - virtual void AddListItem(const AlipayListItem &item); + void AddListItem(const AlipayListItem &item); void SetItemClickListener(UIView::OnClickListener *itemclicklistener) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListItemView.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListItemView.h index 8e6675245..74262222f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListItemView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListItemView.h @@ -20,13 +20,11 @@ namespace OHOS { class AlipayListItemView : public UIViewGroup { public: explicit AlipayListItemView(); - virtual ~AlipayListItemView(); - virtual void SetItemInfo(const AlipayListItem &itemInfo); - virtual void SetUpChild(); + ~AlipayListItemView() override; + void SetItemInfo(const AlipayListItem &itemInfo); + void SetUpChild(); private: - AlipayListItemView(const AlipayListItemView &); - UIImageView sIcon; UILabel sLabel; UIImageView sNextImage; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListView.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListView.h index 1f7958c48..ef9dd02bf 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayList/AlipayListView.h @@ -18,7 +18,6 @@ #include "components/icon_adapter.h" #include "AlipayPresenter.h" #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "UiConfig.h" #include "AlipayListAdapter.h" #include "AlipayListItem.h" @@ -27,8 +26,8 @@ namespace OHOS { class AlipayListAdapter; class AlipayList : public UIViewGroup { public: - AlipayList(AlipayPresenter *presenter); - virtual ~AlipayList(); + explicit AlipayList(AlipayPresenter *presenter); + ~AlipayList() override; bool InitListView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayMainView.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayMainView.h index 6d68a39c9..f88514a8c 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayMainView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayMainView.h @@ -41,7 +41,7 @@ class AlipayMainView; class AlipayMainView : public View { public: AlipayMainView(); - virtual ~AlipayMainView(); + ~AlipayMainView() override; static AlipayMainView *GetInstance(void); void OnStart() override; void OnSetUpView() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayModel.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayModel.h index a0cf81329..4f0d4bb69 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayModel.h @@ -89,9 +89,9 @@ public: uint32_t AlipayGetTransCodeLen(void); char* AlipayGetCardTitle(void); private: - osTimerId_t bindTimerId = NULL; - osTimerId_t switchTimerId = NULL; - osTimerId_t transTimerId = NULL; + osTimerId_t bindTimerId = nullptr; + osTimerId_t switchTimerId = nullptr; + osTimerId_t transTimerId = nullptr; int16 alipayInterLis; const alipay_svr_api_t *alipayApi; bool bindFlag_; @@ -99,8 +99,8 @@ private: uint32_t refreshFlag_ = 0; uint32_t cardNum_ = 0; uint32_t cardSum_ = 0; - mc_alipay_trans_card_info_t *cardInfo_ = NULL; - uint8_t* transCode_ = NULL; + mc_alipay_trans_card_info_t *cardInfo_ = nullptr; + uint8_t* transCode_ = nullptr; uint32_t transCodeLen_; char cardTitle_[ALIPAY_TRANS_CARD_MEMBER_LEN]; }; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayPayCode.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayPayCode.h index 55b2ffbe6..6ef24cb3a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayPayCode.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayPayCode.h @@ -17,8 +17,8 @@ namespace OHOS { class AlipayPayCode : public UIViewGroup { public: - AlipayPayCode(AlipayPresenter *presenter); - virtual ~AlipayPayCode(); + explicit AlipayPayCode(AlipayPresenter *presenter); + ~AlipayPayCode() override; static AlipayPayCode *GetInstance(); bool InitView(); void AlipayRefreshQrcode(const char *refreshStr); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayPresenter.h index 7037034fc..7a4fc62da 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayPresenter.h @@ -105,7 +105,7 @@ class AlipayPresenter : public Presenter, public UIView::OnDragListener { public: AlipayPresenter(); - virtual ~AlipayPresenter(); + ~AlipayPresenter() override; void OnStart() override; void OnPause() override; void OnResume() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayRefreshBindCode.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayRefreshBindCode.h index 800000b65..fe03e3035 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayRefreshBindCode.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayRefreshBindCode.h @@ -18,7 +18,7 @@ namespace OHOS { class AlipayRefreshBind : public UIViewGroup { public: AlipayRefreshBind(); - virtual ~AlipayRefreshBind(); + ~AlipayRefreshBind() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipaySetting.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipaySetting.h index 3f652125c..deb5a2da5 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipaySetting.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipaySetting.h @@ -17,8 +17,8 @@ namespace OHOS { class AlipaySetting : public UIViewGroup { public: - AlipaySetting(AlipayPresenter *presenter); - virtual ~AlipaySetting(); + explicit AlipaySetting(AlipayPresenter *presenter); + ~AlipaySetting() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayGetTransList.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayGetTransList.h index 6a7c2359d..a5c671432 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayGetTransList.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayGetTransList.h @@ -16,8 +16,8 @@ namespace OHOS { class AlipayGetTransList : public UIViewGroup { public: - AlipayGetTransList(AlipayPresenter *presenter); - virtual ~AlipayGetTransList(); + explicit AlipayGetTransList(AlipayPresenter *presenter); + ~AlipayGetTransList() override; bool InitGetView(uint32_t index); private: AlipayPresenter *presenter_; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransAni.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransAni.h index 14f2a367a..fc577b8b8 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransAni.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransAni.h @@ -19,8 +19,8 @@ namespace OHOS { class AlipayTransAni : public UIViewGroup { public: - AlipayTransAni(AlipayPresenter *presenter); - virtual ~AlipayTransAni(); + explicit AlipayTransAni(AlipayPresenter *presenter); + ~AlipayTransAni() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransCode.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransCode.h index 884ef277b..d4ba75077 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransCode.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransCode.h @@ -17,8 +17,8 @@ namespace OHOS { class AlipayTransCode : public UIViewGroup { public: - AlipayTransCode(AlipayPresenter *presenter); - virtual ~AlipayTransCode(); + explicit AlipayTransCode(AlipayPresenter *presenter); + ~AlipayTransCode() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransEnable.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransEnable.h index 432a9c993..e2af18b71 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransEnable.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransEnable.h @@ -17,8 +17,8 @@ namespace OHOS { class AlipayTransEnable : public UIViewGroup { public: - AlipayTransEnable(AlipayPresenter *presenter); - virtual ~AlipayTransEnable(); + explicit AlipayTransEnable(AlipayPresenter *presenter); + ~AlipayTransEnable() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListAdapter.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListAdapter.h index 0b24a7eda..233193063 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListAdapter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListAdapter.h @@ -23,7 +23,7 @@ namespace OHOS { class AlipayTransListAdapter : public AbstractAdapter { public: explicit AlipayTransListAdapter(); - virtual ~AlipayTransListAdapter(); + ~AlipayTransListAdapter() override; /* * * @brief Sets the UIView adapter data, which is a AlipayTransListItem linked list. @@ -41,11 +41,11 @@ public: * @since 1.0 * @version 1.0 */ - virtual uint16_t GetCount(void) override; + uint16_t GetCount(void) override; - virtual UIView *GetView(UIView *inView, int16_t index) override; + UIView *GetView(UIView *inView, int16_t index) override; - virtual void AddListItem(const AlipayTransListItem &item); + void AddListItem(const AlipayTransListItem &item); void SetItemClickListener(UIView::OnClickListener *itemclicklistener) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListItemView.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListItemView.h index 1967fa9f8..6a12a6a42 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListItemView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListItemView.h @@ -20,14 +20,12 @@ namespace OHOS { class AlipayTransListItemView : public UIViewGroup { public: explicit AlipayTransListItemView(); - virtual ~AlipayTransListItemView(); - virtual void SetItemInfo(const AlipayTransListItem &itemInfo); - virtual void SetUpChild(); + ~AlipayTransListItemView() override; + void SetItemInfo(const AlipayTransListItem &itemInfo); + void SetUpChild(); uint8_t GetAlipayTransListIndex(); private: - AlipayTransListItemView(const AlipayTransListItemView &); - UILabel sLabel; UIImageView sNextImage; AlipayTransListItem sItemInfo; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListView.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListView.h index 61f50ca9c..23cb4fe94 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransListView.h @@ -19,7 +19,6 @@ #include "components/icon_adapter.h" #include "AlipayPresenter.h" #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "UiConfig.h" #include "AlipayTransListAdapter.h" #include "AlipayTransListItem.h" @@ -32,8 +31,8 @@ static const uint8_t ALIPAY_TRANS_LIST_ITEM_LEN = 20; class AlipayTransListAdapter; class AlipayTransList : public UIViewGroup { public: - AlipayTransList(AlipayPresenter *presenter); - virtual ~AlipayTransList(); + explicit AlipayTransList(AlipayPresenter *presenter); + ~AlipayTransList() override; bool InitListView(); void AlipayTransListUpdate(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransRes.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransRes.h index e42fd3a79..57a93a147 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransRes.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransRes.h @@ -16,8 +16,8 @@ namespace OHOS { class AlipayTransRes : public UIViewGroup { public: - AlipayTransRes(AlipayPresenter *presenter); - virtual ~AlipayTransRes(); + explicit AlipayTransRes(AlipayPresenter *presenter); + ~AlipayTransRes() override; bool InitResView(uint32_t index); void AlipayTransRefreshRes(void); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransTips.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransTips.h index f6ef45fdf..0254ab881 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransTips.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayTrans/AlipayTransTips.h @@ -16,8 +16,8 @@ namespace OHOS { class AlipayTransTips : public UIViewGroup { public: - AlipayTransTips(AlipayPresenter *presenter); - virtual ~AlipayTransTips(); + explicit AlipayTransTips(AlipayPresenter *presenter); + ~AlipayTransTips() override; bool InitTipsView(uint32_t index); void AlipayTransRefreshTips(void); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayUnbind.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayUnbind.h index 434f151ac..183b8066e 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayUnbind.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayUnbind.h @@ -16,8 +16,8 @@ namespace OHOS { class AlipayUnbind : public UIViewGroup { public: - AlipayUnbind(AlipayPresenter *presenter); - virtual ~AlipayUnbind(); + explicit AlipayUnbind(AlipayPresenter *presenter); + ~AlipayUnbind() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayUnbindFinish.h b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayUnbindFinish.h index 8ac78d6d8..9221d783f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayUnbindFinish.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayUnbindFinish.h @@ -17,8 +17,8 @@ namespace OHOS { class AlipayUnbindFinish : public UIViewGroup { public: - AlipayUnbindFinish(AlipayPresenter *presenter); - virtual ~AlipayUnbindFinish(); + explicit AlipayUnbindFinish(AlipayPresenter *presenter); + ~AlipayUnbindFinish() override; bool InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBarCode.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBarCode.cpp index c5740edde..5e8723d58 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBarCode.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBarCode.cpp @@ -231,21 +231,21 @@ bool AlipayBarCode::InitView() SetStyle(STYLE_BACKGROUND_COLOR, 0xff1677ff); SetStyle(STYLE_BACKGROUND_OPA, 0xff); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBarCode::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitButton() == false) { + if (!AlipayInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBarCode::InitView AlipayInitButton() false"); return false; } - if (AlipayInitBarcode() == false) { + if (!AlipayInitBarcode()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBarCode::InitView AlipayInitQrcode() false"); return false; } - if (AlipayInitImage() == false) { + if (!AlipayInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBarCode::InitView AlipayInitImage() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBind.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBind.cpp index 6b1e55848..780949585 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBind.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBind.cpp @@ -101,12 +101,12 @@ bool AlipayBind::InitView() SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); SetStyle(STYLE_BACKGROUND_COLOR, Color::White().full); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBind::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitImage() == false) { + if (!AlipayInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBind::InitView AlipayInitImage() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBindAni.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBindAni.cpp index c3f7390e2..4574cb9f5 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBindAni.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBindAni.cpp @@ -116,11 +116,11 @@ bool AlipayBindAni::InitView() SetTouchable(true); SetOnDragListener(presenter_); SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBindAni::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitImageAni() == false) { + if (!AlipayInitImageAni()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBindAni::InitView AlipayInitImageAni() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBindRes.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBindRes.cpp index 9a6bd4c0c..0a331982b 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBindRes.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayBindRes.cpp @@ -118,11 +118,11 @@ bool AlipayBindRes::InitView() SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); const char *resStr = EXIT_LABEL_TEXT_SEC; - if (AlipayInitLabel(resStr) == false) { + if (!AlipayInitLabel(resStr)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBindRes::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitImage(PNG_ALIPAY_BIND_SUCCESS) == false) { + if (!AlipayInitImage(PNG_ALIPAY_BIND_SUCCESS)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayBindRes::InitView AlipayInitImage() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayExitBind.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayExitBind.cpp index 08944b8d7..edf88e323 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayExitBind.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayExitBind.cpp @@ -131,14 +131,14 @@ bool AlipayExitBind::InitSimilarButton(int16 num, int16 alipayX, int16 alipayY, bool AlipayExitBind::AlipayInitButton() { - if (InitSimilarButton(ALIPAY_SET_ZERO, EXIT_BUTTON_EXIT_X, EXIT_BUTTON_EXIT_Y, EXIT_BUTTON_TEXT_FIRST, - ALIPAY_INTER_EXIT) == false) { + if (!InitSimilarButton(ALIPAY_SET_ZERO, EXIT_BUTTON_EXIT_X, EXIT_BUTTON_EXIT_Y, EXIT_BUTTON_TEXT_FIRST, + ALIPAY_INTER_EXIT)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayExitBind::AlipayInitButton new alipayButton[ALIPAY_SET_ZERO] fail"); return false; } - if (InitSimilarButton(ALIPAY_SET_ONE, EXIT_BUTTON_BIND_X, EXIT_BUTTON_BIND_Y, EXIT_BUTTON_TEXT_SECOND, - ALIPAY_BIND_CONTINUE) == false) { + if (!InitSimilarButton(ALIPAY_SET_ONE, EXIT_BUTTON_BIND_X, EXIT_BUTTON_BIND_Y, EXIT_BUTTON_TEXT_SECOND, + ALIPAY_BIND_CONTINUE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayExitBind::AlipayInitButton new alipayButton[ALIPAY_SET_ONE] fail"); return false; @@ -154,11 +154,11 @@ bool AlipayExitBind::InitView() SetOnDragListener(presenter_); SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayExitBind::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitButton() == false) { + if (!AlipayInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayExitBind::InitView AlipayInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayHelp.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayHelp.cpp index 9f29dedf8..a772a5c10 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayHelp.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayHelp.cpp @@ -101,12 +101,12 @@ bool AlipayHelp::InitView() SetStyle(STYLE_BACKGROUND_COLOR, 0xff1677ff); SetStyle(STYLE_BACKGROUND_OPA, 0xff); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayHelp::InitView AlipayInitImage() false"); return false; } - if (AlipayInitImage() == false) { + if (!AlipayInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayHelp::InitView AlipayInitImage() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayList/AlipayListView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayList/AlipayListView.cpp index 3c44c3a59..e96e47030 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayList/AlipayListView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayList/AlipayListView.cpp @@ -86,7 +86,7 @@ bool AlipayList::InitListView() SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY); - if (AlipayInitList() == false) { + if (!AlipayInitList()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayList::InitView AlipayInitList() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayMainView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayMainView.cpp index 9aca06afd..888dff2ae 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayMainView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayMainView.cpp @@ -78,8 +78,11 @@ void AlipayMainView::OnStart() group = container[startView]; alipayWhichInter = startView; - RootView::GetInstance()->Add(container[startView]); - + if (group == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::OnSetUpView group null error!"); + return; + } + container_ = group; return; } @@ -87,15 +90,6 @@ void AlipayMainView::OnSetUpView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayMainView::OnSetUpView"); View::OnSetUpView(); - - if (group == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::OnSetUpView group null error!"); - return; - } - - RootView::GetInstance()->Add(group); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RootView::GetInstance()->Add"); - // show timerView Draw(); } @@ -112,12 +106,6 @@ void AlipayMainView::OnStop() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayMainView::OnStop"); View::OnStop(); - if (container_ != nullptr) { - container_->RemoveAll(); - delete container_; - container_ = nullptr; - } - group->RemoveAll(); RootView::GetInstance()->ClearOnKeyActListener(); RootView::GetInstance()->RemoveAll(); return; @@ -278,7 +266,7 @@ bool AlipayMainView::ChangePayView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangePayView alipayPayCode null error!"); return false; } - if (alipayPayCode->InitView() == false) { + if (!alipayPayCode->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangePayView InitView null error!"); return false; } @@ -305,7 +293,7 @@ bool AlipayMainView::ChangeSettingView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeSettingView alipayPayCode null error!"); return false; } - if (alipaySetting->InitView() == false) { + if (!alipaySetting->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeSettingView InitView null error!"); return false; } @@ -328,7 +316,7 @@ bool AlipayMainView::ChangeHelpView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeHelpView alipayHelp null error!"); return false; } - if (alipayHelp->InitView() == false) { + if (!alipayHelp->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeHelpView InitView null error!"); return false; } @@ -351,7 +339,7 @@ bool AlipayMainView::ChangeBindAniView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindAniView alipayBindAni null error!"); return false; } - if (alipayBindAni->InitView() == false) { + if (!alipayBindAni->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindAniView InitView null error!"); return false; } @@ -374,7 +362,7 @@ bool AlipayMainView::ChangeBindExitView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindExitView alipayExitBind null error!"); return false; } - if (alipayExitBind->InitView() == false) { + if (!alipayExitBind->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindExitView InitView null error!"); return false; } @@ -397,7 +385,7 @@ bool AlipayMainView::ChangeBindResView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindResView alipayBindRes null error!"); return false; } - if (alipayBindRes->InitView() == false) { + if (!alipayBindRes->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindResView InitView null error!"); return false; } @@ -427,7 +415,7 @@ bool AlipayMainView::ChangeUnbindView(int16 thisView) "AlipayMainView::ChangeUnbindView alipayExitBindSetting null error!"); return false; } - if (alipayExitBindSetting->InitView() == false) { + if (!alipayExitBindSetting->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeUnbindView InitView null error!"); return false; } @@ -452,7 +440,7 @@ bool AlipayMainView::ChangeUnbindFinishView(int16 thisView) "AlipayMainView::ChangeUnbindFinishView alipayUnbindFinish null error!"); return false; } - if (alipayUnbindFinish->InitView() == false) { + if (!alipayUnbindFinish->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeUnbindFinishView InitView null error!"); return false; } @@ -476,7 +464,7 @@ bool AlipayMainView::ChangeBindView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindView alipayBind null error!"); return false; } - if (alipayBind->InitView() == false) { + if (!alipayBind->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBindView InitView null error!"); return false; } @@ -499,7 +487,7 @@ bool AlipayMainView::ChangeTransView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransView alipayTransCode null error!"); return false; } - if (alipayTransCode->InitView() == false) { + if (!alipayTransCode->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransView InitView null error!"); return false; } @@ -522,7 +510,7 @@ bool AlipayMainView::ChangeTransListView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransListView alipayTransList null error!"); return false; } - if (alipayTransList->InitListView() == false) { + if (!alipayTransList->InitListView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransListView InitView null error!"); return false; } @@ -546,7 +534,7 @@ bool AlipayMainView::ChangeTransEnableView(int16 thisView) "AlipayMainView::ChangeTransEnableView alipayTransEnable null error!"); return false; } - if (alipayTransEnable->InitView() == false) { + if (!alipayTransEnable->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransEnableView InitView null error!"); return false; } @@ -569,7 +557,7 @@ bool AlipayMainView::ChangeTransTipsView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransTipsView alipayTransTips null error!"); return false; } - if (alipayTransTips->InitTipsView(presenter_->AlipayGetSwitchIndex()) == false) { + if (!alipayTransTips->InitTipsView(presenter_->AlipayGetSwitchIndex())) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransTipsView InitView null error!"); return false; } @@ -592,7 +580,7 @@ bool AlipayMainView::ChangeTransResView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransResView alipayTransRes null error!"); return false; } - if (alipayTransRes->InitResView(presenter_->AlipayGetSwitchIndex()) == false) { + if (!alipayTransRes->InitResView(presenter_->AlipayGetSwitchIndex())) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransResView InitView null error!"); return false; } @@ -616,7 +604,7 @@ bool AlipayMainView::ChangeGetTransListView(int16 thisView) "AlipayMainView::ChangeGetTransListView alipayGetTransList null error!"); return false; } - if (alipayGetTransList->InitGetView(presenter_->AlipayGetSwitchIndex()) == false) { + if (!alipayGetTransList->InitGetView(presenter_->AlipayGetSwitchIndex())) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeGetTransListView InitView null error!"); return false; } @@ -639,7 +627,7 @@ bool AlipayMainView::ChangeTransAniView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransProcessView alipayTransAni null error!"); return false; } - if (alipayTransAni->InitView() == false) { + if (!alipayTransAni->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeTransProcessView InitView null error!"); return false; } @@ -663,7 +651,7 @@ bool AlipayMainView::ChangeBarCodeView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBarView alipayPayCode null error!"); return false; } - if (alipayBarCode->InitView() == false) { + if (!alipayBarCode->InitView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeBarView InitView null error!"); return false; } @@ -690,7 +678,7 @@ bool AlipayMainView::ChangeListView(int16 thisView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeListView alipayList null error!"); return false; } - if (alipayList->InitListView() == false) { + if (!alipayList->InitListView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeListView InitView null error!"); return false; } @@ -737,7 +725,7 @@ bool AlipayMainView::ClickFunc(int16 interface) for (int i = 0; i < funcSize; i++) { if (interface == ViewMapper[i].viewId) { bool jug = (this->*(ViewMapper[i].func))(interface); - if (jug == false) { + if (!jug) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: ChangeInterFace[%d] false", interface); return false; } @@ -801,7 +789,7 @@ void AlipayMainView::ChangeView(int16 hideView, int16 showView) return; } interListen = hideView; - if (ClickFunc(showView) == false) { + if (!ClickFunc(showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayMainView::ChangeView ClickFunc error"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayModel.cpp index 4c468ea13..353c788d4 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayModel.cpp @@ -81,9 +81,9 @@ void AlipayBindTimerCallBack(void *argument) bool AlipayModel::AlipayStartBind(void) { - if (bindTimerId == NULL) { - bindTimerId = osTimerNew(AlipayBindTimerCallBack, osTimerPeriodic, (void *)0, NULL); - if (bindTimerId == NULL) { + if (bindTimerId == nullptr) { + bindTimerId = osTimerNew(AlipayBindTimerCallBack, osTimerPeriodic, (void *)0, nullptr); + if (bindTimerId == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayModel::AlipayStartBind Create timer fail."); return false; } @@ -110,10 +110,10 @@ void AlipaySwitchTimerCallBackProc(void *argument) } int16 alipayLis = AlipayModel::GetInstance()->GetAlipayInterLis(); int16 bindState = AlipayModel::GetInstance()->AlipayGetBindFlag(); - if (alipayLis == ALIPAY_BIND_RES_VIEW && bindState == true) { + if (alipayLis == ALIPAY_BIND_RES_VIEW && bindState) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ALIPAY_BIND_RES_VIEW bindState true in."); AlipayMainView::GetInstance()->ChangeView(ALIPAY_BIND_RES_VIEW, ALIPAY_LIST_VIEW); - } else if (alipayLis == ALIPAY_BIND_RES_VIEW && bindState == false) { + } else if (alipayLis == ALIPAY_BIND_RES_VIEW && (!bindState)) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ALIPAY_BIND_RES_VIEW bindState false in."); AlipayMainView::GetInstance()->ChangeView(ALIPAY_BIND_RES_VIEW, ALIPAY_BIND_VIEW); } else if (alipayLis == ALIPAY_PAY_VIEW) { @@ -145,9 +145,9 @@ void AlipaySwitchTimerCallBack(void *argument) bool AlipayModel::AlipayStartSwitchTimer(uint16_t time) { - if (switchTimerId == NULL) { - switchTimerId = osTimerNew(AlipaySwitchTimerCallBack, osTimerOnce, (void *)0, NULL); - if (switchTimerId == NULL) { + if (switchTimerId == nullptr) { + switchTimerId = osTimerNew(AlipaySwitchTimerCallBack, osTimerOnce, (void *)0, nullptr); + if (switchTimerId == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayModel::AlipayStartSwitchTimer Create timer fail."); return false; } @@ -166,7 +166,7 @@ bool AlipayModel::AlipayStartSwitchTimer(uint16_t time) void AlipayModel::AlipayStopSwitchTimer() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayModel::AlipayStopSwitchTimer stop timer."); - if (switchTimerId != NULL) { + if (switchTimerId != nullptr) { osTimerStop(switchTimerId); } return; @@ -227,7 +227,7 @@ void AlipayModel::AlipayUnbind(void) void AlipayModel::AlipayStopBindTimer(void) { - if (bindTimerId == NULL) { + if (bindTimerId == nullptr) { return; } int32_t ret = osTimerStop(bindTimerId); @@ -272,10 +272,10 @@ int32_t AlipayModel::AlipayGetLocalTranslist() int32_t AlipayModel::AlipayGetOnlineTranslist() { cardInfo_ = AlipayTransGetCardList(); - mc_alipay_trans_card_info_t *onLineList = NULL; + mc_alipay_trans_card_info_t *onLineList = nullptr; onLineList = (mc_alipay_trans_card_info_t *)malloc(sizeof(mc_alipay_trans_card_info_t) * ALIPAY_TRANS_CARD_MAX_LENGTH); - if (onLineList == NULL) { + if (onLineList == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayModel::AlipayGetOnlineTranslist alloc fail."); return -1; } @@ -294,7 +294,7 @@ int32_t AlipayModel::AlipayGetOnlineTranslist() cardSum_ = onLineNum; } free(onLineList); - onLineList = NULL; + onLineList = nullptr; return ret; } @@ -310,7 +310,7 @@ int32_t AlipayModel::AlipayCheckTransCard(uint32_t index) mc_alipay_tans_card_status_t cardStatus = { 0 }; int32_t ret = alipayApi->check_trans_cartstatus(&cardInfo_[index], &cardStatus); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayModel::AlipayCheckTransCard in:%u.", ret); - if (cardStatus.card_exits == true && cardStatus.remain_use_count >= ALIPAY_TRANS_CARD_MIN_VALID_NUM) { + if (cardStatus.card_exits && cardStatus.remain_use_count >= ALIPAY_TRANS_CARD_MIN_VALID_NUM) { return 0; } return -1; @@ -361,9 +361,9 @@ void AlipayTransGetListsTimerCallBack(void *argument) bool AlipayModel::AlipayTransStartGetListsTimer(void) { - if (transTimerId == NULL) { - transTimerId = osTimerNew(AlipayTransGetListsTimerCallBack, osTimerPeriodic, (void *)0, NULL); - if (transTimerId == NULL) { + if (transTimerId == nullptr) { + transTimerId = osTimerNew(AlipayTransGetListsTimerCallBack, osTimerPeriodic, (void *)0, nullptr); + if (transTimerId == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayModel::AlipayTransStartGetLists Create timer fail."); return false; } @@ -378,7 +378,7 @@ bool AlipayModel::AlipayTransStartGetListsTimer(void) } void AlipayModel::AlipayTransStopGetListsTimer(void) { - if (transTimerId == NULL) { + if (transTimerId == nullptr) { return; } int32_t ret = osTimerStop(transTimerId); @@ -481,7 +481,7 @@ int32_t AlipayModel::AlipayTransGetCardNum(void) bool AlipayModel::AlipayInitModel(void) { transCode_ = (uint8_t *)malloc(ALIPAY_TRANS_CODE_MAX_LEN); - if (transCode_ == NULL) { + if (transCode_ == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayModel::AlipayInitModel transCode_ alloc failure."); return false; } @@ -498,9 +498,9 @@ bool AlipayModel::AlipayInitModel(void) void AlipayModel::AlipayDeinitModel(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayModel::AlipayDeinitModel in."); - if (transCode_ != NULL) { + if (transCode_ != nullptr) { free(transCode_); - transCode_ = NULL; + transCode_ = nullptr; } svr_alipay_deinit_trans_context(); return; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPayCode.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPayCode.cpp index ad73a51d7..79e738f0f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPayCode.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPayCode.cpp @@ -206,20 +206,20 @@ bool AlipayPayCode::InitView() SetStyle(STYLE_BACKGROUND_COLOR, 0xff1677ff); SetStyle(STYLE_BACKGROUND_OPA, 0xff); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayPayCode::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitImage() == false) { + if (!AlipayInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayPayCode::InitView AlipayInitImage() false"); return false; } - if (AlipayInitQrcode() == false) { + if (!AlipayInitQrcode()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayPayCode::InitView AlipayInitQrcode() false"); return false; } - if (AlipayInitButton() == false) { + if (!AlipayInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayPayCode::InitView AlipayInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp index d260f9d49..ef16fe90f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp @@ -50,7 +50,7 @@ void AlipayPresenter::OnStart() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayPresenter OnStart"); Presenter::OnStart(); alipayMode_->AlipayExitLpm(); - if (alipayMode_->AlipayInitModel() == false) { + if (!alipayMode_->AlipayInitModel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayPresenter::OnStart AlipayInitModel fail."); NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); return; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipaySetting.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipaySetting.cpp index 4b2527bc8..c889eff58 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipaySetting.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipaySetting.cpp @@ -154,11 +154,11 @@ bool AlipaySetting::InitView() SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipaySetting::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitButton() == false) { + if (!AlipayInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipaySetting::InitView AlipayInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayGetTransList.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayGetTransList.cpp index 5776b782c..0bdadd009 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayGetTransList.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayGetTransList.cpp @@ -129,14 +129,14 @@ bool AlipayGetTransList::InitSimilarButton(int16 num, int16 alipayX, int16 alipa bool AlipayGetTransList::AlipayInitButton(uint32_t index) { - if (InitSimilarButton(ALIPAY_SET_ZERO, EXIT_BUTTON_EXIT_X, EXIT_BUTTON_EXIT_Y, - g_AlipayTransGetListMapper[index].label_left, g_AlipayTransGetListMapper[index].button_left) == false) { + if (!InitSimilarButton(ALIPAY_SET_ZERO, EXIT_BUTTON_EXIT_X, EXIT_BUTTON_EXIT_Y, + g_AlipayTransGetListMapper[index].label_left, g_AlipayTransGetListMapper[index].button_left)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayGetTransList::AlipayInitButton new alipayButton[ALIPAY_SET_ZERO] fail"); return false; } - if (InitSimilarButton(ALIPAY_SET_ONE, EXIT_BUTTON_BIND_X, EXIT_BUTTON_BIND_Y, - g_AlipayTransGetListMapper[index].label_right, g_AlipayTransGetListMapper[index].button_right) == false) { + if (!InitSimilarButton(ALIPAY_SET_ONE, EXIT_BUTTON_BIND_X, EXIT_BUTTON_BIND_Y, + g_AlipayTransGetListMapper[index].label_right, g_AlipayTransGetListMapper[index].button_right)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayGetTransList::AlipayInitButton new alipayButton[ALIPAY_SET_ONE] fail"); return false; @@ -153,11 +153,11 @@ bool AlipayGetTransList::InitGetView(uint32_t index) SetOnDragListener(presenter_); SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (AlipayInitLabel(index) == false) { + if (!AlipayInitLabel(index)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayGetTransList::InitView AlipayInitLabel false"); return false; } - if (AlipayInitButton(index) == false) { + if (!AlipayInitButton(index)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayGetTransList::InitView AlipayInitButton false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransAni.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransAni.cpp index cb34a5936..37adb66e5 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransAni.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransAni.cpp @@ -122,11 +122,11 @@ bool AlipayTransAni::InitView() SetOnDragListener(presenter_); SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransAni::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitImageAni() == false) { + if (!AlipayInitImageAni()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransAni::InitView AlipayInitImageAni() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransCode.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransCode.cpp index 784472dc8..2f0459546 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransCode.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransCode.cpp @@ -121,16 +121,16 @@ bool AlipayTransCode::InitView() SetStyle(STYLE_BACKGROUND_COLOR, 0xff1677ff); SetStyle(STYLE_BACKGROUND_OPA, 0xff); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransCode::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitQrcode() == false) { + if (!AlipayInitQrcode()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransCode::InitView AlipayInitQrcode() false"); return false; } - if (AlipayInitButton() == false) { + if (!AlipayInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransCode::InitView AlipayInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransEnable.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransEnable.cpp index 967d6168e..8b42995ba 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransEnable.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransEnable.cpp @@ -111,12 +111,12 @@ bool AlipayTransEnable::InitView() SetStyle(STYLE_BACKGROUND_COLOR, 0xff1677ff); SetStyle(STYLE_BACKGROUND_OPA, 0xff); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransEnable::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitQrcode() == false) { + if (!AlipayInitQrcode()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransEnable::InitView AlipayInitQrcode() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransListView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransListView.cpp index bab33701c..b77752179 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransListView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransListView.cpp @@ -126,12 +126,12 @@ bool AlipayTransList::InitListView() SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); SetStyle(STYLE_BACKGROUND_OPA, UN_OPACITY); - if (AlipayInitList() == false) { + if (!AlipayInitList()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransList::InitView AlipayInitList() false"); return false; } - if (AlipayInitButton() == false) { + if (!AlipayInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransList::InitView AlipayInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransRes.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransRes.cpp index e0fed12da..c7b5558b2 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransRes.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransRes.cpp @@ -178,16 +178,16 @@ bool AlipayTransRes::InitResView(uint32_t index) SetOnDragListener(presenter_); SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (AlipayInitLabel(g_AlipayTransResMapper[index].str) == false) { + if (!AlipayInitLabel(g_AlipayTransResMapper[index].str)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransRes::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitImage(PNG_ALIPAY_BIND_FAILURE) == false) { + if (!AlipayInitImage(PNG_ALIPAY_BIND_FAILURE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransRes::InitView AlipayInitImage() false"); return false; } - if (AlipayInitButton(index) == false) { + if (!AlipayInitButton(index)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransRes::InitView AlipayInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransTips.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransTips.cpp index 2f92fed70..11706660a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransTips.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayTrans/AlipayTransTips.cpp @@ -154,16 +154,16 @@ bool AlipayTransTips::InitTipsView(uint32_t index) SetOnDragListener(presenter_); SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (AlipayInitLabel(g_AlipayTransTipsMapper[index].str) == false) { + if (!AlipayInitLabel(g_AlipayTransTipsMapper[index].str)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransTips::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitImage(PNG_ALIPAY_BIND_FAILURE) == false) { + if (!AlipayInitImage(PNG_ALIPAY_BIND_FAILURE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransTips::InitView AlipayInitImage() false"); return false; } - if (AlipayInitButton(index) == false) { + if (!AlipayInitButton(index)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayTransTips::InitView AlipayInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayUnbind.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayUnbind.cpp index 5c6d18580..2c081cae3 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayUnbind.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayUnbind.cpp @@ -130,13 +130,13 @@ bool AlipayUnbind::InitSimilarButton(int16 num, int16 alipayX, int16 alipayY, co bool AlipayUnbind::AlipayInitButton() { - if (InitSimilarButton(ALIPAY_SET_ZERO, EXIT_BUTTON_EXIT_X, EXIT_BUTTON_EXIT_Y, UNBIND_BUTTON_TEXT_FIRST, - ALIPAY_SETTING_UNBIND) == false) { + if (!InitSimilarButton(ALIPAY_SET_ZERO, EXIT_BUTTON_EXIT_X, EXIT_BUTTON_EXIT_Y, UNBIND_BUTTON_TEXT_FIRST, + ALIPAY_SETTING_UNBIND)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayUnbind::AlipayInitButton new alipayButton[ALIPAY_SET_ZERO] fail"); return false; } - if (InitSimilarButton(ALIPAY_SET_ONE, EXIT_BUTTON_BIND_X, EXIT_BUTTON_BIND_Y, UNBIND_BUTTON_TEXT_SECOND, - ALIPAY_SETTING_CANCEL) == false) { + if (!InitSimilarButton(ALIPAY_SET_ONE, EXIT_BUTTON_BIND_X, EXIT_BUTTON_BIND_Y, UNBIND_BUTTON_TEXT_SECOND, + ALIPAY_SETTING_CANCEL)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayUnbind::AlipayInitButton new alipayButton[ALIPAY_SET_ONE] fail"); return false; } @@ -152,11 +152,11 @@ bool AlipayUnbind::InitView() SetOnDragListener(presenter_); SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayUnbind::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitButton() == false) { + if (!AlipayInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayUnbind::InitView AlipayInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayUnbindFinish.cpp b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayUnbindFinish.cpp index b7f49404b..817d90bf3 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayUnbindFinish.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayUnbindFinish.cpp @@ -126,11 +126,11 @@ bool AlipayUnbindFinish::InitView() SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); - if (AlipayInitLabel() == false) { + if (!AlipayInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayUnbindFinish::InitView AlipayInitLabel() false"); return false; } - if (AlipayInitButton() == false) { + if (!AlipayInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlipayUnbindFinish::InitView AlipayInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/AppItemView.h b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/AppItemView.h index b6f9568f4..31eae8f9b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/AppItemView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/AppItemView.h @@ -18,7 +18,7 @@ namespace OHOS { class AppItemView : public UIViewGroup { public: explicit AppItemView(); - virtual ~AppItemView(); + ~AppItemView() override; void SetItemInfo(const AppItem &itemInfo); AppViewId GetViewId(); const char *GetAppUid(); @@ -37,7 +37,7 @@ private: class HexagonsItemView : public UIImageView { public: explicit HexagonsItemView(); - virtual ~HexagonsItemView(); + ~HexagonsItemView(); void SetItemInfo(const AppItem &itemInfo); AppViewId GetViewId(); const char *GetAppUid(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistAdapter.h b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistAdapter.h index c4dc50bf0..5302fbc5e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistAdapter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistAdapter.h @@ -24,7 +24,7 @@ namespace OHOS { class ApplistAdapter : public AbstractAdapter { public: explicit ApplistAdapter(); - virtual ~ApplistAdapter(); + ~ApplistAdapter() override; /* * * @brief Obtains the data size of the UILabel adapter. @@ -33,11 +33,11 @@ public: * @since 1.0 * @version 1.0 */ - virtual uint16 GetCount(void) override; + uint16 GetCount(void) override; - virtual UIView *GetView(UIView *inView, int16 index) override; + UIView *GetView(UIView *inView, int16 index) override; - virtual void AddListItem(const AppItem &item); + void AddListItem(const AppItem &item); void SetItemClickListener(UIView::OnClickListener *itemClickListener) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistPresenter.h index c0d53a29d..bcb6ec7fa 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistPresenter.h @@ -18,16 +18,17 @@ namespace OHOS { class ApplistPresenter : public Presenter, public UIView::OnClickListener, - public ListScrollListener { + public ListScrollListener, public UIView::OnRotateListener { public: ApplistPresenter(); - virtual ~ApplistPresenter(); + ~ApplistPresenter() override; - virtual void OnStart() override; - virtual void OnResume() override; - virtual void OnPause() override; - virtual void OnStop() override; + void OnStart() override; + void OnResume() override; + void OnPause() override; + void OnStop() override; + bool OnRotate(UIView& view, const RotateEvent& event) override; bool OnClick(UIView &view, const ClickEvent &event) override; void OnItemSelected(int16 index, UIView *view) override; void SetStartIndex(uint16_t index); @@ -46,4 +47,4 @@ namespace OHOS { }; } -#endif // APPLIST_PRESENTER_H \ No newline at end of file +#endif // APPLIST_PRESENTER_H diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h index 6689efb18..a1c5e91cc 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h @@ -30,8 +30,8 @@ public: { continueDrag = false; } - virtual ~AppListOnDragListener() {} - virtual bool OnDragStart(UIView& view, const DragEvent& event) + ~AppListOnDragListener() override {} + bool OnDragStart(UIView& view, const DragEvent& event) override { UNUSED(view); UNUSED(event); @@ -40,7 +40,7 @@ public: return false; } - virtual bool OnDrag(UIView& view, const DragEvent& event) + bool OnDrag(UIView& view, const DragEvent& event) override { UNUSED(view); if (!continueDrag) { @@ -50,13 +50,13 @@ public: if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Applist Ondrag!!"); - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TRANSITION_ZOOM); + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TransitionType::TRANSITION_ZOOM); } return false; } - virtual bool OnDragEnd(UIView& view, const DragEvent& event) + bool OnDragEnd(UIView& view, const DragEvent& event) override { UNUSED(view); UNUSED(event); @@ -70,12 +70,12 @@ class ApplistPresenter; class ApplistView : public View { public: ApplistView(); - virtual ~ApplistView(); + ~ApplistView(); - virtual void OnStart() override; - virtual void OnSetUpView() override; - virtual void OnTearDownView() override; - virtual void OnStop() override; + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; void AddAppItemToList(const AppItem &item); void ClearAppItemToList(); @@ -96,11 +96,8 @@ private: /* for hexagons style */ UICustomHexagonsList* hexagonsList_{nullptr}; std::list listHexagonsView_; - int16_t horMargin_ = 0; - int16_t verMargin_ = 0; uint16_t imgSize_ = 0; uint16_t imgDistance_ = 0; - }; } #endif // APPLIST_VIEW_H \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp index f6a21be8f..c7fd860ca 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp @@ -5,7 +5,7 @@ * Create: 2021-09-18 */ -#include "stdint.h" +#include #include "mem_util.h" #include "bundle_info_utils.h" #include "securec.h" @@ -62,11 +62,9 @@ namespace OHOS { void ApplistModel::ResolvingJSAppItems(void) { - uint8 i, ret, nativeAppNum; - int32 len = 0; #ifdef JS_ENABLE if (bundleInfos != nullptr) { - for (i = 0; i < bundleLen; i++) { + for (uint8_t i = 0; i < bundleLen; i++) { ClearBundleInfo(bundleInfos + i); } @@ -79,18 +77,19 @@ namespace OHOS { bundleLen = 0; appLen = 0; - nativeAppNum = sizeof(g_nativeAppList) / sizeof(AppItem); + uint8_t nativeAppNum = sizeof(g_nativeAppList) / sizeof(AppItem); if (nativeAppNum >= APP_MAX_NUM) { nativeAppNum = APP_MAX_NUM; } - ret = memcpy_s(applist, sizeof(AppItem) * APP_MAX_NUM, g_nativeAppList, sizeof(AppItem) * nativeAppNum); + uint8_t ret = memcpy_s(applist, sizeof(AppItem) * APP_MAX_NUM, g_nativeAppList, sizeof(AppItem) * nativeAppNum); if (ret != EOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%s] ret = %d, nativeAppNum = %d", __FUNCTION__, ret, nativeAppNum); nativeAppNum = 0; } appLen = nativeAppNum; #ifdef JS_ENABLE + int32_t len = 0; ret = BundleMsClient::GetInstance().GetBundleInfos(0, &bundleInfos, &len); if ((ret == 0) && (len > 0) && (bundleInfos != nullptr)) { bundleLen = len; @@ -149,8 +148,8 @@ namespace OHOS { void ApplistModel::ApplistUpdate(void) { + ResolvingJSAppItems(); if (presenter != nullptr) { - ResolvingJSAppItems(); presenter->GetAppListView()->ClearAppItemToList(); const AppItem *itemInfo = GetApplistItems(); for (uint8 i = 0; i < GetAppListNum(); i++) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp index 49e02f84d..cf68b21b4 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp @@ -8,6 +8,8 @@ #include "ApplistPresenter.h" #include "ability_manager.h" #include "securec.h" +#include "components/ui_hexagons_list.h" +#include "TransitionType.h" namespace OHOS { ApplistPresenter::ApplistPresenter() @@ -18,7 +20,8 @@ namespace OHOS { model->SetPresenter(this); } - ApplistPresenter::~ApplistPresenter() { + ApplistPresenter::~ApplistPresenter() + { if (keyActListenr != nullptr) { delete keyActListenr; keyActListenr = nullptr; @@ -64,23 +67,57 @@ namespace OHOS { Presenter::OnStop(); } + bool ApplistPresenter::OnRotate(UIView& view, const RotateEvent& event) + { + UICustomHexagonsList* hexagonsView = dynamic_cast(&view); + if (hexagonsView == nullptr) { + return false; + } + int8_t index = hexagonsView->GetFocusedImgIndex(); + uint8_t focusIndex_ = 0; + if (index >= 0) { + focusIndex_ = static_cast(index); + } + HexagonsItemView *itemView = dynamic_cast(hexagonsView->GetViewByIndex(focusIndex_)); + AppViewId viewId = itemView->GetViewId(); + if (FloatMore(hexagonsView->GetGlobalScale(), 2.0f)) { // 2.0 threshold for beginning transition + hexagonsView->StopRotateAnimator(); + NativeAbility::GetInstance().ChangeSlice(viewId, TransitionType::TRANSITION_HEXAGONS); + hexagonsView->ClearFocus(); + } + return true; + } + bool ApplistPresenter::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); AppViewId viewId = VIEW_INVALID; char *uid = nullptr; - if (GetIsUseListStyle() == true) { - AppItemView *itemView = static_cast(&view); + TransitionType type = TransitionType::TRANSITION_INVALID; + if (GetIsUseListStyle()) { + AppItemView *itemView = dynamic_cast(&view); + if (itemView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "itemView is nullptr", viewId); + return false; + } viewId = itemView->GetViewId(); uid = (char *)itemView->GetAppUid(); } else { - HexagonsItemView *itemView = static_cast(&view); + HexagonsItemView *itemView = dynamic_cast(&view); + UIHexagonsList* hexagonsView = dynamic_cast(itemView->GetParent()); + if (hexagonsView == nullptr || itemView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hexagonsView or itemView is nullptr"); + return false; + } viewId = itemView->GetViewId(); uid = (char *)itemView->GetAppUid(); + hexagonsView->SetDraggable(false); + hexagonsView->Scale(1.0f, itemView->GetViewIndex()); // switch focus to click view + type = TransitionType::TRANSITION_HEXAGONS; } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d", viewId); if (viewId < VIEW_MAX_INTER_APP) { - NativeAbility::GetInstance().ChangeSlice(viewId); + NativeAbility::GetInstance().ChangeSlice(viewId, type); return true; } else if (viewId == VIEW_EXTERN_APP) { #ifdef JS_ENABLE @@ -151,4 +188,4 @@ namespace OHOS { return view_; } -} \ No newline at end of file +} diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp index 07b7ef0e1..0f3d9bbf3 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp @@ -33,7 +33,7 @@ ApplistView::~ApplistView() if (dragListener != nullptr) { delete dragListener; dragListener = nullptr; - } + } if (hexagonsList_ != nullptr) { delete hexagonsList_; hexagonsList_ = nullptr; @@ -44,9 +44,7 @@ void ApplistView::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStart "); View::OnStart(); - SetContainerView(new UIViewGroup()); - container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - if (presenter_->GetIsUseListStyle() == true) { + if (presenter_->GetIsUseListStyle()) { ListStyleOnStart(); } else { HexagonsStyleOnStart(); @@ -59,11 +57,10 @@ void ApplistView::HexagonsStyleOnStart() if (hexagonsList_ == nullptr) { hexagonsList_ = new UICustomHexagonsList(); } - container_->Add(hexagonsList_); hexagonsList_->SetPosition(0, 0, - container_->GetWidth() - 2 * (horMargin_ + 1), container_->GetHeight() - 2 * (verMargin_ + 1)); // 2, two - imgDistance_ = container_->GetWidth() * 0.25991; // 0.25991, empirical coefficient - imgSize_ = container_->GetWidth() * 0.23348; // 0.23348, empirical coefficient + Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); // 2, two + imgDistance_ = hexagonsList_->GetWidth() * 0.25991; // 0.25991, empirical coefficient + imgSize_ = hexagonsList_->GetWidth() * 0.23348; // 0.23348, empirical coefficient hexagonsList_->SetImageDistance(imgDistance_); hexagonsList_->SetImageSizeInCenter(imgSize_); int16_t blankSize = hexagonsList_->GetRelativeRect().GetWidth() > hexagonsList_->GetRelativeRect().GetHeight() ? @@ -71,11 +68,16 @@ void ApplistView::HexagonsStyleOnStart() hexagonsList_->SetScrollBlankSize(blankSize); hexagonsList_->SetReboundSize(blankSize); hexagonsList_->SetThrowDrag(true); + hexagonsList_->SetOnRotateListener(presenter_); + hexagonsList_->RequestFocus(); + SetContainerView(hexagonsList_); } void ApplistView::ListStyleOnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::ListStyleOnStart"); + SetContainerView(new UIViewGroup()); + container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); listAdapter_ = new ApplistAdapter(); if (listAdapter_ == nullptr) { return; @@ -109,7 +111,7 @@ void ApplistView::OnSetUpView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnSetUpView"); View::OnSetUpView(); - if (presenter_->GetIsUseListStyle() == true) { + if (presenter_->GetIsUseListStyle()) { ListStyleOnSetUpView(); } else { HexagonsStyleOnSetUpView(); @@ -157,16 +159,19 @@ void ApplistView::OnTearDownView() void ApplistView::OnStop() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStop"); - if (presenter_->GetIsUseListStyle() == true) { + if (presenter_->GetIsUseListStyle()) { ListStyleOnStop(); } else { HexagonsStyleOnStop(); } + View::OnStop(); if (container_ != nullptr) { container_->RemoveAll(); + delete container_; + container_ = nullptr; } - View::OnStop(); RootView::GetInstance()->ClearOnKeyActListener(); + FocusManager::GetInstance()->ClearFocus(); return; } @@ -193,7 +198,7 @@ void ApplistView::ListStyleOnStop() void ApplistView::AddAppItemToList(const AppItem &item) { - if (presenter_->GetIsUseListStyle() == true) { + if (presenter_->GetIsUseListStyle()) { listAdapter_->AddListItem(item); } else { HexagonsItemView *itemView = new HexagonsItemView(); @@ -209,7 +214,7 @@ void ApplistView::AddAppItemToList(const AppItem &item) void ApplistView::ClearAppItemToList() { - if (presenter_->GetIsUseListStyle() == true) { + if (presenter_->GetIsUseListStyle()) { listAdapter_->ClearItem(); } else { if (hexagonsList_ != nullptr) { @@ -225,11 +230,10 @@ void ApplistView::ClearAppItemToList() void ApplistView::RefreshAppList(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::RefreshAppList"); - if (presenter_->GetIsUseListStyle() == true) { + if (presenter_->GetIsUseListStyle()) { contentList_->RefreshList(); } else { hexagonsList_->LayoutChildren(true); } } - } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenModel.h b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenModel.h index 97863c912..d7a7aa9e3 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenModel.h @@ -8,7 +8,7 @@ #ifndef BLOOD_OXYGEN_MODEL_H #define BLOOD_OXYGEN_MODEL_H -#include "stdio.h" +#include #include "gfx_utils/list.h" #include "los_mux.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenPresenter.h index 8c13dfe6a..b09e67960 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenPresenter.h @@ -21,13 +21,13 @@ class BloodOxygenPresenter : public Presenter, public UIView::OnDragListener { public: BloodOxygenPresenter(); - virtual ~BloodOxygenPresenter(); + ~BloodOxygenPresenter() override; void OnStart() override; void OnPause() override; void OnResume() override; void OnStop() override; - virtual void Notify() override; + void Notify() override; static BloodOxygenPresenter *GetInstance(void); bool OnDrag(UIView& view, const DragEvent& event) override; bool OnClick(UIView& view, const ClickEvent& event) override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenView.h b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenView.h index 5a1b12cd9..fceeb7889 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/include/BloodOxygenView.h @@ -25,7 +25,7 @@ namespace OHOS { class BloodOxygenView : public View { public: BloodOxygenView(); - virtual ~BloodOxygenView(); + ~BloodOxygenView() override; void OnStop() override; void OnSetUpView() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp index c940ac853..a21717584 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenPresenter.cpp @@ -39,7 +39,7 @@ BloodOxygenPresenter* BloodOxygenPresenter::GetInstance() void BloodOxygenPresenter::OnStart() { Presenter::OnStart(); - SendMsgToUIService(UI_ADD_SLEEP_VETO, 0, NULL, 0); + SendMsgToUIService(UI_ADD_SLEEP_VETO, 0, nullptr, 0); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodOxygenPresenter::On Start "); } @@ -47,8 +47,9 @@ void BloodOxygenPresenter::OnPause(void) {} void BloodOxygenPresenter::OnResume(void) {} -void BloodOxygenPresenter::OnStop(void) { - SendMsgToUIService(UI_RM_SLEEP_VETO, 0, NULL, 0); +void BloodOxygenPresenter::OnStop(void) +{ + SendMsgToUIService(UI_RM_SLEEP_VETO, 0, nullptr, 0); } bool BloodOxygenPresenter::CheckPointersValue() @@ -85,7 +86,7 @@ bool BloodOxygenPresenter::OnClick(UIView& view, const ClickEvent& event) UNUSED(view); UNUSED(event); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodOxygenPresenter::OnClick"); - if (CheckPointersValue() == false) { + if (!CheckPointersValue()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenPresenter::Pointers is empty"); return false; } @@ -102,12 +103,12 @@ bool BloodOxygenPresenter::OnClick(UIView& view, const ClickEvent& event) void BloodOxygenPresenter::ProgressNotify(void) { - if (CheckPointersValue() == false) { + if (!CheckPointersValue()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenPresenter::Pointers is empty"); return; } - if (BloodOxygenModel::GetInstance()->GetBloodOxygenViewStatus() == true) { + if (BloodOxygenModel::GetInstance()->GetBloodOxygenViewStatus()) { count--; BloodOxygenView::GetInstance()->GetCircleProgress()->SetValue(count); if (count == PROGRESS_VALUE_MIN) { @@ -122,8 +123,8 @@ void BloodOxygenPresenter::ProgressNotify(void) void BloodOxygenPresenter::ReturnInterface() { - if (BloodOxygenModel::GetInstance()->GetBloodBandoffViewStatus() == true) { - if (BloodBandoffView::GetInstance()->GetImageAnimator()->GetState() == false) { + if (BloodOxygenModel::GetInstance()->GetBloodBandoffViewStatus()) { + if (!BloodBandoffView::GetInstance()->GetImageAnimator()->GetState()) { BloodOxygenModel::GetInstance()->SetBloodBandoffViewStatus(false); BloodOxygenModel::GetInstance()->SetBloodOxygenViewStatus(true); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenView.cpp index 553387f9e..d9c88c030 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bloodoxygen/src/BloodOxygenView.cpp @@ -313,8 +313,6 @@ void BloodOxygenView::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::OnStart"); View::OnStart(); - - group = new UIViewGroup(); if (group == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BloodOxygenView::new group fail"); @@ -323,11 +321,11 @@ void BloodOxygenView::OnStart() group->SetPosition(MATH_ZERO, MATH_ZERO); group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); - if (InitImageDisplay() == false) { + if (!InitImageDisplay()) { return; } - if (SetOnDragListener() == false) { + if (!SetOnDragListener()) { return; } @@ -358,7 +356,7 @@ void BloodOxygenView::OnStart() } group->Add(testButton); - if (OHOS::BloodOxygenModel::GetInstance()->GetBloodOxygenViewStatus() == true) { + if (OHOS::BloodOxygenModel::GetInstance()->GetBloodOxygenViewStatus()) { testButton->SetTouchable(false); percent->SetText(""); } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothItemView.h b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothItemView.h index 3e9d617fc..563fe825d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothItemView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothItemView.h @@ -22,11 +22,11 @@ namespace OHOS { class BluetoothItemView : public UIViewGroup { public: explicit BluetoothItemView(); - virtual ~BluetoothItemView(); - virtual void SetItemInfo(const BluetoothCaseInfo& itemInfo, bool isCaseList); + ~BluetoothItemView() override; + void SetItemInfo(const BluetoothCaseInfo& itemInfo, bool isCaseList); BluetoothCaseInfo *GetItemInfo(void); void SetConnectionstatus(const BluetoothCaseInfo& infoData); - virtual void SetUpChild(); + void SetUpChild(); void ConnectAnimatorStart(void); void ConnectAnimatorStop(void); bool IsConnectAnimator(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothModel.h b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothModel.h index 5cbb44093..1c9347e95 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothModel.h @@ -9,7 +9,7 @@ #define BLUETOOTH_MODEL_H #include -#include "stdio.h" +#include #include "gfx_utils/list.h" #include "bts_def.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/MainBluetoothView.h b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/MainBluetoothView.h index a8703af71..a3fd9af85 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/MainBluetoothView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/MainBluetoothView.h @@ -32,7 +32,7 @@ class MainBluetoothView; class MainBluetoothView : public View { public: MainBluetoothView(); - virtual ~MainBluetoothView(); + ~MainBluetoothView() override; void OnStart() override; void OnSetUpView() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothCaseListAdapter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothCaseListAdapter.cpp index ac24bf15d..9bd3eac6f 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothCaseListAdapter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothCaseListAdapter.cpp @@ -106,7 +106,7 @@ void BluetoothCaseListAdapter::ClickAnimation(BluetoothCaseInfo &itemData, Bluet { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothCaseListAdapter::ClickAnimation"); bool ret = BluetoothModel::GetInstance()->IsTagScanDeviceClicked(); - if (ret == true) { + if (ret) { BluetoothCaseInfo *clickInfo = BluetoothModel::GetInstance()->GetTempMacValue(); if ((clickInfo->addr[0] == itemData.addr[0]) && (clickInfo->addr[1] == itemData.addr[1]) && (clickInfo->addr[2] == itemData.addr[2]) && (clickInfo->addr[3] == itemData.addr[3]) && diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothDeviceListView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothDeviceListView.cpp index 8e0c806c0..94ef720d7 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothDeviceListView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothDeviceListView.cpp @@ -185,7 +185,7 @@ void BluetoothDeviceListView::RefreshText(void) List &bluetoothConnedList = BluetoothModel::GetInstance()->GetConnedDevicesCase(); bool ret = bluetoothConnedList.IsEmpty(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothDeviceListView::RefreshText bluetoothConnedList.IsEmpty ret = %d", ret); - if (ret == true) { + if (ret) { emptyLabel->SetVisible(true); } else { emptyLabel->SetVisible(false); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp index e7f807cf5..c26c7f573 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp @@ -23,7 +23,7 @@ static BluetoothEarPhoneView *g_pBluetoothEarPhoneView{nullptr}; #define BLUETOOTH_IMAGE_HEIGHT 104 #define BLUETOOTH_DELAY 200 -osTimerId_t g_stopScanHandle = NULL; +osTimerId_t g_stopScanHandle = nullptr; static constexpr uint64_t MS_SCAN_TIME = 25000; BluetoothEarPhoneView::BluetoothEarPhoneView() @@ -143,13 +143,13 @@ UIViewGroup *BluetoothEarPhoneView::InitShowUpView() void CancelBrScanHandle(void) { - if (g_stopScanHandle != NULL) { + if (g_stopScanHandle != nullptr) { osStatus_t ret = osTimerDelete(g_stopScanHandle); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret); return; } - g_stopScanHandle = NULL; + g_stopScanHandle = nullptr; } bool results = gap_br_cancel_discovery(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CancelBtDiscovery results %d", results); @@ -224,19 +224,19 @@ void BluetoothEarPhoneView::BtEnable() setScanStatus(true); // 开始扫描标记 BluetoothModel::GetInstance()->SetCaseListClear(); // 扫描list清空 ret = is_bt_discovering(BT_TRANSPORT_BR_EDR); - if (ret == true) { + if (ret) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable Bt is Discovering"); return; } else { results = gap_br_start_discovery(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable StartBtDiscovery results %d", results); } - if (g_stopScanHandle != NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable g_stopScanHandle != NULL"); + if (g_stopScanHandle != nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable g_stopScanHandle != nullptr"); return; } - g_stopScanHandle = osTimerNew((osTimerFunc_t)ScanTimerCallback, osTimerPeriodic, NULL, NULL); - if (g_stopScanHandle == NULL) { + g_stopScanHandle = osTimerNew((osTimerFunc_t)ScanTimerCallback, osTimerPeriodic, nullptr, nullptr); + if (g_stopScanHandle == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable osTimerNew failed!!"); return; } @@ -244,13 +244,13 @@ void BluetoothEarPhoneView::BtEnable() osStatus_t retTimer = osTimerStart(g_stopScanHandle, tick); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable osTimerStart failed, ret = %lx!!", retTimer); - if (g_stopScanHandle != NULL) { + if (g_stopScanHandle != nullptr) { retTimer = osTimerDelete(g_stopScanHandle); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable osTimerDelete ret = %lx!!", retTimer); return; } - g_stopScanHandle = NULL; + g_stopScanHandle = nullptr; } return; } @@ -260,7 +260,7 @@ void BluetoothEarPhoneView::BtEnable() void BluetoothEarPhoneView::StopBtDiscovery(void) { bool ret = is_bt_discovering(BT_TRANSPORT_BR_EDR); - if (ret == false) { + if (!ret) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Bt is not Discovering"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp index 94994ca27..00057bc20 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp @@ -26,12 +26,6 @@ bt_avrcp_tg_bts_cbk g_avrcp_tg_audio_cb; avrcp_ct_callbacks_t g_avrcp_ct_cb; avrcp_tg_callbacks_t g_avrcp_tg_cb; BtAvrcpTgInf g_avrcp_srv_inf; -static profile_connect_state_t g_avrcpTgStat = {}; - -static profile_connect_state_t BtAvrcpStat() -{ - return g_avrcpTgStat; -} void BtAvrcpVolumeChangedSyncMedia(uint8_t a2dp_volume) { @@ -102,6 +96,7 @@ void PressButtonStatusCallback(td_u32 keyOperation, td_u32 keyValue) void BtAvrcpTgNotifyVolumeChangedProc(uint8_t a2dp_volume) { int32_t audio_volume = a2dp_volume * BT_A2DP_MEDIA_VOL_LEVEL / AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "NotifyVolume = %d", audio_volume); AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, audio_volume); // 耳机连接手表场景调节手表音量 } @@ -236,7 +231,7 @@ void ConnectTgStateChangedCallback(const bd_addr_t *bdAddr, profile_connect_stat WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bdaddr nullptr"); return; } - g_avrcpTgStat = state; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnCtStateChangedCallback addr: %02x%02x%02x%02x%02x%02x ", bdAddr->addr[5], bdAddr->addr[4], bdAddr->addr[3], /* 5 4 3 idx */ bdAddr->addr[2], bdAddr->addr[1], bdAddr->addr[0]); /* 2 1 0 idx */ @@ -251,7 +246,7 @@ void ConnectTgStateChangedCallback(const bd_addr_t *bdAddr, profile_connect_stat static void BtAvrcpCtPressButtonRspCallback(const bd_addr_t *bd_addr, int32_t key_operation) { - if (bd_addr == NULL) { + if (bd_addr == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "null pointer\n"); return; } @@ -314,7 +309,7 @@ static void BtAvrcpCtReleaseButtonRspCallback(const bd_addr_t *bd_addr, int32_t static void BtAvrcpCtSupportCompanyCallback(const bd_addr_t *bd_addr, avrcp_ct_support_company_para_t *company) { - if (bd_addr == NULL || company == NULL || company->company_id == NULL) { + if (bd_addr == nullptr || company == nullptr || company->company_id == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "null pointer\n"); return; } @@ -326,7 +321,7 @@ static void BtAvrcpCtSupportCompanyCallback(const bd_addr_t *bd_addr, avrcp_ct_s static void BtAvrcpCtSupportEventCallback(const bd_addr_t *bd_addr, avrcp_ct_support_event_para_t *event) { - if (bd_addr == NULL || event == NULL || event->event_id == NULL) { + if (bd_addr == nullptr || event == nullptr || event->event_id == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "null pointer\n"); return; } @@ -344,7 +339,7 @@ static void BtAvrcpCtSupportEventCallback(const bd_addr_t *bd_addr, avrcp_ct_sup static void BtAvrcpCtGetElementAttriCallback(const bd_addr_t *bd_addr, avrcp_ct_element_attr_para_cb_t *attr_cb_para) { - if (bd_addr == NULL || attr_cb_para == NULL || attr_cb_para->attr_value == NULL) { + if (bd_addr == nullptr || attr_cb_para == nullptr || attr_cb_para->attr_value == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "null pointer\n"); return; } @@ -382,7 +377,7 @@ static void BtAvrcpCtGetElementAttriCallback(const bd_addr_t *bd_addr, avrcp_ct_ } uint8_t *value = (uint8_t *)(void *)malloc(attr_cb_para->attr_value[i].value_len + 1); - if (attr_cb_para->attr_value[i].value_len > 0 && attr_cb_para->attr_value[i].value != NULL) { + if (attr_cb_para->attr_value[i].value_len > 0 && attr_cb_para->attr_value[i].value != nullptr) { if (memcpy_s(value, attr_cb_para->attr_value[i].value_len, attr_cb_para->attr_value[i].value, attr_cb_para->attr_value[i].value_len) != EOK) { free(value); @@ -398,7 +393,7 @@ static void BtAvrcpCtGetElementAttriCallback(const bd_addr_t *bd_addr, avrcp_ct_ static void BtAvrcpCtGetPlayStatusCallback(const bd_addr_t *bd_addr, avrcp_ct_play_status_cb_t *status) { - if (bd_addr == NULL || status == NULL) { + if (bd_addr == nullptr || status == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "null pointer\n"); return; } @@ -415,7 +410,7 @@ static void BtAvrcpCtHdlNotifyVolumeRspCbk(avrcp_ct_notification_value_cb_t *not static void BtAvrcpCtNotificationCallback( const bd_addr_t *bd_addr, avrcp_notify_event_t event_id, avrcp_ct_notification_value_cb_t *notification) { - if (bd_addr == NULL || notification == NULL) { + if (bd_addr == nullptr || notification == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "null pointer\n"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp index 5f668e72a..676c0183e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothItemView.cpp @@ -76,9 +76,9 @@ void BluetoothItemView::SetItemInfo(const BluetoothCaseInfo& itemInfo, bool isCa WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothItemView::SetItemInfo"); itemInfo_ = itemInfo; namelabel.SetText(reinterpret_cast(itemInfo_.deviceName)); - if (isCaseList == true) { + if (isCaseList) { bool ret = BluetoothModel::GetInstance()->IsTagScanDeviceClicked(); - if ((IsConnectAnimator() == false) && (ret == true)) { + if ((!IsConnectAnimator()) && (ret)) { namelabel.SetStyle(STYLE_TEXT_COLOR, Color::Gray().full); button.SetTouchable(false); SetTouchable(false); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp index e58b3f6ea..c8cd31ca6 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp @@ -4,7 +4,7 @@ * Author: * Create: 2021-10-13 */ -#include "stdint.h" +#include #include "BluetoothModel.h" #include "BluetoothPresenter.h" #include "ConnectPhonePresenter.h" @@ -13,10 +13,7 @@ #include "PlayersModel.h" #include "PhoneAudio.h" #include "graphic_service.h" -#include "ui_service.h" - #include "msg_center.h" - #include "bts_def.h" #include "bts_gatt_stru.h" #include "bts_a2dp_source.h" @@ -31,6 +28,7 @@ #include "bt_audio_hal_interface.h" #include "audio_manager_c_wrapper.h" #include "bts_avrcp_target.h" +#include "msg_center_msg.h" namespace OHOS { @@ -41,7 +39,7 @@ namespace OHOS { constexpr uint16_t BLUETOOTH_MAX_NUM = 20; #define MEDIA_A2DP_SNK_INTERFACE 1 -osal_timer g_a2dp_stream_accept_timer = {NULL, NULL, 0, 0}; +osal_timer g_a2dp_stream_accept_timer = {nullptr, nullptr, 0, 0}; #define A2DP_STREAM_ACCEPT_TIMER_PERIOD 500 AudioFormatConfig g_audio_format_config = {AUDIO_DEFAULT, 0, 0}; @@ -190,7 +188,7 @@ void BluetoothModel::SetUpConnedDevicesList() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Setup GetPariedDevicesNum ret = %d, num = %d", ret, connedDevicesNum); gap_paired_device_info_t *devInfo = (gap_paired_device_info_t*)malloc(sizeof(gap_paired_device_info_t) *connedDevicesNum); - if (devInfo == NULL) { + if (devInfo == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DevInfo malloc failed %u", sizeof(gap_paired_device_info_t) *connedDevicesNum); return; } @@ -647,8 +645,8 @@ static void ACLConnectionSuss(const bd_addr_t &bdAddr) { // 判断是否已退出蓝牙模块(无需跳转) bool tagConnectView = BluetoothModel::GetInstance()->IsTagConnectView(); - if (tagConnectView == false) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GapAclStateChangedCallback tagConnectView == false"); + if (!tagConnectView) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GapAclStateChangedCallback tagConnectView fail"); return; } // 成功提示 @@ -684,8 +682,8 @@ static void ACLConnectionFail(const bd_addr_t &bdAddr) bool tagConnectView = BluetoothModel::GetInstance()->IsTagConnectView(); // 判断是否无需跳转到失败界面 bool tagDisconnectView = BluetoothModel::GetInstance()->IsTagDisconnectView(); - if (tagConnectView == false || tagDisconnectView == false) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GapAclStateChangedCallback tagDisconnectView == false"); + if ((!tagConnectView) || (!tagDisconnectView)) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GapAclStateChangedCallback tagDisconnectView fail"); return; } // 失败提示页 @@ -715,36 +713,6 @@ static void ACLConnectionFail(const bd_addr_t &bdAddr) tipsConnFailMessageView->RefreshNameLabel(bdAddr); } -static void DisconnectBluetoothPause() -{ - int64_t playerCurrentTime; - int64_t playerMusicDuration; - int64_t playerProgressVlaue; - if (PlayersModel::GetInstance()->GetPlayerCtr() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AclStateChangedCallback GetPlayerCtr() == nullptr"); - return; - } - PlayersModel::GetInstance()->GetPlayerCtr()->Pause(); - PlayersModel::GetInstance()->SetPlayButtonState(false); - PlayersModel::GetInstance()->GetPlayerCtr()->GetCurrentTime(playerCurrentTime); - PlayersModel::GetInstance()->GetPlayerCtr()->GetDuration(playerMusicDuration); - if (playerMusicDuration == 0) { // 0:除数保护 - playerProgressVlaue = 100; // 100:进度条系数 - } else { - playerProgressVlaue = (playerCurrentTime * 100) / playerMusicDuration; // 100:百分比系数 - } - PlayersModel::GetInstance()->SetCircleProgress(playerProgressVlaue); - PlayersView *playersView = PlayersView::GetInstance(); - if (playersView != nullptr) { - playersView->SetPlayerButtonState(UICheckBox::UICheckBoxState::UNSELECTED); - if (playersView->GetPlaybackProgress() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AclStateChangedCallback playersView->GetPlaybackProgress() == nullptr"); - return; - } - playersView->GetPlaybackProgress()->SetValue(playerProgressVlaue); - } -} - static void DisconnectedHandle() { BluetoothModel::GetInstance()->SetTagDisconnectView(false); @@ -769,14 +737,8 @@ static void DisconnectedHandle() void BluetoothModel::BtGapAclStateChangedHandle(gap_acl_state_t state, unsigned int reason, const bd_addr_t &bdAddr) { - if ((state == GAP_ACL_STATE_CONNECTED) || (state == GAP_ACL_STATE_LE_CONNECTED)) { - SendMsgToUIService(BT_CONNECTED_TO_UI, 0, NULL, 0); - } else { - SendMsgToUIService(BT_DISCONNECTED_TO_UI, 0, NULL, 0); - } - bool tag = BluetoothModel::GetInstance()->IsTagScanDeviceClicked(); - if ((reason == 0x13) || (reason == 0x14) || (reason == 0x15) || (reason == 0x3D) || (reason == 0x08 && tag == false)) { // 连接断开 + if ((reason == 0x13) || (reason == 0x14) || (reason == 0x15) || (reason == 0x3D) || (reason == 0x08 && (!tag))) { // 连接断开 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "The peer end is disconnected."); DisconnectedHandle(); } else if (reason == 0x16) { // 主动断开连接 @@ -796,19 +758,21 @@ void BluetoothModel::BtGapAclStateChangedHandle(gap_acl_state_t state, unsigned if ((state == GAP_ACL_STATE_CONNECTED) || (state == GAP_ACL_STATE_LE_CONNECTED)) { SetLastConnedAddr(&bdAddr); // 将数据存入设备列表 - bool tag = CheckExistConnedList(*onClickBtCaseInfo); + tag = CheckExistConnedList(*onClickBtCaseInfo); if (!tag) { AddConnedDevicesCase(*onClickBtCaseInfo); } - ACLConnectionSuss(bdAddr); } else { ACLConnectionFail(bdAddr); } if ((state == GAP_ACL_STATE_CONNECTED) || (state == GAP_ACL_STATE_LE_CONNECTED)) { if (BluetoothModel::GetInstance()->ConnectRemoteCheck(&bdAddr)) { - bool retA2dp = a2dp_src_connect(&bdAddr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "a2dp_src_connect result %d", retA2dp); + int32_t retA2dp = a2dp_src_connect(&bdAddr); + if (retA2dp) { + ACLConnectionFail(bdAddr); + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "a2dp_src_connect result 0x%x", retA2dp); } else { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ingore a2dp_src_connect"); } @@ -826,8 +790,8 @@ void GapAclStateChangedCallback(const bd_addr_t *bdAddr, gap_acl_state_t state, WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GapAclStateChangedCallback: Mobile Phone Device"); return; } - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&BluetoothModel::BtGapAclStateChangedHandle, - BluetoothModel::GetInstance(), state, reason, *bdAddr)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&BluetoothModel::BtGapAclStateChangedHandle, BluetoothModel::GetInstance(), state, reason, *bdAddr)); } // 回调:远端设备名称变化 @@ -875,10 +839,12 @@ static void A2dpSrcConnectstateChanged(bd_addr_t *bdAddr, int connState) if (connState == PROFILE_STATE_CONNECTED) { avrcp_ct_connect(bdAddr); PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_CONNECTED); + GraphicService::GetInstance()->PostGraphicEvent(std::bind(ACLConnectionSuss, *bdAddr)); } if (connState == PROFILE_STATE_DISCONNECTED) { PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_A2DP, AUDIO_DEVICE_DISCONNECTED); + GraphicService::GetInstance()->PostGraphicEvent(std::bind(ACLConnectionFail, *bdAddr)); } } @@ -906,9 +872,12 @@ static void BleConnStateChangeCallback(unsigned short connId, bd_addr_t *addr, g WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BleConnStateChangeCallback connId 0x%x, connState 0x%x, pairState 0x%x", connId, connState, pairState); if (GAP_BLE_STATE_DISCONNECTED == connState) { // restart ble adv when disconnected + /* 通知msg_center,ble状态仍用bt状态,此处不区分 */ + SendMsgToMsgCenterService(BT_DISCONNECTED_TO_MSGCENTER, 0, nullptr, 0); BleAdvStart(); } else { BluetoothModel::GetInstance()->SetAdvStartState(false); + SendMsgToMsgCenterService(BT_CONNECTED_TO_MSGCENTER, 0, nullptr, 0); } } @@ -992,10 +961,10 @@ static void BtGattsRequestWriteCallback(uint8_t serverId, uint16_t connId, gatts static void BtA2dpSnkAcceptTimerStop(void) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "stop timer\n"); - if (g_a2dp_stream_accept_timer.timer != NULL) { + if (g_a2dp_stream_accept_timer.timer != nullptr) { (void)osal_timer_stop(&g_a2dp_stream_accept_timer); (void)osal_timer_destroy(&g_a2dp_stream_accept_timer); - g_a2dp_stream_accept_timer.timer = NULL; + g_a2dp_stream_accept_timer.timer = nullptr; } WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "stop timer success!\n"); } @@ -1011,7 +980,7 @@ static void BtA2dpSnStartAcceptHandler(unsigned long data) static errcode_t BtA2dpSnkStartAcceptTimer(void) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "start timer\n"); - if (g_a2dp_stream_accept_timer.timer != NULL) { + if (g_a2dp_stream_accept_timer.timer != nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "timer is running"); return ERRCODE_SUCC; } @@ -1172,7 +1141,7 @@ void BtInitCallBacksEx() g_btGattsCallbacks.delete_service_cb = BtGattsServiceDeleteCallback; g_btGattsCallbacks.read_request_cb = BtGattsRequestReadCallback; g_btGattsCallbacks.write_request_cb = BtGattsRequestWriteCallback; - g_btGattsCallbacks.mtu_changed_cb = NULL; + g_btGattsCallbacks.mtu_changed_cb = nullptr; gatts_register_callbacks(&g_btGattsCallbacks); } @@ -1212,7 +1181,7 @@ static uint32_t GenerateUuidFromString(const char *str, uint8_t len, bt_uuid_t * { int slen = (int)strnlen(str, len); bool new_uuid = false; - if (uuid_out == NULL) { + if (uuid_out == nullptr) { return ERRCODE_INVALID_PARAM; } @@ -1269,7 +1238,7 @@ void BtSppServerAccept(uint8_t server_id) { osal_task *task = osal_kthread_create(BtSppServerAcceptTaskBody, (void *)(uintptr_t)server_id, "spp_server_accept_task", BT_SPP_TASK_STACK_SIZE); - if (task == NULL) { + if (task == nullptr) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "create task fail\n"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothOptionsView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothOptionsView.cpp index 86ea73edb..a2c367198 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothOptionsView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothOptionsView.cpp @@ -46,7 +46,7 @@ void BluetoothOptionsView::RefreshText(void) { // 刷新状态和文字 BluetoothModel::GetInstance()->SetBtStatus(); - if (BluetoothModel::GetInstance()->GetAclConnected() == true) { + if (BluetoothModel::GetInstance()->GetAclConnected()) { connectStateLabel->SetText("已连接"); optionsOneButton->SetText("断开连接"); } else { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp index 89aa78d87..4935ffbb6 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothPresenter.cpp @@ -143,7 +143,7 @@ void BluetoothPresenter::ClickOptionsOneButton(void) return; } bluetoothMode_->SetBtStatus(); - if (bluetoothMode_->GetAclConnected() == true) { + if (bluetoothMode_->GetAclConnected()) { bluetoothMode_->SetTagConnectNew(false); bluetoothOptionsView->SetBtDisconnect(); view_->ChangeView(BLUETOOTHEOPTIONSVIEW, BLUETOOTHDEVICELISTVIEW); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp index 7fbbc729b..e55170dfb 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/MainBluetoothView.cpp @@ -71,7 +71,7 @@ void MainBluetoothView::OnStart() BluetoothModel::GetInstance()->SetTagReturnToDeviceListView(false); int16_t unusedValue = BLUETOOTHEVIEW_MAX; bool ret = bluetoothCaseList.IsEmpty(); - if (ret != true) { + if (!ret) { ChangeView(unusedValue, BLUETOOTHDEVICELISTVIEW); } else { ChangeView(unusedValue, BLUETOOTHEARPHONEVIEW); @@ -135,11 +135,6 @@ bool MainBluetoothView::ChangeBluetoothDeviceListView(int16_t hideView, int16_t } deviceList->RefreshList(); } - BluetoothDeviceListView *bluetoothDeviceListView = BluetoothDeviceListView::GetInstance(); - if (bluetoothDeviceListView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick bluetoothDeviceListView new fail"); - return false; - } bluetoothDeviceListView->RefreshText(); return true; } @@ -185,7 +180,6 @@ bool MainBluetoothView::ChangeTipsConnFailMessageView(int16_t hideView, int16_t container[thisView] = group; RootView::GetInstance()->Add(container[thisView]); } - BluetoothReconnectView *bluetoothReconnectView = BluetoothReconnectView::GetInstance(); if (bluetoothReconnectView == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GapAclStateChangedCallback bluetoothReconnectView == nullptr"); } else { @@ -312,8 +306,8 @@ bool MainBluetoothView::ChangeBluetoothReconnectView(int16_t hideView, int16_t t RootView::GetInstance()->Add(container[thisView]); } BluetoothModel::GetInstance()->SetTagDisconnectView(true); - BluetoothReconnectView::GetInstance()->RefreshBluetoothNameLabel(); - BluetoothReconnectView::GetInstance()->BtReconnectStart(); + bluetoothReconnectView->RefreshBluetoothNameLabel(); + bluetoothReconnectView->BtReconnectStart(); return true; } @@ -324,12 +318,12 @@ void MainBluetoothView::CorrespondingJump(int16_t hideView) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::DropView bluetoothModel == nullptr"); return; } - if (bluetoothModel->GetTagReconnectJump() == true) { + if (bluetoothModel->GetTagReconnectJump()) { ChangeView(hideView, BLUETOOTHEOPTIONSVIEW); } else { std::list &bluetoothScanList = BluetoothModel::GetInstance()->GetCase(); bool ret = bluetoothScanList.empty(); - if (ret != true) { + if (!ret) { ChangeView(hideView, BLUETOOTHEARLISTVIEW); } else { ChangeView(hideView, BLUETOOTHEARPHONEVIEW); @@ -348,7 +342,6 @@ void MainBluetoothView::ChangeSettingView() void MainBluetoothView::DropEarPhoneView() { - BluetoothEarPhoneView *bluetoothEarPhoneView = BluetoothEarPhoneView::GetInstance(); if (bluetoothEarPhoneView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::DropView bluetoothEarPhoneView == nullptr"); return; @@ -356,7 +349,7 @@ void MainBluetoothView::DropEarPhoneView() bluetoothEarPhoneView->BtAnimatorStop(); bluetoothEarPhoneView->StopBtDiscovery(); bool ret = BluetoothModel::GetInstance()->IsTagReturnToDeviceListView(); - if (ret == true) { + if (ret) { ChangeView(BLUETOOTHEARPHONEVIEW, BLUETOOTHDEVICELISTVIEW); } else { ChangeSettingView(); @@ -374,7 +367,6 @@ void MainBluetoothView::DropEarListView() errcode_t retVal = gap_disconnect_remote_device((const bd_addr_t *)caseInfo->addr); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::DropEarListView gap_disconnect_remote_device retVal = %d", retVal); } - BluetoothEarPhoneView *bluetoothEarPhoneView = BluetoothEarPhoneView::GetInstance(); if (bluetoothEarPhoneView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::DropView bluetoothEarPhoneView == nullptr"); return; @@ -417,14 +409,12 @@ void MainBluetoothView::DropView(UIView& view) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::DropView::container[BLUETOOTHRECONNECTVIEW]"); CorrespondingJump(BLUETOOTHRECONNECTVIEW); BluetoothModel::GetInstance()->SetTagDisconnectView(false); - BluetoothReconnectView *bluetoothReconnectView = BluetoothReconnectView::GetInstance(); bluetoothReconnectView->BtReconnectStop(); } } void MainBluetoothView::ResetEarListView(int16_t hideView) { - BluetoothEarListView *bluetoothEarListView = BluetoothEarListView::GetInstance(); if (bluetoothEarListView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::ResetEarListView bluetoothEarListView == nullptr"); return; @@ -463,14 +453,14 @@ void MainBluetoothView::ChangeView(int16_t hideView, int16_t showView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::ChangeView %d, %d", hideView, showView); - if (CheckViewParam(hideView, showView) == false) { + if (!CheckViewParam(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::CheckViewParam failed."); return; } PreprosssChangeView tmpPreProcessView = preProcessView[showView]; - if ((this->*tmpPreProcessView)(hideView, showView) == false) { + if (!(this->*tmpPreProcessView)(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::ChangeView %d %dfailed", showView, hideView); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/TipsConnFailMessageView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/TipsConnFailMessageView.cpp index ffaf77d77..552f968aa 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/TipsConnFailMessageView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/TipsConnFailMessageView.cpp @@ -189,7 +189,7 @@ void TipsConnFailMessageView::RefreshNameLabel(const bd_addr_t &bdAddr) BluetoothCaseInfo caseInfo; (void)memcpy_s(caseInfo.addr, BD_ADDR_LEN, bdAddr.addr, BD_ADDR_LEN); bool ret = BluetoothModel::GetInstance()->FindNameFromList(&caseInfo); - if (ret == false) { + if (!ret) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TipsConnFailMessageView FindNameFromList fail"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/TipsSuccMessageView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/TipsSuccMessageView.cpp index 3dd80a738..9bab50fa8 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/TipsSuccMessageView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/TipsSuccMessageView.cpp @@ -149,7 +149,7 @@ void TipsSuccMessageView::RefreshNameLabel(const bd_addr_t &bdAddr) BluetoothCaseInfo caseInfo; (void)memcpy_s(caseInfo.addr, BD_ADDR_LEN, bdAddr.addr, BD_ADDR_LEN); bool ret = BluetoothModel::GetInstance()->FindNameFromList(&caseInfo); - if (ret == false) { + if (!ret) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TipsSuccMessageView FindNameFromList fail"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerItemView.h b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerItemView.h index a4c09c2ad..4a5a6970d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerItemView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerItemView.h @@ -24,17 +24,17 @@ public: // @param yCoordinates Y轴坐标值 explicit CallerItemView(int32 yCoordinates); - virtual ~CallerItemView(); + ~CallerItemView() override; - virtual void SetItemInfo(CallLogInfo *itemInfo, char len); - virtual void SetUpChild(); + void SetItemInfo(CallLogInfo *itemInfo, char len); + void SetUpChild(); private: CallerItemView(const CallerItemView &); CallerItemView &operator = (const CallerItemView &); void InitDateMonTime(time_t seconds); - string infoTel; // 电话号码 - string timeDisplay; // 日期显示 + std::string infoTel; // 电话号码 + std::string timeDisplay; // 日期显示 UIImageView icon_; UIImageView icons_; UILabel label_; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogModel.h b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogModel.h index 4bd290096..43bd534bd 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogModel.h @@ -11,7 +11,6 @@ #include "string" #include "PhoneService.h" #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "message.h" #include "msg_center.h" @@ -42,18 +41,16 @@ void UsingPhoneChangeStatusCallback(const PhoneCallInfo *phoneCall); void UsingPhoneErrorCallback(PhoneServiceErrorType type); namespace OHOS { -using namespace std; - class CallerLogModel { public: - typedef enum { +typedef enum { CallSourcePhone, CallSourceCat1, } CallSource; void InitPhoneService(); static CallerLogModel *GetInstance(void); - string GetPhoneNumber(void); + std::string GetPhoneNumber(void); void SetoperateNumber(const char *number, char number_len); bool GetPhoneStatus(); @@ -71,17 +68,17 @@ public: bool GetMulitplePhoneStatus(); void SetMulitplePhoneStatus(bool status); - string GetDialingStatus(void); + std::string GetDialingStatus(void); void SetDialingStatus(const char *text); - string InitDateHourTime(); - char *DisplayCallDuration(); + std::string InitDateHourTime(); + std::string& DisplayCallDuration(); int CurrCallNum(); bool GetNotifyFlag(void); void SetNotifyFlag(bool flag); bool IsMulitplePhoneStatus(void); - CallSource GetCallSource(void) +CallSource GetCallSource(void) { return callsrc; } @@ -95,10 +92,10 @@ private: CallerLogModel &operator=(const CallerLogModel &); virtual ~CallerLogModel(); - string dialingStatus; // 拨号状态 - string timers; // 时间显示 - string callDuration; // 通话时长 - string phoneNumber; // 电话号码 + std::string dialingStatus; // 拨号状态 + std::string timers; // 时间显示 + std::string callDuration; // 通话时长 + std::string phoneNumber; // 电话号码 bool mulitplePhoneStatus{false}; // 判断是否多路通话界面 bool waitingStatus{false}; // 判断是否等待提醒界面 bool volumeStatus{false}; // 判断是否音量界面 diff --git a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h index e66e4fb6b..23a86fd69 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogPresenter.h @@ -19,7 +19,7 @@ class CallerLogView; class CallerLogPresenter : public Presenter, public UIView::OnClickListener { public: CallerLogPresenter(); - virtual ~CallerLogPresenter(); + ~CallerLogPresenter() override; void OnStart() override; void OnPause() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogView.h b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogView.h index adc309cd8..935314bbf 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/include/CallerLogView.h @@ -28,9 +28,9 @@ using namespace Graphic; class CallerListOnDragListener : public UIView::OnDragListener { public: CallerListOnDragListener() {} - virtual ~CallerListOnDragListener() {} + ~CallerListOnDragListener() override {} - virtual bool OnDrag(UIView& view, const DragEvent& event) + bool OnDrag(UIView& view, const DragEvent& event) override { UNUSED(view); if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && @@ -45,7 +45,7 @@ public: class CallerUIScrollView : public UIScrollView { public: CallerUIScrollView() {} - virtual ~CallerUIScrollView() {} + ~CallerUIScrollView() {} bool OnDragEvent(const DragEvent& event) override { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerItemView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerItemView.cpp index c0acd5464..c63f1851c 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerItemView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerItemView.cpp @@ -34,7 +34,6 @@ CallerItemView::CallerItemView(int32 yCoordinates) SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); SetTouchable(true); - } CallerItemView::~CallerItemView() @@ -78,11 +77,11 @@ void CallerItemView::InitDateMonTime(time_t seconds) localtime_r(&seconds, &pTM); timeDisplay.erase(); if (pTM.tm_mday < NUM_10) { - string day = "0" + to_string(pTM.tm_mday); - timeDisplay = to_string(pTM.tm_mon) + "/" + day; + std::string day = "0" + std::to_string(pTM.tm_mday); + timeDisplay = std::to_string(pTM.tm_mon) + "/" + day; return; } - timeDisplay = to_string(pTM.tm_mon) + "/" + to_string(pTM.tm_mday); + timeDisplay = std::to_string(pTM.tm_mon) + "/" + std::to_string(pTM.tm_mday); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp index facd7fcfd..68aeab844 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogModel.cpp @@ -7,7 +7,7 @@ #include "CallerLogModel.h" #include "CallerLogView.h" #include "DialingScreenView.h" -#include "MainCallingView.h" +#include "CallingView.h" #include "service_id_define.h" #include "cmsis_os.h" #include "samgr_lite.h" @@ -29,7 +29,7 @@ static int g_isCall{NO_NUMBER_STATUS}; // 电话状态 static PhoneCallInfo callInfo{}; static int g_retNum{0}; // 电话个数 static int g_volumeLocal{0}; // 错误码返回 -osTimerId_t g_startCounting = NULL; // 定时器 +osTimerId_t g_startCounting = nullptr; // 定时器 static constexpr uint64_t MS_ONE_SECONDS = 1000; static PhoneCallInfo callList[MULTI_CALL_MAX_NUME]{}; // 电话优先级标志位 @@ -39,15 +39,6 @@ static int g_thirdPriority = NO_NUMBER_STATUS; static int g_fourthPriority = NO_NUMBER_STATUS; // 是否为手表接听状态 static bool g_isWatchCallView = false; -void g_callTimesclean() -{ - g_callTimes=0; -} - -void g_callTimesadd() -{ - g_callTimes++; -} static void SetPriorityNumber() { @@ -76,13 +67,13 @@ static void SetPriorityNumber() /* 关闭定时器 */ static void DisableCallingTimer() { - if (g_startCounting != NULL) { + if (g_startCounting != nullptr) { osStatus_t ret = osTimerDelete(g_startCounting); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret); return; } - g_startCounting = NULL; + g_startCounting = nullptr; g_callTimes = 0; } } @@ -94,7 +85,7 @@ static void StatusReset() CallerLogModel::GetInstance()->SetWaitingStatus(false); DisableCallingTimer(); // If the call is handling in the notification, the slice is not switched - if (CallerLogModel::GetInstance()->GetNotifyFlag() == false) { + if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); } else { g_isWatchCallView = false; @@ -108,22 +99,17 @@ static void CallTimerCallbackProc(int data) g_callTimes++; if (CallingView::GetInstance() == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallTimerCallbackProc] GetInstance is NULL"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallTimerCallbackProc] GetInstance is nullptr"); return; } if (CallingView::GetInstance()->GetCallingDurationLabel() == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallTimerCallbackProc] GetInstance()->GetCallingDurationLabel is NULL"); - return; - } - - if (CallerLogModel::GetInstance()->DisplayCallDuration() == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallTimerCallbackProc] DisplayCallDuration is NULL"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallTimerCallbackProc] GetInstance()->GetCallingDurationLabel is nullptr"); return; } CallingView::GetInstance()->GetCallingDurationLabel()-> - SetText(CallerLogModel::GetInstance()->DisplayCallDuration()); + SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str()); } static void CallTimerCallback(int data) @@ -134,12 +120,12 @@ static void CallTimerCallback(int data) /* 开启定时器 */ static void InitCallingTimer() { - if (g_startCounting != NULL) { + if (g_startCounting != nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer already exists!!"); return; } - g_startCounting = osTimerNew((osTimerFunc_t)CallTimerCallback, osTimerPeriodic, NULL, NULL); - if (g_startCounting == NULL) { + g_startCounting = osTimerNew((osTimerFunc_t)CallTimerCallback, osTimerPeriodic, nullptr, nullptr); + if (g_startCounting == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer osTimerNew failed!!"); return; } @@ -147,13 +133,13 @@ static void InitCallingTimer() osStatus_t retTimer = osTimerStart(g_startCounting, tick); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::CallerTimer osTimerStart failed, ret = %lx!!", retTimer); - if (g_startCounting != NULL) { + if (g_startCounting != nullptr) { retTimer = osTimerDelete(g_startCounting); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogModel::osTimerDelete failed, ret = %lx!!", retTimer); return; } - g_startCounting = NULL; + g_startCounting = nullptr; } return; } @@ -217,7 +203,7 @@ static void CallModelResumePlayer(void) usleep(5000); // 延时等待通话释放媒体资源 std::shared_ptr PlayerIntrptListener = OHOS::PlayersModel::GetInstance()->GetPlayerIntrptListener(); - if (PlayerIntrptListener != nullptr && PlayerIntrptListener->IsPaused() == true) { + if (PlayerIntrptListener != nullptr && PlayerIntrptListener->IsPaused()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallModelResumePlayer] ResumePlayer "); PlayerIntrptListener->ResumePlayer(); } @@ -244,7 +230,7 @@ static void ExitMakePhoneSlice(void) } CallerLogModel::GetInstance()->SetCallStatus(false); DisableCallingTimer(); - if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) { + if (CallerLogModel::GetInstance()->GetNotifyFlag()) { g_isWatchCallView = false; } } @@ -269,7 +255,7 @@ static void IncomingHandle(void) // 来电等待界面 static void WaitingOpreate() { - if (IsCompleteCallFlow() == false) { + if (!IsCompleteCallFlow()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[UsingPhoneChangeStatusCallback] is not complete call flow"); return; } @@ -277,8 +263,9 @@ static void WaitingOpreate() CallerLogModel::GetInstance()->SetCallStatus(false); CallerLogModel::GetInstance()->SetWaitingStatus(true); // If the call is handling in the notification, the slice is not switched - if (CallerLogModel::GetInstance()->GetNotifyFlag() == false) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TRANSITION_INVALID, PRIORITY_ONE); + if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { + NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, + PRIORITY_ONE); } else { g_isWatchCallView = true; } @@ -288,7 +275,7 @@ static void WatchActiveHandle(const PhoneCallInfo *phoneCall) { if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || NativeAbility::GetInstance().GetCurSliceId() == VIEW_OFFLINEVOICE || - CallerLogModel::GetInstance()->GetNotifyFlag() == true) { + CallerLogModel::GetInstance()->GetNotifyFlag()) { time_t seconds; time(&seconds); g_callTimes = seconds - phoneCall->activeTime; @@ -296,7 +283,7 @@ static void WatchActiveHandle(const PhoneCallInfo *phoneCall) InitCallingTimer(); CallerLogModel::GetInstance()->SetCallStatus(true); } - if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) { + if (CallerLogModel::GetInstance()->GetNotifyFlag()) { g_isWatchCallView = true; } } @@ -304,7 +291,7 @@ static void WatchActiveHandle(const PhoneCallInfo *phoneCall) static void PhoneActiveHandle(void) { if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || - g_isWatchCallView == true) { + g_isWatchCallView) { if (GetCurrCallNum() > 1) { g_phoneStatus = PHONE_MULTI_STATUS; if (GetScoConnectState() == HFP_SCO_STATE_DISCONNECTED) { @@ -313,7 +300,7 @@ static void PhoneActiveHandle(void) } TransCallToMobilePhone(); // If the call is handling in the notification, the slice is not switched - if (CallerLogModel::GetInstance()->GetNotifyFlag() == false) { + if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); // 退出通话界面,回到主表盘应用 } else { g_isWatchCallView = false; @@ -327,7 +314,7 @@ static void PhoneActiveHandle(void) static void OppoActiveHandle(const PhoneCallInfo *phoneCall) { if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || - g_isWatchCallView == true) { + g_isWatchCallView) { if (GetCurrCallNum() > 1) { g_phoneStatus = PHONE_MULTI_STATUS; return; @@ -345,27 +332,27 @@ bool MulitplePhoneTextReplaces() { DisableCallingTimer(); if (CallingView::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance is NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance is nullptr"); return false; } if (CallingView::GetInstance()->GetCallingDurationLabel() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance()->GetCallingDurationLabel is NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance()->GetCallingDurationLabel is nullptr"); return false; } if (CallingView::GetInstance()->GetCallingDisplayLabel() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance()->GetCallingDurationLabel is NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance()->GetCallingDurationLabel is nullptr"); return false; } if (MainCallingPresenter::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance()->MainCallingPresenter is NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance()->MainCallingPresenter is nullptr"); return false; } - if (MainCallingPresenter::GetInstance()->CallingViewDisplay() == false) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance()->CallingViewDisplay is NULL"); + if (!MainCallingPresenter::GetInstance()->CallingViewDisplay()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[MultiplePhonesViewDisplay] GetInstance()->CallingViewDisplay is nullptr"); return false; } @@ -383,14 +370,15 @@ static bool MultiplePhonesViewDisplay() DisableCallingTimer(); CallerLogModel::GetInstance()->SetMulitplePhoneStatus(true); CallerLogModel::GetInstance()->SetCallStatus(true); - if (CallerLogModel::GetInstance()->GetNotifyFlag() == false) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TRANSITION_INVALID, PRIORITY_ONE); + if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { + NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, + PRIORITY_ONE); } else { g_isWatchCallView = true; } return true; } - if (MulitplePhoneTextReplaces() == false) { + if (!MulitplePhoneTextReplaces()) { return false; } return true; @@ -402,14 +390,14 @@ static bool MultiplePhonesViewDisplay() static void NonWatchFinishHandle(int laststatus) { if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || - CallerLogModel::GetInstance()->GetNotifyFlag() == true) { + CallerLogModel::GetInstance()->GetNotifyFlag()) { if (GetCurrCallNum() == 0) { StatusReset(); CallModelPostGraphicEvent(CallModelResumePlayer); g_phoneStatus = PHONE_SINGLE_STATUS; } else if (g_phoneStatus == PHONE_MULTI_STATUS) { MultiplePhonesViewDisplay(); - } else if (FindCallListInfoAndSetPriorityNumber() == true) { + } else if (FindCallListInfoAndSetPriorityNumber()) { if (laststatus == HFP_HF_CALL_STATE_ACTIVE || laststatus == HFP_HF_CALL_STATE_HELD) { CallerLogModel::GetInstance()->SetCallStatus(false); CallerLogModel::GetInstance()->SetWaitingStatus(false); @@ -418,8 +406,9 @@ static void NonWatchFinishHandle(int laststatus) CallerLogModel::GetInstance()->SetWaitingStatus(false); } // If the call is handling in the notification, the slice is not switched - if (CallerLogModel::GetInstance()->GetNotifyFlag() == false) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TRANSITION_INVALID, PRIORITY_ONE); + if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { + NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, + PRIORITY_ONE); } else { g_isWatchCallView = true; } @@ -436,7 +425,7 @@ static void NonWatchFinishHandle(int laststatus) static void WatchFinishHandle(void) { if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_MAEKPHONE_SAMPLE || - CallerLogModel::GetInstance()->GetNotifyFlag() == true) { + CallerLogModel::GetInstance()->GetNotifyFlag()) { if (GetCurrCallNum() == 0) { StatusReset(); CallerLogModel::GetInstance()->SetNotifyFlag(false); @@ -453,28 +442,33 @@ static void WatchFinishHandle(void) static void ChangeStatusScreendisplay(int lastStatus) { if (GetScoConnectState() != HFP_SCO_STATE_CONNECTED) { - if (lastStatus == OPERATE_INCOMING) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] lastStatus OPERATE_INCOMING"); - } else if (GetCurrCallNum() == 1 && (lastStatus == OPERATE_DIALING || - lastStatus == OPERATE_ALERTING)) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] lastStatus OPERATE_ALERTING"); + if (lastStatus == HFP_HF_CALL_STATE_ACTIVE) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ACTIVE"); + StatusReset(); + return; + } else if (lastStatus == HFP_HF_CALL_STATE_INCOMING) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_INCOMING"); + } else if (GetCurrCallNum() == 1 && (lastStatus == HFP_HF_CALL_STATE_DIALING || + lastStatus == HFP_HF_CALL_STATE_ALERTING)) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] STATE_ALERTING"); } else if (GetCurrCallNum() > 1) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] GetCurrCallNum MULITE"); DisableCallingTimer(); return; } } - if (IsCompleteCallFlow() == false) { + if (!IsCompleteCallFlow()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] is not complete call flow"); return; } - if (MultiplePhonesViewDisplay() == true) { + if (MultiplePhonesViewDisplay()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ChangeStatusScreendisplay] MultiplePhonesViewDisplay"); return; } // If the call is handling in the notification, the slice is not switched - if (g_callOperate != OPERATE_PHONE_ACTIVE && CallerLogModel::GetInstance()->GetNotifyFlag() != true) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TRANSITION_INVALID, PRIORITY_ONE); + if (g_callOperate != OPERATE_PHONE_ACTIVE && (!CallerLogModel::GetInstance()->GetNotifyFlag())) { + NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, + PRIORITY_ONE); } } @@ -553,7 +547,7 @@ static void ScoConnectHandle(void) return; } - if (FindCallListInfoAndSetPriorityNumber() == false) { + if (!FindCallListInfoAndSetPriorityNumber()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ScoConnectHandle FindCallListInfoAndSetPriorityNumber false"); return; } @@ -587,17 +581,18 @@ static void ScoConnectHandle(void) break; } g_isCall = NO_NUMBER_STATUS; - if (IsCompleteCallFlow() == false) { + if (!IsCompleteCallFlow()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectHandle] is not complete call flow"); return; } - if (MultiplePhonesViewDisplay() == true) { + if (MultiplePhonesViewDisplay()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectHandle] MultiplePhonesViewDisplay"); return; } // If the call is handling in the notification, the slice is not switched - if (CallerLogModel::GetInstance()->GetNotifyFlag() == false) { - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TRANSITION_INVALID, PRIORITY_ONE); + if (!CallerLogModel::GetInstance()->GetNotifyFlag()) { + NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, + PRIORITY_ONE); } else { g_isWatchCallView = true; } @@ -613,7 +608,7 @@ void UsingPhoneScoStatausCallback(hfp_sco_connect_state_t state) { WEARABLE_LOGD(HILOG_MODULE_AAFWK, "UsingPhoneScoStatausCallback SOC state: %d", state); - if (IsCompleteCallFlow() == false) { + if (!IsCompleteCallFlow()) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[UsingPhoneScoStatausCallback] is not complete call flow"); return; } @@ -673,7 +668,7 @@ void CallerLogModel::InitPhoneService() } /* 表盘底部时间显示 */ -string CallerLogModel::InitDateHourTime(void) +std::string CallerLogModel::InitDateHourTime(void) { struct tm pTM; time_t seconds; @@ -681,21 +676,21 @@ string CallerLogModel::InitDateHourTime(void) localtime_r(&seconds, &pTM); timers.erase(); if (pTM.tm_min < NUM_TEN) { - string min = "0" + to_string(pTM.tm_min); - timers = to_string(pTM.tm_hour) + ":" + min; + std::string min = "0" + std::to_string(pTM.tm_min); + timers = std::to_string(pTM.tm_hour) + ":" + min; return timers; } - timers = to_string(pTM.tm_hour) + ":" + to_string(pTM.tm_min); + timers = std::to_string(pTM.tm_hour) + ":" + std::to_string(pTM.tm_min); return timers; } /* 表盘通话时间显示 */ -char *CallerLogModel::DisplayCallDuration() +std::string& CallerLogModel::DisplayCallDuration() { callDuration.erase(); - string hours; - string minute; - string seconds; + std::string hours; + std::string minute; + std::string seconds; if (g_callTimes >= NUM_TIME_DAY) { g_callTimes = 0; } @@ -703,19 +698,19 @@ char *CallerLogModel::DisplayCallDuration() int min = (g_callTimes % NUM_TIME_HOUR) / NUM_TIME_MIN; int sec = (g_callTimes % NUM_TIME_HOUR) % NUM_TIME_MIN; if (hour >= 0 && hour < NUM_TEN) { - hours = "0" + to_string(hour); + hours = "0" + std::to_string(hour); } else { - hours = to_string(hour); + hours = std::to_string(hour); } if (min >= 0 && min < NUM_TEN) { - minute = "0" + to_string(min); + minute = "0" + std::to_string(min); } else { - minute = to_string(min); + minute = std::to_string(min); } if (sec >= 0 && sec < NUM_TEN) { - seconds = "0" + to_string(sec); + seconds = "0" + std::to_string(sec); } else { - seconds = to_string(sec); + seconds = std::to_string(sec); } if (hour == 0) { @@ -723,7 +718,7 @@ char *CallerLogModel::DisplayCallDuration() } else { callDuration = hours + ":" + minute + ":" + seconds; } - return (char *)callDuration.c_str(); + return callDuration; } /* 拨号与响铃状态显示 */ @@ -733,7 +728,7 @@ void CallerLogModel::SetDialingStatus(const char *text) dialingStatus.append(reinterpret_cast(text)); } -string CallerLogModel::GetDialingStatus(void) +std::string CallerLogModel::GetDialingStatus(void) { return dialingStatus; } @@ -805,7 +800,7 @@ void CallerLogModel::SetoperateNumber(const char *number, char number_len) phoneNumber.append(reinterpret_cast(number), number_len); } -string CallerLogModel::GetPhoneNumber(void) +std::string CallerLogModel::GetPhoneNumber(void) { return phoneNumber; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp index 63d74d946..6311f7b94 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogPresenter.cpp @@ -46,7 +46,7 @@ void CallerLogPresenter::OnPause(void) {} void CallerLogPresenter::OnStop(void) { - if (hintsCounting != NULL) { + if (hintsCounting != nullptr) { if (g_pMainView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::CallerLogPresenter g_pMainView nullptr"); return; @@ -65,12 +65,12 @@ void BuletoothHintsCallback(int data) /* 开启定时器 */ void CallerLogPresenter::InitBluetoothHints() { - if (hintsCounting != NULL) { + if (hintsCounting != nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::BluetoothHints already exists!"); return; } - hintsCounting = osTimerNew((osTimerFunc_t)BuletoothHintsCallback, osTimerPeriodic, NULL, NULL); - if (hintsCounting == NULL) { + hintsCounting = osTimerNew((osTimerFunc_t)BuletoothHintsCallback, osTimerPeriodic, nullptr, nullptr); + if (hintsCounting == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::BluetoothHints osTimerNew failed!"); return; } @@ -78,13 +78,13 @@ void CallerLogPresenter::InitBluetoothHints() osStatus_t retTimer = osTimerStart(hintsCounting, tick); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::BluetoothHints osTimerStart failed, ret = %lx!", retTimer); - if (hintsCounting != NULL) { + if (hintsCounting != nullptr) { retTimer = osTimerDelete(hintsCounting); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogPresenter::osTimerDelete failed, ret = %lx!", retTimer); return; } - hintsCounting = NULL; + hintsCounting = nullptr; } return; } @@ -107,13 +107,13 @@ void CallerLogPresenter::BuletoothHintsCallbackProc(int data) /* 关闭定时器 */ void CallerLogPresenter::DisableBluetoothHints() { - if (hintsCounting != NULL) { + if (hintsCounting != nullptr) { osStatus_t ret = osTimerDelete(hintsCounting); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanBuletoothHintsCallback osTimerDelete failed, ret = %lx!!", ret); return; } - hintsCounting = NULL; + hintsCounting = nullptr; } } @@ -147,8 +147,8 @@ bool CallerLogPresenter::OnClick(UIView &view, const ClickEvent &event) } if (0 <= view.GetViewIndex() && view.GetViewIndex() < dataNumber) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "callnumber %s, callnumbernum %d", - (char *)(view_->GetCurrentCallInfo() + dataNumber - view.GetViewIndex() - 1)->tel, - (view_->GetCurrentCallInfo() + dataNumber - view.GetViewIndex() - 1)->telLen); + (char *)(view_->GetCurrentCallInfo() + dataNumber - view.GetViewIndex() - 1)->tel, + (view_->GetCurrentCallInfo() + dataNumber - view.GetViewIndex() - 1)->telLen); CallerLogModel::GetInstance()->SetoperateNumber( (char *)(view_->GetCurrentCallInfo() + dataNumber - view.GetViewIndex() - 1)->tel, diff --git a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogView.cpp index ac65dc782..8d4452510 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/callerlog/src/CallerLogView.cpp @@ -41,7 +41,7 @@ CallerLogView::~CallerLogView() delete imageView; imageView = nullptr; - if (item.IsEmpty() == false) { + if (!item.IsEmpty()) { Vector().Swap(item); } @@ -206,18 +206,18 @@ void CallerLogView::OnStart() View::OnStart(); BaseView::RootView(Color::Black().full); - if (CreateNoDataCallerLogViewGroup() == false) { + if (!CreateNoDataCallerLogViewGroup()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogView::CreateNoDataCallerLogViewGroup error"); return; } RootView::GetInstance()->Add(group); - if (CreateCallerLogViewGroup() == false) { + if (!CreateCallerLogViewGroup()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogView::CreateCallerLogViewGroup error"); return; } - if (InitOrBandOnclickEvent() == false) { + if (!InitOrBandOnclickEvent()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerLogView::InitOrBandOnclickEvent fail"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h b/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h index 9f67b8134..861d2dec0 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/clock/include/MainClockView.h @@ -9,7 +9,7 @@ #define MAIN_CLOCK_VIEW_H #include -#include +#include #include "View.h" #include "components/ui_label.h" #include "components/root_view.h" @@ -27,14 +27,14 @@ #include "UiConfig.h" #include "components/ui_card_page.h" #include "animator/animator_manager.h" -#include "time.h" +#include #include "sys/time.h" namespace OHOS { class MainClockView : public UICardPage { public: MainClockView(); - virtual ~MainClockView(); + ~MainClockView() override; static MainClockView *GetInstance(void); bool InitView(void); void PreLoad(void) override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp index 0b446b997..6fb226b6e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/clock/src/MainClockView.cpp @@ -11,7 +11,7 @@ #include "wearable_log.h" #include "ui_resource_image.h" #include "common/image_cache_manager.h" -#include +#include namespace OHOS { static MainClockView *g_pMainClockView = nullptr; @@ -64,41 +64,43 @@ MainClockView::MainClockView() MainClockView::~MainClockView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainClockView::~MainClockView"); - mainSweepClock->RemoveAll(); - delete curFace; - curFace = nullptr; - delete stepLabel; - stepLabel = nullptr; - delete batteryLabel; - batteryLabel = nullptr; - delete secondHand; - secondHand = nullptr; - delete minuteHand; - minuteHand = nullptr; - delete hourHand; - hourHand = nullptr; - delete weekLabel; - weekLabel = nullptr; - delete heartRateLabel; - heartRateLabel = nullptr; - delete heartRate; - heartRate = nullptr; - delete hand24Hour; - hand24Hour = nullptr; - delete weekDay; - weekDay = nullptr; - delete progress; - progress = nullptr; - delete bigCircle; - bigCircle = nullptr; - delete medCircle; - medCircle = nullptr; - delete smallCircle; - smallCircle = nullptr; - Remove(mainSweepClock); - delete mainSweepClock; - mainSweepClock = nullptr; - g_pMainClockView = nullptr; + if (viewiInitStatus) { + mainSweepClock->RemoveAll(); + delete curFace; + curFace = nullptr; + delete stepLabel; + stepLabel = nullptr; + delete batteryLabel; + batteryLabel = nullptr; + delete secondHand; + secondHand = nullptr; + delete minuteHand; + minuteHand = nullptr; + delete hourHand; + hourHand = nullptr; + delete weekLabel; + weekLabel = nullptr; + delete heartRateLabel; + heartRateLabel = nullptr; + delete heartRate; + heartRate = nullptr; + delete hand24Hour; + hand24Hour = nullptr; + delete weekDay; + weekDay = nullptr; + delete progress; + progress = nullptr; + delete bigCircle; + bigCircle = nullptr; + delete medCircle; + medCircle = nullptr; + delete smallCircle; + smallCircle = nullptr; + Remove(mainSweepClock); + delete mainSweepClock; + mainSweepClock = nullptr; + g_pMainClockView = nullptr; + } } MainClockView *MainClockView::GetInstance(void) @@ -185,7 +187,7 @@ bool MainClockView::InitCenterCircleView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bigCircle new fail"); return false; } - if (LoadClockImage(bigCircle, CLOCK_BIGCIRCLE_IMAGE_PATH) == false) { + if (!LoadClockImage(bigCircle, CLOCK_BIGCIRCLE_IMAGE_PATH)) { return false; } @@ -194,7 +196,7 @@ bool MainClockView::InitCenterCircleView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "medCircle new fail"); return false; } - if (LoadClockImage(medCircle, CLOCK_MEDCIRCLE_IMAGE_PATH) == false) { + if (!LoadClockImage(medCircle, CLOCK_MEDCIRCLE_IMAGE_PATH)) { return false; } @@ -203,7 +205,7 @@ bool MainClockView::InitCenterCircleView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "smallCircle new fail"); return false; } - if (LoadClockImage(smallCircle, CLOCK_CIRCLE_IMAGE_PATH) == false) { + if (!LoadClockImage(smallCircle, CLOCK_CIRCLE_IMAGE_PATH)) { return false; } return true; @@ -216,7 +218,7 @@ bool MainClockView::InitHandView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "secondHand new fail"); return false; } - if (LoadClockImage(secondHand, CLOCK_SECONDHAND) == false) { + if (!LoadClockImage(secondHand, CLOCK_SECONDHAND)) { return false; } @@ -225,7 +227,7 @@ bool MainClockView::InitHandView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "minuteHand new fail"); return false; } - if (LoadClockImage(minuteHand, CLOCK_MINUTEHAND) == false) { + if (!LoadClockImage(minuteHand, CLOCK_MINUTEHAND)) { return false; } hourHand = new Image(); @@ -233,7 +235,7 @@ bool MainClockView::InitHandView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hourHand new fail"); return false; } - if (LoadClockImage(hourHand, CLOCK_HOURHAND) == false) { + if (!LoadClockImage(hourHand, CLOCK_HOURHAND)) { return false; } @@ -242,7 +244,7 @@ bool MainClockView::InitHandView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "hand24Hour new fail"); return false; } - if (LoadClockImage(hand24Hour, CLOCK_HAND24HOUR_IMAGE_PATH) == false) { + if (!LoadClockImage(hand24Hour, CLOCK_HAND24HOUR_IMAGE_PATH)) { return false; } return true; @@ -281,16 +283,16 @@ bool MainClockView::InitSweepClock(void) } curFace->SetPosition(0, 0); - if (LoadClockImage(curFace, CLOCK_MAIN_FACE_IMAGE) == false) { + if (!LoadClockImage(curFace, CLOCK_MAIN_FACE_IMAGE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "curFace LoadClockImage CLOCK_MAIN_FACE_IMAGE fail"); return false; } - if (InitLabelView() == false) { + if (!InitLabelView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitLabelView() fail"); return false; } - if (InitCenterCircleView() == false) { + if (!InitCenterCircleView()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitCenterCircleView() fail"); return false; } @@ -300,7 +302,7 @@ bool MainClockView::InitSweepClock(void) return false; } heartRate->SetPosition(HEARTRATE_POSITION_X, HEARTRATE_POSITION_Y); - if (LoadClockImage(heartRate, CLOCK_HEARTRATE_IMAGE_PATH) == false) { + if (!LoadClockImage(heartRate, CLOCK_HEARTRATE_IMAGE_PATH)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "heartRate LoadClockImage CLOCK_HEARTRATE_IMAGE_PATH fail"); return false; } @@ -311,7 +313,7 @@ bool MainClockView::InitSweepClock(void) return false; } progress->SetPosition(PROGRESS_POSITION_X, PROGRESS_POSITION_Y); - if (LoadClockImage(progress, CLOCK_PROGRESS_IMAGE_PATH) == false) { + if (!LoadClockImage(progress, CLOCK_PROGRESS_IMAGE_PATH)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "progress LoadClockImage CLOCK_PROGRESS_IMAGE_PATH fail"); return false; } @@ -323,7 +325,7 @@ bool MainClockView::InitSweepClock(void) return false; } weekDay->SetPosition(WEEKDAY_POSITION_X, WEEKDAY_POSITION_Y); - if (LoadClockImage(weekDay, CLOCK_THURSDAY_IMAGE_PATH) == false) { + if (!LoadClockImage(weekDay, CLOCK_THURSDAY_IMAGE_PATH)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "weekDay LoadClockImage CLOCK_THURSDAY_IMAGE_PATH fail"); return false; } @@ -352,7 +354,7 @@ bool MainClockView::InitView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "mainSweepClock new fail"); return false; } - if (InitSweepClock() == false) { + if (!InitSweepClock()) { return false; } @@ -422,7 +424,7 @@ void MainClockView::InitDateTime(void) void MainClockView::UpdateTime(void) { struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); uint64_t second = tv.tv_sec; uint64_t uSecond = tv.tv_usec; uint64_t minute = second / MIN_TO_HOUR; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassCalibrationView.h b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassCalibrationView.h index 084a63013..704e60d96 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassCalibrationView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassCalibrationView.h @@ -18,7 +18,7 @@ namespace OHOS { class CompassCalibrationView : public AppGroupView { public: CompassCalibrationView(); - virtual ~CompassCalibrationView(); + ~CompassCalibrationView() override; bool CreateUIViewGroup(void); static CompassCalibrationView *GetInstance(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassControlView.h b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassControlView.h index 1e20fe6d1..3dc43f20f 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassControlView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassControlView.h @@ -19,7 +19,7 @@ namespace OHOS { class CompassControlView : public UICardPage { public: CompassControlView(); - virtual ~CompassControlView(); + ~CompassControlView() override; bool InitView(void); void PreLoad(void) override; void UnLoad(void) override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassModel.h b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassModel.h index 0913d97b2..d15e900ac 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassModel.h @@ -8,7 +8,7 @@ #ifndef COMPASS_MODEL_H #define COMPASS_MODEL_H -#include "stdint.h" +#include namespace OHOS { class CompassModel { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassView.h b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassView.h index 72597b580..97cd957d1 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/CompassView.h @@ -23,7 +23,7 @@ static constexpr float VIEW_CENTERS = 227; class CompassView : public AppGroupView { public: CompassView(); - virtual ~CompassView(); + ~CompassView() override; void DirectionSetText(const char *text, const char *angle); static CompassView *GetInstance(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/MainCompassPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/MainCompassPresenter.h index 00c389a9f..f3f835770 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/MainCompassPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/MainCompassPresenter.h @@ -12,7 +12,6 @@ #include "ohos_types.h" #include "UiConfig.h" #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "CompassView.h" #include "CompassPresenter.h" #include "CompassModel.h" @@ -24,16 +23,16 @@ class MainCompassPresenter : public Presenter, public CompassPresen public ModelListenerSample, public UIView::OnDragListener { public: MainCompassPresenter(); - virtual ~MainCompassPresenter(); + ~MainCompassPresenter() override; - virtual void OnStart() override; - virtual void OnPause() override; - virtual void OnResume() override; - virtual void OnStop() override; + void OnStart() override; + void OnPause() override; + void OnResume() override; + void OnStop() override; static MainCompassPresenter *GetInstance(void); bool OnDrag(UIView& view, const DragEvent& event) override; - virtual void Notify() override; + void Notify() override; }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/MainCompassView.h b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/MainCompassView.h index fe78abe5f..b3bacb97c 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/include/MainCompassView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/include/MainCompassView.h @@ -28,7 +28,7 @@ class CompassView; class MainCompassView : public View { public: MainCompassView(); - virtual ~MainCompassView(); + ~MainCompassView() override; void OnStart() override; void OnSetUpView() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassCalibrationView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassCalibrationView.cpp index 568a6558b..390c0ae82 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassCalibrationView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassCalibrationView.cpp @@ -113,7 +113,7 @@ bool CompassCalibrationView::InitView(void *caller) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassCalibrationView InitView %p", caller); bool ret = CreateUIViewGroup(); - if (ret == false) { + if (!ret) { return false; } SetDraggable(true); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassControlView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassControlView.cpp index da7f8f46f..546dd33f8 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassControlView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassControlView.cpp @@ -17,7 +17,9 @@ CompassControlView::CompassControlView() CompassControlView::~CompassControlView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassControlView::~CompassControlView()"); - ClearAll(); + if (viewiInitStatus) { + ClearAll(); + } } void CompassControlView::ClearAll(void) @@ -41,7 +43,7 @@ bool CompassControlView::InitView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CompassCalibrationView::new compassCalibrationView fail"); return false; } - if (compassCalibrationView->CreateUIViewGroup() == false) { + if (!compassCalibrationView->CreateUIViewGroup()) { return false; } @@ -50,7 +52,7 @@ bool CompassControlView::InitView(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CompassView::new compassView fail"); return false; } - if (compassView->InitPage() == false) { + if (!compassView->InitPage()) { return false; } Add(compassView); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassModel.cpp index 1675aa814..e9ff3f5c8 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassModel.cpp @@ -7,7 +7,7 @@ #include #include "CompassModel.h" -#include "time.h" +#include #ifdef __cplusplus extern "C" { @@ -62,7 +62,7 @@ time_t CompassModel::GetLastTime(void) time_t CompassModel::GetCurrentTime(void) { struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); return tv.tv_sec; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassPresenter.cpp index 48aa8bcda..4a48b5458 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassPresenter.cpp @@ -145,15 +145,15 @@ void CompassPresenter::DetermineToRotate(void) return; } bool initState = CompassView::GetInstance()->GetInitViewState(); - if (initState == true) { - if (initDisplayStatus == true) { + if (initState) { + if (initDisplayStatus) { currentRotateAngle = CompassModel::GetInstance()->GetDisplayAngle(); lastRotateAngle = currentRotateAngle; CompassView::GetInstance()->CompassStartRotate(lastRotateAngle); DisplayAngleDir(currentRotateAngle); initDisplayStatus = false; } else { - if (getAngleStatus == false) { + if (!getAngleStatus) { currentRotateAngle = CompassModel::GetInstance()->GetDisplayAngle(); } InScopeRotate(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassView.cpp index 5f4b901a5..5b3bbc27d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/compass/src/CompassView.cpp @@ -94,7 +94,7 @@ bool CompassView::InitCompassImage(void) } backGround->SetPosition(0, 0); - if (LoadCompassImage(backGround, COMPASS_COMPASS) == false) { + if (!LoadCompassImage(backGround, COMPASS_COMPASS)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d], triangulation load fail", __LINE__); return false; } @@ -105,7 +105,7 @@ bool CompassView::InitCompassImage(void) return false; } rotateShaft->SetPosition(POINT_CENTER_IMAGE_X, POINT_CENTER_IMAGE_Y); - if (LoadCompassImage(rotateShaft, COMPASS_ROTATE_CENTER_IMAGE) == false) { + if (!LoadCompassImage(rotateShaft, COMPASS_ROTATE_CENTER_IMAGE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[%d], rotateShaft load fail", __LINE__); return false; } @@ -116,7 +116,7 @@ bool CompassView::InitCompassImage(void) return false; } triangulation->SetPosition(TRIANGULATION_X, TRIANGULATION_Y); - if (LoadCompassImage(triangulation, COMPASS_CORRESPONDENCE_DEGREE) == false) { + if (!LoadCompassImage(triangulation, COMPASS_CORRESPONDENCE_DEGREE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "triangulation load fail"); return false; } @@ -125,7 +125,7 @@ bool CompassView::InitCompassImage(void) bool CompassView::InitPage(void) { - if (InitCompassImage() == false) { + if (!InitCompassImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitCompassImage fail"); ClearAll(); return false; @@ -176,7 +176,7 @@ bool CompassView::InitPage(void) bool CompassView::InitView(void *caller) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CompassView InitView %p", caller); - if (InitPage() == false) { + if (!InitPage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitPage fail"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/include/ConnectPhonePresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/include/ConnectPhonePresenter.h index 0c73d6fbc..2920e0667 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/include/ConnectPhonePresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/include/ConnectPhonePresenter.h @@ -47,7 +47,6 @@ public: private: char watchName[32]; - }; } // namespace OHOS #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp index b68888a45..47ad06a7b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp @@ -49,7 +49,7 @@ void ConnectOpenView::ShowUpBackView() watchNameLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); // 40:font data watchNameLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); watchNameLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, - UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); + UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); group->Add(watchNameLabel); } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp index 67014059c..06a0bce1e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp @@ -81,7 +81,7 @@ void ConnectPhonePresenter::RemovePair() if (connedDevicesNum != 0) { gap_paired_device_info_t *devInfo = (gap_paired_device_info_t *)malloc(sizeof(gap_paired_device_info_t) * connedDevicesNum); - if (devInfo == NULL) { + if (devInfo == nullptr) { return; } ret = gap_get_paired_devices_list(devInfo, (int *)&connedDevicesNum); @@ -105,12 +105,12 @@ void ConnectPhonePresenter::ConfirmOnClick() (void)sprintf_s(watchName, sizeof(watchName), "Watch%x", ((uint32_t)uapi_tcxo_get_us() & 0xFFFF)); ret = bluetooth_set_local_name((unsigned char*)watchName, strlen((char*)watchName) + 1); - if (ret == false) { + if (!ret) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectPhonePresenter: bt SetLocalName ret = 0x%x", ret); } ret = gap_br_set_bt_scan_mode(GAP_SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, 60); // start scan - if (ret == false) { + if (!ret) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectPhonePresenter bt gap_br_set_bt_scan_mode ret = 0x%x", ret); } #ifndef SUPPORT_ALIPAY_SEC @@ -121,7 +121,6 @@ void ConnectPhonePresenter::ConfirmOnClick() bool ConnectPhonePresenter::OnDrag(UIView& view, const DragEvent& event) { std::string viewId = view.GetViewId(); - if ((viewId == CONNECT_SELECT_VIEW) || (viewId == CONNECT_OPEN_VIEW)) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectPhonePresenter::OnDrag"); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhoneView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhoneView.cpp index 0738e4b5c..3ad8e6669 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhoneView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhoneView.cpp @@ -132,14 +132,14 @@ void ConnectPhoneView::ChangeView(int16_t hideView, int16_t showView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ConnectPhoneView::ChangeView %d, %d", hideView, showView); - if (CheckViewParam(hideView, showView) == false) { + if (!CheckViewParam(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectPhoneView::CheckViewParam failed."); return; } PreprosssChangeView tmpPreProcessView = preProcessView[showView]; - if ((this->*tmpPreProcessView)(hideView, showView) == false) { + if (!(this->*tmpPreProcessView)(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectPhoneView::ChangeView %d %dfailed", showView, hideView); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartModel.h b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartModel.h index 1a97e8e6a..3891ec79a 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartModel.h @@ -1,7 +1,7 @@ #ifndef HEART_MODEL_H #define HEART_MODEL_H -#include +#include #include "broadcast_feature.h" #include "broadcast_service.h" #include "samgr_lite.h" @@ -31,14 +31,14 @@ typedef struct { } HeartPoint; typedef struct { - uint16_t perSec; //每秒心率 - uint16_t rest; //静息心率 - uint16_t minX; //最小坐标(实际上是时间) - uint16_t minValue; //最小值? - uint16_t maxX; //最大值时X坐标,相当于第几个测量值 - uint16_t maxValue; //最大值 心率测量值 - uint16_t index; //value 有效值个数 - Point value[HEART_ALL_POINTS]; // + uint16_t perSec; + uint16_t rest; + uint16_t minX; + uint16_t minValue; + uint16_t maxX; + uint16_t maxValue; + uint16_t index; + Point value[HEART_ALL_POINTS]; } HeartInfo; #pragma pack(4) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRateView.h b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRateView.h index 37615cb5d..11d02cc14 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRateView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/include/HeartRateView.h @@ -35,7 +35,7 @@ namespace OHOS { class HeartRateView : public UICardPage { public: HeartRateView(); - virtual ~HeartRateView(); + ~HeartRateView() override; static HeartRateView *GetInstance(void); bool InitView(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartModel.cpp index 54098cc04..852053b9b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartModel.cpp @@ -24,20 +24,20 @@ using namespace OHOS; static void Notify(void *args, const Topic topic, Request* request); Subscriber heartSubscirber = { - .identity = NULL, - .args = NULL, + .identity = nullptr, + .args = nullptr, .Notify = Notify, }; void HeartDataSubscribeTopic(Topic topic) { - BroadcastApi *broadcastApi = NULL; + BroadcastApi *broadcastApi = nullptr; IUnknown *api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); - if (api == NULL) { + if (api == nullptr) { return; } int result = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi); - if (result != 0 || broadcastApi == NULL) { + if (result != 0 || broadcastApi == nullptr) { return; } int ret = broadcastApi->SubscribeTopic((IUnknown *)broadcastApi, topic, &heartSubscirber); @@ -47,13 +47,13 @@ void HeartDataSubscribeTopic(Topic topic) void HearDatatUnsubscribeTopic(Topic topic) { - BroadcastApi *broadcastApi = NULL; + BroadcastApi *broadcastApi = nullptr; IUnknown *api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); - if (api == NULL) { + if (api == nullptr) { return; } int result = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi); - if (result != 0 || broadcastApi == NULL) { + if (result != 0 || broadcastApi == nullptr) { return; } broadcastApi->UnsubscribeTopic((IUnknown *)broadcastApi, topic, &heartSubscirber); @@ -64,19 +64,19 @@ static void Notify(void *args, const Topic topic, Request* request) { UNUSED(args); UNUSED(topic); - if (request == NULL) { + if (request == nullptr) { return; } if (request->msgId == TOPIC_EVENT_HEARTRATE_UPDATA) { HeartDatas *heartInfo = (HeartDatas*)malloc(sizeof(HeartDatas)); - if (heartInfo == NULL) { + if (heartInfo == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[Notify] malloc fail"); } int rets = memcpy_s(heartInfo, sizeof(HeartDatas), (HeartInfo*)request->data, request->len); if (rets != EOK) { free(heartInfo); - heartInfo = NULL; + heartInfo = nullptr; WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s heartRateData fail! ret = %d", rets); return; } @@ -84,7 +84,7 @@ static void Notify(void *args, const Topic topic, Request* request) OHOS::HeartModel::GetInstance()->HeartRatePros(heartInfo); free(heartInfo); - heartInfo = NULL; + heartInfo = nullptr; } if (request->msgId == TOPIC_EVENT_NEXTDAY_UPDATE) { OHOS::HeartModel::GetInstance()->ClearHeartData(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRateView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRateView.cpp index 5ece7d2b7..8c9643544 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRateView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/heartrate/src/HeartRateView.cpp @@ -161,7 +161,7 @@ HeartRateView::HeartRateView() HeartRateView::~HeartRateView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HeartRateView::~HeartRateView"); - if (viewiInitStatus == true) { + if (viewiInitStatus) { int32_t i; RemoveAll(); delete imageViewCoordinate; @@ -208,22 +208,18 @@ HeartRateView *HeartRateView::GetInstance(void) int32_t HeartRateView::InitHeartRateData(void) // 初始化心率数据,将存放心率数据的有效字节设置为无效值 { - int32_t ret; - heartRateData[0].x = INVALID_HEART_VALUE; heartRateData[0].y = INVALID_HEART_VALUE; - ret = memset_s(heartRateData, sizeof(Point) * HEART_AVE_NUM, INVALID_HEART_VALUE, sizeof(Point) * HEART_AVE_NUM); + int32_t ret = memset_s(heartRateData, sizeof(Point) * HEART_AVE_NUM, INVALID_HEART_VALUE, sizeof(Point) * HEART_AVE_NUM); if (ret != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartRateView::[InitHeartRateData] memset_s heartRateData fail! ret = %d", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartRateView::[InitHeartRateData] memset_s heartRateData fail! ret = %d", ret); } return ret; } int32_t HeartRateView::SetHeartRateData(Point *rateData, uint32 rateDataSize) { - int ret; - if (rateData == nullptr) { return OHOS_FAILURE; } @@ -232,35 +228,32 @@ int32_t HeartRateView::SetHeartRateData(Point *rateData, uint32 rateDataSize) rateDataSize = sizeof(Point) * HEART_AVE_NUM; } InitHeartRateData(); - ret = memcpy_s(heartRateData, sizeof(Point) * HEART_AVE_NUM, rateData, rateDataSize); + int32_t ret = memcpy_s(heartRateData, sizeof(Point) * HEART_AVE_NUM, rateData, rateDataSize); if (ret != EOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartRateView::[HeartRateDataProc] memcpy_s heartRateData fail! ret = %d", ret); return OHOS_FAILURE; } - return OHOS_SUCCESS; } int32_t HeartRateView::HeartRateDataProc(void) { - int32_t i, ret; Point datain[HEART_AVE_NUM]; - - ret = memcpy_s(datain, sizeof(Point) * HEART_AVE_NUM, heartRateData, sizeof(Point) * HEART_AVE_NUM); + int32_t ret = memcpy_s(datain, sizeof(Point) * HEART_AVE_NUM, heartRateData, sizeof(Point) * HEART_AVE_NUM); if (ret != EOK) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartRateView::[HeartRateDataProc] memcpy_s rateDataTmp fail! ret = %d", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartRateView::[HeartRateDataProc] memcpy_s rateDataTmp fail! ret = %d", ret); return OHOS_FAILURE; } ret = memset_s(rateDataTmp, sizeof(Point) * HEART_AVE_NUM, INVALID_HEART_VALUE, sizeof(Point) * HEART_AVE_NUM); // 替换为无效值 if (ret != EOK) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartRateView::[HeartRateDataProc] memset_s rateDataTmp fail! ret = %d", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartRateView::[HeartRateDataProc] memset_s rateDataTmp fail! ret = %d", ret); return OHOS_FAILURE; } dataNume = 0; - for (i = 0; i < HEART_AVE_NUM; i++) { + for (int32_t i = 0; i < HEART_AVE_NUM; i++) { if (datain[i].x >= 0 && datain[i].x < HEART_AVE_NUM && datain[i].y > 0 && datain[i].y <= HEART_RATE_LIMIT_UPPER) { rateDataTmp[dataNume].x = datain[i].x + COORDINATE_VALUE; @@ -390,7 +383,6 @@ void HeartRateView::InsertTopAndBottomRateImage(void) void HeartRateView::UpdataTopAndBottomRate(void) { - uint16_t bottom, top; if (chart == nullptr) { return; } @@ -427,7 +419,7 @@ void HeartRateView::UpdataTopAndBottomRate(void) dataTopAndbottom->SetBottomPointStyle(pointStyle); chart->Invalidate(); - bottom = dataTopAndbottom->GetValleyData() * ACT_IMAGE_COOR_VALUE / ACT_IMAGE_COOR_PIXELS; + uint16_t bottom = dataTopAndbottom->GetValleyData() * ACT_IMAGE_COOR_VALUE / ACT_IMAGE_COOR_PIXELS; // 最高心跳 dataTopAndbottom->EnableTopPoint(true); pointStyle.fillColor = Color::Red(); @@ -437,7 +429,7 @@ void HeartRateView::UpdataTopAndBottomRate(void) dataTopAndbottom->SetTopPointStyle(pointStyle); chart->Invalidate(); - top = dataTopAndbottom->GetPeakData() * ACT_IMAGE_COOR_VALUE / ACT_IMAGE_COOR_PIXELS; + uint16_t top = dataTopAndbottom->GetPeakData() * ACT_IMAGE_COOR_VALUE / ACT_IMAGE_COOR_PIXELS; if (top <= HEART_RATE_LIMIT_UPPER) { maxRate = (maxRate >= top) ? maxRate : top; } @@ -615,13 +607,13 @@ void HeartRateView::InitRefreshInterface(void) Point *rateData = HeartModel::GetInstance()->GetAveHeartRate(); uint16_t len = HeartModel::GetInstance()->GetAveHeartRateCount(); SetHeartRateData(rateData, sizeof(Point) * len); - uint16_t maxRate = HeartModel::GetInstance()->GetHeartRateMax(); - uint16_t minRate = HeartModel::GetInstance()->GetHeartRateMin(); + uint16_t maxHeartRate = HeartModel::GetInstance()->GetHeartRateMax(); + uint16_t minHeartRate = HeartModel::GetInstance()->GetHeartRateMin(); RefreshElectrocardiogram(); - if (maxRate > 0 && maxRate < HEART_RATE_LIMIT_UPPER) { + if (maxHeartRate > 0 && maxHeartRate < HEART_RATE_LIMIT_UPPER) { RefreshHeartRateMax(HeartModel::GetInstance()->GetHeartRateMax()); } - if (minRate > 0 && minRate < HEART_RATE_LIMIT_UPPER) { + if (minHeartRate > 0 && minHeartRate < HEART_RATE_LIMIT_UPPER) { RefreshHeartRateMin(HeartModel::GetInstance()->GetHeartRateMin()); } } @@ -629,17 +621,12 @@ void HeartRateView::InitRefreshInterface(void) // 刷新心率曲线 void HeartRateView::RefreshElectrocardiogram(void) { - int32_t ret; - uint16_t tmp, count; - Point *rate = nullptr; - Point modPoint; - - ret = HeartRateDataProc(); + int32_t ret = HeartRateDataProc(); if (ret != OHOS_SUCCESS) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HeartRateView::[RefreshElectrocardiogram()] fail"); return; } - rate = rateDataTmp; + Point *rate = rateDataTmp; if (chart == nullptr) { return; @@ -649,7 +636,7 @@ void HeartRateView::RefreshElectrocardiogram(void) currIndex = HEART_AVE_NUM; } if (dataNume > currIndex) { - tmp = dataNume - currIndex; + uint16_t tmp = dataNume - currIndex; if (currIndex > 0) { rate += (currIndex - 1); tmp += 1; @@ -658,10 +645,11 @@ void HeartRateView::RefreshElectrocardiogram(void) currIndex = dataNume; } else if (dataNume == currIndex) { // 当前点平均心率刷新 if (serialIndex > 0 && serialIndex <= HEART_AVE_NUM && dataSerial[serialIndex - 1] != nullptr) { + Point modPoint; modPoint.x = rate[currIndex - 1].x; modPoint.y = rate[currIndex - 1].y; - count = dataSerial[serialIndex - 1]->GetDataCount(); + uint16_t count = dataSerial[serialIndex - 1]->GetDataCount(); dataSerial[serialIndex - 1]->ModifyPoint(count - 1, modPoint); chart->Invalidate(); } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/CustomizationView.h b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/CustomizationView.h index 557cde567..6ad618fbd 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/CustomizationView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/CustomizationView.h @@ -20,7 +20,7 @@ namespace OHOS { class IndoorWalkUIScrollView : public UIScrollView { public: IndoorWalkUIScrollView() {} - virtual ~IndoorWalkUIScrollView() {} + ~IndoorWalkUIScrollView() override {} bool OnDragEvent(const DragEvent& event) override { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkModel.h b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkModel.h index 679802aec..2afd4efd3 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkModel.h @@ -7,7 +7,7 @@ #ifndef INDOORWALK_MODEL_H #define INDOORWALK_MODEL_H -#include "stdio.h" +#include #include "string" #include "gfx_utils/list.h" #include "components/ui_label.h" @@ -24,46 +24,45 @@ void DisableIndoorWalkTimer(); #endif namespace OHOS { -using namespace std; class IndoorWalkModel { public: ~IndoorWalkModel(); static IndoorWalkModel *GetInstance(void); - string GetConnectionView(); + std::string GetConnectionView(); void SetConnectionView(const char* id); void SetTextLableFirstTop(const char *lable, const char *lableUnit); - string GetTextLableFirstTop(); - string GetTextLableUnitFirstTop(); + std::string GetTextLableFirstTop(); + std::string GetTextLableUnitFirstTop(); void SetTextLableFirstLeft(const char *lable, const char *lableUnit); - string GetTextLableFirstLeft(); - string GetTextLableUnitFirstLeft(); + std::string GetTextLableFirstLeft(); + std::string GetTextLableUnitFirstLeft(); void SetTextLableFirstRight(const char *lable, const char *lableUnit); - string GetTextLableFirstRight(); - string GetTextLableUnitFirstRight(); + std::string GetTextLableFirstRight(); + std::string GetTextLableUnitFirstRight(); void SetTextLableFirstBottom(const char *lable, const char *lableUnit); - string GetTextLableFirstBottom(); - string GetTextLableUnitFirstBottom(); + std::string GetTextLableFirstBottom(); + std::string GetTextLableUnitFirstBottom(); void SetTextLableSecondTop(const char *lable, const char *lableUnit); - string GetTextLableSecondTop(); - string GetTextLableUnitSecondTop(); + std::string GetTextLableSecondTop(); + std::string GetTextLableUnitSecondTop(); void SetTextLableSecondLeft(const char *lable, const char *lableUnit); - string GetTextLableSecondLeft(); - string GetTextLableUnitSecondLeft(); + std::string GetTextLableSecondLeft(); + std::string GetTextLableUnitSecondLeft(); void SetTextLableSecondRight(const char *lable, const char *lableUnit); - string GetTextLableSecondRight(); - string GetTextLableUnitSecondRight(); + std::string GetTextLableSecondRight(); + std::string GetTextLableUnitSecondRight(); void SetTextLableThirdTop(const char *lable, const char *lableUnit); - string GetTextLableThirdTop(); - string GetTextLableUnitThirdTop(); + std::string GetTextLableThirdTop(); + std::string GetTextLableUnitThirdTop(); void SetTextLableThirdBottom(const char *lable, const char *lableUnit); - string GetTextLableThirdBottom(); - string GetTextLableUnitThirdBottom(); + std::string GetTextLableThirdBottom(); + std::string GetTextLableUnitThirdBottom(); void SetTextLableFourth(const char *lable, const char *lableUnit); - string GetTextLableFourth(); - string GetTextLableUnitFourth(); + std::string GetTextLableFourth(); + std::string GetTextLableUnitFourth(); void SetInitialStep(const uint32_t &value); int GetInitialStep(); - char *DisplayMotionDuration(); + std::string& DisplayMotionDuration(); bool OpenDistancesSensor(void); bool CloseDistancesSensor(void); void SetInitialDistances(const float &value); @@ -73,32 +72,32 @@ public: private: IndoorWalkModel(); - string selectPropertiesID; + std::string selectPropertiesID; uint32_t initialStep; float initialDistances; float currentDistances; - string textLableFirstTop{"00:00:00"}; - string textLableUnitFirstTop{"时间"}; - string textLableFirstLeft{"00:00:00"}; - string textLableUnitFirstLeft{"时间"}; - string textLableFirstRight{"00:00:00"}; - string textLableUnitFirstRight{"时间"}; - string textLableFirstBottom{"00:00:00"}; - string textLableUnitFirstBottom{"时间"}; - string textLableSecondTop{"00:00:00"}; - string textLableUnitSecondTop{"时间"}; - string textLableSecondLeft{"00:00:00"}; - string textLableUnitSecondLeft{"时间"}; - string textLableSecondRight{"00:00:00"}; - string textLableUnitSecondRight{"时间"}; - string textLableThirdTop{"00:00:00"}; - string textLableUnitThirdTop{"时间"}; - string textLableThirdBottom{"00:00:00"}; - string textLableUnitThirdBottom{"时间"}; - string textLableFourth{"00:00:00"}; - string textLableUnitFourth{"时间"}; + std::string textLableFirstTop{"00:00:00"}; + std::string textLableUnitFirstTop{"时间"}; + std::string textLableFirstLeft{"00:00:00"}; + std::string textLableUnitFirstLeft{"时间"}; + std::string textLableFirstRight{"00:00:00"}; + std::string textLableUnitFirstRight{"时间"}; + std::string textLableFirstBottom{"00:00:00"}; + std::string textLableUnitFirstBottom{"时间"}; + std::string textLableSecondTop{"00:00:00"}; + std::string textLableUnitSecondTop{"时间"}; + std::string textLableSecondLeft{"00:00:00"}; + std::string textLableUnitSecondLeft{"时间"}; + std::string textLableSecondRight{"00:00:00"}; + std::string textLableUnitSecondRight{"时间"}; + std::string textLableThirdTop{"00:00:00"}; + std::string textLableUnitThirdTop{"时间"}; + std::string textLableThirdBottom{"00:00:00"}; + std::string textLableUnitThirdBottom{"时间"}; + std::string textLableFourth{"00:00:00"}; + std::string textLableUnitFourth{"时间"}; - string motionDuration; + std::string motionDuration; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkMotionView.h b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkMotionView.h index 303045f66..40e0e4502 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkMotionView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkMotionView.h @@ -48,8 +48,6 @@ private: MotionPageFifth *motionPageFifth{nullptr}; AppGroupView *recordCard[MAX_MOTIONPAGE]{nullptr}; bool pageStatus[MAX_MOTIONPAGE]{false}; - UISwipeView::OnSwipeListener* motionclickListener{nullptr}; - UIView::OnDragListener* motionDragListener{nullptr}; }; } // namespace OHOS #endif // INDOORWALK_MOTION_VIEW_H \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkPresenter.h index b3f4c7df5..20755a196 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/IndoorWalkPresenter.h @@ -66,7 +66,7 @@ class IndoorWalkPresenter : public Presenter, public UISwipeView public UIView::OnDragListener { public: IndoorWalkPresenter(); - virtual ~IndoorWalkPresenter(); + ~IndoorWalkPresenter() override; static IndoorWalkPresenter *GetInstance(); void OnStart() override; void OnPause() override; @@ -75,7 +75,7 @@ public: bool OnClick(UIView& view, const ClickEvent& event) override; bool OnDrag(UIView& view, const DragEvent& event) override; bool OnLongPress(UIView& view, const LongPressEvent& event) override; - virtual void OnSwipe(UISwipeView& view) override; + void OnSwipe(UISwipeView& view) override; void HidePageImageView(void); void ModifiesProperties(const char* id, const char *lable, const char *lableUnit); void ModifiesPageFirstTop(const char *lable, const char *lableUnit); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFifth.h b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFifth.h index 745f0fce0..61f676d58 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFifth.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFifth.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageFifth : public AppGroupView { public: MotionPageFifth(); - virtual ~MotionPageFifth(); + ~MotionPageFifth() override; static MotionPageFifth *GetInstance(void); bool InitView(void *caller) override; bool InitPageFifthLableView(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFirst.h b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFirst.h index 8b0c1d188..78259fe71 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFirst.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFirst.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageFirst : public AppGroupView { public: MotionPageFirst(); - virtual ~MotionPageFirst(); + ~MotionPageFirst() override; static MotionPageFirst *GetInstance(void); bool InitView(void *caller) override; bool InitPageFirstImageView(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFourth.h b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFourth.h index f141257d1..34dc3168f 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFourth.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageFourth.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageFourth : public AppGroupView { public: MotionPageFourth(); - virtual ~MotionPageFourth(); + ~MotionPageFourth() override; static MotionPageFourth *GetInstance(void); bool InitView(void *caller) override; bool InitPageFourthLableView(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageSecond.h b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageSecond.h index 005178aa7..2297aa614 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageSecond.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageSecond.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageSecond : public AppGroupView { public: MotionPageSecond(); - virtual ~MotionPageSecond(); + ~MotionPageSecond() override; static MotionPageSecond *GetInstance(void); bool InitView(void *caller) override; bool InitPageSecondImageView(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageThird.h b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageThird.h index de2e51743..e26fcc392 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageThird.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/include/MotionPageThird.h @@ -19,7 +19,7 @@ namespace OHOS { class MotionPageThird : public AppGroupView { public: MotionPageThird(); - virtual ~MotionPageThird(); + ~MotionPageThird() override; static MotionPageThird *GetInstance(void); bool InitView(void *caller) override; bool InitPageThirdImageView(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/CustomizationView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/CustomizationView.cpp index 1762a8b00..4e3e637ea 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/CustomizationView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/CustomizationView.cpp @@ -353,8 +353,8 @@ UIViewGroup *CustomizationView::InitPropertiesView() group->Resize(HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); group->SetHorizontalScrollState(false); - if ((ShowUpTitleLabel() == false) || (InitTimeView() == false) || (InitDistancesView() == false) || - (InitHeartView() == false) || (InitSpeedView() == false) || (InitStepsView() == false)) { + if ((!ShowUpTitleLabel()) || (!InitTimeView()) || (!InitDistancesView()) || + (!InitHeartView()) || (!InitSpeedView()) || (!InitStepsView())) { return nullptr; } group->Add(lable); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkEndView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkEndView.cpp index ae3972416..bcaa1e761 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkEndView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkEndView.cpp @@ -104,12 +104,12 @@ UIViewGroup *IndoorWalkEndView::InitShowUpView() group->SetWidth(HORIZONTAL_RESOLUTION); group->SetHeight(VERTICAL_RESOLUTION); ret = ShowUpTitleLabel(); - if (ret == false) { + if (!ret) { return nullptr; } group->Add(titleLabel); ret = CreateUIButton(); - if (ret == false) { + if (!ret) { return nullptr; } group->Add(cancelButton); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkModel.cpp index ebfb885d6..a89626e86 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkModel.cpp @@ -17,7 +17,7 @@ typedef struct { } fa_treadmill_distance_result; static int g_motionTimes{0}; -osTimerId_t g_startCounting = NULL; // 定时器 +osTimerId_t g_startCounting = nullptr; // 定时器 static constexpr uint64_t MS_ONE_SECONDS = 1000; static constexpr uint16_t NUM_TEN = 10; static constexpr uint16_t NUM_TIME_MIN = 60; @@ -40,7 +40,7 @@ void IndoorWalkModel::SetConnectionView(const char* id) selectPropertiesID = id; } -string IndoorWalkModel::GetConnectionView() +std::string IndoorWalkModel::GetConnectionView() { return selectPropertiesID; } @@ -51,12 +51,12 @@ void IndoorWalkModel::SetTextLableFirstTop(const char *lable, const char *lableU textLableUnitFirstTop = lableUnit; } -string IndoorWalkModel::GetTextLableFirstTop() +std::string IndoorWalkModel::GetTextLableFirstTop() { return textLableFirstTop; } -string IndoorWalkModel::GetTextLableUnitFirstTop() +std::string IndoorWalkModel::GetTextLableUnitFirstTop() { return textLableUnitFirstTop; } @@ -67,12 +67,12 @@ void IndoorWalkModel::SetTextLableFirstLeft(const char *lable, const char *lable textLableUnitFirstLeft = lableUnit; } -string IndoorWalkModel::GetTextLableFirstLeft() +std::string IndoorWalkModel::GetTextLableFirstLeft() { return textLableFirstLeft; } -string IndoorWalkModel::GetTextLableUnitFirstLeft() +std::string IndoorWalkModel::GetTextLableUnitFirstLeft() { return textLableUnitFirstLeft; } @@ -83,12 +83,12 @@ void IndoorWalkModel::SetTextLableFirstRight(const char *lable, const char *labl textLableUnitFirstRight = lableUnit; } -string IndoorWalkModel::GetTextLableFirstRight() +std::string IndoorWalkModel::GetTextLableFirstRight() { return textLableFirstRight; } -string IndoorWalkModel::GetTextLableUnitFirstRight() +std::string IndoorWalkModel::GetTextLableUnitFirstRight() { return textLableUnitFirstRight; } @@ -99,12 +99,12 @@ void IndoorWalkModel::SetTextLableFirstBottom(const char *lable, const char *lab textLableUnitFirstBottom = lableUnit; } -string IndoorWalkModel::GetTextLableFirstBottom() +std::string IndoorWalkModel::GetTextLableFirstBottom() { return textLableFirstBottom; } -string IndoorWalkModel::GetTextLableUnitFirstBottom() +std::string IndoorWalkModel::GetTextLableUnitFirstBottom() { return textLableUnitFirstBottom; } @@ -115,12 +115,12 @@ void IndoorWalkModel::SetTextLableSecondTop(const char *lable, const char *lable textLableUnitSecondTop = lableUnit; } -string IndoorWalkModel::GetTextLableSecondTop() +std::string IndoorWalkModel::GetTextLableSecondTop() { return textLableSecondTop; } -string IndoorWalkModel::GetTextLableUnitSecondTop() +std::string IndoorWalkModel::GetTextLableUnitSecondTop() { return textLableUnitSecondTop; } @@ -131,12 +131,12 @@ void IndoorWalkModel::SetTextLableSecondLeft(const char *lable, const char *labl textLableUnitSecondLeft = lableUnit; } -string IndoorWalkModel::GetTextLableSecondLeft() +std::string IndoorWalkModel::GetTextLableSecondLeft() { return textLableSecondLeft; } -string IndoorWalkModel::GetTextLableUnitSecondLeft() +std::string IndoorWalkModel::GetTextLableUnitSecondLeft() { return textLableUnitSecondLeft; } @@ -147,12 +147,12 @@ void IndoorWalkModel::SetTextLableSecondRight(const char *lable, const char *lab textLableUnitSecondRight = lableUnit; } -string IndoorWalkModel::GetTextLableSecondRight() +std::string IndoorWalkModel::GetTextLableSecondRight() { return textLableSecondRight; } -string IndoorWalkModel::GetTextLableUnitSecondRight() +std::string IndoorWalkModel::GetTextLableUnitSecondRight() { return textLableUnitSecondRight; } @@ -163,12 +163,12 @@ void IndoorWalkModel::SetTextLableThirdTop(const char *lable, const char *lableU textLableUnitThirdTop = lableUnit; } -string IndoorWalkModel::GetTextLableThirdTop() +std::string IndoorWalkModel::GetTextLableThirdTop() { return textLableThirdTop; } -string IndoorWalkModel::GetTextLableUnitThirdTop() +std::string IndoorWalkModel::GetTextLableUnitThirdTop() { return textLableUnitThirdTop; } @@ -179,12 +179,12 @@ void IndoorWalkModel::SetTextLableThirdBottom(const char *lable, const char *lab textLableUnitThirdBottom = lableUnit; } -string IndoorWalkModel::GetTextLableThirdBottom() +std::string IndoorWalkModel::GetTextLableThirdBottom() { return textLableThirdBottom; } -string IndoorWalkModel::GetTextLableUnitThirdBottom() +std::string IndoorWalkModel::GetTextLableUnitThirdBottom() { return textLableUnitThirdBottom; } @@ -195,12 +195,12 @@ void IndoorWalkModel::SetTextLableFourth(const char *lable, const char *lableUni textLableUnitFourth = lableUnit; } -string IndoorWalkModel::GetTextLableFourth() +std::string IndoorWalkModel::GetTextLableFourth() { return textLableFourth; } -string IndoorWalkModel::GetTextLableUnitFourth() +std::string IndoorWalkModel::GetTextLableUnitFourth() { return textLableUnitFourth; } @@ -236,12 +236,12 @@ float IndoorWalkModel::GetCurrentDistances() } /* 时间显示 */ -char *IndoorWalkModel::DisplayMotionDuration() +std::string& IndoorWalkModel::DisplayMotionDuration() { motionDuration.erase(); - string hours; - string minute; - string seconds; + std::string hours; + std::string minute; + std::string seconds; if (g_motionTimes >= NUM_TIME_DAY) { g_motionTimes = 0; } @@ -249,23 +249,23 @@ char *IndoorWalkModel::DisplayMotionDuration() int min = (g_motionTimes % NUM_TIME_HOUR) / NUM_TIME_MIN; int sec = (g_motionTimes % NUM_TIME_HOUR) % NUM_TIME_MIN; if (hour >= 0 && hour < NUM_TEN) { - hours = "0" + to_string(hour); + hours = "0" + std::to_string(hour); } else { - hours = to_string(hour); + hours = std::to_string(hour); } if (min >= 0 && min < NUM_TEN) { - minute = "0" + to_string(min); + minute = "0" + std::to_string(min); } else { - minute = to_string(min); + minute = std::to_string(min); } if (sec >= 0 && sec < NUM_TEN) { - seconds = "0" + to_string(sec); + seconds = "0" + std::to_string(sec); } else { - seconds = to_string(sec); + seconds = std::to_string(sec); } motionDuration = hours + ":" + minute + ":" + seconds; - return (char *)motionDuration.c_str(); + return motionDuration; } #ifdef __cplusplus @@ -287,12 +287,12 @@ void IndoorWalkTimerCallback() /* 开启定时器 */ void InitIndoorWalkTimer() { - if (g_startCounting != NULL) { + if (g_startCounting != nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::IndoorWalkTimer already exists!!"); return; } - g_startCounting = osTimerNew((osTimerFunc_t)IndoorWalkTimerCallback, osTimerPeriodic, NULL, NULL); - if (g_startCounting == NULL) { + g_startCounting = osTimerNew((osTimerFunc_t)IndoorWalkTimerCallback, osTimerPeriodic, nullptr, nullptr); + if (g_startCounting == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::IndoorWalkTimer osTimerNew failed!!"); return; } @@ -300,13 +300,13 @@ void InitIndoorWalkTimer() osStatus_t retTimer = osTimerStart(g_startCounting, tick); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::IndoorWalkTimer osTimerStart failed, ret = %lx!!", retTimer); - if (g_startCounting != NULL) { + if (g_startCounting != nullptr) { retTimer = osTimerDelete(g_startCounting); if (retTimer != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::osTimerDelete failed, ret = %lx!!", retTimer); return; } - g_startCounting = NULL; + g_startCounting = nullptr; } return; } @@ -314,13 +314,13 @@ void InitIndoorWalkTimer() /* 关闭定时器 */ void DisableIndoorWalkTimer() { - if (g_startCounting != NULL) { + if (g_startCounting != nullptr) { osStatus_t ret = osTimerDelete(g_startCounting); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ScanTimerCallback osTimerDelete failed, ret = %lx!!", ret); return; } - g_startCounting = NULL; + g_startCounting = nullptr; g_motionTimes = 0; } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp index c0d8cf3a7..6f3efcd2b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPreparedView.cpp @@ -247,15 +247,15 @@ UIViewGroup *IndoorWalkPreparedView::InitShowUpView() walkButton->SetViewId(WALK_BUTTON); group->Add(walkButton); ret = InitBatteryView(); - if (ret == false) { + if (!ret) { return nullptr; } ret = InitHeartbeatView(); - if (ret == false) { + if (!ret) { return nullptr; } ret = InitLableVIew(); - if (ret == false) { + if (!ret) { return nullptr; } UIView::OnDragListener *indoorWalkDragListener = (UIView::OnDragListener *)OHOS::IndoorWalkPresenter::GetInstance(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPresenter.cpp index 6e33f8f50..6f817f0c0 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkPresenter.cpp @@ -15,7 +15,7 @@ namespace OHOS { static IndoorWalkPresenter *g_pIndoorWalkPresenter = nullptr; -static string g_distancesChar; +static std::string g_distancesChar; static constexpr uint16_t CENTERED_Y = 192; static constexpr uint32_t CONVERSION_NUM = 100000; static constexpr uint16_t STEP_CHAR_NUM = 255; @@ -78,35 +78,36 @@ void IndoorWalkPresenter::WalkButtonOnClick(const char* id) void IndoorWalkPresenter::TimeViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); - ModifiesProperties(selectPropertiesid.c_str(), IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string duration = IndoorWalkModel::GetInstance()->DisplayMotionDuration(); + ModifiesProperties(selectPropertiesid.c_str(), duration.c_str(), "时间"); } void IndoorWalkPresenter::DistancesViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); ModifiesProperties(selectPropertiesid.c_str(), "0.00", "距离(km)"); } void IndoorWalkPresenter::HeartViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); ModifiesProperties(selectPropertiesid.c_str(), "--", "心率(bpm)"); } void IndoorWalkPresenter::SpeedViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); ModifiesProperties(selectPropertiesid.c_str(), "0.00", "速度(km/h)"); } void IndoorWalkPresenter::StepsViewOnClick(const char* id) { UNUSED(id); - string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); + std::string selectPropertiesid = IndoorWalkModel::GetInstance()->GetConnectionView(); char stepChar[STEP_CHAR_NUM] = {0}; InitStepsValue(stepChar); ModifiesProperties(selectPropertiesid.c_str(), stepChar, "步数(steps)"); @@ -419,71 +420,61 @@ static const IndoorWalkPropertiesMapper g_pWalkPropertiesMapper[] = { void IndoorWalkPresenter::SetPropertiesPageFirstTop() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageFirstLeft() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageFirstRight() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageFirstBottom() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageSecondTop() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageSecondLeft() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageSecondRight() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageThirdTop() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageThirdBottom() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom(); SetCustomizationState(lableUnit.c_str()); } void IndoorWalkPresenter::SetPropertiesPageFourth() { - string lableUnit; - lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFourth(); + std::string lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFourth(); SetCustomizationState(lableUnit.c_str()); } @@ -550,39 +541,36 @@ void IndoorWalkPresenter::SetCustomizationState(const char *lableUnit) void IndoorWalkPresenter::ModifiesTime() { - if (IndoorWalkModel::GetInstance()->DisplayMotionDuration() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkModel::GetInstance()->DisplayMotionDuration() nullptr"); - return; - } + std::string duration = IndoorWalkModel::GetInstance()->DisplayMotionDuration(); if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop().c_str(), "时间") == 0) { - ModifiesPageFirstTop(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFirstTop(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft().c_str(), "时间") == 0) { - ModifiesPageFirstLeft(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFirstLeft(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight().c_str(), "时间") == 0) { - ModifiesPageFirstRight(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFirstRight(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom().c_str(), "时间") == 0) { - ModifiesPageFirstBottom(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFirstBottom(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop().c_str(), "时间") == 0) { - ModifiesPageSecondTop(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageSecondTop(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft().c_str(), "时间") == 0) { - ModifiesPageSecondLeft(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageSecondLeft(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight().c_str(), "时间") == 0) { - ModifiesPageSecondRight(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageSecondRight(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop().c_str(), "时间") == 0) { - ModifiesPageThirdTop(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageThirdTop(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom().c_str(), "时间") == 0) { - ModifiesPageThirdBottom(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageThirdBottom(duration.c_str(), "时间"); } if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFourth().c_str(), "时间") == 0) { - ModifiesPageFourth(IndoorWalkModel::GetInstance()->DisplayMotionDuration(), "时间"); + ModifiesPageFourth(duration.c_str(), "时间"); } } @@ -591,7 +579,7 @@ void IndoorWalkPresenter::ModifiesDistances(float value) g_distancesChar.erase(); value -= IndoorWalkModel::GetInstance()->GetInitialDistances(); value /= CONVERSION_NUM; - string g_distancesChar = to_string(value).substr(0, to_string(value).find(".") + 3); + g_distancesChar = std::to_string(value).substr(0, std::to_string(value).find(".") + 3); if (strcmp(IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop().c_str(), "距离(km)") == 0) { ModifiesPageFirstTop(g_distancesChar.c_str(), "距离(km)"); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkView.cpp index 23bd60810..9c7e85fb4 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/IndoorWalkView.cpp @@ -183,14 +183,14 @@ void IndoorWalkView::ChangeView(int16_t hideView, int16_t showView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "IndoorWalkView::ChangeView %d, %d", hideView, showView); - if (CheckViewParam(hideView, showView) == false) { + if (!CheckViewParam(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkView::CheckViewParam failed."); return; } PreprosssChangeView tmpPreProcessView = preProcessView[showView]; - if ((this->*tmpPreProcessView)(hideView, showView) == false) { + if (!(this->*tmpPreProcessView)(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "IndoorWalkView::ChangeView %d %dfailed", showView, hideView); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFifth.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFifth.cpp index 8a5be9cf7..a3da2bbde 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFifth.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFifth.cpp @@ -83,13 +83,12 @@ bool MotionPageFifth::InitPageFifthImageView() bool MotionPageFifth::InitView(void *caller) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MotionPageFifth InitView %p", caller); - bool ret; - ret = InitPageFifthLableView(); - if (ret == false) { + bool ret = InitPageFifthLableView(); + if (!ret) { return false; } ret = InitPageFifthImageView(); - if (ret == false) { + if (!ret) { return false; } return true; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFirst.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFirst.cpp index 02dbf591f..c16b941d5 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFirst.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFirst.cpp @@ -107,8 +107,8 @@ void MotionPageFirst::SetUnitLableTemplate(UILabel *label) bool MotionPageFirst::InitPageFirstLableTopView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFirstTop(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstTop(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -139,8 +139,8 @@ bool MotionPageFirst::InitPageFirstLableTopView() bool MotionPageFirst::InitPageFirstLableLeftView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFirstLeft(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstLeft(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -172,8 +172,8 @@ bool MotionPageFirst::InitPageFirstLableLeftView() bool MotionPageFirst::InitPageFirstLableRightView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFirstRight(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstRight(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -204,8 +204,8 @@ bool MotionPageFirst::InitPageFirstLableRightView() bool MotionPageFirst::InitPageFirstLableBottomView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFirstBottom(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFirstBottom(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -357,23 +357,23 @@ bool MotionPageFirst::InitView(void *caller) backGroundFirst->SetSrc(PNG_WALK_BACK_GROUND); Add(backGroundFirst); ret = InitPageFirstLableTopView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFirstLableLeftView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFirstLableRightView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFirstLableBottomView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFirstImageView(); - if (ret == false) { + if (!ret) { return false; } HideInitPageFirstImageView(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFourth.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFourth.cpp index 4c7274096..a43ab8ff6 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFourth.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageFourth.cpp @@ -44,8 +44,8 @@ MotionPageFourth *MotionPageFourth::GetInstance() bool MotionPageFourth::InitPageFourthLableView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableFourth(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitFourth(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -153,16 +153,15 @@ bool MotionPageFourth::InitView(void *caller) backGroundFourth->SetSrc(PNG_WALK_BACK_GROUND); Add(backGroundFourth); ret = InitPageFourthLableView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageFourthImageView(); - if (ret == false) { + if (!ret) { return false; } HideInitPageFourthImageView(); SetTouchable(true); return true; - } } \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageSecond.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageSecond.cpp index 545fb6947..34e136df5 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageSecond.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageSecond.cpp @@ -81,8 +81,8 @@ void MotionPageSecond::SetLableTemplate(UILabel *label) bool MotionPageSecond::InitPageSecondLableTopView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableSecondTop(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondTop(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -114,8 +114,8 @@ bool MotionPageSecond::InitPageSecondLableTopView() bool MotionPageSecond::InitPageSecondLableLeftView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableSecondLeft(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondLeft(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -147,8 +147,8 @@ bool MotionPageSecond::InitPageSecondLableLeftView() bool MotionPageSecond::InitPageSecondLableRightView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableSecondRight(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitSecondRight(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -292,24 +292,23 @@ bool MotionPageSecond::InitView(void *caller) backGroundSecond->SetSrc(PNG_WALK_BACK_GROUND); Add(backGroundSecond); ret = InitPageSecondLableTopView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageSecondLableLeftView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageSecondLableRightView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageSecondImageView(); - if (ret == false) { + if (!ret) { return false; } HideInitPageSecondImageView(); SetTouchable(true); return true; - } } \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageThird.cpp b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageThird.cpp index a0898bac4..668d78cd4 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageThird.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/indoorwalk/src/MotionPageThird.cpp @@ -71,8 +71,8 @@ void MotionPageThird::SetLableTemplate(UILabel *label) bool MotionPageThird::InitPageThirdLableTopView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableThirdTop(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdTop(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -115,8 +115,8 @@ void MotionPageThird::SetUnitLableTemplate(UILabel *label) bool MotionPageThird::InitPageThirdLableBottomView() { - string lable; - string lableUnit; + std::string lable; + std::string lableUnit; lable = IndoorWalkModel::GetInstance()->GetTextLableThirdBottom(); lableUnit = IndoorWalkModel::GetInstance()->GetTextLableUnitThirdBottom(); if (strcmp(lableUnit.c_str(), "步数(steps)") == 0) { @@ -227,15 +227,15 @@ bool MotionPageThird::InitView(void *caller) backGroundThird->SetSrc(PNG_WALK_BACK_GROUND); Add(backGroundThird); ret = InitPageThirdLableTopView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageThirdLableBottomView(); - if (ret == false) { + if (!ret) { return false; } ret = InitPageThirdImageView(); - if (ret == false) { + if (!ret) { return false; } HideInitPageThirdImageView(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/key/src/KeyInputListener.cpp b/code/sdk/application/wearable/nativeapp/nativeui/key/src/KeyInputListener.cpp index 877ad1b38..1d34972dc 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/key/src/KeyInputListener.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/key/src/KeyInputListener.cpp @@ -19,23 +19,10 @@ #include "MainCallingPresenter.h" namespace OHOS { -static bool IsCallingNotify() -{ - uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); - if (NotificationManager::GetInstance()->hasNotifyShowing() == true && - (notifyId == TOPIC_EVENT_HFP_INCOMMING || - notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE || - notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH)) { - return true; - } else { - return false; - } -} - static bool IsNotifyCallStatus() { uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); - if (NotificationManager::GetInstance()->hasNotifyShowing() == true && + if (NotificationManager::GetInstance()->HasNotifyShowing() && (notifyId == TOPIC_EVENT_HFP_WATCH_ACTIVE || notifyId == TOPIC_EVENT_HFP_PHONE_TO_WATCH)) { return true; @@ -47,7 +34,7 @@ static bool IsNotifyCallStatus() static void PressAlarmNotify() { uint16_t notifyId = NotificationManager::GetInstance()->GetShowingNotifyId(); - if (NotificationManager::GetInstance()->hasNotifyShowing() == true && notifyId == TOPIC_EVENT_ALARM_RING) { + if (NotificationManager::GetInstance()->HasNotifyShowing() && notifyId == TOPIC_EVENT_ALARM_RING) { AlarmClockModel::GetInstance()->AlarmGetClockNum(); AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); NotificationManager::GetInstance()->StopNotify(); @@ -77,8 +64,12 @@ void KeyInputListener::OnKeyLongPress(const KeyEvent& event) void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) { if (MainCallingPresenter::GetInstance() != nullptr && CallerLogModel::GetInstance()->GetCallStatus()) { - if (CallerLogModel::GetInstance()->GetVolumeScreenStatus() == true) { - volumeSliderEventListener = VolumeSliderEventListener::GetInstance(); + if (CallerLogModel::GetInstance()->GetVolumeScreenStatus()) { + VolumeSettingView *settingView = MainCallingPresenter::GetInstance()->GetvolumeSetting(); + if (settingView == nullptr) { + return; + } + volumeSliderEventListener = settingView->GetVolumeEventListener(); if (volumeSliderEventListener == nullptr) { return; } @@ -88,9 +79,13 @@ void KeyInputListener::CallVolumeDipSwitchControl(VolumeChangeStatus status) CallerLogModel::GetInstance()->SetVolumeScreenStatus(true); } } - if (IsNotifyCallStatus() == true) { - if (NotificationManager::GetInstance()->GetVolumeScreenStatus() == true) { - volumeSliderEventListener = VolumeSliderEventListener::GetInstance(); + if (IsNotifyCallStatus()) { + if (NotificationManager::GetInstance()->GetVolumeScreenStatus()) { + VolumeSettingView *settingView = GetvolumeSetting(); + if (settingView == nullptr) { + return; + } + volumeSliderEventListener = settingView->GetVolumeEventListener(); if (volumeSliderEventListener == nullptr) { return; } @@ -108,24 +103,26 @@ void KeyInputListener::OnKeyRelease(const KeyEvent& event) uint16 keyID = event.GetKeyId(); if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_POWER)) { // 电源按键 if (longPressFlag == 0 && pressFlag == 1) { // 短按电源键 - if (currentViewId == VIEW_MAEKPHONE_SAMPLE || IsCallingNotify() == true) { // 音量卡片 + if (currentViewId == VIEW_MAEKPHONE_SAMPLE || + NotificationManager::GetInstance()->GetWatchCallStatus()) { // 音量卡片 // 音量+ CallVolumeDipSwitchControl(VOLUMEUP); } else if (currentViewId != VIEW_MAIN_SAMPLE) { // 主表盘 PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 - NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TRANSITION_ZOOM); + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE, TransitionType::TRANSITION_ZOOM); } else { PressAlarmNotify(); // 当前为闹钟通知页面时,先处理闹钟再切换页面 if (!MainViewSample::GetInstance()->IsMainClockPage()) { // 当前页面为主表盘的其他页面时,切换回主表盘页面 MainViewSample::GetInstance()->SwitchToClockPage(); } else { - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TRANSITION_ZOOM); + NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_ZOOM); } } } } else if (keyID == static_cast(ZliteKeyCode::ZLITE_KEY_FUNC)) { // 功能按键 if (longPressFlag == 0 && pressFlag == 1) { // 短按功能键 - if (currentViewId == VIEW_MAEKPHONE_SAMPLE || IsCallingNotify() == true) { // 音量卡片 + if (currentViewId == VIEW_MAEKPHONE_SAMPLE || + NotificationManager::GetInstance()->GetWatchCallStatus()) { // 音量卡片 // 音量- CallVolumeDipSwitchControl(VOLUMEDOWN); } else { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/AppGroupView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/AppGroupView.h index 88e838133..08529bdb5 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/AppGroupView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/AppGroupView.h @@ -20,7 +20,7 @@ public: { SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); } - virtual ~AppGroupView() {} + ~AppGroupView() override {} virtual bool InitView(void *caller)=0; bool initViewStatus{false}; }; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypes.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypes.h index 1f8f49375..366c1bec6 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypes.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/DialBinTypes.h @@ -155,6 +155,7 @@ struct DialVideo { DialRect rect; uint32_t offset; Color32 colorKey; + uint32_t imgId; }; struct DialClick { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/HealthModel.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/HealthModel.h index e23ad4610..dac9ce9b3 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/HealthModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/HealthModel.h @@ -16,7 +16,7 @@ #ifndef HEALTH_MODEL_H #define HEALTH_MODEL_H -#include "stdio.h" +#include #include "gfx_utils/list.h" #include "los_mux.h" #include "UiServersMsg.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainModel.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainModel.h index 6bc09a099..1d82fac85 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainModel.h @@ -25,9 +25,9 @@ namespace OHOS { } DialInfo; typedef struct { - uint8_t dialFlag; - uint8_t dialId; - std::string dialFullName; + uint8_t dialFlag; + uint8_t dialId; + std::string dialFullName; } DialSetting; class MainModel { @@ -43,6 +43,10 @@ namespace OHOS { void AddDialSetting(const DialSetting &setting); void InitDialSettings(void); DialSetting &GetDialSetting(); + bool IsFromSetCardView(void) const; + void SetFromSetCardView(bool isFrom); + void SetFromCardId(uint8_t cardId); + uint8_t GetFromCardId(void); private: void InitDialSettingDefault(void); MainModel(); @@ -53,6 +57,8 @@ namespace OHOS { CardId cardSettings[CARD_SETTING_COUNT_MAX] = { MAX_CARD }; uint8_t cardSettingCount{0}; DialSetting dialSetting; + bool isFromSetCardView{false}; + uint8_t fromCardId{MAX_CARD}; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h index 08fc301b0..ba4860287 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainPresenterSample.h @@ -17,14 +17,12 @@ #include "MainModel.h" #include "components/ui_swipe_view.h" #include "components/ui_view.h" -#include "CompassView.h" -#include "CompassPresenter.h" +#include "MainCompassView.h" +#include "MainCompassPresenter.h" #include "PlayersView.h" #include "HeartRateView.h" #include "swipe_effect/zoom_effect.h" -using namespace std; - namespace OHOS { static constexpr const char *MAIN_CLICK_WEATHER = "mainclickweather"; static constexpr const char *MAIN_CLICK_ACTIVITY = "mainclickactivity"; @@ -45,17 +43,17 @@ class MainPresenterSample : public Presenter, public ModelListen public UIView::OnLongPressListener, public UISwipeView, public CompassPresenter { public: MainPresenterSample(); - virtual ~MainPresenterSample(); + ~MainPresenterSample() override; static MainPresenterSample *GetInstance(void); void OnStart() override; void OnPause() override; void OnResume() override; void OnStop() override; - virtual void Notify() override; + void Notify() override; bool OnClick(UIView& view, const ClickEvent& event) override; bool OnLongPress(UIView& view, const LongPressEvent& event) override; - virtual void OnSwipe(UISwipeView& view) override; + void OnSwipe(UISwipeView& view) override; void SetPage(int8_t id); void SetTaskPeroid(CardId cardId); void setCallback(ZoomEffect* callback) @@ -68,6 +66,9 @@ public: CardId *GetCardSettings(void); void InitDialSettings(void); DialSetting& GetDialSetting(); + bool IsFromSetCardView(void) const; + void SetFromSetCardView(bool isFrom); + uint8_t GetFromCardId(void); private: void ProcessDataNotify(void); void SetCircleProgress(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainViewSample.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainViewSample.h index 243a5db3a..f09fd1382 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainViewSample.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/MainViewSample.h @@ -36,7 +36,7 @@ class MainPresenterSample; class MainViewSample : public View { public: MainViewSample(); - virtual ~MainViewSample(); + ~MainViewSample() override; static MainViewSample *GetInstance(void); void OnStart() override; void OnSetUpView() override; @@ -66,7 +66,7 @@ public: SetPage(mainClockView->GetViewIndex()); } } - + void SwitchToCard(uint8_t cardId); bool IsMainClockPage(void); void SetDragFg(bool continFg); bool GetDragFg(void); @@ -90,8 +90,8 @@ private: void VerticalViewInit(void); void VertViewLoad(void); void HorViewLoad(void); - UICardPage *InitWathOffDial(DialSetting &setting); - UICardPage *InitWathDial(DialSetting &setting); + UICardPage *InitWatchOffDial(DialSetting &setting); + UICardPage *InitWatchDial(DialSetting &setting); }; } // namespace OHOS #endif // MAIN_VIEW_SAMPLE_H diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/ModelListenerSample.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/ModelListenerSample.h index 8463604e8..6444c4fe6 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/ModelListenerSample.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/ModelListenerSample.h @@ -24,6 +24,7 @@ public: ModelListenerSample(); virtual ~ModelListenerSample(); virtual void Notify(void) = 0; + virtual void OnTickEvent(void) {}; void Callback(); }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/PullUpDownView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/PullUpDownView.h index 147a03a32..e511eccee 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/PullUpDownView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/PullUpDownView.h @@ -10,7 +10,7 @@ #include "graphic_types.h" #include "wearable_log.h" -#include "components/ui_card_page.h" +#include "components/ui_card_page.h" #include "components/ui_view_group.h" #include "components/ui_image_view.h" #include "components/ui_label.h" @@ -20,10 +20,10 @@ namespace OHOS { class PullUpDownView : public UICardPage { public: PullUpDownView(); - virtual ~PullUpDownView(); + ~PullUpDownView() override; static PullUpDownView *GetInstance(void); bool InitView(); - void PreLoad(void) override; + void PreLoad(void) override; void UpdateBlueToothStatus(int status); private: UIImageView *dnotDisturb{nullptr}; @@ -40,7 +40,7 @@ private: UIImageView *battery{nullptr}; UILabel *batteryLable{nullptr}; UILabel *dateLable{nullptr}; - bool viewiInitStatus{false}; + bool viewiInitStatus{false}; void InitSubViewImg(void); void InitViewImg(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/UiServersMsg.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/UiServersMsg.h index b8a8b89e0..0a17cf583 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/UiServersMsg.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/UiServersMsg.h @@ -8,7 +8,7 @@ #ifndef UI_SERVERS_MSG_H #define UI_SERVERS_MSG_H -#include +#include #include "ohos_types.h" #include "message.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/VolumeSettingPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/VolumeSettingPresenter.h index f18dac441..07a41562c 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/VolumeSettingPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/VolumeSettingPresenter.h @@ -33,11 +33,12 @@ typedef enum : uint8_t { VOLUMEDRAG = 2, } VolumeChangeStatus; +class VolumeSettingView; class VolumeSliderEventListener : public UISlider::UISliderEventListener, public UIView::OnClickListener, public UIView::OnDragListener { public: - VolumeSliderEventListener(); + VolumeSliderEventListener(VolumeSettingView *volumeSetting); ~VolumeSliderEventListener(); static VolumeSliderEventListener *GetInstance(); void OnChange(int32_t progress) override; @@ -50,6 +51,7 @@ public: private: int16_t preSound{0}; int16_t playerCoefficients{0}; + VolumeSettingView *volumeSettingView{nullptr}; }; } // namespace OHOS #endif diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/VolumeSettingView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/VolumeSettingView.h index 9765a69a5..63a201e97 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/VolumeSettingView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/VolumeSettingView.h @@ -24,17 +24,13 @@ class VolumeSettingView : public UIViewGroup { public: VolumeSettingView(); ~VolumeSettingView(); - static VolumeSettingView *GetInstance(void); int16_t sounding{0}; UISlider *GetProgress(void); bool SetUpVolume(void); UIButton *GetIncreaseButton(void); UIButton *GetDecreaseButton(void); - int get_progress_vlaue() - { - return progress->GetValue(); - } + VolumeSliderEventListener *GetVolumeEventListener(void); private: VolumeSliderEventListener *listener{nullptr}; UISlider *progress{nullptr}; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialArcLabelView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialArcLabelView.h index ded3418c1..d3ad91ee2 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialArcLabelView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialArcLabelView.h @@ -5,7 +5,7 @@ #ifndef DIAL_ARC_LABEL_VIEW_H #define DIAL_ARC_LABEL_VIEW_H -#include "stdint.h" +#include #include "DialView.h" #include "components/ui_arc_label.h" @@ -13,7 +13,7 @@ namespace OHOS { class DialArcLabelView : public UIArcLabel, public DialView { public: DialArcLabelView(); - virtual ~DialArcLabelView(); + ~DialArcLabelView() override; bool SetText(const char* text); bool SetTextWithWildcard(const char* text); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialArcProgressView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialArcProgressView.h index eab02980a..29675223f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialArcProgressView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialArcProgressView.h @@ -12,7 +12,7 @@ namespace OHOS { class DialArcProgressView : public UICircleProgress, public DialView { public: DialArcProgressView(); - virtual ~DialArcProgressView(); + ~DialArcProgressView() override; void HandleFloatData(float data) override; private: int32_t value_ = -1; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialBaseModel.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialBaseModel.h index 115495579..ef71b9bb1 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialBaseModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialBaseModel.h @@ -12,7 +12,6 @@ #include "heap_base.h" #include "OnDialDataUpdateListener.h" -using namespace std; namespace OHOS { class DialBaseModel : public HeapBase { public: @@ -38,7 +37,7 @@ public: /* * * @brief Get dial data of text type */ - virtual bool GetDialTextData(DialDataType& type, string*& out, int16_t& strNum) + virtual bool GetDialTextData(DialDataType& type, std::string*& out, int16_t& strNum) { return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialBoxProgressView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialBoxProgressView.h index b5ea601ca..cc45b4d91 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialBoxProgressView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialBoxProgressView.h @@ -12,7 +12,7 @@ namespace OHOS { class DialBoxProgressView : public UIBoxProgress, public DialView { public: DialBoxProgressView(); - virtual ~DialBoxProgressView(); + ~DialBoxProgressView() override; void HandleFloatData(float data) override; private: int32_t value_ = -1; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialDigitalImgView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialDigitalImgView.h index 7a67038f7..443c325ee 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialDigitalImgView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialDigitalImgView.h @@ -5,7 +5,7 @@ #ifndef DIAL_DIGITAL_IMG_VIEW_H #define DIAL_DIGITAL_IMG_VIEW_H -#include "stdint.h" +#include #include "DialView.h" #include "components/ui_image_view.h" #include "gfx_utils/graphic_math.h" @@ -22,7 +22,7 @@ enum class ImgAlign { class DialDigitalImgView : public UIImageView, public DialView { public: DialDigitalImgView(); - virtual ~DialDigitalImgView(); + ~DialDigitalImgView() override; void HandleFloatData(float data) override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialKaleidoscopeView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialKaleidoscopeView.h index f73c2b817..3125ab001 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialKaleidoscopeView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialKaleidoscopeView.h @@ -5,7 +5,7 @@ #ifndef DIAL_KALEIDOSCOPE_VIEW_H #define DIAL_KALEIDOSCOPE_VIEW_H #include "components/ui_kaleidoscope_view.h" -namespace OHOS{ +namespace OHOS { using DialKaleidoscopeView = UIKaleidoscopeView; } #endif diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialLabelView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialLabelView.h index 133ae6b88..c5513132a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialLabelView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialLabelView.h @@ -5,7 +5,7 @@ #ifndef DIAL_LABEL_VIEW_H #define DIAL_LABEL_VIEW_H -#include "stdint.h" +#include #include "DialView.h" #include "components/ui_label.h" @@ -13,7 +13,7 @@ namespace OHOS { class DialLabelView : public UILabel, public DialView { public: DialLabelView(); - virtual ~DialLabelView(); + ~DialLabelView() override; bool SetText(const char* text); bool SetTextWithWildcard(const char* text); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelHeartRate.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelHeartRate.h index 9fd090920..481f39459 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelHeartRate.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelHeartRate.h @@ -14,7 +14,7 @@ namespace OHOS { class DialModelHeartRate : public DialBaseModel { public: DialModelHeartRate() {} - virtual ~DialModelHeartRate() {} + ~DialModelHeartRate() override {} static DialModelHeartRate* GetInstance() { static DialModelHeartRate instance; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelPower.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelPower.h index c09fbc8fe..cb6a97ce5 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelPower.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelPower.h @@ -14,7 +14,7 @@ namespace OHOS { class DialModelPower : public DialBaseModel { public: DialModelPower() {} - virtual ~DialModelPower() {} + ~DialModelPower() override {} static DialModelPower* GetInstance() { static DialModelPower instance; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelSteps.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelSteps.h index 412007dbf..e1e9930dd 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelSteps.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelSteps.h @@ -14,7 +14,7 @@ namespace OHOS { class DialModelSteps : public DialBaseModel { public: DialModelSteps() {} - virtual ~DialModelSteps() {} + ~DialModelSteps() override {} static DialModelSteps* GetInstance() { static DialModelSteps instance; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelTime.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelTime.h index d813c65b5..7da252b40 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelTime.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialModelTime.h @@ -14,7 +14,7 @@ namespace OHOS { class DialModelTime : public DialBaseModel { public: DialModelTime() {} - virtual ~DialModelTime() {} + ~DialModelTime() override {} static DialModelTime* GetInstance() { static DialModelTime instance; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialOptionImgView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialOptionImgView.h index 837b24410..4fa2fbd65 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialOptionImgView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialOptionImgView.h @@ -5,7 +5,7 @@ #ifndef DIAL_OPTION_IMG_VIEW_H #define DIAL_OPTION_IMG_VIEW_H -#include "stdint.h" +#include #include "DialView.h" #include "components/ui_image_view.h" @@ -14,7 +14,7 @@ namespace OHOS { class DialOptionImgView : public UIImageView, public DialView { public: DialOptionImgView(); - virtual ~DialOptionImgView(); + ~DialOptionImgView() override; void HandleFloatData(float data) override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialRotateImgView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialRotateImgView.h index 23d49eb68..e1fff0ed8 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialRotateImgView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialRotateImgView.h @@ -5,7 +5,7 @@ #ifndef DIAL_ROTATE_IMG_VIEW_H #define DIAL_ROTATE_IMG_VIEW_H -#include "stdint.h" +#include #include "DialView.h" #include "components/ui_image_view.h" #include "gfx_utils/graphic_math.h" @@ -15,7 +15,7 @@ namespace OHOS { class DialRotateImgView : public UIImageView, public DialView { public: DialRotateImgView(); - virtual ~DialRotateImgView(); + ~DialRotateImgView() override; void HandleFloatData(float data) override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialSequenceImgView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialSequenceImgView.h index ef885b6e0..4800b71b9 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialSequenceImgView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialSequenceImgView.h @@ -12,7 +12,7 @@ namespace OHOS { class DialSequenceImgView : public UIImageAnimatorView { public: DialSequenceImgView(); - virtual ~DialSequenceImgView(); + ~DialSequenceImgView() override; bool SetSequenceRes(const ImageAnimatorInfo* imgSrc, uint8_t imgNum); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialStaticImgView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialStaticImgView.h index a405bd868..e1b48a0a6 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialStaticImgView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialStaticImgView.h @@ -11,7 +11,7 @@ namespace OHOS { class DialStaticImgView : public UIImageView { public: DialStaticImgView(); - virtual ~DialStaticImgView(); + ~DialStaticImgView() override; }; } #endif diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialVideoView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialVideoView.h index eca3227cc..7d4c1408b 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialVideoView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialVideoView.h @@ -5,7 +5,7 @@ #ifndef DIAL_VIDEO_VIEW #define DIAL_VIDEO_VIEW -#include "stdint.h" +#include #include "components/ui_lite_surface_view.h" #include "video_play_wrapper.h" @@ -13,7 +13,7 @@ namespace OHOS { class DialVideoView : public UILiteSurfaceView { public: DialVideoView(); - virtual ~DialVideoView(); + ~DialVideoView() override; bool SetVideoRes(FILE* fp, uint32_t offset); bool StartPlay(); bool ResumePlay(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialView.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialView.h index 4f933a000..300f7a0b4 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialView.h @@ -5,7 +5,7 @@ #ifndef DIAL_VIEW_H #define DIAL_VIEW_H -#include "stdint.h" +#include #include namespace OHOS { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialViewGroup.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialViewGroup.h index 91c68a824..f6822612d 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialViewGroup.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/DialViewGroup.h @@ -5,11 +5,12 @@ #ifndef DIAL_VIEW_GROUP_H #define DIAL_VIEW_GROUP_H -#include "DialDataBase.h" #include +#include "DialDataBase.h" #include "components/ui_view_group.h" #include "OnDialDataUpdateListener.h" #include "components/ui_card_page.h" +#include "components/ui_kaleidoscope_view.h" #include "gfx_utils/list.h" #include "DialView.h" #include "DialVideoView.h" @@ -18,7 +19,7 @@ namespace OHOS { class DialViewGroup : public UICardPage, public OnDialDataUpdateListener { public: DialViewGroup(); - virtual ~DialViewGroup(); + ~DialViewGroup() override; /** * @brief Set dial resource path. @@ -105,6 +106,11 @@ public: */ void CoverEnd(bool isCovered) override; + /** + * @brief This function is invoked when the function SetHorCurrentPage() is called. + */ + void OnActive(void) override; + private: void ProcessData(DialDataType type, DialView* view); std::unordered_map dataTypeMap_; @@ -116,6 +122,7 @@ private: std::string filePath_; FILE* fp_ = nullptr; DialVideoView* video_ = nullptr; + UIKaleidoscopeView* kaleidoscope_ = nullptr; typedef struct { Rect area; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/ModelDialDataFactory.h b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/ModelDialDataFactory.h index 602586aa4..33bedbe49 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/ModelDialDataFactory.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/include/dial/ModelDialDataFactory.h @@ -32,7 +32,7 @@ public: bool RegisterDialDataListener(DialDataType type, OnDialDataUpdateListener* listener); bool UnRegisterDialDataListener(DialDataType type); - bool GetDialTextData(DialDataType& type, string*& out, int16_t& strNum); + bool GetDialTextData(DialDataType& type, std::string*& out, int16_t& strNum); bool GetDialFloatData(DialDataType& type, float& out); bool GetDialFloatData(DialDataType& type, float*& out, int16_t& len); DialBaseModel* GetModuleByType(DialDataType& type); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/HealthModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/HealthModel.cpp index 50bbd9cdf..ad7fb0624 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/HealthModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/HealthModel.cpp @@ -24,8 +24,6 @@ #include #include "thread_adapter.h" -using namespace std; - namespace OHOS { HealthAllData g_healthData; @@ -52,8 +50,8 @@ HealthModel *HealthModel::GetInstance(void) int HealthModel::SaveGlobalHealthToFile(void) { - ofstream outHealthFile; - outHealthFile.open(HEALTH_DATA_PATH, ios::out); + std::ofstream outHealthFile; + outHealthFile.open(HEALTH_DATA_PATH, std::ios::out); if (outHealthFile.is_open() == 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "open HEALTH_DATA_PATH failure!"); outHealthFile.close(); @@ -107,7 +105,7 @@ void HealthModel::PushHealthData(HealthMsg healthMsg) bool HealthModel::FetchedHealthData(HealthMsg *healthMsg) { - if (listHealth.IsEmpty() == true) { + if (listHealth.IsEmpty()) { return false; } else { MUTEX_Lock(g_healthDataMutex); @@ -123,8 +121,8 @@ bool HealthModel::InitHealthData(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HealthModel::InitHealthData start"); (void)memset_s(&g_healthData, sizeof(HealthAllData), 0, sizeof(HealthAllData)); - ifstream inHealthFile; - inHealthFile.open(HEALTH_DATA_PATH, ios::in); + std::ifstream inHealthFile; + inHealthFile.open(HEALTH_DATA_PATH, std::ios::in); if (!inHealthFile.is_open()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "open HEALTH_DATA_PATH failure!"); inHealthFile.close(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainModel.cpp index 53a0dd307..7cd3c937d 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainModel.cpp @@ -159,8 +159,7 @@ namespace OHOS { void MainModel::InitDialSettings(void) { char temp[DIAL_SETTING_VALUE_LEN] = { 0 }; - int len; - len = UtilsGetValue("dial_setting", temp, DIAL_SETTING_VALUE_LEN); + int32_t len = UtilsGetValue("dial_setting", temp, DIAL_SETTING_VALUE_LEN); if (len >= 0) { char *setBuffer = nullptr; char *setValue = strtok_s(temp, ",", &setBuffer); @@ -200,4 +199,24 @@ namespace OHOS { { return dialSetting; } + + bool MainModel::IsFromSetCardView(void) const + { + return isFromSetCardView; + } + + void MainModel::SetFromSetCardView(bool isFrom) + { + isFromSetCardView = isFrom; + } + + void MainModel::SetFromCardId(uint8_t cardId) + { + fromCardId = cardId; + } + + uint8_t MainModel::GetFromCardId(void) + { + return fromCardId; + } } \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp index 0cef9ed5e..8c9f3c229 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp @@ -10,7 +10,7 @@ #include "HeartRateView.h" #include "PlayersModel.h" #include "PlayersPresenter.h" -#include "CompassPresenter.h" +#include "MainCompassPresenter.h" #include "CompassModel.h" #include "CompassCalibrationView.h" #include "drag_event.h" @@ -28,16 +28,16 @@ namespace OHOS { -map g_jumpView = { { MAIN_CLICK_WEATHER, VIEW_MAIN_SAMPLE }, // 天气界面 - { MAIN_CLICK_ACTIVITY, VIEW_MAIN_ACTIVITY }, // 活动记录界面 - { MAIN_CLICK_MESSAGE, VIEW_MAIN_SAMPLE }, // 消息app - { MAIN_CLICK_HEARTRATE, VIEW_MAIN_SAMPLE }, // 心率界面 - { DROPDOWN_CLICK_ALARM, VIEW_MAIN_ALARM }, // 闹钟app - { DROPDOWN_CLICK_SETTING, VIEW_SETTING } }; // 设置界面 +std::map g_jumpView = { { MAIN_CLICK_WEATHER, VIEW_MAIN_SAMPLE }, // 天气界面 + { MAIN_CLICK_ACTIVITY, VIEW_MAIN_ACTIVITY }, // 活动记录界面 + { MAIN_CLICK_MESSAGE, VIEW_MAIN_SAMPLE }, // 消息app + { MAIN_CLICK_HEARTRATE, VIEW_MAIN_SAMPLE }, // 心率界面 + { DROPDOWN_CLICK_ALARM, VIEW_MAIN_ALARM }, // 闹钟app + { DROPDOWN_CLICK_SETTING, VIEW_SETTING } }; // 设置界面 -map g_chanColor = { { DROPDOWN_CLICK_FINDMYPHONE, DROPDOWN_DROPDOWN_FIND_PHONE_B }, - { DROPDOWN_CLICK_ALARM, DROPDOWN_DROPDOWN_ALARM_B }, - { DROPDOWN_CLICK_SETTING, DROPDOWN_DROPDOWN_SETTING_B } }; +std::map g_chanColor = { { DROPDOWN_CLICK_FINDMYPHONE, DROPDOWN_DROPDOWN_FIND_PHONE_B }, + { DROPDOWN_CLICK_ALARM, DROPDOWN_DROPDOWN_ALARM_B }, + { DROPDOWN_CLICK_SETTING, DROPDOWN_DROPDOWN_SETTING_B } }; static MainPresenterSample *g_pMainPresenterSample = nullptr; @@ -95,7 +95,7 @@ bool MainPresenterSample::OnClick(UIView &view, const ClickEvent &event) { UNUSED(event); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "StatusButtonClickListener: %s", view.GetViewId()); - string curViewId = view.GetViewId(); + std::string curViewId = view.GetViewId(); UIImageView *imgView = static_cast(&view); if (HealthModel::GetInstance() == nullptr) { @@ -137,9 +137,9 @@ bool MainPresenterSample::OnLongPress(UIView& view, const LongPressEvent& event) UNUSED(view); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainPresenterSample OnLongPress"); uint8_t cardId = view_->GetHorCurrentCard(); - if (cardId != WATCH_FACE ) { + if (cardId != WATCH_FACE) { SetCardModel::GetInstance().SetSelectedCard(cardId); - NativeAbility::GetInstance().ChangeSlice(VIEW_SET_CARD); + NativeAbility::GetInstance().ChangeSlice(VIEW_SET_CARD); } else { NativeAbility::GetInstance().ChangeSlice(VIEW_SET_DIAL); } @@ -198,7 +198,7 @@ void MainPresenterSample::ProcessDataNotify(void) HealthMsg healthMsg; uint16_t len; - while ((HealthModel::GetInstance()->FetchedHealthData(&healthMsg) == true)) { + while ((HealthModel::GetInstance()->FetchedHealthData(&healthMsg))) { switch (healthMsg.type) { case BATTERY_LIFE: break; @@ -290,4 +290,19 @@ DialSetting& MainPresenterSample::GetDialSetting() return MainModel::GetInstance().GetDialSetting(); } +bool MainPresenterSample::IsFromSetCardView(void) const +{ + return MainModel::GetInstance().IsFromSetCardView(); +} + +void MainPresenterSample::SetFromSetCardView(bool isFrom) +{ + MainModel::GetInstance().SetFromSetCardView(isFrom); +} + +uint8_t MainPresenterSample::GetFromCardId(void) +{ + return MainModel::GetInstance().GetFromCardId(); +} + } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainViewSample.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainViewSample.cpp index 899a83457..54747cdf9 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainViewSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainViewSample.cpp @@ -8,395 +8,371 @@ #include "MainViewSample.h" #include "graphic_service.h" -namespace OHOS +namespace OHOS { +static MainViewSample *g_pMainView = nullptr; +static constexpr uint16_t MESLABLE_X_TMP = 177; +static constexpr uint16_t MESLABLE_Y_TMP = 212; +static constexpr uint16_t MESLABLE_WIDTH_TMP = 100; +static constexpr uint16_t MESLABLE_HEIGHT_TMP = 30; +static constexpr uint8_t FONT_SIZE_TMP = 24; +static constexpr uint8_t PULL_MIDDLE_VIEW_OPA = 0; + +struct MainViewMapper { + CardId id; + UICardPage *(MainViewSample::*func)(void); +}; + +static const MainViewMapper CardMapper[] = { + {WATCH_FACE, &MainViewSample::InitWatchFacePage}, + {HEART_RATE, &MainViewSample::InitHeartRatePage}, + {COMPASS, &MainViewSample::InitCompassPage}, + {ACTIVITY, &MainViewSample::InitActivityPage}, + {MUSIC_PLAYER, &MainViewSample::InitMusicPlayerPage}, +}; + +MainViewSample::MainViewSample() { - static MainViewSample *g_pMainView = nullptr; - static constexpr uint16_t MESLABLE_X_TMP = 177; - static constexpr uint16_t MESLABLE_Y_TMP = 212; - static constexpr uint16_t MESLABLE_WIDTH_TMP = 100; - static constexpr uint16_t MESLABLE_HEIGHT_TMP = 30; - static constexpr uint8_t FONT_SIZE_TMP = 24; - static constexpr uint8_t PULL_MIDDLE_VIEW_OPA = 0; - - struct MainViewMapper - { - CardId id; - UICardPage *(MainViewSample::*func)(void); - }; - - static const MainViewMapper CardMapper[] = { - {WATCH_FACE, &MainViewSample::InitWatchFacePage}, - {HEART_RATE, &MainViewSample::InitHeartRatePage}, - {COMPASS, &MainViewSample::InitCompassPage}, - {ACTIVITY, &MainViewSample::InitActivityPage}, - {MUSIC_PLAYER, &MainViewSample::InitMusicPlayerPage}, - }; - - MainViewSample::MainViewSample() - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::MainViewSample"); - g_pMainView = this; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::MainViewSample"); + g_pMainView = this; +} + +MainViewSample::~MainViewSample() +{ + dropDownView->ClearBackgroundBlur(); + messageView->ClearBackgroundBlur(); + + for (int32_t i = 0; i < MAX_CARD; i++) { + recordCard[i] = nullptr; + pageStatus[i] = false; } - MainViewSample::~MainViewSample() - { - dropDownView->ClearBackgroundBlur(); - messageView->ClearBackgroundBlur(); + if (mainSwipeGroup != nullptr) { + delete mainSwipeGroup; + mainSwipeGroup = nullptr; + } - for (int32_t i = 0; i < MAX_CARD; i++) - { - recordCard[i] = nullptr; - pageStatus[i] = false; - } + if (mainClockView != nullptr) { + delete mainClockView; + mainClockView = nullptr; + } - if (mainSwipeGroup != nullptr) - { - delete mainSwipeGroup; - mainSwipeGroup = nullptr; - } + if (activityWeekView != nullptr) { + delete activityWeekView; + activityWeekView = nullptr; + } - if (mainClockView != nullptr) - { - delete mainClockView; - mainClockView = nullptr; - } + if (playersView != nullptr) { + delete playersView; + playersView = nullptr; + } - if (activityWeekView != nullptr) - { - delete activityWeekView; - activityWeekView = nullptr; - } + if (heartRateView != nullptr) { + delete heartRateView; + heartRateView = nullptr; + } - if (playersView != nullptr) - { - delete playersView; - playersView = nullptr; - } + if (dropDownView != nullptr) { + delete dropDownView; + dropDownView = nullptr; + } - if (heartRateView != nullptr) - { - delete heartRateView; - heartRateView = nullptr; - } + if (messageView != nullptr) { + messageView->RemoveAll(); + delete messageView; + messageView = nullptr; + } - if (dropDownView != nullptr) - { - delete dropDownView; - dropDownView = nullptr; - } + if (messageLable != nullptr) { + delete messageLable; + messageLable = nullptr; + } - if (messageView != nullptr) - { - messageView->RemoveAll(); - delete messageView; - messageView = nullptr; - } + if (compassControlView != nullptr) { + delete compassControlView; + compassControlView = nullptr; + } - if (messageLable != nullptr) - { - delete messageLable; - messageLable = nullptr; - } + if (callback != nullptr) { + delete callback; + callback = nullptr; + } - if (compassControlView != nullptr) - { - delete compassControlView; - compassControlView = nullptr; - } + g_pMainView = nullptr; +} - if (callback != nullptr) - { - delete callback; - callback = nullptr; - } +MainViewSample *MainViewSample::GetInstance(void) +{ + return g_pMainView; +} - g_pMainView = nullptr; - } +void MainViewSample::OnStart() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::OnStart"); + View::OnStart(); + BaseView::RootView(Color::Black().full); - MainViewSample *MainViewSample::GetInstance(void) - { - return g_pMainView; + mainSwipeGroup = new UICrossView(); + if (mainSwipeGroup == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "mainSwipeGroup new fail"); + return; } - void MainViewSample::OnStart() - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::OnStart"); - View::OnStart(); - BaseView::RootView(Color::Black().full); - - mainSwipeGroup = new UICrossView(); - if (mainSwipeGroup == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "mainSwipeGroup new fail"); + if (callback == nullptr) { + callback = new ZoomEffect(); + if (callback == nullptr) { + delete mainSwipeGroup; + mainSwipeGroup = nullptr; + GRAPHIC_LOGE("SwipeCallback new fail\n"); return; } + } - if (callback == nullptr) - { - callback = new ZoomEffect(); - if (callback == nullptr) - { - delete mainSwipeGroup; - mainSwipeGroup = nullptr; - GRAPHIC_LOGE("SwipeCallback new fail\n"); - return; - } - } - - HorizontalViewInit(); - HorViewLoad(); - VerticalViewInit(); - VertViewLoad(); - mainSwipeGroup->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - mainSwipeGroup->SetAnimatorTime(50); // 50: animator drag time(ms); - mainSwipeGroup->SetLoopState(true); - mainSwipeGroup->EnableScreenCap(true); - mainSwipeGroup->RegisterSwipeCallback(callback); + HorizontalViewInit(); + HorViewLoad(); + VerticalViewInit(); + VertViewLoad(); + mainSwipeGroup->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + mainSwipeGroup->SetAnimatorTime(50); // 50: animator drag time(ms); + mainSwipeGroup->SetLoopState(true); + mainSwipeGroup->EnableScreenCap(true); + mainSwipeGroup->RegisterSwipeCallback(callback); + if (presenter_->IsFromSetCardView()) { + presenter_->SetFromSetCardView(false); + SwitchToCard(presenter_->GetFromCardId()); + } else { SwitchToClockPage(); - SetContainerView(mainSwipeGroup); } + SetContainerView(mainSwipeGroup); +} - bool MainViewSample::HorizontalViewInit(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::HorizontalViewInit"); - presenter_->InitDialSettings(); - presenter_->InitCardSettings(); - uint8_t cardSettingNum = presenter_->GetCardSettingCount(); - CardId *cardSettings = presenter_->GetCardSettings(); - uint8_t cardMapNumber = sizeof(CardMapper) / sizeof(CardMapper[0]); - for (int16_t i = 0; i < cardSettingNum; i++) - { - for (uint8_t j = 0; j < cardMapNumber; j++) - { - if (cardSettings[i] == CardMapper[j].id) - { - recordCard[j] = (this->*(CardMapper[j].func))(); - if (recordCard[j] == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, - "MainViewSample:: recordCard %d error", j); - return false; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, - "MainViewSample:: recordCard[%d]:%p", j, recordCard[j]); - break; +bool MainViewSample::HorizontalViewInit(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::HorizontalViewInit"); + presenter_->InitDialSettings(); + presenter_->InitCardSettings(); + uint8_t cardSettingNum = presenter_->GetCardSettingCount(); + CardId *cardSettings = presenter_->GetCardSettings(); + uint8_t cardMapNumber = sizeof(CardMapper) / sizeof(CardMapper[0]); + for (int16_t i = 0; i < cardSettingNum; i++) { + for (uint8_t j = 0; j < cardMapNumber; j++) { + if (cardSettings[i] == CardMapper[j].id) { + recordCard[j] = (this->*(CardMapper[j].func))(); + if (recordCard[j] == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, + "MainViewSample:: recordCard %d error", j); + return false; } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, + "MainViewSample:: recordCard[%d]:%p", j, recordCard[j]); + break; } } - presenter_->setCallback(callback); - mainSwipeGroup->SetOnSwipeListener(presenter_); - mainSwipeGroup->SetOnLongPressListener(presenter_); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::InitPage over"); - return true; } + presenter_->setCallback(callback); + mainSwipeGroup->SetOnSwipeListener(presenter_); + mainSwipeGroup->SetOnLongPressListener(presenter_); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::InitPage over"); + return true; +} - void MainViewSample::HorViewLoad(void) - { - uint8_t cardSettingNum = presenter_->GetCardSettingCount(); - CardId *cardSettings = presenter_->GetCardSettings(); - for (int16_t i = 0; i < cardSettingNum; i++) - { - CardId cardId = cardSettings[i]; - if (recordCard[cardId] != nullptr) - { - mainSwipeGroup->HorAdd(recordCard[cardId]); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample:: HorViewLoad cardid = %d ViewIndex = %d", - cardId, recordCard[cardId]->GetViewIndex()); - } +void MainViewSample::HorViewLoad(void) +{ + uint8_t cardSettingNum = presenter_->GetCardSettingCount(); + CardId *cardSettings = presenter_->GetCardSettings(); + for (int16_t i = 0; i < cardSettingNum; i++) { + CardId cardId = cardSettings[i]; + if (recordCard[cardId] != nullptr) { + mainSwipeGroup->HorAdd(recordCard[cardId]); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample:: HorViewLoad cardid = %d ViewIndex = %d", + cardId, recordCard[cardId]->GetViewIndex()); } } +} - void MainViewSample::VerticalViewInit(void) - { - dropDownView = new PullUpDownView(); - if (dropDownView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropDownView new fail"); - return; - } - dropDownView->PreLoad(); - dropDownView->SetViewId("dropDownView"); - dropDownView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - dropDownView->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - - messageView = new UICardPage(); - if (messageView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageView new fail"); - return; - } - messageView->SetPosition(0, 0); - messageView->SetWidth(Screen::GetInstance().GetWidth()); - messageView->SetHeight(Screen::GetInstance().GetHeight()); - messageView->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - messageView->SetViewId("messageView"); - messageView->SetTouchable(true); - messageView->SetIntercept(true); - messageLable = new UILabel(); - if (messageLable == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLable new fail"); - return; - } - messageLable->SetPosition(MESLABLE_X_TMP, MESLABLE_Y_TMP, MESLABLE_WIDTH_TMP, MESLABLE_HEIGHT_TMP); - messageLable->SetText("无消息"); - messageLable->SetAlign(TEXT_ALIGNMENT_CENTER); - messageLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_SIZE_TMP); - messageLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - messageView->Add(messageLable); +void MainViewSample::VerticalViewInit(void) +{ + dropDownView = new PullUpDownView(); + if (dropDownView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "dropDownView new fail"); + return; } - - void MainViewSample::VertViewLoad(void) - { - mainSwipeGroup->VerAdd(dropDownView, UICrossView::VPage::UP_PAGE); - mainSwipeGroup->VerAdd(messageView, UICrossView::VPage::DOWN_PAGE); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::PullViewLoad::Pull View Load complete"); + dropDownView->PreLoad(); + dropDownView->SetViewId("dropDownView"); + dropDownView->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + dropDownView->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); + + messageView = new UICardPage(); + if (messageView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageView new fail"); + return; } + messageView->SetPosition(0, 0); + messageView->SetWidth(Screen::GetInstance().GetWidth()); + messageView->SetHeight(Screen::GetInstance().GetHeight()); + messageView->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); + messageView->SetViewId("messageView"); + messageView->SetTouchable(true); + messageView->SetIntercept(true); + messageLable = new UILabel(); + if (messageLable == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLable new fail"); + return; + } + messageLable->SetPosition(MESLABLE_X_TMP, MESLABLE_Y_TMP, MESLABLE_WIDTH_TMP, MESLABLE_HEIGHT_TMP); + messageLable->SetText("无消息"); + messageLable->SetAlign(TEXT_ALIGNMENT_CENTER); + messageLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_SIZE_TMP); + messageLable->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + messageView->Add(messageLable); +} - void MainViewSample::OnSetUpView() - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::OnSetUpView"); - View::OnSetUpView(); +void MainViewSample::VertViewLoad(void) +{ + mainSwipeGroup->VerAdd(dropDownView, UICrossView::VPage::UP_PAGE); + mainSwipeGroup->VerAdd(messageView, UICrossView::VPage::DOWN_PAGE); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::PullViewLoad::Pull View Load complete"); +} - // show timerView - Draw(); - } +void MainViewSample::OnSetUpView() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::OnSetUpView"); + View::OnSetUpView(); - void MainViewSample::OnTearDownView() - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::OnTearDownView"); - View::OnTearDownView(); - return; - } + // show timerView + Draw(); +} - void MainViewSample::OnStop() - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::OnStop"); - View::OnStop(); - container_ = nullptr; - messageView->RemoveAll(); - RootView::GetInstance()->ClearOnKeyActListener(); - RootView::GetInstance()->RemoveAll(); - return; - } +void MainViewSample::OnTearDownView() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::OnTearDownView"); + View::OnTearDownView(); + return; +} - UICardPage *MainViewSample::InitWathOffDial(DialSetting &setting) - { - DialViewGroup *dial = new DialViewGroup(); - dial->SetDial(setting.dialFullName); - return dial; - } +void MainViewSample::OnStop() +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainViewSample::OnStop"); + View::OnStop(); + container_ = nullptr; + + messageView->RemoveAll(); + RootView::GetInstance()->ClearOnKeyActListener(); + RootView::GetInstance()->RemoveAll(); + return; +} - UICardPage *MainViewSample::InitWathDial(DialSetting &setting) - { - switch (setting.dialId) - { +UICardPage *MainViewSample::InitWatchOffDial(DialSetting &setting) +{ + DialViewGroup *dial = new DialViewGroup(); + dial->SetDial(setting.dialFullName); + return dial; +} + +UICardPage *MainViewSample::InitWatchDial(DialSetting &setting) +{ + switch (setting.dialId) { case DIAL_CLOCK: return new MainClockView(); default: return nullptr; - } } +} - UICardPage *MainViewSample::InitWatchFacePage(void) - { - DialSetting &setting = presenter_->GetDialSetting(); - if (setting.dialFlag) - { - mainClockView = InitWathOffDial(setting); - } - else - { - mainClockView = InitWathDial(setting); - } +UICardPage *MainViewSample::InitWatchFacePage(void) +{ + DialSetting &setting = presenter_->GetDialSetting(); + if (setting.dialFlag) { + mainClockView = InitWatchOffDial(setting); + } else { + mainClockView = InitWatchDial(setting); + } - if (mainClockView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView new fail"); - return nullptr; - } - return mainClockView; + if (mainClockView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainClockView new fail"); + return nullptr; } + return mainClockView; +} - UICardPage *MainViewSample::InitHeartRatePage(void) - { - heartRateView = new HeartRateView(); - if (heartRateView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "heartRateView new fail"); - return nullptr; - } - return heartRateView; +UICardPage *MainViewSample::InitHeartRatePage(void) +{ + heartRateView = new HeartRateView(); + if (heartRateView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "heartRateView new fail"); + return nullptr; } + return heartRateView; +} - UICardPage *MainViewSample::InitActivityPage(void) - { - activityWeekView = new ActivityWeekView(); - if (activityWeekView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "activityWeekView new fail"); - return nullptr; - } - return activityWeekView; +UICardPage *MainViewSample::InitActivityPage(void) +{ + activityWeekView = new ActivityWeekView(); + if (activityWeekView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "activityWeekView new fail"); + return nullptr; } + return activityWeekView; +} - UICardPage *MainViewSample::InitCompassPage(void) - { - compassControlView = new CompassControlView(); - if (compassControlView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "compassControlView new fail"); - return nullptr; - } - return compassControlView; +UICardPage *MainViewSample::InitCompassPage(void) +{ + compassControlView = new CompassControlView(); + if (compassControlView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "compassControlView new fail"); + return nullptr; } + return compassControlView; +} - UICardPage *MainViewSample::InitMusicPlayerPage(void) - { - playersView = new PlayersView(); - if (playersView == nullptr) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playersView new fail"); - return nullptr; - } - return playersView; +UICardPage *MainViewSample::InitMusicPlayerPage(void) +{ + playersView = new PlayersView(); + if (playersView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playersView new fail"); + return nullptr; } + return playersView; +} - void MainViewSample::SetPage(int16_t page) - { - if (mainSwipeGroup != nullptr) - { - mainSwipeGroup->SetHorCurrentPage(page); - } +void MainViewSample::SetPage(int16_t page) +{ + if (mainSwipeGroup != nullptr) { + mainSwipeGroup->SetHorCurrentPage(page); + } - if (presenter_ != nullptr) - { - CardId *cardSettings = presenter_->GetCardSettings(); - /* page 与CardId 没有对应关系,需要一次转换 */ - presenter_->SetTaskPeroid(cardSettings[page]); - } + if (presenter_ != nullptr) { + CardId *cardSettings = presenter_->GetCardSettings(); + /* page 与CardId 没有对应关系,需要一次转换 */ + presenter_->SetTaskPeroid(cardSettings[page]); } +} - bool MainViewSample::IsMainClockPage(void) - { - if (mainSwipeGroup->GetCurrentPageId(0) == mainClockView->GetViewIndex() && - mainSwipeGroup->GetCurrentPageId(1) == 1) - { // 0: horizontal; 1: vertical - return true; - } - else - { - return false; - } +bool MainViewSample::IsMainClockPage(void) +{ + if (mainSwipeGroup->GetCurrentPageId(0) == mainClockView->GetViewIndex() && + mainSwipeGroup->GetCurrentPageId(1) == 1) { // 0: horizontal; 1: vertical + return true; + } else { + return false; } +} - CardId MainViewSample::GetHorCurrentCard() const - { - CardId *cardSettings = presenter_->GetCardSettings(); - int pageId = mainSwipeGroup->GetCurrentPageId(UISwipeView::HORIZONTAL); // 0: horizontal; 1: vertical - /* pageId 与CardId 没有对应关系,需要一次转换 */ - return cardSettings[pageId]; +CardId MainViewSample::GetHorCurrentCard() const +{ + CardId *cardSettings = presenter_->GetCardSettings(); + int pageId = mainSwipeGroup->GetCurrentPageId(UISwipeView::HORIZONTAL); // 0: horizontal; 1: vertical + /* pageId 与CardId 没有对应关系,需要一次转换 */ + return cardSettings[pageId]; +} + +void MainViewSample::SwitchToCard(uint8_t cardId) +{ + if ((cardId < MAX_CARD) && (recordCard[cardId] != nullptr)) { + SetPage(recordCard[cardId]->GetViewIndex()); + } else { + SwitchToClockPage(); } +} } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/ModelListenerSample.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/ModelListenerSample.cpp index bb5f0bf1b..ab4844c3d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/ModelListenerSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/ModelListenerSample.cpp @@ -34,5 +34,6 @@ ModelListenerSample::~ModelListenerSample() void ModelListenerSample::Callback() { Notify(); + OnTickEvent(); } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/PresenterTask.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/PresenterTask.cpp index 587a35d30..1b1c61930 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/PresenterTask.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/PresenterTask.cpp @@ -4,7 +4,8 @@ namespace OHOS { -PresenterTask* PresenterTask::GetInstance() { +PresenterTask* PresenterTask::GetInstance() +{ static PresenterTask PresenterTask; return &PresenterTask; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/VolumeSettingPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/VolumeSettingPresenter.cpp index ca79d102f..7ca2d4c07 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/VolumeSettingPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/VolumeSettingPresenter.cpp @@ -25,26 +25,16 @@ namespace OHOS { extern "C" { #endif -static VolumeSliderEventListener *g_pVolumeSliderEventListener = nullptr; - constexpr int16_t SOUND_CHANGE = 10; -VolumeSliderEventListener::VolumeSliderEventListener() +VolumeSliderEventListener::VolumeSliderEventListener(VolumeSettingView *volumeSetting) : volumeSettingView(volumeSetting) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeSliderEventListener new"); - g_pVolumeSliderEventListener = this; } VolumeSliderEventListener::~VolumeSliderEventListener() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeSliderEventListener::~VolumeSliderEventListener"); - g_pVolumeSliderEventListener = nullptr; -} - -VolumeSliderEventListener *VolumeSliderEventListener::GetInstance() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeSliderEventListener GetInstance"); - return g_pVolumeSliderEventListener; } bool VolumeSliderEventListener::OnClick(UIView& view, const ClickEvent& event) @@ -67,11 +57,6 @@ bool VolumeSliderEventListener::OnClick(UIView& view, const ClickEvent& event) void VolumeSliderEventListener::ChangeVolume(VolumeChangeStatus status) { ImageInfo *image; - VolumeSettingView *volumeSettingView = VolumeSettingView::GetInstance(); - if (volumeSettingView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick:volumeSettingView new fail"); - return; - } UISlider *progress = volumeSettingView->GetProgress(); if (progress == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick:progress new fail"); @@ -85,7 +70,7 @@ void VolumeSliderEventListener::ChangeVolume(VolumeChangeStatus status) preSound = volumeSettingView->sounding; if (status == VOLUMEUP) { - volumeSettingView->sounding = progress->GetValue() + SOUND_CHANGE; + volumeSettingView->sounding = progress->GetValue() + SOUND_CHANGE; if (volumeSettingView->sounding > VOLUME_MAX) { volumeSettingView->sounding = VOLUME_MAX; } @@ -136,8 +121,7 @@ void VolumeSliderEventListener::ChangeVolume(VolumeChangeStatus status) BtAndLocalVolumeSet(volumeSettingView->sounding); } if (playerCoefficients == VOLUMEPHONE || playerCoefficients == VOLUMEPHONENOTIFY) { - unsigned char volumeValue; - volumeValue = (unsigned char) ((double) (volumeSettingView->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换 + unsigned char volumeValue = (unsigned char) ((double) (volumeSettingView->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换 SetSpeakerVolume(volumeValue); } } @@ -145,14 +129,13 @@ void VolumeSliderEventListener::ChangeVolume(VolumeChangeStatus status) extern BtAvrcpTgInf g_avrcp_srv_inf; void VolumeSliderEventListener::BtAndLocalVolumeSet(int16_t sounding) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtAndLocalVolumeSet %d", sounding); if (g_avrcp_srv_inf.avrcp_srv_conn_stat == PROFILE_STATE_CONNECTED) { uint8_t volume = sounding * AVRCP_ABSOLUTE_VOLUME_PERCENTAGE_100 / 100; // 100:本地音量最大值 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "volume 0x%x", volume); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "avrcp volume = %d", volume); (void)avrcp_ct_set_absolute_volume(&(g_avrcp_srv_inf.bd_addr), volume); // 手表音量设置同步远端BT音量 - } else { - AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, sounding); // 本地音量设置 } + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "audio volume = %d", sounding); + AudioManager::GetInstance().SetVolume(AUDIO_STREAM_MUSIC, sounding); // 本地音量设置 } void VolumeSliderEventListener::OnRelease(int32_t value) @@ -174,11 +157,6 @@ void VolumeSliderEventListener::OnChange(int32_t value) bool VolumeSliderEventListener::OnDrag(UIView& view, const DragEvent& event) { - VolumeSettingView *volumeSettingView = VolumeSettingView::GetInstance(); - if (volumeSettingView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnDrag::volumeSettingView new fail"); - return false; - } if (strcmp(view.GetViewId(), VOLUME_VIEW) == 0) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeSliderEventListener::OnDrag"); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/VolumeSettingView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/VolumeSettingView.cpp index c4d3bad80..e8eeb4df7 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/VolumeSettingView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/VolumeSettingView.cpp @@ -10,7 +10,6 @@ #include "ui_resource_image.h" namespace OHOS { -static VolumeSettingView *g_pVolumeSettingView{nullptr}; static constexpr uint16_t BUTTON_X = 182; static constexpr uint16_t BUTTON_Y = 0; static constexpr uint16_t BUTTON_Y2 = 363; @@ -27,18 +26,15 @@ constexpr int16_t VOLUME_ERROR = (-1); VolumeSettingView::VolumeSettingView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeSettingView::VolumeSettingView"); - g_pVolumeSettingView = this; } VolumeSettingView::~VolumeSettingView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeSettingView::~VolumeSettingView"); RemoveAll(); - - UIView::OnClickListener *click = increaseButton->GetOnClickListener(); - if (click != nullptr) { - delete click; - click = nullptr; + if (listener != nullptr) { + delete listener; + listener = nullptr; } delete increaseButton; increaseButton = nullptr; @@ -48,13 +44,6 @@ VolumeSettingView::~VolumeSettingView() delete progress; progress = nullptr; - - g_pVolumeSettingView = nullptr; -} - -VolumeSettingView *VolumeSettingView::GetInstance(void) -{ - return g_pVolumeSettingView; } bool VolumeSettingView::SetUpVolume(void) @@ -78,7 +67,7 @@ bool VolumeSettingView::SetUpVolume(void) progress->SetRange(VOLUME_MAX, VOLUME_MIN); if (listener == nullptr) { - listener = new VolumeSliderEventListener(); + listener = new VolumeSliderEventListener(this); if (listener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "listener new fail"); return false; @@ -88,9 +77,8 @@ bool VolumeSettingView::SetUpVolume(void) progress->SetOnClickListener(listener); progress->SetOnDragListener(listener); progress->SetKnobStyle(StyleDefault::GetSliderKnobStyle()); - UIView::OnDragListener *volDragListener = (UIView::OnDragListener *)OHOS::VolumeSliderEventListener::GetInstance(); SetViewId(VOLUME_VIEW); - SetOnDragListener(volDragListener); + SetOnDragListener(listener); SetDraggable(true); SetTouchable(true); Add(progress); @@ -117,7 +105,6 @@ UIButton *VolumeSettingView::GetDecreaseButton(void) int VolumeSettingView::ShowVolume(void) { ImageInfo *image; - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::VolumeSliderEventListener::GetInstance(); if (increaseButton == nullptr) { increaseButton = new UIButton(); if (increaseButton == nullptr) { @@ -129,7 +116,7 @@ int VolumeSettingView::ShowVolume(void) increaseButton->SetViewId(INCREASE_BUTTON); image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_INCREASE_BUTTON, PLAYER_IAMGES); increaseButton->SetImageSrc(image, image); - increaseButton->SetOnClickListener(clickListener); + increaseButton->SetOnClickListener(listener); Add(increaseButton); if (decreaseButton == nullptr) { @@ -143,9 +130,15 @@ int VolumeSettingView::ShowVolume(void) decreaseButton->SetViewId(DECREASE_BUTTON); image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_DECREASE_BUTTON, PLAYER_IAMGES); decreaseButton->SetImageSrc(image, image); - decreaseButton->SetOnClickListener(clickListener); + decreaseButton->SetOnClickListener(listener); Add(decreaseButton); return VOLUME_OK; } + +VolumeSliderEventListener *VolumeSettingView::GetVolumeEventListener(void) +{ + return listener; +} + } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialModelSteps.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialModelSteps.cpp index b21f8cc92..0a9e7ff29 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialModelSteps.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialModelSteps.cpp @@ -21,7 +21,7 @@ bool DialModelSteps::GetDialFloatData(DialDataType& type, float& out) void DialModelSteps::UpdateSteps(int16_t steps) { steps_ = static_cast(steps); - if(onChangeListener_ != nullptr) { + if (onChangeListener_ != nullptr) { onChangeListener_->OnDialFloatDataUpdate(DialDataType::DATA_TYPE_STEPS, steps_); } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialModelTime.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialModelTime.cpp index dbc4efff6..2af8cd26d 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialModelTime.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialModelTime.cpp @@ -71,7 +71,7 @@ static float ConvertHandSecondValueToAngle(int32_t handValue, uint16_t range) void DialModelTime::UpdateTime() { struct timeval tv; - gettimeofday(&tv, NULL); + gettimeofday(&tv, nullptr); tblock_ = localtime(&tv.tv_sec); int realMS = tblock_->tm_sec * S_MS_US_TRANS + tv.tv_usec / S_MS_US_TRANS; @@ -101,10 +101,10 @@ bool DialModelTime::GetDialFloatData(DialDataType& type, float& out) out = static_cast(angleMS_); break; case DialDataType::DATA_TYPE_TIME_YEAR: - out = static_cast((tblock_->tm_year) + 1900); + out = static_cast(tblock_->tm_year); break; case DialDataType::DATA_TYPE_TIME_MONTH: - out = static_cast((tblock_->tm_mon) + 1); + out = static_cast(tblock_->tm_mon); break; case DialDataType::DATA_TYPE_TIME_WEEK: out = static_cast(tblock_->tm_wday); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialVideoView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialVideoView.cpp index 7770f1618..c3cbafba4 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialVideoView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialVideoView.cpp @@ -12,7 +12,7 @@ static constexpr int16_t JPEG_HEIGHT_DIVISOR = 2; static constexpr int16_t JPEG_WIDTH_BYTE_ALIGNMENT = 128; static constexpr int16_t JPEG_HEIGHT_BYTE_ALIGNMENT = 16; static constexpr int16_t BUFFER_QUEUE_SIZE = 2; -static constexpr int16_t STRIDE_ALIGNMENT_VALUE = 64; +static constexpr int16_t STRIDE_ALIGNMENT_VALUE = 128; #ifdef SUPPORT_AT_OHOSFWK static MediaVideoPlay *g_videoPlay = nullptr; @@ -50,7 +50,6 @@ DialVideoView::~DialVideoView() deregisterNotifyScreenStatus(ScreenStatusNotify); #endif if (videoPlayer_ != nullptr) { - videoPlayer_->StopVideoPlay(); delete videoPlayer_; } } @@ -87,6 +86,7 @@ bool DialVideoView::SetVideoRes(FILE* fp, uint32_t offset) } videoPlayer_ = new MediaVideoPlay(surface, fd, offset_, true); + videoPlayer_->SetSyncExitMode(true); #ifdef SUPPORT_AT_OHOSFWK g_videoPlay = videoPlayer_; registerNotifyScreenStatus(ScreenStatusNotify); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp index 1b022d79b..2eea946de 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialViewGroup.cpp @@ -18,6 +18,10 @@ DialViewGroup::DialViewGroup(void) DialViewGroup::~DialViewGroup(void) { + if (kaleidoscope_ != nullptr) { + kaleidoscope_->ClearFocus(); + kaleidoscope_ = nullptr; + } ClearDial(); } @@ -82,6 +86,11 @@ void DialViewGroup::PreLoad(void) if (video_ != nullptr) { video_->StartPlay(); } + + if (kaleidoscope_ != nullptr) { + kaleidoscope_->RequestFocus(); + kaleidoscope_->StartRotateAnimator(); + } resPreloaded_ = true; } } @@ -115,6 +124,10 @@ void DialViewGroup::AddView(UIView* view, bool isDialVideoView) dialViews_.PushBack(view); Add(view); + if (view->GetViewType() == UI_KALEIDOSCOPE_VIEW) { + kaleidoscope_ = dynamic_cast(view); + } + if (isDialVideoView) { if (video_ != nullptr) { GRAPHIC_LOGE("Already added a video view.\n"); @@ -253,6 +266,14 @@ bool DialViewGroup::OnClickEvent(const ClickEvent& event) void DialViewGroup::ScrollBegin(bool isActive) { + if (kaleidoscope_ != nullptr) { + if (isActive) { + kaleidoscope_->ClearFocus(); + kaleidoscope_->StopRotateAnimator(); + } + return; + } + if (video_ == nullptr) { return; } @@ -263,6 +284,14 @@ void DialViewGroup::ScrollBegin(bool isActive) void DialViewGroup::ScrollEnd(bool isActive) { + if (kaleidoscope_ != nullptr) { + if (isActive) { + kaleidoscope_->StartRotateAnimator(); + kaleidoscope_->RequestFocus(); + } + return; + } + if (video_ == nullptr) { return; } @@ -273,11 +302,24 @@ void DialViewGroup::ScrollEnd(bool isActive) } else if (video_->IsStopped()) { video_->StartPlay(); } + } else { + if (video_->IsPaused() || video_->IsPlayed()) { + video_->StopPlay(); + } + ClearCache(); } } void DialViewGroup::CoverBegin(bool isCovered) { + if (kaleidoscope_ != nullptr) { + if (!isCovered) { + kaleidoscope_->StopRotateAnimator(); + kaleidoscope_->ClearFocus(); + } + return; + } + if (video_ == nullptr) { return; } @@ -289,6 +331,13 @@ void DialViewGroup::CoverBegin(bool isCovered) void DialViewGroup::CoverEnd(bool isCovered) { + if (kaleidoscope_ != nullptr) { + if (!isCovered) { + kaleidoscope_->RequestFocus(); + kaleidoscope_->StartRotateAnimator(); + } + return; + } if (video_ == nullptr) { return; } @@ -300,4 +349,18 @@ void DialViewGroup::CoverEnd(bool isCovered) } } } + +void DialViewGroup::OnActive(void) +{ + if (video_ != nullptr) { + if (video_->IsPaused()) { + video_->ResumePlay(); + } else if (video_->IsStopped()) { + video_->StartPlay(); + } + } else if (kaleidoscope_ != nullptr) { + kaleidoscope_->RequestFocus(); + kaleidoscope_->StartRotateAnimator(); + } +} } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/ModelDialDataFactory.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/ModelDialDataFactory.cpp index 9d02e691d..d17de5b31 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/ModelDialDataFactory.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/ModelDialDataFactory.cpp @@ -7,7 +7,7 @@ #include "ModelDialDataFactory.h" namespace OHOS { -bool ModelDialDataFactory::GetDialTextData(DialDataType& type, string*& out, int16_t& strNum) +bool ModelDialDataFactory::GetDialTextData(DialDataType& type, std::string*& out, int16_t& strNum) { DialBaseModel* model = GetModuleByType(type); if (model == nullptr) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/parser/DialBinParser.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/parser/DialBinParser.cpp index 6e54b0a92..b2978d168 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/parser/DialBinParser.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/parser/DialBinParser.cpp @@ -578,6 +578,17 @@ int32_t DialBinParser::ParserDialVideo(FILE* fp) view->SetPosition(data->rect.x, data->rect.y, data->rect.w, data->rect.h); view->SetSurfaceColorkey(data->colorKey); view->SetVideoRes(fp, data->offset); + uint32_t resId = data->imgId | dirId_; + uint32_t curReadPt = ftell(fp); + ImageInfo* imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(resId, + file_, fp, false, imageOffset_); + if (imgInfo == nullptr) { + GRAPHIC_LOGE("[%s: %d]load img fail! file: %s resId: %x\n", + __FUNCTION__, __LINE__, file_.c_str(), resId); + return false; + } + fseek(fp, curReadPt, SEEK_SET); + view->SetPreview(imgInfo); dialGroup_->AddView(view, true); UIFree(data); return 0; @@ -633,10 +644,8 @@ int32_t DialBinParser::ParserDialKaleidoscope(FILE* fp) fseek(fp, curReadPt, SEEK_SET); view->SetSrc(imgInfo); - view->RequestFocus(); view->SetRotateEventFactor(data->crownRotateStep); // 0.2: rotate event factor view->SetRotateAnimatorValue(data->animatorRotateStep); // 0.1: rotate animator value - view->StartRotateAnimator(); dialGroup_->AddView(view); UIFree(data); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/MainCallingPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/MainCallingPresenter.h index 761f2320a..dd1ef4e1b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/MainCallingPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/makephone/include/MainCallingPresenter.h @@ -19,7 +19,7 @@ class MainCallingView; class MainCallingPresenter : public Presenter, public UIView::OnClickListener { public: MainCallingPresenter(); - virtual ~MainCallingPresenter(); + ~MainCallingPresenter() override; void OnStart() override; void OnPause() override; @@ -31,12 +31,12 @@ public: bool CallingViewDisplay(); bool InitPointerValue(); bool OnClick(UIView& view, const ClickEvent& event) override; + VolumeSettingView *GetvolumeSetting(); private: int changeImage{0}; bool HintsHandupClick(); KeyInputListener *keyActListenr{nullptr}; VolumeSettingView *volumeSetting{nullptr}; - UIViewGroup *volumeSettingView{nullptr}; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/CallerDisplayView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/CallerDisplayView.cpp index 5de273b53..2426ea21e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/CallerDisplayView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/CallerDisplayView.cpp @@ -139,17 +139,17 @@ UIViewGroup *CallerDisplayView::CreateUIViewGroup() group->SetPosition(MATH_ZERO, MATH_ZERO); group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value - if (InitImageViewDisplay() == false) { + if (!InitImageViewDisplay()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::InitImageViewDisplay error"); return nullptr; } - if (InitAddOnclickevent() == false) { + if (!InitAddOnclickevent()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::InitAddOnclickevent error"); return nullptr; } - if (InitUILabelDisplay() == false) { + if (!InitUILabelDisplay()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallerDisplayView::InitUILabelDisplay error"); return nullptr; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/CallingView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/CallingView.cpp index eb85ee0df..2c19d7599 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/CallingView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/CallingView.cpp @@ -164,7 +164,7 @@ bool CallingView::InitUILabelDisplay() VIEW_DISTANCE_TO_LEFT_SIDE, TITLE_LABEL_DEFAULT_HEIGHT); callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); callDuration->SetAlign(TEXT_ALIGNMENT_CENTER); - callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration()); + callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str()); callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_TIME_FONT_SIZE); callDuration->SetTextColor(Color::White()); group->Add(callDuration); @@ -195,17 +195,17 @@ UIViewGroup *CallingView::CreateUIViewGroup() group->SetPosition(MATH_ZERO, MATH_ZERO); group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value - if (InitImageViewDisplay() == false) { + if (!InitImageViewDisplay()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitImageViewDisplay error"); return nullptr; } - if (InitAddOnclickevent() == false) { + if (!InitAddOnclickevent()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitAddOnclickevent error"); return nullptr; } - if (InitUILabelDisplay() == false) { + if (!InitUILabelDisplay()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CallingView::InitUILabelDisplay error"); return nullptr; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/DialingScreenView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/DialingScreenView.cpp index 7efc14eb1..99808b2e9 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/DialingScreenView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/DialingScreenView.cpp @@ -124,7 +124,7 @@ UIViewGroup *DialingScreenView::CreateUIViewGroup() group->SetPosition(MATH_ZERO, MATH_ZERO); group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value - if (InitUILabelDisplay() == false) { + if (!InitUILabelDisplay()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DialingScreenView::InitImageViewDisplay error"); return nullptr; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp index 7b80e99fa..544d77562 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/MainCallingPresenter.cpp @@ -30,9 +30,8 @@ MainCallingPresenter::~MainCallingPresenter() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::~MainCallingPresenter"); RootView::GetInstance()->RemoveAll(); - if (volumeSettingView != nullptr) { - delete volumeSettingView; - volumeSettingView = nullptr; + if (volumeSetting != nullptr) { + delete volumeSetting; volumeSetting = nullptr; } g_pMainView = nullptr; @@ -70,13 +69,13 @@ void MainCallingPresenter::OnStop(void) void MainCallingPresenter::HonrsViewChange() { - if (volumeSettingView == nullptr) { + if (volumeSetting == nullptr) { volumeSetting = new VolumeSettingView(); if (volumeSetting == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::volumeSetting nullptr err"); return; } - if (volumeSetting->SetUpVolume() == false) { + if (!volumeSetting->SetUpVolume()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::volumeSetting SetUpVolume fail"); return; } @@ -85,10 +84,9 @@ void MainCallingPresenter::HonrsViewChange() ImageInfo *image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_MUTE_BUTTON, PLAYER_IAMGES); volumeSetting->GetDecreaseButton()->SetImageSrc(image, image); } - volumeSettingView = volumeSetting; - RootView::GetInstance()->Add(volumeSettingView); + RootView::GetInstance()->Add(volumeSetting); } - VolumeSliderEventListener *volumeSliderEventListener = VolumeSliderEventListener::GetInstance(); + VolumeSliderEventListener *volumeSliderEventListener = volumeSetting->GetVolumeEventListener(); if (volumeSliderEventListener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::volumeSliderEventListener nullptr err"); return; @@ -96,7 +94,7 @@ void MainCallingPresenter::HonrsViewChange() volumeSliderEventListener->SetPlayerCoefficients(VOLUMEPHONE); // 进度条系数 - if (InitPointerValue() == false) { + if (!InitPointerValue()) { return; } @@ -105,14 +103,14 @@ void MainCallingPresenter::HonrsViewChange() view_->GetCallingGroup()->SetVisible(false); view_->GetWaitingGroup()->SetVisible(false); - volumeSettingView->SetVisible(true); + volumeSetting->SetVisible(true); // 刷新UI RootView::GetInstance()->Invalidate(); } bool MainCallingPresenter::CallingViewDisplay() { - if (InitPointerValue() == false) { + if (!InitPointerValue()) { return false; } view_->GetScreenGroup()->SetVisible(false); @@ -174,7 +172,7 @@ bool MainCallingPresenter::HintsHandupClick() } CallerLogModel::GetInstance()->SetWaitingStatus(false); CallerLogModel::GetInstance()->SetCallStatus(true); - NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TRANSITION_INVALID, PRIORITY_ONE); + NativeAbility::GetInstance().ChangeSlice(VIEW_MAEKPHONE_SAMPLE, TransitionType::TRANSITION_INVALID, PRIORITY_ONE); return true; } @@ -182,7 +180,7 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) { UNUSED(event); - if (InitPointerValue() == false) { + if (!InitPointerValue()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::InitPointerValue error"); return false; } @@ -216,7 +214,7 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingPresenter::honrs show"); HonrsViewChange(); } else if (strcmp(view.GetViewId(), "hintsHandup") == 0) { - if (HintsHandupClick() == false) { + if (!HintsHandupClick()) { return false; } } else if (strcmp(view.GetViewId(), "answer") == 0) { @@ -232,4 +230,9 @@ bool MainCallingPresenter::OnClick(UIView& view, const ClickEvent& event) } return true; } + +VolumeSettingView *MainCallingPresenter::GetvolumeSetting() +{ + return volumeSetting; +} } \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/MainCallingView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/MainCallingView.cpp index 3e2497d14..df06f8429 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/MainCallingView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/MainCallingView.cpp @@ -121,7 +121,7 @@ void MainCallingView::OnStart() View::OnStart(); BaseView::RootView(Color::Black().full); - if (InitPointerValue() == false) { + if (!InitPointerValue()) { return; } @@ -132,15 +132,15 @@ void MainCallingView::OnStart() waitingGroup->SetVisible(false); callingGroup->SetVisible(false); - if (CallerLogModel::GetInstance()->GetCallStatus() == true) { + if (CallerLogModel::GetInstance()->GetCallStatus()) { displayGroup->SetVisible(false); callingGroup->SetVisible(true); screenGroup->SetVisible(false); - } else if (CallerLogModel::GetInstance()->GetWaitingStatus() == true) { + } else if (CallerLogModel::GetInstance()->GetWaitingStatus()) { screenGroup->SetVisible(false); displayGroup->SetVisible(false); waitingGroup->SetVisible(true); - } else if (CallerLogModel::GetInstance()->GetPhoneStatus() == true) { + } else if (CallerLogModel::GetInstance()->GetPhoneStatus()) { displayGroup->SetVisible(false); } else { screenGroup->SetVisible(false); @@ -153,7 +153,7 @@ void MainCallingView::OnSetUpView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "MainCallingView::~OnSetUpView"); View::OnSetUpView(); - if (CallerLogModel::GetInstance()->GetMulitplePhoneStatus() == true) { + if (CallerLogModel::GetInstance()->GetMulitplePhoneStatus()) { MulitplePhoneTextReplaces(); CallerLogModel::GetInstance()->SetMulitplePhoneStatus(false); } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/WaitingHintsView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/WaitingHintsView.cpp index 5b1e446d5..e27e55dbc 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/WaitingHintsView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/makephone/src/WaitingHintsView.cpp @@ -50,10 +50,10 @@ UIViewGroup *WaitingHintsView::CreateUIViewGroup() group->SetPosition(MATH_ZERO, MATH_ZERO); group->Resize(VERTICAL_RESOLUTION, HORIZONTAL_RESOLUTION); // 454 : value - if (InitImageViewDisplay() == false) { + if (!InitImageViewDisplay()) { return nullptr; } - if (InitUILabelDisplay() == false) { + if (!InitUILabelDisplay()) { return nullptr; } return group; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/include/MainVocassistView.h b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/include/MainVocassistView.h index 194e59a4b..74b194508 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/include/MainVocassistView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/include/MainVocassistView.h @@ -17,7 +17,7 @@ class VocassistPresenter; class MainVocassistView : public View { public: MainVocassistView(); - virtual ~MainVocassistView(); + ~MainVocassistView() override; void OnStart() override; void OnSetUpView() override; void OnTearDownView() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/include/VocassistView.h b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/include/VocassistView.h index e22acc3fb..8ec962153 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/include/VocassistView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/include/VocassistView.h @@ -106,7 +106,7 @@ namespace OHOS { class VoiceAssistance : public AppGroupView { public: VoiceAssistance(); - virtual ~VoiceAssistance(); + ~VoiceAssistance() override; static VoiceAssistance *GetInstance(); bool InitView(void *caller) override; // 初始化所有控件 diff --git a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistModel.cpp index c4c704a72..00ffa938d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistModel.cpp @@ -9,7 +9,6 @@ #include "VocassistView.h" #include "VocassistModel.h" #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "NativeAbility.h" #include "graphic_service.h" @@ -36,7 +35,7 @@ static const char g_voiceWordName[SMART_VOICE_INVALID_CMD_ID + 1][CMD_LENGTH] = namespace OHOS { static void RecognVoiceEvent(const SmartVoiceCmdParam data) { - SmartVoiceCmdParam *param = NULL; + SmartVoiceCmdParam *param = nullptr; param = (SmartVoiceCmdParam *)&data; if (param->cmdId < SMART_VOICE_WAKEUP_CMD || param->cmdId > SMART_VOICE_INVALID_CMD_ID) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Get cmdid failed, funct callback finish!!"); @@ -55,11 +54,11 @@ static void RecognVoiceEvent(const SmartVoiceCmdParam data) } } else if (NativeAbility::GetInstance().GetCurSliceId() == VIEW_OFFLINEVOICE) { // 已经进入语音助手 if (VoiceAssistance::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is NULL, funct callback finish!!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is nullptr, funct callback finish!!"); return; } if (VocassistModel::GetInstance()->GetToggleFlag() == ALREADY_OPEN_VOCASSIST_IMAGE && - VocassistModel::GetInstance()->GetHasOneCmd() == false) { + (!VocassistModel::GetInstance()->GetHasOneCmd())) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CurSliceId equals VIEW_OFFLINEVOICE"); VoiceAssistance::GetInstance()->SetCmdContext(g_voiceWordName[param->cmdId]); VoiceAssistance::GetInstance()->SwitchMedium(CREATE_CMD_LABEL); @@ -74,7 +73,7 @@ static void RecognVoiceEvent(const SmartVoiceCmdParam data) void VoiceFunction(SmartVoiceEventType type, td_void *data, td_s32 size) { int dataSize = sizeof(SmartVoiceCmdParam); - if (data == NULL || dataSize != size) { + if (data == nullptr || dataSize != size) { return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistPresenter.cpp index a158f95e9..5cd75bf95 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistPresenter.cpp @@ -5,7 +5,6 @@ * Create: 2022-01-18 */ #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "VocassistPresenter.h" #include "PlayersModel.h" #include "ui_service.h" @@ -62,7 +61,6 @@ void VocassistPresenter::VocAssistDeal(int flag) VocassistModel::GetInstance()->SetExitStatus(CONTINUTE_EXIT_MODE1); VoiceAssistance::GetInstance()->DelayDisplayTime(DELAY_SIX_SECONDS); // 开启定时器,太长时间未操作退出语音助手 - } void VocassistPresenter::OnAnimatorStop(UIView& view) // 播放结束监听 @@ -90,7 +88,7 @@ bool VocassistPresenter::OnClick(UIView& view, const ClickEvent& event) // 语 { UNUSED(event); if (VoiceAssistance::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is NULL!!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is nullptr!!"); return false; } if (strcmp(view.GetViewId(), VOCPHOTO_ID) == 0) { @@ -138,7 +136,6 @@ void VocassistPresenter::OnResume(void) {} void VocassistPresenter::OnStop(void) { Presenter::OnStop(); - SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, NULL, 0); - + SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, nullptr, 0); } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistView.cpp index ff56910d9..98705f63c 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/offlinevoice/src/VocassistView.cpp @@ -8,7 +8,6 @@ #include #include "cmsis_os.h" #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "PlayersModel.h" #include "CallerLogModel.h" #include "VocassistModel.h" @@ -37,7 +36,7 @@ static constexpr uint16_t WORD_LENGTH = 60; static constexpr int16_t ERROR_RETVAL = -1; namespace OHOS { -static osTimerId_t g_closeVocassistHandle = NULL; +static osTimerId_t g_closeVocassistHandle = nullptr; static VoiceAssistance *g_pVoiceAssistance = nullptr; enum { @@ -99,12 +98,12 @@ VoiceAssistance::~VoiceAssistance() RemoveAll(); g_pVoiceAssistance = nullptr; // 切换为其它slice时将定时器删除 - if (g_closeVocassistHandle != NULL) { + if (g_closeVocassistHandle != nullptr) { osStatus_t statusRet = osTimerDelete(g_closeVocassistHandle); if (statusRet != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Delete timer failed!!"); } - g_closeVocassistHandle = NULL; + g_closeVocassistHandle = nullptr; } delete voicePhoto; @@ -145,12 +144,12 @@ void VoiceAssistance::InitImageAnimatorSource(void) void VoiceAssistance::DetermineCause(const int *eventRet) // 根据能否执行用户指令做出回复 { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[VoiceAssistView] Enter DetermineCause"); - if (eventRet == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "EventRet is NULL!!"); + if (eventRet == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "EventRet is nullptr!!"); return; } if (VoiceAssistance::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is NULL!!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is nullptr!!"); return; } int temp = *eventRet; @@ -172,7 +171,7 @@ void VoiceAssistance::InitVocassist(void) voicePhoto->SetSizeFixed(true); if (VoiceAssistance::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is NULL!!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is nullptr!!"); return; } VoiceAssistance::GetInstance()->SwitchMedium(WAVE_VIEW); @@ -192,7 +191,7 @@ void VoiceAssistance::InitVocassist(void) void VoiceAssistance::SwitchMedium(uint16_t targetView) { if (GraphicService::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GraphicService instance is NULL!!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GraphicService instance is nullptr!!"); return; } GraphicService::GetInstance()->PostGraphicEvent(std::bind(&VoiceAssistance::VocSwitchApp, this, targetView)); @@ -212,7 +211,7 @@ void VoiceAssistance::VocSwitchApp(uint16_t targetView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[VoiceAssistView] Start Operation!!"); if (VoiceAssistance::GetInstance() == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is NULL!!"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VoiceAssistance instance is nullptr!!"); return; } viewFunct func = FindIndex(targetView); @@ -233,7 +232,7 @@ int VoiceAssistance::ChangeViewToPlayer() // 播放音乐 { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[VoiceAssistView] Enter ChangeViewToPlayer"); - if(!PlayersModel::GetInstance()->HasPlayerPlayed()) { // 播放过了就不用再初始化 + if (!PlayersModel::GetInstance()->HasPlayerPlayed()) { // 播放过了就不用再初始化 PlayersListGroup::GetInstance()->SetUpListCase(); PlayersModel::GetInstance()->PlayerInit(); } @@ -579,13 +578,13 @@ void VoiceAssistance::CloseVocassist() static void DeleteTimeTick() { - if (g_closeVocassistHandle != NULL) { + if (g_closeVocassistHandle != nullptr) { osStatus_t ret = osTimerDelete(g_closeVocassistHandle); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Delete timer failed!!"); return; } - g_closeVocassistHandle = NULL; + g_closeVocassistHandle = nullptr; } } @@ -654,20 +653,20 @@ void VoiceAssistance::DelayDisplayTime(int32_t waitSec) } int quitStatus = VocassistModel::GetInstance()->GetExitStatus(); // 删除定时器,打断退出语音助手的操作 - if (g_closeVocassistHandle != NULL && (quitStatus == CONTINUTE_EXIT_MODE1 || + if (g_closeVocassistHandle != nullptr && (quitStatus == CONTINUTE_EXIT_MODE1 || quitStatus == CONTINUTE_EXIT_MODE2)) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Interrupt Timer!!"); osStatus_t statusRet = osTimerDelete(g_closeVocassistHandle); if (statusRet != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Delete timer failed!!"); } - g_closeVocassistHandle = NULL; + g_closeVocassistHandle = nullptr; VocassistModel::GetInstance()->SetExitStatus(INTERRUPT_EXIT); } // 创建新的定时器 - g_closeVocassistHandle = osTimerNew((osTimerFunc_t)DelayTimeCallback, osTimerOnce, NULL, NULL); - if (g_closeVocassistHandle == NULL) { + g_closeVocassistHandle = osTimerNew((osTimerFunc_t)DelayTimeCallback, osTimerOnce, nullptr, nullptr); + if (g_closeVocassistHandle == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "New timer failed !!"); return; } @@ -675,13 +674,13 @@ void VoiceAssistance::DelayDisplayTime(int32_t waitSec) osStatus_t statusRet = osTimerStart(g_closeVocassistHandle, tick); if (statusRet != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Start timer failed !!"); - if (g_closeVocassistHandle != NULL) { + if (g_closeVocassistHandle != nullptr) { statusRet = osTimerDelete(g_closeVocassistHandle); if (statusRet != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Delete timer failed !!"); return; } - g_closeVocassistHandle = NULL; + g_closeVocassistHandle = nullptr; } return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/include/PhoneAudio.h b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/include/PhoneAudio.h index 1666ee0c8..fd0b6c957 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/include/PhoneAudio.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/include/PhoneAudio.h @@ -7,8 +7,7 @@ #ifndef PHONE_AUDIO_H #define PHONE_AUDIO_H -#include -#include "stdbool.h" +#include #include "audio_base_type.h" #include "ohos_types.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/include/PhoneService.h b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/include/PhoneService.h index 98b032a4d..1e3f0fa1e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/include/PhoneService.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/include/PhoneService.h @@ -7,260 +7,254 @@ #ifndef PHONE_SERVICE_H #define PHONE_SERVICE_H -#include "stdbool.h" #include "bts_br_gap.h" #include "bts_hfp_hf.h" #include "ohos_types.h" #include "PhoneAudio.h" #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define MULTI_CALL_MAX_NUME 5 // 最大多路通话路数 -#define CALL_LOG_MAX_NUM 30 // 最多记录30条通话记录,超出后删除最老的记录 +#define CALL_LOG_MAX_NUM 30 // 最多记录30条通话记录,超出后删除最老的记录 #define NAME_SIZE 20 #define MAX_PHONE_NUM 20 #define CALL_VOLUME_MAX 15 - typedef struct - { - int operate; - int lastStatus; - char name[NAME_SIZE]; - unsigned char nameLen; - unsigned char tel[MAX_PHONE_NUM]; - unsigned char telLen; - uint32 activeTime; // 首次电话接通时间点 - uint32 creationTime; // 通话创建时间(不是接通时间) - hfp_hf_calls_info_t unitCalls; - } PhoneCallInfo; - - enum OperateType - { - OPERATE_NO_OPE = 0, // 无操作 - OPERATE_DIALING, // 呼出,正在拨号中 - OPERATE_ALERTING, // 呼出,对方响铃 - OPERATE_INCOMING, // 来电呼入 - OPERATE_WAITING, // 来电呼入(等待) - OPERATE_WATCH_ACTIVE, // 对方呼入,手表接听 - OPERATE_PHONE_ACTIVE, // 对方呼入,手机接听 (手表接收到此操作,调用DisconnectSco接口断开SCO连接) - OPERATE_PEER_ACTIVE, // 呼出,对方接听 - OPERATE_PHONE_HOLD, // 手机挂起通话 - OPERATE_WATCH_REJECT, // 手表拒接来电 - OPERATE_WATCH_FINISH, // 手表发起通话结束(挂断通话) - OPERATE_NON_WATCH_FINISH, // 非手表发起通话结束(手机挂断+拒接来电) - }; - - // 通话失败类型 - typedef enum - { - ERROR_BT = 0, // 蓝牙 - ERROR_DIAL, // 拨号 - } PhoneServiceErrorType; - - // 通话结束类型 - typedef enum - { - CALL_OUTGOING = 0, // 呼出电话 - CALL_INCOMING, // 呼入电话 - CALL_MISSED, // 未接来电 - } CallFinishStatus; - - typedef struct - { - char name[NAME_SIZE]; - unsigned char nameLen; - unsigned char tel[MAX_PHONE_NUM]; - unsigned char telLen; - CallFinishStatus status; - uint32 creationTime; // 通话创建时间(不是接通时间) - uint32 callDurTime; // 通话持续时间 - } CallLogInfo; - - // 通话状态改变回调函数 - typedef void (*PhoneServiceCallChangedCb)(const PhoneCallInfo *phoneCall); - // 电话服务失败回调函数 - typedef void (*PhoneServiceErrorCb)(PhoneServiceErrorType type, int volume); - // sco连接回调函数(状态只有断开和连接两种状态) 通话转移会导致sco连接和断连 - typedef void (*PhoneServiceScoStatusCb)(hfp_sco_connect_state_t state); - - typedef struct - { - PhoneServiceCallChangedCb callChanged; - PhoneServiceErrorCb phoneServiceErrorCb; - PhoneServiceScoStatusCb scoStatusCb; - } PhoneServiceCb; - - void AddToCallLog(CallLogInfo *info); - /** - * @brief 注册电话服务回调函数 - * - * @param phoneServiceFun 注册函数 - * @return 返回值 成功返回0,失败返回错误码 - */ - int RegisterCallChangedCb(PhoneServiceCb *phoneServiceFun); - - /** - * @brief 电话服务初始化 - */ - void PhoneServiceInit(void); - - /** - * @brief 手表呼出电话 - * - * @param number 呼出号码 - * @param len 号码长度,只包括号码数字部分,不包括结尾'\0' - * @return 返回值 成功返回0,失败返回错误码 - */ - int DialCall(unsigned char *number, unsigned char len); - - /** - * @brief 手表接听呼入来电 - * - * @return 返回值 成功返回0,失败返回错误码 - */ - int AcceptIncomingCall(void); - - /** - * @brief 手表拒接呼入来电 - * - * @return 返回值 成功返回0,失败返回错误码 - */ - int RejectIncomingCall(void); - - /** - * @brief 手表结束通话 - * - * @return 返回值 成功返回0,失败返回错误码 - */ - int FinishCall(void); - - /** - * @brief 获取当前通话的最新变化状态 - * - * @return 返回值 通话变化状态 - */ - int GetCurrCallState(void); - - /** - * @brief 判断此次通话是否是完整通话流程 - * - * @return 返回值 true:是;false:不是 - */ - bool IsCompleteCallFlow(void); - - /** - * @brief 获取当前正在通话路数 - * - * @return 返回值 返回当前正在通话路数 - */ - int GetCurrCallNum(void); - - /** - * @brief 获取当前通话路数和对应的通话信息 - * - * @param callList 用来接收通话信息,需调用者分配空间,大小为MULTI_CALL_MAX_NUME * sizeof(PhoneCallInfo) - * @param listNum callList中PhoneCallInfo个数,大小为MULTI_CALL_MAX_NUME - * @param retNum 接收当前正在进行的通话路数 - * @return 返回值 成功返回0,失败返回错误码 - */ - int GetCallInfoInCallList(PhoneCallInfo callList[], int listNum, int *retNum); - - /** - * @brief 获取当前通话音量大小(0 -15) - * - * @param volume - * - * @return 返回值 当前通话音量大小 - */ - unsigned char GetCallCurrVolume(void); - - /** - * @brief 设置手表通话Speaker音量 - * - * @param volume - * - * @return 返回值 void - */ - void SetSpeakerVolume(unsigned char volume); - - /** - * @brief 设置通话Speaker静音/取消静音 - * - * @param isMute true:设置通话Speaker静音;false:设置通话Speaker取消静音 - * @return 返回值 成功返回ture,失败返回false - */ - bool SetSpeakerMute(bool isMute); - - /** - * @brief 设置通话mic静音/取消静音 - * - * @param isMute true:设置通话mic静音;false:设置通话mic取消静音 - * @return 返回值 成功返回ture,失败返回false - */ - bool SetMicMute(bool isMute); - - /** - * @brief 获取SCO的连接状态 - * - * @return 返回值 返回SCO的连接状态 - */ - int GetScoConnectState(void); - - /** - * @brief 通话转移到手表 - * - * @return 返回值 成功返回0,失败返回错误码 - */ - int TransCallToWatch(void); - - /** - * @brief 通话转移到手机 - * - * @return 返回值 成功返回0,失败返回错误码 - */ - int TransCallToMobilePhone(void); - - /** - * @brief 获取通话记录 - * - * @param info 接收获取的通话记录,由调用者释放free - * @param num 接收通话记录条数 - * @return 返回值 成功返回0,失败返回错误码 - */ - int GetCallLog(CallLogInfo **info, int *num); - - /** - * @brief 删除第一条通话记录 - * - * @return 返回值 成功返回0,失败返回错误码 - */ - int RemoveFirstCallLog(void); - - /** - * @brief 清空通话记录 - * - * @return 返回值 成功返回0,失败返回错误码 - */ - int ClearCallLogFile(void); - - /** - * @brief 获取蓝牙状态 - * - * @return 返回值 蓝牙连接状态 - */ - uint32 GetBtConnectStatus(void); - - /** - * @brief 释放蓝牙通话媒体资源 - * - * @return 返回值 无 - */ - void AudioRelease(void); - - uint32 GetCallCodec(void); +typedef struct { + int operate; + int lastStatus; + char name[NAME_SIZE]; + unsigned char nameLen; + unsigned char tel[MAX_PHONE_NUM]; + unsigned char telLen; + uint64 activeTime; // 首次电话接通时间点 + uint64 creationTime; // 通话创建时间(不是接通时间) + hfp_hf_calls_info_t unitCalls; +} PhoneCallInfo; + +enum OperateType { + OPERATE_NO_OPE = 0, // 无操作 + OPERATE_DIALING, // 呼出,正在拨号中 + OPERATE_ALERTING, // 呼出,对方响铃 + OPERATE_INCOMING, // 来电呼入 + OPERATE_WAITING, // 来电呼入(等待) + OPERATE_WATCH_ACTIVE, // 对方呼入,手表接听 + OPERATE_PHONE_ACTIVE, // 对方呼入,手机接听 (手表接收到此操作,调用DisconnectSco接口断开SCO连接) + OPERATE_PEER_ACTIVE, // 呼出,对方接听 + OPERATE_PHONE_HOLD, // 手机挂起通话 + OPERATE_WATCH_REJECT, // 手表拒接来电 + OPERATE_WATCH_FINISH, // 手表发起通话结束(挂断通话) + OPERATE_NON_WATCH_FINISH, // 非手表发起通话结束(手机挂断+拒接来电) +}; + +// 通话失败类型 +typedef enum { + ERROR_BT = 0, // 蓝牙 + ERROR_DIAL, // 拨号 +} PhoneServiceErrorType; + +// 通话结束类型 +typedef enum { + CALL_OUTGOING = 0, // 呼出电话 + CALL_INCOMING, // 呼入电话 + CALL_MISSED, // 未接来电 +} CallFinishStatus; + +typedef struct { + char name[NAME_SIZE]; + unsigned char nameLen; + unsigned char tel[MAX_PHONE_NUM]; + unsigned char telLen; + CallFinishStatus status; + uint32 creationTime; // 通话创建时间(不是接通时间) + uint64 callDurTime; // 通话持续时间 +} CallLogInfo; + +// 通话状态改变回调函数 +typedef void (*PhoneServiceCallChangedCb)(const PhoneCallInfo *phoneCall); +// 电话服务失败回调函数 +typedef void (*PhoneServiceErrorCb)(PhoneServiceErrorType type, int volume); +// sco连接回调函数(状态只有断开和连接两种状态) 通话转移会导致sco连接和断连 +typedef void (*PhoneServiceScoStatusCb)(hfp_sco_connect_state_t state); + +typedef struct { + PhoneServiceCallChangedCb callChanged; + PhoneServiceErrorCb phoneServiceErrorCb; + PhoneServiceScoStatusCb scoStatusCb; +} PhoneServiceCb; + +/** + * @brief 注册电话服务回调函数 + * + * @param phoneServiceFun 注册函数 + * @return 返回值 成功返回0,失败返回错误码 + */ +int RegisterCallChangedCb(PhoneServiceCb *phoneServiceFun); + +/** + * @brief 电话服务初始化 + */ +void PhoneServiceInit(void); + +/** + * @brief 手表呼出电话 + * + * @param number 呼出号码 + * @param len 号码长度,只包括号码数字部分,不包括结尾'\0' + * @return 返回值 成功返回0,失败返回错误码 + */ +int DialCall(unsigned char *number, unsigned char len); + +/** + * @brief 手表接听呼入来电 + * + * @return 返回值 成功返回0,失败返回错误码 + */ +int AcceptIncomingCall(void); + +/** + * @brief 手表拒接呼入来电 + * + * @return 返回值 成功返回0,失败返回错误码 + */ +int RejectIncomingCall(void); + +/** + * @brief 手表结束通话 + * + * @return 返回值 成功返回0,失败返回错误码 + */ +int FinishCall(void); + +/** + * @brief 获取当前通话的最新变化状态 + * + * @return 返回值 通话变化状态 + */ +int GetCurrCallState(void); + +/** + * @brief 判断此次通话是否是完整通话流程 + * + * @return 返回值 true:是;false:不是 + */ +bool IsCompleteCallFlow(void); + +/** + * @brief 获取当前正在通话路数 + * + * @return 返回值 返回当前正在通话路数 + */ +int GetCurrCallNum(void); + +/** + * @brief 获取当前通话路数和对应的通话信息 + * + * @param callList 用来接收通话信息,需调用者分配空间,大小为MULTI_CALL_MAX_NUME * sizeof(PhoneCallInfo) + * @param listNum callList中PhoneCallInfo个数,大小为MULTI_CALL_MAX_NUME + * @param retNum 接收当前正在进行的通话路数 + * @return 返回值 成功返回0,失败返回错误码 + */ +int GetCallInfoInCallList(PhoneCallInfo callList[], int listNum, int *retNum); + +/** + * @brief 获取当前通话音量大小(0 -15) + * + * @param volume + * + * @return 返回值 当前通话音量大小 + */ +unsigned char GetCallCurrVolume(void); + +/** + * @brief 设置手表通话Speaker音量 + * + * @param volume + * + * @return 返回值 void + */ +void SetSpeakerVolume(unsigned char volume); + +/** + * @brief 设置通话Speaker静音/取消静音 + * + * @param isMute true:设置通话Speaker静音;false:设置通话Speaker取消静音 + * @return 返回值 成功返回ture,失败返回false + */ +bool SetSpeakerMute(bool isMute); + +/** + * @brief 设置通话mic静音/取消静音 + * + * @param isMute true:设置通话mic静音;false:设置通话mic取消静音 + * @return 返回值 成功返回ture,失败返回false + */ +bool SetMicMute(bool isMute); + +/** + * @brief 获取SCO的连接状态 + * + * @return 返回值 返回SCO的连接状态 + */ +int GetScoConnectState(void); + +/** + * @brief 通话转移到手表 + * + * @return 返回值 成功返回0,失败返回错误码 + */ +int TransCallToWatch(void); + +/** + * @brief 通话转移到手机 + * + * @return 返回值 成功返回0,失败返回错误码 + */ +int TransCallToMobilePhone(void); + +/** + * @brief 获取通话记录 + * + * @param info 接收获取的通话记录,由调用者释放free + * @param num 接收通话记录条数 + * @return 返回值 成功返回0,失败返回错误码 + */ +int GetCallLog(CallLogInfo **info, int *num); + +/** + * @brief 删除第一条通话记录 + * + * @return 返回值 成功返回0,失败返回错误码 + */ +int RemoveFirstCallLog(void); + +/** + * @brief 清空通话记录 + * + * @return 返回值 成功返回0,失败返回错误码 + */ +int ClearCallLogFile(void); + +/** + * @brief 获取蓝牙状态 + * + * @return 返回值 蓝牙连接状态 + */ +uint32 GetBtConnectStatus(void); + +/** + * @brief 释放蓝牙通话媒体资源 + * + * @return 返回值 无 + */ +void AudioRelease(void); + +uint32 GetCallCodec(void); + +// 添加通话进通话记录文件 +void AddToCallLog(CallLogInfo *info); #ifdef __cplusplus } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneAudio.cpp b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneAudio.cpp index 2d32b2b6a..8b695c89a 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneAudio.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneAudio.cpp @@ -85,7 +85,7 @@ bool PhoneAudioSetSpeakerMute(bool isMute) return true; } - if (isMute == true) { + if (isMute) { ret = g_amInstance.Mute(AUDIO_STREAM_VOICE_CALL_BT_SCO); } else { ret = g_amInstance.UnMute(AUDIO_STREAM_VOICE_CALL_BT_SCO); @@ -166,7 +166,7 @@ int32 PhoneAudioManagerSetDeviceConnState(AudioDeviceType deviceType, AudioDevic } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[%s] line:%d success, deviceType = 0x%x connectState = %d", - __FUNCTION__, __LINE__, deviceType, connectState); + __FUNCTION__, __LINE__, deviceType, connectState); return AUDIO_SUCCESS; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp index c781f1f74..e90405d2c 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp @@ -7,12 +7,12 @@ #include "PhoneService.h" #include "PhoneAudio.h" #include "securec.h" -#include -#include -#include +#include +#include +#include #include "audio_base_type.h" #include "audio_manager.h" -#include "time.h" +#include #include "wearable_log.h" #include "unistd.h" #include "dirent.h" @@ -24,9 +24,10 @@ #include "service_id_define.h" #include "samgr_lite.h" #include "ui_service.h" +#include "msg_center_msg.h" + #ifdef __cplusplus -extern "C" -{ +extern "C" { #endif #define CALL_LOG_PATH "/user/data/calllog.bin" @@ -39,643 +40,565 @@ extern "C" #define INVALID_PHONE_SERVICE_VALUE (-1) - typedef enum - { - AUDIO_UNKNOW = 0, - AUDIO_ACT_INTERRUPT_WATCH_RING, // 手表铃声焦点 - AUDIO_ACT_INTERRUPT_BT_SCO, // 蓝牙通话焦点 - AUDIO_CONN_IN_BT_SCO, - AUDIO_CONN_OUT_BT_SCO, - AUDIO_STREAM_INIT, - AUDIO_STREAM_START_SCO, - AUDIO_STREAM_START_DN, - AUDIO_STREAM_START_UP, - } AudioState; - - static PhoneCallInfo g_callList[MULTI_CALL_MAX_NUME]; - static uint32 g_currCallNum = 0; - static uint32 g_finishOperate = OPERATE_NON_WATCH_FINISH; - static uint32 g_scoFlag = HFP_SCO_STATE_DISCONNECTED; // sco连接状态,同时也表示通话在手表还是在手机 - static uint32 g_btConnState = PROFILE_STATE_DISCONNECTED; // 蓝牙连接状态 - static bd_addr_t g_bdAddr; // 设备的蓝牙地址 - static uint32 g_currCallState = HFP_HF_CALL_STATE_FINISHED; - static bool g_completeCallFlag = false; // 完整通话流程:从incoming、dialing或alerting开始才算完整 - static uint32 g_audioState = AUDIO_UNKNOW; - static MutexId g_audioMutex; - static uint32 g_call_codec = mSBC; - - static int g_hdlUpMic = INVALID_PHONE_SERVICE_VALUE; - static int g_hdlUpSco = INVALID_PHONE_SERVICE_VALUE; - static int g_hdlDnSpk = INVALID_PHONE_SERVICE_VALUE; - static int g_hdlDnSco = INVALID_PHONE_SERVICE_VALUE; - - PhoneServiceCb g_callChanged; - void HfpIncomingEventPublish(uint16 topic, hfp_hf_calls_info_t callsInfo); - - static void PhoneServiceScreenCtr(bool turnOnFlag) - { - if (turnOnFlag) - { - int32_t timeout = -1; - SendMsgToUIService(SCREEN_TURN_ON_TO_UI, 0, &timeout, sizeof(int32_t)); - } - else - { - SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, NULL, 0); - } +typedef enum { + AUDIO_UNKNOW = 0, + AUDIO_ACT_INTERRUPT_WATCH_RING, // 手表铃声焦点 + AUDIO_ACT_INTERRUPT_BT_SCO, // 蓝牙通话焦点 + AUDIO_CONN_IN_BT_SCO, + AUDIO_CONN_OUT_BT_SCO, + AUDIO_STREAM_INIT, + AUDIO_STREAM_START_SCO, + AUDIO_STREAM_START_DN, + AUDIO_STREAM_START_UP, +} AudioState; + +static PhoneCallInfo g_callList[MULTI_CALL_MAX_NUME]; +static uint32 g_currCallNum = 0; +static uint32 g_finishOperate = OPERATE_NON_WATCH_FINISH; +static uint32 g_scoFlag = HFP_SCO_STATE_DISCONNECTED; // sco连接状态,同时也表示通话在手表还是在手机 +static uint32 g_btConnState = PROFILE_STATE_DISCONNECTED; // 蓝牙连接状态 +static bd_addr_t g_bdAddr; // 设备的蓝牙地址 +static uint32 g_currCallState = HFP_HF_CALL_STATE_FINISHED; +static bool g_completeCallFlag = false; // 完整通话流程:从incoming、dialing或alerting开始才算完整 +static uint32 g_audioState = AUDIO_UNKNOW; +static MutexId g_audioMutex; +static uint32 g_call_codec = mSBC; + +static int g_hdlUpMic = INVALID_PHONE_SERVICE_VALUE; +static int g_hdlUpSco = INVALID_PHONE_SERVICE_VALUE; +static int g_hdlDnSpk = INVALID_PHONE_SERVICE_VALUE; +static int g_hdlDnSco = INVALID_PHONE_SERVICE_VALUE; + +PhoneServiceCb g_callChanged; +void HfpIncomingEventPublish(uint16 topic, hfp_hf_calls_info_t callsInfo); + +static void PhoneServiceScreenCtr(bool turnOnFlag) +{ + if (turnOnFlag) { + int32_t timeout = -1; + SendMsgToUIService(SCREEN_TURN_ON_TO_UI, 0, &timeout, sizeof(int32_t)); + } else { + SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, nullptr, 0); } +} - static void InitMutex(void) - { - g_audioMutex = MUTEX_InitValue(); - } +static void InitMutex(void) +{ + g_audioMutex = MUTEX_InitValue(); +} + +uint32 GetCallCodec(void) +{ + return g_call_codec; +} - uint32 GetCallCodec(void) - { - return g_call_codec; +int RegisterCallChangedCb(PhoneServiceCb *phoneServiceFun) +{ + if (phoneServiceFun == nullptr) { + return OHOS_FAILURE; } - int RegisterCallChangedCb(PhoneServiceCb *phoneServiceFun) - { - if (phoneServiceFun == NULL) - { - return OHOS_FAILURE; - } + (void)memcpy_s(&g_callChanged, sizeof(g_callChanged), phoneServiceFun, sizeof(g_callChanged)); - (void)memcpy_s(&g_callChanged, sizeof(g_callChanged), phoneServiceFun, sizeof(g_callChanged)); + return OHOS_SUCCESS; +} - return OHOS_SUCCESS; - } +static void CallChangedCb(const PhoneCallInfo *phoneCall) +{ + g_callChanged.callChanged(phoneCall); +} - static void CallChangedCb(const PhoneCallInfo *phoneCall) - { - g_callChanged.callChanged(phoneCall); - } +static void PhoneServiceErrorCallback(PhoneServiceErrorType type, int volume) +{ + g_callChanged.phoneServiceErrorCb(type, volume); +} - static void PhoneServiceErrorCallback(PhoneServiceErrorType type, int volume) - { - g_callChanged.phoneServiceErrorCb(type, volume); - } +static void ScoStatusCb(hfp_sco_connect_state_t state) +{ + g_callChanged.scoStatusCb(state); +} - static void ScoStatusCb(hfp_sco_connect_state_t state) - { - g_callChanged.scoStatusCb(state); - } +int GetCurrCallState(void) +{ + return g_currCallState; +} - int GetCurrCallState(void) - { - return g_currCallState; +// 初始化媒体 +static void AudioInit(void) +{ + int32_t ret = PhoneAudioManagerInit(); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioInit] failed!"); } +} - // 初始化媒体 - static void AudioInit(void) - { - int ret; - ret = PhoneAudioManagerInit(); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioInit] [PhoneAudioManagerInit] failed!"); - } +// 释放音频焦点 +static void AudioDeactInterrupt(AudioStreamType type) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioDeactInterrupt] start type:0x%x, audioState:0x%x", + type, g_audioState); + + if ((type == AUDIO_STREAM_VOICE_CALL_BT_SCO && g_audioState >= AUDIO_ACT_INTERRUPT_BT_SCO) || + (type == AUDIO_STREAM_RING && g_audioState == AUDIO_ACT_INTERRUPT_WATCH_RING)) { + (void)PhoneAudioManagerDeactInterrupt(); } +} + +// 申请音频焦点 +static void AudioActInterrupt(AudioStreamType type) +{ + int ret = OHOS_SUCCESS; - // 释放音频焦点 - static void AudioDeactInterrupt(AudioStreamType type) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioDeactInterrupt] start type: 0x%x, g_audioState: 0x%x", + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] start type:0x%x, audioState:0x%x", + type, g_audioState); + + if (type != AUDIO_STREAM_VOICE_CALL_BT_SCO && type != AUDIO_STREAM_RING) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] failed! type:0x%x, audioState:0x%x", type, g_audioState); + return; + } - if ((type == AUDIO_STREAM_VOICE_CALL_BT_SCO && g_audioState >= AUDIO_ACT_INTERRUPT_BT_SCO) || - (type == AUDIO_STREAM_RING && g_audioState == AUDIO_ACT_INTERRUPT_WATCH_RING)) - { - (void)PhoneAudioManagerDeactInterrupt(); + MUTEX_Lock(g_audioMutex); + // 申请蓝牙通话焦点 + if (type == AUDIO_STREAM_VOICE_CALL_BT_SCO && g_audioState < AUDIO_ACT_INTERRUPT_BT_SCO) { + if (g_audioState == AUDIO_ACT_INTERRUPT_WATCH_RING) { + AudioDeactInterrupt(AUDIO_STREAM_RING); } - } - // 申请音频焦点 - static void AudioActInterrupt(AudioStreamType type) - { - int ret = OHOS_SUCCESS; + ret = PhoneAudioManagerActInterrupt(type); + if (ret == OHOS_SUCCESS) { + g_audioState = AUDIO_ACT_INTERRUPT_BT_SCO; + } + } else if (type == AUDIO_STREAM_RING && g_audioState < AUDIO_ACT_INTERRUPT_WATCH_RING) { + ret = PhoneAudioManagerActInterrupt(type); + if (ret == OHOS_SUCCESS) { + g_audioState = AUDIO_ACT_INTERRUPT_WATCH_RING; + } + } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] start type: 0x%x, g_audioState: 0x%x", + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] failed! type:0x%x, audioState:0x%x", type, g_audioState); + } - if (type != AUDIO_STREAM_VOICE_CALL_BT_SCO && type != AUDIO_STREAM_RING) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] failed! type: 0x%x, g_audioState: 0x%x", - type, g_audioState); - return; - } + MUTEX_Unlock(g_audioMutex); +} - MUTEX_Lock(g_audioMutex); - // 申请蓝牙通话焦点 - if (type == AUDIO_STREAM_VOICE_CALL_BT_SCO && g_audioState < AUDIO_ACT_INTERRUPT_BT_SCO) - { - if (g_audioState == AUDIO_ACT_INTERRUPT_WATCH_RING) - { - AudioDeactInterrupt(AUDIO_STREAM_RING); - } +// 媒体连接SCO设备 +static void AudioConnectScoDevInit(void) +{ + int ret; + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioConnectScoDevInit] start scoFlag:0x%x, audioState:0x%x", + g_scoFlag, g_audioState); + if (g_scoFlag != HFP_SCO_STATE_CONNECTED || g_audioState < AUDIO_ACT_INTERRUPT_BT_SCO) { + return; + } - ret = PhoneAudioManagerActInterrupt(type); - if (ret == OHOS_SUCCESS) - { - g_audioState = AUDIO_ACT_INTERRUPT_BT_SCO; + MUTEX_Lock(g_audioMutex); + if (g_audioState < AUDIO_STREAM_INIT) { + if (g_audioState < AUDIO_CONN_IN_BT_SCO) { + // 配置媒体连接SCO设配状态(下行),只有在SCO连接后才能设置 + ret = PhoneAudioManagerSetDeviceConnState(IN_BLUETOOTH_SCO, AUDIO_DEVICE_CONNECTED); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioConnectScoDevInit] sco in ret:%d", ret); + MUTEX_Unlock(g_audioMutex); + return; + } else { + g_audioState = AUDIO_CONN_IN_BT_SCO; } } - else if (type == AUDIO_STREAM_RING && g_audioState < AUDIO_ACT_INTERRUPT_WATCH_RING) - { - ret = PhoneAudioManagerActInterrupt(type); - if (ret == OHOS_SUCCESS) - { - g_audioState = AUDIO_ACT_INTERRUPT_WATCH_RING; + + if (g_audioState < AUDIO_CONN_OUT_BT_SCO) { + // 配置媒体连接SCO设配状态(上行),只有在SCO连接后才能设置 + ret = PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_SCO, AUDIO_DEVICE_CONNECTED); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioConnectScoDevInit] sco out ret:%d", ret); + MUTEX_Unlock(g_audioMutex); + return; + } else { + g_audioState = AUDIO_CONN_OUT_BT_SCO; } } - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioActInterrupt] failed! type: 0x%x, g_audioState: 0x%x", - type, g_audioState); + if (g_hdlUpSco == INVALID_PHONE_SERVICE_VALUE) { + g_hdlUpSco = PhoneAudioStreamOutInit(AUDIO_UP_LINK); } - MUTEX_Unlock(g_audioMutex); - } - - // 媒体连接SCO设备 - static void AudioConnectScoDevInit(void) - { - int ret; - - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioConnectScoDevInit] start g_scoFlag: 0x%x, g_audioState: 0x%x", - g_scoFlag, g_audioState); - if (g_scoFlag != HFP_SCO_STATE_CONNECTED || g_audioState < AUDIO_ACT_INTERRUPT_BT_SCO) - { - return; + if (g_hdlDnSco == INVALID_PHONE_SERVICE_VALUE) { + g_hdlDnSco = PhoneAudioStreamInInit(AUDIO_DOWN_LINK); } - MUTEX_Lock(g_audioMutex); - if (g_audioState < AUDIO_STREAM_INIT) - { - if (g_audioState < AUDIO_CONN_IN_BT_SCO) - { - // 配置媒体连接SCO设配状态(下行),只有在SCO连接后才能设置 - ret = PhoneAudioManagerSetDeviceConnState(IN_BLUETOOTH_SCO, AUDIO_DEVICE_CONNECTED); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioConnectScoDevInit] [PhoneAudioManagerSetDeviceConnState] \ - IN_BLUETOOTH_SCO failed! ret = %d", - ret); - MUTEX_Unlock(g_audioMutex); - return; - } - else - { - g_audioState = AUDIO_CONN_IN_BT_SCO; - } - } - - if (g_audioState < AUDIO_CONN_OUT_BT_SCO) - { - // 配置媒体连接SCO设配状态(上行),只有在SCO连接后才能设置 - ret = PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_SCO, AUDIO_DEVICE_CONNECTED); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioConnectScoDevInit] [PhoneAudioManagerSetDeviceConnState] \ - OUT_BLUETOOTH_SCO failed! ret = %d", - ret); - MUTEX_Unlock(g_audioMutex); - return; - } - else - { - g_audioState = AUDIO_CONN_OUT_BT_SCO; - } - } + if (g_hdlUpSco != INVALID_PHONE_SERVICE_VALUE && g_hdlDnSco != INVALID_PHONE_SERVICE_VALUE) { + g_audioState = AUDIO_STREAM_INIT; + } + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioConnectScoDevInit] end audioState:%d, hdlUpSco:%d, hdlDnSco:%d", + g_audioState, g_hdlUpSco, g_hdlDnSco); + MUTEX_Unlock(g_audioMutex); - if (g_hdlUpSco == INVALID_PHONE_SERVICE_VALUE) - { - g_hdlUpSco = PhoneAudioStreamOutInit(AUDIO_UP_LINK); - } + return; +} - if (g_hdlDnSco == INVALID_PHONE_SERVICE_VALUE) - { - g_hdlDnSco = PhoneAudioStreamInInit(AUDIO_DOWN_LINK); - } +// 建立上行通路 +static void AudioUpStart(void) +{ + int ret = OHOS_SUCCESS; + uint32 micShmId = 0; - if (g_hdlUpSco != INVALID_PHONE_SERVICE_VALUE && g_hdlDnSco != INVALID_PHONE_SERVICE_VALUE) - { - g_audioState = AUDIO_STREAM_INIT; - } - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioConnectScoDevInit] end g_audioState: %d, g_hdlUpSco: %d, g_hdlDnSco: %d", - g_audioState, g_hdlUpSco, g_hdlDnSco); - MUTEX_Unlock(g_audioMutex); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] start scoFlag:%d, audioState:%d", g_scoFlag, g_audioState); + if (g_scoFlag != HFP_SCO_STATE_CONNECTED || g_audioState < AUDIO_STREAM_INIT) { return; } - // 建立上行通路 - static void AudioUpStart(void) - { - int ret = OHOS_SUCCESS; - uint32 micShmId = 0; - - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] start g_scoFlag: %d, g_audioState: %d", g_scoFlag, g_audioState); - - if (g_scoFlag != HFP_SCO_STATE_CONNECTED || g_audioState < AUDIO_STREAM_INIT) - { - return; + MUTEX_Lock(g_audioMutex); + if (g_audioState < AUDIO_STREAM_START_UP) { + if (g_hdlUpMic == INVALID_PHONE_SERVICE_VALUE) { + g_hdlUpMic = PhoneAudioStreamInInit(AUDIO_UP_LINK); } - MUTEX_Lock(g_audioMutex); - if (g_audioState < AUDIO_STREAM_START_UP) - { - if (g_hdlUpMic == INVALID_PHONE_SERVICE_VALUE) - { - g_hdlUpMic = PhoneAudioStreamInInit(AUDIO_UP_LINK); + if (g_audioState < AUDIO_STREAM_START_SCO) { + ret = PhoneAudioStreamInStart(g_hdlDnSco); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] dn_sco ret:%d", ret); } - if (g_audioState < AUDIO_STREAM_START_SCO) - { - ret = PhoneAudioStreamInStart(g_hdlDnSco); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] [AudioStreamInStart] [dn_sco] error! ret: %d", ret); - } - - ret |= PhoneAudioStreamOutStart(g_hdlUpSco); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] [AudioStreamOutStart] [up_sco] error ret: %d", ret); - } - if (ret == OHOS_SUCCESS) - { - g_audioState = AUDIO_STREAM_START_SCO; - } + ret |= PhoneAudioStreamOutStart(g_hdlUpSco); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] up_sco ret:%d", ret); } - - ret |= PhoneAudioStreamInStart(g_hdlUpMic); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] [PhoneAudioStreamInStart] [up_mic] error! ret = %d", ret); + if (ret == OHOS_SUCCESS) { + g_audioState = AUDIO_STREAM_START_SCO; } + } - ret |= PhoneAudioStreamInGetChannelId(g_hdlUpMic, &micShmId); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] [AudioStreamInGetChannelId] [up_mic] error ret: %d", ret); - } + ret |= PhoneAudioStreamInStart(g_hdlUpMic); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] up_mic ret:%d", ret); + } - ret |= PhoneAudioStreamOutAttachFrontend(g_hdlUpSco, micShmId); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] [AudioStreamOutAttachFrontend] [up_sco] error ret:%d", ret); - } + ret |= PhoneAudioStreamInGetChannelId(g_hdlUpMic, &micShmId); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] up_mic shm ret:%d", ret); + } - if (ret == OHOS_SUCCESS) - { - g_audioState = AUDIO_STREAM_START_UP; - } + ret |= PhoneAudioStreamOutAttachFrontend(g_hdlUpSco, micShmId); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] up_sco attach ret:%d", ret); + } + + if (ret == OHOS_SUCCESS) { + g_audioState = AUDIO_STREAM_START_UP; } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] end g_audioState:%d, g_hdlUpMic:%d, g_hdlUpSco:%d, micShmId:0x%x", - g_audioState, g_hdlUpMic, g_hdlUpSco, micShmId); - MUTEX_Unlock(g_audioMutex); - return; } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioUpStart] end audioState:%d, hdlUpMic:%d, hdlUpSco:%d, micShmId:0x%x", + g_audioState, g_hdlUpMic, g_hdlUpSco, micShmId); + MUTEX_Unlock(g_audioMutex); + return; +} - // 建立下行通路 - static void AudioDnStart(void) - { - int ret = OHOS_SUCCESS; - uint32 spkShmId = 0; +// 建立下行通路 +static void AudioDnStart(void) +{ + int ret = OHOS_SUCCESS; + uint32 spkShmId = 0; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] start g_scoFlag: %d, g_audioState: %d", g_scoFlag, g_audioState); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] start scoFlag:%d, audioState:%d", g_scoFlag, g_audioState); - if (g_scoFlag != HFP_SCO_STATE_CONNECTED || g_audioState < AUDIO_STREAM_INIT) - { - return; + if (g_scoFlag != HFP_SCO_STATE_CONNECTED || g_audioState < AUDIO_STREAM_INIT) { + return; + } + + MUTEX_Lock(g_audioMutex); + if (g_audioState < AUDIO_STREAM_START_DN) { + if (g_hdlDnSpk == INVALID_PHONE_SERVICE_VALUE) { + g_hdlDnSpk = PhoneAudioStreamOutInit(AUDIO_DOWN_LINK); } - MUTEX_Lock(g_audioMutex); - if (g_audioState < AUDIO_STREAM_START_DN) - { - if (g_hdlDnSpk == INVALID_PHONE_SERVICE_VALUE) - { - g_hdlDnSpk = PhoneAudioStreamOutInit(AUDIO_DOWN_LINK); + if (g_audioState < AUDIO_STREAM_START_SCO) { + ret = PhoneAudioStreamOutStart(g_hdlUpSco); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] up_sco ret:%d", ret); } - if (g_audioState < AUDIO_STREAM_START_SCO) - { - ret = PhoneAudioStreamOutStart(g_hdlUpSco); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] [AudioStreamOutStart] [up_sco] error! ret = %d", ret); - } - - ret |= PhoneAudioStreamInStart(g_hdlDnSco); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] [AudioStreamInStart] [dn_sco] error! ret = %d", ret); - } - - if (ret == OHOS_SUCCESS) - { - g_audioState = AUDIO_STREAM_START_SCO; - } + ret |= PhoneAudioStreamInStart(g_hdlDnSco); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] dn_sco ret:%d", ret); } - ret |= PhoneAudioStreamOutStart(g_hdlDnSpk); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] [PhoneAudioStreamOutStart] [dn_spk] error! ret = %d", ret); + if (ret == OHOS_SUCCESS) { + g_audioState = AUDIO_STREAM_START_SCO; } + } - ret |= PhoneAudioStreamOutGetChannelId(g_hdlDnSpk, &spkShmId); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] [AudioStreamOutGetChannelId] [dn_spk] error ret: %d", ret); - } + ret |= PhoneAudioStreamOutStart(g_hdlDnSpk); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] dn_spk ret:%d", ret); + } - ret |= PhoneAudioStreamInAttachBackend(g_hdlDnSco, spkShmId); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] [AudioStreamInAttachBackend] [dn_sco] error ret: %d", ret); - } + ret |= PhoneAudioStreamOutGetChannelId(g_hdlDnSpk, &spkShmId); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] dn_spk shm ret:%d", ret); + } - if (ret == OHOS_SUCCESS) - { - g_audioState = AUDIO_STREAM_START_DN; - } + ret |= PhoneAudioStreamInAttachBackend(g_hdlDnSco, spkShmId); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] dn_sco attach ret:%d", ret); } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] end g_audioState:%d, g_hdlDnSpk:%d, g_hdlDnSco:%d, spkShmId: 0x%x", - g_audioState, g_hdlDnSpk, g_hdlDnSco, spkShmId); - MUTEX_Unlock(g_audioMutex); - return; + if (ret == OHOS_SUCCESS) { + g_audioState = AUDIO_STREAM_START_DN; + } } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioDnStart] end audioState:%d, hdlDnSpk:%d, hdlDnSco:%d, spkShmId:0x%x", + g_audioState, g_hdlDnSpk, g_hdlDnSco, spkShmId); + MUTEX_Unlock(g_audioMutex); - // 同步音量 - static void SyncVolume(void) - { - unsigned char volume; + return; +} - volume = GetCallCurrVolume(); - SetSpeakerVolume(volume); - } +// 同步音量 +static void SyncVolume(void) +{ + unsigned char volume; + + volume = GetCallCurrVolume(); + SetSpeakerVolume(volume); +} #ifdef __cplusplus - extern "C" - { +extern "C" { #endif - static void PostGraphicEvent(void (*fun)(void)) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PostGraphicEvent] start"); - GraphicService::GetInstance()->PostGraphicEvent(*fun); - } +static void PostGraphicEvent(void (*fun)(void)) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PostGraphicEvent] start"); + GraphicService::GetInstance()->PostGraphicEvent(*fun); +} #ifdef __cplusplus - } +} #endif - // 蓝牙通话下行 - static void AudioDn(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioDn] start g_audioState: %d", g_audioState); - - // 申请蓝牙通话音频焦点 - AudioActInterrupt(AUDIO_STREAM_VOICE_CALL_BT_SCO); +// 蓝牙通话下行 +static void AudioDn(void) +{ + // 申请蓝牙通话音频焦点 + AudioActInterrupt(AUDIO_STREAM_VOICE_CALL_BT_SCO); - // 媒体连接SCO设备 - AudioConnectScoDevInit(); + // 媒体连接SCO设备 + AudioConnectScoDevInit(); - // 建立音频下行通路 - AudioDnStart(); - if (g_audioState == AUDIO_STREAM_START_DN) - { - // 同步音量 - PostGraphicEvent(SyncVolume); - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioDn] end g_audioState: %d", g_audioState); + // 建立音频下行通路 + AudioDnStart(); + if (g_audioState == AUDIO_STREAM_START_DN) { + // 同步音量 + SyncVolume(); } + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[AudioDn] audioState:%d", g_audioState); +} - // 蓝牙通话上行 - static void AudioUp(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioUp] start g_audioState: %d", g_audioState); +// 蓝牙通话上行 +static void AudioUp(void) +{ + // 申请蓝牙通话音频焦点 + AudioActInterrupt(AUDIO_STREAM_VOICE_CALL_BT_SCO); - // 申请蓝牙通话音频焦点 - AudioActInterrupt(AUDIO_STREAM_VOICE_CALL_BT_SCO); + // 媒体连接SCO设备 + AudioConnectScoDevInit(); - // 媒体连接SCO设备 - AudioConnectScoDevInit(); + // 建立音频上行通路 + AudioUpStart(); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[AudioUp] audioState:%d", g_audioState); +} - // 建立音频上行通路 - AudioUpStart(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioUp] end g_audioState: %d", g_audioState); +static void AudioSetup(void) +{ + if (g_audioState < AUDIO_STREAM_START_DN) { + AudioDn(); } - static void AudioUpRelease(void) - { - int ret; + if (g_audioState != AUDIO_STREAM_START_UP) { + AudioUp(); + } +} - if (g_hdlUpSco != INVALID_PHONE_SERVICE_VALUE) - { - ret = PhoneAudioStreamOutStop(g_hdlUpSco); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpRelease] [OutStop] g_hdlUpSco error! ret = %d", ret); - } - ret = PhoneAudioStreamOutDeinit(g_hdlUpSco); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpRelease] [OutDeinit] g_hdlUpSco error! ret = %d", ret); - } - } +static void AudioUpRelease(void) +{ + int ret; - if (g_hdlUpMic != INVALID_PHONE_SERVICE_VALUE) - { - ret = PhoneAudioStreamInStop(g_hdlUpMic); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] [InStop] g_hdlUpMic error! ret = %d", ret); - } - ret = PhoneAudioStreamInDeinit(g_hdlUpMic); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] [InDeinit] g_hdlUpMic error! ret = %d", ret); - } + if (g_hdlUpSco != INVALID_PHONE_SERVICE_VALUE) { + ret = PhoneAudioStreamOutStop(g_hdlUpSco); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpRelease] [OutStop] hdlUpSco ret:%d", ret); } + ret = PhoneAudioStreamOutDeinit(g_hdlUpSco); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpRelease] [OutDeinit] hdlUpSco ret:%d", ret); + } + } - if (g_audioState >= AUDIO_CONN_OUT_BT_SCO) - { - ret = PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_SCO, AUDIO_DEVICE_DISCONNECTED); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] OUT_BLUETOOTH_SCO error! ret = %d", ret); - } + if (g_hdlUpMic != INVALID_PHONE_SERVICE_VALUE) { + ret = PhoneAudioStreamInStop(g_hdlUpMic); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] [InStop] hdlUpMic ret:%d", ret); + } + ret = PhoneAudioStreamInDeinit(g_hdlUpMic); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] [InDeinit] hdlUpMic ret:%d", ret); } + } - g_hdlUpSco = INVALID_PHONE_SERVICE_VALUE; - g_hdlUpMic = INVALID_PHONE_SERVICE_VALUE; + if (g_audioState >= AUDIO_CONN_OUT_BT_SCO) { + ret = PhoneAudioManagerSetDeviceConnState(OUT_BLUETOOTH_SCO, AUDIO_DEVICE_DISCONNECTED); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] sco out ret:%d", ret); + } } - static void AudioDnRelease(void) - { - int ret; + g_hdlUpSco = INVALID_PHONE_SERVICE_VALUE; + g_hdlUpMic = INVALID_PHONE_SERVICE_VALUE; +} - if (g_hdlDnSco != INVALID_PHONE_SERVICE_VALUE) - { - ret = PhoneAudioStreamInStop(g_hdlDnSco); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpRelease] [InStop] g_hdlDnSco error! ret = %d", ret); - } - ret = PhoneAudioStreamInDeinit(g_hdlDnSco); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpRelease] [InDeinit] g_hdlDnSco error! ret = %d", ret); - } - } +static void AudioDnRelease(void) +{ + int ret; - if (g_hdlDnSpk != INVALID_PHONE_SERVICE_VALUE) - { - ret = PhoneAudioStreamOutStop(g_hdlDnSpk); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] [OutStop] g_hdlDnSpk error! ret = %d", ret); - } - ret = PhoneAudioStreamOutDeinit(g_hdlDnSpk); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] [OutDeinit] g_hdlDnSpk error! ret = %d", ret); - } + if (g_hdlDnSco != INVALID_PHONE_SERVICE_VALUE) { + ret = PhoneAudioStreamInStop(g_hdlDnSco); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpRelease] [InStop] hdlDnSco ret:%d", ret); } - - if (g_audioState >= AUDIO_CONN_IN_BT_SCO) - { - ret = PhoneAudioManagerSetDeviceConnState(IN_BLUETOOTH_SCO, AUDIO_DEVICE_DISCONNECTED); - if (ret != OHOS_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] IN_BLUETOOTH_SCO error! ret = %d", ret); - } + ret = PhoneAudioStreamInDeinit(g_hdlDnSco); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioUpRelease] [InDeinit] hdlDnSco ret:%d", ret); } + } - g_hdlDnSco = INVALID_PHONE_SERVICE_VALUE; - g_hdlDnSpk = INVALID_PHONE_SERVICE_VALUE; + if (g_hdlDnSpk != INVALID_PHONE_SERVICE_VALUE) { + ret = PhoneAudioStreamOutStop(g_hdlDnSpk); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] [OutStop] hdlDnSpk ret:%d", ret); + } + ret = PhoneAudioStreamOutDeinit(g_hdlDnSpk); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] [OutDeinit] hdlDnSpk ret:%d", ret); + } } - /* 销毁上下行通路 释放音频焦点 */ - void AudioRelease(void) - { - if (g_audioState == AUDIO_UNKNOW) - { - return; + if (g_audioState >= AUDIO_CONN_IN_BT_SCO) { + ret = PhoneAudioManagerSetDeviceConnState(IN_BLUETOOTH_SCO, AUDIO_DEVICE_DISCONNECTED); + if (ret != OHOS_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AudioDnRelease] sco in ret:%d", ret); } + } - MUTEX_Lock(g_audioMutex); - AudioUpRelease(); - AudioDnRelease(); + g_hdlDnSco = INVALID_PHONE_SERVICE_VALUE; + g_hdlDnSpk = INVALID_PHONE_SERVICE_VALUE; +} - /* 释放音频焦点 */ - AudioDeactInterrupt(AUDIO_STREAM_VOICE_CALL_BT_SCO); - AudioDeactInterrupt(AUDIO_STREAM_RING); // 适配某些机型不触发SCO - g_audioState = AUDIO_UNKNOW; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AudioRelease] end g_audioState: %d,", g_audioState); - MUTEX_Unlock(g_audioMutex); +/* 销毁上下行通路 释放音频焦点 */ +void AudioRelease(void) +{ + if (g_audioState == AUDIO_UNKNOW) { + return; } - static void CallListInit(void) - { - int i; + MUTEX_Lock(g_audioMutex); + AudioUpRelease(); + AudioDnRelease(); - g_currCallNum = 0; + /* 释放音频焦点 */ + AudioDeactInterrupt(AUDIO_STREAM_VOICE_CALL_BT_SCO); + AudioDeactInterrupt(AUDIO_STREAM_RING); // 适配某些机型不触发SCO + g_audioState = AUDIO_UNKNOW; - (void)memset_s(g_callList, sizeof(g_callList), 0, sizeof(g_callList)); - for (i = 0; i < MULTI_CALL_MAX_NUME; i++) - { - (void)memset_s(g_callList[i].name, NAME_SIZE, '\0', NAME_SIZE); - (void)memset_s(g_callList[i].tel, MAX_PHONE_NUM, '\0', MAX_PHONE_NUM); - g_callList[i].lastStatus = HFP_HF_CALL_STATE_FINISHED; - } + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[AudioRelease] audioState:%d,", g_audioState); + MUTEX_Unlock(g_audioMutex); +} + +static void CallListInit(void) +{ + int i; + + g_currCallNum = 0; + + (void)memset_s(g_callList, sizeof(g_callList), 0, sizeof(g_callList)); + for (i = 0; i < MULTI_CALL_MAX_NUME; i++) { + (void)memset_s(g_callList[i].name, NAME_SIZE, '\0', NAME_SIZE); + (void)memset_s(g_callList[i].tel, MAX_PHONE_NUM, '\0', MAX_PHONE_NUM); + g_callList[i].lastStatus = HFP_HF_CALL_STATE_FINISHED; } +} - static void CopyBdAddr(const bd_addr_t *bdAddr) - { - unsigned char addr[BD_ADDR_LEN] = {0}; - if (strncmp((const char *)g_bdAddr.addr, (const char *)addr, BD_ADDR_LEN) == 0) - { - (void)memcpy_s(g_bdAddr.addr, BD_ADDR_LEN, bdAddr->addr, BD_ADDR_LEN); - } +static void CopyBdAddr(const bd_addr_t *bdAddr) +{ + unsigned char addr[BD_ADDR_LEN] = {0}; + if (strncmp((const char*)g_bdAddr.addr, (const char*)addr, BD_ADDR_LEN) == 0) { + (void)memcpy_s(g_bdAddr.addr, BD_ADDR_LEN, bdAddr->addr, BD_ADDR_LEN); } +} - static void CatBdAddr(const bd_addr_t *bdAddr) - { +static void CatBdAddr(const bd_addr_t *bdAddr) +{ #if WEARABLEOG_DEBUG_ENABLE - for (unsigned char i = 0; i < BD_ADDR_LEN; i++) - { - printf("%X", bdAddr->addr[i]); - } - printf(""); + for (unsigned char i = 0; i < BD_ADDR_LEN; i++) { + printf("%X", bdAddr->addr[i]); + } + printf(""); #else UNUSED(bdAddr); #endif - } - - static void BtConnectedPro(const bd_addr_t *bdAddr) - { - g_btConnState = PROFILE_STATE_CONNECTED; - CopyBdAddr(bdAddr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[BtConnectedPro] g_bdAddr: "); - CatBdAddr(&g_bdAddr); - } +} - static void BtDisconnectedPro(void) - { - g_btConnState = PROFILE_STATE_DISCONNECTED; - (void)memset_s(g_bdAddr.addr, BD_ADDR_LEN, 0, BD_ADDR_LEN); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[BtDisconnectedPro] g_bdAddr: "); - CatBdAddr(&g_bdAddr); +static void BtConnectedPro(const bd_addr_t *bdAddr) +{ + g_btConnState = PROFILE_STATE_CONNECTED; + CopyBdAddr(bdAddr); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[BtConnectedPro] g_bdAddr: "); + CatBdAddr(&g_bdAddr); +} - // 通知APP蓝牙断开连接 - PhoneServiceErrorCallback(ERROR_BT, PROFILE_STATE_DISCONNECTED); - CallListInit(); +static void BtDisconnectedPro(void) +{ + g_btConnState = PROFILE_STATE_DISCONNECTED; + (void)memset_s(g_bdAddr.addr, BD_ADDR_LEN, 0, BD_ADDR_LEN); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[BtDisconnectedPro] g_bdAddr: "); + CatBdAddr(&g_bdAddr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BtDisconnectedPro callState: %d", g_currCallState); - if (g_currCallState == HFP_HF_CALL_STATE_INCOMING) - { - /* 处理呼入阶段,取消手表配对 */ - hfp_hf_calls_info_t call = {0}; - HfpIncomingEventPublish(TOPIC_EVENT_HFP_FINISHED, call); - } + // 通知APP蓝牙断开连接 + PhoneServiceErrorCallback(ERROR_BT, PROFILE_STATE_DISCONNECTED); + CallListInit(); - g_currCallState = HFP_HF_CALL_STATE_FINISHED; - g_scoFlag = HFP_SCO_STATE_DISCONNECTED; - g_completeCallFlag = false; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BtDisconnectedPro callState:%d", g_currCallState); + if (g_currCallState == HFP_HF_CALL_STATE_INCOMING) { + /* 处理呼入阶段,取消手表配对 */ + hfp_hf_calls_info_t call = {0}; + HfpIncomingEventPublish(TOPIC_EVENT_HFP_FINISHED, call); } - // 蓝牙状态连接 - static void ConnStateChanged(const bd_addr_t *bdAddr, profile_connect_state_t state) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ConnStateChanged] state = 0x%X bdAddr: ", state); - CatBdAddr(bdAddr); + g_currCallState = HFP_HF_CALL_STATE_FINISHED; + g_scoFlag = HFP_SCO_STATE_DISCONNECTED; + g_completeCallFlag = false; +} - if (state == PROFILE_STATE_CONNECTED) - { - SendMsgToUIService(BT_CONNECTED_TO_UI, 0, NULL, 0); - } - else if (state == PROFILE_STATE_DISCONNECTED) - { - SendMsgToUIService(BT_DISCONNECTED_TO_UI, 0, NULL, 0); - } +// 蓝牙状态连接 +static void ConnStateChanged(const bd_addr_t *bdAddr, profile_connect_state_t state) +{ + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[ConnStateChanged] state = 0x%X bdAddr: ", state); + CatBdAddr(bdAddr); - switch (state) - { + switch (state) { case PROFILE_STATE_CONNECTING: // 蓝牙正在连接 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ConnStateChanged] BT connecting"); break; case PROFILE_STATE_CONNECTED: // 蓝牙连接成功 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ConnStateChanged] BT connected"); BtConnectedPro(bdAddr); + SendMsgToUIService(BT_CONNECTED_TO_UI, 0, nullptr, 0); + SendMsgToMsgCenterService(BT_CONNECTED_TO_MSGCENTER, 0, nullptr, 0); break; case PROFILE_STATE_DISCONNECTING: // 蓝牙连接断连 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ConnStateChanged] BT disconnecting"); @@ -683,75 +606,63 @@ extern "C" case PROFILE_STATE_DISCONNECTED: // 蓝牙断开连接 WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ConnStateChanged] BT disconnected"); BtDisconnectedPro(); + SendMsgToUIService(BT_DISCONNECTED_TO_UI, 0, nullptr, 0); + SendMsgToMsgCenterService(BT_DISCONNECTED_TO_MSGCENTER, 0, nullptr, 0); break; default: break; - } } +} - // 获取蓝牙状态 - uint32 GetBtConnectStatus(void) - { - g_btConnState = (uint32)hfp_hf_get_device_connect_state(&g_bdAddr); - return g_btConnState; - } - - // SCO连接处理 - static void ScoConnectPro(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectPro] g_currCallNum = %d, g_scoFlag = %d", g_currCallNum, g_scoFlag); - // 通知sco建立连接(或通话转移:手机 -> 手表) - ScoStatusCb(HFP_SCO_STATE_CONNECTED); - if (g_currCallState == HFP_HF_CALL_STATE_ACTIVE && g_scoFlag == HFP_SCO_STATE_CONNECTED) - { - // The call is transferred from the phone to the watch. Need to show the call notification view. - hfp_hf_calls_info_t call = {0}; - HfpIncomingEventPublish(TOPIC_EVENT_HFP_PHONE_TO_WATCH, call); - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectPro] g_audioState: %d ", g_audioState); - - if (g_audioState < AUDIO_STREAM_START_DN) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectPro] post AudioDn"); - PostGraphicEvent(AudioDn); - } +// 获取蓝牙状态 +uint32 GetBtConnectStatus(void) +{ + g_btConnState = (uint32)hfp_hf_get_device_connect_state(&g_bdAddr); + return g_btConnState; +} - if (g_audioState != AUDIO_STREAM_START_UP) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoConnectPro] post AudioUp"); - PostGraphicEvent(AudioUp); - } +// SCO连接处理 +static void ScoConnectPro(void) +{ + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[ScoConnectPro] CallNum:%d, ScoFlag:%d", g_currCallNum, g_scoFlag); + // 通知sco建立连接(或通话转移:手机 -> 手表) + ScoStatusCb(HFP_SCO_STATE_CONNECTED); + if (g_currCallState == HFP_HF_CALL_STATE_ACTIVE && g_scoFlag == HFP_SCO_STATE_CONNECTED) { + // The call is transferred from the phone to the watch. Need to show the call notification view. + hfp_hf_calls_info_t call = {0}; + HfpIncomingEventPublish(TOPIC_EVENT_HFP_PHONE_TO_WATCH, call); } - // SCO断连处理 - static void ScoDisconnectPro(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoDisconnectPro] start g_currCallState = %d", g_currCallState); + PostGraphicEvent(AudioSetup); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[ScoConnectPro] audioState:%d", g_audioState); +} + +// SCO断连处理 +static void ScoDisconnectPro(void) +{ + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[ScoDisconnectPro] start CallState:%d", g_currCallState); - ScoStatusCb(HFP_SCO_STATE_DISCONNECTED); - if (g_currCallState == HFP_HF_CALL_STATE_ACTIVE && g_scoFlag == HFP_SCO_STATE_DISCONNECTED) - { - // The call is transferred from the watch to the phone. Need to close the call notification view. - hfp_hf_calls_info_t call = {0}; - HfpIncomingEventPublish(TOPIC_EVENT_HFP_WATCH_TO_PHONE, call); - } - AudioRelease(); // 为了保持时序,此处采取同步调用 - usleep(5000); // 增加延时确保SCO断开AUDIO通路释放成功 + ScoStatusCb(HFP_SCO_STATE_DISCONNECTED); + if (g_currCallState == HFP_HF_CALL_STATE_ACTIVE && g_scoFlag == HFP_SCO_STATE_DISCONNECTED) { + // The call is transferred from the watch to the phone. Need to close the call notification view. + hfp_hf_calls_info_t call = {0}; + HfpIncomingEventPublish(TOPIC_EVENT_HFP_WATCH_TO_PHONE, call); } + AudioRelease(); // 为了保持时序,此处采取同步调用 + usleep(5000); // 增加延时确保SCO断开AUDIO通路释放成功 +} - // Sco连接状态变化回调函数,音频连接状态 - static void ScoStateChanged(const bd_addr_t *bdAddr, hfp_sco_connect_state_t state) - { - g_scoFlag = state; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[ScoStateChanged] state = %d, g_scoFlag = %d, g_currCallNum = %d", state, - g_scoFlag, g_currCallNum); +// Sco连接状态变化回调函数,音频连接状态 +static void ScoStateChanged(const bd_addr_t *bdAddr, hfp_sco_connect_state_t state) +{ + g_scoFlag = state; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "[ScoStateChanged] hfpState:%d, ScoFlag:%d, CallNum:%d", state, + g_scoFlag, g_currCallNum); - switch (state) - { + switch (state) { case HFP_SCO_STATE_CONNECTING: PhoneServiceScreenCtr(1); - if (g_scoFlag != HFP_SCO_STATE_CONNECTED) - { + if (g_scoFlag != HFP_SCO_STATE_CONNECTED) { g_scoFlag = HFP_SCO_STATE_CONNECTED; CopyBdAddr(bdAddr); ScoConnectPro(); @@ -776,837 +687,693 @@ extern "C" default: break; - } - } - - static void CallLogCreatDir(void) - { - DIR *dir = NULL; - dir = opendir(CALL_LOG_DIR); - if (dir == NULL) - { - mkdir(CALL_LOG_DIR, S_IREAD | S_IWRITE); - } - else - { - closedir(dir); - } - return; } +} - // 获取通话记录文件长度 - static int GetCallLogFileSize(void) - { - int len = 0; - FILE *fp = fopen(CALL_LOG_PATH, "rb"); - if (fp == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[GetCallLogFileSize] fopen CALL_LOG_PATH error"); - return OHOS_FAILURE; - } - - fseek(fp, 0, SEEK_END); - len = ftell(fp); - fseek(fp, 0, SEEK_SET); - fclose(fp); +static void CallLogCreatDir(void) +{ + DIR *dir = nullptr; + dir = opendir(CALL_LOG_DIR); + if (dir == nullptr) { + mkdir(CALL_LOG_DIR, S_IREAD | S_IWRITE); + } else { + closedir(dir); + } + return; +} - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallLogFileSize] len = %d", len); - return len; +// 获取通话记录文件长度 +static int GetCallLogFileSize(void) +{ + int len = 0; + FILE *fp = fopen(CALL_LOG_PATH, "rb"); + if (fp == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[GetCallLogFileSize] fopen %s failed", CALL_LOG_PATH); + return OHOS_FAILURE; } - // 添加通话进通话记录文件 - void AddToCallLog(CallLogInfo *info) - { - FILE *fp = NULL; - size_t ret; + fseek(fp, 0, SEEK_END); + len = ftell(fp); + fseek(fp, 0, SEEK_SET); + fclose(fp); - fp = fopen(CALL_LOG_PATH, "ab"); - if (fp == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLog] fopen failed!"); - return; - } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallLogFileSize] len:%d", len); + return len; +} - ret = fwrite(info, sizeof(CallLogInfo), 1, fp); - if (ret != 1) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLog] fwrite failed! ret = %d", ret); - } +// 添加通话进通话记录文件 +void AddToCallLog(CallLogInfo *info) +{ + FILE *fp = nullptr; + size_t ret; - fclose(fp); + fp = fopen(CALL_LOG_PATH, "ab"); + if (fp == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLog] fopen %s failed!", CALL_LOG_PATH); return; } - static int CopyPhoneLogToTmpLog(void) - { - FILE *fp = NULL; - FILE *ftp = NULL; - CallLogInfo *info = NULL; - - int retLen; - int fileSize = GetCallLogFileSize(); - - if (fileSize == OHOS_FAILURE || fileSize == 0) - { - return fileSize; - } + ret = fwrite(info, sizeof(CallLogInfo), 1, fp); + if (ret != 1) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLog] fwrite failed! ret:%d", ret); + } - retLen = fileSize - sizeof(CallLogInfo); - if (retLen == 0) - { - return ClearCallLogFile(); // 只有一条记录,清空通话记录 - } + fclose(fp); + return; +} - fp = fopen(CALL_LOG_PATH, "rb"); - if (fp == NULL) - { - return OHOS_FAILURE; - } - ftp = fopen(CALL_TMP_LOG_PATH, "wb+"); - if (ftp == NULL) - { - fclose(fp); - return OHOS_FAILURE; - } +static int CopyPhoneLogToTmpLog(void) +{ + FILE *fp = nullptr; + FILE *ftp = nullptr; + CallLogInfo *info = nullptr; - info = (CallLogInfo *)malloc(fileSize); - if (info == NULL) - { - fclose(fp); - fclose(ftp); - return OHOS_FAILURE; - } + int retLen; + int fileSize = GetCallLogFileSize(); + if (fileSize == OHOS_FAILURE || fileSize == 0) { + return fileSize; + } - (void)memset_s(info, fileSize, 0, fileSize); - if (fread(info, fileSize, 1, fp) != 1) - { - retLen = OHOS_FAILURE; - goto END; - } + retLen = fileSize - sizeof(CallLogInfo); + if (retLen == 0) { + return ClearCallLogFile(); // 只有一条记录,清空通话记录 + } - if (fwrite((info + 1), retLen, 1, ftp) != 1) - { - retLen = OHOS_FAILURE; - goto END; - } + fp = fopen(CALL_LOG_PATH, "rb"); + if (fp == nullptr) { + return OHOS_FAILURE; + } + ftp = fopen(CALL_TMP_LOG_PATH, "wb+"); + if (ftp == nullptr) { + fclose(fp); + return OHOS_FAILURE; + } - END: + info = (CallLogInfo *)malloc(fileSize); + if (info == nullptr) { fclose(fp); fclose(ftp); - free(info); - info = NULL; - return retLen; - } - - // 删除第一条通话记录 - int RemoveFirstCallLog(void) - { - FILE *fp = NULL; - FILE *ftp = NULL; - CallLogInfo *info = NULL; - - int ret = OHOS_SUCCESS; - int fileSize = CopyPhoneLogToTmpLog(); - if (fileSize == OHOS_FAILURE || fileSize == 0) - { - return fileSize; - } + return OHOS_FAILURE; + } - fp = fopen(CALL_LOG_PATH, "wb+"); - if (fp == NULL) - { - return OHOS_FAILURE; - } - ftp = fopen(CALL_TMP_LOG_PATH, "rb"); - if (ftp == NULL) - { - fclose(fp); - return OHOS_FAILURE; - } + (void)memset_s(info, fileSize, 0, fileSize); + if (fread(info, fileSize, 1, fp) != 1) { + retLen = OHOS_FAILURE; + goto END; + } - info = (CallLogInfo *)malloc(fileSize); - if (info == NULL) - { - fclose(fp); - fclose(ftp); - return OHOS_FAILURE; - } - (void)memset_s(info, fileSize, 0, fileSize); - if (fread(info, fileSize, 1, ftp) != 1) - { - ret = OHOS_FAILURE; - goto END; - } + if (fwrite((info + 1), retLen, 1, ftp) != 1) { + retLen = OHOS_FAILURE; + goto END; + } - if (fwrite(info, fileSize, 1, fp) != 1) - { - ret = OHOS_FAILURE; - goto END; - } +END: + fclose(fp); + fclose(ftp); + free(info); + info = nullptr; + return retLen; +} + +// 删除第一条通话记录 +int RemoveFirstCallLog(void) +{ + FILE *fp = nullptr; + FILE *ftp = nullptr; + CallLogInfo *info = nullptr; + + int ret = OHOS_SUCCESS; + int fileSize = CopyPhoneLogToTmpLog(); + if (fileSize == OHOS_FAILURE || fileSize == 0) { + return fileSize; + } + + fp = fopen(CALL_LOG_PATH, "wb+"); + if (fp == nullptr) { + return OHOS_FAILURE; + } + ftp = fopen(CALL_TMP_LOG_PATH, "rb"); + if (ftp == nullptr) { + fclose(fp); + return OHOS_FAILURE; + } - END: + info = (CallLogInfo *)malloc(fileSize); + if (info == nullptr) { fclose(fp); fclose(ftp); - free(info); - info = NULL; - return ret; + return OHOS_FAILURE; + } + (void)memset_s(info, fileSize, 0, fileSize); + if (fread(info, fileSize, 1, ftp) != 1) { + ret = OHOS_FAILURE; + goto END; } - // 添加通话记录 - static void AddToCallLogPro(PhoneCallInfo *callInfo) - { - int ret, num, fileSize; - CallLogInfo info; + if (fwrite(info, fileSize, 1, fp) != 1) { + ret = OHOS_FAILURE; + goto END; + } + +END: + fclose(fp); + fclose(ftp); + free(info); + info = nullptr; + return ret; +} + +// 添加通话记录 +static void AddToCallLogPro(PhoneCallInfo *callInfo) +{ + if (callInfo == nullptr) { + return; + } - if (callInfo == NULL) - { + int fileSize = GetCallLogFileSize(); + int num = fileSize / sizeof(CallLogInfo); + if (num >= CALL_LOG_MAX_NUM) { + int ret = RemoveFirstCallLog(); + if (ret == OHOS_FAILURE) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLogPro] RemoveFirstCallLog error"); return; } + } - fileSize = GetCallLogFileSize(); - num = fileSize / sizeof(CallLogInfo); - if (num >= CALL_LOG_MAX_NUM) - { - ret = RemoveFirstCallLog(); - if (ret == OHOS_FAILURE) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLogPro] RemoveFirstCallLog error"); - return; - } - } - - (void)memset_s(info.name, NAME_SIZE, '\0', NAME_SIZE); - (void)memset_s(info.tel, MAX_PHONE_NUM, '\0', MAX_PHONE_NUM); - ret = memcpy_s(info.name, NAME_SIZE, callInfo->name, callInfo->nameLen); - if (ret != EOK) - { - info.nameLen = 0; - } - else - { - info.nameLen = callInfo->nameLen; - } - - ret = memcpy_s(info.tel, MAX_PHONE_NUM, callInfo->unitCalls.number, callInfo->unitCalls.number_len); - if (ret != EOK) - { - info.telLen = 0; - } - else - { - info.telLen = callInfo->unitCalls.number_len; - } - - info.creationTime = callInfo->creationTime; - if (callInfo->lastStatus == HFP_HF_CALL_STATE_ACTIVE || callInfo->lastStatus == HFP_HF_CALL_STATE_HELD || - callInfo->lastStatus == HFP_HF_CALL_STATE_RESPONSE_HELD) - { - info.callDurTime = time(NULL) - callInfo->activeTime; - } - else - { - info.callDurTime = 0; - } - - if (callInfo->lastStatus == HFP_HF_CALL_STATE_INCOMING || callInfo->lastStatus == HFP_HF_CALL_STATE_WAITING) - { - info.status = CALL_MISSED; - } - else if (callInfo->unitCalls.outgoing == 1) - { - info.status = CALL_OUTGOING; - } - else - { - info.status = CALL_INCOMING; - } + CallLogInfo info; + (void)memset_s(info.name, NAME_SIZE, '\0', NAME_SIZE); + (void)memset_s(info.tel, MAX_PHONE_NUM, '\0', MAX_PHONE_NUM); + int ret = memcpy_s(info.name, NAME_SIZE, callInfo->name, callInfo->nameLen); + if (ret != EOK) { + info.nameLen = 0; + } else { + info.nameLen = callInfo->nameLen; + } - AddToCallLog(&info); + ret = memcpy_s(info.tel, MAX_PHONE_NUM, callInfo->unitCalls.number, callInfo->unitCalls.number_len); + if (ret != EOK) { + info.telLen = 0; + } else { + info.telLen = callInfo->unitCalls.number_len; } - // 获取通话记录 - int GetCallLog(CallLogInfo **info, int *num) - { - FILE *fp = NULL; - int ret, fileSize, number; - CallLogInfo *callInfo = NULL; + info.creationTime = callInfo->creationTime; + if (callInfo->lastStatus == HFP_HF_CALL_STATE_ACTIVE || callInfo->lastStatus == HFP_HF_CALL_STATE_HELD || + callInfo->lastStatus == HFP_HF_CALL_STATE_RESPONSE_HELD) { + info.callDurTime = time(nullptr) - callInfo->activeTime; + } else { + info.callDurTime = 0; + } - fp = fopen(CALL_LOG_PATH, "rb"); - if (fp == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLog] fopen CALL_LOG_PATH failed!"); - return OHOS_FAILURE; - } + if (callInfo->lastStatus == HFP_HF_CALL_STATE_INCOMING || callInfo->lastStatus == HFP_HF_CALL_STATE_WAITING) { + info.status = CALL_MISSED; + } else if (callInfo->unitCalls.outgoing == 1) { + info.status = CALL_OUTGOING; + } else { + info.status = CALL_INCOMING; + } - fileSize = GetCallLogFileSize(); - if (fileSize == 0) - { - *info = NULL; - *num = 0; - fclose(fp); - return OHOS_FAILURE;//文件为空,返回失败 - } + AddToCallLog(&info); +} - number = fileSize / sizeof(CallLogInfo); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallLog] fileSize = %d, number = %d", fileSize, number); - callInfo = (CallLogInfo *)malloc(fileSize); - if (callInfo == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[GetCallLog] malloc callInfo fail!"); - *info = NULL; - *num = 0; - fclose(fp); - return OHOS_FAILURE; - } - (void)memset_s(callInfo, fileSize, 0, fileSize); - - ret = fread(callInfo, sizeof(CallLogInfo), number, fp); - if (ret != number) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[GetCallLog] fread fp fail ret = %d", ret); - *info = NULL; - *num = 0; - fclose(fp); - return OHOS_FAILURE; - } +// 获取通话记录 +int GetCallLog(CallLogInfo **info, int *num) +{ + FILE *fp = fopen(CALL_LOG_PATH, "rb"); + if (fp == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddToCallLog] fopen %s failed!", CALL_LOG_PATH); + return OHOS_FAILURE; + } - *info = callInfo; - *num = number; + int fileSize = GetCallLogFileSize(); + if (fileSize == 0) { + *info = nullptr; + *num = 0; fclose(fp); return OHOS_SUCCESS; } - // 清空通话记录 - int ClearCallLogFile(void) - { - FILE *fp = fopen(CALL_LOG_PATH, "wb"); - if (fp == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ClearCallLogFile] fopen CALL_LOG_PATH failed!"); - return OHOS_FAILURE; - } + int number = fileSize / sizeof(CallLogInfo); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallLog] fileSize:%d, number:%d", fileSize, number); + CallLogInfo *callInfo = (CallLogInfo *)malloc(fileSize); + if (callInfo == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[GetCallLog] malloc callInfo fail!"); + *info = nullptr; + *num = 0; + fclose(fp); + return OHOS_FAILURE; + } + (void)memset_s(callInfo, fileSize, 0, fileSize); + int ret = fread(callInfo, sizeof(CallLogInfo), number, fp); + if (ret != number) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[GetCallLog] fread fp fail ret:%d", ret); + *info = nullptr; + *num = 0; fclose(fp); - return OHOS_SUCCESS; + return OHOS_FAILURE; } - // 查找号码对应的电话信息在list中的位置 - static PhoneCallInfo *FindCallInfoInCallList(const unsigned char *number, unsigned char numberLen) - { - int i; - const char *str1 = NULL; - const char *str2 = NULL; + *info = callInfo; + *num = number; + fclose(fp); + return OHOS_SUCCESS; +} + +// 清空通话记录 +int ClearCallLogFile(void) +{ + FILE *fp = fopen(CALL_LOG_PATH, "wb"); + if (fp == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[ClearCallLogFile] fopen %s failed!", CALL_LOG_PATH); + return OHOS_FAILURE; + } - if (g_currCallNum == 0) - { - return NULL; - } + fclose(fp); + return OHOS_SUCCESS; +} - for (i = 0; i < MULTI_CALL_MAX_NUME; i++) - { - if (numberLen != g_callList[i].telLen) - { - continue; - } - else - { - str1 = (const char *)number; - str2 = (const char *)g_callList[i].tel; - - if (strncmp(str1, str2, numberLen) == 0) - { - return &g_callList[i]; - } +// 查找号码对应的电话信息在list中的位置 +static PhoneCallInfo *FindCallInfoInCallList(const unsigned char *number, unsigned char numberLen) +{ + int i; + const char *str1 = nullptr; + const char *str2 = nullptr; + + if (g_currCallNum == 0) { + return nullptr; + } + + for (i = 0; i < MULTI_CALL_MAX_NUME; i++) { + if (numberLen != g_callList[i].telLen) { + continue; + } else { + str1 = (const char*)number; + str2 = (const char*)g_callList[i].tel; + + if (strncmp(str1, str2, numberLen) == 0) { + return &g_callList[i]; } } - - return NULL; } - static void CatPhoneNumber(char *number, unsigned char len) - { + return nullptr; +} + +static void CatPhoneNumber(char *number, unsigned char len) +{ #if WEARABLEOG_DEBUG_ENABLE - for (unsigned char i = 0; i < len; i++) - { - printf("%c", *(number + i)); - } - printf(""); + for (unsigned char i = 0; i < len; i++) { + printf("%c", *(number + i)); + } + printf(""); #else UNUSED(number); UNUSED(len); #endif - } - - static void AddCurrCallToCallList(const hfp_hf_calls_info_t *call) - { - PhoneCallInfo *phoneCall = NULL; - int tmp, ret; +} - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AddCurrCallToCallList] start, call->state = %d", call->state); - if (call == NULL || g_currCallNum >= MULTI_CALL_MAX_NUME || - (call->state != HFP_HF_CALL_STATE_ACTIVE && call->state != HFP_HF_CALL_STATE_HELD && - call->state != HFP_HF_CALL_STATE_ALERTING)) - { - return; - } +static void AddCurrCallToCallList(const hfp_hf_calls_info_t *call) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AddCurrCallToCallList] state:%d", call->state); + if (call == nullptr || g_currCallNum >= MULTI_CALL_MAX_NUME || + (call->state != HFP_HF_CALL_STATE_ACTIVE && call->state != HFP_HF_CALL_STATE_HELD && + call->state != HFP_HF_CALL_STATE_ALERTING)) { + return; + } - g_currCallNum++; - tmp = g_currCallNum - 1; - phoneCall = &g_callList[tmp]; + g_currCallNum++; + int32_t tmp = g_currCallNum - 1; + PhoneCallInfo *phoneCall = &g_callList[tmp]; - if (call->state == HFP_HF_CALL_STATE_ACTIVE) - { // 正在通话 - phoneCall->operate = OPERATE_PHONE_ACTIVE; - phoneCall->activeTime = time(NULL); - } - else if (call->state == HFP_HF_CALL_STATE_HELD) - { // 挂起 - phoneCall->operate = OPERATE_PHONE_HOLD; - phoneCall->activeTime = time(NULL); - } - else if (call->state == HFP_HF_CALL_STATE_ALERTING) - { // 呼出,对方响铃 - phoneCall->operate = OPERATE_ALERTING; - } + if (call->state == HFP_HF_CALL_STATE_ACTIVE) { // 正在通话 + phoneCall->operate = OPERATE_PHONE_ACTIVE; + phoneCall->activeTime = time(nullptr); + } else if (call->state == HFP_HF_CALL_STATE_HELD) { // 挂起 + phoneCall->operate = OPERATE_PHONE_HOLD; + phoneCall->activeTime = time(nullptr); + } else if (call->state == HFP_HF_CALL_STATE_ALERTING) { // 呼出,对方响铃 + phoneCall->operate = OPERATE_ALERTING; + } - // 使用通讯录接口获取当前电话对应的备注人名(通讯录待开发) + // 使用通讯录接口获取当前电话对应的备注人名(通讯录待开发) - phoneCall->lastStatus = call->state; - phoneCall->creationTime = time(NULL); + phoneCall->lastStatus = call->state; + phoneCall->creationTime = time(nullptr); - ret = memcpy_s(phoneCall->tel, MAX_PHONE_NUM, call->number, call->number_len); - if (ret != EOK) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddCurrCallToCallList] memcpy_s tel fail, ret = %d", ret); - CatPhoneNumber(call->number, call->number_len); - } - phoneCall->telLen = call->number_len; - (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AddCurrCallToCallList] end"); - - // 通知手表电话呼入 - CallChangedCb(phoneCall); + int32_t ret = memcpy_s(phoneCall->tel, MAX_PHONE_NUM, call->number, call->number_len); + if (ret != EOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AddCurrCallToCallList] copy tel ret:%d", ret); + CatPhoneNumber(call->number, call->number_len); } + phoneCall->telLen = call->number_len; + (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AddCurrCallToCallList] end"); - // 通话状态变化--呼出,正在拨号处理 - static void CallChangeDialPro(const hfp_hf_calls_info_t *call) - { - PhoneCallInfo *phoneCall = NULL; - int tmp, ret; - - if (call == NULL) - { - return; - } - g_currCallNum++; - tmp = g_currCallNum - 1; - - phoneCall = &g_callList[tmp]; + // 通知手表电话呼入 + CallChangedCb(phoneCall); +} - // 使用通讯录接口获取当前电话对应的备注人名(通讯录待开发) +// 通话状态变化--呼出,正在拨号处理 +static void CallChangeDialPro(const hfp_hf_calls_info_t *call) +{ + if (call == nullptr) { + return; + } - phoneCall->operate = OPERATE_DIALING; - phoneCall->lastStatus = call->state; - phoneCall->creationTime = time(NULL); + g_currCallNum++; + int32_t tmp = g_currCallNum - 1; + PhoneCallInfo *phoneCall = &g_callList[tmp]; - ret = memcpy_s(phoneCall->tel, MAX_PHONE_NUM, call->number, call->number_len); - if (ret != EOK) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CallChangeDialPro] memcpy_s tel fail, ret = %d", ret); - CatPhoneNumber(call->number, call->number_len); - } - phoneCall->telLen = call->number_len; + // 使用通讯录接口获取当前电话对应的备注人名(通讯录待开发) - (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); + phoneCall->operate = OPERATE_DIALING; + phoneCall->lastStatus = call->state; + phoneCall->creationTime = time(nullptr); - // 通知手表正在拨号 - CallChangedCb(phoneCall); + int32_t ret = memcpy_s(phoneCall->tel, MAX_PHONE_NUM, call->number, call->number_len); + if (ret != EOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CallChangeDialPro] copy tel ret:%d", ret); + CatPhoneNumber(call->number, call->number_len); } + phoneCall->telLen = call->number_len; - // 通话状态变化--呼出,对方响铃 - static void CallChangeAlertPro(const hfp_hf_calls_info_t *call) - { - PhoneCallInfo *phoneCall = NULL; - - if (call == NULL) - { - return; - } + (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); - phoneCall = FindCallInfoInCallList((const unsigned char *)call->number, call->number_len); - if (phoneCall == NULL) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeAlertPro] FindCallInfoInCallList Alert no this call"); - AddCurrCallToCallList(call); - return; - } - phoneCall->operate = OPERATE_ALERTING; - phoneCall->lastStatus = call->state; + // 通知手表正在拨号 + CallChangedCb(phoneCall); +} - (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); +// 通话状态变化--呼出,对方响铃 +static void CallChangeAlertPro(const hfp_hf_calls_info_t *call) +{ + PhoneCallInfo *phoneCall = nullptr; - // 通知手表正对方响铃 - CallChangedCb(phoneCall); + if (call == nullptr) { + return; } - void HfpIncomingEventPublish(uint16 topic, hfp_hf_calls_info_t callsInfo) - { - int32 ret; - uint32 size = sizeof(hfp_hf_calls_info_t); - Request *request = NULL; - BroadcastApi *broadcastApi = NULL; - IUnknown *api = NULL; + phoneCall = FindCallInfoInCallList((const unsigned char*)call->number, call->number_len); + if (phoneCall == nullptr) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeAlertPro] Alert no this call"); + AddCurrCallToCallList(call); + return; + } + phoneCall->operate = OPERATE_ALERTING; + phoneCall->lastStatus = call->state; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish topic=%u!!", topic); + (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); - /* alloc request */ - request = SAMGR_AllocRequestMsg(0, PLATFORM_CORE, BROADCAST_SVR_ID, size); - if (request == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SAMGR_AllocRequestMsg failed"); - return; - } - request->msgId = topic; - ret = memcpy_s(request->data, size, (const void *)&callsInfo, size); - if (ret != EOK) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish memcpy_s rateDataTmp fail! ret = %d", ret); - return; - } - request->len = size; - request->msgValue = 0; - - /* public request */ - api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); - if (api == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetFeatureApi failed"); - SAMGR_FreeRequestMsg(request); - return; - } - ret = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi); - if (ret != 0 || broadcastApi == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QueryInterface failed"); - SAMGR_FreeRequestMsg(request); - return; - } - broadcastApi->PublishTopic((IUnknown *)broadcastApi, request); - broadcastApi->Release((IUnknown *)broadcastApi); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish end!!"); + // 通知手表正对方响铃 + CallChangedCb(phoneCall); +} +void HfpIncomingEventPublish(uint16 topic, hfp_hf_calls_info_t callsInfo) +{ + int32 ret; + uint32 size = sizeof(hfp_hf_calls_info_t); + Request *request = nullptr; + BroadcastApi *broadcastApi = nullptr; + IUnknown *api = nullptr; + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish topic=%u!!", topic); + + /* alloc request */ + request = SAMGR_AllocRequestMsg(0, PLATFORM_CORE, BROADCAST_SVR_ID, size); + if (request == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SAMGR_AllocRequestMsg failed"); + return; + } + request->msgId = topic; + ret = memcpy_s(request->data, size, (const void *)&callsInfo, size); + if (ret != EOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish memcpy_s rateDataTmp fail! ret:%d", ret); return; } + request->len = size; + request->msgValue = 0; - // 通话状态变化--呼入处理 - static void CallChangeIncomePro(const hfp_hf_calls_info_t *call) - { - PhoneCallInfo *phoneCall = NULL; - int tmp, ret; + /* public request */ + api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); + if (api == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetFeatureApi failed"); + SAMGR_FreeRequestMsg(request); + return; + } + ret = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi); + if (ret != 0 || broadcastApi == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "QueryInterface failed"); + SAMGR_FreeRequestMsg(request); + return; + } + broadcastApi->PublishTopic((IUnknown *)broadcastApi, request); + broadcastApi->Release((IUnknown *)broadcastApi); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish end!!"); - if (call == NULL || g_currCallNum >= MULTI_CALL_MAX_NUME || - (call->state != HFP_HF_CALL_STATE_INCOMING && call->state != HFP_HF_CALL_STATE_WAITING)) - { - return; - } + return; +} - phoneCall = FindCallInfoInCallList((const unsigned char *)call->number, call->number_len); - if (phoneCall != NULL) - { - // 通话状态由呼入等待转换成呼入情况 - } - else - { - g_currCallNum++; - tmp = g_currCallNum - 1; - phoneCall = &g_callList[tmp]; - } +// 通话状态变化--呼入处理 +static void CallChangeIncomePro(const hfp_hf_calls_info_t *call) +{ + if (call == nullptr || g_currCallNum >= MULTI_CALL_MAX_NUME || + (call->state != HFP_HF_CALL_STATE_INCOMING && call->state != HFP_HF_CALL_STATE_WAITING)) { + return; + } - // 使用通讯录接口获取当前电话对应的备注人名(通讯录待开发) + PhoneCallInfo *phoneCall = FindCallInfoInCallList((const unsigned char*)call->number, call->number_len); + if (phoneCall != nullptr) { + // 通话状态由呼入等待转换成呼入情况 + } else { + g_currCallNum++; + int32_t tmp = g_currCallNum - 1; + phoneCall = &g_callList[tmp]; + } - if (call->state == HFP_HF_CALL_STATE_INCOMING) - { - phoneCall->operate = OPERATE_INCOMING; - } - else - { - phoneCall->operate = OPERATE_WAITING; - } - phoneCall->lastStatus = call->state; - phoneCall->creationTime = time(NULL); - - ret = memcpy_s(phoneCall->tel, MAX_PHONE_NUM, call->number, call->number_len); - if (ret != EOK) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CallChangeIncomePro] memcpy_s tel fail, ret = %d", ret); - CatPhoneNumber(call->number, call->number_len); - } - phoneCall->telLen = call->number_len; + // 使用通讯录接口获取当前电话对应的备注人名(通讯录待开发) - (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); + if (call->state == HFP_HF_CALL_STATE_INCOMING) { + phoneCall->operate = OPERATE_INCOMING; + } else { + phoneCall->operate = OPERATE_WAITING; + } + phoneCall->lastStatus = call->state; + phoneCall->creationTime = time(nullptr); - // 发布电话呼入事件 - HfpIncomingEventPublish(TOPIC_EVENT_HFP_INCOMMING, phoneCall->unitCalls); - // 通知手表电话呼入 - CallChangedCb(phoneCall); + int32_t ret = memcpy_s(phoneCall->tel, MAX_PHONE_NUM, call->number, call->number_len); + if (ret != EOK) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[CallChangeIncomePro] copy tel ret:%d", ret); + CatPhoneNumber(call->number, call->number_len); } + phoneCall->telLen = call->number_len; - // 通话状态变化--接听流程处理 - static void CallChangeActivePro(const hfp_hf_calls_info_t *call) - { - PhoneCallInfo *phoneCall = NULL; + (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); - if (call == NULL) - { - return; - } + // 发布电话呼入事件 + HfpIncomingEventPublish(TOPIC_EVENT_HFP_INCOMMING, phoneCall->unitCalls); + // 通知手表电话呼入 + CallChangedCb(phoneCall); +} - phoneCall = FindCallInfoInCallList((const unsigned char *)call->number, call->number_len); - if (phoneCall == NULL) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeActivePro] FindCallInfoInCallList Active no this call"); - AddCurrCallToCallList(call); - return; - } +// 通话状态变化--接听流程处理 +static void CallChangeActivePro(const hfp_hf_calls_info_t *call) +{ + PhoneCallInfo *phoneCall = nullptr; - if (phoneCall->lastStatus == HFP_HF_CALL_STATE_HELD && IsCompleteCallFlow() == true) - { // 挂起状态切换到接听状态 - phoneCall->operate = OPERATE_WATCH_ACTIVE; - } - else if (phoneCall->lastStatus == HFP_HF_CALL_STATE_HELD && IsCompleteCallFlow() == false) - { - phoneCall->operate = OPERATE_PHONE_ACTIVE; - } - else if (phoneCall->operate == OPERATE_WATCH_ACTIVE) - { // 手表接听 - // 不做操作 - } - else - { - if (phoneCall->unitCalls.outgoing == 1 && - (phoneCall->lastStatus == HFP_HF_CALL_STATE_DIALING || phoneCall->lastStatus == HFP_HF_CALL_STATE_ALERTING)) - { - phoneCall->operate = OPERATE_PEER_ACTIVE; // 对方接听 - } - else - { - // 手机接听 - phoneCall->operate = OPERATE_PHONE_ACTIVE; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeActivePro] phone active!"); - } - } + if (call == nullptr) { + return; + } - if (phoneCall->activeTime == 0 && - (phoneCall->lastStatus == HFP_HF_CALL_STATE_DIALING || phoneCall->lastStatus == HFP_HF_CALL_STATE_ALERTING || - phoneCall->lastStatus == HFP_HF_CALL_STATE_INCOMING || phoneCall->lastStatus == HFP_HF_CALL_STATE_WAITING)) - { - phoneCall->activeTime = time(NULL); - } + phoneCall = FindCallInfoInCallList((const unsigned char*)call->number, call->number_len); + if (phoneCall == nullptr) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeActivePro] Active no this call"); + AddCurrCallToCallList(call); + TransCallToMobilePhone(); + return; + } - phoneCall->lastStatus = call->state; - (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); - if (phoneCall->operate == OPERATE_PHONE_ACTIVE) - { - // 发布电话接听事件,手表关闭来电通知 - HfpIncomingEventPublish(TOPIC_EVENT_HFP_PHONE_ACTIVE, phoneCall->unitCalls); - } - else if (phoneCall->operate == OPERATE_WATCH_ACTIVE && g_scoFlag == HFP_SCO_STATE_CONNECTED) - { - // 发布手表接听事件,通知切换接听界面 - HfpIncomingEventPublish(TOPIC_EVENT_HFP_WATCH_ACTIVE, phoneCall->unitCalls); + if (phoneCall->lastStatus == HFP_HF_CALL_STATE_HELD && IsCompleteCallFlow()) { // 挂起状态切换到接听状态 + phoneCall->operate = OPERATE_WATCH_ACTIVE; + } else if (phoneCall->lastStatus == HFP_HF_CALL_STATE_HELD && (!IsCompleteCallFlow())) { + phoneCall->operate = OPERATE_PHONE_ACTIVE; + } else if (phoneCall->operate == OPERATE_WATCH_ACTIVE) { // 手表接听 + // 不做操作 + } else { + if (phoneCall->unitCalls.outgoing == 1 && + (phoneCall->lastStatus == HFP_HF_CALL_STATE_DIALING || phoneCall->lastStatus == HFP_HF_CALL_STATE_ALERTING)) { + phoneCall->operate = OPERATE_PEER_ACTIVE; // 对方接听 + } else { + // 手机接听 + phoneCall->operate = OPERATE_PHONE_ACTIVE; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeActivePro] phone active!"); } - // 通知手表触发接听 - CallChangedCb(phoneCall); } - // 通话状态变化--拒接/结束流程处理 - static void CallChangeFinishPro(const hfp_hf_calls_info_t *call) - { - PhoneCallInfo *phoneCall = NULL; - PhoneCallInfo tmp; + if (phoneCall->activeTime == 0 && + (phoneCall->lastStatus == HFP_HF_CALL_STATE_DIALING || phoneCall->lastStatus == HFP_HF_CALL_STATE_ALERTING || + phoneCall->lastStatus == HFP_HF_CALL_STATE_INCOMING || phoneCall->lastStatus == HFP_HF_CALL_STATE_WAITING)) { + phoneCall->activeTime = time(nullptr); + } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeFinishPro] start g_scoFlag = %d, g_currCallNum = %d", - g_scoFlag, g_currCallNum); - if (call == NULL || g_currCallNum == 0) - { - return; - } + phoneCall->lastStatus = call->state; + (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); + if (phoneCall->operate == OPERATE_PHONE_ACTIVE) { + // 发布电话接听事件,手表关闭来电通知 + HfpIncomingEventPublish(TOPIC_EVENT_HFP_PHONE_ACTIVE, phoneCall->unitCalls); + } else if (phoneCall->operate == OPERATE_WATCH_ACTIVE && g_scoFlag == HFP_SCO_STATE_CONNECTED) { + // 发布手表接听事件,通知切换接听界面 + HfpIncomingEventPublish(TOPIC_EVENT_HFP_WATCH_ACTIVE, phoneCall->unitCalls); + } + // 通知手表触发接听 + CallChangedCb(phoneCall); +} - phoneCall = FindCallInfoInCallList((const unsigned char *)call->number, call->number_len); - if (phoneCall == NULL) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeFinishPro] FindCallInfoInCallList Finish no this call"); - return; - } - if (g_finishOperate == OPERATE_WATCH_FINISH) - { - phoneCall->operate = OPERATE_WATCH_FINISH; - } - else if (g_finishOperate == OPERATE_WATCH_REJECT) - { - phoneCall->operate = OPERATE_WATCH_REJECT; - } - else - { - phoneCall->operate = OPERATE_NON_WATCH_FINISH; - } - g_finishOperate = OPERATE_NON_WATCH_FINISH; - g_currCallNum--; +// 通话状态变化--拒接/结束流程处理 +static void CallChangeFinishPro(const hfp_hf_calls_info_t *call) +{ + PhoneCallInfo *phoneCall = nullptr; + PhoneCallInfo tmp; - (void)memcpy_s(&tmp, sizeof(PhoneCallInfo), phoneCall, sizeof(PhoneCallInfo)); - (void)memcpy_s(&tmp.unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); - (void)memset_s(phoneCall, sizeof(PhoneCallInfo), 0, sizeof(PhoneCallInfo)); - (void)memset_s(phoneCall->name, NAME_SIZE, '\0', NAME_SIZE); - (void)memset_s(phoneCall->tel, MAX_PHONE_NUM, '\0', MAX_PHONE_NUM); - phoneCall->lastStatus = HFP_HF_CALL_STATE_FINISHED; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeFinishPro] start scoFlag:%d, CallNum:%d", + g_scoFlag, g_currCallNum); + if (call == nullptr || g_currCallNum == 0) { + return; + } - // 添加通话记录 - AddToCallLogPro(&tmp); + phoneCall = FindCallInfoInCallList((const unsigned char*)call->number, call->number_len); + if (phoneCall == nullptr) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeFinishPro] Finish no this call"); + return; + } + if (g_finishOperate == OPERATE_WATCH_FINISH) { + phoneCall->operate = OPERATE_WATCH_FINISH; + } else if (g_finishOperate == OPERATE_WATCH_REJECT) { + phoneCall->operate = OPERATE_WATCH_REJECT; + } else { + phoneCall->operate = OPERATE_NON_WATCH_FINISH; + } + g_finishOperate = OPERATE_NON_WATCH_FINISH; + g_currCallNum--; - // 发布电话结束事件 - HfpIncomingEventPublish(TOPIC_EVENT_HFP_FINISHED, phoneCall->unitCalls); - // 通知手表通话结束 - CallChangedCb(&tmp); + (void)memcpy_s(&tmp, sizeof(PhoneCallInfo), phoneCall, sizeof(PhoneCallInfo)); + (void)memcpy_s(&tmp.unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); + (void)memset_s(phoneCall, sizeof(PhoneCallInfo), 0, sizeof(PhoneCallInfo)); + (void)memset_s(phoneCall->name, NAME_SIZE, '\0', NAME_SIZE); + (void)memset_s(phoneCall->tel, MAX_PHONE_NUM, '\0', MAX_PHONE_NUM); + phoneCall->lastStatus = HFP_HF_CALL_STATE_FINISHED; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeFinishPro] end g_scoFlag = %d, g_currCallNum = %d", - g_scoFlag, g_currCallNum); - } + // 添加通话记录 + AddToCallLogPro(&tmp); - // 通话状态变化--挂起通话(当前只有手机挂起触发(并且手表不需感知),手表不支持挂起触发,对方挂起不感知) - static void CallChangeHeldPro(const hfp_hf_calls_info_t *call) - { - PhoneCallInfo *phoneCall = NULL; + // 发布电话结束事件 + HfpIncomingEventPublish(TOPIC_EVENT_HFP_FINISHED, phoneCall->unitCalls); + // 通知手表通话结束 + CallChangedCb(&tmp); - if (call == NULL) - { - return; - } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeFinishPro] end scoFlag:%d, CallNum:%d", + g_scoFlag, g_currCallNum); +} - phoneCall = FindCallInfoInCallList((const unsigned char *)call->number, call->number_len); - if (phoneCall == NULL) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeHeldPro] FindCallInfoInCallList Held no this call"); - AddCurrCallToCallList(call); - return; - } +// 通话状态变化--挂起通话(当前只有手机挂起触发(并且手表不需感知),手表不支持挂起触发,对方挂起不感知) +static void CallChangeHeldPro(const hfp_hf_calls_info_t *call) +{ + PhoneCallInfo *phoneCall = nullptr; - // 手机挂起通话 - phoneCall->operate = OPERATE_PHONE_HOLD; - if (phoneCall->lastStatus == HFP_HF_CALL_STATE_INCOMING || phoneCall->lastStatus == HFP_HF_CALL_STATE_WAITING) - { - phoneCall->activeTime = time(NULL); - } - phoneCall->lastStatus = call->state; - (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); + if (call == nullptr) { + return; + } - // 通知手表触发挂起 - CallChangedCb(phoneCall); + phoneCall = FindCallInfoInCallList((const unsigned char*)call->number, call->number_len); + if (phoneCall == nullptr) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallChangeHeldPro] Held no this call"); + AddCurrCallToCallList(call); + return; } - static void PlayWatchRing(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PlayWatchRing] start"); - // 申请手表铃声焦点 - // AudioActInterrupt(AUDIO_STREAM_RING); - // 播放手表铃声(播放方案待定) + // 手机挂起通话 + phoneCall->operate = OPERATE_PHONE_HOLD; + if (phoneCall->lastStatus == HFP_HF_CALL_STATE_INCOMING || phoneCall->lastStatus == HFP_HF_CALL_STATE_WAITING) { + phoneCall->activeTime = time(nullptr); } + phoneCall->lastStatus = call->state; + (void)memcpy_s(&phoneCall->unitCalls, sizeof(hfp_hf_calls_info_t), call, sizeof(hfp_hf_calls_info_t)); - static void CallAudioHandle(const hfp_hf_calls_info_t *call) - { - int state = call->state; + // 通知手表触发挂起 + CallChangedCb(phoneCall); +} - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallAudioHandle] start g_audioState: %d", g_audioState); +static void PlayWatchRing(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PlayWatchRing] start"); +} - if (state == HFP_HF_CALL_STATE_INCOMING || state == HFP_HF_CALL_STATE_DIALING || - state == HFP_HF_CALL_STATE_ALERTING) - { // 电话呼入,支持播放手机铃声 - if (call->in_band_ring == true) - { - // 播放手机端铃声 - PostGraphicEvent(AudioDn); - } - else - { - if (g_scoFlag != HFP_SCO_STATE_CONNECTED) - { - // 播放手表铃声 - PostGraphicEvent(PlayWatchRing); - } - } - } - else if (state == HFP_HF_CALL_STATE_FINISHED) - { - return; - } - else if (g_scoFlag == HFP_SCO_STATE_CONNECTED) - { - if (g_audioState < AUDIO_STREAM_START_DN) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallAudioHandle] post AudioDn"); - PostGraphicEvent(AudioDn); - } - if (g_audioState != AUDIO_STREAM_START_UP) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallAudioHandle] post AudioUp"); - PostGraphicEvent(AudioUp); +static void CallAudioHandle(const hfp_hf_calls_info_t *call) +{ + int state = call->state; + + if (state == HFP_HF_CALL_STATE_INCOMING || state == HFP_HF_CALL_STATE_DIALING || + state == HFP_HF_CALL_STATE_ALERTING) { // 电话呼入,支持播放手机铃声 + if (call->in_band_ring) { + // 播放手机端铃声 + PostGraphicEvent(AudioDn); + } else { + if (g_scoFlag != HFP_SCO_STATE_CONNECTED) { + // 播放手表铃声 + PostGraphicEvent(PlayWatchRing); } } - - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CallAudioHandle] end g_audioState: %d", g_audioState); + } else if (state == HFP_HF_CALL_STATE_FINISHED) { + return; + } else if (g_scoFlag == HFP_SCO_STATE_CONNECTED) { + PostGraphicEvent(AudioSetup); } +} - static void CatCallStateChangedInfo(const bd_addr_t *bdAddr, const hfp_hf_calls_info_t *call) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "***************************CallStateChanged***************************"); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "g_scoFlag = %d, g_currCallNum = %d, bdAddr: ", g_scoFlag, g_currCallNum); - CatBdAddr(bdAddr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "id = %d, state = %d", call->id, call->state); - CatPhoneNumber(call->number, call->number_len); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "multi_party = %d, outgoing = %d, in_band_ring = %d, creation_time = %ld", - call->multi_party, call->outgoing, call->in_band_ring, call->creation_time); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "***********************************************************************"); - } +static void CatCallStateChangedInfo(const bd_addr_t *bdAddr, const hfp_hf_calls_info_t *call) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "***************************CallStateChanged***************************"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "scoFlag:%d, CallNum:%d, bdAddr: ", g_scoFlag, g_currCallNum); + CatBdAddr(bdAddr); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "id:%d, state:%d", call->id, call->state); + CatPhoneNumber(call->number, call->number_len); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "multi_party:%d, outgoing:%d, in_band_ring:%d, creation_time:%ld", + call->multi_party, call->outgoing, call->in_band_ring, call->creation_time); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "***********************************************************************"); +} - // 设置完整通话标志 - static void SetCompleteCallFlag(const hfp_hf_calls_info_t *call) - { - if (call->state == HFP_HF_CALL_STATE_INCOMING) - { - g_completeCallFlag = true; - } - else if ((call->state == HFP_HF_CALL_STATE_DIALING || call->state == HFP_HF_CALL_STATE_ALERTING) && - (g_currCallNum == 1 || g_currCallNum == 0)) - { - g_completeCallFlag = true; - } - else if (call->state == HFP_HF_CALL_STATE_ACTIVE) - { - g_completeCallFlag = true; - } +// 设置完整通话标志 +static void SetCompleteCallFlag(const hfp_hf_calls_info_t *call) +{ + if (call->state == HFP_HF_CALL_STATE_INCOMING) { + g_completeCallFlag = true; + } else if ((call->state == HFP_HF_CALL_STATE_DIALING || call->state == HFP_HF_CALL_STATE_ALERTING) && + (g_currCallNum == 1 || g_currCallNum == 0)) { + g_completeCallFlag = true; + } else if (call->state == HFP_HF_CALL_STATE_ACTIVE) { + g_completeCallFlag = true; } +} - bool IsCompleteCallFlow(void) - { - return g_completeCallFlag; - } +bool IsCompleteCallFlow(void) +{ + return g_completeCallFlag; +} - // 通话状态变化上报回调 - static void CallStateChanged(const bd_addr_t *bdAddr, const hfp_hf_calls_info_t *call) - { - CopyBdAddr(bdAddr); - if (call == NULL || g_btConnState != PROFILE_STATE_CONNECTED) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "call is null or BT disconnected connStatus: 0x%X", g_btConnState); - return; - } +// 通话状态变化上报回调 +static void CallStateChanged(const bd_addr_t *bdAddr, const hfp_hf_calls_info_t *call) +{ + CopyBdAddr(bdAddr); + if (call == nullptr || g_btConnState != PROFILE_STATE_CONNECTED) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "call is null or BT disconnected connStatus: 0x%X", g_btConnState); + return; + } - SetCompleteCallFlag(call); - CatCallStateChangedInfo(bdAddr, call); - CallAudioHandle(call); + SetCompleteCallFlag(call); + CatCallStateChangedInfo(bdAddr, call); + CallAudioHandle(call); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "CallStateChanged state = %d", call->state); - switch (call->state) - { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "CallStateChanged state:%d", call->state); + switch (call->state) { case HFP_HF_CALL_STATE_ACTIVE: // 正在通话 CallChangeActivePro(call); break; @@ -1635,517 +1402,453 @@ extern "C" break; default: break; - } + } - // 规避某些型号手机在电话呼入时重复断开和连接SCO - if (call->state == HFP_HF_CALL_STATE_FINISHED) - { - if (g_currCallNum == 0) - { - g_currCallState = HFP_HF_CALL_STATE_FINISHED; - } - } - else - { - g_currCallState = call->state; + // 规避某些型号手机在电话呼入时重复断开和连接SCO + if (call->state == HFP_HF_CALL_STATE_FINISHED) { + if (g_currCallNum == 0) { + g_currCallState = HFP_HF_CALL_STATE_FINISHED; } + } else { + g_currCallState = call->state; + } - if (g_currCallNum == 0) - { - g_completeCallFlag = false; - } + if (g_currCallNum == 0) { + g_completeCallFlag = false; } +} - static void BtHfpVolumeChanged(int volumeType, unsigned char hfpVolume) - { - int maxVolume, minVolume, volume; - bool ret; +static void BtHfpVolumeChanged(int volumeType, unsigned char hfpVolume) +{ + // mic + if (volumeType == HFP_VOLUME_MIC) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeChanged Type:%d, hfpVolume:%d", + volumeType, hfpVolume); + } + + // speak + if (volumeType == HFP_VOLUME_SPEAKER) { + int32_t minVolume = PhoneAudioGetMinVolume(); + int32_t maxVolume = PhoneAudioGetMaxVolume(); + int32_t volume = hfpVolume * (maxVolume - minVolume) / CALL_VOLUME_MAX; // 转换 + volume = (volume == 0) ? ((maxVolume - minVolume) / CALL_VOLUME_MAX) : volume; + bool ret = PhoneAudioSetVolume(volume); + if (!ret) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VolumeChanged Type:%d, ret:%d", + volumeType, ret); + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeChanged Type:%d, min:%d, max:%d volume:%d ret:%d", + volumeType, minVolume, maxVolume, volume, ret); + } +} - // mic - if (volumeType == HFP_VOLUME_MIC) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeChanged Type = %d, hfpVolume = %d", - volumeType, hfpVolume); - } +// 音量调节回调 +static void VolumeChanged(const bd_addr_t *bdAddr, hfp_volume_type_t type, unsigned char volume) +{ + UNUSED(bdAddr); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[VolumeChanged] type:%d volume:%d", type, volume); + GraphicService::GetInstance()->PostGraphicEvent(std::bind(BtHfpVolumeChanged, type, volume)); +} - // speak - if (volumeType == HFP_VOLUME_SPEAKER) - { - minVolume = PhoneAudioGetMinVolume(); - maxVolume = PhoneAudioGetMaxVolume(); - volume = hfpVolume * (maxVolume - minVolume) / CALL_VOLUME_MAX; // 转换 - volume = (volume == 0) ? ((maxVolume - minVolume) / CALL_VOLUME_MAX) : volume; - ret = PhoneAudioSetVolume(volume); - if (ret != true) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "VolumeChanged Type: %d, ret: %d", - volumeType, ret); - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "VolumeChanged Type: %d, min: %d, max: %d volume: %d ret: %d", - volumeType, minVolume, maxVolume, volume, ret); - } - } +// 拨号失败回调 +static void DialErrorCode(const bd_addr_t *bdAddr, int code) +{ + UNUSED(bdAddr); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[DialErrorCode] code:%d", code); + PhoneServiceErrorCallback(ERROR_DIAL, code); +} - // 音量调节回调 - static void VolumeChanged(const bd_addr_t *bdAddr, hfp_volume_type_t type, unsigned char volume) - { - UNUSED(bdAddr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[VolumeChanged] type = %d volume = %d", type, volume); - GraphicService::GetInstance()->PostGraphicEvent(std::bind(BtHfpVolumeChanged, type, volume)); - } +static void HfpBatteryChanged(const bd_addr_t *bdAddr, int batteryLevel) +{ + UNUSED(bdAddr); + UNUSED(batteryLevel); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpBatteryChanged] batteryLevel:%d", batteryLevel); +} - // 拨号失败回调 - static void DialErrorCode(const bd_addr_t *bdAddr, int code) - { - UNUSED(bdAddr); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[DialErrorCode] code = %d", code); - PhoneServiceErrorCallback(ERROR_DIAL, code); - } +static void HfpSignalStrengthChanged(const bd_addr_t *bdAddr, int signalStrength) +{ + UNUSED(bdAddr); + UNUSED(signalStrength); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpSignalStrengthChanged] signalStrength:%d", signalStrength); +} - static void HfpBatteryChanged(const bd_addr_t *bdAddr, int batteryLevel) - { - UNUSED(bdAddr); - UNUSED(batteryLevel); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpBatteryChanged] batteryLevel: %d", batteryLevel); - } +static void HfpRegistStatusChanged(const bd_addr_t *bdAddr, int status) +{ + UNUSED(bdAddr); + UNUSED(status); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpRegistStatusChanged] status:%d", status); +} - static void HfpSignalStrengthChanged(const bd_addr_t *bdAddr, int signalStrength) - { - UNUSED(bdAddr); - UNUSED(signalStrength); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpSignalStrengthChanged] signalStrength: %d", signalStrength); - } +static void HfpRoamingStatusChanged(const bd_addr_t *bdAddr, int status) +{ + UNUSED(bdAddr); + UNUSED(status); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpRoamingStatusChanged] status:%d", status); +} - static void HfpRegistStatusChanged(const bd_addr_t *bdAddr, int status) - { - UNUSED(bdAddr); - UNUSED(status); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpRegistStatusChanged] status: %d", status); - } +static void HfpOperatorSelection(const bd_addr_t *bdAddr, unsigned char *name, unsigned int len) +{ + UNUSED(bdAddr); + UNUSED(name); + UNUSED(len); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpOperatorSelection] name: %s, len:%d", name, len); +} - static void HfpRoamingStatusChanged(const bd_addr_t *bdAddr, int status) - { - UNUSED(bdAddr); - UNUSED(status); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpRoamingStatusChanged] status: %d", status); - } +static void HfpSubscriberNumber(const bd_addr_t *bdAddr, unsigned char *number, unsigned int len) +{ + UNUSED(bdAddr); + UNUSED(number); + UNUSED(len); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpSubscriberNumber] number: %s, len:%d", number, len); +} - static void HfpOperatorSelection(const bd_addr_t *bdAddr, unsigned char *name, unsigned int len) - { - UNUSED(bdAddr); - UNUSED(name); - UNUSED(len); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpOperatorSelection] name: %s, len: %d", name, len); - } +static void VoiceRecogStatusChanged(const bd_addr_t *bdAddr, int status) +{ + UNUSED(bdAddr); + UNUSED(status); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[VoiceRecogStatusChanged] status:%d", status); +} - static void HfpSubscriberNumber(const bd_addr_t *bdAddr, unsigned char *number, unsigned int len) - { - UNUSED(bdAddr); - UNUSED(number); - UNUSED(len); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[HfpSubscriberNumber] number: %s, len: %d", number, len); - } +static void InbandRingtoneChanged(const bd_addr_t *bdAddr, int status) +{ + UNUSED(bdAddr); + UNUSED(status); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[InbandRingtoneChanged] status:%d", status); +} - static void VoiceRecogStatusChanged(const bd_addr_t *bdAddr, int status) - { - UNUSED(bdAddr); - UNUSED(status); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[VoiceRecogStatusChanged] status: %d", status); +static void CodecChanged(const bd_addr_t *bdAddr, int codec) +{ + UNUSED(bdAddr); + if (codec == HFP_HF_CODEC_ID_CVSD) { + g_call_codec = PCM; + } else if (codec == HFP_HF_CODEC_ID_MSBC) { + g_call_codec = mSBC; } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CodecChanged] codec:%d, call_codec:%d", codec, g_call_codec); +} - static void InbandRingtoneChanged(const bd_addr_t *bdAddr, int status) - { - UNUSED(bdAddr); - UNUSED(status); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[InbandRingtoneChanged] status: %d", status); - } - static void CodecChanged(const bd_addr_t *bdAddr, int codec) - { - UNUSED(bdAddr); - if (codec == HFP_HF_CODEC_ID_CVSD) - { - g_call_codec = PCM; - } - else if (codec == HFP_HF_CODEC_ID_MSBC) - { - g_call_codec = mSBC; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[CodecChanged] codec: %d, call_codec: %d", codec, g_call_codec); - } - - static void RegisterHfpHfCallbacks(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RegisterHfpHfCallbacks] start"); - int ret; - hfp_hf_callbacks_t callbacks = { - ConnStateChanged, - ScoStateChanged, - HfpBatteryChanged, - HfpSignalStrengthChanged, - HfpRegistStatusChanged, - HfpRoamingStatusChanged, - HfpOperatorSelection, - HfpSubscriberNumber, - VoiceRecogStatusChanged, - InbandRingtoneChanged, - VolumeChanged, - CallStateChanged, - DialErrorCode, - CodecChanged, - }; - - ret = hfp_hf_register_callbacks(&callbacks); - if (ret != 0) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[RegisterHfpHfCallbacks] ret = %d", ret); - } +static void RegisterHfpHfCallbacks(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RegisterHfpHfCallbacks] start"); + int ret; + hfp_hf_callbacks_t callbacks = { + ConnStateChanged, + ScoStateChanged, + HfpBatteryChanged, + HfpSignalStrengthChanged, + HfpRegistStatusChanged, + HfpRoamingStatusChanged, + HfpOperatorSelection, + HfpSubscriberNumber, + VoiceRecogStatusChanged, + InbandRingtoneChanged, + VolumeChanged, + CallStateChanged, + DialErrorCode, + CodecChanged, + }; + + ret = hfp_hf_register_callbacks(&callbacks); + if (ret != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[RegisterHfpHfCallbacks] ret:%d", ret); } +} - void PhoneServiceInit(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] start"); - g_scoFlag = HFP_SCO_STATE_DISCONNECTED; - AudioInit(); - InitMutex(); - CallLogCreatDir(); - if (GetCallLogFileSize() == OHOS_FAILURE) - { // 如果不存在文件,创建新文件 - (void)ClearCallLogFile(); - } - (void)memset_s(g_bdAddr.addr, BD_ADDR_LEN, 0, BD_ADDR_LEN); - CallListInit(); - RegisterHfpHfCallbacks(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] end"); - } - - // 手表主动拨打电话 - int DialCall(unsigned char *number, unsigned char len) - { - int ret; - unsigned char *tel = NULL; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[DialCall] start"); - if (g_btConnState != PROFILE_STATE_CONNECTED) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DialCall] BT connStatus: 0x%X", g_btConnState); - return OHOS_FAILURE; - } - - // 有通话时,不允许拨出电话 - if (g_currCallNum > 0 || len > MAX_PHONE_NUM || number == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DialCall] g_currCallNum = %d", g_currCallNum); - return OHOS_FAILURE; - } +void PhoneServiceInit(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] start"); + g_scoFlag = HFP_SCO_STATE_DISCONNECTED; + AudioInit(); + InitMutex(); + CallLogCreatDir(); + if (GetCallLogFileSize() == OHOS_FAILURE) { // 如果不存在文件,创建新文件 + (void)ClearCallLogFile(); + } + (void)memset_s(g_bdAddr.addr, BD_ADDR_LEN, 0, BD_ADDR_LEN); + CallListInit(); + RegisterHfpHfCallbacks(); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[PhoneServiceInit] end"); +} - tel = (unsigned char *)malloc(len + 1); - if (tel == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DialCall] malloc tel error"); - return OHOS_FAILURE; - } - (void)memcpy_s(tel, len, number, len); - *(tel + len) = '\0'; - ret = hfp_hf_start_dial(&g_bdAddr, tel, len); - if (ret != ERRCODE_BT_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DialCall] hfp_hf_start_dial error ret %d", ret); - free(tel); - return OHOS_FAILURE; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[DialCall] success!"); +// 手表主动拨打电话 +int DialCall(unsigned char *number, unsigned char len) +{ + int ret; + unsigned char *tel = nullptr; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[DialCall] start"); + if (g_btConnState != PROFILE_STATE_CONNECTED) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DialCall] BT connStatus: 0x%X", g_btConnState); + return OHOS_FAILURE; + } + + // 有通话时,不允许拨出电话 + if (g_currCallNum > 0 || len > MAX_PHONE_NUM || number == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DialCall] g_currCallNum:%d", g_currCallNum); + return OHOS_FAILURE; + } + + tel = (unsigned char *)malloc(len + 1); + if (tel == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DialCall] malloc tel error"); + return OHOS_FAILURE; + } + (void)memcpy_s(tel, len, number, len); + *(tel + len) = '\0'; + ret = hfp_hf_start_dial(&g_bdAddr, tel, len); + if (ret != ERRCODE_BT_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[DialCall] hfp_hf_start_dial ret %d", ret); free(tel); - return OHOS_SUCCESS; + return OHOS_FAILURE; } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[DialCall] success!"); + free(tel); + return OHOS_SUCCESS; +} - // 手表主动接听 - int AcceptIncomingCall(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] start"); - int ret, i; - PhoneCallInfo *phoneCall = NULL; - PhoneCallInfo *tmp = g_callList; +// 手表主动接听 +int AcceptIncomingCall(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] start"); + int32_t ret; + PhoneCallInfo *phoneCall = nullptr; + PhoneCallInfo *tmp = g_callList; - if (g_btConnState != PROFILE_STATE_CONNECTED) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] BT connStatus: 0x%X", g_btConnState); - return OHOS_FAILURE; - } + if (g_btConnState != PROFILE_STATE_CONNECTED) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] BT connStatus: 0x%X", g_btConnState); + return OHOS_FAILURE; + } - for (i = 0; i < MULTI_CALL_MAX_NUME; i++) - { - if (tmp->lastStatus == HFP_HF_CALL_STATE_INCOMING || tmp->lastStatus == HFP_HF_CALL_STATE_WAITING) - { - phoneCall = tmp; - break; - } - tmp++; + for (int32_t i = 0; i < MULTI_CALL_MAX_NUME; i++) { + if (tmp->lastStatus == HFP_HF_CALL_STATE_INCOMING || tmp->lastStatus == HFP_HF_CALL_STATE_WAITING) { + phoneCall = tmp; + break; } + tmp++; + } - if (phoneCall == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] no incoming"); - return OHOS_FAILURE; - } + if (phoneCall == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] no incoming"); + return OHOS_FAILURE; + } - phoneCall->operate = OPERATE_WATCH_ACTIVE; + phoneCall->operate = OPERATE_WATCH_ACTIVE; - if (g_currCallNum > 1) - { - ret = hfp_hf_accept_incoming_call(&g_bdAddr, HFP_HF_ACCEPT_CALL_ACTION_HOLD); // 正在通话,有人呼入,接听呼入电话,挂起当前通话 - } - else - { - ret = hfp_hf_accept_incoming_call(&g_bdAddr, HFP_HF_ACCEPT_CALL_ACTION_NONE); // 无人通话,有人呼入,接听呼入电话 - } - if (ret != ERRCODE_BT_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] hfp_hf_accept_incoming_call error ret = %d", ret); - phoneCall->operate = OPERATE_NO_OPE; - return OHOS_FAILURE; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] success!"); - return OHOS_SUCCESS; + if (g_currCallNum > 1) { + ret = hfp_hf_accept_incoming_call(&g_bdAddr, HFP_HF_ACCEPT_CALL_ACTION_HOLD); // 正在通话,有人呼入,接听呼入电话,挂起当前通话 + } else { + ret = hfp_hf_accept_incoming_call(&g_bdAddr, HFP_HF_ACCEPT_CALL_ACTION_NONE); // 无人通话,有人呼入,接听呼入电话 } + if (ret != ERRCODE_BT_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] ret:%d", ret); + phoneCall->operate = OPERATE_NO_OPE; + return OHOS_FAILURE; + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] success!"); + return OHOS_SUCCESS; +} - // 手表拒接呼入来电,成功:0,失败:错误码 - int RejectIncomingCall(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RejectIncomingCall] start"); - int ret, i; - PhoneCallInfo *phoneCall = NULL; - PhoneCallInfo *tmp = g_callList; - - if (g_btConnState != PROFILE_STATE_CONNECTED) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[RejectIncomingCall] BT connStatus: 0x%X", g_btConnState); - return OHOS_FAILURE; - } +// 手表拒接呼入来电,成功:0,失败:错误码 +int RejectIncomingCall(void) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RejectIncomingCall] start"); + PhoneCallInfo *phoneCall = nullptr; + PhoneCallInfo *tmp = g_callList; - for (i = 0; i < MULTI_CALL_MAX_NUME; i++) - { - if (tmp->lastStatus == HFP_HF_CALL_STATE_INCOMING || tmp->lastStatus == HFP_HF_CALL_STATE_WAITING) - { - phoneCall = tmp; - } - tmp++; - } + if (g_btConnState != PROFILE_STATE_CONNECTED) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[RejectIncomingCall] BT connStatus: 0x%X", g_btConnState); + return OHOS_FAILURE; + } - if (phoneCall == NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] no incoming"); - return OHOS_SUCCESS; + for (int32_t i = 0; i < MULTI_CALL_MAX_NUME; i++) { + if (tmp->lastStatus == HFP_HF_CALL_STATE_INCOMING || tmp->lastStatus == HFP_HF_CALL_STATE_WAITING) { + phoneCall = tmp; } + tmp++; + } - ret = hfp_hf_reject_incoming_call(&g_bdAddr); - if (ret != ERRCODE_BT_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[RejectIncomingCall] hfp_hf_reject_incoming_call error ret = %d", ret); - return OHOS_FAILURE; - } - g_finishOperate = OPERATE_WATCH_REJECT; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RejectIncomingCall] success!"); + if (phoneCall == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[AcceptIncomingCall] no incoming"); return OHOS_SUCCESS; } - // 手表结束通话 - int FinishCall(void) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FinishCall] start"); - - if (g_btConnState != PROFILE_STATE_CONNECTED) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FinishCall] BT connStatus: 0x%X", g_btConnState); - return OHOS_FAILURE; - } - int ret = hfp_hf_finish_call(&g_bdAddr); - if (ret != ERRCODE_BT_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FinishCall] hfp_hf_finish_call error ret = %d", ret); - return OHOS_FAILURE; - } - g_finishOperate = OPERATE_WATCH_FINISH; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[FinishCall] success!"); - return OHOS_SUCCESS; + int32_t ret = hfp_hf_reject_incoming_call(&g_bdAddr); + if (ret != ERRCODE_BT_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[RejectIncomingCall] ret:%d", ret); + return OHOS_FAILURE; } + g_finishOperate = OPERATE_WATCH_REJECT; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[RejectIncomingCall] success!"); + return OHOS_SUCCESS; +} - // 获取当前正在通话路数 - int GetCurrCallNum(void) - { - return g_currCallNum; - } - - /** - * @brief 获取当前通话路数和对应的通话信息 - * - * @param callList 用来接收通话信息,需调用者分配空间,大小为MULTI_CALL_MAX_NUME * sizeof(PhoneCallInfo) - * @param listNum callList中PhoneCallInfo个数,大小为MULTI_CALL_MAX_NUME - * @param retNum 接收当前正在进行的通话路数 - * @return 返回值 成功返回0,失败返回错误码 - */ - int GetCallInfoInCallList(PhoneCallInfo callList[], int listNum, int *retNum) - { - int i, len; - PhoneCallInfo *tmp = g_callList; - PhoneCallInfo *tmp2 = callList; - - if (callList == NULL || listNum < MULTI_CALL_MAX_NUME) - { - *retNum = 0; - return OHOS_FAILURE; - } +// 手表结束通话 +int FinishCall(void) +{ + if (g_btConnState != PROFILE_STATE_CONNECTED) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FinishCall] BT connStatus: 0x%X", g_btConnState); + return OHOS_FAILURE; + } + int ret = hfp_hf_finish_call(&g_bdAddr); + if (ret != ERRCODE_BT_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[FinishCall] ret:%d", ret); + return OHOS_FAILURE; + } + g_finishOperate = OPERATE_WATCH_FINISH; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "FinishCall"); + return OHOS_SUCCESS; +} - if (g_currCallNum == 0) - { - *retNum = 0; - return OHOS_SUCCESS; - } +// 获取当前正在通话路数 +int GetCurrCallNum(void) +{ + return g_currCallNum; +} - len = sizeof(PhoneCallInfo); - for (i = 0; i < MULTI_CALL_MAX_NUME; i++) - { - if (tmp->lastStatus == HFP_HF_CALL_STATE_FINISHED) - { - tmp++; - } - else - { - (void)memcpy_s(tmp2, len, tmp, len); - tmp++; - tmp2++; - } - } +/** + * @brief 获取当前通话路数和对应的通话信息 + * + * @param callList 用来接收通话信息,需调用者分配空间,大小为MULTI_CALL_MAX_NUME * sizeof(PhoneCallInfo) + * @param listNum callList中PhoneCallInfo个数,大小为MULTI_CALL_MAX_NUME + * @param retNum 接收当前正在进行的通话路数 + * @return 返回值 成功返回0,失败返回错误码 + */ +int GetCallInfoInCallList(PhoneCallInfo callList[], int listNum, int *retNum) +{ + PhoneCallInfo *tmp = g_callList; + PhoneCallInfo *tmp2 = callList; + + if (callList == nullptr || listNum < MULTI_CALL_MAX_NUME) { + *retNum = 0; + return OHOS_FAILURE; + } - *retNum = g_currCallNum; + if (g_currCallNum == 0) { + *retNum = 0; return OHOS_SUCCESS; } - // 获取当前通话音量大小 (0 - 15) - // hfp音量范围 0-15, media 音量范围 0-100 - unsigned char GetCallCurrVolume(void) - { - int volume; - int minVolume; - int maxVolume; - unsigned char hfpVolume; + int32_t len = sizeof(PhoneCallInfo); + for (int32_t i = 0; i < MULTI_CALL_MAX_NUME; i++) { + if (tmp->lastStatus == HFP_HF_CALL_STATE_FINISHED) { + tmp++; + } else { + (void)memcpy_s(tmp2, len, tmp, len); + tmp++; + tmp2++; + } + } - volume = PhoneAudioGetVolume(); - minVolume = PhoneAudioGetMinVolume(); - maxVolume = PhoneAudioGetMaxVolume(); - hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换 + *retNum = g_currCallNum; + return OHOS_SUCCESS; +} - if (volume != 0 && hfpVolume == 0) - { - hfpVolume = 1; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume = %d, minVolume = %d, maxVolume = %d, hfpVolume = %d", - volume, minVolume, maxVolume, hfpVolume); - return hfpVolume; - } - - void SetSpeakerVolume(unsigned char hfpVolume) - { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] start, hfpVolume = %d", hfpVolume); - int ret, minVolume, maxVolume, volume; - - minVolume = PhoneAudioGetMinVolume(); - maxVolume = PhoneAudioGetMaxVolume(); - volume = hfpVolume * (maxVolume - minVolume) / CALL_VOLUME_MAX; // 转换 - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] minVolume = %d, maxVolume = %d, volume = %d", - minVolume, maxVolume, volume); - - ret = PhoneAudioSetVolume(volume); - if (ret != true) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] PhoneAudioSetVolume ret = %d", ret); - return; - } +// 获取当前通话音量大小 (0 - 15) +// hfp音量范围 0-15, media 音量范围 0-100 +unsigned char GetCallCurrVolume(void) +{ + int32_t volume = PhoneAudioGetVolume(); + int32_t minVolume = PhoneAudioGetMinVolume(); + int32_t maxVolume = PhoneAudioGetMaxVolume(); + unsigned char hfpVolume = (unsigned char)((volume * CALL_VOLUME_MAX) / (maxVolume - minVolume)); // 转换 - ret = hfp_hf_set_volume(&g_bdAddr, HFP_VOLUME_SPEAKER, hfpVolume); - if (ret != ERRCODE_BT_SUCCESS) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] set_volume fail ret = %d, hfpVolume = %d", - ret, hfpVolume); - return; - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] success!"); + if (volume != 0 && hfpVolume == 0) { + hfpVolume = 1; + } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[GetCallCurrVolume] volume:%d, minVolume:%d, maxVolume:%d, hfpVolume:%d", + volume, minVolume, maxVolume, hfpVolume); + return hfpVolume; +} +void SetSpeakerVolume(unsigned char hfpVolume) +{ + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] start, hfpVolume:%d", hfpVolume); + int32_t minVolume = PhoneAudioGetMinVolume(); + int32_t maxVolume = PhoneAudioGetMaxVolume(); + int32_t volume = hfpVolume * (maxVolume - minVolume) / CALL_VOLUME_MAX; // 转换 + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] minVolume:%d, maxVolume:%d, volume:%d", + minVolume, maxVolume, volume); + + int32_t ret = PhoneAudioSetVolume(volume); + if (!ret) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] PhoneAudioSetVolume ret:%d", ret); return; } - // 设置通话speaker静音 - bool SetSpeakerMute(bool isMute) - { - return PhoneAudioSetSpeakerMute(isMute); + ret = hfp_hf_set_volume(&g_bdAddr, HFP_VOLUME_SPEAKER, hfpVolume); + if (ret != ERRCODE_BT_SUCCESS) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] set_volume ret:%d, hfpVolume:%d", + ret, hfpVolume); + return; } + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[SetSpeakerVolume] success!"); - // 设置通话mic静音/取消静音 - bool SetMicMute(bool isMute) - { - return PhoneAudioSetMicMute(isMute); - } + return; +} - // 获取SCO的连接状态 - int GetScoConnectState(void) - { - return g_scoFlag; - } +// 设置通话speaker静音 +bool SetSpeakerMute(bool isMute) +{ + return PhoneAudioSetSpeakerMute(isMute); +} - // 通话转移到手表 - int TransCallToWatch(void) - { - int ret; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[TransCallToWatch] start"); +// 设置通话mic静音/取消静音 +bool SetMicMute(bool isMute) +{ + return PhoneAudioSetMicMute(isMute); +} - if (g_btConnState != PROFILE_STATE_CONNECTED) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToWatch] BT connStatus: 0x%X", g_btConnState); - return OHOS_FAILURE; - } +// 获取SCO的连接状态 +int GetScoConnectState(void) +{ + return g_scoFlag; +} - ret = GetScoConnectState(); - if (ret == HFP_SCO_STATE_CONNECTED || ret == HFP_SCO_STATE_CONNECTING) - { - return OHOS_SUCCESS; - } - else - { - ret = hfp_hf_connect_sco(&g_bdAddr); - if (ret != 0) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToWatch] ret = %d", ret); - } - return ret; +// 通话转移到手表 +int TransCallToWatch(void) +{ + int ret; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[TransCallToWatch] start"); + + if (g_btConnState != PROFILE_STATE_CONNECTED) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToWatch] BT connStatus: 0x%X", g_btConnState); + return OHOS_FAILURE; + } + + ret = GetScoConnectState(); + if (ret == HFP_SCO_STATE_CONNECTED || ret == HFP_SCO_STATE_CONNECTING) { + return OHOS_SUCCESS; + } else { + ret = hfp_hf_connect_sco(&g_bdAddr); + if (ret != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToWatch] ret:%d", ret); } + return ret; } +} - // 通话转移到手机 - int TransCallToMobilePhone(void) - { - int ret; - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[TransCallToMobilePhone] start"); +// 通话转移到手机 +int TransCallToMobilePhone(void) +{ + int ret; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "[TransCallToMobilePhone] start"); - if (g_btConnState != PROFILE_STATE_CONNECTED) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToMobilePhone] BT connStatus: 0x%X", g_btConnState); - return OHOS_FAILURE; - } + if (g_btConnState != PROFILE_STATE_CONNECTED) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToMobilePhone] BT connStatus: 0x%X", g_btConnState); + return OHOS_FAILURE; + } - ret = GetScoConnectState(); - if (ret == HFP_SCO_STATE_DISCONNECTED || ret == HFP_SCO_STATE_DISCONNECTING) - { - return OHOS_SUCCESS; - } - else - { - ret = hfp_hf_disconnect_sco(&g_bdAddr); - if (ret != 0) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToMobilePhone] ret = %d", ret); - } - return ret; + ret = GetScoConnectState(); + if (ret == HFP_SCO_STATE_DISCONNECTED || ret == HFP_SCO_STATE_DISCONNECTING) { + return OHOS_SUCCESS; + } else { + ret = hfp_hf_disconnect_sco(&g_bdAddr); + if (ret != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[TransCallToMobilePhone] ret:%d", ret); } + return ret; } +} #ifdef __cplusplus } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersModel.h b/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersModel.h index 724c7394d..61e90947c 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersModel.h @@ -8,7 +8,7 @@ #ifndef PLAYERS_MODEL_H #define PLAYERS_MODEL_H -#include "stdio.h" +#include #include "gfx_utils/list.h" #include "UiServersMsg.h" #include "player.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersPresenter.h index 7446839c5..f955b7142 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersPresenter.h @@ -108,8 +108,7 @@ private: void SoundButtonOnClick(); void PlayerModelButtonOnClick(); void OptionsButtonOnClick(); - VolumeSettingView *volumeSetting{nullptr}; - UIViewGroup *volumeSettingView{nullptr}; + VolumeSettingView *volumeSettingView{nullptr}; }; // 播放器回调 @@ -159,7 +158,7 @@ class PlayerOnDragListener : public UIView::OnDragListener { public: PlayerOnDragListener(); ~PlayerOnDragListener(); - virtual bool OnDragEnd(UIView& view, const DragEvent& event) override; + bool OnDragEnd(UIView& view, const DragEvent& event) override; bool OnDrag(UIView& view, const DragEvent& event) override; static PlayerOnDragListener *GetInstance(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersView.h b/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersView.h index 6be9d5a5c..5ad0ba1ec 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/include/PlayersView.h @@ -35,7 +35,7 @@ class PlayersCaseListAdapter; class PlayersView : public UICardPage { public: PlayersView(); - virtual ~PlayersView(); + ~PlayersView() override; static PlayersView *GetInstance(void); bool InitView(void); void PreLoad(void) override; @@ -101,7 +101,7 @@ private: JumpView *jumpView{nullptr}; PlayersPresenter *playersPresenter{nullptr}; PlayerOnDragListener *playerOnDragListener{nullptr}; - uint8_t state = UICheckBox::UICheckBoxState::MAX_STATUS_NUM; + uint8_t state_ = UICheckBox::UICheckBoxState::MAX_STATUS_NUM; UIView::OnClickListener *playerlistener{nullptr}; UIView::OnClickListener *soundlistener{nullptr}; UIView::OnClickListener *nextlistener{nullptr}; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/src/BluetoothView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/player/src/BluetoothView.cpp index b6534909a..dfae52888 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/src/BluetoothView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/src/BluetoothView.cpp @@ -43,13 +43,12 @@ BluetoothView::BluetoothView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothView::BluetoothView"); g_bluetoothView = this; - } BluetoothView::~BluetoothView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothView::~BluetoothView"); - group->RemoveAll(); + group->RemoveAll(); UIView::OnClickListener *click = watchButton->GetOnClickListener(); if (click != nullptr) { delete click; @@ -116,7 +115,7 @@ UIRadioButton *BluetoothView::GetPhoneButton(void) // Button OnClick class BluetoothOnClickListener : public UIView::OnClickListener { public: - BluetoothOnClickListener(UIView* view) : view_(view){} + explicit BluetoothOnClickListener(UIView* view) : view_(view) {} ~BluetoothOnClickListener() {} bool OnClick(UIView& view, const ClickEvent& event) override diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersCaseListAdapter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersCaseListAdapter.cpp index a6547efa4..b9e550257 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersCaseListAdapter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersCaseListAdapter.cpp @@ -65,8 +65,7 @@ bool BtnOnClickListListener::OnClick(UIView& view, const ClickEvent& event) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "uri: %s.", PlayersModel::GetInstance()->GetPlayerUri().c_str()); std::string strSongName = sliceId_; std::string pureName = strSongName.substr(0, strSongName.rfind(".")); - const char *songName = pureName.c_str(); - playersView->TitleSetText(songName); + playersView->TitleSetText(pureName.c_str()); playersView->SetPlayerListGroupStatus(false); // 刷新UI RootView::GetInstance()->Invalidate(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersModel.cpp index fbcd64fd8..4e4462847 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersModel.cpp @@ -33,7 +33,7 @@ PlayersModel::~PlayersModel() bool PlayersModel::FetchedPlayersCallBack(PlayersMsg *playersMsg) { - if (listPlayers.IsEmpty() == true) { + if (listPlayers.IsEmpty()) { return false; } else { MUTEX_Lock(g_mutex); @@ -140,7 +140,7 @@ bool PlayersModel::GetAudioInitStatus(void) void PlayersModel::AudioInit(void) { - if (audioInitStatus == true) { + if (audioInitStatus) { return; } AudioManager& amIntance = AudioManager::GetInstance(); @@ -195,7 +195,7 @@ void PlayersModel::PlaySwitching(void) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlaySwitching playerModel1 %d!!!", GetPlayerModel()); int32_t ret; PlayersMsg playersMsg; - if (FetchedPlayersCallBack(&playersMsg) == true) { + if (FetchedPlayersCallBack(&playersMsg)) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "FetchedPlayersCallBack true"); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Stop to play"); switch (playersMsg.playerModel) { @@ -239,7 +239,6 @@ int PlayersModel::PlayerInit(void) } std::string strSongName = sliceId; std::string pureName = strSongName.substr(0, strSongName.rfind(".")); - const char *songName = pureName.c_str(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayerInit, url: %s ", sliceId); std::string strSrcMusic(APP_MUSIC_PATH); std::string tempStr("/"); @@ -251,7 +250,7 @@ int PlayersModel::PlayerInit(void) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayerInit playersPresenter GetInstance fail"); return OHOS_FAILURE; } - playersPresenter->SetTitleSetText(songName); + playersPresenter->SetTitleSetText(pureName.c_str()); playersPresenter->SetPlaybackProgress(circleProgress); playersPresenter->SetPlayerState(playButtonState); return 0; @@ -274,10 +273,9 @@ void PlayersModel::NextSong(int16_t index) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "uri: %s.", GetPlayerUri().c_str()); std::string strSongName = sliceId; std::string pureName = strSongName.substr(0, strSongName.rfind(".")); - const char *songName = pureName.c_str(); PlayersPresenter *playersPresenter = PlayersPresenter::GetInstance(); if (playersPresenter != nullptr) { - playersPresenter->SetTitleSetText(songName); + playersPresenter->SetTitleSetText(pureName.c_str()); playersPresenter->SetPlaybackProgress(0); // 0:进度0% } int32_t ret; @@ -358,7 +356,7 @@ void PlayersModel::RandomPlayout() { int16_t random; int16_t indexMax; - srand((unsigned)time(NULL)); + srand((unsigned)time(nullptr)); List &playersCaseList = PlayersListGroup::GetInstance()->GetCase(); indexMax = playersCaseList.Size() - 1; random = (rand() % (indexMax + 1)); @@ -687,7 +685,6 @@ void PlayersModel::ConnectBtAndLocalPlay(int32_t connCtState, int32_t connTgStat WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[PlayersModel::ConnBtAndLocalPlay] BTPlayerStat err, ret:%d", ret); } PlayersModel::GetInstance()->SetBTMusicPlay(playNotification); - } } else { if (playerState == PlayerStates::PLAYER_PAUSED) { @@ -700,7 +697,6 @@ void PlayersModel::ConnectBtAndLocalPlay(int32_t connCtState, int32_t connTgStat } } } - } // 蓝牙连接和本地音乐的暂停 diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersPresenter.cpp index 3a22d8c53..98510eb9e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersPresenter.cpp @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include "PlayersPresenter.h" #include "wearable_log.h" #include "common/image_cache_manager.h" @@ -219,7 +219,6 @@ bool JumpView::ChangeBluetoothDeviceListView(int16_t hideView, int16_t thisView) } deviceList->RefreshList(); } - BluetoothDeviceListView *bluetoothDeviceListView = BluetoothDeviceListView::GetInstance(); if (bluetoothDeviceListView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnClick bluetoothDeviceListView new fail"); return false; @@ -249,14 +248,13 @@ bool JumpView::ChangeBluetoothReconnectView(int16_t hideView, int16_t thisView) RootView::GetInstance()->Add(container[thisView]); } BluetoothModel::GetInstance()->SetTagDisconnectView(true); - BluetoothReconnectView::GetInstance()->RefreshBluetoothNameLabel(); + bluetoothReconnectView->RefreshBluetoothNameLabel(); bluetoothReconnectView->BtReconnectStart(); return true; } void JumpView::ResetEarListView(int16_t hideView) { - BluetoothEarListView *bluetoothEarListView = BluetoothEarListView::GetInstance(); if (bluetoothEarListView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::ResetEarListView bluetoothEarListView == nullptr"); return; @@ -313,7 +311,6 @@ bool JumpView::ChangeTipsConnFailMessageView(int16_t hideView, int16_t thisView) container[thisView] = group; RootView::GetInstance()->Add(container[thisView]); } - BluetoothReconnectView *bluetoothReconnectView = BluetoothReconnectView::GetInstance(); if (bluetoothReconnectView == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GapAclStateChangedCallback bluetoothReconnectView == nullptr"); } else { @@ -374,14 +371,14 @@ bool JumpView::CheckViewParam(int16_t hideView, int16_t showView) void JumpView::ChangeView(int16_t hideView, int16_t showView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "JumpView:: ChangeView %d", hideView); - if (CheckViewParam(hideView, showView) == false) { + if (!CheckViewParam(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "JumpView::ChangeView check param err %d %d.", hideView, showView); return; } PreprosssChangeView tmpPreProcessView = preProcessView[showView]; - if ((this->*tmpPreProcessView)(hideView, showView) == false) { + if (!(this->*tmpPreProcessView)(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "JumpView::ChangeView %d %d failed", showView, hideView); return; } @@ -456,8 +453,8 @@ int PlayersListGroup::GetAllFiles(List *playersCaseList) // 打开目录 DIR *dirp = opendir(APP_MUSIC_PATH); // 遍历文件 - if (dirp != NULL) { - while ((direntp = readdir(dirp)) != NULL) { + if (dirp != nullptr) { + while ((direntp = readdir(dirp)) != nullptr) { ret = memcpy_s(playerCaseInfo.sliceId, DEC_NUM_256, direntp->d_name, DEC_NUM_256); if (ret != OHOS_SUCCESS) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "memcpy_s err %d.", ret); @@ -536,24 +533,25 @@ void ButtonOnClickListener::SoundButtonOnClick() return; } if (volumeSettingView == nullptr) { - volumeSetting = new VolumeSettingView(); - if (volumeSetting == nullptr) { + volumeSettingView = new VolumeSettingView(); + if (volumeSettingView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "volumeSetting nullptr err"); return; } - if (volumeSetting->SetUpVolume() == false) { + if (!volumeSettingView->SetUpVolume()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "volumeSetting SetUpVolume fail"); return; } - volumeSetting->GetProgress()->SetValue(AudioManager::GetInstance().GetVolume(AUDIO_STREAM_MUSIC)); - if (AudioManager::GetInstance().GetVolume(AUDIO_STREAM_MUSIC) == 0) { - ImageInfo *image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_MUTE_BUTTON, PLAYER_IAMGES); - volumeSetting->GetDecreaseButton()->SetImageSrc(image, image); - } - volumeSettingView = volumeSetting; RootView::GetInstance()->Add(volumeSettingView); } - VolumeSliderEventListener *volumeSliderEventListener = VolumeSliderEventListener::GetInstance(); + int32_t volume = AudioManager::GetInstance().GetVolume(AUDIO_STREAM_MUSIC); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "current volume = %d", volume); + volumeSettingView->GetProgress()->SetValue(volume); + if (volume == 0) { + ImageInfo *image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_MUTE_BUTTON, PLAYER_IAMGES); + volumeSettingView->GetDecreaseButton()->SetImageSrc(image, image); + } + VolumeSliderEventListener *volumeSliderEventListener = volumeSettingView->GetVolumeEventListener(); if (volumeSliderEventListener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SoundButtonOnClick volumeSliderEventListener nullptr err"); return; @@ -822,7 +820,7 @@ static void Resume(void) PlayersView *playersView = PlayersView::GetInstance(); player->GetPlayerState(state); - if (state == PLAYER_PAUSED && PlayerIntrptListener->IsPaused() == true) { + if (state == PLAYER_PAUSED && PlayerIntrptListener->IsPaused()) { ret = player->Play(); if (ret == 0) { if (playersView == nullptr) { @@ -906,7 +904,7 @@ void PlayerOnDragListener::OnDragChangView(const DragEvent& event, int16_t hideV { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnDragChangeView=%d showView=%d", hideView, showView); if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { - if (isStopScan == true) { + if (isStopScan) { BluetoothEarPhoneView *bluetoothEarPhoneView = BluetoothEarPhoneView::GetInstance(); if (bluetoothEarPhoneView == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bluetoothEarPhoneView GetInstance fail"); @@ -950,7 +948,7 @@ void PlayerOnDragListener::OnDragChangBluetoothView(const DragEvent& event) void PlayerOnDragListener::DropEarPhoneView(const DragEvent& event) { bool ret = BluetoothModel::GetInstance()->IsTagReturnToDeviceListView(); - if (ret == true) { + if (ret) { OnDragChangView(event, JumpView::BluetoothJumpViewNum::BLUETOOTHEARPHONEVIEW, JumpView::BluetoothJumpViewNum::BLUETOOTHDEVICELISTVIEW, true); } else { @@ -965,8 +963,8 @@ void PlayerOnDragListener::DropEarListView(const DragEvent& event) if (ret) { BluetoothCaseInfo *caseInfo = BluetoothModel::GetInstance()->GetTempMacValue(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayerOnDragListener::DropEarListView Addr: %02x%02x%02x%02x%02x%02x", - caseInfo->addr[5], caseInfo->addr[4], caseInfo->addr[3], /* mac下标 0 1 2 3 4 5 */ - caseInfo->addr[2], caseInfo->addr[1], caseInfo->addr[0]); /* mac下标 0 1 2 3 4 5 */ + caseInfo->addr[5], caseInfo->addr[4], caseInfo->addr[3], /* mac下标 0 1 2 3 4 5 */ + caseInfo->addr[2], caseInfo->addr[1], caseInfo->addr[0]); /* mac下标 0 1 2 3 4 5 */ errcode_t retVal = gap_disconnect_remote_device((const bd_addr_t *)caseInfo->addr); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayerOnDragListener::DropEarListView gap_disconnect_remote_device retVal = %d", retVal); } @@ -1026,13 +1024,13 @@ void PlayerOnDragListener::CorrespondingJump(const DragEvent& event, int16_t hid WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainBluetoothView::DropView bluetoothModel == nullptr"); return; } - if (bluetoothModel->GetTagReconnectJump() == true) { + if (bluetoothModel->GetTagReconnectJump()) { OnDragChangView(event, hideView, JumpView::BluetoothJumpViewNum::BLUETOOTHEOPTIONSVIEW, false); } else { std::list &bluetoothScanList = BluetoothModel::GetInstance()->GetCase(); bool ret = bluetoothScanList.empty(); - if (ret != true) { + if (!ret) { OnDragChangView(event, hideView, JumpView::BluetoothJumpViewNum::BLUETOOTHEARLISTVIEW, false); } else { @@ -1091,8 +1089,8 @@ void PlayersPresenter::OnClickCancelConnedRequestButton(void) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "CancelConnedRequestButton OnClick"); BluetoothCaseInfo *caseInfo = BluetoothModel::GetInstance()->GetTempMacValue(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ClickCancelConnedRequestButton Addr: %02x%02x%02x%02x%02x%02x", - caseInfo->addr[5], caseInfo->addr[4], caseInfo->addr[3], /* mac下标 0 1 2 3 4 5 */ - caseInfo->addr[2], caseInfo->addr[1], caseInfo->addr[0]); /* mac下标 0 1 2 3 4 5 */ + caseInfo->addr[5], caseInfo->addr[4], caseInfo->addr[3], /* mac下标 0 1 2 3 4 5 */ + caseInfo->addr[2], caseInfo->addr[1], caseInfo->addr[0]); /* mac下标 0 1 2 3 4 5 */ errcode_t retVal = gap_disconnect_remote_device((const bd_addr_t *)caseInfo->addr); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "OnClickCancelConnedRequestButton DisconnectRemoteDevice retVal = %d", retVal); @@ -1174,14 +1172,14 @@ void PlayersPresenter::OnClickButtonOptionOne(void) return; } BluetoothModel::GetInstance()->SetBtStatus(); - if (BluetoothModel::GetInstance()->GetAclConnected() == true) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersPresenter::OnClickButtonOptionOne GetAclConnected() == true"); + if (BluetoothModel::GetInstance()->GetAclConnected()) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersPresenter::OnClickButtonOptionOne GetAclConnected()"); BluetoothModel::GetInstance()->SetTagConnectNew(false); bluetoothOptionsView->SetBtDisconnect(); jumpView->ChangeView(JumpView::BluetoothJumpViewNum::BLUETOOTHEOPTIONSVIEW, JumpView::BluetoothJumpViewNum::BLUETOOTHDEVICELISTVIEW); } else { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersPresenter::OnClickButtonOptionOne GetAclConnected() ==false"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersPresenter::OnClickButtonOptionOne GetAclConnected() fail"); BluetoothModel::GetInstance()->SetTagReconnectJump(true); // 重连动画 jumpView->ChangeView(JumpView::BluetoothJumpViewNum::BLUETOOTHEOPTIONSVIEW, @@ -1189,8 +1187,8 @@ void PlayersPresenter::OnClickButtonOptionOne(void) // 判断是否正在连接 bd_addr_t *lastAddr = BluetoothModel::GetInstance()->GetLastConnedAddr(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothPresenter::ClickOptionsOneButton lastAddr: %02x%02x%02x%02x%02x%02x", - lastAddr->addr[5], lastAddr->addr[4], lastAddr->addr[3], /* mac下标 0 1 2 3 4 5 */ - lastAddr->addr[2], lastAddr->addr[1], lastAddr->addr[0]); /* mac下标 0 1 2 3 4 5 */ + lastAddr->addr[5], lastAddr->addr[4], lastAddr->addr[3], /* mac下标 0 1 2 3 4 5 */ + lastAddr->addr[2], lastAddr->addr[1], lastAddr->addr[0]); /* mac下标 0 1 2 3 4 5 */ if (bt_is_acl_connected(lastAddr)) { BluetoothModel::GetInstance()->SetTagConnectNew(true); bluetoothOptionsView->SetBtDisconnect(); @@ -1222,7 +1220,7 @@ void PlayersPresenter::OnClickSetting(void) // 设备列表 List &bluetoothCaseList = BluetoothModel::GetInstance()->GetConnedDevicesCase(); bool ret = bluetoothCaseList.IsEmpty(); - if (ret != true) { + if (!ret) { jumpView->ChangeView(JumpView::BluetoothJumpViewNum::BLUETOOTHEVIEW, JumpView::BluetoothJumpViewNum::BLUETOOTHDEVICELISTVIEW); } else { @@ -1345,7 +1343,7 @@ void PlayersPresenter::SetPlayerState(bool value) WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SetPlayerState playersView GetInstance fail"); return; } - if (value != false) { + if (value) { playersView->SetPlayerButtonState(UICheckBox::UICheckBoxState::SELECTED); PlayersModel::GetInstance()->SetPlayButtonState(false); } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersView.cpp index e64666b3e..c5bbc47ea 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/player/src/PlayersView.cpp @@ -4,7 +4,7 @@ * Author: * Create: 2021-07-26 */ -#include +#include #include #include "common/image_cache_manager.h" #include "ui_resource_image.h" @@ -32,9 +32,9 @@ PlayersView::PlayersView() PlayersView::~PlayersView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersView::~PlayersView"); - if (viewiInitStatus == true) { - state = GetPlayerButtonState(); - if (state == UICheckBox::UICheckBoxState::SELECTED) { + if (viewiInitStatus) { + state_ = GetPlayerButtonState(); + if (state_ == UICheckBox::UICheckBoxState::SELECTED) { PlayersModel::GetInstance()->SetPlayButtonState(true); } RemoveAll(); @@ -80,7 +80,6 @@ void PlayersView::TitleSetText(const char *text) titleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); titleLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); - } void PlayersView::PlayerModelButtonSetSrc(uint32_t playMode) @@ -157,7 +156,7 @@ UICheckBox::UICheckBoxState PlayersView::GetPlayerButtonState(void) void PlayersView::SetPlayerButtonState(UICheckBox::UICheckBoxState state) { if (playerButton == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayersView::SetPlayerButtonState playerButton NULL"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "PlayersView::SetPlayerButtonState playerButton nullptr"); return; } return playerButton->SetState(state); @@ -171,7 +170,7 @@ UIList *PlayersView::GetPlayerList(void) void PlayersView::SetPlayerListGroupStatus(bool status) { if (listGroup == nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersView listGroup is NULL"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "PlayersView listGroup is nullptr"); return; } UIView *vew = MainViewSample::GetInstance()->GetMainViewGroup(); @@ -301,7 +300,7 @@ int PlayersView::ShowUpCheckBoxButton() soundButton->SetTouchable(true); soundButton->SetPosition(178, 316, 95, 76); // 178:x 316:y 95:width 76:height soundButton->SetOnClickListener(soundlistener); - if (LoadPlayerImage(soundButton, PLAYER_SOUND_IMAGE) == false) { + if (!LoadPlayerImage(soundButton, PLAYER_SOUND_IMAGE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "playerModelButton LoadPlayerImage fail"); return false; } @@ -344,7 +343,7 @@ int PlayersView::ShowUpButton() playerModelButton->SetTouchable(true); playerModelButton->SetPosition(pointBtn.x, pointBtn.y, 95, 76); // 95:width 76:height playerModelButton->SetOnClickListener(modellistener); - if (ShowUpPlayerMode() == false) { + if (!ShowUpPlayerMode()) { return OHOS_FAILURE; } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "playerModel %d", PlayersModel::GetInstance()->GetPlayerModel()); @@ -356,22 +355,22 @@ int PlayersView::ShowUpButton() bool PlayersView::ShowUpPlayerMode() { if (PlayersModel::GetInstance()->GetPlayerModel() == LOOP) { - if (LoadPlayerImage(playerModelButton, PLAYER_PLAYERSMODEL_LOOP) == false) { + if (!LoadPlayerImage(playerModelButton, PLAYER_PLAYERSMODEL_LOOP)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "load PLAYER_PLAYERSMODEL_LOOP fail"); return false; } } else if (PlayersModel::GetInstance()->GetPlayerModel() == SEQUENCE) { - if (LoadPlayerImage(playerModelButton, PLAYER_PLAYERSMODEL_SEQUENCE) == false) { + if (!LoadPlayerImage(playerModelButton, PLAYER_PLAYERSMODEL_SEQUENCE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "load PLAYERSMODEL_SEQUENCE fail"); return false; } } else if (PlayersModel::GetInstance()->GetPlayerModel() == REPEATS) { - if (LoadPlayerImage(playerModelButton, PLAYER_PLAYERSMODEL_REPEATS) == false) { + if (!LoadPlayerImage(playerModelButton, PLAYER_PLAYERSMODEL_REPEATS)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "load PLAYERSMODEL_REPEATS fail"); return false; } } else if (PlayersModel::GetInstance()->GetPlayerModel() == RANDOM) { - if (LoadPlayerImage(playerModelButton, PLAYER_PLAYERSMODEL_RANDOM) == false) { + if (!LoadPlayerImage(playerModelButton, PLAYER_PLAYERSMODEL_RANDOM)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "load PLAYERSMODEL_RANDOM fail"); return false; } @@ -381,8 +380,7 @@ bool PlayersView::ShowUpPlayerMode() int PlayersView::ShowUpButtonView() { - int ret; - ret = ShowUpCheckBoxButton(); + int32_t ret = ShowUpCheckBoxButton(); if (ret == OHOS_FAILURE) { return OHOS_FAILURE; } @@ -510,7 +508,7 @@ bool PlayersView::InitBackGround(void) } } backGround->SetPosition(0, 0, HORIZONTAL_RESOLUTION, VERTICAL_RESOLUTION); - if (LoadPlayerImage(backGround, PLAYER_BACK_GROUND) == false) { + if (!LoadPlayerImage(backGround, PLAYER_BACK_GROUND)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "backGround LoadPlayerImage fail"); return false; } @@ -563,7 +561,7 @@ bool PlayersView::InitView(void) int ret; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, " PlayersView InitView"); - if (InitBackGround() == false) { + if (!InitBackGround()) { return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/include/RebootModel.h b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/include/RebootModel.h index 223c3f36e..f3313ad86 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/include/RebootModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/include/RebootModel.h @@ -16,7 +16,6 @@ enum RebootModelView : uint8_t { SHUTDOWNDEVICE, }; -using namespace std; class RebootModel { public: ~RebootModel(); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp index a98af032b..dba1ce021 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootDeviceView.cpp @@ -87,7 +87,7 @@ UIViewGroup *RebootDeviceView::InitShowUpView(void) group->SetHeight(VERTICAL_RESOLUTION); } ret = ShowUpRebootDeviceView(); - if (ret == false) { + if (!ret) { return nullptr; } group->Add(rebootDeviceLabel); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootView.cpp index 1718954c0..b8462fe34 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/RebootView.cpp @@ -176,14 +176,14 @@ UIViewGroup *RebootView::InitShowUpView(void) group->SetHeight(VERTICAL_RESOLUTION); } ret = ShowUpRebootView(); - if (ret == false) { + if (!ret) { return nullptr; } group->Add(rebootLabel); group->Add(rebootButton); ret = ShowUpShutdownView(); - if (ret == false) { + if (!ret) { return nullptr; } group->Add(shutdownLabel); @@ -204,12 +204,12 @@ bool RebootView::ChangeRebootView(int16_t hideView, int16_t thisView) { UNUSED(hideView); // init view - UIViewGroup *group = InitShowUpView(); - if (group == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail"); + UIViewGroup *viewGroup = InitShowUpView(); + if (viewGroup == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "viewGroup nullptr fail"); return false; } - container[thisView] = group; + container[thisView] = viewGroup; RootView::GetInstance()->Add(container[thisView]); return true; } @@ -225,12 +225,12 @@ bool RebootView::ChangeRebootDeviceView(int16_t hideView, int16_t thisView) return false; } // init view - UIViewGroup *group = rebootDeviceView->InitShowUpView(); - if (group == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail"); + UIViewGroup *viewGroup = rebootDeviceView->InitShowUpView(); + if (viewGroup == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "viewGroup nullptr fail"); return false; } - container[thisView] = group; + container[thisView] = viewGroup; RootView::GetInstance()->Add(container[thisView]); } return true; @@ -247,12 +247,12 @@ bool RebootView::ChangeShutdownDeviceView(int16_t hideView, int16_t thisView) return false; } // init view - UIViewGroup *group = shutdownDeviceView->InitShowUpView(); - if (group == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "group nullptr fail"); + UIViewGroup *viewGroup = shutdownDeviceView->InitShowUpView(); + if (viewGroup == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "viewGroup nullptr fail"); return false; } - container[thisView] = group; + container[thisView] = viewGroup; RootView::GetInstance()->Add(container[thisView]); } return true; @@ -277,14 +277,14 @@ void RebootView::ChangeView(int16_t hideView, int16_t showView) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "RebootView::ChangeView %d, %d", hideView, showView); - if (CheckViewParam(hideView, showView) == false) { + if (!CheckViewParam(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootView::CheckViewParam failed."); return; } PreprosssChangeView tmpPreProcessView = preProcessView[showView]; - if ((this->*tmpPreProcessView)(hideView, showView) == false) { + if (!(this->*tmpPreProcessView)(hideView, showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RebootView::ChangeView %d %dfailed", showView, hideView); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp index 74ce3a6a9..e3d74ec18 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/rebootdevice/src/ShutdownDeviceView.cpp @@ -88,7 +88,7 @@ UIViewGroup *ShutdownDeviceView::InitShowUpView(void) } ret = ShowUpShutdownDeviceView(); - if (ret == false) { + if (!ret) { return nullptr; } group->Add(shutdownDeviceLabel); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/rtcservice/src/RtcService.cpp b/code/sdk/application/wearable/nativeapp/nativeui/rtcservice/src/RtcService.cpp index 4178ba76a..8e13b59db 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/rtcservice/src/RtcService.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/rtcservice/src/RtcService.cpp @@ -4,8 +4,8 @@ * Create: 2021-09-22 */ -#include -#include +#include +#include #include "memory_adapter.h" #include "ohos_init.h" #include "samgr_lite.h" @@ -37,7 +37,7 @@ static RtcService g_rtcService = { .MessageHandle = ServiceMessageHandle, .GetTaskConfig = GetServiceTaskConfig, .subscirber = { - .identity = NULL, + .identity = nullptr, .args = &g_rtcService, .Notify = Notify, }, @@ -96,18 +96,18 @@ static TaskConfig GetServiceTaskConfig(Service *service) static void SubscribeTopic(Topic topic) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Rtc Subscribe Topic=%u!!", topic); - BroadcastApi *broadcastApi = NULL; + BroadcastApi *broadcastApi = nullptr; IUnknown *api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); - if (api == NULL) { + if (api == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SubscribeTopic GetFeatureApi %s %s failed!!", - BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); + BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); return; } int result = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi); - if (result != 0 || broadcastApi == NULL) { + if (result != 0 || broadcastApi == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "SubscribeTopic QueryInterface %s %s failed!!", - BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); + BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); return; } @@ -119,18 +119,18 @@ static void SubscribeTopic(Topic topic) void UnsubscribeTopic(Topic topic) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Rtc Unsubscribe Topic=%u!!", topic); - BroadcastApi *broadcastApi = NULL; + BroadcastApi *broadcastApi = nullptr; IUnknown *api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); - if (api == NULL) { + if (api == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UnsubscribeTopic GetFeatureApi %s %s failed!!", - BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); + BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); return; } int result = api->QueryInterface(api, DEFAULT_VERSION, (void **)&broadcastApi); - if (result != 0 || broadcastApi == NULL) { + if (result != 0 || broadcastApi == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "UnsubscribeTopic QueryInterface %s %s failed!!", - BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); + BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); return; } @@ -144,7 +144,7 @@ static void Notify(void *args, const Topic topic, Request* req) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Rtc Notify:"); AlarmClockQueueMsg eventMsg; - if (req == NULL || args == NULL) { + if (req == nullptr || args == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "Notify para invalid!!"); return; } @@ -155,7 +155,7 @@ static void Notify(void *args, const Topic topic, Request* req) eventMsg.eventType = EVENT_ALARM_RING; AlmmgrAlarmClockEventProcess(&eventMsg); } else if (topic == TOPIC_EVENT_NEXTDAY_UPDATE) { - UpdataListAndFirstAlarmToday(); + UpdataListAndFirstAlarmToday(); } else if (topic == TOPIC_EVENT_UTCTIME_UPDATE) { UpdataListAndFirstAlarmToday(); } else { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/screennotify/include/ui_screennotify.h b/code/sdk/application/wearable/nativeapp/nativeui/screennotify/include/ui_screennotify.h index 6b673ba8a..4d202759a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/screennotify/include/ui_screennotify.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/screennotify/include/ui_screennotify.h @@ -44,9 +44,3 @@ uint32_t get_back_to_home_interval(void); #endif #endif // OHOS_UI_SCREENNOTIFY_H - - - - - - diff --git a/code/sdk/application/wearable/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp b/code/sdk/application/wearable/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp index 07627da97..d9658eb29 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/screennotify/src/ui_screennotify.cpp @@ -1,5 +1,5 @@ #include -#include "stdio.h" +#include #include "ability_state.h" #include "cmsis_os2.h" #include "common_def.h" @@ -9,7 +9,6 @@ #include "power_display_service.h" #include "NativeAbility.h" #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "MainViewSample.h" #include "ui_screennotify.h" @@ -59,17 +58,23 @@ static void ChangeToHomeView(void) void notify_screen_on_event(void) { - for (auto callback : g_callback) { - callback(SCREEN_STATUS_ON); - } - GraphicService::GetInstance()->PostGraphicEvent(ChangeToHomeView); + GraphicService::GetInstance()->PostGraphicEvent( + [&] { + for (auto callback : g_callback) { + callback(SCREEN_STATUS_ON); + } + ChangeToHomeView(); + }); } void notify_screen_off_event(void) { - for (auto callback : g_callback) { - callback(SCREEN_STATUS_OFF); - } + GraphicService::GetInstance()->PostGraphicEvent( + [&] { + for (auto callback : g_callback) { + callback(SCREEN_STATUS_OFF); + } + }); } void set_back_to_home_interval(uint32_t time_sec) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp b/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp index 5eebb9819..6f37eb835 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/screensetting/src/ScreenModels.cpp @@ -8,7 +8,7 @@ #include "wearable_log.h" #include "iostream" #include -#include "stdio.h" +#include #include #include #include "kvstore_env.h" diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardAdapter.h b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardAdapter.h index 417891c87..75b9ba8d0 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardAdapter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardAdapter.h @@ -23,18 +23,24 @@ namespace OHOS { class SetCardAdapter : public AbstractAdapter { public: explicit SetCardAdapter(); - virtual ~SetCardAdapter(); + ~SetCardAdapter() override; - virtual uint16 GetCount(void) override; + uint16 GetCount(void) override; - virtual UIView *GetView(UIView *inView, int16 index) override; + UIView *GetView(UIView *inView, int16 index) override; - virtual void AddListItem(const CardInfo &item); + void AddListItem(const CardInfo &item); + + void SetItemClickListener(UIView::OnClickListener *itemClickListener) + { + itemClickListener_ = itemClickListener; + } void ClearItem(void); private: std::list listData_; + UIView::OnClickListener *itemClickListener_; }; } #endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardDeleteView.h b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardDeleteView.h index 99b0c8c2a..6abfe4ee1 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardDeleteView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardDeleteView.h @@ -15,7 +15,7 @@ namespace OHOS { class SetCardDeleteView : public UIViewGroup { public: SetCardDeleteView(SetCardPresenter *presenter); - virtual ~SetCardDeleteView(); + ~SetCardDeleteView() override; bool InitView(); private: SetCardPresenter *presenter_; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardItem.h b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardItem.h index 646f24fbf..3926d9357 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardItem.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardItem.h @@ -18,11 +18,12 @@ namespace OHOS { -class SetCardItem :public UIViewGroup { +class SetCardItem : public UIViewGroup { public: SetCardItem(); - virtual ~SetCardItem(); + ~SetCardItem() override; void SetItemInfo(const CardInfo &cardInfo); + void SetOnClickListener(OnClickListener *onClickListener); private: void SetUpChild(); UIImageView cardImg_; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardNoCardView.h b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardNoCardView.h index 16264fac7..dc8ee1226 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardNoCardView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardNoCardView.h @@ -17,7 +17,7 @@ namespace OHOS { class SetCardNoCardView : public UIViewGroup { public: SetCardNoCardView(SetCardPresenter *presenter); - virtual ~SetCardNoCardView(); + ~SetCardNoCardView() override; bool InitView(); private: SetCardPresenter *presenter_; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardPresenter.h index 5c9b4e016..c4080fab2 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardPresenter.h @@ -12,6 +12,7 @@ #include "components/ui_list.h" #include "components/ui_view.h" #include "KeyInputListener.h" +#include "ModelListenerSample.h" namespace OHOS { @@ -19,32 +20,40 @@ static const char *SET_CARD_ADD = "setcardadd"; static const char *SET_CARD_DEL = "setcarddel"; static const char *SET_CARD_DEL_CONFIRM = "setcarddelconfirm"; static const char *SET_CARD_DEL_CANCEL = "setcarddelcancel"; +static const char *SET_CARD_IMG = "setcardimg"; + +const uint16_t MISS_SET_CARD_OPERATION_TIME = 3000; class SetCardView; class SetCardModel; class SetCardPresenter : public Presenter, - public UIView::OnClickListener, + public UIView::OnClickListener, public ModelListenerSample, public ListScrollListener { public: SetCardPresenter(); - virtual ~SetCardPresenter(); + ~SetCardPresenter() override; - virtual void OnStart() override; - virtual void OnResume() override; - virtual void OnStop() override; + void OnStart() override; + void OnResume() override; + void OnStop() override; bool OnClick(UIView &view, const ClickEvent &event) override; - virtual void OnScrollStart(int16_t index, UIView *view) override; - virtual void OnScrollEnd(int16_t index, UIView *view) override; - virtual void OnItemSelected(int16_t index, UIView* view) override; + void OnScrollStart(int16_t index, UIView *view) override; + void OnScrollEnd(int16_t index, UIView *view) override; + void OnItemSelected(int16_t index, UIView* view) override; + void OnTickEvent() override; + void Notify() override {} void InitCardShowList(void); uint8_t *GetCardShowList(void); uint8_t GetCardShowCount(void) const; void SetSelectedCard(uint8_t cardId); uint8_t GetSelectedCard(void); + void SetSelectedCardIndex(uint8_t cardIndex); private: + void GoToMainView(void); + void ResetTickTimer(void); KeyInputListener *keyActListenr{nullptr}; SetCardModel *model{nullptr}; - + uint64_t startTime{0}; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardView.h b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardView.h index 9c18e0d09..52f87c8c0 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/include/SetCardView.h @@ -28,7 +28,7 @@ class SetCardPresenter; class SetCardView : public View { public: SetCardView(); - virtual ~SetCardView(); + ~SetCardView() override; static SetCardView *GetInstance() { @@ -36,13 +36,14 @@ public: return &instance; } - virtual void OnStart() override; - virtual void OnSetUpView() override; - virtual void OnTearDownView() override; - virtual void OnStop() override; + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; void ShowDeleteView(bool show); void ShowAddView(bool show); void RefreshCardList(void); + void SaveSelectCardIndex(void); private: void SetUpListInfo(void); void SetUpListView(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardAdapter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardAdapter.cpp index 4bce9dbb0..badbc10dc 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardAdapter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardAdapter.cpp @@ -48,6 +48,7 @@ UIView *SetCardAdapter::GetView(UIView *inView, int16 index) item->SetItemInfo(*it); item->SetViewIndex(index); + item->SetOnClickListener(itemClickListener_); return item; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardItem.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardItem.cpp index 61b9c4989..4bdd7ba98 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardItem.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardItem.cpp @@ -28,5 +28,12 @@ namespace OHOS { { cardInfo_ = cardInfo; cardImg_.SetSrc(cardInfo.cardImg); + cardImg_.SetViewId(SET_CARD_IMG); + } + + void SetCardItem::SetOnClickListener(OnClickListener *onClickListener) + { + cardImg_.SetOnClickListener(onClickListener); + cardImg_.SetTouchable(true); } }; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardPresenter.cpp index f32df85a9..cefddd031 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardPresenter.cpp @@ -14,9 +14,11 @@ namespace OHOS { { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::SetCardPresenter"); model = &SetCardModel::GetInstance(); + ResetTickTimer(); } - SetCardPresenter::~SetCardPresenter() { + SetCardPresenter::~SetCardPresenter() + { if (keyActListenr != nullptr) { delete keyActListenr; keyActListenr = nullptr; @@ -50,9 +52,10 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::OnClick"); if (strcmp(view.GetViewId(), SET_CARD_ADD) == 0) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::SET_CARD_ADD"); - NativeAbility::GetInstance().ChangeSlice(VIEW_ADD_CARD); + NativeAbility::GetInstance().ChangeSlice(VIEW_ADD_CARD); } else if (strcmp(view.GetViewId(), SET_CARD_DEL) == 0) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::SET_CARD_DEL"); + view_->SaveSelectCardIndex(); view_->ShowDeleteView(true); } else if (strcmp(view.GetViewId(), SET_CARD_DEL_CONFIRM) == 0) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::SET_CARD_DEL_CONFIRM"); @@ -62,8 +65,12 @@ namespace OHOS { } else if (strcmp(view.GetViewId(), SET_CARD_DEL_CANCEL) == 0) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::SET_CARD_DEL_CANCEL"); view_->ShowDeleteView(false); + } else if (strcmp(view.GetViewId(), SET_CARD_IMG) == 0) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::SET_CARD_IMG"); + GoToMainView(); } - return true; + ResetTickTimer(); + return true; } void SetCardPresenter::OnScrollStart(int16_t index, UIView *view) @@ -78,15 +85,16 @@ namespace OHOS { if (view == nullptr) { return; } - model->SetSelectedCardIndex(index); + SetSelectedCardIndex(index); + ResetTickTimer(); } - void SetCardPresenter::OnItemSelected(int16_t index, UIView* view) + void SetCardPresenter::OnItemSelected(int16_t index, UIView* view) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::OnItemSelected index = %d", index); if (view == nullptr) { return; - } + } } void SetCardPresenter::InitCardShowList(void) { @@ -113,4 +121,37 @@ namespace OHOS { return model->GetSelectedCard(); } + void SetCardPresenter::SetSelectedCardIndex(uint8_t cardIndex) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::SetSelectedCardIndex %d", cardIndex); + model->SetSelectedCardIndex(cardIndex); + } + + void SetCardPresenter::GoToMainView(void) + { + uint8_t *cardSettings = model->GetCardShowList(); + uint8_t selectIndex = model->GetSelectedCardIndex(); + if (selectIndex < model->GetCardShowCount()) { + const CardInfo *info = MainModel::GetInstance().GetCardInfo(static_cast(cardSettings[selectIndex])); + if (info != nullptr) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetCardPresenter::GoToMainView %d", info->id); + MainModel::GetInstance().SetFromSetCardView(true); + MainModel::GetInstance().SetFromCardId(info->id); + } + } + NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); + } + + void SetCardPresenter::OnTickEvent() + { + uint64_t current_time = osKernelGetTick2ms(); + if ((startTime != 0) && (current_time - startTime > MISS_SET_CARD_OPERATION_TIME)) { + GoToMainView(); + } + } + + void SetCardPresenter::ResetTickTimer(void) + { + startTime = osKernelGetTick2ms(); + } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardView.cpp index f18a1c8e4..0efb39e47 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_card/src/SetCardView.cpp @@ -41,6 +41,7 @@ void SetCardView::OnStart() SetContainerView(new UIViewGroup()); container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); setCardAdapter_ = new SetCardAdapter(); + setCardAdapter_->SetItemClickListener(presenter_); SetUpListInfo(); SetUpListView(); SetUpDeleteView(); @@ -88,6 +89,7 @@ void SetCardView::SetUpListInfo(void) static_cast(cardSettings[i])); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetUpListInfo::%d %s", info->id, info->cardImg); if (selectCardId == info->id) { + presenter_->SetSelectedCardIndex(i); scrollIndex_ = i; presenter_->SetSelectedCard(MAX_CARD); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetUpListInfo::scrollIndex_ = %u", scrollIndex_); @@ -163,12 +165,12 @@ void SetCardView::ShowCardListView(bool show) if (show) { addImg_.SetVisible(true); contentList_.SetVisible(true); - delImg_.SetVisible(true); + delImg_.SetVisible(true); } else { addImg_.SetVisible(false); contentList_.SetVisible(false); delImg_.SetVisible(false); - } + } } void SetCardView::ShowDeleteView(bool show) @@ -179,7 +181,7 @@ void SetCardView::ShowDeleteView(bool show) deleteView_->SetVisible(true); } else { ShowCardListView(true); - deleteView_->SetVisible(false); + deleteView_->SetVisible(false); } } @@ -191,7 +193,7 @@ void SetCardView::ShowAddView(bool show) noCardView_->SetVisible(true); } else { ShowCardListView(true); - noCardView_->SetVisible(false); + noCardView_->SetVisible(false); } } @@ -205,4 +207,10 @@ void SetCardView::RefreshCardList(void) } } +void SetCardView::SaveSelectCardIndex(void) +{ + uint8_t cardIdex = contentList_.GetSelectView()->GetViewIndex(); + presenter_->SetSelectedCardIndex(cardIdex); +} + } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopModel.h b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopModel.h index 5c5a9261e..2ef2793dc 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopModel.h @@ -30,7 +30,6 @@ namespace OHOS { SetDesktopModel(const SetDesktopModel &); SetDesktopModel &operator=(const SetDesktopModel &); virtual ~SetDesktopModel(); - }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopPresenter.h index 1e8d0c19f..d757dbe8a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopPresenter.h @@ -22,17 +22,16 @@ class SetDesktopPresenter : public Presenter, public UIView::OnDragListener { public: SetDesktopPresenter(); - virtual ~SetDesktopPresenter(); + ~SetDesktopPresenter() override; - virtual void OnStart() override; - virtual void OnResume() override; - virtual void OnStop() override; + void OnStart() override; + void OnResume() override; + void OnStop() override; bool OnClick(UIView &view, const ClickEvent &event) override; - virtual bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnDrag(UIView& view, const DragEvent& event) override; bool GetHexagonsStyleState(void); private: - }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopView.h b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopView.h index 4c992747f..d1827c77a 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/include/SetDesktopView.h @@ -24,7 +24,7 @@ class SetDesktopPresenter; class SetDesktopView : public View { public: SetDesktopView(); - virtual ~SetDesktopView(); + ~SetDesktopView() override; static SetDesktopView *GetInstance() { @@ -32,10 +32,10 @@ public: return &instance; } - virtual void OnStart() override; - virtual void OnSetUpView() override; - virtual void OnTearDownView() override; - virtual void OnStop() override; + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; void UpdateSelectedStyle(bool hexagonsSelected); private: UILabel titleText; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopModel.cpp index d5f64f315..43c523e4f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopModel.cpp @@ -31,7 +31,7 @@ namespace OHOS { } else { style = APPLIST_STYLE; } - return style; + return style; } void SetDesktopModel::SetDesktopStyle(DesktopStyle style) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopPresenter.cpp index 0c361bcb1..e535895fb 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopPresenter.cpp @@ -53,8 +53,9 @@ namespace OHOS { } uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); NativeAbility::GetInstance().ChangeSlice(preSlice); - return true; + return true; } + bool SetDesktopPresenter::GetHexagonsStyleState(void) { return (SetDesktopModel::GetInstance().GetDesktopStyle() == HEXAGONS_STYLE); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialInfo.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialInfo.h index 7ccb7984d..2de65cf48 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialInfo.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialInfo.h @@ -19,7 +19,6 @@ namespace OHOS { std::string imageFullName; /* 仅预制表盘使用 */ std::string dialName; std::string description; /* 仅离线表盘使用 */ - uint8_t freq; ImageInfo *preImageInfo; } SetDialInfo; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialModel.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialModel.h index 695c5beea..6125415a8 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialModel.h @@ -29,7 +29,6 @@ namespace OHOS { virtual ~SetDialModel(); int32_t ParseDialHeader(const std::string &dialFileName, SetDialInfo &dialInfo); std::vector dialInfoList; - uint8_t pageIndex_{0}; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialPresenter.h index 65b4a746d..1af1cc92c 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialPresenter.h @@ -12,28 +12,36 @@ #include "Presenter.h" #include "components/ui_view.h" #include "KeyInputListener.h" +#include "ModelListenerSample.h" namespace OHOS { +const uint16_t MISS_DIAL_OPERATION_TIME = 3000; + class SetDialView; class SetDialModel; class SetDialPresenter : public Presenter, - public UIView::OnClickListener, + public UIView::OnClickListener, public ModelListenerSample, public UICoverflowView::OnCoverflowScrollListener { public: SetDialPresenter(); - virtual ~SetDialPresenter(); + ~SetDialPresenter() override; size_t GetDialCount(void); std::vector& GetDialInfo(void); uint8_t GetPageIndex(void); - virtual void OnStart() override; - virtual void OnResume() override; - virtual void OnStop() override; + void OnStart() override; + void OnResume() override; + void OnStop() override; + void OnTickEvent() override; + void Notify() override {} bool OnScroll() override; bool OnClick(UIView &view, const ClickEvent &event) override; + void ResetTickTimer(void); private: + void OnClickAction(void); KeyInputListener *keyActListenr{nullptr}; SetDialModel *model{nullptr}; + uint64_t startTime{0}; }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialView.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialView.h index 85ee938c9..0a7f564fe 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/include/SetDialView.h @@ -23,7 +23,7 @@ class SetDialPresenter; class SetDialView : public View { public: SetDialView(); - virtual ~SetDialView(); + ~SetDialView() override; static SetDialView *GetInstance() { @@ -31,10 +31,10 @@ public: return &instance; } - virtual void OnStart() override; - virtual void OnSetUpView() override; - virtual void OnTearDownView() override; - virtual void OnStop() override; + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; void CoverflowViewScroll(void); uint8_t GetCoverflowPage(void); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialModel.cpp index 122c0adb0..93f3e8355 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialModel.cpp @@ -4,13 +4,13 @@ * Author: * Create: 2021-11-23 */ - +#include #include "MainModel.h" #include "SetDialModel.h" #include "kv_store.h" #include "securec.h" #include "dirent.h" -#include "DialBinTypes.h" +#include "DialBinParser.h" #include "wearable_log.h" namespace OHOS { @@ -27,7 +27,12 @@ namespace OHOS { { dialInfoList.clear(); LoadAllDialFromRam(); + size_t dialSize = dialInfoList.size(); LoadAllDialFromFs(); + /* 只排序离线表盘 */ + std::sort(dialInfoList.begin() + dialSize, dialInfoList.end(), [](const SetDialInfo& f, const SetDialInfo& n) { + return f.dialName < n.dialName; + }); } void SetDialModel::LoadAllDialFromRam() @@ -35,12 +40,11 @@ namespace OHOS { for (uint8_t i = DIAL_CLOCK; i < DIAL_MAX; i++) { const DialInfo *info = MainModel::GetInstance().GetDialInfo((DialId)i); if (info != nullptr) { - SetDialInfo dialInfo; + SetDialInfo dialInfo{0}; dialInfo.dialFlag = 0; dialInfo.id = i; dialInfo.dialName = info->dialName; dialInfo.imageFullName = info->dialImg; - dialInfo.freq = info->freq; ImageInfo* imageInfo = ImageCacheManager::GetInstance().LoadSingleRes(info->dialImg, false); if (info == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "LoadAllDialFromRam loadimage %s fail", @@ -61,9 +65,9 @@ namespace OHOS { // 打开目录 DIR *dirp = opendir(APP_DIAL_PATH); // 遍历文件 - if (dirp != NULL) { - while ((direntp = readdir(dirp)) != NULL) { - SetDialInfo dialInfo; + if (dirp != nullptr) { + while ((direntp = readdir(dirp)) != nullptr) { + SetDialInfo dialInfo{0}; int ret = ParseDialHeader(direntp->d_name, dialInfo); if (ret == 0) { dialInfoList.push_back(dialInfo); @@ -77,35 +81,34 @@ namespace OHOS { int32_t SetDialModel::ParseDialHeader(const std::string &dialFileName, SetDialInfo &dialInfo) { - DialHeader dialHeader{0}; std::string dialFullName = APP_DIAL_PATH; dialFullName += "/"; dialFullName += dialFileName; FILE *fp = fopen(dialFullName.c_str(), "rb"); if (fp == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader cannot open file: %s", - dialFullName.c_str()); + dialFullName.c_str()); return -1; } - if (fread(&dialHeader, 1, sizeof(dialHeader), fp) != sizeof(dialHeader)) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader fread %s fail", - dialFullName.c_str()); + DialPreviewInfo preInfo{0}; + bool ret = DialBinParser::GetInstance()->GetDialPreviewInfo(fp, &preInfo); + if (!ret) { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "GetDialPreviewInfo %s fail", + dialFullName.c_str()); return -1; } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader dialFullName: %s", dialFullName.c_str()); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader dialName: %s", - dialHeader.dialName); + preInfo.dialName); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader description: %s", - dialHeader.description); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader freq: %u", - dialHeader.freq); + preInfo.description); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader previewImgId: %u", - dialHeader.previewImgId); + preInfo.imgId); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader imageOffset: %u", - dialHeader.imageOffset); + preInfo.offset); ImageInfo *info = ImageCacheManager::GetInstance().LoadOneInMultiRes( - dialHeader.previewImgId | (0xfef << 20), dialFullName, fp, false, dialHeader.imageOffset); + preInfo.imgId, dialFullName, fp, false, preInfo.offset); if (info == nullptr) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ParseDialHeader loadimage fail"); return -1; @@ -114,9 +117,8 @@ namespace OHOS { dialInfo.dialFlag = 1; dialInfo.id = 0; dialInfo.dialFullName = dialFullName; - dialInfo.dialName = dialHeader.dialName; - dialInfo.description = dialHeader.description; - dialInfo.freq = dialHeader.freq; + dialInfo.dialName = preInfo.dialName; + dialInfo.description = preInfo.description; dialInfo.preImageInfo = info; fclose(fp); @@ -136,7 +138,6 @@ namespace OHOS { diagSetting.dialId = info.id; diagSetting.dialFullName = info.dialFullName; MainModel::GetInstance().AddDialSetting(diagSetting); - pageIndex_ = pageIndex; } size_t SetDialModel::GetDialCount(void) @@ -151,11 +152,21 @@ namespace OHOS { uint8_t SetDialModel::GetPageIndex(void) { - if (pageIndex_ >= dialInfoList.size()) { - return 0; - } else { - return pageIndex_; + uint8_t index = 0; + DialSetting dialSetting = MainModel::GetInstance().GetDialSetting(); + for (auto iter : dialInfoList) { + if (dialSetting.dialFlag) { + if (strcmp(iter.dialFullName.c_str(), dialSetting.dialFullName.c_str()) == 0) { + return index; + } + } else { + if ((!iter.dialFlag) && (iter.id == dialSetting.dialId)) { + return index; + } + } + index++; } + return 0; } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp index 5aa0bb29c..2c3ae789d 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialPresenter.cpp @@ -15,6 +15,7 @@ namespace OHOS { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialPresenter::SetDialPresenter"); model = &SetDialModel::GetInstance(); model->LoadAllDial(); + ResetTickTimer(); } SetDialPresenter::~SetDialPresenter() @@ -46,14 +47,18 @@ namespace OHOS { { } - bool SetDialPresenter::OnClick(UIView &view, const ClickEvent &event) + void SetDialPresenter::OnClickAction(void) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialPresenter::OnClick"); uint8_t pageIndex = view_->GetCoverflowPage(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialPresenter select pageIndex = %u", pageIndex); model->SaveDialSetting(pageIndex); NativeAbility::GetInstance().ChangeSlice(VIEW_MAIN_SAMPLE); - return true; + } + + bool SetDialPresenter::OnClick(UIView &view, const ClickEvent &event) + { + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialPresenter::OnClick"); + OnClickAction(); + return true; } bool SetDialPresenter::OnScroll() @@ -76,4 +81,17 @@ namespace OHOS { { return model->GetPageIndex(); } + + void SetDialPresenter::OnTickEvent() + { + uint64_t current_time = osKernelGetTick2ms(); + if ((startTime != 0) && (current_time - startTime > MISS_DIAL_OPERATION_TIME)) { + OnClickAction(); + } + } + + void SetDialPresenter::ResetTickTimer(void) + { + startTime = osKernelGetTick2ms(); + } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialView.cpp index b683a860f..daa69cd6f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_dial/src/SetDialView.cpp @@ -77,7 +77,7 @@ void SetDialView::OnStop() } } -void SetDialView::CoverflowViewScroll(void) +void SetDialView::CoverflowViewScroll(void) { int16_t contMidX = static_cast(Screen::GetInstance().GetWidth() / DIVISOR_TWO); int16_t minOffset = contMidX; @@ -107,7 +107,8 @@ void SetDialView::CoverflowViewScroll(void) } else { uint8_t alpha = (uint8_t)((1.0f - ((float)offset / (curViewRect.GetWidth() / DIVISOR_TWO))) * OPA_OPAQUE); label_.SetStyle(STYLE_TEXT_OPA, alpha); - } + } + presenter_->ResetTickTimer(); } uint8_t SetDialView::GetCoverflowPage(void) diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingAdapter.h b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingAdapter.h index 80cd05eb6..d89fe3ee0 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingAdapter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingAdapter.h @@ -24,7 +24,7 @@ namespace OHOS { class SettingAdapter : public AbstractAdapter { public: explicit SettingAdapter(); - virtual ~SettingAdapter(); + ~SettingAdapter() override; /* * * @brief Sets the UIView adapter data, which is a SettingItem linked list. @@ -42,11 +42,11 @@ public: * @since 1.0 * @version 1.0 */ - virtual uint16_t GetCount(void) override; + uint16_t GetCount(void) override; - virtual UIView *GetView(UIView *inView, int16_t index) override; + UIView *GetView(UIView *inView, int16_t index) override; - virtual void AddListItem(const SettingItem &item); + void AddListItem(const SettingItem &item); void SetItemClickListener(UIView::OnClickListener *itemclicklistener) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItemView.h b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItemView.h index aa5de7ad1..934e8166b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItemView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingItemView.h @@ -19,14 +19,12 @@ namespace OHOS { class SettingItemView : public UIViewGroup { public: explicit SettingItemView(); - virtual ~SettingItemView(); + ~SettingItemView() override; virtual void SetItemInfo(const SettingItem itemInfo); virtual void SetUpChild(); AppViewId GetViewId(); const char* GetIconId(); private: - SettingItemView(const SettingItemView &); - UIImageView sIcon; UILabel sLabel; UIImageView sNextImage; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingPresenter.h index 08ca8d580..827ad6fac 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingPresenter.h @@ -19,14 +19,14 @@ class SettingPresenter : public Presenter, public UIView::OnDragListener { public: SettingPresenter(); - virtual ~SettingPresenter(); + ~SettingPresenter() override; - virtual void OnStart() override; - virtual void OnResume() override; - virtual void OnStop() override; + void OnStart() override; + void OnResume() override; + void OnStop() override; bool OnClick(UIView &view, const ClickEvent &event) override; - virtual bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnDrag(UIView& view, const DragEvent& event) override; private: SettingModel *settingModel; }; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingView.h b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingView.h index a016243a6..94ab5101d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/include/SettingView.h @@ -23,12 +23,12 @@ class SettingPresenter; class SettingView : public View { public: SettingView(); - virtual ~SettingView(); + ~SettingView() override; - virtual void OnStart() override; - virtual void OnSetUpView() override; - virtual void OnTearDownView() override; - virtual void OnStop() override; + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; void AddSettingItemToList(const SettingItem &item); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp index 47c9c9164..71fed048f 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp @@ -50,7 +50,7 @@ namespace OHOS { void SettingModel::UpdateBlueToothConnectStatus(bool status) { btConnectStatus = status; - if (PullUpDownView::GetInstance() != NULL) { + if (PullUpDownView::GetInstance() != nullptr) { PullUpDownView::GetInstance()->UpdateBlueToothStatus(status); } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingPresenter.cpp index 368d3675e..63a84c7fb 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingPresenter.cpp @@ -47,7 +47,7 @@ namespace OHOS { if ((event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) && (event.GetDeltaX() > X_DRAG_OFFSET) && (event.GetDeltaX() > (DOUBLES * MATH_ABS(event.GetDeltaY())))) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingPresenter::OnDrag ChangeSlice(VIEW_APPLIST)"); - NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); + NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST, TransitionType::TRANSITION_BACK_TO_HEXAGONS); } return false; } @@ -58,7 +58,7 @@ namespace OHOS { SettingItemView *settingItemView = static_cast(&view); AppViewId viewId = settingItemView->GetViewId(); if (viewId == VIEW_REBOOT) { - if (strstr(settingItemView->GetIconId(), "REBOOT") != nullptr){ + if (strstr(settingItemView->GetIconId(), "REBOOT") != nullptr) { RebootModel::GetInstance()->SetSelectViewId(REBOOTDEVICE); RebootModel::GetInstance()->SetExitsView(true); } else { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingView.cpp index b38f9a696..868feb134 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingView.cpp @@ -31,21 +31,31 @@ SettingView::SettingView() SettingView::~SettingView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView::~SettingView"); - scrollView->RemoveAll(); - delete title; - title = nullptr; + if (scrollView != nullptr) { + scrollView->RemoveAll(); + delete scrollView; + scrollView = nullptr; + } - delete listAdapter; - listAdapter = nullptr; + if (title != nullptr) { + delete title; + title = nullptr; + } - delete contentList; - contentList = nullptr; + if (listAdapter != nullptr) { + delete listAdapter; + listAdapter = nullptr; + } - delete scrollView; - scrollView = nullptr; + if (contentList != nullptr) { + delete contentList; + contentList = nullptr; + } - delete dragListener; - dragListener = nullptr; + if (dragListener != nullptr) { + delete dragListener; + dragListener = nullptr; + } } void SettingView::OnStart() @@ -122,6 +132,7 @@ void SettingView::OnSetUpView() scrollView->Add(contentList); RootView::GetInstance()->Add(scrollView); contentList->SetAdapter(listAdapter); + container_ = scrollView; return; } @@ -129,18 +140,13 @@ void SettingView::OnTearDownView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView::OnTearDownView"); View::OnTearDownView(); - return; + Draw(); } void SettingView::OnStop() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SettingView::OnStop"); View::OnStop(); - if (container_ != nullptr) { - container_->RemoveAll(); - delete container_; - container_ = nullptr; - } RootView::GetInstance()->ClearOnKeyActListener(); RootView::GetInstance()->RemoveAll(); return; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempClickMea.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempClickMea.h index c73207053..7756ff74e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempClickMea.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempClickMea.h @@ -17,7 +17,7 @@ namespace OHOS { class TempClickMea : public UIScrollView { public: TempClickMea(); - virtual ~TempClickMea(); + ~TempClickMea() override; bool InitClickMea(); static TempClickMea *GetInstance(); void RefreshClickMea(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempContinueWarn.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempContinueWarn.h index d827b2284..c6aca9ea1 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempContinueWarn.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempContinueWarn.h @@ -17,7 +17,7 @@ namespace OHOS { class TempContinueWarn : public UIViewGroup { public: TempContinueWarn(); - virtual ~TempContinueWarn(); + ~TempContinueWarn() override; bool InitTempContinue(); static TempContinueWarn *GetInstance(); void RefreshTempContinue(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempExitInter.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempExitInter.h index 27207e5ec..81df8141b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempExitInter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempExitInter.h @@ -17,7 +17,7 @@ namespace OHOS { class TempExitInter : public AppGroupView { public: TempExitInter(); - virtual ~TempExitInter(); + ~TempExitInter() override; static TempExitInter *GetInstance(); bool InitView(void *caller) override; private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempExitPrompt.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempExitPrompt.h index cd02beb48..63543772d 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempExitPrompt.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempExitPrompt.h @@ -17,7 +17,7 @@ namespace OHOS { class TempExitPrompt : public UIScrollView { public: TempExitPrompt(); - virtual ~TempExitPrompt(); + ~TempExitPrompt() override; bool InitExitPrompt(); static TempExitPrompt *GetInstance(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempInitInter.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempInitInter.h index 69b4997b0..6de798213 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempInitInter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempInitInter.h @@ -18,7 +18,7 @@ namespace OHOS { class TempInitInter : public AppGroupView { public: TempInitInter(); - virtual ~TempInitInter(); + ~TempInitInter() override; static TempInitInter *GetInstance(); bool InitView(void *caller) override; private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempJoinStudy.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempJoinStudy.h index 20e1759ab..6aec60c0b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempJoinStudy.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempJoinStudy.h @@ -17,7 +17,7 @@ namespace OHOS { class TempJoinStudy : public UIScrollView { public: TempJoinStudy(); - virtual ~TempJoinStudy(); + ~TempJoinStudy() override; bool InitJoinStudy(); static TempJoinStudy *GetInstance(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempLittleTip.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempLittleTip.h index ffec9b440..49320fcff 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempLittleTip.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempLittleTip.h @@ -16,7 +16,7 @@ namespace OHOS { class TempLittleTip : public UIScrollView { public: TempLittleTip(); - virtual ~TempLittleTip(); + ~TempLittleTip() override; bool InitLittleTip(); static TempLittleTip *GetInstance(); void RefreshTip(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMainView.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMainView.h index 2a9dc4610..9fe86b1f6 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMainView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMainView.h @@ -36,7 +36,7 @@ class TempMainView; class TempMainView : public View { public: TempMainView(); - virtual ~TempMainView(); + ~TempMainView() override; static TempMainView *GetInstance(void); void OnStart() override; void OnSetUpView() override; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMeaProcess.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMeaProcess.h index 94b8f79ea..ebd0ee48a 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMeaProcess.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMeaProcess.h @@ -18,7 +18,7 @@ namespace OHOS { class TempMeaProcess : public UIScrollView { public: TempMeaProcess(); - virtual ~TempMeaProcess(); + ~TempMeaProcess() override; static TempMeaProcess *GetInstance(); bool InitMeaProcess(void); void TempMeaDelayExit(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMeasure.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMeasure.h index 433941f89..de6aa31c0 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMeasure.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempMeasure.h @@ -18,7 +18,7 @@ namespace OHOS { class TempMeasure : public AppGroupView { public: TempMeasure(); - virtual ~TempMeasure(); + ~TempMeasure() override; static TempMeasure *GetInstance(); bool InitView(void *caller) override; private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempPresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempPresenter.h index d5e57715b..06c034658 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempPresenter.h @@ -69,7 +69,7 @@ class TempPresenter : public Presenter, public UIView::OnClickList public ModelListenerSample, public UISwipeView::OnSwipeListener { public: TempPresenter(); - virtual ~TempPresenter(); + ~TempPresenter() override; void OnStart() override; void OnPause() override; void OnResume() override; @@ -98,7 +98,7 @@ public: void ProgressNotify(void); void SetTempCountMax(void); void UpdateTempCount(void); - virtual void Notify() override; + void Notify() override; private: uint8 wearListen{0}; int8 tempListen{-1}; // 监测隐藏界面 diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempPromptWear.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempPromptWear.h index b1cf4238c..5f590e00f 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempPromptWear.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempPromptWear.h @@ -18,7 +18,7 @@ namespace OHOS { class TempPromptWear : public UIScrollView { public: TempPromptWear(); - virtual ~TempPromptWear(); + ~TempPromptWear() override; bool InitPromptWear(); static TempPromptWear *GetInstance(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempRemindWear.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempRemindWear.h index 4bde638a1..24f10ed90 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempRemindWear.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempRemindWear.h @@ -17,7 +17,7 @@ namespace OHOS { class TempRemindWear : public UIScrollView { public: TempRemindWear(); - virtual ~TempRemindWear(); + ~TempRemindWear() override; bool InitRemindWear(); static TempRemindWear *GetInstance(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempReport.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempReport.h index 12df52cfc..3faadd519 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempReport.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempReport.h @@ -17,7 +17,7 @@ namespace OHOS { class TempReport : public AppGroupView { public: TempReport(); - virtual ~TempReport(); + ~TempReport() override; static TempReport *GetInstance(); bool InitView(void *caller) override; private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempStudyAbout.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempStudyAbout.h index b20be9516..3d0deee4a 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempStudyAbout.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempStudyAbout.h @@ -16,7 +16,7 @@ namespace OHOS { class TempStudyAbout : public UIScrollView { public: TempStudyAbout(); - virtual ~TempStudyAbout(); + ~TempStudyAbout() override; bool InitStudyAbout(); static TempStudyAbout *GetInstance(); void RefreshStudy(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempWarn.h b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempWarn.h index c87af9490..821b4a4bb 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempWarn.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/include/TempWarn.h @@ -18,7 +18,7 @@ namespace OHOS { class TempWarn : public UIScrollView { public: TempWarn(); - virtual ~TempWarn(); + ~TempWarn() override; bool InitTempWarn(); static TempWarn *GetInstance(); void RefreshTempWarn(void); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempClickMea.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempClickMea.cpp index 478501d1b..28c402b60 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempClickMea.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempClickMea.cpp @@ -125,11 +125,11 @@ bool TempClickMea::InitClickMea(void) SetDraggable(true); SetTouchable(true); - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempClickMea::InitClickMea TempInitLabel() false"); return false; } - if (TempInitButton() == false) { + if (!TempInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempClickMea::InitClickMea TempInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempContinueWarn.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempContinueWarn.cpp index 8fe2db4eb..3a7799b8e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempContinueWarn.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempContinueWarn.cpp @@ -130,11 +130,11 @@ bool TempContinueWarn::InitTempContinue(void) SetDraggable(true); SetTouchable(true); - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::InitTempContinue TempInitImage() error"); return false; } - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempContinueWarn::InitTempContinue TempInitLabel() error"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempExitInter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempExitInter.cpp index 09128a8f1..16ab19dcf 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempExitInter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempExitInter.cpp @@ -45,14 +45,13 @@ TempExitInter::~TempExitInter() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempExitInter::~TempExitInter"); RemoveAll(); - int labelNum, ImageNum; - for (labelNum = SET_ZERO; labelNum < SET_TWO; labelNum++) { + for (int32_t labelNum = SET_ZERO; labelNum < SET_TWO; labelNum++) { if (tempLabel[labelNum] != nullptr) { delete tempLabel[labelNum]; tempLabel[labelNum] = nullptr; } } - for (ImageNum = SET_ZERO; ImageNum < SET_FOUR; ImageNum++) { + for (int32_t ImageNum = SET_ZERO; ImageNum < SET_FOUR; ImageNum++) { if (tempImage[ImageNum] != nullptr) { delete tempImage[ImageNum]; tempImage[ImageNum] = nullptr; @@ -118,19 +117,19 @@ bool TempExitInter::InitSimilarImage(int16 num, int16 tempX, int16 tempY, const bool TempExitInter::TempInitImage(void) { - if (InitSimilarImage(SET_ZERO, EXIT_IMAGE_X, EXIT_IMAGE_EXIT_Y, TEMP_EXIT) == false) { + if (!InitSimilarImage(SET_ZERO, EXIT_IMAGE_X, EXIT_IMAGE_EXIT_Y, TEMP_EXIT)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::TempInitImage new tempImage[SET_ZERO] fail"); return false; } - if (InitSimilarImage(SET_ONE, EXIT_IMAGE_X, EXIT_IMAGE_STUDY_Y, TEMP_ABOUT_STUDY) == false) { + if (!InitSimilarImage(SET_ONE, EXIT_IMAGE_X, EXIT_IMAGE_STUDY_Y, TEMP_ABOUT_STUDY)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::TempInitImage new tempImage[SET_ONE] fail"); return false; } - if (InitSimilarImage(SET_TWO, EXIT_IMAGE_THIS_X, EXIT_THIS_Y_FIRST, PNG_SETTTING_BUTTON_IMAGE) == false) { + if (!InitSimilarImage(SET_TWO, EXIT_IMAGE_THIS_X, EXIT_THIS_Y_FIRST, PNG_SETTTING_BUTTON_IMAGE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::TempInitImage new tempImage[SET_TWO] fail"); return false; } - if (InitSimilarImage(SET_THREE, EXIT_IMAGE_THIS_X, EXIT_THIS_Y_SECOND, PNG_SETTTING_BUTTON_IMAGE) == false) { + if (!InitSimilarImage(SET_THREE, EXIT_IMAGE_THIS_X, EXIT_THIS_Y_SECOND, PNG_SETTTING_BUTTON_IMAGE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::TempInitImage new tempImage[SET_THREE] fail"); return false; } @@ -153,11 +152,11 @@ bool TempExitInter::InitView(void *caller) SetDraggable(true); SetTouchable(true); - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::InitView TempInitLabel() false"); return false; } - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitInter::InitView TempInitImage() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempExitPrompt.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempExitPrompt.cpp index 61512e3bf..1246218dd 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempExitPrompt.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempExitPrompt.cpp @@ -114,11 +114,11 @@ bool TempExitPrompt::InitExitPrompt(void) SetDraggable(true); SetTouchable(true); - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitPrompt::InitExitPrompt TempInitLabel() false"); return false; } - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempExitPrompt::InitExitPrompt TempInitImage() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempInitInter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempInitInter.cpp index 134053f30..f82267b01 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempInitInter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempInitInter.cpp @@ -67,14 +67,13 @@ TempInitInter::~TempInitInter() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempInitInter::~TempInitInter"); RemoveAll(); - int8 stNum, ndNum; - for (stNum = SET_ZERO; stNum < SET_THREE; stNum++) { + for (int8_t stNum = SET_ZERO; stNum < SET_THREE; stNum++) { if (tempImage[stNum] != nullptr) { delete tempImage[stNum]; tempImage[stNum] = nullptr; } } - for (ndNum = SET_ZERO; ndNum < TEMP_LABEL_MAX; ndNum++) { + for (int8_t ndNum = SET_ZERO; ndNum < TEMP_LABEL_MAX; ndNum++) { if (tempLabel[ndNum] != nullptr) { delete tempLabel[ndNum]; tempLabel[ndNum] = nullptr; @@ -142,18 +141,18 @@ typedef struct { } TempInitItem; static const TempInitItem tempInitItem[] = { - {SET_ZERO, LABEL_ONE_X, TEMP_INIT_LABEL_TEMP_Y, TEMP_INIT_LABEL_WIDTH, TEMP_INIT_LABEL_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_FONT, TEMP_INIT_TEMP_LABEL}, - {SET_ONE, LABEL_TWO_X, TEMP_INIT_LABEL_TEMP_Y, TEMP_INIT_LABEL_WIDTH, TEMP_INIT_LABEL_WIDTH, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_FONT, TEMP_INIT_SKIN_TEMP_LABEL}, - {SET_TWO, TEMP_INIT_LABEL_THREE_X, TEMP_INIT_LABEL_SKIN_Y, LABEL_THREE_WIDTH, TITLE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_SKIN_FONT, TEMP_INIT_SKIN_SMALL_LABEL}, - {SET_THREE, TEMP_INIT_LABEL_FOUR_X, TEMP_INIT_LABEL_THREE_Y, TITLE_WIDTH, TITLE_WIDTH, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_TITLE_FONT, TEMP_INIT_TITLE}, - {SET_FOUR, TEMP_INIT_LABEL_TIME_X, TEMP_INIT_LABEL_TIME_Y, TITLE_WIDTH, TITLE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_SKIN_FONT, TEMP_INIT_TITLE_TIME}, - {SET_FIVE, LABEL_FIVE_X, TEMP_INIT_LABEL_FIVE_Y, LABEL_FIVE_WIDTH, LABEL_FIVE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_SKIN_FONT, TEMP_INIT_LABEL_TIP}, + { SET_ZERO, LABEL_ONE_X, TEMP_INIT_LABEL_TEMP_Y, TEMP_INIT_LABEL_WIDTH, TEMP_INIT_LABEL_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_FONT, TEMP_INIT_TEMP_LABEL }, + { SET_ONE, LABEL_TWO_X, TEMP_INIT_LABEL_TEMP_Y, TEMP_INIT_LABEL_WIDTH, TEMP_INIT_LABEL_WIDTH, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_FONT, TEMP_INIT_SKIN_TEMP_LABEL }, + { SET_TWO, TEMP_INIT_LABEL_THREE_X, TEMP_INIT_LABEL_SKIN_Y, LABEL_THREE_WIDTH, TITLE_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_SKIN_FONT, TEMP_INIT_SKIN_SMALL_LABEL }, + { SET_THREE, TEMP_INIT_LABEL_FOUR_X, TEMP_INIT_LABEL_THREE_Y, TITLE_WIDTH, TITLE_WIDTH, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_TITLE_FONT, TEMP_INIT_TITLE }, + { SET_FOUR, TEMP_INIT_LABEL_TIME_X, TEMP_INIT_LABEL_TIME_Y, TITLE_WIDTH, TITLE_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_SKIN_FONT, TEMP_INIT_TITLE_TIME }, + { SET_FIVE, LABEL_FIVE_X, TEMP_INIT_LABEL_FIVE_Y, LABEL_FIVE_WIDTH, LABEL_FIVE_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_INIT_TEMP_SKIN_FONT, TEMP_INIT_LABEL_TIP }, }; bool TempInitInter::SetBasicLabel(void) @@ -216,19 +215,19 @@ bool TempInitInter::InitView(void *caller) return false; } - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView TempInitImage() false"); return false; } - if (SetBasicLabel() == false) { + if (!SetBasicLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView TempInitLabel() false"); return false; } - if (SetAppendLabel() ==false) { + if (!SetAppendLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView TempLowLabel() false"); return false; } - if (TempInitButton() == false) { + if (!TempInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempInitInter::InitView TempInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempJoinStudy.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempJoinStudy.cpp index 77d36a8ed..90eb0edff 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempJoinStudy.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempJoinStudy.cpp @@ -49,18 +49,17 @@ TempJoinStudy::~TempJoinStudy() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::~TempJoinStudy"); RemoveAll(); - int numLabel, numButton; if (tempTitle != nullptr) { delete tempTitle; tempTitle = nullptr; } - for (numLabel = SET_ZERO; numLabel < TEMP_LABEL_MAX; numLabel++) { + for (int32_t numLabel = SET_ZERO; numLabel < TEMP_LABEL_MAX; numLabel++) { if (tempLabel[numLabel] != nullptr) { delete tempLabel[numLabel]; tempLabel[numLabel] = nullptr; } } - for (numButton = SET_ZERO; numButton < TEMP_BUTTON_MAX; numButton++) { + for (int32_t numButton = SET_ZERO; numButton < TEMP_BUTTON_MAX; numButton++) { if (tempButton[numButton] != nullptr) { delete tempButton[numButton]; tempButton[numButton] = nullptr; @@ -102,15 +101,15 @@ bool TempJoinStudy::TempInitLabel(void) tempTitle->SetText(TEMP_TITLE_TEXT); Add(tempTitle); - if (InitSimilarLabel(SET_ZERO, TEMP_LABEL_FIRST_Y, TEMP_LABEL_ONE) == false) { + if (!InitSimilarLabel(SET_ZERO, TEMP_LABEL_FIRST_Y, TEMP_LABEL_ONE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitLabel new tempLabel[SET_ZERO] error"); return false; } - if (InitSimilarLabel(SET_ONE, TEMP_LABEL_SECOND_Y, TEMP_LABEL_TWO) == false) { + if (!InitSimilarLabel(SET_ONE, TEMP_LABEL_SECOND_Y, TEMP_LABEL_TWO)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitLabel new tempLabel[SET_ONE] error"); return false; } - if (InitSimilarLabel(SET_TWO, TEMP_LABEL_THIRD_Y, TEMP_LABEL_THREE) == false) { + if (!InitSimilarLabel(SET_TWO, TEMP_LABEL_THIRD_Y, TEMP_LABEL_THREE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::TempInitLabel new tempLabel[SET_ONE] error"); return false; } @@ -174,11 +173,11 @@ bool TempJoinStudy::InitJoinStudy(void) SetDraggable(true); SetTouchable(true); - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::InitJoinStudy TempInitLabel() false"); return false; } - if (TempInitButton() == false) { + if (!TempInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempJoinStudy::InitJoinStudy TempInitButton() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempLittleTip.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempLittleTip.cpp index abf0694a8..0ce666801 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempLittleTip.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempLittleTip.cpp @@ -85,24 +85,24 @@ typedef struct { } TempTipItem; static const TempTipItem tempTipItem[] = { - {SET_ZERO, TEMP_TIP_LABEL_ONE_X, TEMP_TIP_LABEL_ONE_Y, TEMP_TIP_LABEL_TITLE_WIDTH, TEMP_TIP_LABEL_TITLE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TITLE_FONT, TEMP_TIP_LABEL_ONE}, - {SET_ONE, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_TWO_Y, TEMP_LABEL_WIDTH, TEMP_LABEL_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_TWO}, - {SET_TWO, TEMP_TIP_LABEL_TITLE_X, TEMP_TIP_LABEL_THREE_Y, TEMP_TIP_LABEL_TITLE_WIDTH, - TEMP_TIP_LABEL_TITLE_HEIGHT, (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TITLE_FONT, TEMP_TIP_LABEL_THREE}, - {SET_THREE, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_FOUR_Y, TEMP_LABEL_WIDTH, TEMP_LABEL_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_FOUR}, - {SET_FOUR, TEMP_TIP_LABEL_TITLE_X, TEMP_TIP_LABEL_FIVE_Y, TEMP_TIP_LABEL_TITLE_WIDTH, - TEMP_TIP_LABEL_TITLE_HEIGHT, (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TITLE_FONT, TEMP_TIP_LABEL_FIVE}, - {SET_FIVE, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_SIX_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SIX_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_SIX}, - {SET_SIX, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_SEVEN_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SEVEN_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_SEVEN}, - {SET_SEVEN, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_EIGHT_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SIX_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_EIGHT}, - {SET_EIGHT, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_NIGHT_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SIX_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_NINE}, + { SET_ZERO, TEMP_TIP_LABEL_ONE_X, TEMP_TIP_LABEL_ONE_Y, TEMP_TIP_LABEL_TITLE_WIDTH, TEMP_TIP_LABEL_TITLE_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TITLE_FONT, TEMP_TIP_LABEL_ONE }, + { SET_ONE, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_TWO_Y, TEMP_LABEL_WIDTH, TEMP_LABEL_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_TWO }, + { SET_TWO, TEMP_TIP_LABEL_TITLE_X, TEMP_TIP_LABEL_THREE_Y, TEMP_TIP_LABEL_TITLE_WIDTH, + TEMP_TIP_LABEL_TITLE_HEIGHT, (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TITLE_FONT, TEMP_TIP_LABEL_THREE }, + { SET_THREE, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_FOUR_Y, TEMP_LABEL_WIDTH, TEMP_LABEL_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_FOUR }, + { SET_FOUR, TEMP_TIP_LABEL_TITLE_X, TEMP_TIP_LABEL_FIVE_Y, TEMP_TIP_LABEL_TITLE_WIDTH, + TEMP_TIP_LABEL_TITLE_HEIGHT, (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TITLE_FONT, TEMP_TIP_LABEL_FIVE }, + { SET_FIVE, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_SIX_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SIX_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_SIX }, + { SET_SIX, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_SEVEN_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SEVEN_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_SEVEN }, + { SET_SEVEN, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_EIGHT_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SIX_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_EIGHT }, + { SET_EIGHT, TEMP_TIP_LABEL_X, TEMP_TIP_LABEL_NIGHT_Y, TEMP_LABEL_WIDTH, TEMP_TIP_LABEL_SIX_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_TIP_TEXT_FONT, TEMP_TIP_LABEL_NINE }, }; bool TempLittleTip::SetBasicLabel(void) @@ -155,11 +155,11 @@ bool TempLittleTip::InitLittleTip(void) SetDraggable(true); SetTouchable(true); - if (SetBasicLabel() == false) { + if (!SetBasicLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempLittleTip::InitLittleTip SetLabel() false"); return false; } - if (SetAppendLabel() == false) { + if (!SetAppendLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempLittleTip::InitLittleTip SetAppendLabel() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMainView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMainView.cpp index 2b111d515..5f0952fde 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMainView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMainView.cpp @@ -31,13 +31,12 @@ TempMainView::TempMainView() TempMainView::~TempMainView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::~TempMainView"); - int16 numGroup, numSwipe; - for (numGroup = SET_ZERO; numGroup <= INTERFACES_MAX; numGroup++) { + for (int16_t numGroup = SET_ZERO; numGroup <= INTERFACES_MAX; numGroup++) { if (container[numGroup] != nullptr) { container[numGroup] = nullptr; } } - for (numSwipe = SET_ZERO; numSwipe < SET_TWO; numSwipe++) { + for (int16_t numSwipe = SET_ZERO; numSwipe < SET_TWO; numSwipe++) { if (tempSwipeList[numSwipe] != nullptr) { tempSwipeList[numSwipe]->RemoveAll(); delete tempSwipeList[numSwipe]; @@ -74,7 +73,7 @@ void TempMainView::OnStart() group = container[0]; } else if (tempInterListen == SECOND_TIME_JOIN) { AppGroupView *view[SET_TWO] = {nullptr}; - if (SetSwipeInter(0) == false) { + if (!SetSwipeInter(0)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::OnStart SetSwipeInter[0] null error!"); return; } @@ -297,7 +296,7 @@ bool TempMainView::ChangeMeasure(int16 thisView) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure"); if (container[thisView] == nullptr) { AppGroupView *view[SET_THREE] = {nullptr}; - if (SetSwipeInter(SET_ZERO) == false) { + if (!SetSwipeInter(SET_ZERO)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure SetSwipeInter[0] null error!"); return false; } @@ -307,7 +306,7 @@ bool TempMainView::ChangeMeasure(int16 thisView) return false; } view[SET_ZERO] = tempMeasure; - if (view[SET_ZERO]->InitView(this) == false) { + if (!view[SET_ZERO]->InitView(this)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure view [0] InitView null error!"); return false; } @@ -318,7 +317,7 @@ bool TempMainView::ChangeMeasure(int16 thisView) return false; } view[SET_ONE] = tempExitInter; - if (view[SET_ONE]->InitView(this) == false) { + if (!view[SET_ONE]->InitView(this)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure view [1] InitView null error!"); return false; } @@ -344,7 +343,7 @@ bool TempMainView::ChangeClickMea(int16 thisView) return false; } container[thisView] = tempClickMea; - if (tempClickMea->InitClickMea() == false) { + if (!tempClickMea->InitClickMea()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeClickMea InitClickMea error!"); return false; } @@ -369,7 +368,7 @@ bool TempMainView::ChangeRemindWear(int16 thisView) return false; } container[thisView] = tempRemindWear; - if (tempRemindWear->InitRemindWear() == false) { + if (!tempRemindWear->InitRemindWear()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeRemindWear InitRemindWear error!"); return false; } @@ -389,7 +388,7 @@ bool TempMainView::ChangeMeaProcess(int16 thisView) return false; } container[thisView] = tempMeaProcess; - if (tempMeaProcess->InitMeaProcess() == false) { + if (!tempMeaProcess->InitMeaProcess()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeaProcess InitMeaProcess error!"); return false; } @@ -409,7 +408,7 @@ bool TempMainView::ChangeTempInit(int16 thisView) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempInit"); if (container[thisView] == nullptr) { AppGroupView *view[SET_THREE] = {nullptr}; - if (SetSwipeInter(SET_ONE) == false) { + if (!SetSwipeInter(SET_ONE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure SetSwipeInter[1] null error!"); return false; } @@ -419,7 +418,7 @@ bool TempMainView::ChangeTempInit(int16 thisView) return false; } view[SET_ZERO] = tempInitInter; - if (view[SET_ZERO]->InitView(this) == false) { + if (!view[SET_ZERO]->InitView(this)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempInit view [0] InitView null error!"); return false; } @@ -430,7 +429,7 @@ bool TempMainView::ChangeTempInit(int16 thisView) return false; } view[SET_ONE] = tempExitInter; - if (view[SET_ONE]->InitView(this) == false) { + if (!view[SET_ONE]->InitView(this)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeTempInit view [1] InitView null error!"); return false; } @@ -441,7 +440,7 @@ bool TempMainView::ChangeTempInit(int16 thisView) return false; } view[SET_TWO] = tempReport; - if (view[SET_TWO]->InitView(this) == false) { + if (!view[SET_TWO]->InitView(this)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeMeasure view [2] InitView null error!"); return false; } @@ -467,7 +466,7 @@ bool TempMainView::ChangeTempWarn(int16 thisView) return false; } container[thisView] = tempWarn; - if (tempWarn->InitTempWarn() == false) { + if (!tempWarn->InitTempWarn()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::InitTempWarn tempWarn null error!"); return false; } @@ -492,7 +491,7 @@ bool TempMainView::ChangeContinue(int16 thisView) return false; } container[thisView] = tempContinue; - if (tempContinue->InitTempContinue() == false) { + if (!tempContinue->InitTempContinue()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::InitTempWarn tempContinue null error!"); return false; } @@ -516,7 +515,7 @@ bool TempMainView::ChangeTempTip(int16 thisView) return false; } container[thisView] = tempLittleTip; - if (tempLittleTip->InitLittleTip() == false) { + if (!tempLittleTip->InitLittleTip()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: ChangeTempTip InitLittleTip null error!"); return false; } @@ -541,7 +540,7 @@ bool TempMainView::ChangeExitPrompt(int16 thisView) return false; } container[thisView] = tempExitPrompt; - if (tempExitPrompt->InitExitPrompt() == false) { + if (!tempExitPrompt->InitExitPrompt()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: ChangeExitPrompt InitExitPrompt null error!"); return false; } @@ -561,7 +560,7 @@ bool TempMainView::ChangeStudyAbout(int16 thisView) return false; } container[thisView] = tempStudyAbout; - if (tempStudyAbout->InitStudyAbout() == false) { + if (!tempStudyAbout->InitStudyAbout()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView:: ChangeStudyAbout InitStudyAbout null error!"); return false; } @@ -600,7 +599,7 @@ bool TempMainView::ClickFunc(int16 interface) for (int i = 0; i < funcSize; i++) { if (interface == ViewMapper[i].viewId) { bool jug = (this->*(ViewMapper[i].func))(interface); - if (jug == false) { + if (!jug) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MainAlarmView:: ChangeInterFace[%d] false", interface); return false; } @@ -618,7 +617,7 @@ void TempMainView::ChangeView(int16 hideView, int16 showView) return; } interListen = hideView; - if (ClickFunc(showView) == false) { + if (!ClickFunc(showView)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMainView::ChangeView ClickFunc error"); return; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMeaProcess.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMeaProcess.cpp index b28167168..462541cf2 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMeaProcess.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMeaProcess.cpp @@ -160,15 +160,15 @@ bool TempMeaProcess::InitMeaProcess(void) SetDraggable(true); SetTouchable(true); - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeaProcess TempInitImage() false"); return false; } - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeaProcess TempInitLabel() false"); return false; } - if (TempCirCleProcess() == false) { + if (!TempCirCleProcess()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeaProcess::InitMeaProcess TempCirCleProcess() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMeasure.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMeasure.cpp index 28e9e24e4..f06aeaff7 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMeasure.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempMeasure.cpp @@ -166,15 +166,15 @@ bool TempMeasure::InitView(void *caller) SetTouchable(true); SetOnDragListener(listener); - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitView TempInitLabel() false"); return false; } - if (TempInitButton() == false) { + if (!TempInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitView TempInitButton() false"); return false; } - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempMeasure::InitView TempInitImage() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempPresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempPresenter.cpp index 5f44a54f8..d65187a51 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempPresenter.cpp @@ -43,15 +43,16 @@ void TempPresenter::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempPresenter OnStart"); Presenter::OnStart(); - SendMsgToUIService(UI_ADD_SLEEP_VETO, 0, NULL, 0); + SendMsgToUIService(UI_ADD_SLEEP_VETO, 0, nullptr, 0); } void TempPresenter::OnPause(void) {} void TempPresenter::OnResume(void) {} -void TempPresenter::OnStop(void) { - SendMsgToUIService(UI_RM_SLEEP_VETO, 0, NULL, 0); +void TempPresenter::OnStop(void) +{ + SendMsgToUIService(UI_RM_SLEEP_VETO, 0, nullptr, 0); } bool TempPresenter::OnDrag(UIView& view, const DragEvent& event) @@ -71,7 +72,7 @@ void TempPresenter::ProgressNotify(void) if (TempMeaProcess::GetInstance() == nullptr) { return; } - if (TempMeaProcess::GetInstance()->GetCircleStatus() == true && + if (TempMeaProcess::GetInstance()->GetCircleStatus() && TempMeaProcess::GetInstance()->GetCircleProgress() != nullptr) { if (countTemp > 0) { GraphicService::GetInstance()->PostGraphicEvent(std::bind(&TempPresenter::UpdateTempCount, this)); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempPromptWear.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempPromptWear.cpp index db3d2aec2..ab8ac12be 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempPromptWear.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempPromptWear.cpp @@ -119,15 +119,15 @@ bool TempPromptWear::InitPromptWear(void) SetDraggable(true); SetTouchable(true); - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitPromptWear TempInitLabel() fail"); return false; } - if (TempInitButton() == false) { + if (!TempInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitPromptWear TempInitButton() fail"); return false; } - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempPromptWear::InitPromptWear TempInitImage() fail"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempRemindWear.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempRemindWear.cpp index afa948ff5..20c1e8e94 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempRemindWear.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempRemindWear.cpp @@ -108,11 +108,11 @@ bool TempRemindWear::InitRemindWear(void) SetDraggable(true); SetTouchable(true); - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempRemindWear::InitRemindWear TempInitImage() false"); return false; } - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempRemindWear::InitRemindWear TempInitLabel() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempReport.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempReport.cpp index 09e313300..b4a0f6e86 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempReport.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempReport.cpp @@ -63,15 +63,14 @@ TempReport::TempReport() TempReport::~TempReport() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "TempReport::~TempReport"); - int16 labelNum, imageNum; RemoveAll(); - for (labelNum = 0; labelNum < TEMP_SET_SIX; labelNum++) { + for (int16_t labelNum = 0; labelNum < TEMP_SET_SIX; labelNum++) { if (tempLabel[labelNum] != nullptr) { delete tempLabel[labelNum]; tempLabel[labelNum] = nullptr; } } - for (imageNum = 0; imageNum < SET_FIVE; imageNum++) { + for (int16_t imageNum = 0; imageNum < SET_FIVE; imageNum++) { if (tempImage[imageNum] != nullptr) { delete tempImage[imageNum]; tempImage[imageNum] = nullptr; @@ -159,23 +158,23 @@ bool TempReport::InitSimilarImage(int16 num, int16 tempX, int16 tempY, const cha bool TempReport::TempInitImage(void) { - if (InitSimilarImage(SET_ZERO, TEMP_IMAGE_ONE_X, TEMP_IMAGE_ONE_Y, TEMP_LITTLE_MEASURE) == false) { + if (!InitSimilarImage(SET_ZERO, TEMP_IMAGE_ONE_X, TEMP_IMAGE_ONE_Y, TEMP_LITTLE_MEASURE)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); return false; } - if (InitSimilarImage(SET_ONE, TEMP_IMAGE_TWO_X, TEMP_IMAGE_TWO_Y, TEMP_LIT_TIP) == false) { + if (!InitSimilarImage(SET_ONE, TEMP_IMAGE_TWO_X, TEMP_IMAGE_TWO_Y, TEMP_LIT_TIP)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); return false; } - if (InitSimilarImage(SET_TWO, TEMP_IMAGE_THREE_X, TEMP_IMAGE_THREE_Y, TEMP_POINT) == false) { + if (!InitSimilarImage(SET_TWO, TEMP_IMAGE_THREE_X, TEMP_IMAGE_THREE_Y, TEMP_POINT)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); return false; } - if (InitSimilarImage(SET_THREE, TEMP_IMAGE_FOUR_X, TEMP_IMAGE_THREE_Y, TEMP_REV_POINTER) == false) { + if (!InitSimilarImage(SET_THREE, TEMP_IMAGE_FOUR_X, TEMP_IMAGE_THREE_Y, TEMP_REV_POINTER)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); return false; } - if (InitSimilarImage(SET_FOUR, TEMP_FOUR_X, TEMP_IMAGE_FOUR_Y, TEMP_REPORT) == false) { + if (!InitSimilarImage(SET_FOUR, TEMP_FOUR_X, TEMP_IMAGE_FOUR_Y, TEMP_REPORT)) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::TempReport InitSimilarImage false"); return false; } @@ -197,15 +196,15 @@ bool TempReport::InitView(void *caller) SetDraggable(true); SetTouchable(true); - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::InitView TempInitImage false"); return false; } - if (SetBasicLabel() == false) { + if (!SetBasicLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::InitView SetBasicLabel false"); return false; } - if (SetAppendLabel() == false) { + if (!SetAppendLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempReport::InitView SetAppendLabel false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempStudyAbout.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempStudyAbout.cpp index 362ca5cc6..7153c761e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempStudyAbout.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempStudyAbout.cpp @@ -70,16 +70,16 @@ typedef struct { } TempStudyItem; static const TempStudyItem tempStudyItem[] = { - {SET_ZERO, TEMP_LABEL_ONE_X, TEMP_LABEL_ONE_Y, TEMP_LABEL_ONE_WIDTH, TEMP_LABEL_ONE_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_ONE}, - {SET_ONE, TEMP_LABEL_TWO_X, TEMP_LABEL_TWO_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_TWO}, - {SET_TWO, TEMP_LABEL_TWO_X, TEMP_LABEL_THREE_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_THREE}, - {SET_THREE, TEMP_LABEL_TWO_X, TEMP_LABEL_FOUR_Y, TEMP_LABEL_TWO_WIDTH, LABEL_FOUR_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_FOUR}, - {SET_FOUR, TEMP_LABEL_TWO_X, TEMP_LABEL_FIVE_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, - (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_TIP_FONT, TEMP_STUDY_LABEL_FIVE}, + { SET_ZERO, TEMP_LABEL_ONE_X, TEMP_LABEL_ONE_Y, TEMP_LABEL_ONE_WIDTH, TEMP_LABEL_ONE_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_ONE }, + { SET_ONE, TEMP_LABEL_TWO_X, TEMP_LABEL_TWO_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_TWO }, + { SET_TWO, TEMP_LABEL_TWO_X, TEMP_LABEL_THREE_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_THREE }, + { SET_THREE, TEMP_LABEL_TWO_X, TEMP_LABEL_FOUR_Y, TEMP_LABEL_TWO_WIDTH, LABEL_FOUR_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_FONT, TEMP_STUDY_LABEL_FOUR }, + { SET_FOUR, TEMP_LABEL_TWO_X, TEMP_LABEL_FIVE_Y, TEMP_LABEL_TWO_WIDTH, TEMP_LABEL_TWO_HEIGHT, + (char *)DEFAULT_VECTOR_FONT_FILENAME, TEMP_LABEL_TIP_FONT, TEMP_STUDY_LABEL_FIVE }, }; bool TempStudyAbout::SetBasicLabel(void) @@ -129,11 +129,11 @@ bool TempStudyAbout::InitStudyAbout(void) SetDraggable(true); SetTouchable(true); - if (SetBasicLabel() == false) { + if (!SetBasicLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::InitStudyAbout SetBasicLabel() false"); return false; } - if (SetAppendLabel() == false) { + if (!SetAppendLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempStudyAbout::InitStudyAbout SetAppendLabel() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempWarn.cpp b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempWarn.cpp index cbd1503c1..6ef18b542 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempWarn.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/temperature/src/TempWarn.cpp @@ -122,15 +122,15 @@ bool TempWarn::InitTempWarn(void) SetDraggable(true); SetTouchable(true); - if (TempInitImage() == false) { + if (!TempInitImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::InitTempWarn TempInitImage() false"); return false; } - if (TempInitButton() == false) { + if (!TempInitButton()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::InitTempWarn TempInitButton() false"); return false; } - if (TempInitLabel() == false) { + if (!TempInitLabel()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "TempWarn::InitTempWarn TempInitLabel() false"); return false; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISampleModel.h b/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISampleModel.h index 0570ca0e1..45028caf6 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISampleModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISampleModel.h @@ -11,7 +11,6 @@ #include #include #include "AppViewIDs.h" -#include "components/ui_label_ext.h" #include "UiConfig.h" #include "UISamplePresenter.h" @@ -25,7 +24,6 @@ namespace OHOS { UISampleModel(const UISampleModel &); UISampleModel &operator=(const UISampleModel &); virtual ~UISampleModel(); - }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISamplePresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISamplePresenter.h index 2272d09f5..821544b28 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISamplePresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISamplePresenter.h @@ -19,18 +19,17 @@ class UISamplePresenter : public Presenter, public UIView::OnDragListener { public: UISamplePresenter(); - virtual ~UISamplePresenter(); + ~UISamplePresenter() override; - virtual void OnStart() override; - virtual void OnResume() override; - virtual void OnStop() override; + void OnStart() override; + void OnResume() override; + void OnStop() override; bool OnClick(UIView &view, const ClickEvent &event) override; - virtual bool OnDrag(UIView& view, const DragEvent& event) override; + bool OnDrag(UIView& view, const DragEvent& event) override; private: UISampleModel *uisampleModel; - }; } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISampleView.h b/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISampleView.h index e7e902c87..6009abbaa 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISampleView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/uisample/include/UISampleView.h @@ -26,9 +26,9 @@ class UISamplePresenter; class UISampleOnDragListener : public UIView::OnDragListener { public: UISampleOnDragListener() {} - virtual ~UISampleOnDragListener() {} + ~UISampleOnDragListener() override {} - bool OnDrag(UIView& view, const DragEvent& event) + bool OnDrag(UIView& view, const DragEvent& event) override { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UISampleOnDragListener::OnDrag"); UNUSED(view); @@ -44,7 +44,7 @@ public: class UISampleView : public View { public: UISampleView(); - virtual ~UISampleView(); + ~UISampleView(); static UISampleView *GetInstance() { @@ -52,10 +52,10 @@ public: return &instance; } - virtual void OnStart() override; - virtual void OnSetUpView() override; - virtual void OnTearDownView() override; - virtual void OnStop() override; + void OnStart() override; + void OnSetUpView() override; + void OnTearDownView() override; + void OnStop() override; void InitView(); private: diff --git a/code/sdk/application/wearable/nativeapp/nativeui/uisample/src/UISamplePresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/uisample/src/UISamplePresenter.cpp index 59fe703c6..7037c35fc 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/uisample/src/UISamplePresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/uisample/src/UISamplePresenter.cpp @@ -22,7 +22,7 @@ namespace OHOS { void UISamplePresenter::OnStart() { Presenter::OnStart(); - SendMsgToUIService(UI_ADD_SLEEP_VETO, 0, NULL, 0); + SendMsgToUIService(UI_ADD_SLEEP_VETO, 0, nullptr, 0); } void UISamplePresenter::OnResume(void) @@ -31,7 +31,7 @@ namespace OHOS { void UISamplePresenter::OnStop(void) { - SendMsgToUIService(UI_RM_SLEEP_VETO, 0, NULL, 0); + SendMsgToUIService(UI_RM_SLEEP_VETO, 0, nullptr, 0); return; } @@ -39,7 +39,7 @@ namespace OHOS { { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UISamplePresenter::OnDrag"); UNUSED(view); - UNUSED(event); + UNUSED(event); return false; } @@ -47,7 +47,7 @@ namespace OHOS { { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "UISamplePresenter::OnDrag"); UNUSED(view); - UNUSED(event); - return true; + UNUSED(event); + return true; } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/ui_test_group.cpp b/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/ui_test_group.cpp index a6307df44..3e4da3ccf 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/ui_test_group.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/uisample/uitest/framework/src/ui_test_group.cpp @@ -24,6 +24,9 @@ #include "ui_test_countdown/ui_test_countdown.h" #include "ui_test_running_ball/ui_test_running_ball.h" #endif +#if ENABLE_SOFT_KEYBOARD +#include "ui_test_keyboard/ui_test_keyboard.h" +#endif #include "ui_test_tiger/ui_test_tiger.h" #include "ui_test_hexagons_list/ui_test_hexagons_list.h" #include "ui_test_video_play/ui_test_video_play.h" @@ -59,6 +62,9 @@ void UITestGroup::SetUpTestCase() #if ENABLE_VGU_ENGINE && CAPABILITY_HWDRAW_PATH testCaseList_->PushBack(TestCaseInfo{"倒计时", new UITestCountdown()}); testCaseList_->PushBack(TestCaseInfo{"动画曲线", new UITestRunningBall()}); +#endif +#if ENABLE_SOFT_KEYBOARD + testCaseList_->PushBack(TestCaseInfo{"软键盘", new UITestKeyboard()}); #endif testCaseList_->PushBack(TestCaseInfo{"视频播放", new UITestVideoPlay()}); } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/uiservice/include/ui_service.h b/code/sdk/application/wearable/nativeapp/nativeui/uiservice/include/ui_service.h index 4792e4f2f..823ad1844 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/uiservice/include/ui_service.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/uiservice/include/ui_service.h @@ -49,7 +49,6 @@ typedef enum { SCREEN_OFF_ENABLE_TO_UI, UI_ADD_SLEEP_VETO, UI_RM_SLEEP_VETO, - } UiServiceMsgId; #define BUNDLE_NAME_LEN 128 diff --git a/code/sdk/application/wearable/nativeapp/nativeui/uiservice/src/ui_service.cpp b/code/sdk/application/wearable/nativeapp/nativeui/uiservice/src/ui_service.cpp index 3ede65992..ed8408eb5 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/uiservice/src/ui_service.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/uiservice/src/ui_service.cpp @@ -20,7 +20,7 @@ #include "UiServersMsg.h" #include "ohos_init.h" #include "memory_adapter.h" -#include +#include #include "service_id_define.h" #include "bundle_install_msg.h" #include "graphic_service.h" @@ -55,7 +55,7 @@ static UiService g_uiService = { DEFAULT_IUNKNOWN_ENTRY_BEGIN, .SendMsg = SendMsg, DEFAULT_IUNKNOWN_ENTRY_END, - .identity = { -1, -1, NULL }, + .identity = { -1, -1, nullptr }, }; const int DATA_DIST_STACK_SIZE = 0xC00; @@ -142,17 +142,16 @@ void ServiceMsgProcess(Request *request) case JS_UNINSTALL_SUCESS_TO_UI: WEARABLE_LOGI(WEARABLE_LOG_MODULE_UI_SERVICE, "bms msg_id = %d bundleName = %s", request->msgId, ((BundleData *)request->data)->bundleName); - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::ApplistModel::ApplistUpdate, - &OHOS::ApplistModel::GetInstance())); - + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::ApplistModel::ApplistUpdate, &OHOS::ApplistModel::GetInstance())); break; case BT_CONNECTED_TO_UI: - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::SettingModel::UpdateBlueToothConnectStatus, - &OHOS::SettingModel::GetInstance(), true)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::SettingModel::UpdateBlueToothConnectStatus, &OHOS::SettingModel::GetInstance(), true)); break; case BT_DISCONNECTED_TO_UI: - GraphicService::GetInstance()->PostGraphicEvent(std::bind(&OHOS::SettingModel::UpdateBlueToothConnectStatus, - &OHOS::SettingModel::GetInstance(), false)); + GraphicService::GetInstance()->PostGraphicEvent( + std::bind(&OHOS::SettingModel::UpdateBlueToothConnectStatus, &OHOS::SettingModel::GetInstance(), false)); break; case SCREEN_TURN_ON_TO_UI: ScreenTurnOn(request); @@ -194,17 +193,17 @@ TaskConfig GetServiceTaskConfig(Service *service) static int32_t SendMsg(int32_t msgId, uint32_t msgValue, void *data, int32_t dataLen) { Request *request = SAMGR_AllocRequestMsg(0, PLATFORM_CORE, UI_SVR_ID, dataLen); - if (request == NULL) { + if (request == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "SAMGR_AllocRequestMsg failed"); return FALSE; } request->msgId = msgId; request->msgValue = msgValue; - if (data != NULL) { + if (data != nullptr) { (void)memcpy_s(request->data, dataLen, data, dataLen); } - int32_t ret = SAMGR_SendRequest(IUNKNOWN_GetIdentity(GET_IUNKNOWN(g_uiService)), request, NULL); + int32_t ret = SAMGR_SendRequest(IUNKNOWN_GetIdentity(GET_IUNKNOWN(g_uiService)), request, nullptr); if (ret != 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "SendMsg failed ret = %d ", ret); return FALSE; @@ -215,14 +214,14 @@ static int32_t SendMsg(int32_t msgId, uint32_t msgValue, void *data, int32_t dat void SendMsgToUIService(int32_t msgId, uint32_t msgValue, void *data, int32_t dataLen) { - UiServiceFeatureApi *comApi = NULL; + UiServiceFeatureApi *comApi = nullptr; IUnknown *iUnknown = SAMGR_GetInstance()->GetDefaultFeatureApi(UI_SERVICE); - if (iUnknown == NULL) { + if (iUnknown == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "GetDefaultFeatureApi failed"); return; } int result = iUnknown->QueryInterface(iUnknown, DEFAULT_VERSION, (void **)&comApi); - if (result != 0 || comApi == NULL) { + if (result != 0 || comApi == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "QueryInterface comApi failed"); return; } diff --git a/code/sdk/application/wearable/ohos_deps/wearable_log.h b/code/sdk/application/wearable/ohos_deps/wearable_log.h index 1311b1f05..62557e075 100755 --- a/code/sdk/application/wearable/ohos_deps/wearable_log.h +++ b/code/sdk/application/wearable/ohos_deps/wearable_log.h @@ -1,4 +1,3 @@ - /* * Copyright (c) CompanyNameMagicTag 2023-2023. All rights reserved. * Description: Wearable log header file. @@ -14,7 +13,7 @@ extern "C" { #endif #endif // #define WEARABLE_LOG_DEBUG -#ifdef USE_DIAG_LOG +#if !defined(SW_UART_DEBUG) && !defined(SW_RTT_DEBUG) #include "soc_diag_util.h" #include "log_oam_logger.h" #include "log_def.h" @@ -49,12 +48,16 @@ typedef enum { WEARABLE_LOG_MODULE_MAX } WearableLogModuleType; -#ifdef USE_DIAG_LOG +#if !defined(SW_UART_DEBUG) && !defined(SW_RTT_DEBUG) #define WEARABLE_LOGE(mod, fmt, arg...) uapi_diag_error_log(0, fmt, ##arg) #define WEARABLE_LOGW(mod, fmt, arg...) uapi_diag_warning_log(0, fmt, ##arg) #define WEARABLE_LOGI(mod, fmt, arg...) uapi_diag_info_log(0, fmt, ##arg) +#ifdef WEARABLE_LOG_DEBUG #define WEARABLE_LOGD(mod, fmt, arg...) uapi_diag_debug_log(0, fmt, ##arg) #else +#define WEARABLE_LOGD(mod, fmt, arg...) +#endif +#else #define WEARABLE_LOGE(mod, fmt, arg...) PRINT("[WEARABLE E/] %s: " fmt "\n", __FUNCTION__, ##arg) #define WEARABLE_LOGW(mod, fmt, arg...) PRINT("[WEARABLE W/] %s: " fmt "\n", __FUNCTION__, ##arg) #define WEARABLE_LOGI(mod, fmt, arg...) PRINT("[WEARABLE I/] %s: " fmt "\n", __FUNCTION__, ##arg) diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index a3b376c80..4b17bdf65 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -14,13 +14,16 @@ #include "samgr_lite.h" #include "thread_adapter.h" #include "graphic_service.h" -#include "WeatherModel.h" #include "health_service.h" #include "phoneaddressmodel.h" #include "LanguageInit.h" #include "ConfigModel.h" // #include "TraingCardPresenter.h" + +#ifdef FD230 #include "TraingModel.h" +#include "WeatherModel.h" +#endif #include "AlmmgrAlarmClockManage.h" #include "AlarmClockManage.h" @@ -291,7 +294,7 @@ char * struct_to_json_buf_malloc_Alarm(void) char * struct_to_json_buf_malloc_(void) { - +#ifdef FD230 cJSON *dataJSON = cJSON_CreateObject(); cJSON* data_arryJSON = cJSON_CreateArray(); struct Trainingdata * data=NULL; @@ -335,6 +338,9 @@ char * struct_to_json_buf_malloc_(void) int pSize = cJSON_GetArraySize(dataJSON); printf("训练历史数据:%s\r\n",json_format); return json_format; +#else + return ""; +#endif } void add_addressbookToRead(char *data) @@ -364,15 +370,17 @@ void add_addressbookToRead(char *data) } PRINT("phone : %s \r\n", phone); - +#ifdef FD230 OHOS::add_addressbook_by_AT(name, phone); - +#endif return; } void set_languaage(uint32_t id) {//OHOS:: language language; +#ifdef FD230 OHOS::language::GetInstance()->ChangeLanguage(id); +#endif } char *addressbook(void)//获取通讯录保存文件地址路径 @@ -382,11 +390,13 @@ char *addressbook(void)//获取通讯录保存文件地址路径 void addressbookToRead(char *buf)//转化用于·c文件 { + #ifdef FD230 if(buf!=NULL) OHOS::read_addressbook_to_struct(buf); else OHOS::read_addressbook_bin_file(); return; + #endif } void addressbookTowrite(void)//转化用于·c文件 @@ -648,6 +658,7 @@ static char* JSON_F_buf=NULL; #define PATH_MAX_LEN 124 const char *get_health_data_path(void) { + #ifdef FD230 time_t now = time(0); tm *ltm = localtime(&now); char day[20]; @@ -669,17 +680,23 @@ const char *get_health_data_path(void) strcpy(JSON_F_buf,buf); } WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",JSON_F_buf); + #endif return JSON_F_buf; + } void set_weather_now_data(int humidity, char* windScale, char* textNight,int uvIndex,int temp,int iconNight) { + #ifdef FD230 return OHOS::UI_set_weather_now_data(humidity, windScale, textNight,uvIndex,temp,iconNight); + #endif } void set_weather_address_data(int lat, char* atm, char* city,char* subLocality,int lon) { + #ifdef FD230 return OHOS::UI_set_weather_address_data(lat, atm, city,subLocality,lon); + #endif } // struct ONE_DAY_DATA // { @@ -689,7 +706,7 @@ void set_weather_address_data(int lat, char* atm, char* city,char* subLocality,i // char textDay[16]; // int tempMax; // }; - +#ifdef FD230 static OHOS::ONE_DAY_DATA data_t[7]; void set_weather_one_data(int tempMin, int iconDay,int fxDate, int tempMax, char *textDay,int x) { @@ -703,6 +720,12 @@ void set_weather_one_data(int tempMin, int iconDay,int fxDate, int tempMax, char if(x==6) return UI_set_weather_seven_day_data(data_t); } +#else +void set_weather_one_data(int tempMin, int iconDay,int fxDate, int tempMax, char *textDay,int x) +{ + +} +#endif message_infor_t message_infor_s; void read_message_data(void) { diff --git a/code/sdk/application/wearable/service/broadcast/src/broadcast_feature.c b/code/sdk/application/wearable/service/broadcast/src/broadcast_feature.c index 5b14264fa..be86bb837 100755 --- a/code/sdk/application/wearable/service/broadcast/src/broadcast_feature.c +++ b/code/sdk/application/wearable/service/broadcast/src/broadcast_feature.c @@ -51,14 +51,14 @@ void BroadcastFeatureLog(IUnknown *broadcastApi) void InitBroadcastFeature(void) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_BROADCASE_SERVICE, "InitBroadcastFeature start!"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_BROADCASE_SERVICE, "InitBroadcastFeature start!"); BroadcastFeature *feature = &broadcastFeature; InitTopicSubscriberInfoImpl(&(feature->topicSubscriberInfo)); SAMGR_GetInstance()->RegisterFeature(BROADCAST_SERVICE_NAME, (Feature *)feature); SAMGR_GetInstance()->RegisterDefaultFeatureApi(BROADCAST_SERVICE_NAME, GET_IUNKNOWN(broadcastFeature)); SAMGR_GetInstance()->RegisterFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME, GET_IUNKNOWN(broadcastFeature)); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_BROADCASE_SERVICE, "InitBroadcastFeature end!"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_BROADCASE_SERVICE, "InitBroadcastFeature end!"); } static const char *GetFeatureName(Feature *feature) diff --git a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt index 35ea3b881..78a32aa88 100755 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -32,11 +32,13 @@ set(PRIVATE_HEADER ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits ${ROOT_DIR}/middleware/services/gui/uikit/ui/frameworks + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audio_player/interfaces/kits ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audiomanager/interfaces/kits/audiomanager ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audiomanager/interfaces/kits/audiocommon ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/player/interfaces/kits/ + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent ${ROOT_DIR}/middleware/utils/fs/include/fs ${ROOT_DIR}/include/middleware/services/bts/br ${ROOT_DIR}/include/middleware/services/bts/common @@ -134,11 +136,13 @@ set(PRIVATE_HEADER ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits ${ROOT_DIR}/middleware/services/gui/uikit/ui/frameworks + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audio_player/interfaces/kits ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audiomanager/interfaces/kits/audiomanager ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/audiomanager/interfaces/kits/audiocommon ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include ${ROOT_DIR}/open_source/openharmony/foundation/multimedia/player/interfaces/kits/ + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent ${ROOT_DIR}/middleware/utils/fs/include/fs ${ROOT_DIR}/include/middleware/services/bts/br ${ROOT_DIR}/include/middleware/services/bts/common @@ -152,7 +156,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/charge_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/makephone_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/notification_manager_customer.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/src/vendor_app/baidu/baidu_app.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/pairing_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/findwatch_notification.cpp ${CMAKE_CURRENT_SOURCE_DIR}/src/notify/drinkReminder_notification.cpp @@ -173,6 +176,13 @@ set(SOURCES ) endif() +if("SUPPORT_BAIDU_MAP" IN_LIST DEFINES) +set(SOURCES + ${SOURCES} + ${CMAKE_CURRENT_SOURCE_DIR}/src/vendor_app/baidu/baidu_app.cpp +) +endif() + if("SUPPORT_ALIPAY_SEC" IN_LIST DEFINES) set(SOURCES ${SOURCES} @@ -218,3 +228,11 @@ set(PRIVATE_DEFINES ) build_component() + + +set(COMPONENT_NAME "baidumapsdk") +set(LIBS ${CMAKE_CURRENT_SOURCE_DIR}/libs/lib${COMPONENT_NAME}.a) +set(WHOLE_LINK + true +) +build_component() \ No newline at end of file diff --git a/code/sdk/application/wearable/service/msg_center/brandy-native-js/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-native-js/libmsg_center.a index 056841fe4..914878b09 100755 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-native-js/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-native-js/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a b/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a index 9d10dc59e..8c53ae5ad 100755 Binary files a/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a and b/code/sdk/application/wearable/service/msg_center/brandy-xts/libmsg_center.a differ diff --git a/code/sdk/application/wearable/service/msg_center/include/msg_center.h b/code/sdk/application/wearable/service/msg_center/include/msg_center.h index 645dd3251..af06d1183 100755 --- a/code/sdk/application/wearable/service/msg_center/include/msg_center.h +++ b/code/sdk/application/wearable/service/msg_center/include/msg_center.h @@ -13,11 +13,10 @@ * limitations under the License. */ -#ifndef OHOS_MAIN_SERVICE_H -#define OHOS_MAIN_SERVICE_H +#ifndef MSG_CENTER_H +#define MSG_CENTER_H #include - #include "service.h" #include "iunknown.h" #include "broadcast_feature.h" @@ -38,6 +37,7 @@ typedef enum { typedef struct MsgCenterFeatureApi { INHERIT_IUNKNOWN; + int32_t (*SendMsg)(int32_t msgId, uint32_t msgValue, void *data, int32_t dataLen); } MsgCenterFeatureApi; typedef struct MsgCenter { @@ -47,13 +47,14 @@ typedef struct MsgCenter { Subscriber subscriber; } MsgCenter; -typedef void (*msg_center_notify_cb)(const Topic topic, Request* req); +typedef void (*MsgCenterNotifyCb)(const Topic topic, Request* req); typedef struct { Topic topic; - msg_center_notify_cb cb; -} msg_center_notify_table_t; + MsgCenterNotifyCb cb; +} MsgCenterNotifyTable; void DmsLiteSendMsgToJS(const char *msgBody); +void DuerMapInfo(uint8_t cmd_id, uint8_t type, void* data); void InitMsgCenter(OHOS::ACELite::JSIValue exports); struct PriorityMapper { diff --git a/code/sdk/application/wearable/service/msg_center/include/msg_center_msg.h b/code/sdk/application/wearable/service/msg_center/include/msg_center_msg.h new file mode 100644 index 000000000..f32c9b7f9 --- /dev/null +++ b/code/sdk/application/wearable/service/msg_center/include/msg_center_msg.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. + * Description: broadcast service api + * Author: CompanyName + * Create: 2021-11-11 + */ + +#ifndef MSG_CENTER_MSG_H +#define MSG_CENTER_MSG_H + +#include "stdint.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + BT_DISCONNECTED_TO_MSGCENTER, + BT_CONNECTED_TO_MSGCENTER, + MSGCENTER_ADD_SLEEP_VETO, + MSGCENTER_RM_SLEEP_VETO, +} MsgCenterServiceMsgId; + +void SendMsgToMsgCenterService(int32_t msgId, uint32_t msgValue, void *data, int32_t dataLen); + +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/service/msg_center/include/msg_center_protocol.h b/code/sdk/application/wearable/service/msg_center/include/msg_center_protocol.h index 8b47221f3..8739b3340 100755 --- a/code/sdk/application/wearable/service/msg_center/include/msg_center_protocol.h +++ b/code/sdk/application/wearable/service/msg_center/include/msg_center_protocol.h @@ -40,6 +40,13 @@ extern "C" { #define FILE_SPILT_MAX_SIZE 970 /* SPP包不能超过990字节 */ #define FILE_NAME_MAX_LEN 100 +typedef enum msg_center_pcm_end_flag { + PCM_END_FLAG_AI_CHAT, /* AI对话 */ + PCM_END_FLAG_WATCH_FACE, /* 表盘 */ + PCM_END_FLAG_VECTOR_NAVI, /* 矢量地图 */ +} msg_center_pcm_end_flag_t; + + typedef enum msg_center_xiaodu_type_id { MSGCENTER_TYPE_ID_XIAODU_START = 0x1, MSGCENTER_TYPE_ID_XIAODU_RECV_XIAODU_INFO, @@ -49,7 +56,7 @@ typedef enum msg_center_xiaodu_type_id { MSGCENTER_TYPE_ID_XIAODU_SEND_PCM_STREAM, MSGCENTER_TYPE_ID_XIAODU_END_RECORD, } msg_center_xiaodu_type_id_t; - +#ifdef SUPPORT_BAIDU_MAP typedef enum msg_center_navigation_type_id { MSGCENTER_TYPE_ID_NAVIGATION_START = 0x1, MSGCENTER_TYPE_ID_NAVIGATION_RECV, @@ -69,8 +76,121 @@ typedef enum msg_center_vector_navi_type_id { MSGCENTER_TYPE_ID_VECTOR_NAVI_RECV_POI, MSGCENTER_TYPE_ID_VECTOR_NAVI_FINISH_FROM_WATCH, MSGCENTER_TYPE_ID_VECTOR_NAVI_FINISH_FROM_PHONE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_AUTH_LICENSE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GEO_LOCATION, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_INIT, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_START, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_START, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_SUCC, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_SUCC, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_FAIL, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_FAIL, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_START, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_START, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_DESTROY, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_DESTROY, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_TEXT_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROAD_GUIDE_TEXT_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_ICON_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROAD_GUIDE_ICON_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_TIME_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_TIME_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_DISTANCE_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_DISTANCE_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_ROUTE_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_ROUTE_UPDATE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GPS_STATUS_CHANGE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GPS_STATUS_CHANGE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_FARAWAY, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_FARAWAY, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_YAWING, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_YAWING, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_RE_ROUTE_COMPLETE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_RE_ROUTE_COMPLETE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ARRIVE_DSTINATION, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ARRIVE_DSTINATION, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_POI_SUG_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_RIDING_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_WALKING_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_TRANSIT_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GEOCODE_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH, + MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REGEOCODE_SEARCH, + /* 地图私有协议 */ + MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_DESTROY_PAGE, + MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_DISCONNECTED, + MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED, } msg_center_vector_navi_type_id_t; + + + +static const char *g_vector_navi_str_tb[] = { + "req_auth_license", + "rec_auth_license", + "req_geo_location", + "rec_geo_location", + "req_navi_init", + "rec_navi_init", + "req_route_plan_start", + "rec_route_plan_start", + "req_route_plan_succ", + "rec_route_plan_succ", + "req_route_plan_fail", + "rec_route_plan_fail", + "req_navi_start", + "rec_navi_start", + "req_navi_destroy", + "rec_navi_destroy", + "req_road_guide_text_update", + "rec_road_guide_text_update", + "req_road_guide_icon_update", + "rec_road_guide_icon_update", + "req_remain_time_update", + "rec_remain_time_update", + "req_remain_distance_update", + "rec_remain_distance_update", + "req_remain_route_update", + "rec_remain_route_update", + "req_gps_status_change", + "rec_gps_status_change", + "req_route_faraway", + "rec_route_faraway", + "req_route_plan_yawing", + "rec_route_plan_yawing", + "req_re_route_complete", + "rec_re_route_complete", + "req_arrive_destination", + "rec_arrive_destination", + "req_poi_sug_search", + "rec_poi_sug_search", + "req_route_riding_search", + "rec_route_riding_search", + "req_route_walking_search", + "rec_route_walking_search", + "req_route_transit_search", + "rec_route_transit_search", + "req_geocode_search", + "rec_geocode_search", + "req_regeocode_search", + "rec_regeocode_search", + "req_destroy_page", +}; + +static inline const char* vector_navi_get_str(uint8_t type) +{ + return g_vector_navi_str_tb[type - MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE]; +} + +#endif typedef enum msg_center_alipay_type_id { MSGCENTER_TYPE_ID_ALIPAY_NETWORK_STATUS = 0x1, MSGCENTER_TYPE_ID_ALIPAY_HOST_INFO, @@ -184,6 +304,7 @@ static inline uint8_t msg_center_get_tlv_tl_len(void *usr_data) return offset; } + errcode_t msg_center_pkt_proc(diag_ser_data_t *data); uint8_t msg_center_get_response_cmd(uint8_t cmd_id); diag_ser_data_t *msg_center_encap_diag_info(diag_ser_header_t *header, uint16_t tlv_len, uint8_t cmd_id); @@ -191,6 +312,8 @@ int32_t msg_center_fill_tlv(msg_center_pkt_tlv_t *tlv, uint8_t type, uint8_t *va errcode_t msg_center_send_data(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); void msg_center_split_file(char *origin_file, int size, char *flist); void msg_center_combine_file(char *flist, char *target_file_name); +diag_frame_fid_t msg_center_get_trans_channel(); +void msg_center_set_trans_channel(diag_frame_fid_t select); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h index 67735a750..ef3a4835f 100755 --- a/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/alarm_notification.h @@ -8,18 +8,18 @@ #ifndef ALARM_NOTIFICATION_H #define ALARM_NOTIFICATION_H -#define ALARM_IMAGE_DELETE "alarm_delete" -#define ALARM_IMAGE_CLOCK "alarm_clock" -#define ALARM_VIEW_CLOSE "alarm_close" -#define ALARM_VIEW_DELAY "alarm_delay" -#define ALARM_VIEW_POPUP "alarm_popup" +constexpr char* ALARM_IMAGE_DELETE = "alarm_delete"; +constexpr char* ALARM_IMAGE_CLOCK = "alarm_clock"; +constexpr char* ALARM_VIEW_CLOSE = "alarm_close"; +constexpr char* ALARM_VIEW_DELAY = "alarm_delay"; +constexpr char* ALARM_VIEW_POPUP = "alarm_popup"; -typedef enum { +enum class AlarmTimerType { NOTIFY_ALARM_CLOSE = 0, NOTIFY_ALARM_DELAY = 1, NOTIFY_ALARM_RING = 2, NOTIFY_ALARM_UNKNOWN = 10, -}AlarmTimerType; +}; namespace OHOS { UIViewGroup* CreateAlarmView(void); @@ -37,25 +37,25 @@ class AlarmViewEventListener : public OHOS::UIView::OnClickListener, public OHOS::UIView::OnDragListener { public: AlarmViewEventListener(); - virtual ~AlarmViewEventListener(); - static AlarmViewEventListener *GetInstance(void); + virtual ~AlarmViewEventListener(); + static AlarmViewEventListener *GetInstance(void); bool OnDrag(UIView& view, const DragEvent& event) override; bool OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& event) override; bool OnClick(OHOS::UIView& view, const OHOS::ClickEvent& event) override; - virtual bool OnPress(OHOS::UIView& view, const OHOS::PressEvent& event) override + bool OnPress(OHOS::UIView& view, const OHOS::PressEvent& event) override { return true; } - virtual bool OnLongPress(OHOS::UIView& view, const OHOS::LongPressEvent& event) override + bool OnLongPress(OHOS::UIView& view, const OHOS::LongPressEvent& event) override { return true; } - virtual bool OnRelease(OHOS::UIView& view, const OHOS::ReleaseEvent& event) override + bool OnRelease(OHOS::UIView& view, const OHOS::ReleaseEvent& event) override { return true; } - virtual bool OnDragStart(OHOS::UIView& view, const OHOS::DragEvent& event) override + bool OnDragStart(OHOS::UIView& view, const OHOS::DragEvent& event) override { return true; } diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h index 31c2a5ccf..5339ce3b9 100755 --- a/code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/makephone_notification.h @@ -8,27 +8,32 @@ #ifndef MAKEPHONE_NOTIFICATION_H #define MAKEPHONE_NOTIFICATION_H -typedef enum { +enum class CallTimerType { NOTIFY_PHONE_CALLING_DISPLAY = 0, NOTIFY_PHONE_CURTIME_DISPLAY = 1, NOTIFY_PHONE_DIAL_DISPLAY = 3, NOTIFY_PHONE_UNKNOWN = 10, -}CallTimerType; +}; namespace OHOS { +class VolumeSettingView; UIViewGroup* CreatePhoneCallView(void); UIViewGroup* CreateCallingView(void); -UIViewGroup* CreateCalldialView(void); -void FreeCalldialView(void); +UIViewGroup* CreateMultiplePhoneView(void); +UIViewGroup* CreateWaitingHintsView(void); void HonrsViewChange(void); +VolumeSettingView *GetvolumeSetting(void); void FreeCallingView(void); void FreePhoneCallView(void); - +void FreeMultiplePhoneCallView(void); +void FreeWaitingHintsView(void); void RefreshMicrophoneImageSrc(const char* src); void CallTimerCallBackProc(int data); void CallCurTimerCallBack(int data); void StartCallTimer(CallTimerType type, int32_t interval); void DisableCallTimer(CallTimerType type); +void EnableWaitingView(void); +void DisableWatingView(void); class CallViewEventListener : public OHOS::UIView::OnClickListener, public OHOS::UIView::OnLongPressListener, @@ -36,26 +41,25 @@ class CallViewEventListener : public OHOS::UIView::OnClickListener, public OHOS::UIView::OnDragListener { public: CallViewEventListener(); - virtual ~CallViewEventListener(); - static CallViewEventListener *GetInstance(void); + ~CallViewEventListener() override; + static CallViewEventListener *GetInstance(void); bool OnClick(OHOS::UIView& view, const OHOS::ClickEvent& event) override; bool OnDrag(UIView& view, const DragEvent& event) override; - bool OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& event) override; - virtual bool OnPress(OHOS::UIView& view, const OHOS::PressEvent& event) override + bool OnPress(OHOS::UIView& view, const OHOS::PressEvent& event) override { return true; } - virtual bool OnLongPress(OHOS::UIView& view, const OHOS::LongPressEvent& event) override + bool OnLongPress(OHOS::UIView& view, const OHOS::LongPressEvent& event) override { return true; } - virtual bool OnRelease(OHOS::UIView& view, const OHOS::ReleaseEvent& event) override + bool OnRelease(OHOS::UIView& view, const OHOS::ReleaseEvent& event) override { return true; } - virtual bool OnDragStart(OHOS::UIView& view, const OHOS::DragEvent& event) override + bool OnDragStart(OHOS::UIView& view, const OHOS::DragEvent& event) override { return true; } diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h b/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h index fc7f11631..d4a772899 100755 --- a/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/notification_manager.h @@ -29,9 +29,8 @@ #include "drinkReminder_notification.h" #include "sedentaryReminder_notification.h" -#define UN_OPACITY 255 -#define HAlf_SCREEN 2 -#define NOTIFY_PRIORITY_DEFAULT 4 +constexpr uint16_t HALF_SCREEN = 2; +constexpr int16_t NOTIFY_PRIORITY_DEFAULT = 4; namespace OHOS { using NewNotify = std::function; @@ -67,7 +66,7 @@ public: /** * @brief notify is or not showing. */ - bool hasNotifyShowing(); + bool HasNotifyShowing(); void StartShowNotify(void); uint16_t GetNotifyPriority(void); uint16_t GetShowingNotifyId(void); @@ -75,17 +74,19 @@ public: void SetNativeUIRunning(bool flag); bool GetVolumeScreenStatus(); void SetVolumeScreenStatus(bool status); + bool GetWatchCallStatus(); + void SetWatchCallStatus(bool status); void Callback() override; UIViewGroup* screenContainer_ = nullptr; private: NotificationManager() {} - ~NotificationManager() {} + ~NotificationManager() override {} void StartRefreshNotifyContent(void); void StopShowNotify(void); - void FreeNotifyViews(void); + void FreeNotifyViews(void); NewNotify notify_; RefreshNotifyContent refreshNotifyContent_; @@ -94,6 +95,7 @@ private: bool isFullScreen_ = false; bool isNativeUI = false; bool volumeScreenStatus = false; + bool watchCallStatus = false; bool stopIsLast_ = false; bool showIsLast_ = false; diff --git a/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h index 6451f4ecc..ce9346bfb 100755 --- a/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h +++ b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidu_app.h @@ -9,7 +9,7 @@ #define BAIDU_APP_H #include "errcode.h" - +#include "cmsis_os2.h" #ifdef __cplusplus #if __cplusplus extern "C" { @@ -26,12 +26,11 @@ typedef struct { uint16_t len; } pcm_stream_queue_msg; +osMessageQueueId_t GetPcmMsgQueueId(void); errcode_t pcm_stream_msg_thread(void *data); errcode_t pcm_stream_queue_init(void); errcode_t pcm_stream_create_task(void); -errcode_t msg_center_navigation_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); -errcode_t msg_center_navigation_recv(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_xiaodu_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_xiaodu_recv_xiaodu_info(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_xiaodu_recv_xiaodu_info(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); @@ -40,6 +39,9 @@ errcode_t msg_center_xiaodu_start_record(uint8_t cmd_id, uint8_t type, void *usr errcode_t msg_center_xiaodu_send_pcm_stream(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_xiaodu_send_end_record(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_xiaodu_recv_tts(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +#ifdef SUPPORT_BAIDU_MAP +errcode_t msg_center_navigation_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_navigation_recv(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_vector_navi_pull_up(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_vector_navi_recv_svg(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_vector_navi_req_svg(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); @@ -53,7 +55,70 @@ errcode_t msg_center_vector_navi_req_poi(uint8_t cmd_id, uint8_t type, void *usr errcode_t msg_center_vector_navi_recv_poi(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_vector_navi_finish_from_watch(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); errcode_t msg_center_vector_navi_finish_from_phone(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); - +errcode_t msg_center_vector_navi_req_auth_license(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_auth_license(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_geo_location(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_geo_location(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_navi_init(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_navi_init(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_route_plan_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_route_plan_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_route_plan_succ(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_route_plan_succ(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_route_plan_fail(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_route_plan_fail(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_navi_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_navi_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_navi_destroy(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_navi_destroy(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_road_guide_text_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_road_guide_text_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_req_road_guide_icon_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_road_guide_icon_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_req_remain_time_update(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_remain_time_update(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_remain_distance_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_remain_distance_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_req_remain_route_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_remain_route_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_req_gps_status_change(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_gps_status_change(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_route_faraway(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_route_faraway(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_route_plan_yawing(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_route_plan_yawing(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_re_route_complete(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_re_route_complete(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_arrive_destination(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_arrive_destination(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vertor_navi_req_poi_sug_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vertor_navi_rec_poi_sug_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_route_riding_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_route_riding_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_req_route_walking_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_route_walking_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_req_route_transit_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_route_transit_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len); +errcode_t msg_center_vector_navi_req_geocode_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_geocode_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_regeocode_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_rec_regeocode_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +errcode_t msg_center_vector_navi_req_destroy_page(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); +#endif #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidumap_js_component.h b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidumap_js_component.h new file mode 100644 index 000000000..8d9e4b878 --- /dev/null +++ b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidumap_js_component.h @@ -0,0 +1,60 @@ +#ifndef BAIDU_MAP_COMPONENT_INTERFACE_H +#define BAIDU_MAP_COMPONENT_INTERFACE_H + +#include "baidumap_msg_center.h" +#include "components/ui_view.h" + +class MapComponentApi +{ +public: + + static MapComponentApi &getInstance(); + MapComponentApi(const MapComponentApi &) = delete; + MapComponentApi &operator=(const MapComponentApi &) = delete; + + const OHOS::UIView* get_baidumap_root_view(); + virtual void destroy(); + virtual void set_zoom_event_enabled(bool enabled); + virtual void zoom_in(); + virtual void zoom_out(); + virtual void zoom_by(int amount); + virtual void zoom_to(int level); + virtual void set_map_background_color(char * json_color); + virtual void set_map_overlayer_enabled(bool enabled); + virtual void set_map_tiles_enabled(bool enabled); + virtual void set_scroll_gestures_enabled(bool enabled); + virtual void scroll_by(int pixel_x, int pixel_y); + // 导航过程、定位成功 + virtual void new_lat_lng(char * json_lat_lng); + virtual void new_lat_lng_zoom(char * json_lat_lng, int zoom); + // 导航结束 + virtual void clear_map_overlayer(); + // 画点 + virtual void draw_circle(char * json_circle); + // 无 + virtual void draw_polygon(char * json_polygon); + // 导航路线 + virtual void draw_path(char * json_path); + // 无 + virtual void draw_text(char * json_text); + // 定位成功定位点 + virtual void draw_marker(char * json_marker); + // 导航过程箭头 + virtual void draw_navi_marker(char * json_navi_marker); + // 定位点 + virtual void overlayer_clear_circle(); + // 定位点 + virtual void overlayer_clear_marker(); + // 导航箭头 + virtual void overlayer_clear_navi_marker(); + // 以下调用使用,不用提供js通路 + void RecvMapSvgInfo(Content *info); +private: + // MapRootView* container_ = nullptr; + /** + * @brief 构造函数 + */ + MapComponentApi(); +}; + +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidumap_js_location.h b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidumap_js_location.h new file mode 100644 index 000000000..324a80817 --- /dev/null +++ b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidumap_js_location.h @@ -0,0 +1,56 @@ +#ifndef BAIDU_MAP_LOCATION_H +#define BAIDU_MAP_LOCATION_H + +struct JSCoordinate { + double lon; + double lat; +}; + +/** + * @brief 将 WGS84 坐标转换为 GCJ02 坐标 + * + * 将给定的 WGS84 坐标转换为 GCJ02 坐标,并返回转换后的 GCJ02 坐标。 + * + * @param lon WGS84 经度坐标 + * @param lat WGS84 纬度坐标 + * + * @return GCJ02 坐标点 + */ +extern void WGS84ToGCJ02(double lon, double lat, JSCoordinate &output); + + /** + * @brief 将 GCJ02 坐标转换为 BD09 坐标 + * + * 将给定的 GCJ02 坐标转换为 BD09 坐标,并返回转换后的 BD09 坐标。 + * + * @param lon GCJ02 坐标的经度 + * @param lat GCJ02 坐标的纬度 + * + * @return 转换后的 BD09 坐标 + */ +extern void GCJ02ToBD09(double lon, double lat, JSCoordinate &output); + +/** + * @brief 将WGS84坐标转换为BD09坐标 + * + * 将给定的 WGS84 坐标转换为 BD09 坐标,并返回转换后的 BD09 坐标。 + * + * @param lon WGS84经度坐标 + * @param lat WGS84纬度坐标 + * + * @return 转换后的BD09坐标点 + */ +extern void WGS84ToBD09(double lon, double lat, JSCoordinate &output); + +/** + * @brief 将 BD09 坐标转换为 GCJ02 坐标 + * + * 将给定的 BD09 坐标转换为 GCJ02 坐标,并返回转换后的 GCJ02 坐标。 + * + * @param bd_lon BD09 经度 + * @param bd_lat BD09 纬度 + * + * @return 转换后的 GCJ02 坐标 + */ +extern void BD09ToGCJ02(double bd_lon, double bd_lat, JSCoordinate &output); +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidumap_msg_center.h b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidumap_msg_center.h new file mode 100644 index 000000000..e20f08a55 --- /dev/null +++ b/code/sdk/application/wearable/service/msg_center/include/vendor_app/baidumap_msg_center.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. + * Description: broadcast service api + * Author: CompanyName + * Create: 2021-11-11 + */ + +#ifndef BAIDU_MAP_MSG_CENTER_H +#define BAIDU_MAP_MSG_CENTER_H + +#include + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif + +/** + * 请求接口的 type_id,目前只有svg的请求 + */ +typedef enum duer_msg_center_type_id { + DUER_MSG_TYPE_ID_REQ_SVG = 1, + DUER_MSG_TYPE_ID_MAX +} duer_msg_center_type_id_t; + +struct Content +{ + int x; + int y; + int z; + void *data; + char *json; +}; + + +/** + * 接收msg_center返回的数据,填充对应的content + */ +uint8_t duer_msg_center_recv_map_info(uint8_t command_id, uint8_t type, struct Content *content); + +/** + * 通过【duer_msg_center_type_id】来区分对应请求的是msg_center接口,方便以后扩展 + */ +uint8_t duer_msg_center_send_map_info(uint8_t duer_type, void *usr_data, uint16_t usr_len); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif +#endif /* BAIDU_MAP_MSG_CENTER_H */ diff --git a/code/sdk/application/wearable/service/msg_center/libs/libbaidumapsdk.a b/code/sdk/application/wearable/service/msg_center/libs/libbaidumapsdk.a new file mode 100644 index 000000000..906a03f5d Binary files /dev/null and b/code/sdk/application/wearable/service/msg_center/libs/libbaidumapsdk.a differ diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_cmd.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_cmd.cpp index 6300431df..1487139d3 100755 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_cmd.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_cmd.cpp @@ -17,7 +17,7 @@ extern "C" { #endif msg_center_cmd_map_t g_msg_center_type_tbl[] = { -#ifdef JS_ENABLE +#if defined(JS_ENABLE) { MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_START, msg_center_xiaodu_start}, { MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_RECV_XIAODU_INFO, msg_center_xiaodu_recv_xiaodu_info}, { MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_RECV_WENXIN_INFO, msg_center_xiaodu_recv_wenxin_info}, @@ -25,6 +25,7 @@ msg_center_cmd_map_t g_msg_center_type_tbl[] = { { MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_START_RECORD, msg_center_xiaodu_start_record}, { MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_SEND_PCM_STREAM, msg_center_xiaodu_send_pcm_stream}, { MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_END_RECORD, msg_center_xiaodu_send_end_record}, +#if defined(SUPPORT_BAIDU_MAP) { MSGCENTER_CMD_NAVIGATION, MSGCENTER_TYPE_ID_NAVIGATION_START, msg_center_navigation_start}, { MSGCENTER_CMD_NAVIGATION, MSGCENTER_TYPE_ID_NAVIGATION_RECV, msg_center_navigation_recv}, { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_PULL_UP, msg_center_vector_navi_pull_up}, @@ -40,6 +41,59 @@ msg_center_cmd_map_t g_msg_center_type_tbl[] = { { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_RECV_POI, msg_center_vector_navi_recv_poi}, { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_FINISH_FROM_WATCH, msg_center_vector_navi_finish_from_watch}, { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_FINISH_FROM_PHONE, msg_center_vector_navi_finish_from_phone}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE, msg_center_vector_navi_req_auth_license}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_AUTH_LICENSE, msg_center_vector_navi_rec_auth_license}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION, msg_center_vector_navi_req_geo_location}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GEO_LOCATION, msg_center_vector_navi_rec_geo_location}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT, msg_center_vector_navi_req_navi_init}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_INIT, msg_center_vector_navi_rec_navi_init}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_START, msg_center_vector_navi_req_route_plan_start}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_START, msg_center_vector_navi_rec_route_plan_start}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_SUCC, msg_center_vector_navi_req_route_plan_succ}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_SUCC, msg_center_vector_navi_rec_route_plan_succ}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_FAIL, msg_center_vector_navi_req_route_plan_fail}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_FAIL, msg_center_vector_navi_rec_route_plan_fail}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_START, msg_center_vector_navi_req_navi_start}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_START, msg_center_vector_navi_rec_navi_start}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_DESTROY, msg_center_vector_navi_req_navi_destroy}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_DESTROY, msg_center_vector_navi_rec_navi_destroy}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_TEXT_UPDATE, msg_center_vector_navi_req_road_guide_text_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROAD_GUIDE_TEXT_UPDATE, msg_center_vector_navi_rec_road_guide_text_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_ICON_UPDATE, msg_center_vector_navi_req_road_guide_icon_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROAD_GUIDE_ICON_UPDATE, msg_center_vector_navi_rec_road_guide_icon_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_TIME_UPDATE, msg_center_vector_navi_req_remain_time_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_TIME_UPDATE, msg_center_vector_navi_rec_remain_time_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_DISTANCE_UPDATE, msg_center_vector_navi_req_remain_distance_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_DISTANCE_UPDATE, msg_center_vector_navi_rec_remain_distance_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_ROUTE_UPDATE, msg_center_vector_navi_req_remain_route_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_ROUTE_UPDATE, msg_center_vector_navi_rec_remain_route_update}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GPS_STATUS_CHANGE, msg_center_vector_navi_req_gps_status_change}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GPS_STATUS_CHANGE, msg_center_vector_navi_rec_gps_status_change}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_FARAWAY, msg_center_vector_navi_req_route_faraway}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_FARAWAY, msg_center_vector_navi_rec_route_faraway}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_YAWING, msg_center_vector_navi_req_route_plan_yawing}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_YAWING, msg_center_vector_navi_rec_route_plan_yawing}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_RE_ROUTE_COMPLETE, msg_center_vector_navi_req_re_route_complete}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_RE_ROUTE_COMPLETE, msg_center_vector_navi_rec_re_route_complete}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ARRIVE_DSTINATION, msg_center_vector_navi_req_arrive_destination}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ARRIVE_DSTINATION, msg_center_vector_navi_rec_arrive_destination}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH, msg_center_vertor_navi_req_poi_sug_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_POI_SUG_SEARCH, msg_center_vertor_navi_rec_poi_sug_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH, msg_center_vector_navi_req_route_riding_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_RIDING_SEARCH, msg_center_vector_navi_rec_route_riding_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH, msg_center_vector_navi_req_route_walking_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_WALKING_SEARCH, msg_center_vector_navi_rec_route_walking_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH, msg_center_vector_navi_req_route_transit_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_TRANSIT_SEARCH, msg_center_vector_navi_rec_route_transit_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH, msg_center_vector_navi_req_geocode_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GEOCODE_SEARCH, msg_center_vector_navi_rec_geocode_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH, msg_center_vector_navi_req_regeocode_search}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REGEOCODE_SEARCH, msg_center_vector_navi_rec_regeocode_search}, + /* µØÍ¼Ë½ÓÐЭÒé */ + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_DESTROY_PAGE, msg_center_vector_navi_req_destroy_page}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_DISCONNECTED, NULL}, + { MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED, NULL}, +#endif #endif #ifdef SUPPORT_ALIPAY_SEC { MSGCENTER_CMD_ALIPAY, MSGCENTER_TYPE_ID_ALIPAY_NETWORK_STATUS, msg_center_alipay_network_status}, diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index c068f7a1c..2d7e15fc7 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -5,7 +5,7 @@ * Create: 2021-11-11 */ -#include +#include #include "securec.h" #include "adapter.h" #include "ohos_init.h" @@ -16,12 +16,6 @@ #include "broadcast_service.h" #include "AlarmClockModel.h" #include "AlarmPopUpPresenter.h" -#include "DialModelCharge.h" -#include "DialModelHeartRate.h" -#include "DialModelSPO2.h" -#include "BloodOxygenModel.h" -#include "HeartModel.h" -#include "SaveEleModel.h" #include "ppg_service.h" #include "CallerLogModel.h" #include "notification_manager.h" @@ -43,7 +37,15 @@ #include "bletest.h" //#include "TraingCardPresenter.h" #include "custom_runtime.h" +#ifdef FD230 +#include "DialModelCharge.h" +#include "DialModelHeartRate.h" +#include "DialModelSPO2.h" +#include "BloodOxygenModel.h" +#include "HeartModel.h" +#include "SaveEleModel.h" #include "producttest/include/testcat1.h" +#endif #include //#include "Systemupgrade.h" namespace OHOS { @@ -53,7 +55,7 @@ extern "C" { #endif /* 订阅事件设定优先级 */ -const PriorityMapper g_pri_mapper[] = { +const PriorityMapper PRI_MAPPER[] = { {TOPIC_EVENT_ALARM_RING, PRIORITY_TWO}, {TOPIC_EVENT_NEXTDAY_UPDATE, PRIORITY_TWO}, {TOPIC_EVENT_ACTIVITY_UPDATE,PRIORITY_TWO}, @@ -102,11 +104,11 @@ const PriorityMapper g_pri_mapper[] = { static bool CheckPriority(const Topic topic) { - uint16_t mapperSize = sizeof(g_pri_mapper) / sizeof(g_pri_mapper[0]); + uint16_t mapperSize = sizeof(PRI_MAPPER) / sizeof(PRI_MAPPER[0]); for (uint16_t i = 0; i < mapperSize; i++) { - if (topic == g_pri_mapper[i].topicId) { - if (g_pri_mapper[i].prId <= OHOS::NativeAbility::GetInstance().GetCurSlicePriority() && - g_pri_mapper[i].prId <= OHOS::NotificationManager::GetInstance()->GetNotifyPriority()) { + if (topic == PRI_MAPPER[i].topicId) { + if (PRI_MAPPER[i].prId <= OHOS::NativeAbility::GetInstance().GetCurSlicePriority() && + PRI_MAPPER[i].prId <= OHOS::NotificationManager::GetInstance()->GetNotifyPriority()) { return true; } else { return false; @@ -168,21 +170,26 @@ void MsgCenterSubscribe() MsgCenterSubscribeTopic(TOPIC_EVENT_DRINKREMINDER); } -static OHOS::UIViewGroup* showAlarmNotify(void) +static OHOS::UIViewGroup* ShowAlarmNotify(void) { return OHOS::CreateAlarmView(); } -static OHOS::UIViewGroup* showPhoneCallNotify(void) +static OHOS::UIViewGroup* ShowPhoneCallNotify(void) { return OHOS::CreatePhoneCallView(); } -static OHOS::UIViewGroup* showCallingNotify(void) +static OHOS::UIViewGroup* ShowCallingNotify(void) { return OHOS::CreateCallingView(); } +static OHOS::UIViewGroup* ShowMultiPhoneCallNotify(void) +{ + return OHOS::CreateMultiplePhoneView(); +} +extern UIViewGroup* CreateCalldialView(void); static OHOS::UIViewGroup* CalldialNotify(void) { return OHOS::CreateCalldialView(); @@ -233,10 +240,10 @@ void MsgCenterNotifyAlarmProc(const Topic topic, Request* req) { unused(req); // The alarm notification is not displayed if the incoming call notification is already being processed - if (CheckPriority(topic) == true) { + if (CheckPriority(topic)) { AlarmClockModel::GetInstance()->PopInterPlayMusic(); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); - NotificationManager::GetInstance()->ShowNotify(showAlarmNotify, (uint16_t)topic, true); + NotificationManager::GetInstance()->ShowNotify(ShowAlarmNotify, static_cast(topic), true); } else { // just delay the alarm WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "just delay the alarm"); @@ -348,45 +355,57 @@ void MsgCenterNotifyNextDayProc(const Topic topic, Request* req) void MsgCenterNotifyHfpIncomingProc(const Topic topic, Request* req) { - unused(topic); - hfp_hf_calls_info_t call_data = {0}; - int32 ret = memcpy_s(&call_data, sizeof(hfp_hf_calls_info_t), req->data, req->len); + hfp_hf_calls_info_t callData = {0}; + int32 ret = memcpy_s(&callData, sizeof(hfp_hf_calls_info_t), req->data, req->len); if (ret != EOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "MsgCenterNotify memcpy_s request data fail!"); } else { // Prevent this from happening: // When the incoming call view is displayed, the calling number is not set in CallerLogModel. - - CallerLogModel::GetInstance()->SetoperateNumber(call_data.number, call_data.number_len); - CallerLogModel::GetInstance()->SetCallSource(CallerLogModel::CallSource::CallSourcePhone); + CallerLogModel::GetInstance()->SetoperateNumber(callData.number, callData.number_len); } NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); CallerLogModel::GetInstance()->SetNotifyFlag(true); - NotificationManager::GetInstance()->ShowNotify(showPhoneCallNotify, (uint16_t)topic, true); + if (GetCurrCallNum() == 1) { + NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, static_cast(topic), true); + } else { + EnableWaitingView(); + } + NotificationManager::GetInstance()->SetWatchCallStatus(true); } void MsgCenterNotifyHfpPhoneProc(const Topic topic, Request* req) { - unused(topic); unused(req); - // just stop the notify - if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) { - NotificationManager::GetInstance()->StopNotify(); + // finish a single-channel call, or switch to phone, stop the notify + if (CallerLogModel::GetInstance()->GetNotifyFlag()) { + DisableWatingView(); + if ((topic == TOPIC_EVENT_HFP_FINISHED && GetCurrCallNum() == 0) || + topic == TOPIC_EVENT_HFP_PHONE_ACTIVE || topic == TOPIC_EVENT_HFP_WATCH_TO_PHONE) { + NotificationManager::GetInstance()->StopNotify(); + NotificationManager::GetInstance()->SetWatchCallStatus(false); + } } } void MsgCenterNotifyHfpWatchProc(const Topic topic, Request* req) { - unused(topic); unused(req); - if (CallerLogModel::GetInstance()->GetNotifyFlag() == true) { + if (CallerLogModel::GetInstance()->GetNotifyFlag()) { NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); // default not mute SetMicMute(false); - NotificationManager::GetInstance()->ShowNotify(showCallingNotify, (uint16_t)topic, true); + if (CallerLogModel::GetInstance()->IsMulitplePhoneStatus()) { + NotificationManager::GetInstance()->ShowNotify(ShowMultiPhoneCallNotify, + static_cast(topic), true); + } else { + NotificationManager::GetInstance()->ShowNotify(ShowCallingNotify, static_cast(topic), true); + } + NotificationManager::GetInstance()->SetWatchCallStatus(true); } } + #ifdef SUPPORT_SPO2_NOTIFICATION_TEST uint32_t md = PPG_SERVICE_CMD_TYPE_DO_PPG_TEST; //灰卡测试 @@ -414,13 +433,13 @@ void MsgCenterNotifyCardProc(const Topic topic, Request* req) ir=atoi(tokbuf); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d,%d,%d",green,red,ir); - +#ifdef FD230 testhrsenson1View * t= testhrsenson1View::GetInstance(); if(t!=NULL) { t->setgrayvalue(green,red,ir); } - +#endif } //漏光测试 void MsgCenterNotifyleaklightProc(const Topic topic, Request* req) @@ -449,7 +468,7 @@ void MsgCenterNotifyleaklightProc(const Topic topic, Request* req) ir=atoi(tokbuf); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d,%d,%d",green,red,ir); - +#ifdef FD230 testhrsenson1View * t= testhrsenson1View::GetInstance(); if(t!=NULL) { @@ -461,6 +480,7 @@ void MsgCenterNotifyleaklightProc(const Topic topic, Request* req) { t_1->setlightvalue(green,red,ir); } +#endif } //穿戴状态 @@ -471,8 +491,10 @@ void MsgCenterNotifyWearStateProc(const Topic topic, Request* req) if ( topic == TOPIC_EVENT_WEARSTATE_UPDATE) { int32_t wear = *((int32_t*)(req->data)); // 进行类型转换 + #ifdef FD230 BloodOxygenModel::GetInstance()->SetWearStatus(wear); HeartModel::GetInstance()->SetWearStatus(wear); + #endif } } //血氧 @@ -483,8 +505,10 @@ void MsgCenterNotifySPO2hProc(const Topic topic, Request* req) if (topic == TOPIC_EVENT_SPO2_UPDATE && req != nullptr && req->data != nullptr) { uint8_t spo2 = *((uint8_t*)(req->data)); // 进行类型转换 + #ifdef FD230 DialModelSPO2::GetInstance()->UpdateSPO2(spo2); BloodOxygenModel::GetInstance()->UpSPO2data(spo2); + #endif } } //心率 @@ -496,8 +520,10 @@ void MsgCenterNotifyHeartRateProc(const Topic topic, Request* req) { u_int8_t heart = *((u_int8_t*)(req->data)); // 进行类型转换 //通知对应信息进行更新 + #ifdef FD230 DialModelHeartRate::GetInstance()->UpdateHeartRate(heart); HeartModel::GetInstance()->UpHeartdata(heart); + #endif } } //开始检测心率 @@ -579,7 +605,7 @@ void MsgCenterNotifyCatIncomingCallProc(const Topic topic, Request* req) NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); CallerLogModel::GetInstance()->SetNotifyFlag(true); - NotificationManager::GetInstance()->ShowNotify(showPhoneCallNotify, (uint16_t)topic, true); + NotificationManager::GetInstance()->ShowNotify(ShowPhoneCallNotify, (uint16_t)topic, true); } void MsgCenterNotifyCat1CallConnectedProc(const Topic topic, Request* req) { @@ -625,7 +651,9 @@ void MsgCenterNotifyCat1dialProc(const Topic topic, Request* req) NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_ONE); CallerLogModel::GetInstance()->SetNotifyFlag(true); + #ifdef FD230 NotificationManager::GetInstance()->ShowNotify(CalldialNotify, (uint16_t)topic, true); + #endif } @@ -743,7 +771,7 @@ void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req) case SHUTDOWN: WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, " SHUTDOWN"); set_lowpower_falg(3); - if (NotificationManager::GetInstance()->hasNotifyShowing()) + if (NotificationManager::GetInstance()->HasNotifyShowing()) NotificationManager::GetInstance()->StopNotify(); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); @@ -753,7 +781,7 @@ void MsgCenterNotifyDeviceBindProc(const Topic topic, Request* req) break; case REBOOT: set_lowpower_falg(4); - if (NotificationManager::GetInstance()->hasNotifyShowing()) + if (NotificationManager::GetInstance()->HasNotifyShowing()) NotificationManager::GetInstance()->StopNotify(); NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); @@ -907,7 +935,7 @@ void MsgCenterNotifybleAPPtraining(const Topic topic, Request* req) } /* 订阅事件通知逻辑可定制 */ -static msg_center_notify_table_t g_msg_center_notify_table[] = { +static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_ALARM_RING, MsgCenterNotifyAlarmProc}, {TOPIC_EVENT_NEXTDAY_UPDATE, MsgCenterNotifyNextDayProc}, {TOPIC_EVENT_HFP_INCOMMING, MsgCenterNotifyHfpIncomingProc}, @@ -921,11 +949,13 @@ static msg_center_notify_table_t g_msg_center_notify_table[] = { {TOPIC_EVENT_INACTIVITY_UPDATE, MsgCenterNotifyInactivityProc}, {TOPIC_EVENT_BLE_TRAINING, MsgCenterNotifybleAPPtraining}, #endif +#ifdef FD230 #ifdef SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION {TOPIC_EVENT_CHARGE_PLUG, MsgCenterNotifyChargePlugProc}, {TOPIC_EVENT_CHARGE_UNPLUG, MsgCenterNotifyChargeUnPlugProc}, {TOPIC_EVENT_LOWPOWER_ALARM, MsgCenterNotifyLowPowerAlarmProc}, #endif +#endif #ifdef SUPPORT_SPO2_NOTIFICATION_TEST {TOPIC_EVENT_SPO2_UPDATE, MsgCenterNotifySPO2hProc}, {TOPIC_EVENT_WEARSTATE_UPDATE, MsgCenterNotifyWearStateProc}, @@ -956,24 +986,24 @@ static msg_center_notify_table_t g_msg_center_notify_table[] = { {TOPIC_EVENT_DRINKREMINDER,MsgCenterNotifyDrinkReminderProc}, }; -static msg_center_notify_table_t *MsgCenterGetNotifyTblCb(uint8_t idx) +static MsgCenterNotifyTable *MsgCenterGetNotifyTblCb(uint8_t idx) { - return &g_msg_center_notify_table[idx]; + return &g_msgCenterNotifyTable[idx]; } static uint8_t MsgCenterGetNotifyTblSize(void) { - return sizeof(g_msg_center_notify_table) / sizeof(g_msg_center_notify_table[0]); + return sizeof(g_msgCenterNotifyTable) / sizeof(g_msgCenterNotifyTable[0]); } bool MsgCenterNotifyProc(const Topic topic, Request* req) { uint8_t i; - uint8_t tbl_size = MsgCenterGetNotifyTblSize(); + uint8_t tblSize = MsgCenterGetNotifyTblSize(); - for (i = 0; i < tbl_size; i++) { - msg_center_notify_table_t *item = MsgCenterGetNotifyTblCb(i); - if (item->topic == topic && item->cb != NULL) { + for (i = 0; i < tblSize; i++) { + MsgCenterNotifyTable *item = MsgCenterGetNotifyTblCb(i); + if (item->topic == topic && item->cb != nullptr) { item->cb(topic, req); return true; } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp index 92935ba35..d0acad55f 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/alarm_notification.cpp @@ -12,28 +12,27 @@ #include "components/ui_image_view.h" #include "components/ui_label.h" -#define RING_AGAIN "响铃将在十分钟后再次响起" -#define NOTIFY_THREE_SECONDS 3000 -#define NOTIFY_ONE_SECOND 1000 -#define NOTIFY_THIRTY_SECONDS 30000 -#define NOTIFY_ONE_MINUTE 60000 -#define NOTOFY_NO_OPERATE_TIME 35000 - namespace OHOS { -osTimerId_t g_notifyStopHandle = NULL; // timer of close view and alarm ring view -osTimerId_t g_alarmRing = NULL; // timer of alarm view - -UIViewGroup* alarmView = nullptr; -UIViewGroup* closeView = nullptr; -UIViewGroup* ringView = nullptr; -UIImageView* imageClose = nullptr; -UIImageView* imageRing = nullptr; -UIImageView* imageDelete = nullptr; -UIImageView* imageClock = nullptr; -UILabel* closeLable = nullptr; -UILabel* ringLable = nullptr; -UILabel* mainLable = nullptr; -UIDigitalClock *dClock = nullptr; +constexpr char* RING_AGAIN = "响铃将在十分钟后再次响起"; +constexpr int32_t NOTIFY_THREE_SECONDS = 3000; +constexpr int32_t NOTIFY_ONE_SECOND = 1000; +constexpr int32_t NOTIFY_THIRTY_SECONDS = 30000; +constexpr int32_t NOTIFY_ONE_MINUTE = 60000; +constexpr int32_t NOTOFY_NO_OPERATE_TIME = 35000; +osTimerId_t g_notifyStopHandle = nullptr; // timer of close view and alarm ring view +osTimerId_t g_alarmRing = nullptr; // timer of alarm view + +UIViewGroup* g_alarmView = nullptr; +UIViewGroup* g_closeView = nullptr; +UIViewGroup* g_ringView = nullptr; +UIImageView* g_imageClose = nullptr; +UIImageView* g_imageRing = nullptr; +UIImageView* g_imageDelete = nullptr; +UIImageView* g_imageClock = nullptr; +UILabel* g_closeLable = nullptr; +UILabel* g_ringLable = nullptr; +UILabel* g_mainLable = nullptr; +UIDigitalClock* g_dClock = nullptr; // alarm close view constexpr int16_t MAX_SET_ZERO_LEN = 0; @@ -89,33 +88,33 @@ void StartAlarmTimer(AlarmTimerType type, int32_t interval) { uint32_t tick; osStatus_t retTimer; - if (type >= NOTIFY_ALARM_UNKNOWN) { + if (type >= AlarmTimerType::NOTIFY_ALARM_UNKNOWN) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartAlarmTimer type:%d invalid!!", type); return; } switch (type) { - case NOTIFY_ALARM_CLOSE: - case NOTIFY_ALARM_DELAY: - g_notifyStopHandle = osTimerNew((osTimerFunc_t)StopNotifyCallback, osTimerPeriodic, NULL, NULL); + case AlarmTimerType::NOTIFY_ALARM_CLOSE: + case AlarmTimerType::NOTIFY_ALARM_DELAY: + g_notifyStopHandle = osTimerNew((osTimerFunc_t)StopNotifyCallback, osTimerPeriodic, nullptr, nullptr); tick = osMs2Tick(interval); retTimer = osTimerStart(g_notifyStopHandle, tick); - if (retTimer != osOK && g_notifyStopHandle != NULL) { + if (retTimer != osOK && g_notifyStopHandle != nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartAlarmTimer osTimerStart failed, type= %d ret = %lx!!", type, retTimer); osTimerDelete(g_notifyStopHandle); - g_notifyStopHandle = NULL; + g_notifyStopHandle = nullptr; return; } break; - case NOTIFY_ALARM_RING: - g_alarmRing = osTimerNew((osTimerFunc_t)NoOperateCallback, osTimerPeriodic, NULL, NULL); + case AlarmTimerType::NOTIFY_ALARM_RING: + g_alarmRing = osTimerNew((osTimerFunc_t)NoOperateCallback, osTimerPeriodic, nullptr, nullptr); tick = osMs2Tick(interval); retTimer = osTimerStart(g_alarmRing, tick); - if (retTimer != osOK && g_alarmRing != NULL) { + if (retTimer != osOK && g_alarmRing != nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartAlarmTimer osTimerStart failed, type= %d ret = %lx!!", type, retTimer); osTimerDelete(g_alarmRing); - g_alarmRing = NULL; + g_alarmRing = nullptr; return; } break; @@ -126,31 +125,31 @@ void StartAlarmTimer(AlarmTimerType type, int32_t interval) void DisableAlarmTimer(AlarmTimerType type) { - if (type >= NOTIFY_ALARM_UNKNOWN) { + if (type >= AlarmTimerType::NOTIFY_ALARM_UNKNOWN) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisableAlarmTimer type:%d invalid!!", type); return; } osStatus_t ret; switch (type) { - case NOTIFY_ALARM_CLOSE: - case NOTIFY_ALARM_DELAY: - if (g_notifyStopHandle != NULL) { + case AlarmTimerType::NOTIFY_ALARM_CLOSE: + case AlarmTimerType::NOTIFY_ALARM_DELAY: + if (g_notifyStopHandle != nullptr) { ret = osTimerDelete(g_notifyStopHandle); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisableAlarmTimer failed, type= %d ret = %lx!", type, ret); return; } - g_notifyStopHandle = NULL; + g_notifyStopHandle = nullptr; } break; - case NOTIFY_ALARM_RING: - if (g_alarmRing != NULL) { + case AlarmTimerType::NOTIFY_ALARM_RING: + if (g_alarmRing != nullptr) { ret = osTimerDelete(g_alarmRing); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisableAlarmTimer failed, type= %d ret = %lx!", type, ret); return; } - g_alarmRing = NULL; + g_alarmRing = nullptr; } break; default: @@ -160,254 +159,256 @@ void DisableAlarmTimer(AlarmTimerType type) UIViewGroup *CreateAlarmCloseView() { - closeView = new UIViewGroup(); - if (closeView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmCloseView closeView null!"); + g_closeView = new UIViewGroup(); + if (g_closeView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmCloseView g_closeView null!"); return nullptr; } - closeView->SetPosition(MAX_SET_ZERO_LEN, MAX_SET_ZERO_LEN); - closeView->SetWidth(Screen::GetInstance().GetWidth()); - closeView->SetHeight(Screen::GetInstance().GetHeight()); - imageClose = new UIImageView(); - if (imageClose == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmCloseView imageClose null!"); - delete closeView; - closeView = nullptr; + g_closeView->SetPosition(MAX_SET_ZERO_LEN, MAX_SET_ZERO_LEN); + g_closeView->SetWidth(Screen::GetInstance().GetWidth()); + g_closeView->SetHeight(Screen::GetInstance().GetHeight()); + g_imageClose = new UIImageView(); + if (g_imageClose == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmCloseView g_imageClose null!"); + delete g_closeView; + g_closeView = nullptr; return nullptr; } - imageClose->SetPosition(MAX_IMAGE_X_LEN, MAX_IMAGE_Y_LEN); - imageClose->SetWidth(MAX_SET_SRC_LEN); - imageClose->SetHeight(MAX_SET_SRC_LEN); - imageClose->SetSrc(ALARM_CLOCK_CLOSE_ADD_PATH); - imageClose->SetTouchable(true); - closeView->Add(imageClose); - - closeLable = new UILabel(); - if (closeLable == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmCloseView closeLable null!"); - delete closeView; - closeView = nullptr; - delete imageClose; - imageClose = nullptr; + g_imageClose->SetPosition(MAX_IMAGE_X_LEN, MAX_IMAGE_Y_LEN); + g_imageClose->SetWidth(MAX_SET_SRC_LEN); + g_imageClose->SetHeight(MAX_SET_SRC_LEN); + g_imageClose->SetSrc(ALARM_CLOCK_CLOSE_ADD_PATH); + g_imageClose->SetTouchable(true); + g_closeView->Add(g_imageClose); + + g_closeLable = new UILabel(); + if (g_closeLable == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmCloseView g_closeLable null!"); + delete g_closeView; + g_closeView = nullptr; + delete g_imageClose; + g_imageClose = nullptr; return nullptr; } - closeLable->SetPosition(MAX_LABEL_X_LEN, MAX_LABEL_Y_LEN, MAX_LABEL_LENGTH_LEN, MAX_LABEL_HEIGHT_LEN); - closeLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, MAX_LABEL_FONT_LEN); - closeLable->SetText("CLOSE"); - closeView->Add(closeLable); - closeView->SetViewId(ALARM_VIEW_CLOSE); - UIView::OnDragListener *listener =static_cast(AlarmViewEventListener::GetInstance()); - closeView->SetOnDragListener(listener); - closeView->SetDraggable(true); - closeView->SetTouchable(true); - return closeView; + g_closeLable->SetPosition(MAX_LABEL_X_LEN, MAX_LABEL_Y_LEN, MAX_LABEL_LENGTH_LEN, MAX_LABEL_HEIGHT_LEN); + g_closeLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, MAX_LABEL_FONT_LEN); + g_closeLable->SetText("CLOSE"); + g_closeView->Add(g_closeLable); + g_closeView->SetViewId(ALARM_VIEW_CLOSE); + UIView::OnDragListener *listener = static_cast(AlarmViewEventListener::GetInstance()); + g_closeView->SetOnDragListener(listener); + g_closeView->SetDraggable(true); + g_closeView->SetTouchable(true); + return g_closeView; } void FreeAlarmCloseView(void) { - if (closeView != nullptr) { - DisableAlarmTimer(NOTIFY_ALARM_CLOSE); - closeView->RemoveAll(); - delete imageClose; - imageClose = nullptr; - delete closeLable; - closeLable = nullptr; - RootView::GetInstance()->Remove(closeView); - delete closeView; - closeView = nullptr; + if (g_closeView != nullptr) { + DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_CLOSE); + g_closeView->RemoveAll(); + delete g_imageClose; + g_imageClose = nullptr; + delete g_closeLable; + g_closeLable = nullptr; + RootView::GetInstance()->Remove(g_closeView); + delete g_closeView; + g_closeView = nullptr; } } UIViewGroup *CreateAlarmRingView() { - ringView = new UIViewGroup(); - if (ringView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmRingView ringView null!"); + g_ringView = new UIViewGroup(); + if (g_ringView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmRingView g_ringView null!"); return nullptr; } - ringView->SetPosition(SET_ZERO, SET_ZERO); - ringView->SetWidth(Screen::GetInstance().GetWidth()); - ringView->SetHeight(Screen::GetInstance().GetHeight()); - imageRing = new UIImageView(); - if (imageRing == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmRingView imageRing null!"); - delete ringView; - ringView = nullptr; + g_ringView->SetPosition(SET_ZERO, SET_ZERO); + g_ringView->SetWidth(Screen::GetInstance().GetWidth()); + g_ringView->SetHeight(Screen::GetInstance().GetHeight()); + g_imageRing = new UIImageView(); + if (g_imageRing == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmRingView g_imageRing null!"); + delete g_ringView; + g_ringView = nullptr; return nullptr; } - imageRing->SetPosition(DELAY_IMAGE_X, DELAY_IMAGE_Y); - imageRing->SetWidth(SET_SRC); - imageRing->SetHeight(SET_SRC); - imageRing->SetSrc(ALARM_CLOCK_POP_ADD_PATH); - ringView->Add(imageRing); - ringLable = new UILabel(); - if (ringLable == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmRingView::ringLable null!"); - delete ringView; - ringView = nullptr; - delete imageRing; + g_imageRing->SetPosition(DELAY_IMAGE_X, DELAY_IMAGE_Y); + g_imageRing->SetWidth(SET_SRC); + g_imageRing->SetHeight(SET_SRC); + g_imageRing->SetSrc(ALARM_CLOCK_POP_ADD_PATH); + g_ringView->Add(g_imageRing); + g_ringLable = new UILabel(); + if (g_ringLable == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmRingView::g_ringLable null!"); + delete g_ringView; + g_ringView = nullptr; + delete g_imageRing; return nullptr; } - ringLable->SetPosition(DELAY_LABEL_X, DELAY_LABEL_Y, DELAY_LABEL_LENGTH, DELAY_LABEL_HEIGHT); - ringLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, DELAY_LABEL_FONT); - ringLable->SetText(RING_AGAIN); - ringView->Add(ringLable); - ringView->SetViewId(ALARM_VIEW_DELAY); - UIView::OnDragListener *listener =static_cast(AlarmViewEventListener::GetInstance()); - ringView->SetOnDragListener(listener); - ringView->SetDraggable(true); - ringView->SetTouchable(true); - return ringView; + g_ringLable->SetPosition(DELAY_LABEL_X, DELAY_LABEL_Y, DELAY_LABEL_LENGTH, DELAY_LABEL_HEIGHT); + g_ringLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, DELAY_LABEL_FONT); + g_ringLable->SetText(RING_AGAIN); + g_ringView->Add(g_ringLable); + g_ringView->SetViewId(ALARM_VIEW_DELAY); + UIView::OnDragListener *listener = static_cast(AlarmViewEventListener::GetInstance()); + g_ringView->SetOnDragListener(listener); + g_ringView->SetDraggable(true); + g_ringView->SetTouchable(true); + return g_ringView; } void FreeAlarmRingView(void) { - if (ringView != nullptr) { - DisableAlarmTimer(NOTIFY_ALARM_DELAY); - ringView->RemoveAll(); - delete imageRing; - imageRing = nullptr; - delete ringLable; - ringLable = nullptr; - RootView::GetInstance()->Remove(ringView); - delete ringView; - ringView = nullptr; + if (g_ringView != nullptr) { + DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_DELAY); + g_ringView->RemoveAll(); + delete g_imageRing; + g_imageRing = nullptr; + delete g_ringLable; + g_ringLable = nullptr; + RootView::GetInstance()->Remove(g_ringView); + delete g_ringView; + g_ringView = nullptr; } } static bool CreateAlarmViewImage(void) { - imageDelete = new UIImageView(); - if (imageDelete == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showAlarmNotify imageDelete null!"); + g_imageDelete = new UIImageView(); + if (g_imageDelete == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showAlarmNotify g_imageDelete null!"); return false; } - imageDelete->SetPosition(IMAGE_DELETE_X, IMAGE_DELETE_Y); - imageDelete->SetWidth(MAX_SET_SRC_LEN); - imageDelete->SetHeight(MAX_SET_SRC_LEN); - imageDelete->SetViewId(ALARM_IMAGE_DELETE); - imageDelete->SetSrc(ALARM_DELETE_ADD_PATH); - imageDelete->SetTouchable(true); - UIView::OnClickListener *closeListener = (UIView::OnClickListener *)AlarmViewEventListener::GetInstance(); - imageDelete->SetOnClickListener(closeListener); - - imageClock = new UIImageView(); - if (imageClock == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showAlarmNotify imageClock null!"); - delete imageDelete; + g_imageDelete->SetPosition(IMAGE_DELETE_X, IMAGE_DELETE_Y); + g_imageDelete->SetWidth(MAX_SET_SRC_LEN); + g_imageDelete->SetHeight(MAX_SET_SRC_LEN); + g_imageDelete->SetViewId(ALARM_IMAGE_DELETE); + g_imageDelete->SetSrc(ALARM_DELETE_ADD_PATH); + g_imageDelete->SetTouchable(true); + UIView::OnClickListener *closeListener = static_cast\ + (AlarmViewEventListener::GetInstance()); + g_imageDelete->SetOnClickListener(closeListener); + + g_imageClock = new UIImageView(); + if (g_imageClock == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "showAlarmNotify g_imageClock null!"); + delete g_imageDelete; return false; } - imageClock->SetPosition(IMAGE_CLOCK_X, IMAGE_CLOCK_Y); - imageClock->SetWidth(MAX_SET_SRC_LEN); - imageClock->SetHeight(MAX_SET_SRC_LEN); - imageClock->SetViewId(ALARM_IMAGE_CLOCK); - imageClock->SetSrc(ALARM_CLOCK_ADD_PATH); - imageClock->SetTouchable(true); - imageClock->SetTouchable(true); - UIView::OnClickListener *clockListener = (UIView::OnClickListener *)OHOS::AlarmViewEventListener::GetInstance(); - imageClock->SetOnClickListener(clockListener); + g_imageClock->SetPosition(IMAGE_CLOCK_X, IMAGE_CLOCK_Y); + g_imageClock->SetWidth(MAX_SET_SRC_LEN); + g_imageClock->SetHeight(MAX_SET_SRC_LEN); + g_imageClock->SetViewId(ALARM_IMAGE_CLOCK); + g_imageClock->SetSrc(ALARM_CLOCK_ADD_PATH); + g_imageClock->SetTouchable(true); + g_imageClock->SetTouchable(true); + UIView::OnClickListener *clockListener = static_cast\ + (OHOS::AlarmViewEventListener::GetInstance()); + g_imageClock->SetOnClickListener(clockListener); return true; } static void FreeAlarmViewImage(void) { - delete imageDelete; - imageDelete = nullptr; - delete imageClock; - imageClock = nullptr; + delete g_imageDelete; + g_imageDelete = nullptr; + delete g_imageClock; + g_imageClock = nullptr; } static bool CreateAlarmViewLabel(void) { - struct tm local_time; - time_t seconds; - seconds = time(NULL); - int16 thisHour, thisMin; - - mainLable = new UILabel(); - if (mainLable == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmViewLabel mainLable is nullptr"); + struct tm localTime; + int16 thisHour; + int16 thisMin; + + g_mainLable = new UILabel(); + if (g_mainLable == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmViewLabel g_mainLable is nullptr"); return false; } - mainLable->SetPosition(LABEL_X, LABEL_Y, LABEL_WIDTH, LABEL_HEIGHT); - mainLable->SetText("闹钟"); - mainLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); - - dClock = new UIDigitalClock(); - if (dClock == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmViewLabel dClock is nullptr"); - delete mainLable; + g_mainLable->SetPosition(LABEL_X, LABEL_Y, LABEL_WIDTH, LABEL_HEIGHT); + g_mainLable->SetText("闹钟"); + g_mainLable->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LABEL_FONT); + + g_dClock = new UIDigitalClock(); + if (g_dClock == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmViewLabel g_dClock is nullptr"); + delete g_mainLable; return false; } - dClock->SetPosition(CLOCK_X, CLOCK_Y); - dClock->Resize(DIGITAL_CLOCK_WIDTH, DIGITAL_CLOCK_HEIGHT); - dClock->SetFont(DEFAULT_VECTOR_FONT_FILENAME, CLOCK_FONT); - if (localtime_r(&seconds, &local_time) == NULL) { + g_dClock->SetPosition(CLOCK_X, CLOCK_Y); + g_dClock->Resize(DIGITAL_CLOCK_WIDTH, DIGITAL_CLOCK_HEIGHT); + g_dClock->SetFont(DEFAULT_VECTOR_FONT_FILENAME, CLOCK_FONT); + time_t seconds = time(nullptr); + if (localtime_r(&seconds, &localTime) == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmViewLabel get localtime error!"); - delete mainLable; - delete dClock; + delete g_mainLable; + delete g_dClock; return false; } AlarmClockModel::GetInstance()->GetPopTimeData(&thisHour, &thisMin); - dClock->SetDisplayMode(UIDigitalClock::DISPLAY_24_HOUR_NO_SECONDS); - dClock->SetTime24Hour(thisHour, thisMin, 0); + g_dClock->SetDisplayMode(UIDigitalClock::DISPLAY_24_HOUR_NO_SECONDS); + g_dClock->SetTime24Hour(thisHour, thisMin, 0); return true; } static void FreeAlarmViewLabel(void) { - delete mainLable; - mainLable = nullptr; - delete dClock; - dClock = nullptr; + delete g_mainLable; + g_mainLable = nullptr; + delete g_dClock; + g_dClock = nullptr; } UIViewGroup* CreateAlarmView(void) { AlarmClockModel::GetInstance()->AlarmGetClockNum(); - alarmView = new UIViewGroup(); - if (alarmView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmView alarmView null!"); + g_alarmView = new UIViewGroup(); + if (g_alarmView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateAlarmView g_alarmView null!"); return nullptr; } - alarmView->SetPosition(CONTAINER_X, CONTAINER_Y, - Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - alarmView->SetViewId(ALARM_VIEW_POPUP); + g_alarmView->SetPosition(CONTAINER_X, CONTAINER_Y, + Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + g_alarmView->SetViewId(ALARM_VIEW_POPUP); - if (CreateAlarmViewLabel() == false) { - delete alarmView; - alarmView = nullptr; + if (!CreateAlarmViewLabel()) { + delete g_alarmView; + g_alarmView = nullptr; return nullptr; } - if (CreateAlarmViewImage() == false) { - delete alarmView; - alarmView = nullptr; + if (!CreateAlarmViewImage()) { + delete g_alarmView; + g_alarmView = nullptr; FreeAlarmViewLabel(); return nullptr; } - alarmView->Add(mainLable); - alarmView->Add(dClock); - alarmView->Add(imageDelete); - alarmView->Add(imageClock); - - alarmView->SetDraggable(true); - alarmView->SetTouchable(true); - UIView::OnDragListener *listener =static_cast(AlarmViewEventListener::GetInstance()); - alarmView->SetOnDragListener(listener); - StartAlarmTimer(NOTIFY_ALARM_RING, (int32_t)NOTOFY_NO_OPERATE_TIME); - return alarmView; + g_alarmView->Add(g_mainLable); + g_alarmView->Add(g_dClock); + g_alarmView->Add(g_imageDelete); + g_alarmView->Add(g_imageClock); + + g_alarmView->SetDraggable(true); + g_alarmView->SetTouchable(true); + UIView::OnDragListener *listener = static_cast(AlarmViewEventListener::GetInstance()); + g_alarmView->SetOnDragListener(listener); + StartAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING, NOTOFY_NO_OPERATE_TIME); + return g_alarmView; } void FreeAlarmView(void) { - if (alarmView != nullptr) { - DisableAlarmTimer(NOTIFY_ALARM_RING); - alarmView->RemoveAll(); + if (g_alarmView != nullptr) { + DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING); + g_alarmView->RemoveAll(); FreeAlarmViewLabel(); FreeAlarmViewImage(); - RootView::GetInstance()->Remove(alarmView); - delete alarmView; - alarmView = nullptr; + RootView::GetInstance()->Remove(g_alarmView); + delete g_alarmView; + g_alarmView = nullptr; } } @@ -436,13 +437,13 @@ bool AlarmViewEventListener::OnDragEnd(UIView& view, const DragEvent& event) { if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { if (strcmp(view.GetViewId(), ALARM_VIEW_POPUP) == 0) { - DisableAlarmTimer(NOTIFY_ALARM_RING); + DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING); AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); UIViewGroup* alarmRingView = CreateAlarmRingView(); NotificationManager::GetInstance()->screenContainer_->SetVisible(false); RootView::GetInstance()->Add(alarmRingView); alarmRingView->SetVisible(true); - StartAlarmTimer(NOTIFY_ALARM_DELAY, (int32_t)NOTIFY_THREE_SECONDS); + StartAlarmTimer(AlarmTimerType::NOTIFY_ALARM_DELAY, NOTIFY_THREE_SECONDS); } else if (strcmp(view.GetViewId(), ALARM_VIEW_CLOSE) == 0 || strcmp(view.GetViewId(), ALARM_VIEW_DELAY) == 0) { NotificationManager::GetInstance()->StopNotify(); @@ -456,23 +457,23 @@ bool AlarmViewEventListener::OnClick(UIView& view, const ClickEvent& event) UNUSED(event); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlamNotify ClickListener %s", view.GetViewId()); if (strcmp(view.GetViewId(), ALARM_IMAGE_DELETE) == 0) { - DisableAlarmTimer(NOTIFY_ALARM_RING); + DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING); AlarmPopUpPresenter::GetInstance()->CancelAlarmRing(); UIViewGroup* alarmCloseView = CreateAlarmCloseView(); NotificationManager::GetInstance()->screenContainer_->SetVisible(false); RootView::GetInstance()->Add(alarmCloseView); alarmCloseView->SetVisible(true); - StartAlarmTimer(NOTIFY_ALARM_CLOSE, (int32_t)NOTIFY_THREE_SECONDS); + StartAlarmTimer(AlarmTimerType::NOTIFY_ALARM_CLOSE, NOTIFY_THREE_SECONDS); return true; } else if (strcmp(view.GetViewId(), ALARM_IMAGE_CLOCK) == 0) { - DisableAlarmTimer(NOTIFY_ALARM_RING); + DisableAlarmTimer(AlarmTimerType::NOTIFY_ALARM_RING); AlarmPopUpPresenter::GetInstance()->DelayAlarmRing(); UIViewGroup* alarmRingView = CreateAlarmRingView(); NotificationManager::GetInstance()->screenContainer_->SetVisible(false); RootView::GetInstance()->Add(alarmRingView); alarmRingView->SetVisible(true); - StartAlarmTimer(NOTIFY_ALARM_DELAY, (int32_t)NOTIFY_THREE_SECONDS); + StartAlarmTimer(AlarmTimerType::NOTIFY_ALARM_DELAY, NOTIFY_THREE_SECONDS); } return true; } -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp index 26ace86e0..644f62599 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/drinkReminder_notification.cpp @@ -3,7 +3,9 @@ #include "components/ui_button.h" #include "components/ui_image_view.h" #include "components/ui_label_ext.h" +#ifdef FD230 #include "language/font/ui_resource_string.h" +#endif #include namespace OHOS @@ -72,8 +74,11 @@ namespace OHOS DrinkReminderTitleLabel->SetPosition(83, 52, 300, 35); DrinkReminderTitleLabel->SetStyle(STYLE_TEXT_FONT, 30); DrinkReminderTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - // DrinkReminderTitleLabel->SetText("喝水提醒"); + #ifdef FD230 DrinkReminderTitleLabel->SetTextId(STR_DRINK_WATER_REMINDER); + #else + DrinkReminderTitleLabel->SetText("喝水提醒"); + #endif DrinkReminderTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); DrinkReminderTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); DrinkReminderTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -96,7 +101,9 @@ namespace OHOS DrinkReminderNoteLabel->SetPosition(53, 248, 360, 70); DrinkReminderNoteLabel->SetStyle(STYLE_TEXT_FONT, 30); DrinkReminderNoteLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + #ifdef FD230 SetLabelId(DrinkReminderNoteLabel, STR_DRINK_WATER_REMINDER_NOTE); + #endif DrinkReminderNoteLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); DrinkReminderNoteLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); DrinkReminderNoteLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -124,8 +131,11 @@ namespace OHOS DrinkReminderLabel->SetPosition(133, 399, 200, 35); DrinkReminderLabel->SetStyle(STYLE_TEXT_FONT, 30); DrinkReminderLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - // DrinkReminderLabel->SetText("知道了"); + #ifdef FD230 DrinkReminderLabel->SetTextId(STR_KONW); + #else + DrinkReminderLabel->SetText("知道了"); + #endif DrinkReminderLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); DrinkReminderLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); DrinkReminderLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp index baa7cd9c8..a7c9f3ff3 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/makephone_notification.cpp @@ -21,22 +21,23 @@ #ifdef SUPPORT_CAT1_SERVICE #include "cat1_server.h" #endif -#include "cat1_server.h" -#define NOTIFY_THREE_SECONDS 3000 -#define NOTIFY_ONE_SECOND 1000 -#define NOTIFY_THIRTY_SECONDS 30000 -#define NOTIFY_ONE_MINUTE 60000 -#define NOTOFY_NO_OPERATE_TIME 35000 - #include "cat1_server_hal.h" -#include "NativeAbility.h" #include "custom_utils.h" -#include "phoneaddressmodel.h" +// #define NOTIFY_THREE_SECONDS 3000 +// #define NOTIFY_ONE_SECOND 1000 +// #define NOTIFY_THIRTY_SECONDS 30000 +// #define NOTIFY_ONE_MINUTE 60000 +// #define NOTOFY_NO_OPERATE_TIME 35000 namespace OHOS { -int changeImage = 0; -osTimerId_t g_callDuration = NULL; // timer of call duration -osTimerId_t g_callCurrentTime = NULL; // timer of current time +constexpr int32_t NOTIFY_THREE_SECONDS = 3000; +constexpr int32_t NOTIFY_ONE_SECOND = 1000; +constexpr int32_t NOTIFY_THIRTY_SECONDS = 30000; +constexpr int32_t NOTIFY_ONE_MINUTE = 60000; +constexpr int32_t NOTOFY_NO_OPERATE_TIME = 35000; +int g_changeImage = 0; +osTimerId_t g_callDurationTimer = nullptr; // timer of call duration +osTimerId_t g_callCurrentTime = nullptr; // timer of current time osTimerId_t g_calldialTime = NULL; static constexpr uint16 MATH_ZERO = 0; @@ -56,6 +57,8 @@ static constexpr uint16 LABEL_COMINGTIME_POSITION_Y = 340; // 图片坐标 static constexpr uint16 LABEL_CALLERD_POSITION_X = 0; static constexpr uint16 LABEL_CALLERD_POSITION_Y = 160; +static constexpr uint16 LABEL_NEWCALLERD_POSITION_X = 0; +static constexpr uint16 LABEL_NEWCALLERD_POSITION_Y = 160; static constexpr uint16 IMAGE_HONRS_POSITION_X = 185; static constexpr uint16 IMAGE_HONRS_POSITION_Y = 10; static constexpr uint16 IMAGE_HANDUP_POSITION_X = 70; @@ -63,27 +66,34 @@ static constexpr uint16 IMAGE_MIC_POSITION_X = 280; static constexpr uint16 IMAGE_DISSGREE_POSITION_X = 80; static constexpr uint16 IMAGE_AGREEING_POSITION_X = 270; static constexpr uint16 IMAGE_ALL_POSITION_Y = 240; +static constexpr uint16 IMAGE_HANDUP2_POSITION_X = 177; +static constexpr uint16 IMAGE_HANDUP2_POSITION_Y = 270; // 字体大小 static constexpr uint16 FONT_CURRENT_SIZE = 25; static constexpr uint16 FONT_CALLER_SIZE = 40; -UIViewGroup* phoneView = nullptr; -UIViewGroup* callingView = nullptr; -UIViewGroup* calldialView = nullptr; -UIViewGroup* volumeSettingView = nullptr; -VolumeSettingView *volumeSetting = nullptr; -UIImageView* imageAgree = nullptr; -UIImageView* imageDissgree = nullptr; -UIImageView* imageMicrophone = nullptr; -UIImageView* imageHandUp = nullptr; -UIImageView* imageHorns = nullptr; -UILabel* callerNum = nullptr; -UILabel* callername = nullptr; -UILabel* callerDisplay = nullptr; -UILabel* callDuration = nullptr; -UILabel* currentTimes = nullptr; -UILabel* comingTimes = nullptr; +UIViewGroup* g_phoneView = nullptr; +UIViewGroup* g_multiPhoneView = nullptr; +UIViewGroup* g_callingView = nullptr; +UIViewGroup* g_waitingHintsView = nullptr; +VolumeSettingView *g_volumeSetting = nullptr; +UIImageView* g_imageAgree = nullptr; +UIImageView* g_imageDissgree = nullptr; +UIImageView* g_imageMicrophone = nullptr; +UIImageView* g_imageHandUp = nullptr; +UIImageView* g_imageHorns = nullptr; +UIImageView* g_imageDissgreeNew = nullptr; +UILabel* g_callerNum = nullptr; +UILabel* g_callerDisplay = nullptr; +UILabel* g_callDuration = nullptr; +UILabel* g_currentTimes = nullptr; +UILabel* g_comingTimes = nullptr; +UILabel* g_newCallHints = nullptr; +UILabel* g_newCallNum = nullptr; + +UILabel* callername = nullptr; +UIViewGroup* calldialView = nullptr; UILabel *diallabel1 = nullptr; UILabel *diallabl2 = nullptr; UIButton *button1dial = nullptr; @@ -108,13 +118,16 @@ void calllog_info_init() info.nameLen=3; int len=strlen(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); memcpy_s(info.tel,20,CallerLogModel::GetInstance()->GetPhoneNumber().c_str(),len+1); - uapi_get_timestampe_ms(&info.creationTime); + uint32_t tmptime=0; + uapi_get_timestampe_ms(&tmptime); + info.creationTime = tmptime; info.callDurTime=0; info.telLen=len; } + void addcalllog() { if(call_stat==0) @@ -169,9 +182,11 @@ void CallTimerCallBack(int data) void CallTimerCallBackProc(int data) { + #ifdef FD230 g_callTimesadd(); - if (callDuration != nullptr) { - callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration()); + #endif + if (g_callDuration != nullptr) { + g_callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str()); } } @@ -188,8 +203,8 @@ void CalldialTimerCallBackProc(int data) void CallCurTimerCallBack(int data) { - if (currentTimes != nullptr) { - currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); + if (g_currentTimes != nullptr) { + g_currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); } } @@ -197,36 +212,36 @@ void StartCallTimer(CallTimerType type, int32_t interval) { uint32_t tick; osStatus_t retTimer; - if (type >= NOTIFY_PHONE_UNKNOWN) { + if (type >= CallTimerType::NOTIFY_PHONE_UNKNOWN) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartCallTimer type:%d invalid!!", type); return; } switch (type) { - case NOTIFY_PHONE_CALLING_DISPLAY: - g_callDuration = osTimerNew((osTimerFunc_t)CallTimerCallBack, osTimerPeriodic, NULL, NULL); + case CallTimerType::NOTIFY_PHONE_CALLING_DISPLAY: + g_callDurationTimer = osTimerNew((osTimerFunc_t)CallTimerCallBack, osTimerPeriodic, nullptr, nullptr); tick = osMs2Tick(interval); - retTimer = osTimerStart(g_callDuration, tick); - if (retTimer != osOK && g_callDuration != NULL) { + retTimer = osTimerStart(g_callDurationTimer, tick); + if (retTimer != osOK && g_callDurationTimer != nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartCallTimer osTimerStart failed, type = %d ret = %lx!!", type, retTimer); - osTimerDelete(g_callDuration); - g_callDuration = NULL; + osTimerDelete(g_callDurationTimer); + g_callDurationTimer = nullptr; return; } break; - case NOTIFY_PHONE_CURTIME_DISPLAY: - g_callCurrentTime = osTimerNew((osTimerFunc_t)CallCurTimerCallBack, osTimerPeriodic, NULL, NULL); + case CallTimerType::NOTIFY_PHONE_CURTIME_DISPLAY: + g_callCurrentTime = osTimerNew((osTimerFunc_t)CallCurTimerCallBack, osTimerPeriodic, nullptr, nullptr); tick = osMs2Tick(interval); retTimer = osTimerStart(g_callCurrentTime, tick); - if (retTimer != osOK && g_callCurrentTime != NULL) { + if (retTimer != osOK && g_callCurrentTime != nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "StartCallTimer osTimerStart failed, type = %d ret = %lx!!", type, retTimer); osTimerDelete(g_callCurrentTime); - g_callCurrentTime = NULL; + g_callCurrentTime = nullptr; return; } break; - case NOTIFY_PHONE_DIAL_DISPLAY: + case CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY: g_calldialTime = osTimerNew((osTimerFunc_t)CallCurTimerCallBack, osTimerPeriodic, NULL, NULL); tick = osMs2Tick(interval); retTimer = osTimerStart(g_calldialTime, tick); @@ -245,38 +260,38 @@ void StartCallTimer(CallTimerType type, int32_t interval) void DisableCallTimer(CallTimerType type) { - if (type >= NOTIFY_PHONE_UNKNOWN) { + if (type >= CallTimerType::NOTIFY_PHONE_UNKNOWN) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisableCallTimer type:%d invalid!!", type); return; } osStatus_t ret; switch (type) { - case NOTIFY_PHONE_CALLING_DISPLAY: + case CallTimerType::NOTIFY_PHONE_CALLING_DISPLAY: #ifdef FD230 - if (g_callDuration != NULL) { + if (g_callDurationTimer != nullptr) { info.callDurTime=get_g_callTimes(); g_callTimesclean(); addcalllog(); - ret = osTimerDelete(g_callDuration); + ret = osTimerDelete(g_callDurationTimer); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisableCallTimer failed, type= %d ret = %lx!", type, ret); return; } - g_callDuration = NULL; + g_callDurationTimer = nullptr; } break; #endif - case NOTIFY_PHONE_CURTIME_DISPLAY: - if (g_callCurrentTime != NULL) { + case CallTimerType::NOTIFY_PHONE_CURTIME_DISPLAY: + if (g_callCurrentTime != nullptr) { ret = osTimerDelete(g_callCurrentTime); if (ret != osOK) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "DisableCallTimer failed, type= %d ret = %lx!", type, ret); return; } - g_callCurrentTime = NULL; + g_callCurrentTime = nullptr; } break; - case NOTIFY_PHONE_DIAL_DISPLAY: + case CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY: if (g_calldialTime != NULL) { ret = osTimerDelete(g_calldialTime); if (ret != osOK) { @@ -294,210 +309,278 @@ void DisableCallTimer(CallTimerType type) void HonrsViewChange(void) { - if (volumeSettingView == nullptr) { - volumeSetting = new VolumeSettingView(); - if (volumeSetting == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "makephone_notification::volumeSetting nullptr err"); + if (g_volumeSetting == nullptr) { + g_volumeSetting = new VolumeSettingView(); + if (g_volumeSetting == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "makephone_notification::g_volumeSetting nullptr err"); return; } - if (volumeSetting->SetUpVolume() == false) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "makephone_notification::volumeSetting SetUpVolume fail"); + if (!g_volumeSetting->SetUpVolume()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "makephone_notification::g_volumeSetting SetUpVolume fail"); return; } - volumeSetting->GetProgress()->SetValue(AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO)); + g_volumeSetting->GetProgress()->SetValue( + AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO)); if (AudioManager::GetInstance().GetVolume(AUDIO_STREAM_VOICE_CALL_BT_SCO) == 0) { ImageInfo *image = ImageCacheManager::GetInstance().LoadOneInMultiRes(PLAYER_MUTE_BUTTON, PLAYER_IAMGES); - volumeSetting->GetDecreaseButton()->SetImageSrc(image, image); + g_volumeSetting->GetDecreaseButton()->SetImageSrc(image, image); } - volumeSettingView = volumeSetting; - NotificationManager::GetInstance()->screenContainer_->Add(volumeSettingView); + NotificationManager::GetInstance()->screenContainer_->Add(g_volumeSetting); } - VolumeSliderEventListener *volumeSliderEventListener = VolumeSliderEventListener::GetInstance(); + VolumeSliderEventListener *volumeSliderEventListener = g_volumeSetting->GetVolumeEventListener(); if (volumeSliderEventListener == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "makephone_notification::volumeSliderEventListener nullptr err"); return; } UIView::OnDragListener *dragListener = (UIView::OnDragListener *)OHOS::CallViewEventListener::GetInstance(); - volumeSettingView->SetOnDragListener(dragListener); - // volumeSliderEventListener->SetPlayerCoefficients(VOLUMEPHONENOTIFY); // 进度条系数 - volumeSettingView->SetVisible(true); + g_volumeSetting->SetOnDragListener(dragListener); + volumeSliderEventListener->SetPlayerCoefficients(VOLUMEPHONENOTIFY); // 进度条系数 + g_volumeSetting->SetVisible(true); // 刷新UI RootView::GetInstance()->Invalidate(); } +VolumeSettingView *GetvolumeSetting(void) +{ + return g_volumeSetting; +} static void FreeCallingViewImage(void) { - if (imageMicrophone != nullptr) { - delete imageMicrophone; - imageMicrophone = nullptr; + if (g_imageMicrophone != nullptr) { + delete g_imageMicrophone; + g_imageMicrophone = nullptr; } - if (imageHandUp != nullptr) { - delete imageHandUp; - imageHandUp = nullptr; + if (g_imageHandUp != nullptr) { + delete g_imageHandUp; + g_imageHandUp = nullptr; } - if (imageHorns != nullptr) { - delete imageHorns; - imageHorns = nullptr; + if (g_imageHorns != nullptr) { + delete g_imageHorns; + g_imageHorns = nullptr; } } static bool DrawCallingViewImage(void) { - imageMicrophone = new UIImageView(); - if (imageMicrophone == nullptr) { + g_imageMicrophone = new UIImageView(); + if (g_imageMicrophone == nullptr) { return false; } - imageMicrophone->SetPosition(IMAGE_MIC_POSITION_X, IMAGE_ALL_POSITION_Y); - imageMicrophone->SetSrc(PNG_MICROPHONE_OPEN_IMAGE_PATH); - imageMicrophone->SetTouchable(true); - imageMicrophone->SetViewId("microphoneChange"); + g_imageMicrophone->SetPosition(IMAGE_MIC_POSITION_X, IMAGE_ALL_POSITION_Y); + g_imageMicrophone->SetSrc(PNG_MICROPHONE_OPEN_IMAGE_PATH); + g_imageMicrophone->SetTouchable(true); + g_imageMicrophone->SetViewId("microphoneChange"); - imageHandUp = new UIImageView(); - if (imageHandUp == nullptr) { + g_imageHandUp = new UIImageView(); + if (g_imageHandUp == nullptr) { FreeCallingViewImage(); return false; } - imageHandUp->SetPosition(IMAGE_HANDUP_POSITION_X, IMAGE_ALL_POSITION_Y); - imageHandUp->SetSrc(PNG_DISSGREE_IMAGE_PATH); - imageHandUp->SetTouchable(true); - imageHandUp->SetViewId("callingHandUp"); + g_imageHandUp->SetPosition(IMAGE_HANDUP_POSITION_X, IMAGE_ALL_POSITION_Y); + g_imageHandUp->SetSrc(PNG_DISSGREE_IMAGE_PATH); + g_imageHandUp->SetTouchable(true); + g_imageHandUp->SetViewId("callingHandUp"); - imageHorns = new UIImageView(); - if (imageHorns == nullptr) { + g_imageHorns = new UIImageView(); + if (g_imageHorns == nullptr) { FreeCallingViewImage(); return false; } - imageHorns->SetPosition(IMAGE_HONRS_POSITION_X, IMAGE_HONRS_POSITION_Y); - imageHorns->SetSrc(PNG_SOUNDBUTTON2); - imageHorns->SetTouchable(true); - imageHorns->SetViewId("volumeSwitch"); + g_imageHorns->SetPosition(IMAGE_HONRS_POSITION_X, IMAGE_HONRS_POSITION_Y); + g_imageHorns->SetSrc(PNG_SOUNDBUTTON2); + g_imageHorns->SetTouchable(true); + g_imageHorns->SetViewId("volumeSwitch"); return true; } static void FreeCallingViewUILabel(void) { - if (callerDisplay != nullptr) { - delete callerDisplay; - callerDisplay = nullptr; + if (g_callerDisplay != nullptr) { + delete g_callerDisplay; + g_callerDisplay = nullptr; } - if (callDuration != nullptr) { - delete callDuration; - callDuration = nullptr; + if (g_callDuration != nullptr) { + delete g_callDuration; + g_callDuration = nullptr; } - if (currentTimes != nullptr) { - delete currentTimes; - currentTimes = nullptr; + if (g_currentTimes != nullptr) { + delete g_currentTimes; + g_currentTimes = nullptr; } } static bool DrawCallingViewUILabel(void) { - callerDisplay = new UILabel(); - if (callerDisplay == nullptr) { + g_callerDisplay = new UILabel(); + if (g_callerDisplay == nullptr) { return false; } - callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y, + g_callerDisplay->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y, Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT); - callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER); - callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE); - callerDisplay->SetTextColor(Color::White()); - - callDuration = new UILabel(); - if (callDuration == nullptr) { + g_callerDisplay->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + g_callerDisplay->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + g_callerDisplay->SetAlign(TEXT_ALIGNMENT_CENTER); + g_callerDisplay->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE); + g_callerDisplay->SetTextColor(Color::White()); + + g_callDuration = new UILabel(); + if (g_callDuration == nullptr) { FreeCallingViewUILabel(); return false; } - callDuration->SetPosition(LABEL_CALLERD_POSITION_X, LABEL_CALLERD_POSITION_Y, + g_callDuration->SetPosition(LABEL_CALLERD_POSITION_X, LABEL_CALLERD_POSITION_Y, Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT); - callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - callDuration->SetAlign(TEXT_ALIGNMENT_CENTER); - callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration()); - callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE); - callDuration->SetTextColor(Color::White()); - - currentTimes = new UILabel(); - if (currentTimes == nullptr) { + g_callDuration->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + g_callDuration->SetAlign(TEXT_ALIGNMENT_CENTER); + g_callDuration->SetText(CallerLogModel::GetInstance()->DisplayCallDuration().c_str()); + g_callDuration->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE); + g_callDuration->SetTextColor(Color::White()); + + g_currentTimes = new UILabel(); + if (g_currentTimes == nullptr) { FreeCallingViewUILabel(); return false; } - currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y, + g_currentTimes->SetPosition(LABEL_CURREMTTIME_POSITION_X, LABEL_CURREMTTIME_POSITION_Y, Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT); - currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER); - currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); - currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE); - currentTimes->SetTextColor(Color::White()); + g_currentTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + g_currentTimes->SetAlign(TEXT_ALIGNMENT_CENTER); + g_currentTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); + g_currentTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE); + g_currentTimes->SetTextColor(Color::White()); return true; } +static bool DrawWaitingHintsViewImage(void) +{ + g_imageDissgreeNew = new UIImageView(); + if (g_imageDissgreeNew == nullptr) { + FreeCallingViewImage(); + return false; + } + g_imageDissgreeNew->SetPosition(IMAGE_HANDUP2_POSITION_X, IMAGE_HANDUP2_POSITION_Y); + g_imageDissgreeNew->SetSrc(PNG_DISSGREE_IMAGE_PATH); + g_imageDissgreeNew->SetTouchable(true); + g_imageDissgreeNew->SetViewId("newCallHandUp"); + return true; +} + +static void FreeWaitingHintsViewImage(void) +{ + if (g_imageDissgreeNew != nullptr) { + delete g_imageDissgreeNew; + g_imageDissgreeNew = nullptr; + } +} + +static void FreeWaitingHintsViewLabel(void) +{ + if (g_newCallNum != nullptr) { + delete g_newCallNum; + g_newCallNum = nullptr; + } + if (g_newCallHints != nullptr) { + delete g_newCallHints; + g_newCallHints = nullptr; + } +} + +static bool DrawWaitingHintsViewLabel(void) +{ + g_newCallNum = new UILabel(); + if (g_newCallNum == nullptr) { + return false; + } + g_newCallNum->SetPosition(LABEL_PERCENT_POSITION_X, LABEL_PERCENT_POSITION_Y, + Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT); + g_newCallNum->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + g_newCallNum->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + g_newCallNum->SetAlign(TEXT_ALIGNMENT_CENTER); + g_newCallNum->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE); + g_newCallNum->SetTextColor(Color::White()); + + g_newCallHints = new UILabel(); + if (g_newCallHints == nullptr) { + FreeWaitingHintsViewLabel(); + return false; + } + g_newCallHints->SetPosition(LABEL_NEWCALLERD_POSITION_X, LABEL_NEWCALLERD_POSITION_Y, + Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT); + g_newCallHints->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + g_newCallHints->SetText("新来电"); + g_newCallHints->SetAlign(TEXT_ALIGNMENT_CENTER); + g_newCallHints->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE); + g_newCallHints->SetTextColor(Color::White()); + return true; +} + static void FreePhoneCallViewImage(void) { - if (imageAgree != nullptr) { - delete imageAgree; - imageAgree = nullptr; + if (g_imageAgree != nullptr) { + delete g_imageAgree; + g_imageAgree = nullptr; } - if (imageDissgree != nullptr) { - delete imageDissgree; - imageDissgree = nullptr; + if (g_imageDissgree != nullptr) { + delete g_imageDissgree; + g_imageDissgree = nullptr; } } static bool DrawPhoneCallViewImage(void) { - imageAgree = new UIImageView(); - if (imageAgree == nullptr) { + g_imageAgree = new UIImageView(); + if (g_imageAgree == nullptr) { return false; } - imageAgree->SetPosition(IMAGE_AGREEING_POSITION_X, IMAGE_ALL_POSITION_Y); - imageAgree->SetSrc(PNG_AGREEING_IMAGE_PATH); - imageAgree->SetTouchable(true); - imageAgree->SetViewId("answer"); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::CallViewEventListener::GetInstance(); - imageAgree->SetOnClickListener(clickListener); - imageDissgree = new UIImageView(); - if (imageDissgree == nullptr) { + g_imageAgree->SetPosition(IMAGE_AGREEING_POSITION_X, IMAGE_ALL_POSITION_Y); + g_imageAgree->SetSrc(PNG_AGREEING_IMAGE_PATH); + g_imageAgree->SetTouchable(true); + g_imageAgree->SetViewId("answer"); + UIView::OnClickListener *clickListener = static_cast\ + (OHOS::CallViewEventListener::GetInstance()); + g_imageAgree->SetOnClickListener(clickListener); + g_imageDissgree = new UIImageView(); + if (g_imageDissgree == nullptr) { FreePhoneCallViewImage(); return false; } - imageDissgree->SetPosition(IMAGE_DISSGREE_POSITION_X, IMAGE_ALL_POSITION_Y); - imageDissgree->SetSrc(PNG_DISSGREE_IMAGE_PATH); - imageDissgree->SetTouchable(true); - imageDissgree->SetViewId("displayHandUp"); - imageDissgree->SetOnClickListener(clickListener); + g_imageDissgree->SetPosition(IMAGE_DISSGREE_POSITION_X, IMAGE_ALL_POSITION_Y); + g_imageDissgree->SetSrc(PNG_DISSGREE_IMAGE_PATH); + g_imageDissgree->SetTouchable(true); + g_imageDissgree->SetViewId("displayHandUp"); + g_imageDissgree->SetOnClickListener(clickListener); return true; } static void FreePhoneCallViewLabel(void) { - if (callerNum != nullptr) { - delete callerNum; - callerNum = nullptr; + if (g_callerNum != nullptr) { + delete g_callerNum; + g_callerNum = nullptr; } - if (comingTimes != nullptr) { - delete comingTimes; - comingTimes = nullptr; + if (g_comingTimes != nullptr) { + delete g_comingTimes; + g_comingTimes = nullptr; } } static bool DrawPhoneCallViewLabel(void) { - callerNum = new UILabel(); - if (callerNum == nullptr) { + g_callerNum = new UILabel(); + if (g_callerNum == nullptr) { return false; } - callerNum->SetPosition(LABEL_COMINGVIEW_POSITION_X, LABEL_COMINGVIEW_POSITION_Y, Screen::GetInstance().GetWidth(), - TITLE_LABEL_DEFAULT_HEIGHT); - callerNum->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + g_callerNum->SetPosition(LABEL_COMINGVIEW_POSITION_X, LABEL_COMINGVIEW_POSITION_Y, + Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT); + g_callerNum->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "CreatePhoneCallView phonenum:%s!", CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - callerNum->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); - callerNum->SetAlign(TEXT_ALIGNMENT_CENTER); - callerNum->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE); - callerNum->SetTextColor(Color::White()); + g_callerNum->SetText(CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); + g_callerNum->SetAlign(TEXT_ALIGNMENT_CENTER); + g_callerNum->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE); + g_callerNum->SetTextColor(Color::White()); // callername @@ -512,78 +595,79 @@ static bool DrawPhoneCallViewLabel(void) // CallerLogModel::GetInstance()->GetPhoneNumber().c_str()); const char *number=CallerLogModel::GetInstance()->GetPhoneNumber().c_str(); char name[32]={0}; + #ifdef FD230 OHOS::get_phone_addrss_name(name,number); - + #endif callername->SetText(name); callername->SetAlign(TEXT_ALIGNMENT_CENTER); callername->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CALLER_SIZE); callername->SetTextColor(Color::White()); - comingTimes = new UILabel(); - if (comingTimes == nullptr) { + g_comingTimes = new UILabel(); + if (g_comingTimes == nullptr) { FreePhoneCallViewLabel(); return false; } - comingTimes->SetPosition(LABEL_COMINGTIME_POSITION_X, LABEL_COMINGTIME_POSITION_Y, + g_comingTimes->SetPosition(LABEL_COMINGTIME_POSITION_X, LABEL_COMINGTIME_POSITION_Y, Screen::GetInstance().GetWidth(), TITLE_LABEL_DEFAULT_HEIGHT); - comingTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); - comingTimes->SetAlign(TEXT_ALIGNMENT_CENTER); - comingTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); - comingTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE); - comingTimes->SetTextColor(Color::White()); + g_comingTimes->SetStyle(STYLE_BACKGROUND_COLOR, OPA_TRANSPARENT); + g_comingTimes->SetAlign(TEXT_ALIGNMENT_CENTER); + g_comingTimes->SetText(CallerLogModel::GetInstance()->InitDateHourTime().c_str()); + g_comingTimes->SetFont(DEFAULT_VECTOR_FONT_FILENAME, FONT_CURRENT_SIZE); + g_comingTimes->SetTextColor(Color::White()); return true; } UIViewGroup* CreatePhoneCallView(void) { - phoneView = new UIViewGroup(); - if (phoneView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreatePhoneCallView phoneView null!"); + g_phoneView = new UIViewGroup(); + if (g_phoneView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreatePhoneCallView g_phoneView null!"); return nullptr; } - phoneView->SetPosition(MATH_ZERO, MATH_ZERO); - phoneView->SetWidth(Screen::GetInstance().GetWidth()); - phoneView->SetHeight(Screen::GetInstance().GetHeight()); - if (DrawPhoneCallViewImage() == false) { - delete phoneView; - phoneView = nullptr; + g_phoneView->SetPosition(MATH_ZERO, MATH_ZERO); + g_phoneView->SetWidth(Screen::GetInstance().GetWidth()); + g_phoneView->SetHeight(Screen::GetInstance().GetHeight()); + if (!DrawPhoneCallViewImage()) { + delete g_phoneView; + g_phoneView = nullptr; return nullptr; } - if (DrawPhoneCallViewLabel() == false) { + if (!DrawPhoneCallViewLabel()) { FreePhoneCallViewImage(); - delete phoneView; - phoneView = nullptr; + delete g_phoneView; + g_phoneView = nullptr; return nullptr; } - phoneView->Add(imageAgree); - phoneView->Add(imageDissgree); - phoneView->Add(callerNum); - phoneView->Add(callername); - phoneView->Add(comingTimes); - phoneView->SetDraggable(true); - phoneView->SetTouchable(true); + g_phoneView->Add(g_imageAgree); + g_phoneView->Add(g_imageDissgree); + g_phoneView->Add(g_callerNum); + g_phoneView->Add(callername); + g_phoneView->Add(g_comingTimes); + g_phoneView->SetDraggable(true); + g_phoneView->SetTouchable(true); call_stat=2; calllog_info_init(); - return phoneView; + return g_phoneView; } void FreePhoneCallView(void) { - if (phoneView != nullptr) { - phoneView->RemoveAll(); + if (g_phoneView != nullptr) { + g_phoneView->RemoveAll(); FreePhoneCallViewImage(); FreePhoneCallViewLabel(); - RootView::GetInstance()->Remove(phoneView); - delete phoneView; - phoneView = nullptr; + RootView::GetInstance()->Remove(g_phoneView); + delete g_phoneView; + g_phoneView = nullptr; } } void FreeCalldialView(void) { if (calldialView != nullptr) { - DisableCallTimer(NOTIFY_PHONE_CALLING_DISPLAY); + DisableCallTimer(CallTimerType::NOTIFY_PHONE_CALLING_DISPLAY); calldialView->RemoveAll(); if(diallabel1!=NULL) { @@ -602,7 +686,7 @@ void FreeCalldialView(void) delete button1dial; button1dial =nullptr; } - DisableCallTimer(NOTIFY_PHONE_DIAL_DISPLAY); + DisableCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY); RootView::GetInstance()->Remove(calldialView); delete calldialView; calldialView = nullptr; @@ -693,50 +777,108 @@ UIViewGroup* CreateCalldialView(void) UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::CallViewEventListener::GetInstance(); calldialView->SetOnClickListener(clickListener); - StartCallTimer(NOTIFY_PHONE_DIAL_DISPLAY, (int32_t)NOTIFY_ONE_SECOND); + StartCallTimer(CallTimerType::NOTIFY_PHONE_DIAL_DISPLAY, (int32_t)NOTIFY_ONE_SECOND); call_stat=0; calllog_info_init(); return calldialView; } +UIViewGroup* CreateMultiplePhoneView(void) +{ + g_multiPhoneView = new UIViewGroup(); + if (g_multiPhoneView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateMultiplePhoneView g_multiPhoneView null!"); + return nullptr; + } + g_multiPhoneView->SetPosition(MATH_ZERO, MATH_ZERO); + g_multiPhoneView->SetWidth(Screen::GetInstance().GetWidth()); + g_multiPhoneView->SetHeight(Screen::GetInstance().GetHeight()); + if (!DrawCallingViewImage()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateMultiplePhoneView create image error!"); + delete g_multiPhoneView; + g_multiPhoneView = nullptr; + return nullptr; + } + if (!DrawCallingViewUILabel()) { + FreeCallingViewImage(); + delete g_multiPhoneView; + g_multiPhoneView = nullptr; + return nullptr; + } + g_callerDisplay->SetText("正在通话"); + g_callDuration->SetText(""); + g_multiPhoneView->Add(g_imageMicrophone); + g_multiPhoneView->Add(g_imageHandUp); + g_multiPhoneView->Add(g_imageHorns); + g_multiPhoneView->Add(g_callerDisplay); + g_multiPhoneView->Add(g_callDuration); + g_multiPhoneView->Add(g_currentTimes); + g_multiPhoneView->SetDraggable(true); + g_multiPhoneView->SetTouchable(true); + UIView::OnClickListener *clickListener = static_cast\ + (OHOS::CallViewEventListener::GetInstance()); + g_imageMicrophone->SetOnClickListener(clickListener); + g_imageHandUp->SetOnClickListener(clickListener); + g_imageHorns->SetOnClickListener(clickListener); + StartCallTimer(CallTimerType::NOTIFY_PHONE_CURTIME_DISPLAY, NOTIFY_THIRTY_SECONDS); + NotificationManager::GetInstance()->SetVolumeScreenStatus(false); + return g_multiPhoneView; +} +void FreeMultiplePhoneCallView(void) +{ + if (g_multiPhoneView != nullptr) { + DisableCallTimer(CallTimerType::NOTIFY_PHONE_CURTIME_DISPLAY); + g_multiPhoneView->RemoveAll(); + FreeCallingViewImage(); + FreeCallingViewUILabel(); + RootView::GetInstance()->Remove(g_multiPhoneView); + delete g_multiPhoneView; + g_multiPhoneView = nullptr; + } + if (g_volumeSetting != nullptr) { + delete g_volumeSetting; + g_volumeSetting = nullptr; + } +} UIViewGroup* CreateCallingView(void) { - callingView = new UIViewGroup(); - if (callingView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView callingView null!"); + g_callingView = new UIViewGroup(); + if (g_callingView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView g_callingView null!"); return nullptr; } - callingView->SetPosition(MATH_ZERO, MATH_ZERO); - callingView->SetWidth(Screen::GetInstance().GetWidth()); - callingView->SetHeight(Screen::GetInstance().GetHeight()); - if (DrawCallingViewImage() == false) { + g_callingView->SetPosition(MATH_ZERO, MATH_ZERO); + g_callingView->SetWidth(Screen::GetInstance().GetWidth()); + g_callingView->SetHeight(Screen::GetInstance().GetHeight()); + if (!DrawCallingViewImage()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateCallingView create image error!"); - delete callingView; - callingView = nullptr; + delete g_callingView; + g_callingView = nullptr; return nullptr; } - if (DrawCallingViewUILabel() == false) { + if (!DrawCallingViewUILabel()) { FreeCallingViewImage(); - delete callingView; - callingView = nullptr; + delete g_callingView; + g_callingView = nullptr; return nullptr; } - callingView->Add(imageMicrophone); - callingView->Add(imageHandUp); - callingView->Add(imageHorns); - callingView->Add(callerDisplay); - callingView->Add(callDuration); - callingView->Add(currentTimes); - callingView->SetDraggable(true); - callingView->SetTouchable(true); - UIView::OnClickListener *clickListener = (UIView::OnClickListener *)OHOS::CallViewEventListener::GetInstance(); - imageMicrophone->SetOnClickListener(clickListener); - imageHandUp->SetOnClickListener(clickListener); - imageHorns->SetOnClickListener(clickListener); - StartCallTimer(NOTIFY_PHONE_CALLING_DISPLAY, (int32_t)NOTIFY_ONE_SECOND); - StartCallTimer(NOTIFY_PHONE_CURTIME_DISPLAY, (int32_t)NOTIFY_THIRTY_SECONDS); + g_callingView->Add(g_imageMicrophone); + g_callingView->Add(g_imageHandUp); + g_callingView->Add(g_imageHorns); + g_callingView->Add(g_callerDisplay); + g_callingView->Add(g_callDuration); + g_callingView->Add(g_currentTimes); + g_callingView->SetDraggable(true); + g_callingView->SetTouchable(true); + UIView::OnClickListener *clickListener = static_cast\ + (OHOS::CallViewEventListener::GetInstance()); + g_imageMicrophone->SetOnClickListener(clickListener); + g_imageHandUp->SetOnClickListener(clickListener); + g_imageHorns->SetOnClickListener(clickListener); + StartCallTimer(CallTimerType::NOTIFY_PHONE_CALLING_DISPLAY, NOTIFY_ONE_SECOND); + StartCallTimer(CallTimerType::NOTIFY_PHONE_CURTIME_DISPLAY, NOTIFY_THIRTY_SECONDS); NotificationManager::GetInstance()->SetVolumeScreenStatus(false); if(call_stat==2) @@ -744,31 +886,112 @@ UIViewGroup* CreateCallingView(void) call_stat=1; } - return callingView; + return g_callingView; } void FreeCallingView(void) { - if (callingView != nullptr) { - DisableCallTimer(NOTIFY_PHONE_CALLING_DISPLAY); - DisableCallTimer(NOTIFY_PHONE_CURTIME_DISPLAY); - callingView->RemoveAll(); + if (g_callingView != nullptr) { + DisableCallTimer(CallTimerType::NOTIFY_PHONE_CALLING_DISPLAY); + DisableCallTimer(CallTimerType::NOTIFY_PHONE_CURTIME_DISPLAY); + g_callingView->RemoveAll(); FreeCallingViewImage(); FreeCallingViewUILabel(); - RootView::GetInstance()->Remove(callingView); - delete callingView; - callingView = nullptr; + RootView::GetInstance()->Remove(g_callingView); + delete g_callingView; + g_callingView = nullptr; } - if (volumeSettingView != nullptr) { - delete volumeSettingView; - volumeSettingView = nullptr; - volumeSetting = nullptr; + if (g_volumeSetting != nullptr) { + delete g_volumeSetting; + g_volumeSetting = nullptr; + } +} + +UIViewGroup* CreateWaitingHintsView(void) +{ + g_waitingHintsView = new UIViewGroup(); + if (g_waitingHintsView == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateWaitingHintsView g_waitingHintsView null!"); + return nullptr; + } + g_waitingHintsView->SetPosition(MATH_ZERO, MATH_ZERO); + g_waitingHintsView->SetWidth(Screen::GetInstance().GetWidth()); + g_waitingHintsView->SetHeight(Screen::GetInstance().GetHeight()); + if (!DrawWaitingHintsViewImage()) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "CreateWaitingHintsView create image error!"); + delete g_waitingHintsView; + g_waitingHintsView = nullptr; + return nullptr; + } + if (!DrawWaitingHintsViewLabel()) { + FreeWaitingHintsViewImage(); + delete g_waitingHintsView; + g_waitingHintsView = nullptr; + return nullptr; + } + g_waitingHintsView->Add(g_imageDissgreeNew); + g_waitingHintsView->Add(g_newCallNum); + g_waitingHintsView->Add(g_newCallHints); + g_waitingHintsView->SetDraggable(true); + g_waitingHintsView->SetTouchable(true); + UIView::OnClickListener *clickListener = static_cast\ + (OHOS::CallViewEventListener::GetInstance()); + g_imageDissgreeNew->SetOnClickListener(clickListener); + return g_waitingHintsView; +} + +void FreeWaitingHintsView(void) +{ + if (g_waitingHintsView != nullptr) { + g_waitingHintsView->RemoveAll(); + FreeWaitingHintsViewImage(); + FreeWaitingHintsViewLabel(); + RootView::GetInstance()->Remove(g_waitingHintsView); + delete g_waitingHintsView; + g_waitingHintsView = nullptr; } } void RefreshMicrophoneImageSrc(const char* src) { - imageMicrophone->SetSrc(src); + g_imageMicrophone->SetSrc(src); +} + +void EnableWaitingView(void) +{ + if (g_waitingHintsView == nullptr) { + CreateWaitingHintsView(); + } + if (NotificationManager::GetInstance()->screenContainer_ != nullptr) { + NotificationManager::GetInstance()->screenContainer_->SetVisible(false); + } + RootView::GetInstance()->Add(g_waitingHintsView); + g_waitingHintsView->SetVisible(true); + RootView::GetInstance()->Invalidate(); +} + +void DisableWatingView(void) +{ + if (g_waitingHintsView != nullptr) { + g_waitingHintsView->SetVisible(false); + FreeWaitingHintsView(); + if (NotificationManager::GetInstance()->screenContainer_ != nullptr) { + NotificationManager::GetInstance()->screenContainer_->SetVisible(true); + } + RootView::GetInstance()->Invalidate(); + } +} + +bool HintsHandupClick(void) +{ + if (RejectIncomingCall() != 0) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "[HintsHandupClick] RejectIncomingCall error"); + return false; + } + CallerLogModel::GetInstance()->SetWaitingStatus(false); + CallerLogModel::GetInstance()->SetCallStatus(true); + + return true; } CallViewEventListener::CallViewEventListener() @@ -792,10 +1015,9 @@ bool CallViewEventListener::OnDragEnd(OHOS::UIView& view, const OHOS::DragEvent& if (event.GetDragDirection() == DragEvent::DIRECTION_LEFT_TO_RIGHT) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "xxxxxxxxxxxxxxx"); - volumeSettingView->SetVisible(false); - volumeSetting->SetVisible(false); + g_volumeSetting->SetVisible(false); unsigned char volumeValue; - volumeValue = (unsigned char) ((double) (volumeSetting->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换 + volumeValue = (unsigned char) ((double) (g_volumeSetting->sounding * CALL_VOLUME_MAX) / (VOLUME_MAX - VOLUME_MIN)); // 音量转换 SetSpeakerVolume(volumeValue); return true; } @@ -880,20 +1102,23 @@ bool CallViewEventListener::OnClick(UIView& view, const ClickEvent& event) } else if (strcmp(view.GetViewId(), "microphoneChange") == 0) { - if (changeImage == 0) { - changeImage = 1; + if (g_changeImage == 0) { + g_changeImage = 1; RefreshMicrophoneImageSrc(PNG_MICROPHONE_CLOSE_IMAGE_PATH); SetMicMute(true); } else { - changeImage = 0; + g_changeImage = 0; RefreshMicrophoneImageSrc(PNG_MICROPHONE_OPEN_IMAGE_PATH); SetMicMute(false); } return true; } else if (strcmp(view.GetViewId(), "volumeSwitch") == 0) { HonrsViewChange(); + } else if (strcmp(view.GetViewId(), "newCallHandUp") == 0) { + if (!HintsHandupClick()) { + return false; + } } -// #endif return true; } } // namespace OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp index 3298f9ad8..7878009e2 100755 --- a/code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-07 18:27:45 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-03-25 18:23:17 + * @LastEditors: SnickerSun snickersun@163.com + * @LastEditTime: 2024-05-27 23:52:29 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/notification_manager_customer.cpp */ /* @@ -32,7 +32,11 @@ void NotificationManager::FreeNotifyViews() FreeAlarmRingView(); FreePhoneCallView(); FreeCallingView(); + FreeMultiplePhoneCallView(); + FreeWaitingHintsView(); +#ifdef FD230 FreeCalldialView(); +#endif FreeFindWatchView(); FreelowPower(); FreeDrinkReminderView(); diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp index c7b92b609..fc12b63b4 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-22 10:04:36 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-04-29 20:09:47 + * @LastEditors: SnickerSun snickersun@163.com + * @LastEditTime: 2024-05-28 00:03:19 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/pairing_notification.cpp */ #include "notification_manager.h" @@ -700,7 +700,8 @@ namespace OHOS #ifdef SUPPORT_BLE_SERVICE comfirmPaire(0); #endif - if( NotificationManager::GetInstance()->GetShowingNotifyId() == TOPIC_EVENT_DEVICE_BIND && NotificationManager::GetInstance()->hasNotifyShowing() == true) + if( NotificationManager::GetInstance()->GetShowingNotifyId() == TOPIC_EVENT_DEVICE_BIND && + NotificationManager::GetInstance()->HasNotifyShowing() == true) { NotificationManager::GetInstance()->StopNotify(); } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp index 92c898fd9..99fe15985 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/sedentaryReminder_notification.cpp @@ -3,13 +3,15 @@ #include "components/ui_button.h" #include "components/ui_image_view.h" #include "components/ui_label_ext.h" +#ifdef FD230 #include "language/font/ui_resource_string.h" +#endif #include #include #include #include #include -#include "config/include/ConfigModel.h" +#include "ConfigModel.h" namespace OHOS { @@ -95,8 +97,11 @@ namespace OHOS SedentaryReminderTitleLabel->SetPosition(83, 52, 300, 35); SedentaryReminderTitleLabel->SetStyle(STYLE_TEXT_FONT, 30); SedentaryReminderTitleLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - // SedentaryReminderTitleLabel->SetText("久坐提醒"); + #ifdef FD230 SedentaryReminderTitleLabel->SetTextId(STR_SEDENTARY_REMINDER); + #else + SedentaryReminderTitleLabel->SetText("久坐提醒"); + #endif SedentaryReminderTitleLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); SedentaryReminderTitleLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); SedentaryReminderTitleLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); @@ -119,7 +124,9 @@ namespace OHOS SedentaryReminderNoteLabel->SetPosition(53, 248, 360, 70); SedentaryReminderNoteLabel->SetStyle(STYLE_TEXT_FONT, 30); SedentaryReminderNoteLabel->SetStyle(STYLE_LINE_HEIGHT, 35); + #ifdef FD230 SetLabelId(SedentaryReminderNoteLabel, STR_SEDENTARY_REMINDER_NOTE); + #endif // UpdateLabel(SedentaryReminderNoteLabel,"1",STR_SEDENTARY_REMINDER_NOTE); SedentaryReminderNoteLabel->SetLineBreakMode(UILabel::LINE_BREAK_WRAP); SedentaryReminderNoteLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); @@ -148,8 +155,11 @@ namespace OHOS SedentaryReminderLabel->SetPosition(133, 399, 200, 35); SedentaryReminderLabel->SetStyle(STYLE_TEXT_FONT, 30); SedentaryReminderLabel->SetStyle(STYLE_LINE_HEIGHT, 35); - // SedentaryReminderLabel->SetText("知道了"); + #ifdef FD230 SedentaryReminderLabel->SetTextId(STR_KONW); + #else + SedentaryReminderLabel->SetText("知道了"); + #endif SedentaryReminderLabel->SetLineBreakMode(UILabel::LINE_BREAK_MARQUEE); SedentaryReminderLabel->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); SedentaryReminderLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); diff --git a/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp b/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp index 60969b249..e04b422cd 100755 --- a/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/vendor_app/baidu/baidu_app.cpp @@ -5,8 +5,8 @@ * Create: 2021-11-11 */ -#include "msg_center.h" #include +#include "msg_center.h" #include "adapter.h" #include "msg_center_protocol.h" #include "msg_center_cmd.h" @@ -17,7 +17,9 @@ #endif #include "common_def.h" #include "player_sample_wrapper.h" -#include "cmsis_os2.h" +#include "baidumap_msg_center.h" +#include "baidumap.h" +#include "soc_osal.h" #ifdef __cplusplus extern "C" { @@ -29,7 +31,7 @@ extern "C" { #define TASK_PRIORITY_PCM_STREAM (osPriority_t)(40) #define PCM_STREAM_MSG_STACK_SIZE 0xC00 -osMessageQueueId_t g_pcm_stream_msg_queue_id = NULL; +osMessageQueueId_t g_pcm_stream_msg_queue_id = nullptr; errcode_t msg_center_navigation_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) { @@ -37,7 +39,7 @@ errcode_t msg_center_navigation_start(uint8_t cmd_id, uint8_t type, void *usr_da uint8_t ack = 1; /* 与手机APK侧约定 */ char *bundleName = msg_center_get_bundle_name(cmd_id); - if (bundleName == NULL) { + if (bundleName == nullptr) { return ERRCODE_FAIL; } WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "bundle name = %s\r\n", bundleName); @@ -77,18 +79,17 @@ errcode_t msg_center_navigation_recv(uint8_t cmd_id, uint8_t type, void *usr_dat } char *data = (char *)malloc(payload_len + 1); - if (data == NULL) { + if (data == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "msg_center_navigation_recv: malloc failed.\r\n"); return ERRCODE_FAIL; } - memcpy(data, tlv_payload, payload_len); + (void)memcpy_s(data, payload_len, tlv_payload, payload_len); data[payload_len] = '\0'; WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "recv navigate info--> %s\r\n", tlv_payload); DmsLiteSendMsgToJS(data); - data = NULL; free(data); - + data = nullptr; return ERRCODE_SUCC; } @@ -97,7 +98,7 @@ static errcode_t pcm_stream_task_init(void) osMessageQueueAttr_t m_attr = {0}; m_attr.name = "PCM_STREAM_MSG"; g_pcm_stream_msg_queue_id = osMessageQueueNew(PCM_STREAM_MSG_QUEUE_LEN, sizeof(pcm_stream_queue_msg), &m_attr); - if (g_pcm_stream_msg_queue_id == 0) { + if (g_pcm_stream_msg_queue_id == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "create msg queue fail\r\n"); return ERRCODE_FAIL; } @@ -132,7 +133,7 @@ static errcode_t pcm_stream_task_body(void *data) } for (;;) { - osStatus_t ret = osMessageQueueGet(g_pcm_stream_msg_queue_id, &msg, NULL, osWaitForever); + osStatus_t ret = osMessageQueueGet(g_pcm_stream_msg_queue_id, &msg, nullptr, osWaitForever); if (ret != osOK) { continue; } @@ -145,7 +146,8 @@ static errcode_t pcm_stream_task_body(void *data) return ERRCODE_FAIL; } } else if (msg.msg_id == MSGCENTER_TYPE_ID_XIAODU_END_RECORD) { - res = msg_center_xiaodu_send_end_record(MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_END_RECORD, NULL, 0); + res = msg_center_xiaodu_send_end_record(MSGCENTER_CMD_XIAODU, MSGCENTER_TYPE_ID_XIAODU_END_RECORD, msg.data, + msg.len); if (res != ERRCODE_SUCC) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "send pcm stream failed"); return ERRCODE_FAIL; @@ -157,6 +159,11 @@ static errcode_t pcm_stream_task_body(void *data) return ERRCODE_SUCC; } +osMessageQueueId_t GetPcmMsgQueueId(void) +{ + return g_pcm_stream_msg_queue_id; +} + errcode_t pcm_stream_create_task(void) { errcode_t ret = ERRCODE_SUCC; @@ -166,8 +173,9 @@ errcode_t pcm_stream_create_task(void) return ERRCODE_FAIL; } - osThreadAttr_t attr = {"pcm_stream", 0, NULL, 0, NULL, PCM_STREAM_MSG_STACK_SIZE, TASK_PRIORITY_PCM_STREAM, 0, 0 }; - if (osThreadNew((osThreadFunc_t)pcm_stream_task_body, NULL, &attr) == NULL) { + osThreadAttr_t attr = {"pcm_stream", 0, nullptr, 0, nullptr, PCM_STREAM_MSG_STACK_SIZE, TASK_PRIORITY_PCM_STREAM, 0, + 0 }; + if (osThreadNew((osThreadFunc_t)pcm_stream_task_body, nullptr, &attr) == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "create pcm_stream task fail!\r\n"); return ERRCODE_FAIL; } @@ -183,7 +191,7 @@ errcode_t msg_center_xiaodu_start(uint8_t cmd_id, uint8_t type, void *usr_data, errcode_t ret = ERRCODE_SUCC; char *bundleName = msg_center_get_bundle_name(cmd_id); - if (bundleName == NULL) { + if (bundleName == nullptr) { return ERRCODE_FAIL; } WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "bundle name = %s\r\n", bundleName); @@ -223,18 +231,17 @@ errcode_t msg_center_xiaodu_recv_xiaodu_info(uint8_t cmd_id, uint8_t type, void } char *data = (char *)malloc(payload_len + 1); - if (data == NULL) { + if (data == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "msg_center_xiaodu_recv_xiaodu_info: malloc failed.\r\n"); return ERRCODE_FAIL; } - memcpy(data, tlv_payload, payload_len); + (void)memcpy_s(data, payload_len, tlv_payload, payload_len); data[payload_len] = '\0'; WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "recv xiaodu info--> %s\r\n", tlv_payload); DmsLiteSendMsgToJS(data); - data = NULL; free(data); - + data = nullptr; return ERRCODE_SUCC; } @@ -253,22 +260,22 @@ errcode_t msg_center_xiaodu_recv_wenxin_info(uint8_t cmd_id, uint8_t type, void } char *data = (char *)malloc(payload_len + 1); - if (data == NULL) { + if (data == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "msg_center_xiaodu_recv_wenxin_info: malloc failed.\r\n"); return ERRCODE_FAIL; } - memcpy(data, tlv_payload, payload_len); + (void)memcpy_s(data, payload_len, tlv_payload, payload_len); data[payload_len] = '\0'; WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "recv wenxin info--> %s\r\n", tlv_payload); DmsLiteSendMsgToJS(data); - data = NULL; free(data); - + data = nullptr; return ERRCODE_SUCC; } -static int32_t convert_para_to_player_para(const uint8_t *inParam, uint16_t paramLen, int32_t *outArgc, uint8_t **outArgv) +static int32_t convert_para_to_player_para(const uint8_t *inParam, uint16_t paramLen, int32_t *outArgc, + uint8_t **outArgv) { int ret; char *pos; @@ -276,47 +283,47 @@ static int32_t convert_para_to_player_para(const uint8_t *inParam, uint16_t para uint32_t paramCnt = 0; strTemp = (uint8_t*)osal_kmalloc(paramLen, OSAL_GFP_KERNEL); - if (strTemp == NULL) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER,"{%s():%d} malloc failed.\r\n", __FUNCTION__, __LINE__); + if (strTemp == nullptr) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "{%s():%d} malloc failed.\r\n", __FUNCTION__, __LINE__); return ERRCODE_FAIL; } ret = memset_s(strTemp, paramLen, 0, paramLen); if (ret != EOK) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER,"{%s():%d} memset_s failed.\r\n", __FUNCTION__, __LINE__); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "{%s():%d} memset_s failed.\r\n", __FUNCTION__, __LINE__); osal_kfree(strTemp); return ERRCODE_FAIL; } ret = memcpy_s(strTemp, paramLen, inParam, paramLen); if (ret != EOK) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER,"{%s():%d} memcpy_s failed.\r\n", __FUNCTION__, __LINE__); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "{%s():%d} memcpy_s failed.\r\n", __FUNCTION__, __LINE__); osal_kfree(strTemp); return ERRCODE_FAIL; } pos = strtok((char*)strTemp, ","); - for (uint32_t i = 0; pos != NULL; i++) { + for (uint32_t i = 0; pos != nullptr; i++) { outArgv[i] = (uint8_t*)osal_kmalloc(strlen(pos) + 1, OSAL_GFP_KERNEL); - if (outArgv[i] == NULL) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER,"{%s():%d} malloc failed.\r\n", __FUNCTION__, __LINE__); + if (outArgv[i] == nullptr) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "{%s():%d} malloc failed.\r\n", __FUNCTION__, __LINE__); osal_kfree(strTemp); return ERRCODE_FAIL; } ret = memcpy_s(outArgv[i], strlen(pos) + 1, pos, strlen(pos) + 1); if (ret != EOK) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER,"{%s():%d} memcpy_s failed.\r\n", __FUNCTION__, __LINE__); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "{%s():%d} memcpy_s failed.\r\n", __FUNCTION__, __LINE__); osal_kfree(strTemp); return ERRCODE_FAIL; } paramCnt++; if (*outArgc >= TTS_MEDIA_MAX_PARAM_CNT) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER,"{%s():%d} invalid argc: %d(max: 64).\r\n", + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "{%s():%d} invalid argc: %d(max: 64).\r\n", __FUNCTION__, __LINE__, *outArgc); osal_kfree(strTemp); return ERRCODE_FAIL; } - pos = strtok(NULL, ","); + pos = strtok(nullptr, ","); } *outArgc = paramCnt; @@ -345,9 +352,9 @@ static void msg_center_tts_player_start(const uint8_t *data, uint32_t dataLen) FREE: for (int32_t i = 0; i < argc; i++) { - if (argv[i] != NULL) { + if (argv[i] != nullptr) { osal_kfree(argv[i]); - argv[i] = NULL; + argv[i] = nullptr; } } WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "{%s():%d} func out %s.\r\n", __FUNCTION__, __LINE__, @@ -371,17 +378,17 @@ errcode_t msg_center_xiaodu_recv_tts(uint8_t cmd_id, uint8_t type, void *usr_dat /* 播放tts语音 */ char *tts_file = (char *)malloc(payload_len + 1); - if (tts_file == NULL) { + if (tts_file == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "msg_center_xiaodu_recv_tts: malloc failed.\r\n"); return ERRCODE_FAIL; } - memcpy(tts_file, tlv_payload, payload_len); + (void)memcpy_s(tts_file, payload_len, tlv_payload, payload_len); tts_file[payload_len] = '\0'; WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "recv_tts file: %s\r\n", tts_file); char buffer[TTS_AUDIO_PARA_LEN] = {0}; - sprintf_s(buffer, TTS_AUDIO_PARA_LEN, "%s,%s,%d,%d", "xx", tts_file, 1, 0); + (void)sprintf_s(buffer, TTS_AUDIO_PARA_LEN, "%s,%s,%d,%d", "xx", tts_file, 1, 0); msg_center_tts_player_start((const uint8_t *)buffer, strlen(buffer)); /* 播放完成后需删除文件 */ @@ -420,18 +427,51 @@ errcode_t msg_center_xiaodu_send_pcm_stream(uint8_t cmd_id, uint8_t type, void * errcode_t msg_center_xiaodu_send_end_record(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) { errcode_t ret = ERRCODE_SUCC; - uint8_t end_record_flag = 0; - ret = msg_center_send_data(cmd_id, type, &end_record_flag, sizeof(end_record_flag)); + ret = msg_center_send_data(cmd_id, type, usr_data, usr_len); if (ret != ERRCODE_SUCC) { return ERRCODE_FAIL; } - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "send pcm stream end.\r\n"); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "send pcm stream end, usr_data = %d, usr_len = %d\r\n", + *(uint8_t *)usr_data, usr_len); /* usr_data参考协议msg_center_pcm_end_flag_t */ pcm_stream_del_queue(); return ERRCODE_SUCC; } +static void msg_center_transfer_longbuf(char *data, uint8_t type) +{ + FILE *fp = nullptr; + + fp = fopen(data, "rb"); + if (fp == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "%s: open %s fail.\r\n", vector_navi_get_str(type), data); + return; + } + + fseek(fp, 0L, SEEK_END); + long file_len = ftell(fp); + char *file_content = (char *)malloc(sizeof(char) * (file_len + 1)); + if (file_content == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "%s: malloc fail, file_len = %d.\r\n", vector_navi_get_str(type), file_len); + return; + } + + fseek(fp, 0L, SEEK_SET); + if (fread(file_content, file_len, 1, fp) != 1) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "%s: fread fail, file_len = %d.\r\n", vector_navi_get_str(type), file_len); + return; + } + fclose(fp); + file_content[file_len] = '\0'; + + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "file_len = %d.\r\n", file_len); + /* send to JSI */ + BaidumapSendMsgToJS(file_content, type); + free(file_content); + file_content = nullptr; +} + errcode_t msg_center_vector_navi_pull_up(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) { unused(usr_data); @@ -439,7 +479,7 @@ errcode_t msg_center_vector_navi_pull_up(uint8_t cmd_id, uint8_t type, void *usr errcode_t ret = ERRCODE_SUCC; char *bundleName = msg_center_get_bundle_name(cmd_id); - if (bundleName == NULL) { + if (bundleName == nullptr) { return ERRCODE_FAIL; } WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "bundle name = %s\r\n", bundleName); @@ -467,43 +507,12 @@ errcode_t msg_center_vector_navi_pull_up(uint8_t cmd_id, uint8_t type, void *usr errcode_t msg_center_vector_navi_recv_svg(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) { -#if 0 - /* 单包合并方案,效率低且file_name不好控制 */ - FILE *fw = NULL; - - if (access(BAIDU_NAVI_BASE_DIR, F_OK) != 0) { - if (mkdir(BAIDU_NAVI_BASE_DIR, S_IREAD | S_IWRITE) != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "mkdir /user/baidu_navi/ fail.\r\n"); - return ERRCODE_FAIL; - } - } - - char svg_file_path[BAIDU_NAVI_MAX_FILE_LEN] = { 0 }; - if (sprintf_s(svg_file_path, sizeof(svg_file_path), "%s%s", BAIDU_NAVI_BASE_DIR, svg_file_path) < 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "svg_file_path is valid.\r\n"); - return ERRCODE_FAIL; - } - - fw = fopen(svg_file_path, "wb"); - if (!fw) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "open svg_file_path fail.\r\n"); - return ERRCODE_FAIL; - } - - if (fwrite(usr_data, usr_len, 1, fw) != 1) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "write svg_file fail.\r\n"); - return ERRCODE_FAIL; - } - fclose(fw); - - return ERRCODE_SUCC; -#endif - /* 采用数传方案,svg上传板侧后通知msg_center文件名 */ uint8_t tl_len = msg_center_get_tlv_tl_len(usr_data); uint16_t payload_len = usr_len - tl_len; uint8_t *tlv_payload = (uint8_t *)msg_center_get_tlv_payload(usr_data); uint8_t ack = 1; errcode_t ret = ERRCODE_SUCC; + uint8_t res; /* ack */ ret = msg_center_send_data(cmd_id, type, &ack, sizeof(ack)); @@ -511,17 +520,38 @@ errcode_t msg_center_vector_navi_recv_svg(uint8_t cmd_id, uint8_t type, void *us return ERRCODE_FAIL; } - /* svg_file_name */ - char *svg_file = (char *)malloc(payload_len + 1); - if (svg_file == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "recv_svg: malloc failed.\r\n"); + /* svg json */ + char *svg_json = (char *)malloc(payload_len + 1); + if (svg_json == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "rec_svg_json: malloc failed.\r\n"); return ERRCODE_FAIL; } - memcpy(svg_file, tlv_payload, payload_len); - svg_file[payload_len] = '\0'; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "recv_svg file: %s\r\n", svg_file); - /* send svg_file to baiduSDK */ + (void)memcpy_s(svg_json, payload_len, tlv_payload, payload_len); + svg_json[payload_len] = '\0'; + WEARABLE_LOGD(WEARABLE_LOG_MODULE_MSG_CENTER, "rec_svg_json file: %s\r\n", svg_json); + +#if defined(SUPPORT_POWER_MANAGER) + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + if (display_api->get_screen_state() != SCREEN_ON) { + display_api->turn_on_screen(); + } + display_api->set_screen_set_keepon_timeout(600000); // 600000ms +#endif + + /* send svg_json to baiduSDK */ + struct Content content = { + .x = 0, + .y = 0, + .z = 0, + .data = NULL, + .json = svg_json + }; + + DuerMapInfo(cmd_id, type, &content); + + free(svg_json); + svg_json = NULL; return ERRCODE_SUCC; } @@ -533,6 +563,8 @@ errcode_t msg_center_vector_navi_req_svg(uint8_t cmd_id, uint8_t type, void *usr if (ret != ERRCODE_SUCC) { return ERRCODE_FAIL; } + + WEARABLE_LOGD(WEARABLE_LOG_MODULE_MSG_CENTER, "usr_data = %s\r\n", usr_data); return ERRCODE_SUCC; } @@ -565,20 +597,18 @@ errcode_t msg_center_vector_navi_recv_dst_list(uint8_t cmd_id, uint8_t type, voi uint8_t ack = 1; errcode_t ret = ERRCODE_SUCC; - /* send to baiduSDK */ char *data = (char *)malloc(payload_len + 1); - if (data == NULL) { + if (data == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "recv dst list: malloc failed.\r\n"); return ERRCODE_FAIL; } - memcpy(data, tlv_payload, payload_len); + (void)memcpy_s(data, payload_len, tlv_payload, payload_len); data[payload_len] = '\0'; WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "recv vector navi info--> %s\r\n", tlv_payload); - // DmsLiteSendMsgToJS(data); - data = NULL; + /* send to baiduSDK */ free(data); - + data = nullptr; return ERRCODE_SUCC; } @@ -603,18 +633,17 @@ errcode_t msg_center_vector_navi_recv_navi_info(uint8_t cmd_id, uint8_t type, vo /* send to BaiduSDK */ char *data = (char *)malloc(payload_len + 1); - if (data == NULL) { + if (data == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "recv dst list: malloc failed.\r\n"); return ERRCODE_FAIL; } - memcpy(data, tlv_payload, payload_len); + (void)memcpy_s(data, payload_len, tlv_payload, payload_len); data[payload_len] = '\0'; WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "recv vector navi info--> %s\r\n", tlv_payload); - // DmsLiteSendMsgToJS(data); - data = NULL; + /* send data to js */ free(data); - + data = nullptr; return ERRCODE_SUCC; } @@ -638,8 +667,11 @@ errcode_t msg_center_vector_navi_req_poi(uint8_t cmd_id, uint8_t type, void *usr errcode_t ret = ERRCODE_SUCC; ret = msg_center_send_data(cmd_id, type, usr_data, usr_len); if (ret != ERRCODE_SUCC) { + BaidumapFailSendMsgToJS("send data fail", type + 1); // JSI提供的fail回调只挂接了rec,因此req流程中加一 return ERRCODE_FAIL; } + + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "req poi ok.\r\n"); return ERRCODE_SUCC; } @@ -651,19 +683,26 @@ errcode_t msg_center_vector_navi_recv_poi(uint8_t cmd_id, uint8_t type, void *us uint8_t ack = 1; errcode_t ret = ERRCODE_SUCC; - /* send to baiduSDK */ + /* ack */ + ret = msg_center_send_data(cmd_id, type, &ack, sizeof(ack)); + if (ret != ERRCODE_SUCC) { + return ERRCODE_FAIL; + } + char *data = (char *)malloc(payload_len + 1); - if (data == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "recv dst list: malloc failed.\r\n"); + if (data == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "recv poi: malloc failed.\r\n"); + BaidumapFailSendMsgToJS("rec malloc fail", type); return ERRCODE_FAIL; } - memcpy(data, tlv_payload, payload_len); + (void)memcpy_s(data, payload_len, tlv_payload, payload_len); data[payload_len] = '\0'; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "recv vector navi info--> %s\r\n", tlv_payload); - // DmsLiteSendMsgToJS(data); - data = NULL; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "recv poi info -- > %s, usr_len = %d\r\n", tlv_payload, usr_len); + + msg_center_transfer_longbuf(data, type); free(data); + data = nullptr; return ERRCODE_SUCC; } @@ -693,6 +732,358 @@ errcode_t msg_center_vector_navi_finish_from_phone(uint8_t cmd_id, uint8_t type, return ERRCODE_SUCC; } +static errcode_t msg_center_vector_navi_req_common_proc(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + errcode_t ret = ERRCODE_SUCC; + ret = msg_center_send_data(cmd_id, type, usr_data, usr_len); + if (ret != ERRCODE_SUCC) { + BaidumapFailSendMsgToJS("send data fail", type + 1); + return ERRCODE_FAIL; + } + + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "%s, usr_data = %s, usr_len = %d\r\n", vector_navi_get_str(type), + usr_data == NULL ? NULL : usr_data, usr_len); + return ERRCODE_SUCC; +} + +static bool is_vector_navi_longbuf(uint8_t type) +{ + if (type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_POI_SUG_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REGEOCODE_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_RIDING_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_WALKING_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_TRANSIT_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_ROUTE_UPDATE || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_RE_ROUTE_COMPLETE) { + return true; + } else { + return false; + } +} + +static bool has_two_callback(uint8_t type) +{ + if (type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GEOCODE_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REGEOCODE_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_RECV_POI || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_RIDING_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_WALKING_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_TRANSIT_SEARCH || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_AUTH_LICENSE || + type == MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_INIT) { + return true; + } else { + return false; + } +} + +static errcode_t msg_center_vector_navi_rec_common_proc(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + uint8_t tl_len = msg_center_get_tlv_tl_len(usr_data); + uint16_t payload_len = usr_len - tl_len; + uint8_t *tlv_payload = (uint8_t *)msg_center_get_tlv_payload(usr_data); + errcode_t ret = ERRCODE_SUCC; + uint8_t ack = 1; + + /* ack */ + ret = msg_center_send_data(cmd_id, type, &ack, sizeof(ack)); + if (ret != ERRCODE_SUCC) { + return ERRCODE_FAIL; + } + + #if defined(SUPPORT_POWER_MANAGER) + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + if (display_api->get_screen_state() != SCREEN_ON) { + display_api->turn_on_screen(); + } + display_api->set_screen_set_keepon_timeout(600000); // 600000ms + #endif + + char *data = (char *)malloc(payload_len + 1); + if (data == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "%s: malloc failed.\r\n", vector_navi_get_str(type)); + BaidumapFailSendMsgToJS("rec malloc fail", type); + return ERRCODE_FAIL; + } + + (void)memcpy_s(data, payload_len, tlv_payload, payload_len); + data[payload_len] = '\0'; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "%s -- > %s\r\n", vector_navi_get_str(type), tlv_payload); + + if (is_vector_navi_longbuf(type) && payload_len != 1) { + msg_center_transfer_longbuf(data, type); + } else if (has_two_callback(type) && payload_len == 1) { + if (strcmp(data, "1") == 0) { + BaidumapSendMsgToJS(data, type); + } else if ((strcmp(data, "0") == 0)) { + BaidumapFailSendMsgToJS(data, type); + } else { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "%s, app should trans 0 or 1\r\n", vector_navi_get_str(type)); + } + } else { + BaidumapSendMsgToJS(data, type); + } + free(data); + data = nullptr; + + return ERRCODE_SUCC; +} + +errcode_t msg_center_vector_navi_req_auth_license(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_auth_license(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_geo_location(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_geo_location(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_navi_init(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_navi_init(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_route_plan_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_route_plan_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_route_plan_succ(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_route_plan_succ(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_route_plan_fail(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_route_plan_fail(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_navi_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_navi_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_navi_destroy(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_navi_destroy(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_road_guide_text_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_road_guide_text_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_road_guide_icon_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_road_guide_icon_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_remain_time_update(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_remain_time_update(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_remain_distance_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_remain_distance_update(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_remain_route_update(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_remain_route_update(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_gps_status_change(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_gps_status_change(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_route_faraway(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_route_faraway(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_route_plan_yawing(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_route_plan_yawing(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_re_route_complete(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_re_route_complete(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_arrive_destination(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_arrive_destination(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vertor_navi_req_poi_sug_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vertor_navi_rec_poi_sug_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_route_riding_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_route_riding_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_route_walking_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_route_walking_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_route_transit_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_route_transit_search(uint8_t cmd_id, uint8_t type, void *usr_data, + uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_geocode_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_geocode_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_regeocode_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_rec_regeocode_search(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_rec_common_proc(cmd_id, type, usr_data, usr_len); +} + +errcode_t msg_center_vector_navi_req_destroy_page(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) +{ + return msg_center_vector_navi_req_common_proc(cmd_id, type, usr_data, usr_len); +} + #ifdef __cplusplus } -#endif \ No newline at end of file +#endif diff --git a/code/sdk/application/wearable/service/power_manager/CMakeLists.txt b/code/sdk/application/wearable/service/power_manager/CMakeLists.txt index 9d70515d0..42b441b58 100755 --- a/code/sdk/application/wearable/service/power_manager/CMakeLists.txt +++ b/code/sdk/application/wearable/service/power_manager/CMakeLists.txt @@ -1,4 +1,6 @@ set(COMPONENT_NAME "power_manager") +set(MODULE_NAME "app") +set(AUTO_DEF_FILE_ID TRUE) set(PUBLIC_HEADER ) diff --git a/code/sdk/application/wearable/service/power_manager/include/power_display_service.h b/code/sdk/application/wearable/service/power_manager/include/power_display_service.h index efc7e4952..7ac6713bf 100755 --- a/code/sdk/application/wearable/service/power_manager/include/power_display_service.h +++ b/code/sdk/application/wearable/service/power_manager/include/power_display_service.h @@ -11,7 +11,13 @@ #include "stdint.h" #include "stdbool.h" #include "errcode.h" +#if !defined(SW_UART_DEBUG) && !defined(SW_RTT_DEBUG) +#include "soc_diag_util.h" +#include "log_oam_logger.h" +#include "log_def.h" +#else #include "debug_print.h" +#endif #ifdef __cplusplus #if __cplusplus @@ -34,11 +40,15 @@ extern "C" { /* * 获取对应动作的掩码 */ #define GET_ACTION_MASK(action) (1 << ((uint32_t)(action))) -#ifdef DISPLAY_HSO_DEBUG_LOG -#define POWER_DISPLAY_PRINT_ERR(log_num, fmt, args...) uapi_diag_error_log(0, fmt, ##arg) -#define POWER_DISPLAY_PRINT_WARN(log_num, fmt, args...) uapi_diag_warning_log(0, fmt, ##arg) -#define POWER_DISPLAY_PRINT_INFO(log_num, fmt, args...) uapi_diag_info_log(0, fmt, ##arg) -#define POWER_DISPLAY_PRINT_DEBUG(log_num, fmt, args...) +#if !defined(SW_UART_DEBUG) && !defined(SW_RTT_DEBUG) +#define POWER_DISPLAY_PRINT_ERR(log_num, fmt, arg...) uapi_diag_error_log(0, fmt, ##arg) +#define POWER_DISPLAY_PRINT_WARN(log_num, fmt, arg...) uapi_diag_warning_log(0, fmt, ##arg) +#define POWER_DISPLAY_PRINT_INFO(log_num, fmt, arg...) uapi_diag_info_log(0, fmt, ##arg) +#ifdef WEARABLE_LOG_DEBUG +#define POWER_DISPLAY_PRINT_DEBUG(log_num, fmt, arg...) uapi_diag_debug_log(0, fmt, ##arg) +#else +#define POWER_DISPLAY_PRINT_DEBUG(log_num, fmt, arg...) +#endif #else #define POWER_DISPLAY_PRINT_ERR(log_num, fmt, arg...) PRINT("[POWER_MANAGER E/] %s: " fmt "\r\n", __FUNCTION__, ##arg) #define POWER_DISPLAY_PRINT_WARN(log_num, fmt, arg...) PRINT("[POWER_MANAGER W/] %s: " fmt "\r\n", __FUNCTION__, ##arg) @@ -199,34 +209,6 @@ typedef enum timer_event_type { } timer_event_type_t; -/** - * @brief Touch Panel事件类型枚举值 - * - * TP数据上报时需要同时标识当前TP事件类型,比如按下、释放 - * 在standby mode上报的TP事件只包含当前事件的类型 - * - */ -typedef enum touch_event_type { - /* * 手指触摸 */ - TP_PRESS = 0, - /* * 手指抬起 */ - TP_RELEASE = 1, - /* * 手指触摸后滑动 */ - TP_MOVE = 2, - /* * 主表盘盖屏 */ - TP_COVER = 3, - /* * 手指单击 */ - TP_SHORT_CLICK = 4, - /* * 手指双击 */ - TP_DOUBLE_CLICK = 5, - /* * 上滑 */ - TP_SLIDE_UP = 6, - /* * 下滑 */ - TP_SLIDE_DOWN = 7, - /* * 异常TP事件 */ - TP_INVALID, -} touch_event_type_t; - /** * @brief 屏幕管理上下文,记录关键配置信息,传递给过滤器使用 */ @@ -418,7 +400,6 @@ errcode_t power_display_task_init(void); */ screen_context_t *power_display_get_screen_context(void); - #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c b/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c index 85baf1ab3..274326667 100755 --- a/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c +++ b/code/sdk/application/wearable/service/power_manager/src/actions/display_action.c @@ -93,7 +93,7 @@ static void caculate_screen_off_time() if (last_screen_off_timestamp == 0) { return; } - screen_off_time = last_screen_on_timestamp - last_screen_off_timestamp; //??????????????????????????? + screen_off_time = last_screen_on_timestamp - last_screen_off_timestamp; //灭屏时间间隔等于本次亮屏的时间点减去上次灭屏的时间点。 screen_context_t *sc = power_display_get_screen_context(); sc->screen_off_time_interval = screen_off_time; } @@ -175,7 +175,7 @@ static void caculate_screen_on_time() if (last_screen_on_timestamp == 0) { return; } - screen_on_time = last_screen_off_timestamp - last_screen_on_timestamp; //??????????????????????????? + screen_on_time = last_screen_off_timestamp - last_screen_on_timestamp; //亮屏时间间隔等于本次灭屏的时间点减去上次亮屏的时间点。 screen_context_t *sc = power_display_get_screen_context(); sc->screen_on_time_interval = screen_on_time; } @@ -188,19 +188,20 @@ static uint32_t action_display_lcd_off() } last_screen_off_timestamp = get_display_timestamp(); caculate_screen_on_time(); -#ifdef SUPPORT_AT_OHOSFWK - notify_screen_off_event(); -#endif #if defined(ENABLE_UIKIT) || defined(ENABLE_LVGL) NotifyScreenOff(); // Instruct the uikit to close the display operation. #endif + +#ifdef SUPPORT_AT_OHOSFWK + notify_screen_off_event(); +#endif + osDelay(100); // Wait 100ms for the uikit to complete display. touch_screen_suspend(); // close touch rotary_encoder_suspend(); ext_errno ret = drv_vau_suspend(NULL); if (ret != 0) { POWER_DISPLAY_PRINT_ERR(0, "drv vau suspend error ret=%x\r\n", ret); - return ERRCODE_FAIL; } #ifdef SUPPORT_GPU_JPEG (void)drv_jpeg_suspend(NULL); @@ -209,7 +210,6 @@ static uint32_t action_display_lcd_off() ret = drv_dpu_suspend(NULL); if (ret != 0) { POWER_DISPLAY_PRINT_ERR(0, "drv dpu suspend error ret=%x\r\n", ret); - return ERRCODE_FAIL; } #endif #ifdef SUPPORT_GPU_GMMU diff --git a/code/sdk/application/wearable/service/power_manager/src/filters/gui_event_filter.c b/code/sdk/application/wearable/service/power_manager/src/filters/gui_event_filter.c index 5e5828d21..aceb0a7fa 100755 --- a/code/sdk/application/wearable/service/power_manager/src/filters/gui_event_filter.c +++ b/code/sdk/application/wearable/service/power_manager/src/filters/gui_event_filter.c @@ -8,6 +8,7 @@ #include "power_display_service.h" #include "display_filter.h" #include "common_def.h" +#include "touch_screen_def.h" static input_action_t filter_gui_execute_product_rule(screen_context_t *current, uint32_t event) { @@ -28,13 +29,13 @@ static input_action_t filter_gui_execute_touch_event(screen_context_t *current, { unused(type); input_action_t ac = KEEP_CURRENT_STATE; - if (event == TP_PRESS) { + if (event == MC_TP_PRESS) { current->press_state = true; - } else if (event == TP_RELEASE || event == TP_COVER) { + } else if (event == MC_TP_RELEASE || event == MC_TP_COVER) { current->press_state = false; } - if (event == TP_COVER) { + if (event == MC_TP_COVER) { ac = TURN_OFF_SCREEN; } else { ac = TURN_ON_SCREEN; diff --git a/code/sdk/application/wearable/service/power_manager/src/power_display_service.c b/code/sdk/application/wearable/service/power_manager/src/power_display_service.c index a1909dc89..de79404ee 100755 --- a/code/sdk/application/wearable/service/power_manager/src/power_display_service.c +++ b/code/sdk/application/wearable/service/power_manager/src/power_display_service.c @@ -19,8 +19,9 @@ #include "input_app.h" #include "touch_screen_def.h" #include "display_state_machine.h" +#include "touch_screen_def.h" -#define DISPLAY_AUTO_POWER_OFF_PERIOD_MS (1000 * 5) //5秒 +#define DISPLAY_AUTO_POWER_OFF_PERIOD_MS 5000 #define DISPLAY_DEFAULT_BRIGHTNESS 50 #define POWER_DISPLAY_QUEUE_MAX_SIZE 64 #define POWER_DISPLAY_MAX_SIZE 0x10 @@ -131,9 +132,7 @@ static errcode_t power_display_set_auto_timeout_function(bool enable) static errcode_t power_display_set_keepon_timeout(uint32_t time) { - if (g_screen_context.keep_on_timeout != 0 && time != 0) - // if (g_screen_context.keep_on_timeout != 0 ) - { + if (g_screen_context.keep_on_timeout != 0 && time != 0) { POWER_DISPLAY_PRINT_ERR(0, "current has been set %u,need to wait for timeout or set 0 to cancel. \r\n", g_screen_context.keep_on_timeout); return ERRCODE_FAIL; @@ -224,11 +223,11 @@ static void power_display_touch_event_cb(uint32_t event, uint32_t event_value) unused(event_value); message_type_t mt = GUI_EVENT_CMD; uint32_t event_info = TOUCH; - if (event == INDEV_STATE_PRESS) { - event_info += TP_PRESS; + if (event == MC_TP_PRESS || event == MC_TP_MOVE) { + event_info += MC_TP_PRESS; g_power_tp_press_num++; - } else if (event == INDEV_STATE_RELEASE) { - event_info += TP_RELEASE; + } else if (event == MC_TP_RELEASE) { + event_info += MC_TP_RELEASE; g_power_tp_press_num = 0; } else { return; diff --git a/code/sdk/application/wstp/at_service/app/app_at_process.c b/code/sdk/application/wstp/at_service/app/app_at_process.c index 963d19f66..800d1b66b 100755 --- a/code/sdk/application/wstp/at_service/app/app_at_process.c +++ b/code/sdk/application/wstp/at_service/app/app_at_process.c @@ -128,11 +128,6 @@ #define LCD_FILL_COLOR_ADDR 0x60280000 #endif -#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG 0x57000014 -#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL 0xb66 -#define PM_MCU_SEND_IPC_WKUP_BT_REG 0x52000034 -#define PM_MCU_SEND_IPC_WKUP_BT_VAL 0x2 -#define BT_RESET_DELAY 500 #define POWER_KEY_PARAM_LEN 0x2 #define CALENDAR_PARAM_LEN 0x6 #ifdef CFG_DRIVERS_MMC @@ -416,10 +411,7 @@ uint32_t mcu_os_sys_reset(uint8_t *para, uint32_t para_len) send_spp_diag_msg(g_app_diag_flag, &g_mcu_diag_header, res, DIAG_RES_LEN); reset_deal_with_fs(); - // when bt at sleep, need wkup bt before soft reset - writew(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG, PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL); - writew(PM_MCU_SEND_IPC_WKUP_BT_REG, PM_MCU_SEND_IPC_WKUP_BT_VAL); - uapi_tcxo_delay_ms(BT_RESET_DELAY); + set_cpu_utils_reset_cause(REBOOT_CAUSE_APPLICATION_SYSRESETREQ); hal_reboot_chip(); return ERRCODE_SUCC; @@ -466,8 +458,6 @@ uint32_t mcu_os_heap_info(uint8_t *para, uint32_t para_len) } wstp_print("\r\n"); - - #endif #if defined __FREERTOS__ && defined FREERTOS_DEBUG freertos_heap_print(); @@ -1212,10 +1202,7 @@ uint32_t mcu_pm_into_force_ds_mode(uint8_t *para, uint32_t para_len) { unused(para); unused(para_len); - // when bt at sleep, need wkup bt before soft reset - writew(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG, PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL); - writew(PM_MCU_SEND_IPC_WKUP_BT_REG, PM_MCU_SEND_IPC_WKUP_BT_VAL); - uapi_tcxo_delay_ms(BT_RESET_DELAY); + set_cpu_utils_reset_cause(REBOOT_CAUSE_APPLICATION_SYSRESETREQ); writew(0x5702C010, 0x5A5A); hal_reboot_chip(); diff --git a/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp b/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp index 7fa4d214c..7a36219b8 100755 --- a/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp +++ b/code/sdk/application/wstp/at_service/ohosfwk/ohosfwk_at_process.cpp @@ -14,6 +14,7 @@ #include "abilityms_slite_client.h" #include "gt_bundle_manager_service.h" #include "ui_service.h" +#include "sign_mode.h" #define ARRAY_COUNT(array) (sizeof(array) / sizeof(array[0])) #define OHOSFWK_MAX_ARGC 8 @@ -162,9 +163,9 @@ static uint32_t OhosfwkATCmdBmSet(uint8_t *para, uint32_t paraLen, char *strComm char *enable = (char *)argv[0]; if (strcmp(enable, "enable") == 0) { - OHOS::GtManagerService::GetInstance().SetSignMode(true); + OHOS::SignMode::GetInstance().SetSignMode(true); } else if (strcmp(enable, "disable") == 0) { - OHOS::GtManagerService::GetInstance().SetSignMode(false); + OHOS::SignMode::GetInstance().SetSignMode(false); } else { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "input failed!"); } diff --git a/code/sdk/bootloader/flashboot/brandy/main.c b/code/sdk/bootloader/flashboot/brandy/main.c index be9afc107..274de4b8a 100755 --- a/code/sdk/bootloader/flashboot/brandy/main.c +++ b/code/sdk/bootloader/flashboot/brandy/main.c @@ -644,9 +644,6 @@ void main(void) show_reboot_info(); otp_init(); - // Enable the SSB hash check in the ROM program. - otp_write_bit(OTP_BOOTLOADER_BYTE, (1 << OTP_BOOTLOADER_FSB_EN_SSB_HASH_BIT)); - otp_write_bit(OTP_BOOTLOADER_DOUBLE_BYTE, (1 << OTP_BOOTLOADER_FSB_EN_SSB_HASH_BIT)); irmalloc_init_default(); ssb_hold_flash_pin(); uapi_flash_init(0); diff --git a/code/sdk/bootloader/flashboot/brandy/nandflash/hal_nandflash.c b/code/sdk/bootloader/flashboot/brandy/nandflash/hal_nandflash.c index df6910322..06298c845 100755 --- a/code/sdk/bootloader/flashboot/brandy/nandflash/hal_nandflash.c +++ b/code/sdk/bootloader/flashboot/brandy/nandflash/hal_nandflash.c @@ -79,9 +79,9 @@ uint32_t read_cell_array(qspi_data_type_def *qspi_data) nand_qspi_enable(); writel(SER, 0x0); nand_qspi_write_data(qspi_data->instruction); - nand_qspi_write_data(DUMMY_CYCLE_BYTE); - nand_qspi_write_data(qspi_data->data_ptr[0]); - nand_qspi_write_data(qspi_data->data_ptr[1]); + nand_qspi_write_data(qspi_data->data_ptr[1]); /* 1: bit24~bit16 */ + nand_qspi_write_data(qspi_data->data_ptr[2]); /* 2: bit15~bit8 */ + nand_qspi_write_data(qspi_data->data_ptr[3]); /* 3: bit7~bit0 */ writel(SER, SER_SELECT); is_nandflash_working = false; osal_irq_restore(irq_sts); @@ -111,9 +111,9 @@ uint32_t program_execute(qspi_data_type_def *qspi_data) nand_qspi_enable(); writel(SER, 0x0); nand_qspi_write_data(qspi_data->instruction); - nand_qspi_write_data(DUMMY_CYCLE_BYTE); - nand_qspi_write_data(qspi_data->data_ptr[0]); - nand_qspi_write_data(qspi_data->data_ptr[1]); + nand_qspi_write_data(qspi_data->data_ptr[1]); /* 1: bit24~bit16 */ + nand_qspi_write_data(qspi_data->data_ptr[2]); /* 2: bit15~bit8 */ + nand_qspi_write_data(qspi_data->data_ptr[3]); /* 3: bit7~bit0 */ writel(SER, SER_SELECT); is_nandflash_working = false; osal_irq_restore(irq_sts); @@ -137,9 +137,9 @@ uint32_t block_erase(qspi_data_type_def *qspi_data) nand_qspi_enable(); writel(SER, 0x0); nand_qspi_write_data(qspi_data->instruction); - nand_qspi_write_data(DUMMY_CYCLE_BYTE); - nand_qspi_write_data(qspi_data->data_ptr[0]); - nand_qspi_write_data(qspi_data->data_ptr[1]); + nand_qspi_write_data(qspi_data->data_ptr[1]); /* 1: bit24~bit16 */ + nand_qspi_write_data(qspi_data->data_ptr[2]); /* 2: bit15~bit8 */ + nand_qspi_write_data(qspi_data->data_ptr[3]); /* 3: bit7~bit0 */ writel(SER, SER_SELECT); is_nandflash_working = false; osal_irq_restore(irq_sts); diff --git a/code/sdk/bootloader/flashboot/brandy/nandflash/nandflash.c b/code/sdk/bootloader/flashboot/brandy/nandflash/nandflash.c index 32e41013f..8c740c089 100755 --- a/code/sdk/bootloader/flashboot/brandy/nandflash/nandflash.c +++ b/code/sdk/bootloader/flashboot/brandy/nandflash/nandflash.c @@ -111,15 +111,15 @@ uint32_t mc_flash_read_page(uint32_t nand_page, uint8_t *data, uint32_t data_len { uapi_watchdog_kick(); NFPRINT("mc_flash_read_page nand_page = %d\r\n", nand_page); - uint16_t page_addr; + uint32_t page_addr; errno_t err_code; uint8_t error_cnt = 0; if (nand_page >= (get_nand_flash()->pages_per_block * get_nand_flash()->total_block)) { return MC_FAILURE; } mc_flash_busy_wait(); - page_addr = SWAP_U16(nand_page); - NFPRINT("page addr = %d \r\n", page_addr); + page_addr = SWAP_U32(nand_page); + NFPRINT("page addr = %u \r\n", page_addr); qspi_data_type_def qspi_data = {0}; qspi_data.data_ptr = (uint8_t *)&page_addr; qspi_data.instruction = 0x13; @@ -139,7 +139,7 @@ uint32_t mc_flash_write_page(uint32_t nand_page, uint8_t *data, uint32_t data_le { uapi_watchdog_kick(); uint32_t ret; - uint16_t page_addr; + uint32_t page_addr; uint8_t status_reg; write_cmd(CMD_FLASH_WREN); qspi_data_type_def p_load_qspi_data = {0}; @@ -148,7 +148,7 @@ uint32_t mc_flash_write_page(uint32_t nand_page, uint8_t *data, uint32_t data_le program_load(&p_load_qspi_data, data, data_len, oob, oob_len); qspi_data_type_def e_load_qspi_data = {0}; e_load_qspi_data.instruction = CMD_FLASH_PP_EXE; - page_addr = SWAP_U16(nand_page); + page_addr = SWAP_U32(nand_page); e_load_qspi_data.data_ptr = (uint8_t *)&page_addr; program_execute(&e_load_qspi_data); mc_flash_busy_wait(); @@ -168,9 +168,9 @@ uint32_t mc_flash_erase_block(uint32_t block_no) uapi_watchdog_kick(); NFPRINT("mc_flash_erase_block block_no = %d\r\n", block_no); uint32_t ret; - uint16_t page_addr; + uint32_t page_addr; uint8_t reg_status; - page_addr = SWAP_U16(block_no * get_nand_flash()->pages_per_block); + page_addr = SWAP_U32(block_no * get_nand_flash()->pages_per_block); write_cmd(CMD_FLASH_WREN); qspi_data_type_def erase_qspi_data = {0}; erase_qspi_data.data_ptr = (uint8_t *)&page_addr; @@ -197,11 +197,11 @@ uint32_t mc_flash_mark_bad_block(uint32_t block_no) qspi_data_type_def mark = {0}; mark.instruction = CMD_FLASH_PP_RANDOM; mark.data_ptr = (uint8_t *)&mark_sign; - mark.address = get_nand_flash()->bytes_per_page; + mark.address = (uint16_t)(get_nand_flash()->bytes_per_page); mark_bad_block(&mark); qspi_data_type_def execute = {0}; execute.instruction = CMD_FLASH_PP_EXE; - uint16_t page_addr = SWAP_U16(block_no * get_nand_flash()->pages_per_block); + uint32_t page_addr = SWAP_U32(block_no * get_nand_flash()->pages_per_block); execute.data_ptr = (uint8_t *)&page_addr; program_execute(&execute); mc_flash_busy_wait(); @@ -213,7 +213,7 @@ uint32_t mc_flash_check_bad_block(uint32_t block_no) { uapi_watchdog_kick(); uint32_t ret = NOT_BAD_BLOCK; - uint16_t page_addr = SWAP_U16(block_no * get_nand_flash()->pages_per_block); + uint32_t page_addr = SWAP_U32(block_no * get_nand_flash()->pages_per_block); qspi_data_type_def cell_read = {0}; cell_read.data_ptr = (uint8_t *)&page_addr; cell_read.instruction = CMD_FLASH_READ_PAGE; @@ -225,7 +225,7 @@ uint32_t mc_flash_check_bad_block(uint32_t block_no) random_read.data_ptr = &check_value; random_read.instruction = CMD_FLASH_READ; random_read.data_size = 4; // 4 is data length - random_read.address = get_nand_flash()->bytes_per_page; + random_read.address = (uint16_t)(get_nand_flash()->bytes_per_page); read_buffer_single_line_width_8(&random_read); /* check the oob fisrt byte 2 and byte 3 bytes, they are badblock bits */ check_value = check_value >> 16; // 16 is mark pos need diff --git a/code/sdk/bootloader/flashboot/brandy/nandflash/nandflash_qspi.c b/code/sdk/bootloader/flashboot/brandy/nandflash/nandflash_qspi.c index 1baac32c3..e6694133e 100755 --- a/code/sdk/bootloader/flashboot/brandy/nandflash/nandflash_qspi.c +++ b/code/sdk/bootloader/flashboot/brandy/nandflash/nandflash_qspi.c @@ -76,8 +76,11 @@ void qspi_read_width_8(uint8_t *buffer, uint32_t length) return; } while (((readl(SR)) & 0x8) == 0x8) { - buffer[ul_loop] = ((uint8_t)readl(DR)); - ul_loop++; + if (ul_loop < length) { + buffer[ul_loop++] = ((uint8_t)readl(DR)); + } else { + (void)readl(DR); + } ul_recv_timeout = 0; } ul_recv_timeout++; @@ -100,8 +103,11 @@ void qspi_read_width_32(uint32_t *recvbuf, uint32_t length) return; } while (((readl(SR)) & 0x8) == 0x8) { - recvbuf[ul_loop] = ((uint32_t)readl(DR)); - ul_loop++; + if (ul_loop < length) { + recvbuf[ul_loop++] = ((uint32_t)readl(DR)); + } else { + (void)readl(DR); + } ul_recv_timeout = 0; } ul_recv_timeout++; diff --git a/code/sdk/build/cmake/build_component.cmake b/code/sdk/build/cmake/build_component.cmake index 8da417e97..d494bbb1e 100755 --- a/code/sdk/build/cmake/build_component.cmake +++ b/code/sdk/build/cmake/build_component.cmake @@ -93,8 +93,10 @@ macro(build_library) else() if(DEFINED LIB) else() - message(STATUS "${SOURCES0} is not found, finding lib${COMPONENT_NAME}.a in ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_COMMAND}") - find_library(LINK_LIB_${COMPONENT_NAME} "lib${COMPONENT_NAME}.a" ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_COMMAND}) + set(TARGET_COMMAND_TMP ${TARGET_COMMAND}) + string(REPLACE "-user" "" TARGET_COMMAND_TMP ${TARGET_COMMAND_TMP}) + message(STATUS "${SOURCES0} is not found, finding lib${COMPONENT_NAME}.a in ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_COMMAND_TMP}") + find_library(LINK_LIB_${COMPONENT_NAME} "lib${COMPONENT_NAME}.a" ${CMAKE_CURRENT_SOURCE_DIR}/${TARGET_COMMAND_TMP}) if(NOT LINK_LIB_${COMPONENT_NAME}) message(FATAL_ERROR "${SOURCES0} is not found && lib${COMPONENT_NAME}.a not find") endif() diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index 7f71211d0..bce4505d0 100755 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -113,9 +113,8 @@ target = { "-:TARGET_CHIP_BRANDY=1", "-:BRANDY_CHIP_V100=1", 'CFG_DRIVERS_NANDFLASH', 'CONFIG_ZDIAG_NV_SUPPORT', 'CONFIG_ZDIAG_AUDIO_PROC_SUPPORT', 'CONFIG_ZDIAG_AUDIO_DUMP_SUPPORT', 'CONFIG_ZDIAG_AUDIO_PROBE_SUPPORT', 'CONFIG_SEA_PHS_SUPPORT', 'CONFIG_DIAG_GPU_PROC_SUPPORT', 'SUPPORT_BLE', 'SUPPORT_BREDR', 'ENABLE_UIKIT', 'SUPPORT_GPU_JPEG', 'SUPPORT_GPU_GMMU', 'SUPPORT_GPU_OPENVG', - 'SW_UART_DEBUG', 'SAVE_EXC_INFO', 'HASH_MEM_COPY', 'JS_ENABLE', - 'CONFIG_LOW_POWER_TEST', - 'ENABLE_ECC', + 'SW_UART_DEBUG', 'SAVE_EXC_INFO', 'HASH_MEM_COPY', 'JS_ENABLE', 'CONFIG_LOW_POWER_TEST', + 'ENABLE_ECC','MIPI_ULPS_SUPPORT','SUPPORT_ALIPAY_SEC', 'FT_SINGLE_UART', 'PPG_HX3695', # 'ACC_LIS2DOC', @@ -129,16 +128,15 @@ target = { 'SUPPORT_SPO2_NOTIFICATION', 'SUPPORT_SPO2_NOTIFICATION_TEST', 'SUPPORT_DEVICE_PAIRING_NOTIFICATION', - 'MIPI_ULPS_SUPPORT', 'ENABLE_FONT_VECTOR_GLOBAL', 'ENABLE_SHAPING', 'TPTYPE_FT6X46', 'SUPPORT_CHARGER_PLUG_DETECTION_NOTIFICATION', 'SUPPORT_AT_CUSTOMUTILS', - 'SUPPORT_ALIPAY_SEC', 'SUPPORT_BLE_SERVICE', 'FD230', 'CYWEE_SPORT', + 'SUPPORT_BAIDU_MAP', 'SUPPORT_HID_SERVICE', 'SUPPORT_TELECOM_DMP', ], @@ -147,15 +145,13 @@ target = { 'psram', 'hal_mipi', 'mipi_tx', 'non_os', 'touch', 'ulp_aon', 'hal_l2ram', 'x_dpal', 'x_vfs', 'x_disk', 'x_fat', 'drv_mmc', 'fs_yaffs2', 'x_vfs_private', - 'pm_service', 'pm_brandy', 'cmn_header', - 'at_cmd', - 'graphic_at_service', - 'app_at_service', - 'ohosfwk_at_service', + 'pm_service', 'pm_brandy', 'cmn_header','at_cmd', 'graphic_at_service', 'app_at_service', 'ohosfwk_at_service', + "audio_proc", "audio_dump", "audio_probe", "power_manager", "gpu_proc", 'bts_header', + 'baidumapcomponent', + 'baidumapsdk', 'audio_at_service', 'media_at_service', 'bt_manager_at_service', - "audio_proc", "audio_dump", "audio_probe", "power_manager", "gpu_proc", 'bts_header', "ppg_sensor", "ppgBleService", "mag_sensor", @@ -168,8 +164,9 @@ target = { "CustomUIcomponentTool", "custom_utils", "custom_utilscpp", + "custom_config", "rotary_encoder", - #"nativelauncher", + # "nativelauncher", "fd230launcher", "ppg_service", # "acc_sensor", @@ -184,9 +181,15 @@ target = { 'dsp_version': 'max', 'packet': True, 'image_analysis': False, - #'fs_image_path':'evb4', - 'fs_image_path':'fd230', + # 'fs_image_path':'evb4', + 'fs_image_path':'fd230', 'fs_image': True + }, + #native-js-user: liteos + uikit + nandflash + mipi + psram + audio 典型合封UIKIT版本 + #离线日志版本 + 'brandy-native-js-user': { + 'base_target_name': 'brandy-native-js', + 'defines': ['-:SW_UART_DEBUG'], }, #native-xts: liteos + uikit + nandflash + mipi + psram + audio 典型合封UIKIT版本 'brandy-xts': { @@ -205,6 +208,7 @@ target = { 'MAG_MMC5603', 'ENABLE_FONT_VECTOR_GLOBAL', 'ENABLE_SHAPING', + 'SUPPORT_BAIDU_MAP', 'TPTYPE_FT6X46' ], 'ram_component': ["algorithm", "dfx_port_brandy", "dfx_update", 'dfx_nv', "osal", "arch_port", "-:testsuite", @@ -214,6 +218,8 @@ target = { 'x_dpal', 'x_vfs', 'x_disk', 'x_fat', 'drv_mmc', 'fs_yaffs2', 'x_vfs_private', 'pm_service', 'pm_brandy', 'cmn_header', 'at_cmd', 'graphic_at_service', 'app_at_service', 'ohosfwk_at_service', "audio_proc", "audio_dump", "audio_probe", "power_manager", "gpu_proc", 'bts_header', + 'baidumapcomponent', + 'baidumapsdk', "ppg_sensor", "acc_sensor", "mag_sensor", @@ -353,15 +359,12 @@ target = { "SSB_USE_PLL", "VERSION_STANDARD", "BUILD_APPLICATION_SSB", "LIBBOOTLOADER", "LIBCODELOADER", "LIBCPU_UTILS", "LIBAPP_VERSION", "LIBPANIC", "LIBCONNECTIVITY", "LIBERROR_CODE", "LIBSEC_RANDOM", "LIBCODELOADER_SSB", "LIBJLINK_LOAD", "LIBLIB_UTILS", "LIBBUILD_VERSION", - 'ENABLE_ECC', - "CFG_DRIVERS_NANDFLASH", - "NO_TIMEOUT", "CONFIG_UART_BAUD_RATE_DIV_8", 'SW_UART_DEBUG', 'LARGE_BUFFER', + "NO_TIMEOUT", "CONFIG_UART_BAUD_RATE_DIV_8", 'SW_UART_DEBUG', 'LARGE_BUFFER', + 'ENABLE_ECC',"CFG_DRIVERS_NANDFLASH", 'FT_SINGLE_UART' ], 'ram_component': ['arch_port', 'hal_l2ram', 'sec_boot', 'libboundscheck', - 'dfx_exception', 'error_code', 'psram', 'osal', 'cmn_header', - 'boot_ulp', - 'boot_nandflash' + 'dfx_exception', 'error_code', 'psram', 'osal', 'cmn_header', 'boot_ulp', 'boot_nandflash' ], 'ram_component_set': ['pinctrl'], 'target': 'ssb', @@ -375,10 +378,11 @@ target_group = { 'pack_brandy_target4': ['brandy-ssb', 'brandy-target4-r', 'brandy-target4'], 'pack_brandy_target5': ['brandy-ssb', 'brandy-target5-r', 'brandy-target5'], 'pack_brandy_native_js': ['brandy-ssb', 'brandy-native-js-r', 'brandy-native-js'], + 'pack_brandy_native_js_user': ['brandy-ssb', 'brandy-native-js-r', 'brandy-native-js-user'], 'pack_brandy_xts': ['brandy-ssb', 'brandy-xts-r', 'brandy-xts'], 'brandy_all': ['brandy-ssb', - 'brandy-target1', 'brandy-target3', 'brandy-target4', 'brandy-target5', 'brandy-native-js', 'brandy-xts', + 'brandy-target1', 'brandy-target3', 'brandy-target4', 'brandy-target5', 'brandy-native-js', 'brandy-native-js-user', 'brandy-xts', 'brandy-target1-r', 'brandy-target3-r', 'brandy-target4-r', 'brandy-target5-r', 'brandy-native-js-r', 'brandy-xts-r', 'testsuite-brandy-sdk'] } diff --git a/code/sdk/build/config/target_config/brandy/nv_bin_cfg/mk_nv_bin_cfg.json b/code/sdk/build/config/target_config/brandy/nv_bin_cfg/mk_nv_bin_cfg_eng.json old mode 100755 new mode 100644 similarity index 94% rename from code/sdk/build/config/target_config/brandy/nv_bin_cfg/mk_nv_bin_cfg.json rename to code/sdk/build/config/target_config/brandy/nv_bin_cfg/mk_nv_bin_cfg_eng.json index cde18cf23..d79f52360 --- a/code/sdk/build/config/target_config/brandy/nv_bin_cfg/mk_nv_bin_cfg.json +++ b/code/sdk/build/config/target_config/brandy/nv_bin_cfg/mk_nv_bin_cfg_eng.json @@ -1,10 +1,10 @@ -{ - "OUT_BIN_DIR" : "output/brandy/nv_bin", - "OUT_BIN_NAME" : "brandy_all_nv.bin", - "BUILD_TEMP_PATH" : "output/brandy", - - "NV_TARGET_JSON_PATH" : "middleware/chips/brandy/nv/nv_config/cfg/nv_target.json", - "NV_RELATIVE_PATH" : "output/brandy/nv_bin/temp", - "NV_DEFAULT_CFG_DIR" : "middleware/chips/brandy/nv/nv_config/cfg", - "DATABASE_TXT_FILE" : "output/brandy/nv_bin" +{ + "OUT_BIN_DIR" : "output/brandy/nv_bin", + "OUT_BIN_NAME" : "brandy_all_nv.bin", + "BUILD_TEMP_PATH" : "output/brandy", + + "NV_TARGET_JSON_PATH" : "middleware/chips/brandy/nv/nv_config/cfg/nv_target.json", + "NV_RELATIVE_PATH" : "output/brandy/nv_bin/temp", + "NV_DEFAULT_CFG_DIR" : "middleware/chips/brandy/nv/nv_config/cfg/eng", + "DATABASE_TXT_FILE" : "output/brandy/nv_bin" } \ No newline at end of file diff --git a/code/sdk/build/config/target_config/brandy/nv_bin_cfg/mk_nv_bin_cfg_user.json b/code/sdk/build/config/target_config/brandy/nv_bin_cfg/mk_nv_bin_cfg_user.json new file mode 100644 index 000000000..e42ffa6c9 --- /dev/null +++ b/code/sdk/build/config/target_config/brandy/nv_bin_cfg/mk_nv_bin_cfg_user.json @@ -0,0 +1,10 @@ +{ + "OUT_BIN_DIR" : "output/brandy/nv_bin", + "OUT_BIN_NAME" : "brandy_all_nv.bin", + "BUILD_TEMP_PATH" : "output/brandy", + + "NV_TARGET_JSON_PATH" : "middleware/chips/brandy/nv/nv_config/cfg/nv_target.json", + "NV_RELATIVE_PATH" : "output/brandy/nv_bin/temp", + "NV_DEFAULT_CFG_DIR" : "middleware/chips/brandy/nv/nv_config/cfg/user", + "DATABASE_TXT_FILE" : "output/brandy/nv_bin" +} \ No newline at end of file diff --git a/code/sdk/build/config/target_config/brandy/target_config.py b/code/sdk/build/config/target_config/brandy/target_config.py index 98a05250d..83bd831a1 100755 --- a/code/sdk/build/config/target_config/brandy/target_config.py +++ b/code/sdk/build/config/target_config/brandy/target_config.py @@ -17,7 +17,7 @@ target_template = { 'hso_enable': False, 'os': 'non-os', 'CONFIG_WATCHDOG_USING_V100': 'y', - 'defines': ["RISCV_70", "CONFIG_XIP_ENABLE_READ_OVERTIME", 'CONFIG_PINCTRL_SUPPORT_IE'], + 'defines': ["RISCV_70", "CONFIG_XIP_ENABLE_READ_OVERTIME", 'CONFIG_PINCTRL_SUPPORT_IE', 'CONFIG_EFUSE_CLK_EN'], 'std_libs': ['c', 'm', 'clang_rt.builtins-riscv32', 'gloss'], 'defines_set': ['libsec_defines', 'chip_defines', 'version_defines'], 'ram_component_set': ['cpu_trace', 'ipc', 'mem', 'boot_common_lib', 'gpio_v100', 'ssb_libs', @@ -54,7 +54,7 @@ target_template = { "CONFIG_NV_SUPPORT_SINGLE_CORE_SYSTEM", 'CONFIG_NV_FEATURE_SUPPORT', 'CONFIG_SPI_SUPPORT_LPC', "RISCV_70", 'SUPPORT_DIAG_V2_PROTOCOL', 'CONFIG_PINCTRL_SUPPORT_IE', "DUMP_MEM_SUPPORT", "DUMP_REG_SUPPORT", "SUPPORT_DFX_EXCEPTION", 'CONFIG_SPI_SUPPORT_DMA', - 'CONFIG_I2C_SUPPORT_DMA', 'CONFIG_I2C_SUPPORT_LPC'], + 'CONFIG_I2C_SUPPORT_DMA', 'CONFIG_I2C_SUPPORT_LPC', 'CONFIG_EFUSE_CLK_EN'], 'defines_set': ['chip_defines', 'version_defines'], 'ram_component': ['brandy_std_lds', 'liteos_207_1_0', 'partition', 'chip_brandy', 'driver_header', 'nand_flash', 'brandy_app_standard', 'board_brandy', 'brandy_clocks', 'pmu_brandy', 'hal_sectors', @@ -92,7 +92,7 @@ target_template = { "CONFIG_NV_SUPPORT_SINGLE_CORE_SYSTEM", 'CONFIG_NV_FEATURE_SUPPORT', 'CONFIG_SPI_SUPPORT_LPC', "CONFIG_XIP_ENABLE_READ_OVERTIME", 'SUPPORT_DIAG_V2_PROTOCOL', 'CONFIG_PINCTRL_SUPPORT_IE', "DUMP_MEM_SUPPORT", "DUMP_REG_SUPPORT", "SUPPORT_DFX_EXCEPTION", 'CONFIG_SPI_SUPPORT_DMA', - 'CONFIG_I2C_SUPPORT_DMA', 'FREERTOS_DEBUG', 'CONFIG_I2C_SUPPORT_LPC'], + 'CONFIG_I2C_SUPPORT_DMA', 'FREERTOS_DEBUG', 'CONFIG_I2C_SUPPORT_LPC', 'CONFIG_EFUSE_CLK_EN'], 'defines_set': ['chip_defines', 'version_defines'], 'ram_component': ['brandy_std_lds', 'chip_brandy', 'brandy_app_standard', 'driver_header', 'board_brandy', 'brandy_clocks', 'pmu_brandy', 'c', 'm', 'segger', 'posix', 'sec', 'freertos', @@ -131,7 +131,8 @@ target_template = { 'CONFIG_PINCTRL_SUPPORT_IE', 'CONFIG_DFX_SUPPORT_SOC_LOG=0', 'CONFIG_I2C_SUPPORT_LPC', 'CONFIG_DFX_SUPPORT_TRANSMIT_FILE=0', 'CONFIG_DFX_SUPPORT_DIAG_BEAT_HEART=0', 'CONFIG_DFX_SUPPORT_DIAG_VRTTUAL_SHELL=0', 'CONFIG_DFX_SUPPORT_DIAG_CONNECT_BLE=0', - 'CONFIG_DFX_SUPPORT_OFFLINE_LOG_FILE=0', 'CONFIG_DFX_MEMORY_DEBUG=0', 'CONFIG_DFX_SUPPORT_DIAG_ADAPT_SOC_LOG=0'], + 'CONFIG_DFX_SUPPORT_OFFLINE_LOG_FILE=0', 'CONFIG_DFX_MEMORY_DEBUG=0', 'CONFIG_DFX_SUPPORT_DIAG_ADAPT_SOC_LOG=0', + 'CONFIG_EFUSE_CLK_EN'], 'defines_set': ['chip_defines', 'version_defines'], 'ram_component': ['brandy_recovery_lds', 'liteos_207_1_0', 'partition', 'chip_brandy', 'driver_header', 'brandy_app_recovery', 'board_brandy', 'brandy_clocks', 'pmu_brandy', 'partition_brandy', @@ -170,7 +171,7 @@ target_template = { 'CONFIG_I2C_SUPPORT_LPC', 'CONFIG_DFX_SUPPORT_TRANSMIT_FILE=0', 'CONFIG_DFX_SUPPORT_SOC_LOG=0', 'CONFIG_DFX_SUPPORT_DIAG_BEAT_HEART=0', 'CONFIG_DFX_SUPPORT_DIAG_VRTTUAL_SHELL=0', 'CONFIG_DFX_SUPPORT_DIAG_CONNECT_BLE=0', 'CONFIG_DFX_SUPPORT_OFFLINE_LOG_FILE=0', - 'CONFIG_DFX_MEMORY_DEBUG=0', 'CONFIG_DFX_SUPPORT_DIAG_ADAPT_SOC_LOG=0'], + 'CONFIG_DFX_MEMORY_DEBUG=0', 'CONFIG_DFX_SUPPORT_DIAG_ADAPT_SOC_LOG=0', 'CONFIG_EFUSE_CLK_EN'], 'defines_set': ['chip_defines', 'version_defines'], 'ram_component': ['brandy_recovery_lds', 'partition', 'chip_brandy', 'freertos', 'cmsis_rtos', 'xlt_mem', 'brandy_app_recovery', 'board_brandy', 'brandy_clocks', 'pmu_brandy', 'partition_brandy', @@ -210,7 +211,7 @@ target_template = { "RISCV_70", "CONFIG_XIP_ENABLE_READ_OVERTIME", 'SUPPORT_DIAG_V2_PROTOCOL', 'CONFIG_SPI_SUPPORT_LPC', "SUPPORT_GPU_JPEG", "SUPPORT_GPU_GMMU", "SUPPORT_GPU_OPENVG", 'CONFIG_PINCTRL_SUPPORT_IE', 'CONFIG_SPI_SUPPORT_DMA', 'CONFIG_I2C_SUPPORT_DMA', 'CONFIG_UART_SUPPORT_DMA', - 'CONFIG_I2C_SUPPORT_LPC'], + 'CONFIG_I2C_SUPPORT_LPC', 'CONFIG_EFUSE_CLK_EN'], 'defines_set': ['chip_defines', 'version_defines'], 'ram_component': ['brandy_std_lds', 'liteos_207_1_0', 'chip_brandy', 'driver_header', 'nand_flash', 'brandy_testsuite', 'board_brandy', 'brandy_clocks', 'pmu_brandy', 'hal_sectors', diff --git a/code/sdk/build/config/target_config/common_config.py b/code/sdk/build/config/target_config/common_config.py index be29f0651..5a65f6ad0 100755 --- a/code/sdk/build/config/target_config/common_config.py +++ b/code/sdk/build/config/target_config/common_config.py @@ -116,8 +116,8 @@ component_set = { 'efuse_v120': ['efuse', 'hal_efuse_v120', 'efuse_porting'], 'efuse_v100': ['efuse', 'hal_efuse_v100', 'efuse_porting'], 'efuse_v130': ['efuse', 'hal_efuse_v130', 'efuse_port'], - 'ohos_set' : ['bootstrap', 'samgr', 'ams', 'bms', 'ace', 'ace_adapt', 'permission', 'appverify', 'jerryscript','js_player', 'js_audio_captuer', 'i18n', - 'resmgr', 'syspara', 'utils_kv_store', 'native_file'], + 'ohos_set' : ['bootstrap', 'samgr', 'ams', 'bms', 'bms_sign_mode', 'ace', 'ace_adapt', 'permission', 'appverify', 'jerryscript','js_player', 'js_audio_captuer', 'i18n', + 'resmgr', 'syspara', 'utils_kv_store', 'native_file', 'storage_jsapi', 'brightness'], 'wearable_set' : ['nativeabilityfwk', 'ai_voice_service', 'ai_voice_engine_hal', 'ai_voice_audio_stream_wrapper', 'ohos_deps', 'broadcast', 'msg_center', 'msg_center_adapt', 'ohos_startup'], 'xts_set' : ["xts_adapt", "ohos_drv_v3.2", diff --git a/code/sdk/build/script/cmake_builder.py b/code/sdk/build/script/cmake_builder.py index 33d994cf6..07d53b21a 100755 --- a/code/sdk/build/script/cmake_builder.py +++ b/code/sdk/build/script/cmake_builder.py @@ -27,16 +27,28 @@ class CMakeBuilder(BuildEnvironment): self.sdk = None self.pack_tool = None - def get_build_cmd(self, env): + def get_component(self, env): com_config = CommonConfig(env.get('arch')) - ext_cmd = [] - for component in self.component: + components = [] + if env.get('just_build_components', False): + just_build_components = env.get('just_build_components', False) + else: + just_build_components = self.component + for component in just_build_components: if component in env.get('ram_component', False): - ext_cmd.append(component) - if component in env.get('ram_component_set', False): - for comm in com_config.get_component_set(component): - if comm in env.get('ram_component', False): - ext_cmd.append(comm) + components.append(component) + continue + if component not in env.get('ram_component_set', False): + continue + for comm in com_config.get_component_set(component): + if comm in env.get('ram_component', False): + components.append(comm) + return components + + def get_build_cmd(self, env): + ext_cmd = [] + components = self.get_component(env) + ext_cmd.extend(components) if self.generator == 'Ninja': return ['ninja'] + ext_cmd + ['-j%d' % self.thread] else: @@ -114,6 +126,10 @@ class CMakeBuilder(BuildEnvironment): return self.compile_target(target, env) + + if env.get('just_build_components'): + return + if env.get("fs_image"): fs_image_path = os.path.join(root_path, 'build', 'config', 'target_config', env.get('chip'),'mk_fs_image', env.get('fs_image_path')) fs_script_path = os.path.join(fs_image_path, 'mkyaffs2tool.py') @@ -269,11 +285,17 @@ class CMakeBuilder(BuildEnvironment): _excute(self.cmake_cmd, log_file, self.dump) _excute(self.get_build_cmd(env), log_file, self.dump) else: - _excute(["cmake", "--build", output_path, '-j%d' % self.thread], log_file, self.dump) - - if len(self.component) > 0: - print("######### Build target:%s, component:[%s] success" % (target_name, ' '.join(self.component))) - exit(0) + ext_cmd = [] + components_target = self.get_component(env) + print(components_target) + if components_target: + ext_cmd = ['--target'] + components_target + _excute(["cmake", "--build", output_path, '-j%d' % self.thread] + ext_cmd, log_file, self.dump) + + if len(self.get_component(env)) > 0: + os.chdir(org_work_path) + print("######### Build target:%s, component:[%s] success" % (target_name, ' '.join(self.get_component(env)))) + return 0 if env.is_enable_hso() and not nhso: cmd = self.get_build_cmd(env) diff --git a/code/sdk/build/script/parse_tool/parse_elf.py b/code/sdk/build/script/parse_tool/parse_elf.py index db070c391..08b216dea 100755 --- a/code/sdk/build/script/parse_tool/parse_elf.py +++ b/code/sdk/build/script/parse_tool/parse_elf.py @@ -881,7 +881,7 @@ class ParseCtrl(): """ if self.parse_debug_info_phase_0==True: return - with open(file,'r') as fp: + with open(file,'r',encoding='utf-8') as fp: lines=fp.readlines() self.parse_debug_info_lines(lines) self.parse_debug_info_phase_0=True diff --git a/code/sdk/build/script/sdk_generator/sdk_generator.py b/code/sdk/build/script/sdk_generator/sdk_generator.py index 2fe9590cb..e4011f8ee 100755 --- a/code/sdk/build/script/sdk_generator/sdk_generator.py +++ b/code/sdk/build/script/sdk_generator/sdk_generator.py @@ -8,7 +8,9 @@ import sys import time from utils.build_utils import root_path, script_path, target_config_path, output_root -from utils.build_utils import pkg_tools_path, jlink_tools_path, lzma_tools_path, sign_tools_path, memcheck_tools_path, factory_tools_path, derived_tools_path +from utils.build_utils import pkg_tools_path, jlink_tools_path, lzma_tools_path, sign_tools_path +from utils.build_utils import memcheck_tools_path, factory_tools_path, derived_tools_path +from utils.build_utils import ohos_tools_path from utils.build_utils import CopyModule, exec_shell, cmp_file, rm_pyc, rm_all, fn_get_subdirs from enviroment import TargetEnvironment from sdk_generator.target_config_genarator import genarate_reserve_config @@ -24,6 +26,7 @@ sdk_copy_common_files = [ os.path.join(memcheck_tools_path), os.path.join(factory_tools_path, 'factory_tools'), os.path.join(derived_tools_path), + os.path.join(ohos_tools_path), ] sdk_close_components = [ diff --git a/code/sdk/build/script/utils/build_utils.py b/code/sdk/build/script/utils/build_utils.py index c43cacaf3..2bed7607d 100755 --- a/code/sdk/build/script/utils/build_utils.py +++ b/code/sdk/build/script/utils/build_utils.py @@ -33,6 +33,7 @@ sign_tools_path = os.path.join(root_path, 'tools', 'bin', 'sign_tool') memcheck_tools_path = os.path.join(root_path, 'tools', 'bin', 'memcheck') factory_tools_path = os.path.join(root_path, 'tools', 'bin', 'factory_tools') derived_tools_path = os.path.join(root_path, 'tools', 'bin', 'derived_key_tool') +ohos_tools_path = os.path.join(root_path, 'tools', 'bin', 'ohos_tools') """ Colors defines. To highlight important output. diff --git a/code/sdk/drivers/boards/brandy_evb/linker/standard/acore.prelds b/code/sdk/drivers/boards/brandy_evb/linker/standard/acore.prelds index d233e1b28..69a5f10b6 100755 --- a/code/sdk/drivers/boards/brandy_evb/linker/standard/acore.prelds +++ b/code/sdk/drivers/boards/brandy_evb/linker/standard/acore.prelds @@ -238,6 +238,7 @@ SECTIONS *driver/dma*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *driver/ulp_aon*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *driver/uart*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *driver/touch*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *drivers/chips/brandy/libchip_brandy.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *drivers/chips/brandy/libbrandy_clocks.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *drivers/chips/brandy/libpmu_brandy.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) @@ -245,6 +246,10 @@ SECTIONS *drivers/chips/brandy/porting/xip*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *drivers/chips/brandy/porting/spi*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *drivers/chips/brandy/porting/uart*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *drivers/chips/brandy/porting/dma*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *drivers/chips/brandy/porting/pinctrl*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *drivers/chips/brandy/porting/systick*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *(.text.__udivdi3); /* Kernel */ *kernel/osal*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *kernel/non_os*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) diff --git a/code/sdk/drivers/boards/brandy_evb/memory_config/include/memory_config.h b/code/sdk/drivers/boards/brandy_evb/memory_config/include/memory_config.h index 5d8a7e82f..70fd0c17d 100755 --- a/code/sdk/drivers/boards/brandy_evb/memory_config/include/memory_config.h +++ b/code/sdk/drivers/boards/brandy_evb/memory_config/include/memory_config.h @@ -31,8 +31,8 @@ ULP_RAM地址规划 ULP_RAM有8K大小,范围[0x57038000, 0x57039FFF] */ -/* 不下电日历占用ULP_RAM 8字节 */ +/* 不下电日历占用ULP_RAM 24字节,8字节存储时间8字节存储counter8字节存储alarm */ #define ULP_RAM_OFFSET 0x57038000 #define ULP_RAM_CALENDAR ULP_RAM_OFFSET -#define ULP_RAM_CALENDAR_LENGTH 0x8 +#define ULP_RAM_CALENDAR_LENGTH 0x18 #endif diff --git a/code/sdk/drivers/chips/brandy/config/otp_map.h b/code/sdk/drivers/chips/brandy/config/otp_map.h index fed10f8e4..6e7185af2 100755 --- a/code/sdk/drivers/chips/brandy/config/otp_map.h +++ b/code/sdk/drivers/chips/brandy/config/otp_map.h @@ -232,6 +232,12 @@ #define OTP_DSP_OVERLAY_ROLLBACK_VERSION_BIT 32 #define OTP_ATE_CRC 255 + +// reserved 256-383(128 bytes) for user +#define OTP_APP_USER_START 256 +#define OTP_APP_USER_END 383 + + /** * @} */ diff --git a/code/sdk/drivers/chips/brandy/porting/button/CMakeLists.txt b/code/sdk/drivers/chips/brandy/porting/button/CMakeLists.txt index 1fe38eb24..b4c8bb6d3 100755 --- a/code/sdk/drivers/chips/brandy/porting/button/CMakeLists.txt +++ b/code/sdk/drivers/chips/brandy/porting/button/CMakeLists.txt @@ -9,7 +9,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR} ) set(WHOLE_LINK diff --git a/code/sdk/drivers/chips/brandy/porting/include/efuse_porting.h b/code/sdk/drivers/chips/brandy/porting/include/efuse_porting.h index d71f820f5..e2cd0bb18 100755 --- a/code/sdk/drivers/chips/brandy/porting/include/efuse_porting.h +++ b/code/sdk/drivers/chips/brandy/porting/include/efuse_porting.h @@ -11,6 +11,7 @@ #define EFUSE_PORTING_H #include +#include #ifdef __cplusplus #if __cplusplus @@ -172,6 +173,20 @@ uint8_t efuse_port_get_en_switch(void); * @endif */ errcode_t efuse_port_read_buffer_by_reload(uint8_t *buffer, uint32_t byte_number, uint16_t length); + +/** + * @if Eng + * @brief Open or close efuse region clock gate. + * @param [in] efuse_region the efuse region index. + * @param [in] en open or close. + * @else + * @brief 打开efuse的时钟门控。 + * @param [in] efuse_region efuse 区域。 + * @param [in] en 打开或关闭时钟。 + * @endif + */ +void efuse_port_set_clk_en(hal_efuse_region_t efuse_region, bool en); + /** * @} */ diff --git a/code/sdk/drivers/chips/brandy/porting/include/systick_porting.h b/code/sdk/drivers/chips/brandy/porting/include/systick_porting.h index 396fca7b0..3d2aecfc9 100755 --- a/code/sdk/drivers/chips/brandy/porting/include/systick_porting.h +++ b/code/sdk/drivers/chips/brandy/porting/include/systick_porting.h @@ -41,6 +41,21 @@ extern "C" { #define convert_us_2_count(us) ((us) * HAL_SYSTICK_SPEED / (MS_PER_S * US_PER_MS)) #define convert_count_2_us(count) ((count) * (MS_PER_S * US_PER_MS) / HAL_SYSTICK_SPEED) +#ifdef SUPPORT_RC_CALIBRATION +#define OS_SYS_MS_PER_SECOND 1000 +#define OS_SYS_US_PER_MS 1000 + +typedef enum { + SYSTICK_TIME_S = 0, + SYSTICK_TIME_MS = 1, + SYSTICK_TIME_US = 2, + + SYSTICK_TIME_MAX +} systick_time_t; + +uint64_t uapi_systick_get_time(systick_time_t time_type); +#endif + /** * @if Eng * @brief Get the base address of a specified systick. diff --git a/code/sdk/drivers/chips/brandy/porting/rtc_unified/CMakeLists.txt b/code/sdk/drivers/chips/brandy/porting/rtc_unified/CMakeLists.txt index 038bbdf85..00bfa92c0 100755 --- a/code/sdk/drivers/chips/brandy/porting/rtc_unified/CMakeLists.txt +++ b/code/sdk/drivers/chips/brandy/porting/rtc_unified/CMakeLists.txt @@ -9,7 +9,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR} ) set(PRIVATE_HEADER diff --git a/code/sdk/drivers/chips/brandy/porting/security/efuse/CMakeLists.txt b/code/sdk/drivers/chips/brandy/porting/security/efuse/CMakeLists.txt index b0516ed15..290e8cb15 100755 --- a/code/sdk/drivers/chips/brandy/porting/security/efuse/CMakeLists.txt +++ b/code/sdk/drivers/chips/brandy/porting/security/efuse/CMakeLists.txt @@ -9,7 +9,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR} ) set(WHOLE_LINK diff --git a/code/sdk/drivers/chips/brandy/porting/security/efuse/efuse_porting.c b/code/sdk/drivers/chips/brandy/porting/security/efuse/efuse_porting.c index 808c94852..a23c5e6f1 100755 --- a/code/sdk/drivers/chips/brandy/porting/security/efuse/efuse_porting.c +++ b/code/sdk/drivers/chips/brandy/porting/security/efuse/efuse_porting.c @@ -7,6 +7,7 @@ * 2022-10-20, Create file. \n */ #include "hal_efuse_v100.h" +#include "chip_io.h" #include "efuse_porting.h" #define FUSE_CTL_RB_BASE 0x57028000 @@ -102,6 +103,21 @@ uint8_t efuse_port_get_en_switch(void) return get_efuse_en_switch_val(); } +void efuse_port_set_clk_en(hal_efuse_region_t efuse_region, bool en) +{ + unused(en); + switch (efuse_region) { + case HAL_EFUSE_REGION_1: + writew(0x52000210, 0xB); + break; + case HAL_EFUSE_REGION_2: + writew(0x52000210, 0xD); + break; + default: + break; + } +} + errcode_t efuse_port_read_buffer_by_reload(uint8_t *buffer, uint32_t byte_number, uint16_t length) { if ((length == 0) || (byte_number >= EFUSE_MAX_BYTES) || diff --git a/code/sdk/drivers/chips/brandy/porting/systick/systick_porting.c b/code/sdk/drivers/chips/brandy/porting/systick/systick_porting.c index e071e7dca..27ce6ab39 100755 --- a/code/sdk/drivers/chips/brandy/porting/systick/systick_porting.c +++ b/code/sdk/drivers/chips/brandy/porting/systick/systick_porting.c @@ -31,4 +31,41 @@ void systick_port_unregister_hal_funcs(void) void systick_port_cali_xclk(void) { writel(0x5702c028, 1); // XO: 32Khz, XCLK -} \ No newline at end of file +} + +#ifdef SUPPORT_RC_CALIBRATION +volatile uint64_t g_pre_systick_count = 0; +volatile uint64_t g_pre_systick_msec = 0; + +uint64_t uapi_systick_get_time(systick_time_t time_type) +{ + volatile uint64_t now_count = 0; + volatile uint64_t ret_time = 0; + volatile uint64_t cost_msec = 0; + + if (g_pre_systick_count == 0) { + g_pre_systick_count = uapi_systick_get_count(); + g_pre_systick_msec = (g_pre_systick_count * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ; + } else { + now_count = uapi_systick_get_count(); + cost_msec = ((now_count - g_pre_systick_count) * OS_SYS_MS_PER_SECOND) / CLOCK_32K_CALI_FREQ; + + g_pre_systick_count = now_count; + g_pre_systick_msec = g_pre_systick_msec + cost_msec; + } + + switch (time_type) { + case SYSTICK_TIME_S: + ret_time = (uint64_t)(g_pre_systick_msec / OS_SYS_MS_PER_SECOND); + break; + case SYSTICK_TIME_US: + ret_time = (uint64_t)(g_pre_systick_msec * OS_SYS_US_PER_MS); + break; + default: + ret_time = (uint64_t)(g_pre_systick_msec); + break; + } + + return ret_time; +} +#endif \ No newline at end of file diff --git a/code/sdk/drivers/drivers/driver/adc/CMakeLists.txt b/code/sdk/drivers/drivers/driver/adc/CMakeLists.txt index 8e1958e01..890eba060 100755 --- a/code/sdk/drivers/drivers/driver/adc/CMakeLists.txt +++ b/code/sdk/drivers/drivers/driver/adc/CMakeLists.txt @@ -12,7 +12,6 @@ set(PRIVATE_HEADER ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR} ) set(PRIVATE_DEFINES diff --git a/code/sdk/drivers/drivers/driver/audio/source/core/common/share_mem/core_msg.c b/code/sdk/drivers/drivers/driver/audio/source/core/common/share_mem/core_msg.c index f0a5ee78f..9de2ac143 100755 --- a/code/sdk/drivers/drivers/driver/audio/source/core/common/share_mem/core_msg.c +++ b/code/sdk/drivers/drivers/driver/audio/source/core/common/share_mem/core_msg.c @@ -280,6 +280,10 @@ static td_s32 msg_fifo_put_pkt(const core_msg_inst *msg_inst, core_msg_module ms msg_size = (td_u32)(sizeof(*msg_head) + sizeof(msg_data->cmd) + sizeof(msg_data->handle)); msg_size += msg_data->input_data_size + msg_data->output_data_size; msg_size = msg_pkt_align_up(msg_size); + if (msg_size > MSG_FIFO_TAIL_SIZE) { + sap_err_log_u32(msg_size); + return ERR_SYS_BUF_OVERFLOW; + } if (ring_buf_linear_query_free(msg_inst->shrb_buf.data_buf) < msg_size) { ring_buf_get_pos(msg_inst->shrb_buf.data_buf, &read_pos, &write_pos); sap_err_log_u32(read_pos); diff --git a/code/sdk/drivers/drivers/driver/audio/source/include/sea_struct.h b/code/sdk/drivers/drivers/driver/audio/source/include/sea_struct.h index 6489c08e5..f443d0b09 100755 --- a/code/sdk/drivers/drivers/driver/audio/source/include/sea_struct.h +++ b/code/sdk/drivers/drivers/driver/audio/source/include/sea_struct.h @@ -26,7 +26,7 @@ extern "C" { #define SEA_LIB_AAI_IND 1 #define SEA_RBUF_MAX_NUM 2 #define SEA_RBUF_DUR_MS 40 -#define SEA_PARAM_SIZE_MAX 1024 +#define SEA_PARAM_SIZE_MAX 512 #define SEA_FRAME_MIN_PER_SEC AUDIO_5MS_NUM_PER_SECOND #define SEA_FRAME_MAX_PER_SEC AUDIO_20MS_NUM_PER_SECOND diff --git a/code/sdk/drivers/drivers/driver/calendar/CMakeLists.txt b/code/sdk/drivers/drivers/driver/calendar/CMakeLists.txt index ae56c7def..ddff7781f 100755 --- a/code/sdk/drivers/drivers/driver/calendar/CMakeLists.txt +++ b/code/sdk/drivers/drivers/driver/calendar/CMakeLists.txt @@ -9,7 +9,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR} ) set(PRIVATE_HEADER diff --git a/code/sdk/drivers/drivers/driver/efuse/CMakeLists.txt b/code/sdk/drivers/drivers/driver/efuse/CMakeLists.txt index 6e1caeefc..f5765bf0e 100755 --- a/code/sdk/drivers/drivers/driver/efuse/CMakeLists.txt +++ b/code/sdk/drivers/drivers/driver/efuse/CMakeLists.txt @@ -12,7 +12,6 @@ set(PRIVATE_HEADER ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR} ) set(PRIVATE_DEFINES diff --git a/code/sdk/drivers/drivers/driver/i2c/i2c.c b/code/sdk/drivers/drivers/driver/i2c/i2c.c index 16f3cb316..0addfefff 100755 --- a/code/sdk/drivers/drivers/driver/i2c/i2c.c +++ b/code/sdk/drivers/drivers/driver/i2c/i2c.c @@ -415,7 +415,7 @@ static errcode_t i2c_transmit_dma(i2c_bus_t bus, hal_i2c_buffer_wrap_t *data_cfg static errcode_t i2c_transmit_read_cmd_by_dma(i2c_bus_t bus, hal_i2c_buffer_wrap_t *data_cfg) { uint8_t dma_ch; - uint16_t read_cmd = 0x100; + static uint16_t read_cmd = 0x100; dma_ch_user_peripheral_config_t user_cfg = {0}; i2c_write_by_dma_config(bus, &read_cmd, data_cfg->len, &user_cfg); diff --git a/code/sdk/drivers/drivers/driver/nand_flash/nand/hal_nandflash.c b/code/sdk/drivers/drivers/driver/nand_flash/nand/hal_nandflash.c index 110353ee7..557e4b101 100755 --- a/code/sdk/drivers/drivers/driver/nand_flash/nand/hal_nandflash.c +++ b/code/sdk/drivers/drivers/driver/nand_flash/nand/hal_nandflash.c @@ -90,9 +90,9 @@ uint32_t read_cell_array(qspi_data_type_def *qspi_data) nand_qspi_enable(); writel(SER, 0x0); nand_qspi_write_data(qspi_data->instruction); - nand_qspi_write_data(DUMMY_CYCLE_BYTE); - nand_qspi_write_data(qspi_data->data_ptr[0]); - nand_qspi_write_data(qspi_data->data_ptr[1]); + nand_qspi_write_data(qspi_data->data_ptr[1]); /* 1: bit24~bit16 */ + nand_qspi_write_data(qspi_data->data_ptr[2]); /* 2: bit15~bit8 */ + nand_qspi_write_data(qspi_data->data_ptr[3]); /* 3: bit7~bit0 */ writel(SER, SER_SELECT); is_nandflash_working = false; osal_irq_restore(irq_sts); @@ -122,9 +122,9 @@ uint32_t program_execute(qspi_data_type_def *qspi_data) nand_qspi_enable(); writel(SER, 0x0); nand_qspi_write_data(qspi_data->instruction); - nand_qspi_write_data(DUMMY_CYCLE_BYTE); - nand_qspi_write_data(qspi_data->data_ptr[0]); - nand_qspi_write_data(qspi_data->data_ptr[1]); + nand_qspi_write_data(qspi_data->data_ptr[1]); /* 1: bit24~bit16 */ + nand_qspi_write_data(qspi_data->data_ptr[2]); /* 2: bit15~bit8 */ + nand_qspi_write_data(qspi_data->data_ptr[3]); /* 3: bit7~bit0 */ writel(SER, SER_SELECT); is_nandflash_working = false; osal_irq_restore(irq_sts); @@ -148,9 +148,9 @@ uint32_t block_erase(qspi_data_type_def *qspi_data) nand_qspi_enable(); writel(SER, 0x0); nand_qspi_write_data(qspi_data->instruction); - nand_qspi_write_data(DUMMY_CYCLE_BYTE); - nand_qspi_write_data(qspi_data->data_ptr[0]); - nand_qspi_write_data(qspi_data->data_ptr[1]); + nand_qspi_write_data(qspi_data->data_ptr[1]); /* 1: bit24~bit16 */ + nand_qspi_write_data(qspi_data->data_ptr[2]); /* 2: bit15~bit8 */ + nand_qspi_write_data(qspi_data->data_ptr[3]); /* 3: bit7~bit0 */ writel(SER, SER_SELECT); is_nandflash_working = false; osal_irq_restore(irq_sts); diff --git a/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash.c b/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash.c index 632ea8bdd..8213da212 100755 --- a/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash.c +++ b/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash.c @@ -112,15 +112,15 @@ uint32_t mc_flash_read_page(uint32_t nand_page, uint8_t *data, uint32_t data_len { uapi_watchdog_kick(); NFPRINT("mc_flash_read_page nand_page = %d\r\n", nand_page); - uint16_t page_addr; + uint32_t page_addr; errno_t err_code; uint8_t error_cnt = 0; if (nand_page >= (get_nand_flash()->pages_per_block * get_nand_flash()->total_block)) { return MC_FAILURE; } mc_flash_busy_wait(); - page_addr = SWAP_U16(nand_page); - NFPRINT("page addr = %d \r\n", page_addr); + page_addr = SWAP_U32(nand_page); + NFPRINT("page addr = %u \r\n", page_addr); qspi_data_type_def qspi_data = {0}; qspi_data.data_ptr = (uint8_t *)&page_addr; qspi_data.instruction = 0x13; @@ -140,7 +140,7 @@ uint32_t mc_flash_write_page(uint32_t nand_page, uint8_t *data, uint32_t data_le { uapi_watchdog_kick(); uint32_t ret; - uint16_t page_addr; + uint32_t page_addr; uint8_t status_reg; write_cmd(CMD_FLASH_WREN); qspi_data_type_def p_load_qspi_data = {0}; @@ -149,7 +149,7 @@ uint32_t mc_flash_write_page(uint32_t nand_page, uint8_t *data, uint32_t data_le program_load(&p_load_qspi_data, data, data_len, oob, oob_len); qspi_data_type_def e_load_qspi_data = {0}; e_load_qspi_data.instruction = CMD_FLASH_PP_EXE; - page_addr = SWAP_U16(nand_page); + page_addr = SWAP_U32(nand_page); e_load_qspi_data.data_ptr = (uint8_t *)&page_addr; program_execute(&e_load_qspi_data); mc_flash_busy_wait(); @@ -169,9 +169,9 @@ uint32_t mc_flash_erase_block(uint32_t block_no) uapi_watchdog_kick(); NFPRINT("mc_flash_erase_block block_no = %d\r\n", block_no); uint32_t ret; - uint16_t page_addr; + uint32_t page_addr; uint8_t reg_status; - page_addr = SWAP_U16(block_no * get_nand_flash()->pages_per_block); + page_addr = SWAP_U32(block_no * get_nand_flash()->pages_per_block); write_cmd(CMD_FLASH_WREN); qspi_data_type_def erase_qspi_data = {0}; erase_qspi_data.data_ptr = (uint8_t *)&page_addr; @@ -202,7 +202,7 @@ uint32_t mc_flash_mark_bad_block(uint32_t block_no) mark_bad_block(&mark); qspi_data_type_def execute = {0}; execute.instruction = CMD_FLASH_PP_EXE; - uint16_t page_addr = SWAP_U16(block_no * get_nand_flash()->pages_per_block); + uint32_t page_addr = SWAP_U32(block_no * get_nand_flash()->pages_per_block); execute.data_ptr = (uint8_t *)&page_addr; program_execute(&execute); mc_flash_busy_wait(); @@ -214,7 +214,7 @@ uint32_t mc_flash_check_bad_block(uint32_t block_no) { uapi_watchdog_kick(); uint32_t ret = NOT_BAD_BLOCK; - uint16_t page_addr = SWAP_U16(block_no * get_nand_flash()->pages_per_block); + uint32_t page_addr = SWAP_U32(block_no * get_nand_flash()->pages_per_block); qspi_data_type_def cell_read = {0}; cell_read.data_ptr = (uint8_t *)&page_addr; cell_read.instruction = CMD_FLASH_READ_PAGE; diff --git a/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_config.c b/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_config.c index a6d425b5c..7b835007c 100755 --- a/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_config.c +++ b/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_config.c @@ -55,6 +55,7 @@ uint32_t yf_volume_percent[YF_VOLUMES_NUM] = {100}; static const char * const g_volume_names[YF_VOLUMES_NUM] = { YF_NAME_STRS }; struct mtd_info nandflash_freertos_info; +bool get_exception_status(void); struct nand_driver_struct *get_nand_flash(void) { @@ -122,17 +123,19 @@ static int formate_filesystem_init(uint32_t total_block_num) return 0; } +/* ʹÓÃÔ¼Êø£ºÖжϺÍÒì³£ÖУ¬½ûÖ¹sync²Ù×÷ */ void nandflash_yaffs_sync(void) { - for (uint8_t index = 0; index < YF_VOLUMES_NUM; index++) { - int32_t ret = yaffs_sync(g_volume_names[index]); - if (ret != 0) { - PRINT("[%d] yaffs_sync fail, ret = %d", index, ret); + if (osal_in_interrupt() != true && get_exception_status() != true) { + for (uint8_t index = 0; index < YF_VOLUMES_NUM; index++) { + int32_t ret = yaffs_sync(g_volume_names[index]); + if (ret != 0) { + PRINT("[%d] yaffs_sync fail, ret = %d", index, ret); + } } } } - void erase_all(struct nand_driver_struct *driver) { uint32_t ret; diff --git a/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_qspi.c b/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_qspi.c index 71b2f7e5a..c5d0aa15d 100755 --- a/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_qspi.c +++ b/code/sdk/drivers/drivers/driver/nand_flash/nand/nandflash_qspi.c @@ -76,8 +76,11 @@ void qspi_read_width_8(uint8_t *buffer, uint32_t length) return; } while (((readl(SR)) & 0x8) == 0x8) { - buffer[ul_loop] = ((uint8_t)readl(DR)); - ul_loop++; + if (ul_loop < length) { + buffer[ul_loop++] = ((uint8_t)readl(DR)); + } else { + (void)readl(DR); + } ul_recv_timeout = 0; } ul_recv_timeout++; @@ -100,8 +103,11 @@ void qspi_read_width_32(uint32_t *recvbuf, uint32_t length) return; } while (((readl(SR)) & 0x8) == 0x8) { - recvbuf[ul_loop] = ((uint32_t)readl(DR)); - ul_loop++; + if (ul_loop < length) { + recvbuf[ul_loop++] = ((uint32_t)readl(DR)); + } else { + (void)readl(DR); + } ul_recv_timeout = 0; } ul_recv_timeout++; diff --git a/code/sdk/drivers/drivers/driver/qspi_display/qspi_display.c b/code/sdk/drivers/drivers/driver/qspi_display/qspi_display.c index db302e902..e389d95f7 100755 --- a/code/sdk/drivers/drivers/driver/qspi_display/qspi_display.c +++ b/code/sdk/drivers/drivers/driver/qspi_display/qspi_display.c @@ -62,7 +62,7 @@ #define S_MGPIO30_PAD_CTRL (S_MGPIO_PAD_CTRL_BASE + 0x278) #define QSPI_BUS_PRI5 (M_CTL_RB_BASE + 0xA14) -#define QSPI_M1_HIGHEST_PRI 0x33 +#define QSPI_M1_HIGHEST_PRI 0x22 #define QSPI_RESET_LCD_GPIO S_HGPIO0 diff --git a/code/sdk/drivers/drivers/driver/rtc_unified/CMakeLists.txt b/code/sdk/drivers/drivers/driver/rtc_unified/CMakeLists.txt index 3d1437d2d..51d3d9d84 100755 --- a/code/sdk/drivers/drivers/driver/rtc_unified/CMakeLists.txt +++ b/code/sdk/drivers/drivers/driver/rtc_unified/CMakeLists.txt @@ -9,7 +9,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR} ) set(PRIVATE_HEADER diff --git a/code/sdk/drivers/drivers/driver/rtc_unified/rtc.c b/code/sdk/drivers/drivers/driver/rtc_unified/rtc.c index e711265fd..ef015869d 100755 --- a/code/sdk/drivers/drivers/driver/rtc_unified/rtc.c +++ b/code/sdk/drivers/drivers/driver/rtc_unified/rtc.c @@ -41,6 +41,9 @@ #endif #endif +#define RTCS_TRIES_MAX 2000 +#define RTCS_LOAD_WAIT 120 + typedef enum rtc_flag { RTC_FLAG_NORMAL, RTC_FLAG_PERMANENT @@ -137,6 +140,8 @@ STATIC void rtc_load_cycle_with_mask(rtc_index_t index, uint64_t cycle_with_mask unused(cycle_deviation); #endif g_hal_rtc_func[index]->config_load(index, cycle_with_mask); + /* load完后,需要等待120us */ + uapi_tcxo_delay_us(RTCS_LOAD_WAIT); } /* Reduces the rtc left for all the rtcs by rtc us amount */ @@ -214,7 +219,16 @@ STATIC uint32_t rtc_get_next_rtc(rtc_index_t index) */ STATIC uint64_t rtc_get_rtc_till_interrupt(rtc_index_t index) { - uint64_t current_value = g_hal_rtc_func[index]->get_current_count(index); + uint64_t current_value = 0; + uint32_t tries = 0; + do { + current_value = g_hal_rtc_func[index]->get_current_count(index); + if (tries > RTCS_TRIES_MAX) { + break; + } + tries++; + } while (current_value >= g_rtcs_manager[index].last_rtc_load_cycle && + g_rtcs_manager[index].last_rtc_load_cycle != 0); if (current_value != 0) { return current_value; } diff --git a/code/sdk/drivers/drivers/driver/systick/systick.c b/code/sdk/drivers/drivers/driver/systick/systick.c index 5548821d2..5dd0ba0c9 100755 --- a/code/sdk/drivers/drivers/driver/systick/systick.c +++ b/code/sdk/drivers/drivers/driver/systick/systick.c @@ -82,17 +82,29 @@ uint64_t uapi_systick_get_count(void) uint64_t uapi_systick_get_s(void) { +#ifdef SUPPORT_RC_CALIBRATION + return uapi_systick_get_time(SYSTICK_TIME_S); +#else return convert_count_2_s(uapi_systick_get_count()); +#endif } uint64_t uapi_systick_get_ms(void) { +#ifdef SUPPORT_RC_CALIBRATION + return uapi_systick_get_time(SYSTICK_TIME_MS); +#else return convert_count_2_ms(uapi_systick_get_count()); +#endif } uint64_t uapi_systick_get_us(void) { +#ifdef SUPPORT_RC_CALIBRATION + return uapi_systick_get_time(SYSTICK_TIME_US); +#else return convert_count_2_us(uapi_systick_get_count()); +#endif } errcode_t uapi_systick_delay_count(uint64_t c_delay) diff --git a/code/sdk/drivers/drivers/hal/ipc/hal_ipc_old/hal_ipc.c b/code/sdk/drivers/drivers/hal/ipc/hal_ipc_old/hal_ipc.c index 9d955ebfa..99b87bb2f 100755 --- a/code/sdk/drivers/drivers/hal/ipc/hal_ipc_old/hal_ipc.c +++ b/code/sdk/drivers/drivers/hal/ipc/hal_ipc_old/hal_ipc.c @@ -7,13 +7,27 @@ #include "hal_ipc.h" #include "arch_barrier.h" +#include "chip_io.h" +#define IPC_TRY_SEND_MAX 10000 +#define BT_DEEPSLEEP_FLAG 0x5a5a +#define IPC_TRY_INTERVAL_TIME 100 /* * MCPU core trigger a interrupt to BCPU core. */ void hal_ipc_interrupt_security(void) { - MCPU_SOFT_INT_SET |= M_TO_BCPU_INT_OFFSET; + volatile uint32_t cnt = IPC_TRY_SEND_MAX; + while (cnt > 0) { + if (readw(GLB_CTL_B_RB_BASE + 0x1C) != BT_DEEPSLEEP_FLAG) { + if (cnt < IPC_TRY_SEND_MAX) { + uapi_tcxo_delay_us(IPC_TRY_INTERVAL_TIME); + } + MCPU_SOFT_INT_SET |= M_TO_BCPU_INT_OFFSET; + break; + } + cnt--; + } } /* diff --git a/code/sdk/drivers/drivers/hal/ipc/hal_ipc_old/hal_ipc.h b/code/sdk/drivers/drivers/hal/ipc/hal_ipc_old/hal_ipc.h index 03a375877..d1034d474 100755 --- a/code/sdk/drivers/drivers/hal/ipc/hal_ipc_old/hal_ipc.h +++ b/code/sdk/drivers/drivers/hal/ipc/hal_ipc_old/hal_ipc.h @@ -25,8 +25,13 @@ #define MCPU_SOFT_INT_STS (*(volatile unsigned short *)(0x52000028)) #define MCPU_SOFT_INT_CLR_STS (*(volatile unsigned short *)(0x52000030)) #define M_TO_DSP_INT_OFFSET BIT(2) +#define M_TO_DSP_INT1_OFFSET BIT(3) #define M_TO_DSP_1_INT_OFFSET BIT(4) +#if CHIP_SOCMN1 #define M_TO_ALL_INT (M_TO_BCPU_INT_OFFSET | M_TO_DSP_INT_OFFSET | M_TO_DSP_1_INT_OFFSET) +#elif CHIP_BRANDY +#define M_TO_ALL_INT (M_TO_BCPU_INT_OFFSET | M_TO_DSP_INT_OFFSET | M_TO_DSP_INT1_OFFSET) +#endif #elif CHIP_LIBRA #define MCPU_SOFT_INT_EN (*(volatile unsigned short *)(0x52000020)) #define MCPU_SOFT_INT_SET (*(volatile unsigned short *)(0x52000034)) diff --git a/code/sdk/drivers/drivers/hal/reboot/hal_reboot.c b/code/sdk/drivers/drivers/hal/reboot/hal_reboot.c index 13d6d7a4d..e09b25251 100755 --- a/code/sdk/drivers/drivers/hal/reboot/hal_reboot.c +++ b/code/sdk/drivers/drivers/hal/reboot/hal_reboot.c @@ -47,16 +47,45 @@ #define HAL_ULP_AON_GENERAL_REG (ULP_AON_CTL_RB_ADDR + 0x14) #define HAL_ULP_AON_NO_POWEROFF_FLAG 0xA5A5 -static uint16_t g_reset_cause = REBOOT_CAUSE_UNKNOWN; +#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG 0x57000014 +#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL 0xb66 +#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_ACK 0x499 +#define PM_MCU_SEND_IPC_WKUP_BT_REG 0x52000034 +#define PM_MCU_SEND_IPC_WKUP_BT_VAL 0x2 +#define PM_WAIT_BT_WAKEUP_DELAY 100 +#define HAL_REBOOT_WAIT_ACK_TRY_TIMES 60 +#define BT_RESET_DELAY 500 +#define POS_NO_POWEROFF 15 +#define POS_FIRST_POWERON 14 +static uint16_t g_reset_cause = REBOOT_CAUSE_UNKNOWN; void hal_reboot_set_ulp_aon_no_poweroff_flag(void) { - reg16_write(HAL_ULP_AON_GENERAL_REG, HAL_ULP_AON_NO_POWEROFF_FLAG); + reg16_setbit(HAL_ULP_AON_GENERAL_REG, POS_NO_POWEROFF); } bool hal_reboot_get_ulp_aon_no_poweroff_flag(void) { - if (reg16(HAL_ULP_AON_GENERAL_REG) == HAL_ULP_AON_NO_POWEROFF_FLAG) { + if (reg16_getbit(HAL_ULP_AON_GENERAL_REG, POS_NO_POWEROFF)) { + return true; + } else { + return false; + } +} + +void hal_reboot_set_first_power_on_flag(void) +{ + reg16_setbit(HAL_ULP_AON_GENERAL_REG, POS_FIRST_POWERON); +} + +void hal_reboot_clear_first_power_on_flag(void) +{ + reg16_clrbit(HAL_ULP_AON_GENERAL_REG, POS_FIRST_POWERON); +} + +bool hal_reboot_get_first_power_on_flag(void) +{ + if (reg16_getbit(HAL_ULP_AON_GENERAL_REG, POS_FIRST_POWERON)) { return true; } else { return false; @@ -102,6 +131,23 @@ void hal_reboot_chip(void) set_cpu_utils_system_boot_magic(); #ifdef SUPPORT_GPIO gpio_ulp_int_en(false); // when soft reset, ulp area is not cleared. +#endif + // when bt at sleep, need wkup bt before soft reset +#if !defined(BUILD_APPLICATION_SSB) + uint16_t lock_cnt = 0; + uint16_t max_lock_cnt = HAL_REBOOT_WAIT_ACK_TRY_TIMES; + writew(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG, PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL); + writew(PM_MCU_SEND_IPC_WKUP_BT_REG, PM_MCU_SEND_IPC_WKUP_BT_VAL); + while((readw(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG) != PM_SLEEP_SOFT_RESET_FORCE_WKUP_ACK) && \ + (lock_cnt < max_lock_cnt)) { + PRINT("bt not send ack[%x],don't to reset,try %d.\n", readw(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG), lock_cnt); + uapi_tcxo_delay_ms(PM_WAIT_BT_WAKEUP_DELAY); + lock_cnt++; + } +#else + writew(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG, PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL); + writew(PM_MCU_SEND_IPC_WKUP_BT_REG, PM_MCU_SEND_IPC_WKUP_BT_VAL); + uapi_tcxo_delay_ms(BT_RESET_DELAY); #endif // Request the reset & wait for it... regw_clrbit(HAL_CHIP_RESET_REG, HAL_CHIP_RESET_REG_OFFSET, HAL_CHIP_RESET_REG_ENABLE_RESET_BIT); diff --git a/code/sdk/drivers/drivers/hal/reboot/hal_reboot.h b/code/sdk/drivers/drivers/hal/reboot/hal_reboot.h index a6b0fcb88..ed0140cde 100755 --- a/code/sdk/drivers/drivers/hal/reboot/hal_reboot.h +++ b/code/sdk/drivers/drivers/hal/reboot/hal_reboot.h @@ -49,6 +49,22 @@ void hal_reboot_set_ulp_aon_no_poweroff_flag(void); */ bool hal_reboot_get_ulp_aon_no_poweroff_flag(void); +/** + * @brief Set a universal register of the ULP region to a fix value to indicate that is first power-on + */ +void hal_reboot_set_first_power_on_flag(void); + +/** + * @brief clear a universal register of the ULP region to a fix value to indicate that is not first power-on + */ +void hal_reboot_clear_first_power_on_flag(void); + +/** + * @brief Get is first power-on + * @return true first power-on, false is re-poweron + */ +bool hal_reboot_get_first_power_on_flag(void); + /** * @} */ diff --git a/code/sdk/drivers/drivers/hal/security/efuse/v100/hal_efuse_v100.c b/code/sdk/drivers/drivers/hal/security/efuse/v100/hal_efuse_v100.c index c678363fb..25dfcdfb7 100755 --- a/code/sdk/drivers/drivers/hal/security/efuse/v100/hal_efuse_v100.c +++ b/code/sdk/drivers/drivers/hal/security/efuse/v100/hal_efuse_v100.c @@ -54,6 +54,9 @@ static errcode_t hal_efuse_v100_refresh_read(hal_efuse_region_t region) if (region >= HAL_EFUSE_REGION_MAX) { return ERRCODE_INVALID_PARAM; } +#ifdef CONFIG_EFUSE_CLK_EN + efuse_port_set_clk_en(region, true); +#endif hal_efuse_ctl_set_wr_rd(region, HAL_EFUSE_READ_MODE); while (hal_efuse_ctl_get(region) != HAL_EFUSE_CLEAR_RESULT) {} return ERRCODE_SUCC; @@ -115,6 +118,11 @@ static errcode_t hal_efuse_v100_read_byte(uint32_t byte_address, uint8_t *value) return ERRCODE_INVALID_PARAM; } +#ifdef CONFIG_EFUSE_CLK_EN + hal_efuse_region_t region = hal_efuse_get_region(byte_address); + efuse_port_set_clk_en(region, true); +#endif + volatile uint16_t *efuse_byte = (volatile uint16_t *)((uintptr_t)hal_efuse_v100_get_writeread_addr(byte_address)); if ((byte_address % HAL_EFUSE_BYTES_PRE_REG) != 0) { @@ -146,6 +154,10 @@ static errcode_t hal_efuse_v100_write_byte(uint32_t byte_address, uint8_t value) hal_efuse_region_t region = hal_efuse_get_region(byte_address); uint16_t offset = hal_efuse_get_byte_offset(byte_address); +#ifdef CONFIG_EFUSE_CLK_EN + efuse_port_set_clk_en(region, true); +#endif + volatile uint16_t *efuse_byte = (volatile uint16_t *)((uintptr_t)g_efuse_region_write_address[region] + ((offset >> 1U) << HAL_EFUSE_REG_SHIFT)); diff --git a/code/sdk/drivers/peripheral/CMakeLists.txt b/code/sdk/drivers/peripheral/CMakeLists.txt index 12dda6189..10fe5b8e1 100644 --- a/code/sdk/drivers/peripheral/CMakeLists.txt +++ b/code/sdk/drivers/peripheral/CMakeLists.txt @@ -14,6 +14,7 @@ add_subdirectory_if_exist(slip) add_subdirectory_if_exist(slip/cat1Service) add_subdirectory_if_exist(utils) add_subdirectory_if_exist(utilscpp) +add_subdirectory_if_exist(config) add_subdirectory_if_exist(rotary_encoder) add_subdirectory_if_exist(vibrator/service) add_subdirectory_if_exist(cywee) diff --git a/code/sdk/drivers/peripheral/config/CMakeLists.txt b/code/sdk/drivers/peripheral/config/CMakeLists.txt new file mode 100644 index 000000000..20c5f3c0d --- /dev/null +++ b/code/sdk/drivers/peripheral/config/CMakeLists.txt @@ -0,0 +1,56 @@ +#=============================================================================== +# @brief cmake file +# Copyright (c) @CompanyNameMagicTag 2022-2023. All rights reserved. +#=============================================================================== +set(COMPONENT_NAME "custom_config") + +set(SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/src/ConfigModel.cpp +) + +set(PUBLIC_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${CMAKE_SOURCE_DIR}/open_source/openharmony/third_party/cJSON +) + +set(PRIVATE_HEADER + ${CMAKE_SOURCE_DIR}/middleware/utils/update/inner_include +) + +set(PRIVATE_DEFINES + TARGET_NAME="${TARGET_COMMAND}" + BUILD_TIME="${BUILD_TIME}" +) + +set(PUBLIC_DEFINES +) + +# use this when you want to add ccflags like -include xxx +set(COMPONENT_PUBLIC_CCFLAGS +) + +set(COMPONENT_CCFLAGS + -std=c++11 + -Wno-error + -Wno-unused-parameter + -fno-exceptions + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -Wno-undef + -Wno-bitwise-op-parentheses + -Wno-shift-op-parentheses + -nostdlibinc + -nostdinc + -nostdlib + -Wno-c++11-narrowing + -Wno-error=unused-function +) +set(WHOLE_LINK + true +) + +set(MAIN_COMPONENT + false +) + +build_component() diff --git a/code/sdk/application/wearable/fd230app/nativeui/config/ConfigModel.json b/code/sdk/drivers/peripheral/config/ConfigModel.json similarity index 100% rename from code/sdk/application/wearable/fd230app/nativeui/config/ConfigModel.json rename to code/sdk/drivers/peripheral/config/ConfigModel.json diff --git a/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h b/code/sdk/drivers/peripheral/config/include/ConfigModel.h similarity index 99% rename from code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h rename to code/sdk/drivers/peripheral/config/include/ConfigModel.h index a4ad41392..c00ccb990 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModel.h +++ b/code/sdk/drivers/peripheral/config/include/ConfigModel.h @@ -4,11 +4,13 @@ #include #include #include -#include "../../../../../../open_source/openharmony/third_party/cJSON/cJSON.h" +#include "cJSON.h" #include "wearable_log.h" -#include "components/ui_image_animator.h" #include "vector" +#ifdef FD230 +#include "components/ui_image_animator.h" #include "language/font/ui_resource_string.h" +#endif struct dial_config { std::string dialname; diff --git a/code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h b/code/sdk/drivers/peripheral/config/include/ConfigModelC.h similarity index 100% rename from code/sdk/application/wearable/fd230app/nativeui/config/include/ConfigModelC.h rename to code/sdk/drivers/peripheral/config/include/ConfigModelC.h diff --git a/code/sdk/application/wearable/fd230app/nativeui/config/src/ConfigModel.cpp b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp similarity index 99% rename from code/sdk/application/wearable/fd230app/nativeui/config/src/ConfigModel.cpp rename to code/sdk/drivers/peripheral/config/src/ConfigModel.cpp index a653c5982..1e4ec44e0 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/config/src/ConfigModel.cpp +++ b/code/sdk/drivers/peripheral/config/src/ConfigModel.cpp @@ -1,5 +1,5 @@ -#include "config/include/ConfigModel.h" -#include "config/include/ConfigModelC.h" +#include "ConfigModel.h" +#include "ConfigModelC.h" #include "custom_utils.h" namespace OHOS { diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp index bda10581b..717dc45f1 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_at_cmd.cpp @@ -280,7 +280,9 @@ static uint32_t ADD_ADDRESS(uint8_t *para, uint32_t paraLen, char *strCommonCmd) printf("CAT1TEST ATCMD Convert Command Failed\n"); return ERRCODE_FAIL; } + #ifdef FD230 OHOS::add_addressbook_by_AT((char *)argv[0],(char *)argv[1]); + #endif //uapi_cat1_wakeup_cat1(1); //u32_t sret= OsShellPing( argc, (const char *)argv[0]); //printf("CAT1TEST ATCMD ping ret = 0x%X\n",sret); @@ -301,7 +303,9 @@ static uint32_t read_ADDRESS(uint8_t *para, uint32_t paraLen, char *strCommonCmd printf("CAT1TEST ATCMD Convert Command Failed\n"); return ERRCODE_FAIL; } + #ifdef FD230 OHOS::read_addressbook_bin_file(); + #endif return ERRCODE_SUCC; } diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index 6d2284d65..db77f6fdd 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -25,8 +25,8 @@ #include -#include "config/include/ConfigModelC.h" -#include "config/include/ConfigModel.h" +#include "ConfigModelC.h" +#include "ConfigModel.h" #include "wearable_log.h" #include "custom_runtime.h" diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp index 491aba3a4..697a3d9a2 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server_hal.cpp @@ -152,8 +152,10 @@ int cat1_msg_event_sendmsg_toUI(char* callno) void up_report_timer(void) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "up_report_timer_"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "up_report_timer_"); + #ifdef FD230 OHOS::start_report_timer(); + #endif } diff --git a/code/sdk/drivers/peripheral/touch/ft6x46_touch/ft6x46_ctrl.c b/code/sdk/drivers/peripheral/touch/ft6x46_touch/ft6x46_ctrl.c index 883324bad..5bdfe1f94 100644 --- a/code/sdk/drivers/peripheral/touch/ft6x46_touch/ft6x46_ctrl.c +++ b/code/sdk/drivers/peripheral/touch/ft6x46_touch/ft6x46_ctrl.c @@ -291,6 +291,7 @@ ext_errno tp_ft6x46_i2c_data_write(uint8_t reg_addr, uint8_t *data_buf, uint16_t } if (ret != EXT_ERR_SUCCESS) { tp_err("tp data write fail! ret=0x%x", ret); + tp_mem_free(write_data); return ret; } diff --git a/code/sdk/drivers/peripheral/touch/tma525b_touch/tma525b_ctrl.c b/code/sdk/drivers/peripheral/touch/tma525b_touch/tma525b_ctrl.c index 6d36fb15e..ec0bb9af2 100644 --- a/code/sdk/drivers/peripheral/touch/tma525b_touch/tma525b_ctrl.c +++ b/code/sdk/drivers/peripheral/touch/tma525b_touch/tma525b_ctrl.c @@ -23,6 +23,8 @@ bool g_host_dev_init_flag = TD_FALSE; tma525b_ctrl_attr g_ctrl_attr; touch_callback g_tma525b_callback = NULL; +static uint8_t g_tp_send_buf[TMA525B_REG_WRITE_LEN] = {0}; +static uint8_t g_tp_recv_buf[TMA525B_INPUT_SIZE] = {0}; static void tma525b_gpio_isr_handle(pin_t pin, uintptr_t param) { @@ -103,7 +105,6 @@ ext_errno tp_i2c_data_read(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_l errcode_t ret; uint8_t retry; i2c_data_t data; - uint8_t tp_reg_addr[TMA525B_REG_BYTE_LEN]; ret = tp_i2c_rd_wr_param_check(data_buf, data_len); if (ret != EXT_ERR_SUCCESS) { @@ -111,15 +112,17 @@ ext_errno tp_i2c_data_read(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_l return ret; } - memset_s(data_buf, data_len, 0, data_len); - tp_reg_addr[TMA525B_I2C_SEND_INDEX0] = reg_addr & 0xff; - tp_reg_addr[TMA525B_I2C_SEND_INDEX1] = (reg_addr >> OFFSET_8_BITS) & 0xff; + if (memset_s(g_tp_recv_buf, data_len, 0, data_len) != EOK) { + tp_err("tp read buff set fail! ret=0x%x", ret); + return EXT_ERR_FAILURE; + } + g_tp_send_buf[TMA525B_I2C_SEND_INDEX0] = reg_addr & 0xff; + g_tp_send_buf[TMA525B_I2C_SEND_INDEX1] = (reg_addr >> OFFSET_8_BITS) & 0xff; - data.send_buf = tp_reg_addr; + data.send_buf = g_tp_send_buf; data.send_len = TMA525B_CMD_SEND_LEN; - data.receive_buf = data_buf; + data.receive_buf = g_tp_recv_buf; data.receive_len = data_len; - for (retry = 0; retry < TMA525B_I2C_TIME_MAX; retry++) { ret = uapi_i2c_master_read(TMA525B_I2C_BUS, TMA525B_I2C_ADDR, &data); if (ret == ERRCODE_SUCC) { @@ -131,6 +134,12 @@ ext_errno tp_i2c_data_read(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_l return ret; } + ret = (uint32_t)memcpy_s(data_buf, data_len, g_tp_recv_buf, data_len); + if (ret != EOK) { + tp_err("tp data buf content copy fail! ret=0x%x", ret); + return ret; + } + return EXT_ERR_SUCCESS; } @@ -139,17 +148,16 @@ ext_errno tp_i2c_cmd_write(uint16_t cmd) errcode_t ret; uint8_t retry; i2c_data_t data; - uint8_t tp_reg_addr[TMA525B_CMD_SEND_LEN]; ret = tp_peripheral_init_status_check(); if (ret != EXT_ERR_SUCCESS) { tp_err("host peripheral not init! ret=0x%x", ret); return ret; } - tp_reg_addr[TMA525B_I2C_SEND_INDEX0] = cmd & 0xff; - tp_reg_addr[TMA525B_I2C_SEND_INDEX1] = (cmd >> OFFSET_8_BITS) & 0xff; - data.send_buf = tp_reg_addr; + g_tp_send_buf[TMA525B_I2C_SEND_INDEX0] = cmd & 0xff; + g_tp_send_buf[TMA525B_I2C_SEND_INDEX1] = (cmd >> OFFSET_8_BITS) & 0xff; + data.send_buf = g_tp_send_buf; data.send_len = TMA525B_CMD_SEND_LEN; data.receive_buf = NULL; data.receive_len = 0; @@ -172,7 +180,6 @@ ext_errno tp_i2c_reg_write(uint16_t reg_addr, uint16_t reg_cfg) errcode_t ret; uint8_t retry; i2c_data_t data; - uint8_t tp_reg_addr[TMA525B_REG_WRITE_LEN]; ret = tp_peripheral_init_status_check(); if (ret != EXT_ERR_SUCCESS) { @@ -180,12 +187,11 @@ ext_errno tp_i2c_reg_write(uint16_t reg_addr, uint16_t reg_cfg) return ret; } - tp_reg_addr[TMA525B_I2C_SEND_INDEX0] = reg_addr & 0xff; - tp_reg_addr[TMA525B_I2C_SEND_INDEX1] = (reg_addr >> OFFSET_8_BITS) & 0xff; - tp_reg_addr[TMA525B_I2C_SEND_INDEX2] = reg_cfg & 0xff; - tp_reg_addr[TMA525B_I2C_SEND_INDEX3] = (reg_cfg >> OFFSET_8_BITS) & 0xff; - - data.send_buf = tp_reg_addr; + g_tp_send_buf[TMA525B_I2C_SEND_INDEX0] = reg_addr & 0xff; + g_tp_send_buf[TMA525B_I2C_SEND_INDEX1] = (reg_addr >> OFFSET_8_BITS) & 0xff; + g_tp_send_buf[TMA525B_I2C_SEND_INDEX2] = reg_cfg & 0xff; + g_tp_send_buf[TMA525B_I2C_SEND_INDEX3] = (reg_cfg >> OFFSET_8_BITS) & 0xff; + data.send_buf = g_tp_send_buf; data.send_len = TMA525B_REG_WRITE_LEN; data.receive_buf = NULL; data.receive_len = 0; @@ -231,6 +237,7 @@ ext_errno tp_i2c_data_write(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_ ret = (uint32_t)memcpy_s(write_data + sizeof(uint16_t), send_len - sizeof(uint16_t), data_buf, data_len); if (ret != EOK) { tp_err("tp send_buf content copy fail! ret=0x%x", ret); + osal_kfree(write_data); return ret; } @@ -247,10 +254,11 @@ ext_errno tp_i2c_data_write(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_ } if (ret != ERRCODE_SUCC) { tp_err("tp data write fail! ret=0x%x", ret); + osal_kfree(write_data); return ret; } - tp_mem_free(write_data); + osal_kfree(write_data); return EXT_ERR_SUCCESS; } diff --git a/code/sdk/drivers/peripheral/touch/ztw523_touch/ztw523_ctrl.c b/code/sdk/drivers/peripheral/touch/ztw523_touch/ztw523_ctrl.c index ec85d227c..927a5d756 100644 --- a/code/sdk/drivers/peripheral/touch/ztw523_touch/ztw523_ctrl.c +++ b/code/sdk/drivers/peripheral/touch/ztw523_touch/ztw523_ctrl.c @@ -23,6 +23,8 @@ bool g_host_dev_init_flag = TD_FALSE; ztw523_ctrl_attr g_ctrl_attr; touch_callback g_ztw523_callback = NULL; +static uint8_t g_tp_send_buf[ZTW523_REG_WRITE_LEN] = {0}; +static uint8_t g_tp_recv_buf[ZTW523_INPUT_SIZE] = {0}; static void ztw523_gpio_isr_handle(pin_t pin, uintptr_t param) { @@ -96,7 +98,6 @@ ext_errno tp_i2c_data_read(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_l errcode_t ret; uint32_t retry; i2c_data_t data; - uint8_t tp_reg_addr[ZTW523_REG_BYTE_LEN]; ret = tp_i2c_rd_wr_param_check(data_buf, data_len); if (ret != 0) { @@ -104,15 +105,17 @@ ext_errno tp_i2c_data_read(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_l return ret; } - memset_s(data_buf, data_len, 0, data_len); - tp_reg_addr[ZTW523_I2C_SEND_INDEX0] = reg_addr & 0xff; - tp_reg_addr[ZTW523_I2C_SEND_INDEX1] = (reg_addr >> OFFSET_8_BITS) & 0xff; + if (memset_s(g_tp_recv_buf, data_len, 0, data_len) != EOK) { + tp_err("tp read buff set fail! ret=0x%x", ret); + return EXT_ERR_FAILURE; + } + g_tp_send_buf[ZTW523_I2C_SEND_INDEX0] = reg_addr & 0xff; + g_tp_send_buf[ZTW523_I2C_SEND_INDEX1] = (reg_addr >> OFFSET_8_BITS) & 0xff; - data.send_buf = tp_reg_addr; + data.send_buf = g_tp_send_buf; data.send_len = ZTW523_CMD_SEND_LEN; - data.receive_buf = data_buf; + data.receive_buf = g_tp_recv_buf; data.receive_len = data_len; - for (retry = 0; retry < ZTW523_I2C_TIME_MAX; retry++) { ret = uapi_i2c_master_writeread(ZTW523_I2C_BUS, ZTW523_I2C_ADDR, &data); if (ret == EXT_ERR_SUCCESS) { @@ -124,6 +127,12 @@ ext_errno tp_i2c_data_read(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_l return ret; } + ret = (uint32_t)memcpy_s(data_buf, data_len, g_tp_recv_buf, data_len); + if (ret != EOK) { + tp_err("tp data buf content copy fail! ret=0x%x", ret); + return ret; + } + return EXT_ERR_SUCCESS; } @@ -132,17 +141,16 @@ ext_errno tp_i2c_cmd_write(uint16_t cmd) errcode_t ret; uint32_t retry; i2c_data_t data; - uint8_t tp_reg_addr[ZTW523_CMD_SEND_LEN]; ret = tp_peripheral_init_status_check(); if (ret != 0) { tp_err("host peripheral not init! ret=0x%x", ret); return ret; } - tp_reg_addr[ZTW523_I2C_SEND_INDEX0] = cmd & 0xff; - tp_reg_addr[ZTW523_I2C_SEND_INDEX1] = (cmd >> OFFSET_8_BITS) & 0xff; + g_tp_send_buf[ZTW523_I2C_SEND_INDEX0] = cmd & 0xff; + g_tp_send_buf[ZTW523_I2C_SEND_INDEX1] = (cmd >> OFFSET_8_BITS) & 0xff; - data.send_buf = tp_reg_addr; + data.send_buf = g_tp_send_buf; data.send_len = ZTW523_CMD_SEND_LEN; data.receive_buf = NULL; data.receive_len = 0; @@ -166,7 +174,6 @@ ext_errno tp_i2c_reg_write(uint16_t reg_addr, uint16_t reg_cfg) errcode_t ret; uint32_t retry; i2c_data_t data; - uint8_t tp_reg_addr[ZTW523_REG_WRITE_LEN]; ret = tp_peripheral_init_status_check(); if (ret != 0) { @@ -174,12 +181,12 @@ ext_errno tp_i2c_reg_write(uint16_t reg_addr, uint16_t reg_cfg) return ret; } - tp_reg_addr[ZTW523_I2C_SEND_INDEX0] = reg_addr & 0xff; - tp_reg_addr[ZTW523_I2C_SEND_INDEX1] = (reg_addr >> OFFSET_8_BITS) & 0xff; - tp_reg_addr[ZTW523_I2C_SEND_INDEX2] = reg_cfg & 0xff; - tp_reg_addr[ZTW523_I2C_SEND_INDEX3] = (reg_cfg >> OFFSET_8_BITS) & 0xff; + g_tp_send_buf[ZTW523_I2C_SEND_INDEX0] = reg_addr & 0xff; + g_tp_send_buf[ZTW523_I2C_SEND_INDEX1] = (reg_addr >> OFFSET_8_BITS) & 0xff; + g_tp_send_buf[ZTW523_I2C_SEND_INDEX2] = reg_cfg & 0xff; + g_tp_send_buf[ZTW523_I2C_SEND_INDEX3] = (reg_cfg >> OFFSET_8_BITS) & 0xff; - data.send_buf = tp_reg_addr; + data.send_buf = g_tp_send_buf; data.send_len = ZTW523_REG_WRITE_LEN; data.receive_buf = NULL; data.receive_len = 0; @@ -225,6 +232,7 @@ ext_errno tp_i2c_data_write(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_ ret = (uint32_t)memcpy_s(write_data + sizeof(uint16_t), send_len - sizeof(uint16_t), data_buf, data_len); if (ret != EOK) { tp_err("tp send_buf content copy fail! ret=0x%x", ret); + osal_kfree(write_data); return ret; } @@ -241,10 +249,11 @@ ext_errno tp_i2c_data_write(uint16_t reg_addr, uint8_t *data_buf, uint32_t data_ } if (ret != EXT_ERR_SUCCESS) { tp_err("tp data write fail! ret=0x%x", ret); + osal_kfree(write_data); return ret; } - tp_mem_free(write_data); + osal_kfree(write_data); return EXT_ERR_SUCCESS; } diff --git a/code/sdk/drivers/peripheral/touch/ztw523_touch/ztw523_ctrl.h b/code/sdk/drivers/peripheral/touch/ztw523_touch/ztw523_ctrl.h index 55e014b73..9438a362b 100644 --- a/code/sdk/drivers/peripheral/touch/ztw523_touch/ztw523_ctrl.h +++ b/code/sdk/drivers/peripheral/touch/ztw523_touch/ztw523_ctrl.h @@ -25,7 +25,7 @@ #define ZTW523_CMD_SEND_LEN 2 #define ZTW523_REG_DATA_LEN 2 #define ZTW523_I2C_TIME_MAX 3 - +#define ZTW523_INPUT_SIZE 156 #define ZTW523_I2C_SEND_INDEX0 0 #define ZTW523_I2C_SEND_INDEX1 1 #define ZTW523_I2C_SEND_INDEX2 2 diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index fd80eab99..ca515fcce 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -23,8 +23,11 @@ #include "errcode.h" #include "power_display_service.h" // #include "config/include/ConfigModelC.h" + +#ifdef FD230 #include "soundandvibration/include/SoundAndVibrationVolumeSettingC.h" #include "networkandcall/include/NetworkAndCallC.h" +#endif #include #include #include "custom_runtime.h" @@ -249,7 +252,9 @@ bool start_custom_ble_service(void) PRINT("register custom protocol classic bt service !\r\n"); BtInitCallBacks(); + #ifdef FD230 BtA2dpInit(); + #endif enable_a2dp_service(true); BtInitSpp(); enable_spp_service(true); @@ -855,27 +860,45 @@ void uapi_set_screen_on_api(void) /*系统声音设置*/ void uapi_systemVolumeSet(int16_t sounding) { + #ifdef FD230 SystemVolumeSet(sounding); + #endif } //通话音量设置 void uapi_callVolumeSet(int16_t sounding) { + #ifdef FD230 CallVolumeSet(sounding); + #endif } //震动强度设置 void uapi_vibrationModeSet(int value) { + #ifdef FD230 VibationModeSet(value); + #endif } //设置是否静音 void uapi_setSilentMode(bool isopen) { + #ifdef FD230 SilentModelSet(isopen); + #endif +} +void power_on_cat1(void) +{ + uapi_cat1_power_on(1); + uapi_cat1_reset(0); } +void power_off_cat1(void) +{ + uapi_cat1_reset(1); + uapi_cat1_power_on(0); +} //设置4G能力开关是否开启 void uapi_set4GCapability(bool isopen) { diff --git a/code/sdk/include/middleware/services/bts/br/bts_br_gap.h b/code/sdk/include/middleware/services/bts/br/bts_br_gap.h index 93b3fc6f7..416f5b6bf 100755 --- a/code/sdk/include/middleware/services/bts/br/bts_br_gap.h +++ b/code/sdk/include/middleware/services/bts/br/bts_br_gap.h @@ -103,6 +103,24 @@ extern "C" { */ #define SERVICE_INFORMATION 0x800000 +/** + * @if Eng + * @brief The Class of Device Audio or Vido. + * @else + * @brief 音配设备类型。 + * @endif + */ +#define DEVICE_MAJOR_CLASS_AUDIO_VIDEO 0x400 + +/** + * @if Eng + * @brief The Class of Device Phone. + * @else + * @brief 手机设备类型。 + * @endif + */ +#define DEVICE_MAJOR_CLASS_PHONE 0x200 + /** * @if Eng * @brief Enum of Bluetooth stack state. @@ -772,6 +790,29 @@ errcode_t gap_disconnect_remote_device(const bd_addr_t *addr); */ errcode_t gap_connect_remote_device(const bd_addr_t *addr); +/** + * @if Eng + * @brief Use this funtion to set the inquiry parameters. + * @par Use this funtion to set the inquiry parameters. + * @attention NULL + * @param [in] device_class #uint32_t, class of device to report. + * @param [in] max_num #uint8_t, max number of response devices. + * @retval error code + * @par Dependency: + * @li bts_gap.h + * @else + * @brief 设置扫描参数。 + * @par 设置扫描参数。 + * @attention 无 + * @param [in] device_class 设备类型。 + * @param [in] max_num 最大上报数量。 + * @retval 执行结果错误码。 + * @par 依赖: + * @li bts_gap.h + * @endif + */ +errcode_t gap_br_set_inquiry_paramters(uint32_t device_class, uint8_t max_num); + /** * @if Eng * @brief Use this funtion to start BT discovery. @@ -1391,6 +1432,29 @@ typedef struct { */ int gap_register_callbacks(gap_call_backs_t *func); +/** + * @if Eng + * @brief Use this funtion to reconnect a media device. + * @par Use this funtion to reconnect a media device. + * @attention NULL + * @param [in] addr #const bd_addr_t *, address of the device. + * @retval #true Execute successfully. + * @retval #false Execution failed. + * @par Dependency: + * @li bts_gap.h + * @else + * @brief 回连媒体设备。 + * @par 回连媒体设备。 + * @attention 无 + * @param [in] 要回连的设备地址。 + * @retval #true 连接成功。 + * @retval #false 连接失败。 + * @par 依赖: + * @li bts_gap.h + * @endif + */ +errcode_t gap_reconnect_media_device(const bd_addr_t *addr); + /** * @} */ diff --git a/code/sdk/include/middleware/services/bts/common/bts_feature.h b/code/sdk/include/middleware/services/bts/common/bts_feature.h new file mode 100644 index 000000000..5c13978ab --- /dev/null +++ b/code/sdk/include/middleware/services/bts/common/bts_feature.h @@ -0,0 +1,92 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2024. All rights reserved. + * Description: BTS FEATURE module. + */ + +/** + * @defgroup bluetooth_bts_feature BTS FEATURE API + * @ingroup bluetooth + * @{ + */ + + +#ifndef BTS_FEATURE_H +#define BTS_FEATURE_H + +#include +#include +#include "errcode.h" +#include "bts_def.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @if Eng + * @brief Struct of BT stack feature. + * @else + * @brief 蓝牙特性位图。 + * @endif + */ +typedef struct { + uint32_t bt_auto_reconnect_closed:1; /*!< @if Eng BT reconnect feature. + @else 蓝牙回连特性。 @endif */ + uint32_t reserved:31; /*!< @if Eng Featrues reserved for future. + @else 保留字段。 @endif */ +} bts_feature_t; + +/** + * @if Eng + * @brief Set BTS Features supported. + * @par Set BTS Features supported. + * @attention NULL + * @param [in] feature #bts_feature_t, a bitmap indicate supported features. + * @retval #BT_STATUS_SUCCESS Excute successfully. + * @retval #Other Error code, @ref bt_status_t + * @par Dependency: + * @li bts_feature.h + * @see + * @else + * @brief 设置想要使用的特性。 + * @par 设置想要使用的特性。 + * @attention 无 + * @param [in] 特性位图。 @ref bts_feature_t + * @retval #BT_STATUS_SUCCESS 执行成功。 + * @retval #Other 错误码, @ref bt_status_t。 + * @par 依赖: + * @li bts_feature.h + * @see + * @endif + */ +errcode_t bts_set_features(bts_feature_t *feature); + +/** + * @if Eng + * @brief Use this funtion to get BTS features supported. + * @par Use this funtion to get BTS features supported. + * @attention NULL. + * @param NULL. + * @retval BT features bitmap. see @ref bts_feature_t + * @par Dependency: + * @li bts_feature.h + * @else + * @brief 获取BT协议栈支持的特性。 + * @par 获取BT协议栈支持的特性。 + * @attention 无 + * @param 无 + * @retval BT 特性位图。 参考 @ref bts_feature_t + * @par 依赖: + * @li bts_feature.h + * @endif + */ +bts_feature_t bts_get_features(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style.cpp.xml index 9510415a8..3505361f8 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style.cpp.xml @@ -1,10 +1,10 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_item.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_item.cpp.xml index fbc65aa03..41741a128 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_item.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_item.cpp.xml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_manager.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_manager.cpp.xml index c12bf10d5..7b7e87f85 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_manager.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style_manager.cpp.xml @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml index 4fc2d0358..91cdbc7a6 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/appsys_bms_cmd.cpp.xml @@ -1,19 +1,19 @@ - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/async_task_manager.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/async_task_manager.cpp.xml index 761c46530..da5ee9294 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/async_task_manager.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/async_task_manager.cpp.xml @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_gatt_client.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_gatt_client.c.xml index f33750d87..12aa0327c 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_gatt_client.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_gatt_client.c.xml @@ -63,16 +63,16 @@ - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_gatt_server.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_gatt_server.c.xml index 05dd35477..f22cc8af2 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_gatt_server.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsrv_gatt_server.c.xml @@ -111,13 +111,13 @@ - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsv_l2cap_chan.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsv_l2cap_chan.c.xml index 7aea144aa..6663e84d6 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsv_l2cap_chan.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/btsv_l2cap_chan.c.xml @@ -3,9 +3,9 @@ - - - - - + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/connection_manager.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/connection_manager.c.xml index e487e2d61..886042363 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/connection_manager.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/connection_manager.c.xml @@ -1,127 +1,133 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/descriptor_utils.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/descriptor_utils.cpp.xml index b261f5fc5..927a87a30 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/descriptor_utils.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/descriptor_utils.cpp.xml @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/dft_impl.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/dft_impl.cpp.xml index 8749a4926..3e6f360af 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/dft_impl.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/dft_impl.cpp.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/dfx_assist.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/dfx_assist.cpp.xml index 33085c0b9..bd45882b9 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/dfx_assist.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/dfx_assist.cpp.xml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/event_util.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/event_util.cpp.xml index 2af67a1a4..fb1e68e15 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/event_util.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/event_util.cpp.xml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/fatal_handler.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/fatal_handler.cpp.xml index f7dd78504..e1b3f67cf 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/fatal_handler.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/fatal_handler.cpp.xml @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml index f2218a25a..6c735f040 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_installer.cpp.xml @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_manager_service.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_manager_service.cpp.xml index 4651a2439..0b41cd54a 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_manager_service.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/gt_bundle_manager_service.cpp.xml @@ -30,5 +30,4 @@ - \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml index e6d452d6e..2777196cc 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/image_cache_manager.cpp.xml @@ -1,13 +1,32 @@ - - - - - + + + + + + + - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_ability.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_ability.cpp.xml index 7d25e5b58..c0397f67f 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_ability.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_ability.cpp.xml @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_ability_impl.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_ability_impl.cpp.xml index 29f309bf5..2f88837a3 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_ability_impl.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_ability_impl.cpp.xml @@ -1,8 +1,8 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_app_context.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_app_context.cpp.xml index c56e1a819..e2684fa88 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_app_context.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_app_context.cpp.xml @@ -1,15 +1,15 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_app_environment.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_app_environment.cpp.xml index b37a76d6d..edbeccf34 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_app_environment.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_app_environment.cpp.xml @@ -1,6 +1,6 @@ - - - - - + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_debugger_config.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_debugger_config.cpp.xml index 5b1487ddb..14b504287 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_debugger_config.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_debugger_config.cpp.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_fwk_common.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_fwk_common.cpp.xml index 3b0d44430..8bfb5fa7e 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_fwk_common.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_fwk_common.cpp.xml @@ -1,46 +1,46 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state.cpp.xml index 2b3ff6201..4247ae37f 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state.cpp.xml @@ -1,11 +1,11 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state_machine.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state_machine.cpp.xml index 065db362b..d53ccf521 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state_machine.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_page_state_machine.cpp.xml @@ -1,22 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_profiler.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_profiler.cpp.xml index e75501296..1e7dbea75 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_profiler.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_profiler.cpp.xml @@ -1,14 +1,14 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_router.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_router.cpp.xml index a38c90764..cc56b3574 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_router.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/js_router.cpp.xml @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/jsi.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/jsi.cpp.xml index 46264eaac..c9bf4d9bb 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/jsi.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/jsi.cpp.xml @@ -1,98 +1,98 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/kaleidoscope_utils.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/kaleidoscope_utils.cpp.xml new file mode 100644 index 000000000..3b813ecea --- /dev/null +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/kaleidoscope_utils.cpp.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lazy_load_manager.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lazy_load_manager.cpp.xml index 007b214d7..d36cfcc93 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lazy_load_manager.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lazy_load_manager.cpp.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lite_m_gfx_engine.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lite_m_gfx_engine.cpp.xml index df964eed8..abaa4dab8 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lite_m_gfx_engine.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/lite_m_gfx_engine.cpp.xml @@ -17,17 +17,17 @@ - - - - - - - - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml index 24e22b236..b3843def9 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/local_device_manager.c.xml @@ -1,87 +1,90 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/locale_util.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/locale_util.cpp.xml index c81179b9b..e509a74e5 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/locale_util.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/locale_util.cpp.xml @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/map_svg_parser.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/map_svg_parser.cpp.xml new file mode 100644 index 000000000..3fabf8d45 --- /dev/null +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/map_svg_parser.cpp.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/mem_util.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/mem_util.cpp.xml index a146bd509..08d3265af 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/mem_util.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/mem_util.cpp.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/number_parser.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/number_parser.cpp.xml index 1c0c3e2b0..0a4f564ca 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/number_parser.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/number_parser.cpp.xml @@ -1,3 +1,3 @@ - - + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/platform_adapter.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/platform_adapter.cpp.xml index 41383d409..fee5236db 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/platform_adapter.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/platform_adapter.cpp.xml @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/remote_device_manager.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/remote_device_manager.c.xml index 782222904..b4df39fc3 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/remote_device_manager.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/remote_device_manager.c.xml @@ -9,58 +9,64 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gatt.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gatt.c.xml index 8856e20b6..f4d0e899b 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gatt.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gatt.c.xml @@ -9,59 +9,59 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/stack_gap_if.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/stack_gap_if.c.xml index 1812a70b4..2487c86cd 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/stack_gap_if.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/stack_gap_if.c.xml @@ -1,20 +1,20 @@ - - - + + - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view.cpp.xml new file mode 100644 index 000000000..9cb8a703c --- /dev/null +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_coverflow_view.cpp.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_hexagons_list.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_hexagons_list.cpp.xml new file mode 100644 index 000000000..ff2fbb76a --- /dev/null +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_hexagons_list.cpp.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_icosahedron_view.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_icosahedron_view.cpp.xml new file mode 100644 index 000000000..e4a5ae044 --- /dev/null +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_icosahedron_view.cpp.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_kaleidoscope_view.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_kaleidoscope_view.cpp.xml new file mode 100644 index 000000000..f39f1c7dd --- /dev/null +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_kaleidoscope_view.cpp.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_map_view.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_map_view.cpp.xml new file mode 100644 index 000000000..6b960ad9a --- /dev/null +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_map_view.cpp.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_roller_view.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_roller_view.cpp.xml new file mode 100644 index 000000000..6c53c2df6 --- /dev/null +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/ui_roller_view.cpp.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/core_msg.c.xml b/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/core_msg.c.xml index 8737d90a0..4deeda727 100755 --- a/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/core_msg.c.xml +++ b/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/core_msg.c.xml @@ -1,52 +1,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml index f50202ba7..3ab2f0f3f 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hdb/hdbcfg/mss_prim_db.xml @@ -86,7 +86,7 @@ - + @@ -178,7 +178,7 @@ - + @@ -206,9 +206,9 @@ - - - + + + @@ -286,7 +286,7 @@ - + @@ -513,7 +513,7 @@ - + @@ -613,13 +613,13 @@ - - - - - - - + + + + + + + @@ -781,7 +781,7 @@ - + @@ -802,7 +802,7 @@ - + @@ -918,6 +918,10 @@ + + + + @@ -1036,15 +1040,17 @@ - - - - - - - - - + + + + + + + + + + + @@ -1100,21 +1106,20 @@ - + - - - - - - - - - - - - - + + + + + + + + + + + + @@ -1137,11 +1142,11 @@ - - + + - - + + @@ -1178,6 +1183,7 @@ + @@ -1219,8 +1225,9 @@ - - + + + @@ -1625,22 +1632,23 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -1907,14 +1915,17 @@ - - - - - - - - + + + + + + + + + + + @@ -1954,9 +1965,10 @@ - - - + + + + @@ -2006,9 +2018,9 @@ - + - + @@ -2158,16 +2170,17 @@ - - - - - - - - - - + + + + + + + + + + + @@ -2313,21 +2326,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -2345,74 +2358,72 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2431,6 +2442,7 @@ + @@ -2499,10 +2511,10 @@ - - - - + + + + @@ -2585,6 +2597,8 @@ + + @@ -2614,8 +2628,8 @@ - - + + @@ -2690,13 +2704,14 @@ - - - - - - - + + + + + + + + @@ -3031,9 +3046,10 @@ - - - + + + + @@ -3072,56 +3088,55 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3276,18 +3291,27 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -3335,10 +3359,10 @@ - - - - + + + + @@ -3377,23 +3401,23 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -3432,18 +3456,28 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + @@ -3522,38 +3556,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3621,8 +3655,11 @@ - - + + + + + @@ -3634,7 +3671,7 @@ - + @@ -3849,11 +3886,13 @@ - - - - - + + + + + + + @@ -4304,7 +4343,7 @@ - + @@ -4336,32 +4375,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4524,40 +4565,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/att_gatt.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/att_gatt.c.xml index 79aaed9e8..a75cd461a 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/att_gatt.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/att_gatt.c.xml @@ -1,14 +1,24 @@ - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_core.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_core.c.xml index 7520b7a55..0c2bfe4de 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_core.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_core.c.xml @@ -50,19 +50,18 @@ - + - - - - - - - - - - - - - + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_general.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_general.c.xml index f1f75bfbd..4a9232f13 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_general.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_general.c.xml @@ -1,69 +1,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_general_gatt.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_general_gatt.c.xml index c808c18a0..a9b35a427 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_general_gatt.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_general_gatt.c.xml @@ -34,54 +34,53 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_gap.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_gap.c.xml index e38f9ce3c..6c194ad5e 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_gap.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_gap.c.xml @@ -1,33 +1,33 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_main.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_main.c.xml index 40238267a..bbe9874bc 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_main.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_main.c.xml @@ -1,8 +1,8 @@ - - - - - - - + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_mpc_adpt_gatt.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_mpc_adpt_gatt.c.xml index 6d8251840..b4a447d57 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_mpc_adpt_gatt.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_mpc_adpt_gatt.c.xml @@ -61,14 +61,15 @@ - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_sleep.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_sleep.c.xml index 1d994423b..8c40a46d5 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_sleep.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_sleep.c.xml @@ -1,14 +1,14 @@ - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_tran_task.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_tran_task.c.xml index b6a0dc18a..45cfe4c19 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_tran_task.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_tran_task.c.xml @@ -1,27 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/fsm.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/fsm.c.xml index cec3cd9ed..62c052b1a 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/fsm.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/fsm.c.xml @@ -1,6 +1,8 @@ - - - - - + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_comm.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_comm.c.xml index 363dc3af0..63850e37a 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_comm.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_comm.c.xml @@ -1,11 +1,13 @@ - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_le.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_le.c.xml index 2d0bcaa81..da45fb165 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_le.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_le.c.xml @@ -1,17 +1,18 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_core_ram.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_core_ram.c.xml index ef7adc351..0bdff1a17 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_core_ram.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_core_ram.c.xml @@ -1,9 +1,12 @@ - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_data_proc.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_data_proc.c.xml index ea716cded..e9bfbf636 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_data_proc.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_data_proc.c.xml @@ -1,16 +1,16 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_ev_le.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_ev_le.c.xml index 648aeab66..fbf25fbf9 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_ev_le.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_ev_le.c.xml @@ -1,3 +1,4 @@ - - + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_hlp_ram.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_hlp_ram.c.xml index e060f2451..720dfbcdc 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_hlp_ram.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_hlp_ram.c.xml @@ -1,3 +1,3 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_link_br.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_link_br.c.xml index 0e17c349a..043c21b70 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_link_br.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_link_br.c.xml @@ -1,5 +1,6 @@ - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_link_le.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_link_le.c.xml new file mode 100644 index 000000000..7726db44f --- /dev/null +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/hci_link_le.c.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ipc_irq.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ipc_irq.c.xml new file mode 100644 index 000000000..d492b4ac6 --- /dev/null +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ipc_irq.c.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/llc_bis_hci_ram.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/llc_bis_hci_ram.c.xml index db9492441..fc0673569 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/llc_bis_hci_ram.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/llc_bis_hci_ram.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/lld_per_ram.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/lld_per_ram.c.xml index 6f0e8e256..53c207824 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/lld_per_ram.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/lld_per_ram.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/log_oml_exception.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/log_oml_exception.c.xml index 5129a41b6..aedb9eca9 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/log_oml_exception.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/log_oml_exception.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/osdep.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/osdep.c.xml index def1f92ce..abaece3a8 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/osdep.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/osdep.c.xml @@ -1,8 +1,9 @@ - - - - - - - + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_btdfx.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_btdfx.c.xml index c1cf4a5a2..99ca52a25 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_btdfx.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_btdfx.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_bth.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_bth.c.xml index 9f07411be..85e002ab5 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_bth.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_bth.c.xml @@ -1,4 +1,5 @@ - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_ea.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_ea.c.xml index dddfc3052..f17b4dd3f 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_ea.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_ea.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_ld_acl.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_ld_acl.c.xml index f07fb9d46..02a450702 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_ld_acl.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_ld_acl.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc.c.xml index fe553a93d..cf9158df9 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc_bis_util.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc_bis_util.c.xml index 86fb48666..67e4fa3f8 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc_bis_util.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc_bis_util.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc_llcp.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc_llcp.c.xml new file mode 100644 index 000000000..1ecab8adb --- /dev/null +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llc_llcp.c.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis.c.xml index d3c08e744..fd1decc85 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis_evt.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis_evt.c.xml index a6d92f090..20d9c779d 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis_evt.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis_evt.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis_pdu.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis_pdu.c.xml index fe3c01148..852bea28a 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis_pdu.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_bis_pdu.c.xml @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_evt.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_evt.c.xml index 616cab1a2..563f73f3d 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_evt.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_evt.c.xml @@ -1,5 +1,5 @@ - - - - + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_pdu.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_pdu.c.xml new file mode 100644 index 000000000..6cdef533a --- /dev/null +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_lld_pdu.c.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llm_util.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llm_util.c.xml index 951927695..e806e6c25 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llm_util.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/patch_llm_util.c.xml @@ -1,4 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gap_conn_management.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gap_conn_management.c.xml index eb1b6bbcd..14ad471e7 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gap_conn_management.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gap_conn_management.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gatt.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gatt.c.xml index e4f71434e..5b560d155 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gatt.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gatt.c.xml @@ -1,18 +1,18 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gatt_hlp.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gatt_hlp.c.xml index da868766d..481ab07e7 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gatt_hlp.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_gatt_hlp.c.xml @@ -1,37 +1,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_hfp.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_hfp.c.xml index f19cb4195..fcab8d50d 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_hfp.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_hfp.c.xml @@ -1,9 +1,9 @@ - - + + - - + + diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_hlp.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_hlp.c.xml index 5949061b2..af8daa1de 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_hlp.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_hlp.c.xml @@ -1,3 +1,6 @@ - - + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/smp_ui.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/smp_ui.c.xml new file mode 100644 index 000000000..8c7cf1015 --- /dev/null +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/smp_ui.c.xml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/tladapter.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/tladapter.c.xml index 304102381..bab79cb6e 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/tladapter.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/tladapter.c.xml @@ -1,2 +1,2 @@ - + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_audio_manager_wrapper.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_audio_manager_wrapper.a index e61fe554c..1557c5e72 100755 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_audio_manager_wrapper.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_audio_manager_wrapper.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_brandy_service.a index 8df753eee..61b8bb284 100755 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_brandy_service.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_brandy_service.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_sdk.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_sdk.a index 861e04f93..3f240eea4 100755 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_sdk.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/freertos/br/libbt_host_sdk.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_audio_manager_wrapper.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_audio_manager_wrapper.a index baac1e339..1a804b7a8 100755 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_audio_manager_wrapper.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_audio_manager_wrapper.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_service.a index 653fee490..f2197678a 100755 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_service.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_brandy_service.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_sdk.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_sdk.a index 50c5f685e..b164a1ffb 100755 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_sdk.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/br/libbt_host_sdk.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a index 3e0841b4e..1799e1667 100755 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_brandy_service.a differ diff --git a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_sdk.a b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_sdk.a index da48fbd0b..6fdd6682c 100755 Binary files a/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_sdk.a and b/code/sdk/interim_binary/brandy/libs/bt/evb_standard/liteos/mini/br/libbt_host_sdk.a differ diff --git a/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt b/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt index 5d784c2aa..4b5183c4b 100755 --- a/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt +++ b/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt @@ -11,6 +11,7 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/last_dump_adapt.c ${CMAKE_CURRENT_SOURCE_DIR}/sample_data_adapt.c ${CMAKE_CURRENT_SOURCE_DIR}/zdiag_adapt_sdt.c + ${CMAKE_CURRENT_SOURCE_DIR}/mon_log_output.c ) set(PUBLIC_HEADER @@ -19,14 +20,27 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_system_cmd/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_system_cmd/dfx_include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_mocked_shell/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/last_dump/dfx_include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/last_dump/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/sample_data/dfx_include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/sample_data/include ${ROOT_DIR}/include/middleware/services/bts ${ROOT_DIR}/include/middleware/services/bts/ble ${ROOT_DIR}/include/middleware/services/bts/br ${ROOT_DIR}/include/middleware/services/bts/common ) -set(PRIVATE_DEFINES -) +if("${TARGET_COMMAND}" MATCHES "-user$") + set(PRIVATE_DEFINES + USER_VERSION + ) +else() + set(PRIVATE_DEFINES + ) +endif() set(PUBLIC_DEFINES ) diff --git a/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c b/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c index b843c9fe0..f7a112ad8 100755 --- a/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c +++ b/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c @@ -86,6 +86,8 @@ #include "key_id.h" #endif +#include "mon_log_output.h" + #define DFX_MSG_TASK_PRIO 5 const diag_cmd_reg_obj_t g_diag_default_cmd_tbl[] = { @@ -108,8 +110,8 @@ const diag_cmd_reg_obj_t g_diag_default_cmd_tbl[] = { { DIAG_CMD_ID_DBG_STAT_QUERY, DIAG_CMD_ID_DBG_STAT_QUERY, diag_cmd_stat_query }, }; -static unsigned long g_dfx_osal_queue_id; -static unsigned long g_dfx_transmit_queue_id; +static unsigned long g_dfx_osal_queue_id = DFX_INVALID_QUEUE_ID; +static unsigned long g_dfx_transmit_queue_id = DFX_INVALID_QUEUE_ID; static errcode_t register_default_diag_cmd(void) { @@ -412,6 +414,11 @@ errcode_t dfx_system_init(void) if (ret != ERRCODE_SUCC) { return ret; } +#ifdef USER_VERSION + diag_highest_level_proc(DIAG_LOG_LEVEL_WARN); + mon_log_output_ctrl_init(); + mon_log_output_enable(true); +#endif return ERRCODE_SUCC; } diff --git a/code/sdk/middleware/chips/brandy/dfx/include/dfx_adapt_layer.h b/code/sdk/middleware/chips/brandy/dfx/include/dfx_adapt_layer.h index e705c6d69..90d439920 100755 --- a/code/sdk/middleware/chips/brandy/dfx/include/dfx_adapt_layer.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/dfx_adapt_layer.h @@ -24,6 +24,7 @@ #include "debug_print.h" #define DFX_CHIP_WS_TV_SEC 1663739960 +#define DFX_INVALID_QUEUE_ID 0xFFFFFFFF typedef enum { FLASH_OP_TYPE_OTA, @@ -101,6 +102,11 @@ static inline errcode_t dfx_event_write(dfx_event_id_t event_id) /* Msg 接口 */ static inline errcode_t dfx_msg_write(uint32_t msg_id, uint8_t *msg, uint16_t msg_len, bool wait) { + unsigned long queue_id = dfx_get_osal_queue_id(); + if (queue_id == DFX_INVALID_QUEUE_ID) { + return ERRCODE_FAIL; + } + unsigned int timeout = (wait) ? OSAL_MSGQ_WAIT_FOREVER : 0; uint8_t msg_data[DFX_MSG_MAX_SIZE + DFX_MSG_ID_LEN]; @@ -110,7 +116,7 @@ static inline errcode_t dfx_msg_write(uint32_t msg_id, uint8_t *msg, uint16_t ms return ERRCODE_FAIL; } - return (errcode_t)osal_msg_queue_write_copy(dfx_get_osal_queue_id(), + return (errcode_t)osal_msg_queue_write_copy(queue_id, msg_data, DFX_MSG_MAX_SIZE + DFX_MSG_ID_LEN, timeout); } @@ -124,6 +130,10 @@ static inline errcode_t transmit_msg_write(uint32_t msg_id, uint8_t *msg, uint16 #if (defined(MEMORY_MINI)) return dfx_msg_write(msg_id, msg, msg_len, wait); #else + unsigned long queue_id = dfx_get_transmit_queue_id(); + if (queue_id == DFX_INVALID_QUEUE_ID) { + return ERRCODE_FAIL; + } unsigned int timeout = (wait) ? OSAL_MSGQ_WAIT_FOREVER : 0; uint8_t msg_data[DFX_MSG_MAX_SIZE + DFX_MSG_ID_LEN]; @@ -133,7 +143,7 @@ static inline errcode_t transmit_msg_write(uint32_t msg_id, uint8_t *msg, uint16 return ERRCODE_FAIL; } - return (errcode_t)osal_msg_queue_write_copy(dfx_get_transmit_queue_id(), + return (errcode_t)osal_msg_queue_write_copy(queue_id, msg_data, DFX_MSG_MAX_SIZE + DFX_MSG_ID_LEN, timeout); #endif } diff --git a/code/sdk/middleware/chips/brandy/dfx/include/log_def_app.h b/code/sdk/middleware/chips/brandy/dfx/include/log_def_app.h index 7df400f93..8fed17758 100755 --- a/code/sdk/middleware/chips/brandy/dfx/include/log_def_app.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/log_def_app.h @@ -16,6 +16,7 @@ typedef enum { NATIVEABILITY_CPP, NATIVELAUNCHER_CPP, MAINVIEW_CPP, + MAINMODEL_CPP, ACTIVITYMODEL_CPP, ACTIVITYPRESENTER_CPP, ACTIVITYWEEKVIEW_CPP, @@ -195,6 +196,34 @@ typedef enum { SMART_VOICE_SERVICE_C, VOICE_ENGINE_HAL_C, OHOSFWK_AT_PROCESS_CPP, + SETCARDADAPTER_CPP, + SETCARDITEM_CPP, + SETCARDDELETEVIEW_CPP, + SETCARDVIEW_CPP, + SETCARDNOCARDVIEW_CPP, + SETCARDPRESENTER_CPP, + SETCARDMODEL_CPP, + ADDCARDPRESENTER_CPP, + ADDCARDADAPTER_CPP, + ADDCARDVIEW_CPP, + ADDCARDMODEL_CPP, + ADDCARDITEM_CPP, + SETDIALVIEW_CPP, + SETDIALMODEL_CPP, + SETDIALPRESENTER_CPP, + SETDESKTOPMODEL_CPP, + SETDESKTOPVIEW_CPP, + SETDESKTOPPRESENTER_CPP, + DISPLAY_STATE_MACHINE_C, + POWER_DISPLAY_SERVICE_C, + GUI_EVENT_FILTER_C, + SLICE_EVENT_FILTER_C, + TIMER_EVENT_FILTER_C, + DISPLAY_ACTION_C, + TIMER_ACTION_C, + TOUCH_ACTION_C, + ALIPAY_FEATURE_C, + ALIPAY_BLUETOOTH_C, APP_FILE_ID_MAX = 1024, } log_file_list_enum_app_t; diff --git a/code/sdk/middleware/chips/brandy/dfx/include/log_def_bth.h b/code/sdk/middleware/chips/brandy/dfx/include/log_def_bth.h index ac8417030..2bc496e41 100755 --- a/code/sdk/middleware/chips/brandy/dfx/include/log_def_bth.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/log_def_bth.h @@ -128,6 +128,10 @@ typedef enum { STACK_PAN_IF_C, STACK_PBAP_IF_C, STACK_SPP_IF_C, + SAMPLE_BLE_ANCS_C, + BLE_ANCS_CLIENT_C, + SAMPLE_BLE_AMS_C, + BLE_AMS_CLIENT_C, BTH_FILE_ID_MAX = 1024, } log_file_list_enum_bth_t; #endif diff --git a/code/sdk/middleware/chips/brandy/dfx/include/log_def_gui.h b/code/sdk/middleware/chips/brandy/dfx/include/log_def_gui.h index 0886e8c41..df22386cc 100755 --- a/code/sdk/middleware/chips/brandy/dfx/include/log_def_gui.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/log_def_gui.h @@ -419,6 +419,21 @@ typedef enum { UI_MENU_ITEM_CPP, UI_BARCODE_CPP, SCREENMODEL_CPP, + UI_HEXAGONS_LIST_CPP, + UI_CUSTOM_HEXAGONS_LIST_CPP, + UI_TEST_HEXAGONS_LIST_CPP, + UI_KALEIDOSCOPE_VIEW_CPP, + KALEIDOSCOPE_UTILS_CPP, + UI_COVERFLOW_VIEW_CPP, + UI_ROLLER_VIEW_CPP, + UI_ICOSAHEDRON_VIEW_CPP, + UI_MAP_VIEW_CPP, + MAP_SVG_PARSER_CPP, + SLICETRANSITION_CPP, + TRANSITIONMANAGER_CPP, + UI_PINYIN_CANDIDATE_CPP, + HEXAGONSTRANSITION_CPP, + BACKTOHEXAGONSTRANSITION_CPP, FILE_ID_MAX = 1024, } log_file_list_enum_gui_t; #endif diff --git a/code/sdk/middleware/chips/brandy/dfx/include/log_def_ohos.h b/code/sdk/middleware/chips/brandy/dfx/include/log_def_ohos.h index 2069373e8..bda3e3838 100644 --- a/code/sdk/middleware/chips/brandy/dfx/include/log_def_ohos.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/log_def_ohos.h @@ -52,6 +52,8 @@ typedef enum { JS_ASYNC_WORK_CPP, MESSAGE_QUEUE_UTILS_CPP, ACE_LOG_CPP, + BAIDUMAP_CPP, + DISPLAY_CPP, ACE_MEM_BASE_CPP, ASYNC_TASK_MANAGER_CPP, // CACHE_MANAGER_CPP, @@ -168,6 +170,7 @@ typedef enum { APP_PROVISION_C, APP_VERIFY_C, MBEDTLS_PKCS7_C, + BAIDU_MAP_COMPONENT_CPP, } log_file_list_enum_ohos_e; #endif /* LOG_DEF_OHOS_H */ diff --git a/code/sdk/middleware/chips/brandy/dfx/include/log_def_pf.h b/code/sdk/middleware/chips/brandy/dfx/include/log_def_pf.h index 98052e3ce..9a5c1793b 100755 --- a/code/sdk/middleware/chips/brandy/dfx/include/log_def_pf.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/log_def_pf.h @@ -78,6 +78,7 @@ typedef enum { DFX_CHANNEL_C, SAMPLE_DATA_ADAPT_C, ZDIAG_ADAPT_SDT_C, + MON_LOG_OUTPUT_C, DIAG_CMD_DST_C, DIAG_DEBUG_C, DIAG_FILTER_C, diff --git a/code/sdk/middleware/chips/brandy/dfx/include/zdiag_config.h b/code/sdk/middleware/chips/brandy/dfx/include/zdiag_config.h index 57b76e2f1..47a0f8d5c 100755 --- a/code/sdk/middleware/chips/brandy/dfx/include/zdiag_config.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/zdiag_config.h @@ -7,7 +7,7 @@ #ifndef ZDIAG_CONFIG_H #define ZDIAG_CONFIG_H -#define DFX_OFFLINE_LOG_MUTI_FILE_NUM 20 /* 离线日志最大文件个数 */ +#define DFX_OFFLINE_LOG_MUTI_FILE_NUM 5 /* 离线日志最大文件个数 */ #define DFX_OFFLINE_LOG_FILE_SIZE (1024 * 1024) /* 离线日志每个文件最大字节数 */ #define DFX_OFFLINE_LOG_PATH "/user/log/" /* 离线日志存放路径 */ #define DFX_OFFLINE_LOG_NAME "log_file_diag.bin" /* 离线日志文件名 */ diff --git a/code/sdk/middleware/chips/brandy/dfx/mon_log_output.c b/code/sdk/middleware/chips/brandy/dfx/mon_log_output.c new file mode 100644 index 000000000..f14594743 --- /dev/null +++ b/code/sdk/middleware/chips/brandy/dfx/mon_log_output.c @@ -0,0 +1,113 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2023-2023. All rights reserved. \n + * Description: log output monitor. + */ + +#include +#include +#include +#include +#include +#include +#include "common_def.h" +#include "mon_log_output.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ +#define MODULEID_COUNT (MODULEID_BUTT + 2) +STATIC uint32_t g_mon_logcnt_max[MODULEID_COUNT] = { 0, + MAX_LOGCNT_BT, + 0, + MAX_LOGCNT_DSP, + MAX_LOGCNT_PF, + MAX_LOGCNT_MEDIA, + 0, + MAX_LOGCNT_APP, + MAX_LOGCNT_GPU, + MAX_LOGCNT_GUI, + 0, + MAX_LOGCNT_BTH, + MAX_LOGCNT_OHOS, + 0, + MAX_LOGCNT_BT_STATUS, + MAX_LOGCNT_BT_OTA }; +STATIC uint32_t g_mon_logcnt_ctrl[MODULEID_COUNT] = { 0 }; +STATIC osal_timer g_logcnt_timer = { 0 }; +STATIC bool g_logcnt_en = false; + +STATIC void mon_logcnt_enable(void) +{ + for (uint32_t i = 0; i < MODULEID_COUNT; i++) { + g_mon_logcnt_ctrl[i] = 0; + } + + osal_timer_start(&g_logcnt_timer); +} + +STATIC void mon_log_output_timer_alert(unsigned long data) +{ + unused(data); + mon_logcnt_enable(); +} + +STATIC bool mon_logcnt_process(uint8_t mid, uint8_t level) +{ + unused(level); + if (mid >= MODULEID_COUNT) { + return false; + } + + if ((g_logcnt_en == true) && (g_mon_logcnt_max[mid] < g_mon_logcnt_ctrl[mid])) { + return false; + } + + g_mon_logcnt_ctrl[mid]++; + return true; +} + +void mon_log_output_ctrl_init(void) +{ + g_logcnt_timer.handler = mon_log_output_timer_alert; + g_logcnt_timer.data = 0; + g_logcnt_timer.interval = MON_LOG_CNT_CLEAR_TIMEOUT; + + if (osal_timer_init(&g_logcnt_timer) < 0) { + uapi_diag_error_log(0, "Create logcnt timer failed!"); + return; + } + + /* register log file hook */ + uapi_diag_register_msg_flow_control_hook(mon_logcnt_process); + + osal_timer_start(&g_logcnt_timer); +} + +uint32_t *mon_log_output_get_counter(void) +{ + return &g_mon_logcnt_ctrl; +} + +void mon_log_output_enable(bool enable) +{ + if (g_logcnt_en == enable) { + return; /* Same settings, do nothing */ + } + + g_logcnt_en = enable; + + if (enable == true) { + mon_logcnt_enable(); /* start over counting */ + } else { + osal_timer_stop(&g_logcnt_timer); /* continue counting, but do not clear */ + } +} + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + diff --git a/code/sdk/middleware/chips/brandy/dfx/mon_log_output.h b/code/sdk/middleware/chips/brandy/dfx/mon_log_output.h new file mode 100644 index 000000000..59c1a5aa9 --- /dev/null +++ b/code/sdk/middleware/chips/brandy/dfx/mon_log_output.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2023-2023. All rights reserved. \n + * Description: log output monitor. + */ + +#ifndef MON_LOG_OUTPUT_H +#define MON_LOG_OUTPUT_H + +#include "stdint.h" +#include "stdbool.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#define MON_LOG_CNT_CLEAR_TIMEOUT (1000 * 60 * 15) /* 15 min */ +#define MAX_LOGCNT_BT 9000 +#define MAX_LOGCNT_DSP 1000 +#define MAX_LOGCNT_PF 2000 +#define MAX_LOGCNT_MEDIA 1000 +#define MAX_LOGCNT_APP 5000 +#define MAX_LOGCNT_GPU 2000 +#define MAX_LOGCNT_GUI 1000 +#define MAX_LOGCNT_BTH 3000 +#define MAX_LOGCNT_OHOS 1000 +#define MAX_LOGCNT_BT_STATUS 3000 +#define MAX_LOGCNT_BT_OTA 3000 + +void mon_log_output_ctrl_init(void); +uint32_t *mon_log_output_get_counter(void); +void mon_log_output_enable(bool enable); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif diff --git a/code/sdk/middleware/chips/brandy/dfx/zdiag_adapt_sdt.c b/code/sdk/middleware/chips/brandy/dfx/zdiag_adapt_sdt.c index 7b3c3c0ef..ea74ec417 100755 --- a/code/sdk/middleware/chips/brandy/dfx/zdiag_adapt_sdt.c +++ b/code/sdk/middleware/chips/brandy/dfx/zdiag_adapt_sdt.c @@ -338,7 +338,9 @@ void diag_debug_cmd_proc(uint8_t *data, uint32_t len) void diag_auto_log_report_enable(void) { uint32_t level[] = { +#ifndef USER_VERSION DIAG_LOG_LEVEL_DBG, +#endif DIAG_LOG_LEVEL_INFO, DIAG_LOG_LEVEL_WARN, DIAG_LOG_LEVEL_ERROR, @@ -354,6 +356,7 @@ void diag_auto_log_report_enable(void) LOG_OTA_MODULE, LOG_OHOSMODULE, LOG_BTHMODULE, + LOG_GPUMODULE, }; #ifndef FT_SINGLE_UART diff --git a/code/sdk/middleware/chips/brandy/exception/CMakeLists.txt b/code/sdk/middleware/chips/brandy/exception/CMakeLists.txt index 9e0d1e43b..15e8e131e 100755 --- a/code/sdk/middleware/chips/brandy/exception/CMakeLists.txt +++ b/code/sdk/middleware/chips/brandy/exception/CMakeLists.txt @@ -13,6 +13,9 @@ elseif (${ARCH_FAMILY} STREQUAL "riscv") set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/exception_riscv.s ${CMAKE_CURRENT_SOURCE_DIR}/exception_riscv.c + ${CMAKE_CURRENT_SOURCE_DIR}/chip_system_time.c + ${CMAKE_CURRENT_SOURCE_DIR}/chip_exception_utils.c + ${CMAKE_CURRENT_SOURCE_DIR}/exception_dump.c ) endif() diff --git a/code/sdk/middleware/chips/brandy/exception/chip_exception_utils.c b/code/sdk/middleware/chips/brandy/exception/chip_exception_utils.c new file mode 100644 index 000000000..0af3409a1 --- /dev/null +++ b/code/sdk/middleware/chips/brandy/exception/chip_exception_utils.c @@ -0,0 +1,35 @@ +/** + * Copyright (c) CompanyNameMagicTag 2023-2023. All rights reserved. + * Description: utils + * Author: + * Create: + */ +#include "chip_exception_utils.h" +#include +#include "hal_reboot.h" +#include "chip_io.h" + +#define STATUS_ADDRESS 0x5702C1E8 +#define VBUS_INSERT_POS 4 +#define PWREN_PRESS_POS 3 + +bool is_first_power_on(void) +{ + return hal_reboot_get_first_power_on_flag(); +} + +bool is_vbus_insert(void) +{ + if (reg32_getbit(STATUS_ADDRESS, VBUS_INSERT_POS)) { + return true; + } + return false; +} + +bool is_pwren_press(void) +{ + if (reg32_getbit(STATUS_ADDRESS, PWREN_PRESS_POS)) { + return true; + } + return false; +} \ No newline at end of file diff --git a/code/sdk/middleware/chips/brandy/exception/chip_exception_utils.h b/code/sdk/middleware/chips/brandy/exception/chip_exception_utils.h new file mode 100644 index 000000000..2a7a67998 --- /dev/null +++ b/code/sdk/middleware/chips/brandy/exception/chip_exception_utils.h @@ -0,0 +1,31 @@ +/** + * Copyright (c) CompanyNameMagicTag 2023-2023. All rights reserved. + * Description: utils + * Author: + * Create: + */ +#ifndef CHIP_EXCEPTION_UTILS_H +#define CHIP_EXCEPTION_UTILS_H + +#include +#include +#include + +/** + * @brief Check if this is the first power-on since the device was battery-powered. + * @return true if this is the first power-on, false otherwise. + */ +bool is_first_power_on(void); + +/** + * @brief Check if the VBUS (power supply) is inserted. + * @return true if VBUS is inserted, false otherwise. + */ +bool is_vbus_insert(void); + +/** + * @brief Check if the power button (PWREN) is being pressed. + * @return true if PWREN is pressed, false otherwise. + */ +bool is_pwren_press(void); +#endif diff --git a/code/sdk/middleware/chips/brandy/exception/chip_system_time.c b/code/sdk/middleware/chips/brandy/exception/chip_system_time.c new file mode 100644 index 000000000..36c21313f --- /dev/null +++ b/code/sdk/middleware/chips/brandy/exception/chip_system_time.c @@ -0,0 +1,152 @@ +/** + * Copyright (c) CompanyNameMagicTag 2023-2023. All rights reserved. + * Description: get time + * Author: + * Create: + */ +#ifndef BUILD_APPLICATION_SSB + +#include "chip_system_time.h" + +#define SECONDS_PER_MINUTE 60 /* second per minute */ +#define MINUTES_PER_HOUR 60 /* second per minute */ +#define MSEC_PER_SEC 1000 +#define USEC_PER_MSEC 1000 +#define TZ_ADDRESS 0x5702C014 +#define MAX_TIMEZONE_HOURS 24 +#define TIME_MAX 64 + +void print_time(calendar_t *date) +{ + printf("CALLENDAR:year = %d, month = %d, day = %d, hour = %d, minute = %d, second = %d \r\n", + date->year, + date->mon, + date->day, + date->hour, + date->min, + date->sec); +} + +void print_time_2(struct tm *date) +{ + printf("TM:year = %d, month = %d, day = %d, hour = %d, minute = %d, second = %d \r\n", + date->tm_year + 1900, + date->tm_mon, + date->tm_mday, + date->tm_hour, + date->tm_min, + date->tm_sec); +} + +static uint16_t get_timezone(void) +{ + return readw(TZ_ADDRESS) & 0x00FF; +} + +static void set_timezone(uint16_t timezone) +{ + uint16_t tz_zone = readw(TZ_ADDRESS) & 0xFF00; + tz_zone = tz_zone | timezone; + writew(TZ_ADDRESS, tz_zone); +} + +void save_time(void) +{ + uint64_t time_sec = get_local_timestamp(); + time_sec = time_sec * MSEC_PER_SEC; + uapi_calendar_set_timestamp(time_sec); +} + +uint32_t get_current_timestamp(void) +{ + uint32_t timestamp = 0; + struct timeval current_time = {0}; + if (gettimeofday(¤t_time, NULL)) { + return 0; + } + struct tm tm; + localtime_r(¤t_time.tv_sec, &tm); + timestamp = (uint32_t)current_time.tv_sec; + return timestamp; +} + +uint32_t get_local_timestamp(void) +{ + uint32_t timestamp = get_current_timestamp() + get_timezone() * MINUTES_PER_HOUR * SECONDS_PER_MINUTE; + return timestamp; +} + +void get_current_time(struct timeval *tv, struct tm *tm) +{ + char timebuf[TIME_MAX] = {0}; + if (gettimeofday(tv, NULL)) { + return; + } + localtime_r(&tv->tv_sec, tm); + tm->tm_mon = tm->tm_mon + 1; + printf("get_current_time tv_tv_sec = %d \r\n", tv->tv_sec); + print_time_2(tm); +} + +void restore_time(void) +{ + uapi_ulp_systick_soc_calibration(); + calendar_t date; + uapi_calendar_get_datetime(&date); + print_time(&date); + uint64_t sec; + uapi_calendar_get_timestamp(&sec); + printf("callendar timestamp = %lld \r\n", sec); + sec = sec / MSEC_PER_SEC; + sync_time(sec, get_timezone()); +} + +uint32_t sync_time(uint32_t timestamp, uint32_t timezone) +{ + printf("sync time timestamp %d, timezone %d \r\n", timestamp, timezone); + uint32_t seconds; + if (timezone > MAX_TIMEZONE_HOURS) { + return ERRCODE_FAIL; + } + if (timestamp == 0) { + return ERRCODE_FAIL; + } else if (timestamp <= (timezone * MINUTES_PER_HOUR * SECONDS_PER_MINUTE)) { + seconds = 0; + } else { + seconds = timestamp - (timezone * MINUTES_PER_HOUR * SECONDS_PER_MINUTE); + } + set_timezone(timezone); + struct timeval tv = {0}; + struct timezone tzone = {0}; + tv.tv_sec = seconds; + tv.tv_usec = 0; + tzone.tz_dsttime = 0; + tzone.tz_minuteswest = timezone * MINUTES_PER_HOUR; + return settimeofday(&tv, &tzone); +} + +void test_bandy_time(void) +{ + struct tm tm; + struct timeval tv; + uint32_t time = 1716044461; // 2024-5-18 15:1:1 + printf("--------SYNC TIME----------\r\n"); + get_current_timestamp(); + get_current_time(&tv, &tm); + sync_time(time, 8); + get_current_timestamp(); + get_current_time(&tv, &tm); + printf("--------SAVE TIME----------\r\n"); + get_current_timestamp(); + get_current_time(&tv, &tm); + save_time(); + get_current_timestamp(); + get_current_time(&tv, &tm); + printf("--------RESTORE TIME----------\r\n"); + get_current_timestamp(); + get_current_time(&tv, &tm); + restore_time(); + get_current_timestamp(); + get_current_time(&tv, &tm); +} +#endif \ No newline at end of file diff --git a/code/sdk/middleware/chips/brandy/exception/chip_system_time.h b/code/sdk/middleware/chips/brandy/exception/chip_system_time.h new file mode 100644 index 000000000..d2f2e7744 --- /dev/null +++ b/code/sdk/middleware/chips/brandy/exception/chip_system_time.h @@ -0,0 +1,67 @@ +/** + * Copyright (c) CompanyNameMagicTag 2023-2023. All rights reserved. + * Description: time + * Author: + * Create: + */ +#ifndef CHIP_SYSTEM_TIME_H +#define CHIP_SYSTEM_TIME_H + +#ifndef BUILD_APPLICATION_SSB +#include +#include +#include +#include "calendar.h" +#include "chip_io.h" +#include "errcode.h" +#include "time.h" +#include "sys/time.h" +/** + * @brief Print the time represented by the given calendar date + * @return void. + */ +void print_time(calendar_t *date); + +/** + * @brief Save the current system time to non-volatile memory + * @return void. + */ +void save_time(void); + +/** + * @brief Get the current system time as a Unix timestamp + * @return void. + */ +uint32_t get_current_timestamp(void); + +/** + * @brief Get the current system time as a timeval struct and a tm + * @return void. + */ +void get_current_time(struct timeval *tv, struct tm *tm); + +/** + * @brief Restore the system time from the saved non-volatile + * @return void. + */ +void restore_time(void); + +/** + * @brief Synchronize the system time with the given timestamp and timezone + * @return void. + */ +uint32_t sync_time(uint32_t timestamp, uint32_t timezone); + +/** + * @brief use for test + * @return void. + */ +void test_time(void); + +/** + * @brief Get the current system time as a local timestamp with timezone offset + * @return void. + */ +uint32_t get_local_timestamp(void); +#endif +#endif \ No newline at end of file diff --git a/code/sdk/middleware/chips/brandy/exception/exception.h b/code/sdk/middleware/chips/brandy/exception/exception.h index ede22b684..77b5f48fd 100755 --- a/code/sdk/middleware/chips/brandy/exception/exception.h +++ b/code/sdk/middleware/chips/brandy/exception/exception.h @@ -519,6 +519,7 @@ errcode_t emmc_exc_info_write(void); #endif #endif void reset_deal_with_fs(void); +bool get_exception_status(void); /** * @} */ diff --git a/code/sdk/middleware/chips/brandy/exception/exception_dump.c b/code/sdk/middleware/chips/brandy/exception/exception_dump.c new file mode 100644 index 000000000..6d42aea84 --- /dev/null +++ b/code/sdk/middleware/chips/brandy/exception/exception_dump.c @@ -0,0 +1,99 @@ +/** + * Copyright (c) CompanyNameMagicTag 2023-2023. All rights reserved. + * Description: dump + * Author: + * Create: + */ +#include "exception_dump.h" +#include +#include +#include "exception.h" +#include "memory_config.h" +#include "time.h" +#include "sys/time.h" +#include "chip_io.h" +#ifdef CFG_DRIVERS_NANDFLASH +#include "nandflash_config.h" + +#define PSRAM_DUMP_TO_FILE_LENGTH 0x40000 // 256KB + +void exception_dump_memory_to_file(char *file_name, uint32_t dump_time, uintptr_t startAddr, uint32_t length) +{ + char *str = (char *)malloc(200); + memset_s(str, 200, 0, 200); + sprintf(str, file_name, dump_time); + exc_info_write(str, 0, (const uint8_t *)startAddr, length); +} + +typedef struct { + char *name; + uintptr_t start_addr; + uint32_t len; +} mem_dump_to_file_t; + +static const mem_dump_to_file_t g_mem_dump_to_file_info[] = { + {"/user/exc/APP_DTCM_ORIGIN_%d.bin", APP_DTCM_ORIGIN, APP_DTCM_LENGTH}, + {"/user/exc/MCPU_TRACE_MEM_REGION_%d.bin", MCPU_TRACE_MEM_REGION_START, CPU_TRACE_MEM_REGION_LENGTH}, + {"/user/exc/PSRAM_ORIGIN_%d.bin", PSRAM_APP_DATA_ADDR, PSRAM_DUMP_TO_FILE_LENGTH}, +}; + +void dump_mem_to_file(uint32_t time_sec) +{ + uint16_t count = (uint16_t)(sizeof(g_mem_dump_to_file_info) / sizeof(mem_dump_to_file_t)); + for (uint8_t i = 0; i < count; i++) { + exception_dump_memory_to_file(g_mem_dump_to_file_info[i].name, + time_sec, + g_mem_dump_to_file_info[i].start_addr, + g_mem_dump_to_file_info[i].len); + } +} +#endif + +#ifdef CFG_DUMP_REG_SUPPORT +char *g_regist_str = "[PMU1_B_SOC_PWR_EN_REG %x, %x]\r\n + [PMU1_BT_CBB_PWR_EN_REG %x, %x]\r\n + [PMU1_BMEM_PWR_EN_REG %x, %x]\r\n + [PMU1_BT_EM_PWR_EN_REG %x, %x]\r\n + [PMU1_MCU_HS_PWR_EN_REG %x, %x]\r\n + [PMU1_DSUB_PWR_EN_REG %x, %x]\r\n + [PMU1_ASUB_PWR_EN_REG %x, %x]\r\n + [PMU1_S_EGPIO_PWR_EN_REG %x, %x]\r\n + [PMU1_BT_RF_PWR_EN_REG %x, %x]\r\n + [PMU1_MCU_PWR_EN_REG %x, %x]\r\n + [PMU1_MEM_PWR_EN_REG %x, %x]\r\n + [PMU1_COM_PWR_EN_REG %x, %x]"; +static const char *g_reg_path = "/user/exc/reg_path%d.txt"; + +void dump_reg_to_file(uint32_t time_sec) +{ + char *file_name = (char *)malloc(100); + sprintf(file_name, g_reg_path, time_sec); + char *str = (char *)malloc(500); + uint32_t ctrl_base = 0x57004000; + sprintf(str, g_regist_str, + ctrl_base + 0x20, readl(ctrl_base + 0x20), + ctrl_base + 0x24, readl(ctrl_base + 0x24), + ctrl_base + 0x28, readl(ctrl_base + 0x28), + ctrl_base + 0x2c, readl(ctrl_base + 0x2c), + ctrl_base + 0x30, readl(ctrl_base + 0x30), + ctrl_base + 0x34, readl(ctrl_base + 0x34), + ctrl_base + 0x38, readl(ctrl_base + 0x38), + ctrl_base + 0x5c, readl(ctrl_base + 0x5c), + ctrl_base + 0x60, readl(ctrl_base + 0x60), + ctrl_base + 0x64, readl(ctrl_base + 0x64), + ctrl_base + 0x68, readl(ctrl_base + 0x68), + ctrl_base + 0x78, readl(ctrl_base + 0x78)); + exc_info_write(file_name, 0, (uint8_t *)str, strlen(str)); +} +#endif + +void dump_all_to_file(void) +{ + uint32_t timestamp = get_local_timestamp(); +#ifdef CFG_DRIVERS_NANDFLASH + dump_mem_to_file(timestamp); +#endif +#ifdef CFG_DUMP_REG_SUPPORT + dump_reg_to_file(timestamp); +#endif +} \ No newline at end of file diff --git a/code/sdk/middleware/chips/brandy/exception/exception_dump.h b/code/sdk/middleware/chips/brandy/exception/exception_dump.h new file mode 100644 index 000000000..e375ec13c --- /dev/null +++ b/code/sdk/middleware/chips/brandy/exception/exception_dump.h @@ -0,0 +1,16 @@ +/** + * Copyright (c) CompanyNameMagicTag 2023-2023. All rights reserved. + * Description: dump + * Author: + * Create: + */ +#ifndef EXCEPTION_DUMP_H +#define EXCEPTION_DUMP_H + +/** + * @brief support nandflash storage dump sysmem to file. + * @return void. + */ +void dump_all_to_file(void); + +#endif \ No newline at end of file diff --git a/code/sdk/middleware/chips/brandy/exception/exception_riscv.c b/code/sdk/middleware/chips/brandy/exception/exception_riscv.c index 5d9652d52..0a0e6d102 100755 --- a/code/sdk/middleware/chips/brandy/exception/exception_riscv.c +++ b/code/sdk/middleware/chips/brandy/exception/exception_riscv.c @@ -13,6 +13,8 @@ #include "non_os_reboot.h" #include "watchdog_porting.h" #include "flash.h" +#include "exception_dump.h" + #if defined(BUILD_APPLICATION_STANDARD) && !defined(BUILD_RECOVERY_IMAGE) #include "nv.h" #endif @@ -114,7 +116,7 @@ exc_info_t g_exc_info; static exc_nmi_stat_t g_exc_nmi_store; // Check whether the exception is repeated #if (CORE == MASTER_BY_ALL) && (CORE != WIFI) -static bool g_is_repeat_exc = false; +bool g_is_repeat_exc = false; #endif #if defined SAVE_EXC_INFO /* ifdef LOSCFG_EXC_SIMPLE_INFO g_xregs_map start from X4(instead of X0) to X31 */ @@ -137,12 +139,13 @@ static const char *g_exc_info_path = "/user/exc/exc_info.bin"; static volatile uint32_t g_bt_nmi_reboot = 0; static volatile uint32_t g_bt_nmi_mask = 0; #endif -#if MASTER_BY_BRANDY_ONLY -#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG 0x57000014 -#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL 0xb66 -#define PM_MCU_SEND_IPC_WKUP_BT_REG 0x52000034 -#define PM_MCU_SEND_IPC_WKUP_BT_BIT 0x1 -#endif + + +bool get_exception_status(void) +{ + return g_is_repeat_exc; +} + #if ((defined(BUILD_APPLICATION_STANDARD)) && (IS_MAIN_CORE == NO)) #include "ipc.h" @@ -827,6 +830,7 @@ static errcode_t exc_info_write_local(exc_info_save_t *exc_info_save, uint32_t e nand_driver_init(SPEED_SLOW); set_trans_type(TRANS_BY_CPU_SINGLE_LINE); ret = exc_info_write(g_exc_info_path, 0, (const uint8_t *)exc_info_save, exc_size); + dump_all_to_file(); #endif #ifdef CFG_DRIVERS_MMC char *exc_info_buffer = (char *)osal_kmalloc_align(ONE_SECTOR_SIZE, 0, MMC_BUFFER_ALIGN); @@ -915,7 +919,7 @@ void do_hard_fault_handler(exc_context_t *exc_buf_addr) uapi_flash_switch_to_xip_mode(CHIP_FLASH_ID); #if (CORE == MASTER_BY_ALL) && (CORE != WIFI) if (g_is_repeat_exc == true) { - cpu_utils_reset_chip_with_log((cores_t)MASTER_BY_ALL, REBOOT_CAUSE_APPLICATION_HARDFAULT); + cpu_utils_reset_chip_with_log((cores_t)MASTER_BY_ALL, REBOOT_CAUSE_APPLICATION_SECOND_FAULT); } /* If the process is restarted at the end of an abnormal process, the value of this variable is false. */ /* Do not need to manually set false at the end. */ @@ -953,7 +957,6 @@ void do_hard_fault_handler(exc_context_t *exc_buf_addr) cpu_utils_set_system_status_by_cause(reset_cause); #endif #endif - disable_watchdog(); hal_save_reg_info(exc_buf_addr); deal_with_exception(exc_buf_addr, exc_type, reset_cause); } @@ -974,11 +977,6 @@ void reset_deal_with_fs(void) static void deal_with_exception(exc_context_t *exc_buf_addr, uint32_t exc_type, reboot_cause_t reset_cause) { UNUSED(reset_cause); -#if MASTER_BY_BRANDY_ONLY - // when bt at sleep, need wkup bt before soft reset - writew(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG, PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL); - reg16_setbit(PM_MCU_SEND_IPC_WKUP_BT_REG, PM_MCU_SEND_IPC_WKUP_BT_BIT); -#endif #if defined(BUILD_APPLICATION_STANDARD) && (CORE == MASTER_BY_ALL) set_exception_time_stamp(); // Record the reason before wait, so apps can get the reason. @@ -998,6 +996,8 @@ static void deal_with_exception(exc_context_t *exc_buf_addr, uint32_t exc_type, #ifndef BUILD_APPLICATION_SSB reset_deal_with_fs(); #endif + /* 关狗操作一定要在reset之前 */ + disable_watchdog(); #if (CORE == MASTER_BY_ALL) && (CORE != WIFI) cpu_utils_reset_chip_with_log((cores_t)MASTER_BY_ALL, reset_cause); #endif diff --git a/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/acore/app.json b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json old mode 100755 new mode 100644 similarity index 86% rename from code/sdk/middleware/chips/brandy/nv/nv_config/cfg/acore/app.json rename to code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json index 1e6fff5e1..e71b83266 --- a/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/acore/app.json +++ b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json @@ -69,12 +69,12 @@ "key_status": "alive", "structure_type": "audio_vqe_param_t", "attributions": 1, - "value": [48, [0, 0, 0, 0, 16843009, 33554689, 16000, 16000, - 1024, 100, 1985229328, 1985229328, 16843009, 257, 257, 256, - 16778116, 1280, 4, 0, 458824, 11796580, 327946, 196608005, - 65576964, 1000, 21499085, 67108874, 327680, 655367, 2126009683, - 654734439, 1, 0, 0, 0, 0, 0, 10551292, 655336, 4286447619, 64536, - 500, 16384, 3277, 0, 66049, 0]] + "value": [48, [0, 0, 0, 0, 16843009, 33620225, 16000, 16000, + 1024, 100, 0, 0, 16842753, 257, 257, 256, + 16778116, 16844032, 4, 0, 458824, 11796580, 327946, 1310720005, + 65576964, 1000, 21499085, 67108874, 327680, 655367, 2126009683, 654734439, + 1, 0, 0, 0, 0, 0, 5308380, 655336, + 4286447619, 64536, 500, 16384, 3277, 0, 66049, 0]] }, "audio_vqe_kws_param":{ "key_id": "0x320D", @@ -87,17 +87,6 @@ 65576964, 1000, 679102459, 67108874, 327680, 655367, 2126009683, 654734439, 1, 0, 0, 0, 0, 0, 10551272, 655336, 4286447619, 64536, 500, 16384, 3277, 0, 66049, 0]] - }, - "custom_key_serial_num":{ - "key_id": "0x1010", - "key_status": "alive", - "structure_type": "custom_key_sn_t", - "attributions": 4, - "value": [32, - [0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0]] } } } diff --git a/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/user/acore/app.json b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/user/acore/app.json new file mode 100644 index 000000000..11a5df878 --- /dev/null +++ b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/user/acore/app.json @@ -0,0 +1,92 @@ +{ + "common":{ + "module_id": "0x0", + "secure_conn":{ + "key_id": "0x2001", + "key_status": "alive", + "structure_type": "ext_nv_secure_conn_t", + "attributions": 1, + "value": [[ + 243, 241, 252, 189, 233, 154, 35, 34, 155, 96, 183, 133, 229, 196, 190, 222, 180, 146, 211, 63, + 59, 38, 229, 100, 24, 165, 216, 53, 120, 133, 104, 166, 31, 6, 220, 125, 87, 47, 131, 42, 74, + 240, 107, 111, 146, 239, 251, 229, 146, 99, 46, 4, 38, 183, 99, 2, 47, 215, 88, 151, 178, 198, + 148, 222, 135, 2, 156, 203, 192, 138, 178, 118, 6, 110, 40, 38, 235, 31, 220, 118, 53, 75, 152, + 32, 246, 4, 225, 131, 242, 96, 176, 20, 131, 184, 39, 88, 96, 7, 205, 231, 158, 10, 136, 178, + 32, 19, 156, 88, 133, 93, 18, 251, 35, 146, 58, 83, 25, 188, 84, 151, 99, 38, 102, 48, 240, 214, + 157, 197, 88, 160, 224, 71, 174, 4, 216, 234, 117, 87, 53, 132, 204, 99, 62, 201, 61, 116, 186, + 29, 201, 172, 140, 176, 226, 123, 55, 95, 18, 197, 30, 244, 19, 143, 112, 12, 29, 162, 188, 208, + 48, 242, 108, 76, 170, 139, 140, 198, 177, 233, 251, 57, 91, 10, 70, 117, 231, 226, 67, 26, 55, + 249, 144, 165, 75, 125, 215, 220, 190, 199, 116, 40, 221, 0, 17, 90, 25, 11, 47, 177, 255, 218, + 153, 254, 127, 237, 211, 170, 174, 104, 76, 47, 136, 193, 0, 147, 157, 74, 213, 180, 143, 240, + 173, 98, 90, 27, 30, 213, 217, 247, 50, 147, 202, 224, 54, 147, 34, 19, 177, 128, 27, 123, 101, + 242, 36, 68, 71, 184, 62, 166, 134, 86, 98, 216, 120, 123, 191, 49, 135, 105, 187, 38, 241, 125, + 26, 80, 141, 151, 222, 240, 253, 115, 102, 86, 118, 153, 214, 4, 209, 186, 110, 50, 105, 194, + 100, 125, 242, 51, 117, 118, 107, 164, 133, 229, 157, 221, 114, 121, 152, 204, 57, 119, 176, + 167, 75, 208, 156, 243, 138, 176, 50, 102, 121, 69, 22, 21, 225, 41, 216, 247, 133, 47, 129, 74, + 20, 79, 236, 42, 38, 134, 68, 224, 200, 42, 223, 23, 191, 88, 221, 31, 133, 145, 171, 46, 98, 4, + 202, 160, 0, 89, 222, 92, 67, 160, 163, 185, 52, 70, 129, 62, 112, 1, 223, 187, 218, 241, 25, + 215, 129, 196, 249, 32, 201, 96, 249, 165 + ], + [15,238,119,231,29,44,120,58,55,14,80,125,220,227,124,8,39,0,104,162],20] + }, + "offline_enable_flag":{ + "key_id": "0x2002", + "key_status": "alive", + "structure_type": "uint8_t", + "attributions": 1, + "value": 1 + }, + "btsrv_local_device_info":{ + "key_id": "0x2101", + "key_status": "alive", + "structure_type": "btsrv_local_device_info_t", + "attributions": 1, + "value": [[40,17,6,133,105, 89],0,0,["W","a","t","c","h","D","e","m","o",0]] + }, + "btsrv_paired_device_info":{ + "key_id": "0x2102", + "key_status": "alive", + "structure_type": "btsrv_paired_device_info_t", + "attributions": 1, + "value": [0] + }, + "btsrv_tx_power_info":{ + "key_id": "0x2103", + "key_status": "", + "structure_type": "btsrv_calibration_config_t", + "attributions": 1, + "value": [8,[75,75,75,75,55,55,95,95],[2,15,27,31,41,51,66,77],[-28,1818,-6745],0,14,14,14,12,0,0,0,0] + }, + "bth_host_config": { + "key_id": "0x2104", + "key_status": "alive", + "structure_type": "bth_product_data_config_t", + "attributions": 1, + "value": [0] + }, + "audio_vqe_param":{ + "key_id": "0x320C", + "key_status": "alive", + "structure_type": "audio_vqe_param_t", + "attributions": 1, + "value": [48, [0, 0, 0, 0, 16843009, 33620225, 16000, 16000, + 1024, 100, 0, 0, 16842753, 257, 257, 256, + 16778116, 16844032, 4, 0, 458824, 11796580, 327946, 1310720005, + 65576964, 1000, 21499085, 67108874, 327680, 655367, 2126009683, 654734439, + 1, 0, 0, 0, 0, 0, 5308380, 655336, + 4286447619, 64536, 500, 16384, 3277, 0, 66049, 0]] + }, + "audio_vqe_kws_param":{ + "key_id": "0x320D", + "key_status": "alive", + "structure_type": "audio_vqe_param_t", + "attributions": 1, + "value": [48, [0, 0, 0, 0, 16843009, 33554689, 16000, 16000, + 1024, 100, 1985229328, 1985229328, 16843009, 257, 257, 256, + 16778116, 1280, 4, 0, 458824, 11796580, 327690, 13107205, + 65576964, 1000, 679102459, 67108874, 327680, 655367, 2126009683, + 654734439, 1, 0, 0, 0, 0, 0, 10551272, 655336, 4286447619, 64536, + 500, 16384, 3277, 0, 66049, 0]] + } + } +} diff --git a/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h b/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h index 16c84a7e4..d8b0f2ba8 100755 --- a/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h +++ b/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h @@ -39,6 +39,8 @@ typedef enum { PM_ID_STORAGE, PM_ID_TOUCH, PM_ID_JPEG, + PM_ID_JS, + PM_ID_MSGCENTER, PM_ID_HEART,//新增,心率芯片 PM_ID_MOTOR,//新增,马达 PM_ID_GSENSOR,//新增,加速计 diff --git a/code/sdk/middleware/chips/brandy/pm/pm_adapt/pm_core.c b/code/sdk/middleware/chips/brandy/pm/pm_adapt/pm_core.c index 959d333eb..a67bea2b1 100755 --- a/code/sdk/middleware/chips/brandy/pm/pm_adapt/pm_core.c +++ b/code/sdk/middleware/chips/brandy/pm/pm_adapt/pm_core.c @@ -144,6 +144,8 @@ void pm_core_suspend(void) g_frs_sleep_flag = 0; } display_suspend_power_off(); + hal_pmu1_dig_pg_l2m_gmmu_ret1_en(true); // The GMMU memory is set to the retention state. + hal_pmu1_dig_pg_l2m_gmmu_pwr_en(false); #endif storage_device_suspend(); opi_psram_suspend_tmp(); @@ -225,8 +227,8 @@ void pm_core_resume_min(void) clocks_system_resume_clock(); uapi_dma_init(); uapi_dma_open(); + cpu_trace_enable_mcpu_repeat(); storage_device_resume(); - reg16_setbit(0x520003e4, 0x0); // set mcpu_clken_slp in MSUB_SLP_CFG reg16_setbit(0x520003e4, 0x1); // set mcpu_hclken_slp in MSUB_SLP_CFG clocks_auto_cg_config(); @@ -272,6 +274,8 @@ void pm_core_resume(void) uapi_dma_open(); storage_device_resume(); #if defined(ENABLE_UIKIT) || defined(ENABLE_LVGL) + hal_pmu1_dig_pg_l2m_gmmu_pwr_en(true); // The GMMU memory is set to the normal state. + hal_pmu1_dig_pg_l2m_gmmu_ret1_en(false); if (lcd_get_status() != 0) { display_resume_tmp(); } diff --git a/code/sdk/middleware/chips/brandy/pm/pm_adapt/pm_lp_stub.c b/code/sdk/middleware/chips/brandy/pm/pm_adapt/pm_lp_stub.c index e54d5438a..e0af7a89f 100755 --- a/code/sdk/middleware/chips/brandy/pm/pm_adapt/pm_lp_stub.c +++ b/code/sdk/middleware/chips/brandy/pm/pm_adapt/pm_lp_stub.c @@ -48,9 +48,6 @@ #define PLL_CLK_VALUE 884736000 #define PM_SDIOM_CLK_REG 0x55000628 #define PM_EMMC_DIV_REG 0x52000120 -#define PM_DISPLAY_LOGIC_CRG_RESET 0x570000c0 -#define PM_DISPLAY_PWR_EN_CFG 0x57004034 -#define PM_DISPLAY_PWR_CLOSE_POWER 0x100 static uint32_t g_uart_h0_regs_tmp[UART_SUSPEND_REGS_NUM]; static uint32_t g_uart_h1_regs_tmp[UART_SUSPEND_REGS_NUM]; @@ -353,8 +350,6 @@ void display_suspend_tmp(void) pmu_ldo_power_on(PMU_LDO_AUXLDO3, TURN_OFF); hal_pmu_auxldo_enable_high_resistance(HAL_PMU_AUXLDO3, TURN_ON); #endif - writew(PM_DISPLAY_LOGIC_CRG_RESET, 0x0); // display logic crg reset - writew(PM_DISPLAY_PWR_EN_CFG, PM_DISPLAY_PWR_CLOSE_POWER); // display close power } void display_resume_tmp(void) diff --git a/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c b/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c index 71da1bbda..4d58f1861 100755 --- a/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c +++ b/code/sdk/middleware/chips/brandy/pm/service/pm_sleep.c @@ -30,11 +30,6 @@ #define PM_SLEEP_SEL_EVENT 0x777 #define PM_SLEEP_TRACE_DEF_VAL 0x5a5a #define PM_OS_US_TO_MS 1000 -#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG 0x57000014 -#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL 0xb66 -#define PM_MCU_SEND_IPC_WKUP_BT_REG 0x52000034 -#define PM_MCU_SEND_IPC_WKUP_BT_VAL 0x2 -#define BT_RESET_DELAY 10 enum { PM_SLEEP_STATE_IDLE, @@ -176,9 +171,6 @@ void pm_enter_deep_sleep_wfi(void) void pm_wkup_event_by_ulp_callback(void) { - writew(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG, PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL); - writew(PM_MCU_SEND_IPC_WKUP_BT_REG, PM_MCU_SEND_IPC_WKUP_BT_VAL); - uapi_tcxo_delay_ms(BT_RESET_DELAY); set_cpu_utils_reset_cause(REBOOT_CAUSE_APPLICATION_SYSRESETREQ); hal_reboot_chip(); } diff --git a/code/sdk/middleware/chips/brandy/update/common/upg_common_porting.c b/code/sdk/middleware/chips/brandy/update/common/upg_common_porting.c index 524e6708c..b414a90f0 100755 --- a/code/sdk/middleware/chips/brandy/update/common/upg_common_porting.c +++ b/code/sdk/middleware/chips/brandy/update/common/upg_common_porting.c @@ -31,11 +31,6 @@ #define MS_ID_ADDR 0xF8 #define CHIP_ID_ADDR OTP_CHIP_ID_START -#define TCXO_REBOOT_DELAY 500ULL -#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG 0x57000014 -#define PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL 0xb66 -#define PM_MCU_SEND_IPC_WKUP_BT_REG 0x52000034 -#define PM_MCU_SEND_IPC_WKUP_BT_VAL 0x2 #define SUB_RSA4096_PUBKEY_N_OFFSET 24 #define uapi_array_size(_array) (sizeof(_array) / sizeof((_array)[0])) @@ -187,11 +182,6 @@ errcode_t upg_get_fota_partiton_area_addr(uint32_t *start_address, uint32_t *siz */ void upg_reboot(void) { - // when bt at sleep, need wkup bt before soft reset - writew(PM_SLEEP_SOFT_RESET_FORCE_WKUP_REG, PM_SLEEP_SOFT_RESET_FORCE_WKUP_VAL); - writew(PM_MCU_SEND_IPC_WKUP_BT_REG, PM_MCU_SEND_IPC_WKUP_BT_VAL); - /* 重启前睡眠500ms */ - uapi_tcxo_delay_ms((uint64_t)TCXO_REBOOT_DELAY); cpu_utils_set_system_status_by_cause(REBOOT_CAUSE_UPG_COMPLETION); hal_reboot_chip(); } diff --git a/code/sdk/middleware/services/gpu/api/jpeg/src/soc_jpeg_api.c b/code/sdk/middleware/services/gpu/api/jpeg/src/soc_jpeg_api.c index 5c1a5f393..a5a267e97 100755 --- a/code/sdk/middleware/services/gpu/api/jpeg/src/soc_jpeg_api.c +++ b/code/sdk/middleware/services/gpu/api/jpeg/src/soc_jpeg_api.c @@ -435,16 +435,15 @@ td_void uapi_jpeg_decompress_destroy(jpeg_decompress_ptr dinfo) jpeg_exif_deinit(par); - mem.vir_buf = (td_char *)dinfo->private_data; - jpeg_mem_free_small(&mem); - - dinfo->private_data = TD_NULL; - td_s32 ret = jpeg_ioctl(par->dev_fd, DRV_JPEG_CMD_DESTROY, TD_NULL); if (ret != EXT_SUCCESS) { jpeg_err("call ioctl destroy failure"); - return; } + mem.vir_buf = (td_char *)dinfo->private_data; + jpeg_mem_free_small(&mem); + + dinfo->private_data = TD_NULL; + return; } diff --git a/code/sdk/middleware/services/gpu/api/vau/draw/vau_draw.c b/code/sdk/middleware/services/gpu/api/vau/draw/vau_draw.c index 4185740d4..4f3fb54d6 100755 --- a/code/sdk/middleware/services/gpu/api/vau/draw/vau_draw.c +++ b/code/sdk/middleware/services/gpu/api/vau/draw/vau_draw.c @@ -184,6 +184,11 @@ static td_s32 vau_draw_make_path(const ext_vau_path *path, vau_hardware_node *no vau_err("path should start width move to abs, now:%u", path->cmds[0]); return EXT_ERR_GFX_INVALID_PARAM; } + if (uapi_is_byte_align((td_u32)(uintptr_t)path->datas, 4) != TD_TRUE) { // need 4 byte align + vau_err("path data addr align err"); + return EXT_ERR_GFX_INVALID_ADDR; + } + td_bool is_internal_buff = vau_mem_is_internal(VAU_MEM_TYPE_PATH_CMD, path->cmds); if (is_internal_buff == TD_TRUE) { vau_mem_ref_inc(VAU_MEM_TYPE_PATH_CMD, path->cmds); diff --git a/code/sdk/middleware/services/gpu/drv/dpu/hal/dpu_hal.c b/code/sdk/middleware/services/gpu/drv/dpu/hal/dpu_hal.c index 418dcd190..18775ee76 100755 --- a/code/sdk/middleware/services/gpu/drv/dpu/hal/dpu_hal.c +++ b/code/sdk/middleware/services/gpu/drv/dpu/hal/dpu_hal.c @@ -30,7 +30,6 @@ static td_void dpu_hal_reg_unmap(void) { if (g_dpu_reg != TD_NULL) { osal_iounmap((void *)g_dpu_reg, sizeof(dpu_regs_type)); - g_dpu_reg = TD_NULL; } return; } diff --git a/code/sdk/middleware/services/gpu/drv/dpu/intf/drv_dpu_intf.c b/code/sdk/middleware/services/gpu/drv/dpu/intf/drv_dpu_intf.c index f2991bfe9..76d758040 100755 --- a/code/sdk/middleware/services/gpu/drv/dpu/intf/drv_dpu_intf.c +++ b/code/sdk/middleware/services/gpu/drv/dpu/intf/drv_dpu_intf.c @@ -14,6 +14,7 @@ #include "dpu_qspi.h" static td_bool g_is_qspi = TD_FALSE; +static td_bool g_dpu_suspend_flag = TD_FALSE; #define DRV_DPU_IOCTL_CMD_NUM 20 @@ -31,6 +32,16 @@ static td_s32 drv_dpu_close(td_void *private_data) return EXT_SUCCESS; } +static td_void drv_dpu_set_suspend_flag(td_bool flag) +{ + unsigned long flags = 0; + dpu_disp_info *disp_info = dpu_disp_get_info(); + + osal_spin_lock_irqsave(&disp_info->disp_lock, &flags); + g_dpu_suspend_flag = flag; + osal_spin_unlock_irqrestore(&disp_info->disp_lock, &flags); +} + td_s32 drv_dpu_suspend(td_void *private_data) { uapi_unused(private_data); @@ -39,15 +50,18 @@ td_s32 drv_dpu_suspend(td_void *private_data) return EXT_SUCCESS; } + td_s32 ret = dpu_wait_all_finish(); + dpu_dfx_info *dfx_info = dpu_dfx_get_info(); dfx_info->suspend_cnt++; dpu_dbg("dpu suspend start"); dpu_hal_deinit(); dpu_layer_suspend(); + drv_dpu_set_suspend_flag(TD_TRUE); dpu_dbg("dpu suspend ok"); - return EXT_SUCCESS; + return ret; } td_s32 drv_dpu_resume(td_void *private_data) @@ -65,6 +79,7 @@ td_s32 drv_dpu_resume(td_void *private_data) dpu_hal_init(); dpu_layer_resume(); dpu_disp_chl_cfg(); + drv_dpu_set_suspend_flag(TD_FALSE); dpu_dbg("dpu resume ok"); return EXT_SUCCESS; @@ -137,6 +152,11 @@ td_s32 dpu_ioctl(td_s32 module_idx, td_ulong ioctl_cmd, td_void *para) return EXT_FAILURE; } + if (g_dpu_suspend_flag == TD_TRUE) { + dpu_err("dpu is in suspend state!, suspend_flag = %u", g_dpu_suspend_flag); + return EXT_FAILURE; + } + if (g_is_qspi == TD_TRUE) { return dpu_qspi_ioctl(ioctl_cmd, para); } diff --git a/code/sdk/middleware/services/gpu/drv/dpu/isr/dpu_isr.c b/code/sdk/middleware/services/gpu/drv/dpu/isr/dpu_isr.c index e0cef8e1e..03446a407 100755 --- a/code/sdk/middleware/services/gpu/drv/dpu/isr/dpu_isr.c +++ b/code/sdk/middleware/services/gpu/drv/dpu/isr/dpu_isr.c @@ -151,10 +151,13 @@ td_void dpu_isr_deinit(void) td_void dpu_isr_wait_finish(void) { td_s32 ret; + dpu_dfx_info *dfx_info = dpu_dfx_get_info(); ret = osal_wait_timeout_interruptible(&g_dpu_isr_info.finish_event, isr_get_finish_done, TD_NULL, 500); /* 500 ms */ if (ret <= 0) { + dfx_info->refresh_total = 0; + dfx_info->frm_done_total = 0; dpu_err("osal_wait_timeout!!!!"); return; } @@ -182,3 +185,26 @@ td_void dpu_isr_clear_finish_flag(void) { g_dpu_isr_info.finish_done = 0; } + +td_s32 dpu_wait_all_finish(td_void) +{ + unsigned long flag = 0; + dpu_dfx_info *dfx_info = dpu_dfx_get_info(); + const td_u32 wait_time = 200; + td_u32 cnt = 0; + + while (cnt++ < wait_time) { + osal_spin_lock_irqsave(&g_dpu_isr_info.isr_lock, &flag); + if (dfx_info->refresh_total == dfx_info->frm_done_total) { + osal_spin_unlock_irqrestore(&g_dpu_isr_info.isr_lock, &flag); + break; + } + osal_spin_unlock_irqrestore(&g_dpu_isr_info.isr_lock, &flag); + osal_udelay(100); // 100us + } + if (cnt >= wait_time) { + dpu_err("dpu_wait_all_finish timeout!!!!"); + return EXT_FAILURE; + } + return EXT_SUCCESS; +} diff --git a/code/sdk/middleware/services/gpu/drv/dpu/isr/dpu_isr.h b/code/sdk/middleware/services/gpu/drv/dpu/isr/dpu_isr.h index b8ab24189..4dedbc677 100755 --- a/code/sdk/middleware/services/gpu/drv/dpu/isr/dpu_isr.h +++ b/code/sdk/middleware/services/gpu/drv/dpu/isr/dpu_isr.h @@ -21,6 +21,7 @@ td_void dpu_isr_deinit(void); td_void dpu_isr_wait_finish(void); td_void dpu_isr_wait_te_signal(void); td_void dpu_isr_clear_finish_flag(void); +td_s32 dpu_wait_all_finish(td_void); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c b/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c index f94c87b2c..b02f22877 100755 --- a/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c +++ b/code/sdk/middleware/services/gpu/drv/dpu/layer/dpu_layer.c @@ -91,8 +91,6 @@ static td_void dpu_layer_set_run_info(dpu_layer_run_info *run_info, const drv_dp run_info->global_alpha = 0xFF; run_info->width = layer_info->width; run_info->height = layer_info->height; - run_info->stride = 0; - run_info->current_addr = 0; run_info->fmt = layer_info->layer_fmt; run_info->premulti_en = 0; run_info->compress_mode = layer_info->compress_mode; @@ -180,6 +178,16 @@ static td_void dpu_layer_yuv_base_config(dpu_layer_dev *layer_dev) yuv_info.uv_stride = layer_dev->canvas_surface.uv_stride; yuv_info.uv_offset = layer_dev->canvas_surface.uv_offset; + /* soft support yuv crop */ + if (layer_dev->run_info.crop_rect.y != 0) { + yuv_info.y_addr += (td_u32)layer_dev->run_info.crop_rect.y * yuv_info.uv_stride; + yuv_info.uv_offset -= (td_u32)layer_dev->run_info.crop_rect.y * yuv_info.uv_stride / 2; /* 2:index */ + + layer_dev->run_info.crop_rect.y = 0; + dpu_hal_layer_set_crop_rect(layer_dev->layer_id, &layer_dev->run_info.crop_rect); + } + + dpu_hal_layer_set_addr(layer_dev->layer_id, yuv_info.y_addr); dpu_hal_layer_set_yuv_base_info(layer_dev->layer_id, &yuv_info); return; @@ -283,17 +291,14 @@ static td_void dpu_layer_calculate_gp_region(ext_rect *gp_region) td_s32 start_y = (td_s32)screen_height; for (td_u32 layer_id = 0; layer_id <= (td_u32)DRV_DPU_MAX_LAYER_ID; layer_id++) { - if (g_dpu_layer_dev[layer_id] == TD_NULL) { - continue; - } - - if (g_dpu_layer_dev[layer_id]->is_create != TD_TRUE) { + if ((g_dpu_layer_dev[layer_id] == TD_NULL) || (g_dpu_layer_dev[layer_id]->is_create != TD_TRUE)) { continue; } dpu_layer_run_info *run_info = &g_dpu_layer_dev[layer_id]->run_info; - /* if exists full screen layer, gp_reion is full */ - if ((run_info->update_region.width == screen_width) && (run_info->update_region.height == screen_height)) { + /* if exists full screen layer or g1, gp_reion is full */ + if (((run_info->update_region.width == screen_width) && (run_info->update_region.height == screen_height)) || + (layer_id == DRV_DPU_LAYER_ID2)) { gp_region->x = 0; gp_region->y = 0; gp_region->width = screen_width; diff --git a/code/sdk/middleware/services/gpu/drv/gmmu/intf/drv_gmmu_intf.c b/code/sdk/middleware/services/gpu/drv/gmmu/intf/drv_gmmu_intf.c index 408234f56..f5a72e786 100755 --- a/code/sdk/middleware/services/gpu/drv/gmmu/intf/drv_gmmu_intf.c +++ b/code/sdk/middleware/services/gpu/drv/gmmu/intf/drv_gmmu_intf.c @@ -119,6 +119,11 @@ td_s32 gmmu_ioctl(td_s32 module_idx, td_ulong ioctl_cmd, td_void *para) return EXT_FAILURE; } + if (g_gmmu_suspend_flag == TD_TRUE) { + gmmu_err("gmmu is in suspend state!, suspend_flag = %u", g_gmmu_suspend_flag); + return EXT_FAILURE; + } + if ((ioctl_cmd == DRV_GMMU_CMD_CONFIG) && (para != TD_NULL)) { g_gmmu_suspend_mgr = *(drv_gmmu_mgr *)para; } diff --git a/code/sdk/middleware/services/gpu/drv/jpeg/dev/jpeg_dev.c b/code/sdk/middleware/services/gpu/drv/jpeg/dev/jpeg_dev.c index 848bd8c03..2ba04ef1e 100755 --- a/code/sdk/middleware/services/gpu/drv/jpeg/dev/jpeg_dev.c +++ b/code/sdk/middleware/services/gpu/drv/jpeg/dev/jpeg_dev.c @@ -80,16 +80,14 @@ td_s32 jpeg_dev_close(td_void) return EXT_SUCCESS; } -td_s32 jpeg_suspend(td_void) +td_void jpeg_suspend(td_void) { jpeg_clock_reset(); jpeg_clock_close(); - return EXT_SUCCESS; } -td_s32 jpeg_resume(td_void) +td_void jpeg_resume(td_void) { jpeg_clock_open(); jpeg_clock_dereset(); - return EXT_SUCCESS; } diff --git a/code/sdk/middleware/services/gpu/drv/jpeg/dev/jpeg_dev.h b/code/sdk/middleware/services/gpu/drv/jpeg/dev/jpeg_dev.h index 80db2550e..e0f6adb87 100755 --- a/code/sdk/middleware/services/gpu/drv/jpeg/dev/jpeg_dev.h +++ b/code/sdk/middleware/services/gpu/drv/jpeg/dev/jpeg_dev.h @@ -22,8 +22,8 @@ extern "C" { td_s32 jpeg_dev_open(td_void); td_s32 jpeg_dev_close(td_void); -td_s32 jpeg_suspend(td_void); -td_s32 jpeg_resume(td_void); +td_void jpeg_suspend(td_void); +td_void jpeg_resume(td_void); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/middleware/services/gpu/drv/jpeg/dfx/jpeg_dfx.h b/code/sdk/middleware/services/gpu/drv/jpeg/dfx/jpeg_dfx.h index b4268d12e..02439a845 100755 --- a/code/sdk/middleware/services/gpu/drv/jpeg/dfx/jpeg_dfx.h +++ b/code/sdk/middleware/services/gpu/drv/jpeg/dfx/jpeg_dfx.h @@ -50,6 +50,8 @@ typedef struct { td_float start_cost; td_float get_status_cost; td_float init_cost; + td_u32 create_cnt; + td_u32 destroy_cnt; } drv_jpeg_dfx_info; diff --git a/code/sdk/middleware/services/gpu/drv/jpeg/intf/drv_jpeg_intf.c b/code/sdk/middleware/services/gpu/drv/jpeg/intf/drv_jpeg_intf.c index 00d4ca805..de4d1156b 100755 --- a/code/sdk/middleware/services/gpu/drv/jpeg/intf/drv_jpeg_intf.c +++ b/code/sdk/middleware/services/gpu/drv/jpeg/intf/drv_jpeg_intf.c @@ -17,6 +17,7 @@ #define DRV_JPEG_IOCTL_CMD_NUM 5 +static td_bool g_jpeg_suspend_flag = TD_FALSE; /*-------------------------------- func declares ------------------------------------------*/ static td_s32 drv_jpeg_open(td_void *private_data); @@ -68,18 +69,33 @@ static td_s32 drv_jpeg_close(td_void *private_data) return EXT_SUCCESS; } +static td_void drv_jpeg_set_suspend_flag(td_bool flag) +{ + unsigned long flags = 0; + drv_jpeg_context *jpeg_context = jpeg_context_get(); + + osal_spin_lock_irqsave(&jpeg_context->lock, &flags); + g_jpeg_suspend_flag = flag; + osal_spin_unlock_irqrestore(&jpeg_context->lock, &flags); +} + td_s32 drv_jpeg_suspend(td_void *private_data) { uapi_unused(private_data); - - return jpeg_suspend(); + + td_s32 ret = jpeg_wait_all_finish(); + jpeg_suspend(); + drv_jpeg_set_suspend_flag(TD_TRUE); + return ret; } td_s32 drv_jpeg_resume(td_void *private_data) { uapi_unused(private_data); - return jpeg_resume(); + jpeg_resume(); + drv_jpeg_set_suspend_flag(TD_FALSE); + return EXT_SUCCESS; } td_s32 jpeg_open(const td_char *path_name, td_s32 flags, td_s32 mode) @@ -107,6 +123,11 @@ td_s32 jpeg_ioctl(td_s32 module_idx, td_ulong ioctl_cmd, td_void *para) return EXT_FAILURE; } + if (g_jpeg_suspend_flag == TD_TRUE) { + jpeg_err("jpeg is in suspend state!, suspend_flag = %u", g_jpeg_suspend_flag); + return EXT_FAILURE; + } + return (td_s32)g_jpeg_ioctl_cmd_list[ioctl_cmd].handler((td_u32)ioctl_cmd, para, TD_NULL); } diff --git a/code/sdk/middleware/services/gpu/drv/jpeg/ioctl/jpeg_ioctl.c b/code/sdk/middleware/services/gpu/drv/jpeg/ioctl/jpeg_ioctl.c index d000e458b..c76b33a96 100755 --- a/code/sdk/middleware/services/gpu/drv/jpeg/ioctl/jpeg_ioctl.c +++ b/code/sdk/middleware/services/gpu/drv/jpeg/ioctl/jpeg_ioctl.c @@ -275,6 +275,8 @@ td_s32 jpeg_ioctl_decomress_create(td_u32 cmd, td_void *arg, td_void *file) uapi_unused(file); uapi_unused(arg); + drv_jpeg_dfx_info *jpeg_dfx_info = jpeg_dfx_get_info(); + jpeg_dfx_info->create_cnt++; uapi_pm_add_sleep_veto(PM_ID_JPEG); return EXT_SUCCESS; } @@ -285,6 +287,8 @@ td_s32 jpeg_ioctl_decompress_destroy(td_u32 cmd, td_void *arg, td_void *file) uapi_unused(file); uapi_unused(arg); + drv_jpeg_dfx_info *jpeg_dfx_info = jpeg_dfx_get_info(); + jpeg_dfx_info->destroy_cnt++; uapi_pm_remove_sleep_veto(PM_ID_JPEG); return EXT_SUCCESS; } diff --git a/code/sdk/middleware/services/gpu/drv/jpeg/isr/jpeg_isr.c b/code/sdk/middleware/services/gpu/drv/jpeg/isr/jpeg_isr.c index 040d5ef6f..2f7babb90 100755 --- a/code/sdk/middleware/services/gpu/drv/jpeg/isr/jpeg_isr.c +++ b/code/sdk/middleware/services/gpu/drv/jpeg/isr/jpeg_isr.c @@ -54,3 +54,27 @@ td_s32 jpeg_isr_init(td_void) return EXT_SUCCESS; } + +td_s32 jpeg_wait_all_finish(td_void) +{ + unsigned long flag = 0; + drv_jpeg_dfx_info *dfx_info = jpeg_dfx_get_info(); + const td_u32 wait_time = 200; + td_u32 cnt = 0; + drv_jpeg_context *jpeg_context = jpeg_context_get(); + + while (cnt++ < wait_time) { + osal_spin_lock_irqsave(&jpeg_context->lock, &flag); + if (dfx_info->create_cnt == dfx_info->destroy_cnt) { + osal_spin_unlock_irqrestore(&jpeg_context->lock, &flag); + break; + } + osal_spin_unlock_irqrestore(&jpeg_context->lock, &flag); + osal_udelay(100); // 100us + } + if (cnt >= wait_time) { + jpeg_err("jpeg_wait_all_finish timeout"); + return EXT_FAILURE; + } + return EXT_SUCCESS; +} diff --git a/code/sdk/middleware/services/gpu/drv/jpeg/isr/jpeg_isr.h b/code/sdk/middleware/services/gpu/drv/jpeg/isr/jpeg_isr.h index dd887f623..edc95d08d 100755 --- a/code/sdk/middleware/services/gpu/drv/jpeg/isr/jpeg_isr.h +++ b/code/sdk/middleware/services/gpu/drv/jpeg/isr/jpeg_isr.h @@ -15,6 +15,7 @@ extern "C" { #endif td_s32 jpeg_isr_init(td_void); +td_s32 jpeg_wait_all_finish(td_void); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/middleware/services/gpu/drv/vau/dfx/vau_dfx.c b/code/sdk/middleware/services/gpu/drv/vau/dfx/vau_dfx.c index fc41f483d..d2ea85af5 100755 --- a/code/sdk/middleware/services/gpu/drv/vau/dfx/vau_dfx.c +++ b/code/sdk/middleware/services/gpu/drv/vau/dfx/vau_dfx.c @@ -30,7 +30,7 @@ typedef struct { static td_s32 vau_dfx_help(int argc, const char *argv[]); static inline td_void vau_dfx_print_func_info(void); -static inline td_void vau_dfx_print_func_time_info(void); +static td_void vau_dfx_print_func_time_info(void); static td_void vau_dfx_print_func_cnt_info(void); /*-------------------------------- par define ---------------------------------------------*/ @@ -79,8 +79,10 @@ static inline td_void vau_dfx_print_func_info(td_void) vau_print("end func info: ------------------------------------\n"); } -static inline td_void vau_dfx_print_func_time_info(td_void) +static td_void vau_dfx_print_func_time_info(td_void) { + uapi_reg_read(HAL_VAU_LIST_PFCNT, g_vau_dfx_info.func_info.time_info.list_pfcnt); + vau_print("-----------time info-----------\n"); vau_print("create_cost(us) :%u\n", (td_u32)(g_vau_dfx_info.func_info.time_info.create_cost)); vau_print("destroy_cost(us) :%u\n", (td_u32)(g_vau_dfx_info.func_info.time_info.destroy_cost)); diff --git a/code/sdk/middleware/services/gpu/drv/vau/hal/vau_hal_apb.c b/code/sdk/middleware/services/gpu/drv/vau/hal/vau_hal_apb.c index 1284292f8..2b10d0c56 100755 --- a/code/sdk/middleware/services/gpu/drv/vau/hal/vau_hal_apb.c +++ b/code/sdk/middleware/services/gpu/drv/vau/hal/vau_hal_apb.c @@ -227,7 +227,7 @@ td_void vau_hal_apb_vector_draw_init(td_void) u_vau_draw_cvrg_weight1 weight1; quad.bits.threshold_quad = 0.125; /* 0.125 : default threshold for quad split */ - cubic.bits.threshold_cubic = 0.125; /* 0.125 : default threshold for cubic split */ + cubic.bits.threshold_cubic = 1.0f; /* 0.125 : default threshold for cubic split */ weight0.bits.weight0 = 32; /* 32 default weithg for 8x */ weight0.bits.weight1 = 32; /* 32 default weithg for 8x */ diff --git a/code/sdk/middleware/services/gpu/drv/vau/intf/drv_vau_intf.c b/code/sdk/middleware/services/gpu/drv/vau/intf/drv_vau_intf.c index 5d9c2a12f..b40575693 100755 --- a/code/sdk/middleware/services/gpu/drv/vau/intf/drv_vau_intf.c +++ b/code/sdk/middleware/services/gpu/drv/vau/intf/drv_vau_intf.c @@ -14,9 +14,12 @@ #include "vau_hal.h" #include "vau_dfx.h" #include "vau_pre_process.h" +#include "vau_handle.h" #define DRV_VAU_IOCTL_CMD_NUM 20 +static td_bool g_vau_suspend_flag = TD_FALSE; + static td_s32 drv_vau_open(td_void *private_data) { uapi_unused(private_data); @@ -31,18 +34,30 @@ static td_s32 drv_vau_close(td_void *private_data) return EXT_SUCCESS; } +static td_void drv_vau_set_suspend_flag(td_bool flag) +{ + unsigned long flags = 0; + vau_handle_mgr *vau_handle_list = vau_handle_list_get(); + + osal_spin_lock_irqsave(&vau_handle_list->lock, &flags); + g_vau_suspend_flag = flag; + osal_spin_unlock_irqrestore(&vau_handle_list->lock, &flags); +} + td_s32 drv_vau_suspend(td_void *private_data) { uapi_unused(private_data); + td_s32 ret = drv_vau_wait_all_done(); vau_dfx_info *dfx_info = vau_dfx_get_info(); dfx_info->suspend_cnt++; vau_dbg("vau suspend start"); vau_hal_suspend(); + drv_vau_set_suspend_flag(TD_TRUE); vau_dbg("vau suspend ok"); - return EXT_SUCCESS; + return ret; } td_s32 drv_vau_resume(td_void *private_data) @@ -60,6 +75,7 @@ td_s32 drv_vau_resume(td_void *private_data) #ifdef CONFIG_CLDO1PD_SUPPORT vau_mem_draw_pool_init(); #endif + drv_vau_set_suspend_flag(TD_FALSE); vau_dbg("vau resume ok"); return EXT_SUCCESS; @@ -120,6 +136,11 @@ td_s32 vau_ioctl(td_s32 module_idx, td_ulong ioctl_cmd, td_void *para) return EXT_FAILURE; } + if (g_vau_suspend_flag == TD_TRUE) { + vau_err("vau is in suspend state!, suspend_flag = %u", g_vau_suspend_flag); + return EXT_FAILURE; + } + return (td_s32)g_vau_ioctl_cmd_list[ioctl_cmd].handler((td_u32)ioctl_cmd, para, TD_NULL); } diff --git a/code/sdk/middleware/services/gpu/drv/vau/list/vau_list.c b/code/sdk/middleware/services/gpu/drv/vau/list/vau_list.c index 98f53d3fc..60e784c87 100755 --- a/code/sdk/middleware/services/gpu/drv/vau/list/vau_list.c +++ b/code/sdk/middleware/services/gpu/drv/vau/list/vau_list.c @@ -433,7 +433,6 @@ td_s32 vau_list_submit_job(td_handle handle, td_u32 time_out, td_size_t lockflags = 0; td_bool asynflag = 0; td_u32 tmp_time_out = time_out; - vau_dfx_info *vau_info = vau_dfx_get_info(); if ((tmp_time_out == 0) || (tmp_time_out > 2000)) { /* 2000ms */ tmp_time_out = 2000; /* max 2000ms */ @@ -456,7 +455,6 @@ td_s32 vau_list_submit_job(td_handle handle, td_u32 time_out, wait_ret = osal_wait_timeout_interruptible(&g_vau_block_job_wq, vau_osal_wait_check, (td_void *)&job->notify_type, tmp_time_out); osal_spin_lock_irqsave(&g_vau_sw_job_list->lock, &lockflags); - uapi_reg_read(HAL_VAU_LIST_PFCNT, vau_info->func_info.time_info.list_pfcnt); job->wait_for_done_count--; ret = vau_list_wake_up_job(job, asynflag, &wait_ret); osal_spin_unlock_irqrestore(&g_vau_sw_job_list->lock, &lockflags); diff --git a/code/sdk/middleware/services/gui/hal/display/CMakeLists.txt b/code/sdk/middleware/services/gui/hal/display/CMakeLists.txt index 1986740b3..03e4c0d4f 100755 --- a/code/sdk/middleware/services/gui/hal/display/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/hal/display/CMakeLists.txt @@ -45,6 +45,7 @@ set(COMPONENT_CCFLAGS -Wno-unused-function -Wno-incompatible-pointer-types -Wno-incompatible-pointer-types-discards-qualifiers + -Werror=return-type ) set(WHOLE_LINK @@ -97,6 +98,7 @@ list(APPEND CFLAG -Wno-missing-field-initializers) set(COMPONENT_CCFLAGS ${CFLAG} -Wno-sign-compare + -Werror=return-type ) set(WHOLE_LINK @@ -144,6 +146,7 @@ set(COMPONENT_CCFLAGS ${CFLAG} -Wno-unused-parameter -Wno-unused-function + -Werror=return-type ) set(WHOLE_LINK diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-native-js/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-native-js/libdisplay_gfx.a index f20d975dc..8eb8684f3 100755 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-native-js/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-native-js/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-target1/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-target1/libdisplay_gfx.a index eb73ea809..9ad11a06f 100755 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-target1/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-target1/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-target3/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-target3/libdisplay_gfx.a index f5f1c39b7..9c321175b 100755 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-target3/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-target3/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-target5/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-target5/libdisplay_gfx.a index 4a8ab1216..dde8b6f1e 100755 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-target5/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-target5/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a b/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a index d78c31608..a8b77c937 100755 Binary files a/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a and b/code/sdk/middleware/services/gui/hal/display/brandy-xts/libdisplay_gfx.a differ diff --git a/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c b/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c index 6f64ebdc7..c1508373c 100755 --- a/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c +++ b/code/sdk/middleware/services/gui/hal/display/src/display_gralloc.c @@ -232,7 +232,6 @@ static int32_t AllocMem(const AllocInfo *info, BufferHandle **handle) uint8_t *addr = LosAllocMem(pool, (uint32_t)(buffer->size)); if (addr == NULL) { - DISP_LOGE("LosAllocMem failure\n"); ret = DISPLAY_FAILURE; goto END; } @@ -241,7 +240,6 @@ static int32_t AllocMem(const AllocInfo *info, BufferHandle **handle) END: if ((ret != DISPLAY_SUCCESS) && (buffer != NULL)) { - DISP_LOGE("AllocMem FAILED.\n"); free(buffer); buffer = NULL; } diff --git a/code/sdk/middleware/services/gui/hal/input/CMakeLists.txt b/code/sdk/middleware/services/gui/hal/input/CMakeLists.txt index c8b06bfd6..4962c481c 100755 --- a/code/sdk/middleware/services/gui/hal/input/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/hal/input/CMakeLists.txt @@ -33,6 +33,7 @@ set(COMPONENT_CCFLAGS ${CFLAG} -Wno-incompatible-function-pointer-types -Wno-implicit-function-declaration + -Werror=return-type ) set(WHOLE_LINK diff --git a/code/sdk/middleware/services/gui/uikit/CMakeLists.txt b/code/sdk/middleware/services/gui/uikit/CMakeLists.txt index c2aa26288..e6bd80471 100755 --- a/code/sdk/middleware/services/gui/uikit/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/uikit/CMakeLists.txt @@ -47,6 +47,7 @@ set(public_configs -Wno-tautological-pointer-compare -Wno-unused-private-field -Wno-unused-function + -Werror=return-type ) # build graphic utils @@ -180,6 +181,7 @@ set(COMPONENT_CCFLAGS -Wno-tautological-pointer-compare -Wno-unused-private-field -Wno-unused-function + -Werror=return-type ) set(WHOLE_LINK @@ -212,9 +214,11 @@ set(COMPONENT_SRC ${PROP_UI_SRC}/components_ext/ui_cross_view.cpp ${PROP_UI_SRC}/components_ext/kaleidoscope_utils.cpp ${PROP_UI_SRC}/components_ext/ui_kaleidoscope_view.cpp + ${PROP_UI_SRC}/components_ext/ui_roller_view.cpp ${PROP_UI_SRC}/components_ext/ui_map_view.cpp ${PROP_UI_SRC}/components_ext/map_svg_parser.cpp ${PROP_UI_SRC}/components_ext/ui_coverflow_view.cpp + ${PROP_UI_SRC}/components_ext/ui_icosahedron_view.cpp ) set(SOURCES @@ -257,6 +261,7 @@ set(COMPONENT_CCFLAGS -Wno-tautological-pointer-compare -Wno-unused-private-field -Wno-unused-function + -Werror=return-type ) set(WHOLE_LINK diff --git a/code/sdk/middleware/services/gui/uikit/brandy-native-js/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-native-js/libuikit_ext.a index 8161135c7..d629f4128 100755 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-native-js/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-native-js/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-target3/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-target3/libuikit_ext.a index 8161135c7..8ec26e3ed 100755 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-target3/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-target3/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a b/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a index 8161135c7..334912403 100755 Binary files a/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a and b/code/sdk/middleware/services/gui/uikit/brandy-xts/libuikit_ext.a differ diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/graphic_utils.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/graphic_utils.h new file mode 100644 index 000000000..7fdd0b1a3 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/graphic_utils.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) CompanyNameMagicTag 2023. All rights reserved. + */ + +#ifndef DEFER_UTILS_H +#define DEFER_UTILS_H + +#include +#include "gfx_utils/image_info.h" +#include "gfx_utils/graphic_math.h" + +namespace OHOS { +#ifndef defer +struct defer_dummy {}; +template struct deferrer { F f; ~deferrer() { f(); } }; +template deferrer operator*(defer_dummy, F f) { return {f}; } +#define DEFER_(LINE) zz_defer##LINE +#define DEFER(LINE) DEFER_(LINE) +#define defer auto DEFER(__LINE__) = defer_dummy{} *[&]() +#endif // defer +} // OHOS +#endif // DEFER_UTILS_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h index 38c5a15b0..095a9f1b0 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/image_cache_manager.h @@ -37,6 +37,7 @@ #include "gfx_utils/image_info.h" #include "gfx_utils/heap_base.h" #include "graphic_config.h" +#include "hals/gralloc_engines.h" #if ENABLE_IMAGE_PACKER namespace OHOS { @@ -103,16 +104,24 @@ public: */ void UpdateImageInfoIfNecessary(ImageInfo& info); + void* FreeAndGetBuf(const AllocInfo& info, GrallocBuffer& buffer); + + /** + * @brief Dump image information. + */ + void Dump(); + private: struct ImageNode; struct MultiImageInfo { - uint32_t dirId; - uint32_t count; - uint32_t loadedCount; - bool isPath; - bool isSingle; + uint32_t dirId = 0; + uint32_t count = 0; + uint32_t loadedCount = 0; + uint32_t offset = 0; + bool isPath = false; + bool isSingle = false; std::string file; - ImageNode** node; + ImageNode** node = nullptr; }; struct ImageNode { @@ -149,7 +158,6 @@ private: ImageInfo* LoadSingleImgInfo(FILE* fp, MultiImageInfo& multiImgInfo, uint32_t imgIndex, int offset, bool isLongTerm); ImageInfo* LoadOneImgFromBuf(uint8_t* buf, MultiImageInfo& multiImgInfo, uint32_t imgIndex); - void* GetImgCacheBuffer(ImageInfo& info); ImageCacheManager::ImageNode* CreateImageNode(MultiImageInfo* multiImgInfo, uint32_t size, bool isLongTerm, uint32_t imgId); void DestoryImageNode(ImageNode*& node); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h index f86fd9e12..de6afb630 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/common/lite_surface.h @@ -286,6 +286,9 @@ public: */ void CancelBuffer(SurfaceBuffer* buffer) override; + void ClearBuffers(); + SurfaceBuffer* GetBackBuf(); + protected: void AddBuffer(); BufferItem* GetBufferItem(const SurfaceBuffer* buffer); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/card_swipe.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/card_swipe.h index 9d19e86c4..535696cb8 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/card_swipe.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/card_swipe.h @@ -39,6 +39,8 @@ public: * @version 1.0 */ virtual void CardSwipeAlg(UIImageView* leftCard, UIImageView* rightCard, int16_t xOffset) {} + + bool isNeedClip_ = false; }; } #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/kaleidoscope_utils.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/kaleidoscope_utils.h index c126d1ba9..7ed170fab 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/kaleidoscope_utils.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/kaleidoscope_utils.h @@ -17,10 +17,10 @@ namespace OHOS { -typedef struct { +struct ImageInfoExt { ImageInfo info; uint32_t stride; -} ImageInfoExt; +}; class KaleidoscopeUtils : public HeapBase { public: @@ -50,7 +50,7 @@ public: * @param [in] addr Address of kaleidoscope data. * @return Return true if update successfully; and false otherwise. */ - bool UpdateKaleidoscopeAddr(const uint8_t* addr); + bool UpdateKaleidoscopeImgInfo(const ImageInfoExt &imgInfo); /** * @brief Obtain kaleidoscope img. @@ -58,6 +58,12 @@ public: */ ImageInfoExt* GetKaleidoscopeInfo(); + /** + * @brief Get pointer to source ImageInfo struct. + * @return Return pointer to source ImageInfo struct. + */ + const ImageInfo* GetSrcImgInfo(); + private: ImageInfo* imgInfo_ = nullptr; ImageInfoExt* kaleidoscopeInfo_ = nullptr; @@ -81,8 +87,8 @@ private: void DeInitPartialInfo(); void DeinitInnerPath(); void DeinitImgInfo(); - bool ConstructFirstQuadrant(BufferInfo& bufferInfo); - bool ConstructRestQuadrant(BufferInfo& bufferInfo); + bool ConstructFirstQuadrant(BufferInfo& dstBufInfo); + bool ConstructRestQuadrant(BufferInfo& dstBufInfo); }; } #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_barcode.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_barcode.h index ac8342681..a9258e026 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_barcode.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_barcode.h @@ -105,11 +105,11 @@ private: void ReMeasure() override; void RefreshBarcode(); bool FillImageInfo(); - void FillBarCodeColor(ImageInfo& imageInfo, int32_t actualLenght, uint8_t *destData, uint32_t offset); - void SetBarcodeVal(const char* val, uint32_t length); + void FillBarCodeColor(ImageInfo& imageInfo, int32_t actualLength, uint8_t *destData, uint32_t offset); + void SetBarcodeVal(const char* barcodeVal, uint32_t length); ImageInfo imageInfo_; - int16_t stride_; + int16_t stride_ = 0; bool needDraw_; ColorType barColor_; char* barcodeVal_; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_card_page.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_card_page.h index d3b668c79..9e90eb04b 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_card_page.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_card_page.h @@ -51,6 +51,20 @@ public: */ ~UICardPage() override {} + /* * + * @brief This function is invoked when the function SetHorCurrentPage() is called. + * @since 1.0 + * @version 1.0 + */ + virtual void OnActive(void) {} + + /* * + * @brief This function is invoked when the function SetHorCurrentPage() is called. + * @since 1.0 + * @version 1.0 + */ + virtual void OnInactive(void) {} + /* * * @brief Preload resource callback function, it will be called at the end of swipe animator or the function * SetHorCurrentPage() is called. diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_coverflow_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_coverflow_view.h index e063a8af0..c94aa7228 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_coverflow_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_coverflow_view.h @@ -15,16 +15,16 @@ #ifndef UI_COVERFLOW_VIEW_H #define UI_COVERFLOW_VIEW_H -#include "components/ui_swipe_view.h" #include #include #include "components/ui_image_view.h" #include "components/ui_label.h" +#include "components/ui_swipe_view.h" namespace OHOS { class UICoverflowView : public UISwipeView { public: - UICoverflowView(); + explicit UICoverflowView(uint8_t mirrorOpa = 30, bool supportMirror = true); // 30: default mirror opacity ~UICoverflowView() override; /** @@ -43,25 +43,26 @@ public: void Remove(const char* id); /** - * @brief Set center item width in static display mode. + * @brief Set image size. * - * @param width setting item width. + * @param width setting image width. + * @param height setting image height. */ - void SetItemWidth(uint16_t width); + void SetImgSize(uint16_t width, uint16_t height); /** - * @brief Set ratote angle between the left and right items in static display mode. + * @brief Set image direct interval. * - * @param angle setting ratote angle. + * @param padding setting padding value. The interval between two images is twice the padding. */ - void SetRotateAngle(float angle); + void SetImgPadding(uint16_t padding); /** - * @brief Set mirror image opacity. + * @brief Set rotate angle between the left and right items in static display mode. * - * @param opa setting mirror opacity value. + * @param angle setting rotate angle. */ - void SetMirrorOpacity(uint8_t opa); + void SetRotateAngle(float angle); /** * @brief Represents a listener for swipe of the coverflow view. @@ -88,23 +89,30 @@ public: uint8_t GetDirection() const = delete; protected: bool DragXInner(int16_t distance) override; + void RefreshCurrentView(int16_t distance, uint8_t dragDirection); private: void UpdatePerspectiveMatrix(); void ReMeasure(void) override; void TransformImage(UIImageView* view); - void TransformPage(uint16_t index); void DeleteGroup(UIViewGroup* group); + bool CalCurViewInfo(); using UISwipeView::Add; using UISwipeView::Remove; OnCoverflowScrollListener* coverflowListener_; - uint16_t itemWidth_; - uint8_t mirrorOpa_; - float rotateAngle_; std::map> map_; Matrix4 perspectiveMatrix_; + + uint16_t imgWidth_; + uint16_t imgHeight_; + uint16_t padding_; + float rotateAngle_; + uint8_t mirrorOpa_; + bool isShowMirrorImg_; + UIView* lastView_; + uint16_t swipeMid_; }; } // namespace OHOS #endif // UI_COVERFLOW_VIEW_H diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h index e0d4fefb4..37229c75f 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_cross_view.h @@ -181,6 +181,9 @@ public: void RegisterSwipeCallback(CardSwipe* callback) { horizontal_.RegisterSwipeCallback(callback); + if (callback != nullptr) { + isNeedClip_ = callback->isNeedClip_; + } } /* * @@ -210,7 +213,7 @@ private: static constexpr uint16_t INVALID_VIEW_INDEX = 0xff; bool loop_ = false; bool enableScreenCap_ = false; - bool GaussianBlurEnable_ = false; + bool gaussianBlurEnable_ = false; int swipeDirect_ = 0; int pullIndex_ = 0; int16_t hDragStartIndex_ = INVALID_VIEW_INDEX; @@ -220,6 +223,7 @@ private: HorSwipeView horizontal_; UIView* tailView_ = nullptr; UISwipeView::OnSwipeListener *swipeListener_ = nullptr; + bool isNeedClip_ = false; void RemoveAllInner(UISwipeView& view); void ProcessRes(void); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h index 5a7e3d11d..7d287c554 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_hexagons_list.h @@ -184,10 +184,16 @@ public: */ Vector2 GetCurrentPosition(uint8_t index); + UIViewType GetViewType() const override + { + return UI_HEXAGONS_LIST; + } + + void ReMeasure() override; + protected: bool DragXInner(int16_t distance) override; bool DragYInner(int16_t distance) override; - void ReMeasure() override; /** * @brief Get center position of the special(index) image when scale and center image index in screen is specified * @@ -214,7 +220,7 @@ private: uint16_t maxLap_ = 0; uint16_t maxAngleInMaxLap_ = 0; Graphic::Vector polygonPoints_{10}; - uint16_t imgDistance_{0}; + float imgDistance_{0}; uint16_t oriImgDistance_{0}; float oriScaleFactor_{0.23f}; int16_t imgSizeInCenter_{0}; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_icosahedron_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_icosahedron_view.h new file mode 100644 index 000000000..e483fa414 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_icosahedron_view.h @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024 CompanyNameMagicTag. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UI_ICOSAHEDRON_VIEW_H +#define UI_ICOSAHEDRON_VIEW_H +#include "components/ui_abstract_scroll.h" +#include "gfx_utils/graphic_math.h" +#include "components_ext/triangular_plane.h" + +namespace OHOS { +class UIIcosahedronView : public UIAbstractScroll { +public: + UIIcosahedronView(); + virtual ~UIIcosahedronView(); + + /** + * @brief Set the edge length of the icosahedron. + * + * @param sideLen edge length of body shape. + */ + void SetSideLength(uint16_t sideLen); + + /** + * @brief Add a one-sided view to the icosahedron. + * + * @param view Single-sided corresponding view.Only supported ui image view. + */ + void Add(UIView* view) override; + + /** + * @brief Refresh icosahedral position.physique position will be reset after refreshing + */ + void RefreshIcosahedron(); + + /** + * @brief Rotates the icosahedral in 3d. + * + * @param angle Indicates the rotation angle. + * @param pivotStart Indicates the coordinates of the rotation start pivot. + * @param pivotEnd Indicates the coordinates of the rotation end pivot. + */ + bool RotatePlanes(int16_t angle, const Vector3& pivotStart, const Vector3& pivotEnd); + + UIViewType GetViewType() const override + { + return UI_ICOSAHEDRON_VIEW; + } + +protected: + bool OnDragStartEvent(const DragEvent& event); + bool OnDragEvent(const DragEvent& event); + bool OnDragEndEvent(const DragEvent& event); + bool DragXInner(int16_t distance) override + { + return true; + } + + bool DragYInner(int16_t distance) override + { + return true; + } + +private: + class inertiaAnimatorCallback : public AnimatorCallback { + public: + inertiaAnimatorCallback() : rotateTimes_(0), curtTime_(0), angle_(0) + { + } + + virtual ~inertiaAnimatorCallback() {} + + void SetRotateTimes(uint16_t times) + { + curtTime_ = 0; + rotateTimes_ = times; + } + + void SetRotateAngle(int16_t angle) + { + angle_ = angle; + } + + void SetRotateAxis(const Vector3& rotateStart, const Vector3& rotateEnd) + { + rotateStart_ = rotateStart; + rotateEnd_ = rotateEnd; + } + + virtual void Callback(UIView* view) override; + + private: + uint16_t rotateTimes_; + uint16_t curtTime_; + int16_t angle_; + Vector3 rotateStart_; + Vector3 rotateEnd_; + }; + Matrix4 CalculateRotateMatrix(TriangularPlane dst); + Point startPoint_; + uint16_t sideLen_; + + TriangularPlane plane_[20]; // 20: plane number + Matrix4 imgMatrix_; + Matrix4 sphereMatrix_; + Matrix4 lastSphereMatrix_; + bool isUpdateSideLen_ = true; + + Animator inertiaAnimator_; + inertiaAnimatorCallback inertiaCallback_; + float lastAngle_; +}; +} // namespace OHOS +#endif // UI_ICOSAHEDRON_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_kaleidoscope_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_kaleidoscope_view.h index fcb00217f..f2c5312cd 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_kaleidoscope_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_kaleidoscope_view.h @@ -58,7 +58,7 @@ public: The size of img must match the size of screen. * @return Return true if set successfully; and false otherwise. */ - bool SetSrc(const ImageInfo* info); + bool SetSrc(const ImageInfo* src); /** * @brief Update the kaleidoscope by a rotate value. @@ -96,6 +96,9 @@ public: void StopRotateAnimator(); void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override; + + void DumpImgInfo() override; + private: class RotateCallback : public AnimatorCallback { public: diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_list_ext.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_list_ext.h index cb79caeee..f39d0bf37 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_list_ext.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_list_ext.h @@ -59,7 +59,7 @@ public: * @since 1.0 * @version 1.0 */ - UIListExt(uint8_t direction) + explicit UIListExt(uint8_t direction) { SetDirection(direction); } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h index 4365bd935..b34781850 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_lite_surface_view.h @@ -34,6 +34,7 @@ #include "common/ihardware_view.h" #include "common/lite_surface.h" +#include "common/image.h" #include "components/ui_view.h" #include "ibuffer_consumer_listener.h" #include "graphic_mutex.h" @@ -169,21 +170,19 @@ public: } /** - * @brief Check if first video frame came. + * @brief Set preview image info. * @since 1.0 * @version 1.0 */ - bool IsFirstFrameCame() - { - return isFirstFrameCome_; - } + void SetPreview(ImageInfo* info); + + void DumpImgInfo() override; private: UILiteSurfaceView(const UILiteSurfaceView&) = delete; UILiteSurfaceView &operator=(const UILiteSurfaceView&) = delete; void InitLayer(); - bool isStopped_ = false; - bool isFirstFrameCome_ = false; + bool isStopped_ = true; bool isLayerInit_ : 1; uint8_t flushCount_; LiteSurface* surface_ = nullptr; @@ -192,12 +191,12 @@ private: GraphicMutex lock_; ColorType colorKey_ = Color::White(); Rect layerRect_; - - void PreHandleStatus(); + Image* preView_ = nullptr; #ifdef VERSION_IOT void BlitBitmapToFb(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea, ImageInfo& bitmap); #endif + void AdjustArea(Rect& rect); }; } // namespace OHOS #endif // GRAPHIC_LITE_UI_LITE_SURFACE_VIEW_H diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h index 75a255743..f7f5b2619 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_map_view.h @@ -40,21 +40,21 @@ namespace OHOS { #if ENABLE_VGU_ENGINE && CAPABILITY_HWDRAW_PATH struct POIInfo { - ImageDetail* img; - TextDetail* text[2]; - uint8_t tag; - uint16_t rank; - uint16_t id; + ImageDetail* img = nullptr; + TextDetail* text[2] = {nullptr, nullptr}; + uint8_t tag = 0; + uint16_t rank = 0; + uint16_t id = 0; Rect rect; - Point orignPos; - bool visible; + Point orignPos = {0, 0}; + bool visible = false; }; struct RoadInfo { - TextDetail* text; + TextDetail* text = nullptr; Rect rect; - Point orignPos; - bool visible; + Point orignPos = {0, 0}; + bool visible = false; }; class OnPOIClickListener : public HeapBase { @@ -144,27 +144,28 @@ public: void SetY(int16_t x) override; private: - POIInfo* POIs_ = nullptr; + POIInfo* pois_ = nullptr; RoadInfo* roads_ = nullptr; - OnPOIClickListener* POIlistener_ = nullptr; + OnPOIClickListener* poiListener_ = nullptr; bool cacheEnable_ = false; bool needUpdate_ = false; ImageInfo cacheInfo_ = {{0}}; MapSVGParser parser_; - uint8_t* data_ = nullptr; char* filePath_ = nullptr; PathDetail* pathArray_ = nullptr; uint8_t pathCount_ = 0; RoadDetail* roadArray_ = nullptr; uint8_t roadCount_ = 0; - POIDetail* POIArray_ = nullptr; - uint8_t POICount_ = 0; + POIDetail* poiArray_ = nullptr; + uint8_t poiCount_ = 0; char* fontName_ = DEFAULT_VECTOR_FONT_FILENAME; uint8_t fontId_ = 0xff; uint8_t fontSize_ = 0; - uint32_t POIMask_ = 0; + uint32_t poiMask_ = 0; float scale_ = 1.0f; + bool isSetSVG_ = false; + void InitMapInfo(); void DrawPath(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea); void DrawText(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea, TextDetail& info, Point offset = {0, 0}, bool isPOIText = false); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_menu_item.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_menu_item.h index d2bea3e33..fb38503c8 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_menu_item.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_menu_item.h @@ -94,7 +94,7 @@ public: * @since 1.0 * @version 1.0 */ - void SetImageSrc(const char* ImgSrc); + void SetImageSrc(const char* imgSrc); /** * @brief Sets the image info for menu image. @@ -102,7 +102,7 @@ public: * @since 1.0 * @version 1.0 */ - void SetImageSrc(const ImageInfo* ImgSrc); + void SetImageSrc(const ImageInfo* imgSrc); /** * @brief Sets the text for this item. @@ -291,6 +291,8 @@ public: void ReMeasure() override; void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override; + void DumpImgInfo() override; + private: UIImageView* image_ = nullptr; Style textStyle_; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h new file mode 100644 index 000000000..24465f648 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_roller_view.h @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2024 CompanyNameMagicTag. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UI_ROLLER_VIEW_H +#define UI_ROLLER_VIEW_H +#include +#include "components/ui_abstract_scroll.h" + +namespace OHOS { + +enum RollerViewMode { + DISPLAY, // Display all items in roller form. + COVER, // Display current item at full size. + TRANSITION, // used internally. +}; + +class UIRollerView : public UIAbstractScroll { +public: + UIRollerView(); + virtual ~UIRollerView() override; + + /** + * @brief Set item size, which is the size of image in DisplayMode. + */ + void SetItemSize(uint16_t width, uint16_t height); + + /** + * @brief Set item padding. + */ + void SetItemPadding(uint16_t padding); + + /** + * @brief Set mirror img opacity. + */ + void SetMirrorOpacity(uint8_t opa); + + /** + * @brief Set sensitivity factor. + * Drag distance will be converted to angle, and will multiply by this factor. + */ + void SetSensitivityFactor(float sensitivity); + + /** + * @brief Get sensitivity factor. Default value is 1.0. + */ + float GetSensitivityFactor(); + + /** + * @brief Add an item. + */ + void AddItem(std::string name, const ImageInfo* src); + + /** + * @brief Remove an item. + */ + void RemoveItem(std::string name); + + /** + * @brief Clear all items. + */ + void ClearAll(); + + /** + * @brief Get current item name. + */ + std::string GetCurrentItemName(); + + /** + * @brief Get current item, which contains 2 imgs. + */ + UIViewGroup* GetCurrentItem(); + + /** + * @brief Set current item. + */ + void SetCurrentItem(std::string name, bool enableAnimator = false); + + /** + * @brief Set current mode, choose from [DISPLAY, COVER]. + */ + void SetMode(RollerViewMode mode, bool enableAnimator = false); + + /** + * @brief Mode change listener. + */ + class OnModeChangeListener : public HeapBase { + public: + /** + * @brief Called when RollerViewMode is changed. + */ + virtual void OnModeChange(UIRollerView* view, RollerViewMode targetMode) = 0; + virtual ~OnModeChangeListener() {} + }; + + /** + * @brief Get OnModeChangeListener. + */ + OnModeChangeListener*& GetOnModeChangeListener() + { + return onModeChangeListener_; + } + + /** + * @brief Set OnModeChangeListener. + */ + void SetOnModeChangeListener(OnModeChangeListener* onModeChangeListener) + { + onModeChangeListener_ = onModeChangeListener; + } + + /** + * @brief Get current mode. + */ + RollerViewMode GetMode(); + + /** + * @brief Set camera distance. If not set, default distance is 1000. + */ + void SetCamDistance(int16_t distance); + + /** + * @brief Set absolute y coordinate of camera. + Default value is GetY() - GetHeight() / 3. + */ + void SetCamY(int16_t y); + + UIViewType GetViewType() const override + { + return UI_ROLLER_VIEW; + } + + bool OnDragStartEvent(const DragEvent& event) override; + bool OnDragEvent(const DragEvent& event) override; + bool OnDragEndEvent(const DragEvent& event) override; + + void SetDirection(uint8_t direction) = delete; + uint8_t GetDirection() const = delete; + void SetLoopState(bool loop) = delete; + +protected: + bool DragXInner(int16_t distance); + bool DragYInner(int16_t distance) + { + return true; + } + +private: + class AlignAnimatorCallback : public AnimatorCallback { + public: + AlignAnimatorCallback() + : curTime_(0), + animTime_(0), + angle_(0), + previousAngle_(0) + { + } + + virtual ~AlignAnimatorCallback() {} + + void SetAnimTimes(uint16_t times) + { + animTime_ = times; + } + + void SetAngle(float angle) + { + angle_ = angle; + } + + void ResetCallback() + { + angle_ = 0; + previousAngle_ = 0; + animTime_ = 0; + curTime_ = 0; + } + + virtual void Callback(UIView* view) override; + + uint16_t curTime_; + uint16_t animTime_; + float previousAngle_; + float angle_; + }; + + class TransitionAnimatorCallback : public AnimatorCallback { + public: + TransitionAnimatorCallback() : curTime_(0), animTime_(0), + startScaleX_(0), startScaleY_(0), endScaleX_(0), endScaleY_(0), + camPos_({0, 0}), targetCamPos_({0, 0}) + { + } + + virtual ~TransitionAnimatorCallback() {} + + void SetAnimTimes(uint16_t times) + { + animTime_ = times; + } + + void SetScaleFactor(float startScaleX, float startScaleY, float endScaleX, float endScaleY) + { + startScaleX_ = startScaleX; + startScaleY_ = startScaleY; + endScaleX_ = endScaleX; + endScaleY_ = endScaleY; + } + + void SetCamPosition(Point previousCamPos, Point targetCamPos) + { + camPos_ = previousCamPos; + targetCamPos_ = targetCamPos; + } + + void ResetCallback() + { + curTime_ = 0; + animTime_ = 0; + startScaleX_ = 0; + startScaleY_ = 0; + endScaleX_ = 0; + endScaleY_ = 0; + camPos_ = {0, 0}; + targetCamPos_ = {0, 0}; + } + + virtual void Callback(UIView* view) override; + + uint16_t curTime_; + uint16_t animTime_; + float startScaleX_; + float startScaleY_; + float endScaleX_; + float endScaleY_; + Point camPos_; + Point targetCamPos_; + }; + + /* calculate swipe anim period: angle offset / ANGLE_COEFFICIENT. Minimum swipe anim period is MIN_DRAG_TIMES. */ + static constexpr uint8_t ANGLE_COEFFICIENT = 5; + /* the minimum period of mode transition animator. */ + static constexpr uint8_t MIN_TRANSITION_TIMES = 5; + /* calculate mode transition animator period: scale offset / TRANSITION_COEFFICIENT. */ + static constexpr float TRANSITION_COEFFICIENT = 0.2; + OnModeChangeListener* onModeChangeListener_; + float ConvertDistanceToAngle(int16_t distance); + bool IsInCurrentItemRange(float angle); + void InitImg(UIView* img); + void DoCalculation(); + void PrepAlign(float angle); + void SetCamPosInner(Point position); + void StartTransitionAnim(); + void StopTransitionAnim(); + void ReflectImg(UIView* img, UIView* mirror); + void ReMeasure(void) override; + void LayoutItem(); + void TransformByAngle(float angle); + void TransformItemGroup(UIView* view, float angle); + void DelItemGroup(UIViewGroup* group); + void ResetState(); + void StartAlignAnim(); + void StopAlignAnim(); + void MoveHeadOrTail(); + void HandleMode(); + void HandleAlign(); + void UpdateCam(); + + Animator alignAnim_; + AlignAnimatorCallback alignCallback_; + + Animator transitionAnim_; + TransitionAnimatorCallback transitionCallback_; + + int16_t camY_ = 0; + bool isCamYSet_ = false; + RollerViewMode mode_ = DISPLAY; + RollerViewMode targetMode_ = DISPLAY; + bool switchModeWithAnim_ = false; + bool alignWithAnim_ = false; + UIView* coverPreviousItem_ = nullptr; + uint16_t itemWidth_ = 0; + uint16_t itemHeight_ = 0; + uint8_t mirrorOpa_ = 100; + float radius_ = 0.0f; + float perimeter_ = 0.0f; + float sensitivityFactor_ = 1.0f; + float anglePerItem_ = 0.0f; + Point camPosition_ = {0, 0}; + Point displayCamPosition_ = {0, 0}; + uint16_t cameraDistance_ = 1000; + uint16_t itemPadding_ = 0; + bool needLayout_ = false; + UIViewGroup* currentItem_ = nullptr; + UIViewGroup* alignItem_ = nullptr; + float alignAngle_ = 0.0f; +}; +} // namespace OHOS +#endif // UI_ROLLER_VIEW_H diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_sweep_clock.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_sweep_clock.h index 73dafd3a2..c21b68214 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_sweep_clock.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_sweep_clock.h @@ -410,6 +410,8 @@ public: */ void SetWorkMode(WorkMode newMode) override; + void DumpImgInfo() override; + private: Hand hourHand_; Hand minuteHand_; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/service/graphic_service.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/service/graphic_service.h index 15f0f332e..fa8d6a03c 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/service/graphic_service.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/service/graphic_service.h @@ -101,6 +101,16 @@ public: */ bool InitGraphicService(); + /** + * @brief GPU Reset start. + */ + void GpuResetStart(void); + + /** + * @brief GPU Reset end. + */ + void GpuResetEnd(void); + #ifdef ENABLE_CMSIS static void NativeMainThread(void* args); static void RtcEventThread(void* args); @@ -118,6 +128,7 @@ private: static OHOS::GraphicMutex rtcEventMutex_; static OHOS::GraphicCond rtcEventCond_; static bool fullRefreshFlag_; + bool isGpuReseting = false; void DecreaseTriggerCount(); void SetUpRootView(); GraphicService(); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/service/graphic_service_wrapper.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/service/graphic_service_wrapper.h index ca6945dd6..dcc86f2fb 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/service/graphic_service_wrapper.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/service/graphic_service_wrapper.h @@ -30,10 +30,15 @@ extern "C" { #endif /** - * @brief Set frequence for graphic. + * @brief Set frequence for graphic, cannot use PostGraphicEvent() to excute this method. */ void SetFrequence(int freq); +/** + * @brief Set frequence for graphic inner. + */ +void SetFrequenceInner(int freq); + /** * @brief Notify the Screen is on, for c language. */ @@ -59,6 +64,16 @@ void ShowGraphicOTALogo(void); */ void HideGraphicLogo(void); void HideGraphicOtaLogo(void); + +/** + * @brief GPU Reset start. + */ +void GpuResetStart(void); + +/** + * @brief GPU Reset end. + */ +void GpuResetEnd(void); #ifdef __cplusplus }; #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp index dbff032f3..513c80adc 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/service/src/graphic_service_wrapper.cpp @@ -60,7 +60,7 @@ static void UikitRTCCallBack(uintptr_t data) GraphicService::GetInstance()->UpdateGraphicEvent(); } -void SetFrequence(int freq) +void SetFrequenceInner(int freq) { if (!g_isScreenOn) { return; @@ -85,6 +85,13 @@ void SetFrequence(int freq) } } +void SetFrequence(int freq) +{ + GraphicService::GetInstance()->PostGraphicEvent([=] { + SetFrequenceInner(freq); + }); +} + void NotifyScreenOn(void) { if (g_rtcHandle == nullptr) { diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp index ef6ae8e33..82c36b1e0 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/lite_surface.cpp @@ -25,6 +25,11 @@ LiteSurface::LiteSurface() : bufferCount_(0), queueSize_(0), size_(0), } LiteSurface::~LiteSurface() +{ + ClearBuffers(); +} + +void LiteSurface::ClearBuffers() { lock_.Lock(); freeList_.Clear(); @@ -42,6 +47,7 @@ LiteSurface::~LiteSurface() node = node->next_; } buffers_.Clear(); + bufferCount_ = 0; lock_.Unlock(); } @@ -312,4 +318,9 @@ void LiteSurface::CancelBuffer(SurfaceBuffer* buffer) { ReleaseBuffer(buffer); } + +SurfaceBuffer* LiteSurface::GetBackBuf() +{ + return dirtyList_.Back(); +} } // namespace OHOS diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/low_power_manager.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/low_power_manager.cpp index 1bf9a68a5..15eb859d3 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/low_power_manager.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/low_power_manager.cpp @@ -27,13 +27,13 @@ void LowPowerManager::TryToEnterLowPower() void LowPowerManager::EnterLowPower() { - SetFrequence(1); + SetFrequenceInner(1); } void LowPowerManager::ExitLowPower() { lastExitTime_ = HALTick::GetInstance().GetTime(); - SetFrequence(60); // 60: 60fps + SetFrequenceInner(60); // 60: 60fps } bool LowPowerManager::IsLiteSurfaceInRootView() @@ -57,8 +57,8 @@ bool LowPowerManager::CheckTaskState() if (period == 0) { return false; } else { - int freq = 1000 / period; // 1000: 1000ms per second - SetFrequence(freq); + int freq = 1000 / static_cast(period); // 1000: 1000ms per second + SetFrequenceInner(freq); return true; } } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/ui_barcode.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/ui_barcode.cpp index 987dfc771..6638e1bae 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/ui_barcode.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/common/ui_barcode.cpp @@ -140,8 +140,8 @@ bool UIBarcode::FillImageInfo() GRAPHIC_LOGE("actualLength is 0 or actualLength > width"); return false; } - uint32_t step = width / actualLength; - imageInfo_.header.width = actualLength * step; + uint32_t step = static_cast(width / actualLength); + imageInfo_.header.width = static_cast(actualLength) * step; imageInfo_.header.height = height; imageInfo_.header.colorMode = RGB565; stride_ = DisplayDev::GetInstance()->CalcStride(imageInfo_.header.width, PIXEL_FMT_RGB_565); @@ -166,12 +166,12 @@ void UIBarcode::FillBarCodeColor(ImageInfo& imageInfo, int32_t actualLength, uin { uint8_t* data = const_cast(imageInfo.data); - for (uint32_t i = 0; i < actualLength; i++) { + for (uint32_t i = 0; i < static_cast(actualLength); i++) { if ((*(destData + i)) == 0) { continue; } - int16_t codeOffset = i * offset * 2; // 2: rgb565 has 2 byte per pixel + int16_t codeOffset = static_cast(i * offset * 2); // 2: rgb565 has 2 byte per pixel for (uint32_t k = 0; k < offset; k++) { *(data + codeOffset + k * 2) = 0; // 2: rgb565 has 2 byte per pixel *(data + codeOffset + k * 2 + 1) = 0; // 2: rgb565 has 2 byte per pixel diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp index c6a48d506..2b578d746 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_custom_hexagons_list.cpp @@ -60,7 +60,10 @@ void UICustomHexagonsList::RotateAnimatorCallback::Callback(UIView* view) float curScale = timeRatio * (endScale_ - startScale_) + startScale_; if (FloatMoreEqual(curScale, 1.0f)) { uint8_t opa = static_cast((1 - (curScale - 1.0f) / (TRASPANRENT_SCALE - 1.0f)) * OPA_OPAQUE); - hexView->GetViewByIndex(centerIndex_)->SetOpaScale(opa); + UIView* curview = hexView->GetViewByIndex(centerIndex_); + if (curview != nullptr) { + curview->SetOpaScale(opa); + } } if ((FloatMore(startScale_, endScale_) && (curScale >= endScale_)) || (FloatLess(startScale_, endScale_) || (curScale <= endScale_))) { @@ -86,8 +89,10 @@ void UICustomHexagonsList::StartRotateAnimator(uint8_t center, int16_t xDistance void UICustomHexagonsList::StopRotateAnimator() { - rotateAnimator_->Stop(); - rotateCallback_.ResetCallback(); + if (rotateAnimator_ != nullptr) { + rotateAnimator_->Stop(); + rotateCallback_.ResetCallback(); + } } #if ENABLE_ROTATE_INPUT diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_input_method.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_input_method.cpp index 963891f97..f6da2932b 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_input_method.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_input_method.cpp @@ -13,11 +13,11 @@ * limitations under the License. */ -#include "input_method/ui_input_method.h" +#include #include "common/screen.h" #include "components/root_view.h" -#include "font/ui_font.h" #include "input_method/ui_soft_keyboard.h" +#include "input_method/ui_input_method.h" #if ENABLE_SOFT_KEYBOARD namespace OHOS { @@ -26,6 +26,7 @@ enum class SYS_IMT_TYPE { SYS_IME_CAP, SYS_IME_NUMBER, SYS_IME_SYMBOL, + SYS_IME_PINYIN, SYS_IME_ALL, }; UIInputMethod::UIInputMethod() @@ -34,6 +35,7 @@ UIInputMethod::UIInputMethod() customSoftKeyboard_.PushBack(UICapitalSoftKeyboard::GetInstance()); customSoftKeyboard_.PushBack(UINumberSoftKeyboard::GetInstance()); customSoftKeyboard_.PushBack(UISymbolSoftKeyboard::GetInstance()); + customSoftKeyboard_.PushBack(UIPinyinSoftKeyboard::GetInstance()); curSoftKeyboard_ = customSoftKeyboard_[static_cast(SYS_IMT_TYPE::SYS_IME_EN)]; } @@ -54,6 +56,15 @@ UIInputMethod::~UIInputMethod() previeBox_ = nullptr; } + if (pinyinPreview_ != nullptr) { + delete pinyinPreview_; + pinyinPreview_ = nullptr; + } + + ClearPinyinTable(); + + ClearHanziCandidate(); + curSoftKeyboard_ = nullptr; isInit_ = false; } @@ -70,15 +81,16 @@ void UIInputMethod::OnShow(InputMethodManager::InputMethodParam& param) GRAPHIC_LOGD("UI system soft keyboard has been shown\n"); return; } + SetupPinyinTable(); InitInputMethod(); // update edit text edit_ = static_cast(param.view); if (previeBox_ != nullptr) { previeBox_->SetInputType(param.inputType); + previeBox_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, UITextPreviewBox::DEFAULT_EDIT_FONT_SIZE); previeBox_->SetText(param.text.c_str()); previeBox_->Focus(); - previeBox_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, UITextPreviewBox::DEFAULT_EDIT_FONT_SIZE); if (edit_ != nullptr) { previeBox_->SetStyle(STYLE_LINE_HEIGHT, edit_->GetStyle(STYLE_LINE_HEIGHT)); previeBox_->SetMaxLength(edit_->GetMaxLength()); @@ -117,7 +129,7 @@ void UIInputMethod::OnHide() InputMethodManager::GetInstance().OnKeyboardHide(); } -void UIInputMethod::Input(UI_KEYCODE &key) +void UIInputMethod::Input(UI_KEYCODE key) { if (key >= UI_KEYCODE::UI_KEY_SOFT_KEYBOARD) { ChangSoftKeyboard(key); @@ -128,6 +140,61 @@ void UIInputMethod::Input(UI_KEYCODE &key) } } +void UIInputMethod::InputPinyin(UI_KEYCODE key) +{ + // process pinyin logic here + if (key >= UI_KEYCODE::UI_KEY_SOFT_KEYBOARD) { + if (curKeyboardIndex_ == static_cast(SYS_IMT_TYPE::SYS_IME_PINYIN)) { + HidePinyinPreview(); + HideHanziPageList(); + } + ChangSoftKeyboard(key); + return; + } + if (curSoftKeyboard_ == nullptr) { + return; + } + + switch (key) { + case UI_KEYCODE::UI_KEY_ENTER: + HidePinyinPreview(); + HideHanziPageList(); + DealSendKey(); + break; + case UI_KEYCODE::UI_KEY_DEL: + if (pinyinPreview_ && pinyinPreview_->IsVisible()) { + DealPinyinDelKey(); + } else { + DealDelKey(); + } + break; + default: + if (key >= UI_KEYCODE::UI_KEY_a && key <= UI_KEYCODE::UI_KEY_z) { + InsertPinyin(key); + } else { + DealNormalKey(key); + } + break; + } +} + +void UIInputMethod::ShowHanziPageList() +{ + if (hanziList_ == nullptr || pinyinPreview_ == nullptr) { + return; + } + if (pinyinPreview_->GetText() != nullptr && strlen(pinyinPreview_->GetText()) != 0) { + hanziList_->SetVisible(true); + } +} + +void UIInputMethod::HideHanziPageList() +{ + if (hanziList_ != nullptr) { + hanziList_->SetVisible(false); + } +} + uint8_t UIInputMethod::HideOptionBox() { if ((optionBox_ == nullptr) || !optionBox_->IsVisible()) { @@ -152,10 +219,32 @@ void UIInputMethod::ShowOptionBox(UIView *view, UI_KEYCODE *keys, uint8_t num) return; } +bool UIInputMethod::OnClick(UIView& view, const ClickEvent& event) +{ + if (previeBox_ == nullptr) { + return false; + } + UILabelButton *btn = dynamic_cast(&view); + if (btn == nullptr) { + return false; + } + + std::string u8hanzi; + const char *hanzi = btn->GetText(); + if (hanzi != nullptr) { + u8hanzi = hanzi; + } + previeBox_->InsertHanzi(u8hanzi); + HideHanziPageList(); + HidePinyinPreview(); + return true; +} + void UIInputMethod::DealSendKey() { std::string inputText = previeBox_->GetText(); InputMethodManager::GetInstance().InsertText(inputText); + ClearPinyinTable(); InputMethodManager::GetInstance().HideInputMethod(); } @@ -166,7 +255,92 @@ void UIInputMethod::DealDelKey() } } -void UIInputMethod::DealFunctionKey(UI_KEYCODE &keyCode) +void UIInputMethod::DealPinyinDelKey() +{ + if (pinyinPreview_ == nullptr) { + return; + } + const char *str = pinyinPreview_->GetText(); + std::string pinyin; + if (str != nullptr && strlen(str) > 0) { + pinyin = str; + } + if (pinyin.length() > 0) { + pinyin = pinyin.substr(0, pinyin.length() - 1); + pinyinPreview_->SetText(pinyin.c_str()); + } + const char *text = pinyinPreview_->GetText(); + if (text == nullptr || strlen(text) == 0) { + pinyinPreview_->SetVisible(false); + HideHanziPageList(); + return; + } + + // find pinyin hanzi, and display! + UpdateHanziOption(text); +} + +void UIInputMethod::HidePinyinPreview() +{ + if (pinyinPreview_ != nullptr) { + pinyinPreview_->SetText(""); + pinyinPreview_->SetVisible(false); + } +} + +void UIInputMethod::ShowPinyinPreview() +{ + if (pinyinPreview_ != nullptr) { + pinyinPreview_->SetVisible(true); + } +} + +void UIInputMethod::ClearHanziCandidate() +{ + if (hanziAdapter_ != nullptr) { + delete hanziAdapter_; + hanziAdapter_ = nullptr; + } + if (hanziList_ != nullptr) { + delete hanziList_; + hanziList_ = nullptr; + } + memset_s(hanziMatched_, sizeof(hanziMatched_), 0, + sizeof(hanziMatched_)); +} + +void UIInputMethod::SetupHanziCandidate() +{ + if (inputMethod_ == nullptr) { + return; + } + ClearHanziCandidate(); + int16_t x = 28; + int16_t y = 200; + int16_t w = 398; + int16_t h = 50; + int8_t gap = 2; + int16_t buttonGap = (w - gap) / DEFAULT_NUMPERPAGE; + int16_t btnWidth = buttonGap - gap; + int16_t btnHeight = h - gap * 2; // 2: half + + hanziAdapter_ = new HanziAdapter; + // set height, set width, set data + hanziAdapter_->SetWidthAndHeight(w, h); + hanziAdapter_->SetClickListener(this); + + hanziList_ = new UIList(UIList::HORIZONTAL); + // set position, font, adapter, listener, and add to inputmethod + hanziList_->SetPosition(x, y, w, h); + hanziList_->SetStyle(STYLE_BACKGROUND_COLOR, 0xFFE8EAEE); + hanziList_->SetIntercept(false); + hanziList_->SetAdapter(hanziAdapter_); + hanziList_->SetScrollStateListener(this); + hanziList_->SetVisible(false); + inputMethod_->Add(hanziList_); +} + +void UIInputMethod::DealFunctionKey(UI_KEYCODE keyCode) { if (curSoftKeyboard_ != nullptr) { switch (keyCode) { @@ -182,7 +356,7 @@ void UIInputMethod::DealFunctionKey(UI_KEYCODE &keyCode) } } -void UIInputMethod::DealNormalKey(UI_KEYCODE &keyCode) +void UIInputMethod::DealNormalKey(UI_KEYCODE keyCode) { if (previeBox_ != nullptr) { UITextPreviewBox::TextPreviewBoxMode mode = previeBox_->GetEditMode(); @@ -200,7 +374,7 @@ void UIInputMethod::DealNormalKey(UI_KEYCODE &keyCode) } } -void UIInputMethod::ChangSoftKeyboard(UI_KEYCODE &keyCode) +void UIInputMethod::ChangSoftKeyboard(UI_KEYCODE keyCode) { switch (keyCode) { case UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_EN: @@ -215,6 +389,9 @@ void UIInputMethod::ChangSoftKeyboard(UI_KEYCODE &keyCode) case UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_SYMBOL: curKeyboardIndex_ = static_cast(SYS_IMT_TYPE::SYS_IME_SYMBOL); break; + case UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_PINYIN: + curKeyboardIndex_ = static_cast(SYS_IMT_TYPE::SYS_IME_PINYIN); + break; default: curKeyboardIndex_++; break; @@ -234,7 +411,7 @@ void UIInputMethod::ChangSoftKeyboard(UI_KEYCODE &keyCode) inputMethod_->Invalidate(); } -void UIInputMethod::InsertChar(UI_KEYCODE& keyCode) +void UIInputMethod::InsertChar(UI_KEYCODE keyCode) { if (previeBox_ != nullptr) { previeBox_->InsertChar(keyCode); @@ -242,6 +419,60 @@ void UIInputMethod::InsertChar(UI_KEYCODE& keyCode) return; } +void UIInputMethod::InsertPinyin(UI_KEYCODE pinyin) +{ + if (pinyinPreview_ == nullptr) { + return; + } + char ch = static_cast(pinyin); + std::string originPinyin; + const char *str = pinyinPreview_->GetText(); + if (str != nullptr && strlen(str) > 0) { + originPinyin = str; + } + originPinyin = originPinyin + ch; + pinyinPreview_->SetText(originPinyin.c_str()); + pinyinPreview_->SetVisible(true); + const char *text = pinyinPreview_->GetText(); + if (text == nullptr) { + return; + } + + // find pinyin hanzi, and display! + UpdateHanziOption(text); +} + +void UIInputMethod::UpdateHanziOption(const std::string &pinyin) +{ + if (pinyin.empty() || pinyinTable_ == nullptr) { + return; + } + + PinyinState res = pinyinTable_->FindHanzi(pinyin); + if (res != PinyinState::SUCCESS) { + GRAPHIC_LOGE("%s", pinyinTable_->DebugInfo(res).c_str()); + return; + } + + uint8_t matchnum = pinyinTable_->GetMatchHanziNum(); + if (matchnum == 0) { + return; + } + + memset_s(hanziMatched_, sizeof(hanziMatched_), + 0, sizeof(hanziMatched_)); + res = pinyinTable_->GetAllHanzi(hanziMatched_, + sizeof(hanziMatched_) / sizeof(hanziMatched_[0])); + if (res != PinyinState::SUCCESS) { + GRAPHIC_LOGE("%s", pinyinTable_->DebugInfo(res).c_str()); + return; + } + hanziAdapter_->SetData(hanziMatched_, matchnum); + hanziList_->ScrollTo(0); + hanziList_->SetVisible(true); + hanziList_->RefreshList(); +} + void UIInputMethod::InitInputMethod() { if (isInit_) { @@ -261,6 +492,8 @@ void UIInputMethod::InitInputMethod() SetupOptionBox(); SetupSoftKeyboard(); SetupTextPreviewBox(); + SetupHanziCandidate(); + SetupPinyinPreviewBox(); isInit_ = true; } @@ -301,5 +534,117 @@ void UIInputMethod::SetupTextPreviewBox() inputMethod_->Add(previeBox_); } } + +void UIInputMethod::SetupPinyinPreviewBox() +{ + if (pinyinPreview_ != nullptr) { + return; + } + pinyinPreview_ = new UILabel; + int16_t x = 28; + int16_t y = 160; + int16_t w = 77; + int16_t h = 30; + pinyinPreview_->SetPosition(x, y, w, h); + pinyinPreview_->SetStyle(STYLE_BACKGROUND_COLOR, 0xFFE8EAEE); + pinyinPreview_->SetStyle(STYLE_BORDER_RADIUS, 10); // 10: border radius + pinyinPreview_->SetText(""); + pinyinPreview_->SetTouchable(false); + pinyinPreview_->SetTextColor(Color::Black()); + pinyinPreview_->SetViewId("input_pinyin_text_view_id"); + pinyinPreview_->SetVisible(false); + + inputMethod_->Add(pinyinPreview_); +} + +void UIInputMethod::SetupPinyinTable() +{ + if (pinyinTable_ != nullptr) { + return; + } + pinyinTable_ = new PinyinCandidate(); + if (pinyinTable_ == nullptr) { + return; + } + +#ifndef WIN32 + PinyinState state = pinyinTable_->Init("/user/res/pymb.bin"); +#else + PinyinState state = pinyinTable_->Init(RES_PATH"/pymb.bin"); +#endif + if (state != PinyinState::SUCCESS) { + ClearPinyinTable(); + } +} + +void UIInputMethod::ClearPinyinTable() +{ + if (pinyinTable_ != nullptr) { + delete pinyinTable_; + pinyinTable_ = nullptr; + } +} + +UIView* UIInputMethod::HanziAdapter::GetView(UIView* inView, int16_t index) +{ + if (data_ == nullptr || size_ == 0) { + return nullptr; + } + if (index < 0 || index >= static_cast(size_)) { + return nullptr; + } + + UILabelButton* item = dynamic_cast(inView); + if (item == nullptr) { + int16_t gap = 2; + item = new UILabelButton; + item->SetPosition(0, 0); + item->Resize(GetItemWidthWithMargin(index) - gap, GetItemHeightWithMargin(index)); + } + item->SetOnClickListener(clickListener_); + item->SetText(reinterpret_cast(data_[index])); + item->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); // 40: means font size + item->SetViewIndex(index); + item->SetAlign(TEXT_ALIGNMENT_CENTER); + item->SetStyleForState(STYLE_BORDER_RADIUS, 0, UIButton::RELEASED); + item->SetStyleForState(STYLE_BORDER_RADIUS, 0, UIButton::PRESSED); + item->SetStyleForState(STYLE_BORDER_RADIUS, 0, UIButton::INACTIVE); + item->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::RELEASED); + item->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::PRESSED); + item->SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::INACTIVE); + item->SetTextColor(Color::Black()); + return item; +} + +uint16_t UIInputMethod::HanziAdapter::GetCount() +{ + return size_; +} + +int16_t UIInputMethod::HanziAdapter::GetItemWidthWithMargin(int16_t index) +{ + return width_ * 1.0 / UIInputMethod::DEFAULT_NUMPERPAGE; +} + +int16_t UIInputMethod::HanziAdapter::GetItemHeightWithMargin(int16_t index) +{ + return height_; +} + +bool UIInputMethod::HanziAdapter::SetWidthAndHeight(int16_t w, int16_t h) +{ + if (w > 0 && h > 0) { + width_ = w; + height_ = h; + return true; + } + return false; +} + +void UIInputMethod::HanziAdapter::SetData(int8_t hanzi[][PinyinCandidate::IME_HZLENTH], uint8_t len) +{ + data_ = hanzi; + size_ = len; +} } // namespace OHOS #endif // ENABLE_SOFT_KEYBOARD diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_keyboard_button.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_keyboard_button.cpp index e22d60f16..f3175a649 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_keyboard_button.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_keyboard_button.cpp @@ -15,6 +15,7 @@ #include "input_method/ui_keyboard_button.h" #include "input_method/ui_input_method.h" +#include "input_method/ui_soft_keyboard.h" #if ENABLE_SOFT_KEYBOARD namespace OHOS { @@ -66,6 +67,9 @@ void UIKeyboardButton::GetFuncKeyText(UI_KEYCODE key, std::string &tmpText) case UI_KEYCODE::UI_KEY_ENTER: tmpText += "Send"; break; + case UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_PINYIN: + tmpText += "中"; + break; case UI_KEYCODE::UI_KEY_DEL: tmpText += "Del"; break; @@ -91,10 +95,6 @@ void UIKeyboardButton::GetFuncKeyText(UI_KEYCODE key, std::string &tmpText) void UIKeyboardButton::SetButtonText() { - if (keyCode_ == nullptr) { - return; - } - std::string tmpText; for (uint8_t i = 0; i < keyNum_; i++) { UI_KEYCODE key = keyCode_[i]; @@ -118,6 +118,11 @@ void UIKeyboardButton::Clear() bool UIKeyboardButton::OnClickEvent(const ClickEvent& event) { if (keyNum_ == 1) { + UIPinyinSoftKeyboard *parent = dynamic_cast(GetParent()); + if (parent != nullptr) { + UIInputMethod::GetInstance()->InputPinyin(keyCode_[0]); + return true; + } UIInputMethod::GetInstance()->Input(keyCode_[0]); } return true; @@ -126,6 +131,10 @@ bool UIKeyboardButton::OnClickEvent(const ClickEvent& event) bool UIKeyboardButton::OnPressEvent(const PressEvent& event) { if (keyNum_ > 1) { + UIPinyinSoftKeyboard *parent = dynamic_cast(GetParent()); + if (parent != nullptr) { + UIInputMethod::GetInstance()->HideHanziPageList(); + } UIInputMethod::GetInstance()->ShowOptionBox(this, keyCode_, keyNum_); } return true; @@ -134,7 +143,13 @@ bool UIKeyboardButton::OnPressEvent(const PressEvent& event) bool UIKeyboardButton::OnReleaseEvent(const ReleaseEvent& event) { if (keyNum_ > 1) { + UIPinyinSoftKeyboard *parent = dynamic_cast(GetParent()); uint8_t keyIndex = UIInputMethod::GetInstance()->HideOptionBox(); + if (parent != nullptr) { + UIInputMethod::GetInstance()->ShowHanziPageList(); + UIInputMethod::GetInstance()->InputPinyin(keyCode_[keyIndex]); + return true; + } UIInputMethod::GetInstance()->Input(keyCode_[keyIndex]); } return true; @@ -143,7 +158,13 @@ bool UIKeyboardButton::OnReleaseEvent(const ReleaseEvent& event) bool UIKeyboardButton::OnDragEndEvent(const DragEvent& event) { if (keyNum_ > 1) { + UIPinyinSoftKeyboard *parent = dynamic_cast(GetParent()); uint8_t keyIndex = UIInputMethod::GetInstance()->HideOptionBox(); + if (parent != nullptr) { + UIInputMethod::GetInstance()->ShowHanziPageList(); + UIInputMethod::GetInstance()->InputPinyin(keyCode_[keyIndex]); + return true; + } UIInputMethod::GetInstance()->Input(keyCode_[keyIndex]); } return true; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp index ca2585861..77c637024 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_lite_surface_view.cpp @@ -26,6 +26,11 @@ #include "common/low_power_manager.h" #include "components/ui_lite_surface_view.h" + +#ifndef UIKIT_SKIP_LINE +#define UIKIT_SKIP_LINE 1 +#endif + namespace OHOS { static constexpr int16_t YUV_WIDTH_ALIGNMENT = 128; UILiteSurfaceView::UILiteSurfaceView() : isLayerInit_(false), flushCount_(0) @@ -36,8 +41,6 @@ UILiteSurfaceView::UILiteSurfaceView() : isLayerInit_(false), flushCount_(0) return; } surface_->RegisterConsumerListener(*this); - LiteMGfxEngine::GetInstance()->AddHardwareLayer(this); - GraphicService::GetInstance()->EnableAsyncMode(false); LowPowerManager::GetInstance()->PowerLock(); } @@ -116,10 +119,7 @@ void UILiteSurfaceView::Flush() --flushCount_; lock_.Unlock(); currentBuffer_ = surface_->AcquireBuffer(); - PreHandleStatus(); if (currentBuffer_ == nullptr) { - surface_->ReleaseBuffer(lastFlushedBuffer_); - lastFlushedBuffer_ = nullptr; return; } @@ -145,25 +145,6 @@ void UILiteSurfaceView::Flush() } } -void UILiteSurfaceView::PreHandleStatus() -{ - if (currentBuffer_ == nullptr) { - return; - } - - if (currentBuffer_->format == PIXEL_FMT_BUTT) { - DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, false, 0); - currentBuffer_->format = PIXEL_FMT_YCBCR_420_SP; - surface_->ReleaseBuffer(currentBuffer_); - currentBuffer_ = nullptr; - isStopped_ = true; - isFirstFrameCome_ = false; - } else if (currentBuffer_->format != PIXEL_FMT_BUTT && isStopped_) { - DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, true, colorKey_.full); - isStopped_ = false; - } -} - void UILiteSurfaceView::PostFlush() { if (currentBuffer_ != nullptr) { @@ -223,8 +204,13 @@ bool UILiteSurfaceView::GetBitmap(ImageInfo& bitmap) yuv.uvStride = ALIGN_BYTE(lastFlushedBuffer_->width, YUV_WIDTH_ALIGNMENT); CscRgbBuf rgb = {0}; +#if UIKIT_SKIP_LINE + rgb.width = lastFlushedBuffer_->width / 2; // 2: half + rgb.height = lastFlushedBuffer_->height / 2; // 2: half +#else rgb.width = lastFlushedBuffer_->width; rgb.height = lastFlushedBuffer_->height; +#endif rgb.stride = ALIGN_BYTE(rgb.width, BYTE_ALIGNMENT) * 3; // 3: 3 bytes for rgb888 bitmap.header.colorMode = RGB888; @@ -234,7 +220,15 @@ bool UILiteSurfaceView::GetBitmap(ImageInfo& bitmap) bitmap.header.compressMode = 0; bitmap.header.reserved = 0; rgb.addr = reinterpret_cast(ImageCacheMalloc(bitmap)); - CscConvertYuvToRgb(&rgb, &yuv); + if (rgb.addr != nullptr) { +#if UIKIT_SKIP_LINE + CscConvertYuvToRgbWithSkipLP(&rgb, &yuv); +#else + CscConvertYuvToRgb(&rgb, &yuv); +#endif + } else { + GRAPHIC_LOGE("UILiteSurfaceView::GetBitmap img alloc failed! size: 0x%x\n", bitmap.dataSize); + } } return true; } @@ -255,6 +249,9 @@ void UILiteSurfaceView::BlitBitmapToFb(BufferInfo& gfxDstBuffer, const Rect& inv Rect rect = GetRect(); rect.Intersect(rect, invalidatedArea); BlendOption blendOption; +#if UIKIT_SKIP_LINE + blendOption.transMap.Scale(Vector2{2.0, 2.0}, Vector2{0, 0}); // 2.0: scale 2 +#endif blendOption.opacity = OPA_OPAQUE; blendOption.mode = BLEND_SRC_OVER; BaseGfxEngine::GetInstance()->Blit(gfxDstBuffer, {0, 0}, src, rect, blendOption); @@ -262,6 +259,25 @@ void UILiteSurfaceView::BlitBitmapToFb(BufferInfo& gfxDstBuffer, const Rect& inv } #endif +void UILiteSurfaceView::AdjustArea(Rect& rect) +{ + if (rect.GetX() % 2 != 0) { // 2: mod + if (rect.GetX() < 0) { + rect.SetX(rect.GetX() + 1); + } else { + rect.SetX(rect.GetX() - 1); + } + } + + if (rect.GetY() % 2 != 0) { // 2: mod + if (rect.GetY() < 0) { + rect.SetY(rect.GetY() + 1); + } else { + rect.SetY(rect.GetY() - 1); + } + } +} + void UILiteSurfaceView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) { if (surface_ == nullptr) { @@ -269,13 +285,21 @@ void UILiteSurfaceView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidated return; } + if ((isStopped_ || lastFlushedBuffer_ == nullptr) && preView_ != nullptr) { + const ImageInfo* info = preView_->GetImageInfo(); + Rect coords(GetX(), GetY(), GetX() + info->header.width - 1, GetY() + info->header.height - 1); + preView_->DrawImage(gfxDstBuffer, coords, invalidatedArea, *style_, opaScale_); + return; + } + #ifdef VERSION_IOT if (lastFlushedBuffer_ != nullptr && RootView::GetInstance()->GetSnapshotFlag()) { ImageInfo bitmap; - GetBitmap(bitmap); - BlitBitmapToFb(gfxDstBuffer, invalidatedArea, bitmap); - ImageCacheFree(bitmap); - return; + if (GetBitmap(bitmap)) { + BlitBitmapToFb(gfxDstBuffer, invalidatedArea, bitmap); + ImageCacheFree(bitmap); + return; + } } #endif @@ -286,6 +310,7 @@ void UILiteSurfaceView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidated if (!(layerRect_ == GetRect())) { layerRect_ = GetRect(); + AdjustArea(layerRect_); Rect dirtyRect(0, 0, layerRect_.GetWidth() - 1, layerRect_.GetHeight() - 1); DisplayDev::GetInstance()->SetLayerPositon(LAYER_1, layerRect_.GetX(), layerRect_.GetY()); DisplayDev::GetInstance()->SetLayerDirtyRegion(LAYER_1, dirtyRect); @@ -296,18 +321,62 @@ void UILiteSurfaceView::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidated void UILiteSurfaceView::OnBufferAvailable() { lock_.Lock(); - ++flushCount_; - lock_.Unlock(); - if (!isFirstFrameCome_) { - isFirstFrameCome_ = true; + SurfaceBuffer* back = surface_->GetBackBuf(); + bool isLastFrame = (back->format == PIXEL_FMT_BUTT); + if (isLastFrame) { + back->format = PIXEL_FMT_YCBCR_420_SP; + flushCount_ = 0; + } else { + ++flushCount_; } - if (!isLayerInit_) { - InitLayer(); + lock_.Unlock(); + + if (isLastFrame) { + isStopped_ = true; + GraphicService::GetInstance()->PostGraphicEvent( + [&] { + if (surface_ != nullptr) { + DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, false, 0); + LiteMGfxEngine::GetInstance()->ClearHardwareLayer(); + LiteMGfxEngine::GetInstance()->EnableAsyncMode(true); + surface_->ClearBuffers(); + currentBuffer_ = nullptr; + lastFlushedBuffer_ = nullptr; + } + }); + } else if (isStopped_) { + isStopped_ = false; + GraphicService::GetInstance()->PostGraphicEvent( + [&] { + LiteMGfxEngine::GetInstance()->EnableAsyncMode(false); + LiteMGfxEngine::GetInstance()->AddHardwareLayer(this); + DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, true, colorKey_.full); + InitLayer(); + }); } - OHOS::GraphicEventHandler::GetInstance()->PostGraphicEvent( + + GraphicService::GetInstance()->PostGraphicEvent( [] { RootView::GetInstance()->Invalidate(); - }, - false); + }); +} + +void UILiteSurfaceView::SetPreview(ImageInfo* info) +{ + if (preView_ == nullptr) { + preView_ = new Image(); + } + if (preView_ != nullptr) { + preView_->SetSrc(info); + } +} + +void UILiteSurfaceView::DumpImgInfo() +{ + if (preView_ != nullptr) { + printf("view[%p]: viewType = %d\n", this, GetViewType()); + const ImageInfo* info = preView_->GetImageInfo(); + PrintImgInfo(info); + } } } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_menu_item.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_menu_item.cpp index d4c799a8b..37a8fc7f3 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_menu_item.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_menu_item.cpp @@ -43,20 +43,19 @@ UIMenuItem::~UIMenuItem() void UIMenuItem::SetScaleCenter() { - Rect rect = GetOrigRect(); if (transAlignMode_ == ScaleAlignMode::ALIGN_TEXT_LEFT) { - textScaleCenter_ = Vector2{0.0, textRect_.GetHeight() / 2}; - imgScaleCenter_ = Vector2{textRect_.GetLeft() - imgRect_.GetLeft(), textRect_.GetHeight() / 2}; - itemScaleCenter_ = Vector2{textRect_.GetLeft(), textRect_.GetHeight() / 2}; + textScaleCenter_ = Vector2{0.0, textRect_.GetHeight() / 2.0f}; + imgScaleCenter_ = Vector2{textRect_.GetLeft() - imgRect_.GetLeft(), textRect_.GetHeight() / 2.0f}; + itemScaleCenter_ = Vector2{textRect_.GetLeft(), textRect_.GetHeight() / 2.0f}; } else if (transAlignMode_ == ScaleAlignMode::ALIGN_IMAGE_LEFT) { - textScaleCenter_ = Vector2{imgRect_.GetLeft() - textRect_.GetLeft(), imgRect_.GetHeight() / 2}; - imgScaleCenter_ = Vector2{0.0, imgRect_.GetHeight() / 2}; - itemScaleCenter_ = Vector2{imgRect_.GetLeft(), imgRect_.GetHeight() / 2}; + textScaleCenter_ = Vector2{imgRect_.GetLeft() - textRect_.GetLeft(), imgRect_.GetHeight() / 2.0f}; + imgScaleCenter_ = Vector2{0.0, imgRect_.GetHeight() / 2.0f}; + itemScaleCenter_ = Vector2{imgRect_.GetLeft(), imgRect_.GetHeight() / 2.0f}; } else if (transAlignMode_ == ScaleAlignMode::ALIGN_ITEM_CENTER) { Rect rect = GetOrigRect(); - itemScaleCenter_ = Vector2{rect.GetX() + rect.GetWidth() / 2, rect.GetHeight() / 2}; - textScaleCenter_ = Vector2{itemScaleCenter_.x_ - textRect_.GetLeft(), rect.GetHeight() / 2}; - imgScaleCenter_ = Vector2{itemScaleCenter_.x_ - imgRect_.GetLeft(), rect.GetHeight() / 2}; + itemScaleCenter_ = Vector2{rect.GetX() + rect.GetWidth() / 2.0f, rect.GetHeight() / 2.0f}; + textScaleCenter_ = Vector2{itemScaleCenter_.x_ - textRect_.GetLeft(), rect.GetHeight() / 2.0f}; + imgScaleCenter_ = Vector2{itemScaleCenter_.x_ - imgRect_.GetLeft(), rect.GetHeight() / 2.0f}; } } @@ -99,7 +98,7 @@ void UIMenuItem::ReMeasure() UpdateTransformMap(); } -void UIMenuItem::SetImageSrc(const char* ImgSrc) +void UIMenuItem::SetImageSrc(const char* imgSrc) { if (image_ == nullptr) { image_ = new UIImageView(); @@ -110,12 +109,12 @@ void UIMenuItem::SetImageSrc(const char* ImgSrc) image_->SetResizeMode(resizeMode_); image_->SetAutoEnable(false); } - image_->SetSrc(ImgSrc); + image_->SetSrc(imgSrc); UpdateRect(); SetScaleCenter(); } -void UIMenuItem::SetImageSrc(const ImageInfo* ImgSrc) +void UIMenuItem::SetImageSrc(const ImageInfo* imgSrc) { if (image_ == nullptr) { image_ = new UIImageView(); @@ -126,7 +125,7 @@ void UIMenuItem::SetImageSrc(const ImageInfo* ImgSrc) image_->SetResizeMode(resizeMode_); image_->SetAutoEnable(false); } - image_->SetSrc(ImgSrc); + image_->SetSrc(imgSrc); UpdateRect(); SetScaleCenter(); } @@ -136,7 +135,7 @@ void UIMenuItem::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, GetRect(), invalidatedArea, *style_, opaScale_); if (text_ != nullptr) { Rect rect; - rect.Join(invalidatedArea, textRect_); + rect.Intersect(invalidatedArea, textRect_); if (rect.GetLeft() < 0) { rect.SetLeft(0); } @@ -153,4 +152,15 @@ void UIMenuItem::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) image_->OnDraw(gfxDstBuffer, invalidatedArea); } } + +void UIMenuItem::DumpImgInfo() +{ + if (image_ == nullptr) { + return; + } + printf("view[%p]: viewType = %d\n", this, GetViewType()); + const ImageInfo* info = image_->GetImageInfo(); + PrintImgInfo(info); +} + } // namespace OHOS diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_pinyin_candidate.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_pinyin_candidate.cpp new file mode 100644 index 000000000..59d9a30e3 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_pinyin_candidate.cpp @@ -0,0 +1,364 @@ +/* + * Copyright (c) 2022 CompanyNameMagicTag. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include +#include "common/graphic_utils.h" +#include "input_method/ui_pinyin_candidate.h" + +#if ENABLE_SOFT_KEYBOARD +namespace OHOS { + +PinyinCandidate::PinyinCandidate() +{ + memset_s(m_pyTabBuf, sizeof(m_pyTabBuf), 0, sizeof(m_pyTabBuf)); + memset_s(m_hzTabBuf, sizeof(m_hzTabBuf), 0, sizeof(m_hzTabBuf)); +} + +PinyinCandidate::~PinyinCandidate() +{ +} + +PinyinCandidate::PinyinState PinyinCandidate::InitPinyinTablePath(const std::string &path) +{ + size_t len = path.length(); + char *tablePath = new char[len + 1]; + defer { + delete []tablePath; + }; + if (tablePath == nullptr) { + GRAPHIC_LOGE("the length of path is too long."); + return PinyinState::MEM_ALLOC_ERROR; + } + int32_t ret = snprintf_s(tablePath, len + 1, len, "%s", path.c_str()); + if (ret == -1) { + GRAPHIC_LOGE("Secure fuction issue."); + return PinyinState::MEM_COPY_ERROR; + } + char truePath[PATH_MAX + 1] = {0x00}; +#ifndef WIN32 + if ((path.length() == 0) || (realpath(tablePath, truePath) == nullptr)) { + GRAPHIC_LOGE("The path of pin yin table is invalid."); + return PinyinState::INVALID_PATH; + } +#else + memcpy_s(truePath, sizeof(truePath), tablePath, len + 1); +#endif + m_pinyinTablePath = truePath; + return PinyinState::SUCCESS; +} + +int32_t PinyinCandidate::SetLv2NumPerPage(uint8_t num) +{ + if ((num < 1) || (num > 10)) { // 10是汉字候选码的个数 + return -1; + } else { + m_lv2NumPerPage = num; + return 0; + } +} + +PinyinCandidate::PinyinState PinyinCandidate::Init(const std::string &path) +{ + PinyinState pathState = InitPinyinTablePath(path); + if (pathState != PinyinState::SUCCESS) { + return pathState; + } + InitEx(); + return PinyinState::SUCCESS; +} + +void PinyinCandidate::InitEx(void) +{ + int32_t ret; + size_t len = m_pinyinTablePath.length(); + char *table = new char[len + 1]; + defer { + delete []table; + }; + if (table == nullptr) { + GRAPHIC_LOGE("Malloc mem fails."); + return; + } + + ret = snprintf_s(table, len + 1, len, "%s", m_pinyinTablePath.c_str()); + if (ret == -1) { + GRAPHIC_LOGE("Secure fuction issue."); + return; + } + + ret = LoadCodeTable((const int8_t *)table); + if (ret != 0) { + GRAPHIC_LOGE("LoadCodeTable failed!"); + } +} + +std::string PinyinCandidate::DebugInfo(PinyinCandidate::PinyinState state) const +{ + static const struct { + PinyinState state; + std::string info; + } infoTable[] = { + {PinyinState::SUCCESS, "SUCCESS"}, + {PinyinState::INVALID_PINYIN, "INVALID_PINYIN"}, + {PinyinState::INVALID_PATH, "INVALID_PATH"}, + {PinyinState::MEM_NOT_ENOUGH, "MEM_NOT_ENOUGH"}, + {PinyinState::MEM_SET_ERROR, "MEM_SET_ERROR"}, + {PinyinState::MEM_COPY_ERROR, "MEM_COPY_ERROR"}, + {PinyinState::MEM_ALLOC_ERROR, "MEM_ALLOC_ERROR"}, + {PinyinState::INVALID_PAGE_INDEX, "INVALID_PAGE_INDEX"}, + }; + for (size_t i = 0; i < sizeof(infoTable) / sizeof(infoTable[0]); ++i) { + if (infoTable[i].state == state) { + return infoTable[i].info; + } + } + return "not defined!"; +} + +PinyinCandidate::PinyinState PinyinCandidate::FindHanzi(const std::string &sourceStr) +{ + if (sourceStr.length() > IME_PYMAXLENTH) { + return PinyinState::INVALID_PINYIN; + } + + bool candidateFlag = false; + + hanziStatus_.m_currentHzPage = 0; + hanziStatus_.m_currentHzIndex = 0; + hanziStatus_.m_matchHzNumber = 0; + pinyinStatus_.m_currentPyIndex = sourceStr[0] - 'a'; + + if (pinyinStatus_.m_currentPyIndex >= MAXCHARNUM) { + return PinyinState::INVALID_PINYIN; + } + + uint8_t index; + for (index = 0; index < MAXSAMEPREFIXPY; index++) { + if (strncmp(sourceStr.c_str(), + reinterpret_cast(m_pyTabBuf[pinyinStatus_.m_currentPyIndex][index].pinyin), + sourceStr.length()) == 0) { + candidateFlag = true; + break; + } + } + + if (candidateFlag == false) { + GRAPHIC_LOGE("查找拼音索引出错!!\n"); + return PinyinState::INVALID_PINYIN; + } + + hanziStatus_.m_currentHzIndex = m_pyTabBuf[pinyinStatus_.m_currentPyIndex][index].hzIndex; + hanziStatus_.m_matchHzNumber = m_pyTabBuf[pinyinStatus_.m_currentPyIndex][index].hzNum; + if (m_lv2NumPerPage != 0) { + hanziStatus_.m_matchHZPageNumber = + static_cast(ceil(1.0 * hanziStatus_.m_matchHzNumber / m_lv2NumPerPage)); + } + + return PinyinState::SUCCESS; +} + +PinyinCandidate::PinyinState PinyinCandidate::GetHanziPage( + uint8_t pageNumber, int8_t candidate[][IME_HZLENTH], uint8_t len) +{ + if (len < m_lv2NumPerPage) { + /* 存放结果的字符串长度小于要求长度 */ + return PinyinState::MEM_NOT_ENOUGH; + } + + if (pageNumber >= GetHanziPagesNum()) { + return PinyinState::INVALID_PAGE_INDEX; + } + + for (uint8_t i = 0; i < m_lv2NumPerPage; i++) { + uint16_t curIndex = hanziStatus_.m_currentHzIndex + (pageNumber * m_lv2NumPerPage) + i; + if (curIndex >= (hanziStatus_.m_currentHzIndex + hanziStatus_.m_matchHzNumber)) { + break; + } + + if (curIndex >= MAXHZNUM) { + break; + } + + candidate[i][0] = + (int8_t)(m_hzTabBuf[curIndex] + .hz >> + 16); // Shift right by 16 bytes and get the storage bitin the encoding format + candidate[i][1] = + (int8_t)(m_hzTabBuf[curIndex] + .hz >> + 8); // Shift right by 8 bytes and get the storage bit in the encoding format + candidate[i][2] = // 2 is the index of the Array + (int8_t)(m_hzTabBuf[curIndex] + .hz); + } + return PinyinState::SUCCESS; +} + +PinyinCandidate::PinyinState PinyinCandidate::GetFwdHanziPage(int8_t candidate[][IME_HZLENTH], uint8_t len) +{ + if (hanziStatus_.m_currentHzPage > 0) { + --hanziStatus_.m_currentHzPage; + return GetHanziPage(hanziStatus_.m_currentHzPage, candidate, len); + } + return PinyinState::INVALID_PAGE_INDEX; +} + +PinyinCandidate::PinyinState PinyinCandidate::GetCurHanziPage(int8_t candidate[][IME_HZLENTH], uint8_t len) +{ + return GetHanziPage(hanziStatus_.m_currentHzPage, candidate, len); +} + +PinyinCandidate::PinyinState PinyinCandidate::GetNxtHanziPage(int8_t candidate[][IME_HZLENTH], uint8_t len) +{ + if (hanziStatus_.m_currentHzPage + 1 < GetHanziPagesNum()) { + ++hanziStatus_.m_currentHzPage; + return GetHanziPage(hanziStatus_.m_currentHzPage, candidate, len); + } + return PinyinState::INVALID_PAGE_INDEX; +} + +PinyinCandidate::PinyinState PinyinCandidate::GetAllHanzi(int8_t candidate[][IME_HZLENTH], uint8_t len) +{ + if (len < hanziStatus_.m_matchHzNumber) { + return PinyinState::MEM_NOT_ENOUGH; + } + + for (uint16_t i = hanziStatus_.m_currentHzIndex; i < hanziStatus_.m_currentHzIndex + hanziStatus_.m_matchHzNumber; + ++i) { + if (i >= MAXHZNUM) { + break; + } + candidate[i - hanziStatus_.m_currentHzIndex][0] = + static_cast(m_hzTabBuf[i] + .hz >> + 16); // Shift right by 16 bytes and get the storage bitin the encoding format + candidate[i - hanziStatus_.m_currentHzIndex][1] = + static_cast(m_hzTabBuf[i] + .hz >> + 8); // Shift right by 8 bytes and get the storage bit in the encoding format + candidate[i - hanziStatus_.m_currentHzIndex][2] = // 2 is the index of the Array + static_cast(m_hzTabBuf[i] + .hz); + } + return PinyinState::SUCCESS; +} + +int32_t PinyinCandidate::LoadCodeTable(const int8_t *filePath) +{ + int32_t ret; + FILE *tableFile = nullptr; + uint32_t bufLen; + char resolvedPath[PATH_MAX + 1] = {0}; + +#ifndef WIN32 + if (realpath((const char *)filePath, resolvedPath) == nullptr) { + return -1; + } +#else + memcpy_s(resolvedPath, sizeof(resolvedPath), filePath, strlen(reinterpret_cast(filePath)) + 1); +#endif + + tableFile = fopen((const char *)resolvedPath, "rb"); + if (tableFile == nullptr) { + return -1; + } + + ret = memset_s(m_hzTabBuf, sizeof(m_hzTabBuf), 0, sizeof(m_hzTabBuf)); + if (ret != EOK) { + (void)fclose(tableFile); + return -1; + } + + ret = memset_s(m_pyTabBuf, sizeof(m_pyTabBuf), 0, sizeof(m_pyTabBuf)); + if (ret != EOK) { + (void)fclose(tableFile); + return -1; + } + + bufLen = fread(m_hzTabBuf, 1, sizeof(m_hzTabBuf), tableFile); + if (bufLen != sizeof(m_hzTabBuf)) { + (void)fclose(tableFile); + return -1; + } + + if (fread(m_pyTabBuf, 1, sizeof(m_pyTabBuf), tableFile) != sizeof(m_pyTabBuf)) { + (void)fclose(tableFile); + return -1; + } + + (void)fclose(tableFile); + + return 0; +} + +int32_t PinyinCandidate::RecoverCodeTable(const int8_t *filePath, const int8_t *BackupPath) +{ + FILE *tableFile = nullptr; + FILE *backupFile = nullptr; + uint32_t fileSizeCounter = 0; + int32_t temp = 0; + char resolvedPath1[PATH_MAX + 1] = {0}; + char resolvedPath2[PATH_MAX + 1] = {0}; + +#ifndef WIN32 + if (realpath((const char *)filePath, resolvedPath1) == nullptr) { + return -1; + } + + if (realpath((const char *)BackupPath, resolvedPath2) == nullptr) { + return -1; + } +#endif + + /* 只写方式打开 */ + tableFile = fopen(reinterpret_cast(resolvedPath1), "w"); + if (tableFile == nullptr) { + return -1; + } + + /* 只读方式打开 */ + backupFile = fopen(reinterpret_cast(resolvedPath2), "r"); + if (backupFile == nullptr) { + (void)fclose(tableFile); + return -1; + } + + while (1) { + temp = fgetc(backupFile); + if ((temp == EOF) || (feof(backupFile) != 0)) { + break; + } + + fputc((int8_t)temp, tableFile); + fileSizeCounter++; + if (fileSizeCounter > (sizeof(m_hzTabBuf) + sizeof(m_pyTabBuf))) { + /* 防止出错造成死循环 */ + break; + } + } + + fclose(tableFile); + fclose(backupFile); + if (fileSizeCounter == (sizeof(m_hzTabBuf) + sizeof(m_pyTabBuf))) { + GRAPHIC_LOGD("Code table file recover successed!"); + return 0; + } else { + return -1; + } +} + +} // namespace OHOS +#endif // ENABLE_SOFT_KEYBOARD \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_soft_keyboard.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_soft_keyboard.cpp index e5e5f5754..d947fe105 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_soft_keyboard.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_soft_keyboard.cpp @@ -288,7 +288,8 @@ void UIEnglishSoftKeyboard::CreateKeyButtons() { std::vector keySet { {{COL_2_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_CAP, - UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_NUMBER, UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_SYMBOL}}, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_NUMBER, UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_SYMBOL, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_PINYIN}}, {{COL_3_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_a, UI_KEYCODE::UI_KEY_b, UI_KEYCODE::UI_KEY_c}}, {{COL_4_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_d, UI_KEYCODE::UI_KEY_e, UI_KEYCODE::UI_KEY_f}}, {{COL_2_X, ROW_2_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_g, UI_KEYCODE::UI_KEY_h, UI_KEYCODE::UI_KEY_i}}, @@ -318,7 +319,8 @@ void UICapitalSoftKeyboard::CreateKeyButtons() { std::vector keySet { {{COL_2_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_EN, - UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_NUMBER, UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_SYMBOL}}, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_NUMBER, UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_SYMBOL, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_PINYIN}}, {{COL_3_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_A, UI_KEYCODE::UI_KEY_B, UI_KEYCODE::UI_KEY_C}}, {{COL_4_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_D, UI_KEYCODE::UI_KEY_E, UI_KEYCODE::UI_KEY_F}}, {{COL_2_X, ROW_2_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_G, UI_KEYCODE::UI_KEY_H, UI_KEYCODE::UI_KEY_I}}, @@ -355,8 +357,9 @@ void UINumberSoftKeyboard::CreateKeyButtons() {{COL_3_X, ROW_2_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_0}}, {{COL_4_X, ROW_2_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_ASTERISK, UI_KEYCODE::UI_KEY_SLASH, UI_KEYCODE::UI_KEY_EQUAL}}, - {{COL_2_X, ROW_3_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_CAP}}, - {{COL_3_X, ROW_3_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_EN}}, + {{COL_2_X, ROW_3_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_CAP, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_EN}}, + {{COL_3_X, ROW_3_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_PINYIN}}, {{COL_4_X, ROW_3_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_SYMBOL}}, // FUNCTION_KEY {{COL_1_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_DEL}}, @@ -377,7 +380,8 @@ void UISymbolSoftKeyboard::CreateKeyButtons() { std::vector keySet { {{COL_2_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_CAP, - UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_EN, UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_NUMBER}}, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_EN, UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_PINYIN, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_NUMBER}}, {{COL_3_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_EXCLAM, UI_KEYCODE::UI_KEY_DOUBLEQUOTE, UI_KEYCODE::UI_KEY_NUMBERSIGN}}, {{COL_4_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_DOLLAR, UI_KEYCODE::UI_KEY_PERCENT, @@ -402,5 +406,37 @@ void UISymbolSoftKeyboard::CreateKeyButtons() SetupKeyButton(key); } } + +void UIPinyinSoftKeyboard::CreateKeyButtons() +{ + std::vector keySet { + {{COL_2_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_EN, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_CAP, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_NUMBER, + UI_KEYCODE::UI_KEY_SOFT_KEYBOARD_SYMBOL}}, + {{COL_3_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_a, UI_KEYCODE::UI_KEY_b, UI_KEYCODE::UI_KEY_c}}, + {{COL_4_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_d, UI_KEYCODE::UI_KEY_e, UI_KEYCODE::UI_KEY_f}}, + {{COL_2_X, ROW_2_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_g, UI_KEYCODE::UI_KEY_h, UI_KEYCODE::UI_KEY_i}}, + {{COL_3_X, ROW_2_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_j, UI_KEYCODE::UI_KEY_k, UI_KEYCODE::UI_KEY_l}}, + {{COL_4_X, ROW_2_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_m, UI_KEYCODE::UI_KEY_n, UI_KEYCODE::UI_KEY_o}}, + {{COL_2_X, ROW_3_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_p, UI_KEYCODE::UI_KEY_q, UI_KEYCODE::UI_KEY_r, + UI_KEYCODE::UI_KEY_s}}, + {{COL_3_X, ROW_3_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_t, UI_KEYCODE::UI_KEY_u, UI_KEYCODE::UI_KEY_v}}, + {{COL_4_X, ROW_3_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_w, UI_KEYCODE::UI_KEY_x, UI_KEYCODE::UI_KEY_y, + UI_KEYCODE::UI_KEY_z}}, + // FUNCTION_KEY + {{COL_1_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_DEL}}, + {{COL_5_X, ROW_1_Y, KEY_WIDTH, KEY_HEIGHT}, {UI_KEYCODE::UI_KEY_ENTER}}, + }; + for (auto key : keySet) { + SetupKeyButton(key); + } +} + +UIPinyinSoftKeyboard* UIPinyinSoftKeyboard::GetInstance() +{ + static UIPinyinSoftKeyboard pinyinSoftkeyboard; + return &pinyinSoftkeyboard; +} } // namespace OHOS #endif // ENABLE_SOFT_KEYBOARD diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp index b4fb207ee..86515b8fa 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_sweep_clock.cpp @@ -434,5 +434,37 @@ void UISweepClock::UpdateClock(bool clockInit) CalculateRedrawArea(rect, secondHand_, clockInit); } } + +void UISweepClock::DumpImgInfo() +{ + printf("view[%p]: viewType = %d\n", this, GetViewType()); + if ((hourHand_.drawtype_ == DrawType::DRAW_IMAGE) && (hourHand_.image_.GetSrcType() == IMG_SRC_VARIABLE)) { + const ImageInfo* info = hourHand_.image_.GetImageInfo(); + PrintImgInfo(info); + } + if ((minuteHand_.drawtype_ == DrawType::DRAW_IMAGE) && (minuteHand_.image_.GetSrcType() == IMG_SRC_VARIABLE)) { + const ImageInfo* info = minuteHand_.image_.GetImageInfo(); + PrintImgInfo(info); + } + if ((secondHand_.drawtype_ == DrawType::DRAW_IMAGE) && (secondHand_.image_.GetSrcType() == IMG_SRC_VARIABLE)) { + const ImageInfo* info = secondHand_.image_.GetImageInfo(); + PrintImgInfo(info); + } + + if ((hourHandCircle_.circleImg_.GetSrcType() == IMG_SRC_VARIABLE)) { + const ImageInfo* info = hourHandCircle_.circleImg_.GetImageInfo(); + PrintImgInfo(info); + } + + if ((minuteHandCircle_.circleImg_.GetSrcType() == IMG_SRC_VARIABLE)) { + const ImageInfo* info = minuteHandCircle_.circleImg_.GetImageInfo(); + PrintImgInfo(info); + } + + if ((secondHandCircle_.circleImg_.GetSrcType() == IMG_SRC_VARIABLE)) { + const ImageInfo* info = secondHandCircle_.circleImg_.GetImageInfo(); + PrintImgInfo(info); + } +} } #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_text_preview_box.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_text_preview_box.cpp index bfca7ed25..51355dd80 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_text_preview_box.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components/ui_text_preview_box.cpp @@ -135,6 +135,8 @@ void UITextPreviewBox::GetLineInfo(LineInfo& lineInfo) if (text == nullptr) { return; } + std::string u8str(text); + std::wstring u16str; UIFont::GetInstance()->SetCurrentFontId(inputText_->GetFontId(), inputText_->GetFontSize()); lineInfo.lineHeight = GetStyleConst().GetStyle(STYLE_LINE_HEIGHT); if (lineInfo.lineHeight == 0) { @@ -147,8 +149,9 @@ void UITextPreviewBox::GetLineInfo(LineInfo& lineInfo) uint32_t begin = 0; while ((begin < textLen) && (text[begin] != '\0') && (lineNum < GetMaxLength())) { uint32_t count = inputText_->GetTextLine(begin, textLen, GetContentRect().GetWidth(), lineNum, 0); + u16str = Utf8ToUtf16(u8str.substr(begin, count)); begin += count; - lineInfo.charCountPerLine.push_back(count); + lineInfo.charCountPerLine.push_back(u16str.length()); lineNum++; } } @@ -184,18 +187,45 @@ void UITextPreviewBox::InitCursor() void UITextPreviewBox::InsertChar(UI_KEYCODE& keyCode) { - std::string temp = tempText_; - temp.insert(cursorIndex_, 1, static_cast(keyCode)); - if (!CheckSpaceLeft(temp.c_str())) { + std::wstring temp = tempText_; + std::string str; + temp.insert(cursorIndex_, 1, static_cast(keyCode)); + str = Utf16ToUtf8(temp); + if (!CheckSpaceLeft(str.c_str())) { GRAPHIC_LOGE("Character length exceeded. Fail to input the letter."); return; } - tempText_.insert(cursorIndex_, 1, static_cast(keyCode)); + tempText_.insert(cursorIndex_, 1, static_cast(keyCode)); uint16_t width = UIFont::GetInstance()->GetWidth(static_cast(keyCode), 0); widthOfChars_.insert(widthOfChars_.begin() + cursorIndex_, width); - UIEditText::SetText(tempText_.c_str()); + str = Utf16ToUtf8(tempText_); + UIEditText::SetText(str.c_str()); + GetLineInfo(lineInfo_); + + cursorIndex_++; + HandleCursorPosByIndex(); +} + +void UITextPreviewBox::InsertHanzi(const std::string &u8hanzi) +{ + std::wstring temp = tempText_; + std::string str; + std::wstring u16hanzi = Utf8ToUtf16(u8hanzi); + temp.insert(cursorIndex_, 1, u16hanzi[0]); + str = Utf16ToUtf8(temp); + if (!CheckSpaceLeft(str.c_str())) { + GRAPHIC_LOGE("Character length exceeded. Fail to input the letter."); + return; + } + + tempText_.insert(cursorIndex_, 1, u16hanzi[0]); + uint16_t width = UIFont::GetInstance()->GetWidth(u16hanzi[0], 0); + widthOfChars_.insert(widthOfChars_.begin() + cursorIndex_, width); + + str = Utf16ToUtf8(tempText_); + UIEditText::SetText(str.c_str()); GetLineInfo(lineInfo_); cursorIndex_++; @@ -210,7 +240,8 @@ void UITextPreviewBox::DeleteChar() tempText_.erase(cursorIndex_ - 1, 1); widthOfChars_.erase(widthOfChars_.begin() + cursorIndex_ - 1); - UIEditText::SetText(tempText_.c_str()); + std::string temp = Utf16ToUtf8(tempText_); + UIEditText::SetText(temp.c_str()); GetLineInfo(lineInfo_); cursorIndex_--; @@ -307,13 +338,15 @@ void UITextPreviewBox::SetText(std::string text) widthOfChars_.clear(); tempText_.clear(); - tempText_ = text; - for (uint16_t i = 0; i < text.length(); i++) { - uint16_t width = UIFont::GetInstance()->GetWidth(text[i], 0); + tempText_ = Utf8ToUtf16(text); + UIEditText::SetText(text.c_str()); + UIFont::GetInstance()->SetCurrentFontId(inputText_->GetFontId(), inputText_->GetFontSize()); + + for (uint16_t i = 0; i < tempText_.length(); i++) { + uint16_t width = UIFont::GetInstance()->GetWidth(tempText_[i], 0); widthOfChars_.push_back(width); } - UIEditText::SetText(tempText_.c_str()); GetLineInfo(lineInfo_); cursorIndex_ = widthOfChars_.size(); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/map_svg_parser.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/map_svg_parser.h index d2efc3bfc..4cae67612 100644 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/map_svg_parser.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/map_svg_parser.h @@ -15,6 +15,7 @@ #ifndef GRAPHIC_LITE_MAP_SVG_PARSER_H #define GRAPHIC_LITE_MAP_SVG_PARSER_H #include +#include #include "gfx_utils/color.h" namespace OHOS { @@ -88,7 +89,10 @@ public: MapSVGParser(void); virtual ~MapSVGParser(void); + bool SetSVG(const std::string& file); bool SetSVG(uint8_t* data, uint32_t length); + void ClearSVG(); + Color24 GetBackGroundColor(void); uint32_t GetImageOffset(void); void GetSize(int16_t& width, int16_t& height); @@ -100,7 +104,6 @@ public: PathStyle* GetPathStyleByIndex(uint8_t index); TextDetail* GetTextByIndex(uint8_t index); ImageDetail* GetImageByIndex(uint8_t index); - void ClearSVG(uint8_t* data); private: struct MapHeader { @@ -119,8 +122,10 @@ private: }; static constexpr uint8_t PARSER_TYPE_NUM = 5; - typedef uint32_t (MapSVGParser::*MapTypeParserInit)(uint8_t* data, uint32_t length, uint32_t offset, uint8_t count); - typedef void (MapSVGParser::*MapTypeParserDeinit)(uint8_t count); + using MapTypeReadByData = uint32_t (MapSVGParser::*)(uint8_t *data, uint32_t length, + uint32_t offset, uint8_t count); + using MapTypeReadByPath = uint32_t (MapSVGParser::*)(FILE* fp, uint8_t count); + using MapTypeRelease = void (MapSVGParser::*)(uint8_t count); uint32_t ReadMapNode(uint8_t* data, uint32_t length, uint32_t offset); uint32_t ReadPathStyle(uint8_t* data, uint32_t length, uint32_t offset); @@ -129,25 +134,37 @@ private: uint32_t ReadMapImg(uint8_t* data, uint32_t length, uint32_t offset, uint8_t count); uint32_t ReadMapRoad(uint8_t* data, uint32_t length, uint32_t offset, uint8_t count); uint32_t ReadMapPOI(uint8_t* data, uint32_t length, uint32_t offset, uint8_t count); - uint32_t ReadImage(uint8_t* data, uint32_t length, uint32_t offset); + + uint32_t ReadMapNode(FILE* fp); + uint32_t ReadPathStyle(FILE* fp); + uint32_t ReadMapPath(FILE* fp, uint8_t count); + uint32_t ReadMapText(FILE* fp, uint8_t count); + uint32_t ReadMapImg(FILE* fp, uint8_t count); + uint32_t ReadMapRoad(FILE* fp, uint8_t count); + uint32_t ReadMapPOI(FILE* fp, uint8_t count); void ReleaseMapPath(uint8_t count); void ReleaseMapText(uint8_t count); void ReleaseMapImg(uint8_t count); void ReleaseMapRoad(uint8_t count); void ReleaseMapPOI(uint8_t count); + void ReleaseResource(void); bool AllocPath(PathDetail& path, uint32_t cmdNum, uint32_t dataNum); - MapTypeParserInit parserInitFunc[PARSER_TYPE_NUM] = { &MapSVGParser::ReadMapPath, &MapSVGParser::ReadMapText, - &MapSVGParser::ReadMapImg, &MapSVGParser::ReadMapRoad, - &MapSVGParser::ReadMapPOI }; - MapTypeParserDeinit parserDeinitFunc[PARSER_TYPE_NUM] = { + MapTypeReadByData readByDataFunc[PARSER_TYPE_NUM] = { + &MapSVGParser::ReadMapPath, &MapSVGParser::ReadMapText, &MapSVGParser::ReadMapImg, + &MapSVGParser::ReadMapRoad, &MapSVGParser::ReadMapPOI }; + + MapTypeReadByPath readByPathFunc[PARSER_TYPE_NUM] = { + &MapSVGParser::ReadMapPath, &MapSVGParser::ReadMapText, &MapSVGParser::ReadMapImg, + &MapSVGParser::ReadMapRoad, &MapSVGParser::ReadMapPOI }; + + MapTypeRelease releaseFunc[PARSER_TYPE_NUM] = { &MapSVGParser::ReleaseMapPath, &MapSVGParser::ReleaseMapText, &MapSVGParser::ReleaseMapImg, - &MapSVGParser::ReleaseMapRoad, &MapSVGParser::ReleaseMapPOI - }; + &MapSVGParser::ReleaseMapRoad, &MapSVGParser::ReleaseMapPOI }; - MapHeader mapHeader_; + MapHeader mapHeader_ = {0}; MapNode* nodeArray_ = nullptr; PathStyle* pathStyleArray_ = nullptr; PathDetail* pathArray_ = nullptr; @@ -160,6 +177,8 @@ private: uint8_t roadCount_ = 0; POIDetail* poiArray_ = nullptr; uint8_t poiCount_ = 0; + uint8_t* data_ = nullptr; + std::string file_; }; } #endif // GRAPHIC_LITE_MAP_SVG_PARSER_H diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/triangular_plane.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/triangular_plane.h new file mode 100644 index 000000000..74218512d --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/triangular_plane.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2024 CompanyNameMagicTag. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef TRIANGULAR_PLANE_H +#define TRIANGULAR_PLANE_H + +#include "gfx_utils/graphic_math.h" +namespace OHOS { +class TriangularPlane : public HeapBase { +public: + TriangularPlane() {} + virtual ~TriangularPlane() {} + + void SetVertex(Vector3vertex1, Vector3vertex2, Vector3vertex3) + { + vertexes_[0] = vertex1; + vertexes_[1] = vertex2; + vertexes_[2] = vertex3; // 2:index + } + + void SetMatrix(Matrix4 matrix) + { + matrix_ = matrix; + } + + Matrix4 GetMatrix() + { + return matrix_; + } + + const Vector4 GetNormal() + { + float nx = (vertexes_[1].y_ - vertexes_[0].y_) * (vertexes_[2].z_ - vertexes_[0].z_) - // 2: vertex index + (vertexes_[1].z_ - vertexes_[0].z_) * (vertexes_[2].y_ - vertexes_[0].y_); // 2: vertex index + float ny = (vertexes_[1].z_ - vertexes_[0].z_) * (vertexes_[2].x_ - vertexes_[0].x_) - // 2: vertex index + (vertexes_[1].x_ - vertexes_[0].x_) * (vertexes_[2].z_ - vertexes_[0].z_); // 2: vertex index + float nz = (vertexes_[1].x_ - vertexes_[0].x_) * (vertexes_[2].y_ - vertexes_[0].y_) - // 2: vertex index + (vertexes_[1].y_ - vertexes_[0].y_) * (vertexes_[2].x_ - vertexes_[0].x_); // 2: vertex index + return Vector4(nx, ny, nz, 0); + } + + Vector3& operator[](uint8_t index) + { + return vertexes_[index]; + } + + const Vector3 operator[](uint8_t index) const + { + return vertexes_[index]; + } + +private: + static constexpr uint8_t MAX_VERTEX_NUM = 3; // 3: triangular vertex number + Vector3 vertexes_[MAX_VERTEX_NUM]; // the vertexes of polygon + Matrix4 matrix_; +}; +} +#endif // TRIANGULAR_PLANE_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ui_card_container.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ui_card_container.h index c009fcd7d..7f572ff1b 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ui_card_container.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/components_ext/ui_card_container.h @@ -18,7 +18,7 @@ public: ~UICardContainer() override; UICardContainer(const UICardContainer &) = delete; UICardContainer &operator=(const UICardContainer &) = delete; - void SwitchCardToBitmap(bool bitMapFromFB = false); + void SwitchCardToBitmap(bool isNeedClip, bool bitMapFromFB = false); void SwitchBitmapToCard(void); void SetCardPage(UICardPage* page) @@ -33,10 +33,10 @@ public: return cardPage_; } - UIImageView* GetCardimg(void) + UIImageView* GetCardimg(bool isNeedClip) { if (!isBitMapExist_) { - SwitchCardToBitmap(); + SwitchCardToBitmap(isNeedClip); } return imgView_; } @@ -62,7 +62,6 @@ private: #if ENABLE_ROTATE_INPUT bool OnRotateEvent(const RotateEvent& event) override; #endif - bool IsVideoContained(UIView* view); }; } #endif diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/core/input_method_manager.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/core/input_method_manager.cpp index a10a3970d..7f36d7bc4 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/core/input_method_manager.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/core/input_method_manager.cpp @@ -36,9 +36,9 @@ void InputMethodManager::ShowInputMethod(UIView* view) return; } - inputView_ = view; UIViewType viewType = view->GetViewType(); if (viewType == UI_EDIT_TEXT) { + inputView_ = view; // µã»÷¹â±ê»áµ¼ÖÂ×Ö·û´®¶ªÊ§£¬´Ë´¦Ð޸ĿÉÒÔ±ÜÃâÕâ¸öÎÊÌâ UIEditText* tmpView = reinterpret_cast(view); InputMethodParam param; param.view = view; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_cmd.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_cmd.cpp index 5f8018366..b2771f1b1 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_cmd.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_cmd.cpp @@ -28,6 +28,7 @@ #include "securec.h" #include "dfx/dfx_record.h" #include "common/low_power_manager.h" +#include "common/image_cache_manager.h" #if ENABLE_DEBUG #include "common/key_code.h" @@ -75,6 +76,31 @@ void DumpMemoryCmd(int argc, char *argv[]) { MemCheck::GetInstance()->DumpMemInfo(); } + +void DumpImgCmd(int argc, char *argv[]) +{ + ImageCacheManager::GetInstance().Dump(); + + printf("\n\n"); + printf("========================DumpImgInfoRecursive========================\n"); + RootView::GetInstance()->DumpImgInfoRecursive(); +} + +void SetMemMonitorCmd(int argc, char *argv[]) +{ + if (argc != 1) { + GRAPHIC_LOGE("param err.\n"); + return; + } + if (strcmp(argv[0], "0") == 0) { + GrallocEngines::GetInstance()->SetMemMonitor(false); + } else if (strcmp(argv[0], "1") == 0) { + GrallocEngines::GetInstance()->SetMemMonitor(true); + } else { + GRAPHIC_LOGE("param err.\n"); + return; + } +} #endif static bool ConvertToInt(const char* input, uint16_t& value) @@ -471,6 +497,8 @@ struct DfxCmd g_dfxCmdList[] = { {"showtime", OHOS::ShowTime}, #if ENABLE_MEMORY_CHECK {"dumpmem", OHOS::DumpMemoryCmd}, + {"mem_monitor", OHOS::SetMemMonitorCmd}, + {"dumpimg", OHOS::DumpImgCmd}, #endif #if ENABLE_DEBUG {"inject_rotate", OHOS::InjectRotateEvent}, diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_record.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_record.cpp index 1785e8899..2d84cd6b7 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_record.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/dfx/dfx_record.cpp @@ -156,7 +156,7 @@ void DfxRenderReset() void DfxRecordShow() { if (g_dfxShow == ShowType::DFX_SHOW_ULPS) { - GRAPHIC_LOGP("g_ulpsExit: %d, g_flush: %d\n", g_ulpsExit, g_flush); + GRAPHIC_LOGP("g_ulpsExit: %u, g_flush: %u\n", g_ulpsExit, g_flush); return; } diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/engines/gfx/lite_m_gfx_engine.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/engines/gfx/lite_m_gfx_engine.h index b3b57512d..43de3905c 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/engines/gfx/lite_m_gfx_engine.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/engines/gfx/lite_m_gfx_engine.h @@ -124,7 +124,7 @@ public: void RenderPath(BufferInfo& dst, uintptr_t path, const Rect& mask, VGUStrokeAttr* strokeAttr, VGUFillAttr* fillAttr, VGUMatrix3* matrix); - void ClipImgByPath(ImageInfo& dstInfo, ImageInfo& srcInfo, uintptr_t path, Rect* srcArea, + void ClipImgByPath(ImageInfo& dstInfo, ImageInfo& srcInfo, uintptr_t path, Rect* srcImgArea, const Matrix4* pathMatrix, const Matrix4* imgMatrix); bool Convert2VGUFormat(const ColorMode& colorMode, VGUPixelFormat& dstColorFmt) const; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/cube_effect.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/cube_effect.cpp new file mode 100644 index 000000000..748f45e13 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/cube_effect.cpp @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2022 CompanyNameMagicTag. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "securec.h" +#include "common/screen.h" +#include "cube_effect.h" + +namespace OHOS { +namespace { +static constexpr int16_t EASE_RANGE = 100; +static constexpr int16_t CAMERA_DISTANCE = 500; +static constexpr int16_t ROTATE_RANGE_MAX = 90; +} + +void CubeEffect::OnSwipe(UISwipeView& view) +{ + if (preLeftCard != nullptr) { + preLeftCard->ResetTransParameter(); + preLeftCard = nullptr; + container_->UIViewGroup::Remove(&leftImg_); + leftImg_.ResetTransParameter(); + } + + if (preRightCard != nullptr) { + preRightCard->ResetTransParameter(); + preRightCard = nullptr; + container_->UIViewGroup::Remove(&rightImg_); + rightImg_.ResetTransParameter(); + } +} + +void CubeEffect::TransformCard(UIView* leftCard, UIView* rightCard, int16_t xOffset) +{ + int16_t width = Screen::GetInstance().GetWidth(); + + float angle = ROTATE_RANGE_MAX * MATH_ABS(xOffset) / (float)width; + + uint16_t leftW = leftCard->GetWidth(); + Vector3 leftRotateStart = {leftW + 1, 0, 0}; + Vector3 leftRotateEnd = {leftW + 1, 1, 0}; + Vector3 rightRotateStart = {-1, 0, 0}; + Vector3 rightRotateEnd = {-1, 1, 0}; + if (xOffset > 0) { + leftCard->Rotate((angle - ROTATE_RANGE_MAX), leftRotateStart, leftRotateEnd); + rightCard->Rotate(angle, rightRotateStart, rightRotateEnd); + } else if (xOffset < 0) { + leftCard->Rotate(-angle, leftRotateStart, leftRotateEnd); + rightCard->Rotate((ROTATE_RANGE_MAX - angle), rightRotateStart, rightRotateEnd); + } else { + leftCard->ResetTransParameter(); + rightCard->ResetTransParameter(); + } +} + +void CubeEffect::TransformMirrorCard(UIView& leftCard, UIView& rightCard, int16_t xOffset) +{ + int16_t width = Screen::GetInstance().GetWidth(); + int16_t height = Screen::GetInstance().GetHeight(); + float angle = ROTATE_RANGE_MAX * MATH_ABS(xOffset) / (float)width; + + Matrix4 perspectiveMatrix; + perspectiveMatrix[2][2] = 0; // 2 : index + perspectiveMatrix[2][3] = -1.0f / CAMERA_DISTANCE; // 2 3 : index 1000:cam distance + + int16_t leftRigth = leftCard.GetOrigRect().GetRight(); + int16_t leftBottom = leftCard.GetOrigRect().GetBottom(); + Matrix4 leftMatrix = Matrix4::Rotate(180.0f, {0, leftBottom, 0}, {1.0, leftBottom, 0}); + Vector3 leftRotateStart = {leftRigth, 0, 0}; + Vector3 leftRotateEnd = {leftRigth, 1, 0}; + Matrix4 leftTranslateFromCamera = Matrix4::Translate(Vector3(-leftRigth, -(height >> 1), 0)); + Matrix4 leftTranslateToCamera = Matrix4::Translate(Vector3(leftRigth, (height >> 1), 0)); + + int16_t rightBottom = rightCard.GetOrigRect().GetBottom(); + Matrix4 rightMatrix = Matrix4::Rotate(180.0f, {0, rightBottom, 0}, {1.0, rightBottom, 0}); + Vector3 rightRotateStart = {0, 0, 0}; + Vector3 rightRotateEnd = {0, 1, 0}; + Matrix4 rightTranslateFromCamera = Matrix4::Translate(Vector3(0, -(height >> 1), 0)); + Matrix4 rightTranslateToCamera = Matrix4::Translate(Vector3(0, (height >> 1), 0)); + if (xOffset > 0) { + leftMatrix = Matrix4::Rotate((angle - ROTATE_RANGE_MAX), leftRotateStart, leftRotateEnd) * leftMatrix; + leftMatrix = leftTranslateToCamera * (perspectiveMatrix * leftTranslateFromCamera) * leftMatrix; + leftMatrix = Matrix4::Translate({-(width - xOffset), 0, 0}) * leftMatrix; + + rightMatrix = Matrix4::Rotate(angle, rightRotateStart, rightRotateEnd) * rightMatrix; + rightMatrix = rightTranslateToCamera * (perspectiveMatrix * rightTranslateFromCamera) * rightMatrix; + rightMatrix = Matrix4::Translate({xOffset, 0, 0}) * rightMatrix; + } else { + leftMatrix = Matrix4::Rotate(-angle, leftRotateStart, leftRotateEnd) * leftMatrix; + leftMatrix = leftTranslateToCamera * (perspectiveMatrix * leftTranslateFromCamera) * leftMatrix; + leftMatrix = Matrix4::Translate({xOffset, 0, 0}) * leftMatrix; + + rightMatrix = + Matrix4::Rotate((ROTATE_RANGE_MAX - angle), rightRotateStart, rightRotateEnd) * rightMatrix; + rightMatrix = rightTranslateToCamera * (perspectiveMatrix * rightTranslateFromCamera) * rightMatrix; + rightMatrix = Matrix4::Translate({width + xOffset, 0, 0}) * rightMatrix; + } + TransformMap tempTrans; + tempTrans.SetMatrix(leftMatrix); + leftCard.SetTransformMap(tempTrans); + + tempTrans.SetMatrix(rightMatrix); + rightCard.SetTransformMap(tempTrans); +} + +void CubeEffect::CommonAlg(UIView* leftCard, UIView* rightCard, int16_t xOffset) +{ + if (leftCard == nullptr || rightCard == nullptr) { + return; + } + + if (preLeftCard == nullptr) { + leftImg_.SetStyle(STYLE_IMAGE_OPA, 90); // 90: degree + rightImg_.SetStyle(STYLE_IMAGE_OPA, 90); // 90: degree + container_->UIViewGroup::Add(&leftImg_); + container_->UIViewGroup::Add(&rightImg_); + } + + int16_t width = Screen::GetInstance().GetWidth(); + int16_t height = Screen::GetInstance().GetHeight(); + int16_t middleWidth = width / 2; + if (leftCard != preLeftCard && rightCard != preRightCard) { + leftImg_.SetPosition(0, 0, width, height); + if (leftCard->GetViewType() == UI_IMAGE_VIEW) { + leftImg_.SetSrc(static_cast(leftCard)->GetImageInfo()); + } + preLeftCard = leftCard; + preLeftCard->SetCameraPosition(Vector2(leftCard->GetWidth(), leftCard->GetHeight() / 2)); // 2: half + preLeftCard->SetCameraDistance(CAMERA_DISTANCE); + rightImg_.SetPosition(0, 0, width, height); + if (rightCard->GetViewType() == UI_IMAGE_VIEW) { + rightImg_.SetSrc(static_cast(rightCard)->GetImageInfo()); + } + preRightCard = rightCard; + preRightCard->SetCameraPosition(Vector2(0, rightCard->GetHeight() / 2)); // 2: half + preRightCard->SetCameraDistance(CAMERA_DISTANCE); + } + + TransformCard(preLeftCard, preRightCard, xOffset); + TransformMirrorCard(leftImg_, rightImg_, xOffset); +} + +void CubeEffect::CardSwipeAlg(UIImageView* leftCard, UIImageView* rightCard, int16_t xOffset) +{ + CommonAlg(leftCard, rightCard, xOffset); +} + +void CubeEffect::CardSwipeAlg(UICardPage* leftCard, UICardPage* rightCard, int16_t xOffset) +{ + CommonAlg(leftCard, rightCard, xOffset); +} +} diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/cube_effect.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/cube_effect.h new file mode 100644 index 000000000..751d99e2f --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/cube_effect.h @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2022 CompanyNameMagicTag. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef UI_CUBE_EFFECT_H +#define UI_CUBE_EFFECT_H +#include "components/ui_cross_view.h" + +namespace OHOS { +class CubeEffect : public CardSwipe, public UISwipeView::OnSwipeListener { +public: + CubeEffect(void) {} + ~CubeEffect() override {} + void CardSwipeAlg(UICardPage* leftCard, UICardPage* rightCard, int16_t xOffset) override; + void CardSwipeAlg(UIImageView* leftCard, UIImageView* rightCard, int16_t xOffset) override; + void OnSwipe(UISwipeView& view) override; + + void SetContainer(UICrossView* view) + { + container_ = view; + } + +private: + UIImageView leftImg_; + UIImageView rightImg_; + UIView* preLeftCard = nullptr; + UIView* preRightCard = nullptr; + UICrossView* container_ = nullptr; + + void CommonAlg(UIView* leftCard, UIView* rightCard, int16_t xOffset); + void TransformCard(UIView* leftCard, UIView* rightCard, int16_t xOffset); + void TransformMirrorCard(UIView& leftCard, UIView& rightCard, int16_t xOffset); +}; +} // OHOS +#endif // UI_CUBE_EFFECT_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/turn_page_effect.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/turn_page_effect.h index 5ee348f0f..b05514280 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/turn_page_effect.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/frameworks/swipe_effect/turn_page_effect.h @@ -12,7 +12,10 @@ namespace OHOS { class TurnPageEffect : public CardSwipe, public UISwipeView::OnSwipeListener { public: - TurnPageEffect(void) {} + TurnPageEffect(void) + { + isNeedClip_ = true; + } ~TurnPageEffect() override {} void CardSwipeAlg(UICardPage* leftCard, UICardPage* rightCard, int16_t xOffset) override; void CardSwipeAlg(UIImageView* leftCard, UIImageView* rightCard, int16_t xOffset) override; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_input_method.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_input_method.h index d925c2145..3cf98c7c2 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_input_method.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_input_method.h @@ -16,11 +16,15 @@ #ifndef GRAPHIC_LITE_UI_SOFT_KEYBOARD_H #define GRAPHIC_LITE_UI_SOFT_KEYBOARD_H +#include "components/ui_label.h" +#include "components/ui_label_button.h" +#include "components/ui_list.h" #include "common/input_method_manager.h" #include "components/ui_edit_text.h" #include "input_method/ui_abstract_soft_keyboard.h" #include "input_method/ui_option_box.h" #include "input_method/ui_text_preview_box.h" +#include "input_method/ui_pinyin_candidate.h" #include "gfx_utils/vector.h" #if ENABLE_SOFT_KEYBOARD @@ -28,8 +32,35 @@ namespace OHOS { /** * @brief Provides the functions related to UIInputMethod. */ -class UIInputMethod : public InputMethodManager::InputMethodListener { +class UIInputMethod : public InputMethodManager::InputMethodListener, + public UIView::OnClickListener, public ListScrollListener { + class HanziAdapter : public AbstractAdapter { + public: + ~HanziAdapter() override {}; + HanziAdapter() {}; + HanziAdapter(const HanziAdapter&) = delete; + HanziAdapter& operator=(const HanziAdapter&) = delete; + UIView* GetView(UIView* inView, int16_t index) override; + int16_t GetItemWidthWithMargin(int16_t index) override; + int16_t GetItemHeightWithMargin(int16_t index) override; + uint16_t GetCount() override; + bool SetWidthAndHeight(int16_t w, int16_t h); + void SetData(int8_t hanzi[][PinyinCandidate::IME_HZLENTH], uint8_t len); + void SetClickListener(UIView::OnClickListener* clickListener) + { + clickListener_ = clickListener; + } + + private: + UIView::OnClickListener* clickListener_ = nullptr; + int8_t (*data_)[PinyinCandidate::IME_HZLENTH] = nullptr; + uint8_t size_ = 0; + int16_t width_ = 0; + int16_t height_ = 0; + }; public: + static constexpr uint8_t DEFAULT_NUMPERPAGE = 5; + static constexpr uint8_t MAX_HANZIMATCHED = 255; static UIInputMethod* GetInstance(); /** @@ -47,7 +78,13 @@ public: * @brief Enter a key value in the input method. * @param keys key value, see UI_KEYCODE. */ - void Input(UI_KEYCODE &key); + void Input(UI_KEYCODE key); + + void InputPinyin(UI_KEYCODE key); + + void ShowHanziPageList(); + + void HideHanziPageList(); /** * @brief Hide soft keyboad option box. @@ -62,6 +99,7 @@ public: */ void ShowOptionBox(UIView *view, UI_KEYCODE *keys, uint8_t num); + bool OnClick(UIView& view, const ClickEvent& event) override; private: UIInputMethod(); ~UIInputMethod() override; @@ -71,18 +109,37 @@ private: void SetupOptionBox(); void SetupSoftKeyboard(); void SetupTextPreviewBox(); - void InsertChar(UI_KEYCODE &keyCode); - void ChangSoftKeyboard(UI_KEYCODE &keyCode); - void DealFunctionKey(UI_KEYCODE& keyCode); - void DealNormalKey(UI_KEYCODE &keyCode); + void InsertChar(UI_KEYCODE keyCode); + void InsertPinyin(UI_KEYCODE pinyin); + void UpdateHanziOption(const std::string &pinyin); + void ChangSoftKeyboard(UI_KEYCODE keyCode); + void DealFunctionKey(UI_KEYCODE keyCode); + void DealNormalKey(UI_KEYCODE keyCode); void DealSendKey(); void DealDelKey(); + void DealPinyinDelKey(); UIViewGroup* inputMethod_ = nullptr; UITextPreviewBox* previeBox_ = nullptr; // soft keyboard edit box UIEditText* edit_ = nullptr; // user creat edit box UIOptionBox* optionBox_ = nullptr; // Preselection box + UILabel* pinyinPreview_ = nullptr; // pinyin preview box + void SetupPinyinPreviewBox(); + void HidePinyinPreview(); + void ShowPinyinPreview(); + + UIList *hanziList_ = nullptr; // hanzi candidates + HanziAdapter *hanziAdapter_ = nullptr; // hanzi adapter + int8_t hanziMatched_[MAX_HANZIMATCHED][PinyinCandidate::IME_HZLENTH]; + void ClearHanziCandidate(); + void SetupHanziCandidate(); + + PinyinCandidate* pinyinTable_ = nullptr; // pinyin and hanzi find table + void SetupPinyinTable(); + void ClearPinyinTable(); + using PinyinState = PinyinCandidate::PinyinState; + UIAbstractSoftKeyboard* curSoftKeyboard_ = nullptr; uint8_t curKeyboardIndex_ = 0; Graphic::Vector customSoftKeyboard_; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_keyboard_codetable.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_keyboard_codetable.h index ecd6bb293..168b576b8 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_keyboard_codetable.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_keyboard_codetable.h @@ -140,6 +140,7 @@ enum class UI_KEYCODE : uint8_t { UI_KEY_SOFT_KEYBOARD_CAP = 0xF7, UI_KEY_SOFT_KEYBOARD_NUMBER = 0xF8, UI_KEY_SOFT_KEYBOARD_SYMBOL = 0xF9, + UI_KEY_SOFT_KEYBOARD_PINYIN = 0xFA, UI_KEY_BUTT = 0XFF, }; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_pinyin_candidate.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_pinyin_candidate.h new file mode 100644 index 000000000..640554b78 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_pinyin_candidate.h @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2022 CompanyNameMagicTag. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef GRAPHIC_LITE_UI_PINYIN_CANDIDATE_H +#define GRAPHIC_LITE_UI_PINYIN_CANDIDATE_H +#include "components/ui_label.h" +#include "components/ui_view_group.h" +#include "gfx_utils/vector.h" +#include "graphic_config.h" +#include "input_method/ui_keyboard_codetable.h" + +#if ENABLE_SOFT_KEYBOARD + +namespace OHOS { +class PinyinCandidate : public HeapBase { +public: + enum class PinyinState : int32_t { + SUCCESS = 0, + INVALID_PINYIN, // input source str is invalid + INVALID_PATH, + MEM_NOT_ENOUGH, + MEM_SET_ERROR, + MEM_COPY_ERROR, + MEM_ALLOC_ERROR, + INVALID_PAGE_INDEX, + }; + static const uint32_t IME_PYMAXLENTH = 8; // 单个拼音的最大字母个数 + static const uint32_t IME_HZLENTH = 4; // 单个汉字占内存大小 + static const uint8_t MAXSAMEPREFIXPY = 45; // 前缀相同的拼音的最大个数 + static const int32_t MAXHZNUM = 0x2192; // 汉字的总共个数 + static const uint8_t MAXNUMBEROFCHAR = 5; // 5 is the Maximum number of characters on key + static const uint8_t MAXCHARNUM = 26; // 26 characters, a ~ z + static const uint32_t MAX_TABLE_LEN = 12; // 12 is the max Length of Table + static const uint32_t MAX_TABLE_MEMBER_LEN = 5; // 5 is the max length of Tabel Member + + PinyinCandidate(const PinyinCandidate&) = delete; + PinyinCandidate& operator=(const PinyinCandidate&) = delete; + ~PinyinCandidate(); + PinyinCandidate(); + + std::string DebugInfo(PinyinState state) const; + PinyinState FindHanzi(const std::string &sourceStr); + PinyinState GetHanziPage(uint8_t pageNumber, int8_t candidate[][IME_HZLENTH], uint8_t len); + PinyinState GetFwdHanziPage(int8_t candidate[][IME_HZLENTH], uint8_t len); + PinyinState GetCurHanziPage(int8_t candidate[][IME_HZLENTH], uint8_t len); + PinyinState GetNxtHanziPage(int8_t candidate[][IME_HZLENTH], uint8_t len); + PinyinState GetAllHanzi(int8_t candidate[][IME_HZLENTH], uint8_t len); + uint8_t GetHanziPagesNum() const + { + return hanziStatus_.m_matchHZPageNumber; + } + uint8_t GetMatchHanziNum() const + { + return hanziStatus_.m_matchHzNumber; + } + uint8_t GetHanziPageIndex() const + { + return hanziStatus_.m_currentHzPage; + } + + PinyinState Init(const std::string &path); + + /* 设定每页显示二级候选码的个数 */ + int32_t SetLv2NumPerPage(uint8_t num); + uint8_t GetLv2NumPerPage() + { + return m_lv2NumPerPage; + } + +protected: + /* 从外部文件装载候选码 */ + int32_t LoadCodeTable(const int8_t *filePath); + /* 修复损坏的码表文件 */ + int32_t RecoverCodeTable(const int8_t *filePath, const int8_t *backupPath); + +private: + /* init pinyin table path */ + PinyinState InitPinyinTablePath(const std::string &path); + void InitEx(void); + + /* 以下两结构组成了拼音码表,并且以只读方式保存, + * 今后扩展词频调整,则将词频数据以另外文件单独保存, + * FreqTableIndex数据成员用于实现拼音码表中的结构与词频表中的记录相映射 + */ + struct PYTab { + int8_t pinyin[IME_PYMAXLENTH]; + uint32_t freqTableIndex; // 指向本结构在频率记录表中的位置 + uint16_t hzIndex; + uint8_t hzNum; // 拼音对应的汉字个数 + }; + + struct HZTab { + uint32_t hz; + uint16_t freqTableIndex; // 指向本结构在频率记录表中的位置 + }; + + uint8_t m_lv2NumPerPage = 5; // 5 是二级候选码每页显示的个数 + + /* 拼音码表的缓存 */ + PYTab m_pyTabBuf[MAXCHARNUM][MAXSAMEPREFIXPY]; + HZTab m_hzTabBuf[MAXHZNUM] = {0, 0}; // 汉字码表缓存 + + struct { + uint8_t m_currentPyPage = 0; // current pinyin page number + uint8_t m_matchPyPage = 0; // matched pinyin page num + int8_t m_matchPyStartIndex = -1; /* 在码表中与指定拼音匹配的拼音的起始索引 */ + int8_t m_matchPyEndIndex = -1; /* 在码表中与指定拼音匹配的结束索引 */ + uint8_t m_matchPyNumber = 0; /* 与指定拼音匹配的候选码数量 */ + uint8_t m_currentPyIndex = 0; + } pinyinStatus_; + struct { + uint16_t m_currentHzIndex = 0; + uint8_t m_matchHzNumber = 0; + uint8_t m_matchHZPageNumber = 0; + uint8_t m_currentHzPage = 0; + } hanziStatus_; + + std::string m_pinyinTablePath = ""; +}; +} // namespace OHOS +#endif // ENABLE_SOFT_KEYBOARD +#endif // GRAPHIC_LITE_UI_PINYIN_CANDIDATE_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_soft_keyboard.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_soft_keyboard.h index 3be731ad6..11202ca44 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_soft_keyboard.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_soft_keyboard.h @@ -83,6 +83,15 @@ public: void CreateKeyButtons() override; static UISymbolSoftKeyboard* GetInstance(); }; + +class UIPinyinSoftKeyboard : public UIAbstractSoftKeyboard { +public: + UIPinyinSoftKeyboard() {} + ~UIPinyinSoftKeyboard() override {} + void CreateKeyButtons() override; + static UIPinyinSoftKeyboard* GetInstance(); +}; + } // namespace OHOS #endif // ENABLE_SOFT_KEYBOARD #endif // GRAPHIC_LITE_UI_INPUT_METHOD_H diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_text_preview_box.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_text_preview_box.h index cd8151dee..eaeb6446d 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_text_preview_box.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/ui/innerkits/input_method/ui_text_preview_box.h @@ -16,6 +16,9 @@ #ifndef GRAPHIC_LITE_UI_EDIT_TEXT_H #define GRAPHIC_LITE_UI_EDIT_TEXT_H +#include +#include +#include #include #include "components/ui_edit_text.h" #include "input_method/ui_keyboard_codetable.h" @@ -66,6 +69,7 @@ public: void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override; bool OnClickEvent(const ClickEvent& event) override; void InsertChar(UI_KEYCODE& keyCode); + void InsertHanzi(const std::string &u8hanzi); void DeleteChar(); void SetText(std::string text); @@ -91,13 +95,26 @@ protected: void GetLineInfo(LineInfo& lineInfo); private: + std::wstring Utf8ToUtf16(const std::string &text) const + { + std::wstring_convert, wchar_t> convert; + std::wstring wideText = convert.from_bytes(text); + return wideText; + } + + std::string Utf16ToUtf8(const std::wstring &wtext) const + { + std::wstring_convert, wchar_t> convert; + return convert.to_bytes(wtext); + } + uint32_t cursorIndex_ = 0; bool isCursorInited_ = false; CursorCallback cursorCallback_; Animator *cursorAnimator_ = nullptr; UIView *cursorView_ = nullptr; LineInfo lineInfo_ = {{0}}; - std::string tempText_; + std::wstring tempText_; std::vector widthOfChars_; TextPreviewBoxMode editMode_ = TEXT_PREVIEW_BOX_MODE_INSERT; diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp index bc2163186..b173f99fc 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/display_dev.cpp @@ -43,7 +43,7 @@ void DisplayDev::LcdFlush(uint8_t layerId) } if (layerFuncs_->Flush != nullptr) { if (layerId == LAYER_MAX) { - if (layerFuncs_->Flush(0, 0, NULL) != DISPLAY_SUCCESS) { + if (layerFuncs_->Flush(0, 0, nullptr) != DISPLAY_SUCCESS) { GRAPHIC_LOGE("flush failed."); } return; @@ -159,7 +159,7 @@ bool DisplayDev::OpenLayer(uint8_t layerId, const LayerInfo& info, uint8_t buffe } if (layer_[layerId].bufferCount != 0) { - GRAPHIC_LOGE("layer[%u] is already opened with BufferNo[%u].", layerId, layer_[layerId].bufferCount); + GRAPHIC_LOGD("layer[%u] is already opened with bufferCount[%u].", layerId, layer_[layerId].bufferCount); return false; } @@ -394,7 +394,7 @@ void DisplayDev::SetLayerZOrder(uint8_t layerId, uint8_t order) } } -void DisplayDev::SetLayerPositon(uint8_t layerId, uint8_t x, uint8_t y) +void DisplayDev::SetLayerPositon(uint8_t layerId, int16_t x, int16_t y) { if (layerId < LAYER_0 || layerId >= LAYER_MAX) { GRAPHIC_LOGE("Invalid layerId[%u].", layerId); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp index b14181307..3a98cda47 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/hals/gralloc_engines.cpp @@ -13,11 +13,15 @@ * limitations under the License. */ -#include "hals/gralloc_engines.h" #include +#ifdef __LITEOS__ +#include "los_memory_pri.h" +#endif #include "display_type.h" #include "gfx_utils/graphic_log.h" #include "securec.h" +#include "common/image_cache_manager.h" +#include "hals/gralloc_engines.h" namespace OHOS { static std::unordered_map g_buffers; @@ -40,14 +44,14 @@ bool GrallocEngines::Init() return true; } -bool GrallocEngines::AllocBuffer(const AllocInfo& info, GrallocBuffer& buffer) +bool GrallocEngines::AllocBufferOnce(const AllocInfo& info, GrallocBuffer& buffer) { if (grallocFuncs_ == nullptr) { GRAPHIC_LOGE("GrallocEngines not init!"); return false; } BufferHandle* bufferHandle = nullptr; - if (grallocFuncs_->AllocMem(&info, &bufferHandle) != DISPLAY_SUCCESS) { + if (grallocFuncs_->AllocMem(&info, &bufferHandle) != DISPLAY_SUCCESS || bufferHandle == nullptr) { return false; } g_buffers.insert(std::make_pair(reinterpret_cast(bufferHandle->virAddr), bufferHandle)); @@ -56,6 +60,37 @@ bool GrallocEngines::AllocBuffer(const AllocInfo& info, GrallocBuffer& buffer) #if ENABLE_GMMU buffer.stride = static_cast(bufferHandle->stride); #endif +#if ENABLE_MEMORY_CHECK + if (isMonitorEnabled_) { + printf("[Alloc] addr = %p, size = %d, usage = %llu\n", bufferHandle->virAddr, bufferHandle->size, bufferHandle->usage); + } +#endif + return true; +} + +bool GrallocEngines::AllocBuffer(const AllocInfo& info, GrallocBuffer& buffer) +{ + if (grallocFuncs_ == nullptr && info.expectedSize == 0) { + GRAPHIC_LOGE("alloc failed!!, size: %u", info.expectedSize); + return false; + } + + if (!AllocBufferOnce(info, buffer)) { + GRAPHIC_LOGE("GrallocEngines::AllocBuffer realloc size: %u", info.expectedSize); + if (ImageCacheManager::GetInstance().FreeAndGetBuf(info, buffer) == nullptr) { + DumpMem(); +#ifdef __LITEOS__ + OsMemInfoPrint(reinterpret_cast(MEM_POOL_UI_OTHER)); +#endif + return false; + } + } + if ((info.usage & HBM_USE_MEM_YUV) == HBM_USE_MEM_YUV) { + yuvBufCnt_++; + if (yuvBufCnt_ > 3) { // 3: yuv buf cnt + GRAPHIC_LOGW("Count of yuv buffer is %d. It should not be greater than 3.", yuvBufCnt_); + } + } return true; } @@ -75,7 +110,15 @@ void GrallocEngines::FreeBuffer(uint8_t* virAddr) if (iter != g_buffers.end()) { BufferHandle* handle = iter->second; if (handle != nullptr) { + if ((handle->usage & HBM_USE_MEM_YUV) == HBM_USE_MEM_YUV) { + yuvBufCnt_--; + } g_buffers.erase(iter); +#if ENABLE_MEMORY_CHECK + if (isMonitorEnabled_) { + printf("[Free] addr = %p, size = %d, usage = %llu\n", virAddr, handle->size, handle->usage); + } +#endif grallocFuncs_->FreeMem(handle); } } @@ -141,5 +184,11 @@ void GrallocEngines::DumpMem() printf("total size: font %d (count: %d, max: %d), image %d, path %d, fb %d, mapbuffer:%d, yuv %d\n", fontCacheSize, fontCount, fontMax, imageCacheSize, pathCacheSize, fbSize, mapBufferSize, yuvCacheSize); } + +void GrallocEngines::SetMemMonitor(bool enable) +{ + isMonitorEnabled_ = enable; +} + #endif } // namespace OHOS diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_custom.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_custom.cpp index 1c8ed681a..01f4c1c21 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_custom.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_custom.cpp @@ -29,7 +29,7 @@ void* ImageCacheMalloc(ImageInfo& info) allocInfo.usage = HBM_USE_ASSIGN_SIZE; GrallocBuffer buffer; if (!GrallocEngines::GetInstance()->AllocBuffer(allocInfo, buffer)) { - GRAPHIC_LOGE("AllocBuffer failed."); + GRAPHIC_LOGE("ImageCacheMalloc failed! size = %u", info.dataSize); return nullptr; } info.phyAddr = reinterpret_cast(buffer.phyAddr); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/display_dev.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/display_dev.h index ef30654de..7d4094d31 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/display_dev.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/display_dev.h @@ -97,7 +97,7 @@ public: /** * @brief set layer position. */ - void SetLayerPositon(uint8_t layerId, uint8_t x, uint8_t y); + void SetLayerPositon(uint8_t layerId, int16_t x, int16_t y); /** * @brief set layer visible state. diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h index af7a4c05b..138bad1b5 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/innerkits/hals/gralloc_engines.h @@ -39,14 +39,18 @@ public: bool Init(); bool AllocBuffer(const AllocInfo& info, GrallocBuffer& buffer); + bool AllocBufferOnce(const AllocInfo& info, GrallocBuffer& buffer); void FreeBuffer(uint8_t* virAddr); #if ENABLE_MEMORY_CHECK void DumpMem(); + void SetMemMonitor(bool enable); #endif private: GrallocEngines() : grallocFuncs_(nullptr) {} ~GrallocEngines() {} + uint8_t yuvBufCnt_ = 0; GrallocFuncs* grallocFuncs_; + bool isMonitorEnabled_ = false; }; } // end namespace #endif // GRAPHIC_LITE_GRALLOC_ENGINES_H diff --git a/code/sdk/middleware/services/gui/uikit/res/panda_first.bin b/code/sdk/middleware/services/gui/uikit/res/panda_first.bin new file mode 100644 index 000000000..0ba0c7636 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/res/panda_first.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3ead2ae29e2abd94663466f5cda7c392bfeffc3363e724891a9966a074a215f2 +size 103992 diff --git a/code/sdk/middleware/services/gui/uikit/res/pymb.bin b/code/sdk/middleware/services/gui/uikit/res/pymb.bin new file mode 100644 index 000000000..1dd9e3d61 --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/res/pymb.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:aa81b306865f9f4ea6a588080f7f31e1a99558d2ca4a072b43a6368298e9d69f +size 87472 diff --git a/code/sdk/middleware/services/gui/uikit/res/regular_hexagon.bin b/code/sdk/middleware/services/gui/uikit/res/regular_hexagon.bin new file mode 100644 index 000000000..27c4fce1c --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/res/regular_hexagon.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5ab073aa44a3d363774a2643cf80e4a6f3a3ca6b886e3c5f347c99bd45ecf0b9 +size 14376 diff --git a/code/sdk/middleware/services/gui/uikit/res/regular_hexagon_inverse.bin b/code/sdk/middleware/services/gui/uikit/res/regular_hexagon_inverse.bin new file mode 100644 index 000000000..b3f69e8ee --- /dev/null +++ b/code/sdk/middleware/services/gui/uikit/res/regular_hexagon_inverse.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5f239864317c61724189ae003c5d6109f3d4835f10ea7bcda578791fb7ebc7ee +size 14376 diff --git a/code/sdk/middleware/services/gui/uikit/sample/CMakeLists.txt b/code/sdk/middleware/services/gui/uikit/sample/CMakeLists.txt index da574a539..4100ec8b3 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/CMakeLists.txt +++ b/code/sdk/middleware/services/gui/uikit/sample/CMakeLists.txt @@ -37,6 +37,7 @@ set(PRIVATE_HEADER ${UIKIT_ROOT_DIR}/proprietary/include/service ${UIKIT_ROOT_DIR}/proprietary/src/utils/innerkits ${UIKIT_ROOT_DIR}/proprietary/src/ui/frameworks + ${UIKIT_ROOT_DIR}/proprietary/src/ui/innerkits ${PROJECT_ROOT_DIR}/hal/input/include ${ROOTDIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include ${ROOTDIR}/open_source/openharmony/third_party/bounds_checking_function/include @@ -79,6 +80,7 @@ set(COMPONENT_CCFLAGS -Wno-missing-declarations -Wno-tautological-pointer-compare -Wno-unused-private-field + -Werror=return-type ) set(WHOLE_LINK diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/ui_test_clock_dial.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/ui_test_clock_dial.cpp index 78ecc57a0..c3730a28c 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/ui_test_clock_dial.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/ui_test_clock_dial.cpp @@ -175,7 +175,7 @@ bool UITestClockDial::HorizontalViewInit(void) pageStatus[maxPage - 1] = true; } listener = new SwipeListener(); - listener->setCallback(calback); + listener->SetCallback(calback); mainSwipeGroup->SetOnSwipeListener(listener); GRAPHIC_LOGD("UITestClockDial::InitPage over\n"); return true; @@ -299,7 +299,7 @@ void UITestClockDial::PreLoad(uint16_t index) } else { if (!pageStatus[index - 1]) { if (!recordCard[index - 1]->InitView()) { - GRAPHIC_LOGE("PreLoad PAGE:%d\n", index - 1); + GRAPHIC_LOGE("PreLoad PAGE:%u\n", index - 1); return; } pageStatus[index - 1] = true; @@ -310,7 +310,7 @@ void UITestClockDial::PreLoad(uint16_t index) } if (!pageStatus[index + 1]) { if (!recordCard[index + 1]->InitView()) { - GRAPHIC_LOGE("PreLoad PAGE:%d\n", index + 1); + GRAPHIC_LOGE("PreLoad PAGE:%u\n", index + 1); return; } pageStatus[index + 1] = true; diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/ui_test_clock_dial.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/ui_test_clock_dial.h index 53ba272ca..00d6e6353 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/ui_test_clock_dial.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_clock_dial/ui_test_clock_dial.h @@ -41,7 +41,7 @@ public: ~SwipeListener() override {} void OnSwipe(UISwipeView& view) override; - void setCallback(ZoomEffect* calback) + void SetCallback(ZoomEffect* calback) { calback_ = calback; } diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow.cpp index fd3e57978..2291781e5 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow.cpp @@ -66,18 +66,28 @@ void UITestCoverflow::TearDown() } delete coverflow_; coverflow_ = nullptr; + + label_ = nullptr; + lastIndex_ = 0; showBtn_ = nullptr; + isShowBtnGrp_ = false; btnGrp_ = nullptr; - label_ = nullptr; + loadNum_ = 0; + addBtn_ = nullptr; removeBtn_ = nullptr; - mirrorOpaAddBtn_ = nullptr; - mirrorOpaSubBtn_ = nullptr; - pageWidthAddBtn_ = nullptr; - pageWidthSubBtn_ = nullptr; + imgWidthAddBtn_ = nullptr; + imgWidthSubBtn_ = nullptr; + imgPaddingAddBtn_ = nullptr; + imgPaddingSubBtn_ = nullptr; maxAngleAddBtn_ = nullptr; maxAngleSubBtn_ = nullptr; loopBtn_ = nullptr; + + imgWidth_ = 200; // 200: default value + imgPadding_ = 50; // 50: default value + mirrorOpa_ = 30; // 30: default value + rotateAngle_ = 70.0f; // 70: default value } const UIView* UITestCoverflow::GetTestView() @@ -117,15 +127,15 @@ void UITestCoverflow::InitButtonGroup() btnGrp_->SetVisible(false); container_->Add(btnGrp_); } - CreateLabelButton(&mirrorOpaAddBtn_, "opa+", 0, 0); - CreateLabelButton(&mirrorOpaSubBtn_, "opa-", 60, 0); // 60: x position - CreateLabelButton(&pageWidthAddBtn_, "wid+", 120, 0); // 120: x position - CreateLabelButton(&pageWidthSubBtn_, "wid-", 180, 0); // 180: x position - CreateLabelButton(&maxAngleAddBtn_, "ang+", 0, 40); // 40: y position - CreateLabelButton(&maxAngleSubBtn_, "ang-", 60, 40); // 60: x position 40: y position - CreateLabelButton(&addBtn_, "add", 120, 40); // 120: x position 40: y position - CreateLabelButton(&removeBtn_, "sub", 180, 40); // 180: x position 40: y position - CreateLabelButton(&loopBtn_, "loop", 240, 40); // 240: x position 40: y position + CreateLabelButton(&imgWidthAddBtn_, "wid+", 0, 0); + CreateLabelButton(&imgWidthSubBtn_, "wid-", 60, 0); // 60: x position + CreateLabelButton(&maxAngleAddBtn_, "ang+", 120, 0); // 120: x position + CreateLabelButton(&maxAngleSubBtn_, "ang-", 180, 0); // 180: x position + CreateLabelButton(&addBtn_, "add", 0, 40); // 40: y position + CreateLabelButton(&removeBtn_, "sub", 60, 40); // 60: x position 40: y position + CreateLabelButton(&loopBtn_, "loop", 120, 40); // 120: x position 40: y position + CreateLabelButton(&imgPaddingAddBtn_, "pad+", 180, 40); // 180: x position 40: y position + CreateLabelButton(&imgPaddingSubBtn_, "pad-", 240, 40); // 240: x position 40: y position } void UITestCoverflow::UITestCoverflowView001() @@ -136,11 +146,11 @@ void UITestCoverflow::UITestCoverflowView001() } coverflow_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); coverflow_->SetIntercept(true); + coverflow_->SetThrowDrag(true); + coverflow_->SetSwipeACCLevel(150); // 150: set drag compensation distance + coverflow_->SetDragACCLevel(16); // 16: set drag time duration level for (uint8_t i = 0; i < COVERFLOW_PRELOAD_PAGE_NUM; i++) { ImageInfo* src = ImageCacheManager::GetInstance().LoadSingleRes(std::string(g_faceInfo[i].path)); - if (src == nullptr) { - continue; - } coverflow_->Add(g_faceInfo[i].name, src); loadNum_++; } @@ -180,7 +190,7 @@ bool UITestCoverflow::OnScroll() } if (newCenterIndex != lastIndex_) { lastIndex_ = newCenterIndex; - label_->SetText(g_faceInfo[lastIndex_].name); + label_->SetText(coverflow_->GetViewByIndex(lastIndex_)->GetViewId()); } Rect curViewRect = coverflow_->GetViewByIndex(lastIndex_)->GetOrigRect(); @@ -197,28 +207,23 @@ bool UITestCoverflow::OnScroll() bool UITestCoverflow::OnClick(UIView& view, const ClickEvent& event) { - if (&view == mirrorOpaAddBtn_) { - mirrorOpa_ += DEFAULT_STEP; - coverflow_->SetMirrorOpacity(mirrorOpa_); - } else if (&view == mirrorOpaSubBtn_) { - mirrorOpa_ -= DEFAULT_STEP; - coverflow_->SetMirrorOpacity(mirrorOpa_); - } else if (&view == showBtn_) { + if (&view == showBtn_) { btnGrp_->SetVisible(!btnGrp_->IsVisible()); } else if (&view == loopBtn_) { - isLoop_ = !isLoop_; - coverflow_->SetLoopState(isLoop_); - if (isLoop_) { - loopBtn_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Gray().full); - } else { - loopBtn_->SetStyle(STYLE_BACKGROUND_COLOR, Color::GetColorFromRGB(0x00, 0x7d, 0xff).full); - } - } else if (&view == pageWidthAddBtn_) { - itemWidth_ += DEFAULT_STEP; - coverflow_->SetItemWidth(itemWidth_); - } else if (&view == pageWidthSubBtn_) { - itemWidth_ -= DEFAULT_STEP; - coverflow_->SetItemWidth(itemWidth_); + coverflow_->SetLoopState(true); + loopBtn_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Yellow().full); + } else if (&view == imgWidthAddBtn_) { + imgWidth_ += DEFAULT_STEP; + coverflow_->SetImgSize(imgWidth_, imgWidth_); + } else if (&view == imgWidthSubBtn_) { + imgWidth_ -= DEFAULT_STEP; + coverflow_->SetImgSize(imgWidth_, imgWidth_); + } else if (&view == imgPaddingAddBtn_) { + imgPadding_ += DEFAULT_STEP; + coverflow_->SetImgPadding(imgPadding_); + } else if (&view == imgPaddingSubBtn_) { + imgPadding_ -= DEFAULT_STEP; + coverflow_->SetImgPadding(imgPadding_); } else if (&view == addBtn_) { if (loadNum_ >= COVERFLOW_MAX_PAGE_NUM) { return true; diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow.h index b67c47e49..82c76ac37 100644 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_coverflow/ui_test_coverflow.h @@ -53,17 +53,17 @@ private: uint8_t loadNum_ = 0; UILabelButton* addBtn_ = nullptr; UILabelButton* removeBtn_ = nullptr; - UILabelButton* mirrorOpaAddBtn_ = nullptr; - UILabelButton* mirrorOpaSubBtn_ = nullptr; - UILabelButton* pageWidthAddBtn_ = nullptr; - UILabelButton* pageWidthSubBtn_ = nullptr; + UILabelButton* imgWidthAddBtn_ = nullptr; + UILabelButton* imgWidthSubBtn_ = nullptr; + UILabelButton* imgPaddingAddBtn_ = nullptr; + UILabelButton* imgPaddingSubBtn_ = nullptr; UILabelButton* maxAngleAddBtn_ = nullptr; UILabelButton* maxAngleSubBtn_ = nullptr; UILabelButton* loopBtn_ = nullptr; - uint16_t itemWidth_ = 250; // 250: default value + uint16_t imgWidth_ = 200; // 200: default value + uint16_t imgPadding_ = 50; // 50: default value uint8_t mirrorOpa_ = 30; // 30: default value float rotateAngle_ = 70.0f; // 70: default value - bool isLoop_ = false; }; } // namespace OHOS #endif // UI_TEST_QRCODE_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp index be5dfeceb..dfbba8eee 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cross/ui_test_cross.cpp @@ -23,7 +23,7 @@ static constexpr int16_t VIDEO_WIDTH = 454; static constexpr int16_t VIDEO_HEIGHT = 454; static constexpr int16_t CAMERA_DISTANCE = 600; static constexpr int16_t EASE_RANGE = 100; -static constexpr int16_t STRIDE_ALIGNMENT_VALUE = 64; +static constexpr int16_t STRIDE_ALIGNMENT_VALUE = 128; static constexpr int16_t BUFFER_QUEUE_SIZE = 2; static constexpr int16_t JPEG_HEIGHT_DIVISOR = 2; static constexpr int16_t JPEG_WIDTH_BYTE_ALIGNMENT = 128; @@ -58,11 +58,11 @@ static void ScreenStatusNotify(ScreenStatus status) static void GetTime(char* buf, int len) { struct timeval tv; - gettimeofday(&tv, NULL); - uint32_t second = tv.tv_sec % TIME_CONVERT; - uint32_t minute = tv.tv_sec / TIME_CONVERT; - uint32_t hour = (minute / TIME_CONVERT) % 24; // 24: 24 hours per day - uint32_t realMilliSecond = tv.tv_usec / USEC_TO_MILLI; + gettimeofday(&tv, nullptr); + int32_t second = tv.tv_sec % TIME_CONVERT; + int32_t minute = tv.tv_sec / TIME_CONVERT; + int32_t hour = (minute / TIME_CONVERT) % 24; // 24: 24 hours per day + int32_t realMilliSecond = tv.tv_usec / USEC_TO_MILLI; minute = minute % TIME_CONVERT; sprintf_s(buf, len, "%02d : %02d : %02d : %03d", hour, minute, second, realMilliSecond); @@ -153,7 +153,7 @@ void UITestCross::VideoPage::PageInit() std::string uri("/user/video/demo_pure_video_loop.mp4"); videoPlay_ = new MediaVideoPlay(surface, nullptr, uri, true); #ifdef SUPPORT_AT_OHOSFWK - g_videoPlay = videoPlay_; + g_videoPlay = videoPlayer_; registerNotifyScreenStatus(ScreenStatusNotify); #endif } diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cube_rotate/cube_rotate_view.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cube_rotate/cube_rotate_view.h index 8999ad003..202559594 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cube_rotate/cube_rotate_view.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_cube_rotate/cube_rotate_view.h @@ -51,7 +51,7 @@ public: bool OnDragStartEvent(const DragEvent& event) override; bool OnDragEvent(const DragEvent& event) override; bool OnDragEndEvent(const DragEvent& event) override; - void RotatePlanes(int angleDelta, const Vector3& rotateStart, const Vector3& rotateEnd); + void RotatePlanes(int angle, const Vector3& rotateStart, const Vector3& rotateEnd); private: Graphic::Vector cubePlane_; diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_svg/ui_test_svg.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_svg/ui_test_svg.h index adaeab534..686d1a58e 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_svg/ui_test_svg.h +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_svg/ui_test_svg.h @@ -43,7 +43,7 @@ private: UIViewGroup* group_ = nullptr; UICanvasExt* canvas_ = nullptr; UILabelButton* btn_ = nullptr; - int16_t index_; + int16_t index_ = 0; }; } #endif // UI_TEST_SVG_H \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_video_play/ui_test_video_play.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_video_play/ui_test_video_play.cpp index a84fb1666..0084d2b53 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_video_play/ui_test_video_play.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_video_play/ui_test_video_play.cpp @@ -24,7 +24,7 @@ namespace OHOS { static constexpr int16_t VIDEO_WIDTH = 454; static constexpr int16_t VIDEO_HEIGHT = 454; -static constexpr int16_t STRIDE_ALIGNMENT_VALUE = 64; +static constexpr int16_t STRIDE_ALIGNMENT_VALUE = 128; static constexpr int16_t BUFFER_QUEUE_SIZE = 3; static constexpr int16_t JPEG_HEIGHT_DIVISOR = 2; static constexpr int16_t JPEG_WIDTH_BYTE_ALIGNMENT = 128; @@ -36,7 +36,7 @@ static constexpr int16_t TEXT_FONT_SIEZ = 40; #ifdef SUPPORT_AT_OHOSFWK static MediaVideoPlay *g_videoPlay = nullptr; -static bool g_lastPlayed_ = false; +static bool g_lastPlayed = false; static void ScreenStatusNotify(ScreenStatus status) { if (g_videoPlay == nullptr) { @@ -47,22 +47,22 @@ static void ScreenStatusNotify(ScreenStatus status) if (status == SCREEN_STATUS_OFF && g_videoPlay->isPlayed_) { g_videoPlay->PauseVideoPlay(); } else if (status == SCREEN_STATUS_ON) { - if (g_lastPlayed_ && g_videoPlay->isPause_) { + if (g_lastPlayed && g_videoPlay->isPause_) { g_videoPlay->ResumeVideoPlay(); } } - g_lastPlayed_ = temp; + g_lastPlayed = temp; } #endif static void GetTime(char* buf, int len) { struct timeval tv; - gettimeofday(&tv, NULL); - uint32_t second = tv.tv_sec % TIME_CONVERT; - uint32_t minute = tv.tv_sec / TIME_CONVERT; - uint32_t hour = (minute / TIME_CONVERT) % 24; // 24: 24 hours per day - uint32_t realMilliSecond = tv.tv_usec / USEC_TO_MILLI; + gettimeofday(&tv, nullptr); + int32_t second = tv.tv_sec % TIME_CONVERT; + int32_t minute = tv.tv_sec / TIME_CONVERT; + int32_t hour = (minute / TIME_CONVERT) % 24; // 24: 24 hours per day + int32_t realMilliSecond = tv.tv_usec / USEC_TO_MILLI; minute = minute % TIME_CONVERT; sprintf_s(buf, len, "%02d : %02d : %02d : %03d", hour, minute, second, realMilliSecond); diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/ui_test_group.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/ui_test_group.cpp index 7109cafed..0e6bce629 100755 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/ui_test_group.cpp +++ b/code/sdk/middleware/services/gui/uikit/sample/uitest/framework/src/ui_test_group.cpp @@ -96,7 +96,9 @@ void UITestGroup::SetUpTestCase() } testCaseList_->Clear(); testCaseList_->PushBack(TestCaseInfo{"老虎头", new UITestTiger()}); +#ifndef QSPI_DISPLAY testCaseList_->PushBack(TestCaseInfo{"蜂窝表盘", new UITestHexagonsList()}); +#endif testCaseList_->PushBack(TestCaseInfo{"滑动列表", new UITestListFPS()}); testCaseList_->PushBack(TestCaseInfo{"扫秒", new UITestSweepClock()}); testCaseList_->PushBack(TestCaseInfo{"指南针", new UITestCompass()}); @@ -106,18 +108,17 @@ void UITestGroup::SetUpTestCase() testCaseList_->PushBack(TestCaseInfo{"卡片切换", new UITestCardSwitch()}); testCaseList_->PushBack(TestCaseInfo{"消息", new UITestMessage()}); testCaseList_->PushBack(TestCaseInfo{"呼吸效果", new UITestBreath()}); +#ifndef QSPI_DISPLAY testCaseList_->PushBack(TestCaseInfo{"地图", new UITestMap()}); -#if !defined(_WIN32) && !defined(QSPI_DISPLAY) +#if !defined(_WIN32) testCaseList_->PushBack(TestCaseInfo{"视频播放", new UITestVideoPlay()}); #endif -#if !defined(QSPI_DISPLAY) testCaseList_->PushBack(TestCaseInfo{"翻转动效", new UITestCross()}); -#endif #if !defined(_WIN32) testCaseList_->PushBack(TestCaseInfo{"万花筒", new UITestKaleidoscope()}); #endif testCaseList_->PushBack(TestCaseInfo{"覆盖流", new UITestCoverflow()}); - +#endif #if ENABLE_VGU_ENGINE && CAPABILITY_HWDRAW_PATH testCaseList_->PushBack(TestCaseInfo{"倒计时", new UITestCountdown()}); testCaseList_->PushBack(TestCaseInfo{"动画曲线", new UITestRunningBall()}); diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/common/input_device_manager.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/common/input_device_manager.cpp index a4b37b165..3e1c2cb38 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/common/input_device_manager.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/common/input_device_manager.cpp @@ -16,6 +16,7 @@ #include "common/input_device_manager.h" #include "common/task_manager.h" #include "gfx_utils/graphic_log.h" +#include "dock/pointer_input_device.h" namespace OHOS { InputDeviceManager* InputDeviceManager::GetInstance() @@ -81,4 +82,16 @@ void InputDeviceManager::Clear() { deviceList_.Clear(); } + +void InputDeviceManager::ClearPressableViews() +{ + ListNode* node = deviceList_.Begin(); + while (node != deviceList_.End()) { + PointerInputDevice* device = dynamic_cast(node->data_); + if (device != nullptr) { + device->ClearPressableViews(); + } + node = node->next_; + } +} } // namespace OHOS \ No newline at end of file diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_chart.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_chart.cpp index 508445cfd..4f8656daa 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_chart.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_chart.cpp @@ -432,18 +432,30 @@ Path* UIChartPillar::AllocPath(uint32_t cmdNum, uint32_t dataNum) } path->cmdNum = cmdNum; path->dataNum = dataNum; - AllocInfo info; - info.expectedSize = sizeof(uint8_t) * cmdNum + sizeof(float) * dataNum; - info.usage = HBM_USE_ASSIGN_SIZE | HBM_USE_MEM_PATH; + + AllocInfo cmdInfo; GrallocBuffer cmdBuffer; - if (!GrallocEngines::GetInstance()->AllocBuffer(info, cmdBuffer)) { - GRAPHIC_LOGE("Alloc buffer for buffer failed."); + cmdInfo.expectedSize = sizeof(uint8_t) * cmdNum; + cmdInfo.usage = HBM_USE_ASSIGN_SIZE | HBM_USE_MEM_PATH; + if (!GrallocEngines::GetInstance()->AllocBuffer(cmdInfo, cmdBuffer)) { + GRAPHIC_LOGE("Alloc buffer for cmd buffer failed."); delete path; - path = nullptr; return nullptr; } + + AllocInfo dataInfo; + GrallocBuffer dataBuffer; + dataInfo.expectedSize = sizeof(float) * dataNum; + dataInfo.usage = HBM_USE_ASSIGN_SIZE | HBM_USE_MEM_PATH; + if (!GrallocEngines::GetInstance()->AllocBuffer(dataInfo, dataBuffer)) { + GRAPHIC_LOGE("Alloc buffer for data buffer failed."); + delete path; + GrallocEngines::GetInstance()->FreeBuffer(reinterpret_cast(cmdBuffer.virAddr)); + return nullptr; + } + path->cmds = (uint8_t *)cmdBuffer.virAddr; - path->data = reinterpret_cast(path->cmds + cmdNum); + path->data = reinterpret_cast(dataBuffer.virAddr); return path; } @@ -1023,13 +1035,12 @@ void UIChartPolyline::GradientWithVGU(BufferInfo& gfxDstBuffer, const Rect& inva { Point yStart = yAxis_.GetStartPoint(); yStart.y = enableReverse_ ? (yStart.y + gradientBottom_) : (yStart.y - gradientBottom_); - int16_t topY = enableReverse_ ? data->GetValleyData() : data->GetPeakData(); - int16_t bottomY = enableReverse_ ? data->GetPeakData() : data->GetValleyData(); + int16_t topY = data->GetPeakData(); yAxis_.TranslateToPixel(topY); - yAxis_.TranslateToPixel(bottomY); - int16_t startY = enableReverse_ ? topY : yStart.y; - int16_t endY = enableReverse_ ? yStart.y : topY; - if ((invalidatedArea.GetBottom() < endY) || (invalidatedArea.GetTop() > startY)) { + + int16_t startY = enableReverse_ ? yStart.y : topY; + int16_t endY = enableReverse_ ? topY : yStart.y; + if ((invalidatedArea.GetBottom() < startY) || (invalidatedArea.GetTop() > endY)) { return; } @@ -1061,7 +1072,7 @@ void UIChartPolyline::GradientWithVGU(BufferInfo& gfxDstBuffer, const Rect& inva ColorType color = data->GetFillColor(); int16_t opaScaleTop = enableReverse_ ? (topY - yStart.y - 1) : (yStart.y - topY - 1); - if ((opaScaleTop < 0) || (opaScaleTop >= invalidatedArea.GetHeight())) { + if (opaScaleTop < 0) { return; } VGUColorStop stops[2] = {{0, Color::ColorTo32(Color::GetColorFromRGBA( diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_image_animator.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_image_animator.cpp index ad12a80f9..621ff5d88 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_image_animator.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_image_animator.cpp @@ -139,6 +139,12 @@ void UIImageAnimatorView::SetImageAnimatorSrc(const ImageAnimatorInfo imageAnima uint16_t timeOfUpdate) { ClearImagesCache(); + if ((imageSrc_ != nullptr) && (imageNum_ != 0)) { + ImageAnimatorInfo* imageAnimatorInfo = &(imageSrc_[0]); + if (imageAnimatorInfo->imageType == IMG_SRC_IMAGE_INFO) { + SetSrc(static_cast(nullptr)); + } + } imageSrc_ = const_cast(imageAnimatorInfoSrc); imageNum_ = imageNum; timeOfUpdate_ = timeOfUpdate; diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_image_view.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_image_view.cpp index 04569006b..5b2af86c0 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_image_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_image_view.cpp @@ -27,6 +27,7 @@ #ifndef VERSION_LITE #include "gif_lib.h" #endif +#include "draw/draw_utils.h" namespace OHOS { #ifndef VERSION_LITE @@ -567,6 +568,15 @@ void UIImageView::SetSrc(const ImageInfo* src) Invalidate(); } +void UIImageView::DumpImgInfo() +{ + if (image_.GetSrcType() == IMG_SRC_VARIABLE) { + printf("view[%p]: viewType = %d\n", this, GetViewType()); + const ImageInfo* info = image_.GetImageInfo(); + PrintImgInfo(info); + } +} + #ifndef VERSION_LITE void UIImageView::AddAndStartGifAnimator() { diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_label.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_label.cpp index 5c4833840..18af043f5 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_label.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_label.cpp @@ -83,7 +83,8 @@ public: if (integerStep != 0) { offsetX_ -= integerStep; } else { - return; + offsetX_ -= 1; // At lest move one pixel + decimal_ = 0; } offsetX_ = ((offsetX_ - labelX_) % (textX_ + labelX_)) + labelX_; static_cast(view)->offsetX_ = offsetX_; diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_qrcode.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_qrcode.cpp index 9f2f1aba7..e3b110b8a 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_qrcode.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_qrcode.cpp @@ -147,7 +147,7 @@ void UIQrcode::SetQrcodeVal(const uint8_t* val, uint32_t length) qrcodeVal_ = nullptr; } dataBin_.clear(); - for (int i = 0; i < length; i++) { + for (uint32_t i = 0; i < length; i++) { dataBin_.push_back(val[i]); } } diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_swipe_view.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_swipe_view.cpp index a24706eed..b74328075 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_swipe_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_swipe_view.cpp @@ -321,18 +321,16 @@ void UISwipeView::SwitchToPage(int16_t dst, bool needAnimator) yOffset = (GetHeight() >> 1) - (dstView->GetY() + (dstView->GetHeightWithMargin() >> 1)); } - if ((xOffset != 0) || (yOffset != 0)) { - if (scrollAnimator_.GetState() != Animator::STOP) { - UIAbstractScroll::StopAnimator(); - } - if (needAnimator) { - animatorCallback_.SetDragTimes(tickTime_); - animatorCallback_.SetDragStartValue(0, 0); - animatorCallback_.SetDragEndValue(xOffset, yOffset); - scrollAnimator_.Start(); - } else { - MoveChildByOffset(xOffset, yOffset); - } + if (scrollAnimator_.GetState() != Animator::STOP) { + UIAbstractScroll::StopAnimator(); + } + if (needAnimator) { + animatorCallback_.SetDragTimes(tickTime_); + animatorCallback_.SetDragStartValue(0, 0); + animatorCallback_.SetDragEndValue(xOffset, yOffset); + scrollAnimator_.Start(); + } else { + MoveChildByOffset(xOffset, yOffset); } } diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp index 74a13ec57..3f63d2ea0 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view.cpp @@ -26,6 +26,7 @@ #include "gfx_utils/mem_api.h" #include "securec.h" #include "themes/theme_manager.h" +#include namespace OHOS { UIView::UIView() @@ -272,7 +273,8 @@ void UIView::Rotate(int16_t angle, const Vector2& pivot) { #if !ENABLE_MAP_BUFFER UIViewType type = GetViewType(); - if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW)) { + if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW) && + (type != UI_MENU_ITEM)) { GRAPHIC_LOGE("Rotate is not supported for view type %d if ENABLE_MAP_BUFFER is 0", type); return; } @@ -291,14 +293,15 @@ void UIView::Rotate(int16_t angle, const Vector3& pivotStart, const Vecto { #if !ENABLE_MAP_BUFFER UIViewType type = GetViewType(); - if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW)) { + if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW) && + (type != UI_MENU_ITEM)) { GRAPHIC_LOGE("Rotate is not supported for view type %d if ENABLE_MAP_BUFFER is 0", type); return; } #endif if (transMap_ == nullptr) { - ReMeasure(); transMap_ = new TransformMap(); + ReMeasure(); } bool firstTrans = transMap_->IsInvalid(); Rect joinRect = transMap_->GetBoxRect(); @@ -317,7 +320,8 @@ void UIView::Scale(const Vector2& scale, const Vector2& pivot) { #if !ENABLE_MAP_BUFFER UIViewType type = GetViewType(); - if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW)) { + if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW) && + (type != UI_MENU_ITEM)) { GRAPHIC_LOGE("Scale is not supported for view type %d if ENABLE_MAP_BUFFER is 0", type); return; } @@ -331,14 +335,15 @@ void UIView::Scale(const Vector3& scale, const Vector3& pivot) { #if !ENABLE_MAP_BUFFER UIViewType type = GetViewType(); - if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW)) { + if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW) && + (type != UI_MENU_ITEM)) { GRAPHIC_LOGE("Scale is not supported for view type %d if ENABLE_MAP_BUFFER is 0", type); return; } #endif if (transMap_ == nullptr) { - ReMeasure(); transMap_ = new TransformMap(); + ReMeasure(); } bool firstTrans = transMap_->IsInvalid(); Rect joinRect = transMap_->GetBoxRect(); @@ -365,14 +370,15 @@ void UIView::Shear(const Vector2& shearX, const Vector2& shearY, c { #if !ENABLE_MAP_BUFFER UIViewType type = GetViewType(); - if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW)) { + if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW) && + (type != UI_MENU_ITEM)) { GRAPHIC_LOGE("Shear is not supported for view type %d if ENABLE_MAP_BUFFER is 0", type); return; } #endif if (transMap_ == nullptr) { - ReMeasure(); transMap_ = new TransformMap(); + ReMeasure(); } bool firstTrans = transMap_->IsInvalid(); Rect joinRect = transMap_->GetBoxRect(); @@ -391,7 +397,8 @@ void UIView::Translate(const Vector2& trans) { #if !ENABLE_MAP_BUFFER UIViewType type = GetViewType(); - if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW)) { + if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW) && + (type != UI_MENU_ITEM)) { GRAPHIC_LOGE("Translate is not supported for view type %d if ENABLE_MAP_BUFFER is 0", type); return; } @@ -404,14 +411,15 @@ void UIView::Translate(const Vector3& trans) { #if !ENABLE_MAP_BUFFER UIViewType type = GetViewType(); - if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW)) { + if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW) && + (type != UI_MENU_ITEM)) { GRAPHIC_LOGE("Translate is not supported for view type %d if ENABLE_MAP_BUFFER is 0", type); return; } #endif if (transMap_ == nullptr) { - ReMeasure(); transMap_ = new TransformMap(); + ReMeasure(); } bool firstTrans = transMap_->IsInvalid(); Rect joinRect = transMap_->GetBoxRect(); @@ -437,8 +445,8 @@ bool UIView::IsTransInvalid() void UIView::SetCameraDistance(int16_t distance) { if (transMap_ == nullptr) { - ReMeasure(); transMap_ = new TransformMap(); + ReMeasure(); } Rect joinRect = transMap_->GetBoxRect(); transMap_->SetTransMapRect(GetOrigRect()); @@ -451,8 +459,8 @@ void UIView::SetCameraDistance(int16_t distance) void UIView::SetCameraPosition(const Vector2& position) { if (transMap_ == nullptr) { - ReMeasure(); transMap_ = new TransformMap(); + ReMeasure(); } Rect joinRect = transMap_->GetBoxRect(); transMap_->SetTransMapRect(GetOrigRect()); @@ -510,7 +518,9 @@ void UIView::RequestFocus() void UIView::ClearFocus() { - FocusManager::GetInstance()->ClearFocus(); + if (FocusManager::GetInstance()->GetFocusedView() == this) { + FocusManager::GetInstance()->ClearFocus(); + } } #endif @@ -799,7 +809,8 @@ void UIView::SetTransformMap(const TransformMap& transMap) { #if !ENABLE_MAP_BUFFER UIViewType type = GetViewType(); - if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW)) { + if ((type != UI_IMAGE_VIEW) && (type != UI_TEXTURE_MAPPER) && (type != UI_CANVAS_EXT) && (type != UI_MAP_VIEW) && + (type != UI_MENU_ITEM)) { GRAPHIC_LOGE("SetTransformMap is not supported for view type %d if ENABLE_MAP_BUFFER is 0", type); return; } @@ -1185,7 +1196,7 @@ bool UIView::GetBitmap(ImageInfo& bitmap) RootView::GetInstance()->SaveDrawContext(); RootView::GetInstance()->UpdateBufferInfo(&newBufferInfo); RootView::GetInstance()->SetSnapshotFlag(true); - RootView::GetInstance()->Measure(); + RootView::GetInstance()->MeasureView(this); RootView::GetInstance()->DrawTop(this, mask); #if ENABLE_VGU_ENGINE LiteMGfxEngine::GetInstance()->SyncHwDraw(); @@ -1197,4 +1208,47 @@ bool UIView::GetBitmap(ImageInfo& bitmap) rect_.SetPosition(tempX, tempY); return true; } + +bool UIView::IsVideoContained() +{ + if (GetViewType() == UI_LITE_SURFACE_VIEW) { + return true; + } + UIViewGroup* group = dynamic_cast(this); + if (group == nullptr) { + return false; + } + + UIView* view = group->GetChildrenHead(); + while (view != nullptr) { + if (view->IsVideoContained()) { + return true; + } + view = view->GetNextSibling(); + } + return false; +} + +void UIView::PrintImgInfo(const ImageInfo* info) +{ + if (info == nullptr) { + printf(" ImgInfo[%p]\n", info); + } else { + printf(" ImgInfo[%p]: size = [%d, %d], fmt = %d, data = %p, dataSize = %d, cacheNode = %p\n", + info, info->header.width, info->header.height, info->header.colorMode, info->data, info->dataSize, info->cacheNode); + } +} + +void UIView::DumpImgInfoRecursive() +{ + DumpImgInfo(); + + if (IsViewGroup()) { + UIView* child = static_cast(this)->GetChildrenHead(); + while (child != nullptr) { + child->DumpImgInfoRecursive(); + child = child->GetNextSibling(); + } + } +} } // namespace OHOS diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/pointer_input_device.h b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/pointer_input_device.h index 295fb93ff..c5343fc14 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/pointer_input_device.h +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/dock/pointer_input_device.h @@ -32,6 +32,14 @@ public: {} virtual ~PointerInputDevice() {} + void ClearPressableViews() + { + dragLen_ = { 0, 0 }; + dragStep_ = { 0, 0 }; + draggableView_ = nullptr; + touchableView_ = nullptr; + } + protected: void DispatchEvent(const DeviceData& data) override; diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/common/input_device_manager.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/common/input_device_manager.h index 11e09dac1..bd89a1919 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/common/input_device_manager.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/innerkits/common/input_device_manager.h @@ -53,6 +53,11 @@ public: */ void Clear(); + /** + * Clear pressable views recorded in the pointer input device + */ + void ClearPressableViews(); + void Callback() override; /** diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h index af0059558..3219560a8 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/root_view.h @@ -464,7 +464,7 @@ private: bool needScreencap_ = false; #endif bool isSnapshot_ = false; - UIView* blurView_; + UIView* blurView_ = nullptr; UIViewGroup sysView_; UIViewGroup appView_; }; diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_image_view.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_image_view.h index e39efb55e..24c62e790 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_image_view.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_image_view.h @@ -272,6 +272,8 @@ public: void SetWidth(int16_t width) override; void SetHeight(int16_t height) override; + void DumpImgInfo() override; + protected: /** * @brief Represents the width of this image. diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_swipe_view.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_swipe_view.h index 690be3930..884e5c376 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_swipe_view.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_swipe_view.h @@ -331,7 +331,7 @@ protected: virtual void SwitchToPage(int16_t dst, bool needAnimator = true); void MoveChildByOffset(int16_t xOffset, int16_t yOffset) override; void MoveHeadOrTailChild(); - + virtual void RefreshCurrentView(int16_t distance, uint8_t dragDirection); /** * @brief Indicates that the animation duration is 12 ticks. * @@ -370,7 +370,6 @@ protected: #endif private: - void RefreshCurrentView(int16_t distance, uint8_t dragDirection); void RefreshCurrentViewInner(int16_t distance, uint8_t dragDirection, int16_t (UIView::*pfnGetXOrY)() const, diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h index 3c9227f09..bffed44f7 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view.h @@ -115,6 +115,9 @@ enum UIViewType : uint8_t { UI_BARCODE, UI_MAP_VIEW, UI_KALEIDOSCOPE_VIEW, + UI_ROLLER_VIEW, + UI_HEXAGONS_LIST, + UI_ICOSAHEDRON_VIEW, UI_NUMBER_MAX }; @@ -1787,6 +1790,16 @@ public: * to apply blur effect to the background. */ void HandleGaussianBlur(BufferInfo& gfxDstBuffer); + + /** + * @brief Check whether this view is lite surface view or it contains lite surface view + */ + bool IsVideoContained(); + + void DumpImgInfoRecursive(); + + virtual void DumpImgInfo() {} + protected: bool touchable_ : 1; bool visible_ : 1; @@ -1824,6 +1837,7 @@ protected: bool IsInvalid(float percent); void DrawViewBounds(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea); void UpdateRectInfo(uint8_t key, const Rect& rect); + void PrintImgInfo(const ImageInfo* info); private: Rect rect_; diff --git a/code/sdk/middleware/services/gui/uikit/utils/interfaces/innerkits/graphic_config.h b/code/sdk/middleware/services/gui/uikit/utils/interfaces/innerkits/graphic_config.h index fd6764235..a31383746 100755 --- a/code/sdk/middleware/services/gui/uikit/utils/interfaces/innerkits/graphic_config.h +++ b/code/sdk/middleware/services/gui/uikit/utils/interfaces/innerkits/graphic_config.h @@ -157,7 +157,7 @@ namespace OHOS { * @brief use map buffer to support view transformation. if disable it to save memory, * transformation will not be supported except UIImageView, UITextureMapper and UICanvasExt. */ -#define ENABLE_MAP_BUFFER 1 +#define ENABLE_MAP_BUFFER 0 #elif defined _LITEOS /** * @brief Font shaping, which is disabled by default on LiteOS. @@ -361,7 +361,7 @@ namespace OHOS { /** * @brief Graphics rendering accelerated by VGUEngine, which is disabled by default on other platforms. */ -#define ENABLE_VGU_ENGINE 1 +#define ENABLE_VGU_ENGINE 0 /** * @brief ARM NEON ability, which is enabled by default on other platforms. */ @@ -369,7 +369,7 @@ namespace OHOS { /** * @brief vector font global ability, which is disabled by default on LiteOS. */ -#define ENABLE_FONT_VECTOR_GLOBAL 1 +#define ENABLE_FONT_VECTOR_GLOBAL 0 /** * @brief image bin ability, which is disabled by default on LiteOS. */ @@ -594,7 +594,7 @@ static constexpr uint8_t INDEV_DRAG_LIMIT = 10; /* Maximum depth of view nesting. The default value is 64. */ static constexpr uint8_t COMPONENT_NESTING_DEPTH = 64; /* Long-press event threshold. The default value is 1000 ms. */ -static constexpr uint16_t INDEV_LONG_PRESS_TIME = 100; +static constexpr uint16_t INDEV_LONG_PRESS_TIME = 1000; /* Delay for reporting a press event on a draggable object. The default value is 100 ms. */ static constexpr uint16_t INDEV_PRESS_TIME_IN_DRAG = 100; /* Maximum number of bytes in a text that can be continuously displayed. The default value is 4096 bytes. */ diff --git a/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/graphic_math.h b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/graphic_math.h index 7780787b1..748c81d8b 100755 --- a/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/graphic_math.h +++ b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/graphic_math.h @@ -662,6 +662,19 @@ public: */ Matrix4 Inverse() const; + /** + * @brief Obtains a rotation matrix. + * + * @param cosA Indicates the cosine of the angle to rotate. + * @param sinA Indicates the sine of the angle to rotate. + * @param pivot1 Indicates the rotation pivot. + * @param pivot2 Indicates the rotation pivot. + * @return Returns the matrix after rotation. + * @since 5.0 + * @version 3.0 + */ + static Matrix4 Rotate(T cosA, T sinA, const Vector3& pivot1, const Vector3& pivot2); + /** * @brief Obtains a rotation matrix. * @@ -865,7 +878,7 @@ bool Matrix4::operator==(const Matrix4& other) const } template -Matrix4 Matrix4::Rotate(T angle, const Vector3& pivot1, const Vector3& pivot2) +Matrix4 Matrix4::Rotate(T cosA, T sinA, const Vector3& pivot1, const Vector3& pivot2) { Matrix4 rotateMat4; T* rData = rotateMat4.data_; @@ -875,12 +888,12 @@ Matrix4 Matrix4::Rotate(T angle, const Vector3& pivot1, const Vector3(Sin(angle + QUARTER_IN_DEGREE)); - T sinA = static_cast(Sin(angle)); + T diff = 1 - cosA; T ux = (pivot2.x_ - pivot1.x_) / length; // 0 T uy = (pivot2.y_ - pivot1.y_) / length; // 0 T uz = (pivot2.z_ - pivot1.z_) / length; // 1 + Matrix4 transToOrigin = Matrix4::Translate(Vector3 { -pivot1.x_, -pivot1.y_, -pivot1.z_ }); rData[0] = ux * ux * diff + cosA; // 0 : index // cosA @@ -899,6 +912,14 @@ Matrix4 Matrix4::Rotate(T angle, const Vector3& pivot1, const Vector3 +Matrix4 Matrix4::Rotate(T angle, const Vector3& pivot1, const Vector3& pivot2) +{ + T cosA = static_cast(Sin(angle + QUARTER_IN_DEGREE)); + T sinA = static_cast(Sin(angle)); + return Matrix4::Rotate(cosA, sinA, pivot1, pivot2); +} + template Matrix4 Matrix4::Scale(const Vector3& scale, const Vector3& fixed) { diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager.cpp b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager.cpp index 7d49d1c93..38247a870 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager.cpp +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager.cpp @@ -14,7 +14,7 @@ #define LOG_MODULE_NAME "AudioManager" namespace Audio { -AudioManager::AudioManager() +AudioManager::AudioManager() noexcept : impl_(nullptr) { } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c index b90744cfd..ee97596ec 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/interrupt_manager.c @@ -782,7 +782,7 @@ static bool InterruptCheckIsCanResume(const InterruptElement *interruptMain, static void ResumeInterruptStream(const InterruptElement *interruptEl, List *list, bool isOutPut) { - for (ListIterator it = ListIterBegin(list); it != ListIterEnd(list);) { + for (ListIterator it = ListIterBegin(list); it != ListIterEnd(list); it = ListIterNext(list, it)) { InterruptElement *curInterruptEl = (InterruptElement *)ListIterData(it); if (curInterruptEl != NULL && curInterruptEl->isInterrupted && curInterruptEl->interruptedStreamType == interruptEl->streamType) { @@ -802,7 +802,6 @@ static void ResumeInterruptStream(const InterruptElement *interruptEl, List *lis curInterruptEl->delayedStreamType = AUDIO_STREAM_INVALID; } } - it = ListIterNext(list, it); } } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/stream_manager.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/stream_manager.c index aa07c130c..88f9624eb 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/stream_manager.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/stream_manager.c @@ -365,7 +365,7 @@ static int32_t CheckTrackState(const AudioStreamStrategy *strategy, int32_t newS for (int i = 0; i < CONCURRENT_ACTIVE_STREAM_MAX_NUM; i++) { if (g_streamMgrContext.simpleInfos[i].active) { uintptr_t handle = g_streamMgrContext.simpleInfos[i].streamHandle; - if (GetState(handle) == RUNNING) { + if (GetState(handle) == RUNNING && GetStreamType(handle) != AUDIO_STREAM_A2DP_MUSIC) { CHK_FAILED_RETURN(PauseTrack(handle), AUDIO_SUCCESS, AUDIO_ERROR, "pause failed"); } } @@ -522,7 +522,17 @@ static int32_t UpdateActiveStreamMixWeight(const AudioStreamStrategy *strategy, } int32_t ret = SetTrackVolume(streamHandle, g_streamMgrContext.typeVolume[typeHashId], mixWeightSet, NOT_SET_STREAM_VOLUME); - CHK_FAILED_RETURN(ret, AUDIO_SUCCESS, AUDIO_ERROR, "update stream volume fail when new stream create"); + // 解决多线程竞争,概率出现老流未启动设置混音失败,此时新流也会失败退出, + // 老流会在启动的时候设置音量,此处设置失败不应该直接向上返回错误, + // 后续要考虑下老流设置音箱的时机,此处是不是只记录音量信息即可 + if (ret == AUDIO_BAD_STATE) { + ALOGW("current state is not right!"); + return AUDIO_SUCCESS; + } + if (ret != AUDIO_SUCCESS) { + ALOGW("update stream volume fail when new stream create: %d", ret); + return AUDIO_ERROR; + } } } return AUDIO_SUCCESS; @@ -666,6 +676,10 @@ int32_t StreamMgrDestroyStreamOut(uintptr_t handle) AudioStreamStrategy *strategy = GetStrategyFromPolicyManager(&streamInfForDestroy, (uint32_t)streamId, STREAM_OUT_DESTROY); CHK_NULL_RETURN(strategy, AUDIO_ERROR, "get strategy fail when destroy out stream"); +#ifdef SUPPORT_SET_DSP_CLOCK_FREQ + AudioStreamType streamType = GetStreamType(handle); + AudioDeviceType deviceType = (AudioDeviceType)GetStreamDeviceId(handle); +#endif // hal 销毁 if (DestroyTrackHandle(handle) != AUDIO_SUCCESS) { return AUDIO_ERROR; @@ -676,9 +690,8 @@ int32_t StreamMgrDestroyStreamOut(uintptr_t handle) MediaMutexLock(g_mutex); DeleteOneStream(streamId, true); #ifdef SUPPORT_SET_DSP_CLOCK_FREQ - AudioStreamType streamType = GetStreamType(handle); if (IsAllStreamDestroyed(streamType)) { - SetHifiClockFreqByStreamTypeAndDeviceType(streamType, (AudioDeviceType)GetStreamDeviceId(handle), false); + SetHifiClockFreqByStreamTypeAndDeviceType(streamType, deviceType, false); } #endif if (UpdateTrackMixWeightWhenDestroy(strategy) != AUDIO_SUCCESS) { @@ -737,15 +750,18 @@ int32_t StreamMgrDestroyStreamIn(uintptr_t handle) { MediaMutexLock(g_mutex); int32_t streamId = GetSourceStreamId(handle); +#ifdef SUPPORT_SET_DSP_CLOCK_FREQ + AudioStreamType streamType = GetSourceStreamType(handle); + AudioDeviceType deviceType = (AudioDeviceType)GetSourceDeviceId(handle); +#endif if (DestroySourceHandle(handle) != AUDIO_SUCCESS) { MediaMutexUnLock(g_mutex); return AUDIO_ERROR; } DeleteOneStream(streamId, false); #ifdef SUPPORT_SET_DSP_CLOCK_FREQ - AudioStreamType streamType = GetSourceStreamType(handle); if (IsAllStreamDestroyed(streamType)) { - SetHifiClockFreqByStreamTypeAndDeviceType(streamType, (AudioDeviceType)GetSourceDeviceId(handle), false); + SetHifiClockFreqByStreamTypeAndDeviceType(streamType, deviceType, false); } #endif MediaMutexUnLock(g_mutex); diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c index d4248dba5..834752043 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/track_handle.c @@ -192,6 +192,9 @@ static int32_t ProcessCurStream(TrackHandleContext *context) return AUDIO_ERROR; } context->render = NULL; +#ifdef SUPPORT_SET_DSP_CLOCK_FREQ + SetHifiClockFreqByStreamTypeAndDeviceType(context->streamInfo.streamType, (AudioDeviceType)validFwDevice, false); +#endif return AUDIO_SUCCESS; } @@ -355,6 +358,7 @@ int32_t SetTrackOutputDevice(uintptr_t handle, int32_t deviceId, const AudioStre if (context->state == IDLE) { context->userAudioOutDevice = (uint32_t)deviceId; } else if (context->state == RUNNING) { + (void)context->callback(context->caller, AUDIO_EVENT_OUTPUT_DEVICE_CHANGED, NULL); if (ChangeRouteInner(context, deviceId) != AUDIO_SUCCESS) { goto ERR; } @@ -473,10 +477,9 @@ static void DestroyAudioRenderHandle(TrackHandleContext *context) static int32_t ResumeTrack(TrackHandleContext *context) { bool needChangeRoute = (context->routeChangedDevice != UNKNOWN); - + int32_t ret = UpdateMixWeigthWhenResume(context); + CHK_FAILED_RETURN_NO_LOG(ret, AUDIO_SUCCESS, ret); if (!needChangeRoute) { - int32_t ret = UpdateMixWeigthWhenResume(context); - CHK_FAILED_RETURN_NO_LOG(ret, AUDIO_SUCCESS, ret); if (context->render->control.Resume((AudioHandle)context->render) != AUDIO_SUCCESS) { return AUDIO_ERROR; } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/interfaces/kits/audiocommon/audio_base_type.h b/code/sdk/middleware/services/media/foundation/audiomanager/interfaces/kits/audiocommon/audio_base_type.h index 07b6c11d3..6df4ffcbc 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/interfaces/kits/audiocommon/audio_base_type.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/interfaces/kits/audiocommon/audio_base_type.h @@ -448,6 +448,7 @@ typedef enum { AUDIO_EVENT_RENDER_FULL, /**< The render buffer is full. */ AUDIO_EVENT_RENDER_EOS, /**< Render to the end of the stream. */ AUDIO_EVENT_BUFFER_EMPTY, /**< The underlying buffer data is empty. */ + AUDIO_EVENT_OUTPUT_DEVICE_CHANGED, /**< The output device has been changed. */ AUDIO_EVENT_ERROR_OCCUR, /**< An error occurs. */ } AudioCallbackEventType; diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/interfaces/kits/audiomanager/cpp/audio_manager.h b/code/sdk/middleware/services/media/foundation/audiomanager/interfaces/kits/audiomanager/cpp/audio_manager.h index f85583c5b..46654fccc 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/interfaces/kits/audiomanager/cpp/audio_manager.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/interfaces/kits/audiomanager/cpp/audio_manager.h @@ -332,7 +332,7 @@ public: int32_t DumpInfo(AudioManagerDebugInfo &audioManagerInfo); private: - AudioManager(); + AudioManager() noexcept; class AudioManagerImpl; AudioManagerImpl *impl_; }; diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/include/player_define.h b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/include/player_define.h index 4b5a8dc98..1701f52b9 100755 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/include/player_define.h +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/include/player_define.h @@ -68,6 +68,7 @@ typedef enum { EVNET_ON_JPEG_FRAME_RENDED, EVNET_FRAME_CONTINUE_LOST, EVNET_FIRST_AUDIO_REND, + EVNET_OUTPUT_DEVICE_CHANGED, EVNET_BUTT } EventCbType; diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp index f22c5817d..4d38e1786 100755 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.cpp @@ -272,6 +272,7 @@ PlayerControl::PlayerControl() seekToTimeMs_(-1), sourceType_(SOURCE_TYPE_BUT), firstAudioFrameAfterSeek_(false), + firstPosAfterSeek_(0), fd_(-1), offset_(0), playerSource_(nullptr), @@ -610,6 +611,10 @@ int32_t PlayerControl::OnPlayControlEvent(void *priv, const EventCbType event) c } else if (event == EVNET_AUDIO_BUFFER_EMPTY) { EventCallback(PLAYERCONTROL_BUFFER_EMPTY, nullptr); return HI_SUCCESS; + } else if (event == EVNET_OUTPUT_DEVICE_CHANGED) { + PlayerControl *player = static_cast(priv); + player->RecordLastPosition(); + return HI_SUCCESS; } PalayControlEventItem item; @@ -623,15 +628,16 @@ int32_t PlayerControl::OnPlayControlEvent(void *priv, const EventCbType event) c int32_t PlayerControl::PauseResume(void) { CHECK_NULL_RETURN(sinkManager_, HI_ERR_PLAYERCONTROL_NULL_PTR, "sinkManager_ nullptr"); + MediaMutexLock(schMutex_); int32_t ret = sinkManager_->Resume(); if (ret != HI_SUCCESS) { if (ret != NOT_FOUND_ACTIVE_STREAME) { MEDIA_ERR_LOG("resume failed"); hasVideo_ ? NotifyError(PLAYERCONTROL_ERROR_VID_PLAY_FAIL) : NotifyError(PLAYERCONTROL_ERROR_AUD_PLAY_FAIL); } + MediaMutexUnLock(schMutex_); return ret; } - MediaMutexLock(schMutex_); paused_ = false; // played to the end no need to signal if (!IsPlayEos()) { @@ -1130,7 +1136,11 @@ void PlayerControl::ReportRenderPosition(void) CHECK_NULL_RETURN_NONE(sinkManager_, "sinkManager_ nullptr"); sinkManager_->GetRenderPosition(position); if (position >= 0 && currentPosition_ != position) { - currentPosition_ = position; + if (lastRendPos_ > 0) { + currentPosition_ = position - lastRendPos_ + firstPosAfterSeek_; + } else { + currentPosition_ = position; + } EventCallback(PLAYERCONTROL_EVENT_PROGRESS, ¤tPosition_); } } @@ -1213,7 +1223,12 @@ int32_t PlayerControl::DequeueInputDataFromDemuxer(void) if (formatPacket_.data == nullptr && formatPacket_.len == 0) { strmReadEnd_ = true; + formatPacket_.timestampUs = -1; gettimeofday(&streamEndTime_, nullptr); + if (loop_) { + seekToTimeMs_ = 0; + return HI_FAILURE; + } } isAudio_ = (formatPacket_.frameType == FRAME_TYPE_AUDIO) ? true : false; @@ -1277,6 +1292,8 @@ int32_t PlayerControl::QueueInputDataToAudioSink(void) } if (firstAudioFrameAfterSeek_) { firstAudioFrameAfterSeek_ = false; + sinkManager_->GetRenderPosition(lastRendPos_); + firstPosAfterSeek_ = formatPacket_.timestampUs; MEDIA_INFO_LOG("push firstAudioFrameAfterSeek_ success, pts:%lld", formatPacket_.timestampUs); } if (formatPacket_.data != nullptr || formatPacket_.len != 0) { @@ -1832,6 +1849,7 @@ int32_t PlayerControl::DoSeekIfNeed(void) if (seekToTimeMs_ == -1) { return HI_SUCCESS; } + MEDIA_INFO_LOG("seek start"); int32_t ret = AyncSeek(seekToTimeMs_); if (ret != HI_SUCCESS) { MEDIA_ERR_LOG(" AyncSeek failed , ret:%d", ret); @@ -1847,7 +1865,7 @@ int32_t PlayerControl::DoSeekIfNeed(void) seekToTimeMs_ = -1; firstAudioFrameAfterSeek_ = true; firstVideoFrameAfterSeek_ = true; - MEDIA_DEBUG_LOG("seek end"); + MEDIA_INFO_LOG("seek end"); return HI_SUCCESS; } @@ -1896,6 +1914,11 @@ int32_t PlayerControl::DoSetPlaybackSpeed(float speed) const return HI_SUCCESS; } +void PlayerControl::RecordLastPosition() +{ + sinkManager_->RecordLastPosition(); +} + // util bigein void PlayerControl::EventCallback(PlayerControlEvent event, const void *data) const { @@ -1910,6 +1933,13 @@ void PlayerControl::PlayerControlCondSignal(void) } } +void PlayerControl::EnableSingleLooping(bool loop) +{ + MediaMutexLock(schMutex_); + loop_ = loop; + MediaMutexUnLock(schMutex_); +} + void PlayerControl::NotifyError(PlayerControlError playerError) const { EventCallback(PLAYERCONTROL_EVENT_ERROR, static_cast(&playerError)); @@ -1939,6 +1969,9 @@ void PlayerControl::FlushDecoder(void) const int32_t PlayerControl::DecoderAndSinkReset(void) { + if (strmReadEnd_ && loop_) { + return HI_SUCCESS; + } int32_t ret; bool isNeedResume = false; ret = sinkManager_->Pause(); @@ -1972,7 +2005,8 @@ int32_t PlayerControl::AyncSeek(int64_t seekTime) MEDIA_INFO_LOG("exec fmt_seek video stream failed, ret:%d", ret); seekTimeInMs = currentPosition_; } - } else if (fmtFileInfo_.s32UsedAudioStreamIndex != HI_DEMUXER_NO_MEDIA_STREAM) { + } + if (fmtFileInfo_.s32UsedAudioStreamIndex != HI_DEMUXER_NO_MEDIA_STREAM) { ret = playerSource_->Seek(fmtFileInfo_.s32UsedAudioStreamIndex, seekTimeInMs, FORMAT_SEEK_MODE_BACKWARD_KEY); if (ret != HI_SUCCESS) { MEDIA_INFO_LOG("exec fmt_seek audio stream failed, ret:%d", ret); diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.h b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.h index 90123212e..7c8d532fb 100755 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.h +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/player/liteplayer.h @@ -125,6 +125,7 @@ public: int32_t GetPlayerFileDumpInfo(PlayerFileDebugInfo &fileDebugInfo); void PlayerControlCondSignal(void); + void EnableSingleLooping(bool loop); protected: int32_t DoRegCallback(const PlayerCtrlCallbackParam &observer); @@ -155,6 +156,7 @@ protected: void ClearCachePacket(void); void NotifyError(PlayerControlError playerError) const; void EventCallback(PlayerControlEvent event, const void *data) const; + void RecordLastPosition(); private: int32_t InitAttr(const PlayerControlParam &createParam); bool IsPlayEos(void) const; @@ -271,6 +273,7 @@ private: SourceType sourceType_; bool firstAudioFrameAfterSeek_; bool firstVideoFrameAfterSeek_; + int64_t firstPosAfterSeek_; int32_t fd_; uint64_t offset_; std::string filePath_; diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_audio_sink.cpp b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_audio_sink.cpp index c9c06b86c..69568fdeb 100755 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_audio_sink.cpp +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_audio_sink.cpp @@ -45,7 +45,7 @@ AudioSink::AudioSink() rendStartTime_(-1), lastRendPts_(AV_INVALID_PTS), #ifdef MINI_MEMORY_SUPPORT - lastRenderPtsWhenPause_(0), + lastRenderPosition_(0), hasSendEosFrame_(false), #endif lastRendSysTimeMs_(-1), @@ -158,7 +158,7 @@ void AudioSink::ResetRendStartTime() { lastRendFrameCnt_ = 0; #ifdef MINI_MEMORY_SUPPORT - lastRenderPtsWhenPause_ = 0; + lastRenderPosition_ = 0; #endif lastRendPts_ = AV_INVALID_PTS; rendStartTime_ = AV_INVALID_PTS; @@ -552,9 +552,7 @@ int32_t AudioSink::Pause(void) CHECK_FAILED_RETURN(outStream_->Pause(), 0, -1, "pause() fail"); } paused_ = true; -#ifdef MINI_MEMORY_SUPPORT - lastRenderPtsWhenPause_ = lastRendPts_; -#endif + RecordLastPosition(); return SINK_SUCCESS; } @@ -632,7 +630,7 @@ void AudioSink::GetRenderPosition(int64_t &position) const position = posNs / NANOS_PER_MILLISECOND; #ifdef MINI_MEMORY_SUPPORT - position += lastRenderPtsWhenPause_; + position += lastRenderPosition_; #endif } @@ -669,6 +667,13 @@ int32_t AudioSink::SetOutputDevice(const int32_t deviceId) const return outStream_->SetOutputDevice(deviceId, renderConfig); } +void AudioSink::RecordLastPosition() +{ +#ifdef MINI_MEMORY_SUPPORT + lastRenderPosition_ = lastRendPts_; +#endif +} + int32_t AudioSink::SetParam(std::string &key, const DataType type, const void *value, int32_t len) const { (void)type; diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_audio_sink.h b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_audio_sink.h index a3dcd9d68..11dfc3539 100755 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_audio_sink.h +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_audio_sink.h @@ -65,6 +65,7 @@ public: void GetRenderPosition(int64_t &position) const; bool IsOffloadSupported(const AudioOffloadParam &offloadInfo) const; int32_t SetOutputDevice(const int32_t deviceId) const; + void RecordLastPosition(); private: void ResetRendStartTime(); void SendAudioEndOfStream(); @@ -94,7 +95,7 @@ private: int64_t rendStartTime_; int64_t lastRendPts_; #ifdef MINI_MEMORY_SUPPORT - int64_t lastRenderPtsWhenPause_; + int64_t lastRenderPosition_; bool hasSendEosFrame_; #endif int64_t lastRendSysTimeMs_; diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_sink_manager.cpp b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_sink_manager.cpp index c9cb7a75b..9ec34e693 100755 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_sink_manager.cpp +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_sink_manager.cpp @@ -466,5 +466,12 @@ int32_t SinkManager::SetOutputDevice(const int32_t deviceId) const } return -1; } + +void SinkManager::RecordLastPosition() +{ + if (audioSinkInfo_[0].sink != nullptr) { + audioSinkInfo_[0].sink->RecordLastPosition(); + } +} } } diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_sink_manager.h b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_sink_manager.h index f3cf5907e..f9e02fbc0 100755 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_sink_manager.h +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_control/sink/player_sink_manager.h @@ -79,6 +79,7 @@ public: void GetRenderPosition(int64_t &position) const; bool IsOffloadSupported(const AudioOffloadParam &offloadInfo) const; int32_t SetOutputDevice(const int32_t deviceId) const; + void RecordLastPosition(); private: float speed_; float leftVolume_; diff --git a/code/sdk/middleware/services/media/foundation/player/frameworks/player_impl.cpp b/code/sdk/middleware/services/media/foundation/player/frameworks/player_impl.cpp index 9e82e2cb3..42dc93487 100755 --- a/code/sdk/middleware/services/media/foundation/player/frameworks/player_impl.cpp +++ b/code/sdk/middleware/services/media/foundation/player/frameworks/player_impl.cpp @@ -985,6 +985,9 @@ int32_t Player::PlayerImpl::EnableSingleLooping(bool loop) return -1; } isSingleLoop_ = loop; + if (player_ != nullptr) { + player_->EnableSingleLooping(loop); + } MediaMutexUnLock(lock_); return 0; } diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/include/audio_module.h b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/include/audio_module.h index c4b2f13d2..23c96bbde 100755 --- a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/include/audio_module.h +++ b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/include/audio_module.h @@ -115,6 +115,15 @@ public: */ static JSIValue SrcGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + /** + * the getter of audio srcInner property + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSIValue SrcInnerGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + /** * the setter of audio src property * @@ -124,6 +133,15 @@ public: */ static JSIValue SrcSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + /** + * the setter of audio srcInner property + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSIValue SrcInnerSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + /** * the getter of audio currentTime property * diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/include/audio_player.h b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/include/audio_player.h index 3b71da894..30105485e 100755 --- a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/include/audio_player.h +++ b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/include/audio_player.h @@ -89,7 +89,7 @@ public: bool Stop(); - char *GetSrc() const; + char *GetSrc(bool innerFlag) const; double GetCurrentTime() const; @@ -107,7 +107,7 @@ public: bool IsPlaying() const; - bool SetSrc(char *src); + bool SetSrc(char *src, bool innerFlag); bool SetCurrentTime(double currentTime) const; @@ -159,6 +159,7 @@ private: static MediaMutexHandle lock_; static MediaThreadCondHandle condition_; static void *UpdateTimeHandler(void *arg); + static int GetSrcInnerPrefix(char *src, char *dest); Media::Player *player_; std::shared_ptr callback_; @@ -170,11 +171,13 @@ private: AudioEventListener *onErrorListener_; AudioEventListener *onTimeUpdateListener_; char *src_; + char *srcInner_; char *status_; double volume_; bool autoPlay_; bool muted_; bool isRunning_; + bool isSysSrc_; MediaThreadIdHandle updateTimeProcess_; }; } // namespace ACELite diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp index c830fe084..174b29fac 100755 --- a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp +++ b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_module.cpp @@ -153,7 +153,8 @@ JSIValue AudioModule::GetPlayState(const JSIValue thisVal, const JSIValue *args, AudioPlayer *audioPlayer = AudioPlayer::GetInstance(); JSIValue data = JSI::CreateObject(); JSI::SetStringProperty(data, "status", audioPlayer->GetStatus()); - JSI::SetStringProperty(data, "src", audioPlayer->GetSrc()); + JSI::SetStringProperty(data, "src", audioPlayer->GetSrc(false)); + JSI::SetStringProperty(data, "srcInner", audioPlayer->GetSrc(true)); JSI::SetNumberProperty(data, "currentTime", audioPlayer->GetCurrentTime()); JSI::SetBooleanProperty(data, "autoplay", audioPlayer->GetAutoPlay()); JSI::SetBooleanProperty(data, "loop", audioPlayer->IsLooping()); @@ -175,7 +176,13 @@ JSIValue AudioModule::GetPlayState(const JSIValue thisVal, const JSIValue *args, JSIValue AudioModule::SrcGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) { - char *src = AudioPlayer::GetInstance()->GetSrc(); + char *src = AudioPlayer::GetInstance()->GetSrc(false); + return (src == nullptr) ? JSI::CreateUndefined() : JSI::CreateString(src); +} + +JSIValue AudioModule::SrcInnerGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + char *src = AudioPlayer::GetInstance()->GetSrc(true); return (src == nullptr) ? JSI::CreateUndefined() : JSI::CreateString(src); } @@ -188,7 +195,24 @@ JSIValue AudioModule::SrcSetter(const JSIValue thisVal, const JSIValue *args, ui ActivateAudioInterrupt(); char *src = JSI::ValueToString(args[0]); bool autoPlay = AudioPlayer::GetInstance()->GetAutoPlay(); - bool ret = AudioPlayer::GetInstance()->SetSrc(src); + bool ret = AudioPlayer::GetInstance()->SetSrc(src, false); + AudioPlayer::GetInstance()->SetAudioSessionId(interrupt->sessionID); + if (autoPlay) { + AudioPlayer::GetInstance()->Play(); + } + return JSI::CreateBoolean(ret); +} + +JSIValue AudioModule::SrcInnerSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + if (argsSize < 1) { + MEDIA_ERR_LOG("1 argument is required."); + return JSI::CreateBoolean(false); + } + ActivateAudioInterrupt(); + char *src = JSI::ValueToString(args[0]); + bool autoPlay = AudioPlayer::GetInstance()->GetAutoPlay(); + bool ret = AudioPlayer::GetInstance()->SetSrc(src, true); AudioPlayer::GetInstance()->SetAudioSessionId(interrupt->sessionID); if (autoPlay) { AudioPlayer::GetInstance()->Play(); @@ -435,6 +459,7 @@ void InitAudioModule(JSIValue exports) JSI::SetModuleAPI(exports, "getPlayState", AudioModule::GetPlayState); AudioModule::DefineProperty(exports, "src", AudioModule::SrcGetter, AudioModule::SrcSetter); + AudioModule::DefineProperty(exports, "srcInner", AudioModule::SrcInnerGetter, AudioModule::SrcInnerSetter); AudioModule::DefineProperty(exports, "currentTime", AudioModule::CurrentTimeGetter, AudioModule::CurrentTimeSetter); AudioModule::DefineProperty(exports, "duration", AudioModule::DurationGetter, AudioModule::DurationSetter); AudioModule::DefineProperty(exports, "autoplay", AudioModule::AutoPlayGetter, AudioModule::AutoPlaySetter); diff --git a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp index 5c636780d..a94b564ea 100755 --- a/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp +++ b/code/sdk/middleware/services/media/foundation/player/interfaces/kits/player_lite/js/builtin/src/audio_player.cpp @@ -21,6 +21,8 @@ #include "js_async_work.h" #include "media_log.h" #include "audio_manager.h" +#include "bundlems_slite_client.h" +#include "abilityms_slite_client.h" #define DELETE_NOT_NULL(pointer) \ if (pointer != nullptr) \ @@ -38,6 +40,8 @@ constexpr uint16_t MAX_VOLUME = 100; constexpr double DEFAULT_VOLUME = 1.0; constexpr double MILLISECONDS_PER_SECOND = 1000.0; constexpr uint32_t MICROSECONDS_PER_SECOND = 1000 * 1000; +constexpr uint32_t MAX_PATH_LEN = 128; +char absPath[MAX_PATH_LEN] = {0}; static Audio::AudioManager& g_amInstance = Audio::AudioManager::GetInstance(); @@ -125,11 +129,13 @@ AudioPlayer::AudioPlayer() : player_(nullptr), onErrorListener_(nullptr), onTimeUpdateListener_(nullptr), src_(nullptr), + srcInner_(nullptr), status_(const_cast(STATUS_STOP)), volume_(DEFAULT_VOLUME), autoPlay_(false), muted_(false), isRunning_(false), + isSysSrc_(false), updateTimeProcess_(nullptr) {} void AudioPlayer::ForkUpdateTimeThread() @@ -184,6 +190,25 @@ void *AudioPlayer::UpdateTimeHandler(void *arg) return nullptr; } +int AudioPlayer::GetSrcInnerPrefix(char *src, char *dest) +{ + int ret; + ElementName* topAbility = OHOS::AbilityMsClient::GetInstance().GetTopAbility(); + if (topAbility != nullptr) { + BundleInfo bundleInfo; + ret = BundleMsClient::GetInstance().GetBundleInfo(topAbility->bundleName, 0, &bundleInfo); + if (ret == 0) { + (void)sprintf_s(dest, MAX_PATH_LEN - 1, "%s/assets/entry/%s", bundleInfo.codePath, src); + return 0; + } else { + MEDIA_ERR_LOG("failed to get bundleInfo!"); + } + } else { + MEDIA_ERR_LOG("failed to get top ability!"); + } + return -1; +} + void AudioPlayer::StopUpdateTimeThread() { MediaMutexLock(lock_); @@ -267,10 +292,14 @@ void AudioPlayer::ReleaseEventListeners() void AudioPlayer::ReleaseSrc() { - if (src_ != nullptr) { + if (src_ != nullptr && isSysSrc_ == true) { ace_free(src_); src_ = nullptr; } + if (srcInner_ != nullptr && isSysSrc_ == false) { + ace_free(srcInner_); + srcInner_ = nullptr; + } } bool AudioPlayer::Play() @@ -321,9 +350,9 @@ bool AudioPlayer::Stop() return true; } -char *AudioPlayer::GetSrc() const +char *AudioPlayer::GetSrc(bool innerFlag) const { - return src_; + return innerFlag ? srcInner_ : src_; } double AudioPlayer::GetCurrentTime() const @@ -387,7 +416,7 @@ bool AudioPlayer::IsPlaying() const return player_->IsPlaying(); } -bool AudioPlayer::SetSrc(char *src) +bool AudioPlayer::SetSrc(char *src, bool innerFlag) { if (src_ != nullptr) { if (!DestoryPlayer()) { @@ -403,14 +432,28 @@ bool AudioPlayer::SetSrc(char *src) return true; } - std::string uri(src); + std::string uri; + if (innerFlag) { + srcInner_ = src; + (void)memset_s(absPath, MAX_PATH_LEN, 0, MAX_PATH_LEN); + if (GetSrcInnerPrefix(src, absPath) != 0) { + MEDIA_ERR_LOG("fail to get absolute path of srcInner."); + return false; + } + uri += absPath; + src_ = absPath; + isSysSrc_ = false; + } else { + uri += src; + src_ = src; + isSysSrc_ = true; + } std::map header; Media::Source source(uri, header); if (player_->SetSource(source) != 0) { MEDIA_ERR_LOG("fail to set audio src property."); return false; } - src_ = src; if (player_->Prepare() != 0) { MEDIA_ERR_LOG("fail to prepare."); return false; diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_capture_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_capture_wrapper.cpp index e23fb05e8..d2591b368 100755 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_capture_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_capture_wrapper.cpp @@ -63,6 +63,7 @@ typedef struct TagTestSample { bool needStop; AudioInterrupt interrupt; MediaThreadIdHandle audioCaptureProcess; + MediaMutexHandle mutex; } TestSample; struct SampleAudioCapturerInfo { @@ -130,6 +131,29 @@ static AudioManager& g_amInstance = AudioManager::GetInstance(); static TestSample g_sample; static std::shared_ptr g_captureInterruptListener; +static void AudioCaptureStop() +{ + MediaMutexLock(g_sample.mutex); + if (!g_audioCap->Stop()) { + MEDIA_ERR_LOG("Stop failed"); + } + if (!g_audioCap->Release()) { + MEDIA_ERR_LOG("Release failed"); + } + + delete g_audioSourceProcessInput.buffer; + g_audioSourceProcessInput.buffer = nullptr; + + if (g_amInstance.DeactivateAudioInterrupt(g_sample.interrupt) != 0) { + MEDIA_ERR_LOG("deactivate audio interrupt failed"); + } + g_audioCap.reset(); + g_audioCap = nullptr; + g_audioSourceProcessInput.bThreadRun = false; + MediaMutexUnLock(g_sample.mutex); + (void)MediaMutexDestroy(&g_sample.mutex); +} + static void* AudioCaptureProcess(void* arg) { FILE *pfd = (FILE *)arg; @@ -163,22 +187,7 @@ static void* AudioCaptureProcess(void* arg) MEDIA_INFO_LOG("audioCap Read readCnt = %d, size = %d", readCnt, ret); } fclose(pfd); - - if (!g_audioCap->Stop()) { - MEDIA_ERR_LOG("Stop failed"); - } - if (!g_audioCap->Release()) { - MEDIA_ERR_LOG("Release failed"); - } - - delete g_audioSourceProcessInput.buffer; - g_audioSourceProcessInput.buffer = nullptr; - - if (g_amInstance.DeactivateAudioInterrupt(g_sample.interrupt) != 0) { - MEDIA_ERR_LOG("deactivate audio interrupt failed"); - } - g_audioCap.reset(); - g_audioSourceProcessInput.bThreadRun = false; + AudioCaptureStop(); MEDIA_INFO_LOG("AudioCaptureProcess end"); return NULL; } @@ -253,10 +262,12 @@ static int32_t HandleAudioCaptureCmd(int32_t argc, const char **argv) } MEDIA_INFO_LOG("unmute cmd out"); } else if ((strncmp(g_sample.control, "dumpinfo", strlen("dumpinfo")) == 0)) { + MediaMutexLock(g_sample.mutex); if (g_audioCap != nullptr && g_audioCap.get() != nullptr) { AudioCapturerDebugInfo info; g_audioCap->DumpInfo(info); } + MediaMutexUnLock(g_sample.mutex); } else { MEDIA_ERR_LOG("[AudioCaptureSample]control cmd not supported:%s do nothing", g_sample.control); return 0; @@ -346,6 +357,12 @@ int32_t AudioCaptureSample(int32_t argc, const char **argv) std::string filePath = ""; g_sample.needStop = false; g_interruptHintStop = false; + g_sample.mutex = MediaMutexCreate(nullptr); + if (g_sample.mutex == nullptr) { + MEDIA_ERR_LOG("create mutex failed"); + g_audioSourceProcessInput.bThreadRun = false; + return -1; + } SampleAudioCapturerInfo audioCapturerInfo = {}; AudioSession sessionId = AUDIO_SESSION_ID_NONE; FILE *pfd = nullptr; diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/camera_preview_sample_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/camera_preview_sample_wrapper.cpp index ec7d37df5..447b97cd8 100755 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/camera_preview_sample_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/camera_preview_sample_wrapper.cpp @@ -56,7 +56,7 @@ const static int16_t MEDIA_PATH_MAX = 260; const static int32_t WAIT_SURFACE_INIT_SUCCESS_US = 100000; const static int32_t WAIT_START_CAPTURE_SUCCESS_US = 100000; const static int32_t WAIT_SURFACE_DEINIT_SUCCESS_US = 100000; -const static int16_t SURFACE_BYTE_ALIGNMENT = 64; +const static int16_t SURFACE_BYTE_ALIGNMENT = 128; const static int16_t JPEG_WIDTH_BYTE_ALIGNMENT = 128; const static int16_t JPEG_HEIGHT_BYTE_ALIGNMENT = 16; const static int16_t JPEG_HEIGHT_DIVISOR = 2; diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp index 75ffd97da..42ef36bdf 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.cpp @@ -185,6 +185,7 @@ static void DeinitPlayerResources(MediaVideoPlay *videoPlay) { (void)videoPlay->player_.reset(); videoPlay->isExited_ = true; + videoPlay->isEntered_ = false; (void)MediaThreadCondDestroy(&videoPlay->cond_); (void)MediaMutexDestroy(&videoPlay->mutex_); } @@ -204,6 +205,7 @@ static int32_t VideoPlay(MediaVideoPlay *videoPlay) (void)videoPlay->player_->Release(); return MEDIA_ERR; } + videoPlay->player_->EnableSingleLooping(videoPlay->isLoop_); MediaMutexLock(videoPlay->mutex_); videoPlay->isPlayed_ = true; if (videoPlay->button_ != nullptr) { @@ -221,6 +223,7 @@ static int32_t VideoPlay(MediaVideoPlay *videoPlay) static void VideoStopAndExit(MediaVideoPlay *videoPlay) { + MediaMutexLock(videoPlay->mutex_); int32_t ret = videoPlay->player_->Stop(); if (ret != 0) { MEDIA_ERR_LOG("stop failed"); @@ -229,7 +232,6 @@ static void VideoStopAndExit(MediaVideoPlay *videoPlay) if (ret != 0) { MEDIA_ERR_LOG("reset failed"); } - MediaMutexLock(videoPlay->mutex_); videoPlay->isPlaybackCompleted_ = false; videoPlay->isPlayed_ = false; videoPlay->isPause_ = false; @@ -292,6 +294,24 @@ static Source GetVideoPlaySource(MediaVideoPlay *videoPlay) return source; } +static int32_t SetAudioSessionIdAndStreamType(MediaVideoPlay *videoPlay) +{ + int32_t ret = MEDIA_OK; + if (!videoPlay->isPureVideo_) { + ret = videoPlay->player_->SetAudioSessionId(videoPlay->sessionId_); + if (ret != MEDIA_OK) { + MEDIA_ERR_LOG("set audio sessionId failed\n"); + return ret; + } + ret = videoPlay->player_->SetAudioStreamType(AUDIO_STREAM_FITNESS_VIDEO); + if (ret != MEDIA_OK) { + MEDIA_ERR_LOG("set audio stream type failed\n"); + return ret; + } + } + return ret; +} + static int32_t RunVideoPlay(MediaVideoPlay *videoPlay) { bool success = InitPlayerResources(videoPlay); @@ -300,47 +320,32 @@ static int32_t RunVideoPlay(MediaVideoPlay *videoPlay) return MEDIA_ERR; } int32_t ret = 0; - do { - Source source = GetVideoPlaySource(videoPlay); - ret = videoPlay->player_->SetSource(source); - if (ret != 0) { - MEDIA_ERR_LOG("set source failed\n"); - (void)DeinitPlayerResources(videoPlay); - return MEDIA_ERR; - } - ret = videoPlay->player_->Prepare(); - if (ret != 0) { - MEDIA_ERR_LOG("prepare failed\n"); - return ReleasePlayer(videoPlay); - } - if (!videoPlay->isPureVideo_) { - ret = videoPlay->player_->SetAudioSessionId(videoPlay->sessionId_); - if (ret != 0) { - MEDIA_ERR_LOG("set audio sessionId failed\n"); - return ReleasePlayer(videoPlay); - } - ret = videoPlay->player_->SetAudioStreamType(AUDIO_STREAM_FITNESS_VIDEO); - if (ret != 0) { - MEDIA_ERR_LOG("set audio stream type failed\n"); - return ReleasePlayer(videoPlay); - } - } - ret = videoPlay->player_->SetVideoSurface(videoPlay->surface_); - if (ret != 0) { - MEDIA_ERR_LOG("set video surface failed\n"); - return ReleasePlayer(videoPlay); - } - ret = VideoPlay(videoPlay); - if (ret != 0) { - return ReleasePlayer(videoPlay); - } - VideoStopAndExit(videoPlay); - if (videoPlay->isPlaybackStopped_ || - videoPlay->playError_ || - videoPlay->interruptHintStop_) { - break; - } - } while (videoPlay->isLoop_); + Source source = GetVideoPlaySource(videoPlay); + ret = videoPlay->player_->SetSource(source); + if (ret != 0) { + MEDIA_ERR_LOG("set source failed\n"); + (void)DeinitPlayerResources(videoPlay); + return MEDIA_ERR; + } + ret = videoPlay->player_->Prepare(); + if (ret != 0) { + MEDIA_ERR_LOG("prepare failed\n"); + return ReleasePlayer(videoPlay); + } + ret = SetAudioSessionIdAndStreamType(videoPlay); + if (ret != 0) { + return ReleasePlayer(videoPlay); + } + ret = videoPlay->player_->SetVideoSurface(videoPlay->surface_); + if (ret != 0) { + MEDIA_ERR_LOG("set video surface failed\n"); + return ReleasePlayer(videoPlay); + } + ret = VideoPlay(videoPlay); + if (ret != 0) { + return ReleasePlayer(videoPlay); + } + VideoStopAndExit(videoPlay); SendBackgroundFrame(videoPlay); return 0; } @@ -399,9 +404,16 @@ MediaVideoPlay::~MediaVideoPlay() int32_t MediaVideoPlay::StartVideoPlay(void) { + if (isEntered_) { + MEDIA_INFO_LOG("video play is not stop, can not start!"); + return MEDIA_OK; + } isExited_ = false; isEntered_ = true; MediaThreadattr attr = { "VideoPlayThread", 0x2000, THREAD_SCHED_INVALID, 0, true }; + if (isSyncExitMode_) { + attr.detached = false; + } threadHandle_ = MediaThreadCreate(VideoPlayThread, this, &attr); if (threadHandle_ == NULL) { MEDIA_ERR_LOG("create thread failed\n"); @@ -480,16 +492,32 @@ int32_t MediaVideoPlay::GetDumpInfo(PlayerDebugInfo *playerInfo) int32_t MediaVideoPlay::StopVideoPlay(void) { MediaMutexLock(mutex_); - if (isPlaybackStopped_ || isPlaybackCompleted_ || interruptHintStop_) { - MEDIA_ERR_LOG("video play already stopped"); + if (!isPlayed_) { + MEDIA_INFO_LOG("video play is not start,can not stop!"); + isPlaybackStopped_ = true; MediaMutexUnLock(mutex_); return MEDIA_OK; } - + if (isPlaybackStopped_ || isPlaybackCompleted_ || interruptHintStop_) { + if (isLoop_) { + if (!isPlaybackCompleted_) { + MEDIA_ERR_LOG("video play already stopped"); + MediaMutexUnLock(mutex_); + return MEDIA_OK; + } + } else { + MEDIA_ERR_LOG("video play already stopped"); + MediaMutexUnLock(mutex_); + return MEDIA_OK; + } + } isPlaybackStopped_ = true; MediaThreadCondSignal(cond_); - play = nullptr; MediaMutexUnLock(mutex_); + if (isSyncExitMode_) { + MediaThreadJoin(&threadHandle_); + } + play = nullptr; return MEDIA_OK; } @@ -505,6 +533,15 @@ void MediaVideoPlay::SetVideoPlayLoop(bool isLoop) MediaMutexUnLock(mutex_); } +void MediaVideoPlay::SetSyncExitMode(bool isSyncExitMode) +{ + MediaMutexLock(mutex_); + if (!isEntered_) { + isSyncExitMode_ = isSyncExitMode; + } + MediaMutexUnLock(mutex_); +} + void MediaVideoPlay::DestroyVideoPlaySource(void) { if (!isEntered_) { diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h index 267fbffa2..7d260a49c 100644 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_play_wrapper.h @@ -36,6 +36,7 @@ public: int32_t ResumeVideoPlay(void); int32_t GetDumpInfo(PlayerDebugInfo *playerInfo); void SetVideoPlayLoop(bool isLoop); + void SetSyncExitMode(bool isSyncExitMode); bool IsExitCompletely(void); Surface *surface_ = nullptr; AudioInterrupt interrupt_; @@ -61,6 +62,7 @@ public: bool isPureVideo_ = false; static MediaVideoPlay *play; private: + bool isSyncExitMode_ = false; static void *VideoPlayThread(void *arg); void DestroyVideoPlaySource(void); }; diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_player_sample_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_player_sample_wrapper.cpp index eb7e38851..cea092d80 100755 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/video_player_sample_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/video_player_sample_wrapper.cpp @@ -69,7 +69,7 @@ using namespace OHOS; const static int32_t WAIT_SURFACE_INIT_SUCCESS_US = 100000; const static int32_t WAIT_PLAYER_SUCCESS_US = 1000000; const static int32_t WAIT_SURFACE_DEINIT_SUCCESS_US = 100000; -const static int16_t SURFACE_BYTE_ALIGNMENT = 64; +const static int16_t SURFACE_BYTE_ALIGNMENT = 128; const static int16_t JPEG_WIDTH_BYTE_ALIGNMENT = 128; const static int16_t JPEG_HEIGHT_BYTE_ALIGNMENT = 16; const static int16_t JPEG_HEIGHT_DIVISOR = 2; @@ -311,11 +311,6 @@ static void VideoStopAndExit(shared_ptr player) if (ret != 0) { MEDIA_ERR_LOG("Reset failed"); } - - if (g_isNeedLoop) { - return; - } - ret = player->Release(); if (ret != 0) { MEDIA_ERR_LOG("Release failed"); @@ -376,6 +371,7 @@ static int32_t VideoPlay(VideoPlaySampleContext *context) MEDIA_ERR_LOG("Play failed"); goto RELEASE_PLAYER; } + context->player->EnableSingleLooping(g_isNeedLoop); MediaMutexLock(g_videoPlayContextMutex); #if defined(ENABLE_LVGL) g_isPlayed = true; @@ -432,54 +428,50 @@ static int32_t RunVideoPlay(VideoPlaySampleContext *context) MEDIA_ERR_LOG("init player resources failed"); return -1; } - do { - std::string uri(context->filePath); - std::map header; - Source source(uri, header); - int32_t ret = context->player->SetSource(source); - if (ret != 0) { - MEDIA_ERR_LOG("SetSource failed"); - goto DEINIT_PLAYER; - } - ret = context->player->Prepare(); - if (ret != 0) { - MEDIA_ERR_LOG("Prepare failed"); - goto RELEASE_PLAYER; - } - ret = context->player->SetAudioSessionId(context->sessionId); - if (ret != 0) { - MEDIA_ERR_LOG("SetAudioSessionId failed"); - goto RELEASE_PLAYER; - } - ret = context->player->SetAudioStreamType(AUDIO_STREAM_FITNESS_VIDEO); - if (ret != 0) { - MEDIA_ERR_LOG("SetAudioStreamType failed"); - goto RELEASE_PLAYER; - } + std::string uri(context->filePath); + std::map header; + Source source(uri, header); + int32_t ret = context->player->SetSource(source); + if (ret != 0) { + MEDIA_ERR_LOG("SetSource failed"); + goto DEINIT_PLAYER; + } + ret = context->player->Prepare(); + if (ret != 0) { + MEDIA_ERR_LOG("Prepare failed"); + goto RELEASE_PLAYER; + } + ret = context->player->SetAudioSessionId(context->sessionId); + if (ret != 0) { + MEDIA_ERR_LOG("SetAudioSessionId failed"); + goto RELEASE_PLAYER; + } + ret = context->player->SetAudioStreamType(AUDIO_STREAM_FITNESS_VIDEO); + if (ret != 0) { + MEDIA_ERR_LOG("SetAudioStreamType failed"); + goto RELEASE_PLAYER; + } #if defined(ENABLE_UIKIT) - ret = context->player->SetVideoSurface(context->surface); + ret = context->player->SetVideoSurface(context->surface); #elif defined(ENABLE_LVGL) - ret = context->player->SetVideoSurface(g_surface); + ret = context->player->SetVideoSurface(g_surface); #endif - if (ret != 0) { - MEDIA_ERR_LOG("SetVideoSurface failed"); - goto RELEASE_PLAYER; - } - ret = VideoPlay(context); - if (ret != 0) { - goto RELEASE_PLAYER; - } - VideoStopAndExit(context->player); + if (ret != 0) { + MEDIA_ERR_LOG("SetVideoSurface failed"); + goto RELEASE_PLAYER; + } + ret = VideoPlay(context); + if (ret != 0) { + goto RELEASE_PLAYER; + } + VideoStopAndExit(context->player); #if defined(ENABLE_LVGL) - context->isPlaybackCompleted = false; - if (g_isNeedLoop) { - MediaMutexLock(g_videoPlayContextMutex); - g_isPlayed = false; - g_pause = false; - MediaMutexUnLock(g_videoPlayContextMutex); - } + context->isPlaybackCompleted = false; + MediaMutexLock(g_videoPlayContextMutex); + g_isPlayed = false; + g_pause = false; + MediaMutexUnLock(g_videoPlayContextMutex); #endif - } while (g_isNeedLoop); return 0; RELEASE_PLAYER: diff --git a/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/raw_format.c b/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/raw_format.c index 3bf0235b4..ce9d5b66e 100755 --- a/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/raw_format.c +++ b/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/raw_format.c @@ -202,8 +202,13 @@ static int32_t RawFormatFree(HalHandle fmtHandle, FormatPacket *fmtFrame) static int32_t RawFormatSeek(__attribute__((unused)) HalHandle fmtHandle, __attribute__((unused))int32_t streamIndex, __attribute__((unused)) int64_t toMs, __attribute__((unused)) uint32_t flag) { - MEDIA_HAL_LOGE(MODULE_NAME, "not support"); - return ERR_DEMUXER_NOT_SUPPORT; + RawFormatMember *member = (RawFormatMember *)fmtHandle; + CHK_NULL_RETURN(member, ERR_DEMUXER_INVALID_HANDLE, "input param fmtHandle null"); + CHK_FAILED_RETURN(member->prepared, true, -1, "not prepared"); + CHK_NULL_RETURN(member->ops, ERR_DEMUXER_NULL_PTR, "ops null"); + CHK_NULL_RETURN(member->demuxer, ERR_DEMUXER_NULL_PTR, "demuxer null"); + CHK_NULL_RETURN(member->ops->Seek, ERR_DEMUXER_NULL_PTR, "Seek null"); + return member->ops->Seek(member->demuxer, toMs, flag); } static int32_t RawFormatSeekPos(__attribute__((unused)) HalHandle fmtHandle, int64_t pos, uint32_t whence) diff --git a/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/sbc_demuxer.c b/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/sbc_demuxer.c index 3f7058b84..d48c033c0 100755 --- a/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/sbc_demuxer.c +++ b/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/sbc_demuxer.c @@ -104,6 +104,18 @@ static void SBCDemuxerClose(HalHandle fmtHandle) free(demuxer); } +static void FillFrameCommonInfo(FormatPacket *fmtFrame, int64_t timestamp) +{ + fmtFrame->packetType = PACKET_TYPE_AUDIO; + fmtFrame->trackId = 0; + fmtFrame->isKeyFrame = true; + fmtFrame->timestampUs = timestamp; + fmtFrame->durationUs = -1; + fmtFrame->frameIndex = 0; + fmtFrame->itemCnt = 0; + fmtFrame->item = NULL; +} + static int32_t SBCDemuxerReadFrame(HalHandle fmtHandle, FormatPacket *fmtFrame) { SBCDemuxer *demuxer = (SBCDemuxer *)fmtHandle; @@ -120,15 +132,7 @@ static int32_t SBCDemuxerReadFrame(HalHandle fmtHandle, FormatPacket *fmtFrame) return MEDIA_HAL_NO_MEM; } - size_t readLen = fread(fmtFrame->data, 1, SBC_BLOCK_DATA_SIZE, demuxer->file); - if (readLen == -1) { - free(fmtFrame->data); - fmtFrame->data = NULL; - fmtFrame->len = 0; - MEDIA_HAL_LOGE(MODULE_NAME, "fread falied"); - return MEDIA_HAL_ERR; - } - + uint32_t readLen = fread(fmtFrame->data, 1, SBC_BLOCK_DATA_SIZE, demuxer->file); if (readLen == 0) { free(fmtFrame->data); fmtFrame->data = NULL; @@ -136,14 +140,13 @@ static int32_t SBCDemuxerReadFrame(HalHandle fmtHandle, FormatPacket *fmtFrame) demuxer->eof = true; return RET_FILE_EOF; } - fmtFrame->packetType = PACKET_TYPE_AUDIO; fmtFrame->len = readLen; - + FillFrameCommonInfo(fmtFrame, -1); return MEDIA_HAL_OK; } -static int32_t SBCDemuxerFreeFrame(HalHandle fmtHandle, FormatPacket *fmtFrame) +static int32_t SBCDemuxerFreeFrame(const HalHandle fmtHandle, FormatPacket *fmtFrame) { MEDIA_HAL_UNUSED(fmtHandle); if (fmtFrame->data != NULL) { @@ -155,11 +158,19 @@ static int32_t SBCDemuxerFreeFrame(HalHandle fmtHandle, FormatPacket *fmtFrame) static int32_t SBCDemuxerSeek(HalHandle fmtHandle, int64_t toMs, uint32_t flag) { - MEDIA_HAL_UNUSED(fmtHandle); - MEDIA_HAL_UNUSED(toMs); + SBCDemuxer *demuxer = (SBCDemuxer *)fmtHandle; MEDIA_HAL_UNUSED(flag); - - MEDIA_HAL_LOGE(MODULE_NAME, "not support"); + if (toMs == 0) { + int32_t ret = fseek(demuxer->file, toMs, SEEK_SET); + if (ret != 0) { + MEDIA_HAL_LOGE(MODULE_NAME, "failed to seek to the sbc file header."); + return MEDIA_HAL_ERR; + } + demuxer->eof = false; + } else { + MEDIA_HAL_LOGE(MODULE_NAME, "not support"); + return MEDIA_HAL_ERR; + } return MEDIA_HAL_OK; } diff --git a/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/silk_demuxer.c b/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/silk_demuxer.c index 37c1f3bc7..b0e14defd 100755 --- a/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/silk_demuxer.c +++ b/code/sdk/middleware/services/media/hal/format/plugins/raw_demuxer/silk_demuxer.c @@ -71,6 +71,7 @@ typedef struct { int32_t readLen; int32_t prepared; FILE *file; + int64_t fileSeekStartPosition; } SilkRawDemuxer; static HalHandle SilkDemuxerOpen(const char *url) @@ -111,6 +112,7 @@ static HalHandle SilkDemuxerOpen(const char *url) demuxer->prepared = false; demuxer->firstFrame = true; demuxer->position = 0; + demuxer->fileSeekStartPosition = 0; MEDIA_HAL_LOGI(MODULE_NAME, "buffer Demuxer open"); return (HalHandle)demuxer; FREE: @@ -293,8 +295,21 @@ static int32_t SilkDemuxerFreeFrame(HalHandle fmtHandle, FormatPacket *fmtFrame) static int32_t SilkDemuxerSeek(__attribute__((unused)) HalHandle fmtHandle, __attribute__((unused)) int64_t toMs, __attribute__((unused)) uint32_t flag) { - MEDIA_HAL_LOGE(MODULE_NAME, "not support"); - return MEDIA_HAL_ERR; + SilkRawDemuxer *demuxer = (SilkRawDemuxer *)fmtHandle; + if (toMs == 0) { + int32_t ret = fseek(demuxer->file, demuxer->fileSeekStartPosition, SEEK_SET); + if (ret != 0) { + MEDIA_HAL_LOGE(MODULE_NAME, "failed to seek to the silk file header."); + return MEDIA_HAL_ERR; + } + demuxer->eof = false; + demuxer->position = demuxer->fileSeekStartPosition; + MEDIA_HAL_LOGI(MODULE_NAME, "SilkRawDemuxer seek success = %d!!", ftell(demuxer->file)); + } else { + MEDIA_HAL_LOGE(MODULE_NAME, "not support"); + return MEDIA_HAL_ERR; + } + return MEDIA_HAL_OK; } static int32_t GetBlockSampleRateAndLength(SilkRawDemuxer *demuxer, int32_t *sampleRate, int16_t *length) @@ -341,6 +356,7 @@ static int32_t ProbeScore(SilkRawDemuxer *demuxer, int32_t *score, int32_t offse { demuxer->probeSuccessed = true; demuxer->position = offset + SILK_HEAD_SIZE; + demuxer->fileSeekStartPosition = offset + SILK_HEAD_SIZE; if (fseek(demuxer->file, offset + SILK_HEAD_SIZE, SEEK_SET) != 0) { return MEDIA_HAL_ERR; } diff --git a/code/sdk/middleware/utils/dfx/CMakeLists.txt b/code/sdk/middleware/utils/dfx/CMakeLists.txt index dd8765faa..d5a904b8b 100755 --- a/code/sdk/middleware/utils/dfx/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/CMakeLists.txt @@ -140,6 +140,11 @@ else() ${CMAKE_CURRENT_SOURCE_DIR}/diag_transmit/ ) endif() +set(PRIVATE_HEADER + ${PRIVATE_HEADER} + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_system_cmd/include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/diag_system_cmd/dfx_include +) set(PRIVATE_DEFINES ) @@ -435,6 +440,8 @@ set(PUBLIC_HEADER ) set(PRIVATE_HEADER + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/last_dump/dfx_include + ${ROOT_DIR}/middleware/utils/dfx/diag_dfx_cmd/last_dump/include ) set(PRIVATE_DEFINES diff --git a/code/sdk/middleware/utils/dfx/dfx_reboot/cpu_utils/private/cpu_utils.c b/code/sdk/middleware/utils/dfx/dfx_reboot/cpu_utils/private/cpu_utils.c index fe0f4e02d..24d15c10f 100755 --- a/code/sdk/middleware/utils/dfx/dfx_reboot/cpu_utils/private/cpu_utils.c +++ b/code/sdk/middleware/utils/dfx/dfx_reboot/cpu_utils/private/cpu_utils.c @@ -39,6 +39,14 @@ #include "diag_log.h" #endif +#if defined CFG_DRIVERS_NANDFLASH +#include "nandflash_config.h" +#endif + +#if !defined(BUILD_RECOVERY_IMAGE) && !defined(BUILD_APPLICATION_SSB) +#include "cmsis_os2.h" +#endif + #if MCU_ONLY static cpu_utils_reboot_cb g_reboot_mcu_cb = NULL; #endif @@ -150,16 +158,33 @@ static bool cpu_utils_sys_reboot_req(ipc_action_t message, const volatile ipc_pa #endif set_update_reset_cause_on_boot(false); #if MCU_ONLY && defined(USE_CMSIS_OS) - log_oml_memory_dump(); + log_bt_req_dump(); #endif #if MCU_ONLY if (g_reboot_mcu_cb != NULL) { // when registering g_reboot_mcu_cb, need to restart chip by yourself. g_reboot_mcu_cb(src); return true; } +#endif +#ifdef CFG_DRIVERS_NANDFLASH + nand_driver_init(SPEED_SLOW); + set_trans_type(TRANS_BY_CPU_SINGLE_LINE); #endif reset_deal_with_fs(); - cpu_utils_reset_chip_with_log(src, (reboot_cause_t)reboot_reason); +#if defined(BUILD_APPLICATION_STANDARD) && (USE_COMPRESS_LOG_INSTEAD_OF_SDT_LOG == NO) + PRINT("Reboot by core:%d with reason of 0x%x", src, reboot_reason); +#endif + +#if (CORE == MASTER_BY_ALL) + set_update_reset_cause_on_boot(false); +#endif + cpu_utils_set_system_status_by_cause(reboot_reason); +#if !defined(BUILD_RECOVERY_IMAGE) && !defined(BUILD_APPLICATION_SSB) + /* Give the semaphore to ensure the main logging task will be active */ + (void)osSemaphoreRelease(get_save_file_semaphore()); +#else + hal_reboot_chip(); +#endif return true; } diff --git a/code/sdk/middleware/utils/dfx/dfx_reboot/reboot/shared/non_os_reboot.h b/code/sdk/middleware/utils/dfx/dfx_reboot/reboot/shared/non_os_reboot.h index cfe4cba4e..898bd5c88 100755 --- a/code/sdk/middleware/utils/dfx/dfx_reboot/reboot/shared/non_os_reboot.h +++ b/code/sdk/middleware/utils/dfx/dfx_reboot/reboot/shared/non_os_reboot.h @@ -101,6 +101,7 @@ typedef enum { REBOOT_CAUSE_UPG_COMPLETION = 0x2040, // !< Start of custom reset reasons REBOOT_CAUSE_MON_MEM_ALMOST_EMPTY = 0x2041, + REBOOT_CAUSE_APPLICATION_SECOND_FAULT = 0x2042, REBOOT_CAUSE_APPLICATION_RPC_TIMEOUT = 0x2100, // !< Start of custom reset reasons diff --git a/code/sdk/middleware/utils/dfx/diag/diag_cmd_router/diag_ind_src.c b/code/sdk/middleware/utils/dfx/diag/diag_cmd_router/diag_ind_src.c index 89c3c5be5..7da9d3360 100755 --- a/code/sdk/middleware/utils/dfx/diag/diag_cmd_router/diag_ind_src.c +++ b/code/sdk/middleware/utils/dfx/diag/diag_cmd_router/diag_ind_src.c @@ -28,6 +28,8 @@ #define SUB_MOD_ID_OFFSET 8 #define PKT_DATA_CNT_2 2 +static diag_msg_flow_control_hook g_flow_control_hook = NULL; + STATIC bool zdiag_msg_permit(uint32_t module_id, uint8_t level) { if ((zdiag_is_enable() == false) && (uapi_zdiag_offline_log_is_enable() != true)) { @@ -153,6 +155,12 @@ static errcode_t uapi_diag_report_packet_direct_secure(uint16_t cmd_id, diag_opt return ERRCODE_SUCC; } #endif + +void uapi_diag_register_msg_flow_control_hook(diag_msg_flow_control_hook func) +{ + g_flow_control_hook = func; +} + errcode_t uapi_diag_report_packet(uint16_t cmd_id, diag_option_t *option, const uint8_t *packet, uint16_t packet_size, bool sync) { @@ -308,6 +316,9 @@ errcode_t uapi_zdiag_report_sys_msg_instance(uint32_t module_id, uint32_t msg_id return ERRCODE_FAIL; } + if (g_flow_control_hook != NULL && g_flow_control_hook((uint8_t)module_id, level) == false) { + return ERRCODE_FAIL; + } diag_pkt_handle_init(&pkt, 1); /* data_cnt 为1 */ if (uapi_zdiag_offline_log_is_enable()) { diff --git a/code/sdk/middleware/utils/dfx/diag/include/diag_msg.h b/code/sdk/middleware/utils/dfx/diag/include/diag_msg.h index 0995edff4..a9b5e2390 100755 --- a/code/sdk/middleware/utils/dfx/diag/include/diag_msg.h +++ b/code/sdk/middleware/utils/dfx/diag/include/diag_msg.h @@ -11,9 +11,12 @@ #include "diag_common.h" #include "diag_channel.h" +typedef bool (*diag_msg_flow_control_hook)(uint8_t mid, uint8_t level); + errcode_t diag_msg_proc(uint16_t msg_id, uint8_t *msg, uint32_t msg_len); void uapi_zdiag_set_offline_log_enable(bool enable); bool uapi_zdiag_offline_log_is_enable(void); +void uapi_diag_register_msg_flow_control_hook(diag_msg_flow_control_hook func); #endif diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/CMakeLists.txt index 39443c864..ac54a4e6b 100755 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/CMakeLists.txt @@ -33,6 +33,9 @@ set(SOURCES ) set(PUBLIC_HEADER +) + +set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/diag_system_cmd/include ${CMAKE_CURRENT_SOURCE_DIR}/diag_system_cmd/dfx_include ${CMAKE_CURRENT_SOURCE_DIR}/diag_mocked_shell/include @@ -40,9 +43,6 @@ set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/last_dump/include ${CMAKE_CURRENT_SOURCE_DIR}/sample_data/dfx_include ${CMAKE_CURRENT_SOURCE_DIR}/sample_data/include -) - -set(PRIVATE_HEADER ${CMAKE_SOURCE_DIR}/include/middleware/utils ) set(PRIVATE_DEFINES diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/CMakeLists.txt index ca02b3a8a..93e14b5de 100755 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/CMakeLists.txt @@ -10,7 +10,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/include ) set(PRIVATE_HEADER diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/zdiag_audio_dump.c b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/zdiag_audio_dump.c index ff233c1ce..f3d67d859 100755 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/zdiag_audio_dump.c +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_dump/zdiag_audio_dump.c @@ -544,10 +544,8 @@ static int32_t dump_open_inst(audio_dump_inst *dump_inst) uapi_adp_attr adp_attr; osThreadAttr_t task_attr = {0}; thread_callback func_call = NULL; - char *real_path = NULL; - real_path = realpath(dump_inst->file_path, NULL); - dump_inst->h_file = fopen(real_path, "wb"); + dump_inst->h_file = fopen(dump_inst->file_path, "wb"); if (dump_inst->h_file == NULL) { diag_dump_log("open %s failed.", dump_inst->file_path); return ERRCODE_FAIL; diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/CMakeLists.txt index 01eb0cb85..0db1fa145 100755 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/CMakeLists.txt @@ -10,7 +10,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/include ) set(PRIVATE_HEADER diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_proc/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_proc/CMakeLists.txt index 9292cf1e3..762672d06 100755 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_proc/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_proc/CMakeLists.txt @@ -10,7 +10,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/include ) set(PRIVATE_HEADER diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_gpu_proc/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_gpu_proc/CMakeLists.txt index 8a57d15ec..03865a512 100755 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_gpu_proc/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_gpu_proc/CMakeLists.txt @@ -10,7 +10,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/include ) set(PRIVATE_HEADER diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_nv/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_nv/CMakeLists.txt index 5650c7e7d..86351c956 100755 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_nv/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_nv/CMakeLists.txt @@ -10,7 +10,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/include ) set(PRIVATE_HEADER diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_update/CMakeLists.txt b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_update/CMakeLists.txt index 348c5d4d0..c23cf2f54 100755 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_update/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_update/CMakeLists.txt @@ -10,7 +10,6 @@ set(SOURCES ) set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/include ) set(PRIVATE_HEADER diff --git a/code/sdk/middleware/utils/dfx/log/log.c b/code/sdk/middleware/utils/dfx/log/log.c index 68c80f5b1..360e14d1b 100755 --- a/code/sdk/middleware/utils/dfx/log/log.c +++ b/code/sdk/middleware/utils/dfx/log/log.c @@ -214,7 +214,7 @@ void log_event(const uint8_t *buffer, uint16_t length) } } else { #if (SLAVE_BY_LIBRA_BT || SLAVE_BY_LIBRA_GNSS || SLAVE_BY_SOCMN1_ONLY || SLAVE_BY_BS25_ONLY || \ - SLAVE_BY_WS53_ONLY || CHIP_WS63) + SLAVE_BY_WS53_ONLY || CHIP_WS63 || CHIP_BRANDY) g_trigger_tx = true; #endif g_missed_messages++; diff --git a/code/sdk/middleware/utils/dfx/log/log_oml_exception.c b/code/sdk/middleware/utils/dfx/log/log_oml_exception.c index b1ad6d09c..cdf3a5554 100755 --- a/code/sdk/middleware/utils/dfx/log/log_oml_exception.c +++ b/code/sdk/middleware/utils/dfx/log/log_oml_exception.c @@ -46,6 +46,8 @@ #include "last_dump_adapt.h" #endif #endif +#include "chip_io.h" +#include "nandflash_config.h" #define STACK_SIZE 3 @@ -437,23 +439,42 @@ void log_oml_dump_stack(void) #endif } -static void log_watch_dog_disable(void) +static void log_watch_dog_reconfigure(void) { watchdog_turnon_clk(); uapi_watchdog_disable(); - watchdog_turnoff_clk(); + /* DUMPÁ÷³ÌºÄʱ¹ý´ó£¬ÐèÒªÖØÐÂÅäÖù·³¬Ê±Ê±¼ä */ + uapi_watchdog_set_time(CHIP_WDT_TIMEOUT_256S); + uapi_watchdog_enable(WDT_MODE_INTERRUPT); +} + +void log_bt_req_dump(void) +{ +#if (USE_COMPRESS_LOG_INSTEAD_OF_SDT_LOG == NO) + log_watch_dog_reconfigure(); +#endif + +#ifdef HSO_SUPPORT + dfx_last_dump(); +#endif + return; } void log_oml_memory_dump(void) { #if (USE_COMPRESS_LOG_INSTEAD_OF_SDT_LOG == NO) - log_watch_dog_disable(); + log_watch_dog_reconfigure(); #if CORE == BT /* BT core has just one block of ram */ uapi_tcxo_delay_ms(DUMP_DELAY); -#elif CORE == APPS +#elif CORE == APPS && !defined(BUILD_RECOVERY_IMAGE) #ifdef HSO_SUPPORT dfx_last_dump(); + nand_driver_init(SPEED_SLOW); + set_trans_type(TRANS_BY_CPU_SINGLE_LINE); +#if defined SAVE_EXC_INFO + save_preserve_file_to_nand(); +#endif #else log_exception_dump_memory(APP_ITCM_ORIGIN, APP_ITCM_LENGTH); log_exception_dump_memory(APP_DTCM_ORIGIN, APP_DTCM_LENGTH); diff --git a/code/sdk/middleware/utils/dfx/log_reader/private/log_uart.c b/code/sdk/middleware/utils/dfx/log_reader/private/log_uart.c index be9873f3e..f83753b9c 100755 --- a/code/sdk/middleware/utils/dfx/log_reader/private/log_uart.c +++ b/code/sdk/middleware/utils/dfx/log_reader/private/log_uart.c @@ -27,7 +27,7 @@ #ifdef SUPPORT_IPC #include "ipc.h" #endif - +#include "exception.h" #include "uart.h" #include "watchdog.h" #include "log_uart_porting.h" @@ -368,7 +368,7 @@ void log_main(const void *unused_p) uint32_t wdg_left_time; uapi_watchdog_get_left_time(&wdg_left_time); - if (wdg_left_time < LOG_MIN_WATCHDOG_LEFT_TIME) { + if (wdg_left_time < LOG_MIN_WATCHDOG_LEFT_TIME && get_exception_status() != true) { uapi_watchdog_kick(); } } diff --git a/code/sdk/middleware/utils/dfx/preserve/private/preserve.c b/code/sdk/middleware/utils/dfx/preserve/private/preserve.c index 85414eccb..e26b6d8e8 100755 --- a/code/sdk/middleware/utils/dfx/preserve/private/preserve.c +++ b/code/sdk/middleware/utils/dfx/preserve/private/preserve.c @@ -21,6 +21,8 @@ #define RESERVED_PC_INDEX 0 #define RESERVED_LR_INDEX 1 #define RESERVED_SP_INDEX 2 +#define BTRACE_ADDR_EXEC 0x5900E000 +#define BTRACE_ADDR_EXEC_LEN 0X1FF8 // all security core preserve data here, if want to add new,should add tail for compatible befor version #pragma pack(4) @@ -100,6 +102,31 @@ static void system_set_reboot_status_by_crash_cause(void) g_preserve_data_lib.reboot_status = REBOOT_SOFT_PANIC_TRIGGER_STATUS; } } +#if defined SAVE_EXC_INFO +#if !defined(BUILD_RECOVERY_IMAGE) +void save_preserve_file_to_nand(void) +{ + const char *preserve_info_ex_path = "/user/exc/preserve.bin"; + int32_t ret = exc_info_write(preserve_info_ex_path, 0, (uint8_t *)&g_preserve_data_lib, sizeof(preserve_data_t)); + printf("save_preserve_file_to_nand ret:%d.\r\n", ret); +} + +void save_btram_file_to_nand(void) +{ + const char *btram_info_path = "/user/exc/bt_ram_info.bin"; + int32_t ret = + exc_info_write(btram_info_path, 0, (uint8_t *)BT_RAM_ORIGIN_APP_MAPPING, BT_RAM_ORIGIN_APP_MAPPING_LENGTH); + printf("save_btram_file_to_nand ret:%d.\r\n", ret); +} + +void save_btrace_file_to_nand(void) +{ + const char *btrace_info_path = "/user/exc/btrace_info.bin"; + int32_t ret = exc_info_write(btrace_info_path, 0, (uint8_t *)BTRACE_ADDR_EXEC, BTRACE_ADDR_EXEC_LEN); + printf("save_btrace_file_to_nand ret:%d.\r\n", ret); +} +#endif +#endif #ifdef weak weak void watchdog_porting_pmu_reboot(void) @@ -115,8 +142,11 @@ void system_boot_status_init(void) { bool is_hardwdg_timeout = false; if (!hal_reboot_get_ulp_aon_no_poweroff_flag()) { + hal_reboot_set_first_power_on_flag(); hal_reboot_set_ulp_aon_no_poweroff_flag(); memset_s((void *)&g_preserve_data_lib, sizeof(g_preserve_data_lib), 0, sizeof(g_preserve_data_lib)); + } else { + hal_reboot_clear_first_power_on_flag(); } if (g_preserve_data_lib.magic == 0) { // Hard power-off restart diff --git a/code/sdk/middleware/utils/dfx/preserve/public/preserve.h b/code/sdk/middleware/utils/dfx/preserve/public/preserve.h index 638afd0b4..8d735faca 100755 --- a/code/sdk/middleware/utils/dfx/preserve/public/preserve.h +++ b/code/sdk/middleware/utils/dfx/preserve/public/preserve.h @@ -112,6 +112,13 @@ uint32_t get_system_magic(void); void show_reboot_info(void); +#if !defined(BUILD_RECOVERY_IMAGE) +void save_preserve_file_to_nand(void); + +void save_btram_file_to_nand(void); + +void save_btrace_file_to_nand(void); +#endif /** * @} */ diff --git a/code/sdk/open_source/openharmony/CMakeLists.txt b/code/sdk/open_source/openharmony/CMakeLists.txt index 846c4170c..540bec494 100755 --- a/code/sdk/open_source/openharmony/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/CMakeLists.txt @@ -29,6 +29,7 @@ add_subdirectory_with_alias_if_exist(base/global/i18n_lite ${PROJECT_BINARY_DIR} add_subdirectory_with_alias_if_exist(base/global/resmgr_lite ${PROJECT_BINARY_DIR}/ohos/resmgr) add_subdirectory_with_alias_if_exist(utils/native/lite/file ${PROJECT_BINARY_DIR}/ohos/file) add_subdirectory_with_alias_if_exist(utils/native/lite/kv_store ${PROJECT_BINARY_DIR}/ohos/kv_store) +add_subdirectory_with_alias_if_exist(utils/native/lite/js/builtin ${PROJECT_BINARY_DIR}/ohos/storage_jsi) add_subdirectory_with_alias_if_exist(hiviewdfx/hiview/lite ${PROJECT_BINARY_DIR}/ohos/hiview) add_subdirectory_with_alias_if_exist(hiviewdfx/hievent/lite ${PROJECT_BINARY_DIR}/ohos/hievent) add_subdirectory_with_alias_if_exist(hiviewdfx/hilog/lite/frameworks/mini ${PROJECT_BINARY_DIR}/ohos/hilog) diff --git a/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt index 2166b4a29..572bdff94 100755 --- a/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/base/global/i18n_lite/CMakeLists.txt @@ -1,11 +1,11 @@ set(COMPONENT_NAME "i18n") set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/include - ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/kits/i18n/include ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/i18n/include + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/kits/i18n/include ) set(SOURCES diff --git a/code/sdk/open_source/openharmony/base/global/resmgr_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/base/global/resmgr_lite/CMakeLists.txt index 6c4895fed..2cf01e081 100755 --- a/code/sdk/open_source/openharmony/base/global/resmgr_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/base/global/resmgr_lite/CMakeLists.txt @@ -1,11 +1,11 @@ set(COMPONENT_NAME "resmgr") set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/resmgr_lite/include - ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/innerkits/include ) set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/frameworks/resmgr_lite/include + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/innerkits/include ) set(SOURCES diff --git a/code/sdk/open_source/openharmony/base/security/permission/CMakeLists.txt b/code/sdk/open_source/openharmony/base/security/permission/CMakeLists.txt index ebb566d3b..5a38671bd 100755 --- a/code/sdk/open_source/openharmony/base/security/permission/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/base/security/permission/CMakeLists.txt @@ -6,6 +6,8 @@ set(PUBLIC_HEADER set(PRIVATE_HEADER ${ROOT_DIR}/open_source/openharmony/third_party/cJSON + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/frameworks/resmgr_lite/include + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/interfaces/innerkits/include ) set(SOURCES diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/CMakeLists.txt index e7594794b..9a2c0fa1f 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/CMakeLists.txt @@ -8,6 +8,12 @@ set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/base ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/jsi ${CMAKE_CURRENT_SOURCE_DIR}/ + ${CMAKE_CURRENT_SOURCE_DIR}/include/base + ${CMAKE_CURRENT_SOURCE_DIR}/include/context +) + +set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/base ${CMAKE_CURRENT_SOURCE_DIR}/animation ${CMAKE_CURRENT_SOURCE_DIR}/base ${CMAKE_CURRENT_SOURCE_DIR}/base/cache @@ -22,10 +28,6 @@ set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/router ${CMAKE_CURRENT_SOURCE_DIR}/stylemgr ${CMAKE_CURRENT_SOURCE_DIR}/targets -) - -set(PRIVATE_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/base ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include/service @@ -46,6 +48,23 @@ set(PRIVATE_HEADER ${ROOT_DIR}/application/wearable/ohos_deps ${ROOT_DIR}/open_source/openharmony/third_party/cJSON ${ROOT_DIR}/open_source/openharmony/third_party/qrcodegen/cpp + ${ROOT_DIR}/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include + ${ROOT_DIR}/open_source/openharmony/base/global/i18n_lite/interfaces/kits/i18n/include + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/frameworks/resmgr_lite/include + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/interfaces/innerkits/include + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-core + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-core/api + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-core/ext + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-core/include + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-core/ecma/base + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-core/jmem + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-core/jrt + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-core/lit + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-ext/include + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-ext/include/jerryscript-ext + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-port/default/include + ${ROOT_DIR}/open_source/openharmony/third_party/jerryscript/jerry-libm/include + ) if("JS_ENABLE" IN_LIST DEFINES) @@ -153,6 +172,12 @@ set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/base ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/jsi ${CMAKE_CURRENT_SOURCE_DIR}/ + ${CMAKE_CURRENT_SOURCE_DIR}/include/base + ${CMAKE_CURRENT_SOURCE_DIR}/include/context +) + +set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/base ${CMAKE_CURRENT_SOURCE_DIR}/animation ${CMAKE_CURRENT_SOURCE_DIR}/base ${CMAKE_CURRENT_SOURCE_DIR}/base/cache @@ -167,10 +192,7 @@ set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/router ${CMAKE_CURRENT_SOURCE_DIR}/stylemgr ${CMAKE_CURRENT_SOURCE_DIR}/targets -) - -set(PRIVATE_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/base + ${ROOT_DIR}/application/wearable/service/msg_center/include/vendor_app ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include/service @@ -191,6 +213,10 @@ set(PRIVATE_HEADER ${ROOT_DIR}/application/wearable/ohos_deps ${ROOT_DIR}/open_source/openharmony/third_party/cJSON ${ROOT_DIR}/open_source/openharmony/third_party/qrcodegen/cpp + ${ROOT_DIR}/open_source/openharmony/base/global/i18n_lite/frameworks/i18n/include + ${ROOT_DIR}/open_source/openharmony/base/global/i18n_lite/interfaces/kits/i18n/include + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/frameworks/resmgr_lite/include + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/interfaces/innerkits/include ) if("JS_ENABLE" IN_LIST DEFINES) @@ -224,10 +250,12 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/components/tab_content_component.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/tabs_component.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/text_component.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/components/baidu_map_component.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/app_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/dfx_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/module_manager.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/locale_module.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/app_data_module.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/cjson_parser.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/console_log_impl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets/console_module.cpp @@ -287,3 +315,172 @@ install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/interfaces" "*") install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/include" "*") build_component() + +set(COMPONENT_NAME "baidumapcomponent") +set(MODULE_NAME "ohos") +set(AUTO_DEF_FILE_ID TRUE) + +set(PUBLIC_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/async + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/base + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/jsi + ${CMAKE_CURRENT_SOURCE_DIR}/ + ${CMAKE_CURRENT_SOURCE_DIR}/animation + ${CMAKE_CURRENT_SOURCE_DIR}/base + ${CMAKE_CURRENT_SOURCE_DIR}/base/cache + ${CMAKE_CURRENT_SOURCE_DIR}/components + ${CMAKE_CURRENT_SOURCE_DIR}/context + ${CMAKE_CURRENT_SOURCE_DIR}/directive + ${CMAKE_CURRENT_SOURCE_DIR}/include/base + ${CMAKE_CURRENT_SOURCE_DIR}/include/context + ${CMAKE_CURRENT_SOURCE_DIR}/jsi + ${CMAKE_CURRENT_SOURCE_DIR}/modules + ${CMAKE_CURRENT_SOURCE_DIR}/modules/presets + ${CMAKE_CURRENT_SOURCE_DIR}/router + ${CMAKE_CURRENT_SOURCE_DIR}/stylemgr + ${CMAKE_CURRENT_SOURCE_DIR}/targets + ${ROOT_DIR}/application/wearable/service/msg_center/include/vendor_app +) + +set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/base + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include/service + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/components + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/animator + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/innerkits + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils + ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/layout + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits/common + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/font + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/dfx + ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include + ${ROOT_DIR}/application/wearable/ohos_deps + ${ROOT_DIR}/open_source/openharmony/third_party/cJSON + ${ROOT_DIR}/open_source/openharmony/third_party/qrcodegen/cpp + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent +) + +set(SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/modules/baidumapcomponent/baidumap.cpp +) + +set(COMPONENT_PUBLIC_CCFLAGS +) + +set(COMPONENT_CCFLAGS + -std=c++11 + -Wno-error + -Wno-unused-parameter + -fno-exceptions + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -Wno-undef + -Wno-bitwise-op-parentheses + -Wno-shift-op-parentheses + -nostdlibinc + -nostdinc + -nostdlib + -Wno-c++11-narrowing + -Wno-error=unused-function +) + +set(WHOLE_LINK + true +) + +set(MAIN_COMPONENT + false +) + +set(PUBLIC_DEFINES + FEATURE_MODULE_BAIDU + FEATURE_COMPONENT_BAIDUMAP +) + +set(PRIVATE_DEFINES +) + +install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/interfaces" "*") +install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/include" "*") + +build_component() + +set(COMPONENT_NAME "brightness") +set(MODULE_NAME "ohos") +set(AUTO_DEF_FILE_ID TRUE) + +set(PUBLIC_HEADER +) + +set(PRIVATE_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/base + ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/base + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include/service + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/components + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/animator + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/innerkits + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils + ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/layout + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits/common + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/font + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/dfx + ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include + ${ROOT_DIR}/open_source/openharmony/third_party/cJSON + ${ROOT_DIR}/open_source/openharmony/third_party/qrcodegen/cpp + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display +) + +set(SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/modules/display/display.cpp +) + +set(COMPONENT_PUBLIC_CCFLAGS +) + +set(COMPONENT_CCFLAGS + -std=c++11 + -Wno-error + -Wno-unused-parameter + -fno-exceptions + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -Wno-undef + -Wno-bitwise-op-parentheses + -Wno-shift-op-parentheses + -nostdlibinc + -nostdinc + -nostdlib + -Wno-c++11-narrowing + -Wno-error=unused-function +) + +set(WHOLE_LINK + true +) + +set(MAIN_COMPONENT + false +) + +set(PUBLIC_DEFINES + FEATURE_MODULE_BRIGHTNESS +) + +set(PRIVATE_DEFINES +) + +install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/interfaces" "*") +install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/include" "*") + +build_component() diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/framework_min_bc.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/framework_min_bc.h index 6c357d593..f29b72f5c 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/framework_min_bc.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/framework_min_bc.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Copyright (c) 2020-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,8 +13,10 @@ * limitations under the License. */ -// AUTO GENERATED, PLEASE DO NOT EDIT DIRECTLY +#ifndef OHOS_ACELITE_FRAMEWORK_MIN_BC_H +#define OHOS_ACELITE_FRAMEWORK_MIN_BC_H +// AUTO GENERATED, PLEASE DO NOT EDIT DIRECTLY #include #ifndef ACELITE_FRAMEWORK_RAW_BUFFER @@ -25,17 +27,17 @@ #define OHOS_ACELITE_FRAMEWORK_MIN_SNAPSHOT_BUFFER const uint8_t g_frameworkBCBuffer[] = { - 0x4a, 0x52, 0x52, 0x59, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x0a, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x01, 0x00, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x28, 0x00, 0x30, 0x28, - 0x01, 0xc3, 0x4f, 0x08, 0x46, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x21, 0x00, 0x03, 0x02, + 0x4a, 0x52, 0x52, 0x59, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x0a, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x41, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00, 0x00, 0x90, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x33, 0x2c, + 0x01, 0xd4, 0x5d, 0x08, 0x53, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x41, 0x00, 0x03, 0x02, 0x02, 0x06, 0x0c, 0x0c, 0x07, 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x27, 0x01, 0x00, 0x00, 0xa7, 0x01, 0x00, 0x00, 0x07, 0x02, 0x00, 0x00, 0x87, 0x02, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x47, 0x03, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, 0x47, 0x04, 0x00, 0x00, 0x28, 0x06, 0x56, 0x02, - 0x60, 0x21, 0x07, 0x28, 0x07, 0x56, 0x03, 0x63, 0x11, 0x0a, 0x2b, 0x03, 0x08, 0x01, 0xb7, 0xc9, - 0x01, 0x21, 0x28, 0x09, 0x56, 0x04, 0x60, 0x21, 0x05, 0x36, 0x04, 0x0a, 0x11, 0x08, 0x29, 0x04, - 0x01, 0xbd, 0x01, 0x0f, 0x28, 0x00, 0x1d, 0x04, 0x28, 0x05, 0xcc, 0x00, 0x28, 0x01, 0xb7, 0xd2, - 0x0b, 0x04, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, + 0x47, 0x03, 0x00, 0x00, 0xe7, 0x03, 0x00, 0x00, 0x47, 0x04, 0x00, 0x00, 0x2c, 0x06, 0x64, 0x02, + 0x6e, 0x21, 0x07, 0x2c, 0x07, 0x64, 0x03, 0x71, 0x11, 0x0a, 0x2f, 0x03, 0x08, 0x01, 0xc8, 0xda, + 0x01, 0x21, 0x2c, 0x09, 0x64, 0x04, 0x6e, 0x21, 0x05, 0x39, 0x04, 0x0a, 0x11, 0x08, 0x2d, 0x04, + 0x01, 0xce, 0x01, 0x0f, 0x2c, 0x00, 0x1d, 0x04, 0x2c, 0x05, 0xdd, 0x00, 0x2c, 0x01, 0xc8, 0xe3, + 0x0b, 0x04, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x09, 0x27, 0x3b, 0x07, 0x05, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, 0xc7, 0x05, 0x00, 0x00, 0x07, 0x06, 0x00, 0x00, 0x47, 0x06, 0x00, 0x00, 0x87, 0x06, 0x00, 0x00, 0xc7, 0x06, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x87, 0x07, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, @@ -46,159 +48,161 @@ const uint8_t g_frameworkBCBuffer[] = 0xe7, 0x10, 0x00, 0x00, 0x87, 0x11, 0x00, 0x00, 0x07, 0x12, 0x00, 0x00, 0x87, 0x12, 0x00, 0x00, 0xe7, 0x12, 0x00, 0x00, 0x47, 0x13, 0x00, 0x00, 0xc7, 0x13, 0x00, 0x00, 0x47, 0x14, 0x00, 0x00, 0xe7, 0x14, 0x00, 0x00, 0x87, 0x15, 0x00, 0x00, 0xe7, 0x15, 0x00, 0x00, 0x47, 0x16, 0x00, 0x00, - 0x88, 0x01, 0x00, 0x00, 0xa8, 0x01, 0x00, 0x00, 0xc8, 0x01, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, - 0x10, 0x02, 0x00, 0x00, 0x40, 0x02, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x08, 0x05, 0x00, 0x00, - 0x48, 0x05, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x00, 0xe0, 0x05, 0x00, 0x00, 0x10, 0x06, 0x00, 0x00, - 0x48, 0x06, 0x00, 0x00, 0x60, 0x06, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x50, 0x07, 0x00, 0x00, - 0x70, 0x07, 0x00, 0x00, 0x98, 0x07, 0x00, 0x00, 0xb0, 0x07, 0x00, 0x00, 0xa8, 0x09, 0x00, 0x00, - 0x41, 0x04, 0x43, 0x05, 0x07, 0x2c, 0x2d, 0x39, 0x14, 0x1c, 0x18, 0x09, 0x48, 0x27, 0x0a, 0x48, - 0x28, 0x0b, 0x48, 0x29, 0x0c, 0xcb, 0x00, 0xce, 0x2a, 0x01, 0xce, 0x2b, 0x02, 0x36, 0x05, 0x0d, - 0x28, 0x2e, 0xd1, 0x0e, 0x36, 0x05, 0x0d, 0x28, 0x2f, 0xd1, 0x0f, 0x36, 0x05, 0x0d, 0x28, 0x30, - 0xd1, 0x10, 0x36, 0x05, 0x0d, 0x28, 0x31, 0xd1, 0x11, 0x2b, 0x06, 0x12, 0x32, 0xc8, 0x2b, 0x06, - 0x13, 0x33, 0xc8, 0x36, 0x06, 0x0d, 0x28, 0x34, 0xd1, 0x14, 0x36, 0x06, 0x0d, 0x28, 0x35, 0xd1, - 0x15, 0x36, 0x06, 0x0d, 0x28, 0x36, 0xd1, 0x16, 0x36, 0x06, 0x0d, 0x28, 0x37, 0xd1, 0x17, 0x14, - 0x48, 0x0a, 0x18, 0x48, 0x0b, 0x19, 0x48, 0x1b, 0x1a, 0x48, 0x1d, 0x1c, 0x48, 0x1f, 0x1e, 0x48, - 0x21, 0x20, 0x48, 0x23, 0x22, 0xcb, 0x04, 0x3b, 0x08, 0x24, 0x28, 0x04, 0xc0, 0x3a, 0x25, 0x28, - 0x38, 0xc0, 0xcb, 0x03, 0x36, 0x07, 0x0d, 0x28, 0x3a, 0xd1, 0x26, 0x47, 0x07, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x01, 0x00, 0x29, 0x00, 0x04, 0x01, 0x01, 0x01, 0x03, 0x03, 0x87, 0x07, 0x00, 0x00, - 0x07, 0x08, 0x00, 0x00, 0x37, 0x01, 0x3a, 0x02, 0x28, 0x00, 0xbf, 0x46, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x01, 0x00, 0x29, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x02, 0x87, 0x07, 0x00, 0x00, - 0x67, 0x08, 0x00, 0x00, 0x37, 0x00, 0x3a, 0x01, 0xba, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x05, 0x00, 0x01, 0x00, 0x29, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x87, 0x07, 0x00, 0x00, - 0xc7, 0x16, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x37, 0x00, 0x37, 0x00, 0x35, 0x01, 0x8b, 0x02, - 0x34, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x29, 0x00, 0x02, 0x01, - 0x01, 0x01, 0x02, 0x02, 0x07, 0x02, 0x00, 0x00, 0x28, 0x01, 0x56, 0x00, 0x60, 0x21, 0x05, 0x2f, - 0x6a, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x29, 0x00, 0x07, 0x03, - 0x03, 0x04, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x47, 0x17, 0x00, 0x00, 0x47, 0x18, 0x00, 0x00, - 0x07, 0x19, 0x00, 0x00, 0x3b, 0x03, 0x04, 0x29, 0x00, 0x01, 0x14, 0x32, 0x00, 0x4f, 0x18, 0x05, - 0x48, 0x02, 0x06, 0xb3, 0x03, 0x46, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x29, 0x00, 0x03, 0x04, - 0x04, 0x04, 0x0a, 0x0a, 0x87, 0x19, 0x00, 0x00, 0xe7, 0x19, 0x00, 0x00, 0x87, 0x1a, 0x00, 0x00, - 0xe7, 0x1a, 0x00, 0x00, 0x67, 0x1b, 0x00, 0x00, 0xe7, 0x09, 0x00, 0x00, 0x28, 0x00, 0xd4, 0x04, - 0x28, 0x01, 0xd4, 0x05, 0x28, 0x02, 0xd4, 0x06, 0x28, 0x03, 0xd4, 0x07, 0x3c, 0x09, 0xba, 0xd4, - 0x08, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x01, - 0x01, 0x05, 0x0a, 0x0c, 0x47, 0x05, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, 0x27, 0x1c, 0x00, 0x00, - 0x07, 0x07, 0x00, 0x00, 0xa7, 0x1c, 0x00, 0x00, 0x67, 0x1d, 0x00, 0x00, 0xe7, 0x1d, 0x00, 0x00, - 0x87, 0x15, 0x00, 0x00, 0x87, 0x1e, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, - 0x42, 0x01, 0x00, 0x31, 0x4f, 0xd4, 0x05, 0x2b, 0x02, 0x01, 0x06, 0x30, 0xb0, 0x03, 0x3b, 0x03, - 0x07, 0x28, 0x01, 0xc0, 0x21, 0x06, 0x29, 0x0a, 0x01, 0xbd, 0x04, 0x3b, 0x04, 0x08, 0x28, 0x01, - 0xc0, 0x3a, 0x09, 0x28, 0x0b, 0xbf, 0x46, 0x00, 0x05, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x01, - 0x01, 0x03, 0x04, 0x05, 0x07, 0x05, 0x00, 0x00, 0xc7, 0x05, 0x00, 0x00, 0x87, 0x1e, 0x00, 0x00, - 0x28, 0x00, 0x00, 0x00, 0x42, 0x01, 0x00, 0x3b, 0x02, 0x03, 0x28, 0x04, 0xbf, 0x46, 0x00, 0x00, - 0x07, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x01, 0x01, 0x05, 0x05, 0x06, 0x47, 0x06, 0x00, 0x00, - 0x47, 0x05, 0x00, 0x00, 0x07, 0x05, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, - 0x41, 0x01, 0x42, 0x02, 0x00, 0x36, 0x03, 0x02, 0xcb, 0x01, 0x2b, 0x04, 0x03, 0x02, 0x28, 0x05, - 0xb0, 0x03, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x01, 0x00, 0x19, 0x00, 0x05, 0x00, - 0x00, 0x0a, 0x16, 0x16, 0x87, 0x05, 0x00, 0x00, 0xc7, 0x05, 0x00, 0x00, 0xc7, 0x06, 0x00, 0x00, - 0x27, 0x1c, 0x00, 0x00, 0x27, 0x1f, 0x00, 0x00, 0x47, 0x06, 0x00, 0x00, 0x07, 0x06, 0x00, 0x00, - 0x47, 0x05, 0x00, 0x00, 0x87, 0x06, 0x00, 0x00, 0x07, 0x05, 0x00, 0x00, 0x27, 0x09, 0x00, 0x00, - 0xe7, 0x1f, 0x00, 0x00, 0x67, 0x20, 0x00, 0x00, 0xc7, 0x20, 0x00, 0x00, 0x87, 0x0f, 0x00, 0x00, - 0x47, 0x10, 0x00, 0x00, 0x47, 0x13, 0x00, 0x00, 0xc7, 0x16, 0x00, 0x00, 0x87, 0x1e, 0x00, 0x00, - 0x67, 0x0c, 0x00, 0x00, 0x67, 0x1d, 0x00, 0x00, 0xa7, 0x0e, 0x00, 0x00, 0x41, 0x02, 0x36, 0x03, - 0x0a, 0x35, 0x0b, 0x3a, 0x0c, 0x28, 0x04, 0xc0, 0xcb, 0x01, 0x3b, 0x05, 0x0d, 0x2a, 0x01, 0xc5, - 0x36, 0x06, 0x0e, 0x67, 0x07, 0x1d, 0x07, 0x36, 0x06, 0x0f, 0x67, 0x07, 0x11, 0x07, 0xcf, 0x01, - 0x00, 0x01, 0x11, 0x36, 0x06, 0x10, 0x67, 0x07, 0x21, 0x0a, 0x3b, 0x01, 0x0b, 0x32, 0x01, 0xc0, - 0xcc, 0x00, 0x04, 0x28, 0x00, 0x21, 0x0e, 0x36, 0x00, 0x11, 0x21, 0x09, 0x3b, 0x00, 0x12, 0x36, - 0x08, 0x13, 0xc0, 0x04, 0x36, 0x09, 0x14, 0xcb, 0x02, 0x28, 0x02, 0x21, 0x06, 0x3b, 0x02, 0x15, - 0xba, 0x04, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x29, 0x00, 0x04, 0x01, - 0x01, 0x02, 0x02, 0x03, 0x47, 0x05, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x2b, 0x02, 0x01, 0x00, - 0x36, 0x01, 0x00, 0xb1, 0x03, 0x45, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x09, 0x00, 0x07, 0x03, - 0x03, 0x07, 0x0c, 0x0e, 0x07, 0x06, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, 0x47, 0x06, 0x00, 0x00, - 0x07, 0x07, 0x00, 0x00, 0x67, 0x1d, 0x00, 0x00, 0x47, 0x17, 0x00, 0x00, 0x47, 0x18, 0x00, 0x00, - 0x47, 0x21, 0x00, 0x00, 0xa7, 0x21, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, - 0x41, 0x03, 0x42, 0x04, 0x01, 0x42, 0x05, 0x02, 0x36, 0x00, 0x07, 0xcb, 0x03, 0x3b, 0x06, 0x08, - 0x29, 0x00, 0x04, 0x14, 0x31, 0x4f, 0x18, 0x09, 0x48, 0x0c, 0x0a, 0x48, 0x0d, 0x0b, 0xb3, 0x03, - 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x29, 0x00, 0x05, 0x00, - 0x02, 0x07, 0x0c, 0x0c, 0x07, 0x05, 0x00, 0x00, 0x07, 0x06, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, - 0x87, 0x06, 0x00, 0x00, 0x47, 0x06, 0x00, 0x00, 0xc7, 0x08, 0x00, 0x00, 0xc7, 0x0a, 0x00, 0x00, - 0x67, 0x0c, 0x00, 0x00, 0xa7, 0x0c, 0x00, 0x00, 0xe7, 0x0d, 0x00, 0x00, 0x3b, 0x02, 0x07, 0xba, - 0xd7, 0x00, 0x28, 0x00, 0x21, 0x09, 0x3b, 0x00, 0x08, 0x29, 0x03, 0x04, 0xc6, 0x04, 0x3b, 0x05, - 0x09, 0x28, 0x06, 0xc0, 0xd7, 0x01, 0x3b, 0x05, 0x0a, 0x28, 0x01, 0xc0, 0x21, 0x09, 0x3b, 0x01, - 0x0b, 0x29, 0x03, 0x04, 0xc6, 0x04, 0x47, 0x06, 0x05, 0x00, 0x01, 0x00, 0x29, 0x00, 0x04, 0x01, - 0x01, 0x04, 0x05, 0x05, 0x47, 0x06, 0x00, 0x00, 0x07, 0x06, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, - 0x67, 0x0d, 0x00, 0x00, 0xce, 0x00, 0x01, 0x3b, 0x02, 0x04, 0x28, 0x03, 0xbf, 0x46, 0x00, 0x00, - 0x08, 0x00, 0x01, 0x00, 0x29, 0x00, 0x06, 0x00, 0x00, 0x01, 0x06, 0x06, 0x07, 0x05, 0x00, 0x00, - 0x07, 0x08, 0x00, 0x00, 0xe7, 0x19, 0x00, 0x00, 0x67, 0x20, 0x00, 0x00, 0x87, 0x19, 0x00, 0x00, - 0x67, 0x08, 0x00, 0x00, 0x00, 0x15, 0x10, 0x3b, 0x00, 0x01, 0x30, 0xbf, 0x37, 0x02, 0x3a, 0x03, - 0x37, 0x04, 0xc0, 0x45, 0x00, 0x1d, 0x08, 0x3b, 0x00, 0x05, 0xb9, 0x10, 0x46, 0x00, 0x00, 0x00, - 0x0b, 0x00, 0x01, 0x00, 0x29, 0x00, 0x07, 0x00, 0x04, 0x05, 0x0b, 0x0b, 0x47, 0x05, 0x00, 0x00, - 0x67, 0x1b, 0x00, 0x00, 0xe7, 0x09, 0x00, 0x00, 0x87, 0x19, 0x00, 0x00, 0xe7, 0x1a, 0x00, 0x00, - 0x87, 0x1a, 0x00, 0x00, 0x67, 0x20, 0x00, 0x00, 0x37, 0x05, 0xd7, 0x00, 0x3c, 0x06, 0xba, 0xd7, - 0x01, 0x37, 0x07, 0xd7, 0x02, 0x37, 0x08, 0xd7, 0x03, 0x6b, 0x01, 0x00, 0x1d, 0x06, 0x29, 0x04, - 0x01, 0xbd, 0x21, 0x12, 0x37, 0x09, 0x3a, 0x0a, 0x2b, 0x02, 0x01, 0x00, 0x28, 0x03, 0xb3, 0x04, - 0x28, 0x01, 0xd5, 0x05, 0x04, 0x46, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x29, 0x00, 0x05, 0x02, - 0x03, 0x03, 0x07, 0x07, 0xe7, 0x0c, 0x00, 0x00, 0x47, 0x03, 0x00, 0x00, 0x07, 0x22, 0x00, 0x00, - 0x07, 0x08, 0x00, 0x00, 0x3b, 0x00, 0x03, 0x28, 0x01, 0x30, 0xc6, 0xd7, 0x02, 0x28, 0x04, 0x56, - 0x02, 0x60, 0x21, 0x11, 0x37, 0x05, 0x1d, 0x05, 0x1c, 0xd5, 0x05, 0x04, 0x37, 0x05, 0x3a, 0x06, - 0x28, 0x02, 0xc0, 0x04, 0x46, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x29, 0x00, 0x03, 0x00, - 0x01, 0x01, 0x04, 0x04, 0x07, 0x22, 0x00, 0x00, 0x67, 0x08, 0x00, 0x00, 0xc7, 0x16, 0x00, 0x00, - 0x37, 0x01, 0xd7, 0x00, 0x28, 0x00, 0x11, 0x0e, 0x01, 0x07, 0x3b, 0x00, 0x02, 0xba, 0xb6, 0x36, - 0x00, 0x03, 0x0d, 0x08, 0x46, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x29, 0x00, 0x02, 0x01, - 0x01, 0x03, 0x04, 0x04, 0x47, 0x05, 0x00, 0x00, 0x87, 0x06, 0x00, 0x00, 0x67, 0x1d, 0x00, 0x00, - 0x28, 0x00, 0x21, 0x06, 0x29, 0x01, 0x00, 0xbd, 0x11, 0x12, 0x36, 0x00, 0x03, 0x11, 0x07, 0x36, - 0x00, 0x03, 0x01, 0x06, 0x29, 0x02, 0x00, 0x3f, 0x01, 0x04, 0x28, 0x00, 0x45, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x00, 0x29, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0xa7, 0x1c, 0x00, 0x00, - 0x28, 0x00, 0x21, 0x05, 0x36, 0x00, 0x01, 0x45, 0x0e, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x02, - 0x02, 0x04, 0x08, 0x09, 0x87, 0x05, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, 0xc7, 0x22, 0x00, 0x00, - 0x67, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, - 0x41, 0x02, 0x42, 0x03, 0x01, 0x31, 0x53, 0x6a, 0x00, 0x21, 0x04, 0x28, 0x03, 0x11, 0x34, 0x37, - 0x04, 0x1d, 0x05, 0x14, 0xd5, 0x04, 0x04, 0x37, 0x04, 0x35, 0x00, 0x1d, 0x08, 0x37, 0x04, 0x28, - 0x00, 0x1c, 0xc9, 0x04, 0x37, 0x04, 0x35, 0x00, 0xcb, 0x02, 0x3b, 0x02, 0x05, 0x28, 0x03, 0xc0, - 0x6d, 0x06, 0x11, 0x0c, 0x3b, 0x02, 0x07, 0x28, 0x03, 0xbf, 0x28, 0x08, 0x01, 0x04, 0x31, 0x53, - 0x45, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x29, 0x00, 0x07, 0x00, - 0x00, 0x02, 0x04, 0x04, 0x87, 0x05, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, 0xc7, 0x13, 0x00, 0x00, - 0x67, 0x23, 0x00, 0x00, 0x3b, 0x00, 0x02, 0x3b, 0x00, 0x03, 0x28, 0x01, 0xc0, 0x32, 0x00, 0xc5, - 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x29, 0x00, 0x04, 0x01, - 0x01, 0x01, 0x03, 0x04, 0xc7, 0x22, 0x00, 0x00, 0x87, 0x1e, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, - 0x31, 0x53, 0x6a, 0x00, 0x21, 0x15, 0x37, 0x01, 0x21, 0x11, 0x37, 0x01, 0x35, 0x00, 0x21, 0x0b, - 0x37, 0x01, 0x35, 0x00, 0x3a, 0x02, 0x28, 0x03, 0xc0, 0x04, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x00, 0x29, 0x00, 0x03, 0x01, 0x01, 0x01, 0x02, 0x02, 0x47, 0x0a, 0x00, 0x00, - 0x3b, 0x00, 0x01, 0xba, 0x45, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x29, 0x00, 0x02, 0x02, - 0x02, 0x02, 0x04, 0x04, 0x07, 0x24, 0x00, 0x00, 0xa7, 0x24, 0x00, 0x00, 0x28, 0x00, 0xd4, 0x02, - 0x28, 0x01, 0xd4, 0x03, 0x46, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x29, 0x00, 0x04, 0x00, - 0x00, 0x00, 0x03, 0x03, 0x07, 0x24, 0x00, 0x00, 0x67, 0x0d, 0x00, 0x00, 0xa7, 0x24, 0x00, 0x00, - 0x37, 0x00, 0x21, 0x09, 0x37, 0x00, 0x3a, 0x01, 0x37, 0x02, 0xc0, 0x04, 0x46, 0x00, 0x00, 0x00, - 0x03, 0x00, 0x01, 0x00, 0x29, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x07, 0x06, 0x00, 0x00, - 0x36, 0x01, 0x00, 0x45, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x09, 0x00, 0x05, 0x01, - 0x01, 0x05, 0x0c, 0x0d, 0x47, 0x05, 0x00, 0x00, 0x07, 0x05, 0x00, 0x00, 0xc7, 0x06, 0x00, 0x00, - 0x07, 0x07, 0x00, 0x00, 0x07, 0x25, 0x00, 0x00, 0x67, 0x25, 0x00, 0x00, 0x27, 0x09, 0x00, 0x00, - 0x87, 0x26, 0x00, 0x00, 0x67, 0x20, 0x00, 0x00, 0x87, 0x15, 0x00, 0x00, 0x87, 0x1e, 0x00, 0x00, - 0x70, 0x00, 0x00, 0x00, 0x41, 0x01, 0x42, 0x02, 0x00, 0x2a, 0x03, 0x7b, 0x4f, 0x11, 0x07, 0x29, - 0x03, 0x02, 0x3f, 0x45, 0x30, 0xd5, 0x05, 0xcb, 0x01, 0x29, 0x06, 0x04, 0x35, 0x07, 0x35, 0x08, - 0x3a, 0x09, 0x28, 0x02, 0xc0, 0x66, 0x21, 0x0d, 0x3b, 0x04, 0x0a, 0x28, 0x02, 0xc0, 0x3a, 0x0b, - 0x28, 0x0c, 0xc0, 0x04, 0x46, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x29, 0x00, 0x06, 0x01, - 0x02, 0x05, 0x0b, 0x0c, 0x07, 0x05, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, 0x27, 0x27, 0x00, 0x00, - 0x27, 0x28, 0x00, 0x00, 0xa7, 0x28, 0x00, 0x00, 0x47, 0x29, 0x00, 0x00, 0xa7, 0x29, 0x00, 0x00, - 0x47, 0x03, 0x00, 0x00, 0x67, 0x2a, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x36, 0x02, 0x00, 0xd7, - 0x01, 0x68, 0x05, 0x00, 0x11, 0x09, 0x2b, 0x03, 0x06, 0x01, 0xc9, 0x01, 0x2a, 0x68, 0x07, 0x00, - 0x11, 0x09, 0x2b, 0x0b, 0x03, 0x01, 0xc3, 0x01, 0x1e, 0x68, 0x08, 0x00, 0x11, 0x08, 0x29, 0x04, - 0x01, 0xbd, 0x01, 0x13, 0x28, 0x09, 0x56, 0x01, 0x60, 0x21, 0x0c, 0x2b, 0x03, 0x00, 0x01, 0x3a, - 0x0a, 0x28, 0x03, 0xc0, 0xc9, 0x04, 0x46, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x09, 0x00, 0x05, 0x02, - 0x02, 0x06, 0x0b, 0x0c, 0x07, 0x05, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, - 0x87, 0x06, 0x00, 0x00, 0x47, 0x03, 0x00, 0x00, 0x67, 0x20, 0x00, 0x00, 0x87, 0x15, 0x00, 0x00, - 0x87, 0x1e, 0x00, 0x00, 0x67, 0x0c, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x42, 0x02, 0x00, 0x42, - 0x03, 0x01, 0x28, 0x06, 0x56, 0x03, 0x60, 0x21, 0x0b, 0x3b, 0x03, 0x07, 0x29, 0x02, 0x02, 0xc6, - 0xcc, 0x03, 0x04, 0x3b, 0x04, 0x08, 0x28, 0x03, 0xc0, 0x3a, 0x09, 0x28, 0x0b, 0xbf, 0x3b, 0x05, - 0x0a, 0x28, 0x03, 0xbf, 0x46, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x29, 0x00, 0x04, 0x01, + 0x98, 0x01, 0x00, 0x00, 0xd8, 0x01, 0x00, 0x00, 0x50, 0x04, 0x00, 0x00, 0x68, 0x06, 0x00, 0x00, + 0x88, 0x06, 0x00, 0x00, 0xa8, 0x06, 0x00, 0x00, 0xd0, 0x06, 0x00, 0x00, 0xf0, 0x06, 0x00, 0x00, + 0x20, 0x07, 0x00, 0x00, 0x60, 0x07, 0x00, 0x00, 0xb8, 0x07, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x00, + 0x28, 0x08, 0x00, 0x00, 0x60, 0x08, 0x00, 0x00, 0x78, 0x08, 0x00, 0x00, 0x18, 0x09, 0x00, 0x00, + 0x68, 0x09, 0x00, 0x00, 0x88, 0x09, 0x00, 0x00, 0xb0, 0x09, 0x00, 0x00, 0xc8, 0x09, 0x00, 0x00, + 0x46, 0x00, 0x46, 0x01, 0x46, 0x02, 0x4d, 0x27, 0x03, 0x4d, 0x28, 0x04, 0x46, 0x05, 0x46, 0x06, + 0x4d, 0x29, 0x07, 0x14, 0x1c, 0x18, 0x09, 0x55, 0x2a, 0x0a, 0x55, 0x2b, 0x0b, 0x55, 0x2c, 0x0c, + 0xdc, 0x00, 0x2c, 0x2d, 0xdc, 0x01, 0x2c, 0x2e, 0xdc, 0x02, 0x39, 0x03, 0x0d, 0x2c, 0x2f, 0xe2, + 0x0e, 0x39, 0x03, 0x0d, 0x2c, 0x30, 0xe2, 0x0f, 0x39, 0x03, 0x0d, 0x2c, 0x31, 0xe2, 0x10, 0x39, + 0x03, 0x0d, 0x2c, 0x32, 0xe2, 0x11, 0x2f, 0x04, 0x12, 0x33, 0xd9, 0x2f, 0x04, 0x13, 0x34, 0xd9, + 0x39, 0x04, 0x0d, 0x2c, 0x35, 0xe2, 0x14, 0x39, 0x04, 0x0d, 0x2c, 0x36, 0xe2, 0x15, 0x39, 0x04, + 0x0d, 0x2c, 0x37, 0xe2, 0x16, 0x39, 0x04, 0x0d, 0x2c, 0x38, 0xe2, 0x17, 0x14, 0x55, 0x0a, 0x18, + 0x55, 0x0b, 0x19, 0x55, 0x1b, 0x1a, 0x55, 0x1d, 0x1c, 0x55, 0x1f, 0x1e, 0x55, 0x21, 0x20, 0x55, + 0x23, 0x22, 0xdc, 0x06, 0x3e, 0x08, 0x24, 0x2c, 0x06, 0xd1, 0x3d, 0x25, 0x2c, 0x39, 0xd1, 0xdc, + 0x05, 0x39, 0x07, 0x0d, 0x2c, 0x3a, 0xe2, 0x26, 0x54, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x49, 0x00, 0x03, 0x04, 0x04, 0x04, 0x0a, 0x0a, 0xc7, 0x16, 0x00, 0x00, + 0x27, 0x17, 0x00, 0x00, 0xc7, 0x17, 0x00, 0x00, 0x27, 0x18, 0x00, 0x00, 0xa7, 0x18, 0x00, 0x00, + 0xe7, 0x09, 0x00, 0x00, 0x2c, 0x00, 0xe5, 0x04, 0x2c, 0x01, 0xe5, 0x05, 0x2c, 0x02, 0xe5, 0x06, + 0x2c, 0x03, 0xe5, 0x07, 0x3f, 0x09, 0xcb, 0xe5, 0x08, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x01, 0x01, 0x05, 0x0a, 0x0c, 0x47, 0x05, 0x00, 0x00, + 0x87, 0x05, 0x00, 0x00, 0x67, 0x19, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0xe7, 0x19, 0x00, 0x00, + 0xa7, 0x1a, 0x00, 0x00, 0x27, 0x1b, 0x00, 0x00, 0x87, 0x15, 0x00, 0x00, 0xc7, 0x1b, 0x00, 0x00, + 0x60, 0x00, 0x00, 0x00, 0x70, 0x01, 0x00, 0x00, 0x4d, 0x00, 0x01, 0x34, 0x5d, 0xe5, 0x05, 0x2f, + 0x02, 0x01, 0x06, 0x33, 0xc1, 0x03, 0x3e, 0x03, 0x07, 0x2c, 0x01, 0xd1, 0x21, 0x06, 0x2d, 0x0a, + 0x01, 0xce, 0x04, 0x3e, 0x04, 0x08, 0x2c, 0x01, 0xd1, 0x3d, 0x09, 0x2c, 0x0b, 0xd0, 0x53, 0x00, + 0x05, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x01, 0x01, 0x03, 0x04, 0x05, 0x07, 0x05, 0x00, 0x00, + 0x47, 0x06, 0x00, 0x00, 0xc7, 0x1b, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x01, 0x3e, + 0x02, 0x03, 0x2c, 0x04, 0xd0, 0x53, 0x00, 0x00, 0x07, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x01, + 0x01, 0x05, 0x05, 0x06, 0x47, 0x05, 0x00, 0x00, 0xc7, 0x05, 0x00, 0x00, 0x07, 0x05, 0x00, 0x00, + 0x87, 0x05, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x01, 0x46, 0x02, 0x39, 0x03, 0x01, + 0xdc, 0x02, 0x2f, 0x04, 0x03, 0x01, 0x2c, 0x05, 0xc1, 0x03, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x16, 0x00, 0x01, 0x00, 0x29, 0x00, 0x05, 0x00, 0x03, 0x0a, 0x16, 0x16, 0x67, 0x1c, 0x00, 0x00, + 0x67, 0x19, 0x00, 0x00, 0xc7, 0x05, 0x00, 0x00, 0x87, 0x06, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, + 0x07, 0x06, 0x00, 0x00, 0x07, 0x05, 0x00, 0x00, 0x27, 0x09, 0x00, 0x00, 0x27, 0x1d, 0x00, 0x00, + 0xa7, 0x1d, 0x00, 0x00, 0x07, 0x1e, 0x00, 0x00, 0x87, 0x0f, 0x00, 0x00, 0x47, 0x10, 0x00, 0x00, + 0x47, 0x13, 0x00, 0x00, 0x87, 0x1e, 0x00, 0x00, 0xc7, 0x1b, 0x00, 0x00, 0x67, 0x0c, 0x00, 0x00, + 0xa7, 0x1a, 0x00, 0x00, 0xa7, 0x0e, 0x00, 0x00, 0x39, 0x04, 0x0a, 0x38, 0x0b, 0x3d, 0x0c, 0x2c, + 0x03, 0xd1, 0xe8, 0x01, 0x3e, 0x05, 0x0d, 0x2e, 0x01, 0xd6, 0x39, 0x06, 0x0e, 0x75, 0x07, 0x1d, + 0x07, 0x39, 0x06, 0x0f, 0x75, 0x07, 0x11, 0x07, 0xe0, 0x01, 0x00, 0x01, 0x11, 0x39, 0x06, 0x10, + 0x75, 0x07, 0x21, 0x0a, 0x3e, 0x01, 0x0b, 0x35, 0x01, 0xd1, 0xdd, 0x00, 0x04, 0x2c, 0x00, 0x21, + 0x0e, 0x39, 0x00, 0x11, 0x21, 0x09, 0x3e, 0x00, 0x12, 0x39, 0x08, 0x13, 0xd1, 0x04, 0x39, 0x09, + 0x14, 0xe8, 0x02, 0x2c, 0x02, 0x21, 0x06, 0x3e, 0x02, 0x15, 0xcb, 0x04, 0x53, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x01, 0x00, 0x49, 0x00, 0x04, 0x01, 0x01, 0x02, 0x02, 0x03, 0x47, 0x05, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x2f, 0x02, 0x01, 0x00, 0x39, 0x01, 0x00, 0xc2, 0x03, 0x52, 0x00, 0x00, + 0x0c, 0x00, 0x01, 0x00, 0x09, 0x00, 0x07, 0x03, 0x03, 0x07, 0x0c, 0x0e, 0x87, 0x05, 0x00, 0x00, + 0xc7, 0x05, 0x00, 0x00, 0x87, 0x06, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0xa7, 0x1a, 0x00, 0x00, + 0x07, 0x1f, 0x00, 0x00, 0x07, 0x20, 0x00, 0x00, 0xc7, 0x20, 0x00, 0x00, 0x27, 0x21, 0x00, 0x00, + 0x60, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x4d, 0x01, 0x03, 0x4d, 0x02, 0x04, 0x46, 0x05, + 0x39, 0x00, 0x07, 0xdc, 0x05, 0x3e, 0x06, 0x08, 0x2d, 0x00, 0x03, 0x14, 0x34, 0x5d, 0x18, 0x09, + 0x55, 0x0c, 0x0a, 0x55, 0x0d, 0x0b, 0xc4, 0x03, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0c, 0x00, 0x01, 0x00, 0x49, 0x00, 0x05, 0x00, 0x02, 0x07, 0x0c, 0x0c, 0x07, 0x05, 0x00, 0x00, + 0x87, 0x06, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, 0x07, 0x06, 0x00, 0x00, 0xc7, 0x05, 0x00, 0x00, + 0xc7, 0x08, 0x00, 0x00, 0xc7, 0x0a, 0x00, 0x00, 0x67, 0x0c, 0x00, 0x00, 0xa7, 0x0c, 0x00, 0x00, + 0xe7, 0x0d, 0x00, 0x00, 0x3e, 0x02, 0x07, 0xcb, 0xe8, 0x00, 0x2c, 0x00, 0x21, 0x09, 0x3e, 0x00, + 0x08, 0x2d, 0x03, 0x04, 0xd7, 0x04, 0x3e, 0x05, 0x09, 0x2c, 0x06, 0xd1, 0xe8, 0x01, 0x3e, 0x05, + 0x0a, 0x2c, 0x01, 0xd1, 0x21, 0x09, 0x3e, 0x01, 0x0b, 0x2d, 0x03, 0x04, 0xd7, 0x04, 0x54, 0x06, + 0x05, 0x00, 0x01, 0x00, 0x49, 0x00, 0x04, 0x01, 0x01, 0x04, 0x05, 0x05, 0xc7, 0x05, 0x00, 0x00, + 0x87, 0x06, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, 0x67, 0x0d, 0x00, 0x00, 0xdf, 0x00, 0x01, 0x3e, + 0x02, 0x04, 0x2c, 0x03, 0xd0, 0x53, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x09, 0x00, 0x05, 0x01, + 0x01, 0x05, 0x0c, 0x0d, 0x07, 0x05, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, 0xc7, 0x06, 0x00, 0x00, + 0x07, 0x07, 0x00, 0x00, 0x87, 0x21, 0x00, 0x00, 0xe7, 0x21, 0x00, 0x00, 0x27, 0x09, 0x00, 0x00, + 0x07, 0x23, 0x00, 0x00, 0xa7, 0x1d, 0x00, 0x00, 0x87, 0x15, 0x00, 0x00, 0xc7, 0x1b, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x01, 0x46, 0x02, 0x2e, 0x03, 0x89, 0x5d, 0x11, 0x07, 0x2d, + 0x03, 0x01, 0x42, 0x52, 0x33, 0xe6, 0x05, 0xdc, 0x02, 0x2d, 0x06, 0x04, 0x38, 0x07, 0x38, 0x08, + 0x3d, 0x09, 0x2c, 0x01, 0xd1, 0x74, 0x21, 0x0d, 0x3e, 0x04, 0x0a, 0x2c, 0x01, 0xd1, 0x3d, 0x0b, + 0x2c, 0x0c, 0xd1, 0x04, 0x53, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x49, 0x00, 0x06, 0x01, + 0x02, 0x05, 0x0b, 0x0c, 0x07, 0x05, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, 0xa7, 0x23, 0x00, 0x00, + 0xa7, 0x24, 0x00, 0x00, 0x27, 0x25, 0x00, 0x00, 0xc7, 0x25, 0x00, 0x00, 0x27, 0x26, 0x00, 0x00, + 0x47, 0x03, 0x00, 0x00, 0xe7, 0x26, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x39, 0x02, 0x00, 0xe8, + 0x01, 0x76, 0x05, 0x00, 0x11, 0x09, 0x2f, 0x03, 0x06, 0x01, 0xda, 0x01, 0x2a, 0x76, 0x07, 0x00, + 0x11, 0x09, 0x2f, 0x0b, 0x03, 0x01, 0xd4, 0x01, 0x1e, 0x76, 0x08, 0x00, 0x11, 0x08, 0x2d, 0x04, + 0x01, 0xce, 0x01, 0x13, 0x2c, 0x09, 0x64, 0x01, 0x6e, 0x21, 0x0c, 0x2f, 0x03, 0x00, 0x01, 0x3d, + 0x0a, 0x2c, 0x03, 0xd1, 0xda, 0x04, 0x53, 0x00, 0x10, 0x00, 0x01, 0x00, 0x09, 0x00, 0x05, 0x02, + 0x02, 0x07, 0x0e, 0x0f, 0x07, 0x05, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, 0x47, 0x27, 0x00, 0x00, + 0x07, 0x07, 0x00, 0x00, 0x07, 0x06, 0x00, 0x00, 0x47, 0x03, 0x00, 0x00, 0xa7, 0x1d, 0x00, 0x00, + 0x87, 0x02, 0x00, 0x00, 0xc7, 0x25, 0x00, 0x00, 0x87, 0x15, 0x00, 0x00, 0xc7, 0x1b, 0x00, 0x00, + 0x67, 0x0c, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x02, 0x4d, 0x01, 0x03, 0x2c, 0x07, + 0x64, 0x03, 0x6e, 0x21, 0x0b, 0x3e, 0x03, 0x08, 0x2d, 0x02, 0x02, 0xd7, 0xdd, 0x03, 0x04, 0x2c, + 0x09, 0x64, 0x04, 0x71, 0x21, 0x04, 0x2c, 0x04, 0x11, 0x09, 0x2f, 0x02, 0x0a, 0x03, 0xda, 0x61, + 0x52, 0x3e, 0x05, 0x0b, 0x2c, 0x03, 0xd1, 0x3d, 0x0c, 0x2c, 0x0e, 0xd0, 0x3e, 0x06, 0x0d, 0x2c, + 0x03, 0xd0, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x01, 0x00, 0x49, 0x00, 0x04, 0x01, 0x01, 0x03, 0x03, 0x04, 0x07, 0x05, 0x00, 0x00, 0x47, 0x05, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, - 0x2b, 0x03, 0x01, 0x02, 0x28, 0x00, 0xb1, 0x03, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x2f, 0x03, 0x01, 0x02, 0x2c, 0x00, 0xc2, 0x03, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x01, 0x00, 0x09, 0x00, 0x07, 0x03, 0x03, 0x06, 0x0b, 0x0d, 0x47, 0x05, 0x00, 0x00, - 0x87, 0x05, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x47, 0x17, 0x00, 0x00, 0x47, 0x18, 0x00, 0x00, - 0xc7, 0x2a, 0x00, 0x00, 0x47, 0x21, 0x00, 0x00, 0xa7, 0x21, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, - 0x70, 0x00, 0x00, 0x00, 0x42, 0x03, 0x01, 0x42, 0x04, 0x02, 0x3b, 0x05, 0x06, 0x29, 0x00, 0x04, - 0x14, 0x32, 0x00, 0x4f, 0x18, 0x07, 0x31, 0x4f, 0x18, 0x08, 0x48, 0x0b, 0x09, 0x48, 0x0c, 0x0a, - 0xb3, 0x03, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x29, 0x00, 0x01, 0x00, - 0x00, 0x02, 0x02, 0x02, 0x47, 0x05, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, 0x36, 0x00, 0x01, 0x45, - 0x04, 0x00, 0x01, 0x00, 0x29, 0x00, 0x03, 0x01, 0x01, 0x03, 0x03, 0x03, 0x47, 0x05, 0x00, 0x00, - 0x87, 0x05, 0x00, 0x00, 0x2b, 0x01, 0x02, 0x00, 0xc8, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x01, 0x00, 0x29, 0x00, 0x05, 0x03, 0x03, 0x04, 0x04, 0x04, 0x47, 0x06, 0x00, 0x00, - 0x28, 0x03, 0x2a, 0x00, 0x29, 0x01, 0x02, 0x3d, 0x04, 0x45, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x87, 0x05, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x07, 0x1f, 0x00, 0x00, 0x07, 0x20, 0x00, 0x00, + 0x27, 0x28, 0x00, 0x00, 0xc7, 0x20, 0x00, 0x00, 0x27, 0x21, 0x00, 0x00, 0x58, 0x00, 0x00, 0x00, + 0x70, 0x00, 0x00, 0x00, 0x4d, 0x01, 0x03, 0x4d, 0x02, 0x04, 0x3e, 0x05, 0x06, 0x2d, 0x00, 0x04, + 0x14, 0x35, 0x00, 0x5d, 0x18, 0x07, 0x34, 0x5d, 0x18, 0x08, 0x55, 0x0b, 0x09, 0x55, 0x0c, 0x0a, + 0xc4, 0x03, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x49, 0x00, 0x01, 0x00, + 0x00, 0x02, 0x02, 0x02, 0x47, 0x05, 0x00, 0x00, 0x87, 0x05, 0x00, 0x00, 0x39, 0x00, 0x01, 0x52, + 0x04, 0x00, 0x01, 0x00, 0x49, 0x00, 0x03, 0x01, 0x01, 0x03, 0x03, 0x03, 0x47, 0x05, 0x00, 0x00, + 0x87, 0x05, 0x00, 0x00, 0x2f, 0x01, 0x02, 0x00, 0xd9, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x01, 0x00, 0x49, 0x00, 0x04, 0x01, 0x01, 0x01, 0x03, 0x03, 0x87, 0x07, 0x00, 0x00, + 0x07, 0x08, 0x00, 0x00, 0x3a, 0x01, 0x3d, 0x02, 0x2c, 0x00, 0xd0, 0x53, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x01, 0x00, 0x49, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x02, 0x87, 0x07, 0x00, 0x00, + 0x67, 0x08, 0x00, 0x00, 0x3a, 0x00, 0x3d, 0x01, 0xcb, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x01, 0x00, 0x49, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x03, 0x87, 0x07, 0x00, 0x00, + 0x87, 0x1e, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x3a, 0x00, 0x38, 0x01, 0x99, 0x02, + 0x37, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x01, 0x00, 0x49, 0x00, 0x02, 0x01, + 0x01, 0x01, 0x02, 0x02, 0x07, 0x02, 0x00, 0x00, 0x2c, 0x01, 0x64, 0x00, 0x6e, 0x21, 0x05, 0x28, + 0x78, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x49, 0x00, 0x07, 0x03, + 0x03, 0x04, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x07, 0x1f, 0x00, 0x00, 0x07, 0x20, 0x00, 0x00, + 0x07, 0x29, 0x00, 0x00, 0x3e, 0x03, 0x04, 0x2d, 0x00, 0x01, 0x14, 0x35, 0x00, 0x5d, 0x18, 0x05, + 0x55, 0x02, 0x06, 0xc4, 0x03, 0x53, 0x00, 0x00, 0x08, 0x00, 0x01, 0x00, 0x49, 0x00, 0x06, 0x00, + 0x00, 0x01, 0x06, 0x06, 0x07, 0x05, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x27, 0x17, 0x00, 0x00, + 0xa7, 0x1d, 0x00, 0x00, 0xc7, 0x16, 0x00, 0x00, 0x67, 0x08, 0x00, 0x00, 0x00, 0x15, 0x10, 0x3e, + 0x00, 0x01, 0x33, 0xd0, 0x3a, 0x02, 0x3d, 0x03, 0x3a, 0x04, 0xd1, 0x52, 0x00, 0x1d, 0x08, 0x3e, + 0x00, 0x05, 0xca, 0x10, 0x53, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x01, 0x00, 0x49, 0x00, 0x07, 0x00, + 0x04, 0x05, 0x0b, 0x0b, 0x47, 0x05, 0x00, 0x00, 0xa7, 0x18, 0x00, 0x00, 0xe7, 0x09, 0x00, 0x00, + 0xc7, 0x16, 0x00, 0x00, 0x27, 0x18, 0x00, 0x00, 0xc7, 0x17, 0x00, 0x00, 0xa7, 0x1d, 0x00, 0x00, + 0x3a, 0x05, 0xe8, 0x00, 0x3f, 0x06, 0xcb, 0xe8, 0x01, 0x3a, 0x07, 0xe8, 0x02, 0x3a, 0x08, 0xe8, + 0x03, 0x79, 0x01, 0x00, 0x1d, 0x06, 0x2d, 0x04, 0x01, 0xce, 0x21, 0x12, 0x3a, 0x09, 0x3d, 0x0a, + 0x2f, 0x02, 0x01, 0x00, 0x2c, 0x03, 0xc4, 0x04, 0x2c, 0x01, 0xe6, 0x05, 0x04, 0x53, 0x00, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x49, 0x00, 0x05, 0x02, 0x03, 0x03, 0x07, 0x07, 0xe7, 0x0c, 0x00, 0x00, + 0x47, 0x03, 0x00, 0x00, 0x87, 0x29, 0x00, 0x00, 0x07, 0x08, 0x00, 0x00, 0x3e, 0x00, 0x03, 0x2c, + 0x01, 0x33, 0xd7, 0xe8, 0x02, 0x2c, 0x04, 0x64, 0x02, 0x6e, 0x21, 0x11, 0x3a, 0x05, 0x1d, 0x05, + 0x1c, 0xe6, 0x05, 0x04, 0x3a, 0x05, 0x3d, 0x06, 0x2c, 0x02, 0xd1, 0x04, 0x53, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x01, 0x00, 0x49, 0x00, 0x03, 0x00, 0x01, 0x01, 0x04, 0x04, 0x87, 0x29, 0x00, 0x00, + 0x67, 0x08, 0x00, 0x00, 0x87, 0x1e, 0x00, 0x00, 0x3a, 0x01, 0xe8, 0x00, 0x2c, 0x00, 0x11, 0x0e, + 0x01, 0x07, 0x3e, 0x00, 0x02, 0xcb, 0xc7, 0x39, 0x00, 0x03, 0x0d, 0x08, 0x53, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x01, 0x00, 0x49, 0x00, 0x02, 0x01, 0x01, 0x03, 0x04, 0x04, 0x47, 0x05, 0x00, 0x00, + 0x07, 0x06, 0x00, 0x00, 0xa7, 0x1a, 0x00, 0x00, 0x2c, 0x00, 0x21, 0x06, 0x2d, 0x01, 0x00, 0xce, + 0x11, 0x12, 0x39, 0x00, 0x03, 0x11, 0x07, 0x39, 0x00, 0x03, 0x01, 0x06, 0x2d, 0x02, 0x00, 0x42, + 0x01, 0x04, 0x2c, 0x00, 0x52, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x49, 0x00, 0x01, 0x01, + 0x01, 0x01, 0x02, 0x02, 0xe7, 0x19, 0x00, 0x00, 0x2c, 0x00, 0x21, 0x05, 0x39, 0x00, 0x01, 0x52, + 0x0e, 0x00, 0x01, 0x00, 0x09, 0x00, 0x04, 0x02, 0x02, 0x04, 0x08, 0x09, 0x47, 0x05, 0x00, 0x00, + 0x87, 0x05, 0x00, 0x00, 0x47, 0x2a, 0x00, 0x00, 0xe7, 0x2a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x08, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x4d, 0x01, 0x02, 0x46, 0x03, 0x34, 0x61, 0x78, + 0x00, 0x21, 0x04, 0x2c, 0x02, 0x11, 0x34, 0x3a, 0x04, 0x1d, 0x05, 0x14, 0xe6, 0x04, 0x04, 0x3a, + 0x04, 0x38, 0x00, 0x1d, 0x08, 0x3a, 0x04, 0x2c, 0x00, 0x1c, 0xda, 0x04, 0x3a, 0x04, 0x38, 0x00, + 0xdc, 0x03, 0x3e, 0x03, 0x05, 0x2c, 0x02, 0xd1, 0x7b, 0x06, 0x11, 0x0c, 0x3e, 0x03, 0x07, 0x2c, + 0x02, 0xd0, 0x2c, 0x08, 0x01, 0x04, 0x34, 0x61, 0x52, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x00, 0x01, 0x00, 0x49, 0x00, 0x07, 0x00, 0x00, 0x02, 0x04, 0x04, 0x87, 0x05, 0x00, 0x00, + 0x47, 0x05, 0x00, 0x00, 0xc7, 0x13, 0x00, 0x00, 0xe7, 0x2a, 0x00, 0x00, 0x3e, 0x00, 0x02, 0x3e, + 0x00, 0x03, 0x2c, 0x01, 0xd1, 0x35, 0x00, 0xd6, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x01, 0x00, 0x49, 0x00, 0x04, 0x01, 0x01, 0x01, 0x03, 0x04, 0x47, 0x2a, 0x00, 0x00, + 0xc7, 0x1b, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x34, 0x61, 0x78, 0x00, 0x21, 0x15, 0x3a, 0x01, + 0x21, 0x11, 0x3a, 0x01, 0x38, 0x00, 0x21, 0x0b, 0x3a, 0x01, 0x38, 0x00, 0x3d, 0x02, 0x2c, 0x03, + 0xd1, 0x04, 0x53, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x49, 0x00, 0x03, 0x01, + 0x01, 0x01, 0x02, 0x02, 0x47, 0x0a, 0x00, 0x00, 0x3e, 0x00, 0x01, 0xcb, 0x52, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x01, 0x00, 0x49, 0x00, 0x02, 0x02, 0x02, 0x02, 0x04, 0x04, 0x87, 0x2b, 0x00, 0x00, + 0x27, 0x2c, 0x00, 0x00, 0x2c, 0x00, 0xe5, 0x02, 0x2c, 0x01, 0xe5, 0x03, 0x53, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x01, 0x00, 0x49, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x03, 0x87, 0x2b, 0x00, 0x00, + 0x67, 0x0d, 0x00, 0x00, 0x27, 0x2c, 0x00, 0x00, 0x3a, 0x00, 0x21, 0x09, 0x3a, 0x00, 0x3d, 0x01, + 0x3a, 0x02, 0xd1, 0x04, 0x53, 0x00, 0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x49, 0x00, 0x01, 0x01, + 0x01, 0x02, 0x02, 0x02, 0x87, 0x06, 0x00, 0x00, 0x39, 0x01, 0x00, 0x52, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x01, 0x00, 0x49, 0x00, 0x05, 0x03, 0x03, 0x04, 0x04, 0x04, 0xc7, 0x05, 0x00, 0x00, + 0x2c, 0x03, 0x2e, 0x00, 0x2d, 0x01, 0x02, 0x40, 0x04, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x73, 0x00, 0x06, 0x00, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x06, 0x00, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x04, 0x00, 0x73, 0x65, 0x6c, 0x66, 0x06, 0x00, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x09, 0x00, 0x75, 0x6e, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x64, 0x00, 0x08, 0x00, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x03, 0x00, 0x61, 0x6d, 0x64, 0x00, 0x09, 0x00, 0x56, 0x69, 0x65, 0x77, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x00, - 0x01, 0x00, 0x74, 0x00, 0x01, 0x00, 0x65, 0x00, 0x01, 0x00, 0x6e, 0x00, 0x01, 0x00, 0x73, 0x00, - 0x01, 0x00, 0x72, 0x00, 0x01, 0x00, 0x69, 0x00, 0x01, 0x00, 0x6f, 0x00, 0x01, 0x00, 0x63, 0x00, + 0x01, 0x00, 0x74, 0x00, 0x01, 0x00, 0x65, 0x00, 0x01, 0x00, 0x6e, 0x00, 0x01, 0x00, 0x69, 0x00, + 0x01, 0x00, 0x6f, 0x00, 0x01, 0x00, 0x73, 0x00, 0x01, 0x00, 0x72, 0x00, 0x01, 0x00, 0x63, 0x00, 0x06, 0x00, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x05, 0x00, 0x73, 0x74, 0x61, 0x63, 0x6b, 0x00, 0x04, 0x00, 0x70, 0x75, 0x73, 0x68, 0x03, 0x00, 0x70, 0x6f, 0x70, 0x00, 0x03, 0x00, 0x74, 0x6f, 0x70, 0x00, 0x09, 0x00, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x74, 0x79, 0x70, 0x65, 0x00, 0x04, 0x00, @@ -214,27 +218,29 @@ const uint8_t g_frameworkBCBuffer[] = 0x73, 0x6f, 0x72, 0x74, 0x06, 0x00, 0x53, 0x50, 0x4c, 0x49, 0x43, 0x45, 0x06, 0x00, 0x73, 0x70, 0x6c, 0x69, 0x63, 0x65, 0x07, 0x00, 0x52, 0x45, 0x56, 0x45, 0x52, 0x53, 0x45, 0x00, 0x07, 0x00, 0x72, 0x65, 0x76, 0x65, 0x72, 0x73, 0x65, 0x00, 0x04, 0x00, 0x6b, 0x65, 0x79, 0x73, 0x03, 0x00, - 0x6d, 0x61, 0x70, 0x00, 0x06, 0x00, 0x24, 0x77, 0x61, 0x74, 0x63, 0x68, 0x06, 0x00, 0x6c, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x0e, 0x00, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x79, 0x0a, 0x00, 0x65, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x62, 0x6c, 0x65, - 0x05, 0x00, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x00, 0x04, 0x00, 0x5f, 0x63, 0x74, 0x78, 0x07, 0x00, - 0x5f, 0x67, 0x65, 0x74, 0x74, 0x65, 0x72, 0x00, 0x03, 0x00, 0x5f, 0x66, 0x6e, 0x00, 0x05, 0x00, - 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x00, 0x0a, 0x00, 0x5f, 0x6c, 0x61, 0x73, 0x74, 0x56, 0x61, 0x6c, - 0x75, 0x65, 0x05, 0x00, 0x41, 0x72, 0x72, 0x61, 0x79, 0x00, 0x0a, 0x00, 0x5f, 0x68, 0x69, 0x6a, - 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x06, 0x00, 0x5f, 0x5f, 0x6f, 0x62, 0x5f, 0x5f, 0x07, 0x00, - 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x00, 0x07, 0x00, 0x66, 0x6f, 0x72, 0x45, 0x61, 0x63, - 0x68, 0x00, 0x09, 0x00, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x00, 0x05, 0x00, - 0x73, 0x6c, 0x69, 0x63, 0x65, 0x00, 0x04, 0x00, 0x63, 0x61, 0x6c, 0x6c, 0x05, 0x00, 0x61, 0x70, - 0x70, 0x6c, 0x79, 0x00, 0x03, 0x00, 0x67, 0x65, 0x74, 0x00, 0x03, 0x00, 0x73, 0x65, 0x74, 0x00, - 0x09, 0x00, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x63, 0x68, 0x65, 0x73, 0x00, 0x07, 0x00, 0x5f, 0x6f, - 0x62, 0x73, 0x4d, 0x61, 0x70, 0x00, 0x07, 0x00, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x00, - 0x07, 0x00, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x00, 0x04, 0x00, 0x5f, 0x6b, 0x65, 0x79, - 0x03, 0x00, 0x5f, 0x76, 0x6d, 0x00, 0x0f, 0x00, 0x5b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, - 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5d, 0x00, 0x08, 0x00, 0x74, 0x6f, 0x53, 0x74, 0x72, 0x69, - 0x6e, 0x67, 0x0e, 0x00, 0x69, 0x6e, 0x69, 0x74, 0x53, 0x74, 0x79, 0x6c, 0x65, 0x53, 0x68, 0x65, - 0x65, 0x74, 0x06, 0x00, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x07, 0x00, 0x24, 0x72, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x00, 0x04, 0x00, 0x64, 0x61, 0x74, 0x61, 0x0a, 0x00, 0x73, 0x74, 0x79, 0x6c, - 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x04, 0x00, 0x62, 0x69, 0x6e, 0x64, 0x0c, 0x00, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65 + 0x6d, 0x61, 0x70, 0x00, 0x06, 0x00, 0x24, 0x77, 0x61, 0x74, 0x63, 0x68, 0x04, 0x00, 0x5f, 0x63, + 0x74, 0x78, 0x07, 0x00, 0x5f, 0x67, 0x65, 0x74, 0x74, 0x65, 0x72, 0x00, 0x03, 0x00, 0x5f, 0x66, + 0x6e, 0x00, 0x05, 0x00, 0x5f, 0x6d, 0x65, 0x74, 0x61, 0x00, 0x0a, 0x00, 0x5f, 0x6c, 0x61, 0x73, + 0x74, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x05, 0x00, 0x41, 0x72, 0x72, 0x61, 0x79, 0x00, 0x0a, 0x00, + 0x5f, 0x68, 0x69, 0x6a, 0x61, 0x63, 0x6b, 0x69, 0x6e, 0x67, 0x06, 0x00, 0x5f, 0x5f, 0x6f, 0x62, + 0x5f, 0x5f, 0x07, 0x00, 0x69, 0x73, 0x41, 0x72, 0x72, 0x61, 0x79, 0x00, 0x07, 0x00, 0x66, 0x6f, + 0x72, 0x45, 0x61, 0x63, 0x68, 0x00, 0x09, 0x00, 0x61, 0x72, 0x67, 0x75, 0x6d, 0x65, 0x6e, 0x74, + 0x73, 0x00, 0x05, 0x00, 0x73, 0x6c, 0x69, 0x63, 0x65, 0x00, 0x04, 0x00, 0x63, 0x61, 0x6c, 0x6c, + 0x05, 0x00, 0x61, 0x70, 0x70, 0x6c, 0x79, 0x00, 0x06, 0x00, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, + 0x0e, 0x00, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, + 0x0a, 0x00, 0x65, 0x6e, 0x75, 0x6d, 0x65, 0x72, 0x61, 0x62, 0x6c, 0x65, 0x03, 0x00, 0x67, 0x65, + 0x74, 0x00, 0x03, 0x00, 0x73, 0x65, 0x74, 0x00, 0x03, 0x00, 0x5f, 0x76, 0x6d, 0x00, 0x0f, 0x00, + 0x5b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x20, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x5d, 0x00, + 0x08, 0x00, 0x74, 0x6f, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x0e, 0x00, 0x69, 0x6e, 0x69, 0x74, + 0x53, 0x74, 0x79, 0x6c, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x06, 0x00, 0x72, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x07, 0x00, 0x24, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x00, 0x04, 0x00, 0x64, 0x61, + 0x74, 0x61, 0x0a, 0x00, 0x73, 0x74, 0x79, 0x6c, 0x65, 0x53, 0x68, 0x65, 0x65, 0x74, 0x04, 0x00, + 0x62, 0x69, 0x6e, 0x64, 0x0b, 0x00, 0x5f, 0x5f, 0x61, 0x70, 0x70, 0x56, 0x69, 0x6e, 0x67, 0x5f, + 0x5f, 0x00, 0x0c, 0x00, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x62, 0x6c, 0x65, + 0x05, 0x00, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x00, 0x09, 0x00, 0x5f, 0x64, 0x65, 0x74, 0x61, 0x63, + 0x68, 0x65, 0x73, 0x00, 0x07, 0x00, 0x5f, 0x6f, 0x62, 0x73, 0x4d, 0x61, 0x70, 0x00, 0x07, 0x00, + 0x69, 0x6e, 0x64, 0x65, 0x78, 0x4f, 0x66, 0x00, 0x07, 0x00, 0x5f, 0x70, 0x61, 0x72, 0x65, 0x6e, + 0x74, 0x00, 0x04, 0x00, 0x5f, 0x6b, 0x65, 0x79 }; #endif +#endif // OHOS_ACELITE_FRAMEWORK_MIN_BC_H diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/framework_min_js.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/framework_min_js.h index 4a5d10d8d..393093cbe 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/framework_min_js.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/framework_min_js.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 Huawei Device Co., Ltd. + * Copyright (c) 2020-2023 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,7 +13,11 @@ * limitations under the License. */ +#ifndef OHOS_ACELITE_FRAMEWORK_MIN_JS_H +#define OHOS_ACELITE_FRAMEWORK_MIN_JS_H + // AUTO GENERATED, PLEASE DO NOT EDIT DIRECTLY +#include #ifndef ACELITE_FRAMEWORK_RAW_BUFFER #error THIS FILE CAN ONLY BE INCLUDED BY RAW BUFFER CPP @@ -51,9 +55,11 @@ const char * const g_frameworkJSBuffer = "'},s=Object.keys(r).map((function(t){return r[t]}));function c(t){if(!(this instanceof c))" "return new c(t);var e=this._vm=this;'[object Object]'===Object.prototype.toString.call(t)&" "&Object.keys(t).forEach((function(n){var i=t[n];'render'===n?e.$render=i:'data'===n?functi" - "on(t,e){'function'==typeof e&&(e=e.call(t,t));Object.keys(e).forEach((function(n){return f" - "unction(t,e,n){Object.defineProperty(t,n,{enumerable:!1,configurable:!0,get:function(){ret" - "urn e[n]},set:function(t){e[n]=t}})}(t,e,n)})),o.of(e)}(e,i):'styleSheet'===n?initStyleShe" - "et(i):'function'==typeof i&&(e[n]=i.bind(e))}))}return c.prototype.$watch=function(t,e,n){" - "return new i(this,t,e,n)},c}));"; + "on(t,e){'function'==typeof e&&(e=e.call(t,t));if('undefined'!=typeof __appVing__&&__appVin" + "g__)return void(t.data=e);Object.keys(e).forEach((function(n){return function(t,e,n){Objec" + "t.defineProperty(t,n,{enumerable:!1,configurable:!0,get:function(){return e[n]},set:functi" + "on(t){e[n]=t}})}(t,e,n)})),o.of(e)}(e,i):'styleSheet'===n?initStyleSheet(i):'function'==ty" + "peof i&&(e[n]=i.bind(e))}))}return c.prototype.$watch=function(t,e,n){return new i(this,t," + "e,n)},c}));"; #endif +#endif // OHOS_ACELITE_FRAMEWORK_MIN_JS_H diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/keys.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/keys.h index aeffcf675..0e36c5915 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/keys.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/keys.h @@ -266,12 +266,14 @@ enum { #endif // FEATURE_COMPONENT_TABS KEYWORD(TEXT, text) // tag name, picker-view attr value KEYWORD(TEXT_ALIGN, textAlign) // text style type + KEYWORD(TEXT_ALIGN_VERTICAL, textAlignVertical) //text style vertical type KEYWORD(TEXT_OVERFLOW, textOverflow) // text style type KEYWORD(TIME, time) // picker-view attr value #ifdef FEATURE_COMPONENT_VIDEO KEYWORD(TIME_UPDATE, timeupdate) // video component timeupdate event tag #endif // FEATURE_COMPONENT_VIDEO KEYWORD(TOP, top) + KEYWORD(BOTTOM, bottom) KEYWORD(TOTAL_ANGLE, total-angle) // circle progress style #ifdef JS_TOUCH_EVENT_SUPPORT KEYWORD(TOUCHCANCEL, touchcancel) // ontouchcancel event @@ -290,6 +292,9 @@ enum { #ifdef FEATURE_COMPONENT_VIDEO KEYWORD(VIDEO, video) // video tag name #endif // FEATURE_COMPONENT_VIDEO +#ifdef FEATURE_COMPONENT_BAIDUMAP + KEYWORD(BAIDUMAP, baidumap) // baidumap tag name +#endif // FEATURE_COMPONENT_BAIDUMAP KEYWORD(WIDTH, width) // common attributes KEYWORD(WRAP, wrap) // flex wrap #ifdef FEATURE_DATE_FORMAT diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js/libace.a index 54e282d4e..76ea6a4db 100755 Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-native-js/libace.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-xts/libace.a b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-xts/libace.a index 86889f011..f294d808c 100755 Binary files a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-xts/libace.a and b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/brandy-xts/libace.a differ diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/baidu_map_component.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/baidu_map_component.cpp new file mode 100644 index 000000000..58a91159a --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/baidu_map_component.cpp @@ -0,0 +1,330 @@ +/* + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include "acelite_config.h" +#ifdef FEATURE_COMPONENT_BAIDUMAP +#include "baidu_map_component.h" +#include "ace_log.h" +#include "key_parser.h" +#include "keys.h" + +namespace OHOS { +namespace ACELite { +// API-method +const char * const BaiduMapComponent::FUNC_SET_ZOOM_EVENT_ENABLED = "set_zoom_event_enabled"; +const char * const BaiduMapComponent::FUNC_ZOOM_IN = "zoom_in"; +const char * const BaiduMapComponent::FUNC_ZOOM_OUT = "zoom_out"; +const char * const BaiduMapComponent::FUNC_ZOOM_TO = "zoom_to"; +const char * const BaiduMapComponent::FUNC_ZOOM_BY = "zoom_by"; +const char * const BaiduMapComponent::FUNC_SET_MAP_BACKGROUND_COLOR = "set_map_background_color"; +const char * const BaiduMapComponent::FUNC_SET_MAP_OVERLAYER_ENABLED = "set_map_overlayer_enabled"; +const char * const BaiduMapComponent::FUNC_SET_MAP_TITLES_ENABLED = "set_map_tiles_enabled"; +const char * const BaiduMapComponent::FUNC_SET_SCROLL_GESTURES_ENABLED = "set_scroll_gestures_enabled"; +const char * const BaiduMapComponent::FUNC_SCROLL_BY = "scroll_by"; +const char * const BaiduMapComponent::FUNC_NEW_LAT_LNG = "new_lat_lng"; +const char * const BaiduMapComponent::FUNC_NEW_LAT_LNG_ZOOM = "new_lat_lng_zoom"; +const char * const BaiduMapComponent::FUNC_CLEAR_MAP_OVERLAYER = "clear_map_overlayer"; +const char * const BaiduMapComponent::FUNC_DRAW_MARKER = "draw_marker"; +const char * const BaiduMapComponent::FUNC_DRAW_POLYGON = "draw_polygon"; +const char * const BaiduMapComponent::FUNC_DRAW_PATH = "draw_path"; +const char * const BaiduMapComponent::FUNC_DRAW_TEXT = "draw_text"; +const char * const BaiduMapComponent::FUNC_START_LISTEN_MY_GEO_LOCATION = "start_listen_my_geo_location"; +const char * const BaiduMapComponent::FUNC_STOP_LISTEN_MY_GEO_LOCATION = "stop_listen_my_geo_location"; +const char * const BaiduMapComponent::FUNC_GET_MY_GEO_STATUS = "get_my_geo_status"; +const char * const BaiduMapComponent::FUNC_GET_MY_GEO_LOCATION = "get_my_geo_location"; +const char * const BaiduMapComponent::FUNC_DRAW_CIRCLE = "draw_circle"; +const char * const BaiduMapComponent::FUNC_DRAW_NAVI_MARKER = "draw_navi_marker"; +const char * const BaiduMapComponent::FUNC_OVERLAYER_CLEAR_CIRCLE = "overlayer_clear_circle"; +const char * const BaiduMapComponent::FUNC_OVERLAYER_CLEAR_MARKER = "overlayer_clear_marker"; +const char * const BaiduMapComponent::FUNC_OVERLAYER_CLEAR_NAVI_MARKER = "overlayer_clear_navi_marker"; +const char * const BaiduMapComponent::FUNC_DESTROY = "destroy"; + +const FunctionMap BaiduMapComponent::funcMap[] = { + {FUNC_SET_ZOOM_EVENT_ENABLED, SetZoomEventEnabled}, + {FUNC_ZOOM_IN, ZoomIn}, + {FUNC_ZOOM_OUT, ZoomOut}, + {FUNC_ZOOM_TO, ZoomTo}, + {FUNC_ZOOM_BY, ZoomBy}, + {FUNC_SET_MAP_BACKGROUND_COLOR, SetMapBackgroundColor}, + {FUNC_SET_MAP_OVERLAYER_ENABLED, SetMapOverlayerEnabled}, + {FUNC_SET_MAP_TITLES_ENABLED, SetMapTilesEnabled}, + {FUNC_SET_SCROLL_GESTURES_ENABLED, SetScrollGesturesEnabled}, + {FUNC_SCROLL_BY, ScrollBy}, + {FUNC_NEW_LAT_LNG, NewLatLng}, + {FUNC_NEW_LAT_LNG_ZOOM, NewLatLngZoom}, + {FUNC_CLEAR_MAP_OVERLAYER, ClearMapOverlayer}, + {FUNC_DRAW_MARKER, DrawMarker}, + {FUNC_DRAW_POLYGON, DrawPolygon}, + {FUNC_DRAW_PATH, DrawPath}, + {FUNC_DRAW_TEXT, DrawText}, + {FUNC_START_LISTEN_MY_GEO_LOCATION, StartListenMyGeoLocation}, + {FUNC_STOP_LISTEN_MY_GEO_LOCATION, StopListenMyGeoLocation}, + {FUNC_GET_MY_GEO_STATUS, GetMyGeoStatus}, + {FUNC_GET_MY_GEO_LOCATION, GetMyGeoLocation}, + {FUNC_DRAW_CIRCLE, DrawCircle}, + {FUNC_DRAW_NAVI_MARKER, DrawNaviMarker}, + {FUNC_OVERLAYER_CLEAR_CIRCLE, OverlayerClearCircle}, + {FUNC_OVERLAYER_CLEAR_MARKER, OverlayerClearMarker}, + {FUNC_OVERLAYER_CLEAR_NAVI_MARKER, OverlayerClearNaviMarker}, + {FUNC_DESTROY, Destroy} +}; +BaiduMapComponent::BaiduMapComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager) + : Component(options, children, styleManager) +{ + HILOG_INFO(HILOG_MODULE_ACE,"BaiduMapComponent"); + SetComponentName(K_BAIDUMAP); + uint16_t funcMapLength = sizeof(funcMap) / sizeof(funcMap[0]); + for (uint16_t index = 0; index < funcMapLength; index++) { + RegisterNamedFunction(funcMap[index].funcName, funcMap[index].handler); + } +} + +UIView *BaiduMapComponent::GetComponentRootView() const +{ + return const_cast(MapComponentApi::getInstance().get_baidumap_root_view()); +} + +JSValue BaiduMapComponent::SetZoomEventEnabled(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"SetZoomEventEnabled"); + bool enabled = BoolOf(args[0]); + MapComponentApi::getInstance().set_zoom_event_enabled(enabled); + return UNDEFINED; +} + +JSValue BaiduMapComponent::ZoomIn(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"ZoomIn"); + MapComponentApi::getInstance().zoom_in(); + return UNDEFINED; +} + +JSValue BaiduMapComponent::ZoomOut(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"ZoomOut"); + MapComponentApi::getInstance().zoom_out(); + return UNDEFINED; +} + +JSValue BaiduMapComponent::ZoomTo(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"ZoomTo"); + int amount = IntegerOf(args[0]); + MapComponentApi::getInstance().zoom_to(amount); + return UNDEFINED; +} + +JSValue BaiduMapComponent::ZoomBy(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"ZoomBy"); + int amount = IntegerOf(args[0]); + MapComponentApi::getInstance().zoom_by(amount); + return UNDEFINED; +} + +JSValue BaiduMapComponent::SetMapBackgroundColor(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"SetMapBackgroundColor"); + char *json_color = MallocStringOf(args[0]); + MapComponentApi::getInstance().set_map_background_color(json_color); + return UNDEFINED; +} + +JSValue BaiduMapComponent::SetMapOverlayerEnabled(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"SetMapOverlayerEnabled"); + bool enabled = BoolOf(args[0]); + MapComponentApi::getInstance().set_map_overlayer_enabled(enabled); + return UNDEFINED; +} + +JSValue BaiduMapComponent::SetMapTilesEnabled(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"SetMapTilesEnabled"); + bool enabled = BoolOf(args[0]); + MapComponentApi::getInstance().set_map_tiles_enabled(enabled); + return UNDEFINED; +} + +JSValue BaiduMapComponent::SetScrollGesturesEnabled(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"SetScrollGesturesEnabled"); + bool enabled = BoolOf(args[0]); + MapComponentApi::getInstance().set_scroll_gestures_enabled(enabled); + return UNDEFINED; +} + +JSValue BaiduMapComponent::ScrollBy(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"ScrollBy"); + int pixel_x = IntegerOf(args[0]); + int pixel_y = IntegerOf(args[1]); + MapComponentApi::getInstance().scroll_by(pixel_x,pixel_y); + return UNDEFINED; +} + +JSValue BaiduMapComponent::NewLatLng(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"NewLatLng"); + char *json_lat_lng = MallocStringOf(args[0]); + MapComponentApi::getInstance().new_lat_lng(json_lat_lng); + return UNDEFINED; +} + +JSValue BaiduMapComponent::NewLatLngZoom(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"NewLatLngZoom"); + char *json_lat_lng = MallocStringOf(args[0]); + int zoom = IntegerOf(args[1]); + MapComponentApi::getInstance().new_lat_lng_zoom(json_lat_lng,zoom); + return UNDEFINED; +} + +JSValue BaiduMapComponent::ClearMapOverlayer(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"ClearMapOverlayer"); + MapComponentApi::getInstance().clear_map_overlayer(); + return UNDEFINED; +} + +JSValue BaiduMapComponent::DrawMarker(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"DrawMarker"); + char *json_marker = MallocStringOf(args[0]); + MapComponentApi::getInstance().draw_marker(json_marker); + return UNDEFINED; +} + +JSValue BaiduMapComponent::DrawNaviMarker(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"DrawNaviMarker"); + char *json_navi_marker = MallocStringOf(args[0]); + MapComponentApi::getInstance().draw_navi_marker(json_navi_marker); + return UNDEFINED; +} + +JSValue BaiduMapComponent::DrawPolygon(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"DrawPolygon"); + char *json_polygon = MallocStringOf(args[0]); + MapComponentApi::getInstance().draw_polygon(json_polygon); + return UNDEFINED; +} + +JSValue BaiduMapComponent::DrawPath(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"DrawPath"); + char *json_path = MallocStringOf(args[0]); + MapComponentApi::getInstance().draw_path(json_path); + return UNDEFINED; +} + +JSValue BaiduMapComponent::DrawCircle(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"DrawCircle"); + char *json_circle = MallocStringOf(args[0]); + MapComponentApi::getInstance().draw_circle(json_circle); + return UNDEFINED; +} + +JSValue BaiduMapComponent::DrawText(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"DrawText"); + char *json_text = MallocStringOf(args[0]); + MapComponentApi::getInstance().draw_text(json_text); + return UNDEFINED; +} + +JSValue BaiduMapComponent::StartListenMyGeoLocation(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"StartListenMyGeoLocation"); + return UNDEFINED; +} + +JSValue BaiduMapComponent::StopListenMyGeoLocation(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"StopListenMyGeoLocation"); + return UNDEFINED; +} + +JSValue BaiduMapComponent::GetMyGeoStatus(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"GetMyGeoStatus"); + return UNDEFINED; +} + +JSValue BaiduMapComponent::GetMyGeoLocation(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"GetMyGeoLocation"); + return UNDEFINED; +} + +JSValue BaiduMapComponent::OverlayerClearCircle(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"OverlayerClearCircle"); + MapComponentApi::getInstance().overlayer_clear_circle(); + return UNDEFINED; +} + +JSValue BaiduMapComponent::OverlayerClearMarker(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"OverlayerClearMarker"); + MapComponentApi::getInstance().overlayer_clear_marker(); + return UNDEFINED; +} + +JSValue BaiduMapComponent::OverlayerClearNaviMarker(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"OverlayerClearNaviMarker"); + MapComponentApi::getInstance().overlayer_clear_navi_marker(); + return UNDEFINED; +} + +JSValue BaiduMapComponent::Destroy(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"Destroy"); + MapComponentApi::getInstance().destroy(); + return UNDEFINED; +} + +} // namespace ACELite +} // namespace OHOS +#endif // FEATURE_COMPONENT_BAIDUMAP \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/baidu_map_component.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/baidu_map_component.h new file mode 100644 index 000000000..af7ca152a --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/baidu_map_component.h @@ -0,0 +1,315 @@ +/* + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ACELITE_BAIDU_MAP_COMPONENT_H +#define OHOS_ACELITE_BAIDU_MAP_COMPONENT_H + +#include "acelite_config.h" +#ifdef FEATURE_COMPONENT_BAIDUMAP +#include +#include "jsi.h" +#include "component.h" +#include "baidumap_js_component.h" + + +namespace OHOS { +namespace ACELite { +struct FunctionMap { + ACE_DISALLOW_COPY_AND_MOVE(FunctionMap); + const char *funcName; + jerry_external_handler_t handler; +}; + +class BaiduMapComponent final: public Component { +public: + ACE_DISALLOW_COPY_AND_MOVE(BaiduMapComponent); + BaiduMapComponent() = delete; + BaiduMapComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager); + ~BaiduMapComponent() override{} + + /** + * SetZoomEventEnabled, enabled Indicates whether to allow scaling events. This function is disabled by default + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue SetZoomEventEnabled(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * ZoomIn ,Map zoomed out one level. Valid only at levels 4 to 18 + */ + static JSValue ZoomIn(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * ZoomOut ,Map zoomed in one level. Valid only at levels 4 to 18 + */ + static JSValue ZoomOut(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * ZoomTo, Zoom the map to the specified level + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue ZoomTo(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * ZoomBy, amount Incremental scaling of a map at a given level + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue ZoomBy(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * SetMapBackgroundColor, Set the placeholder background color before the map is displayed + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue SetMapBackgroundColor(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * SetMapOverlayerEnabled, Indicates whether to enable the overlay layer. This function is disabled by default + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue SetMapOverlayerEnabled(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * SetMapTilesEnabled, Indicates whether to enable the map tile layer. This function is enabled by default + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue SetMapTilesEnabled(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * SetScrollGesturesEnabled, Indicates whether to enable gesture sliding. This function is enabled by default + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue SetScrollGesturesEnabled(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * ScrollBy, Incremental moving map for a given screen pixel. The screen origin is in the upper left corner + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue ScrollBy(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * NewLatLng, Displays the map to the center of the screen based on the longitude and latitude + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue NewLatLng(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * NewLatLngZoom, Displays the map of the specified longitude and latitude at the specified level to the center of the screen + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue NewLatLngZoom(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * ClearMapOverlayer, Clear all overlays on the map + */ + static JSValue ClearMapOverlayer(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * OverlayerClearCircle + */ + static JSValue OverlayerClearCircle(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * OverlayerClearMarker + */ + static JSValue OverlayerClearMarker(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * OverlayerClearNaviMarker + */ + static JSValue OverlayerClearNaviMarker(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * DrawMarker, Construction point + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue DrawMarker(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * DrawNaviMarker + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue DrawNaviMarker(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * DrawPolygon, Constructing Polygons + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue DrawPolygon(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * DrawPath, structural route + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue DrawPath(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * DrawCircle + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue DrawCircle(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * DrawText, Constructed text + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue DrawText(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * StartListenMyGeoLocation, Initiate location interception + */ + static JSValue StartListenMyGeoLocation(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * StopListenMyGeoLocation, Stop location interception + */ + static JSValue StopListenMyGeoLocation(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * GetMyGeoStatus, Obtaining the Location Status + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue GetMyGeoStatus(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * GetMyGeoLocation, Obtains the watch location information + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue GetMyGeoLocation(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + /** + * Destroy + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSValue Destroy(const jerry_value_t func, const jerry_value_t context, + const jerry_value_t args[], const jerry_length_t argsSize); + + static const char * const FUNC_SET_ZOOM_EVENT_ENABLED; + static const char * const FUNC_ZOOM_IN; + static const char * const FUNC_ZOOM_OUT; + static const char * const FUNC_ZOOM_TO; + static const char * const FUNC_ZOOM_BY; + static const char * const FUNC_SET_MAP_BACKGROUND_COLOR; + static const char * const FUNC_SET_MAP_OVERLAYER_ENABLED; + static const char * const FUNC_SET_MAP_TITLES_ENABLED; + static const char * const FUNC_SET_SCROLL_GESTURES_ENABLED; + static const char * const FUNC_SCROLL_BY; + static const char * const FUNC_NEW_LAT_LNG; + static const char * const FUNC_NEW_LAT_LNG_ZOOM; + static const char * const FUNC_CLEAR_MAP_OVERLAYER; + static const char * const FUNC_DRAW_MARKER; + static const char * const FUNC_DRAW_POLYGON; + static const char * const FUNC_DRAW_PATH; + static const char * const FUNC_DRAW_TEXT; + static const char * const FUNC_START_LISTEN_MY_GEO_LOCATION; + static const char * const FUNC_STOP_LISTEN_MY_GEO_LOCATION; + static const char * const FUNC_GET_MY_GEO_STATUS; + static const char * const FUNC_GET_MY_GEO_LOCATION; + static const char * const FUNC_DRAW_CIRCLE; + static const char * const FUNC_DRAW_NAVI_MARKER; + static const char * const FUNC_OVERLAYER_CLEAR_CIRCLE; + static const char * const FUNC_OVERLAYER_CLEAR_MARKER; + static const char * const FUNC_OVERLAYER_CLEAR_NAVI_MARKER; + static const char * const FUNC_DESTROY; + static const FunctionMap funcMap[]; + +protected: + UIView *GetComponentRootView() const override; +}; +} // namespace ACELite +} // namespace OHOS +#endif // FEATURE_COMPONENT_BAIDUMAP +#endif // OHOS_ACELITE_BAIDU_MAP_COMPONENT_H \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component_factory.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component_factory.h index c686ee874..7e5c68f58 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component_factory.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component_factory.h @@ -57,6 +57,9 @@ #include "tab_content_component.h" #include "tabs_component.h" #endif // FEATURE_COMPONENT_TABS +#ifdef FEATURE_COMPONENT_BAIDUMAP +#include "baidu_map_component.h" +#endif // FEATURE_COMPONENT_BAIDUMAP #include "text_component.h" #include "video_component.h" @@ -180,6 +183,11 @@ public: component = new VideoComponent(options, children, styleManager); break; #endif // FEATURE_COMPONENT_VIDEO +#ifdef FEATURE_COMPONENT_BAIDUMAP + case K_BAIDUMAP: + component = new BaiduMapComponent(options, children, styleManager); + break; +#endif // FEATURE_COMPONENT_BAIDUMAP default: component = nullptr; break; diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.cpp index 7970fcb3a..2b0992e55 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.cpp @@ -26,6 +26,10 @@ using namespace OHOS; namespace OHOS { namespace ACELite { + +UITextLanguageAlignment align_horizontal = UITextLanguageAlignment::TEXT_ALIGNMENT_LEFT; +UITextLanguageAlignment align_vertical = UITextLanguageAlignment::TEXT_ALIGNMENT_TOP; + TextComponent::TextComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *styleManager) : Component(options, children, styleManager), fontSize_(DEFAULT_FONT_SIZE), @@ -98,6 +102,9 @@ bool TextComponent::ApplyPrivateStyle(const AppStyleItem *styleItem) case K_LETTER_SPACING: SetTextLetterSpace(uiLabel_, styleItem); break; + case K_TEXT_ALIGN_VERTICAL: + SetTextAlignVertical(uiLabel_, styleItem); + break; case K_TEXT_ALIGN: SetTextAlign(uiLabel_, styleItem); break; @@ -224,32 +231,60 @@ void TextComponent::PostUpdate(uint16_t attrKeyId) } } +void TextComponent::SetTextAlignVertical(UILabel &label, const AppStyleItem *styleItem) const +{ + if (!IsStyleValueTypeString(styleItem)) { + HILOG_ERROR(HILOG_MODULE_ACE, "text text vertical align style value is invalid!"); + return; + } + + const char * const stylePropValue = GetStyleStrValue(styleItem); + uint16_t alignId = KeyParser::ParseKeyId(stylePropValue, GetStyleStrValueLen(styleItem)); + switch (alignId) { + case K_CENTER: + align_vertical = UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER; + break; + case K_BOTTOM: + align_vertical = UITextLanguageAlignment::TEXT_ALIGNMENT_BOTTOM; + break; + case K_TOP: + align_vertical = UITextLanguageAlignment::TEXT_ALIGNMENT_TOP; + break; + default: + HILOG_WARN(HILOG_MODULE_ACE, "text vertical textAlign style value =%s is invalid, using default instead", + stylePropValue); + break; + } + label.SetAlign(align_horizontal, align_vertical); +} + void TextComponent::SetTextAlign(UILabel &label, const AppStyleItem *styleItem) const { if (!IsStyleValueTypeString(styleItem)) { - HILOG_ERROR(HILOG_MODULE_ACE, "text text align style value is invalid!"); + HILOG_ERROR(HILOG_MODULE_ACE, "text text horizontal align style value is invalid!"); return; } - // set ui label text align, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_CENTER are support. + const char * const stylePropValue = GetStyleStrValue(styleItem); uint16_t alignId = KeyParser::ParseKeyId(stylePropValue, GetStyleStrValueLen(styleItem)); - UITextLanguageAlignment align = UITextLanguageAlignment::TEXT_ALIGNMENT_LEFT; switch (alignId) { case K_LEFT: - align = UITextLanguageAlignment::TEXT_ALIGNMENT_LEFT; + align_horizontal = UITextLanguageAlignment::TEXT_ALIGNMENT_LEFT; break; case K_RIGHT: - align = UITextLanguageAlignment::TEXT_ALIGNMENT_RIGHT; + align_horizontal = UITextLanguageAlignment::TEXT_ALIGNMENT_RIGHT; break; case K_CENTER: - align = UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER; + align_horizontal = UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER; break; default: - HILOG_WARN(HILOG_MODULE_ACE, "text textAlign style value =%s is invalid, using default instead", + HILOG_WARN(HILOG_MODULE_ACE, "text horizontal textAlign style value =%s is invalid, using default instead", stylePropValue); break; } - label.SetAlign(align, UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER); + label.SetAlign(align_horizontal, align_vertical); } + + } // namespace ACELite } // namespace OHOS diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.h index fc9a39fed..64778ea6a 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/text_component.h @@ -44,6 +44,7 @@ protected: private: // parse js text align style to ui_label void SetTextAlign(UILabel& label, const AppStyleItem* styleItem) const; + void SetTextAlignVertical(UILabel& label, const AppStyleItem* styleItem) const; // parse js text size style to fontSize_ void SetTextSize(const AppStyleItem* styleItem); // parse js text color style to ui_label diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/context/js_ability_impl.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/context/js_ability_impl.h index d59927281..68b56ba9b 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/context/js_ability_impl.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/context/js_ability_impl.h @@ -112,11 +112,17 @@ public: return router_; } + jerry_value_t GetAppVM() const + { + return abilityModel_; + } + private: void InvokeOnCreate() const; void InvokeOnDestroy() const; void InvokeOnBackPressed() const; void InvokeMethodWithoutParameter(const char * const name) const; + void MarkAppViewModelEvaling(bool evaling) const; JsAppContext* appContext_; jerry_value_t abilityModel_; // the object evaled from user JS code diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp new file mode 100644 index 000000000..ce1cf77bf --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.cpp @@ -0,0 +1,1170 @@ +/* + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "ace_log.h" +#include "baidumap.h" +#include "baidumap_js_location.h" +#include "baidumap_js_component.h" +#include "baidu_app.h" +#include "msg_center_protocol.h" +#include "js_async_work.h" +#include "adapter.h" + +#include "gfx_utils/heap_base.h" + +typedef struct : public OHOS::HeapBase { + char *msgBody; + uint8_t type; + bool flag; +} BaiduMapAsyncMsgParams; + +typedef struct : public OHOS::HeapBase { + double lon; + double lat; +} BaiduMapJSCoordinate; + +constexpr char LON[] = "lon"; +constexpr char LAT[] = "lat"; +//BT_CONNECT +constexpr char CONNECT[] = "connectcallback"; +constexpr char DISCONNECT[] = "disconnectcallback"; + +namespace OHOS { +namespace ACELite { + +static int32_t DmsLiteCpoyStr(char **destStr, const char *srcStr); + +static void ExecuteSendMsgToJS(void *data); + +static bool CheckIsJsValueFunction(OHOS::ACELite::JSIValue jsValue); + +//poi_nearby_search +OHOS::ACELite::JSIValue poi_successCallback = nullptr; +OHOS::ACELite::JSIValue poi_failCallback = nullptr; +OHOS::ACELite::JSIValue poi_callbackContext = nullptr; +//route_riding_search +OHOS::ACELite::JSIValue route_riding_successCallback = nullptr; +OHOS::ACELite::JSIValue route_riding_failCallback = nullptr; +OHOS::ACELite::JSIValue route_riding_callbackContext = nullptr; +//route_walking_search +OHOS::ACELite::JSIValue route_walking_successCallback = nullptr; +OHOS::ACELite::JSIValue route_walking_failCallback = nullptr; +OHOS::ACELite::JSIValue route_walking_callbackContext = nullptr; +//route_transit_search +OHOS::ACELite::JSIValue route_transit_successCallback = nullptr; +OHOS::ACELite::JSIValue route_transit_failCallback = nullptr; +OHOS::ACELite::JSIValue route_transit_callbackContext = nullptr; +//auth_license +OHOS::ACELite::JSIValue auth_successCallback = nullptr; +OHOS::ACELite::JSIValue auth_failCallback = nullptr; +OHOS::ACELite::JSIValue auth_callbackContext = nullptr; +//naviInit +OHOS::ACELite::JSIValue nav_successCallback = nullptr; +OHOS::ACELite::JSIValue nav_failCallback = nullptr; +OHOS::ACELite::JSIValue nav_callbackContext = nullptr; +//getGeolocation +OHOS::ACELite::JSIValue geo_location_Callback = nullptr; +OHOS::ACELite::JSIValue geo_location_callbackContext = nullptr; +//onRoutePlanStart +OHOS::ACELite::JSIValue route_plan_start_Callback = nullptr; +OHOS::ACELite::JSIValue route_plan_start_callbackContext = nullptr; +//onRoutePlanSuccess +OHOS::ACELite::JSIValue route_plan_success_Callback = nullptr; +OHOS::ACELite::JSIValue route_plan_success_callbackContext = nullptr; +//onRoutePlanFail +OHOS::ACELite::JSIValue route_plan_fail_Callback = nullptr; +OHOS::ACELite::JSIValue route_plan_fail_callbackContext = nullptr; +//onNaviStart +OHOS::ACELite::JSIValue navi_start_Callback = nullptr; +OHOS::ACELite::JSIValue navi_start_callbackContext = nullptr; +//onNaviDestroy +OHOS::ACELite::JSIValue navi_destroy_Callback = nullptr; +OHOS::ACELite::JSIValue navi_destroy_callbackContext = nullptr; +//onRoadGuideTextUpdate +OHOS::ACELite::JSIValue road_guide_text_update_Callback = nullptr; +OHOS::ACELite::JSIValue road_guide_text_update_callbackContext = nullptr; +//onRouteGuideIconUpdate +OHOS::ACELite::JSIValue road_guide_icon_update_Callback = nullptr; +OHOS::ACELite::JSIValue road_guide_icon_update_callbackContext = nullptr; +//onRemainTimeUpdate +OHOS::ACELite::JSIValue remain_time_Callback = nullptr; +OHOS::ACELite::JSIValue remain_time_callbackContext = nullptr; +//onRemainDistanceUpdate +OHOS::ACELite::JSIValue remain_distance_Callback = nullptr; +OHOS::ACELite::JSIValue remain_distance_callbackContext = nullptr; +//onRemainRouteUpdate +OHOS::ACELite::JSIValue remain_route_Callback = nullptr; +OHOS::ACELite::JSIValue remain_route_callbackContext = nullptr; +//onGpsStatusChange +OHOS::ACELite::JSIValue gps_status_Callback = nullptr; +OHOS::ACELite::JSIValue gps_status_callbackContext = nullptr; +//onRouteFarAway +OHOS::ACELite::JSIValue route_far_Callback = nullptr; +OHOS::ACELite::JSIValue route_far_callbackContext = nullptr; +//onRoutePlanYawing +OHOS::ACELite::JSIValue route_plan_yawing_Callback = nullptr; +OHOS::ACELite::JSIValue route_plan_yawing_callbackContext = nullptr; +//onReRouteComplete +OHOS::ACELite::JSIValue reroute_Callback = nullptr; +OHOS::ACELite::JSIValue reroute_callbackContext = nullptr; +//onArriveDest +OHOS::ACELite::JSIValue arrivedest_Callback = nullptr; +OHOS::ACELite::JSIValue arrivedest_callbackContext = nullptr; +//poi_sug_search +OHOS::ACELite::JSIValue poi_sug_successCallback = nullptr; +OHOS::ACELite::JSIValue poi_sug_failCallback = nullptr; +OHOS::ACELite::JSIValue poi_sug_callbackContext = nullptr; +//geocode_search +OHOS::ACELite::JSIValue geocode_search_successCallback = nullptr; +OHOS::ACELite::JSIValue geocode_search_failCallback = nullptr; +OHOS::ACELite::JSIValue geocode_search_callbackContext = nullptr; +//regeocode_search +OHOS::ACELite::JSIValue regeocode_search_successCallback = nullptr; +OHOS::ACELite::JSIValue regeocode_search_failCallback = nullptr; +OHOS::ACELite::JSIValue regeocode_search_callbackContext = nullptr; +//BT_connect +OHOS::ACELite::JSIValue bt_connect_successCallback = nullptr; +OHOS::ACELite::JSIValue bt_connect_failCallback = nullptr; +OHOS::ACELite::JSIValue bt_connect_callbackContext = nullptr; + +static bool CheckIsJsValueDefined(OHOS::ACELite::JSIValue jsValue) +{ + if (jsValue == nullptr) { + return false; + } + + if (OHOS::ACELite::JSI::ValueIsUndefined(jsValue)) { + return false; + } + + return true; +} + + +static int32_t DmsLiteCpoyStr(char **destStr, const char *srcStr) +{ + if (destStr == nullptr || srcStr == nullptr) { + return -1; + } + + uint32_t length = strlen(srcStr) + 1; + *destStr = static_cast(AdapterMalloc(length)); + if (*destStr == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to allocate memory for destination string"); + return -1; + } + + if (memset_s(*destStr, length, 0, length) != EOK) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to set memory for destination string"); + AdapterFree(*destStr); + return -1; + } + if (memcpy_s(*destStr, length, srcStr, length) != EOK) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to copy source string to destination string"); + AdapterFree(*destStr); + return -1; + } + + return 0; +} + + + +static void ExecuteSendMsgToJS(void *data) +{ + BaiduMapAsyncMsgParams *params = static_cast(data); + if (params == nullptr) { + return; + } + + OHOS::ACELite::JSIValue success = nullptr; + OHOS::ACELite::JSIValue fail = nullptr; + OHOS::ACELite::JSIValue context = nullptr; + uint8_t type = params->type; + bool flag = params->flag; + switch (type) { + case MSGCENTER_TYPE_ID_VECTOR_NAVI_RECV_POI: + success = poi_successCallback; + fail = poi_failCallback; + context = poi_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_RIDING_SEARCH: + success = route_riding_successCallback; + fail = route_riding_failCallback; + context = route_riding_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_WALKING_SEARCH: + success = route_walking_successCallback; + fail = route_walking_failCallback; + context = route_walking_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_TRANSIT_SEARCH: + success = route_transit_successCallback; + fail = route_transit_failCallback; + context = route_transit_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_POI_SUG_SEARCH: + success = poi_sug_successCallback; + fail = poi_sug_failCallback; + context = poi_sug_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_AUTH_LICENSE: + success = auth_successCallback; + fail = auth_failCallback; + context = auth_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_INIT: + success = nav_successCallback; + fail = nav_failCallback; + context = nav_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GEO_LOCATION: + success = geo_location_Callback; + context = geo_location_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_START: + success = route_plan_start_Callback; + context = route_plan_start_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_SUCC: + success = route_plan_success_Callback; + context = route_plan_success_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_FAIL: + success = route_plan_fail_Callback; + context = route_plan_fail_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_START: + success = navi_start_Callback; + context = navi_start_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_NAVI_DESTROY: + success = navi_destroy_Callback; + context = navi_destroy_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROAD_GUIDE_TEXT_UPDATE: + success = road_guide_text_update_Callback; + context = road_guide_text_update_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROAD_GUIDE_ICON_UPDATE: + success = road_guide_icon_update_Callback; + context = road_guide_icon_update_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_TIME_UPDATE: + success = remain_time_Callback; + context = remain_time_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_DISTANCE_UPDATE: + success = remain_distance_Callback; + context = remain_distance_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REMAIN_ROUTE_UPDATE: + success = remain_route_Callback; + context = remain_route_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GPS_STATUS_CHANGE: + success = gps_status_Callback; + context = gps_status_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_FARAWAY: + success = route_far_Callback; + context = route_far_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ROUTE_PLAN_YAWING: + success = route_plan_yawing_Callback; + context = route_plan_yawing_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_RE_ROUTE_COMPLETE: + success = reroute_Callback; + context = reroute_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_ARRIVE_DSTINATION: + success = arrivedest_Callback; + context = arrivedest_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_GEOCODE_SEARCH: + success = geocode_search_successCallback; + fail = geocode_search_failCallback; + context = geocode_search_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REC_REGEOCODE_SEARCH: + success = regeocode_search_successCallback; + fail = regeocode_search_failCallback; + context = regeocode_search_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED: + success = bt_connect_successCallback; + context = bt_connect_callbackContext; + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_DISCONNECTED: + success = bt_connect_failCallback; + context = bt_connect_callbackContext; + break; + default: + HILOG_ERROR(HILOG_MODULE_ACE, "Invalid command type"); + break; + + } + + char *msgBody = params->msgBody; + delete params; + params = nullptr; + + OHOS::ACELite::JSIValue dataInfo = OHOS::ACELite::JSI::CreateObject(); + OHOS::ACELite::JSI::SetBooleanProperty(dataInfo, "isFileType", false); + OHOS::ACELite::JSI::SetBooleanProperty(dataInfo, "isRegister", false); + OHOS::ACELite::JSI::SetStringProperty(dataInfo, "message", msgBody); + if (flag) { + if ((!CheckIsJsValueFunction(success)) || (!CheckIsJsValueDefined(context))) { + HILOG_ERROR(HILOG_MODULE_ACE, "Error in ExecuteSendMsgToJS. Invalid params detected!"); + return; + } + OHOS::ACELite::JSIValue successArgv[OHOS::ACELite::ARGC_ONE] = { dataInfo }; + OHOS::ACELite::JSI::CallFunction(success, context, successArgv, OHOS::ACELite::ARGC_ONE); + OHOS::ACELite::JSI::ReleaseValue(dataInfo); + } else { + if ((!CheckIsJsValueDefined(context)) || (!CheckIsJsValueFunction(fail))) { + HILOG_ERROR(HILOG_MODULE_ACE, "Error in ExecuteSendMsgToJS. Invalid params detected!"); + return; + } + OHOS::ACELite::JSIValue failArgv[OHOS::ACELite::ARGC_ONE] = { dataInfo }; + OHOS::ACELite::JSI::CallFunction(fail, context, failArgv, OHOS::ACELite::ARGC_ONE); + OHOS::ACELite::JSI::ReleaseValue(dataInfo); + } + if (msgBody != nullptr) { + AdapterFree(msgBody); + msgBody = nullptr; + } + + return; +} + +static bool CheckIsJsValueFunction(OHOS::ACELite::JSIValue jsValue) +{ + if (!CheckIsJsValueDefined(jsValue)) { + return false; + } + + return OHOS::ACELite::JSI::ValueIsFunction(jsValue); +} + +static void ReleaseJsValue(OHOS::ACELite::JSIValue &jsValue) +{ + if (CheckIsJsValueDefined(jsValue)) { + OHOS::ACELite::JSI::ReleaseValue(jsValue); + jsValue = OHOS::ACELite::JSI::CreateUndefined(); + } + return; +} + +static void ReleaseMsgJsValue(uint8_t type) +{ + HILOG_INFO(HILOG_MODULE_ACE,"ReleasePoiMsgJsValue"); + switch (type) { + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI: + ReleaseJsValue(poi_callbackContext); + ReleaseJsValue(poi_successCallback); + ReleaseJsValue(poi_failCallback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE: + ReleaseJsValue(auth_callbackContext); + ReleaseJsValue(auth_successCallback); + ReleaseJsValue(auth_failCallback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT: + ReleaseJsValue(nav_callbackContext); + ReleaseJsValue(nav_successCallback); + ReleaseJsValue(nav_failCallback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_START: + ReleaseJsValue(route_plan_start_callbackContext); + ReleaseJsValue(route_plan_start_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH: + ReleaseJsValue(poi_sug_callbackContext); + ReleaseJsValue(poi_sug_successCallback); + ReleaseJsValue(poi_sug_failCallback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_SUCC: + ReleaseJsValue(route_plan_success_callbackContext); + ReleaseJsValue(route_plan_success_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION: + ReleaseJsValue(geo_location_callbackContext); + ReleaseJsValue(geo_location_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_FAIL: + ReleaseJsValue(route_plan_fail_callbackContext); + ReleaseJsValue(route_plan_fail_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_START: + ReleaseJsValue(navi_start_callbackContext); + ReleaseJsValue(navi_start_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_DESTROY: + ReleaseJsValue(navi_destroy_callbackContext); + ReleaseJsValue(navi_destroy_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_TEXT_UPDATE: + ReleaseJsValue(road_guide_text_update_callbackContext); + ReleaseJsValue(road_guide_text_update_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_ICON_UPDATE: + ReleaseJsValue(road_guide_icon_update_callbackContext); + ReleaseJsValue(road_guide_icon_update_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_TIME_UPDATE: + ReleaseJsValue(remain_time_callbackContext); + ReleaseJsValue(remain_time_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_DISTANCE_UPDATE: + ReleaseJsValue(remain_distance_callbackContext); + ReleaseJsValue(remain_distance_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_ROUTE_UPDATE: + ReleaseJsValue(remain_route_callbackContext); + ReleaseJsValue(remain_route_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GPS_STATUS_CHANGE: + ReleaseJsValue(gps_status_callbackContext); + ReleaseJsValue(gps_status_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_FARAWAY: + ReleaseJsValue(route_far_callbackContext); + ReleaseJsValue(route_far_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_YAWING: + ReleaseJsValue(route_plan_yawing_callbackContext); + ReleaseJsValue(route_plan_yawing_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_RE_ROUTE_COMPLETE: + ReleaseJsValue(reroute_callbackContext); + ReleaseJsValue(reroute_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ARRIVE_DSTINATION: + ReleaseJsValue(arrivedest_callbackContext); + ReleaseJsValue(arrivedest_Callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH: + ReleaseJsValue(geocode_search_successCallback); + ReleaseJsValue(geocode_search_failCallback); + ReleaseJsValue(geocode_search_callbackContext); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH: + ReleaseJsValue(regeocode_search_successCallback); + ReleaseJsValue(regeocode_search_failCallback); + ReleaseJsValue(regeocode_search_callbackContext); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH: + ReleaseJsValue(route_riding_successCallback); + ReleaseJsValue(route_riding_failCallback); + ReleaseJsValue(route_riding_callbackContext); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH: + ReleaseJsValue(route_walking_successCallback); + ReleaseJsValue(route_walking_failCallback); + ReleaseJsValue(route_walking_callbackContext); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH: + ReleaseJsValue(route_transit_successCallback); + ReleaseJsValue(route_transit_failCallback); + ReleaseJsValue(route_transit_callbackContext); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED: + ReleaseJsValue(bt_connect_successCallback); + ReleaseJsValue(bt_connect_failCallback); + ReleaseJsValue(bt_connect_callbackContext); + break; + default: + HILOG_ERROR(HILOG_MODULE_ACE, "ReleaseMsgJsValue Invalid command type"); + break; + } + return; +} + +bool setCallbackFunction(OHOS::ACELite::JSIValue callback,uint8_t type,bool isSuccess) +{ + if (!OHOS::ACELite::JSI::ValueIsUndefined(callback)) { + if (!OHOS::ACELite::JSI::ValueIsFunction(callback)) { + HILOG_ERROR(HILOG_MODULE_ACE, "Success callback value is not a function"); + } else { + switch (type) { + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI: + if (isSuccess) { + poi_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + poi_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE: + if (isSuccess) { + auth_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + auth_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT: + if (isSuccess) { + nav_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + nav_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH: + if (isSuccess) { + poi_sug_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + poi_sug_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION: + geo_location_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_START: + route_plan_start_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_SUCC: + route_plan_success_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_FAIL: + route_plan_fail_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_START: + navi_start_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_DESTROY: + navi_destroy_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_TEXT_UPDATE: + road_guide_text_update_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_ICON_UPDATE: + road_guide_icon_update_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_TIME_UPDATE: + remain_time_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_DISTANCE_UPDATE: + remain_distance_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_ROUTE_UPDATE: + remain_route_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GPS_STATUS_CHANGE: + gps_status_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_FARAWAY: + route_far_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_YAWING: + route_plan_yawing_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_RE_ROUTE_COMPLETE: + reroute_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ARRIVE_DSTINATION: + arrivedest_Callback = OHOS::ACELite::JSI::AcquireValue(callback); + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH: + if (isSuccess) { + geocode_search_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + geocode_search_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH: + if (isSuccess) { + regeocode_search_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + regeocode_search_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH: + if (isSuccess) { + route_riding_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + route_riding_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH: + if (isSuccess) { + route_walking_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + route_walking_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH: + if (isSuccess) { + route_transit_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + route_transit_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + case MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED: + if (isSuccess) { + bt_connect_successCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } else { + bt_connect_failCallback = OHOS::ACELite::JSI::AcquireValue(callback); + } + break; + default: + HILOG_ERROR(HILOG_MODULE_ACE, "setCallbackFunction Invalid command type"); + return false; + } + } + } else { + HILOG_ERROR(HILOG_MODULE_ACE, "Success callback value is undefined"); + return false; + } + + return true; +} + +/** + * MsgCenter interface + */ + +JSIValue BaiduMapComponentModule::poi_nearby_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"poi_nearby_search"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"poi_nearby_search : %s \n",data); + //success Callback & failed Callback + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI); + poi_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_SUCCESS); + OHOS::ACELite::JSIValue failCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_FAIL); + setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI,true); + setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI,false); + msg_center_vector_navi_req_poi(MSGCENTER_CMD_VECTOR_NAVI,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::route_riding_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"route_riding_search"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"route_riding_search : %s \n",data); + //success Callback & failed Callback + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH); + route_riding_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_SUCCESS); + OHOS::ACELite::JSIValue failCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_FAIL); + setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH,true); + setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH,false); + msg_center_vector_navi_req_route_riding_search(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_RIDING_SEARCH,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::route_walking_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"route_walking_search"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"route_walking_search : %s \n",data); + //success Callback & failed Callback + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH); + route_walking_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_SUCCESS); + OHOS::ACELite::JSIValue failCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_FAIL); + setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH,true); + setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH,false); + msg_center_vector_navi_req_route_walking_search(MSGCENTER_CMD_VECTOR_NAVI,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_WALKING_SEARCH,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::route_transit_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"route_transit_search"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"route_transit_search : %s \n",data); + //success Callback & failed Callback + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH); + route_transit_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_SUCCESS); + OHOS::ACELite::JSIValue failCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_FAIL); + setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH,true); + setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH,false); + msg_center_vector_navi_req_route_transit_search(MSGCENTER_CMD_VECTOR_NAVI,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_TRANSIT_SEARCH,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::auth_license(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"auth_license"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"auth_license : %s \n",data); + //success Callback & failed Callback + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE); + auth_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_SUCCESS); + OHOS::ACELite::JSIValue failCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_FAIL); + setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE,true); + setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE,false); + msg_center_vector_navi_req_auth_license(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_AUTH_LICENSE,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::getGeolocation(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"getGeolocation"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"getGeolocation : %s \n",data); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION); + geo_location_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION,true); + msg_center_vector_navi_req_geo_location(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEO_LOCATION,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::naviInit(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"naviInit"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"naviInit : %s \n",data); + //success Callback & failed Callback + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT); + nav_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_SUCCESS); + OHOS::ACELite::JSIValue failCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_FAIL); + setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT,true); + setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT,false); + msg_center_vector_navi_req_navi_init(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_INIT,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRoutePlanStart(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRoutePlanStart"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_START); + route_plan_start_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_START,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRoutePlanSuccess(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRoutePlanSuccess"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_SUCC); + route_plan_success_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_SUCC,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRoutePlanFail(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRoutePlanFail"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_FAIL); + route_plan_fail_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_FAIL,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onNaviStart(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onNaviStart"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_START); + navi_start_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_START,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onNaviDestroy(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onNaviDestroy"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_DESTROY); + navi_destroy_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_NAVI_DESTROY,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRoadGuideTextUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRoadGuideTextUpdate"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_TEXT_UPDATE); + road_guide_text_update_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_TEXT_UPDATE,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRouteGuideIconUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRouteGuideIconUpdate"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_ICON_UPDATE); + road_guide_icon_update_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROAD_GUIDE_ICON_UPDATE,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRemainTimeUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRemainTimeUpdate"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_TIME_UPDATE); + remain_time_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_TIME_UPDATE,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRemainDistanceUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRemainDistanceUpdate"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_DISTANCE_UPDATE); + remain_distance_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_DISTANCE_UPDATE,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRemainRouteUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRemainRouteUpdate"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_ROUTE_UPDATE); + remain_route_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REMAIN_ROUTE_UPDATE,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onGpsStatusChange(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onGpsStatusChange"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GPS_STATUS_CHANGE); + gps_status_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GPS_STATUS_CHANGE,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRouteFarAway(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRouteFarAway"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_FARAWAY); + route_far_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_FARAWAY,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onRoutePlanYawing(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onRoutePlanYawing"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_YAWING); + route_plan_yawing_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_YAWING,true); + //msg_center_vector_navi_req_route_plan_yawing(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ROUTE_PLAN_YAWING,Callback,1); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onReRouteComplete(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onReRouteComplete"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_RE_ROUTE_COMPLETE); + reroute_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_RE_ROUTE_COMPLETE,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::onArriveDest(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onArriveDest"); + OHOS::ACELite::JSIValue Callback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_CALLBACK); + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ARRIVE_DSTINATION); + arrivedest_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + setCallbackFunction(Callback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_ARRIVE_DSTINATION,true); + return JSI::CreateBoolean(0); +} + +JSIValue BaiduMapComponentModule::poi_sug_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"poi_sug_search"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"poi_sug_search : %s \n",data); + + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH); + poi_sug_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_SUCCESS); + OHOS::ACELite::JSIValue failCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_FAIL); + setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH,true); + setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH,false); + msg_center_vertor_navi_req_poi_sug_search(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_POI_SUG_SEARCH,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +/** + * location interface + */ +JSIValue BaiduMapComponentModule::Location_WGS84ToGCJ02(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToGCJ02"); + double lon = OHOS::ACELite::JSI::GetNumberProperty(args[0], LON); + double lat = OHOS::ACELite::JSI::GetNumberProperty(args[0], LAT); + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToGCJ02 befor lon: %lf \s",lon); + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToGCJ02 befor lat: %lf \s",lat); + JSCoordinate params = {0}; + WGS84ToGCJ02(lon, lat, params); + + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToGCJ02 after lon: %lf \s",params.lon); + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToGCJ02 after lat: %lf \s",params.lat); + JSIValue result = JSI::CreateObject(); + JSI::SetNumberProperty(result, "lon", params.lon); + JSI::SetNumberProperty(result, "lat", params.lat); + return result; +} + +JSIValue BaiduMapComponentModule::Location_GCJ02ToBD09(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"GCJ02ToBD09"); + double lon = OHOS::ACELite::JSI::GetNumberProperty(args[0], LON); + double lat = OHOS::ACELite::JSI::GetNumberProperty(args[0], LAT); + HILOG_INFO(HILOG_MODULE_ACE,"GCJ02ToBD09 befor lon: %lf \s",lon); + HILOG_INFO(HILOG_MODULE_ACE,"GCJ02ToBD09 befor lat: %lf \s",lat); + JSCoordinate params = {0}; + GCJ02ToBD09(lon, lat, params); + + HILOG_INFO(HILOG_MODULE_ACE,"GCJ02ToBD09 after lon: %lf \s",params.lon); + HILOG_INFO(HILOG_MODULE_ACE,"GCJ02ToBD09 after lat: %lf \s",params.lat); + JSIValue result = JSI::CreateObject(); + JSI::SetNumberProperty(result, "lon", params.lon); + JSI::SetNumberProperty(result, "lat", params.lat); + return result; +} + +JSIValue BaiduMapComponentModule::Location_WGS84ToBD09(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToBD09"); + double lon = OHOS::ACELite::JSI::GetNumberProperty(args[0], LON); + double lat = OHOS::ACELite::JSI::GetNumberProperty(args[0], LAT); + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToBD09 befor lon: %lf \s",lon); + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToBD09 befor lat: %lf \s",lat); + JSCoordinate params = {0}; + WGS84ToBD09(lon, lat, params); + + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToBD09 after lon: %lf \s",params.lon); + HILOG_INFO(HILOG_MODULE_ACE,"WGS84ToBD09 after lat: %lf \s",params.lat); + JSIValue result = JSI::CreateObject(); + JSI::SetNumberProperty(result, "lon", params.lon); + JSI::SetNumberProperty(result, "lat", params.lat); + return result; +} + +JSIValue BaiduMapComponentModule::Location_BD09ToGCJ02(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"BD09ToGCJ02"); + double lon = OHOS::ACELite::JSI::GetNumberProperty(args[0], LON); + double lat = OHOS::ACELite::JSI::GetNumberProperty(args[0], LAT); + HILOG_INFO(HILOG_MODULE_ACE,"BD09ToGCJ02 befor lon: %lf \s",lon); + HILOG_INFO(HILOG_MODULE_ACE,"BD09ToGCJ02 befor lat: %lf \s",lat); + JSCoordinate params = {0}; + BD09ToGCJ02(lon, lat, params); + + HILOG_INFO(HILOG_MODULE_ACE,"BD09ToGCJ02 after lon: %lf \s",params.lon); + HILOG_INFO(HILOG_MODULE_ACE,"BD09ToGCJ02 after lat: %lf \s",params.lat); + JSIValue result = JSI::CreateObject(); + JSI::SetNumberProperty(result, "lon", params.lon); + JSI::SetNumberProperty(result, "lat", params.lat); + return result; +} + +/** + * geocode interface + */ +JSIValue BaiduMapComponentModule::Geocode_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"Geocode_search"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"Geocode_search : %s \n",data); + //success Callback & failed Callback + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH); + geocode_search_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_SUCCESS); + OHOS::ACELite::JSIValue failCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_FAIL); + setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH,true); + setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH,false); + msg_center_vector_navi_req_geocode_search(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_GEOCODE_SEARCH,data,strlen(data)); + return JSI::CreateBoolean(0); + +} + +JSIValue BaiduMapComponentModule::Regeocode_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"Regeocode_search"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"Regeocode_search : %s \n",data); + //success Callback & failed Callback + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH); + regeocode_search_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue successCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_SUCCESS); + OHOS::ACELite::JSIValue failCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CB_FAIL); + setCallbackFunction(successCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH,true); + setCallbackFunction(failCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH,false); + msg_center_vector_navi_req_regeocode_search(MSGCENTER_CMD_VECTOR_NAVI, MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_REGEOCODE_SEARCH,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +/** + * destroy page interface + */ +JSIValue BaiduMapComponentModule::Destroy_page(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"Destroy_page"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"Destroy_page : %s \n",data); + msg_center_vector_navi_req_destroy_page(MSGCENTER_CMD_VECTOR_NAVI,MSGCENTER_TYPE_ID_VECTOR_NAVI_REQ_DESTROY_PAGE,data,strlen(data)); + return JSI::CreateBoolean(0); +} + +/** + * BT connect interface + */ +JSIValue BaiduMapComponentModule::onBTConnect(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + HILOG_INFO(HILOG_MODULE_ACE,"onBTConnect"); + char *data = JSI::JsonStringify(args[0]); + HILOG_INFO(HILOG_MODULE_ACE,"onBTConnect : %s \n",data); + //success Callback & failed Callback + ReleaseMsgJsValue(MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED); + bt_connect_callbackContext = OHOS::ACELite::JSI::AcquireValue(thisVal); + OHOS::ACELite::JSIValue connectCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], CONNECT); + OHOS::ACELite::JSIValue disconnectCallback = OHOS::ACELite::JSI::GetNamedProperty(args[0], DISCONNECT); + setCallbackFunction(connectCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED,true); + setCallbackFunction(disconnectCallback,MSGCENTER_TYPE_ID_VECTOR_NAVI_BT_CONNECTED,false); + return JSI::CreateBoolean(0); +} + +void InitBaiduMapComponentModule(JSIValue exports) +{ + HILOG_INFO(HILOG_MODULE_ACE,"InitBaiduMapComponentModule"); + /** + * MsgCenter interface + */ + JSI::SetModuleAPI(exports, "poi_nearby_search", BaiduMapComponentModule::poi_nearby_search); + JSI::SetModuleAPI(exports, "route_riding_search", BaiduMapComponentModule::route_riding_search); + JSI::SetModuleAPI(exports, "route_walking_search", BaiduMapComponentModule::route_walking_search); + JSI::SetModuleAPI(exports, "route_transit_search", BaiduMapComponentModule::route_transit_search); + JSI::SetModuleAPI(exports, "auth_license", BaiduMapComponentModule::auth_license); + JSI::SetModuleAPI(exports, "getGeolocation", BaiduMapComponentModule::getGeolocation); + JSI::SetModuleAPI(exports, "naviInit", BaiduMapComponentModule::naviInit); + JSI::SetModuleAPI(exports, "onRoutePlanStart", BaiduMapComponentModule::onRoutePlanStart); + JSI::SetModuleAPI(exports, "onRoutePlanSuccess", BaiduMapComponentModule::onRoutePlanSuccess); + JSI::SetModuleAPI(exports, "onRoutePlanFail", BaiduMapComponentModule::onRoutePlanFail); + JSI::SetModuleAPI(exports, "onNaviStart", BaiduMapComponentModule::onNaviStart); + JSI::SetModuleAPI(exports, "onNaviDestroy", BaiduMapComponentModule::onNaviDestroy); + JSI::SetModuleAPI(exports, "onRoadGuideTextUpdate", BaiduMapComponentModule::onRoadGuideTextUpdate); + JSI::SetModuleAPI(exports, "onRouteGuideIconUpdate", BaiduMapComponentModule::onRouteGuideIconUpdate); + JSI::SetModuleAPI(exports, "onRemainTimeUpdate", BaiduMapComponentModule::onRemainTimeUpdate); + JSI::SetModuleAPI(exports, "onRemainDistanceUpdate", BaiduMapComponentModule::onRemainDistanceUpdate); + JSI::SetModuleAPI(exports, "onRemainRouteUpdate", BaiduMapComponentModule::onRemainRouteUpdate); + JSI::SetModuleAPI(exports, "onGpsStatusChange", BaiduMapComponentModule::onGpsStatusChange); + JSI::SetModuleAPI(exports, "onRouteFarAway", BaiduMapComponentModule::onRouteFarAway); + JSI::SetModuleAPI(exports, "onRoutePlanYawing", BaiduMapComponentModule::onRoutePlanYawing); + JSI::SetModuleAPI(exports, "onReRouteComplete", BaiduMapComponentModule::onReRouteComplete); + JSI::SetModuleAPI(exports, "onArriveDest", BaiduMapComponentModule::onArriveDest); + JSI::SetModuleAPI(exports, "poi_sug_search", BaiduMapComponentModule::poi_sug_search); + + /** + * location interface + */ + JSI::SetModuleAPI(exports, "WGS84ToGCJ02", BaiduMapComponentModule::Location_WGS84ToGCJ02); + JSI::SetModuleAPI(exports, "GCJ02ToBD09", BaiduMapComponentModule::Location_GCJ02ToBD09); + JSI::SetModuleAPI(exports, "WGS84ToBD09", BaiduMapComponentModule::Location_WGS84ToBD09); + JSI::SetModuleAPI(exports, "BD09ToGCJ02", BaiduMapComponentModule::Location_BD09ToGCJ02); + + /** + * geocode interface + */ + JSI::SetModuleAPI(exports, "geocode_search", BaiduMapComponentModule::Geocode_search); + JSI::SetModuleAPI(exports, "regeocode_search", BaiduMapComponentModule::Regeocode_search); + + /** + * destroy page + */ + JSI::SetModuleAPI(exports, "destroy_page", BaiduMapComponentModule::Destroy_page); + + /** + * BT connect interface + */ + JSI::SetModuleAPI(exports, "onBTConnect", BaiduMapComponentModule::onBTConnect); + +} + +} // namespace ACELite +} // namespace OHOS + +void BaidumapSendMsgToJS(const char *msgBody,uint8_t type) +{ + BaiduMapAsyncMsgParams *params = new BaiduMapAsyncMsgParams(); + if (params == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE,"Failed to allocate memory for params"); + return; + } + params->type = type; + params->flag = true; + int32_t copyRet = OHOS::ACELite::DmsLiteCpoyStr(¶ms->msgBody, msgBody); + + if (copyRet != 0) { + HILOG_ERROR(HILOG_MODULE_ACE,"Failed to copy msgBody"); + delete params; + params = nullptr; + return; + } + + bool ret = OHOS::ACELite::JsAsyncWork::DispatchAsyncWork(OHOS::ACELite::ExecuteSendMsgToJS,static_cast(params)); + if (!ret) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to dispatch async work"); + delete params; + params = nullptr; + } + + return; +} + +void BaidumapFailSendMsgToJS(const char *msgBody,uint8_t type) +{ + BaiduMapAsyncMsgParams *params = new BaiduMapAsyncMsgParams(); + if (params == nullptr) { + HILOG_ERROR(HILOG_MODULE_ACE,"Failed to allocate memory for params"); + return; + } + params->type = type; + params->flag = false; + int32_t copyRet = OHOS::ACELite::DmsLiteCpoyStr(¶ms->msgBody, msgBody); + + if (copyRet != 0) { + HILOG_ERROR(HILOG_MODULE_ACE,"Failed to copy msgBody"); + delete params; + params = nullptr; + return; + } + + bool ret = OHOS::ACELite::JsAsyncWork::DispatchAsyncWork(OHOS::ACELite::ExecuteSendMsgToJS, static_cast(params)); + if (!ret) { + HILOG_ERROR(HILOG_MODULE_ACE, "Failed to dispatch async work"); + delete params; + params = nullptr; + } + + return; +} + diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.h new file mode 100644 index 000000000..93a3182cd --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/baidumapcomponent/baidumap.h @@ -0,0 +1,113 @@ +/* +* Copyright (c) CompanyNameMagicTag. 2021-2021. All rights reserved. +* Description: audio capture wrapper +* Author: Media Software Group +* Create: 2021-09-13 +*/ + +#ifndef BAIDUMAPCOMPONENT_MODULE_H +#define BAIDUMAPCOMPONENT_MODULE_H + +#include +#include "jsi.h" + +namespace OHOS { +namespace ACELite { +class BaiduMapComponentModule final : public MemoryHeap { +public: + /** + * constructor + */ + BaiduMapComponentModule() = default; + + /** + * desconstructor + */ + ~BaiduMapComponentModule() = default; + + /** + * MsgCenter interface + */ + static JSIValue poi_nearby_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue route_riding_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue route_walking_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue route_transit_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue auth_license(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue getGeolocation(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue naviInit(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRoutePlanStart(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRoutePlanSuccess(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRoutePlanFail(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onNaviStart(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onNaviDestroy(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRoadGuideTextUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRouteGuideIconUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRemainTimeUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRemainDistanceUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRemainRouteUpdate(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onGpsStatusChange(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRouteFarAway(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onRoutePlanYawing(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onReRouteComplete(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue onArriveDest(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue poi_sug_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + * location interface + */ + static JSIValue Location_WGS84ToGCJ02(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue Location_GCJ02ToBD09(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue Location_WGS84ToBD09(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue Location_BD09ToGCJ02(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + * geocode interface + */ + static JSIValue Geocode_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + static JSIValue Regeocode_search(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + * destroy page interface + */ + static JSIValue Destroy_page(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + * bt connect interface + */ + static JSIValue onBTConnect(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + +}; + +void InitBaiduMapComponentModule(JSIValue exports); +} +} +void BaidumapSendMsgToJS(const char *msgBody,uint8_t type); +void BaidumapFailSendMsgToJS(const char *msgBody,uint8_t type); +#endif + diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp new file mode 100644 index 000000000..bf97b75ed --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.cpp @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2020-2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +#include "display.h" +#include "ace_log.h" +#include "errcode.h" +#if defined(SUPPORT_POWER_MANAGER) +#include "power_display_service.h" +#endif + +constexpr char KEEPSCREENON[] = "keepScreenOn"; +uint32_t g_keepOnTimeout = 5000; // 5000ms +const char * ERR_GENERAL = "display error"; +const char * ERR_NOT_SUPPORT = "display set is not support"; +const int DISPLAY_SUCCESS = 0; +const int DISPLAY_FAIL = -1; +const int DISPLAY_NOT_SUPPORT = -2; + +namespace OHOS { +namespace ACELite { +static void FailCallBack(const JSIValue thisVal, const JSIValue args, int ret) +{ + JSIValue errCode = JSI::CreateNumber(ret); + JSIValue errInfo; + if (ret == DISPLAY_FAIL) { + errInfo = JSI::CreateString(ERR_GENERAL); + } else { + errInfo = JSI::CreateString(ERR_NOT_SUPPORT); + } + JSIValue fail = JSI::GetNamedProperty(args, CB_FAIL); + JSIValue complete = JSI::GetNamedProperty(args, CB_COMPLETE); + JSIValue argv[ARGC_TWO] = {errInfo, errCode}; + if (!JSI::ValueIsUndefined(fail)) { + JSI::CallFunction(fail, thisVal, argv, ARGC_TWO); + } + if (!JSI::ValueIsUndefined(complete)) { + JSI::CallFunction(complete, thisVal, nullptr, 0); + } + JSI::ReleaseValueList(fail, complete, errInfo, errCode, ARGS_END); +} + +static void SuccessCallBack(const JSIValue thisVal, const JSIValue args, JSIValue jsiValue) +{ + if (JSI::ValueIsUndefined(args)) { + return; + } + JSIValue success = JSI::GetNamedProperty(args, CB_SUCCESS); + JSIValue complete = JSI::GetNamedProperty(args, CB_COMPLETE); + if (!JSI::ValueIsUndefined(success)) { + if (JSI::ValueIsUndefined(jsiValue)) { + JSI::CallFunction(success, thisVal, nullptr, 0); + } else { + JSI::CallFunction(success, thisVal, &jsiValue, ARGC_ONE); + } + } + if (!JSI::ValueIsUndefined(complete)) { + JSI::CallFunction(complete, thisVal, nullptr, 0); + } + JSI::ReleaseValueList(success, complete, ARGS_END); +} + +JSIValue DisplayModule::SetKeepScreenOn(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +{ + int ret = DISPLAY_NOT_SUPPORT; +#if defined(SUPPORT_POWER_MANAGER) + errcode_t result; + bool keepScreenOn = JSI::GetBooleanProperty(args[0], KEEPSCREENON); + const power_display_svr_api_t *display_api = power_display_svr_get_api(); + if (keepScreenOn) { + screen_context_t * curScreenCtx = power_display_get_screen_context(); + g_keepOnTimeout = curScreenCtx->keep_on_timeout; + if (display_api->get_screen_state() != SCREEN_ON) { + display_api->turn_on_screen(); + } + result = display_api->set_screen_set_keepon_timeout(3600000); // 3600000ms + } else { + result = display_api->set_screen_set_keepon_timeout(g_keepOnTimeout); + } + if (result == ERRCODE_SUCC) { + ret = DISPLAY_SUCCESS; + } + else { + ret = DISPLAY_FAIL; + } +#endif + if (ret == DISPLAY_SUCCESS) { + SuccessCallBack(thisVal, args[0], JSI::CreateUndefined()); + } else { + FailCallBack(thisVal, args[0], ret); + } + return JSI::CreateUndefined(); +} +void InitBrightnessModule(JSIValue exports) +{ + JSI::SetModuleAPI(exports, "setKeepScreenOn", DisplayModule::SetKeepScreenOn); +} +} // namespace ACELite +} // namespace OHOS \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.h new file mode 100644 index 000000000..387495535 --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/display/display.h @@ -0,0 +1,40 @@ +/* +* Copyright (c) CompanyNameMagicTag. 2024-2024. All rights reserved. +* Description: display control interfaces +* Author: Software Group +* Create: 2024-04-03 +*/ + +#ifndef DISPLAY_MODULE_H +#define DISPLAY_MODULE_H + +#include +#include "jsi.h" + +namespace OHOS { +namespace ACELite { +class DisplayModule final : public MemoryHeap { +public: + /** + * constructor + */ + DisplayModule() = default; + + /** + * desconstructor + */ + ~DisplayModule() = default; + + /** + * Display interface + */ + static JSIValue SetKeepScreenOn(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + +}; + +void InitBrightnessModule(JSIValue exports); +} // namespace ACELite +} // namespace OHOS + +#endif // DISPLAY_MODULE_H + diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/ohos_module_config.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/ohos_module_config.h index 4ab2f81b0..e6f4df9f8 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/ohos_module_config.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/ohos_module_config.h @@ -33,6 +33,7 @@ extern void InitAppModule(JSIValue exports); #ifdef FEATURE_MODULE_AUDIO extern void InitAudioModule(JSIValue exports); extern void InitAudioCaptuerModule(JSIValue exports); +extern void InitBaiduMapComponentModule(JSIValue exports); #endif // FEATURE_MODULE_AUDIO #ifdef FEATURE_ACELITE_DFX_MODULE extern void InitDfxModule(JSIValue exports); @@ -44,10 +45,10 @@ extern void InitDfxModule(JSIValue exports); // extern void InitDialogModule(JSIValue exports); // #endif // FEATURE_MODULE_DIALOG -// #ifdef FEATURE_MODULE_STORAGE -// extern void InitNativeApiFs(JSIValue exports); -// extern void InitNativeApiKv(JSIValue exports); -// #endif +#ifdef FEATURE_MODULE_STORAGE +extern void InitNativeApiFs(JSIValue exports); +extern void InitNativeApiKv(JSIValue exports); +#endif // #ifdef FEATURE_MODULE_DEVICE // extern void InitDeviceModule(JSIValue exports); @@ -62,9 +63,9 @@ extern void InitDfxModule(JSIValue exports); // extern void InitSensorModule(JSIValue exports); // #endif -// #ifdef FEATURE_MODULE_BRIGHTNESS -// extern void InitBrightnessModule(JSIValue exports); -// #endif +#ifdef FEATURE_MODULE_BRIGHTNESS +extern void InitBrightnessModule(JSIValue exports); +#endif // #ifdef FEATURE_MODULE_BATTERY // extern void InitBatteryModule(JSIValue exports); @@ -87,6 +88,9 @@ const Module OHOS_MODULES[] = { #ifdef FEATURE_MODULE_AUDIO {"audio", InitAudioModule}, {"audiocaptuer", InitAudioCaptuerModule}, +#endif +#ifdef FEATURE_MODULE_BAIDU + {"baidumapcomponent",InitBaiduMapComponentModule}, #endif // FEATURE_MODULE_AUDIO #ifdef FEATURE_MODULE_MESSAGE_CENTER {"message", InitMsgCenter}, @@ -102,10 +106,10 @@ const Module OHOS_MODULES[] = { // {"prompt", InitDialogModule}, // #endif // FEATURE_MODULE_DIALOG -// #ifdef FEATURE_MODULE_STORAGE -// {"file", InitNativeApiFs}, -// {"storage", InitNativeApiKv}, -// #endif +#ifdef FEATURE_MODULE_STORAGE + {"file", InitNativeApiFs}, + {"storage", InitNativeApiKv}, +#endif // #ifdef FEATURE_MODULE_DEVICE // {"device", InitDeviceModule}, // #endif @@ -116,9 +120,9 @@ const Module OHOS_MODULES[] = { // {"vibrator", InitVibratorModule}, // {"sensor", InitSensorModule}, // #endif -// #ifdef FEATURE_MODULE_BRIGHTNESS -// {"brightness", InitBrightnessModule}, -// #endif +#ifdef FEATURE_MODULE_BRIGHTNESS + {"brightness", InitBrightnessModule}, +#endif // #ifdef FEATURE_MODULE_BATTERY // {"battery", InitBatteryModule}, // #endif diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/app_data_module.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/app_data_module.cpp new file mode 100644 index 000000000..6966cf073 --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/app_data_module.cpp @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "app_data_module.h" + +#include "ace_log.h" +#include "js_ability_impl.h" +#include "js_app_context.h" +#include "js_fwk_common.h" + +namespace OHOS { +namespace ACELite { +const char * const AppDataModule::GETAPP_METHOD_NAME = "getApp"; +const char * const AppDataModule::GETAPP_DATA_STR = "data"; +void AppDataModule::Init() +{ + CreateNamedFunction(GETAPP_METHOD_NAME, GetApp); +} + +jerry_value_t AppDataModule::GetApp(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum) +{ + (void)func; + (void)context; + (void)args; + + if (argsNum != 0) { + return UNDEFINED; + } + + const JSAbilityImpl *abilityImpl = JsAppContext::GetInstance()->GetTopJSAbilityImpl(); + if (!abilityImpl) { + return UNDEFINED; + } + + jerry_value_t abilityVM = abilityImpl->GetAppVM(); // do not release here + if (IS_UNDEFINED(abilityVM)) { + return UNDEFINED; + } + + jerry_value_t dataObj = jerryx_get_property_str(abilityVM, GETAPP_DATA_STR); + if (IS_UNDEFINED(dataObj)) { + return UNDEFINED; + } + jerry_release_value(dataObj); + return abilityVM; +} +} // namespace ACELite +} // namespace OHOS diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/app_data_module.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/app_data_module.h new file mode 100644 index 000000000..dfba14ddb --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/presets/app_data_module.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef OHOS_ACELITE_APP_DATA_MODULE_H +#define OHOS_ACELITE_APP_DATA_MODULE_H + +#include "acelite_config.h" +#include "js_config.h" +#include "non_copyable.h" +#include "presets/preset_module.h" + +namespace OHOS { +namespace ACELite { +class AppDataModule final : public PresetModule { +public: + ACE_DISALLOW_COPY_AND_MOVE(AppDataModule); + + /** + * @fn AppDataModule::AppDataModule() + * + * @brief Constructor. + */ + AppDataModule() : PresetModule(nullptr) {} + + /** + * @fn AppDataModule::~AppDataModule() + * + * @brief Constructor. + */ + ~AppDataModule() = default; + + static void Load() + { + AppDataModule appDataModule; + appDataModule.Init(); + } + + void Init() override; + +private: + static jerry_value_t GetApp(const jerry_value_t func, + const jerry_value_t context, + const jerry_value_t args[], + const jerry_length_t argsNum); + static const char * const GETAPP_METHOD_NAME; + static const char * const GETAPP_DATA_STR; +}; +} // namespace ACELite +} // namespace OHOS +#endif // OHOS_ACELITE_APP_DATA_MODULE_H diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/CMakeLists.txt index 9f1b335fc..82a382278 100755 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/CMakeLists.txt @@ -16,6 +16,8 @@ set(PUBLIC_HEADER set(PRIVATE_HEADER ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/base + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/frameworks/resmgr_lite/include + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/interfaces/innerkits/include ${ROOT_DIR}/application/wearable/ohos_deps ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include @@ -102,3 +104,89 @@ install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/extcmd/include" "*") build_component() +set(COMPONENT_NAME "bms_sign_mode") +set(MODULE_NAME "ohos") +set(AUTO_DEF_FILE_ID TRUE) + +set(PUBLIC_HEADER + ${CMAKE_CURRENT_SOURCE_DIR}/include/appexecfwk/appexecfwk_lite/frameworks/bundle_lite/include + ${CMAKE_CURRENT_SOURCE_DIR}/include/appexecfwk/appexecfwk_lite/interfaces/innerkits/bundlemgr_lite + ${CMAKE_CURRENT_SOURCE_DIR}/include/appexecfwk/appexecfwk_lite/interfaces/innerkits/bundlemgr_lite/slite + ${CMAKE_CURRENT_SOURCE_DIR}/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite + ${CMAKE_CURRENT_SOURCE_DIR}/include/appexecfwk/appexecfwk_lite/interfaces/kits/bundle_lite/slite + ${CMAKE_CURRENT_SOURCE_DIR}/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include + ${CMAKE_CURRENT_SOURCE_DIR}/include/appexecfwk/appexecfwk_lite/utils + ${CMAKE_CURRENT_SOURCE_DIR}/include/appexecfwk/appexecfwk_lite/utils/bundle_lite + ${CMAKE_CURRENT_SOURCE_DIR}/extcmd/include +) + +set(PRIVATE_HEADER + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/base + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/frameworks/resmgr_lite/include + ${ROOT_DIR}/open_source/openharmony/base/global/resmgr_lite/interfaces/innerkits/include + ${ROOT_DIR}/application/wearable/ohos_deps + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include + ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/include/service + ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits + ${ROOT_DIR}/open_source/openharmony/third_party/cJSON + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/innerkits + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits +) + +if("__LITEOS__" IN_LIST DEFINES) +elseif ("__FREERTOS__" IN_LIST DEFINES) + set(PRIVATE_HEADER + ${PRIVATE_HEADER} + ${ROOT_DIR}/middleware/services/utils/fs/include/freertos_adapt + ) +endif() + +if("JS_ENABLE" IN_LIST DEFINES) +set(SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/bundlems/sign_mode.cpp +) +endif() + +set(COMPONENT_PUBLIC_CCFLAGS +) + +set(COMPONENT_CCFLAGS + -std=c++11 + -Wno-error + -Wno-unused-parameter + -fno-exceptions + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -Wno-undef + -Wno-bitwise-op-parentheses + -Wno-shift-op-parentheses + -nostdlibinc + -nostdinc + -nostdlib + -Wno-c++11-narrowing + -Wno-error=unused-function +) + + +set(WHOLE_LINK + true +) + +set(MAIN_COMPONENT + false +) + +set(PUBLIC_DEFINES +) + +set(PRIVATE_DEFINES + APP_PLATFORM_WATCHGT + OHOS_DEBUG + JERRY_FOR_IAR_CONFIG +) + +install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/include" "*") +install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/extcmd/include" "*") + +build_component() \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js/libbms.a index 638859b9a..e49a9a0e0 100755 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-native-js/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a index c36aac3e4..fd2e7606b 100755 Binary files a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a and b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/brandy-xts/libbms.a differ diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/bundlems/sign_mode.cpp b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/bundlems/sign_mode.cpp new file mode 100644 index 000000000..df1e672c4 --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/bundlems/sign_mode.cpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "sign_mode.h" + +#include "ability_info_utils.h" +#include "ability_message_id.h" +#include "appexecfwk_errors.h" +#include "bundle_common.h" +#include "bundle_message_id.h" +#include "bundle_util.h" +#include "bundlems_log.h" +#include "cmsis_os2.h" +#include "dirent.h" +#include "fcntl.h" +#include "gt_bundle_extractor.h" +#include "gt_bundle_parser.h" +#include "gt_extractor_util.h" + +#include "los_tick.h" +#include "stdio.h" +#include "sys/stat.h" +#include "unistd.h" +#include "utils.h" +#include "want.h" + +#include "generate-bytecode.h" + +namespace OHOS { + +#ifdef OHOS_DEBUG +bool SignMode::isSignMode_ = true; + +uint8_t SignMode::SetSignMode(bool enable) +{ + isSignMode_ = enable; + return ERR_OK; +} + +bool SignMode::IsSignMode() +{ + return isSignMode_; +} +#endif +} // namespace OHOS diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h index f619d4f72..d9f5eec50 100755 --- a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/gt_bundle_manager_service.h @@ -83,10 +83,6 @@ public: PreAppList *InitPreAppInfo(void); void InsertPreAppInfo(const char *filePath, PreAppList *list); void SetPreAppInfo(PreAppList *list); -#ifdef OHOS_DEBUG - uint8_t SetSignMode(bool enable); - bool IsSignMode() const; -#endif private: GtManagerService(); ~GtManagerService(); @@ -121,9 +117,6 @@ private: PreAppList *preAppList_; bool updateFlag_; int32_t oldVersionCode_; -#ifdef OHOS_DEBUG - bool isSignMode_ { true }; -#endif }; } diff --git a/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/sign_mode.h b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/sign_mode.h new file mode 100644 index 000000000..6ce1a2770 --- /dev/null +++ b/code/sdk/open_source/openharmony/foundation/appexecfwk/appexecfwk_lite/include/appexecfwk/appexecfwk_lite/services/bundlemgr_lite/include/sign_mode.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef SIGN_MODE_H +#define SIGN_MODE_H + +#include "adapter.h" +#include "bundle_info.h" +#include "bundle_map.h" +#include "cJSON.h" +#include "gt_bundle_installer.h" +#include "stdint.h" +#include "want.h" +#include "install_param.h" +#include "bundle_install_msg.h" +#include "bundle_manager.h" +#include "los_list.h" +#include "ohos_types.h" + +namespace OHOS { + +class SignMode { +public: + static SignMode& GetInstance() { + static SignMode instance; + return instance; + } +#ifdef OHOS_DEBUG + static uint8_t SetSignMode(bool enable); + static bool IsSignMode(); +#endif + +private: + SignMode() = default; + ~SignMode() = default; + static bool isSignMode_; +}; + +} // namespace OHOS + +#endif // SIGN_MODE_H \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/foundation/distributedschedule/samgr_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/foundation/distributedschedule/samgr_lite/CMakeLists.txt index a49694b68..e0740bbc7 100755 --- a/code/sdk/open_source/openharmony/foundation/distributedschedule/samgr_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/foundation/distributedschedule/samgr_lite/CMakeLists.txt @@ -8,13 +8,13 @@ set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/kits/communication/broadcast ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/kits/registry ${CMAKE_CURRENT_SOURCE_DIR}/interfaces/kits/samgr - ${CMAKE_CURRENT_SOURCE_DIR}/services/samgr/dependency - ${CMAKE_CURRENT_SOURCE_DIR}/services/samgr/registry ) set(PRIVATE_HEADER ${ROOT_DIR}/application/wearable/ohos_deps ${ROOT_DIR}/open_source/openharmony/utils/native/lite/include + ${CMAKE_CURRENT_SOURCE_DIR}/services/samgr/dependency + ${CMAKE_CURRENT_SOURCE_DIR}/services/samgr/registry ${PUBLIC_HEADER} ) diff --git a/code/sdk/open_source/openharmony/foundation/multimedia/player/interfaces/kits/player_lite/js/builtin/include/audio_module.h b/code/sdk/open_source/openharmony/foundation/multimedia/player/interfaces/kits/player_lite/js/builtin/include/audio_module.h index c4b2f13d2..23c96bbde 100755 --- a/code/sdk/open_source/openharmony/foundation/multimedia/player/interfaces/kits/player_lite/js/builtin/include/audio_module.h +++ b/code/sdk/open_source/openharmony/foundation/multimedia/player/interfaces/kits/player_lite/js/builtin/include/audio_module.h @@ -115,6 +115,15 @@ public: */ static JSIValue SrcGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + /** + * the getter of audio srcInner property + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSIValue SrcInnerGetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + /** * the setter of audio src property * @@ -124,6 +133,15 @@ public: */ static JSIValue SrcSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + /** + * the setter of audio srcInner property + * + * @param thisVal Indicates function execute context + * @param args Indicates the function arguments + * @param argsSize Indicates the size of function arguments + */ + static JSIValue SrcInnerSetter(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + /** * the getter of audio currentTime property * diff --git a/code/sdk/open_source/openharmony/foundation/multimedia/player/interfaces/kits/player_lite/js/builtin/include/audio_player.h b/code/sdk/open_source/openharmony/foundation/multimedia/player/interfaces/kits/player_lite/js/builtin/include/audio_player.h index 3b71da894..30105485e 100755 --- a/code/sdk/open_source/openharmony/foundation/multimedia/player/interfaces/kits/player_lite/js/builtin/include/audio_player.h +++ b/code/sdk/open_source/openharmony/foundation/multimedia/player/interfaces/kits/player_lite/js/builtin/include/audio_player.h @@ -89,7 +89,7 @@ public: bool Stop(); - char *GetSrc() const; + char *GetSrc(bool innerFlag) const; double GetCurrentTime() const; @@ -107,7 +107,7 @@ public: bool IsPlaying() const; - bool SetSrc(char *src); + bool SetSrc(char *src, bool innerFlag); bool SetCurrentTime(double currentTime) const; @@ -159,6 +159,7 @@ private: static MediaMutexHandle lock_; static MediaThreadCondHandle condition_; static void *UpdateTimeHandler(void *arg); + static int GetSrcInnerPrefix(char *src, char *dest); Media::Player *player_; std::shared_ptr callback_; @@ -170,11 +171,13 @@ private: AudioEventListener *onErrorListener_; AudioEventListener *onTimeUpdateListener_; char *src_; + char *srcInner_; char *status_; double volume_; bool autoPlay_; bool muted_; bool isRunning_; + bool isSysSrc_; MediaThreadIdHandle updateTimeProcess_; }; } // namespace ACELite diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/CMakeLists.txt b/code/sdk/open_source/openharmony/third_party/jerryscript/CMakeLists.txt index 8f557e3b1..0648d1d11 100755 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/CMakeLists.txt @@ -1,195 +1,253 @@ set(COMPONENT_NAME "jerryscript") set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR}/include/jerrycore - ${CMAKE_CURRENT_SOURCE_DIR}/include/jerryext - ${CMAKE_CURRENT_SOURCE_DIR}/include/jerrylibm - ${CMAKE_CURRENT_SOURCE_DIR}/include/jerryport - ${CMAKE_CURRENT_SOURCE_DIR}/include/jerryext/jerryscript-ext +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/api +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ext +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/include +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jmem +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jrt +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/lit +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/include +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/include/jerryscript-ext +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-port/default/include +# ${CMAKE_CURRENT_SOURCE_DIR}/jerry-libm/include + ${CMAKE_CURRENT_SOURCE_DIR}/include/jerry-core + ${CMAKE_CURRENT_SOURCE_DIR}/include/jerry-core/api + ${CMAKE_CURRENT_SOURCE_DIR}/include/jerry-core/ecma/base + ${CMAKE_CURRENT_SOURCE_DIR}/include/jerry-core/include + ${CMAKE_CURRENT_SOURCE_DIR}/include/jerry-core/jmem + ${CMAKE_CURRENT_SOURCE_DIR}/include/jerry-core/jrt + ${CMAKE_CURRENT_SOURCE_DIR}/include/jerry-core/lit + ${CMAKE_CURRENT_SOURCE_DIR}/include/jerry-ext/include/jerryscript-ext ) set(PRIVATE_HEADER ${ROOT_DIR}/application/wearable/ohos_deps - ${PUBLIC_HEADER} + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/debugger + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jcontext + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/regexp + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/vm + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/debugger + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/common + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/arg + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/handle-scope + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-port + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/api + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ext + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/include + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jmem + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jrt + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/lit + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/include + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/include/jerryscript-ext + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-port/default/include + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-libm/include ) if("JS_ENABLE" IN_LIST DEFINES) + set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/src/arg.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/arg-js-iterator-helper.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/arg-transform-functions.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/byte-code.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/common.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger-common.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger-rp.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger-serial.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger-sha1.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger-tcp.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/debugger-ws.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/default-date.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/default-debugger.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/default-external-context.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/default-fatal.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/default-io.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/default-module.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-alloc.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-arraybuffer-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-array-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-boolean-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-arraybuffer.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-arraybuffer-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-array.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-array-iterator-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-array-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-boolean.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-boolean-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-dataview.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-dataview-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-date.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-date-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-error.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-error-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-evalerror.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-evalerror-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-float32array.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-float32array-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-float64array.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-float64array-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-function.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-function-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-global.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-helpers.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-helpers-date.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-helpers-error.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-helpers-json.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-helpers-sort.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-int16array.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-int16array-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-int32array.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-int32array-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-int8array.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-int8array-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-iterator-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-json.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-map.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-map-iterator-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-map-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-math.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-number.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-number-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-object-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-promise.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-promise-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-rangeerror.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-rangeerror-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-referenceerror.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-referenceerror-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-regexp.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-regexp-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtins.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-set.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-set-iterator-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-set-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-string.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-string-iterator-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-string-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-symbol.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-symbol-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-syntaxerror.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-syntaxerror-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-typedarray.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-typedarray-helpers.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-typedarray-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-typeerror.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-typeerror-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-type-error-thrower.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-uint16array.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-uint16array-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-uint32array.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-uint32array-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-uint8array.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-uint8array-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-uint8clampedarray.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-uint8clampedarray-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-urierror.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-builtin-urierror-prototype.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-comparison.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-container-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-conversion.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-dataview-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-eval.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-exceptions.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-function-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-gc.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-get-put-value.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-helpers.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-helpers-collection.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-helpers-conversion.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-helpers-errol.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-helpers-external-pointers.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-helpers-number.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-helpers-string.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-helpers-value.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-init-finalize.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-iterator-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-jobqueue.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-lcache.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-lex-env.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-literal-storage.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-module.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-number-arithmetic.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-number-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-objects-arguments.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-objects.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-objects-general.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-promise-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-property-hashmap.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-reference.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-regexp-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-string-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-symbol-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/ecma-typedarray-object.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/generate-bytecode.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/handler-assert.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/handler-gc.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/handler-print.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/handler-register.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/handle-scope-allocator.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/handle-scope.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/jcontext.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/jerry.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/jerry-debugger.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/jerry-debugger-transport.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/jerry-snapshot.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/jmem-allocator.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/jmem-heap.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/jmem-poolman.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/jrt-fatals.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/js-lexer.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/js-parser.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/js-parser-expr.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/js-parser-mem.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/js-parser-module.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/js-parser-statm.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/js-parser-util.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/js-scanner.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/js-scanner-util.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/lit-char-helpers.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/lit-magic-strings.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/lit-strings.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/module.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/opcodes.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/opcodes-ecma-arithmetics.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/opcodes-ecma-bitwise.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/opcodes-ecma-relational-equality.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/re-bytecode.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/re-compiler.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/re-parser.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/vm.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/vm-stack.c - ${CMAKE_CURRENT_SOURCE_DIR}/src/vm-utils.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/api/jerry-debugger-transport.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/api/jerry-debugger.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/api/jerry-snapshot.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/api/jerry.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/debugger/debugger.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-alloc.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-gc.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-helpers-collection.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-helpers-conversion.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-helpers-errol.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-helpers-external-pointers.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-helpers-number.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-helpers-string.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-helpers-value.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-helpers.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-init-finalize.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-lcache.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-literal-storage.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-module.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/base/ecma-property-hashmap.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-array.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-date.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-error.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-function.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-generator.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-global.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-sort.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-json.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-map.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-math.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-number.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-set.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-string.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/ecma-builtins.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-array-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-arraybuffer-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-boolean-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-comparison.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-container-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-conversion.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-dataview-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-eval.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-exceptions.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-function-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-get-put-value.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-iterator-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-jobqueue.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-lex-env.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-number-arithmetic.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-number-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-objects-arguments.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-objects-general.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-objects.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-promise-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-proxy-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-reference.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-regexp-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-string-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-symbol-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ecma/operations/ecma-typedarray-object.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ext/ext-utils.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ext/heapdump.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/ext/tracker.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jcontext/jcontext.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jmem/jmem-allocator.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jmem/jmem-heap.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jmem/jmem-poolman.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/jrt/jrt-fatals.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/lit/lit-char-helpers.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/lit/lit-magic-strings.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/lit/lit-strings.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/byte-code.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/common.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-lexer.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-parser-expr.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-parser-mem.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-parser-module.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-parser-statm.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-parser-tagged-template-literal.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-parser-util.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-parser.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-scanner-ops.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-scanner-util.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/js/js-scanner.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/regexp/re-bytecode.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/regexp/re-compiler.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/parser/regexp/re-parser.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/vm/opcodes-ecma-arithmetics.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/vm/opcodes-ecma-bitwise.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/vm/opcodes-ecma-relational-equality.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/vm/opcodes.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/vm/vm-stack.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/vm/vm-utils.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-core/vm/vm.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/arg/arg-js-iterator-helper.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/arg/arg-transform-functions.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/arg/arg.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/debugger/debugger-common.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/debugger/debugger-rp.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/debugger/debugger-serial.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/debugger/debugger-sha1.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/debugger/debugger-tcp.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/debugger/debugger-ws.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/handle-scope/handle-scope-allocator.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/handle-scope/handle-scope.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/handler/handler-assert.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/handler/handler-gc.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/handler/handler-print.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/handler/handler-register.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/handler/handler-resource-name.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-ext/module/module.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-port/default/default-date.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-port/default/default-debugger.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-port/default/default-external-context.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-port/default/default-fatal.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-port/default/default-io.c + ${CMAKE_CURRENT_SOURCE_DIR}/jerry-port/default/default-module.c ) endif() @@ -223,54 +281,12 @@ set(PUBLIC_DEFINES ) set(PRIVATE_DEFINES + JERRY_GLOBAL_HEAP_SIZE=128 JERRY_ERROR_MESSAGES=1 JERRY_LINE_INFO=1 - JERRY_DEBUGGER=1 - JERRY_STACK_LIMIT=0 - JERRY_FOR_IAR_CONFIG JERRY_FUNCTION_NAME JERRY_FUNCTION_BACKTRACE - JERRY_GC_LIMIT=0 - JERRY_CPOINTER_32_BIT=0 - JERRY_EXTERNAL_CONTEXT=0 - JERRY_PARSER=1 - JERRY_LOGGING=0 - JERRY_MEM_GC_BEFORE_EACH_ALLOC=0 - JERRY_PARSER_DUMP_BYTE_CODE=0 - JERRY_ES2015=0 - JERRY_REGEXP_STRICT_MODE=0 - JERRY_REGEXP_DUMP_BYTE_CODE=0 - JERRY_SNAPSHOT_EXEC=1 - JERRY_SNAPSHOT_SAVE=1 - JERRY_SYSTEM_ALLOCATOR=0 - JERRY_VALGRIND=0 - JERRY_VM_EXEC_STOP=0 - CONFIG_FEATURE_OS_DEBUG=false - JERRYSCRIPT_MASK_OFF_ACOS - JERRYSCRIPT_MASK_OFF_ACOSH - JERRYSCRIPT_MASK_OFF_ASIN - JERRYSCRIPT_MASK_OFF_ASINH - JERRYSCRIPT_MASK_OFF_ATAN - JERRYSCRIPT_MASK_OFF_ATAN2 - JERRYSCRIPT_MASK_OFF_ATANH - JERRYSCRIPT_MASK_OFF_CBRT - JERRYSCRIPT_MASK_OFF_CEIL - JERRYSCRIPT_MASK_OFF_COSH - JERRYSCRIPT_MASK_OFF_EXP - JERRYSCRIPT_MASK_OFF_FABS - JERRYSCRIPT_MASK_OFF_FLOOR - JERRYSCRIPT_MASK_OFF_FMOD - JERRYSCRIPT_MASK_OFF_LOG - JERRYSCRIPT_MASK_OFF_LOG10 - JERRYSCRIPT_MASK_OFF_LOG2 - JERRYSCRIPT_MASK_OFF_POW - JERRYSCRIPT_MASK_OFF_SCALBN - JERRYSCRIPT_MASK_OFF_SINH - JERRYSCRIPT_MASK_OFF_SQRT - JERRYSCRIPT_MASK_OFF_TANH - JERRYSCRIPT_MASK_OFF_SIN - JERRYSCRIPT_MASK_OFF_COS - JERRYSCRIPT_MASK_OFF_TAN + JERRY_STACK_LIMIT=0 ) install_sdk_by_sh("${CMAKE_CURRENT_SOURCE_DIR}/include" "*") diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js/libjerryscript.a index 9c6dd5196..9d650b590 100755 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-native-js/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a index c738f1f46..fc64215d9 100755 Binary files a/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a and b/code/sdk/open_source/openharmony/third_party/jerryscript/brandy-xts/libjerryscript.a differ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/generate-bytecode.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/api/generate-bytecode.h old mode 100755 new mode 100644 similarity index 61% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/generate-bytecode.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/api/generate-bytecode.h index cc23d4bda..b33dbba7b --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/generate-bytecode.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/api/generate-bytecode.h @@ -7,32 +7,55 @@ #ifndef GENERATE_BYTECODE_H #define GENERATE_BYTECODE_H +#ifdef __cplusplus +extern "C" +{ +#endif /* __cplusplus */ + #ifdef JERRY_FOR_IAR_CONFIG +#include "jerryscript.h" +#include "jerry-snapshot.h" + typedef enum { EXCE_ACE_JERRY_EXEC_OK = 0, // program function OK EXCE_ACE_JERRY_NULL_PATH, // null path for generateing snapshot - EXEC_ACE_JERRY_MALLOC_ERROR, // error when malloc + EXCE_ACE_JERRY_MALLOC_ERROR, // error when malloc EXCE_ACE_JERRY_INPUT_PATH_ERROR, // passed input path is NULL OR open failed EXCE_ACE_JERRY_INPUT_PATH_NOT_DIR, // passed input path is not a directory EXCE_ACE_JERRY_OPEN_DIR_FAILED, // open directory failed EXCE_ACE_JERRY_GENERATE_SNAPSHOT_FAILED, // jerry_generate_snapshot failed EXCE_ACE_JERRY_OPEN_FILE_FAILED, // open file failed EXCE_ACE_JERRY_WRITE_SNAPSHOT_FILE_FAILED, // write into snapshot file failed - EXCE_ACE_JERRY_READ_JSFILE_FAILED, // read .js file process failed - EXCE_ACE_JERRY_JSFILE_TOO_LARGE, // bytes of js file out of psRAM + EXCE_ACE_JERRY_READ_FILE_FAILED, // read .js file or snapshot file process failed + EXCE_ACE_JERRY_FILE_TOO_LARGE, // bytes of js or snapshot file out of psRAM buffer size for them EXCE_ACE_JERRY_SPLICE_PATH_ERROR, // error when splice path EXCE_ACE_JERRY_SPLICE_OUTPUT_PATH_ERROR, // error when splice output file abs name EXCE_ACE_JERRY_SPRINTFS_VERSION_ERROR, // error when sprintf_s for jerry_version EXCE_ACE_JERRY_GET_FILE_STAT_ERROR, // error when getting file stat EXCE_ACE_JERRY_LINKLIST_ERROR, // error when malloc for list node - EXEC_ACE_JERRY_UNLINKFILE_ERROR, // error when unlink bytecode file + EXCE_ACE_JERRY_UNLINKFILE_ERROR, // error when unlink bytecode file + EXCE_ACE_JERRY_SNAPSHOT_VERSION_ERROR, // snapshot file version wrong } EXECRES; +typedef struct +{ + jerry_context_t *context_p; +} ContextRecord; + char* get_jerry_version_no(); EXECRES walk_directory(char* filefolder); EXECRES walk_del_bytecode(char* filefolder); -#endif // end JERRY_FOR_IAR_CONFIG +void bms_task_context_init (void); +void js_task_context_init (void); +void jerry_port_default_remove_current_context_record (); + +void jerry_external_context_init(uint32_t heap_size, jerry_context_alloc_t alloc, void *cb_data_p); + +#endif // JERRY_FOR_IAR_CONFIG +#ifdef __cplusplus +} +#endif /* __cplusplus */ #endif // GENERATE_BYTECODE_H diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerry-snapshot.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/api/jerry-snapshot.h old mode 100755 new mode 100644 similarity index 100% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerry-snapshot.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/api/jerry-snapshot.h diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/config.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/config.h old mode 100755 new mode 100644 similarity index 85% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/config.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/config.h index cf375a7c2..bae023347 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/config.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/config.h @@ -21,7 +21,7 @@ */ #if (!defined(_WIN32) && !defined(_WIN64)) -# define JERRY_BUILTIN_REGEXP 0 +# define JERRY_BUILTIN_REGEXP 1 # define JERRY_ES2015 0 #ifndef JERRY_NDEBUG # define JERRY_NDEBUG @@ -33,18 +33,25 @@ #ifndef JERRY_FOR_IAR_CONFIG # define JERRY_MEM_STATS 1 # define JERRY_LOGGING 1 -#endif +#endif /* JERRY_FOR_IAR_CONFIG */ #ifndef JERRY_GLOBAL_HEAP_SIZE //Maximum size of heap in kilobytes -# define JERRY_GLOBAL_HEAP_SIZE (48) +# define JERRY_GLOBAL_HEAP_SIZE (128) #endif #ifndef JERRY_BUILTIN_EVAL_DISABLED // disable builtin eval() function # define JERRY_BUILTIN_EVAL_DISABLED 1 #endif -#endif /* JERRY_FOR_IAR_CONFIG */ + +#if defined (__linux__) +#ifndef JERRY_SNAPSHOT_SAVE +# define JERRY_SNAPSHOT_SAVE 1 +#endif +#endif /* binary tool compiling in linux platform */ + +#endif /* !defined(_WIN32) && !defined(_WIN64) */ /* * Here define the special config for Win simulator build. @@ -64,9 +71,9 @@ # define JERRY_MEM_STATS 1 # define JERRY_SNAPSHOT_EXEC 1 # define JERRY_SNAPSHOT_SAVE 1 -# ifndef JERRY_LOGGING -# define JERRY_LOGGING 1 -# endif +#ifndef JERRY_LOGGING +# define JERRY_LOGGING 1 +#endif // following config controls temp changes in jerry for debugger function with IDE # define ACE_DEBUGGER_CUSTOM @@ -144,18 +151,10 @@ # define JERRY_ES2015 1 #endif /* !defined (JERRY_ES2015) */ -#ifndef JERRY_ES2015_BUILTIN -# define JERRY_ES2015_BUILTIN JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_BUILTIN) */ - #ifndef JERRY_ES2015_BUILTIN_DATAVIEW # define JERRY_ES2015_BUILTIN_DATAVIEW JERRY_ES2015 #endif /* !defined (JERRY_ES2015_BUILTIN_DATAVIEW) */ -#ifndef JERRY_ES2015_BUILTIN_ITERATOR -# define JERRY_ES2015_BUILTIN_ITERATOR JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_BUILTIN_ITERATOR) */ - #ifndef JERRY_ES2015_BUILTIN_MAP # define JERRY_ES2015_BUILTIN_MAP JERRY_ES2015 #endif /* !defined (JERRY_ES2015_BUILTIN_MAP) */ @@ -164,50 +163,34 @@ # define JERRY_ES2015_BUILTIN_SET JERRY_ES2015 #endif /* !defined (JERRY_ES2015_BUILTIN_SET) */ +#ifndef JERRY_ES2015_BUILTIN_WEAKMAP +# define JERRY_ES2015_BUILTIN_WEAKMAP JERRY_ES2015 +#endif /* !defined (JERRY_ES2015_BUILTIN_WEAKMAP) */ + +#ifndef JERRY_ES2015_BUILTIN_WEAKSET +# define JERRY_ES2015_BUILTIN_WEAKSET JERRY_ES2015 +#endif /* !defined (JERRY_ES2015_BUILTIN_WEAKSET) */ + #ifndef JERRY_ES2015_BUILTIN_PROMISE # define JERRY_ES2015_BUILTIN_PROMISE JERRY_ES2015 #endif /* !defined (JERRY_ES2015_BUILTIN_PROMISE) */ -#ifndef JERRY_ES2015_BUILTIN_SYMBOL -# define JERRY_ES2015_BUILTIN_SYMBOL JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_BUILTIN_SYMBOL) */ +#ifndef JERRY_ES2015_BUILTIN_PROXY +# define JERRY_ES2015_BUILTIN_PROXY JERRY_ES2015 +#endif /* !defined (JERRY_ES2015_BUILTIN_PROXY) */ + +#ifndef JERRY_ES2015_BUILTIN_REFLECT +# define JERRY_ES2015_BUILTIN_REFLECT JERRY_ES2015 +#endif /* !defined (JERRY_ES2015_BUILTIN_REFLECT) */ #ifndef JERRY_ES2015_BUILTIN_TYPEDARRAY # define JERRY_ES2015_BUILTIN_TYPEDARRAY JERRY_ES2015 #endif /* !defined (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ -#ifndef JERRY_ES2015_ARROW_FUNCTION -# define JERRY_ES2015_ARROW_FUNCTION JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_ARROW_FUNCTION) */ - -#ifndef JERRY_ES2015_CLASS -# define JERRY_ES2015_CLASS JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_CLASS) */ - -#ifndef JERRY_ES2015_FOR_OF -# define JERRY_ES2015_FOR_OF JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_FOR_OF) */ - -#ifndef JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER -# define JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) */ - -#ifndef JERRY_ES2015_FUNCTION_REST_PARAMETER -# define JERRY_ES2015_FUNCTION_REST_PARAMETER JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_FUNCTION_REST_PARAMETER) */ - -#ifndef JERRY_ES2015_OBJECT_INITIALIZER -# define JERRY_ES2015_OBJECT_INITIALIZER JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_OBJECT_INITIALIZER) */ - #ifndef JERRY_ES2015_MODULE_SYSTEM # define JERRY_ES2015_MODULE_SYSTEM JERRY_ES2015 #endif /* !defined (JERRY_ES2015_MODULE_SYSTEM) */ -#ifndef JERRY_ES2015_TEMPLATE_STRINGS -# define JERRY_ES2015_TEMPLATE_STRINGS JERRY_ES2015 -#endif /* !defined (JERRY_ES2015_TEMPLATE_STRINGS) */ - /** * Engine internal and misc configurations. */ @@ -294,6 +277,15 @@ # define JERRY_STACK_LIMIT (0) #endif /* !defined (JERRY_STACK_LIMIT) */ +/** + * Maximum depth of recursion during GC mark phase + * + * Default value: 8 + */ +#ifndef JERRY_GC_MARK_LIMIT +# define JERRY_GC_MARK_LIMIT (8) +#endif /* !defined (JERRY_GC_MARK_LIMIT) */ + /** * Enable/Disable property lookup cache. * @@ -539,7 +531,6 @@ # define JERRY_ATTR_GLOBAL_HEAP #endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */ - /** * Sanity check for macros to see if the values are 0 or 1 * @@ -600,18 +591,6 @@ || ((JERRY_ES2015 != 0) && (JERRY_ES2015 != 1)) # error "Invalid value for JERRY_ES2015 macro." #endif -#if !defined (JERRY_ES2015_ARROW_FUNCTION) \ -|| ((JERRY_ES2015_ARROW_FUNCTION != 0) && (JERRY_ES2015_ARROW_FUNCTION != 1)) -# error "Invalid value for JERRY_ES2015_ARROW_FUNCTION macro." -#endif -#if !defined (JERRY_ES2015_BUILTIN) \ -|| ((JERRY_ES2015_BUILTIN != 0) && (JERRY_ES2015_BUILTIN != 1)) -# error "Invalid value for JERRY_ES2015_BUILTIN macro." -#endif -#if !defined (JERRY_ES2015_BUILTIN_ITERATOR) \ -|| ((JERRY_ES2015_BUILTIN_ITERATOR != 0) && (JERRY_ES2015_BUILTIN_ITERATOR != 1)) -# error "Invalid value for JERRY_ES2015_BUILTIN_ITERATOR macro." -#endif #if !defined (JERRY_ES2015_BUILTIN_DATAVIEW) \ || ((JERRY_ES2015_BUILTIN_DATAVIEW != 0) && (JERRY_ES2015_BUILTIN_DATAVIEW != 1)) # error "Invalid value for JERRY_ES2015_BUILTIN_DATAVIEW macro." @@ -620,50 +599,38 @@ || ((JERRY_ES2015_BUILTIN_MAP != 0) && (JERRY_ES2015_BUILTIN_MAP != 1)) # error "Invalid value for JERRY_ES2015_BUILTIN_MAP macro." #endif +#if !defined (JERRY_ES2015_BUILTIN_REFLECT) \ +|| ((JERRY_ES2015_BUILTIN_REFLECT != 0) && (JERRY_ES2015_BUILTIN_REFLECT != 1)) +# error "Invalid value for JERRY_ES2015_BUILTIN_REFLECT macro." +#endif #if !defined (JERRY_ES2015_BUILTIN_SET) \ || ((JERRY_ES2015_BUILTIN_SET != 0) && (JERRY_ES2015_BUILTIN_SET != 1)) # error "Invalid value for JERRY_ES2015_BUILTIN_SET macro." #endif +#if !defined (JERRY_ES2015_BUILTIN_WEAKMAP) \ +|| ((JERRY_ES2015_BUILTIN_WEAKMAP != 0) && (JERRY_ES2015_BUILTIN_WEAKMAP != 1)) +# error "Invalid value for JERRY_ES2015_BUILTIN_WEAKMAP macro." +#endif +#if !defined (JERRY_ES2015_BUILTIN_WEAKSET) \ +|| ((JERRY_ES2015_BUILTIN_WEAKSET != 0) && (JERRY_ES2015_BUILTIN_WEAKSET != 1)) +# error "Invalid value for JERRY_ES2015_BUILTIN_WEAKSET macro." +#endif #if !defined (JERRY_ES2015_BUILTIN_PROMISE) \ || ((JERRY_ES2015_BUILTIN_PROMISE != 0) && (JERRY_ES2015_BUILTIN_PROMISE != 1)) # error "Invalid value for JERRY_ES2015_BUILTIN_PROMISE macro." #endif -#if !defined (JERRY_ES2015_BUILTIN_SYMBOL) \ -|| ((JERRY_ES2015_BUILTIN_SYMBOL != 0) && (JERRY_ES2015_BUILTIN_SYMBOL != 1)) -# error "Invalid value for JERRY_ES2015_BUILTIN_SYMBOL macro." +#if !defined (JERRY_ES2015_BUILTIN_PROXY) \ +|| ((JERRY_ES2015_BUILTIN_PROXY != 0) && (JERRY_ES2015_BUILTIN_PROXY != 1)) +# error "Invalid value for JERRY_ES2015_BUILTIN_PROXY macro." #endif #if !defined (JERRY_ES2015_BUILTIN_TYPEDARRAY) \ || ((JERRY_ES2015_BUILTIN_TYPEDARRAY != 0) && (JERRY_ES2015_BUILTIN_TYPEDARRAY != 1)) # error "Invalid value for JERRY_ES2015_BUILTIN_TYPEDARRAY macro." #endif -#if !defined (JERRY_ES2015_CLASS) \ -|| ((JERRY_ES2015_CLASS != 0) && (JERRY_ES2015_CLASS != 1)) -# error "Invalid value for JERRY_ES2015_CLASS macro." -#endif -#if !defined (JERRY_ES2015_FOR_OF) \ -|| ((JERRY_ES2015_FOR_OF != 0) && (JERRY_ES2015_FOR_OF != 1)) -# error "Invalid value for JERRY_ES2015_FOR_OF macro." -#endif -#if !defined (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) \ -|| ((JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER != 0) && (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER != 1)) -# error "Invalid value for JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER macro." -#endif -#if !defined (JERRY_ES2015_FUNCTION_REST_PARAMETER) \ -|| ((JERRY_ES2015_FUNCTION_REST_PARAMETER != 0) && (JERRY_ES2015_FUNCTION_REST_PARAMETER != 1)) -# error "Invalid value for JERRY_ES2015_FUNCTION_REST_PARAMETER macro." -#endif -#if !defined (JERRY_ES2015_OBJECT_INITIALIZER) \ -|| ((JERRY_ES2015_OBJECT_INITIALIZER != 0) && (JERRY_ES2015_OBJECT_INITIALIZER != 1)) -# error "Invalid value for JERRY_ES2015_OBJECT_INITIALIZER macro." -#endif #if !defined (JERRY_ES2015_MODULE_SYSTEM) \ || ((JERRY_ES2015_MODULE_SYSTEM != 0) && (JERRY_ES2015_MODULE_SYSTEM != 1)) # error "Invalid value for JERRY_ES2015_MODULE_SYSTEM macro." #endif -#if !defined (JERRY_ES2015_TEMPLATE_STRINGS) \ -|| ((JERRY_ES2015_TEMPLATE_STRINGS != 0) && (JERRY_ES2015_TEMPLATE_STRINGS != 1)) -# error "Invalid value for JERRY_ES2015_TEMPLATE_STRINGS macro." -#endif /** * Internal options. @@ -693,6 +660,9 @@ #if !defined (JERRY_STACK_LIMIT) || (JERRY_STACK_LIMIT < 0) # error "Invalid value for 'JERRY_STACK_LIMIT' macro." #endif +#if !defined (JERRY_GC_MARK_LIMIT) || (JERRY_GC_MARK_LIMIT < 0) +# error "Invalid value for 'JERRY_GC_MARK_LIMIT' macro." +#endif #if !defined (JERRY_LCACHE) \ || ((JERRY_LCACHE != 0) && (JERRY_LCACHE != 1)) # error "Invalid value for 'JERRY_LCACHE' macro." @@ -762,7 +732,6 @@ # error "Invalid value for 'JERRY_VM_EXEC_STOP' macro." #endif - #define ENABLED(FEATURE) ((FEATURE) == 1) #define DISABLED(FEATURE) ((FEATURE) != 1) @@ -777,4 +746,14 @@ # error "Date does not support float32" #endif +/** + * Wrap container types into a single guard + */ +#if ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) \ +|| ENABLED (JERRY_ES2015_BUILTIN_WEAKMAP) || ENABLED (JERRY_ES2015_BUILTIN_WEAKSET) +# define JERRY_ES2015_BUILTIN_CONTAINER 1 +#else +# define JERRY_ES2015_BUILTIN_CONTAINER 0 +#endif + #endif /* !JERRYSCRIPT_CONFIG_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-globals.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/ecma/base/ecma-globals.h old mode 100755 new mode 100644 similarity index 82% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-globals.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/ecma/base/ecma-globals.h index aa55b2ee6..d5a117aef --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-globals.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/ecma/base/ecma-globals.h @@ -36,6 +36,15 @@ */ #define ECMA_NULL_POINTER JMEM_CP_NULL +#if defined (JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY) + +/** + * JMEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t + */ +#define ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY + +#endif /* JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY */ + /** * @} */ @@ -62,6 +71,7 @@ typedef enum ECMA_STATUS_HIGH_PRESSURE_GC = (1u << 2), /**< last gc was under high pressure */ #endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */ ECMA_STATUS_EXCEPTION = (1u << 3), /**< last exception is a normal exception */ + ECMA_STATUS_ABORT = (1u << 4), /**< last exception is an abort */ } ecma_status_flag_t; /** @@ -88,23 +98,37 @@ typedef enum #endif /* ENABLED (JERRY_DEBUGGER) */ /** - * Option flags for script parsing. + * Option flags for parser_parse_script and internal flags for global_status_flags in parser context. * Note: - * The enum members must be kept in sync with parser_general_flags_t - * The last 16 bits are reserved for scope chain index + * the last 16 bits is reserved for internal parser flags, because the debugger uses these + * 16 bits to encode the scope chain skip index as well (see ECMA_PARSE_CHAIN_INDEX_SHIFT) */ typedef enum { ECMA_PARSE_NO_OPTS = 0, /**< no options passed */ - ECMA_PARSE_STRICT_MODE = (1u << 0), /**< enable strict mode */ - ECMA_PARSE_DIRECT_EVAL = (1u << 1), /**< eval is called directly (ECMA-262 v5, 15.1.2.1.1) */ - /* These four status flags must be in this order. See PARSER_CLASS_PARSE_OPTS_OFFSET. */ - ECMA_PARSE_CLASS_CONSTRUCTOR = (1u << 2), /**< a class constructor is being parsed (this value must be kept in - * in sync with PARSER_CLASS_CONSTRUCTOR) */ - ECMA_PARSE_HAS_SUPER = (1u << 3), /**< the current context has super reference */ - ECMA_PARSE_HAS_IMPL_SUPER = (1u << 4), /**< the current context has implicit parent class */ - ECMA_PARSE_HAS_STATIC_SUPER = (1u << 5), /**< the current context is a static class method */ - ECMA_PARSE_EVAL = (1u << 6), /**< eval is called */ + ECMA_PARSE_STRICT_MODE = (1u << 0), /**< enable strict mode, must be same as PARSER_IS_STRICT */ + ECMA_PARSE_MODULE = (1u << 1), /**< module is parsed */ + ECMA_PARSE_EVAL = (1u << 2), /**< eval is called */ + ECMA_PARSE_DIRECT_EVAL = (1u << 3), /**< eval is called directly (ECMA-262 v5, 15.1.2.1.1) */ + ECMA_PARSE_CLASS_CONSTRUCTOR = (1u << 4), /**< a class constructor is being parsed */ + + /* These four status flags must be in this order. The first three are also parser status flags. + * See PARSER_SAVE_STATUS_FLAGS / PARSER_RESTORE_STATUS_FLAGS. */ + ECMA_PARSE_ALLOW_SUPER = (1u << 5), /**< allow super property access */ + ECMA_PARSE_ALLOW_SUPER_CALL = (1u << 6), /**< allow super constructor call */ + ECMA_PARSE_ALLOW_NEW_TARGET = (1u << 7), /**< allow new.target access */ + ECMA_PARSE_FUNCTION_CONTEXT = (1u << 8), /**< function context is present (ECMA_PARSE_DIRECT_EVAL must be set) */ + + ECMA_PARSE_GENERATOR_FUNCTION = (1u << 9), /**< generator function is parsed */ + + /* These flags are internally used by the parser. */ +#ifndef JERRY_NDEBUG + /** + * This flag represents an error in for in/of statements, which cannot be set + * if the parsing is completed successfully. + */ + ECMA_PARSE_INTERNAL_FOR_IN_OFF_CONTEXT_ERROR = (1u << 30), +#endif /* !JERRY_NDEBUG */ } ecma_parse_opts_t; /** @@ -119,15 +143,6 @@ typedef uint32_t ecma_value_t; */ typedef int32_t ecma_integer_value_t; -#if UINTPTR_MAX <= UINT32_MAX - -/** - * JMEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t - */ -#define ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY - -#endif /* UINTPTR_MAX <= UINT32_MAX */ - /** * Mask for ecma types in ecma_value_t */ @@ -187,7 +202,11 @@ enum * ecma_op_object_find */ ECMA_VALUE_REGISTER_REF = ECMA_MAKE_VALUE (8), /**< register reference, * a special "base" value for vm */ - ECMA_VALUE_IMPLICIT_CONSTRUCTOR = ECMA_MAKE_VALUE (9), /**< special value for bound class constructors */ + ECMA_VALUE_RELEASE_LEX_ENV = ECMA_MAKE_VALUE (9), /**< if this error remains on the stack when an exception occours + the top lexical environment of the VM frame should be popped */ + ECMA_VALUE_UNINITIALIZED = ECMA_MAKE_VALUE (10), /**< a special value for uninitialized let/const declarations */ + ECMA_VALUE_SPREAD_ELEMENT = ECMA_MAKE_VALUE (11), /**< a special value for spread elements in array initialization + * or function call argument list */ }; #if !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) @@ -327,10 +346,11 @@ typedef enum * that are not indices */ ECMA_LIST_ENUMERABLE = (1 << 1), /**< exclude non-enumerable properties */ ECMA_LIST_PROTOTYPE = (1 << 2), /**< list properties from prototype chain */ -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) - ECMA_LIST_SYMBOLS = (1 << 3), /**< list symbol properties only */ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - ECMA_LIST_CONVERT_FAST_ARRAYS = (1 << 4), /**< after listing the properties convert +#if ENABLED (JERRY_ES2015) + ECMA_LIST_SYMBOLS = (1 << 3), /**< list symbol properties */ + ECMA_LIST_SYMBOLS_ONLY = (1 << 4), /**< list symbol properties only */ +#endif /* ENABLED (JERRY_ES2015) */ + ECMA_LIST_CONVERT_FAST_ARRAYS = (1 << 5), /**< after listing the properties convert * the fast access mode array back to normal array */ } ecma_list_properties_options_t; @@ -390,6 +410,15 @@ typedef enum */ #define ECMA_PROPERTY_FIXED 0 +/** + * Default flag of length property. + */ +#if ENABLED (JERRY_ES2015) +#define ECMA_PROPERTY_FLAG_DEFAULT_LENGTH ECMA_PROPERTY_FLAG_CONFIGURABLE +#else /* !ENABLED (JERRY_ES2015) */ +#define ECMA_PROPERTY_FLAG_DEFAULT_LENGTH ECMA_PROPERTY_FIXED +#endif /* ENABLED (JERRY_ES2015) */ + /** * Shift for property name part. */ @@ -593,6 +622,7 @@ typedef enum ECMA_PROPERTY_GET_NO_OPTIONS = 0, /**< no option flags for ecma_op_object_get_property */ ECMA_PROPERTY_GET_VALUE = 1u << 0, /**< fill virtual_value field for virtual properties */ ECMA_PROPERTY_GET_EXT_REFERENCE = 1u << 1, /**< get extended reference to the property */ + ECMA_PROPERTY_GET_HAS_OWN_PROP = 1u << 2, /**< internal [[HasOwnProperty]] method */ } ecma_property_get_option_bits_t; /** @@ -602,15 +632,13 @@ typedef enum { ECMA_OBJECT_TYPE_GENERAL = 0, /**< all objects that are not belongs to the sub-types below. */ ECMA_OBJECT_TYPE_CLASS = 1, /**< Objects with class property */ - ECMA_OBJECT_TYPE_FUNCTION = 2, /**< Function objects (15.3), created through 13.2 routine */ - ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION = 3, /**< External (host) function object */ - ECMA_OBJECT_TYPE_ARRAY = 4, /**< Array object (15.4) */ - ECMA_OBJECT_TYPE_BOUND_FUNCTION = 5, /**< Function objects (15.3), created through 15.3.4.5 routine */ - ECMA_OBJECT_TYPE_PSEUDO_ARRAY = 6, /**< Array-like object, such as Arguments object (10.6) */ -#if ENABLED (JERRY_ES2015_ARROW_FUNCTION) - ECMA_OBJECT_TYPE_ARROW_FUNCTION = 7, /**< arrow function objects */ -#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */ - + ECMA_OBJECT_TYPE_ARRAY = 2, /**< Array object (15.4) */ + ECMA_OBJECT_TYPE_PSEUDO_ARRAY = 3, /**< Array-like object, such as Arguments object (10.6) */ + ECMA_OBJECT_TYPE_PROXY = 4, /**< Proxy object ECMAScript v6 26.2 */ + /* Note: these 4 types must be in this order. See IsCallable operation. */ + ECMA_OBJECT_TYPE_FUNCTION = 5, /**< Function objects (15.3), created through 13.2 routine */ + ECMA_OBJECT_TYPE_BOUND_FUNCTION = 6, /**< Function objects (15.3), created through 15.3.4.5 routine */ + ECMA_OBJECT_TYPE_EXTERNAL_FUNCTION = 7, /**< External (host) function object */ /* Types between 13-15 cannot have a built-in flag. See ecma_lexical_environment_type_t. */ ECMA_OBJECT_TYPE__MAX /**< maximum value */ @@ -641,15 +669,16 @@ typedef enum ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE = 13, /**< declarative lexical environment */ ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND = 14, /**< object-bound lexical environment * with provideThis flag */ - ECMA_LEXICAL_ENVIRONMENT_SUPER_OBJECT_BOUND = 15, /**< object-bound lexical environment - * with provided super reference */ + ECMA_LEXICAL_ENVIRONMENT_HOME_OBJECT_BOUND = 15, /**< object-bound lexical environment + * with provided home object reference */ ECMA_LEXICAL_ENVIRONMENT_TYPE_START = ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE, /**< first lexical * environment type */ - ECMA_LEXICAL_ENVIRONMENT_TYPE__MAX = ECMA_LEXICAL_ENVIRONMENT_SUPER_OBJECT_BOUND /**< maximum value */ + ECMA_LEXICAL_ENVIRONMENT_TYPE__MAX = ECMA_LEXICAL_ENVIRONMENT_HOME_OBJECT_BOUND /**< maximum value */ } ecma_lexical_environment_type_t; -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) +#if ENABLED (JERRY_ES2015) + /** * Types of array iterators. */ @@ -658,35 +687,37 @@ typedef enum ECMA_ITERATOR_KEYS, /**< List only key indices */ ECMA_ITERATOR_VALUES, /**< List only key values */ ECMA_ITERATOR_KEYS_VALUES, /**< List key indices and values */ -} ecma_iterator_type_t; -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ +} ecma_array_iterator_type_t; + +#endif /* ENABLED (JERRY_ES2015) */ /** * Offset for JERRY_CONTEXT (status_flags) top 8 bits. */ -#define ECMA_SUPER_EVAL_OPTS_OFFSET (32 - 8) +#define ECMA_LOCAL_PARSE_OPTS_OFFSET ((sizeof (uint32_t) - sizeof (uint8_t)) * JERRY_BITSINBYTE) /** * Set JERRY_CONTEXT (status_flags) top 8 bits to the specified 'opts'. */ -#define ECMA_SET_SUPER_EVAL_PARSER_OPTS(opts) \ +#define ECMA_SET_LOCAL_PARSE_OPTS(opts) \ do \ { \ - JERRY_CONTEXT (status_flags) |= ((uint32_t) opts << ECMA_SUPER_EVAL_OPTS_OFFSET) | ECMA_STATUS_DIRECT_EVAL; \ + JERRY_CONTEXT (status_flags) |= ((uint32_t) opts << ECMA_LOCAL_PARSE_OPTS_OFFSET) | ECMA_STATUS_DIRECT_EVAL; \ } while (0) /** * Get JERRY_CONTEXT (status_flags) top 8 bits. */ -#define ECMA_GET_SUPER_EVAL_PARSER_OPTS() (JERRY_CONTEXT (status_flags) >> ECMA_SUPER_EVAL_OPTS_OFFSET) +#define ECMA_GET_LOCAL_PARSE_OPTS() \ + (JERRY_CONTEXT (status_flags) >> (ECMA_LOCAL_PARSE_OPTS_OFFSET - JERRY_LOG2 (ECMA_PARSE_ALLOW_SUPER))) /** * Clear JERRY_CONTEXT (status_flags) top 8 bits. */ -#define ECMA_CLEAR_SUPER_EVAL_PARSER_OPTS() \ +#define ECMA_CLEAR_LOCAL_PARSE_OPTS() \ do \ { \ - JERRY_CONTEXT (status_flags) &= ((1 << ECMA_SUPER_EVAL_OPTS_OFFSET) - 1); \ + JERRY_CONTEXT (status_flags) &= ((1 << ECMA_LOCAL_PARSE_OPTS_OFFSET) - 1); \ } while (0) /** @@ -709,19 +740,32 @@ typedef enum /** * Non closure flag for debugger. */ -#if ENABLED (JERRY_DEBUGGER) -#define ECMA_OBJECT_FLAG_NON_CLOSURE 0x20 -#endif /* ENABLED (JERRY_DEBUGGER) */ +#define ECMA_OBJECT_FLAG_BLOCK ECMA_OBJECT_FLAG_EXTENSIBLE + +/** + * Bitshift index for an ecma-object reference count field + */ +#define ECMA_OBJECT_REF_SHIFT 6 + +/** + * Bitmask for an ecma-object reference count field + */ +#define ECMA_OBJECT_REF_MASK (((1u << 10) - 1) << ECMA_OBJECT_REF_SHIFT) /** * Value for increasing or decreasing the object reference counter. */ -#define ECMA_OBJECT_REF_ONE (1u << 6) +#define ECMA_OBJECT_REF_ONE (1u << ECMA_OBJECT_REF_SHIFT) /** - * Maximum value of the object reference counter (1023). + * Represents non-visited white object */ -#define ECMA_OBJECT_MAX_REF (0x3ffu << 6) +#define ECMA_OBJECT_NON_VISITED (0x3ffu << ECMA_OBJECT_REF_SHIFT) + +/** + * Maximum value of the object reference counter (1022). + */ +#define ECMA_OBJECT_MAX_REF (ECMA_OBJECT_NON_VISITED - ECMA_OBJECT_REF_ONE) /** * Description of ECMA-object or lexical environment @@ -732,8 +776,8 @@ typedef struct /** type : 4 bit : ecma_object_type_t or ecma_lexical_environment_type_t depending on ECMA_OBJECT_FLAG_BUILT_IN_OR_LEXICAL_ENV flags : 2 bit : ECMA_OBJECT_FLAG_BUILT_IN_OR_LEXICAL_ENV, - ECMA_OBJECT_FLAG_EXTENSIBLE or ECMA_OBJECT_FLAG_NON_CLOSURE - refs : 10 bit (max 1023) */ + ECMA_OBJECT_FLAG_EXTENSIBLE or ECMA_OBJECT_FLAG_BLOCK + refs : 10 bit (max 1022) */ uint16_t type_flags_refs; /** next in the object chain maintained by the garbage collector */ @@ -743,8 +787,9 @@ typedef struct union { jmem_cpointer_t property_list_cp; /**< compressed pointer to object's - * or declerative lexical environments's property list */ + * or declerative lexical environments's property list */ jmem_cpointer_t bound_object_cp; /**< compressed pointer to lexical environments's the bound object */ + jmem_cpointer_t home_object_cp; /**< compressed pointer to lexical environments's the home object */ } u1; /** object prototype or outer reference */ @@ -764,7 +809,15 @@ typedef struct uint8_t length_and_bitset_size; /**< length for built-in functions and * bit set size for all built-ins */ uint16_t routine_id; /**< routine id for built-in functions */ - uint32_t instantiated_bitset[1]; /**< bit set for instantiated properties */ + union + { + uint32_t instantiated_bitset[1]; /**< bit set for instantiated properties */ + struct + { + uint16_t name; /**< name of the built-in functions */ + uint16_t bitset; /**< bit set for instantiated properties of builtin functions */ + } builtin_routine; + } u; } ecma_built_in_props_t; /** @@ -804,6 +857,7 @@ typedef struct { ecma_value_t value; /**< value of the object (e.g. boolean, number, string, etc.) */ uint32_t length; /**< length related property (e.g. length of ArrayBuffer) */ + ecma_value_t target; /**< [[ProxyTarget]] internal property */ } u; } class_prop; @@ -812,7 +866,7 @@ typedef struct */ struct { - ecma_value_t scope_cp; /**< function scope */ + jmem_cpointer_tag_t scope_cp; /**< function scope */ ecma_value_t bytecode_cp; /**< function byte code */ } function; @@ -822,10 +876,13 @@ typedef struct struct { uint32_t length; /**< length property value */ - ecma_property_t length_prop; /**< length property */ - bool is_fast_mode; /**< true - if the array is a fast access mode array - * false - otherwise */ - uint8_t hole_count; /**< Number of array holes in a fast access mode array */ + union + { + ecma_property_t length_prop; /**< length property */ + uint32_t hole_count; /**< number of array holes in a fast access mode array + * multiplied ECMA_FAST_ACCESS_HOLE_ONE */ + } u; + } array; /** @@ -848,6 +905,7 @@ typedef struct ecma_value_t lex_env_cp; /**< for arguments: lexical environment */ ecma_value_t arraybuffer; /**< for typedarray: internal arraybuffer */ ecma_value_t iterated_value; /**< for %Iterator%: [[IteratedObject]] property */ + ecma_value_t spread_value; /**< for spread object: spreaded element */ } u2; } pseudo_array; @@ -856,7 +914,7 @@ typedef struct */ struct { - ecma_value_t target_function; /**< target function */ + jmem_cpointer_tag_t target_function; /**< target function */ ecma_value_t args_len_or_this; /**< length of arguments or this value */ } bound_function; @@ -885,7 +943,6 @@ typedef struct #define ECMA_FAST_ARRAY_ALIGN_LENGTH(length) \ (uint32_t) ((((length)) + ECMA_FAST_ARRAY_ALIGNMENT - 1) / ECMA_FAST_ARRAY_ALIGNMENT * ECMA_FAST_ARRAY_ALIGNMENT) - /** * Compiled byte code data. */ @@ -900,6 +957,17 @@ typedef struct * If regexp, the other flags must be RE_FLAG... */ } ecma_compiled_code_t; +/** + * Description of bound function objects. + */ +typedef struct +{ + ecma_extended_object_t header; /**< extended object header */ +#if ENABLED (JERRY_ES2015) + ecma_integer_value_t target_length; /**< length of target function */ +#endif /* ENABLED (JERRY_ES2015) */ +} ecma_bound_function_t; + #if ENABLED (JERRY_SNAPSHOT_EXEC) /** @@ -913,17 +981,16 @@ typedef struct #endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */ -#if ENABLED (JERRY_ES2015_ARROW_FUNCTION) +#if ENABLED (JERRY_ES2015) /** * Description of arrow function objects. */ typedef struct { - ecma_object_t object; /**< object header */ + ecma_extended_object_t header; /**< extended object header */ ecma_value_t this_binding; /**< value of 'this' binding */ - jmem_cpointer_t scope_cp; /**< function scope */ - jmem_cpointer_t bytecode_cp; /**< function byte code */ + ecma_value_t new_target; /**< value of new.target */ } ecma_arrow_function_t; #if ENABLED (JERRY_SNAPSHOT_EXEC) @@ -939,18 +1006,62 @@ typedef struct #endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */ -#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */ +#endif /* ENABLED (JERRY_ES2015) */ + +#if ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) +/** + * Flags for container objects + */ +typedef enum +{ + ECMA_CONTAINER_FLAGS_EMPTY = (0), /** empty flags */ + ECMA_CONTAINER_FLAGS_WEAK = (1 << 0) /** container object is weak */ +} ecma_container_flags_t; -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) /** - * Description of Map/Set objects. + * Description of map collection. */ typedef struct { - ecma_extended_object_t header; /**< header part */ - uint32_t size; /**< size of the map object */ -} ecma_map_object_t; -#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) */ + ecma_value_t key; /**< key value */ + ecma_value_t value; /**< value of the key */ +} ecma_container_pair_t; + +/** + * Size of a single element (in ecma_value_t unit). + */ +#define ECMA_CONTAINER_VALUE_SIZE 1 + +/** + * Size of a key - value pair (in ecma_value_t unit). + */ +#define ECMA_CONTAINER_PAIR_SIZE 2 + +/** + * Size of the internal buffer. + */ +#define ECMA_CONTAINER_GET_SIZE(container_p) \ + (container_p->buffer_p[0]) + +/** + * Remove the size field of the internal buffer. + */ +#define ECMA_CONTAINER_SET_SIZE(container_p, size) \ + (container_p->buffer_p[0] = (ecma_value_t) (size)) + +/** + * Number of entries of the internal buffer. + */ +#define ECMA_CONTAINER_ENTRY_COUNT(collection_p) \ + (collection_p->item_count - 1) + +/** + * Pointer to the first entry of the internal buffer. + */ +#define ECMA_CONTAINER_START(collection_p) \ + (collection_p->buffer_p + 1) + +#endif /* ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) */ typedef enum { @@ -1148,6 +1259,26 @@ typedef union * See also: ECMA_262 v5, 15.7.3.2 */ # define ECMA_NUMBER_MAX_VALUE (FLT_MAX) +/** + * Number.EPSILON + * + * See also: ECMA_262 v6, 20.1.2.1 + */ +# define ECMA_NUMBER_EPSILON ((ecma_number_t) 1.1920928955078125e-7) + +/** + * Number.MAX_SAFE_INTEGER + * + * See also: ECMA_262 v6, 20.1.2.6 + */ +# define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0xFFFFFF) + +/** + * Number.MIN_SAFE_INTEGER + * + * See also: ECMA_262 v6, 20.1.2.8 + */ +# define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0xFFFFFF) #elif ENABLED (JERRY_NUMBER_TYPE_FLOAT64) /** * Number.MAX_VALUE (i.e., the maximum value of ecma-number) @@ -1155,29 +1286,36 @@ typedef union * See also: ECMA_262 v5, 15.7.3.2 */ # define ECMA_NUMBER_MAX_VALUE ((ecma_number_t) 1.7976931348623157e+308) + /** * Number.MIN_VALUE (i.e., the smallest positive value of ecma-number) * * See also: ECMA_262 v5, 15.7.3.3 */ # define ECMA_NUMBER_MIN_VALUE ((ecma_number_t) 5e-324) -#endif /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */ -#if ENABLED (JERRY_ES2015_BUILTIN) + /** * Number.EPSILON * * See also: ECMA_262 v6, 20.1.2.1 */ # define ECMA_NUMBER_EPSILON ((ecma_number_t) 2.2204460492503130808472633361816e-16) -#endif /* ENABLED (JERRY_ES2015_BUILTIN) */ -#if ENABLED (JERRY_ES2015_BUILTIN) + /** * Number.MAX_SAFE_INTEGER * - * See also: ECMA_262 v6, 20.1.2.1 + * See also: ECMA_262 v6, 20.1.2.6 */ # define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0x1FFFFFFFFFFFFF) -#endif /* ENABLED (JERRY_ES2015_BUILTIN) */ + +/** + * Number.MIN_SAFE_INTEGER + * + * See also: ECMA_262 v6, 20.1.2.8 + */ +# define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0x1FFFFFFFFFFFFF) +#endif /* !ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */ + /** * Euler number */ @@ -1363,9 +1501,7 @@ typedef enum ECMA_STRING_CONTAINER_SYMBOL, /**< the ecma-string is a symbol */ - ECMA_STRING_CONTAINER_MAP_KEY, /**< the ecma-string is a map key string */ - - ECMA_STRING_CONTAINER__MAX = ECMA_STRING_CONTAINER_MAP_KEY /**< maximum value */ + ECMA_STRING_CONTAINER__MAX = ECMA_STRING_CONTAINER_SYMBOL /**< maximum value */ } ecma_string_container_t; /** @@ -1622,12 +1758,12 @@ typedef struct /** * Function callback descriptor of a %TypedArray% object getter */ -typedef ecma_number_t (*ecma_typedarray_getter_fn_t)(lit_utf8_byte_t *src); +typedef ecma_number_t (*ecma_typedarray_getter_fn_t) (lit_utf8_byte_t *src); /** * Function callback descriptor of a %TypedArray% object setter */ -typedef void (*ecma_typedarray_setter_fn_t)(lit_utf8_byte_t *src, ecma_number_t value); +typedef void (*ecma_typedarray_setter_fn_t) (lit_utf8_byte_t *src, ecma_number_t value); /** * Builtin id for the different types of TypedArray's @@ -1703,6 +1839,27 @@ typedef struct #endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ +#if ENABLED (JERRY_ES2015) + +/** + * Executable (e.g. generator, async) object flags. + */ +typedef enum +{ + ECMA_EXECUTABLE_OBJECT_COMPLETED = (1u << 0), /**< executable object is completed and cannot be resumed */ + ECMA_EXECUTABLE_OBJECT_RUNNING = (1u << 1), /**< executable object is currently running */ + /* Generator specific flags. */ + ECMA_GENERATOR_ITERATE_AND_YIELD = (1u << 2), /**< the generator performs a yield* operation */ +} ecma_executable_object_flags_t; + +/** + * Checks whether the executable object is waiting for resuming. + */ +#define ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED(extra_info) \ + (!((extra_info) & (ECMA_EXECUTABLE_OBJECT_COMPLETED | ECMA_EXECUTABLE_OBJECT_RUNNING))) + +#endif /* ENABLED (JERRY_ES2015) */ + #if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) /** * Description of DataView objects. @@ -1735,6 +1892,23 @@ typedef struct #define ECMA_SYMBOL_HASH_SHIFT 2 #if (JERRY_STACK_LIMIT != 0) +/** + * Set the jerry context stack limit for IAR. + */ +#define JERRY_IAR_MEM_STACK_LIMIT (4480) // > 4136b, 3500; < 4.5 * 1024 = 4608 + +/** + * Check the current jerry context stack usage. + */ +#define CHECK_JERRY_STACK_USAGE(context_p) \ +do \ +{ \ + if (ecma_get_current_stack_usage () > JERRY_IAR_MEM_STACK_LIMIT) \ + { \ + parser_raise_error (context_p, PARSER_ERR_JERRY_STACK_LIMIT_REACHED); \ + } \ +} while (0) + /** * Check the current stack usage. If the limit is reached a RangeError is raised. */ @@ -1751,8 +1925,35 @@ do \ * If the stack limit is unlimited, this check is an empty macro. */ #define ECMA_CHECK_STACK_USAGE() +#define CHECK_JERRY_STACK_USAGE(context_p) #endif /* (JERRY_STACK_LIMIT != 0) */ +/** + * Invalid object pointer which represents abrupt completion + */ +#define ECMA_OBJECT_POINTER_ERROR ((ecma_object_t *) 0x01) + +#if ENABLED (JERRY_ES2015_BUILTIN_PROXY) +/** + * Description of Proxy objects. + */ +typedef struct +{ + ecma_object_t header; /**< header part */ + ecma_value_t target; /**< [[ProxyTarget]] internal slot */ + ecma_value_t handler; /**< [[ProxyHandler]] internal slot */ +} ecma_proxy_object_t; + +/** + * Description of Proxy objects. + */ +typedef struct +{ + ecma_extended_object_t header; /**< header part */ + ecma_value_t proxy; /**< [[RevocableProxy]] internal slot */ +} ecma_revocable_proxy_object_t; +#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROXY) */ + /** * @} * @} diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-compiler.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-compiler.h old mode 100755 new mode 100644 similarity index 100% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-compiler.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-compiler.h diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-core.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-core.h old mode 100755 new mode 100644 similarity index 89% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-core.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-core.h index c732d970c..a5c71197c --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-core.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-core.h @@ -39,7 +39,7 @@ extern "C" /** * Minor version of JerryScript API. */ -#define JERRY_API_MINOR_VERSION 1 +#define JERRY_API_MINOR_VERSION 3 /** * Patch version of JerryScript API. @@ -99,6 +99,11 @@ typedef enum JERRY_FEATURE_LOGGING, /**< logging */ JERRY_FEATURE_SYMBOL, /**< symbol support */ JERRY_FEATURE_DATAVIEW, /**< DataView support */ + JERRY_FEATURE_PROXY, /**< Proxy support */ + JERRY_FEATURE_MAP, /**< Map support */ + JERRY_FEATURE_SET, /**< Set support */ + JERRY_FEATURE_WEAKMAP, /**< WeakMap support */ + JERRY_FEATURE_WEAKSET, /**< WeakSet support */ JERRY_FEATURE__COUNT /**< number of features. NOTE: must be at the end of the list */ } jerry_feature_t; @@ -327,6 +332,11 @@ typedef enum JERRY_BIN_OP_GREATER, /**< greater relation (>) */ JERRY_BIN_OP_GREATER_EQUAL, /**< greater or equal relation (>=)*/ JERRY_BIN_OP_INSTANCEOF, /**< instanceof operation */ + JERRY_BIN_OP_ADD, /**< addition operator (+) */ + JERRY_BIN_OP_SUB, /**< subtraction operator (-) */ + JERRY_BIN_OP_MUL, /**< multiplication operator (*) */ + JERRY_BIN_OP_DIV, /**< division operator (/) */ + JERRY_BIN_OP_REM, /**< remainder operator (%) */ } jerry_binary_operation_t; /** @@ -380,6 +390,7 @@ bool jerry_value_is_number (const jerry_value_t value); bool jerry_value_is_null (const jerry_value_t value); bool jerry_value_is_object (const jerry_value_t value); bool jerry_value_is_promise (const jerry_value_t value); +bool jerry_value_is_proxy (const jerry_value_t value); bool jerry_value_is_string (const jerry_value_t value); bool jerry_value_is_symbol (const jerry_value_t value); bool jerry_value_is_undefined (const jerry_value_t value); @@ -494,6 +505,7 @@ jerry_value_t jerry_create_number_nan (void); jerry_value_t jerry_create_null (void); jerry_value_t jerry_create_object (void); jerry_value_t jerry_create_promise (void); +jerry_value_t jerry_create_proxy (const jerry_value_t target, const jerry_value_t handler); jerry_value_t jerry_create_regexp (const jerry_char_t *pattern, uint16_t flags); jerry_value_t jerry_create_regexp_sz (const jerry_char_t *pattern, jerry_size_t pattern_size, uint16_t flags); jerry_value_t jerry_create_string_from_utf8 (const jerry_char_t *str_p); @@ -508,15 +520,20 @@ jerry_value_t jerry_create_undefined (void); */ jerry_value_t jerry_has_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val); jerry_value_t jerry_has_own_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val); +bool jerry_has_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val); bool jerry_delete_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val); bool jerry_delete_property_by_index (const jerry_value_t obj_val, uint32_t index); +bool jerry_delete_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val); jerry_value_t jerry_get_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val); jerry_value_t jerry_get_property_by_index (const jerry_value_t obj_val, uint32_t index); +jerry_value_t jerry_get_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val); jerry_value_t jerry_set_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val, const jerry_value_t value_to_set); jerry_value_t jerry_set_property_by_index (const jerry_value_t obj_val, uint32_t index, const jerry_value_t value_to_set); +bool jerry_set_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val, + const jerry_value_t value_to_set); void jerry_init_property_descriptor_fields (jerry_property_descriptor_t *prop_desc_p); jerry_value_t jerry_define_own_property (const jerry_value_t obj_val, @@ -556,10 +573,24 @@ bool jerry_foreach_object_property (const jerry_value_t obj_val, jerry_object_pr void *user_data_p); /** - * Promise resolve/reject functions. + * Promise functions. */ jerry_value_t jerry_resolve_or_reject_promise (jerry_value_t promise, jerry_value_t argument, bool is_resolve); +/** + * Enum values representing various Promise states. + */ +typedef enum +{ + JERRY_PROMISE_STATE_NONE = 0u, /**< Invalid/Unknown state (possibly called on a non-promise object). */ + JERRY_PROMISE_STATE_PENDING, /**< Promise is in "Pending" state. */ + JERRY_PROMISE_STATE_FULFILLED, /**< Promise is in "Fulfilled" state. */ + JERRY_PROMISE_STATE_REJECTED, /**< Promise is in "Rejected" state. */ +} jerry_promise_state_t; + +jerry_value_t jerry_get_promise_result (const jerry_value_t promise); +jerry_promise_state_t jerry_get_promise_state (const jerry_value_t promise); + /** * Symbol functions. */ @@ -587,6 +618,8 @@ jerry_context_t *jerry_create_context (uint32_t heap_size, jerry_context_alloc_t */ void jerry_set_vm_exec_stop_callback (jerry_vm_exec_stop_callback_t stop_cb, void *user_p, uint32_t frequency); jerry_value_t jerry_get_backtrace (uint32_t max_depth); +jerry_value_t jerry_get_resource_name (const jerry_value_t value); +jerry_value_t jerry_get_new_target (void); /** * Array buffer components. @@ -606,6 +639,8 @@ jerry_length_t jerry_arraybuffer_read (const jerry_value_t value, jerry_length_t buf_size); jerry_length_t jerry_get_arraybuffer_byte_length (const jerry_value_t value); uint8_t *jerry_get_arraybuffer_pointer (const jerry_value_t value); +jerry_value_t jerry_is_arraybuffer_detachable (const jerry_value_t value); +jerry_value_t jerry_detach_arraybuffer (const jerry_value_t value); /** * DataView functions. @@ -644,6 +679,17 @@ typedef enum JERRY_TYPEDARRAY_FLOAT64, } jerry_typedarray_type_t; +/** + * Container types. + */ +typedef enum +{ + JERRY_CONTAINER_TYPE_INVALID = 0, /**< Invalid container */ + JERRY_CONTAINER_TYPE_MAP, /**< Map type */ + JERRY_CONTAINER_TYPE_SET, /**< Set type */ + JERRY_CONTAINER_TYPE_WEAKMAP, /**< WeakMap type */ + JERRY_CONTAINER_TYPE_WEAKSET, /**< WeakSet type */ +} jerry_container_type_t; bool jerry_value_is_typedarray (jerry_value_t value); jerry_value_t jerry_create_typedarray (jerry_typedarray_type_t type_name, jerry_length_t length); @@ -660,6 +706,19 @@ jerry_value_t jerry_get_typedarray_buffer (jerry_value_t value, jerry_length_t *byte_length); jerry_value_t jerry_json_parse (const jerry_char_t *string_p, jerry_size_t string_size); jerry_value_t jerry_json_stringify (const jerry_value_t object_to_stringify); +jerry_value_t jerry_create_container (jerry_container_type_t container_type, + const jerry_value_t *arguments_list_p, + jerry_length_t arguments_list_len); +jerry_container_type_t jerry_get_container_type (const jerry_value_t value); + +#if defined(JERRY_HEAPDUMP) +void JerryHeapdumpRun(const char* filepath); +#endif + +#if defined(JERRY_REF_TRACKER) +void JerryRefTrackerStart(const char* filepath); +void JerryRefTrackerStop(void); +#endif /** * @} diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-debugger.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-debugger.h old mode 100755 new mode 100644 similarity index 100% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-debugger.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-debugger.h diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-port.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-port.h old mode 100755 new mode 100644 similarity index 99% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-port.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-port.h index 9a9e4463e..37609fd4d --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-port.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-port.h @@ -51,6 +51,7 @@ typedef enum ERR_OUT_OF_MEMORY = 10, ERR_REF_COUNT_LIMIT = 12, ERR_DISABLED_BYTE_CODE = 13, + ERR_UNTERMINATED_GC_LOOPS = 14, ERR_FAILED_INTERNAL_ASSERTION = 120 } jerry_fatal_code_t; diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-snapshot.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-snapshot.h old mode 100755 new mode 100644 similarity index 98% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-snapshot.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-snapshot.h index 12f21315e..1dfbf1219 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-snapshot.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript-snapshot.h @@ -30,7 +30,7 @@ extern "C" /** * Jerry snapshot format version. */ -#define JERRY_SNAPSHOT_VERSION (24u) +#define JERRY_SNAPSHOT_VERSION (49u) /** * Flags for jerry_generate_snapshot and jerry_generate_function_snapshot. diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript.h old mode 100755 new mode 100644 similarity index 90% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript.h index 041ac7ea3..150eef4f5 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/include/jerryscript.h @@ -20,4 +20,8 @@ #include "jerryscript-debugger.h" #include "jerryscript-snapshot.h" +#ifdef JERRY_IAR_JUPITER +#include "ohos_mem_pool.h" +#endif // JERRY_IAR_JUPITER + #endif /* !JERRYSCRIPT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jmem.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/jmem/jmem.h old mode 100755 new mode 100644 similarity index 73% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jmem.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/jmem/jmem.h index 18ad2f383..a89f705df --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jmem.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/jmem/jmem.h @@ -40,6 +40,37 @@ */ #define JMEM_ALIGNMENT (1u << JMEM_ALIGNMENT_LOG) +/** + * Pointer value can be directly stored without compression + */ +#if UINTPTR_MAX <= UINT32_MAX +#define JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY +#endif /* UINTPTR_MAX <= UINT32_MAX */ + +/** + * Mask for tag part in jmem_cpointer_tag_t + */ +#define JMEM_TAG_MASK 0x7u + +/** + * Shift for tag part in jmem_cpointer_tag_t + */ +#if defined (JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY) && ENABLED (JERRY_CPOINTER_32_BIT) +#define JMEM_TAG_SHIFT 0 +#else /* !JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY || !ENABLED (JERRY_CPOINTER_32_BIT) */ +#define JMEM_TAG_SHIFT 3 +#endif /* JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY && ENABLED (JERRY_CPOINTER_32_BIT) */ + +/** + * Bit mask for tag part in jmem_cpointer_tag_t + */ +enum +{ + JMEM_FIRST_TAG_BIT_MASK = (1u << 0), /**< first tag bit mask **/ + JMEM_SECOND_TAG_BIT_MASK = (1u << 1), /**< second tag bit mask **/ + JMEM_THIRD_TAG_BIT_MASK = (1u << 2), /**< third tag bit mask **/ +}; + /** * Compressed pointer representations * @@ -69,6 +100,11 @@ typedef uint32_t jmem_cpointer_t; typedef uint16_t jmem_cpointer_t; #endif /* ENABLED (JERRY_CPOINTER_32_BIT) */ +/** + * Compressed pointer with tag value + */ +typedef uint32_t jmem_cpointer_tag_t; + /** * Memory usage pressure for reclaiming unused memory. * @@ -223,6 +259,44 @@ void * JERRY_ATTR_PURE jmem_decompress_pointer (uintptr_t compressed_pointer); } \ } while (false); +/** + * Set value of pointer-tag value so that it will correspond + * to specified non_compressed_pointer along with tag + */ +#define JMEM_CP_SET_NON_NULL_POINTER_TAG(cp_value, pointer, tag) \ + do \ + { \ + JERRY_ASSERT ((uintptr_t) tag < (uintptr_t) (JMEM_ALIGNMENT)); \ + jmem_cpointer_tag_t compressed_ptr = jmem_compress_pointer (pointer); \ + (cp_value) = (jmem_cpointer_tag_t) ((compressed_ptr << JMEM_TAG_SHIFT) | tag); \ + } while (false); + +/** + * Extract value of pointer from specified pointer-tag value + */ +#define JMEM_CP_GET_NON_NULL_POINTER_FROM_POINTER_TAG(type, cp_value) \ + ((type *) (jmem_decompress_pointer ((cp_value & ~JMEM_TAG_MASK) >> JMEM_TAG_SHIFT))) + +/** + * Get value of each tag from specified pointer-tag value + */ +#define JMEM_CP_GET_FIRST_BIT_FROM_POINTER_TAG(cp_value) \ + (cp_value & JMEM_FIRST_TAG_BIT_MASK) /**< get first tag bit **/ +#define JMEM_CP_GET_SECOND_BIT_FROM_POINTER_TAG(cp_value) \ + (cp_value & JMEM_SECOND_TAG_BIT_MASK) /**< get second tag bit **/ +#define JMEM_CP_GET_THIRD_BIT_FROM_POINTER_TAG(cp_value) \ + (cp_value & JMEM_THIRD_TAG_BIT_MASK) /**< get third tag bit **/ + +/** + * Set value of each tag to specified pointer-tag value + */ +#define JMEM_CP_SET_FIRST_BIT_TO_POINTER_TAG(cp_value) \ + (cp_value) = (cp_value | JMEM_FIRST_TAG_BIT_MASK) /**< set first tag bit **/ +#define JMEM_CP_SET_SECOND_BIT_TO_POINTER_TAG(cp_value) \ + (cp_value) = (cp_value | JMEM_SECOND_TAG_BIT_MASK) /**< set second tag bit **/ +#define JMEM_CP_SET_THIRD_BIT_TO_POINTER_TAG(cp_value) \ + (cp_value) = (cp_value | JMEM_THIRD_TAG_BIT_MASK) /**< set third tag bit **/ + /** * @} * \addtogroup poolman Memory pool manager diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt-types.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/jrt/jrt-types.h old mode 100755 new mode 100644 similarity index 100% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt-types.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/jrt/jrt-types.h diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/jrt/jrt.h old mode 100755 new mode 100644 similarity index 99% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/jrt/jrt.h index e0658a9f9..318e603fd --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/jrt/jrt.h @@ -19,7 +19,7 @@ #include #include -#include "config.h" +#include "../config.h" #include "jerryscript-port.h" #include "jrt-types.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-globals.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/lit/lit-globals.h old mode 100755 new mode 100644 similarity index 100% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-globals.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/lit/lit-globals.h diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-magic-strings.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/lit/lit-magic-strings.h old mode 100755 new mode 100644 similarity index 92% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-magic-strings.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/lit/lit-magic-strings.h index faf636b40..1ab61aa28 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-magic-strings.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/lit/lit-magic-strings.h @@ -41,13 +41,15 @@ typedef enum LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_RESOLVE, /**< [[Resolve]] property */ LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_REJECT, /**< [[Reject]] property */ LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_CAPABILITY, /**< [[Capability]] property */ - LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_HANDLER, /**< [[Handler]] property */ LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_ALREADY_CALLED, /**< [[AlreadyCalled]] property */ LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_INDEX, /**< [[Index]] property */ LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_VALUE, /**< [[Values]] property */ LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_REMAINING_ELEMENT, /**< [[RemainingElement]] property */ LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX, /**< [[%Iterator%NextIndex]] property */ LIT_INTERNAL_MAGIC_STRING_MAP_KEY, /**< Property key used when an object is a key in a map object */ + LIT_INTERNAL_MAGIC_API_INTERNAL, /**< Property key used to add non-visible JS properties from the public API */ + LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES, /**< %ArrayProto_values% intrinsic routine */ + LIT_INTERNAL_MAGIC_THIS_BINDING_VALUE, /**< FunctionEnvironmentRecord [[ThisBindingValue]] internal slot */ /* List of well known symbols */ LIT_GLOBAL_SYMBOL_HAS_INSTANCE, /**< @@hasInstance well known symbol */ LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE, /**< @@isConcatSpreadable well known symbol */ @@ -68,7 +70,8 @@ typedef enum LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER, /**< native pointer info associated with an object */ LIT_FIRST_INTERNAL_MAGIC_STRING = LIT_INTERNAL_MAGIC_STRING_NATIVE_POINTER, /**< first index of internal * magic strings */ - LIT_INTERNAL_MAGIC_STRING_CLASS_THIS_BINDING, /**< the this binding of the class constructor */ + LIT_INTERNAL_MAGIC_STRING_WEAK_REFS, /**< Weak references to the current object */ + LIT_INTERNAL_MAGIC_STRING_INTERNAL_OBJECT, /**< Internal object ID for internal properties */ LIT_MAGIC_STRING__COUNT /**< number of magic strings */ } lit_magic_string_id_t; diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-magic-strings.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/lit/lit-magic-strings.inc.h old mode 100755 new mode 100644 similarity index 81% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-magic-strings.inc.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/lit/lit-magic-strings.inc.h index be61e7810..5c8b6c4fc --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-magic-strings.inc.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-core/lit/lit-magic-strings.inc.h @@ -16,17 +16,15 @@ /* This file is automatically generated by the gen-magic-strings.py script * from lit-magic-strings.ini. Do not edit! */ - LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING__EMPTY, "") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPACE_CHAR, " ") -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RIGHT_PAREN, ")") -#endif #if ENABLED (JERRY_ES2015_MODULE_SYSTEM) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASTERIX_CHAR, "*") #endif +#if ENABLED (JERRY_BUILTIN_ARRAY) \ +|| ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COMMA_CHAR, ",") -LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COLON_CHAR, ":") +#endif #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_E_U, "E") #endif @@ -35,18 +33,22 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR, "]") #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PI_U, "PI") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) +#if ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS, "is") +#endif +#if ENABLED (JERRY_BUILTIN_ARRAY) && ENABLED (JERRY_ES2015) \ +|| ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OF, "of") #endif #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LN2_U, "LN2") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) \ -|| ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) +#if ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) \ +|| ENABLED (JERRY_ES2015_BUILTIN_MAP) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAP_UL, "Map") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NAN, "NaN") -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) \ +#if ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) \ || ENABLED (JERRY_ES2015_BUILTIN_SET) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UL, "Set") #endif @@ -56,7 +58,9 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UTC_U, "UTC") #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ABS, "abs") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SET) +#if ENABLED (JERRY_ES2015) && ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) \ +|| ENABLED (JERRY_ES2015_BUILTIN_SET) \ +|| ENABLED (JERRY_ES2015_BUILTIN_WEAKSET) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ADD, "add") #endif #if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) @@ -66,12 +70,16 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ALL, "all") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COS, "cos") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EXP, "exp") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FOR, "for") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET, "get") #if ENABLED (JERRY_ES2015_BUILTIN_MAP) \ -|| ENABLED (JERRY_ES2015_BUILTIN_SET) +|| ENABLED (JERRY_ES2015_BUILTIN_PROXY) \ +|| ENABLED (JERRY_ES2015_BUILTIN_REFLECT) \ +|| ENABLED (JERRY_ES2015_BUILTIN_SET) \ +|| ENABLED (JERRY_ES2015_BUILTIN_WEAKMAP) \ +|| ENABLED (JERRY_ES2015_BUILTIN_WEAKSET) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS, "has") #endif #if ENABLED (JERRY_BUILTIN_MATH) @@ -94,6 +102,9 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POP, "pop") #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POW, "pow") #endif +#if ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RAW, "raw") +#endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET, "set") #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SIN, "sin") @@ -118,33 +129,44 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATAN, "atan") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIND, "bind") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CALL, "call") +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CBRT, "cbrt") +#endif #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CEIL, "ceil") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COSH, "cosh") +#endif +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DONE, "done") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EVAL, "eval") #if ENABLED (JERRY_BUILTIN_REGEXP) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EXEC, "exec") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) -LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FILL, "fill") -#endif -#if ENABLED (JERRY_BUILTIN_ARRAY) && ENABLED (JERRY_ES2015_BUILTIN) \ +#if ENABLED (JERRY_ES2015) \ || ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FILL, "fill") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FIND, "find") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) +#if ENABLED (JERRY_BUILTIN_ARRAY) && ENABLED (JERRY_ES2015) \ +|| ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROM, "from") #endif +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IMUL, "imul") +#endif #if ENABLED (JERRY_BUILTIN_ARRAY) \ || ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_JOIN, "join") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_KEYS, "keys") +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG2, "log2") +#endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NAME, "name") -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) \ +#if ENABLED (JERRY_ES2015) \ || ENABLED (JERRY_ES2015_BUILTIN_MAP) \ || ENABLED (JERRY_ES2015_BUILTIN_SET) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NEXT, "next") @@ -157,8 +179,9 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PUSH, "push") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RACE, "race") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SEAL, "seal") -#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015_BUILTIN) +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SIGN, "sign") +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SINH, "sinh") #endif #if ENABLED (JERRY_ES2015_BUILTIN_MAP) \ || ENABLED (JERRY_ES2015_BUILTIN_SET) @@ -172,6 +195,9 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SORT, "sort") #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT, "sqrt") #endif +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TANH, "tanh") +#endif #if ENABLED (JERRY_BUILTIN_REGEXP) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TEST, "test") #endif @@ -186,12 +212,26 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_UL, "Array") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ERROR_UL, "Error") #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG2E_U, "LOG2E") +#endif +#if ENABLED (JERRY_ES2015_BUILTIN_PROXY) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROXY_UL, "Proxy") +#endif +#if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT2_U, "SQRT2") #endif +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ACOSH, "acosh") +#endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_APPLY, "apply") +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASINH, "asinh") +#endif #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATAN2, "atan2") #endif +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATANH, "atanh") +#endif #if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CATCH, "catch") #endif @@ -199,10 +239,16 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CATCH, "catch") || ENABLED (JERRY_ES2015_BUILTIN_SET) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CLEAR, "clear") #endif +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CLZ32, "clz32") +#endif #if ENABLED (JERRY_BUILTIN_ARRAY) \ || ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EVERY, "every") #endif +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EXPM1, "expm1") +#endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FALSE, "false") #if ENABLED (JERRY_BUILTIN_REGEXP) && ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLAGS, "flags") @@ -210,22 +256,29 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLAGS, "flags") #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLOOR, "floor") #endif -#if ENABLED (JERRY_BUILTIN_REGEXP) \ -|| ENABLED (JERRY_BUILTIN_STRING) -LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INDEX, "index") +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HYPOT, "hypot") #endif #if ENABLED (JERRY_BUILTIN_REGEXP) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INDEX, "index") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INPUT, "input") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_NAN, "isNaN") +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG10, "log10") +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG1P, "log1p") +#endif #if ENABLED (JERRY_BUILTIN_REGEXP) && ENABLED (JERRY_BUILTIN_STRING) \ -|| ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +|| ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MATCH, "match") #endif #if ENABLED (JERRY_BUILTIN_DATE) \ || ENABLED (JERRY_BUILTIN_JSON) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PARSE, "parse") #endif +#if ENABLED (JERRY_ES2015_BUILTIN_PROXY) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROXY, "proxy") +#endif #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ROUND, "round") #endif @@ -238,10 +291,13 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SHIFT, "shift") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SLICE, "slice") #endif #if ENABLED (JERRY_BUILTIN_STRING) \ -|| ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +|| ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPLIT, "split") #endif -#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015_BUILTIN) +#if ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_THROW, "throw") +#endif +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRUNC, "trunc") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_VALUE, "value") @@ -255,10 +311,8 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NUMBER_UL, "Number") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT_UL, "Object") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REGEXP_UL, "RegExp") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING_UL, "String") -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_UL, "Symbol") -#endif -#if ENABLED (JERRY_ES2015_BUILTIN) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASSIGN, "assign") #endif #if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) \ @@ -276,7 +330,9 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONCAT, "concat") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CREATE, "create") #if ENABLED (JERRY_ES2015_BUILTIN_MAP) \ -|| ENABLED (JERRY_ES2015_BUILTIN_SET) +|| ENABLED (JERRY_ES2015_BUILTIN_SET) \ +|| ENABLED (JERRY_ES2015_BUILTIN_WEAKMAP) \ +|| ENABLED (JERRY_ES2015_BUILTIN_WEAKSET) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DELETE, "delete") #endif #if ENABLED (JERRY_BUILTIN_ANNEXB) @@ -287,19 +343,19 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ESCAPE, "escape") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FILTER, "filter") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FREEZE, "freeze") +#if ENABLED (JERRY_BUILTIN_MATH) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROUND, "fround") +#endif #if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_DAY_UL, "getDay") #endif -#if !ENABLED (JERRY_ES2015) && ENABLED (JERRY_BUILTIN_REGEXP) \ -|| ENABLED (JERRY_BUILTIN_REGEXP) && ENABLED (JERRY_BUILTIN_STRING) \ -|| ENABLED (JERRY_BUILTIN_REGEXP) && ENABLED (JERRY_ES2015) \ -|| ENABLED (JERRY_BUILTIN_REGEXP) && !( ENABLED (JERRY_ES2015)) +#if ENABLED (JERRY_BUILTIN_REGEXP) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GLOBAL, "global") #endif #if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_VIEW_UL, "isView") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_KEY_FOR, "keyFor") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LENGTH, "length") @@ -315,11 +371,17 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REDUCE, "reduce") #if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REJECT, "reject") #endif -#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015_BUILTIN) +#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REPEAT, "repeat") #endif +#if ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RETURN, "return") +#endif +#if ENABLED (JERRY_ES2015_BUILTIN_PROXY) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REVOKE, "revoke") +#endif #if ENABLED (JERRY_BUILTIN_REGEXP) && ENABLED (JERRY_BUILTIN_STRING) \ -|| ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +|| ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SEARCH, "search") #endif #if !ENABLED (JERRY_ES2015) && ENABLED (JERRY_BUILTIN_REGEXP) \ @@ -330,45 +392,55 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SOURCE, "source") #if ENABLED (JERRY_BUILTIN_ARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPLICE, "splice") #endif +#if ENABLED (JERRY_BUILTIN_REGEXP) && ENABLED (JERRY_ES2015) \ +|| ENABLED (JERRY_BUILTIN_REGEXP) && !( !ENABLED (JERRY_ES2015)) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STICKY, "sticky") +#endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING, "string") #if ENABLED (JERRY_BUILTIN_ANNEXB) && ENABLED (JERRY_BUILTIN_STRING) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SUBSTR, "substr") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) \ +|| ENABLED (JERRY_ES2015_BUILTIN_PROMISE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL, "symbol") #endif #if ENABLED (JERRY_BUILTIN_DATE) \ || ENABLED (JERRY_BUILTIN_JSON) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_JSON_UL, "toJSON") #endif -#if ENABLED (JERRY_BUILTIN_ARRAY) && ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) \ -|| ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) && ENABLED (JERRY_ES2015_BUILTIN_MAP) \ -|| ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) && ENABLED (JERRY_ES2015_BUILTIN_SET) \ -|| ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) && ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_VALUES, "values") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BOOLEAN_UL, "Boolean") +#if ENABLED (JERRY_BUILTIN_NUMBER) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EPSILON_U, "EPSILON") +#endif #if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROMISE_UL, "Promise") #endif +#if ENABLED (JERRY_ES2015_BUILTIN_REFLECT) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REFLECT_UL, "Reflect") +#endif #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT1_2_U, "SQRT1_2") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_LEFT_PAREN_UL, "Symbol(") -LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_DOT_UL, "Symbol.") +#if ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) \ +|| ENABLED (JERRY_ES2015_BUILTIN_WEAKMAP) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKMAP_UL, "WeakMap") +#endif +#if ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) \ +|| ENABLED (JERRY_ES2015_BUILTIN_WEAKSET) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKSET_UL, "WeakSet") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BOOLEAN, "boolean") #if ENABLED (JERRY_BUILTIN_ANNEXB) && ENABLED (JERRY_BUILTIN_REGEXP) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COMPILE, "compile") #endif -#if ENABLED (JERRY_ES2015_MODULE_SYSTEM) +#if ENABLED (JERRY_ES2015) \ +|| ENABLED (JERRY_ES2015_MODULE_SYSTEM) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFAULT, "default") #endif -#if ENABLED (JERRY_BUILTIN_ARRAY) && ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) \ -|| ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) && ENABLED (JERRY_ES2015_BUILTIN_MAP) \ -|| ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) && ENABLED (JERRY_ES2015_BUILTIN_SET) \ -|| ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) && ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENTRIES, "entries") #endif #if ENABLED (JERRY_BUILTIN_ARRAY) \ @@ -398,8 +470,12 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INDEX_OF_UL, "indexOf") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_ARRAY_UL, "isArray") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MESSAGE, "message") +#if ENABLED (JERRY_ES2015_BUILTIN_PROXY) \ +|| ENABLED (JERRY_ES2015_BUILTIN_REFLECT) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OWN_KEYS_UL, "ownKeys") +#endif #if ENABLED (JERRY_BUILTIN_REGEXP) && ENABLED (JERRY_BUILTIN_STRING) \ -|| ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +|| ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REPLACE, "replace") #endif #if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) @@ -421,12 +497,15 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_TIME_UL, "setTime") #if ENABLED (JERRY_BUILTIN_ANNEXB) && ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_YEAR_UL, "setYear") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPECIES, "species") #endif #if ENABLED (JERRY_BUILTIN_NUMBER) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_FIXED_UL, "toFixed") #endif +#if ENABLED (JERRY_BUILTIN_REGEXP) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNICODE, "unicode") +#endif #if ENABLED (JERRY_BUILTIN_ARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNSHIFT, "unshift") #endif @@ -439,7 +518,7 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INFINITY_UL, "Infinity") #if ENABLED (JERRY_BUILTIN_ERRORS) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_URI_ERROR_UL, "URIError") #endif -#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015_BUILTIN) +#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENDS_WITH, "endsWith") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION, "function") @@ -456,17 +535,19 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_MONTH_UL, "getMonth") #if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UINT8_UL, "getUint8") #endif -#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015_BUILTIN) +#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INCLUDES, "includes") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_FINITE, "isFinite") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_FROZEN_UL, "isFrozen") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_SEALED_UL, "isSealed") -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) \ -|| ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ITERATOR, "iterator") #endif +#if ENABLED (JERRY_ES2015) \ +|| !( ENABLED (JERRY_ES2015)) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PARSE_INT, "parseInt") +#endif #if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_HOURS_UL, "setHours") #endif @@ -493,6 +574,9 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARGUMENTS_UL, "Arguments") #if ENABLED (JERRY_BUILTIN_ERRORS) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EVAL_ERROR_UL, "EvalError") #endif +#if ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GENERATOR_UL, "Generator") +#endif #if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INT8_ARRAY_UL, "Int8Array") #endif @@ -504,10 +588,15 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MIN_VALUE_U, "MIN_VALUE") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TYPE_ERROR_UL, "TypeError") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNDEFINED_UL, "Undefined") +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING__PROTO__, "__proto__") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARGUMENTS, "arguments") +#if ENABLED (JERRY_ES2015_BUILTIN_PROXY) \ +|| ENABLED (JERRY_ES2015_BUILTIN_REFLECT) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONSTRUCT, "construct") +#endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DECODE_URI, "decodeURI") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENCODE_URI, "encodeURI") -#if ENABLED (JERRY_BUILTIN_ARRAY) && ENABLED (JERRY_ES2015_BUILTIN) \ +#if ENABLED (JERRY_ES2015) \ || ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FIND_INDEX, "findIndex") #endif @@ -518,7 +607,7 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_DAY_UL, "getUTCDay") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UINT16_UL, "getUint16") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UINT32_UL, "getUint32") #endif -#if ENABLED (JERRY_ES2015_BUILTIN) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_INTEGER, "isInteger") #endif #if ENABLED (JERRY_BUILTIN_REGEXP) @@ -530,6 +619,9 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LASTINDEX_UL, "lastIndex") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MULTILINE, "multiline") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROTOTYPE, "prototype") +#if ENABLED (JERRY_ES2015_BUILTIN_PROXY) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REVOCABLE, "revocable") +#endif #if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UINT16_UL, "setUint16") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UINT32_UL, "setUint32") @@ -560,7 +652,8 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BYTE_OFFSET_UL, "byteOffset") #if ENABLED (JERRY_BUILTIN_STRING) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CHAR_CODE_AT_UL, "charCodeAt") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) +#if ENABLED (JERRY_ES2015) \ +|| ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COPY_WITHIN, "copyWithin") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENUMERABLE, "enumerable") @@ -580,7 +673,10 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_DATE_UL, "getUTCDate") || ENABLED (JERRY_BUILTIN_REGEXP) && !( ENABLED (JERRY_ES2015)) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IGNORECASE_UL, "ignoreCase") #endif +#if ENABLED (JERRY_ES2015) \ +|| !( ENABLED (JERRY_ES2015)) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PARSE_FLOAT, "parseFloat") +#endif #if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_FLOAT_32_UL, "setFloat32") #endif @@ -592,12 +688,10 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_MINUTES_UL, "setMinutes") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_SECONDS_UL, "setSeconds") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_DATE_UL, "setUTCDate") #endif -#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015_BUILTIN) +#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STARTS_WITH, "startsWith") #endif -#if ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ERROR_MESSAGES) || ENABLED (JERRY_ES2015_MODULE_SYSTEM) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RESOURCE_ANON, "") -#endif #if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) \ || ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, "ArrayBuffer") @@ -609,13 +703,16 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, "SyntaxError") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT16_ARRAY_UL, "Uint16Array") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT32_ARRAY_UL, "Uint32Array") #endif +#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CODE_POINT_AT, "codePointAt") +#endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONSTRUCTOR, "constructor") #if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_FULL_YEAR_UL, "getFullYear") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_HOURS_UL, "getUTCHours") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_MONTH_UL, "getUTCMonth") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS_INSTANCE, "hasInstance") #endif #if ENABLED (JERRY_BUILTIN_ARRAY) \ @@ -644,7 +741,7 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOWER_CASE_UL, "toLowerCase") #if ENABLED (JERRY_BUILTIN_NUMBER) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_PRECISION_UL, "toPrecision") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_PRIMITIVE, "toPrimitive") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_STRING_TAG, "toStringTag") #endif @@ -654,7 +751,7 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_UTC_STRING_UL, "toUTCString") #if ENABLED (JERRY_BUILTIN_STRING) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_UPPER_CASE_UL, "toUpperCase") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNSCOPABLES, "unscopables") #endif #if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) @@ -666,11 +763,11 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, "Float64Array") #if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INVALID_DATE_UL, "Invalid Date") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) \ +#if ENABLED (JERRY_ES2015) \ || ENABLED (JERRY_ES2015_BUILTIN_MAP) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAP_ITERATOR_UL, "Map Iterator") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) \ +#if ENABLED (JERRY_ES2015) \ || ENABLED (JERRY_ES2015_BUILTIN_SET) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_ITERATOR_UL, "Set Iterator") #endif @@ -682,11 +779,16 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_EXTENSIBLE, "isExtensible") #if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_DATE_STRING_UL, "toDateString") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_TIME_STRING_UL, "toTimeString") +#endif +#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROM_CODE_POINT_UL, "fromCodePoint") +#endif +#if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_MINUTES_UL, "getUTCMinutes") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_SECONDS_UL, "getUTCSeconds") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_PROTOTYPE_OF_UL, "isPrototypeOf") -#if ENABLED (JERRY_ES2015_BUILTIN) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_SAFE_INTEGER, "isSafeInteger") #endif #if ENABLED (JERRY_BUILTIN_STRING) @@ -699,36 +801,49 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_SECONDS_UL, "setUTCSeconds") #if ENABLED (JERRY_BUILTIN_NUMBER) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_EXPONENTIAL_UL, "toExponential") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, "Array Iterator") #endif #if ENABLED (JERRY_BUILTIN_ERRORS) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, "ReferenceError") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_PROPERTY_UL, "defineProperty") +#if ENABLED (JERRY_ES2015_BUILTIN_PROXY) \ +|| ENABLED (JERRY_ES2015_BUILTIN_REFLECT) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DELETE_PROPERTY_UL, "deleteProperty") +#endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_PROTOTYPE_OF_UL, "getPrototypeOf") #if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_FULL_YEAR_UL, "getUTCFullYear") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS_OWN_PROPERTY_UL, "hasOwnProperty") -#if ENABLED (JERRY_ES2015_BUILTIN) +#if ENABLED (JERRY_ES2015) \ +|| ENABLED (JERRY_ES2015_BUILTIN_PROXY) \ +|| ENABLED (JERRY_ES2015_BUILTIN_REFLECT) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_PROTOTYPE_OF_UL, "setPrototypeOf") #endif #if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_FULL_YEAR_UL, "setUTCFullYear") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, "toLocaleString") -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING_ITERATOR_UL, "String Iterator") #endif #if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_MILLISECONDS_UL, "getMilliseconds") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_MILLISECONDS_UL, "setMilliseconds") #endif +#if ENABLED (JERRY_BUILTIN_NUMBER) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U, "MAX_SAFE_INTEGER") +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U, "MIN_SAFE_INTEGER") +#endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL, "defineProperties") #if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, "BYTES_PER_ELEMENT") #endif +#if ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, "GeneratorFunction") +#endif #if ENABLED (JERRY_BUILTIN_NUMBER) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, "NEGATIVE_INFINITY") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, "POSITIVE_INFINITY") @@ -749,7 +864,7 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENCODE_URI_COMPONENT, "encodeURIComponent #if ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_MILLISECONDS_UL, "getUTCMilliseconds") #endif -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, "isConcatSpreadable") #endif #if ENABLED (JERRY_BUILTIN_DATE) @@ -759,7 +874,7 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL, "toLocaleTimeSt #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL, "getOwnPropertyNames") LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL, "propertyIsEnumerable") -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL, "getOwnPropertySymbols") #endif LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL, "getOwnPropertyDescriptor") @@ -769,20 +884,23 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (0, LIT_MAGIC_STRING__EMPTY) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_SPACE_CHAR) #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_PI_U) -#elif ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) +#elif ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_IS) +#elif ENABLED (JERRY_BUILTIN_ARRAY) && ENABLED (JERRY_ES2015) \ +|| ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_OF) #elif ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_LN2_U) -#elif ENABLED (JERRY_ES2015_BUILTIN_MAP) \ -|| ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) +#elif ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) \ +|| ENABLED (JERRY_ES2015_BUILTIN_MAP) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_MAP_UL) #else LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_NAN) #endif #if ENABLED (JERRY_BUILTIN_MATH) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (3, LIT_MAGIC_STRING_LN2_U) -#elif ENABLED (JERRY_ES2015_BUILTIN_MAP) \ -|| ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) +#elif ENABLED (JERRY_ES2015_BUILTIN_CONTAINER) \ +|| ENABLED (JERRY_ES2015_BUILTIN_MAP) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (3, LIT_MAGIC_STRING_MAP_UL) #else LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (3, LIT_MAGIC_STRING_NAN) @@ -818,60 +936,60 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_TYPED_ARRAY_UL) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_BYTE_LENGTH_UL) #elif ENABLED (JERRY_BUILTIN_STRING) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_CHAR_CODE_AT_UL) -#elif ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) +#elif ENABLED (JERRY_ES2015) \ +|| ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_COPY_WITHIN) #else LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_ENUMERABLE) #endif -#if ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ERROR_MESSAGES) || ENABLED (JERRY_ES2015_MODULE_SYSTEM) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (11, LIT_MAGIC_STRING_RESOURCE_ANON) -#elif ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) \ -|| ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) -LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (11, LIT_MAGIC_STRING_ARRAY_BUFFER_UL) -#elif ENABLED (JERRY_BUILTIN_ERRORS) -LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (11, LIT_MAGIC_STRING_SYNTAX_ERROR_UL) -#elif ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) -LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (11, LIT_MAGIC_STRING_UINT16_ARRAY_UL) -#else -LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (11, LIT_MAGIC_STRING_CONSTRUCTOR) -#endif #if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_FLOAT32_ARRAY_UL) #elif ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) && ENABLED (JERRY_NUMBER_TYPE_FLOAT64) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_FLOAT64_ARRAY_UL) #elif ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_INVALID_DATE_UL) -#elif ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) \ +#elif ENABLED (JERRY_ES2015) \ || ENABLED (JERRY_ES2015_BUILTIN_MAP) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_MAP_ITERATOR_UL) -#elif ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) \ +#elif ENABLED (JERRY_ES2015) \ || ENABLED (JERRY_ES2015_BUILTIN_SET) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_SET_ITERATOR_UL) #else LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_CONFIGURABLE) #endif -#if ENABLED (JERRY_BUILTIN_DATE) +#if ENABLED (JERRY_BUILTIN_STRING) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (13, LIT_MAGIC_STRING_FROM_CODE_POINT_UL) +#elif ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (13, LIT_MAGIC_STRING_GET_UTC_MINUTES_UL) #else LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (13, LIT_MAGIC_STRING_IS_PROTOTYPE_OF_UL) #endif -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (14, LIT_MAGIC_STRING_ARRAY_ITERATOR_UL) #elif ENABLED (JERRY_BUILTIN_ERRORS) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (14, LIT_MAGIC_STRING_REFERENCE_ERROR_UL) #else LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (14, LIT_MAGIC_STRING_DEFINE_PROPERTY_UL) #endif -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_STRING_ITERATOR_UL) #elif ENABLED (JERRY_BUILTIN_DATE) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_GET_MILLISECONDS_UL) +#elif ENABLED (JERRY_BUILTIN_NUMBER) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U) #else LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL) #endif +#if ENABLED (JERRY_BUILTIN_NUMBER) && ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (16, LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U) +#else LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (16, LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL) +#endif #if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U) +#elif ENABLED (JERRY_ES2015) +LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL) #elif ENABLED (JERRY_BUILTIN_NUMBER) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_NEGATIVE_INFINITY_U) #elif ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) @@ -884,7 +1002,7 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_PREVENT_EXTENSIONS LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (18, LIT_MAGIC_STRING_DECODE_URI_COMPONENT) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (19, LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (20, LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL) -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) +#if ENABLED (JERRY_ES2015) LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (21, LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL) #else LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (21, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL) diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/handler.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-ext/include/jerryscript-ext/handler.h old mode 100755 new mode 100644 similarity index 95% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/handler.h rename to code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-ext/include/jerryscript-ext/handler.h index 41bfeeb88..c36b6b871 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/handler.h +++ b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerry-ext/include/jerryscript-ext/handler.h @@ -44,6 +44,8 @@ jerry_value_t jerryx_handler_gc (const jerry_value_t func_obj_val, const jerry_v const jerry_value_t args_p[], const jerry_length_t args_cnt); jerry_value_t jerryx_handler_print (const jerry_value_t func_obj_val, const jerry_value_t this_p, const jerry_value_t args_p[], const jerry_length_t args_cnt); +jerry_value_t jerryx_handler_resource_name (const jerry_value_t func_obj_val, const jerry_value_t this_p, + const jerry_value_t args_p[], const jerry_length_t args_cnt); /** * Struct used by the `jerryx_set_functions` method to diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Config_Full.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Config_Full.h deleted file mode 100755 index a8730d14c..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Config_Full.h +++ /dev/null @@ -1,23 +0,0 @@ -/* DLib configuration. */ -/* Copyright 2003-2017 IAR Systems AB. */ - -#ifndef _DLIB_CONFIG_H -#define _DLIB_CONFIG_H - -#ifndef _SYSTEM_BUILD - #pragma system_include -#endif - -/* Turn on locale support. */ -#define _DLIB_FULL_LOCALE_SUPPORT 1 - -/* Turn on FILE descriptor support. */ -#define _DLIB_FILE_DESCRIPTOR 1 - -/* Turn on multibyte formatting. */ -#define _DLIB_FORMATTED_MULTIBYTE 1 - -/* Turn on support for hex-floats in strtod. */ -#define _DLIB_STRTOD_HEX_FLOAT 1 - -#endif /* _DLIB_CONFIG_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Defaults.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Defaults.h deleted file mode 100755 index 964e459e1..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Defaults.h +++ /dev/null @@ -1,599 +0,0 @@ -/*************************************************** - * - * DLib_Defaults.h is the library configuration manager. - * - * Copyright 2003-2017 IAR Systems AB. - * - * This configuration header file performs the following tasks: - * - * 1. Includes the configuration header file, defined by _DLIB_CONFIG_FILE, - * that sets up a particular runtime environment. - * - * 2. Includes the product configuration header file, DLib_Product.h, that - * specifies default values for the product and makes sure that the - * configuration is valid. - * - * 3. Sets up default values for all remaining configuration symbols. - * - * This configuration header file, the one defined by _DLIB_CONFIG_FILE, and - * DLib_Product.h configures how the runtime environment should behave. This - * includes all system headers and the library itself, i.e. all system headers - * includes this configuration header file, and the library has been built - * using this configuration header file. - * - *************************************************** - * - * DO NOT MODIFY THIS FILE! - * - ***************************************************/ - -#ifndef _DLIB_DEFAULTS_H -#define _DLIB_DEFAULTS_H - -#ifndef _SYSTEM_BUILD - #pragma system_include -#endif - -/* Include the main configuration header file. */ -#if defined(_DLIB_CONFIG_FILE_HEADER_NAME) - #include _DLIB_CONFIG_FILE_HEADER_NAME - /* _DLIB_CONFIG_FILE_STRING is the quoted variant of above */ -#elif defined(_DLIB_CONFIG_FILE) - #include _STRINGIFY(_DLIB_CONFIG_FILE) -#else - #pragma message("Library configuration file is not specified. Use\ - --dlib_config, please see the compiler reference guide for details.") -#endif - -/* Include the product specific header file. */ -#ifndef __NO_DLIB_PRODUCT_FILE - #include -#endif - - -/* - * The remainder of the file sets up defaults for a number of - * configuration symbols, each corresponds to a feature in the - * libary. - * - * The value of the symbols should either be 1, if the feature should - * be supported, or 0 if it shouldn't. (Except where otherwise - * noted.) - */ - - -/* - * File handling - * - * Determines whether FILE descriptors and related functions exists or not. - * When this feature is selected, i.e. set to 1, then FILE descriptors and - * related functions (e.g. fprintf, fopen) exist. All files, even stdin, - * stdout, and stderr will then be handled with a file system mechanism that - * buffers files before accessing the lowlevel I/O interface (__open, __read, - * __write, etc). - * - * If not selected, i.e. set to 0, then FILE descriptors and related functions - * (e.g. fprintf, fopen) does not exist. All functions that normally uses - * stderr will use stdout instead. Functions that uses stdout and stdin (like - * printf and scanf) will access the lowlevel I/O interface directly (__open, - * __read, __write, etc), i.e. there will not be any buffering. - * - * The default is not to have support for FILE descriptors. - */ - -#ifndef _DLIB_FILE_DESCRIPTOR - #define _DLIB_FILE_DESCRIPTOR 0 -#endif - - -/* - * Use static buffers for stdout - * - * This setting controls whether the stream stdout uses a static 80 bytes - * buffer or uses a one byte buffer allocated in the file descriptor. This - * setting is only applicable if the FILE descriptors are enabled above. - * - * Default is to use a static 80 byte buffer. - */ - -#ifndef _DLIB_STDOUT_USES_STATIC_BUFFER - #define _DLIB_STDOUT_USES_STATIC_BUFFER 1 -#endif - - -/* - * Support of locale interface - * - * "Locale" is the system in C that support language- and - * contry-specific settings for a number of areas, including currency - * symbols, date and time, and multibyte encodings. - * - * This setting determines whether the locale interface exist or not. - * When this feature is selected, i.e. set to 1, the locale interface exist - * (setlocale, etc). A number of preselected locales can be activated during - * runtime. The preselected locales and encodings are choosen at linkage. The - * application will start with the "C" locale choosen. (Single byte encoding is - * always supported in this mode.) - * - * - * If not selected, i.e. set to 0, the locale interface (setlocale, etc) does - * not exist. The C locale is then preset and cannot be changed. - * - * The default is not to have support for the locale interface with the "C" - * locale and the single byte encoding. - */ - -#ifndef _DLIB_FULL_LOCALE_SUPPORT - #define _DLIB_FULL_LOCALE_SUPPORT 0 -#endif - -/* - * Define what memory to place the locale table segment (.iar.locale_table) - * in. - */ -#ifndef _DLIB_LOCALE_TABLE_MEMORY - #define _DLIB_LOCALE_TABLE_MEMORY -#endif - -/* - * Wide character and multi byte character support in library. - */ - -#ifndef _DLIB_WIDE_CHARACTERS - #define _DLIB_WIDE_CHARACTERS 1 -#endif -#ifndef _DLIB_CONFIG_AGNOSTIC - #if _DLIB_FILE_DESCRIPTOR && !_DLIB_WIDE_CHARACTERS - #error "_DLIB_FILE_DESCRIPTOR == 0 if wide characters are disabled" - #endif - #if _DLIB_FULL_LOCALE_SUPPORT && !_DLIB_WIDE_CHARACTERS - #error "_DLIB_FULL_LOCALE_SUPPORT == 0 if wide characters are disabled" - #endif -#endif - -/* - * Support of multibytes in printf- and scanf-like functions - * - * This is the default value for _DLIB_PRINTF_MULTIBYTE and - * _DLIB_SCANF_MULTIBYTE. See them for a description. - * - * Default is to not have support for multibytes in printf- and scanf-like - * functions. - */ - -#ifndef _DLIB_FORMATTED_MULTIBYTE - #define _DLIB_FORMATTED_MULTIBYTE 0 -#endif -#ifndef _DLIB_CONFIG_AGNOSTIC - #if _DLIB_FORMATTED_MULTIBYTE && !_DLIB_WIDE_CHARACTERS - #error "_DLIB_FORMATTED_MULTIBYTE == 0 if wide characters are disabled" - #endif -#endif - -/* - * Hexadecimal floating-point numbers in strtod - * - * If selected, i.e. set to 1, strtod supports C99 hexadecimal floating-point - * numbers. This also enables hexadecimal floating-points in internal functions - * used for converting strings and wide strings to float, double, and long - * double. - * - * If not selected, i.e. set to 0, C99 hexadecimal floating-point numbers - * aren't supported. - * - * Default is not to support hexadecimal floating-point numbers. - */ - -#ifndef _DLIB_STRTOD_HEX_FLOAT - #define _DLIB_STRTOD_HEX_FLOAT 0 -#endif - - -/* - * Printf configuration symbols. - * - * All the configuration symbols described further on controls the behaviour - * of printf, sprintf, and the other printf variants. - * - * The library proves four formatters for printf: 'tiny', 'small', - * 'large', and 'default'. The setup in this file controls all except - * 'tiny'. Note that both small' and 'large' explicitly removes - * some features. - */ - -/* - * Handle multibytes in printf - * - * This setting controls whether multibytes and wchar_ts are supported in - * printf. Set to 1 to support them, otherwise set to 0. - * - * See _DLIB_FORMATTED_MULTIBYTE for the default setting. - */ -#ifndef _DLIB_PRINTF_MULTIBYTE - #define _DLIB_PRINTF_MULTIBYTE _DLIB_FORMATTED_MULTIBYTE -#endif -#ifndef _DLIB_CONFIG_AGNOSTIC - #if _DLIB_PRINTF_MULTIBYTE && !_DLIB_FULL_LOCALE_SUPPORT - #error "_DLIB_PRINTF_MULTIBYTE needs full locale" - #endif - #if _DLIB_PRINTF_MULTIBYTE && !_DLIB_WIDE_CHARACTERS - #error "_DLIB_PRINTF_MULTIBYTE == 0 if wide characters are disabled" - #endif -#endif - -/* - * Support of formatting anything larger than int in printf - * - * This setting controls if 'int' should be used internally in printf, rather - * than the largest existing integer type. If 'int' is used, any integer or - * pointer type formatting use 'int' as internal type even though the - * formatted type is larger. Set to 1 to use 'int' as internal type, otherwise - * set to 0. - * - * See also next configuration. - * - * Default is to internally use largest existing internally type. - */ -#ifndef _DLIB_PRINTF_INT_TYPE_IS_INT - #define _DLIB_PRINTF_INT_TYPE_IS_INT 0 -#endif - -/* - * Support of formatting anything larger than long in printf - * - * This setting controls if 'long' should be used internally in printf, rather - * than the largest existing integer type. If 'long' is used, any integer or - * pointer type formatting use 'long' as internal type even though the - * formatted type is larger. Set to 1 to use 'long' as internal type, - * otherwise set to 0. - * - * See also previous configuration. - * - * Default is to internally use largest existing internally type. - */ -#ifndef _DLIB_PRINTF_INT_TYPE_IS_LONG - #define _DLIB_PRINTF_INT_TYPE_IS_LONG 0 -#endif - -#if _DLIB_PRINTF_INT_TYPE_IS_INT && _DLIB_PRINTF_INT_TYPE_IS_LONG - #error "At most one of _DLIB_PRINTF_INT_TYPE_IS_INT and _DLIB_PRINTF_INT_TYPE_IS_LONG can be defined." -#endif - -/* - * Emit a char a time in printf - * - * This setting controls internal output handling. If selected, i.e. set to 1, - * then printf emits one character at a time, which requires less code but - * can be slightly slower for some types of output. - * - * If not selected, i.e. set to 0, then printf buffers some outputs. - * - * Note that it is recommended to either use full file support (see - * _DLIB_FILE_DESCRIPTOR) or -- for debug output -- use the linker - * option "-e__write_buffered=__write" to enable buffered I/O rather - * than deselecting this feature. - */ -#ifndef _DLIB_PRINTF_CHAR_BY_CHAR - #define _DLIB_PRINTF_CHAR_BY_CHAR 1 -#endif - - -/* - * Scanf configuration symbols. - * - * All the configuration symbols described here controls the - * behaviour of scanf, sscanf, and the other scanf variants. - * - * The library proves three formatters for scanf: 'small', 'large', - * and 'default'. The setup in this file controls all, however both - * 'small' and 'large' explicitly removes some features. - */ - -/* - * Handle multibytes in scanf - * - * This setting controls whether multibytes and wchar_t:s are supported in - * scanf. Set to 1 to support them, otherwise set to 0. - * - * See _DLIB_FORMATTED_MULTIBYTE for the default. - */ -#ifndef _DLIB_SCANF_MULTIBYTE - #define _DLIB_SCANF_MULTIBYTE _DLIB_FORMATTED_MULTIBYTE -#endif -#ifndef _DLIB_CONFIG_AGNOSTIC - #if _DLIB_SCANF_MULTIBYTE && !_DLIB_FULL_LOCALE_SUPPORT - #error "_DLIB_SCANF_MULTIBYTE needs full locale" - #endif - #if _DLIB_SCANF_MULTIBYTE && !_DLIB_WIDE_CHARACTERS - #error "_DLIB_SCANF_MULTIBYTE == 0 if wide characters are disabled" - #endif -#endif - -/* - * Handle multibytes in asctime and strftime. - * - * This setting controls whether multibytes and wchar_ts are - * supported.Set to 1 to support them, otherwise set to 0. - * - * See _DLIB_FORMATTED_MULTIBYTE for the default setting. - */ -#ifndef _DLIB_STRFTIME_MULTIBYTE - #define _DLIB_STRFTIME_MULTIBYTE _DLIB_FORMATTED_MULTIBYTE -#endif -#ifndef _DLIB_CONFIG_AGNOSTIC - #if _DLIB_STRFTIME_MULTIBYTE && !_DLIB_FULL_LOCALE_SUPPORT - #error "_DLIB_STRFTIME_MULTIBYTE needs full locale" - #endif - #if _DLIB_STRFTIME_MULTIBYTE && !_DLIB_WIDE_CHARACTERS - #error "_DLIB_STRFTIME_MULTIBYTE == 0 if wide characters are disabled" - #endif -#endif - -/* - * Implement "qsort" using a bubble sort algorithm. - * - * Bubble sort is less efficient than quick sort but requires less RAM - * and ROM resources. - */ - -#ifndef _DLIB_QSORT_USE_BUBBLE_SORT - #define _DLIB_QSORT_USE_BUBBLE_SORT 0 -#endif - - -/* - * Set Buffert size used in qsort - */ - -#ifndef _DLIB_QSORT_BUF_SIZE - #define _DLIB_QSORT_BUF_SIZE 256 -#endif - - -/* - * Use a simple rand implementation to reduce memory footprint. - * - * The default "rand" function uses an array of 32 32-bit integers of memory to - * store the current state. - * - * The simple "rand" function uses only a single 32-bit integer. However, the - * quality of the generated psuedo-random numbers are not as good as - * the default implementation. - */ - -#ifndef _DLIB_RAND_USE_SIMPLE - #define _DLIB_RAND_USE_SIMPLE 0 -#endif - - -/* - * Set attributes for the function used by the C-SPY debug interface to stop at. - */ - -#ifndef _DLIB_DEBUG_BREAK_FUNCTION_ATTRIBUTE - #define _DLIB_DEBUG_BREAK_FUNCTION_ATTRIBUTE -#endif - -/* - * Used by products where one runtime library can be used by applications - * with different data models, in order to reduce the total number of - * libraries required. Typically, this is used when the pointer types does - * not change over the data models used, but the placement of data variables - * or/and constant variables do. - * - * If defined, this symbol is typically defined to the memory attribute that - * is used by the runtime library. The actual define must use a - * _Pragma("type_attribute = xxx") construct. In the header files, it is used - * on all statically linked data objects seen by the application. - */ -#ifndef _DLIB_DATA_ATTR - #define _DLIB_DATA_ATTR -#endif - -#ifndef _DLIB_CONST_ATTR - #ifdef _DLIB_DATA_ATTR - #define _DLIB_CONST_ATTR _DLIB_DATA_ATTR - #else - #define _DLIB_CONST_ATTR - #endif -#endif - - -/* - * Turn on support for the Target-specific ABI. The ABI is based on the - * ARM AEABI. A target, except ARM, may deviate from it. - */ - -#ifndef _DLIB_SUPPORT_FOR_AEABI - #ifdef __EDG_IA64_ABI - #define _DLIB_SUPPORT_FOR_AEABI 1 - #else - #define _DLIB_SUPPORT_FOR_AEABI 0 - #endif -#endif - -#if _DLIB_SUPPORT_FOR_AEABI == 1 - /* Possible AEABI deviations */ - #ifndef _DLIB_MBSTATET_IS_UNSIGNED_LONG - #if __INT_SIZE__ != 4 - #define _DLIB_MBSTATET_USES_UNSIGNED_LONG 1 - #else - #define _DLIB_MBSTATET_USES_UNSIGNED_LONG 0 - #endif - #endif - - #ifndef _DLIB_TIME_USES_LONG - #if __INT_SIZE__ != 4 - #define _DLIB_TIME_USES_LONG 1 - #else - #define _DLIB_TIME_USES_LONG 0 - #endif - #endif - - /* - * The "difunc" table contains information about C++ objects that - * should be dynamically initialized, where each entry in the table - * represents an initialization function that should be called. When - * the symbol _DLIB_AEABI_DIFUNC_CONTAINS_OFFSETS is true, each - * entry in the table is encoded as an offset from the entry - * location. When false, the entries contain the actual addresses to - * call. - */ - #ifndef _DLIB_AEABI_DIFUNC_CONTAINS_OFFSETS - #define _DLIB_AEABI_DIFUNC_CONTAINS_OFFSETS 1 - #endif -#endif /* _DLIB_SUPPORT_FOR_AEABI == 1 */ - -/* - * Only use IA64 functions - * - * Remove the C++ __aeabi functions when using the IA64 interface. Used in - * ARM AARCH64 mode. - * - */ -#ifndef _DLIB_ONLY_USE_CXA_FUNCTIONS -#if defined(__ICCARM__) && defined(__aarch64__) - #define _DLIB_ONLY_USE_CXA_FUNCTIONS 1 - #else - #define _DLIB_ONLY_USE_CXA_FUNCTIONS 0 - #endif -#endif - -/* - * Turn on usage of a pragma to tell the linker the number of elements used - * in a setjmp jmp_buf. - */ - -#ifndef _DLIB_USE_RTMODEL_JMP_BUF_NUM_ELEMENTS - #define _DLIB_USE_RTMODEL_JMP_BUF_NUM_ELEMENTS 0 -#endif - - -/* - * If true, the product supplies a "DLib_Product_string.h" file that - * is included from "string.h". - */ - -#ifndef _DLIB_PRODUCT_STRING - #define _DLIB_PRODUCT_STRING 0 -#endif - -/* - * Determine whether the math fma routines are fast or not. - */ -#ifndef _DLIB_FAST_FMA - #define _DLIB_FAST_FMA 0 -#endif - - -/* - * Favor speed versus some size enlargements in floating point functions. - */ -#ifndef _DLIB_SPEEDY_FLOATS - #define _DLIB_SPEEDY_FLOATS 0 -#endif - - -/* - * Include dlmalloc as an alternative heap manager in the product. - * - * Typically, an application will use a "malloc" heap manager that is - * relatively small but not that efficient. An application can - * optionally use the "dlmalloc" package, which provides a more - * effective "malloc" heap manager, if it is included in the product - * and supported by the settings. - * - * See the product documentation on how to use it, and whether or not - * it is included in the product. - */ - -#ifndef _DLIB_INCLUDE_DLMALLOC_ALTERNATIVE - /* size_t/ptrdiff_t must be a 4 bytes unsigned integer. */ - #if __SIZE_T_MAX__ < 0xfffffffful - #define _DLIB_INCLUDE_DLMALLOC_ALTERNATIVE 0 - #else - #define _DLIB_INCLUDE_DLMALLOC_ALTERNATIVE 1 - #endif -#endif - - -/* - * Make sure certain C++ functions use the soft floating point variant. - */ - -#ifndef __SOFTFP - #define __SOFTFP -#endif - - -/* - * Allow the 64-bit time_t interface? - * - * Default is yes if long long is 64 bits. - */ - -#ifndef _DLIB_TIME_ALLOW_64 - #if __LONG_LONG_SIZE__ == 8 - #define _DLIB_TIME_ALLOW_64 1 - #else - #define _DLIB_TIME_ALLOW_64 0 - #endif -#endif - - -/* - * Is time_t 64 or 32 bits? - * - * Default is 32 bits. - */ - -#ifndef _DLIB_TIME_USES_64_DEFAULT - #define _DLIB_TIME_USES_64_DEFAULT 0 -#endif - - -/* - * Do we include math functions that demands lots of constant bytes? - * (like erf, erfc, expm1, fma, lgamma, tgamma, and *_accurate) - * - */ - -#ifndef _DLIB_ALLOW_LARGE_CONSTANT_TABLES_FOR_MATH - #define _DLIB_ALLOW_LARGE_CONSTANT_TABLES_FOR_MATH 1 -#endif - - -/* - * Support of weak. - * - * __weak must be supported. Support of weak means that the call to - * a weak declared function that isn't part of the application will be - * executed as a nop instruction. - * - */ - -#ifndef __WEAK - #if !defined(__HAS_WEAK__) || !__HAS_WEAK__ - #error "Compiler must support __weak" - #endif - #define __WEAK _Pragma("object_attribute = __weak") - #define __WEAK_DEFS 1 -#endif - - -/* - * Deleted options - */ -#ifdef _DLIB_FLOAT_ENVIRONMENT - #error "Option has been removed" -#endif - -#ifdef _DLIB_SMALL_TARGET - #error "Option has been removed" -#endif - -#ifdef _DLIB_THREAD_SUPPORT - #error "Option has been removed" -#endif - -#endif /* _DLIB_DEFAULTS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Product.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Product.h deleted file mode 100755 index 8b101a259..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Product.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright 2017 IAR Systems AB. */ - -#ifndef _DLIB_PRODUCTS_H_ -#define _DLIB_PRODUCTS_H_ - -#ifndef _SYSTEM_BUILD - #pragma system_include -#endif - - -/********************************************************************* -* -* Configuration -* -*********************************************************************/ - -/* Wide character and multi byte character support in library. - * This is not allowed to vary over configurations, since math-library - * is built with wide character support. - */ -#define _DLIB_WIDE_CHARACTERS 1 - -/* This ensures that the standard header file "string.h" includes - * the Arm-specific file "DLib_Product_string.h". */ -#define _DLIB_PRODUCT_STRING 1 - -/* This ensures that the standard header file "fenv.h" includes - * the Arm-specific file "DLib_Product_fenv.h". */ -#define _DLIB_PRODUCT_FENV 1 - -/* This ensures that the standard header file "stdlib.h" includes - * the Arm-specific file "DLib_Product_stdlib.h". */ -#define _DLIB_PRODUCT_STDLIB 1 - -/* Max buffer used for swap in qsort */ -#if !defined(_DLIB_QSORT_BUF_SIZE) -#define _DLIB_QSORT_BUF_SIZE 128 -#endif - -#if defined(__RWPI__) - /* No thread local storage with RWPI */ - #define _THREAD_LOCAL -#endif - -/* Enable AEABI support */ -#define _DLIB_SUPPORT_FOR_AEABI 1 - -/* Enable rtmodel for setjump buffer size */ -#define _DLIB_USE_RTMODEL_JMP_BUF_NUM_ELEMENTS 1 - -/* Enable parsing of hex floats */ -#if !defined(_DLIB_STRTOD_HEX_FLOAT) -#define _DLIB_STRTOD_HEX_FLOAT 1 -#elif _DLIB_STRTOD_HEX_FLOAT != 1 -#error "_DLIB_STRTOD_HEX_FLOAT must be 1 to match the math-library" -#endif - -/* Special placement for locale structures when building ropi libraries */ -#if defined(__ROPI__) -#define _LOCALE_PLACEMENT_ static -#endif - -/* Use atomic if possible */ -#ifndef __STDC_NO_ATOMICS__ - #define _USE_ATOMIC_OPS 1 -#endif - -/* CPP-library uses software floatingpoint interface */ -#define __SOFTFP _Pragma( "type_attribute=__softfp" ) - -/* functions for setting errno should be __no_scratch */ -#define __NO_SCRATCH _Pragma( "type_attribute=__no_scratch" ) - -/* Use speedy implementation of floats (simple quad). */ -#define _DLIB_SPEEDY_FLOATS 1 - -/* Configure generic ELF init routines. */ -#define _DLIB_ELF_INIT_STATIC_BASE_DECLARATION __no_init uint32_t __iar_SB @ r9 -#define _DLIB_ELF_INIT_STATIC_BASE __iar_SB -#define _DLIB_ELF_INIT_FUNCTION_ATTRIBUTES \ - _Pragma("type_attribute=__interwork __thumb") -#define _DLIB_ELF_INIT_TABLE_MEMORY __data -#define _DLIB_ELF_INIT_SOURCE_MEMORY __data -#define _DLIB_ELF_INIT_DESTINATION_MEMORY __data -#define _DLIB_ELF_INIT_USE_RELATIVE_ROM_ADDRESSES 1 -#define _DLIB_ELF_INIT_REGION_COUNT_TYPE uint32_t -#ifdef AVOID_ROPI -#define _DLIB_ELF_INIT_MODULE_ATTRIBUTES \ - _Pragma("build_attribute vfpcc_compatible") \ - _Pragma("build_attribute arm_thumb_compatible") \ - _Pragma("build_attribute rwpi_compatible") \ - _Pragma("diag_suppress=Pa107") \ - _Pragma("rtmodel=\"CppFlavor\",\"*\"") \ - _Pragma("diag_default=Pa107") -#else -#define _DLIB_ELF_INIT_MODULE_ATTRIBUTES \ - _Pragma("build_attribute vfpcc_compatible") \ - _Pragma("build_attribute arm_thumb_compatible") \ - _Pragma("build_attribute ropi_compatible") \ - _Pragma("build_attribute rwpi_compatible") \ - _Pragma("diag_suppress=Pa107") \ - _Pragma("rtmodel=\"CppFlavor\",\"*\"") \ - _Pragma("diag_default=Pa107") -#endif -#define _DLIB_ELF_INIT_INTERFACE_VERSION 3 - -#define _DLIB_USE_RTMODEL_JMP_BUF_NUM_ELEMENTS 1 - -#define _XMATHWRAPPERS_DEF xarmmathwrappers.h - -#define _CPPINIT_ATTR _Pragma("no_bounds") - -#endif - diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Product_stdlib.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Product_stdlib.h deleted file mode 100755 index 30e61cb62..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Product_stdlib.h +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************** - * - * ARM-specific configuration for stdlib.h in DLib. - * - * Copyright 2017 IAR Systems AB. - * - **************************************************/ - -#ifndef _DLIB_PRODUCTS_STDLIB_H_ -#define _DLIB_PRODUCTS_STDLIB_H_ - -#ifndef _SYSTEM_BUILD - #pragma system_include -#endif - -#ifndef _NO_DEFINITIONS_IN_HEADER_FILES - -#ifdef __cplusplus -extern "C" { -#endif - -#pragma type_attribute=__value_in_regs -div_t __aeabi_idivmod(int n, int d); - -#if !_DLIB_ONLY_C89 - #pragma type_attribute=__value_in_regs - lldiv_t __aeabi_ldivmod(long long n, long long d); -#endif - -#pragma inline=forced_no_body -__ATTRIBUTES -div_t div(int a, int b) -{ -#if __ARM_FEATURE_IDIV - int q = a / b; - int r = a - (q*b); - div_t d; - d.quot = q; - d.rem = r; - return d; -#else - return __aeabi_idivmod(a, b); -#endif -} - -#pragma inline=forced_no_body -__ATTRIBUTES -ldiv_t ldiv(long a, long b) -{ -#if __ARM_FEATURE_IDIV - int q = a / b; - int r = a - (q*b); - ldiv_t ld; - ld.quot = q; - ld.rem = r; -#else - div_t d = __aeabi_idivmod(a, b); - ldiv_t ld; - ld.quot = d.quot; - ld.rem = d.rem; -#endif - return ld; -} - -#if !_DLIB_ONLY_C89 - #pragma inline=forced_no_body - __ATTRIBUTES - lldiv_t lldiv(long long a, long long b) - { - return __aeabi_ldivmod(a, b); - } -#endif - -#ifdef __cplusplus -}; -#endif - -#endif /* _NO_DEFINITIONS_IN_HEADER_FILES */ - -#endif /* _DLIB_PRODUCTS_STDLIB_H_ */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Product_string.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Product_string.h deleted file mode 100755 index acf18b04a..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/DLib_Product_string.h +++ /dev/null @@ -1,82 +0,0 @@ -/************************************************** - * - * ARM-specific configuration for string.h in DLib. - * - * Copyright 2006-2017 IAR Systems AB. - * - * $Id: DLib_Product_string.h 126465 2018-03-21 15:15:50Z mats $ - * - **************************************************/ - -#ifndef _DLIB_PRODUCTS_STRING_H_ -#define _DLIB_PRODUCTS_STRING_H_ - -#ifndef _SYSTEM_BUILD - #pragma system_include -#endif - -#ifndef _NO_DEFINITIONS_IN_HEADER_FILES - - /* - * The following is pre-declared by the compiler. - * - * __INTRINSIC void __aeabi_memset (void *, size_t, int); - * __INTRINSIC void __aeabi_memcpy (void *, const void *, size_t); - * __INTRINSIC void __aeabi_memmove(void *, const void *, size_t); - */ - - - /* - * Inhibit inline definitions for routines with an effective - * ARM-specific implementation. - * - * Not in Cortex-M1 and Cortex-MS1 - */ - - #if __CORE__ != 11 && __CORE__ != 12 - - #define _DLIB_STRING_SKIP_INLINE_MEMCHR - #define _DLIB_STRING_SKIP_INLINE_MEMCMP - #define _DLIB_STRING_SKIP_INLINE_STRCHR - #define _DLIB_STRING_SKIP_INLINE_STRCMP - #define _DLIB_STRING_SKIP_INLINE_STRLEN - #define _DLIB_STRING_SKIP_INLINE_STRNCPY - - #endif - - /* - * Redirect calls to standard functions to the corresponding - * __aeabi_X function. - */ -#ifndef __AS_BOUNDS__ -_EXTERN_C - - #define _DLIB_STRING_SKIP_INLINE_MEMCPY - #pragma inline=forced_no_body - __EFF_NENR1NW2R1 __ATTRIBUTES void * memcpy(void * _D, const void * _S, size_t _N) - { - __aeabi_memcpy(_D, _S, _N); - return _D; - } - - #define _DLIB_STRING_SKIP_INLINE_MEMMOVE - #pragma inline=forced_no_body - __EFF_NENR1NW2R1 __ATTRIBUTES void * memmove(void * _D, const void * _S, size_t _N) - { - __aeabi_memmove(_D, _S, _N); - return _D; - } - - #define _DLIB_STRING_SKIP_INLINE_MEMSET - #pragma inline=forced_no_body - __EFF_NENR1R1 __ATTRIBUTES void * memset(void * _D, int _C, size_t _N) - { - __aeabi_memset(_D, _N, _C); - return _D; - } - -_EXTERN_C_END -#endif /* __AS_BOUNDS__ */ -#endif /* _NO_DEFINITIONS_IN_HEADER_FILES */ - -#endif /* _DLIB_PRODUCTS_STRING_H_ */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/arg-internal.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/arg-internal.h deleted file mode 100755 index 3f9c4fe07..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/arg-internal.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_ARG_INTERNAL_H -#define JERRYX_ARG_INTERNAL_H - -#include "jerryscript.h" - -/** - * The iterator structor for JS arguments. - */ -struct jerryx_arg_js_iterator_t -{ - const jerry_value_t *js_arg_p; /**< the JS arguments */ - const jerry_length_t js_arg_cnt; /**< the total num of JS arguments */ - jerry_length_t js_arg_idx; /**< current index of JS argument */ -}; - -#endif /* !JERRYX_ARG_INTERNAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/arg.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/arg.h deleted file mode 100755 index 8171bcf3c..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/arg.h +++ /dev/null @@ -1,198 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_ARG_H -#define JERRYX_ARG_H - -#include -#include -#include -#include "jerryscript.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/** - * The forward declaration of jerryx_arg_t. - */ -typedef struct jerryx_arg_t jerryx_arg_t; - -/** - * The forward declaration of jerryx_arg_js_iterator_t - */ -typedef struct jerryx_arg_js_iterator_t jerryx_arg_js_iterator_t; - -/** - * Signature of the transform function. - */ -typedef jerry_value_t (*jerryx_arg_transform_func_t) (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */ - const jerryx_arg_t *c_arg_p); /**< native arg */ - -/** - * The structure used in jerryx_arg_object_properties - */ -typedef struct -{ - const jerry_char_t **name_p; /**< property name list of the JS object */ - jerry_length_t name_cnt; /**< count of the name list */ - const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */ - jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */ -} jerryx_arg_object_props_t; - -/** - * The structure used in jerryx_arg_array - */ -typedef struct -{ - const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */ - jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */ -} jerryx_arg_array_items_t; - -/** - * The structure defining a single validation & transformation step. - */ -struct jerryx_arg_t -{ - jerryx_arg_transform_func_t func; /**< the transform function */ - void *dest; /**< pointer to destination where func should store the result */ - uintptr_t extra_info; /**< extra information, specific to func */ -}; - -jerry_value_t jerryx_arg_transform_this_and_args (const jerry_value_t this_val, - const jerry_value_t *js_arg_p, - const jerry_length_t js_arg_cnt, - const jerryx_arg_t *c_arg_p, - jerry_length_t c_arg_cnt); - -jerry_value_t jerryx_arg_transform_args (const jerry_value_t *js_arg_p, - const jerry_length_t js_arg_cnt, - const jerryx_arg_t *c_arg_p, - jerry_length_t c_arg_cnt); - -jerry_value_t jerryx_arg_transform_object_properties (const jerry_value_t obj_val, - const jerry_char_t **name_p, - const jerry_length_t name_cnt, - const jerryx_arg_t *c_arg_p, - jerry_length_t c_arg_cnt); -jerry_value_t jerryx_arg_transform_array (const jerry_value_t array_val, - const jerryx_arg_t *c_arg_p, - jerry_length_t c_arg_cnt); - -/** - * Indicates whether an argument is allowed to be coerced into the expected JS type. - */ -typedef enum -{ - JERRYX_ARG_COERCE, /**< the transform inside will invoke toNumber, toBoolean or toString */ - JERRYX_ARG_NO_COERCE /**< the type coercion is not allowed. */ -} jerryx_arg_coerce_t; - -/** - * Indicates whether an argument is optional or required. - */ -typedef enum -{ - /** - * The argument is optional. If the argument is `undefined` the transform is - * successful and `c_arg_p->dest` remains untouched. - */ - JERRYX_ARG_OPTIONAL, - /** - * The argument is required. If the argument is `undefined` the transform - * will fail and `c_arg_p->dest` remains untouched. - */ - JERRYX_ARG_REQUIRED -} jerryx_arg_optional_t; - -/** - * Indicates the rounding policy which will be chosen to transform an integer. - */ -typedef enum -{ - JERRYX_ARG_ROUND, /**< round */ - JERRYX_ARG_FLOOR, /**< floor */ - JERRYX_ARG_CEIL /**< ceil */ -} jerryx_arg_round_t; - -/** - * Indicates the clamping policy which will be chosen to transform an integer. - * If the policy is NO_CLAMP, and the number is out of range, - * then the transformer will throw a range error. - */ -typedef enum -{ - JERRYX_ARG_CLAMP,/**< clamp the number when it is out of range */ - JERRYX_ARG_NO_CLAMP /**< throw a range error */ -} jerryx_arg_clamp_t; - -/* Inline functions for initializing jerryx_arg_t */ - -#define JERRYX_ARG_INTEGER(type) \ - static inline jerryx_arg_t \ - jerryx_arg_ ## type (type ## _t *dest, \ - jerryx_arg_round_t round_flag, \ - jerryx_arg_clamp_t clamp_flag, \ - jerryx_arg_coerce_t coerce_flag, \ - jerryx_arg_optional_t opt_flag); - -JERRYX_ARG_INTEGER (uint8) -JERRYX_ARG_INTEGER (int8) -JERRYX_ARG_INTEGER (uint16) -JERRYX_ARG_INTEGER (int16) -JERRYX_ARG_INTEGER (uint32) -JERRYX_ARG_INTEGER (int32) - -#undef JERRYX_ARG_INTEGER - -static inline jerryx_arg_t -jerryx_arg_number (double *dest, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_boolean (bool *dest, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_string (char *dest, uint32_t size, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_utf8_string (char *dest, uint32_t size, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_function (jerry_value_t *dest, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_native_pointer (void **dest, const jerry_object_native_info_t *info_p, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_ignore (void); -static inline jerryx_arg_t -jerryx_arg_custom (void *dest, uintptr_t extra_info, jerryx_arg_transform_func_t func); -static inline jerryx_arg_t -jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props_p, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p, jerryx_arg_optional_t opt_flag); - -jerry_value_t -jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p, - const jerryx_arg_t *c_arg_p, - jerryx_arg_transform_func_t func); - -/* Helper functions for transform functions. */ -jerry_value_t jerryx_arg_js_iterator_pop (jerryx_arg_js_iterator_t *js_arg_iter_p); -jerry_value_t jerryx_arg_js_iterator_restore (jerryx_arg_js_iterator_t *js_arg_iter_p); -jerry_value_t jerryx_arg_js_iterator_peek (jerryx_arg_js_iterator_t *js_arg_iter_p); -jerry_length_t jerryx_arg_js_iterator_index (jerryx_arg_js_iterator_t *js_arg_iter_p); - -#include "arg.impl.h" - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* !JERRYX_ARG_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/arg.impl.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/arg.impl.h deleted file mode 100755 index 1b3111e5a..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/arg.impl.h +++ /dev/null @@ -1,443 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_ARG_IMPL_H -#define JERRYX_ARG_IMPL_H - -/* transform functions for each type. */ - -#define JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL(type) \ - jerry_value_t jerryx_arg_transform_ ## type (jerryx_arg_js_iterator_t *js_arg_iter_p, \ - const jerryx_arg_t *c_arg_p); \ - jerry_value_t jerryx_arg_transform_ ## type ## _optional (jerryx_arg_js_iterator_t *js_arg_iter_p, \ - const jerryx_arg_t *c_arg_p); - -#define JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT(type) \ - JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type) \ - JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type ## _strict) - -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint8) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int8) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint16) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int16) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint32) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int32) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (number) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (string) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (utf8_string) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (boolean) - -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (function) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (native_pointer) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (object_props) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (array_items) - -jerry_value_t jerryx_arg_transform_ignore (jerryx_arg_js_iterator_t *js_arg_iter_p, - const jerryx_arg_t *c_arg_p); - -#undef JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL -#undef JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT - -/** - * The structure indicates the options used to transform integer argument. - * It will be passed into jerryx_arg_t's extra_info field. - */ -typedef struct -{ - uint8_t round; /**< rounding policy */ - uint8_t clamp; /**< clamping policy */ -} jerryx_arg_int_option_t; - -/** - * The macro used to generate jerryx_arg_xxx for int type. - */ -#define JERRYX_ARG_INT(type) \ - static inline jerryx_arg_t \ - jerryx_arg_ ## type (type ## _t *dest, \ - jerryx_arg_round_t round_flag, \ - jerryx_arg_clamp_t clamp_flag, \ - jerryx_arg_coerce_t coerce_flag, \ - jerryx_arg_optional_t opt_flag) \ - { \ - jerryx_arg_transform_func_t func; \ - if (coerce_flag == JERRYX_ARG_NO_COERCE) \ - { \ - if (opt_flag == JERRYX_ARG_OPTIONAL) \ - { \ - func = jerryx_arg_transform_ ## type ## _strict_optional; \ - } \ - else \ - { \ - func = jerryx_arg_transform_ ## type ## _strict; \ - } \ - } \ - else \ - { \ - if (opt_flag == JERRYX_ARG_OPTIONAL) \ - { \ - func = jerryx_arg_transform_ ## type ## _optional; \ - } \ - else \ - { \ - func = jerryx_arg_transform_ ## type; \ - } \ - } \ - union \ - { \ - jerryx_arg_int_option_t int_option; \ - uintptr_t extra_info; \ - } u = { .int_option = { .round = (uint8_t) round_flag, .clamp = (uint8_t) clamp_flag } }; \ - return (jerryx_arg_t) \ - { \ - .func = func, \ - .dest = (void *) dest, \ - .extra_info = u.extra_info \ - }; \ - } - -JERRYX_ARG_INT (uint8) -JERRYX_ARG_INT (int8) -JERRYX_ARG_INT (uint16) -JERRYX_ARG_INT (int16) -JERRYX_ARG_INT (uint32) -JERRYX_ARG_INT (int32) - -#undef JERRYX_ARG_INT - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `number` JS argument and stores it into a C `double`. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_number (double *dest, /**< pointer to the double where the result should be stored */ - jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (coerce_flag == JERRYX_ARG_NO_COERCE) - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_number_strict_optional; - } - else - { - func = jerryx_arg_transform_number_strict; - } - } - else - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_number_optional; - } - else - { - func = jerryx_arg_transform_number; - } - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest - }; -} /* jerryx_arg_number */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `boolean` JS argument and stores it into a C `bool`. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_boolean (bool *dest, /**< points to the native bool */ - jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (coerce_flag == JERRYX_ARG_NO_COERCE) - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_boolean_strict_optional; - } - else - { - func = jerryx_arg_transform_boolean_strict; - } - } - else - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_boolean_optional; - } - else - { - func = jerryx_arg_transform_boolean; - } - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest - }; -} /* jerryx_arg_boolean */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `string` JS argument and stores it into a C `char` array. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_string (char *dest, /**< pointer to the native char array where the result should be stored */ - uint32_t size, /**< the size of native char array */ - jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (coerce_flag == JERRYX_ARG_NO_COERCE) - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_string_strict_optional; - } - else - { - func = jerryx_arg_transform_string_strict; - } - } - else - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_string_optional; - } - else - { - func = jerryx_arg_transform_string; - } - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest, - .extra_info = (uintptr_t) size - }; -} /* jerryx_arg_string */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `string` JS argument and stores it into a C utf8 `char` array. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_utf8_string (char *dest, /**< [out] pointer to the native char array where the result should be stored */ - uint32_t size, /**< the size of native char array */ - jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (coerce_flag == JERRYX_ARG_NO_COERCE) - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_utf8_string_strict_optional; - } - else - { - func = jerryx_arg_transform_utf8_string_strict; - } - } - else - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_utf8_string_optional; - } - else - { - func = jerryx_arg_transform_utf8_string; - } - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest, - .extra_info = (uintptr_t) size - }; -} /* jerryx_arg_utf8_string */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `function` JS argument and stores it into a C `jerry_value_t`. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_function (jerry_value_t *dest, /**< pointer to the jerry_value_t where the result should be stored */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_function_optional; - } - else - { - func = jerryx_arg_transform_function; - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest - }; -} /* jerryx_arg_function */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `object` JS argument that is 'backed' with a native pointer with - * a given type info. In case the native pointer info matches, the transform - * will succeed and the object's native pointer will be assigned to *dest. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_native_pointer (void **dest, /**< pointer to where the resulting native pointer should be stored */ - const jerry_object_native_info_t *info_p, /**< expected the type info */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_native_pointer_optional; - } - else - { - func = jerryx_arg_transform_native_pointer; - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest, - .extra_info = (uintptr_t) info_p - }; -} /* jerryx_arg_native_pointer */ - -/** - * Create a jerryx_arg_t instance for ignored argument. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_ignore (void) -{ - return (jerryx_arg_t) - { - .func = jerryx_arg_transform_ignore - }; -} /* jerryx_arg_ignore */ - -/** - * Create a jerryx_arg_t instance with custom transform. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_custom (void *dest, /**< pointer to the native argument where the result should be stored */ - uintptr_t extra_info, /**< the extra parameter, specific to the transform function */ - jerryx_arg_transform_func_t func) /**< the custom transform function */ -{ - return (jerryx_arg_t) - { - .func = func, - .dest = dest, - .extra_info = extra_info - }; -} /* jerryx_arg_custom */ - -/** - * Create a jerryx_arg_t instance for object properties. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props, /**< pointer to object property mapping */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_object_props_optional; - } - else - { - func = jerryx_arg_transform_object_props; - } - - return (jerryx_arg_t) - { - .func = func, - .dest = NULL, - .extra_info = (uintptr_t) object_props - }; -} /* jerryx_arg_object_properties */ - -/** - * Create a jerryx_arg_t instance for array. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p, /**< pointer to array items mapping */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_array_items_optional; - } - else - { - func = jerryx_arg_transform_array_items; - } - - return (jerryx_arg_t) - { - .func = func, - .dest = NULL, - .extra_info = (uintptr_t) array_items_p - }; -} /* jerryx_arg_array */ - -#endif /* !JERRYX_ARG_IMPL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/byte-code.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/byte-code.h deleted file mode 100755 index 57a626a03..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/byte-code.h +++ /dev/null @@ -1,735 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef BYTE_CODE_H -#define BYTE_CODE_H - -#include "ecma-globals.h" - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup jsparser JavaScript - * @{ - * - * \addtogroup jsparser_bytecode Bytecode - * @{ - */ - -/** - * Compact byte code (CBC) is a byte code representation - * of EcmaScript which is designed for low memory - * environments. Most opcodes are only one or sometimes - * two byte long so the CBC provides a small binary size. - * - * The execution engine of CBC is a stack machine, where - * the maximum stack size is known in advance for each - * function. - */ - -/** - * Byte code flags. Only the lower 5 bit can be used - * since the stack change is encoded in the upper - * three bits for each instruction between -4 and 3 - * (except for call / construct opcodes). - */ -#define CBC_STACK_ADJUST_BASE 4 -#define CBC_STACK_ADJUST_SHIFT 5 -#define CBC_STACK_ADJUST_VALUE(value) \ - (((value) >> CBC_STACK_ADJUST_SHIFT) - CBC_STACK_ADJUST_BASE) - -#define CBC_NO_FLAG 0x00u -#define CBC_HAS_LITERAL_ARG 0x01u -#define CBC_HAS_LITERAL_ARG2 0x02u -#define CBC_HAS_BYTE_ARG 0x04u -#define CBC_HAS_BRANCH_ARG 0x08u - -/* These flags are shared */ -#define CBC_FORWARD_BRANCH_ARG 0x10u -#define CBC_POP_STACK_BYTE_ARG 0x10u - -#define CBC_ARG_TYPES (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2 | CBC_HAS_BYTE_ARG | CBC_HAS_BRANCH_ARG) - -#define CBC_HAS_POP_STACK_BYTE_ARG (CBC_HAS_BYTE_ARG | CBC_POP_STACK_BYTE_ARG) - -#if ENABLED (JERRY_ES2015_CLASS) -/** - * Checks whether the current opcode is a super constructor call - */ -#define CBC_SUPER_CALL_OPERATION(opcode) \ - ((opcode) >= PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_CALL) \ - && (opcode) <= PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_CALL_BLOCK)) -#else /* !ENABLED (JERRY_ES2015_CLASS) */ -/** - * Checks whether the current opcode is a super constructor call - */ -#define CBC_SUPER_CALL_OPERATION(opcode) false -#endif /* ENABLED (JERRY_ES2015_CLASS) */ - -/* Debug macro. */ -#define CBC_ARGS_EQ(op, types) \ - ((cbc_flags[op] & CBC_ARG_TYPES) == (types)) - -/* Debug macro. */ -#define CBC_SAME_ARGS(op1, op2) \ - (CBC_SUPER_CALL_OPERATION (op1) ? ((cbc_ext_flags[PARSER_GET_EXT_OPCODE (op1)] & CBC_ARG_TYPES) \ - == (cbc_ext_flags[PARSER_GET_EXT_OPCODE (op2)] & CBC_ARG_TYPES)) \ - : ((cbc_flags[op1] & CBC_ARG_TYPES) == (cbc_flags[op2] & CBC_ARG_TYPES))) - -#define CBC_UNARY_OPERATION(name, group) \ - CBC_OPCODE (name, CBC_NO_FLAG, 0, \ - (VM_OC_ ## group) | VM_OC_GET_STACK | VM_OC_PUT_STACK) \ - CBC_OPCODE (name ## _LITERAL, CBC_HAS_LITERAL_ARG, 1, \ - (VM_OC_ ## group) | VM_OC_GET_LITERAL | VM_OC_PUT_STACK) - -#define CBC_BINARY_OPERATION(name, group) \ - CBC_OPCODE (name, CBC_NO_FLAG, -1, \ - (VM_OC_ ## group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \ - CBC_OPCODE (name ## _RIGHT_LITERAL, CBC_HAS_LITERAL_ARG, 0, \ - (VM_OC_ ## group) | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK) \ - CBC_OPCODE (name ## _TWO_LITERALS, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 1, \ - (VM_OC_ ## group) | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK) - -#define CBC_UNARY_LVALUE_OPERATION(name, group) \ - CBC_OPCODE (name, CBC_NO_FLAG, -2, \ - (VM_OC_PROP_ ## group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE) \ - CBC_OPCODE (name ## _PUSH_RESULT, CBC_NO_FLAG, -1, \ - (VM_OC_PROP_ ## group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \ - CBC_OPCODE (name ## _BLOCK, CBC_NO_FLAG, -2, \ - (VM_OC_PROP_ ## group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (name ## _IDENT, CBC_HAS_LITERAL_ARG, 0, \ - (VM_OC_ ## group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT) \ - CBC_OPCODE (name ## _IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 1, \ - (VM_OC_ ## group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_STACK) \ - CBC_OPCODE (name ## _IDENT_BLOCK, CBC_HAS_LITERAL_ARG, 0, \ - (VM_OC_ ## group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK) - -#define CBC_UNARY_LVALUE_WITH_IDENT 3 - -#define CBC_BINARY_WITH_LITERAL 1 -#define CBC_BINARY_WITH_TWO_LITERALS 2 - -/** - * Several opcodes (mostly call and assignment opcodes) have - * two forms: one which does not push a return value onto - * the stack, and another which does. The reason is that - * the return value of these opcodes are often not used - * and the first form provides smaller byte code. - * - * The following rules must be kept by the code generator: - * - only the opcode without return value can be emitted - * by the code generator - * - the first form can be converted to the second form - * by adding 1 to the opcode - * - after the conversion the opcode must be immediately - * flushed, so no further changes are possible - * - * Hence CBC_NO_RESULT_OPERATION (context_p->last_cbc_opcode) - * cannot be true for an opcode which has a result - */ -#define CBC_NO_RESULT_OPERATION(opcode) \ - (((opcode) >= CBC_PRE_INCR && (opcode) < CBC_END) || CBC_SUPER_CALL_OPERATION ((opcode))) - -/** - * Branch instructions are organized in group of 8 opcodes. - * - 1st opcode: unused, can be used for other purpose - * - 2nd opcode: forward branch with 1 byte offset - * - 3rd opcode: forward branch with 2 byte offset - * - 4th opcode: forward branch with 3 byte offset - * - 5th opcode: unused, can be used for other purpose - * - 6th opcode: backward branch with 1 byte offset - * - 7th opcode: backward branch with 2 byte offset - * - 8th opcode: backward branch with 3 byte offset - * - * Reasons: - * The branch_opcode & 0x3 tells the length in bytes of the offset - * If branch offset & 0x4 == 0, it is a forward branch. Otherwise - * it is backward. - * - * The offset bytes are encoded in higher to lower order. - */ - -#define CBC_FORWARD_BRANCH(name, stack, vm_oc) \ - CBC_OPCODE (name, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, \ - (vm_oc) | VM_OC_GET_BRANCH) \ - CBC_OPCODE (name ## _2, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, \ - (vm_oc) | VM_OC_GET_BRANCH) \ - CBC_OPCODE (name ## _3, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, \ - (vm_oc) | VM_OC_GET_BRANCH) - -#define CBC_BACKWARD_BRANCH(name, stack, vm_oc) \ - CBC_OPCODE (name, CBC_HAS_BRANCH_ARG, stack, \ - (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH) \ - CBC_OPCODE (name ## _2, CBC_HAS_BRANCH_ARG, stack, \ - (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH) \ - CBC_OPCODE (name ## _3, CBC_HAS_BRANCH_ARG, stack, \ - (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH) - -#define CBC_BRANCH_OFFSET_LENGTH(opcode) \ - ((opcode) & 0x3) - -#define CBC_BRANCH_IS_BACKWARD(flags) \ - (!((flags) & CBC_FORWARD_BRANCH_ARG)) - -#define CBC_BRANCH_IS_FORWARD(flags) \ - ((flags) & CBC_FORWARD_BRANCH_ARG) - -/* Stack consumption of opcodes with context. */ - -/* PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION must be <= 3 */ -#define PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION 3 -/* PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION must be <= 4 */ -#define PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION 4 -/* PARSER_WITH_CONTEXT_STACK_ALLOCATION must be <= 4 */ -#define PARSER_WITH_CONTEXT_STACK_ALLOCATION 1 -/* PARSER_SUPER_CLASS_CONTEXT_STACK_ALLOCATION must be <= 4 */ -#define PARSER_SUPER_CLASS_CONTEXT_STACK_ALLOCATION 1 -/* PARSER_TRY_CONTEXT_STACK_ALLOCATION must be <= 3 */ -#define PARSER_TRY_CONTEXT_STACK_ALLOCATION 2 - -/** - * Opcode definitions. - */ -#define CBC_OPCODE_LIST \ - /* Branch opcodes first. Some other opcodes are mixed. */ \ - CBC_OPCODE (CBC_EXT_OPCODE, CBC_NO_FLAG, 0, \ - VM_OC_NONE) \ - CBC_FORWARD_BRANCH (CBC_JUMP_FORWARD, 0, \ - VM_OC_JUMP) \ - CBC_OPCODE (CBC_POP, CBC_NO_FLAG, -1, \ - VM_OC_POP) \ - CBC_BACKWARD_BRANCH (CBC_JUMP_BACKWARD, 0, \ - VM_OC_JUMP) \ - CBC_OPCODE (CBC_POP_BLOCK, CBC_NO_FLAG, -1, \ - VM_OC_POP_BLOCK | VM_OC_PUT_BLOCK) \ - CBC_FORWARD_BRANCH (CBC_BRANCH_IF_TRUE_FORWARD, -1, \ - VM_OC_BRANCH_IF_TRUE) \ - CBC_OPCODE (CBC_THROW, CBC_NO_FLAG, -1, \ - VM_OC_THROW | VM_OC_GET_STACK) \ - CBC_BACKWARD_BRANCH (CBC_BRANCH_IF_TRUE_BACKWARD, -1, \ - VM_OC_BRANCH_IF_TRUE) \ - CBC_OPCODE (CBC_CONTEXT_END, CBC_NO_FLAG, 0, \ - VM_OC_CONTEXT_END) \ - CBC_FORWARD_BRANCH (CBC_BRANCH_IF_FALSE_FORWARD, -1, \ - VM_OC_BRANCH_IF_FALSE) \ - CBC_OPCODE (CBC_CREATE_OBJECT, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_OBJECT | VM_OC_PUT_STACK) \ - CBC_BACKWARD_BRANCH (CBC_BRANCH_IF_FALSE_BACKWARD, -1, \ - VM_OC_BRANCH_IF_FALSE) \ - CBC_OPCODE (CBC_SET_PROPERTY, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_SET_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL) \ - CBC_FORWARD_BRANCH (CBC_JUMP_FORWARD_EXIT_CONTEXT, 0, \ - VM_OC_JUMP_AND_EXIT_CONTEXT) \ - CBC_OPCODE (CBC_CREATE_ARRAY, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_ARRAY | VM_OC_PUT_STACK) \ - CBC_FORWARD_BRANCH (CBC_BRANCH_IF_LOGICAL_TRUE, -1, \ - VM_OC_BRANCH_IF_LOGICAL_TRUE) \ - CBC_OPCODE (CBC_ARRAY_APPEND, CBC_HAS_POP_STACK_BYTE_ARG, 0, \ - VM_OC_APPEND_ARRAY) \ - CBC_FORWARD_BRANCH (CBC_BRANCH_IF_LOGICAL_FALSE, -1, \ - VM_OC_BRANCH_IF_LOGICAL_FALSE) \ - CBC_OPCODE (CBC_PUSH_ELISION, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_ELISON | VM_OC_PUT_STACK) \ - CBC_FORWARD_BRANCH (CBC_BRANCH_IF_STRICT_EQUAL, -1, \ - VM_OC_BRANCH_IF_STRICT_EQUAL) \ - \ - /* Basic opcodes. Note: These 4 opcodes must me in this order */ \ - CBC_OPCODE (CBC_PUSH_LITERAL, CBC_HAS_LITERAL_ARG, 1, \ - VM_OC_PUSH | VM_OC_GET_LITERAL) \ - CBC_OPCODE (CBC_PUSH_TWO_LITERALS, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 2, \ - VM_OC_PUSH_TWO | VM_OC_GET_LITERAL_LITERAL) \ - CBC_OPCODE (CBC_PUSH_THIS_LITERAL, CBC_HAS_LITERAL_ARG, 2, \ - VM_OC_PUSH_TWO | VM_OC_GET_THIS_LITERAL) \ - CBC_OPCODE (CBC_PUSH_THREE_LITERALS, CBC_HAS_LITERAL_ARG2, 3, \ - VM_OC_PUSH_THREE | VM_OC_GET_LITERAL_LITERAL) \ - CBC_OPCODE (CBC_PUSH_UNDEFINED, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_UNDEFINED | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_TRUE, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_TRUE | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_FALSE, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_FALSE | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_NULL, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_NULL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_THIS, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_THIS | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_NUMBER_0, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_0 | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_NUMBER_POS_BYTE, CBC_HAS_BYTE_ARG, 1, \ - VM_OC_PUSH_POS_BYTE | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_NUMBER_NEG_BYTE, CBC_HAS_BYTE_ARG, 1, \ - VM_OC_PUSH_NEG_BYTE | VM_OC_PUT_STACK) \ - /* Note: These 4 opcodes must me in this order */ \ - CBC_OPCODE (CBC_PUSH_PROP, CBC_NO_FLAG, -1, \ - VM_OC_PROP_GET | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_PROP_LITERAL, CBC_HAS_LITERAL_ARG, 0, \ - VM_OC_PROP_GET | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_PROP_LITERAL_LITERAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 1, \ - VM_OC_PROP_GET | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_PROP_THIS_LITERAL, CBC_HAS_LITERAL_ARG, 1, \ - VM_OC_PROP_GET | VM_OC_GET_THIS_LITERAL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_IDENT_REFERENCE, CBC_HAS_LITERAL_ARG, 3, \ - VM_OC_IDENT_REFERENCE | VM_OC_PUT_STACK) \ - /* Note: These 4 opcodes must me in this order */ \ - CBC_OPCODE (CBC_PUSH_PROP_REFERENCE, CBC_NO_FLAG, 1, \ - VM_OC_PROP_REFERENCE | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_PROP_LITERAL_REFERENCE, CBC_HAS_LITERAL_ARG, 2, \ - VM_OC_PROP_REFERENCE | VM_OC_GET_LITERAL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_PROP_LITERAL_LITERAL_REFERENCE, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 3, \ - VM_OC_PROP_REFERENCE | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_PUSH_PROP_THIS_LITERAL_REFERENCE, CBC_HAS_LITERAL_ARG, 3, \ - VM_OC_PROP_REFERENCE | VM_OC_GET_THIS_LITERAL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_NEW, CBC_HAS_POP_STACK_BYTE_ARG, 0, \ - VM_OC_NEW | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_NEW0, CBC_NO_FLAG, 0, \ - VM_OC_NEW | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_NEW1, CBC_NO_FLAG, -1, \ - VM_OC_NEW | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_EVAL, CBC_NO_FLAG, 0, \ - VM_OC_EVAL) \ - CBC_OPCODE (CBC_DEFINE_VARS, CBC_HAS_LITERAL_ARG, 0, \ - VM_OC_NONE) \ - CBC_OPCODE (CBC_INITIALIZE_VAR, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_NONE) \ - CBC_OPCODE (CBC_INITIALIZE_VARS, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_NONE) \ - CBC_OPCODE (CBC_SET_BYTECODE_PTR, CBC_NO_FLAG, 0, \ - VM_OC_NONE) \ - CBC_OPCODE (CBC_RETURN, CBC_NO_FLAG, -1, \ - VM_OC_RET | VM_OC_GET_STACK) \ - CBC_OPCODE (CBC_RETURN_WITH_BLOCK, CBC_NO_FLAG, 0, \ - VM_OC_RET) \ - CBC_OPCODE (CBC_RETURN_WITH_LITERAL, CBC_HAS_LITERAL_ARG, 0, \ - VM_OC_RET | VM_OC_GET_LITERAL) \ - CBC_OPCODE (CBC_SET_LITERAL_PROPERTY, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_SET_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL) \ - CBC_OPCODE (CBC_BREAKPOINT_ENABLED, CBC_NO_FLAG, 0, \ - VM_OC_BREAKPOINT_ENABLED) \ - CBC_OPCODE (CBC_BREAKPOINT_DISABLED, CBC_NO_FLAG, 0, \ - VM_OC_BREAKPOINT_DISABLED) \ - \ - /* Unary opcodes. */ \ - CBC_UNARY_OPERATION (CBC_PLUS, \ - PLUS) \ - CBC_UNARY_OPERATION (CBC_NEGATE, \ - MINUS) \ - CBC_UNARY_OPERATION (CBC_LOGICAL_NOT, \ - NOT) \ - CBC_UNARY_OPERATION (CBC_BIT_NOT, \ - BIT_NOT) \ - CBC_UNARY_OPERATION (CBC_VOID, \ - VOID) \ - CBC_OPCODE (CBC_TYPEOF, CBC_NO_FLAG, 0, \ - VM_OC_TYPEOF | VM_OC_GET_STACK | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_TYPEOF_IDENT, CBC_HAS_LITERAL_ARG, 1, \ - VM_OC_TYPEOF_IDENT | VM_OC_PUT_STACK) \ - \ - /* Binary opcodes. */ \ - CBC_BINARY_OPERATION (CBC_BIT_OR, \ - BIT_OR) \ - CBC_BINARY_OPERATION (CBC_BIT_XOR, \ - BIT_XOR) \ - CBC_BINARY_OPERATION (CBC_BIT_AND, \ - BIT_AND) \ - CBC_BINARY_OPERATION (CBC_EQUAL, \ - EQUAL) \ - CBC_BINARY_OPERATION (CBC_NOT_EQUAL, \ - NOT_EQUAL) \ - CBC_BINARY_OPERATION (CBC_STRICT_EQUAL, \ - STRICT_EQUAL) \ - CBC_BINARY_OPERATION (CBC_STRICT_NOT_EQUAL, \ - STRICT_NOT_EQUAL) \ - CBC_BINARY_OPERATION (CBC_LESS, \ - LESS) \ - CBC_BINARY_OPERATION (CBC_GREATER, \ - GREATER) \ - CBC_BINARY_OPERATION (CBC_LESS_EQUAL, \ - LESS_EQUAL) \ - CBC_BINARY_OPERATION (CBC_GREATER_EQUAL, \ - GREATER_EQUAL) \ - CBC_BINARY_OPERATION (CBC_IN, \ - IN) \ - CBC_BINARY_OPERATION (CBC_INSTANCEOF, \ - INSTANCEOF) \ - CBC_BINARY_OPERATION (CBC_LEFT_SHIFT, \ - LEFT_SHIFT) \ - CBC_BINARY_OPERATION (CBC_RIGHT_SHIFT, \ - RIGHT_SHIFT) \ - CBC_BINARY_OPERATION (CBC_UNS_RIGHT_SHIFT, \ - UNS_RIGHT_SHIFT) \ - CBC_BINARY_OPERATION (CBC_ADD, \ - ADD) \ - CBC_BINARY_OPERATION (CBC_SUBTRACT, \ - SUB) \ - CBC_BINARY_OPERATION (CBC_MULTIPLY, \ - MUL) \ - CBC_BINARY_OPERATION (CBC_DIVIDE, \ - DIV) \ - CBC_BINARY_OPERATION (CBC_MODULO, \ - MOD) \ - \ - /* Unary lvalue opcodes. */ \ - CBC_OPCODE (CBC_DELETE_PUSH_RESULT, CBC_NO_FLAG, -1, \ - VM_OC_PROP_DELETE | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_DELETE_IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 1, \ - VM_OC_DELETE | VM_OC_PUT_STACK) \ - CBC_UNARY_LVALUE_OPERATION (CBC_PRE_INCR, \ - PRE_INCR) \ - CBC_UNARY_LVALUE_OPERATION (CBC_PRE_DECR, \ - PRE_DECR) \ - CBC_UNARY_LVALUE_OPERATION (CBC_POST_INCR, \ - POST_INCR) \ - CBC_UNARY_LVALUE_OPERATION (CBC_POST_DECR, \ - POST_DECR) \ - \ - /* Call opcodes. */ \ - CBC_OPCODE (CBC_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, \ - VM_OC_CALL) \ - CBC_OPCODE (CBC_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, \ - VM_OC_CALL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, \ - VM_OC_CALL | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_CALL_PROP, CBC_HAS_POP_STACK_BYTE_ARG, -3, \ - VM_OC_CALL) \ - CBC_OPCODE (CBC_CALL_PROP_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, -2, \ - VM_OC_CALL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_CALL_PROP_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -3, \ - VM_OC_CALL | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_CALL0, CBC_NO_FLAG, -1, \ - VM_OC_CALL) \ - CBC_OPCODE (CBC_CALL0_PUSH_RESULT, CBC_NO_FLAG, 0, \ - VM_OC_CALL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_CALL0_BLOCK, CBC_NO_FLAG, -1, \ - VM_OC_CALL | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_CALL0_PROP, CBC_NO_FLAG, -3, \ - VM_OC_CALL) \ - CBC_OPCODE (CBC_CALL0_PROP_PUSH_RESULT, CBC_NO_FLAG, -2, \ - VM_OC_CALL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_CALL0_PROP_BLOCK, CBC_NO_FLAG, -3, \ - VM_OC_CALL | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_CALL1, CBC_NO_FLAG, -2, \ - VM_OC_CALL) \ - CBC_OPCODE (CBC_CALL1_PUSH_RESULT, CBC_NO_FLAG, -1, \ - VM_OC_CALL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_CALL1_BLOCK, CBC_NO_FLAG, -2, \ - VM_OC_CALL | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_CALL1_PROP, CBC_NO_FLAG, -4, \ - VM_OC_CALL) \ - CBC_OPCODE (CBC_CALL1_PROP_PUSH_RESULT, CBC_NO_FLAG, -3, \ - VM_OC_CALL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_CALL1_PROP_BLOCK, CBC_NO_FLAG, -4, \ - VM_OC_CALL | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_CALL2, CBC_NO_FLAG, -3, \ - VM_OC_CALL) \ - CBC_OPCODE (CBC_CALL2_PUSH_RESULT, CBC_NO_FLAG, -2, \ - VM_OC_CALL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_CALL2_BLOCK, CBC_NO_FLAG, -3, \ - VM_OC_CALL | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_CALL2_PROP, CBC_NO_FLAG, -4, \ - VM_OC_CALL) \ - CBC_OPCODE (CBC_CALL2_PROP_PUSH_RESULT, CBC_NO_FLAG, -3, \ - VM_OC_CALL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_CALL2_PROP_BLOCK, CBC_NO_FLAG, -4, \ - VM_OC_CALL | VM_OC_PUT_BLOCK) \ - \ - /* Binary assignment opcodes. */ \ - CBC_OPCODE (CBC_ASSIGN, CBC_NO_FLAG, -3, \ - VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE) \ - CBC_OPCODE (CBC_ASSIGN_PUSH_RESULT, CBC_NO_FLAG, -2, \ - VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_ASSIGN_BLOCK, CBC_NO_FLAG, -3, \ - VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_ASSIGN_SET_IDENT, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT) \ - CBC_OPCODE (CBC_ASSIGN_SET_IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 0, \ - VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_ASSIGN_SET_IDENT_BLOCK, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT) \ - CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 1, \ - VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT_BLOCK, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL, CBC_HAS_LITERAL_ARG, -2, \ - VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE) \ - CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL_PUSH_RESULT, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL_BLOCK, CBC_HAS_LITERAL_ARG, -2, \ - VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE) \ - CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 0, \ - VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL_BLOCK, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_MOV_IDENT, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_MOV_IDENT | VM_OC_GET_STACK | VM_OC_PUT_IDENT) \ - \ - /* Last opcode (not a real opcode). */ \ - CBC_OPCODE (CBC_END, CBC_NO_FLAG, 0, \ - VM_OC_NONE) - -/* All EXT branches are statement block end - * marks, so they are always forward branches. */ - -#define CBC_EXT_OPCODE_LIST \ - /* Branch opcodes first. Some other opcodes are mixed. */ \ - CBC_OPCODE (CBC_EXT_NOP, CBC_NO_FLAG, 0, \ - VM_OC_NONE) \ - CBC_FORWARD_BRANCH (CBC_EXT_WITH_CREATE_CONTEXT, \ - -1 + PARSER_WITH_CONTEXT_STACK_ALLOCATION, VM_OC_WITH) \ - CBC_OPCODE (CBC_EXT_FOR_IN_GET_NEXT, CBC_NO_FLAG, 1, \ - VM_OC_FOR_IN_GET_NEXT | VM_OC_PUT_STACK) \ - CBC_FORWARD_BRANCH (CBC_EXT_FOR_IN_CREATE_CONTEXT, \ - -1 + PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION, VM_OC_FOR_IN_CREATE_CONTEXT) \ - CBC_OPCODE (CBC_EXT_SET_GETTER, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_SET_GETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL) \ - CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_IN_HAS_NEXT, 0, \ - VM_OC_FOR_IN_HAS_NEXT) \ - CBC_OPCODE (CBC_EXT_FOR_OF_GET_NEXT, CBC_NO_FLAG, 1, \ - VM_OC_FOR_OF_GET_NEXT | VM_OC_PUT_STACK) \ - CBC_FORWARD_BRANCH (CBC_EXT_FOR_OF_CREATE_CONTEXT, \ - -1 + PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION, VM_OC_FOR_OF_CREATE_CONTEXT) \ - CBC_OPCODE (CBC_EXT_PUSH_NAMED_FUNC_EXPRESSION, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 1, \ - VM_OC_PUSH_NAMED_FUNC_EXPR | VM_OC_GET_LITERAL_LITERAL) \ - CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_OF_HAS_NEXT, 0, \ - VM_OC_FOR_OF_HAS_NEXT) \ - CBC_OPCODE (CBC_EXT_SET_SETTER, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_SET_SETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL) \ - CBC_FORWARD_BRANCH (CBC_EXT_TRY_CREATE_CONTEXT, PARSER_TRY_CONTEXT_STACK_ALLOCATION, \ - VM_OC_TRY) \ - CBC_OPCODE (CBC_EXT_THROW_REFERENCE_ERROR, CBC_NO_FLAG, 1, \ - VM_OC_THROW_REFERENCE_ERROR) \ - CBC_FORWARD_BRANCH (CBC_EXT_CATCH, 1, \ - VM_OC_CATCH) \ - CBC_OPCODE (CBC_EXT_PUSH_UNDEFINED_BASE, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_UNDEFINED_BASE | VM_OC_PUT_STACK) \ - CBC_FORWARD_BRANCH (CBC_EXT_FINALLY, 0, \ - VM_OC_FINALLY) \ - CBC_OPCODE (CBC_EXT_CLASS_EXPR_CONTEXT_END, CBC_NO_FLAG, 0, \ - VM_OC_CLASS_EXPR_CONTEXT_END) \ - CBC_FORWARD_BRANCH (CBC_EXT_SUPER_CLASS_CREATE_CONTEXT, \ - -1 + PARSER_SUPER_CLASS_CONTEXT_STACK_ALLOCATION, VM_OC_CLASS_HERITAGE) \ - \ - /* Basic opcodes. */ \ - CBC_OPCODE (CBC_EXT_PUSH_LITERAL_PUSH_NUMBER_0, CBC_HAS_LITERAL_ARG, 2, \ - VM_OC_PUSH_LIT_0 | VM_OC_GET_LITERAL) \ - CBC_OPCODE (CBC_EXT_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE, CBC_HAS_LITERAL_ARG | CBC_HAS_BYTE_ARG, 2, \ - VM_OC_PUSH_LIT_POS_BYTE | VM_OC_GET_LITERAL) \ - CBC_OPCODE (CBC_EXT_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE, CBC_HAS_LITERAL_ARG | CBC_HAS_BYTE_ARG, 2, \ - VM_OC_PUSH_LIT_NEG_BYTE | VM_OC_GET_LITERAL) \ - CBC_OPCODE (CBC_EXT_RESOURCE_NAME, CBC_NO_FLAG, 0, \ - VM_OC_RESOURCE_NAME) \ - CBC_OPCODE (CBC_EXT_LINE, CBC_NO_FLAG, 0, \ - VM_OC_LINE) \ - CBC_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY, CBC_NO_FLAG, -2, \ - VM_OC_SET_COMPUTED_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK) \ - CBC_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY_LITERAL, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_SET_COMPUTED_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL) \ - CBC_OPCODE (CBC_EXT_SET_COMPUTED_GETTER, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_SET_GETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL) \ - CBC_OPCODE (CBC_EXT_SET_COMPUTED_SETTER, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_SET_SETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL) \ - CBC_OPCODE (CBC_EXT_SET_STATIC_PROPERTY_LITERAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_SET_PROPERTY | VM_OC_GET_LITERAL_LITERAL) \ - CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_PROPERTY_LITERAL, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_SET_COMPUTED_PROPERTY | VM_OC_GET_STACK_LITERAL) \ - CBC_OPCODE (CBC_EXT_SET_STATIC_GETTER, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_SET_GETTER | VM_OC_GET_LITERAL_LITERAL) \ - CBC_OPCODE (CBC_EXT_SET_STATIC_SETTER, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \ - VM_OC_SET_SETTER | VM_OC_GET_LITERAL_LITERAL) \ - CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_GETTER, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_SET_GETTER | VM_OC_GET_STACK_LITERAL) \ - CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_SETTER, CBC_HAS_LITERAL_ARG, -1, \ - VM_OC_SET_SETTER | VM_OC_GET_STACK_LITERAL) \ - CBC_OPCODE (CBC_EXT_RESOLVE_BASE, CBC_NO_FLAG, 0, \ - VM_OC_RESOLVE_BASE_FOR_CALL) \ - \ - /* Class opcodes */ \ - CBC_OPCODE (CBC_EXT_INHERIT_AND_SET_CONSTRUCTOR, CBC_NO_FLAG, 0, \ - VM_OC_CLASS_INHERITANCE) \ - CBC_OPCODE (CBC_EXT_PUSH_CLASS_CONSTRUCTOR_AND_PROTOTYPE, CBC_NO_FLAG, 2, \ - VM_OC_PUSH_CLASS_CONSTRUCTOR_AND_PROTOTYPE | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_EXT_IMPLICIT_CONSTRUCTOR_CALL, CBC_NO_FLAG, 0, \ - VM_OC_PUSH_IMPL_CONSTRUCTOR) \ - CBC_OPCODE (CBC_EXT_SET_CLASS_LITERAL, CBC_HAS_LITERAL_ARG, 0, \ - VM_OC_SET_CLASS_CONSTRUCTOR | VM_OC_GET_LITERAL) \ - CBC_OPCODE (CBC_EXT_CLASS_EVAL, CBC_HAS_BYTE_ARG, 0, \ - VM_OC_CLASS_EVAL) \ - CBC_OPCODE (CBC_EXT_SUPER_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, \ - VM_OC_SUPER_CALL) \ - CBC_OPCODE (CBC_EXT_SUPER_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, \ - VM_OC_SUPER_CALL | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_EXT_SUPER_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, \ - VM_OC_SUPER_CALL | VM_OC_PUT_BLOCK) \ - CBC_OPCODE (CBC_EXT_PUSH_CONSTRUCTOR_SUPER, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_CONSTRUCTOR_SUPER | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_EXT_PUSH_CONSTRUCTOR_SUPER_PROP, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_CONSTRUCTOR_SUPER | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_EXT_PUSH_SUPER, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_SUPER | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_EXT_PUSH_STATIC_SUPER, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_SUPER | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_EXT_PUSH_CONSTRUCTOR_THIS, CBC_NO_FLAG, 1, \ - VM_OC_PUSH_CONSTRUCTOR_THIS | VM_OC_PUT_STACK) \ - CBC_OPCODE (CBC_EXT_SUPER_PROP_CALL, CBC_NO_FLAG, 0, \ - VM_OC_SUPER_PROP_REFERENCE) \ - CBC_OPCODE (CBC_EXT_SUPER_PROP_ASSIGN, CBC_NO_FLAG, 0, \ - VM_OC_SUPER_PROP_REFERENCE) \ - CBC_OPCODE (CBC_EXT_CONSTRUCTOR_RETURN, CBC_NO_FLAG, -1, \ - VM_OC_CONSTRUCTOR_RET | VM_OC_GET_STACK) \ - CBC_OPCODE (CBC_EXT_ERROR, CBC_NO_FLAG, 0, \ - VM_OC_ERROR) \ - \ - /* Last opcode (not a real opcode). */ \ - CBC_OPCODE (CBC_EXT_END, CBC_NO_FLAG, 0, \ - VM_OC_NONE) - -#define CBC_MAXIMUM_BYTE_VALUE 255 -#define CBC_MAXIMUM_SMALL_VALUE 510 -#define CBC_MAXIMUM_FULL_VALUE 32767 - -#define CBC_PUSH_NUMBER_BYTE_RANGE_END 256 - -#define CBC_HIGHEST_BIT_MASK 0x80 -#define CBC_LOWER_SEVEN_BIT_MASK 0x7f - -/** - * Literal encoding limit when full literal encoding mode is enabled - */ -#define CBC_FULL_LITERAL_ENCODING_LIMIT 128 - -/** - * Literal encoding delta when full literal encoding mode is enabled - */ -#define CBC_FULL_LITERAL_ENCODING_DELTA 0x8000 - -/** - * Literal encoding limit when full literal encoding mode is disabled - */ -#define CBC_SMALL_LITERAL_ENCODING_LIMIT 255 - -/** - * Literal encoding delta when full literal encoding mode is disabled - */ -#define CBC_SMALL_LITERAL_ENCODING_DELTA 0xfe01 - -/** - * Literal indicies belong to one of the following groups: - * - * 0 <= index < argument_end : arguments - * argument_end <= index < register_end : registers - * register_end <= index < ident_end : identifiers - * ident_end <= index < const_literal_end : constant literals - * const_literal_end <= index < literal_end : template literals - */ - -/** - * Compiled byte code arguments. - */ -typedef struct -{ - ecma_compiled_code_t header; /**< compiled code header */ - uint8_t stack_limit; /**< maximum number of values stored on the stack */ - uint8_t argument_end; /**< number of arguments expected by the function */ - uint8_t register_end; /**< end position of the register group */ - uint8_t ident_end; /**< end position of the identifier group */ - uint8_t const_literal_end; /**< end position of the const literal group */ - uint8_t literal_end; /**< end position of the literal group */ -} cbc_uint8_arguments_t; - -/** - * Compiled byte code arguments. - */ -typedef struct -{ - ecma_compiled_code_t header; /**< compiled code header */ - uint16_t stack_limit; /**< maximum number of values stored on the stack */ - uint16_t argument_end; /**< number of arguments expected by the function */ - uint16_t register_end; /**< end position of the register group */ - uint16_t ident_end; /**< end position of the identifier group */ - uint16_t const_literal_end; /**< end position of the const literal group */ - uint16_t literal_end; /**< end position of the literal group */ - uint16_t padding; /**< an unused value */ -} cbc_uint16_arguments_t; - -/** - * Compact byte code status flags. - */ -typedef enum -{ - CBC_CODE_FLAGS_FUNCTION = (1u << 0), /**< compiled code is JavaScript function */ - CBC_CODE_FLAGS_FULL_LITERAL_ENCODING = (1u << 1), /**< full literal encoding mode is enabled */ - CBC_CODE_FLAGS_UINT16_ARGUMENTS = (1u << 2), /**< compiled code data is cbc_uint16_arguments_t */ - CBC_CODE_FLAGS_STRICT_MODE = (1u << 3), /**< strict mode is enabled */ - CBC_CODE_FLAGS_ARGUMENTS_NEEDED = (1u << 4), /**< arguments object must be constructed */ - CBC_CODE_FLAGS_LEXICAL_ENV_NOT_NEEDED = (1u << 5), /**< no need to create a lexical environment */ - CBC_CODE_FLAGS_ARROW_FUNCTION = (1u << 6), /**< this function is an arrow function */ - CBC_CODE_FLAGS_STATIC_FUNCTION = (1u << 7), /**< this function is a static snapshot function */ - CBC_CODE_FLAGS_DEBUGGER_IGNORE = (1u << 8), /**< this function should be ignored by debugger */ - CBC_CODE_FLAGS_CONSTRUCTOR = (1u << 9), /**< this function is a constructor */ - CBC_CODE_FLAGS_REST_PARAMETER = (1u << 10), /**< this function has rest parameter */ -} cbc_code_flags; - -/** - * Non-strict arguments object must be constructed - */ -#define CBC_NON_STRICT_ARGUMENTS_NEEDED(compiled_code_p) \ - (((compiled_code_p)->status_flags & CBC_CODE_FLAGS_ARGUMENTS_NEEDED) \ - && !((compiled_code_p)->status_flags & CBC_CODE_FLAGS_STRICT_MODE)) - -#define CBC_OPCODE(arg1, arg2, arg3, arg4) arg1, - -/** - * Opcode list. - */ -typedef enum -{ - CBC_OPCODE_LIST /**< list of opcodes */ -} cbc_opcode_t; - -/** - * Extended opcode list. - */ -typedef enum -{ - CBC_EXT_OPCODE_LIST /**< list extended opcodes */ -} cbc_ext_opcode_t; - -#undef CBC_OPCODE - -/** - * Opcode flags. - */ -extern const uint8_t cbc_flags[]; -extern const uint8_t cbc_ext_flags[]; - -#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) - -/** - * Opcode names for debugging. - */ -extern const char * const cbc_names[]; -extern const char * const cbc_ext_names[]; - -#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */ - -/** - * @} - * @} - * @} - */ - -#endif /* !BYTE_CODE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/common.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/common.h deleted file mode 100755 index 184797722..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/common.h +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef COMMON_H -#define COMMON_H - -#include -#include -#include -#include -#include - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup jsparser JavaScript - * @{ - * - * \addtogroup jsparser_utils Utility - * @{ - */ - -#include "config.h" -#include "ecma-globals.h" -#include "ecma-regexp-object.h" -#include "jmem.h" - -/* Immediate management. */ - -/** - * Literal types. - * - * The LEXER_UNUSED_LITERAL type is internal and - * used for various purposes. - */ -typedef enum -{ - /* The LEXER_IS_IDENT_OR_STRING macro must be updated if the order is changed. */ - LEXER_IDENT_LITERAL = 0, /**< identifier literal */ - LEXER_STRING_LITERAL = 1, /**< string literal */ - LEXER_NUMBER_LITERAL = 2, /**< number literal */ - LEXER_FUNCTION_LITERAL = 3, /**< function literal */ - LEXER_REGEXP_LITERAL = 4, /**< regexp literal */ - LEXER_UNUSED_LITERAL = 5, /**< unused literal, can only be - used by the byte code generator. */ -} lexer_literal_type_t; - -/** - * Checks whether the literal type is identifier or string. - */ -#define LEXER_IS_IDENT_OR_STRING(literal_type) ((literal_type) <= LEXER_STRING_LITERAL) - -/** - * Flag bits for status_flags member of lexer_literal_t. - */ -typedef enum -{ - LEXER_FLAG_VAR = (1 << 0), /**< local identifier (var, function arg) */ - LEXER_FLAG_NO_REG_STORE = (1 << 1), /**< this local identifier cannot be stored in register */ - LEXER_FLAG_INITIALIZED = (1 << 2), /**< this local identifier is initialized with a value */ - LEXER_FLAG_FUNCTION_ARGUMENT = (1 << 3), /**< this local identifier is a function argument */ - LEXER_FLAG_UNUSED_IDENT = (1 << 4), /**< this identifier is referenced by sub-functions, - * but not referenced by the currently parsed function */ - LEXER_FLAG_SOURCE_PTR = (1 << 5), /**< the literal is directly referenced in the source code - * (no need to allocate memory) */ - LEXER_FLAG_LATE_INIT = (1 << 6), /**< initialize this variable after the byte code is freed */ -} lexer_literal_status_flags_t; - -/** - * Type of property length. - */ -#if ENABLED (JERRY_CPOINTER_32_BIT) -typedef uint32_t prop_length_t; -#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */ -typedef uint16_t prop_length_t; -#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */ - -/** - * Literal data. - */ -typedef struct -{ - union - { - ecma_value_t value; /**< literal value (not processed by the parser) */ - const uint8_t *char_p; /**< character value */ - ecma_compiled_code_t *bytecode_p; /**< compiled function or regexp pointer */ - uint32_t source_data; /**< encoded source literal */ - } u; - -#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) - struct -#else /* !ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */ - union -#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */ - { - prop_length_t length; /**< length of ident / string literal */ - uint16_t index; /**< real index during post processing */ - } prop; - - uint8_t type; /**< type of the literal */ - uint8_t status_flags; /**< status flags */ -} lexer_literal_t; - -void util_free_literal (lexer_literal_t *literal_p); - -#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) -void util_print_literal (lexer_literal_t *); -#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */ - -/* TRY/CATCH block */ - -#define PARSER_TRY_CONTEXT(context_name) \ - jmp_buf context_name - -#define PARSER_THROW(context_name) \ - longjmp (context_name, 1); - -#define PARSER_TRY(context_name) \ - { \ - if (!setjmp (context_name)) \ - { \ - -#define PARSER_CATCH \ - } \ - else \ - { - -#define PARSER_TRY_END \ - } \ - } - -/** - * @} - * @} - * @} - */ - -#endif /* !COMMON_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/debugger.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/debugger.h deleted file mode 100755 index d18825632..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/debugger.h +++ /dev/null @@ -1,494 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef DEBUGGER_H -#define DEBUGGER_H - -#include "ecma-globals.h" -#include "jerryscript-debugger-transport.h" - -#if ENABLED (JERRY_DEBUGGER) - -/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */ - -/** - * Frequency of calling jerry_debugger_receive() by the VM. - */ -#define JERRY_DEBUGGER_MESSAGE_FREQUENCY 5 - -/** - * This constant represents that the string to be sent has no subtype. - */ -#define JERRY_DEBUGGER_NO_SUBTYPE 0 - -/** - * Limited resources available for the engine, so it is important to - * check the maximum buffer size. It needs to be between 64 and 256 bytes. - */ -#if JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE < 64 || JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE > 256 -#error Please define the MAX_BUFFER_SIZE between 64 and 256 bytes. -#endif /* JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE < 64 || JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE > 256 */ - -/** - * Calculate the maximum number of items for a given type - * which can be transmitted in one message. - */ -#define JERRY_DEBUGGER_SEND_MAX(type) \ - ((size_t) ((JERRY_CONTEXT (debugger_max_send_size) - sizeof (jerry_debugger_send_type_t)) / sizeof (type))) - -/** - * Calculate the size of a message when a count number of items transmitted. - */ -#define JERRY_DEBUGGER_SEND_SIZE(count, type) \ - ((size_t) ((count * sizeof (type)) + sizeof (jerry_debugger_send_type_t))) - -/** - * Debugger operation modes: - * - * The debugger has two operation modes: run mode and breakpoint mode. - * - * In run mode the debugger server accepts only a limited number of message - * types from the debugger client (e.g. stop execution, set breakpoint). - * - * In breakpoint mode the JavaScript execution is stopped at a breakpoint and - * more message types are accepted (e.g. get backtrace, evaluate expression). - * - * Switching between modes: - * - * When the JavaScript execution stops at a breakpoint the server sends a - * JERRY_DEBUGGER_BREAKPOINT_HIT message to the client. The client can only - * issue breakpoint mode commands after this message is received. - * - * Certain breakpoint mode commands (e.g. continue) resumes the JavaScript - * execution and the client must not send any breakpoint mode messages - * until the JERRY_DEBUGGER_BREAKPOINT_HIT is received again. - * - * The debugger server starts in run mode but stops at the first available - * breakpoint. - */ - -/** - * Debugger option flags. - */ -typedef enum -{ - JERRY_DEBUGGER_CONNECTED = 1u << 0, /**< debugger is connected */ - JERRY_DEBUGGER_BREAKPOINT_MODE = 1u << 1, /**< debugger waiting at a breakpoint */ - JERRY_DEBUGGER_VM_STOP = 1u << 2, /**< stop at the next breakpoint even if disabled */ - JERRY_DEBUGGER_VM_IGNORE = 1u << 3, /**< ignore all breakpoints */ - JERRY_DEBUGGER_VM_IGNORE_EXCEPTION = 1u << 4, /**< debugger doesn't stop at any exception */ - JERRY_DEBUGGER_VM_EXCEPTION_THROWN = 1u << 5, /**< no need to stop for this exception */ - JERRY_DEBUGGER_PARSER_WAIT = 1u << 6, /**< debugger should wait after parsing is completed */ - JERRY_DEBUGGER_PARSER_WAIT_MODE = 1u << 7, /**< debugger is waiting after parsing is completed */ - JERRY_DEBUGGER_CLIENT_SOURCE_MODE = 1u << 8, /**< debugger waiting for client code */ - JERRY_DEBUGGER_CLIENT_NO_SOURCE = 1u << 9, /**< debugger leaving the client source loop */ - JERRY_DEBUGGER_CONTEXT_RESET_MODE = 1u << 10, /**< debugger and engine reinitialization mode */ -#ifdef ACE_DEBUGGER_CUSTOM - JERRY_DEBUGGER_TRANSPORT_STARTED = 1u << 11, /**< only can send data to client after this flag set */ -#endif -} jerry_debugger_flags_t; - -/** - * Set debugger flags. - */ -#define JERRY_DEBUGGER_SET_FLAGS(flags) \ - JERRY_CONTEXT (debugger_flags) = (JERRY_CONTEXT (debugger_flags) | (uint32_t) (flags)) - -/** - * Clear debugger flags. - */ -#define JERRY_DEBUGGER_CLEAR_FLAGS(flags) \ - JERRY_CONTEXT (debugger_flags) = (JERRY_CONTEXT (debugger_flags) & (uint32_t) ~(flags)) - -/** - * Set and clear debugger flags. - */ -#define JERRY_DEBUGGER_UPDATE_FLAGS(flags_to_set, flags_to_clear) \ - JERRY_CONTEXT (debugger_flags) = ((JERRY_CONTEXT (debugger_flags) | (uint32_t) (flags_to_set)) \ - & (uint32_t) ~(flags_to_clear)) - -/** - * Types for the package. - */ -typedef enum -{ - /* Messages sent by the server to client. */ - /* This is a handshake message, sent once during initialization. */ - JERRY_DEBUGGER_CONFIGURATION = 1, /**< debugger configuration */ - /* These messages are sent by the parser. */ - JERRY_DEBUGGER_PARSE_ERROR = 2, /**< parse error */ - JERRY_DEBUGGER_BYTE_CODE_CP = 3, /**< byte code compressed pointer */ - JERRY_DEBUGGER_PARSE_FUNCTION = 4, /**< parsing a new function */ - JERRY_DEBUGGER_BREAKPOINT_LIST = 5, /**< list of line offsets */ - JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST = 6, /**< list of byte code offsets */ - JERRY_DEBUGGER_SOURCE_CODE = 7, /**< source code fragment */ - JERRY_DEBUGGER_SOURCE_CODE_END = 8, /**< source code last fragment */ - JERRY_DEBUGGER_SOURCE_CODE_NAME = 9, /**< source code name fragment */ - JERRY_DEBUGGER_SOURCE_CODE_NAME_END = 10, /**< source code name last fragment */ - JERRY_DEBUGGER_FUNCTION_NAME = 11, /**< function name fragment */ - JERRY_DEBUGGER_FUNCTION_NAME_END = 12, /**< function name last fragment */ - JERRY_DEBUGGER_WAITING_AFTER_PARSE = 13, /**< engine waiting for a parser resume */ - /* These messages are generic messages. */ - JERRY_DEBUGGER_RELEASE_BYTE_CODE_CP = 14, /**< invalidate byte code compressed pointer */ - JERRY_DEBUGGER_MEMSTATS_RECEIVE = 15, /**< memstats sent to the client */ - JERRY_DEBUGGER_BREAKPOINT_HIT = 16, /**< notify breakpoint hit */ - JERRY_DEBUGGER_EXCEPTION_HIT = 17, /**< notify exception hit */ - JERRY_DEBUGGER_EXCEPTION_STR = 18, /**< exception string fragment */ - JERRY_DEBUGGER_EXCEPTION_STR_END = 19, /**< exception string last fragment */ - JERRY_DEBUGGER_BACKTRACE_TOTAL = 20, /**< number of total frames */ - JERRY_DEBUGGER_BACKTRACE = 21, /**< backtrace data */ - JERRY_DEBUGGER_BACKTRACE_END = 22, /**< last backtrace data */ - JERRY_DEBUGGER_EVAL_RESULT = 23, /**< eval result */ - JERRY_DEBUGGER_EVAL_RESULT_END = 24, /**< last part of eval result */ - JERRY_DEBUGGER_WAIT_FOR_SOURCE = 25, /**< engine waiting for source code */ - JERRY_DEBUGGER_OUTPUT_RESULT = 26, /**< output sent by the program to the debugger */ - JERRY_DEBUGGER_OUTPUT_RESULT_END = 27, /**< last output result data */ - JERRY_DEBUGGER_SCOPE_CHAIN = 28, /**< scope chain */ - JERRY_DEBUGGER_SCOPE_CHAIN_END = 29, /**< last output of scope chain */ - JERRY_DEBUGGER_SCOPE_VARIABLES = 30, /**< scope variables */ - JERRY_DEBUGGER_SCOPE_VARIABLES_END = 31, /**< last output of scope variables */ - JERRY_DEBUGGER_CLOSE_CONNECTION = 32, /**< close connection with the client */ - JERRY_DEBUGGER_MESSAGES_OUT_MAX_COUNT, /**< number of different type of output messages by the debugger */ - - /* Messages sent by the client to server. */ - - /* The following messages are accepted in both run and breakpoint modes. */ - JERRY_DEBUGGER_FREE_BYTE_CODE_CP = 1, /**< free byte code compressed pointer */ - JERRY_DEBUGGER_UPDATE_BREAKPOINT = 2, /**< update breakpoint status */ - JERRY_DEBUGGER_EXCEPTION_CONFIG = 3, /**< exception handler config */ - JERRY_DEBUGGER_PARSER_CONFIG = 4, /**< parser config */ - JERRY_DEBUGGER_MEMSTATS = 5, /**< list memory statistics */ - JERRY_DEBUGGER_STOP = 6, /**< stop execution */ - /* The following message is only available in waiting after parse mode. */ - JERRY_DEBUGGER_PARSER_RESUME = 7, /**< stop waiting after parse */ - /* The following four messages are only available in client switch mode. */ - JERRY_DEBUGGER_CLIENT_SOURCE = 8, /**< first message of client source */ - JERRY_DEBUGGER_CLIENT_SOURCE_PART = 9, /**< next message of client source */ - JERRY_DEBUGGER_NO_MORE_SOURCES = 10, /**< no more sources notification */ - JERRY_DEBUGGER_CONTEXT_RESET = 11, /**< context reset request */ - /* The following messages are only available in breakpoint - * mode and they switch the engine to run mode. */ - JERRY_DEBUGGER_CONTINUE = 12, /**< continue execution */ - JERRY_DEBUGGER_STEP = 13, /**< next breakpoint, step into functions */ - JERRY_DEBUGGER_NEXT = 14, /**< next breakpoint in the same context */ - JERRY_DEBUGGER_FINISH = 15, /**< Continue running just after the function in the current stack frame returns */ - /* The following messages are only available in breakpoint - * mode and this mode is kept after the message is processed. */ - JERRY_DEBUGGER_GET_BACKTRACE = 16, /**< get backtrace */ - JERRY_DEBUGGER_EVAL = 17, /**< first message of evaluating a string */ - JERRY_DEBUGGER_EVAL_PART = 18, /**< next message of evaluating a string */ - JERRY_DEBUGGER_GET_SCOPE_CHAIN = 19, /**< get type names of the scope chain */ - JERRY_DEBUGGER_GET_SCOPE_VARIABLES = 20, /**< get variables of a scope */ - JERRY_DEBUGGER_MESSAGES_IN_MAX_COUNT, /**< number of different type of input messages */ -} jerry_debugger_header_type_t; - -/** - * Debugger option flags. - */ -typedef enum -{ - JERRY_DEBUGGER_LITTLE_ENDIAN = 1u << 0, /**< little endian */ -} jerry_debugger_configuration_flags_t; - -/** - * Subtypes of eval. - */ -typedef enum -{ - JERRY_DEBUGGER_EVAL_EVAL = 0, /**< evaluate expression */ - JERRY_DEBUGGER_EVAL_THROW = 1, /**< evaluate expression and throw the result */ - JERRY_DEBUGGER_EVAL_ABORT = 2, /**< evaluate expression and abrot with the result */ -} jerry_debugger_eval_type_t; - -/** - * Subtypes of eval_result. - */ -typedef enum -{ - JERRY_DEBUGGER_EVAL_OK = 1, /**< eval result, no error */ - JERRY_DEBUGGER_EVAL_ERROR = 2, /**< eval result when an error has occurred */ -} jerry_debugger_eval_result_type_t; - -/** - * Subtypes of output_result. - * - * Note: - * This enum has to be kept in sync with jerry_log_level_t with an offset - * of +2. - */ -typedef enum -{ - JERRY_DEBUGGER_OUTPUT_OK = 1, /**< output result, no error */ - JERRY_DEBUGGER_OUTPUT_ERROR = 2, /**< output result, error */ - JERRY_DEBUGGER_OUTPUT_WARNING = 3, /**< output result, warning */ - JERRY_DEBUGGER_OUTPUT_DEBUG = 4, /**< output result, debug */ - JERRY_DEBUGGER_OUTPUT_TRACE = 5, /**< output result, trace */ -} jerry_debugger_output_subtype_t; - -/** - * Types of scopes. - */ -typedef enum -{ - JERRY_DEBUGGER_SCOPE_WITH = 1, /**< with */ - JERRY_DEBUGGER_SCOPE_LOCAL = 2, /**< local */ - JERRY_DEBUGGER_SCOPE_CLOSURE = 3, /**< closure */ - JERRY_DEBUGGER_SCOPE_GLOBAL = 4, /**< global */ - JERRY_DEBUGGER_SCOPE_NON_CLOSURE = 5 /**< non closure */ -} jerry_debugger_scope_chain_type_t; - -/** - * Type of scope variables. - */ -typedef enum -{ - JERRY_DEBUGGER_VALUE_NONE = 1, - JERRY_DEBUGGER_VALUE_UNDEFINED = 2, - JERRY_DEBUGGER_VALUE_NULL = 3, - JERRY_DEBUGGER_VALUE_BOOLEAN = 4, - JERRY_DEBUGGER_VALUE_NUMBER = 5, - JERRY_DEBUGGER_VALUE_STRING = 6, - JERRY_DEBUGGER_VALUE_FUNCTION = 7, - JERRY_DEBUGGER_VALUE_ARRAY = 8, - JERRY_DEBUGGER_VALUE_OBJECT = 9 -} jerry_debugger_scope_variable_type_t; - -/** - * Byte data for evaluating expressions and receiving client source. - */ -typedef struct -{ - uint32_t uint8_size; /**< total size of the client source */ - uint32_t uint8_offset; /**< current offset in the client source */ -} jerry_debugger_uint8_data_t; - -/** - * Delayed free of byte code data. - */ -typedef struct -{ - uint16_t size; /**< size of the byte code header divided by JMEM_ALIGNMENT */ - jmem_cpointer_t prev_cp; /**< previous byte code data to be freed */ -} jerry_debugger_byte_code_free_t; - -/** - * Outgoing message: JerryScript configuration. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t configuration; /**< configuration option bits */ - uint8_t version[sizeof (uint32_t)]; /**< debugger version */ - uint8_t max_message_size; /**< maximum incoming message size */ - uint8_t cpointer_size; /**< size of compressed pointers */ -} jerry_debugger_send_configuration_t; - -/** - * Outgoing message: message without arguments. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ -} jerry_debugger_send_type_t; - -/** - * Incoming message: message without arguments. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ -} jerry_debugger_receive_type_t; - -/** - * Outgoing message: string (Source file name or function name). - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t string[]; /**< string data */ -} jerry_debugger_send_string_t; - -/** - * Outgoing message: uint32 value. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t line[sizeof (uint32_t)]; /**< value data */ - uint8_t column[sizeof (uint32_t)]; /**< value data */ -} jerry_debugger_send_parse_function_t; - -/** - * Outgoing message: byte code compressed pointer. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */ -} jerry_debugger_send_byte_code_cp_t; - -/** - * Incoming message: byte code compressed pointer. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */ -} jerry_debugger_receive_byte_code_cp_t; - -/** - * Incoming message: update (enable/disable) breakpoint status. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t is_set_breakpoint; /**< set or clear breakpoint */ - uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */ - uint8_t offset[sizeof (uint32_t)]; /**< breakpoint offset */ -} jerry_debugger_receive_update_breakpoint_t; - -/** - * Outgoing message: send memory statistics - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t allocated_bytes[sizeof (uint32_t)]; /**< allocated bytes */ - uint8_t byte_code_bytes[sizeof (uint32_t)]; /**< byte code bytes */ - uint8_t string_bytes[sizeof (uint32_t)]; /**< string bytes */ - uint8_t object_bytes[sizeof (uint32_t)]; /**< object bytes */ - uint8_t property_bytes[sizeof (uint32_t)]; /**< property bytes */ -} jerry_debugger_send_memstats_t; - -/** - * Outgoing message: notify breakpoint hit. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */ - uint8_t offset[sizeof (uint32_t)]; /**< breakpoint offset */ -} jerry_debugger_send_breakpoint_hit_t; - -/** - * Stack frame descriptor for sending backtrace information. - */ -typedef struct -{ - uint8_t byte_code_cp[sizeof (jmem_cpointer_t)]; /**< byte code compressed pointer */ - uint8_t offset[sizeof (uint32_t)]; /**< last breakpoint offset */ -} jerry_debugger_frame_t; - -/** - * Outgoing message: backtrace information. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - jerry_debugger_frame_t frames[]; /**< frames */ -} jerry_debugger_send_backtrace_t; - -/** - * Outgoing message: scope chain. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t scope_types[]; /**< scope types */ -} jerry_debugger_send_scope_chain_t; - -/** - * Outgoing message: number of total frames in backtrace. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t frame_count[sizeof (uint32_t)]; /**< total number of frames */ -} jerry_debugger_send_backtrace_total_t; - -/** - * Incoming message: set behaviour when exception occures. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t enable; /**< non-zero: enable stop at exception */ -} jerry_debugger_receive_exception_config_t; - -/** - * Incoming message: set parser configuration. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t enable_wait; /**< non-zero: wait after parsing is completed */ -} jerry_debugger_receive_parser_config_t; - -/** - * Incoming message: get backtrace. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t min_depth[sizeof (uint32_t)]; /**< minimum depth*/ - uint8_t max_depth[sizeof (uint32_t)]; /**< maximum depth (0 - unlimited) */ - uint8_t get_total_frame_count; /**< non-zero: if total frame count is also requested */ -} jerry_debugger_receive_get_backtrace_t; - -/** - * Incoming message: first message of evaluating expression. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t eval_size[sizeof (uint32_t)]; /**< total size of the message */ -} jerry_debugger_receive_eval_first_t; - -/** - * Incoming message: get scope variables -*/ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t chain_index[sizeof (uint32_t)]; /**< index element of the scope */ -} jerry_debugger_receive_get_scope_variables_t; - -/** - * Incoming message: first message of client source. - */ -typedef struct -{ - uint8_t type; /**< type of the message */ - uint8_t code_size[sizeof (uint32_t)]; /**< total size of the message */ -} jerry_debugger_receive_client_source_first_t; - -void jerry_debugger_free_unreferenced_byte_code (void); - -bool jerry_debugger_receive (jerry_debugger_uint8_data_t **message_data_p); - -void jerry_debugger_breakpoint_hit (uint8_t message_type); - -void jerry_debugger_send_type (jerry_debugger_header_type_t type); -bool jerry_debugger_send_configuration (uint8_t max_message_size); -void jerry_debugger_send_data (jerry_debugger_header_type_t type, const void *data, size_t size); -bool jerry_debugger_send_string (uint8_t message_type, uint8_t sub_type, const uint8_t *string_p, size_t string_length); -bool jerry_debugger_send_function_cp (jerry_debugger_header_type_t type, ecma_compiled_code_t *compiled_code_p); -bool jerry_debugger_send_parse_function (uint32_t line, uint32_t column); -void jerry_debugger_send_memstats (void); -bool jerry_debugger_send_exception_string (void); - -#endif /* ENABLED (JERRY_DEBUGGER) */ - -#endif /* !DEBUGGER_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-alloc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-alloc.h deleted file mode 100755 index 437931781..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-alloc.h +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_ALLOC_H -#define ECMA_ALLOC_H - -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmaalloc Routines for allocation/freeing memory for ECMA data types - * @{ - */ - -/** - * Allocate memory for ecma-object - * - * @return pointer to allocated memory - */ -ecma_object_t *ecma_alloc_object (void); - -/** - * Dealloc memory from an ecma-object - */ -void ecma_dealloc_object (ecma_object_t *object_p); - -/** - * Allocate memory for extended object - * - * @return pointer to allocated memory - */ -ecma_extended_object_t *ecma_alloc_extended_object (size_t size); - -/** - * Dealloc memory of an extended object - */ -void ecma_dealloc_extended_object (ecma_object_t *object_p, size_t size); - -/** - * Allocate memory for ecma-number - * - * @return pointer to allocated memory - */ -ecma_number_t *ecma_alloc_number (void); - -/** - * Dealloc memory from an ecma-number - */ -void ecma_dealloc_number (ecma_number_t *number_p); - -/** - * Allocate memory for ecma-string descriptor - * - * @return pointer to allocated memory - */ -ecma_string_t *ecma_alloc_string (void); - -/** - * Dealloc memory from ecma-string descriptor - */ -void ecma_dealloc_string (ecma_string_t *string_p); - -/** - * Allocate memory for extended ecma-string descriptor - * - * @return pointer to allocated memory - */ -ecma_extended_string_t *ecma_alloc_extended_string (void); - -/** - * Dealloc memory from extended ecma-string descriptor - */ -void ecma_dealloc_extended_string (ecma_extended_string_t *string_p); - -/** - * Allocate memory for string with character data - * - * @return pointer to allocated memory - */ -ecma_string_t *ecma_alloc_string_buffer (size_t size); - -/** - * Dealloc memory of a string with character data - */ -void ecma_dealloc_string_buffer (ecma_string_t *string_p, size_t size); - -/** - * Allocate memory for ecma-property pair - * - * @return pointer to allocated memory - */ -ecma_property_pair_t *ecma_alloc_property_pair (void); - -/** - * Dealloc memory from an ecma-property pair - */ -void ecma_dealloc_property_pair (ecma_property_pair_t *property_pair_p); - -/** - * @} - * @} - */ - -#endif /* !ECMA_ALLOC_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-array-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-array-object.h deleted file mode 100755 index b5de122f9..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-array-object.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_ARRAY_OBJECT_H -#define ECMA_ARRAY_OBJECT_H - -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmaarrayobject ECMA Array object related routines - * @{ - */ - -/** - * Maximum number of array holes in a fast mode access array. - * If the number of holes exceeds this limit, the array is converted back - * to normal property list based array. - */ -#define ECMA_FAST_ARRAY_MAX_HOLE_COUNT 32 - -/** - * Flags for ecma_op_array_object_set_length - */ -typedef enum -{ - ECMA_ARRAY_OBJECT_SET_LENGTH_FLAG_IS_THROW = 1u << 0, /**< is_throw flag is set */ - ECMA_ARRAY_OBJECT_SET_LENGTH_FLAG_REJECT = 1u << 1, /**< reject later because the descriptor flags - * contains an unallowed combination */ - ECMA_ARRAY_OBJECT_SET_LENGTH_FLAG_WRITABLE_DEFINED = 1u << 2, /**< writable flag defined - * in the property descriptor */ - ECMA_ARRAY_OBJECT_SET_LENGTH_FLAG_WRITABLE = 1u << 3, /**< writable flag enabled - * in the property descriptor */ -} ecma_array_object_set_length_flags_t; - -ecma_object_t * -ecma_op_new_array_object (ecma_length_t length); - -ecma_object_t * -ecma_op_new_fast_array_object (ecma_length_t length); - -ecma_value_t * -ecma_fast_array_extend (ecma_object_t *object_p, uint32_t new_lengt); - -bool -ecma_fast_array_set_property (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t value); - -void -ecma_array_object_delete_property (ecma_object_t *object_p, ecma_string_t *property_name_p, - ecma_property_value_t *prop_value_p); - -ecma_collection_t * -ecma_fast_array_get_property_names (ecma_object_t *object_p, uint32_t opts); - -void -ecma_fast_array_convert_to_normal (ecma_object_t *object_p); - -ecma_value_t -ecma_op_create_array_object (const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len, - bool is_treat_single_arg_as_length); - -#if ENABLED (JERRY_ES2015_CLASS) -ecma_value_t -ecma_op_create_array_object_by_constructor (const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len, - bool is_treat_single_arg_as_length, ecma_object_t *object_p); -#endif /* ENABLED (JERRY_ES2015_CLASS) */ - -ecma_value_t -ecma_op_array_object_set_length (ecma_object_t *object_p, ecma_value_t new_value, uint32_t flags); - -ecma_value_t -ecma_op_array_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p, - const ecma_property_descriptor_t *property_desc_p); - -void -ecma_op_array_list_lazy_property_names (ecma_object_t *obj_p, bool separate_enumerable, - ecma_collection_t *main_collection_p, - ecma_collection_t *non_enum_collection_p); - -/** - * @} - * @} - */ - -#endif /* !ECMA_ARRAY_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-arraybuffer-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-arraybuffer-object.h deleted file mode 100755 index a77deb500..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-arraybuffer-object.h +++ /dev/null @@ -1,55 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_ARRAYBUFFER_OBJECT_H -#define ECMA_ARRAYBUFFER_OBJECT_H - -#include "ecma-globals.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmaarraybufferobject ECMA ArrayBuffer object related routines - * @{ - */ - -ecma_value_t -ecma_op_create_arraybuffer_object (const ecma_value_t *, ecma_length_t); - -/** - * Helper functions for arraybuffer. - */ -ecma_object_t * -ecma_arraybuffer_new_object (ecma_length_t lengh); -ecma_object_t * -ecma_arraybuffer_new_object_external (ecma_length_t length, - void *buffer_p, - ecma_object_native_free_callback_t free_cb); -lit_utf8_byte_t * JERRY_ATTR_PURE -ecma_arraybuffer_get_buffer (ecma_object_t *obj_p); -ecma_length_t JERRY_ATTR_PURE -ecma_arraybuffer_get_length (ecma_object_t *obj_p); -bool -ecma_is_arraybuffer (ecma_value_t val); - -/** - * @} - * @} - */ - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ -#endif /* !ECMA_ARRAYBUFFER_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-boolean-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-boolean-object.h deleted file mode 100755 index adf0353d8..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-boolean-object.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_BOOLEAN_OBJECT_H -#define ECMA_BOOLEAN_OBJECT_H - -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmabooleanobject ECMA Boolean object related routines - * @{ - */ - -ecma_value_t ecma_op_create_boolean_object (ecma_value_t arg); - -/** - * @} - * @} - */ - -#endif /* !ECMA_BOOLEAN_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-array-iterator-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-array-iterator-prototype.inc.h deleted file mode 100755 index f7ec656ad..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-array-iterator-prototype.inc.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * %ArrayIteratorPrototype% built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) - -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_NEXT, ecma_builtin_array_iterator_prototype_object_next, 0, 0) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-array-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-array-prototype.inc.h deleted file mode 100755 index ad86d85e7..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-array-prototype.inc.h +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Array.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ARRAY) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.4.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* Number properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.4.4 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_WRITABLE) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_ARRAY_PROTOTYPE_TO_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_ARRAY_PROTOTYPE_TO_LOCALE_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_CONCAT, ECMA_ARRAY_PROTOTYPE_CONCAT, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_JOIN, ECMA_ARRAY_PROTOTYPE_JOIN, 1, 1) -ROUTINE (LIT_MAGIC_STRING_POP, ECMA_ARRAY_PROTOTYPE_POP, 0, 0) -ROUTINE (LIT_MAGIC_STRING_PUSH, ECMA_ARRAY_PROTOTYPE_PUSH, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_REVERSE, ECMA_ARRAY_PROTOTYPE_REVERSE, 0, 0) -ROUTINE (LIT_MAGIC_STRING_SHIFT, ECMA_ARRAY_PROTOTYPE_SHIFT, 0, 0) -ROUTINE (LIT_MAGIC_STRING_SLICE, ECMA_ARRAY_PROTOTYPE_SLICE, 2, 2) -ROUTINE (LIT_MAGIC_STRING_SORT, ECMA_ARRAY_PROTOTYPE_SORT, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SPLICE, ECMA_ARRAY_PROTOTYPE_SPLICE, NON_FIXED, 2) -ROUTINE (LIT_MAGIC_STRING_UNSHIFT, ECMA_ARRAY_PROTOTYPE_UNSHIFT, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ECMA_ARRAY_PROTOTYPE_INDEX_OF, 2, 1) -ROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ECMA_ARRAY_PROTOTYPE_LAST_INDEX_OF, NON_FIXED, 1) -/* Note these 3 routines must be in this order */ -ROUTINE (LIT_MAGIC_STRING_EVERY, ECMA_ARRAY_PROTOTYPE_EVERY, 2, 1) -ROUTINE (LIT_MAGIC_STRING_SOME, ECMA_ARRAY_PROTOTYPE_SOME, 2, 1) -ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_ARRAY_PROTOTYPE_FOR_EACH, 2, 1) -ROUTINE (LIT_MAGIC_STRING_MAP, ECMA_ARRAY_PROTOTYPE_MAP, 2, 1) -ROUTINE (LIT_MAGIC_STRING_FILTER, ECMA_ARRAY_PROTOTYPE_FILTER, 2, 1) -/* Note these 2 routines must be in this order */ -ROUTINE (LIT_MAGIC_STRING_REDUCE, ECMA_ARRAY_PROTOTYPE_REDUCE, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_REDUCE_RIGHT_UL, ECMA_ARRAY_PROTOTYPE_REDUCE_RIGHT, NON_FIXED, 1) -#if ENABLED (JERRY_ES2015_BUILTIN) -ROUTINE (LIT_MAGIC_STRING_FIND, ECMA_ARRAY_PROTOTYPE_FIND, 2, 1) -ROUTINE (LIT_MAGIC_STRING_FIND_INDEX, ECMA_ARRAY_PROTOTYPE_FIND_INDEX, 2, 1) -#endif /* ENABLED (JERRY_ES2015_BUILTIN) */ -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) -ROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_ARRAY_PROTOTYPE_ENTRIES, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUES, ECMA_ARRAY_PROTOTYPE_VALUES, 0, 0) -ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_ARRAY_PROTOTYPE_KEYS, 0, 0) -ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ECMA_ARRAY_PROTOTYPE_SYMBOL_ITERATOR, 0, 0) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -#endif /* ENABLED (JERRY_BUILTIN_ARRAY) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-array.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-array.inc.h deleted file mode 100755 index ccea4a5e6..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-array.inc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Array description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ARRAY) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.4.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -/* Number properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.4.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_IS_ARRAY_UL, ecma_builtin_array_object_is_array, 1, 1) - -#endif /* !(ENABLED (JERRY_BUILTIN_ARRAY)) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-arraybuffer-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-arraybuffer-prototype.inc.h deleted file mode 100755 index 852e356ef..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-arraybuffer-prototype.inc.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * ArrayBuffer.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -/* Object properties: - * (property name, object pointer getter) */ - -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_ARRAYBUFFER, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* Readonly accessor properties */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL, - ecma_builtin_arraybuffer_prototype_bytelength_getter, - ECMA_PROPERTY_FIXED) - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/* ECMA-262 v6, 24.1.4.4 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_ARRAY_BUFFER_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_SLICE, ecma_builtin_arraybuffer_prototype_object_slice, 2, 2) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-arraybuffer.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-arraybuffer.inc.h deleted file mode 100755 index 2ed9fa4ad..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-arraybuffer.inc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * ArrayBuffer built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ - -/* ES2015 24.1.3.1 */ -ROUTINE (LIT_MAGIC_STRING_IS_VIEW_UL, ecma_builtin_arraybuffer_object_is_view, 1, 1) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-boolean-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-boolean-prototype.inc.h deleted file mode 100755 index c8f222358..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-boolean-prototype.inc.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Boolean.prototype description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_BOOLEAN) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.6.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_BOOLEAN, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ecma_builtin_boolean_prototype_object_to_string, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ecma_builtin_boolean_prototype_object_value_of, 0, 0) - -#endif /* ENABLED (JERRY_BUILTIN_BOOLEAN) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-boolean.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-boolean.inc.h deleted file mode 100755 index a26f129d2..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-boolean.inc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Boolean description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_BOOLEAN) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.6.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -/* Number properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.6.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_BUILTIN_BOOLEAN) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-dataview-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-dataview-prototype.inc.h deleted file mode 100755 index 3dd9efde1..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-dataview-prototype.inc.h +++ /dev/null @@ -1,79 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * DataView.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v6, 24.2.3 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_DATAVIEW, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/* ECMA-262 v6, 23.2.4.21 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_DATAVIEW_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_GET_FLOAT_32_UL, ECMA_DATAVIEW_PROTOTYPE_GET_FLOAT32, 2, 1) -#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64) -ROUTINE (LIT_MAGIC_STRING_GET_FLOAT_64_UL, ECMA_DATAVIEW_PROTOTYPE_GET_FLOAT64, 2, 1) -#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */ -ROUTINE (LIT_MAGIC_STRING_GET_INT8_UL, ECMA_DATAVIEW_PROTOTYPE_GET_INT8, 1, 1) -ROUTINE (LIT_MAGIC_STRING_GET_INT16_UL, ECMA_DATAVIEW_PROTOTYPE_GET_INT16, 2, 1) -ROUTINE (LIT_MAGIC_STRING_GET_INT32_UL, ECMA_DATAVIEW_PROTOTYPE_GET_INT32, 2, 1) -ROUTINE (LIT_MAGIC_STRING_GET_UINT8_UL, ECMA_DATAVIEW_PROTOTYPE_GET_UINT8, 2, 1) -ROUTINE (LIT_MAGIC_STRING_GET_UINT16_UL, ECMA_DATAVIEW_PROTOTYPE_GET_UINT16, 2, 1) -ROUTINE (LIT_MAGIC_STRING_GET_UINT32_UL, ECMA_DATAVIEW_PROTOTYPE_GET_UINT32, 2, 1) -ROUTINE (LIT_MAGIC_STRING_SET_FLOAT_32_UL, ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT32, 2, 1) -#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64) -ROUTINE (LIT_MAGIC_STRING_SET_FLOAT_64_UL, ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT64, 2, 1) -#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */ -ROUTINE (LIT_MAGIC_STRING_SET_INT8_UL, ECMA_DATAVIEW_PROTOTYPE_SET_INT8, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SET_INT16_UL, ECMA_DATAVIEW_PROTOTYPE_SET_INT16, 2, 1) -ROUTINE (LIT_MAGIC_STRING_SET_INT32_UL, ECMA_DATAVIEW_PROTOTYPE_SET_INT32, 2, 1) -ROUTINE (LIT_MAGIC_STRING_SET_UINT8_UL, ECMA_DATAVIEW_PROTOTYPE_SET_UINT8, 2, 1) -ROUTINE (LIT_MAGIC_STRING_SET_UINT16_UL, ECMA_DATAVIEW_PROTOTYPE_SET_UINT16, 2, 1) -ROUTINE (LIT_MAGIC_STRING_SET_UINT32_UL, ECMA_DATAVIEW_PROTOTYPE_SET_UINT32, 2, 1) - -/* ECMA-262 v6, 24.2.4.1 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER, - ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v6, 24.2.4.2 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL, - ECMA_DATAVIEW_PROTOTYPE_BYTE_LENGTH_GETTER, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v6, 24.2.4.3 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_OFFSET_UL, - ECMA_DATAVIEW_PROTOTYPE_BYTE_OFFSET_GETTER, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-dataview.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-dataview.inc.h deleted file mode 100755 index 75fbc688f..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-dataview.inc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * DataView built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v6, 23.1.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 3, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v6, 23.1 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_DATAVIEW_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v6, 23.1.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-date-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-date-prototype.inc.h deleted file mode 100755 index 543080149..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-date-prototype.inc.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Date.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_DATE) - -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_DATE, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_DATE_STRING_UL, ECMA_DATE_PROTOTYPE_TO_DATE_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_TIME_STRING_UL, ECMA_DATE_PROTOTYPE_TO_TIME_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_DATE_PROTOTYPE_TO_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_DATE_STRING_UL, ECMA_DATE_PROTOTYPE_TO_DATE_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL, ECMA_DATE_PROTOTYPE_TO_TIME_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_DATE_PROTOTYPE_GET_TIME, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_TIME_UL, ECMA_DATE_PROTOTYPE_GET_TIME, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_FULL_YEAR_UL, ECMA_DATE_PROTOTYPE_GET_FULL_YEAR, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_UTC_FULL_YEAR_UL, ECMA_DATE_PROTOTYPE_GET_UTC_FULL_YEAR, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_MONTH_UL, ECMA_DATE_PROTOTYPE_GET_MONTH, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_UTC_MONTH_UL, ECMA_DATE_PROTOTYPE_GET_UTC_MONTH, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_DATE_UL, ECMA_DATE_PROTOTYPE_GET_DATE, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_UTC_DATE_UL, ECMA_DATE_PROTOTYPE_GET_UTC_DATE, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_DAY_UL, ECMA_DATE_PROTOTYPE_GET_DAY, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_UTC_DAY_UL, ECMA_DATE_PROTOTYPE_GET_UTC_DAY, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_HOURS_UL, ECMA_DATE_PROTOTYPE_GET_HOURS, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_UTC_HOURS_UL, ECMA_DATE_PROTOTYPE_GET_UTC_HOURS, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_MINUTES_UL, ECMA_DATE_PROTOTYPE_GET_MINUTES, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_UTC_MINUTES_UL, ECMA_DATE_PROTOTYPE_GET_UTC_MINUTES, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_SECONDS_UL, ECMA_DATE_PROTOTYPE_GET_SECONDS, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_UTC_SECONDS_UL, ECMA_DATE_PROTOTYPE_GET_UTC_SECONDS, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_MILLISECONDS_UL, ECMA_DATE_PROTOTYPE_GET_MILLISECONDS, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_UTC_MILLISECONDS_UL, ECMA_DATE_PROTOTYPE_GET_UTC_MILLISECONDS, 0, 0) -ROUTINE (LIT_MAGIC_STRING_GET_TIMEZONE_OFFSET_UL, ECMA_DATE_PROTOTYPE_GET_UTC_TIMEZONE_OFFSET, 0, 0) -ROUTINE (LIT_MAGIC_STRING_SET_TIME_UL, ECMA_DATE_PROTOTYPE_SET_TIME, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SET_MILLISECONDS_UL, ECMA_DATE_PROTOTYPE_SET_MILLISECONDS, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SET_UTC_MILLISECONDS_UL, ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SET_SECONDS_UL, ECMA_DATE_PROTOTYPE_SET_SECONDS, 2, 2) -ROUTINE (LIT_MAGIC_STRING_SET_UTC_SECONDS_UL, ECMA_DATE_PROTOTYPE_SET_UTC_SECONDS, 2, 2) -ROUTINE (LIT_MAGIC_STRING_SET_MINUTES_UL, ECMA_DATE_PROTOTYPE_SET_MINUTES, NON_FIXED, 3) -ROUTINE (LIT_MAGIC_STRING_SET_UTC_MINUTES_UL, ECMA_DATE_PROTOTYPE_SET_UTC_MINUTES, NON_FIXED, 3) -ROUTINE (LIT_MAGIC_STRING_SET_HOURS_UL, ECMA_DATE_PROTOTYPE_SET_HOURS, NON_FIXED, 4) -ROUTINE (LIT_MAGIC_STRING_SET_UTC_HOURS_UL, ECMA_DATE_PROTOTYPE_SET_UTC_HOURS, NON_FIXED, 4) -ROUTINE (LIT_MAGIC_STRING_SET_DATE_UL, ECMA_DATE_PROTOTYPE_SET_DATE, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SET_UTC_DATE_UL, ECMA_DATE_PROTOTYPE_SET_UTC_DATE, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SET_MONTH_UL, ECMA_DATE_PROTOTYPE_SET_MONTH, 2, 2) -ROUTINE (LIT_MAGIC_STRING_SET_UTC_MONTH_UL, ECMA_DATE_PROTOTYPE_SET_UTC_MONTH, 2, 2) -ROUTINE (LIT_MAGIC_STRING_SET_FULL_YEAR_UL, ECMA_DATE_PROTOTYPE_SET_FULL_YEAR, NON_FIXED, 3) -ROUTINE (LIT_MAGIC_STRING_SET_UTC_FULL_YEAR_UL, ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR, NON_FIXED, 3) -ROUTINE (LIT_MAGIC_STRING_TO_UTC_STRING_UL, ECMA_DATE_PROTOTYPE_TO_UTC_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_ISO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_ISO_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_JSON_UL, ECMA_DATE_PROTOTYPE_TO_JSON, 1, 1) - -#if ENABLED (JERRY_BUILTIN_ANNEXB) - -ROUTINE (LIT_MAGIC_STRING_GET_YEAR_UL, ECMA_DATE_PROTOTYPE_GET_YEAR, 0, 0) -ROUTINE (LIT_MAGIC_STRING_SET_YEAR_UL, ECMA_DATE_PROTOTYPE_SET_YEAR, 1, 1) -ROUTINE (LIT_MAGIC_STRING_TO_GMT_STRING_UL, ECMA_DATE_PROTOTYPE_TO_UTC_STRING, 0, 0) - -#endif /* ENABLED (JERRY_BUILTIN_ANNEXB) */ - -#endif /* ENABLED (JERRY_BUILTIN_DATE) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-date.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-date.inc.h deleted file mode 100755 index fc38bf56b..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-date.inc.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Date built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_DATE) - -/* ECMA-262 v5, 15.9.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_DATE_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 7, - ECMA_PROPERTY_FIXED) - -ROUTINE (LIT_MAGIC_STRING_PARSE, ecma_builtin_date_parse, 1, 1) -ROUTINE (LIT_MAGIC_STRING_UTC_U, ecma_builtin_date_utc, NON_FIXED, 7) -ROUTINE (LIT_MAGIC_STRING_NOW, ecma_builtin_date_now, 0, 0) - -#endif /* ENABLED (JERRY_BUILTIN_DATE) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-error-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-error-prototype.inc.h deleted file mode 100755 index 2cb344438..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-error-prototype.inc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Error.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.4.2 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.4.3 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ecma_builtin_error_prototype_object_to_string, 0, 0) - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-error.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-error.inc.h deleted file mode 100755 index 3fbddac22..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-error.inc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Error built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.11.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.7.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-evalerror-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-evalerror-prototype.inc.h deleted file mode 100755 index a6e1f6400..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-evalerror-prototype.inc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * EvalError.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_EVAL_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_EVAL_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-evalerror.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-evalerror.inc.h deleted file mode 100755 index c6d7626b7..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-evalerror.inc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * EvalError built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.11.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float32array-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float32array-prototype.inc.h deleted file mode 100755 index 5ad673d65..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float32array-prototype.inc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Float32Array prototype description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY -#include "ecma-builtin-typedarray-prototype-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float32array.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float32array.inc.h deleted file mode 100755 index 7ba4130cf..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float32array.inc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Float32Array description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT32_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE -#include "ecma-builtin-typedarray-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float64array-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float64array-prototype.inc.h deleted file mode 100755 index e3528d333..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float64array-prototype.inc.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Float64Array prototype description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) -#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 8 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY -#include "ecma-builtin-typedarray-prototype-template.inc.h" - -#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float64array.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float64array.inc.h deleted file mode 100755 index 76f6d7340..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-float64array.inc.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Float64Array description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) -#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 8 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT64_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE -#include "ecma-builtin-typedarray-template.inc.h" - -#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-function-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-function-prototype.inc.h deleted file mode 100755 index 945a14fc8..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-function-prototype.inc.h +++ /dev/null @@ -1,45 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Function.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.3.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_FUNCTION, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* Number properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.3.4 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FIXED) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_FUNCTION_PROTOTYPE_TO_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_APPLY, ECMA_FUNCTION_PROTOTYPE_APPLY, 2, 2) -ROUTINE (LIT_MAGIC_STRING_CALL, ECMA_FUNCTION_PROTOTYPE_CALL, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_BIND, ECMA_FUNCTION_PROTOTYPE_BIND, NON_FIXED, 1) - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-function.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-function.inc.h deleted file mode 100755 index c6a4a7bd6..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-function.inc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Function built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.3.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -/* Number properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.3.3.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-global.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-global.inc.h deleted file mode 100755 index 4964887f2..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-global.inc.h +++ /dev/null @@ -1,247 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Global built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* Simple value properties: - * (property name, simple value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.1.1.3 */ -SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED, - ECMA_VALUE_UNDEFINED, - ECMA_PROPERTY_FIXED) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.1.1.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_NAN, - ECMA_BUILTIN_NUMBER_NAN, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.1.1.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL, - ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.1.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL, - ECMA_BUILTIN_ID_OBJECT, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.1.4.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL, - ECMA_BUILTIN_ID_FUNCTION, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.1.4.3 */ -#if ENABLED (JERRY_BUILTIN_ARRAY) -OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL, - ECMA_BUILTIN_ID_ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_BUILTIN_ARRAY) */ - -#if ENABLED (JERRY_BUILTIN_STRING) -/* ECMA-262 v5, 15.1.4.4 */ -OBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL, - ECMA_BUILTIN_ID_STRING, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_BUILTIN_STRING) */ - -#if ENABLED (JERRY_BUILTIN_BOOLEAN) -/* ECMA-262 v5, 15.1.4.5 */ -OBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL, - ECMA_BUILTIN_ID_BOOLEAN, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_BUILTIN_BOOLEAN) */ - -#if ENABLED (JERRY_BUILTIN_NUMBER) -/* ECMA-262 v5, 15.1.4.6 */ -OBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL, - ECMA_BUILTIN_ID_NUMBER, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_BUILTIN_NUMBER) */ - -#if ENABLED (JERRY_BUILTIN_DATE) -/* ECMA-262 v5, 15.1.4.7 */ -OBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL, - ECMA_BUILTIN_ID_DATE, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_BUILTIN_DATE) */ - -#if ENABLED (JERRY_BUILTIN_REGEXP) -/* ECMA-262 v5, 15.1.4.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL, - ECMA_BUILTIN_ID_REGEXP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ - -/* ECMA-262 v5, 15.1.4.9 */ -OBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL, - ECMA_BUILTIN_ID_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* ECMA-262 v5, 15.1.4.10 */ -OBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL, - ECMA_BUILTIN_ID_EVAL_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.1.4.11 */ -OBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL, - ECMA_BUILTIN_ID_RANGE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.1.4.12 */ -OBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, - ECMA_BUILTIN_ID_REFERENCE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.1.4.13 */ -OBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, - ECMA_BUILTIN_ID_SYNTAX_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.1.4.14 */ -OBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL, - ECMA_BUILTIN_ID_TYPE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.1.4.15 */ -OBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL, - ECMA_BUILTIN_ID_URI_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#if ENABLED (JERRY_BUILTIN_MATH) -/* ECMA-262 v5, 15.1.5.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL, - ECMA_BUILTIN_ID_MATH, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_BUILTIN_MATH) */ - -#if ENABLED (JERRY_BUILTIN_JSON) -/* ECMA-262 v5, 15.1.5.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U, - ECMA_BUILTIN_ID_JSON, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_BUILTIN_JSON) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) -OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, - ECMA_BUILTIN_ID_ARRAYBUFFER, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -OBJECT_VALUE (LIT_MAGIC_STRING_INT8_ARRAY_UL, - ECMA_BUILTIN_ID_INT8ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_ARRAY_UL, - ECMA_BUILTIN_ID_UINT8ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -OBJECT_VALUE (LIT_MAGIC_STRING_INT16_ARRAY_UL, - ECMA_BUILTIN_ID_INT16ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -OBJECT_VALUE (LIT_MAGIC_STRING_UINT16_ARRAY_UL, - ECMA_BUILTIN_ID_UINT16ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -OBJECT_VALUE (LIT_MAGIC_STRING_INT32_ARRAY_UL, - ECMA_BUILTIN_ID_INT32ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -OBJECT_VALUE (LIT_MAGIC_STRING_UINT32_ARRAY_UL, - ECMA_BUILTIN_ID_UINT32ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, - ECMA_BUILTIN_ID_FLOAT32ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64) -OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, - ECMA_BUILTIN_ID_FLOAT64ARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */ - -OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL, - ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) -OBJECT_VALUE (LIT_MAGIC_STRING_PROMISE_UL, - ECMA_BUILTIN_ID_PROMISE, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) -/* ECMA-262 v6, 23.1.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_MAP_UL, - ECMA_BUILTIN_ID_MAP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_SET) -/* ECMA-262 v6, 23.1.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_SET_UL, - ECMA_BUILTIN_ID_SET, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SET) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/* ECMA-262 v6, 19.4.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_SYMBOL_UL, - ECMA_BUILTIN_ID_SYMBOL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) -/* ECMA-262 v6, 23.1.1.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_DATAVIEW_UL, - ECMA_BUILTIN_ID_DATAVIEW, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW */ - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ - -ROUTINE (LIT_MAGIC_STRING_EVAL, ECMA_GLOBAL_EVAL, 1, 1) -ROUTINE (LIT_MAGIC_STRING_PARSE_FLOAT, ECMA_GLOBAL_PARSE_FLOAT, 1, 1) -ROUTINE (LIT_MAGIC_STRING_IS_NAN, ECMA_GLOBAL_IS_NAN, 1, 1) -ROUTINE (LIT_MAGIC_STRING_IS_FINITE, ECMA_GLOBAL_IS_FINITE, 1, 1) -ROUTINE (LIT_MAGIC_STRING_DECODE_URI, ECMA_GLOBAL_DECODE_URI, 1, 1) -ROUTINE (LIT_MAGIC_STRING_DECODE_URI_COMPONENT, ECMA_GLOBAL_DECODE_URI_COMPONENT, 1, 1) -ROUTINE (LIT_MAGIC_STRING_ENCODE_URI, ECMA_GLOBAL_ENCODE_URI, 1, 1) -ROUTINE (LIT_MAGIC_STRING_ENCODE_URI_COMPONENT, ECMA_GLOBAL_ENCODE_URI_COMPONENT, 1, 1) -ROUTINE (LIT_MAGIC_STRING_PARSE_INT, ECMA_GLOBAL_PARSE_INT, 2, 2) - -#if ENABLED (JERRY_BUILTIN_ANNEXB) -ROUTINE (LIT_MAGIC_STRING_ESCAPE, ECMA_GLOBAL_ESCAPE, 1, 1) -ROUTINE (LIT_MAGIC_STRING_UNESCAPE, ECMA_GLOBAL_UNESCAPE, 1, 1) -#endif /* ENABLED (JERRY_BUILTIN_ANNEXB) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-helpers-macro-defines.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-helpers-macro-defines.inc.h deleted file mode 100755 index 53ecd64e2..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-helpers-macro-defines.inc.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef SIMPLE_VALUE -#define SIMPLE_VALUE(name, simple_value, prop_attributes) -#endif /* !SIMPLE_VALUE */ - -#ifndef NUMBER_VALUE -#define NUMBER_VALUE(name, number_value, prop_attributes) -#endif /* !NUMBER_VALUE */ - -#ifndef STRING_VALUE -#define STRING_VALUE(name, magic_string_id, prop_attributes) -#endif /* !STRING_VALUE */ - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -#ifndef SYMBOL_VALUE -#define SYMBOL_VALUE(name, desc_string_id) -#endif /* !SYMBOL_VALUE */ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -#ifndef OBJECT_VALUE -#define OBJECT_VALUE(name, obj_builtin_id, prop_attributes) -#endif /* !OBJECT_VALUE */ - -#ifndef ROUTINE -#define ROUTINE(name, c_function_name, args_number, length_prop_value) -#endif /* !ROUTINE */ - -#ifndef ROUTINE_CONFIGURABLE_ONLY -#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) -#endif /* !ROUTINE_CONFIGURABLE_ONLY */ - -#ifndef ACCESSOR_READ_WRITE -#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) -#endif /* !ACCESSOR_READ_WRITE */ - -#ifndef ACCESSOR_READ_ONLY -#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) -#endif /* !ACCESSOR_READ_ONLY */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-helpers-macro-undefs.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-helpers-macro-undefs.inc.h deleted file mode 100755 index 8f7252513..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-helpers-macro-undefs.inc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#undef SIMPLE_VALUE -#undef NUMBER_VALUE -#undef STRING_VALUE -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -#undef SYMBOL_VALUE -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -#undef OBJECT_VALUE -#undef ROUTINE -#undef ROUTINE_CONFIGURABLE_ONLY -#undef ACCESSOR_READ_WRITE -#undef ACCESSOR_READ_ONLY diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-helpers.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-helpers.h deleted file mode 100755 index 319811a80..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-helpers.h +++ /dev/null @@ -1,210 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_BUILTIN_HELPERS_H -#define ECMA_BUILTIN_HELPERS_H - -#include "ecma-globals.h" -#include "ecma-exceptions.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmabuiltinhelpers ECMA builtin helper operations - * @{ - */ - -/** - * Mode of string index routine. - */ -typedef enum -{ - /** These routines must be in this order */ - ECMA_STRING_INDEX_OF, /**< String.indexOf: ECMA-262 v5, 15.5.4.7 */ - ECMA_STRING_LAST_INDEX_OF, /**< String.lastIndexOf: ECMA-262 v5, 15.5.4.8 */ - ECMA_STRING_STARTS_WITH, /**< String.startsWith: ECMA-262 v6, 21.1.3.18 */ - ECMA_STRING_INCLUDES, /**< String.includes: ECMA-262 v6, 21.1.3.7 */ - ECMA_STRING_ENDS_WITH /**< String.includes: ECMA-262 v6, 21.1.3.6 */ -} ecma_string_index_of_mode_t; - -ecma_value_t -ecma_builtin_helper_object_to_string (const ecma_value_t this_arg); -ecma_value_t -ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, uint32_t index); -ecma_value_t -ecma_builtin_helper_object_get_properties (ecma_object_t *obj_p, uint32_t opts); -ecma_value_t -ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, uint32_t *length_p, ecma_value_t value); -uint32_t -ecma_builtin_helper_array_index_normalize (ecma_number_t index, uint32_t length, bool last_index_of); -uint32_t -ecma_builtin_helper_string_index_normalize (ecma_number_t index, uint32_t length, bool nan_to_zero); -ecma_value_t -ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_str_p, ecma_value_t arg1, - ecma_value_t arg2, ecma_string_index_of_mode_t mode); -bool -ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, ecma_string_t *search_str_p, bool first_index, - ecma_length_t start_pos, ecma_length_t *ret_index_p); -ecma_value_t -ecma_builtin_helper_def_prop (ecma_object_t *obj_p, ecma_string_t *index_p, ecma_value_t value, uint32_t opts); - -ecma_value_t -ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, uint32_t index, ecma_value_t value, uint32_t opts); - -#if ENABLED (JERRY_BUILTIN_DATE) - -/** - * Time range defines for helper functions. - * - * See also: - * ECMA-262 v5, 15.9.1.1, 15.9.1.10 - */ - -/** Hours in a day. */ -#define ECMA_DATE_HOURS_PER_DAY ((ecma_number_t) 24) - -/** Minutes in an hour. */ -#define ECMA_DATE_MINUTES_PER_HOUR ((ecma_number_t) 60) - -/** Seconds in a minute. */ -#define ECMA_DATE_SECONDS_PER_MINUTE ((ecma_number_t) 60) - -/** Milliseconds in a second. */ -#define ECMA_DATE_MS_PER_SECOND ((ecma_number_t) 1000) - -/** ECMA_DATE_MS_PER_MINUTE == 60000 */ -#define ECMA_DATE_MS_PER_MINUTE (ECMA_DATE_MS_PER_SECOND * ECMA_DATE_SECONDS_PER_MINUTE) - -/** ECMA_DATE_MS_PER_HOUR == 3600000 */ -#define ECMA_DATE_MS_PER_HOUR (ECMA_DATE_MS_PER_MINUTE * ECMA_DATE_MINUTES_PER_HOUR) - -/** ECMA_DATE_MS_PER_DAY == 86400000 */ -#define ECMA_DATE_MS_PER_DAY (ECMA_DATE_MS_PER_HOUR * ECMA_DATE_HOURS_PER_DAY) - -/** - * This gives a range of 8,640,000,000,000,000 milliseconds - * to either side of 01 January, 1970 UTC. - */ -#define ECMA_DATE_MAX_VALUE 8.64e15 - -/** - * Timezone type. - */ -typedef enum -{ - ECMA_DATE_UTC, /**< date vaule is in UTC */ - ECMA_DATE_LOCAL /**< date vaule is in local time */ -} ecma_date_timezone_t; - -/* ecma-builtin-helpers-date.c */ -ecma_number_t ecma_date_day (ecma_number_t time); -ecma_number_t ecma_date_time_within_day (ecma_number_t time); -ecma_number_t ecma_date_year_from_time (ecma_number_t time); -ecma_number_t ecma_date_month_from_time (ecma_number_t time); -ecma_number_t ecma_date_date_from_time (ecma_number_t time); -ecma_number_t ecma_date_week_day (ecma_number_t time); -ecma_number_t ecma_date_local_time_zone_adjustment (ecma_number_t time); -ecma_number_t ecma_date_utc (ecma_number_t time); -ecma_number_t ecma_date_hour_from_time (ecma_number_t time); -ecma_number_t ecma_date_min_from_time (ecma_number_t time); -ecma_number_t ecma_date_sec_from_time (ecma_number_t time); -ecma_number_t ecma_date_ms_from_time (ecma_number_t time); -ecma_number_t ecma_date_make_time (ecma_number_t hour, ecma_number_t min, ecma_number_t sec, ecma_number_t ms); -ecma_number_t ecma_date_make_day (ecma_number_t year, ecma_number_t month, ecma_number_t date); -ecma_number_t ecma_date_make_date (ecma_number_t day, ecma_number_t time); -ecma_number_t ecma_date_time_clip (ecma_number_t time); -ecma_number_t ecma_date_timezone_offset (ecma_number_t time); - -ecma_value_t ecma_date_value_to_string (ecma_number_t datetime_number); -ecma_value_t ecma_date_value_to_utc_string (ecma_number_t datetime_number); -ecma_value_t ecma_date_value_to_iso_string (ecma_number_t datetime_number); -ecma_value_t ecma_date_value_to_date_string (ecma_number_t datetime_number); -ecma_value_t ecma_date_value_to_time_string (ecma_number_t datetime_number); - -#endif /* ENABLED (JERRY_BUILTIN_DATE) */ - -#if ENABLED (JERRY_BUILTIN_JSON) -/* ecma-builtin-helper-json.c */ - -/** - * Occurence stack item of JSON.stringify() - */ -typedef struct struct_ecma_json_occurence_stack_item_t -{ - struct struct_ecma_json_occurence_stack_item_t *next_p; /**< next stack item */ - ecma_object_t *object_p; /**< current object */ -} ecma_json_occurence_stack_item_t; - -/** - * Context for JSON.stringify() - */ -typedef struct -{ - /** Collection for property keys. */ - ecma_collection_t *property_list_p; - - /** Collection for traversing objects. */ - ecma_json_occurence_stack_item_t *occurence_stack_last_p; - - /** The actual indentation text. */ - ecma_stringbuilder_t indent_builder; - - /** The indentation text. */ - ecma_string_t *gap_str_p; - - /** The replacer function. */ - ecma_object_t *replacer_function_p; - - /** Result string builder. */ - ecma_stringbuilder_t result_builder; -} ecma_json_stringify_context_t; - -ecma_value_t ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p, - lit_utf8_size_t string_size); -ecma_value_t ecma_builtin_json_string_from_object (const ecma_value_t arg1); -bool ecma_json_has_object_in_stack (ecma_json_occurence_stack_item_t *stack_p, ecma_object_t *object_p); -bool ecma_has_string_value_in_collection (ecma_collection_t *collection_p, ecma_string_t *string_p); - -ecma_value_t -ecma_builtin_helper_json_create_non_formatted_json (lit_utf8_byte_t left_bracket, lit_utf8_byte_t right_bracket, - ecma_collection_t *partial_p); -#endif /* ENABLED (JERRY_BUILTIN_JSON) */ - -/* ecma-builtin-helper-error.c */ - -ecma_value_t -ecma_builtin_helper_error_dispatch_call (ecma_standard_error_t error_type, const ecma_value_t *arguments_list_p, - ecma_length_t arguments_list_len); - -/* ecma-builtin-helpers-sort.c */ - -/** - * Comparison callback function header for sorting helper routines. - */ -typedef ecma_value_t (*ecma_builtin_helper_sort_compare_fn_t)(ecma_value_t lhs, /**< left value */ - ecma_value_t rhs, /**< right value */ - ecma_value_t compare_func); /**< compare function */ - -ecma_value_t ecma_builtin_helper_array_heap_sort_helper (ecma_value_t *array_p, - uint32_t right, - ecma_value_t compare_func, - const ecma_builtin_helper_sort_compare_fn_t sort_cb); - -/** - * @} - * @} - */ - -#endif /* !ECMA_BUILTIN_HELPERS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int16array-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int16array-prototype.inc.h deleted file mode 100755 index 0d70bd56d..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int16array-prototype.inc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Int16Array prototype description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 2 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY -#include "ecma-builtin-typedarray-prototype-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int16array.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int16array.inc.h deleted file mode 100755 index 7522b80ec..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int16array.inc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Int16Array description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 2 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT16_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY_PROTOTYPE -#include "ecma-builtin-typedarray-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int32array-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int32array-prototype.inc.h deleted file mode 100755 index ca15f6e7a..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int32array-prototype.inc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Int32Array prototype description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY -#include "ecma-builtin-typedarray-prototype-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int32array.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int32array.inc.h deleted file mode 100755 index 8319f8438..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int32array.inc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Int32Array description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT32_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY_PROTOTYPE -#include "ecma-builtin-typedarray-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int8array-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int8array-prototype.inc.h deleted file mode 100755 index c96e557f4..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int8array-prototype.inc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Int8Array prototype description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY -#include "ecma-builtin-typedarray-prototype-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int8array.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int8array.inc.h deleted file mode 100755 index 07a3800d5..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-int8array.inc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Int8Array description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT8_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE -#include "ecma-builtin-typedarray-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-internal-routines-template.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-internal-routines-template.inc.h deleted file mode 100755 index 06a10fb67..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-internal-routines-template.inc.h +++ /dev/null @@ -1,264 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef BUILTIN_UNDERSCORED_ID -# error "Please, define BUILTIN_UNDERSCORED_ID" -#endif /* !BUILTIN_UNDERSCORED_ID */ - -#ifndef BUILTIN_INC_HEADER_NAME -# error "Please, define BUILTIN_INC_HEADER_NAME" -#endif /* !BUILTIN_INC_HEADER_NAME */ - -#include "ecma-objects.h" - -#define PASTE__(x, y) x ## y -#define PASTE_(x, y) PASTE__ (x, y) -#define PASTE(x, y) PASTE_ (x, y) - -#define PROPERTY_DESCRIPTOR_LIST_NAME \ - PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _property_descriptor_list) -#define DISPATCH_ROUTINE_ROUTINE_NAME \ - PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _dispatch_routine) - -#ifndef BUILTIN_CUSTOM_DISPATCH - -#define ROUTINE_ARG(n) , ecma_value_t arg ## n -#define ROUTINE_ARG_LIST_0 ecma_value_t this_arg -#define ROUTINE_ARG_LIST_1 ROUTINE_ARG_LIST_0 ROUTINE_ARG(1) -#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1 ROUTINE_ARG(2) -#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2 ROUTINE_ARG(3) -#define ROUTINE_ARG_LIST_NON_FIXED ROUTINE_ARG_LIST_0, \ - const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len -#define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number); -#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number); -#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \ - static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0); \ - static ecma_value_t c_setter_func_name (ROUTINE_ARG_LIST_1); -#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ - static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0); -#include BUILTIN_INC_HEADER_NAME -#undef ROUTINE_ARG_LIST_NON_FIXED -#undef ROUTINE_ARG_LIST_3 -#undef ROUTINE_ARG_LIST_2 -#undef ROUTINE_ARG_LIST_1 -#undef ROUTINE_ARG_LIST_0 -#undef ROUTINE_ARG - -/** - * List of built-in routine identifiers. - */ -enum -{ - PASTE (ECMA_ROUTINE_START_, BUILTIN_UNDERSCORED_ID) = ECMA_BUILTIN_ID__COUNT - 1, -#define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - ECMA_ROUTINE_ ## name ## c_function_name, -#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - ECMA_ROUTINE_ ## name ## c_function_name, -#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \ - ECMA_ACCESSOR_ ## name ## c_getter_func_name, \ - ECMA_ACCESSOR_ ## name ## c_setter_func_name, -#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ - ECMA_ACCESSOR_ ## name ## c_getter_func_name, -#include BUILTIN_INC_HEADER_NAME -}; - -#endif /* !BUILTIN_CUSTOM_DISPATCH */ - -/** - * Built-in property list of the built-in object. - */ -const ecma_builtin_property_descriptor_t PROPERTY_DESCRIPTOR_LIST_NAME[] = -{ -#ifndef BUILTIN_CUSTOM_DISPATCH -#define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - ECMA_PROPERTY_CONFIGURABLE_WRITABLE, \ - ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \ - }, -#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - ECMA_PROPERTY_FLAG_CONFIGURABLE, \ - ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \ - }, -#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \ - prop_attributes, \ - ECMA_ACCESSOR_ ## name ## c_getter_func_name \ - }, -#else /* BUILTIN_CUSTOM_DISPATCH */ -#define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - ECMA_PROPERTY_CONFIGURABLE_WRITABLE, \ - ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \ - }, -#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ROUTINE, \ - ECMA_PROPERTY_FLAG_CONFIGURABLE, \ - ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \ - }, -#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \ - prop_attributes, \ - c_getter_func_name \ - }, -#endif /* !BUILTIN_CUSTOM_DISPATCH */ -#define OBJECT_VALUE(name, obj_builtin_id, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_OBJECT, \ - prop_attributes, \ - obj_builtin_id \ - }, -#define SIMPLE_VALUE(name, simple_value, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_SIMPLE, \ - prop_attributes, \ - simple_value \ - }, -#define NUMBER_VALUE(name, number_value, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_NUMBER, \ - prop_attributes, \ - number_value \ - }, -#define STRING_VALUE(name, magic_string_id, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_STRING, \ - prop_attributes, \ - magic_string_id \ - }, -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -#define SYMBOL_VALUE(name, desc_string_id) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_SYMBOL, \ - ECMA_PROPERTY_FIXED, \ - desc_string_id \ - }, -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -#define ACCESSOR_READ_WRITE(name, c_getter_name, c_setter_name, prop_attributes) \ - { \ - name, \ - ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \ - prop_attributes, \ - ECMA_ACCESSOR_READ_WRITE (ECMA_ACCESSOR_ ## name ## c_getter_name, ECMA_ACCESSOR_ ## name ## c_setter_name) \ - }, -#include BUILTIN_INC_HEADER_NAME - { - LIT_MAGIC_STRING__COUNT, - ECMA_BUILTIN_PROPERTY_END, - 0, - 0 - } -}; - -#ifndef BUILTIN_CUSTOM_DISPATCH - -/** - * Dispatcher of the built-in's routines - * - * @return ecma value - * Returned value must be freed with ecma_free_value. - */ -ecma_value_t -DISPATCH_ROUTINE_ROUTINE_NAME (uint16_t builtin_routine_id, /**< built-in wide routine - identifier */ - ecma_value_t this_arg_value, /**< 'this' argument - value */ - const ecma_value_t arguments_list[], /**< list of arguments - passed to routine */ - ecma_length_t arguments_number) /**< length of - arguments' list */ -{ - /* the arguments may be unused for some built-ins */ - JERRY_UNUSED (this_arg_value); - JERRY_UNUSED (arguments_list); - JERRY_UNUSED (arguments_number); - - switch (builtin_routine_id) - { -#define ROUTINE_ARG(n) (arguments_list[n - 1]) -#define ROUTINE_ARG_LIST_0 -#define ROUTINE_ARG_LIST_1 , ROUTINE_ARG(1) -#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1, ROUTINE_ARG(2) -#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2, ROUTINE_ARG(3) -#define ROUTINE_ARG_LIST_NON_FIXED , arguments_list, arguments_number -#define ROUTINE(name, c_function_name, args_number, length_prop_value) \ - case ECMA_ROUTINE_ ## name ## c_function_name: \ - { \ - return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \ - } -#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \ - case ECMA_ROUTINE_ ## name ## c_function_name: \ - { \ - return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \ - } -#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \ - case ECMA_ACCESSOR_ ## name ## c_getter_func_name: \ - { \ - return c_getter_func_name(this_arg_value); \ - } \ - case ECMA_ACCESSOR_ ## name ## c_setter_func_name: \ - { \ - return c_setter_func_name(this_arg_value ROUTINE_ARG_LIST_1); \ - } -#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \ - case ECMA_ACCESSOR_ ## name ## c_getter_func_name: \ - { \ - return c_getter_func_name(this_arg_value); \ - } -#include BUILTIN_INC_HEADER_NAME -#undef ROUTINE_ARG -#undef ROUTINE_ARG_LIST_0 -#undef ROUTINE_ARG_LIST_1 -#undef ROUTINE_ARG_LIST_2 -#undef ROUTINE_ARG_LIST_3 -#undef ROUTINE_ARG_LIST_NON_FIXED - - default: - { - JERRY_UNREACHABLE (); - } - } -} /* DISPATCH_ROUTINE_ROUTINE_NAME */ - -#endif /* !BUILTIN_CUSTOM_DISPATCH */ - -#undef BUILTIN_INC_HEADER_NAME -#undef BUILTIN_CUSTOM_DISPATCH -#undef BUILTIN_UNDERSCORED_ID -#undef DISPATCH_ROUTINE_ROUTINE_NAME -#undef ECMA_BUILTIN_PROPERTY_NAME_INDEX -#undef PASTE__ -#undef PASTE_ -#undef PASTE -#undef PROPERTY_DESCRIPTOR_LIST_NAME diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-iterator-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-iterator-prototype.inc.h deleted file mode 100755 index 507026272..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-iterator-prototype.inc.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * %IteratorPrototype% built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ecma_builtin_iterator_prototype_object_iterator, 0, 0) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-json.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-json.inc.h deleted file mode 100755 index 11446b832..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-json.inc.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * JSON built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_JSON) - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/* ECMA-262 v6, 24.3.3 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_JSON_U, - ECMA_PROPERTY_FLAG_CONFIGURABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_PARSE, ecma_builtin_json_parse, 2, 2) -ROUTINE (LIT_MAGIC_STRING_STRINGIFY, ecma_builtin_json_stringify, 3, 3) - -#endif /* ENABLED (JERRY_BUILTIN_JSON) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-map-iterator-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-map-iterator-prototype.inc.h deleted file mode 100755 index 8f3b326e8..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-map-iterator-prototype.inc.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * %MapIteratorPrototype% built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) - -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_MAP_ITERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_NEXT, ecma_builtin_map_iterator_prototype_object_next, 0, 0) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-map-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-map-prototype.inc.h deleted file mode 100755 index c7d7bc7cb..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-map-prototype.inc.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Map.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v6, 23.1.3.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_MAP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/* ECMA-262 v6, 23.1.3.13 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_MAP_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_CLEAR, ecma_builtin_map_prototype_object_clear, 0, 0) -ROUTINE (LIT_MAGIC_STRING_DELETE, ecma_builtin_map_prototype_object_delete, 1, 1) -ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ecma_builtin_map_prototype_object_foreach, 2, 1) -ROUTINE (LIT_MAGIC_STRING_GET, ecma_builtin_map_prototype_object_get, 1, 1) -ROUTINE (LIT_MAGIC_STRING_HAS, ecma_builtin_map_prototype_object_has, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SET, ecma_builtin_map_prototype_object_set, 2, 2) -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) -ROUTINE (LIT_MAGIC_STRING_ENTRIES, ecma_builtin_map_prototype_object_entries, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUES, ecma_builtin_map_prototype_object_values, 0, 0) -ROUTINE (LIT_MAGIC_STRING_KEYS, ecma_builtin_map_prototype_object_keys, 0, 0) -ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ecma_builtin_map_prototype_object_values, 0, 0) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -/* ECMA-262 v6, 23.1.3.10 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, - ecma_builtin_map_prototype_object_size_getter, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-map.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-map.inc.h deleted file mode 100755 index 2c4ca3d21..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-map.inc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Map built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v6, 23.1.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v6, 23.1 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_MAP_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v6, 23.1.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_MAP_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-math.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-math.inc.h deleted file mode 100755 index f889b5477..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-math.inc.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Math built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_MATH) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.8.1.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_E_U, - ECMA_BUILTIN_NUMBER_E, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.8.1.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U, - ECMA_BUILTIN_NUMBER_LN10, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.8.1.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U, - ECMA_BUILTIN_NUMBER_LN2, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.8.1.4 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U, - ECMA_BUILTIN_NUMBER_LOG2E, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.8.1.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U, - ECMA_BUILTIN_NUMBER_LOG10E, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.8.1.6 */ -NUMBER_VALUE (LIT_MAGIC_STRING_PI_U, - ECMA_BUILTIN_NUMBER_PI, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.8.1.7 */ -NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U, - ECMA_BUILTIN_NUMBER_SQRT_1_2, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.8.1.8 */ -NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U, - ECMA_BUILTIN_NUMBER_SQRT2, - ECMA_PROPERTY_FIXED) - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/* ECMA-262 v6, 20.2.1.9 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_MATH_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_ABS, ECMA_MATH_OBJECT_ABS, 1, 1) -ROUTINE (LIT_MAGIC_STRING_ACOS, ECMA_MATH_OBJECT_ACOS, 1, 1) -ROUTINE (LIT_MAGIC_STRING_ASIN, ECMA_MATH_OBJECT_ASIN, 1, 1) -ROUTINE (LIT_MAGIC_STRING_ATAN, ECMA_MATH_OBJECT_ATAN, 1, 1) -ROUTINE (LIT_MAGIC_STRING_ATAN2, ECMA_MATH_OBJECT_ATAN2, 2, 2) -ROUTINE (LIT_MAGIC_STRING_CEIL, ECMA_MATH_OBJECT_CEIL, 1, 1) -ROUTINE (LIT_MAGIC_STRING_COS, ECMA_MATH_OBJECT_COS, 1, 1) -ROUTINE (LIT_MAGIC_STRING_EXP, ECMA_MATH_OBJECT_EXP, 1, 1) -ROUTINE (LIT_MAGIC_STRING_FLOOR, ECMA_MATH_OBJECT_FLOOR, 1, 1) -ROUTINE (LIT_MAGIC_STRING_LOG, ECMA_MATH_OBJECT_LOG, 1, 1) -ROUTINE (LIT_MAGIC_STRING_MAX, ECMA_MATH_OBJECT_MAX, NON_FIXED, 2) -ROUTINE (LIT_MAGIC_STRING_MIN, ECMA_MATH_OBJECT_MIN, NON_FIXED, 2) -ROUTINE (LIT_MAGIC_STRING_POW, ECMA_MATH_OBJECT_POW, 2, 2) -ROUTINE (LIT_MAGIC_STRING_RANDOM, ECMA_MATH_OBJECT_RANDOM, 0, 0) -ROUTINE (LIT_MAGIC_STRING_ROUND, ECMA_MATH_OBJECT_ROUND, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SIN, ECMA_MATH_OBJECT_SIN, 1, 1) -ROUTINE (LIT_MAGIC_STRING_SQRT, ECMA_MATH_OBJECT_SQRT, 1, 1) -ROUTINE (LIT_MAGIC_STRING_TAN, ECMA_MATH_OBJECT_TAN, 1, 1) -#if ENABLED (JERRY_ES2015_BUILTIN) -ROUTINE (LIT_MAGIC_STRING_SIGN, ECMA_MATH_OBJECT_SIGN, 1, 1) -ROUTINE (LIT_MAGIC_STRING_TRUNC, ECMA_MATH_OBJECT_TRUNC, 1, 1) -#endif /* ENABLED (JERRY_ES2015_BUILTIN) */ - -#endif /* ENABLED (JERRY_BUILTIN_MATH) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-number-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-number-prototype.inc.h deleted file mode 100755 index 8b509255b..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-number-prototype.inc.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Number.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_NUMBER) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.7.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_NUMBER, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_NUMBER_PROTOTYPE_TO_STRING, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_NUMBER_PROTOTYPE_VALUE_OF, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_NUMBER_PROTOTYPE_TO_LOCALE_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_FIXED_UL, ECMA_NUMBER_PROTOTYPE_TO_FIXED, 1, 1) -ROUTINE (LIT_MAGIC_STRING_TO_EXPONENTIAL_UL, ECMA_NUMBER_PROTOTYPE_TO_EXPONENTIAL, 1, 1) -ROUTINE (LIT_MAGIC_STRING_TO_PRECISION_UL, ECMA_NUMBER_PROTOTYPE_TO_PRECISION, 1, 1) - -#endif /* ENABLED (JERRY_BUILTIN_NUMBER) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-number.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-number.inc.h deleted file mode 100755 index 695f9cb9d..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-number.inc.h +++ /dev/null @@ -1,75 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Number built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_NUMBER) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.7.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.7.3.4 */ -NUMBER_VALUE (LIT_MAGIC_STRING_NAN, - ECMA_BUILTIN_NUMBER_NAN, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.7.3.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U, - ECMA_BUILTIN_NUMBER_MAX, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.7.3.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U, - ECMA_BUILTIN_NUMBER_MIN, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.7.3.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, - ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.7.3.6 */ -NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, - ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.7.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_BUILTIN_NUMBER) */ - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -#if ENABLED (JERRY_ES2015_BUILTIN) -ROUTINE (LIT_MAGIC_STRING_IS_FINITE, ecma_builtin_number_object_is_finite, 1, 1) -ROUTINE (LIT_MAGIC_STRING_IS_NAN, ecma_builtin_number_object_is_nan, 1, 1) -ROUTINE (LIT_MAGIC_STRING_IS_INTEGER, ecma_builtin_number_object_is_integer, 1, 1) -ROUTINE (LIT_MAGIC_STRING_IS_SAFE_INTEGER, ecma_builtin_number_object_is_safe_integer, 1, 1) -#endif /* ENABLED (JERRY_ES2015_BUILTIN) */ -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-object-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-object-prototype.inc.h deleted file mode 100755 index 5da1290be..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-object-prototype.inc.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Object.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.2.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_OBJECT, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_OBJECT_PROTOTYPE_TO_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_OBJECT_PROTOTYPE_VALUE_OF, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_OBJECT_PROTOTYPE_TO_LOCALE_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_HAS_OWN_PROPERTY_UL, ECMA_OBJECT_PROTOTYPE_HAS_OWN_PROPERTY, 1, 1) -ROUTINE (LIT_MAGIC_STRING_IS_PROTOTYPE_OF_UL, ECMA_OBJECT_PROTOTYPE_IS_PROTOTYPE_OF, 1, 1) -ROUTINE (LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL, ECMA_OBJECT_PROTOTYPE_PROPERTY_IS_ENUMERABLE, 1, 1) - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-object.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-object.inc.h deleted file mode 100755 index 457a28233..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-object.inc.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Object built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.2.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.2.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_GET_PROTOTYPE_OF_UL, ECMA_OBJECT_ROUTINE_GET_PROTOTYPE_OF, 1, 1) -ROUTINE (LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL, ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_NAMES, 1, 1) -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -ROUTINE (LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL, ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_SYMBOLS, 1, 1) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -ROUTINE (LIT_MAGIC_STRING_SEAL, ECMA_OBJECT_ROUTINE_SEAL, 1, 1) -ROUTINE (LIT_MAGIC_STRING_FREEZE, ECMA_OBJECT_ROUTINE_FREEZE, 1, 1) -ROUTINE (LIT_MAGIC_STRING_PREVENT_EXTENSIONS_UL, ECMA_OBJECT_ROUTINE_PREVENT_EXTENSIONS, 1, 1) -ROUTINE (LIT_MAGIC_STRING_IS_SEALED_UL, ECMA_OBJECT_ROUTINE_IS_SEALED, 1, 1) -ROUTINE (LIT_MAGIC_STRING_IS_FROZEN_UL, ECMA_OBJECT_ROUTINE_IS_FROZEN, 1, 1) -ROUTINE (LIT_MAGIC_STRING_IS_EXTENSIBLE, ECMA_OBJECT_ROUTINE_IS_EXTENSIBLE, 1, 1) -ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_OBJECT_ROUTINE_KEYS, 1, 1) -ROUTINE (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL, ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTOR, 2, 2) -ROUTINE (LIT_MAGIC_STRING_CREATE, ECMA_OBJECT_ROUTINE_CREATE, 2, 2) -ROUTINE (LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL, ECMA_OBJECT_ROUTINE_DEFINE_PROPERTIES, 2, 2) -ROUTINE (LIT_MAGIC_STRING_DEFINE_PROPERTY_UL, ECMA_OBJECT_ROUTINE_DEFINE_PROPERTY, 3, 3) - -#if ENABLED (JERRY_ES2015_BUILTIN) -ROUTINE (LIT_MAGIC_STRING_SET_PROTOTYPE_OF_UL, ECMA_OBJECT_ROUTINE_SET_PROTOTYPE_OF, 2, 2) -ROUTINE (LIT_MAGIC_STRING_ASSIGN, ECMA_OBJECT_ROUTINE_ASSIGN, NON_FIXED, 2) -#endif /* ENABLED (JERRY_ES2015_BUILTIN) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-promise-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-promise-prototype.inc.h deleted file mode 100755 index 872fab5da..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-promise-prototype.inc.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) - -/* Object properties: - * (property name, object pointer getter) */ - -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_PROMISE, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FLAG_WRITABLE) - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/* ECMA-262 v6, 25.4.5.4 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_PROMISE_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -ROUTINE (LIT_MAGIC_STRING_THEN, ecma_builtin_promise_prototype_then, 2, 2) -ROUTINE (LIT_MAGIC_STRING_CATCH, ecma_builtin_promise_prototype_catch, 1, 1) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-promise.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-promise.inc.h deleted file mode 100755 index 3135ac70b..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-promise.inc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Promose built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_PROMISE_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_REJECT, ecma_builtin_promise_reject, 1, 1) -ROUTINE (LIT_MAGIC_STRING_RESOLVE, ecma_builtin_promise_resolve, 1, 1) -ROUTINE (LIT_MAGIC_STRING_RACE, ecma_builtin_promise_race, 1, 1) -ROUTINE (LIT_MAGIC_STRING_ALL, ecma_builtin_promise_all, 1, 1) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-rangeerror-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-rangeerror-prototype.inc.h deleted file mode 100755 index 684171590..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-rangeerror-prototype.inc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * RangeError.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_RANGE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_RANGE_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-rangeerror.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-rangeerror.inc.h deleted file mode 100755 index b1da135d2..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-rangeerror.inc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * RangeError built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.11.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-referenceerror-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-referenceerror-prototype.inc.h deleted file mode 100755 index 496ea9923..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-referenceerror-prototype.inc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * ReferenceError.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_REFERENCE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_REFERENCE_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-referenceerror.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-referenceerror.inc.h deleted file mode 100755 index 077a93d31..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-referenceerror.inc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * ReferenceError built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.11.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-regexp-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-regexp-prototype.inc.h deleted file mode 100755 index 33a1375bf..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-regexp-prototype.inc.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * RegExp.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_REGEXP) - -/* ECMA-262 v5, 15.10.6.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_REGEXP, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#if ENABLED (JERRY_ES2015) -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_FLAGS, - ecma_builtin_regexp_prototype_get_flags, - ECMA_PROPERTY_FIXED) - -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SOURCE, - ecma_builtin_regexp_prototype_get_source, - ECMA_PROPERTY_FIXED) - -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_GLOBAL, - ecma_builtin_regexp_prototype_get_global, - ECMA_PROPERTY_FIXED) - -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_IGNORECASE_UL, - ecma_builtin_regexp_prototype_get_ignorecase, - ECMA_PROPERTY_FIXED) - -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_MULTILINE, - ecma_builtin_regexp_prototype_get_multiline, - ECMA_PROPERTY_FIXED) -#else /* !ENABLED (JERRY_ES2015) */ -/* ECMA-262 v5, 15.10.7.1 */ -STRING_VALUE (LIT_MAGIC_STRING_SOURCE, - LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.10.7.2 */ -SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL, - ECMA_VALUE_FALSE, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.10.7.3 */ -SIMPLE_VALUE (LIT_MAGIC_STRING_IGNORECASE_UL, - ECMA_VALUE_FALSE, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.10.7.4 */ -SIMPLE_VALUE (LIT_MAGIC_STRING_MULTILINE, - ECMA_VALUE_FALSE, - ECMA_PROPERTY_FIXED) -#endif /* ENABLED (JERRY_ES2015) */ - -/* ECMA-262 v5, 15.10.7.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LASTINDEX_UL, - 0, - ECMA_PROPERTY_FLAG_WRITABLE) - -#if ENABLED (JERRY_BUILTIN_ANNEXB) -ROUTINE (LIT_MAGIC_STRING_COMPILE, ecma_builtin_regexp_prototype_compile, 2, 1) -#endif /* ENABLED (JERRY_BUILTIN_ANNEXB) */ -ROUTINE (LIT_MAGIC_STRING_EXEC, ecma_builtin_regexp_prototype_exec, 1, 1) -ROUTINE (LIT_MAGIC_STRING_TEST, ecma_builtin_regexp_prototype_test, 1, 1) -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ecma_builtin_regexp_prototype_to_string, 0, 0) - -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-regexp.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-regexp.inc.h deleted file mode 100755 index 135427af4..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-regexp.inc.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * RegExp built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_REGEXP) - -/* ECMA-262 v5, 15.10.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 2, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v5, 15.10.5.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_REGEXP_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-set-iterator-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-set-iterator-prototype.inc.h deleted file mode 100755 index a19399163..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-set-iterator-prototype.inc.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * %SetIteratorPrototype% built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_SET) - -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_SET_ITERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_NEXT, ecma_builtin_set_iterator_prototype_object_next, 0, 0) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SET) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-set-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-set-prototype.inc.h deleted file mode 100755 index a0356127a..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-set-prototype.inc.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Set.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_SET) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v6, 23.2.3.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_SET, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/* ECMA-262 v6, 23.1.3.13 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_SET_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_ADD, ecma_builtin_set_prototype_object_add, 1, 1) -ROUTINE (LIT_MAGIC_STRING_CLEAR, ecma_builtin_set_prototype_object_clear, 0, 0) -ROUTINE (LIT_MAGIC_STRING_DELETE, ecma_builtin_set_prototype_object_delete, 1, 1) -ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ecma_builtin_set_prototype_object_foreach, 2, 1) -ROUTINE (LIT_MAGIC_STRING_HAS, ecma_builtin_set_prototype_object_has, 1, 1) -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) -ROUTINE (LIT_MAGIC_STRING_ENTRIES, ecma_builtin_set_prototype_object_entries, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUES, ecma_builtin_set_prototype_object_values, 0, 0) -ROUTINE (LIT_MAGIC_STRING_KEYS, ecma_builtin_set_prototype_object_keys, 0, 0) -ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ecma_builtin_set_prototype_object_values, 0, 0) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, - ecma_builtin_set_prototype_object_size_getter, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SET) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-set.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-set.inc.h deleted file mode 100755 index c2847bbc4..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-set.inc.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Set built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_SET) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v6, 23.2.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v6, 23.1 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_SET_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v6, 23.2.2.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_SET_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SET) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-string-iterator-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-string-iterator-prototype.inc.h deleted file mode 100755 index 9a04570e7..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-string-iterator-prototype.inc.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * %StringIteratorPrototype% built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) - -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_STRING_ITERATOR_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_NEXT, ecma_builtin_string_iterator_prototype_object_next, 0, 0) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-string-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-string-prototype.inc.h deleted file mode 100755 index 5679079c0..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-string-prototype.inc.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * String.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_STRING) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.5.4.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_STRING, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* Number properties: - * (property name, number value) */ - -/* ECMA-262 v5, 15.5.4 (String.prototype is itself a String object whose value is an empty String), 15.5.5.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FIXED) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_STRING_PROTOTYPE_TO_STRING, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_STRING_PROTOTYPE_VALUE_OF, 0, 0) -ROUTINE (LIT_MAGIC_STRING_CONCAT, ECMA_STRING_PROTOTYPE_CONCAT, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_SLICE, ECMA_STRING_PROTOTYPE_SLICE, 2, 2) -ROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ECMA_STRING_PROTOTYPE_INDEX_OF, 2, 1) -ROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ECMA_STRING_PROTOTYPE_LAST_INDEX_OF, 2, 1) -ROUTINE (LIT_MAGIC_STRING_CHAR_AT_UL, ECMA_STRING_PROTOTYPE_CHAR_AT, 1, 1) -ROUTINE (LIT_MAGIC_STRING_CHAR_CODE_AT_UL, ECMA_STRING_PROTOTYPE_CHAR_CODE_AT, 1, 1) -ROUTINE (LIT_MAGIC_STRING_LOCALE_COMPARE_UL, ECMA_STRING_PROTOTYPE_LOCALE_COMPARE, 1, 1) - -#if ENABLED (JERRY_BUILTIN_REGEXP) -ROUTINE (LIT_MAGIC_STRING_MATCH, ECMA_STRING_PROTOTYPE_MATCH, 1, 1) -ROUTINE (LIT_MAGIC_STRING_REPLACE, ECMA_STRING_PROTOTYPE_REPLACE, 2, 2) -ROUTINE (LIT_MAGIC_STRING_SEARCH, ECMA_STRING_PROTOTYPE_SEARCH, 1, 1) -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ - -ROUTINE (LIT_MAGIC_STRING_SPLIT, ECMA_STRING_PROTOTYPE_SPLIT, 2, 2) -ROUTINE (LIT_MAGIC_STRING_SUBSTRING, ECMA_STRING_PROTOTYPE_SUBSTRING, 2, 2) -ROUTINE (LIT_MAGIC_STRING_TO_LOWER_CASE_UL, ECMA_STRING_PROTOTYPE_TO_LOWER_CASE, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_LOWER_CASE_UL, ECMA_STRING_PROTOTYPE_TO_LOCAL_LOWER_CASE, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_UPPER_CASE_UL, ECMA_STRING_PROTOTYPE_TO_UPPER_CASE, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_UPPER_CASE_UL, ECMA_STRING_PROTOTYPE_TO_LOCAL_UPPER_CASE, 0, 0) -ROUTINE (LIT_MAGIC_STRING_TRIM, ECMA_STRING_PROTOTYPE_TRIM, 0, 0) - -#if ENABLED (JERRY_BUILTIN_ANNEXB) -ROUTINE (LIT_MAGIC_STRING_SUBSTR, ECMA_STRING_PROTOTYPE_SUBSTR, 2, 2) -#endif /* ENABLED (JERRY_BUILTIN_ANNEXB) */ - -#if ENABLED (JERRY_ES2015_BUILTIN) -ROUTINE (LIT_MAGIC_STRING_REPEAT, ECMA_STRING_PROTOTYPE_REPEAT, 1, 1) -ROUTINE (LIT_MAGIC_STRING_STARTS_WITH, ECMA_STRING_PROTOTYPE_STARTS_WITH, 2, 1) -ROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_STRING_PROTOTYPE_INCLUDES, 2, 1) -ROUTINE (LIT_MAGIC_STRING_ENDS_WITH, ECMA_STRING_PROTOTYPE_ENDS_WITH, 2, 1) -#endif /* ENABLED (JERRY_ES2015_BUILTIN) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) -ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ECMA_STRING_PROTOTYPE_ITERATOR, 0, 0) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -#endif /* ENABLED (JERRY_BUILTIN_STRING) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-string.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-string.inc.h deleted file mode 100755 index a8435a90b..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-string.inc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * String built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_STRING) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.5.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.7.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_STRING_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_FROM_CHAR_CODE_UL, ecma_builtin_string_object_from_char_code, NON_FIXED, 1) - -#endif /* ENABLED (JERRY_BUILTIN_STRING) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-symbol-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-symbol-prototype.inc.h deleted file mode 100755 index 8301f78b8..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-symbol-prototype.inc.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Symbol prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) - -/* Object properties: - * (property name, object pointer getter) */ - -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_SYMBOL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FLAG_WRITABLE) - -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ecma_builtin_symbol_prototype_object_to_string, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ecma_builtin_symbol_prototype_object_value_of, 0, 0) -ROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, - ecma_builtin_symbol_prototype_object_to_primitive, - 0, - 0) - -/* ECMA-262 v6, 19.4.3.4 */ -STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - LIT_MAGIC_STRING_SYMBOL_UL, - ECMA_PROPERTY_FLAG_CONFIGURABLE) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-symbol.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-symbol.inc.h deleted file mode 100755 index b9a33ffde..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-symbol.inc.h +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Symbol built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v6, 19.4.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v6, 19.4.2.7 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -/* ECMA-262 v6, 19.4.2.2 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_HAS_INSTANCE, - LIT_GLOBAL_SYMBOL_HAS_INSTANCE) - -/* ECMA-262 v6, 19.4.2.3 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, - LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE) - -/* ECMA-262 v6, 19.4.2.4 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_ITERATOR, - LIT_GLOBAL_SYMBOL_ITERATOR) - -/* ECMA-262 v6, 19.4.2.6 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_MATCH, - LIT_GLOBAL_SYMBOL_MATCH) - -/* ECMA-262 v6, 19.4.2.8 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_REPLACE, - LIT_GLOBAL_SYMBOL_REPLACE) - -/* ECMA-262 v6, 19.4.2.9 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_SEARCH, - LIT_GLOBAL_SYMBOL_SEARCH) - -/* ECMA-262 v6, 19.4.2.10 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_SPECIES, - LIT_GLOBAL_SYMBOL_SPECIES) - -/* ECMA-262 v6, 19.4.2.11 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_SPLIT, - LIT_GLOBAL_SYMBOL_SPLIT) - -/* ECMA-262 v6, 19.4.2.12 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_TO_PRIMITIVE, - LIT_GLOBAL_SYMBOL_TO_PRIMITIVE) - -/* ECMA-262 v6, 19.4.2.13 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_TO_STRING_TAG, - LIT_GLOBAL_SYMBOL_TO_STRING_TAG) - -/* ECMA-262 v6, 19.4.2.14 */ -SYMBOL_VALUE (LIT_MAGIC_STRING_UNSCOPABLES, - LIT_GLOBAL_SYMBOL_UNSCOPABLES) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_FOR, ecma_builtin_symbol_for, 1, 1) -ROUTINE (LIT_MAGIC_STRING_KEY_FOR, ecma_builtin_symbol_key_for, 1, 1) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-syntaxerror-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-syntaxerror-prototype.inc.h deleted file mode 100755 index 827290ade..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-syntaxerror-prototype.inc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * SyntaxError.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_SYNTAX_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_SYNTAX_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-syntaxerror.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-syntaxerror.inc.h deleted file mode 100755 index 3585aea91..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-syntaxerror.inc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * SyntaxError built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.11.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-type-error-thrower.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-type-error-thrower.inc.h deleted file mode 100755 index 640f40fd4..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-type-error-thrower.inc.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * [[ThrowTypeError]] description - * - * See also: ECMA-262 v5, 13.2.3 - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 0, - ECMA_PROPERTY_FIXED) - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-helpers.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-helpers.h deleted file mode 100755 index 7ddee8e31..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-helpers.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_TYPEDARRAY_HELPERS_H -#define ECMA_TYPEDARRAY_HELPERS_H -#include "ecma-globals.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmabuiltinhelpers ECMA builtin helper operations - * @{ - */ - -ecma_value_t -ecma_typedarray_helper_dispatch_construct (const ecma_value_t *arguments_list_p, - ecma_length_t arguments_list_len, - ecma_typedarray_type_t typedarray_id); - -/** - * @} - * @} - */ - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ -#endif /* !ECMA_TYPEDARRAY_HELPERS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-prototype-template.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-prototype-template.inc.h deleted file mode 100755 index 18615ec93..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-prototype-template.inc.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#ifndef TYPEDARRAY_BYTES_PER_ELEMENT -# error "Please define TYPEDARRAY_BYTES_PER_ELEMENT" -#endif /* !TYPEDARRAY_BYTES_PER_ELEMENT */ - -#ifndef TYPEDARRAY_BUILTIN_ID -# error "Please define TYPEDARRAY_BUILTIN_ID" -#endif /* !TYPEDARRAY_BUILTIN_ID */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* ES2015 22.2.3.4 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - TYPEDARRAY_BUILTIN_ID, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ES2015 22.2.6.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, - TYPEDARRAY_BYTES_PER_ELEMENT, - ECMA_PROPERTY_FIXED) - -#include "ecma-builtin-helpers-macro-undefs.inc.h" - -#undef TYPEDARRAY_BUILTIN_ID -#undef TYPEDARRAY_BYTES_PER_ELEMENT - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-prototype.inc.h deleted file mode 100755 index 7ca5b43af..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-prototype.inc.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * %TypedArrayPrototype% description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -/* ES2015 22.2.3.4 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_TYPEDARRAY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* Readonly accessor properties */ -/* ES2015 22.2.3.1 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER, - ecma_builtin_typedarray_prototype_buffer_getter, - ECMA_PROPERTY_FIXED) -/* ES2015 22.2.3.2 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL, - ecma_builtin_typedarray_prototype_bytelength_getter, - ECMA_PROPERTY_FIXED) -/* ES2015 22.2.3.3 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_OFFSET_UL, - ecma_builtin_typedarray_prototype_byteoffset_getter, - ECMA_PROPERTY_FIXED) - -/* ES2015 22.2.3.17 */ -ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_LENGTH, - ecma_builtin_typedarray_prototype_length_getter, - ECMA_PROPERTY_FIXED) - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/* ECMA-262 v6, 23.1.3.13 */ -ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, - ecma_builtin_typedarray_prototype_to_string_tag_getter, - ECMA_PROPERTY_FLAG_CONFIGURABLE) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ -ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ecma_builtin_typedarray_prototype_object_to_string, 0, 0) -ROUTINE (LIT_MAGIC_STRING_JOIN, ecma_builtin_typedarray_prototype_join, 1, 1) -ROUTINE (LIT_MAGIC_STRING_EVERY, ecma_builtin_typedarray_prototype_every, 2, 1) -ROUTINE (LIT_MAGIC_STRING_SOME, ecma_builtin_typedarray_prototype_some, 2, 1) -ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ecma_builtin_typedarray_prototype_for_each, 2, 1) -ROUTINE (LIT_MAGIC_STRING_MAP, ecma_builtin_typedarray_prototype_map, 2, 1) -ROUTINE (LIT_MAGIC_STRING_REDUCE, ecma_builtin_typedarray_prototype_reduce, 2, 1) -ROUTINE (LIT_MAGIC_STRING_REDUCE_RIGHT_UL, ecma_builtin_typedarray_prototype_reduce_right, 2, 1) -ROUTINE (LIT_MAGIC_STRING_FILTER, ecma_builtin_typedarray_prototype_filter, 2, 1) -ROUTINE (LIT_MAGIC_STRING_REVERSE, ecma_builtin_typedarray_prototype_reverse, 0, 0) -ROUTINE (LIT_MAGIC_STRING_SET, ecma_builtin_typedarray_prototype_set, 2, 1) -ROUTINE (LIT_MAGIC_STRING_SUBARRAY, ecma_builtin_typedarray_prototype_subarray, 2, 2) -ROUTINE (LIT_MAGIC_STRING_FILL, ecma_builtin_typedarray_prototype_fill, 3, 1) -ROUTINE (LIT_MAGIC_STRING_SORT, ecma_builtin_typedarray_prototype_sort, 1, 1) -ROUTINE (LIT_MAGIC_STRING_FIND, ecma_builtin_typedarray_prototype_find, 2, 1) -ROUTINE (LIT_MAGIC_STRING_FIND_INDEX, ecma_builtin_typedarray_prototype_find_index, 2, 1) -ROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ecma_builtin_typedarray_prototype_index_of, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ecma_builtin_typedarray_prototype_last_index_of, NON_FIXED, 1) -ROUTINE (LIT_MAGIC_STRING_COPY_WITHIN, ecma_builtin_typedarray_prototype_copy_within, NON_FIXED, 2) -ROUTINE (LIT_MAGIC_STRING_SLICE, ecma_builtin_typedarray_prototype_slice, NON_FIXED, 2) -ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ecma_builtin_typedarray_prototype_to_locale_string, 0, 0) - -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) - -ROUTINE (LIT_MAGIC_STRING_KEYS, ecma_builtin_typedarray_prototype_keys, 0, 0) -ROUTINE (LIT_MAGIC_STRING_VALUES, ecma_builtin_typedarray_prototype_values, 0, 0) -ROUTINE (LIT_MAGIC_STRING_ENTRIES, ecma_builtin_typedarray_prototype_entries, 0, 0) -ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ecma_builtin_typedarray_prototype_values, 0, 0) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-template.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-template.inc.h deleted file mode 100755 index f1ba74060..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray-template.inc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#ifndef TYPEDARRAY_BYTES_PER_ELEMENT -# error "Please define TYPEDARRAY_BYTES_PER_ELEMENT" -#endif /* !TYPEDARRAY_BYTES_PER_ELEMENT */ - -#ifndef TYPEDARRAY_MAGIC_STRING_ID -# error "Please define TYPEDARRAY_MAGIC_STRING_ID" -#endif /* !TYPEDARRAY_MAGIC_STRING_ID */ - -#ifndef TYPEDARRAY_BUILTIN_ID -# error "Please define TYPEDARRAY_BUILTIN_ID" -#endif /* !TYPEDARRAY_BUILTIN_ID */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -/* ES2015 22.2.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 3, - ECMA_PROPERTY_FIXED) - -/* ES2015 22.2.5.1 */ -NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, - TYPEDARRAY_BYTES_PER_ELEMENT, - ECMA_PROPERTY_FIXED) - -/* ES2015 22.2.5 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 3, - ECMA_PROPERTY_FIXED) - -/* ES2015 22.2.5 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - TYPEDARRAY_MAGIC_STRING_ID, - ECMA_PROPERTY_FIXED) - -/* ES2015 22.2.5.2 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - TYPEDARRAY_BUILTIN_ID, - ECMA_PROPERTY_FIXED) - -#include "ecma-builtin-helpers-macro-undefs.inc.h" - -#undef TYPEDARRAY_BUILTIN_ID -#undef TYPEDARRAY_MAGIC_STRING_ID -#undef TYPEDARRAY_BYTES_PER_ELEMENT - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray.inc.h deleted file mode 100755 index 36cf1eaf5..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typedarray.inc.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * %TypedArray% description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -/* ES2015 22.2.2 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 3, - ECMA_PROPERTY_FIXED) - -/* ES2015 22.2.2 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_TYPED_ARRAY_UL, - ECMA_PROPERTY_FIXED) - -/* ES2015 22.2.2.3 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -/* Routine properties: - * (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */ - -/* ES2015 22.2.2.1 */ -ROUTINE (LIT_MAGIC_STRING_FROM, ecma_builtin_typedarray_from, NON_FIXED, 1) - -/* ES2015 22.2.2.2 */ -ROUTINE (LIT_MAGIC_STRING_OF, ecma_builtin_typedarray_of, NON_FIXED, 0) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typeerror-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typeerror-prototype.inc.h deleted file mode 100755 index d570124c7..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typeerror-prototype.inc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * TypeError.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_TYPE_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_TYPE_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typeerror.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typeerror.inc.h deleted file mode 100755 index 587c4e769..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-typeerror.inc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * TypeError built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.11.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint16array-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint16array-prototype.inc.h deleted file mode 100755 index cacee6525..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint16array-prototype.inc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Uint16Array prototype description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 2 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY -#include "ecma-builtin-typedarray-prototype-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint16array.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint16array.inc.h deleted file mode 100755 index 90c3dd931..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint16array.inc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Uint16Array description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 2 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT16_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY_PROTOTYPE -#include "ecma-builtin-typedarray-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint32array-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint32array-prototype.inc.h deleted file mode 100755 index 4d75dea12..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint32array-prototype.inc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Uint32Array prototype description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY -#include "ecma-builtin-typedarray-prototype-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint32array.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint32array.inc.h deleted file mode 100755 index 7eb9e7f1b..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint32array.inc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Uint32Array description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 4 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT32_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE -#include "ecma-builtin-typedarray-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8array-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8array-prototype.inc.h deleted file mode 100755 index 5c89a0162..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8array-prototype.inc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Uint8Array prototype description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY -#include "ecma-builtin-typedarray-prototype-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8array.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8array.inc.h deleted file mode 100755 index 5fbdd6f31..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8array.inc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Uint8Array description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE -#include "ecma-builtin-typedarray-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8clampedarray-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8clampedarray-prototype.inc.h deleted file mode 100755 index 623091f89..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8clampedarray-prototype.inc.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Uint8ClampedArray prototype description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY -#include "ecma-builtin-typedarray-prototype-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8clampedarray.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8clampedarray.inc.h deleted file mode 100755 index 68942b867..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-uint8clampedarray.inc.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Uint8ClampedArray description - */ - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -#define TYPEDARRAY_BYTES_PER_ELEMENT 1 -#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL -#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE -#include "ecma-builtin-typedarray-template.inc.h" - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-urierror-prototype.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-urierror-prototype.inc.h deleted file mode 100755 index 9f9213175..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-urierror-prototype.inc.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * UriError.prototype built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.7.8 */ -OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, - ECMA_BUILTIN_ID_URI_ERROR, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.9 */ -STRING_VALUE (LIT_MAGIC_STRING_NAME, - LIT_MAGIC_STRING_URI_ERROR_UL, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -/* ECMA-262 v5, 15.11.7.10 */ -STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, - LIT_MAGIC_STRING__EMPTY, - ECMA_PROPERTY_CONFIGURABLE_WRITABLE) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-urierror.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-urierror.inc.h deleted file mode 100755 index c0d555be1..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtin-urierror.inc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * UriError built-in description - */ - -#include "ecma-builtin-helpers-macro-defines.inc.h" - -#if ENABLED (JERRY_BUILTIN_ERRORS) - -/* Number properties: - * (property name, number value, writable, enumerable, configurable) */ - -/* ECMA-262 v5, 15.11.3 */ -NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, - 1, - ECMA_PROPERTY_FIXED) - -/* Object properties: - * (property name, object pointer getter) */ - -/* ECMA-262 v5, 15.11.3.1 */ -OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, - ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE, - ECMA_PROPERTY_FIXED) - -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -#include "ecma-builtin-helpers-macro-undefs.inc.h" diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtins-internal.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtins-internal.h deleted file mode 100755 index c82672bd9..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtins-internal.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_BUILTINS_INTERNAL_H -#define ECMA_BUILTINS_INTERNAL_H - -#ifndef ECMA_BUILTINS_INTERNAL -# error "!ECMA_BUILTINS_INTERNAL" -#endif /* !ECMA_BUILTINS_INTERNAL */ - -#include "ecma-builtins.h" -#include "ecma-globals.h" - -/** - * Type of built-in properties. - */ -typedef enum -{ - ECMA_BUILTIN_PROPERTY_SIMPLE, /**< simple value property */ - ECMA_BUILTIN_PROPERTY_NUMBER, /**< number value property */ - ECMA_BUILTIN_PROPERTY_STRING, /**< string value property */ -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) - ECMA_BUILTIN_PROPERTY_SYMBOL, /**< symbol value property */ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - ECMA_BUILTIN_PROPERTY_OBJECT, /**< builtin object property */ - ECMA_BUILTIN_PROPERTY_ROUTINE, /**< routine property */ - ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, /**< full accessor property */ - ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, /**< read-only accessor property */ - ECMA_BUILTIN_PROPERTY_END, /**< last property */ -} ecma_builtin_property_type_t; - -/** - * Type of symbolic built-in number types (starting from 256). - */ -typedef enum -{ - ECMA_BUILTIN_NUMBER_MAX = 256, /**< value of ECMA_NUMBER_MAX_VALUE */ - ECMA_BUILTIN_NUMBER_MIN, /**< value of ECMA_NUMBER_MIN_VALUE */ -#if ENABLED (JERRY_ES2015_BUILTIN) - ECMA_BUILTIN_NUMBER_EPSILON, /**< value of ECMA_NUMBER_EPSILON */ - ECMA_BUILTIN_NUMBER_MAX_SAFE_INTEGER, /**< value of ECMA_NUMBER_MAX_SAFE_INTEGER */ -#endif /* ENABLED (JERRY_BUILTIN_NUMBER) */ - ECMA_BUILTIN_NUMBER_E, /**< value of ECMA_NUMBER_E */ - ECMA_BUILTIN_NUMBER_PI, /**< value of ECMA_NUMBER_PI */ - ECMA_BUILTIN_NUMBER_LN10, /**< value of ECMA_NUMBER_LN10 */ - ECMA_BUILTIN_NUMBER_LN2, /**< value of ECMA_NUMBER_LN2 */ - ECMA_BUILTIN_NUMBER_LOG2E, /**< value of ECMA_NUMBER_LOG2E */ - ECMA_BUILTIN_NUMBER_LOG10E, /**< value of ECMA_NUMBER_LOG10E */ - ECMA_BUILTIN_NUMBER_SQRT2, /**< value of ECMA_NUMBER_SQRT2 */ - ECMA_BUILTIN_NUMBER_SQRT_1_2, /**< value of ECMA_NUMBER_SQRT_1_2 */ - ECMA_BUILTIN_NUMBER_NAN, /**< result of ecma_number_make_nan () */ - ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, /**< result of ecma_number_make_infinity (false) */ - ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY, /**< result of ecma_number_make_infinity (true) */ -} ecma_builtin_number_type_t; - -/** - * Description of built-in properties. - */ -typedef struct -{ - uint16_t magic_string_id; /**< name of the property */ - uint8_t type; /**< type of the property */ - uint8_t attributes; /**< attributes of the property */ - uint16_t value; /**< value of the property */ -} ecma_builtin_property_descriptor_t; - -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ -extern const ecma_builtin_property_descriptor_t \ -ecma_builtin_ ## lowercase_name ## _property_descriptor_list[]; \ -ecma_value_t \ -ecma_builtin_ ## lowercase_name ## _dispatch_call (const ecma_value_t *, \ - ecma_length_t); \ -ecma_value_t \ -ecma_builtin_ ## lowercase_name ## _dispatch_construct (const ecma_value_t *, \ - ecma_length_t); \ -ecma_value_t \ -ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint16_t builtin_routine_id, \ - ecma_value_t this_arg_value, \ - const ecma_value_t [], \ - ecma_length_t); -#define BUILTIN(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ -extern const ecma_builtin_property_descriptor_t \ -ecma_builtin_ ## lowercase_name ## _property_descriptor_list[]; \ -ecma_value_t \ -ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint16_t builtin_routine_id, \ - ecma_value_t this_arg_value, \ - const ecma_value_t [], \ - ecma_length_t); -#include "ecma-builtins.inc.h" - -#undef BUILTIN_ROUTINE -#undef BUILTIN - -#endif /* !ECMA_BUILTINS_INTERNAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtins.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtins.h deleted file mode 100755 index 15d21c42e..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtins.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_BUILTINS_H -#define ECMA_BUILTINS_H - -#include "ecma-globals.h" - -/** - * A built-in object's identifier - */ -typedef enum -{ -/** @cond doxygen_suppress */ -#define BUILTIN(a, b, c, d, e) -#define BUILTIN_ROUTINE(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - builtin_id, -#include "ecma-builtins.inc.h" -#undef BUILTIN -#undef BUILTIN_ROUTINE -#define BUILTIN_ROUTINE(a, b, c, d, e) -#define BUILTIN(builtin_id, \ - object_type, \ - object_prototype_builtin_id, \ - is_extensible, \ - lowercase_name) \ - builtin_id, -#include "ecma-builtins.inc.h" -#undef BUILTIN -#undef BUILTIN_ROUTINE -/** @endcond */ - ECMA_BUILTIN_ID__COUNT /**< number of built-in objects */ -} ecma_builtin_id_t; - -/** - * Construct a routine value - */ -#define ECMA_ROUTINE_VALUE(id, length) (((id) << 4) | length) - -/** - * Get routine length - */ -#define ECMA_GET_ROUTINE_LENGTH(value) ((uint8_t) ((value) & 0xf)) - -/** - * Get routine ID - */ -#define ECMA_GET_ROUTINE_ID(value) ((uint16_t) ((value) >> 4)) - -/** - * Construct a fully accessor value - */ -#define ECMA_ACCESSOR_READ_WRITE(getter, setter) (((getter) << 8) | (setter)) - -/** - * Get accessor setter ID - */ -#define ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID(value) ((uint16_t) ((value) & 0xff)) - -/** - * Get accessor getter ID - */ -#define ECMA_ACCESSOR_READ_WRITE_GET_GETTER_ID(value) ((uint16_t) ((value) >> 8)) - -/* ecma-builtins.c */ -void ecma_finalize_builtins (void); - -ecma_value_t -ecma_builtin_dispatch_call (ecma_object_t *obj_p, ecma_value_t this_arg_value, - const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len); -ecma_value_t -ecma_builtin_dispatch_construct (ecma_object_t *obj_p, - const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len); -ecma_property_t * -ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, ecma_string_t *string_p); -void -ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, - bool separate_enumerable, - ecma_collection_t *main_collection_p, - ecma_collection_t *non_enum_collection_p); -bool -ecma_builtin_is (ecma_object_t *obj_p, ecma_builtin_id_t builtin_id); -ecma_object_t * -ecma_builtin_get (ecma_builtin_id_t builtin_id); -ecma_object_t * -ecma_builtin_get_global (void); -bool -ecma_builtin_function_is_routine (ecma_object_t *func_obj_p); - -#endif /* !ECMA_BUILTINS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtins.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtins.inc.h deleted file mode 100755 index ddd19606f..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-builtins.inc.h +++ /dev/null @@ -1,546 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* Description of built-in objects - in format (ECMA_BUILTIN_ID_id, object_type, prototype_id, is_extensible, is_static, underscored_id) */ - -/* The Object.prototype object (15.2.4) */ -BUILTIN (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID__COUNT /* no prototype */, - true, - object_prototype) - -/* The Object object (15.2.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_OBJECT, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - object) - -#if ENABLED (JERRY_BUILTIN_ARRAY) -/* The Array.prototype object (15.4.4) */ -BUILTIN (ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_ARRAY, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - array_prototype) - -/* The Array object (15.4.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - array) -#endif /* ENABLED (JERRY_BUILTIN_ARRAY) */ - -#if ENABLED (JERRY_BUILTIN_STRING) -/* The String.prototype object (15.5.4) */ -BUILTIN (ECMA_BUILTIN_ID_STRING_PROTOTYPE, - ECMA_OBJECT_TYPE_CLASS, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - string_prototype) - -/* The String object (15.5.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_STRING, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - string) -#endif /* ENABLED (JERRY_BUILTIN_STRING) */ - -#if ENABLED (JERRY_BUILTIN_BOOLEAN) -/* The Boolean.prototype object (15.6.4) */ -BUILTIN (ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, - ECMA_OBJECT_TYPE_CLASS, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - boolean_prototype) - -/* The Boolean object (15.6.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_BOOLEAN, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - boolean) -#endif /* ENABLED (JERRY_BUILTIN_BOOLEAN) */ - -#if ENABLED (JERRY_BUILTIN_NUMBER) -/* The Number.prototype object (15.7.4) */ -BUILTIN (ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, - ECMA_OBJECT_TYPE_CLASS, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - number_prototype) - -/* The Number object (15.7.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_NUMBER, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - number) -#endif /* ENABLED (JERRY_BUILTIN_NUMBER) */ - -/* The Function.prototype object (15.3.4) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - function_prototype) - -/* The Function object (15.3.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - function) - -#if ENABLED (JERRY_BUILTIN_MATH) -/* The Math object (15.8) */ -BUILTIN (ECMA_BUILTIN_ID_MATH, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - math) -#endif /* ENABLED (JERRY_BUILTIN_MATH) */ - -#if ENABLED (JERRY_BUILTIN_JSON) -/* The JSON object (15.12) */ -BUILTIN (ECMA_BUILTIN_ID_JSON, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - json) -#endif /* ENABLED (JERRY_BUILTIN_JSON) */ - -#if ENABLED (JERRY_BUILTIN_DATE) -/* The Date.prototype object (15.9.4) */ -BUILTIN (ECMA_BUILTIN_ID_DATE_PROTOTYPE, - ECMA_OBJECT_TYPE_CLASS, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - date_prototype) - -/* The Date object (15.9.3) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATE, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - date) -#endif /* ENABLED (JERRY_BUILTIN_DATE) */ - -#if ENABLED (JERRY_BUILTIN_REGEXP) -/* The RegExp.prototype object (15.10.6) */ -BUILTIN (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE, - ECMA_OBJECT_TYPE_CLASS, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - regexp_prototype) - -/* The RegExp object (15.10) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REGEXP, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - regexp) -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ - -/* The Error object (15.11.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ERROR, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - error) - -/* The Error.prototype object (15.11.4) */ -BUILTIN (ECMA_BUILTIN_ID_ERROR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - error_prototype) - -#if ENABLED (JERRY_BUILTIN_ERRORS) -/* The EvalError.prototype object (15.11.6.1) */ -BUILTIN (ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ERROR_PROTOTYPE, - true, - eval_error_prototype) - -/* The EvalError object (15.11.6.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_EVAL_ERROR, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - eval_error) - -/* The RangeError.prototype object (15.11.6.2) */ -BUILTIN (ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ERROR_PROTOTYPE, - true, - range_error_prototype) - -/* The RangeError object (15.11.6.2) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_RANGE_ERROR, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - range_error) - -/* The ReferenceError.prototype object (15.11.6.3) */ -BUILTIN (ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ERROR_PROTOTYPE, - true, - reference_error_prototype) - -/* The ReferenceError object (15.11.6.3) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_REFERENCE_ERROR, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - reference_error) - -/* The SyntaxError.prototype object (15.11.6.4) */ -BUILTIN (ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ERROR_PROTOTYPE, - true, - syntax_error_prototype) - -/* The SyntaxError object (15.11.6.4) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYNTAX_ERROR, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - syntax_error) - -/* The TypeError.prototype object (15.11.6.5) */ -BUILTIN (ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ERROR_PROTOTYPE, - true, - type_error_prototype) - -/* The TypeError object (15.11.6.5) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - type_error) - -/* The URIError.prototype object (15.11.6.6) */ -BUILTIN (ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ERROR_PROTOTYPE, - true, - uri_error_prototype) - -/* The URIError object (15.11.6.6) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_URI_ERROR, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - uri_error) -#endif /* ENABLED (JERRY_BUILTIN_ERRORS) */ - -/**< The [[ThrowTypeError]] object (13.2.3) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPE_ERROR_THROWER, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - false, - type_error_thrower) - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -/* The ArrayBuffer.prototype object (ES2015 24.1.4) */ -BUILTIN (ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - arraybuffer_prototype) - -/* The ArrayBuffer object (ES2015 24.1.2) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAYBUFFER, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - arraybuffer) - - /* The %TypedArrayPrototype% object (ES2015 24.2.3) */ -BUILTIN (ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - typedarray_prototype) - -/* The %TypedArray% intrinsic object (ES2015 22.2.1) - Note: The routines must be in this order. */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_TYPEDARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - typedarray) - -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT8ARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_TYPEDARRAY, - true, - int8array) - -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8ARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_TYPEDARRAY, - true, - uint8array) - -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_TYPEDARRAY, - true, - uint8clampedarray) - -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT16ARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_TYPEDARRAY, - true, - int16array) - -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT16ARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_TYPEDARRAY, - true, - uint16array) - -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_INT32ARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_TYPEDARRAY, - true, - int32array) - -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_UINT32ARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_TYPEDARRAY, - true, - uint32array) - -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT32ARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_TYPEDARRAY, - true, - float32array) - -#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64) -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FLOAT64ARRAY, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_TYPEDARRAY, - true, - float64array) -#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */ - - -BUILTIN (ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - true, - int8array_prototype) - -BUILTIN (ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - true, - uint8array_prototype) - -BUILTIN (ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - true, - uint8clampedarray_prototype) - -BUILTIN (ECMA_BUILTIN_ID_INT16ARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - true, - int16array_prototype) - -BUILTIN (ECMA_BUILTIN_ID_UINT16ARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - true, - uint16array_prototype) - -BUILTIN (ECMA_BUILTIN_ID_INT32ARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - true, - int32array_prototype) - -BUILTIN (ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - true, - uint32array_prototype) - -BUILTIN (ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - true, - float32array_prototype) - -#if ENABLED (JERRY_NUMBER_TYPE_FLOAT64) -BUILTIN (ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, - true, - float64array_prototype) -#endif /* ENABLED (JERRY_NUMBER_TYPE_FLOAT64) */ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) - -BUILTIN (ECMA_BUILTIN_ID_PROMISE_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - promise_prototype) - -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_PROMISE, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - promise) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) - -/* The Map prototype object (23.1.3) */ -BUILTIN (ECMA_BUILTIN_ID_MAP_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - map_prototype) - -/* The Map routine (ECMA-262 v6, 23.1.1.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - map) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_SET) - -/* The Set prototype object (23.1.3) */ -BUILTIN (ECMA_BUILTIN_ID_SET_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - set_prototype) - -/* The Set routine (ECMA-262 v6, 23.1.1.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - set) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SET) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) - -/* The Symbol prototype object (ECMA-262 v6, 19.4.2.7) */ -BUILTIN (ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - symbol_prototype) - -/* The Symbol routine (ECMA-262 v6, 19.4.2.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SYMBOL, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - symbol) - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) -/* The %IteratorPrototype% object (ECMA-262 v6, 25.1.2) */ -BUILTIN (ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - iterator_prototype) - -/* The %ArrayIteratorPrototype% object (ECMA-262 v6, 22.1.5.2) */ -BUILTIN (ECMA_BUILTIN_ID_ARRAY_ITERATOR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE, - true, - array_iterator_prototype) - -/* The %StringIteratorPrototype% object (ECMA-262 v6, 22.1.5.2) */ -BUILTIN (ECMA_BUILTIN_ID_STRING_ITERATOR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE, - true, - string_iterator_prototype) - -#if ENABLED (JERRY_ES2015_BUILTIN_SET) -/* The %SetIteratorPrototype% object (ECMA-262 v6, 23.2.5.2) */ -BUILTIN (ECMA_BUILTIN_ID_SET_ITERATOR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE, - true, - set_iterator_prototype) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SET) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) -/* The %MapIteratorPrototype% object (ECMA-262 v6, 23.1.5.2) */ -BUILTIN (ECMA_BUILTIN_ID_MAP_ITERATOR_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_ITERATOR_PROTOTYPE, - true, - map_iterator_prototype) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SET) */ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) -/* The DataView prototype object (ECMA-262 v6, 24.2.3.1) */ -BUILTIN (ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, - true, - dataview_prototype) - -/* The DataView routine (ECMA-262 v6, 24.2.2.1) */ -BUILTIN_ROUTINE (ECMA_BUILTIN_ID_DATAVIEW, - ECMA_OBJECT_TYPE_FUNCTION, - ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, - true, - dataview) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW */ - -/* The Global object (15.1) */ -BUILTIN (ECMA_BUILTIN_ID_GLOBAL, - ECMA_OBJECT_TYPE_GENERAL, - ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, /* Implementation-dependent */ - true, - global) - -#undef BUILTIN diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-comparison.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-comparison.h deleted file mode 100755 index d8e0084eb..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-comparison.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_COMPARISON_H -#define ECMA_COMPARISON_H - -#include "ecma-globals.h" -#include "ecma-helpers.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmacomparison ECMA comparison - * @{ - */ - -ecma_value_t ecma_op_abstract_equality_compare (ecma_value_t x, ecma_value_t y); -bool ecma_op_strict_equality_compare (ecma_value_t x, ecma_value_t y); -ecma_value_t ecma_op_abstract_relational_compare (ecma_value_t x, ecma_value_t y, bool left_first); - -/** - * @} - * @} - */ - -#endif /* !ECMA_COMPARISON_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-container-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-container-object.h deleted file mode 100755 index 6959d2b9d..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-container-object.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_CONTAINER_OBJECT_H -#define ECMA_CONTAINER_OBJECT_H - -#include "ecma-globals.h" -#include "ecma-builtins.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmamaphelpers ECMA builtin map/set helper functions - * @{ - */ - -ecma_value_t ecma_op_container_create (const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len, - lit_magic_string_id_t lit_id, ecma_builtin_id_t proto_id); -ecma_value_t ecma_op_container_size (ecma_value_t this_arg, lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_get (ecma_value_t this_arg, ecma_value_t key_arg); -ecma_value_t ecma_op_container_foreach (ecma_value_t this_arg, ecma_value_t predicate, ecma_value_t predicate_this_arg, - lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_has (ecma_value_t this_arg, ecma_value_t key_arg, lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_set (ecma_value_t this_arg, ecma_value_t key_arg, ecma_value_t value_arg, - lit_magic_string_id_t lit_id); - -ecma_value_t ecma_op_container_clear (ecma_value_t this_arg, lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_delete (ecma_value_t this_arg, ecma_value_t key_arg, lit_magic_string_id_t lit_id); -ecma_value_t ecma_op_container_create_iterator (ecma_value_t this_arg, uint8_t type, lit_magic_string_id_t lit_id, - ecma_builtin_id_t proto_id, ecma_pseudo_array_type_t iterator_type); -ecma_value_t ecma_op_container_iterator_next (ecma_value_t this_val, ecma_pseudo_array_type_t iterator_type); - -/** - * @} - * @} - */ - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) */ - -#endif /* !ECMA_CONTAINER_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-conversion.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-conversion.h deleted file mode 100755 index 61e511774..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-conversion.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_CONVERSION_H -#define ECMA_CONVERSION_H - -#include "ecma-globals.h" -#include "ecma-helpers.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmaconversion ECMA conversion routines - * @{ - */ - -/** - * Second argument of 'ToPrimitive' operation that is a hint, - * specifying the preferred type of conversion result. - */ -typedef enum -{ - ECMA_PREFERRED_TYPE_NO, /**< no preferred type is specified */ - ECMA_PREFERRED_TYPE_NUMBER, /**< Number */ - ECMA_PREFERRED_TYPE_STRING /**< String */ -} ecma_preferred_type_hint_t; - -ecma_value_t ecma_op_check_object_coercible (ecma_value_t value); -bool ecma_op_same_value (ecma_value_t x, ecma_value_t y); -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) -bool ecma_op_same_value_zero (ecma_value_t x, ecma_value_t y); -#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) */ -ecma_value_t ecma_op_to_primitive (ecma_value_t value, ecma_preferred_type_hint_t preferred_type); -bool ecma_op_to_boolean (ecma_value_t value); -ecma_value_t ecma_op_to_number (ecma_value_t value); -ecma_value_t ecma_get_number (ecma_value_t value, ecma_number_t *number_p); -ecma_value_t ecma_op_to_string (ecma_value_t value); -ecma_string_t *ecma_op_to_prop_name (ecma_value_t value); -ecma_value_t ecma_op_to_object (ecma_value_t value); -ecma_value_t ecma_op_to_integer (ecma_value_t value, ecma_number_t *number_p); -ecma_value_t ecma_op_to_length (ecma_value_t value, uint32_t *length); - -ecma_object_t *ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_desc_p); -ecma_value_t ecma_op_to_property_descriptor (ecma_value_t obj_value, ecma_property_descriptor_t *out_prop_desc_p); - -/** - * @} - * @} - */ - -#endif /* !ECMA_CONVERSION_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-dataview-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-dataview-object.h deleted file mode 100755 index 3bc658acd..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-dataview-object.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_DATAVIEW_OBJECT_H -#define ECMA_DATAVIEW_OBJECT_H - -#include "ecma-globals.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW) - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmadataviewobject ECMA builtin DataView helper functions - * @{ - */ - -ecma_value_t ecma_op_dataview_create (const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len); -ecma_dataview_object_t *ecma_op_dataview_get_object (ecma_value_t this_arg); -ecma_value_t ecma_op_dataview_get_set_view_value (ecma_value_t view, ecma_value_t request_index, - ecma_value_t little_endian, ecma_value_t value_to_set, - ecma_typedarray_type_t id); - -/** - * @} - * @} - */ - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_DATAVIEW */ - -#endif /* !ECMA_DATAVIEW_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-eval.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-eval.h deleted file mode 100755 index 057c4d2fa..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-eval.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_EVAL_H -#define ECMA_EVAL_H - -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup eval eval - * @{ - */ - -ecma_value_t -ecma_op_eval (ecma_string_t *code_p, uint32_t parse_opts); - -ecma_value_t -ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, size_t code_buffer_size, uint32_t parse_opts); - -/** - * @} - * @} - */ - -#endif /* !ECMA_EVAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-exceptions.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-exceptions.h deleted file mode 100755 index 0dc0122be..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-exceptions.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_EXCEPTIONS_H -#define ECMA_EXCEPTIONS_H - -#include "ecma-globals.h" -#include "jrt.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup exceptions Exceptions - * @{ - */ - -#if ENABLED (JERRY_ERROR_MESSAGES) -#define ECMA_ERR_MSG(msg) msg -#else /* !ENABLED (JERRY_ERROR_MESSAGES) */ -#define ECMA_ERR_MSG(msg) NULL -#endif /* ENABLED (JERRY_ERROR_MESSAGES) */ - -/** - * Native errors. - * - * See also: 15.11.1, 15.11.6 - */ -typedef enum -{ - ECMA_ERROR_NONE, /**< Not an Error */ - - ECMA_ERROR_COMMON, /**< Error */ - ECMA_ERROR_EVAL, /**< EvalError */ - ECMA_ERROR_RANGE, /**< RangeError */ - ECMA_ERROR_REFERENCE, /**< ReferenceError */ - ECMA_ERROR_SYNTAX, /**< SyntaxError */ - ECMA_ERROR_TYPE, /**< TypeError */ - ECMA_ERROR_URI /**< URIError */ -} ecma_standard_error_t; - -ecma_standard_error_t ecma_get_error_type (ecma_object_t *error_object); -ecma_object_t *ecma_new_standard_error (ecma_standard_error_t error_type); -ecma_object_t *ecma_new_standard_error_with_message (ecma_standard_error_t error_type, ecma_string_t *message_string_p); -#if ENABLED (JERRY_ERROR_MESSAGES) -ecma_value_t ecma_raise_standard_error_with_format (ecma_standard_error_t error_type, const char *msg_p, ...); -#endif /* ENABLED (JERRY_ERROR_MESSAGES) */ -ecma_value_t ecma_raise_common_error (const char *msg_p); -ecma_value_t ecma_raise_range_error (const char *msg_p); -ecma_value_t ecma_raise_reference_error (const char *msg_p); -ecma_value_t ecma_raise_syntax_error (const char *msg_p); -ecma_value_t ecma_raise_type_error (const char *msg_p); -ecma_value_t ecma_raise_uri_error (const char *msg_p); - -/** - * @} - * @} - */ - -#endif /* !ECMA_EXCEPTIONS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-function-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-function-object.h deleted file mode 100755 index b5be3358f..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-function-object.h +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_FUNCTION_OBJECT_H -#define ECMA_FUNCTION_OBJECT_H - -#include "ecma-globals.h" -#include "vm.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmafunctionobject ECMA Function object related routines - * @{ - */ - -bool ecma_is_normal_or_arrow_function (ecma_object_type_t type); - -bool ecma_op_is_callable (ecma_value_t value); -bool ecma_is_constructor (ecma_value_t value); - -ecma_object_t * -ecma_op_create_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p); - -#if ENABLED (JERRY_ES2015_ARROW_FUNCTION) -ecma_object_t * -ecma_op_create_arrow_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p, - ecma_value_t this_binding); -#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */ - -ecma_object_t * -ecma_op_create_external_function_object (ecma_external_handler_t handler_cb); - -const ecma_compiled_code_t * -ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p); - -#if ENABLED (JERRY_ES2015_CLASS) -void -ecma_op_set_super_called (ecma_object_t *lex_env_p); - -bool -ecma_op_is_super_called (ecma_object_t *lex_env_p); - -void -ecma_op_set_class_this_binding (ecma_object_t *lex_env_p, ecma_value_t this_binding); - -ecma_value_t -ecma_op_get_class_this_binding (ecma_object_t *lex_env_p); - -ecma_value_t -ecma_op_function_implicit_constructor_handler_cb (const ecma_value_t function_obj, - const ecma_value_t this_val, - const ecma_value_t args_p[], - const ecma_length_t args_count); - -void -ecma_op_set_class_prototype (ecma_value_t completion_value, ecma_value_t this_arg); -#endif /* ENABLED (JERRY_ES2015_CLASS) */ - -#if ENABLED (JERRY_ES2015_ARROW_FUNCTION) -const ecma_compiled_code_t * -ecma_op_arrow_function_get_compiled_code (ecma_arrow_function_t *arrow_function_p); -#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */ - -ecma_value_t -ecma_op_function_has_instance (ecma_object_t *func_obj_p, ecma_value_t value); - -ecma_value_t -ecma_op_function_call (ecma_object_t *func_obj_p, ecma_value_t this_arg_value, - const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len); - -ecma_value_t -ecma_op_function_construct (ecma_object_t *func_obj_p, ecma_value_t this_arg_value, - const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len); - -ecma_property_t * -ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); - -ecma_property_t * -ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); - -ecma_property_t * -ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p); - -void -ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, - bool separate_enumerable, - ecma_collection_t *main_collection_p, - ecma_collection_t *non_enum_collection_p); - -void -ecma_op_external_function_list_lazy_property_names (bool separate_enumerable, - ecma_collection_t *main_collection_p, - ecma_collection_t *non_enum_collection_p); - -void -ecma_op_bound_function_list_lazy_property_names (bool separate_enumerable, - ecma_collection_t *main_collection_p, - ecma_collection_t *non_enum_collection_p); - -/** - * @} - * @} - */ - -#endif /* !ECMA_FUNCTION_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-gc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-gc.h deleted file mode 100755 index 6a4166adb..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-gc.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_GC_H -#define ECMA_GC_H - -#include "ecma-globals.h" -#include "jmem.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmagc Garbage collector - * @{ - */ - -void ecma_init_gc_info (ecma_object_t *object_p); -void ecma_ref_object (ecma_object_t *object_p); -void ecma_deref_object (ecma_object_t *object_p); -void ecma_gc_run (void); -void ecma_free_unused_memory (jmem_pressure_t pressure); - -/** - * @} - * @} - */ - -#endif /* !ECMA_GC_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-helpers.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-helpers.h deleted file mode 100755 index a4fbde471..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-helpers.h +++ /dev/null @@ -1,447 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_HELPERS_H -#define ECMA_HELPERS_H - -#include "ecma-globals.h" -#include "jmem.h" -#include "lit-strings.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmahelpers Helpers for operations with ECMA data types - * @{ - */ - -/** - * Get value of pointer from specified non-null compressed pointer. - */ -#define ECMA_GET_NON_NULL_POINTER(type, field) JMEM_CP_GET_NON_NULL_POINTER (type, field) - -/** - * Get value of pointer from specified compressed pointer. - */ -#define ECMA_GET_POINTER(type, field) JMEM_CP_GET_POINTER (type, field) - -/** - * Set value of non-null compressed pointer so that it will correspond - * to specified non_compressed_pointer. - */ -#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) JMEM_CP_SET_NON_NULL_POINTER (field, \ - non_compressed_pointer) - -/** - * Set value of compressed pointer so that it will correspond - * to specified non_compressed_pointer. - */ -#define ECMA_SET_POINTER(field, non_compressed_pointer) JMEM_CP_SET_POINTER (field, non_compressed_pointer) - -/** - * Status flags for ecma_string_get_chars function - */ -typedef enum -{ - ECMA_STRING_FLAG_EMPTY = 0, /**< No options are provided. */ - ECMA_STRING_FLAG_IS_ASCII = (1 << 0), /**< The string contains only ASCII characters. */ - ECMA_STRING_FLAG_REHASH_NEEDED = (1 << 1), /**< The hash of the string must be recalculated. - * For more details see ecma_append_chars_to_string */ - ECMA_STRING_FLAG_IS_UINT32 = (1 << 2), /**< The string repesents an UINT32 number */ - ECMA_STRING_FLAG_MUST_BE_FREED = (1 << 3), /**< The returned buffer must be freed */ -} ecma_string_flag_t; - -/** - * Convert ecma-string's contents to a cesu-8 string and put it into a buffer. - */ -#define ECMA_STRING_TO_UTF8_STRING(ecma_str_ptr, /**< ecma string pointer */ \ - utf8_ptr, /**< [out] output buffer pointer */ \ - utf8_str_size) /**< [out] output buffer size */ \ - lit_utf8_size_t utf8_str_size; \ - uint8_t utf8_ptr ## flags = ECMA_STRING_FLAG_EMPTY; \ - const lit_utf8_byte_t *utf8_ptr = ecma_string_get_chars (ecma_str_ptr, \ - &utf8_str_size, \ - NULL, \ - NULL, \ - &utf8_ptr ## flags); - -/** - * Free the cesu-8 string buffer allocated by 'ECMA_STRING_TO_UTF8_STRING' - */ -#define ECMA_FINALIZE_UTF8_STRING(utf8_ptr, /**< pointer to character buffer */ \ - utf8_str_size) /**< buffer size */ \ - if (utf8_ptr ## flags & ECMA_STRING_FLAG_MUST_BE_FREED) \ - { \ - JERRY_ASSERT (utf8_ptr != NULL); \ - jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \ - } - -#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY - -/** - * Set an internal property value from pointer. - */ -#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) \ - (field) = ((ecma_value_t) pointer) - -/** - * Set an internal property value from pointer. Pointer can be NULL. - */ -#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) \ - (field) = ((ecma_value_t) pointer) - -/** - * Convert an internal property value to pointer. - */ -#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \ - ((type *) field) - -/** - * Convert an internal property value to pointer. Result can be NULL. - */ -#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) \ - ((type *) field) - -#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */ - -/** - * Set an internal property value from pointer. - */ -#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) \ - ECMA_SET_NON_NULL_POINTER (field, pointer) - -/** - * Set an internal property value from pointer. Pointer can be NULL. - */ -#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) \ - ECMA_SET_POINTER (field, pointer) - -/** - * Convert an internal property value to pointer. - */ -#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \ - ECMA_GET_NON_NULL_POINTER (type, field) - -/** - * Convert an internal property value to pointer. Result can be NULL. - */ -#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) \ - ECMA_GET_POINTER (type, field) - -#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */ - -/** - * Convert boolean to bitfield value. - */ -#define ECMA_BOOL_TO_BITFIELD(x) ((x) ? 1 : 0) - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -/** - * JERRY_ASSERT compatible macro for checking whether the given ecma-value is symbol - */ -#define ECMA_ASSERT_VALUE_IS_SYMBOL(value) (ecma_is_value_symbol ((value))) -#else /* !ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -/** - * JERRY_ASSERT compatible macro for checking whether the given ecma-value is symbol - */ -#define ECMA_ASSERT_VALUE_IS_SYMBOL(value) (false) -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - -/* ecma-helpers-value.c */ -bool JERRY_ATTR_CONST ecma_is_value_direct (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_simple (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_empty (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_undefined (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_null (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_boolean (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_true (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_false (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_found (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_array_hole (ecma_value_t value); - -bool JERRY_ATTR_CONST ecma_is_value_integer_number (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_are_values_integer_numbers (ecma_value_t first_value, ecma_value_t second_value); -bool JERRY_ATTR_CONST ecma_is_value_float_number (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_number (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_string (ecma_value_t value); -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -bool JERRY_ATTR_CONST ecma_is_value_symbol (ecma_value_t value); -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -bool JERRY_ATTR_CONST ecma_is_value_prop_name (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_direct_string (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_non_direct_string (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_object (ecma_value_t value); -bool JERRY_ATTR_CONST ecma_is_value_error_reference (ecma_value_t value); - -void ecma_check_value_type_is_spec_defined (ecma_value_t value); - -ecma_value_t JERRY_ATTR_CONST ecma_make_boolean_value (bool boolean_value); -ecma_value_t JERRY_ATTR_CONST ecma_make_integer_value (ecma_integer_value_t integer_value); -ecma_value_t ecma_make_nan_value (void); -ecma_value_t ecma_make_float_value (ecma_number_t *ecma_num_p); -ecma_value_t ecma_make_number_value (ecma_number_t ecma_number); -ecma_value_t ecma_make_int32_value (int32_t int32_number); -ecma_value_t ecma_make_uint32_value (uint32_t uint32_number); -ecma_value_t JERRY_ATTR_PURE ecma_make_string_value (const ecma_string_t *ecma_string_p); -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -ecma_value_t JERRY_ATTR_PURE ecma_make_symbol_value (const ecma_string_t *ecma_symbol_p); -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -ecma_value_t JERRY_ATTR_PURE ecma_make_prop_name_value (const ecma_string_t *ecma_prop_name_p); -ecma_value_t JERRY_ATTR_PURE ecma_make_magic_string_value (lit_magic_string_id_t id); -ecma_value_t JERRY_ATTR_PURE ecma_make_object_value (const ecma_object_t *object_p); -ecma_value_t JERRY_ATTR_PURE ecma_make_error_reference_value (const ecma_error_reference_t *error_ref_p); -ecma_integer_value_t JERRY_ATTR_CONST ecma_get_integer_from_value (ecma_value_t value); -ecma_number_t JERRY_ATTR_PURE ecma_get_float_from_value (ecma_value_t value); -ecma_number_t * ecma_get_pointer_from_float_value (ecma_value_t value); -ecma_number_t JERRY_ATTR_PURE ecma_get_number_from_value (ecma_value_t value); -ecma_string_t JERRY_ATTR_PURE *ecma_get_string_from_value (ecma_value_t value); -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -ecma_string_t JERRY_ATTR_PURE *ecma_get_symbol_from_value (ecma_value_t value); -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -ecma_string_t JERRY_ATTR_PURE *ecma_get_prop_name_from_value (ecma_value_t value); -ecma_object_t JERRY_ATTR_PURE *ecma_get_object_from_value (ecma_value_t value); -ecma_error_reference_t JERRY_ATTR_PURE *ecma_get_error_reference_from_value (ecma_value_t value); -ecma_value_t JERRY_ATTR_CONST ecma_invert_boolean_value (ecma_value_t value); -ecma_value_t ecma_copy_value (ecma_value_t value); -ecma_value_t ecma_fast_copy_value (ecma_value_t value); -ecma_value_t ecma_copy_value_if_not_object (ecma_value_t value); -ecma_value_t ecma_update_float_number (ecma_value_t float_value, ecma_number_t new_number); -void ecma_value_assign_value (ecma_value_t *value_p, ecma_value_t ecma_value); -void ecma_value_assign_number (ecma_value_t *value_p, ecma_number_t ecma_number); -void ecma_free_value (ecma_value_t value); -void ecma_fast_free_value (ecma_value_t value); -void ecma_free_value_if_not_object (ecma_value_t value); -void ecma_free_number (ecma_value_t value); -lit_magic_string_id_t ecma_get_typeof_lit_id (ecma_value_t value); - -/* ecma-helpers-string.c */ -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -ecma_string_t *ecma_new_symbol_from_descriptor_string (ecma_value_t string_desc); -bool ecma_prop_name_is_symbol (ecma_string_t *string_p); -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -#if ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) -ecma_string_t *ecma_new_map_key_string (ecma_value_t value); -bool ecma_prop_name_is_map_key (ecma_string_t *string_p); -#endif /* ENABLED (JERRY_ES2015_BUILTIN_MAP) || ENABLED (JERRY_ES2015_BUILTIN_SET) */ -ecma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size); -ecma_string_t *ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string_p, - lit_utf8_size_t string_size); -ecma_string_t *ecma_new_ecma_string_from_code_unit (ecma_char_t code_unit); -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) -ecma_string_t *ecma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, ecma_char_t second_code_unit); -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ -ecma_string_t *ecma_new_ecma_string_from_uint32 (uint32_t uint32_number); -ecma_string_t *ecma_new_non_direct_string_from_uint32 (uint32_t uint32_number); -ecma_string_t *ecma_get_ecma_string_from_uint32 (uint32_t uint32_number); -ecma_string_t *ecma_new_ecma_string_from_number (ecma_number_t num); -ecma_string_t *ecma_get_magic_string (lit_magic_string_id_t id); -ecma_string_t *ecma_append_chars_to_string (ecma_string_t *string1_p, - const lit_utf8_byte_t *cesu8_string2_p, - lit_utf8_size_t cesu8_string2_size, - lit_utf8_size_t cesu8_string2_length); -ecma_string_t *ecma_concat_ecma_strings (ecma_string_t *string1_p, ecma_string_t *string2_p); -ecma_string_t *ecma_append_magic_string_to_string (ecma_string_t *string1_p, lit_magic_string_id_t string2_id); -void ecma_ref_ecma_string (ecma_string_t *string_p); -void ecma_deref_ecma_string (ecma_string_t *string_p); -void ecma_destroy_ecma_string (ecma_string_t *string_p); -ecma_number_t ecma_string_to_number (const ecma_string_t *str_p); -uint32_t ecma_string_get_array_index (const ecma_string_t *str_p); - -lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT -ecma_string_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p, - lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); -lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT -ecma_string_copy_to_utf8_buffer (const ecma_string_t *string_desc_p, - lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); -lit_utf8_size_t -ecma_substring_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p, - ecma_length_t start_pos, - ecma_length_t end_pos, - lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); -lit_utf8_size_t -ecma_substring_copy_to_utf8_buffer (const ecma_string_t *string_desc_p, - ecma_length_t start_pos, - ecma_length_t end_pos, - lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); -void ecma_string_to_utf8_bytes (const ecma_string_t *string_desc_p, lit_utf8_byte_t *buffer_p, - lit_utf8_size_t buffer_size); -const lit_utf8_byte_t *ecma_string_get_chars (const ecma_string_t *string_p, - lit_utf8_size_t *size_p, - lit_utf8_size_t *length_p, - lit_utf8_byte_t *uint32_buff_p, - uint8_t *flags_p); -bool ecma_compare_ecma_string_to_magic_id (const ecma_string_t *string_p, lit_magic_string_id_t id); -bool ecma_string_is_empty (const ecma_string_t *string_p); -bool ecma_string_is_length (const ecma_string_t *string_p); - -jmem_cpointer_t ecma_string_to_property_name (ecma_string_t *prop_name_p, ecma_property_t *name_type_p); -ecma_string_t *ecma_string_from_property_name (ecma_property_t property, jmem_cpointer_t prop_name_cp); -lit_string_hash_t ecma_string_get_property_name_hash (ecma_property_t property, jmem_cpointer_t prop_name_cp); -uint32_t ecma_string_get_property_index (ecma_property_t property, jmem_cpointer_t prop_name_cp); -bool ecma_string_compare_to_property_name (ecma_property_t property, jmem_cpointer_t prop_name_cp, - const ecma_string_t *string_p); - -bool ecma_compare_ecma_strings (const ecma_string_t *string1_p, const ecma_string_t *string2_p); -bool ecma_compare_ecma_non_direct_strings (const ecma_string_t *string1_p, const ecma_string_t *string2_p); -bool ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, const ecma_string_t *string2_p); -ecma_length_t ecma_string_get_length (const ecma_string_t *string_p); -ecma_length_t ecma_string_get_utf8_length (const ecma_string_t *string_p); -lit_utf8_size_t ecma_string_get_size (const ecma_string_t *string_p); -lit_utf8_size_t ecma_string_get_utf8_size (const ecma_string_t *string_p); -ecma_char_t ecma_string_get_char_at_pos (const ecma_string_t *string_p, ecma_length_t index); - -lit_magic_string_id_t ecma_get_string_magic (const ecma_string_t *string_p); - -lit_string_hash_t ecma_string_hash (const ecma_string_t *string_p); -ecma_string_t *ecma_string_substr (const ecma_string_t *string_p, ecma_length_t start_pos, ecma_length_t end_pos); -void ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p, - lit_utf8_size_t *utf8_str_size); -ecma_string_t *ecma_string_trim (const ecma_string_t *string_p); - -ecma_stringbuilder_t ecma_stringbuilder_create (void); -ecma_stringbuilder_t ecma_stringbuilder_create_from (ecma_string_t *string_p); -lit_utf8_size_t ecma_stringbuilder_get_size (ecma_stringbuilder_t *builder_p); -lit_utf8_byte_t *ecma_stringbuilder_get_data (ecma_stringbuilder_t *builder_p); -void ecma_stringbuilder_revert (ecma_stringbuilder_t *builder_p, const lit_utf8_size_t size); -void ecma_stringbuilder_append (ecma_stringbuilder_t *builder_p, const ecma_string_t *string_p); -void ecma_stringbuilder_append_magic (ecma_stringbuilder_t *builder_p, const lit_magic_string_id_t id); -void ecma_stringbuilder_append_raw (ecma_stringbuilder_t *builder_p, - const lit_utf8_byte_t *data_p, - const lit_utf8_size_t data_size); -void ecma_stringbuilder_append_char (ecma_stringbuilder_t *builder_p, const ecma_char_t c); -void ecma_stringbuilder_append_byte (ecma_stringbuilder_t *builder_p, const lit_utf8_byte_t); -ecma_string_t *ecma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p); -void ecma_stringbuilder_destroy (ecma_stringbuilder_t *builder_p); - -/* ecma-helpers-number.c */ -ecma_number_t ecma_number_make_nan (void); -ecma_number_t ecma_number_make_infinity (bool sign); -bool ecma_number_is_nan (ecma_number_t num); -bool ecma_number_is_negative (ecma_number_t num); -bool ecma_number_is_zero (ecma_number_t num); -bool ecma_number_is_infinity (ecma_number_t num); -ecma_number_t -ecma_number_make_from_sign_mantissa_and_exponent (bool sign, uint64_t mantissa, int32_t exponent); -ecma_number_t ecma_number_get_prev (ecma_number_t num); -ecma_number_t ecma_number_get_next (ecma_number_t num); -ecma_number_t ecma_number_trunc (ecma_number_t num); -ecma_number_t ecma_number_calc_remainder (ecma_number_t left_num, ecma_number_t right_num); -ecma_value_t ecma_integer_multiply (ecma_integer_value_t left_integer, ecma_integer_value_t right_integer); -lit_utf8_size_t ecma_number_to_decimal (ecma_number_t num, lit_utf8_byte_t *out_digits_p, int32_t *out_decimal_exp_p); -lit_utf8_size_t ecma_number_to_binary_floating_point_number (ecma_number_t num, - lit_utf8_byte_t *out_digits_p, - int32_t *out_decimal_exp_p); - -/* ecma-helpers-collection.c */ -ecma_collection_t *ecma_new_collection (void); -void ecma_collection_push_back (ecma_collection_t *collection_p, ecma_value_t value); -void ecma_collection_destroy (ecma_collection_t *collection_p); -void ecma_collection_free (ecma_collection_t *collection_p); -void ecma_collection_free_if_not_object (ecma_collection_t *collection_p); -void ecma_collection_free_objects (ecma_collection_t *collection_p); - -/* ecma-helpers.c */ -ecma_object_t *ecma_create_object (ecma_object_t *prototype_object_p, size_t ext_object_size, ecma_object_type_t type); -ecma_object_t *ecma_create_decl_lex_env (ecma_object_t *outer_lexical_environment_p); -ecma_object_t *ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, ecma_object_t *binding_obj_p, - ecma_lexical_environment_type_t type); -bool JERRY_ATTR_PURE ecma_is_lexical_environment (const ecma_object_t *object_p); -bool JERRY_ATTR_PURE ecma_get_object_extensible (const ecma_object_t *object_p); -void ecma_set_object_extensible (ecma_object_t *object_p, bool is_extensible); -ecma_object_type_t JERRY_ATTR_PURE ecma_get_object_type (const ecma_object_t *object_p); -bool JERRY_ATTR_PURE ecma_get_object_is_builtin (const ecma_object_t *object_p); -void ecma_set_object_is_builtin (ecma_object_t *object_p); -uint8_t ecma_get_object_builtin_id (ecma_object_t *object_p); -ecma_lexical_environment_type_t JERRY_ATTR_PURE ecma_get_lex_env_type (const ecma_object_t *object_p); -ecma_object_t JERRY_ATTR_PURE *ecma_get_lex_env_outer_reference (const ecma_object_t *object_p); -ecma_object_t JERRY_ATTR_PURE *ecma_get_lex_env_binding_object (const ecma_object_t *object_p); - -ecma_property_value_t * -ecma_create_named_data_property (ecma_object_t *object_p, ecma_string_t *name_p, uint8_t prop_attributes, - ecma_property_t **out_prop_p); -ecma_property_value_t * -ecma_create_named_accessor_property (ecma_object_t *object_p, ecma_string_t *name_p, ecma_object_t *get_p, - ecma_object_t *set_p, uint8_t prop_attributes, ecma_property_t **out_prop_p); -ecma_property_t * -ecma_find_named_property (ecma_object_t *obj_p, ecma_string_t *name_p); -ecma_property_value_t * -ecma_get_named_data_property (ecma_object_t *obj_p, ecma_string_t *name_p); - -void ecma_free_property (ecma_object_t *object_p, jmem_cpointer_t name_cp, ecma_property_t *property_p); - -void ecma_delete_property (ecma_object_t *object_p, ecma_property_value_t *prop_value_p); - -void ecma_named_data_property_assign_value (ecma_object_t *obj_p, ecma_property_value_t *prop_value_p, - ecma_value_t value); - -ecma_getter_setter_pointers_t * -ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p); -void ecma_set_named_accessor_property_getter (ecma_object_t *object_p, ecma_property_value_t *prop_value_p, - ecma_object_t *getter_p); -void ecma_set_named_accessor_property_setter (ecma_object_t *object_p, ecma_property_value_t *prop_value_p, - ecma_object_t *setter_p); -bool ecma_is_property_writable (ecma_property_t property); -void ecma_set_property_writable_attr (ecma_property_t *property_p, bool is_writable); -bool ecma_is_property_enumerable (ecma_property_t property); -void ecma_set_property_enumerable_attr (ecma_property_t *property_p, bool is_enumerable); -bool ecma_is_property_configurable (ecma_property_t property); -void ecma_set_property_configurable_attr (ecma_property_t *property_p, bool is_configurable); - -#if ENABLED (JERRY_LCACHE) -bool ecma_is_property_lcached (ecma_property_t *property_p); -void ecma_set_property_lcached (ecma_property_t *property_p, bool is_lcached); -#endif /* ENABLED (JERRY_LCACHE) */ - -ecma_property_descriptor_t ecma_make_empty_property_descriptor (void); -void ecma_free_property_descriptor (ecma_property_descriptor_t *prop_desc_p); - -ecma_value_t ecma_create_error_reference (ecma_value_t value, bool is_exception); -ecma_value_t ecma_create_error_reference_from_context (void); -ecma_value_t ecma_create_error_object_reference (ecma_object_t *object_p); -void ecma_ref_error_reference (ecma_error_reference_t *error_ref_p); -void ecma_deref_error_reference (ecma_error_reference_t *error_ref_p); -ecma_value_t ecma_clear_error_reference (ecma_value_t value, bool set_abort_flag); - -void ecma_bytecode_ref (ecma_compiled_code_t *bytecode_p); -void ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p); -#if (JERRY_STACK_LIMIT != 0) -uintptr_t ecma_get_current_stack_usage (void); -#endif /* (JERRY_STACK_LIMIT != 0) */ - -/* ecma-helpers-external-pointers.c */ -bool ecma_create_native_pointer_property (ecma_object_t *obj_p, void *native_p, void *info_p); -ecma_native_pointer_t *ecma_get_native_pointer_value (ecma_object_t *obj_p, void *info_p); -bool ecma_delete_native_pointer_property (ecma_object_t *obj_p, void *info_p); - -/* ecma-helpers-conversion.c */ -ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, lit_utf8_size_t str_size); -lit_utf8_size_t ecma_uint32_to_utf8_string (uint32_t value, lit_utf8_byte_t *out_buffer_p, lit_utf8_size_t buffer_size); -uint32_t ecma_number_to_uint32 (ecma_number_t num); -int32_t ecma_number_to_int32 (ecma_number_t num); -lit_utf8_size_t ecma_number_to_utf8_string (ecma_number_t num, lit_utf8_byte_t *buffer_p, lit_utf8_size_t buffer_size); - -/* ecma-helpers-errol.c */ -lit_utf8_size_t ecma_errol0_dtoa (double val, lit_utf8_byte_t *buffer_p, int32_t *exp_p); - -/** - * @} - * @} - */ - -#endif /* !ECMA_HELPERS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-init-finalize.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-init-finalize.h deleted file mode 100755 index 0e4fda213..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-init-finalize.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_INIT_FINALIZE_H -#define ECMA_INIT_FINALIZE_H - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmainitfinalize Initialization and finalization of ECMA components - * @{ - */ - -void ecma_init (void); -void ecma_finalize (void); - -/** - * @} - * @} - */ - -#endif /* !ECMA_INIT_FINALIZE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-iterator-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-iterator-object.h deleted file mode 100755 index d4b81e614..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-iterator-object.h +++ /dev/null @@ -1,62 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_ITERATOR_OBJECT_H -#define ECMA_ITERATOR_OBJECT_H - -#include "ecma-globals.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmaiteratorobject ECMA iterator object related routines - * @{ - */ - -/** - * Maximum value of [[%Iterator%NextIndex]] until it can be stored - * in an ecma pseudo array object structure element. - */ -#define ECMA_ITERATOR_INDEX_LIMIT UINT16_MAX - -ecma_value_t -ecma_op_create_iterator_object (ecma_value_t iterated_value, ecma_object_t *prototype_obj_p, - uint8_t iterator_type, uint8_t extra_info); - -ecma_value_t -ecma_create_iter_result_object (ecma_value_t value, ecma_value_t done); - -ecma_value_t -ecma_create_array_from_iter_element (ecma_value_t value, ecma_value_t index_value); - -ecma_value_t -ecma_op_get_iterator (ecma_value_t value, ecma_value_t method); - -ecma_value_t -ecma_op_iterator_value (ecma_value_t iter_result); - -ecma_value_t -ecma_op_iterator_step (ecma_value_t iterator); - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_ITERATOR) */ - -/** - * @} - * @} - */ - -#endif /* !ECMA_ITERATOR_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-jobqueue.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-jobqueue.h deleted file mode 100755 index 260776823..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-jobqueue.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_JOB_QUEUE_H -#define ECMA_JOB_QUEUE_H - -#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmajobqueue ECMA Job Queue related routines - * @{ - */ - -/** - * Jerry job handler function type - */ -typedef ecma_value_t (*ecma_job_handler_t) (void *job_p); - -/** - * Description of the job queue item. - */ -typedef struct ecma_job_queueitem_t -{ - struct ecma_job_queueitem_t *next_p; /**< points to next item */ - ecma_job_handler_t handler; /**< the handler for the job*/ - void *job_p; /**< points to the job */ -} ecma_job_queueitem_t; - -void ecma_job_queue_init (void); - -void ecma_enqueue_promise_reaction_job (ecma_value_t reaction, ecma_value_t argument); -void ecma_enqueue_promise_resolve_thenable_job (ecma_value_t promise, ecma_value_t thenable, ecma_value_t then); -void ecma_free_all_enqueued_jobs (void); - -ecma_value_t ecma_process_all_enqueued_jobs (void); - -/** - * @} - * @} - */ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */ -#endif /* !ECMA_JOB_QUEUE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-lcache.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-lcache.h deleted file mode 100755 index e4add397b..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-lcache.h +++ /dev/null @@ -1,38 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_LCACHE_H -#define ECMA_LCACHE_H - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmalcache Property lookup cache - * @{ - */ - -#if ENABLED (JERRY_LCACHE) -void ecma_lcache_insert (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p); -ecma_property_t *ecma_lcache_lookup (const ecma_object_t *object_p, const ecma_string_t *prop_name_p); -void ecma_lcache_invalidate (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p); - -#endif /* ENABLED (JERRY_LCACHE) */ - -/** - * @} - * @} - */ - -#endif /* !ECMA_LCACHE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-lex-env.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-lex-env.h deleted file mode 100755 index 7ff5c98b9..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-lex-env.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_LEX_ENV_H -#define ECMA_LEX_ENV_H - -#include "ecma-globals.h" -#include "ecma-reference.h" -#include "jrt.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup lexicalenvironment Lexical environment - * @{ - * - * \addtogroup globallexicalenvironment Global lexical environment - * @{ - */ - -void ecma_init_global_lex_env (void); -void ecma_finalize_global_lex_env (void); -ecma_object_t *ecma_get_global_environment (void); - -#if ENABLED (JERRY_ES2015_MODULE_SYSTEM) -void ecma_module_add_lex_env (ecma_object_t *lex_env_p); -void ecma_module_finalize_lex_envs (void); -#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ - -/** - * @} - */ - -/* ECMA-262 v5, 8.7.1 and 8.7.2 */ -ecma_value_t ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, ecma_object_t **ref_base_lex_env_p, - ecma_string_t *name_p); -ecma_value_t ecma_op_get_value_object_base (ecma_value_t base_value, ecma_string_t *property_name_p); -ecma_value_t ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, ecma_string_t *var_name_string_p, - bool is_strict, ecma_value_t value); - -/* ECMA-262 v5, Table 17. Abstract methods of Environment Records */ -bool ecma_op_has_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p); -ecma_value_t ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, bool is_deletable); -ecma_value_t ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value, - bool is_strict); -ecma_value_t ecma_op_get_binding_value (ecma_object_t *lex_env_p, ecma_string_t *name_p, bool is_strict); -ecma_value_t ecma_op_delete_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p); -ecma_value_t ecma_op_implicit_this_value (ecma_object_t *lex_env_p); - -/* ECMA-262 v5, Table 18. Additional methods of Declarative Environment Records */ -void ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value); - -/** - * @} - * @} - */ - -#endif /* !ECMA_LEX_ENV_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-literal-storage.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-literal-storage.h deleted file mode 100755 index debbcc50a..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-literal-storage.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_LIT_STORAGE_H -#define ECMA_LIT_STORAGE_H - -#include "ecma-globals.h" -#include "jmem.h" -#include "lit-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmalitstorage Literal storage - * @{ - */ - -#if ENABLED (JERRY_SNAPSHOT_SAVE) -/** - * Snapshot literal - offset map - */ -typedef struct -{ - ecma_value_t literal_id; /**< literal id */ - ecma_value_t literal_offset; /**< literal offset */ -} lit_mem_to_snapshot_id_map_entry_t; -#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */ - -void ecma_finalize_lit_storage (void); - -ecma_value_t ecma_find_or_create_literal_string (const lit_utf8_byte_t *chars_p, lit_utf8_size_t size); -ecma_value_t ecma_find_or_create_literal_number (ecma_number_t number_arg); - -#if ENABLED (JERRY_SNAPSHOT_SAVE) -void ecma_save_literals_append_value (ecma_value_t value, ecma_collection_t *lit_pool_p); -void ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, - ecma_collection_t *lit_pool_p); -bool ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, uint32_t *buffer_p, size_t buffer_size, - size_t *in_out_buffer_offset_p, lit_mem_to_snapshot_id_map_entry_t **out_map_p, - uint32_t *out_map_len_p); -#endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */ - -#if ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE) -ecma_value_t -ecma_snapshot_get_literal (const uint8_t *literal_base_p, ecma_value_t literal_value); -#endif /* ENABLED (JERRY_SNAPSHOT_EXEC) || ENABLED (JERRY_SNAPSHOT_SAVE) */ - -/** - * @} - * @} - */ - -#endif /* !ECMA_LIT_STORAGE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-module.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-module.h deleted file mode 100755 index 290b4d5c3..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-module.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_MODULE_H -#define ECMA_MODULE_H - -#if ENABLED (JERRY_ES2015_MODULE_SYSTEM) - -#include "common.h" -#include "ecma-globals.h" - -#define ECMA_MODULE_MAX_PATH 255u - -/** - * Imported or exported names, such as "a as b" - * Note: See https://www.ecma-international.org/ecma-262/6.0/#table-39 - * and https://www.ecma-international.org/ecma-262/6.0/#table-41 - */ -typedef struct ecma_module_names -{ - struct ecma_module_names *next_p; /**< next linked list node */ - ecma_string_t *imex_name_p; /**< Import/export name of the item */ - ecma_string_t *local_name_p; /**< Local name of the item */ -} ecma_module_names_t; - -typedef struct ecma_module ecma_module_t; - -/** - * Module node to store imports / exports. - */ -typedef struct ecma_module_node -{ - struct ecma_module_node *next_p; /**< next linked list node */ - ecma_module_names_t *module_names_p; /**< names of the requested import/export node */ - ecma_module_t *module_request_p; /**< module structure of the requested module */ -} ecma_module_node_t; - -/** - * Module context containing all import and export nodes. - */ -typedef struct ecma_module_context -{ - struct ecma_module_context *parent_p; /**< parent context */ - ecma_module_node_t *imports_p; /**< import item of the current context */ - ecma_module_node_t *local_exports_p; /**< export item of the current context */ - ecma_module_node_t *indirect_exports_p; /**< export item of the current context */ - ecma_module_node_t *star_exports_p; /**< export item of the current context */ - ecma_module_t *module_p; /**< module request */ -} ecma_module_context_t; - -/** - * An enum identifing the current state of the module - */ -typedef enum -{ - ECMA_MODULE_STATE_INIT = 0, /**< module is initialized */ - ECMA_MODULE_STATE_PARSING = 1, /**< module is currently being parsed */ - ECMA_MODULE_STATE_PARSED = 2, /**< module has been parsed */ - ECMA_MODULE_STATE_EVALUATING = 3, /**< module is currently being evaluated */ - ECMA_MODULE_STATE_EVALUATED = 4, /**< module has been evaluated */ - ECMA_MODULE_STATE_NATIVE = 5, /**< module is native */ -} ecma_module_state_t; - -/** - * Module structure storing an instance of a module - */ -struct ecma_module -{ - struct ecma_module *next_p; /**< next linked list node */ - ecma_module_state_t state; /**< state of the mode */ - ecma_string_t *path_p; /**< path of the module */ - ecma_module_context_t *context_p; /**< module context of the module */ - ecma_compiled_code_t *compiled_code_p; /**< compiled code of the module */ - ecma_object_t *scope_p; /**< lexica lenvironment of the module */ - ecma_object_t *namespace_object_p; /**< namespace import object of the module */ -}; - -/** - * A record that can be used to store {module, identifier} pairs - */ -typedef struct ecma_module_record -{ - ecma_module_t *module_p; /**< module */ - ecma_string_t *name_p; /**< identifier name */ -} ecma_module_record_t; - -/** - * A list of module records that can be used to identify circular imports during resolution - */ -typedef struct ecma_module_resolve_set -{ - struct ecma_module_resolve_set *next_p; /**< next in linked list */ - ecma_module_record_t record; /**< module record */ -} ecma_module_resolve_set_t; - -/** - * A list that is used like a stack to drive the resolution process, instead of recursion. - */ -typedef struct ecma_module_resolve_stack -{ - struct ecma_module_resolve_stack *next_p; /**< next in linked list */ - ecma_module_t *module_p; /**< module request */ - ecma_string_t *export_name_p; /**< export identifier name */ - bool resolving; /**< flag storing wether the current frame started resolving */ -} ecma_module_resolve_stack_t; - -bool ecma_module_resolve_set_insert (ecma_module_resolve_set_t **set_p, - ecma_module_t *const module_p, - ecma_string_t *const export_name_p); -void ecma_module_resolve_set_cleanup (ecma_module_resolve_set_t *set_p); - -void ecma_module_resolve_stack_push (ecma_module_resolve_stack_t **stack_p, - ecma_module_t *const module_p, - ecma_string_t *const export_name_p); -void ecma_module_resolve_stack_pop (ecma_module_resolve_stack_t **stack_p); - -ecma_string_t *ecma_module_create_normalized_path (const uint8_t *char_p, - prop_length_t size); -ecma_module_t *ecma_module_find_module (ecma_string_t *const path_p); -ecma_module_t *ecma_module_create_native_module (ecma_string_t *const path_p, - ecma_object_t *const namespace_p); -ecma_module_t *ecma_module_find_or_create_module (ecma_string_t *const path_p); - -ecma_value_t ecma_module_connect_imports (void); -ecma_value_t ecma_module_parse_modules (void); -ecma_value_t ecma_module_check_indirect_exports (void); - -void ecma_module_release_module_nodes (ecma_module_node_t *module_node_p); -void ecma_module_cleanup (void); -#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ - -#endif /* !ECMA_MODULE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-number-arithmetic.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-number-arithmetic.h deleted file mode 100755 index 2d9d00ac2..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-number-arithmetic.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_NUMBER_ARITHMETIC_H -#define ECMA_NUMBER_ARITHMETIC_H - -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup numberarithmetic ECMA number arithmetic operations - * @{ - */ - -ecma_number_t ecma_op_number_remainder (ecma_number_t left_num, ecma_number_t right_num); - -/** - * @} - * @} - */ - -#endif /* !ECMA_NUMBER_ARITHMETIC_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-number-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-number-object.h deleted file mode 100755 index c4baf75f1..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-number-object.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_NUMBER_OBJECT_H -#define ECMA_NUMBER_OBJECT_H - -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmanumberobject ECMA Number object related routines - * @{ - */ - -ecma_value_t ecma_op_create_number_object (ecma_value_t arg); - -/** - * @} - * @} - */ - -#endif /* !ECMA_NUMBER_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-objects-arguments.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-objects-arguments.h deleted file mode 100755 index 8f7a0dc17..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-objects-arguments.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_OBJECTS_ARGUMENTS_H -#define ECMA_OBJECTS_ARGUMENTS_H - -#include "ecma-globals.h" -#include "ecma-helpers.h" - -void -ecma_op_create_arguments_object (ecma_object_t *func_obj_p, ecma_object_t *lex_env_p, - const ecma_value_t *arguments_list_p, ecma_length_t arguments_number, - const ecma_compiled_code_t *bytecode_data_p); - -ecma_value_t -ecma_op_arguments_object_delete (ecma_object_t *object_p, ecma_string_t *property_name_p, bool is_throw); -ecma_value_t -ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p, - const ecma_property_descriptor_t *property_desc_p); - -#endif /* !ECMA_OBJECTS_ARGUMENTS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-objects-general.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-objects-general.h deleted file mode 100755 index 74c1f3a4e..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-objects-general.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_OBJECTS_GENERAL_H -#define ECMA_OBJECTS_GENERAL_H - -#include "ecma-conversion.h" -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmaobjectsinternalops ECMA objects' operations - * @{ - */ - -ecma_value_t ecma_reject (bool is_throw); -ecma_object_t *ecma_op_create_object_object_noarg (void); -ecma_value_t ecma_op_create_object_object_arg (ecma_value_t value); -ecma_object_t *ecma_op_create_object_object_noarg_and_set_prototype (ecma_object_t *object_prototype_p); - -ecma_value_t ecma_op_general_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw); -ecma_value_t ecma_op_general_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint); -ecma_value_t ecma_op_general_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p, - const ecma_property_descriptor_t *property_desc_p); - -/** - * @} - * @} - */ - -#endif /* !ECMA_OBJECTS_GENERAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-objects.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-objects.h deleted file mode 100755 index c416ed2bd..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-objects.h +++ /dev/null @@ -1,70 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_OBJECTS_H -#define ECMA_OBJECTS_H - -#include "ecma-conversion.h" -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmaobjectsinternalops ECMA objects' operations - * @{ - */ - -ecma_property_t ecma_op_object_get_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p, - ecma_property_ref_t *property_ref_p, uint32_t options); -bool ecma_op_object_has_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p); -bool ecma_op_object_has_property (ecma_object_t *object_p, ecma_string_t *property_name_p); -ecma_value_t ecma_op_object_find_own (ecma_value_t base_value, ecma_object_t *object_p, ecma_string_t *property_name_p); -ecma_value_t ecma_op_object_find (ecma_object_t *object_p, ecma_string_t *property_name_p); -ecma_value_t ecma_op_object_find_by_uint32_index (ecma_object_t *object_p, uint32_t index); -ecma_value_t ecma_op_object_find_by_number_index (ecma_object_t *object_p, ecma_number_t index); -ecma_value_t ecma_op_object_get_own_data_prop (ecma_object_t *object_p, ecma_string_t *property_name_p); -ecma_value_t ecma_op_object_get (ecma_object_t *object_p, ecma_string_t *property_name_p); -ecma_value_t ecma_op_object_get_by_magic_id (ecma_object_t *object_p, lit_magic_string_id_t property_id); -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -ecma_value_t ecma_op_object_get_by_symbol_id (ecma_object_t *object_p, lit_magic_string_id_t property_id); -ecma_value_t ecma_op_get_method_by_symbol_id (ecma_value_t value, lit_magic_string_id_t property_id); -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -ecma_value_t ecma_op_object_put (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t value, - bool is_throw); -ecma_value_t ecma_op_object_put_by_uint32_index (ecma_object_t *object_p, uint32_t index, - ecma_value_t value, bool is_throw); -ecma_value_t ecma_op_object_put_by_number_index (ecma_object_t *object_p, ecma_number_t index, - ecma_value_t value, bool is_throw); -ecma_value_t ecma_op_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw); -ecma_value_t ecma_op_object_delete_by_uint32_index (ecma_object_t *obj_p, uint32_t index, bool is_throw); -ecma_value_t ecma_op_object_delete_by_number_index (ecma_object_t *obj_p, ecma_number_t index, bool is_throw); -ecma_value_t ecma_op_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint); -ecma_value_t ecma_op_object_define_own_property (ecma_object_t *obj_p, ecma_string_t *property_name_p, - const ecma_property_descriptor_t *property_desc_p); -bool ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, ecma_string_t *property_name_p, - ecma_property_descriptor_t *prop_desc_p); -ecma_value_t ecma_op_object_has_instance (ecma_object_t *obj_p, ecma_value_t value); -bool ecma_op_object_is_prototype_of (ecma_object_t *base_p, ecma_object_t *target_p); -ecma_collection_t * ecma_op_object_get_property_names (ecma_object_t *obj_p, uint32_t opts); - -lit_magic_string_id_t ecma_object_get_class_name (ecma_object_t *obj_p); -bool ecma_object_class_is (ecma_object_t *object_p, uint32_t class_id); - -/** - * @} - * @} - */ - -#endif /* !ECMA_OBJECTS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-promise-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-promise-object.h deleted file mode 100755 index 2e71b6225..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-promise-object.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_PROMISE_OBJECT_H -#define ECMA_PROMISE_OBJECT_H - -#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmaarraybufferobject ECMA ArrayBuffer object related routines - * @{ - */ - -/** - * The PromiseState of promise object. - */ -typedef enum -{ - ECMA_PROMISE_STATE_PENDING, /**< pending state */ - ECMA_PROMISE_STATE_FULFILLED, /**< fulfilled state */ - ECMA_PROMISE_STATE_REJECTED, /** rejected state */ - ECMA_PROMISE_STATE__COUNT /**< number of states */ -} ecma_promise_state_t; - -/** - * Indicates the type of the executor in promise construct. - */ -typedef enum -{ - ECMA_PROMISE_EXECUTOR_FUNCTION, /**< the executor is a function, it is for the usual constructor */ - ECMA_PROMISE_EXECUTOR_OBJECT, /**< the executor is an object, it is for the `then` routine */ - ECMA_PROMISE_EXECUTOR_EMPTY /**< the executor is empty, it is for external C API */ -} ecma_promise_executor_type_t; - -/** - * Description of the promise resolving functions. - */ -typedef struct -{ - ecma_value_t resolve; /**< the resolve function */ - ecma_value_t reject; /**< the reject function */ -} ecma_promise_resolving_functions_t; - -/** - * Description of the promise object. - * It need more space than normal object to store builtin properties. - */ -typedef struct -{ - ecma_extended_object_t ecma_extended_object_t; /**< extended object part */ - uint8_t state; /**< promise state, see ecma_promise_state_t */ - ecma_collection_t *fulfill_reactions; /**< list of PromiseFullfillReactions */ - ecma_collection_t *reject_reactions; /**< list of PromiseRejectReactions */ -} ecma_promise_object_t; - -bool ecma_is_promise (ecma_object_t *obj_p); -ecma_value_t -ecma_op_create_promise_object (ecma_value_t executor, ecma_promise_executor_type_t type); -ecma_value_t ecma_promise_new_capability (void); -ecma_value_t -ecma_promise_then (ecma_value_t promise, - ecma_value_t on_fulfilled, - ecma_value_t on_rejected); -ecma_promise_resolving_functions_t * -ecma_promise_create_resolving_functions (ecma_object_t *object_p); -void ecma_promise_free_resolving_functions (ecma_promise_resolving_functions_t *funcs); - -/** - * @} - * @} - */ - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */ -#endif /* !ECMA_PROMISE_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-property-hashmap.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-property-hashmap.h deleted file mode 100755 index 13b417468..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-property-hashmap.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_PROPERTY_HASHMAP_H -#define ECMA_PROPERTY_HASHMAP_H - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmapropertyhashmap Property hashmap - * @{ - */ - -/** - * Recommended minimum number of items in a property cache. - */ -#define ECMA_PROPERTY_HASMAP_MINIMUM_SIZE 32 - -/** - * Property hash. - */ -typedef struct -{ - ecma_property_header_t header; /**< header of the property */ - uint32_t max_property_count; /**< maximum property count (power of 2) */ - uint32_t null_count; /**< number of NULLs in the map */ - uint32_t unused_count; /**< number of unused entires in the map */ - - /* - * The hash is followed by max_property_count ecma_cpointer_t - * compressed pointers and (max_property_count + 7) / 8 bytes - * which stores a flag for each compressed pointer. - * - * If the compressed pointer is equal to ECMA_NULL_POINTER - * - flag is cleared if the entry is NULL - * - flag is set if the entry is deleted - * - * If the compressed pointer is not equal to ECMA_NULL_POINTER - * - flag is cleared if the first entry of a property pair is referenced - * - flag is set if the second entry of a property pair is referenced - */ -} ecma_property_hashmap_t; - -#if ENABLED (JERRY_PROPRETY_HASHMAP) - -/** - * Simple ecma values - */ -typedef enum -{ - ECMA_PROPERTY_HASHMAP_DELETE_NO_HASHMAP, /**< object has no hashmap */ - ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP, /**< object has hashmap */ - ECMA_PROPERTY_HASHMAP_DELETE_RECREATE_HASHMAP, /**< hashmap should be recreated */ -} ecma_property_hashmap_delete_status; - -void ecma_property_hashmap_create (ecma_object_t *object_p); -void ecma_property_hashmap_free (ecma_object_t *object_p); -void ecma_property_hashmap_insert (ecma_object_t *object_p, ecma_string_t *name_p, - ecma_property_pair_t *property_pair_p, int property_index); -ecma_property_hashmap_delete_status ecma_property_hashmap_delete (ecma_object_t *object_p, jmem_cpointer_t name_cp, - ecma_property_t *property_p); - - -ecma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, ecma_string_t *name_p, - jmem_cpointer_t *property_real_name_cp); -#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */ - -/** - * @} - * @} - */ - -#endif /* !ECMA_PROPERTY_HASHMAP_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-reference.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-reference.h deleted file mode 100755 index 37409edb5..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-reference.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_REFERENCE_H -#define ECMA_REFERENCE_H - -#include "ecma-globals.h" -#include "jrt.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup references ECMA-Reference - * @{ - */ - -ecma_object_t *ecma_op_resolve_reference_base (ecma_object_t *lex_env_p, ecma_string_t *name_p); -ecma_value_t ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, ecma_string_t *name_p); -#if ENABLED (JERRY_ES2015_CLASS) -ecma_object_t *ecma_op_resolve_super_reference_value (ecma_object_t *lex_env_p); -#endif /* ENABLED (JERRY_ES2015_CLASS) */ - -/** - * @} - * @} - */ - -#endif /* !ECMA_REFERENCE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-regexp-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-regexp-object.h deleted file mode 100755 index 1b1c6e547..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-regexp-object.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_REGEXP_OBJECT_H -#define ECMA_REGEXP_OBJECT_H - -#if ENABLED (JERRY_BUILTIN_REGEXP) - -#include "ecma-globals.h" -#include "re-compiler.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmaregexpobject ECMA RegExp object related routines - * @{ - */ - -/** - * RegExp flags - * Note: - * This enum has to be kept in sync with jerry_regexp_flags_t. - */ -typedef enum -{ - RE_FLAG_EMPTY = 0u, /* Empty RegExp flags */ - RE_FLAG_GLOBAL = (1u << 1), /**< ECMA-262 v5, 15.10.7.2 */ - RE_FLAG_IGNORE_CASE = (1u << 2), /**< ECMA-262 v5, 15.10.7.3 */ - RE_FLAG_MULTILINE = (1u << 3) /**< ECMA-262 v5, 15.10.7.4 */ -} ecma_regexp_flags_t; - -/** - * Structure for storing capturing group results - */ -typedef struct -{ - const lit_utf8_byte_t *begin_p; /**< substring start pointer */ - const lit_utf8_byte_t *end_p; /**< substring end pointer */ -} ecma_regexp_capture_t; - -/** - * Structure for storing non-capturing group results - */ -typedef struct -{ - const lit_utf8_byte_t *str_p; /**< string pointer */ -} ecma_regexp_non_capture_t; - -#if (JERRY_STACK_LIMIT != 0) -/** - * Value used ase result when stack limit is reached - */ -#define ECMA_RE_OUT_OF_STACK ((const lit_utf8_byte_t *) UINTPTR_MAX) - -/** - * Checks if the stack limit has been reached during regexp matching - */ -#define ECMA_RE_STACK_LIMIT_REACHED(p) (JERRY_UNLIKELY (p == ECMA_RE_OUT_OF_STACK)) -#else /* JERRY_STACK_LIMIT == 0 */ -#define ECMA_RE_STACK_LIMIT_REACHED(p) (false) -#endif /* JERRY_STACK_LIMIT != 0 */ - -/** - * RegExp executor context - */ -typedef struct -{ - const lit_utf8_byte_t *input_end_p; /**< end of input string */ - const lit_utf8_byte_t *input_start_p; /**< start of input string */ - uint32_t captures_count; /**< number of capture groups */ - ecma_regexp_capture_t *captures_p; /**< capturing groups */ - uint32_t non_captures_count; /**< number of non-capture groups */ - ecma_regexp_non_capture_t *non_captures_p; /**< non-capturing groups */ - uint32_t *iterations_p; /**< number of iterations */ - uint16_t flags; /**< RegExp flags */ -} ecma_regexp_ctx_t; - -ecma_value_t ecma_op_create_regexp_object_from_bytecode (re_compiled_code_t *bytecode_p); -ecma_value_t ecma_op_create_regexp_object (ecma_string_t *pattern_p, uint16_t flags); -ecma_value_t ecma_regexp_exec_helper (ecma_value_t regexp_value, ecma_value_t input_string, bool ignore_global); -ecma_value_t ecma_regexp_read_pattern_str_helper (ecma_value_t pattern_arg, ecma_string_t **pattern_string_p); -ecma_char_t ecma_regexp_canonicalize (ecma_char_t ch, bool is_ignorecase); -ecma_char_t ecma_regexp_canonicalize_char (ecma_char_t ch); -ecma_value_t ecma_regexp_parse_flags (ecma_string_t *flags_str_p, uint16_t *flags_p); -void ecma_regexp_initialize_props (ecma_object_t *re_obj_p, ecma_string_t *source_p, uint16_t flags); - -/** - * @} - * @} - */ - -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ -#endif /* !ECMA_REGEXP_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-string-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-string-object.h deleted file mode 100755 index b1c4b7ad9..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-string-object.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_STRING_OBJECT_H -#define ECMA_STRING_OBJECT_H - -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmastringobject ECMA String object related routines - * @{ - */ - -ecma_value_t -ecma_op_create_string_object (const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len); - -void -ecma_op_string_list_lazy_property_names (ecma_object_t *obj_p, - bool separate_enumerable, - ecma_collection_t *main_collection_p, - ecma_collection_t *non_enum_collection_p); - - -/** - * @} - * @} - */ - -#endif /* !ECMA_STRING_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-symbol-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-symbol-object.h deleted file mode 100755 index b5721da38..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-symbol-object.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_SYMBOL_H -#define ECMA_SYMBOL_H - -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) -#include "ecma-globals.h" - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmasymbolobject ECMA Symbol object related routines - * @{ - */ - -ecma_value_t -ecma_op_create_symbol (const ecma_value_t *arguments_list_p, ecma_length_t arguments_list_len); - -ecma_value_t -ecma_op_create_symbol_object (const ecma_value_t value); - -bool -ecma_prop_name_is_symbol (ecma_string_t *string_p); - -ecma_string_t * -ecma_get_symbol_description (ecma_string_t *symbol_p); - -ecma_value_t -ecma_symbol_to_string_helper (ecma_value_t this_arg, bool is_to_string); - -ecma_value_t -ecma_get_symbol_descriptive_string (ecma_value_t symbol_value); - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ -/** - * @} - * @} - */ - -#endif /* !ECMA_SYMBOL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-try-catch-macro.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-try-catch-macro.h deleted file mode 100755 index 8d01ac089..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-try-catch-macro.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_TRY_CATCH_MACRO_H -#define ECMA_TRY_CATCH_MACRO_H - -#include "ecma-helpers.h" - -/** - * The macro defines try-block that initializes variable 'var' with 'op' - * and checks for exceptions that might be thrown during initialization. - * - * If no exception was thrown, then code after the try-block is executed. - * Otherwise, throw-completion value is just copied to return_value. - * - * Note: - * Each ECMA_TRY_CATCH should have it's own corresponding ECMA_FINALIZE - * statement with same argument as corresponding ECMA_TRY_CATCH's first argument. - */ -#define ECMA_TRY_CATCH(var, op, return_value) \ - JERRY_ASSERT (return_value == ECMA_VALUE_EMPTY); \ - ecma_value_t var ## _completion = op; \ - if (ECMA_IS_VALUE_ERROR (var ## _completion)) \ - { \ - return_value = var ## _completion; \ - } \ - else \ - { \ - ecma_value_t var = var ## _completion; \ - JERRY_UNUSED (var); - -/** - * The macro marks end of code block that is defined by corresponding - * ECMA_TRY_CATCH and frees variable, initialized by the ECMA_TRY_CATCH. - * - * Note: - * Each ECMA_TRY_CATCH should be followed by ECMA_FINALIZE with same argument - * as corresponding ECMA_TRY_CATCH's first argument. - */ -#define ECMA_FINALIZE(var) \ - ecma_free_value (var ## _completion); \ - } - -/** - * The macro defines try-block that tries to perform ToNumber operation on given value - * and checks for exceptions that might be thrown during the operation. - * - * If no exception was thrown, then code after the try-block is executed. - * Otherwise, throw-completion value is just copied to return_value. - * - * Note: - * Each ECMA_OP_TO_NUMBER_TRY_CATCH should have it's own corresponding ECMA_OP_TO_NUMBER_FINALIZE - * statement with same argument as corresponding ECMA_OP_TO_NUMBER_TRY_CATCH's first argument. - */ -#define ECMA_OP_TO_NUMBER_TRY_CATCH(num_var, value, return_value) \ - JERRY_ASSERT (return_value == ECMA_VALUE_EMPTY); \ - ecma_number_t num_var; \ - return_value = ecma_get_number (value, &num_var); \ - \ - if (JERRY_LIKELY (ecma_is_value_empty (return_value))) \ - { - -/** - * The macro marks end of code block that is defined by corresponding ECMA_OP_TO_NUMBER_TRY_CATCH. - * - * Note: - * Each ECMA_OP_TO_NUMBER_TRY_CATCH should be followed by ECMA_OP_TO_NUMBER_FINALIZE - * with same argument as corresponding ECMA_OP_TO_NUMBER_TRY_CATCH's first argument. - */ -#define ECMA_OP_TO_NUMBER_FINALIZE(num_var) } - -#endif /* !ECMA_TRY_CATCH_MACRO_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-typedarray-object.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-typedarray-object.h deleted file mode 100755 index 3171891a0..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/ecma-typedarray-object.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMA_TYPEDARRAY_OBJECT_H -#define ECMA_TYPEDARRAY_OBJECT_H - -#include "ecma-globals.h" -#include "ecma-builtins.h" - -#if ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) - -/** \addtogroup ecma ECMA - * @{ - * - * \addtogroup ecmatypedarrayobject ECMA TypedArray object related routines - * @{ - */ - -uint8_t ecma_typedarray_helper_get_shift_size (ecma_typedarray_type_t typedarray_id); -ecma_typedarray_getter_fn_t ecma_get_typedarray_getter_fn (ecma_typedarray_type_t typedarray_id); -ecma_typedarray_setter_fn_t ecma_get_typedarray_setter_fn (ecma_typedarray_type_t typedarray_id); -ecma_number_t ecma_get_typedarray_element (lit_utf8_byte_t *src_p, - ecma_typedarray_type_t typedarray_id); -void ecma_set_typedarray_element (lit_utf8_byte_t *dst_p, - ecma_number_t value, - ecma_typedarray_type_t typedarray_id); -bool ecma_typedarray_helper_is_typedarray (ecma_builtin_id_t builtin_id); -ecma_typedarray_type_t ecma_get_typedarray_id (ecma_object_t *obj_p); -ecma_builtin_id_t ecma_typedarray_helper_get_prototype_id (ecma_typedarray_type_t typedarray_id); -ecma_typedarray_type_t ecma_typedarray_helper_builtin_to_typedarray_id (ecma_builtin_id_t builtin_id); - -ecma_value_t ecma_op_typedarray_from (ecma_value_t items_val, - ecma_value_t map_fn_val, - ecma_value_t this_val, - ecma_object_t *proto_p, - uint8_t element_size_shift, - ecma_typedarray_type_t typedarray_id); -ecma_length_t ecma_typedarray_get_length (ecma_object_t *typedarray_p); -ecma_length_t ecma_typedarray_get_offset (ecma_object_t *typedarray_p); -lit_utf8_byte_t *ecma_typedarray_get_buffer (ecma_object_t *typedarray_p); -uint8_t ecma_typedarray_get_element_size_shift (ecma_object_t *typedarray_p); -ecma_object_t *ecma_typedarray_get_arraybuffer (ecma_object_t *typedarray_p); -ecma_value_t ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, - ecma_length_t arguments_list_len, - ecma_object_t *proto_p, - uint8_t element_size_shift, - ecma_typedarray_type_t typedarray_id); -bool ecma_is_typedarray (ecma_value_t target); -void ecma_op_typedarray_list_lazy_property_names (ecma_object_t *obj_p, - ecma_collection_t *main_collection_p); -bool ecma_op_typedarray_define_index_prop (ecma_object_t *obj_p, - uint32_t index, - const ecma_property_descriptor_t *property_desc_p); -ecma_value_t ecma_op_create_typedarray_with_type_and_length (ecma_object_t *obj_p, - ecma_length_t array_length); -ecma_typedarray_info_t ecma_typedarray_get_info (ecma_object_t *typedarray_p); -ecma_value_t ecma_typedarray_create_object_with_length (ecma_length_t array_length, - ecma_object_t *proto_p, - uint8_t element_size_shift, - ecma_typedarray_type_t typedarray_id); - -/** - * @} - * @} - */ - -#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */ -#endif /* !ECMA_TYPEDARRAY_OBJECT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jcontext.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jcontext.h deleted file mode 100755 index 0f779fafa..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jcontext.h +++ /dev/null @@ -1,298 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Engine context for JerryScript - */ -#ifndef JCONTEXT_H -#define JCONTEXT_H - -#include "debugger.h" -#include "ecma-builtins.h" -#include "ecma-jobqueue.h" -#include "jerryscript-port.h" -#include "jmem.h" -#include "re-bytecode.h" -#include "vm-defines.h" -#include "jerryscript.h" -#include "jerryscript-debugger-transport.h" -#include "js-parser-internal.h" - -/** \addtogroup context Context - * @{ - */ - -/** - * Advanced allocator configurations. - */ -/** - * Maximum global heap size in bytes - */ -#define CONFIG_MEM_HEAP_SIZE (JERRY_GLOBAL_HEAP_SIZE * 1024) - -/** - * Maximum stack usage size in bytes - */ -#define CONFIG_MEM_STACK_LIMIT (JERRY_STACK_LIMIT * 1024) - -/** - * Max heap usage limit - */ -#define CONFIG_MAX_GC_LIMIT 8192 - -/** - * Allowed heap usage limit until next garbage collection - * - * Whenever the total allocated memory size reaches the current heap limit, garbage collection will be triggered - * to try and reduce clutter from unreachable objects. If the allocated memory can't be reduced below the limit, - * then the current limit will be incremented by CONFIG_MEM_HEAP_LIMIT. - */ -#if defined (JERRY_GC_LIMIT) && (JERRY_GC_LIMIT != 0) -#define CONFIG_GC_LIMIT JERRY_GC_LIMIT -#else -#define CONFIG_GC_LIMIT (JERRY_MIN (CONFIG_MEM_HEAP_SIZE / 32, CONFIG_MAX_GC_LIMIT)) -#endif - -/** - * Amount of newly allocated objects since the last GC run, represented as a fraction of all allocated objects, - * which when reached will trigger garbage collection to run with a low pressure setting. - * - * The fraction is calculated as: - * 1.0 / CONFIG_ECMA_GC_NEW_OBJECTS_FRACTION - */ -#define CONFIG_ECMA_GC_NEW_OBJECTS_FRACTION (16) - -#if !ENABLED (JERRY_SYSTEM_ALLOCATOR) -/** - * Heap structure - * - * Memory blocks returned by the allocator must not start from the - * beginning of the heap area because offset 0 is reserved for - * JMEM_CP_NULL. This special constant is used in several places, - * e.g. it marks the end of the property chain list, so it cannot - * be eliminated from the project. Although the allocator cannot - * use the first 8 bytes of the heap, nothing prevents to use it - * for other purposes. Currently the free region start is stored - * there. - */ -typedef struct jmem_heap_t jmem_heap_t; -#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */ - -/** - * User context item - */ -typedef struct jerry_context_data_header -{ - struct jerry_context_data_header *next_p; /**< pointer to next context item */ - const jerry_context_data_manager_t *manager_p; /**< manager responsible for deleting this item */ -} jerry_context_data_header_t; - -#define JERRY_CONTEXT_DATA_HEADER_USER_DATA(item_p) \ - ((uint8_t *) (item_p + 1)) - -/** - * First non-external member of the jerry context - */ -#define JERRY_CONTEXT_FIRST_MEMBER ecma_builtin_objects - -/** - * JerryScript context - * - * The purpose of this header is storing - * all global variables for Jerry - */ -struct jerry_context_t -{ - /* The value of external context members must be preserved across initializations and cleanups. */ -#if ENABLED (JERRY_EXTERNAL_CONTEXT) -#if !ENABLED (JERRY_SYSTEM_ALLOCATOR) - jmem_heap_t *heap_p; /**< point to the heap aligned to JMEM_ALIGNMENT. */ - uint32_t heap_size; /**< size of the heap */ -#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */ -#endif /* ENABLED (JERRY_EXTERNAL_CONTEXT) */ - - /* Update JERRY_CONTEXT_FIRST_MEMBER if the first non-external member changes */ - jmem_cpointer_t ecma_builtin_objects[ECMA_BUILTIN_ID__COUNT]; /**< pointer to instances of built-in objects */ -#if ENABLED (JERRY_BUILTIN_REGEXP) - const re_compiled_code_t *re_cache[RE_CACHE_SIZE]; /**< regex cache */ -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ - jmem_cpointer_t ecma_gc_objects_cp; /**< List of currently alive objects. */ - jmem_heap_free_t *jmem_heap_list_skip_p; /**< This is used to speed up deallocation. */ - jmem_pools_chunk_t *jmem_free_8_byte_chunk_p; /**< list of free eight byte pool chunks */ -#if ENABLED (JERRY_CPOINTER_32_BIT) - jmem_pools_chunk_t *jmem_free_16_byte_chunk_p; /**< list of free sixteen byte pool chunks */ -#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */ - const lit_utf8_byte_t * const *lit_magic_string_ex_array; /**< array of external magic strings */ - const lit_utf8_size_t *lit_magic_string_ex_sizes; /**< external magic string lengths */ - jmem_cpointer_t string_list_first_cp; /**< first item of the literal string list */ -#if ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) - jmem_cpointer_t symbol_list_first_cp; /**< first item of the global symbol list */ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_SYMBOL) */ - jmem_cpointer_t number_list_first_cp; /**< first item of the literal number list */ - jmem_cpointer_t ecma_global_lex_env_cp; /**< global lexical environment */ - -#if ENABLED (JERRY_ES2015_MODULE_SYSTEM) - ecma_module_t *ecma_modules_p; /**< list of referenced modules */ - ecma_module_context_t *module_top_context_p; /**< top (current) module parser context */ -#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ - - vm_frame_ctx_t *vm_top_context_p; /**< top (current) interpreter context */ - jerry_context_data_header_t *context_data_p; /**< linked list of user-provided context-specific pointers */ - size_t ecma_gc_objects_number; /**< number of currently allocated objects */ - size_t ecma_gc_new_objects; /**< number of newly allocated objects since last GC session */ - size_t jmem_heap_allocated_size; /**< size of allocated regions */ - size_t jmem_heap_limit; /**< current limit of heap usage, that is upon being reached, - * causes call of "try give memory back" callbacks */ - ecma_value_t error_value; /**< currently thrown error value */ - uint32_t lit_magic_string_ex_count; /**< external magic strings count */ - uint32_t jerry_init_flags; /**< run-time configuration flags */ - uint32_t status_flags; /**< run-time flags (the top 8 bits are used for passing class parsing options) */ - -#if ENABLED (JERRY_PROPRETY_HASHMAP) - uint8_t ecma_prop_hashmap_alloc_state; /**< property hashmap allocation state: 0-4, - * if !0 property hashmap allocation is disabled */ -#endif /* ENABLED (JERRY_PROPRETY_HASHMAP) */ - -#if ENABLED (JERRY_BUILTIN_REGEXP) - uint8_t re_cache_idx; /**< evicted item index when regex cache is full (round-robin) */ -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ - -#if ENABLED (JERRY_ES2015_BUILTIN_PROMISE) - ecma_job_queueitem_t *job_queue_head_p; /**< points to the head item of the jobqueue */ - ecma_job_queueitem_t *job_queue_tail_p; /**< points to the tail item of the jobqueue*/ -#endif /* ENABLED (JERRY_ES2015_BUILTIN_PROMISE) */ - -#if ENABLED (JERRY_VM_EXEC_STOP) - uint32_t vm_exec_stop_frequency; /**< reset value for vm_exec_stop_counter */ - uint32_t vm_exec_stop_counter; /**< down counter for reducing the calls of vm_exec_stop_cb */ - void *vm_exec_stop_user_p; /**< user pointer for vm_exec_stop_cb */ - ecma_vm_exec_stop_callback_t vm_exec_stop_cb; /**< user function which returns whether the - * ECMAScript execution should be stopped */ -#endif /* ENABLED (JERRY_VM_EXEC_STOP) */ - -#if (JERRY_STACK_LIMIT != 0) - uintptr_t stack_base; /**< stack base marker */ -#endif /* (JERRY_STACK_LIMIT != 0) */ - -#if ENABLED (JERRY_DEBUGGER) - uint8_t debugger_send_buffer[JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE]; /**< buffer for sending messages */ - uint8_t debugger_receive_buffer[JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE]; /**< buffer for receiving messages */ - jerry_debugger_transport_header_t *debugger_transport_header_p; /**< head of transport protocol chain */ - uint8_t *debugger_send_buffer_payload_p; /**< start where the outgoing message can be written */ - vm_frame_ctx_t *debugger_stop_context; /**< stop only if the current context is equal to this context */ - uint8_t *debugger_exception_byte_code_p; /**< Location of the currently executed byte code if an - * error occours while the vm_loop is suspended */ - jmem_cpointer_t debugger_byte_code_free_head; /**< head of byte code free linked list */ - jmem_cpointer_t debugger_byte_code_free_tail; /**< tail of byte code free linked list */ - uint32_t debugger_flags; /**< debugger flags */ - uint16_t debugger_received_length; /**< length of currently received bytes */ - uint8_t debugger_message_delay; /**< call receive message when reaches zero */ - uint8_t debugger_max_send_size; /**< maximum amount of data that can be sent */ - uint8_t debugger_max_receive_size; /**< maximum amount of data that can be received */ -#endif /* ENABLED (JERRY_DEBUGGER) */ - -#if ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ERROR_MESSAGES) || ENABLED (JERRY_ES2015_MODULE_SYSTEM) - ecma_value_t resource_name; /**< resource name (usually a file name) */ -#endif /* ENABLED (JERRY_LINE_INFO) || ENABLED (JERRY_ERROR_MESSAGES) || ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ - -#if ENABLED (JERRY_MEM_STATS) - jmem_heap_stats_t jmem_heap_stats; /**< heap's memory usage statistics */ -#endif /* ENABLED (JERRY_MEM_STATS) */ - - /* This must be at the end of the context for performance reasons */ -#if ENABLED (JERRY_LCACHE) - /** hash table for caching the last access of properties */ - ecma_lcache_hash_entry_t lcache[ECMA_LCACHE_HASH_ROWS_COUNT][ECMA_LCACHE_HASH_ROW_LENGTH]; -#endif /* ENABLED (JERRY_LCACHE) */ -}; - - -#if ENABLED (JERRY_EXTERNAL_CONTEXT) - -/* - * This part is for JerryScript which uses external context. - */ - -#define JERRY_CONTEXT(field) (jerry_port_get_current_context ()->field) - -#if !ENABLED (JERRY_SYSTEM_ALLOCATOR) - -#define JMEM_HEAP_SIZE (JERRY_CONTEXT (heap_size)) - -#define JMEM_HEAP_AREA_SIZE (JMEM_HEAP_SIZE - JMEM_ALIGNMENT) - -struct jmem_heap_t -{ - jmem_heap_free_t first; /**< first node in free region list */ - uint8_t area[]; /**< heap area */ -}; - -#define JERRY_HEAP_CONTEXT(field) (JERRY_CONTEXT (heap_p)->field) - -#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */ - -#else /* !ENABLED (JERRY_EXTERNAL_CONTEXT) */ - -/* - * This part is for JerryScript which uses default context. - */ - -/** - * Global context. - */ -extern jerry_context_t jerry_global_context; - -/** - * Provides a reference to a field in the current context. - */ -#define JERRY_CONTEXT(field) (jerry_global_context.field) - -#if !ENABLED (JERRY_SYSTEM_ALLOCATOR) - -/** -* Size of heap -*/ -#define JMEM_HEAP_SIZE ((size_t) (CONFIG_MEM_HEAP_SIZE)) - -/** - * Calculate heap area size, leaving space for a pointer to the free list - */ -#define JMEM_HEAP_AREA_SIZE (JMEM_HEAP_SIZE - JMEM_ALIGNMENT) - -struct jmem_heap_t -{ - jmem_heap_free_t first; /**< first node in free region list */ - uint8_t area[JMEM_HEAP_AREA_SIZE]; /**< heap area */ -}__attribute__((aligned(8))); - -/** - * Global heap. - */ -extern jmem_heap_t jerry_global_heap; - -/** - * Provides a reference to a field of the heap. - */ -#define JERRY_HEAP_CONTEXT(field) (jerry_global_heap.field) - -#endif /* !ENABLED (JERRY_SYSTEM_ALLOCATOR) */ - -#endif /* ENABLED (JERRY_EXTERNAL_CONTEXT) */ - -/** - * @} - */ - -#endif /* !JCONTEXT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-debugger-transport.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-debugger-transport.h deleted file mode 100755 index f6f9acaaa..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jerryscript-debugger-transport.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYSCRIPT_DEBUGGER_TRANSPORT_H -#define JERRYSCRIPT_DEBUGGER_TRANSPORT_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/** \addtogroup jerry-debugger-transport Jerry engine debugger interface - transport control - * @{ - */ - -/** - * Maximum number of bytes transmitted or received. - */ -#define JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE 128 - -/** - * Receive message context. - */ -typedef struct -{ - uint8_t *buffer_p; /**< buffer for storing the received data */ - size_t received_length; /**< number of currently received bytes */ - uint8_t *message_p; /**< start of the received message */ - size_t message_length; /**< length of the received message */ - size_t message_total_length; /**< total length for datagram protocols, - * 0 for stream protocols */ -} jerry_debugger_transport_receive_context_t; - -/** - * Forward definition of jerry_debugger_transport_header_t. - */ -struct jerry_debugger_transport_interface_t; - -/** - * Close connection callback. - */ -typedef void (*jerry_debugger_transport_close_t) (struct jerry_debugger_transport_interface_t *header_p); - -/** - * Send data callback. - */ -typedef bool (*jerry_debugger_transport_send_t) (struct jerry_debugger_transport_interface_t *header_p, - uint8_t *message_p, size_t message_length); - -/** - * Receive data callback. - */ -typedef bool (*jerry_debugger_transport_receive_t) (struct jerry_debugger_transport_interface_t *header_p, - jerry_debugger_transport_receive_context_t *context_p); - -/** - * Transport layer header. - */ -typedef struct jerry_debugger_transport_interface_t -{ - /* The following fields must be filled before calling jerry_debugger_transport_add(). */ - jerry_debugger_transport_close_t close; /**< close connection callback */ - jerry_debugger_transport_send_t send; /**< send data callback */ - jerry_debugger_transport_receive_t receive; /**< receive data callback */ - - /* The following fields are filled by jerry_debugger_transport_add(). */ - struct jerry_debugger_transport_interface_t *next_p; /**< next transport layer */ -} jerry_debugger_transport_header_t; - -void jerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p, - size_t send_message_header_size, size_t max_send_message_size, - size_t receive_message_header_size, size_t max_receive_message_size); -void jerry_debugger_transport_start (void); - -bool jerry_debugger_transport_is_connected (void); -void jerry_debugger_transport_close (void); - -bool jerry_debugger_transport_send (const uint8_t *message_p, size_t message_length); -bool jerry_debugger_transport_receive (jerry_debugger_transport_receive_context_t *context_p); -void jerry_debugger_transport_receive_completed (jerry_debugger_transport_receive_context_t *context_p); - -void jerry_debugger_transport_sleep (void); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* !JERRYSCRIPT_DEBUGGER_TRANSPORT_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jmem-allocator-internal.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jmem-allocator-internal.h deleted file mode 100755 index 3abb1b22c..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jmem-allocator-internal.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JMEM_ALLOCATOR_INTERNAL_H -#define JMEM_ALLOCATOR_INTERNAL_H - -#ifndef JMEM_ALLOCATOR_INTERNAL -# error "The header is for internal routines of memory allocator component. Please, don't use the routines directly." -#endif /* !JMEM_ALLOCATOR_INTERNAL */ - -/** \addtogroup mem Memory allocation - * @{ - */ - -/** - * @{ - * Valgrind-related options and headers - */ -#if ENABLED (JERRY_VALGRIND) -# include "memcheck.h" - -# define JMEM_VALGRIND_NOACCESS_SPACE(p, s) VALGRIND_MAKE_MEM_NOACCESS((p), (s)) -# define JMEM_VALGRIND_UNDEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_UNDEFINED((p), (s)) -# define JMEM_VALGRIND_DEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_DEFINED((p), (s)) -# define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s) VALGRIND_MALLOCLIKE_BLOCK((p), (s), 0, 0) -# define JMEM_VALGRIND_RESIZE_SPACE(p, o, n) VALGRIND_RESIZEINPLACE_BLOCK((p), (o), (n), 0) -# define JMEM_VALGRIND_FREELIKE_SPACE(p) VALGRIND_FREELIKE_BLOCK((p), 0) -#else /* !ENABLED (JERRY_VALGRIND) */ -# define JMEM_VALGRIND_NOACCESS_SPACE(p, s) -# define JMEM_VALGRIND_UNDEFINED_SPACE(p, s) -# define JMEM_VALGRIND_DEFINED_SPACE(p, s) -# define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s) -# define JMEM_VALGRIND_RESIZE_SPACE(p, o, n) -# define JMEM_VALGRIND_FREELIKE_SPACE(p) -#endif /* ENABLED (JERRY_VALGRIND) */ -/** @} */ - -void jmem_heap_init (void); -void jmem_heap_finalize (void); -bool jmem_is_heap_pointer (const void *pointer); -void *jmem_heap_alloc_block_internal (const size_t size); -void jmem_heap_free_block_internal (void *ptr, const size_t size); - -/** - * \addtogroup poolman Memory pool manager - * @{ - */ - -void jmem_pools_finalize (void); - -/** - * @} - * @} - */ - -/** - * @{ - * Jerry mem-stat definitions - */ -#if ENABLED (JERRY_MEM_STATS) -void jmem_heap_stat_init (void); -void jmem_heap_stat_alloc (size_t num); -void jmem_heap_stat_free (size_t num); - -#define JMEM_HEAP_STAT_INIT() jmem_heap_stat_init () -#define JMEM_HEAP_STAT_ALLOC(v1) jmem_heap_stat_alloc (v1) -#define JMEM_HEAP_STAT_FREE(v1) jmem_heap_stat_free (v1) -#else /* !ENABLED (JERRY_MEM_STATS) */ -#define JMEM_HEAP_STAT_INIT() -#define JMEM_HEAP_STAT_ALLOC(v1) JERRY_UNUSED (v1) -#define JMEM_HEAP_STAT_FREE(v1) JERRY_UNUSED (v1) -#endif /* ENABLED (JERRY_MEM_STATS) */ - -/** @} */ - -#endif /* !JMEM_ALLOCATOR_INTERNAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt-bit-fields.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt-bit-fields.h deleted file mode 100755 index c5aaf373f..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt-bit-fields.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JRT_BIT_FIELDS_H -#define JRT_BIT_FIELDS_H - -/** - * Extract a bit-field. - * - * @param type type of container - * @param container container to extract bit-field from - * @param lsb least significant bit of the value to be extracted - * @param width width of the bit-field to be extracted - * @return bit-field's value - */ -#define JRT_EXTRACT_BIT_FIELD(type, container, lsb, width) \ - (((container) >> lsb) & ((((type) 1) << (width)) - 1)) - -/** - * Set a bit-field. - * - * @param type type of container - * @param container container to insert bit-field to - * @param new_bit_field_value value of bit-field to insert - * @param lsb least significant bit of the value to be inserted - * @param width width of the bit-field to be inserted - * @return bit-field's value - */ -#define JRT_SET_BIT_FIELD_VALUE(type, container, new_bit_field_value, lsb, width) \ - (((container) & ~(((((type) 1) << (width)) - 1) << (lsb))) | (((type) new_bit_field_value) << (lsb))) - -#endif /* !JRT_BIT_FIELDS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt-libc-includes.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt-libc-includes.h deleted file mode 100755 index bf87a86b2..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/jrt-libc-includes.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JRT_LIBC_INCLUDES_H -#define JRT_LIBC_INCLUDES_H - -#include -#include -#include -#include -#include -#include - -#endif /* !JRT_LIBC_INCLUDES_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-lexer.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-lexer.h deleted file mode 100755 index 79f762284..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-lexer.h +++ /dev/null @@ -1,334 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JS_LEXER_H -#define JS_LEXER_H - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup jsparser JavaScript - * @{ - * - * \addtogroup jsparser_lexer Lexer - * @{ - */ - -/** - * Lexer token types. - */ -typedef enum -{ - LEXER_EOS, /**< end of source */ - - /* Primary expressions */ - LEXER_LITERAL, /**< literal token */ - LEXER_KEYW_THIS, /**< this */ - LEXER_LIT_TRUE, /**< true (not a keyword!) */ - LEXER_LIT_FALSE, /**< false (not a keyword!) */ - LEXER_LIT_NULL, /**< null (not a keyword!) */ -#if ENABLED (JERRY_ES2015_TEMPLATE_STRINGS) - LEXER_TEMPLATE_LITERAL, /**< multi segment template literal */ -#endif /* ENABLED (JERRY_ES2015_TEMPLATE_STRINGS) */ -#if ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) - LEXER_THREE_DOTS, /**< ... (rest or spread operator) */ -#endif /* ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) */ - - /* Unary operators - * IMPORTANT: update CBC_UNARY_OP_TOKEN_TO_OPCODE and - * CBC_UNARY_LVALUE_OP_TOKEN_TO_OPCODE after changes. */ -#define LEXER_IS_UNARY_OP_TOKEN(token_type) \ - ((token_type) >= LEXER_PLUS && (token_type) <= LEXER_DECREASE) -#define LEXER_IS_UNARY_LVALUE_OP_TOKEN(token_type) \ - ((token_type) >= LEXER_KEYW_DELETE && (token_type) <= LEXER_DECREASE) - - LEXER_PLUS, /**< "+" */ - LEXER_NEGATE, /**< "-" */ - LEXER_LOGICAL_NOT, /**< "!" */ - LEXER_BIT_NOT, /**< "~" */ - LEXER_KEYW_VOID, /**< void */ - LEXER_KEYW_TYPEOF, /**< typeof */ - LEXER_KEYW_DELETE, /**< delete */ - LEXER_INCREASE, /**< "++" */ - LEXER_DECREASE, /**< "--" */ - - /* Binary operators - * IMPORTANT: update CBC_BINARY_OP_TOKEN_TO_OPCODE, - * CBC_BINARY_LVALUE_OP_TOKEN_TO_OPCODE and - * parser_binary_precedence_table after changes. */ -#define LEXER_IS_BINARY_OP_TOKEN(token_type) \ - ((token_type) >= LEXER_ASSIGN && (token_type) <= LEXER_MODULO) -#define LEXER_IS_BINARY_LVALUE_TOKEN(token_type) \ - ((token_type) >= LEXER_ASSIGN && (token_type) <= LEXER_ASSIGN_BIT_XOR) -#define LEXER_FIRST_BINARY_OP LEXER_ASSIGN - - LEXER_ASSIGN, /**< "=" (prec: 3) */ - LEXER_ASSIGN_ADD, /**< "+=" (prec: 3) */ - LEXER_ASSIGN_SUBTRACT, /**< "-=" (prec: 3) */ - LEXER_ASSIGN_MULTIPLY, /**< "*=" (prec: 3) */ - LEXER_ASSIGN_DIVIDE, /**< "/=" (prec: 3) */ - LEXER_ASSIGN_MODULO, /**< "%=" (prec: 3) */ - LEXER_ASSIGN_LEFT_SHIFT, /**< "<<=" (prec: 3) */ - LEXER_ASSIGN_RIGHT_SHIFT, /**< ">>=" (prec: 3) */ - LEXER_ASSIGN_UNS_RIGHT_SHIFT, /**< ">>>=" (prec: 3) */ - LEXER_ASSIGN_BIT_AND, /**< "&=" (prec: 3) */ - LEXER_ASSIGN_BIT_OR, /**< "|=" (prec: 3) */ - LEXER_ASSIGN_BIT_XOR, /**< "^=" (prec: 3) */ - LEXER_QUESTION_MARK, /**< "?" (prec: 4) */ - LEXER_LOGICAL_OR, /**< "||" (prec: 5) */ - LEXER_LOGICAL_AND, /**< "&&" (prec: 6) */ - LEXER_BIT_OR, /**< "|" (prec: 7) */ - LEXER_BIT_XOR, /**< "^" (prec: 8) */ - LEXER_BIT_AND, /**< "&" (prec: 9) */ - LEXER_EQUAL, /**< "==" (prec: 10) */ - LEXER_NOT_EQUAL, /**< "!=" (prec: 10) */ - LEXER_STRICT_EQUAL, /**< "===" (prec: 10) */ - LEXER_STRICT_NOT_EQUAL, /**< "!==" (prec: 10) */ - LEXER_LESS, /**< "<" (prec: 11) */ - LEXER_GREATER, /**< ">" (prec: 11) */ - LEXER_LESS_EQUAL, /**< "<=" (prec: 11) */ - LEXER_GREATER_EQUAL, /**< ">=" (prec: 11) */ - LEXER_KEYW_IN, /**< in (prec: 11) */ - LEXER_KEYW_INSTANCEOF, /**< instanceof (prec: 11) */ - LEXER_LEFT_SHIFT, /**< "<<" (prec: 12) */ - LEXER_RIGHT_SHIFT, /**< ">>" (prec: 12) */ - LEXER_UNS_RIGHT_SHIFT, /**< ">>>" (prec: 12) */ - LEXER_ADD, /**< "+" (prec: 13) */ - LEXER_SUBTRACT, /**< "-" (prec: 13) */ - LEXER_MULTIPLY, /**< "*" (prec: 14) */ - LEXER_DIVIDE, /**< "/" (prec: 14) */ - LEXER_MODULO, /**< "%" (prec: 14) */ - - LEXER_LEFT_BRACE, /**< "{" */ - LEXER_LEFT_PAREN, /**< "(" */ - LEXER_LEFT_SQUARE, /**< "[" */ - LEXER_RIGHT_BRACE, /**< "}" */ - LEXER_RIGHT_PAREN, /**< ")" */ - LEXER_RIGHT_SQUARE, /**< "]" */ - LEXER_DOT, /**< "." */ - LEXER_SEMICOLON, /**< ";" */ - LEXER_COLON, /**< ":" */ - LEXER_COMMA, /**< "," */ -#if ENABLED (JERRY_ES2015_ARROW_FUNCTION) - LEXER_ARROW, /**< "=>" */ -#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */ - - LEXER_KEYW_BREAK, /**< break */ - LEXER_KEYW_DO, /**< do */ - LEXER_KEYW_CASE, /**< case */ - LEXER_KEYW_ELSE, /**< else */ - LEXER_KEYW_NEW, /**< new */ - LEXER_KEYW_VAR, /**< var */ - LEXER_KEYW_CATCH, /**< catch */ - LEXER_KEYW_FINALLY, /**< finally */ - LEXER_KEYW_RETURN, /**< return */ - LEXER_KEYW_CONTINUE, /**< continue */ - LEXER_KEYW_FOR, /**< for */ - LEXER_KEYW_SWITCH, /**< switch */ - LEXER_KEYW_WHILE, /**< while */ - LEXER_KEYW_DEBUGGER, /**< debugger */ - LEXER_KEYW_FUNCTION, /**< function */ - LEXER_KEYW_WITH, /**< with */ - LEXER_KEYW_DEFAULT, /**< default */ - LEXER_KEYW_IF, /**< if */ - LEXER_KEYW_THROW, /**< throw */ - LEXER_KEYW_TRY, /**< try */ - - /* These are virtual tokens. */ - LEXER_EXPRESSION_START, /**< expression start */ - LEXER_PROPERTY_GETTER, /**< property getter function */ - LEXER_PROPERTY_SETTER, /**< property setter function */ - LEXER_COMMA_SEP_LIST, /**< comma separated bracketed expression list */ - LEXER_SCAN_SWITCH, /**< special value for switch pre-scan */ - LEXER_CLASS_CONSTRUCTOR, /**< special value for class constructor method */ -#if ENABLED (JERRY_ES2015_FOR_OF) - LEXER_FOR_IN_OF, /**< special value during for in/of statmenet scanning */ - LEXER_LITERAL_OF, /**< 'of' literal */ -#endif /* ENABLED (JERRY_ES2015_FOR_OF) */ - -#if !ENABLED (JERRY_ES2015) - /* Future reserved words: these keywords - * must form a group after all other keywords. */ -#define LEXER_FIRST_FUTURE_RESERVED_WORD LEXER_KEYW_CLASS -#endif /* !ENABLED (JERRY_ES2015) */ - LEXER_KEYW_CLASS, /**< class */ - LEXER_KEYW_EXTENDS, /**< extends */ - LEXER_KEYW_SUPER, /**< super */ - LEXER_KEYW_CONST, /**< const */ - LEXER_KEYW_EXPORT, /**< export */ - LEXER_KEYW_IMPORT, /**< import */ -#if ENABLED (JERRY_ES2015) - /* Future reserved words: these keywords - * must form a group after all other keywords. - * Note: - * Tokens from LEXER_KEYW_CLASS to LEXER_KEYW_IMPORT - * are no longer future reserved words in ES2015. */ -#define LEXER_FIRST_FUTURE_RESERVED_WORD LEXER_KEYW_ENUM -#endif /* ENABLED (JERRY_ES2015) */ - LEXER_KEYW_ENUM, /**< enum */ -#if ENABLED (JERRY_ES2015) - LEXER_KEYW_AWAIT, /**< await */ -#endif /* ENABLED (JERRY_ES2015) */ - - /* Future strict reserved words: these keywords - * must form a group after future reserved words. */ -#define LEXER_FIRST_FUTURE_STRICT_RESERVED_WORD LEXER_KEYW_IMPLEMENTS - LEXER_KEYW_IMPLEMENTS, /**< implements */ - LEXER_KEYW_PRIVATE, /**< private */ - LEXER_KEYW_PUBLIC, /**< public */ - LEXER_KEYW_INTERFACE, /**< interface */ - LEXER_KEYW_PACKAGE, /**< package */ - LEXER_KEYW_PROTECTED, /**< protected */ - -#if ENABLED (JERRY_ES2015) - /* Context dependent strict reserved words: - * See also: ECMA-262 v6, 11.6.2.1 */ -#define LEXER_FIRST_CONTEXT_DEPENDENT_RESERVED_WORD LEXER_KEYW_STATIC - LEXER_KEYW_STATIC, /**< static */ -#else /* !ENABLED (JERRY_ES2015) */ - /* Context dependent strict reserved words: - * See also: ECMA-262 v6, 11.6.2.1 */ -#define LEXER_FIRST_CONTEXT_DEPENDENT_RESERVED_WORD -#endif /* ENABLED (JERRY_ES2015) */ - - /* Context dependent future strict reserved words: - * See also: ECMA-262 v6, 11.6.2.1 */ -#define LEXER_FIRST_CONTEXT_DEPENDENT_FUTURE_RESERVED_WORD LEXER_KEYW_LET - LEXER_KEYW_LET, /**< let */ - LEXER_KEYW_YIELD, /**< yield */ -#if !ENABLED (JERRY_ES2015) - LEXER_KEYW_STATIC, /**< static */ -#endif /* !ENABLED (JERRY_ES2015) */ -} lexer_token_type_t; - -#define LEXER_NEWLINE_LS_PS_BYTE_1 0xe2 -#define LEXER_NEWLINE_LS_PS_BYTE_23(source) \ - ((source)[1] == LIT_UTF8_2_BYTE_CODE_POINT_MIN && ((source)[2] | 0x1) == 0xa9) -#define LEXER_UTF8_4BYTE_START 0xf0 - -#define LEXER_IS_LEFT_BRACKET(type) \ - ((type) == LEXER_LEFT_BRACE || (type) == LEXER_LEFT_PAREN || (type) == LEXER_LEFT_SQUARE) - -#define LEXER_IS_RIGHT_BRACKET(type) \ - ((type) == LEXER_RIGHT_BRACE || (type) == LEXER_RIGHT_PAREN || (type) == LEXER_RIGHT_SQUARE) - -#define LEXER_UNARY_OP_TOKEN_TO_OPCODE(token_type) \ - ((((token_type) - LEXER_PLUS) * 2) + CBC_PLUS) - -#define LEXER_UNARY_LVALUE_OP_TOKEN_TO_OPCODE(token_type) \ - ((((token_type) - LEXER_INCREASE) * 6) + CBC_PRE_INCR) - -#define LEXER_BINARY_OP_TOKEN_TO_OPCODE(token_type) \ - ((cbc_opcode_t) ((((token_type) - LEXER_BIT_OR) * 3) + CBC_BIT_OR)) - -#define LEXER_BINARY_LVALUE_OP_TOKEN_TO_OPCODE(token_type) \ - ((cbc_opcode_t) ((((token_type) - LEXER_ASSIGN_ADD) * 2) + CBC_ASSIGN_ADD)) - -/** - * Lexer newline flags. - */ -typedef enum -{ - LEXER_WAS_NEWLINE = (1u << 0), /**< newline was seen */ - LEXER_NO_SKIP_SPACES = (1u << 1) /**< ignore skip spaces */ -} lexer_newline_flags_t; - -/** - * Lexer object identifier parse options. - */ -typedef enum -{ - LEXER_OBJ_IDENT_NO_OPTS = (1u << 0), /**< no options */ - LEXER_OBJ_IDENT_ONLY_IDENTIFIERS = (1u << 1), /**< only identifiers are accepted */ - LEXER_OBJ_IDENT_CLASS_METHOD = (1u << 2), /**< expect identifier inside a class body */ -} lexer_obj_ident_opts_t; - -/** - * Lexer scan identifier parse options. - */ -typedef enum -{ - LEXER_SCAN_IDENT_NO_OPTS = (1u << 0), /**< no options */ - LEXER_SCAN_IDENT_PROPERTY = (1u << 1), /**< scan valid property names */ - LEXER_SCAN_IDENT_NO_KEYW = (1u << 2), /**< don't scan keywords (e.g. get/set) */ -#if ENABLED (JERRY_ES2015_CLASS) - LEXER_SCAN_CLASS_PROPERTY = (1u << 3), /**< scan valid class property names */ - LEXER_SCAN_CLASS_LEFT_PAREN = (1u << 4), /**< also parse left parenthesis */ -#endif /* ENABLED (JERRY_ES2015_CLASS) */ -} lexer_scan_ident_opts_t; - -/** - * Lexer literal object types. - */ -typedef enum -{ - LEXER_LITERAL_OBJECT_ANY, /**< unspecified object type */ - LEXER_LITERAL_OBJECT_EVAL, /**< reference is equal to eval */ - LEXER_LITERAL_OBJECT_ARGUMENTS, /**< reference is equal to arguments */ -} lexer_literal_object_type_t; - -/** - * Lexer number types. - */ -typedef enum -{ - LEXER_NUMBER_DECIMAL, /**< decimal number */ - LEXER_NUMBER_HEXADECIMAL, /**< hexadecimal number */ - LEXER_NUMBER_OCTAL, /**< octal number */ -} lexer_number_type_t; - -/** - * Lexer character (string / identifier) literal data. - */ -typedef struct -{ - const uint8_t *char_p; /**< start of identifier or string token */ - prop_length_t length; /**< length or index of a literal */ - uint8_t type; /**< type of the current literal */ - uint8_t has_escape; /**< has escape sequences */ -} lexer_lit_location_t; - -/** - * Lexer token. - */ -typedef struct -{ - uint8_t type; /**< token type */ - uint8_t literal_is_reserved; /**< future reserved keyword - * (when char_literal.type is LEXER_IDENT_LITERAL) */ - uint8_t extra_value; /**< helper value for different purposes */ - uint8_t flags; /**< flag bits for the current token */ - parser_line_counter_t line; /**< token start line */ - parser_line_counter_t column; /**< token start column */ - lexer_lit_location_t lit_location; /**< extra data for character literals */ -} lexer_token_t; - -/** - * Literal data set by lexer_construct_literal_object. - */ -typedef struct -{ - lexer_literal_t *literal_p; /**< pointer to the literal object */ - uint16_t index; /**< literal index */ - uint8_t type; /**< literal object type */ -} lexer_lit_object_t; - -/** - * @} - * @} - * @} - */ - -#endif /* !JS_LEXER_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-parser-internal.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-parser-internal.h deleted file mode 100755 index d756f6dac..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-parser-internal.h +++ /dev/null @@ -1,679 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JS_PARSER_INTERNAL_H -#define JS_PARSER_INTERNAL_H - -#include "common.h" - -#include "byte-code.h" -#include "debugger.h" -#include "js-parser.h" -#include "js-parser-limits.h" -#include "js-lexer.h" -#include "js-scanner.h" - -#include "ecma-module.h" - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup jsparser JavaScript - * @{ - * - * \addtogroup jsparser_internals Internals - * @{ - */ - -/** - * General parser flags. - */ -typedef enum -{ - PARSER_IS_STRICT = (1u << 0), /**< strict mode code */ - PARSER_IS_FUNCTION = (1u << 1), /**< function body is parsed */ - PARSER_IS_CLOSURE = (1u << 2), /**< function body is encapsulated in {} block */ - PARSER_IS_FUNC_EXPRESSION = (1u << 3), /**< a function expression is parsed */ - PARSER_IS_PROPERTY_GETTER = (1u << 4), /**< a property getter function is parsed */ - PARSER_IS_PROPERTY_SETTER = (1u << 5), /**< a property setter function is parsed */ -#if ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) - PARSER_FUNCTION_HAS_REST_PARAM = (1u << 6), /**< function has rest parameter */ -#endif /* ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) */ - PARSER_HAS_NON_STRICT_ARG = (1u << 7), /**< the function has arguments which - * are not supported in strict mode */ - PARSER_ARGUMENTS_NEEDED = (1u << 8), /**< arguments object must be created */ - PARSER_ARGUMENTS_NOT_NEEDED = (1u << 9), /**< arguments object must NOT be created */ - PARSER_LEXICAL_ENV_NEEDED = (1u << 10), /**< lexical environment object must be created */ - PARSER_NO_REG_STORE = (1u << 11), /**< all local variables must be stored - * in the lexical environment object */ - PARSER_INSIDE_WITH = (1u << 12), /**< code block is inside a with statement */ - PARSER_RESOLVE_BASE_FOR_CALLS = (1u << 13), /**< the this object must be resolved when - * a function without a base object is called */ - PARSER_HAS_INITIALIZED_VARS = (1u << 14), /**< a CBC_INITIALIZE_VARS instruction must be emitted */ - PARSER_HAS_LATE_LIT_INIT = (1u << 15), /**< allocate memory for this string after - * the local parser data is freed */ - PARSER_NO_END_LABEL = (1u << 16), /**< return instruction must be inserted - * after the last byte code */ - PARSER_DEBUGGER_BREAKPOINT_APPENDED = (1u << 17), /**< pending (unsent) breakpoint - * info is available */ -#if ENABLED (JERRY_ES2015_ARROW_FUNCTION) - PARSER_IS_ARROW_FUNCTION = (1u << 18), /**< an arrow function is parsed */ - PARSER_ARROW_PARSE_ARGS = (1u << 19), /**< parse the argument list of an arrow function */ -#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */ -#if ENABLED (JERRY_ES2015_CLASS) - /* These four status flags must be in this order. See PARSER_CLASS_PARSE_OPTS_OFFSET. */ - PARSER_CLASS_CONSTRUCTOR = (1u << 20), /**< a class constructor is parsed (this value must be kept in - * in sync with ECMA_PARSE_CLASS_CONSTRUCTOR) */ - PARSER_CLASS_HAS_SUPER = (1u << 21), /**< class has super reference */ - PARSER_CLASS_IMPLICIT_SUPER = (1u << 22), /**< class has implicit parent class */ - PARSER_CLASS_STATIC_FUNCTION = (1u << 23), /**< this function is a static class method */ - PARSER_CLASS_SUPER_PROP_REFERENCE = (1u << 24), /**< super property call or assignment */ -#endif /* ENABLED (JERRY_ES2015_CLASS) */ -#if ENABLED (JERRY_ES2015_MODULE_SYSTEM) - PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 25), /**< parsing a function or class default export */ - PARSER_MODULE_STORE_IDENT = (1u << 26), /**< store identifier of the current export statement */ - PARSER_IS_EVAL = (1u << 27), /**< eval code */ -#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ -#ifndef JERRY_NDEBUG - PARSER_SCANNING_SUCCESSFUL = (1u << 30), /**< scanning process was successful */ -#endif /* !JERRY_NDEBUG */ -} parser_general_flags_t; - -/** - * Expression parsing flags. - */ -typedef enum -{ - PARSE_EXPR = 0, /**< parse an expression without any special flags */ - PARSE_EXPR_NO_PUSH_RESULT = (1u << 0), /**< do not push the result of the expression onto the stack */ - PARSE_EXPR_NO_COMMA = (1u << 1), /**< do not parse comma operator */ - PARSE_EXPR_HAS_LITERAL = (1u << 2), /**< a primary literal is provided by a - * CBC_PUSH_LITERAL instruction */ -} parser_expression_flags_t; - -/** - * Mask for strict mode code - */ -#define PARSER_STRICT_MODE_MASK 0x1 - -#if ENABLED (JERRY_ES2015_CLASS) -/** - * Offset between PARSER_CLASS_CONSTRUCTOR and ECMA_PARSE_CLASS_CONSTRUCTOR - */ -#define PARSER_CLASS_PARSE_OPTS_OFFSET \ - (JERRY_LOG2 (PARSER_CLASS_CONSTRUCTOR) - JERRY_LOG2 (ECMA_PARSE_CLASS_CONSTRUCTOR)) - -/** - * Count of ecma_parse_opts_t class parsing options related bits - */ -#define PARSER_CLASS_PARSE_OPTS_COUNT \ - (JERRY_LOG2 (ECMA_PARSE_HAS_STATIC_SUPER) - JERRY_LOG2 (ECMA_PARSE_CLASS_CONSTRUCTOR)) - -/** - * Mask for get class option bits from ecma_parse_opts_t - */ -#define PARSER_CLASS_ECMA_PARSE_OPTS_TO_PARSER_OPTS_MASK \ - (((1 << PARSER_CLASS_PARSE_OPTS_COUNT) - 1) << JERRY_LOG2 (ECMA_PARSE_CLASS_CONSTRUCTOR)) - -/** - * Get class option bits from ecma_parse_opts_t - */ -#define PARSER_GET_CLASS_PARSER_OPTS(opts) \ - (((opts) & PARSER_CLASS_ECMA_PARSE_OPTS_TO_PARSER_OPTS_MASK) << PARSER_CLASS_PARSE_OPTS_OFFSET) - -/** - * Get class option bits from parser_general_flags_t - */ -#define PARSER_GET_CLASS_ECMA_PARSE_OPTS(opts) \ - ((uint16_t) (((opts) >> PARSER_CLASS_PARSE_OPTS_OFFSET) & PARSER_CLASS_ECMA_PARSE_OPTS_TO_PARSER_OPTS_MASK)) - -/** - * Class constructor with heritage context representing bits - */ -#define PARSER_CLASS_CONSTRUCTOR_SUPER (PARSER_CLASS_CONSTRUCTOR | PARSER_CLASS_HAS_SUPER) - -/** - * Check the scope is a class constructor with heritage context - */ -#define PARSER_IS_CLASS_CONSTRUCTOR_SUPER(flag) \ - (((flag) & PARSER_CLASS_CONSTRUCTOR_SUPER) == PARSER_CLASS_CONSTRUCTOR_SUPER) -#endif /* ENABLED (JERRY_ES2015_CLASS) */ - -/* The maximum of PARSER_CBC_STREAM_PAGE_SIZE is 127. */ -#define PARSER_CBC_STREAM_PAGE_SIZE \ - ((uint32_t) (64 - sizeof (void *))) - -#define PARSER_STACK_PAGE_SIZE \ - ((uint32_t) (((sizeof (void *) > 4) ? 128 : 64) - sizeof (void *))) - -/* Avoid compiler warnings for += operations. */ -#define PARSER_PLUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) + (value)) -#define PARSER_MINUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) - (value)) -#define PARSER_PLUS_EQUAL_LC(base, value) (base) = (parser_line_counter_t) ((base) + (value)) - -/** - * Argument for a compact-byte code. - */ -typedef struct -{ - uint16_t literal_index; /**< literal index argument */ - uint16_t value; /**< other argument (second literal or byte). */ - uint16_t third_literal_index; /**< literal index argument */ - uint8_t literal_type; /**< last literal type */ - uint8_t literal_object_type; /**< last literal object type */ -} cbc_argument_t; - -/* Useful parser macros. */ - -#define PARSER_CBC_UNAVAILABLE CBC_EXT_OPCODE - -#define PARSER_TO_EXT_OPCODE(opcode) ((uint16_t) ((opcode) + 256)) -#define PARSER_GET_EXT_OPCODE(opcode) ((opcode) - 256) -#define PARSER_IS_BASIC_OPCODE(opcode) ((opcode) < 256) -#define PARSER_IS_PUSH_LITERAL(opcode) \ - ((opcode) == CBC_PUSH_LITERAL \ - || (opcode) == CBC_PUSH_TWO_LITERALS \ - || (opcode) == CBC_PUSH_THREE_LITERALS) -#define PARSER_IS_PUSH_NUMBER(opcode) \ - ((opcode) == CBC_PUSH_NUMBER_0 \ - || (opcode) == CBC_PUSH_NUMBER_POS_BYTE \ - || (opcode) == CBC_PUSH_NUMBER_NEG_BYTE \ - || (opcode) == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_LITERAL_PUSH_NUMBER_0) \ - || (opcode) == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE) \ - || (opcode) == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)) - -#define PARSER_IS_MUTABLE_PUSH_LITERAL(opcode) \ - ((opcode) >= CBC_PUSH_LITERAL && (opcode) <= CBC_PUSH_THIS_LITERAL) - -#define PARSER_IS_PUSH_LITERALS_WITH_THIS(opcode) \ - ((opcode) >= CBC_PUSH_LITERAL && (opcode) <= CBC_PUSH_THREE_LITERALS) - -#define PARSER_IS_PUSH_PROP(opcode) \ - ((opcode) >= CBC_PUSH_PROP && (opcode) <= CBC_PUSH_PROP_THIS_LITERAL) - -#define PARSER_IS_PUSH_PROP_LITERAL(opcode) \ - ((opcode) >= CBC_PUSH_PROP_LITERAL && (opcode) <= CBC_PUSH_PROP_THIS_LITERAL) - -#define PARSER_PUSH_LITERAL_TO_PUSH_PROP_LITERAL(opcode) \ - (uint16_t) ((opcode) + (CBC_PUSH_PROP_LITERAL - CBC_PUSH_LITERAL)) - -#define PARSER_PUSH_PROP_LITERAL_TO_PUSH_LITERAL(opcode) \ - (uint16_t) ((opcode) - (CBC_PUSH_PROP_LITERAL - CBC_PUSH_LITERAL)) - -#define PARSER_PUSH_PROP_TO_PUSH_PROP_REFERENCE(opcode) \ - (uint16_t) ((opcode) + (CBC_PUSH_PROP_REFERENCE - CBC_PUSH_PROP)) - -#define PARSER_PUSH_PROP_REFERENCE_TO_PUSH_PROP(opcode) \ - (uint16_t) ((opcode) - (CBC_PUSH_PROP_REFERENCE - CBC_PUSH_PROP)) - -#define PARSER_GET_LITERAL(literal_index) \ - ((lexer_literal_t *) parser_list_get (&context_p->literal_pool, (literal_index))) - -#define PARSER_TO_BINARY_OPERATION_WITH_RESULT(opcode) \ - (PARSER_TO_EXT_OPCODE(opcode) - CBC_ASSIGN_ADD + CBC_EXT_ASSIGN_ADD_PUSH_RESULT) - -#define PARSER_TO_BINARY_OPERATION_WITH_BLOCK(opcode) \ - ((uint16_t) (PARSER_TO_EXT_OPCODE(opcode) - CBC_ASSIGN_ADD + CBC_EXT_ASSIGN_ADD_BLOCK)) - -#define PARSER_GET_FLAGS(op) \ - (PARSER_IS_BASIC_OPCODE (op) ? cbc_flags[(op)] : cbc_ext_flags[PARSER_GET_EXT_OPCODE (op)]) - -#define PARSER_OPCODE_IS_RETURN(op) \ - ((op) == CBC_RETURN || (op) == CBC_RETURN_WITH_BLOCK || (op) == CBC_RETURN_WITH_LITERAL) - -#define PARSER_ARGS_EQ(op, types) \ - ((PARSER_GET_FLAGS (op) & CBC_ARG_TYPES) == (types)) - -/** - * All data allocated by the parser is - * stored in parser_data_pages in the memory. - */ -typedef struct parser_mem_page_t -{ - struct parser_mem_page_t *next_p; /**< next page */ - uint8_t bytes[1]; /**< memory bytes */ -} parser_mem_page_t; - -/** - * Structure for managing parser memory. - */ -typedef struct -{ - parser_mem_page_t *first_p; /**< first allocated page */ - parser_mem_page_t *last_p; /**< last allocated page */ - uint32_t last_position; /**< position of the last allocated byte */ -} parser_mem_data_t; - -/** - * Parser memory list. - */ -typedef struct -{ - parser_mem_data_t data; /**< storage space */ - uint32_t page_size; /**< size of each page */ - uint32_t item_size; /**< size of each item */ - uint32_t item_count; /**< number of items on each page */ -} parser_list_t; - -/** - * Iterator for parser memory list. - */ -typedef struct -{ - parser_list_t *list_p; /**< parser list */ - parser_mem_page_t *current_p; /**< currently processed page */ - size_t current_position; /**< current position on the page */ -} parser_list_iterator_t; - -/** - * Parser memory stack. - */ -typedef struct -{ - parser_mem_data_t data; /**< storage space */ - parser_mem_page_t *free_page_p; /**< space for fast allocation */ -} parser_stack_t; - -/** - * Iterator for parser memory stack. - */ -typedef struct -{ - parser_mem_page_t *current_p; /**< currently processed page */ - size_t current_position; /**< current position on the page */ -} parser_stack_iterator_t; - -/** - * Branch type. - */ -typedef struct -{ - parser_mem_page_t *page_p; /**< branch location page */ - uint32_t offset; /**< branch location offset */ -} parser_branch_t; - -/** - * Branch chain type. - */ -typedef struct parser_branch_node_t -{ - struct parser_branch_node_t *next_p; /**< next linked list node */ - parser_branch_t branch; /**< branch */ -} parser_branch_node_t; - -#if ENABLED (JERRY_DEBUGGER) -/** - * Extra information for each breakpoint. - */ -typedef struct -{ - uint32_t value; /**< line or offset of the breakpoint */ -} parser_breakpoint_info_t; - -/** - * Maximum number of breakpoint info. - */ -#define PARSER_MAX_BREAKPOINT_INFO_COUNT \ - (JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE / sizeof (parser_breakpoint_info_t)) - -#endif /* ENABLED (JERRY_DEBUGGER) */ - -/** - * Those members of a context which needs - * to be saved when a sub-function is parsed. - */ -typedef struct parser_saved_context_t -{ - /* Parser members. */ - uint32_t status_flags; /**< parsing options */ - uint16_t stack_depth; /**< current stack depth */ - uint16_t stack_limit; /**< maximum stack depth */ - struct parser_saved_context_t *prev_context_p; /**< last saved context */ - parser_stack_iterator_t last_statement; /**< last statement position */ - - /* Literal types */ - uint16_t argument_count; /**< number of function arguments */ - uint16_t register_count; /**< number of registers */ - uint16_t literal_count; /**< number of literals */ - - /* Memory storage members. */ - parser_mem_data_t byte_code; /**< byte code buffer */ - uint32_t byte_code_size; /**< byte code size for branches */ - parser_mem_data_t literal_pool_data; /**< literal list */ - -#ifndef JERRY_NDEBUG - uint16_t context_stack_depth; /**< current context stack depth */ -#endif /* !JERRY_NDEBUG */ -} parser_saved_context_t; - -/** - * Shared parser context. - */ -typedef struct -{ - PARSER_TRY_CONTEXT (try_buffer); /**< try_buffer */ - parser_error_t error; /**< error code */ - void *allocated_buffer_p; /**< dinamically allocated buffer - * which needs to be freed on error */ - uint32_t allocated_buffer_size; /**< size of the dinamically allocated buffer */ - - /* Parser members. */ - uint32_t status_flags; /**< status flags */ - uint16_t stack_depth; /**< current stack depth */ - uint16_t stack_limit; /**< maximum stack depth */ - parser_saved_context_t *last_context_p; /**< last saved context */ - parser_stack_iterator_t last_statement; /**< last statement position */ - -#if ENABLED (JERRY_ES2015_MODULE_SYSTEM) - ecma_module_node_t *module_current_node_p; /**< import / export node that is being processed */ - lexer_literal_t *module_identifier_lit_p; /**< the literal for the identifier of the current element */ -#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ - - /* Lexer members. */ - lexer_token_t token; /**< current token */ - lexer_lit_object_t lit_object; /**< current literal object */ - const uint8_t *source_p; /**< next source byte */ - const uint8_t *source_end_p; /**< last source byte */ - parser_line_counter_t line; /**< current line */ - parser_line_counter_t column; /**< current column */ - - /* Scanner members. */ - scanner_info_t *next_scanner_info_p; /**< next scanner info block */ - scanner_info_t *active_scanner_info_p; /**< currently active scanner info block */ - scanner_info_t *skipped_scanner_info_p; /**< next scanner info block */ - scanner_info_t *skipped_scanner_info_end_p; /**< currently active scanner info block */ - - /* Compact byte code members. */ - cbc_argument_t last_cbc; /**< argument of the last cbc */ - uint16_t last_cbc_opcode; /**< opcode of the last cbc */ - - /* Literal types */ - uint16_t argument_count; /**< number of function arguments */ - uint16_t register_count; /**< number of registers */ - uint16_t literal_count; /**< number of literals */ - - /* Memory storage members. */ - parser_mem_data_t byte_code; /**< byte code buffer */ - uint32_t byte_code_size; /**< current byte code size for branches */ - parser_list_t literal_pool; /**< literal list */ - parser_mem_data_t stack; /**< storage space */ - parser_mem_page_t *free_page_p; /**< space for fast allocation */ - uint8_t stack_top_uint8; /**< top byte stored on the stack */ - -#ifndef JERRY_NDEBUG - /* Variables for debugging / logging. */ - uint16_t context_stack_depth; /**< current context stack depth */ -#endif /* !JERRY_NDEBUG */ - -#if ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) - int is_show_opcodes; /**< show opcodes */ - uint32_t total_byte_code_size; /**< total byte code size */ -#endif /* ENABLED (JERRY_PARSER_DUMP_BYTE_CODE) */ - -#if ENABLED (JERRY_DEBUGGER) - parser_breakpoint_info_t breakpoint_info[PARSER_MAX_BREAKPOINT_INFO_COUNT]; /**< breakpoint info list */ - uint16_t breakpoint_info_count; /**< current breakpoint index */ - parser_line_counter_t last_breakpoint_line; /**< last line where breakpoint has been inserted */ -#endif /* ENABLED (JERRY_DEBUGGER) */ - -#if ENABLED (JERRY_LINE_INFO) - parser_line_counter_t last_line_info_line; /**< last line where line info has been inserted */ -#endif /* ENABLED (JERRY_LINE_INFO) */ -} parser_context_t; - -/** - * @} - * @} - * @} - * - * \addtogroup mem Memory allocation - * @{ - * - * \addtogroup mem_parser Parser memory manager - * @{ - */ - -/* Memory management. - * Note: throws an error if unsuccessful. */ -void *parser_malloc (parser_context_t *context_p, size_t size); -void parser_free (void *ptr, size_t size); -void *parser_malloc_local (parser_context_t *context_p, size_t size); -void parser_free_local (void *ptr, size_t size); - -/* Parser byte stream. */ - -void parser_cbc_stream_init (parser_mem_data_t *data_p); -void parser_cbc_stream_free (parser_mem_data_t *data_p); -void parser_cbc_stream_alloc_page (parser_context_t *context_p, parser_mem_data_t *data_p); - -/* Parser list. Ensures pointer alignment. */ - -void parser_list_init (parser_list_t *list_p, uint32_t item_size, uint32_t item_count); -void parser_list_free (parser_list_t *list_p); -void parser_list_reset (parser_list_t *list_p); -void *parser_list_append (parser_context_t *context_p, parser_list_t *list_p); -void *parser_list_get (parser_list_t *list_p, size_t index); -void parser_list_iterator_init (parser_list_t *list_p, parser_list_iterator_t *iterator_p); -void *parser_list_iterator_next (parser_list_iterator_t *iterator_p); - -/* Parser stack. Optimized for pushing bytes. - * Pop functions never throws error. */ - -void parser_stack_init (parser_context_t *context_p); -void parser_stack_free (parser_context_t *context_p); -void parser_stack_push_uint8 (parser_context_t *context_p, uint8_t uint8_value); -void parser_stack_pop_uint8 (parser_context_t *context_p); -void parser_stack_push_uint16 (parser_context_t *context_p, uint16_t uint16_value); -uint16_t parser_stack_pop_uint16 (parser_context_t *context_p); -void parser_stack_push (parser_context_t *context_p, const void *data_p, uint32_t length); -void parser_stack_pop (parser_context_t *context_p, void *data_p, uint32_t length); -void parser_stack_iterator_skip (parser_stack_iterator_t *iterator, size_t length); -void parser_stack_iterator_read (parser_stack_iterator_t *iterator, void *data_p, size_t length); -void parser_stack_iterator_write (parser_stack_iterator_t *iterator, const void *data_p, size_t length); - -/** - * @} - * @} - * - * \addtogroup parser Parser - * @{ - * - * \addtogroup jsparser JavaScript - * @{ - * - * \addtogroup jsparser_utils Utility - * @{ - */ - -/* Compact byte code emitting functions. */ - -void parser_flush_cbc (parser_context_t *context_p); -void parser_emit_cbc (parser_context_t *context_p, uint16_t opcode); -void parser_emit_cbc_literal (parser_context_t *context_p, uint16_t opcode, uint16_t literal_index); -void parser_emit_cbc_literal_from_token (parser_context_t *context_p, uint16_t opcode); -void parser_emit_cbc_call (parser_context_t *context_p, uint16_t opcode, size_t call_arguments); -void parser_emit_cbc_push_number (parser_context_t *context_p, bool is_negative_number); -void parser_emit_cbc_forward_branch (parser_context_t *context_p, uint16_t opcode, parser_branch_t *branch_p); -parser_branch_node_t *parser_emit_cbc_forward_branch_item (parser_context_t *context_p, uint16_t opcode, - parser_branch_node_t *next_p); -void parser_emit_cbc_backward_branch (parser_context_t *context_p, uint16_t opcode, uint32_t offset); -void parser_set_branch_to_current_position (parser_context_t *context_p, parser_branch_t *branch_p); -void parser_set_breaks_to_current_position (parser_context_t *context_p, parser_branch_node_t *current_p); -void parser_set_continues_to_current_position (parser_context_t *context_p, parser_branch_node_t *current_p); - -/* Convenience macros. */ -#define parser_emit_cbc_ext(context_p, opcode) \ - parser_emit_cbc ((context_p), PARSER_TO_EXT_OPCODE (opcode)) -#define parser_emit_cbc_ext_literal(context_p, opcode, literal_index) \ - parser_emit_cbc_literal ((context_p), PARSER_TO_EXT_OPCODE (opcode), (literal_index)) -#define parser_emit_cbc_ext_call(context_p, opcode, call_arguments) \ - parser_emit_cbc_call ((context_p), PARSER_TO_EXT_OPCODE (opcode), (call_arguments)) -#define parser_emit_cbc_ext_forward_branch(context_p, opcode, branch_p) \ - parser_emit_cbc_forward_branch ((context_p), PARSER_TO_EXT_OPCODE (opcode), (branch_p)) -#define parser_emit_cbc_ext_backward_branch(context_p, opcode, offset) \ - parser_emit_cbc_backward_branch ((context_p), PARSER_TO_EXT_OPCODE (opcode), (offset)) - -/** - * @} - * - * \addtogroup jsparser_lexer Lexer - * @{ - */ - -/* Lexer functions */ - -void lexer_next_token (parser_context_t *context_p); -bool lexer_check_next_character (parser_context_t *context_p, lit_utf8_byte_t character); -#if ENABLED (JERRY_ES2015_CLASS) -void lexer_skip_empty_statements (parser_context_t *context_p); -#endif /* ENABLED (JERRY_ES2015_CLASS) */ -#if ENABLED (JERRY_ES2015_ARROW_FUNCTION) -bool lexer_check_arrow (parser_context_t *context_p); -#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */ -void lexer_parse_string (parser_context_t *context_p); -void lexer_expect_identifier (parser_context_t *context_p, uint8_t literal_type); -void lexer_scan_identifier (parser_context_t *context_p, uint32_t ident_opts); -ecma_char_t lexer_hex_to_character (parser_context_t *context_p, const uint8_t *source_p, int length); -void lexer_expect_object_literal_id (parser_context_t *context_p, uint32_t ident_opts); -void lexer_construct_literal_object (parser_context_t *context_p, lexer_lit_location_t *literal_p, - uint8_t literal_type); -bool lexer_construct_number_object (parser_context_t *context_p, bool is_expr, bool is_negative_number); -void lexer_convert_push_number_to_push_literal (parser_context_t *context_p); -uint16_t lexer_construct_function_object (parser_context_t *context_p, uint32_t extra_status_flags); -void lexer_construct_regexp_object (parser_context_t *context_p, bool parse_only); -bool lexer_compare_identifier_to_current (parser_context_t *context_p, const lexer_lit_location_t *right_ident_p); -bool lexer_compare_literal_to_identifier (parser_context_t *context_p, const char *identifier_p, - size_t identifier_length); -bool lexer_compare_literal_to_string (parser_context_t *context_p, const char *string_p, size_t string_length); -uint8_t lexer_convert_binary_lvalue_token_to_binary (uint8_t token); - -/** - * @} - * - * \addtogroup jsparser_expr Expression parser - * @{ - */ - -/* Parser functions. */ - -void parser_parse_block_expression (parser_context_t *context_p, int options); -void parser_parse_expression_statement (parser_context_t *context_p, int options); -void parser_parse_expression (parser_context_t *context_p, int options); -#if ENABLED (JERRY_ES2015_CLASS) -void parser_parse_class (parser_context_t *context_p, bool is_statement); -void parser_parse_super_class_context_start (parser_context_t *context_p); -void parser_parse_super_class_context_end (parser_context_t *context_p, bool is_statement); -#endif /* ENABLED (JERRY_ES2015_CLASS) */ - -/** - * @} - * - * \addtogroup jsparser_scanner Scanner - * @{ - */ - -void scanner_raise_error (parser_context_t *context_p); -void *scanner_malloc (parser_context_t *context_p, size_t size); -void scanner_free (void *ptr, size_t size); - -scanner_info_t *scanner_insert_info (parser_context_t *context_p, const uint8_t *source_p, size_t size); -void scanner_release_next (parser_context_t *context_p, size_t size); -void scanner_set_active (parser_context_t *context_p); -void scanner_release_active (parser_context_t *context_p, size_t size); -void scanner_release_switch_cases (scanner_case_info_t *case_p); -void scanner_seek (parser_context_t *context_p); -void scanner_reverse_info_list (parser_context_t *context_p); -void scanner_cleanup (parser_context_t *context_p); - -void scanner_get_location (scanner_location_t *location_p, parser_context_t *context_p); -void scanner_set_location (parser_context_t *context_p, scanner_location_t *location_p); - -void scanner_scan_all (parser_context_t *context_p, const uint8_t *arg_list_p, const uint8_t *arg_list_end_p, - const uint8_t *source_p, const uint8_t *source_end_p); - -/** - * @} - * - * \addtogroup jsparser_stmt Statement parser - * @{ - */ - -void parser_parse_statements (parser_context_t *context_p); -void parser_free_jumps (parser_stack_iterator_t iterator); - -#if ENABLED (JERRY_ES2015_MODULE_SYSTEM) -/** - * @} - * - * \addtogroup jsparser_stmt Module statement parser - * @{ - */ - -extern const lexer_lit_location_t lexer_default_literal; -void parser_module_add_export_node_to_context (parser_context_t *context_p); -void parser_module_add_import_node_to_context (parser_context_t *context_p); -void parser_module_check_request_place (parser_context_t *context_p); -void parser_module_context_init (void); -void parser_module_handle_module_specifier (parser_context_t *context_p); -void parser_module_handle_requests (parser_context_t *context_p); -void parser_module_parse_export_clause (parser_context_t *context_p); -void parser_module_parse_import_clause (parser_context_t *context_p); -void parser_module_set_default (parser_context_t *context_p); -ecma_module_node_t *parser_module_create_module_node (parser_context_t *context_p); -bool parser_module_check_duplicate_import (parser_context_t *context_p, ecma_string_t *local_name_p); -bool parser_module_check_duplicate_export (parser_context_t *context_p, ecma_string_t *export_name_p); -void parser_module_add_names_to_node (parser_context_t *context_p, - ecma_string_t *imex_name_p, - ecma_string_t *local_name_p); - -#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ - -/** - * @} - * - * \addtogroup jsparser_parser Parser - * @{ - */ - -ecma_compiled_code_t *parser_parse_function (parser_context_t *context_p, uint32_t status_flags); -#if ENABLED (JERRY_ES2015_ARROW_FUNCTION) -ecma_compiled_code_t *parser_parse_arrow_function (parser_context_t *context_p, uint32_t status_flags); -#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */ - -/* Error management. */ - -void parser_raise_error (parser_context_t *context_p, parser_error_t error); - -/* Debug functions. */ - -#if ENABLED (JERRY_DEBUGGER) - -void parser_append_breakpoint_info (parser_context_t *context_p, jerry_debugger_header_type_t type, uint32_t value); - -#endif /* ENABLED (JERRY_DEBUGGER) */ - -#if ENABLED (JERRY_LINE_INFO) - -void parser_emit_line_info (parser_context_t *context_p, uint32_t line, bool flush_cbc); - -#endif /* ENABLED (JERRY_LINE_INFO) */ - -/** - * @} - * @} - * @} - */ - -#endif /* !JS_PARSER_INTERNAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-parser-limits.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-parser-limits.h deleted file mode 100755 index 89ed26732..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-parser-limits.h +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JS_PARSER_LIMITS_H -#define JS_PARSER_LIMITS_H - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup jsparser JavaScript - * @{ - * - * \addtogroup jsparser_internals Internals - * @{ - */ - -/** - * Maximum identifier length accepted by the parser. - * Limit: LEXER_MAX_STRING_LENGTH. - */ -#ifndef PARSER_MAXIMUM_IDENT_LENGTH -#define PARSER_MAXIMUM_IDENT_LENGTH 255 -#endif /* !PARSER_MAXIMUM_IDENT_LENGTH */ - -/** - * Maximum string limit. - * Limit: 2147483647 / 65535. - */ -#if ENABLED (JERRY_CPOINTER_32_BIT) -#define PARSER_MAXIMUM_STRING_LIMIT 2147483647 -#else /* !ENABLED (JERRY_CPOINTER_32_BIT) */ -#define PARSER_MAXIMUM_STRING_LIMIT 65535 -#endif /* ENABLED (JERRY_CPOINTER_32_BIT) */ - -/** - * Maximum string length. - * Limit: PARSER_MAXIMUM_STRING_LIMIT. - */ -#ifndef PARSER_MAXIMUM_STRING_LENGTH -#define PARSER_MAXIMUM_STRING_LENGTH PARSER_MAXIMUM_STRING_LIMIT -#endif /* !PARSER_MAXIMUM_STRING_LENGTH */ - -/** - * Maximum number of literals. - * Limit: 32767. Recommended: 510, 32767 - */ -#ifndef PARSER_MAXIMUM_NUMBER_OF_LITERALS -#define PARSER_MAXIMUM_NUMBER_OF_LITERALS 32767 -#endif /* !PARSER_MAXIMUM_NUMBER_OF_LITERALS */ - -/** - * Maximum number of registers. - * Limit: PARSER_MAXIMUM_NUMBER_OF_LITERALS - */ -#ifndef PARSER_MAXIMUM_NUMBER_OF_REGISTERS -#define PARSER_MAXIMUM_NUMBER_OF_REGISTERS 256 -#endif /* !PARSER_MAXIMUM_NUMBER_OF_REGISTERS */ - -/** - * Maximum code size. - * Limit: 16777215. Recommended: 65535, 16777215. - */ -#ifndef PARSER_MAXIMUM_CODE_SIZE -#define PARSER_MAXIMUM_CODE_SIZE (65535 << (JMEM_ALIGNMENT_LOG)) -#endif /* !PARSER_MAXIMUM_CODE_SIZE */ - -/** - * Maximum number of values pushed onto the stack by a function. - * Limit: 65500. Recommended: 1024. - */ -#ifndef PARSER_MAXIMUM_STACK_LIMIT -#define PARSER_MAXIMUM_STACK_LIMIT 1024 - -#endif /* !PARSER_MAXIMUM_STACK_LIMIT */ - -/* Checks. */ - -#if (PARSER_MAXIMUM_STRING_LENGTH < 1) || (PARSER_MAXIMUM_STRING_LENGTH > PARSER_MAXIMUM_STRING_LIMIT) -#error "Maximum string length is not within range." -#endif /* (PARSER_MAXIMUM_STRING_LENGTH < 1) || (PARSER_MAXIMUM_STRING_LENGTH > PARSER_MAXIMUM_STRING_LIMIT) */ - -#if (PARSER_MAXIMUM_IDENT_LENGTH < 1) || (PARSER_MAXIMUM_IDENT_LENGTH > PARSER_MAXIMUM_STRING_LENGTH) -#error "Maximum identifier length is not within range." -#endif /* (PARSER_MAXIMUM_IDENT_LENGTH < 1) || (PARSER_MAXIMUM_IDENT_LENGTH > PARSER_MAXIMUM_STRING_LENGTH) */ - -#if (PARSER_MAXIMUM_NUMBER_OF_LITERALS < 1) || (PARSER_MAXIMUM_NUMBER_OF_LITERALS > 32767) -#error "Maximum number of literals is not within range." -#endif /* (PARSER_MAXIMUM_NUMBER_OF_LITERALS < 1) || (PARSER_MAXIMUM_NUMBER_OF_LITERALS > 32767) */ - -#if (PARSER_MAXIMUM_NUMBER_OF_REGISTERS > PARSER_MAXIMUM_NUMBER_OF_LITERALS) -#error "Maximum number of registers is not within range." -#endif /* (PARSER_MAXIMUM_NUMBER_OF_REGISTERS > PARSER_MAXIMUM_NUMBER_OF_LITERALS) */ - -#if (PARSER_MAXIMUM_CODE_SIZE < 4096) || (PARSER_MAXIMUM_CODE_SIZE > 16777215) -#error "Maximum code size is not within range." -#endif /* (PARSER_MAXIMUM_CODE_SIZE < 4096) || (PARSER_MAXIMUM_CODE_SIZE > 16777215) */ - -#if (PARSER_MAXIMUM_STACK_LIMIT < 16) || (PARSER_MAXIMUM_STACK_LIMIT > 65500) -#error "Maximum function stack usage is not within range." -#endif /* (PARSER_MAXIMUM_STACK_LIMIT < 16) || (PARSER_MAXIMUM_STACK_LIMIT > 65500) */ - -/** - * @} - * @} - * @} - */ - -#endif /* !JS_PARSER_LIMITS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-parser.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-parser.h deleted file mode 100755 index 599abeddc..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-parser.h +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JS_PARSER_H -#define JS_PARSER_H - -#include "ecma-globals.h" - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup jsparser JavaScript - * @{ - * - * \addtogroup jsparser_parser Parser - * @{ - */ - -/** - * Error codes. - */ -typedef enum -{ - PARSER_ERR_NO_ERROR, /**< no error */ - - PARSER_ERR_OUT_OF_MEMORY, /**< out of memory */ - PARSER_ERR_LITERAL_LIMIT_REACHED, /**< maximum number of literals reached */ - PARSER_ERR_ARGUMENT_LIMIT_REACHED, /**< maximum number of function arguments reached */ - PARSER_ERR_STACK_LIMIT_REACHED, /**< maximum function stack size reached */ - PARSER_ERR_REGISTER_LIMIT_REACHED, /**< maximum register size reached */ - - PARSER_ERR_INVALID_CHARACTER, /**< unexpected character */ - PARSER_ERR_INVALID_HEX_DIGIT, /**< invalid hexadecimal digit */ - PARSER_ERR_INVALID_ESCAPE_SEQUENCE, /**< invalid escape sequence */ - PARSER_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE, /**< invalid unicode escape sequence */ - PARSER_ERR_INVALID_IDENTIFIER_START, /**< character cannot be start of an identifier */ - PARSER_ERR_INVALID_IDENTIFIER_PART, /**< character cannot be part of an identifier */ - - PARSER_ERR_INVALID_NUMBER, /**< invalid number literal */ - PARSER_ERR_MISSING_EXPONENT, /**< missing exponent */ - PARSER_ERR_IDENTIFIER_AFTER_NUMBER, /**< identifier start after number */ - - PARSER_ERR_INVALID_REGEXP, /**< invalid regular expression */ - PARSER_ERR_UNKNOWN_REGEXP_FLAG, /**< unknown regexp flag */ - PARSER_ERR_DUPLICATED_REGEXP_FLAG, /**< duplicated regexp flag */ - PARSER_ERR_UNSUPPORTED_REGEXP, /**< regular expression is not supported */ - - PARSER_ERR_IDENTIFIER_TOO_LONG, /**< too long identifier */ - PARSER_ERR_STRING_TOO_LONG, /**< too long string literal */ - PARSER_ERR_NUMBER_TOO_LONG, /**< too long number literal */ - PARSER_ERR_REGEXP_TOO_LONG, /**< too long regexp literal */ - - PARSER_ERR_UNTERMINATED_MULTILINE_COMMENT, /**< unterminated multiline comment */ - PARSER_ERR_UNTERMINATED_STRING, /**< unterminated string literal */ - PARSER_ERR_UNTERMINATED_REGEXP, /**< unterminated regexp literal */ - - PARSER_ERR_NEWLINE_NOT_ALLOWED, /**< newline is not allowed */ - PARSER_ERR_OCTAL_NUMBER_NOT_ALLOWED, /**< octal numbers are not allowed in strict mode */ - PARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED, /**< octal escape sequences are not allowed in strict mode */ - PARSER_ERR_STRICT_IDENT_NOT_ALLOWED, /**< identifier name is reserved in strict mode */ - PARSER_ERR_EVAL_NOT_ALLOWED, /**< eval is not allowed here in strict mode */ - PARSER_ERR_ARGUMENTS_NOT_ALLOWED, /**< arguments is not allowed here in strict mode */ - PARSER_ERR_DELETE_IDENT_NOT_ALLOWED, /**< identifier delete is not allowed in strict mode */ - PARSER_ERR_EVAL_CANNOT_ASSIGNED, /**< eval cannot be assigned in strict mode */ - PARSER_ERR_ARGUMENTS_CANNOT_ASSIGNED, /**< arguments cannot be assigned in strict mode */ - PARSER_ERR_WITH_NOT_ALLOWED, /**< with statement is not allowed in strict mode */ - PARSER_ERR_MULTIPLE_DEFAULTS_NOT_ALLOWED, /**< multiple default cases are not allowed */ - PARSER_ERR_DEFAULT_NOT_IN_SWITCH, /**< default statement is not in switch block */ - PARSER_ERR_CASE_NOT_IN_SWITCH, /**< case statement is not in switch block */ -#if ENABLED (JERRY_ES2015_CLASS) - PARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS, /**< multiple class constructor */ - PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR, /**< class constructor cannot be an accessor */ - PARSER_ERR_CLASS_STATIC_PROTOTYPE, /**< static method name 'prototype' is not allowed */ - PARSER_ERR_UNEXPECTED_SUPER_REFERENCE, /**< unexpected super keyword */ -#endif /* ENABLED (JERRY_ES2015_CLASS) */ - - PARSER_ERR_LEFT_PAREN_EXPECTED, /**< left paren expected */ - PARSER_ERR_LEFT_BRACE_EXPECTED, /**< left brace expected */ - PARSER_ERR_RIGHT_PAREN_EXPECTED, /**< right paren expected */ - PARSER_ERR_RIGHT_SQUARE_EXPECTED, /**< right square expected */ - -#if ENABLED (JERRY_ES2015_TEMPLATE_STRINGS) - PARSER_ERR_RIGHT_BRACE_EXPECTED, /**< right brace expected */ -#endif /* ENABLED (JERRY_ES2015_TEMPLATE_STRINGS) */ - PARSER_ERR_COLON_EXPECTED, /**< colon expected */ - PARSER_ERR_COLON_FOR_CONDITIONAL_EXPECTED, /**< colon expected for conditional expression */ - PARSER_ERR_SEMICOLON_EXPECTED, /**< semicolon expected */ - PARSER_ERR_IN_EXPECTED, /**< in keyword expected */ -#if ENABLED (JERRY_ES2015_FOR_OF) - PARSER_ERR_OF_EXPECTED, /**< of keyword expected */ -#endif /* ENABLED (JERRY_ES2015_FOR_OF) */ - PARSER_ERR_WHILE_EXPECTED, /**< while expected for do-while loop */ - PARSER_ERR_CATCH_FINALLY_EXPECTED, /**< catch or finally expected */ - PARSER_ERR_ARRAY_ITEM_SEPARATOR_EXPECTED, /**< array item separator expected */ - PARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED, /**< object item separator expected */ - PARSER_ERR_IDENTIFIER_EXPECTED, /**< identifier expected */ - PARSER_ERR_EXPRESSION_EXPECTED, /**< expression expected */ - PARSER_ERR_PRIMARY_EXP_EXPECTED, /**< primary expression expected */ - PARSER_ERR_STATEMENT_EXPECTED, /**< statement expected */ - PARSER_ERR_PROPERTY_IDENTIFIER_EXPECTED, /**< property identifier expected */ - PARSER_ERR_ARGUMENT_LIST_EXPECTED, /**< argument list expected */ - PARSER_ERR_NO_ARGUMENTS_EXPECTED, /**< property getters must have no arguments */ - PARSER_ERR_ONE_ARGUMENT_EXPECTED, /**< property setters must have one argument */ - - PARSER_ERR_INVALID_EXPRESSION, /**< invalid expression */ - PARSER_ERR_INVALID_SWITCH, /**< invalid switch body */ - PARSER_ERR_INVALID_BREAK, /**< break must be inside a loop or switch */ - PARSER_ERR_INVALID_BREAK_LABEL, /**< break target not found */ - PARSER_ERR_INVALID_CONTINUE, /**< continue must be inside a loop */ - PARSER_ERR_INVALID_CONTINUE_LABEL, /**< continue target not found */ - PARSER_ERR_INVALID_RETURN, /**< return must be inside a function */ - PARSER_ERR_INVALID_RIGHT_SQUARE, /**< right square must terminate a block */ - PARSER_ERR_DUPLICATED_LABEL, /**< duplicated label */ -#if ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) || ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) - PARSER_ERR_DUPLICATED_ARGUMENT_NAMES, /**< duplicated argument names */ -#endif /* ENABLED (JERRY_ES2015_FUNCTION_PARAMETER_INITIALIZER) || ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) */ -#if ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) - PARSER_ERR_FORMAL_PARAM_AFTER_REST_PARAMETER, /**< formal parameter after rest parameter */ - PARSER_ERR_REST_PARAMETER_DEFAULT_INITIALIZER, /**< rest parameter default initializer */ -#endif /* ENABLED (JERRY_ES2015_FUNCTION_REST_PARAMETER) */ - PARSER_ERR_OBJECT_PROPERTY_REDEFINED, /**< property of object literal redefined */ - -#if ENABLED (JERRY_ES2015_MODULE_SYSTEM) - PARSER_ERR_FILE_NOT_FOUND, /**< file not found*/ - PARSER_ERR_FROM_EXPECTED, /**< from expected */ - PARSER_ERR_FROM_COMMA_EXPECTED, /**< from or comma expected */ - PARSER_ERR_AS_EXPECTED, /**< as expected */ - PARSER_ERR_STRING_EXPECTED, /**< string literal expected */ - PARSER_ERR_MODULE_UNEXPECTED, /**< unexpected import or export statement */ - PARSER_ERR_LEFT_BRACE_MULTIPLY_LITERAL_EXPECTED, /**< left brace or multiply or literal expected */ - PARSER_ERR_LEFT_BRACE_MULTIPLY_EXPECTED, /**< left brace or multiply expected */ - PARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED, /**< right brace or comma expected */ - PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER, /**< duplicated export identifier name */ - PARSER_ERR_DUPLICATED_IMPORT_BINDING, /**< duplicated import binding name */ -#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ - - PARSER_ERR_NON_STRICT_ARG_DEFINITION /**< non-strict argument definition */ -} parser_error_t; - -/** - * Source code line counter type. - */ -typedef uint32_t parser_line_counter_t; - -/** - * Error code location. - */ -typedef struct -{ - parser_error_t error; /**< error code */ - parser_line_counter_t line; /**< line where the error occured */ - parser_line_counter_t column; /**< column where the error occured */ -} parser_error_location_t; - -/* Note: source must be a valid UTF-8 string */ -ecma_value_t parser_parse_script (const uint8_t *arg_list_p, size_t arg_list_size, - const uint8_t *source_p, size_t source_size, - uint32_t parse_opts, ecma_compiled_code_t **bytecode_data_p); - -#if ENABLED (JERRY_ERROR_MESSAGES) -const char *parser_error_to_string (parser_error_t); -#endif /* ENABLED (JERRY_ERROR_MESSAGES) */ - -/** - * @} - * @} - * @} - */ - -#endif /* !JS_PARSER_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-scanner-internal.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-scanner-internal.h deleted file mode 100755 index ab1942c03..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-scanner-internal.h +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JS_SCANNER_INTERNAL_H -#define JS_SCANNER_INTERNAL_H - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup jsparser JavaScript - * @{ - * - * \addtogroup jsparser_scanner Scanner - * @{ - */ - -/** - * Generic descriptor which stores only the start position. - */ -typedef struct -{ - const uint8_t *source_p; /**< start source byte */ -} scanner_source_start_t; - -/** - * For statement descriptor. - */ -typedef struct -{ - /** shared fields of for statements */ - union - { - const uint8_t *source_p; /**< start source byte */ - scanner_for_info_t *for_info_p; /**< for info */ - } u; -} scanner_for_statement_t; - -/** - * Switch statement descriptor. - */ -typedef struct -{ - scanner_case_info_t **last_case_p; /**< last case info */ -} scanner_switch_statement_t; - -/** - * Scanner context. - */ -typedef struct -{ - uint8_t mode; /**< scanner mode */ - scanner_switch_statement_t active_switch_statement; /**< currently active switch statement */ -} scanner_context_t; - -/** - * @} - * @} - * @} - */ - -#endif /* !JS_SCANNER_INTERNAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-scanner.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-scanner.h deleted file mode 100755 index b44d0ebb6..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/js-scanner.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JS_SCANNER_H -#define JS_SCANNER_H - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup jsparser JavaScript - * @{ - * - * \addtogroup jsparser_scanner Scanner - * @{ - */ - -/** - * Allowed types for scanner_info_t structures. - */ -typedef enum -{ - SCANNER_TYPE_END, /**< mark the last info block */ - SCANNER_TYPE_END_ARGUMENTS, /**< mark the end of function arguments - * (only present if a function script is parsed) */ - SCANNER_TYPE_WHILE, /**< while statement */ - SCANNER_TYPE_FOR, /**< for statement */ - SCANNER_TYPE_FOR_IN, /**< for-in statement */ -#if ENABLED (JERRY_ES2015_FOR_OF) - SCANNER_TYPE_FOR_OF, /**< for-of statement */ -#endif /* ENABLED (JERRY_ES2015_FOR_OF) */ - SCANNER_TYPE_SWITCH, /**< switch statement */ - SCANNER_TYPE_CASE, /**< case statement */ -#if ENABLED (JERRY_ES2015_ARROW_FUNCTION) - SCANNER_TYPE_ARROW, /**< arrow function */ -#endif /* ENABLED (JERRY_ES2015_ARROW_FUNCTION) */ -} scanner_info_type_t; - -/** - * Source code location which can be used to change the position of parsing. - */ -typedef struct -{ - const uint8_t *source_p; /**< next source byte */ - parser_line_counter_t line; /**< token start line */ - parser_line_counter_t column; /**< token start column */ -} scanner_location_t; - -/** - * Scanner info blocks which provides information for the parser. - */ -typedef struct scanner_info_t -{ - struct scanner_info_t *next_p; /**< next info structure */ - const uint8_t *source_p; /**< triggering position of this scanner info */ - uint8_t type; /**< type of the scanner info */ -} scanner_info_t; - -/** - * Scanner info extended with a location. - */ -typedef struct -{ - scanner_info_t info; /**< header */ - scanner_location_t location; /**< location */ -} scanner_location_info_t; - -/** - * Scanner info for "for" statements. - */ -typedef struct -{ - scanner_info_t info; /**< header */ - scanner_location_t expression_location; /**< location of expression start */ - scanner_location_t end_location; /**< location of expression end */ -} scanner_for_info_t; - -/** - * Case statement list for scanner_switch_info_t structure. - */ -typedef struct scanner_case_info_t -{ - struct scanner_case_info_t *next_p; /**< next case statement info */ - scanner_location_t location; /**< location of case statement */ -} scanner_case_info_t; - -/** - * Scanner info for "switch" statements. - */ -typedef struct -{ - scanner_info_t info; /**< header */ - scanner_case_info_t *case_p; /**< list of switch cases */ -} scanner_switch_info_t; - -/** - * @} - * @} - * @} - */ - -#endif /* !JS_SCANNER_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-char-helpers.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-char-helpers.h deleted file mode 100755 index 08c0439a0..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-char-helpers.h +++ /dev/null @@ -1,247 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef LIT_CHAR_HELPERS_H -#define LIT_CHAR_HELPERS_H - -#include "lit-globals.h" - -#define LIT_CHAR_UNDEF ((ecma_char_t) 0xFFFF) /* undefined character */ - -/* - * Format control characters (ECMA-262 v5, Table 1) - */ -#define LIT_CHAR_ZWNJ ((ecma_char_t) 0x200C) /* zero width non-joiner */ -#define LIT_CHAR_ZWJ ((ecma_char_t) 0x200D) /* zero width joiner */ -#define LIT_CHAR_BOM ((ecma_char_t) 0xFEFF) /* byte order mark */ - -/* - * Whitespace characters (ECMA-262 v5, Table 2) - */ -#define LIT_CHAR_TAB ((ecma_char_t) 0x0009) /* tab */ -#define LIT_CHAR_VTAB ((ecma_char_t) 0x000B) /* vertical tab */ -#define LIT_CHAR_FF ((ecma_char_t) 0x000C) /* form feed */ -#define LIT_CHAR_SP ((ecma_char_t) 0x0020) /* space */ -#define LIT_CHAR_NBSP ((ecma_char_t) 0x00A0) /* no-break space */ -/* LIT_CHAR_BOM is defined above */ - -bool lit_char_is_white_space (ecma_char_t c); - -/* - * Line terminator characters (ECMA-262 v5, Table 3) - */ -#define LIT_CHAR_LF ((ecma_char_t) 0x000A) /* line feed */ -#define LIT_CHAR_CR ((ecma_char_t) 0x000D) /* carriage return */ -#define LIT_CHAR_LS ((ecma_char_t) 0x2028) /* line separator */ -#define LIT_CHAR_PS ((ecma_char_t) 0x2029) /* paragraph separator */ - -bool lit_char_is_line_terminator (ecma_char_t c); - -/* - * String Single Character Escape Sequences (ECMA-262 v5, Table 4) - */ -#define LIT_CHAR_BS ((ecma_char_t) 0x0008) /* backspace */ -/* LIT_CHAR_TAB is defined above */ -/* LIT_CHAR_LF is defined above */ -/* LIT_CHAR_VTAB is defined above */ -/* LIT_CHAR_FF is defined above */ -/* LIT_CHAR_CR is defined above */ -#define LIT_CHAR_DOUBLE_QUOTE ((ecma_char_t) '"') /* double quote */ -#define LIT_CHAR_SINGLE_QUOTE ((ecma_char_t) '\'') /* single quote */ -#define LIT_CHAR_BACKSLASH ((ecma_char_t) '\\') /* reverse solidus (backslash) */ - -/* - * Comment characters (ECMA-262 v5, 7.4) - */ -#define LIT_CHAR_SLASH ((ecma_char_t) '/') /* solidus */ -#define LIT_CHAR_ASTERISK ((ecma_char_t) '*') /* asterisk */ - -/* - * Identifier name characters (ECMA-262 v5, 7.6) - */ -#define LIT_CHAR_DOLLAR_SIGN ((ecma_char_t) '$') /* dollar sign */ -#define LIT_CHAR_UNDERSCORE ((ecma_char_t) '_') /* low line (underscore) */ -/* LIT_CHAR_BACKSLASH defined above */ - -bool lit_char_is_identifier_start (const uint8_t *src_p); -bool lit_char_is_identifier_part (const uint8_t *src_p); -bool lit_char_is_identifier_start_character (ecma_char_t chr); -bool lit_char_is_identifier_part_character (ecma_char_t chr); - -/* - * Punctuator characters (ECMA-262 v5, 7.7) - */ -#define LIT_CHAR_LEFT_BRACE ((ecma_char_t) '{') /* left curly bracket */ -#define LIT_CHAR_RIGHT_BRACE ((ecma_char_t) '}') /* right curly bracket */ -#define LIT_CHAR_LEFT_PAREN ((ecma_char_t) '(') /* left parenthesis */ -#define LIT_CHAR_RIGHT_PAREN ((ecma_char_t) ')') /* right parenthesis */ -#define LIT_CHAR_LEFT_SQUARE ((ecma_char_t) '[') /* left square bracket */ -#define LIT_CHAR_RIGHT_SQUARE ((ecma_char_t) ']') /* right square bracket */ -#define LIT_CHAR_DOT ((ecma_char_t) '.') /* dot */ -#define LIT_CHAR_SEMICOLON ((ecma_char_t) ';') /* semicolon */ -#define LIT_CHAR_COMMA ((ecma_char_t) ',') /* comma */ -#define LIT_CHAR_LESS_THAN ((ecma_char_t) '<') /* less-than sign */ -#define LIT_CHAR_GREATER_THAN ((ecma_char_t) '>') /* greater-than sign */ -#define LIT_CHAR_EQUALS ((ecma_char_t) '=') /* equals sign */ -#define LIT_CHAR_PLUS ((ecma_char_t) '+') /* plus sign */ -#define LIT_CHAR_MINUS ((ecma_char_t) '-') /* hyphen-minus */ -/* LIT_CHAR_ASTERISK is defined above */ -#define LIT_CHAR_PERCENT ((ecma_char_t) '%') /* percent sign */ -#define LIT_CHAR_AMPERSAND ((ecma_char_t) '&') /* ampersand */ -#define LIT_CHAR_VLINE ((ecma_char_t) '|') /* vertical line */ -#define LIT_CHAR_CIRCUMFLEX ((ecma_char_t) '^') /* circumflex accent */ -#define LIT_CHAR_EXCLAMATION ((ecma_char_t) '!') /* exclamation mark */ -#define LIT_CHAR_TILDE ((ecma_char_t) '~') /* tilde */ -#define LIT_CHAR_QUESTION ((ecma_char_t) '?') /* question mark */ -#define LIT_CHAR_COLON ((ecma_char_t) ':') /* colon */ - -/* - * Special characters for String.prototype.replace. - */ -#define LIT_CHAR_GRAVE_ACCENT ((ecma_char_t) '`') /* grave accent */ - -/** - * Uppercase ASCII letters - */ -#define LIT_CHAR_UPPERCASE_A ((ecma_char_t) 'A') -#define LIT_CHAR_UPPERCASE_B ((ecma_char_t) 'B') -#define LIT_CHAR_UPPERCASE_C ((ecma_char_t) 'C') -#define LIT_CHAR_UPPERCASE_D ((ecma_char_t) 'D') -#define LIT_CHAR_UPPERCASE_E ((ecma_char_t) 'E') -#define LIT_CHAR_UPPERCASE_F ((ecma_char_t) 'F') -#define LIT_CHAR_UPPERCASE_G ((ecma_char_t) 'G') -#define LIT_CHAR_UPPERCASE_H ((ecma_char_t) 'H') -#define LIT_CHAR_UPPERCASE_I ((ecma_char_t) 'I') -#define LIT_CHAR_UPPERCASE_J ((ecma_char_t) 'J') -#define LIT_CHAR_UPPERCASE_K ((ecma_char_t) 'K') -#define LIT_CHAR_UPPERCASE_L ((ecma_char_t) 'L') -#define LIT_CHAR_UPPERCASE_M ((ecma_char_t) 'M') -#define LIT_CHAR_UPPERCASE_N ((ecma_char_t) 'N') -#define LIT_CHAR_UPPERCASE_O ((ecma_char_t) 'O') -#define LIT_CHAR_UPPERCASE_P ((ecma_char_t) 'P') -#define LIT_CHAR_UPPERCASE_Q ((ecma_char_t) 'Q') -#define LIT_CHAR_UPPERCASE_R ((ecma_char_t) 'R') -#define LIT_CHAR_UPPERCASE_S ((ecma_char_t) 'S') -#define LIT_CHAR_UPPERCASE_T ((ecma_char_t) 'T') -#define LIT_CHAR_UPPERCASE_U ((ecma_char_t) 'U') -#define LIT_CHAR_UPPERCASE_V ((ecma_char_t) 'V') -#define LIT_CHAR_UPPERCASE_W ((ecma_char_t) 'W') -#define LIT_CHAR_UPPERCASE_X ((ecma_char_t) 'X') -#define LIT_CHAR_UPPERCASE_Y ((ecma_char_t) 'Y') -#define LIT_CHAR_UPPERCASE_Z ((ecma_char_t) 'Z') - -/** - * Lowercase ASCII letters - */ -#define LIT_CHAR_LOWERCASE_A ((ecma_char_t) 'a') -#define LIT_CHAR_LOWERCASE_B ((ecma_char_t) 'b') -#define LIT_CHAR_LOWERCASE_C ((ecma_char_t) 'c') -#define LIT_CHAR_LOWERCASE_D ((ecma_char_t) 'd') -#define LIT_CHAR_LOWERCASE_E ((ecma_char_t) 'e') -#define LIT_CHAR_LOWERCASE_F ((ecma_char_t) 'f') -#define LIT_CHAR_LOWERCASE_G ((ecma_char_t) 'g') -#define LIT_CHAR_LOWERCASE_H ((ecma_char_t) 'h') -#define LIT_CHAR_LOWERCASE_I ((ecma_char_t) 'i') -#define LIT_CHAR_LOWERCASE_J ((ecma_char_t) 'j') -#define LIT_CHAR_LOWERCASE_K ((ecma_char_t) 'k') -#define LIT_CHAR_LOWERCASE_L ((ecma_char_t) 'l') -#define LIT_CHAR_LOWERCASE_M ((ecma_char_t) 'm') -#define LIT_CHAR_LOWERCASE_N ((ecma_char_t) 'n') -#define LIT_CHAR_LOWERCASE_O ((ecma_char_t) 'o') -#define LIT_CHAR_LOWERCASE_P ((ecma_char_t) 'p') -#define LIT_CHAR_LOWERCASE_Q ((ecma_char_t) 'q') -#define LIT_CHAR_LOWERCASE_R ((ecma_char_t) 'r') -#define LIT_CHAR_LOWERCASE_S ((ecma_char_t) 's') -#define LIT_CHAR_LOWERCASE_T ((ecma_char_t) 't') -#define LIT_CHAR_LOWERCASE_U ((ecma_char_t) 'u') -#define LIT_CHAR_LOWERCASE_V ((ecma_char_t) 'v') -#define LIT_CHAR_LOWERCASE_W ((ecma_char_t) 'w') -#define LIT_CHAR_LOWERCASE_X ((ecma_char_t) 'x') -#define LIT_CHAR_LOWERCASE_Y ((ecma_char_t) 'y') -#define LIT_CHAR_LOWERCASE_Z ((ecma_char_t) 'z') - -/** - * ASCII decimal digits - */ -#define LIT_CHAR_0 ((ecma_char_t) '0') -#define LIT_CHAR_1 ((ecma_char_t) '1') -#define LIT_CHAR_2 ((ecma_char_t) '2') -#define LIT_CHAR_3 ((ecma_char_t) '3') -#define LIT_CHAR_4 ((ecma_char_t) '4') -#define LIT_CHAR_5 ((ecma_char_t) '5') -#define LIT_CHAR_6 ((ecma_char_t) '6') -#define LIT_CHAR_7 ((ecma_char_t) '7') -#define LIT_CHAR_8 ((ecma_char_t) '8') -#define LIT_CHAR_9 ((ecma_char_t) '9') - -/** - * ASCII character ranges - */ -#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_BEGIN LIT_CHAR_UPPERCASE_A /* uppercase letters range */ -#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_END LIT_CHAR_UPPERCASE_Z - -#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_BEGIN LIT_CHAR_LOWERCASE_A /* lowercase letters range */ -#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_END LIT_CHAR_LOWERCASE_Z - -#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_HEX_BEGIN LIT_CHAR_UPPERCASE_A /* uppercase letters for - * hexadecimal digits range */ -#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_HEX_END LIT_CHAR_UPPERCASE_F - -#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_BEGIN LIT_CHAR_LOWERCASE_A /* lowercase letters for - * hexadecimal digits range */ -#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_END LIT_CHAR_LOWERCASE_F - -#define LIT_CHAR_ASCII_OCTAL_DIGITS_BEGIN LIT_CHAR_0 /* octal digits range */ -#define LIT_CHAR_ASCII_OCTAL_DIGITS_END LIT_CHAR_7 - -#define LIT_CHAR_ASCII_DIGITS_BEGIN LIT_CHAR_0 /* decimal digits range */ -#define LIT_CHAR_ASCII_DIGITS_END LIT_CHAR_9 - -#define LEXER_TO_ASCII_LOWERCASE(character) ((character) | LIT_CHAR_SP) - -bool lit_char_is_octal_digit (ecma_char_t c); -bool lit_char_is_decimal_digit (ecma_char_t c); -bool lit_char_is_hex_digit (ecma_char_t c); -uint32_t lit_char_hex_to_int (ecma_char_t c); -size_t lit_char_to_utf8_bytes (uint8_t *dst_p, ecma_char_t chr); -size_t lit_char_get_utf8_length (ecma_char_t chr); - -/* read a hex encoded code point from a zero terminated buffer */ -bool lit_read_code_unit_from_hex (const lit_utf8_byte_t *buf_p, lit_utf8_size_t number_of_characters, - ecma_char_t *out_code_unit_p); - -/** - * Null character - */ -#define LIT_CHAR_NULL ((ecma_char_t) '\0') - -/* - * Part of IsWordChar abstract operation (ECMA-262 v5, 15.10.2.6, step 3) - */ -bool lit_char_is_word_char (ecma_char_t c); - -/* - * Utility functions for uppercasing / lowercasing - */ - -/** - * Minimum buffer size for lit_char_to_lower_case / lit_char_to_upper_case functions. - */ -#define LIT_MAXIMUM_OTHER_CASE_LENGTH (3) - -ecma_length_t lit_char_to_lower_case (ecma_char_t character, ecma_char_t *output_buffer_p, ecma_length_t buffer_size); -ecma_length_t lit_char_to_upper_case (ecma_char_t character, ecma_char_t *output_buffer_p, ecma_length_t buffer_size); - -#endif /* !LIT_CHAR_HELPERS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-strings.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-strings.h deleted file mode 100755 index 208108bde..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-strings.h +++ /dev/null @@ -1,143 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef LIT_STRINGS_H -#define LIT_STRINGS_H - -#include "jrt.h" -#include "lit-globals.h" - -/** - * Null character (used in few cases as utf-8 string end marker) - */ -#define LIT_BYTE_NULL (0) - -/** - * For the formal definition of Unicode transformation formats (UTF) see Section 3.9, Unicode Encoding Forms in The - * Unicode Standard (http://www.unicode.org/versions/Unicode3.0.0/ch03.pdf#G7404). - */ -#define LIT_UNICODE_CODE_POINT_NULL (0x0) -#define LIT_UNICODE_CODE_POINT_MAX (0x10FFFF) - -#define LIT_UTF16_CODE_UNIT_MAX (0xFFFF) -#define LIT_UTF16_FIRST_SURROGATE_CODE_POINT (0x10000) -#define LIT_UTF16_LOW_SURROGATE_MARKER (0xDC00) -#define LIT_UTF16_HIGH_SURROGATE_MARKER (0xD800) -#define LIT_UTF16_HIGH_SURROGATE_MIN (0xD800) -#define LIT_UTF16_HIGH_SURROGATE_MAX (0xDBFF) -#define LIT_UTF16_LOW_SURROGATE_MIN (0xDC00) -#define LIT_UTF16_LOW_SURROGATE_MAX (0xDFFF) -#define LIT_UTF16_BITS_IN_SURROGATE (10) -#define LIT_UTF16_LAST_10_BITS_MASK (0x3FF) - -#define LIT_UTF8_1_BYTE_MARKER (0x00) -#define LIT_UTF8_2_BYTE_MARKER (0xC0) -#define LIT_UTF8_3_BYTE_MARKER (0xE0) -#define LIT_UTF8_4_BYTE_MARKER (0xF0) -#define LIT_UTF8_5_BYTE_MARKER (0xF8) -#define LIT_UTF8_EXTRA_BYTE_MARKER (0x80) - -#define LIT_UTF8_1_BYTE_MASK (0x80) -#define LIT_UTF8_2_BYTE_MASK (0xE0) -#define LIT_UTF8_3_BYTE_MASK (0xF0) -#define LIT_UTF8_4_BYTE_MASK (0xF8) -#define LIT_UTF8_EXTRA_BYTE_MASK (0xC0) - -#define LIT_UTF8_LAST_7_BITS_MASK (0x7F) -#define LIT_UTF8_LAST_6_BITS_MASK (0x3F) -#define LIT_UTF8_LAST_5_BITS_MASK (0x1F) -#define LIT_UTF8_LAST_4_BITS_MASK (0x0F) -#define LIT_UTF8_LAST_3_BITS_MASK (0x07) -#define LIT_UTF8_LAST_2_BITS_MASK (0x03) -#define LIT_UTF8_LAST_1_BIT_MASK (0x01) - -#define LIT_UTF8_BITS_IN_EXTRA_BYTES (6) - -#define LIT_UTF8_1_BYTE_CODE_POINT_MAX (0x7F) -#define LIT_UTF8_2_BYTE_CODE_POINT_MIN (0x80) -#define LIT_UTF8_2_BYTE_CODE_POINT_MAX (0x7FF) -#define LIT_UTF8_3_BYTE_CODE_POINT_MIN (0x800) -#define LIT_UTF8_3_BYTE_CODE_POINT_MAX (LIT_UTF16_CODE_UNIT_MAX) -#define LIT_UTF8_4_BYTE_CODE_POINT_MIN (0x10000) -#define LIT_UTF8_4_BYTE_CODE_POINT_MAX (LIT_UNICODE_CODE_POINT_MAX) - -/** - * Differnce between byte count needed to represent code point greater than 0xFFFF - * in common UTF-8 (4 bytes required) and CESU-8 (6 bytes required) - */ -#define LIT_UTF8_CESU8_SURROGATE_SIZE_DIF (2 * LIT_UTF8_MAX_BYTES_IN_CODE_UNIT - LIT_UTF8_MAX_BYTES_IN_CODE_POINT) - -/** - * Byte values >= LIT_UTF8_FIRST_BYTE_MAX are not allowed in internal strings - */ -#define LIT_UTF8_FIRST_BYTE_MAX LIT_UTF8_5_BYTE_MARKER - -/* validation */ -bool lit_is_valid_utf8_string (const lit_utf8_byte_t *utf8_buf_p, lit_utf8_size_t buf_size); -bool lit_is_valid_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, lit_utf8_size_t buf_size); - -/* checks */ -bool lit_is_code_point_utf16_low_surrogate (lit_code_point_t code_point); -bool lit_is_code_point_utf16_high_surrogate (lit_code_point_t code_point); - -/* size */ -lit_utf8_size_t lit_zt_utf8_string_size (const lit_utf8_byte_t *utf8_str_p); -lit_utf8_size_t lit_get_utf8_size_of_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, lit_utf8_size_t cesu8_buf_size); - -/* length */ -ecma_length_t lit_utf8_string_length (const lit_utf8_byte_t *utf8_buf_p, lit_utf8_size_t utf8_buf_size); -ecma_length_t lit_get_utf8_length_of_cesu8_string (const lit_utf8_byte_t *cesu8_buf_p, lit_utf8_size_t cesu8_buf_size); - -/* hash */ -lit_string_hash_t lit_utf8_string_calc_hash (const lit_utf8_byte_t *utf8_buf_p, lit_utf8_size_t utf8_buf_size); -lit_string_hash_t lit_utf8_string_hash_combine (lit_string_hash_t hash_basis, const lit_utf8_byte_t *utf8_buf_p, - lit_utf8_size_t utf8_buf_size); - -/* code unit access */ -ecma_char_t lit_utf8_string_code_unit_at (const lit_utf8_byte_t *utf8_buf_p, lit_utf8_size_t utf8_buf_size, - ecma_length_t code_unit_offset); -lit_utf8_size_t lit_get_unicode_char_size_by_utf8_first_byte (const lit_utf8_byte_t first_byte); - -/* conversion */ -lit_utf8_size_t lit_code_unit_to_utf8 (ecma_char_t code_unit, lit_utf8_byte_t *buf_p); -lit_utf8_size_t lit_code_point_to_utf8 (lit_code_point_t code_point, lit_utf8_byte_t *buf); -lit_utf8_size_t lit_code_point_to_cesu8 (lit_code_point_t code_point, lit_utf8_byte_t *buf); -lit_utf8_size_t lit_convert_cesu8_string_to_utf8_string (const lit_utf8_byte_t *cesu8_string, - lit_utf8_size_t cesu8_size, - lit_utf8_byte_t *utf8_string, - lit_utf8_size_t utf8_size); -lit_code_point_t lit_convert_surrogate_pair_to_code_point (ecma_char_t high_surrogate, ecma_char_t low_surrogate); - -bool lit_compare_utf8_strings_relational (const lit_utf8_byte_t *string1_p, lit_utf8_size_t string1_size, - const lit_utf8_byte_t *string2_p, lit_utf8_size_t string2_size); - -/* read code point from buffer */ -lit_utf8_size_t lit_read_code_point_from_utf8 (const lit_utf8_byte_t *buf_p, lit_utf8_size_t buf_size, - lit_code_point_t *code_point); - -lit_utf8_size_t lit_read_code_unit_from_utf8 (const lit_utf8_byte_t *buf_p, - ecma_char_t *code_point); - -lit_utf8_size_t lit_read_prev_code_unit_from_utf8 (const lit_utf8_byte_t *buf_p, - ecma_char_t *code_point); - -ecma_char_t lit_utf8_read_next (const lit_utf8_byte_t **buf_p); -ecma_char_t lit_utf8_read_prev (const lit_utf8_byte_t **buf_p); -ecma_char_t lit_utf8_peek_next (const lit_utf8_byte_t *buf_p); -ecma_char_t lit_utf8_peek_prev (const lit_utf8_byte_t *buf_p); -void lit_utf8_incr (const lit_utf8_byte_t **buf_p); -void lit_utf8_decr (const lit_utf8_byte_t **buf_p); - -#endif /* !LIT_STRINGS_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-unicode-conversions.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-unicode-conversions.inc.h deleted file mode 100755 index 1398597ef..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-unicode-conversions.inc.h +++ /dev/null @@ -1,162 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* This file is automatically generated by the gen-unicode.py script - * from UnicodeData-9.0.0.txt and SpecialCasing-9.0.0.txt files. Do not edit! */ - -/* Contains start points of character case ranges (these are bidirectional conversions). */ -static const uint16_t lit_character_case_ranges[] JERRY_ATTR_CONST_DATA = -{ - 0x00c0, 0x00e0, 0x00d8, 0x00f8, 0x0189, 0x0256, 0x01b1, 0x028a, 0x0388, 0x03ad, - 0x038e, 0x03cd, 0x0391, 0x03b1, 0x03a3, 0x03c3, 0x03fd, 0x037b, 0x0400, 0x0450, - 0x0410, 0x0430, 0x0531, 0x0561, 0x10a0, 0x2d00, 0x13a0, 0xab70, 0x13f0, 0x13f8, - 0x1f08, 0x1f00, 0x1f18, 0x1f10, 0x1f28, 0x1f20, 0x1f38, 0x1f30, 0x1f48, 0x1f40, - 0x1f68, 0x1f60, 0x1fb8, 0x1fb0, 0x1fba, 0x1f70, 0x1fc8, 0x1f72, 0x1fd8, 0x1fd0, - 0x1fda, 0x1f76, 0x1fe8, 0x1fe0, 0x1fea, 0x1f7a, 0x1ff8, 0x1f78, 0x1ffa, 0x1f7c, - 0x2160, 0x2170, 0x24b6, 0x24d0, 0x2c00, 0x2c30, 0x2c7e, 0x023f, 0xff21, 0xff41 -}; - -/* Interval lengths of start points in `character_case_ranges` table. */ -static const uint8_t lit_character_case_range_lengths[] JERRY_ATTR_CONST_DATA = -{ - 0x0017, 0x0007, 0x0002, 0x0002, 0x0003, 0x0002, 0x0011, 0x0009, 0x0003, 0x0010, - 0x0020, 0x0026, 0x0026, 0x0050, 0x0006, 0x0008, 0x0006, 0x0008, 0x0008, 0x0006, - 0x0008, 0x0002, 0x0002, 0x0004, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, - 0x0010, 0x001a, 0x002f, 0x0002, 0x001a -}; - -/* Contains the start points of bidirectional conversion ranges. */ -static const uint16_t lit_character_pair_ranges[] JERRY_ATTR_CONST_DATA = -{ - 0x0100, 0x0132, 0x0139, 0x014a, 0x0179, 0x0182, 0x0187, 0x018b, 0x0191, 0x0198, - 0x01a0, 0x01a7, 0x01ac, 0x01af, 0x01b3, 0x01b8, 0x01bc, 0x01cd, 0x01de, 0x01f4, - 0x01f8, 0x0222, 0x023b, 0x0241, 0x0246, 0x0370, 0x0376, 0x03d8, 0x03f7, 0x03fa, - 0x0460, 0x048a, 0x04c1, 0x04d0, 0x1e00, 0x1ea0, 0x2183, 0x2c60, 0x2c67, 0x2c72, - 0x2c75, 0x2c80, 0x2ceb, 0x2cf2, 0xa640, 0xa680, 0xa722, 0xa732, 0xa779, 0xa77e, - 0xa78b, 0xa790, 0xa796, 0xa7b4 -}; - -/* Interval lengths of start points in `character_pair_ranges` table. */ -static const uint8_t lit_character_pair_range_lengths[] JERRY_ATTR_CONST_DATA = -{ - 0x0030, 0x0006, 0x0010, 0x002e, 0x0006, 0x0004, 0x0002, 0x0002, 0x0002, 0x0002, - 0x0006, 0x0002, 0x0002, 0x0002, 0x0004, 0x0002, 0x0002, 0x0010, 0x0012, 0x0002, - 0x0028, 0x0012, 0x0002, 0x0002, 0x000a, 0x0004, 0x0002, 0x0018, 0x0002, 0x0002, - 0x0022, 0x0036, 0x000e, 0x0060, 0x0096, 0x0060, 0x0002, 0x0002, 0x0006, 0x0002, - 0x0002, 0x0064, 0x0004, 0x0002, 0x002e, 0x001c, 0x000e, 0x003e, 0x0004, 0x000a, - 0x0002, 0x0004, 0x0014, 0x0004 -}; - -/* Contains lower/upper case bidirectional conversion pairs. */ -static const uint16_t lit_character_pairs[] JERRY_ATTR_CONST_DATA = -{ - 0x0178, 0x00ff, 0x0181, 0x0253, 0x0186, 0x0254, 0x018e, 0x01dd, 0x018f, 0x0259, - 0x0190, 0x025b, 0x0193, 0x0260, 0x0194, 0x0263, 0x0196, 0x0269, 0x0197, 0x0268, - 0x019c, 0x026f, 0x019d, 0x0272, 0x019f, 0x0275, 0x01a6, 0x0280, 0x01a9, 0x0283, - 0x01ae, 0x0288, 0x01b7, 0x0292, 0x01c4, 0x01c6, 0x01c7, 0x01c9, 0x01ca, 0x01cc, - 0x01f1, 0x01f3, 0x01f6, 0x0195, 0x01f7, 0x01bf, 0x0220, 0x019e, 0x023a, 0x2c65, - 0x023d, 0x019a, 0x023e, 0x2c66, 0x0243, 0x0180, 0x0244, 0x0289, 0x0245, 0x028c, - 0x037f, 0x03f3, 0x0386, 0x03ac, 0x038c, 0x03cc, 0x03cf, 0x03d7, 0x03f9, 0x03f2, - 0x04c0, 0x04cf, 0x10c7, 0x2d27, 0x10cd, 0x2d2d, 0x1f59, 0x1f51, 0x1f5b, 0x1f53, - 0x1f5d, 0x1f55, 0x1f5f, 0x1f57, 0x1fec, 0x1fe5, 0x2132, 0x214e, 0x2c62, 0x026b, - 0x2c63, 0x1d7d, 0x2c64, 0x027d, 0x2c6d, 0x0251, 0x2c6e, 0x0271, 0x2c6f, 0x0250, - 0x2c70, 0x0252, 0xa77d, 0x1d79, 0xa78d, 0x0265, 0xa7aa, 0x0266, 0xa7ab, 0x025c, - 0xa7ac, 0x0261, 0xa7ad, 0x026c, 0xa7ae, 0x026a, 0xa7b0, 0x029e, 0xa7b1, 0x0287, - 0xa7b2, 0x029d, 0xa7b3, 0xab53 -}; - -/* Contains start points of one-to-two uppercase ranges where the second character - * is always the same. - */ -static const uint16_t lit_upper_case_special_ranges[] JERRY_ATTR_CONST_DATA = -{ - 0x1f80, 0x1f08, 0x0399, 0x1f88, 0x1f08, 0x0399, 0x1f90, 0x1f28, 0x0399, 0x1f98, - 0x1f28, 0x0399, 0x1fa0, 0x1f68, 0x0399, 0x1fa8, 0x1f68, 0x0399 -}; - -/* Interval lengths for start points in `upper_case_special_ranges` table. */ -static const uint8_t lit_upper_case_special_range_lengths[] JERRY_ATTR_CONST_DATA = -{ - 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007 -}; - -/* Contains start points of lowercase ranges. */ -static const uint16_t lit_lower_case_ranges[] JERRY_ATTR_CONST_DATA = -{ - 0x1e96, 0x1e96, 0x1f80, 0x1f80, 0x1f88, 0x1f80, 0x1f90, 0x1f90, 0x1f98, 0x1f90, - 0x1fa0, 0x1fa0, 0x1fa8, 0x1fa0, 0x1fb2, 0x1fb2, 0x1fb6, 0x1fb6, 0x1fc2, 0x1fc2, - 0x1fc6, 0x1fc6, 0x1fd2, 0x1fd2, 0x1fd6, 0x1fd6, 0x1fe2, 0x1fe2, 0x1fe6, 0x1fe6, - 0x1ff2, 0x1ff2, 0x1ff6, 0x1ff6, 0xfb00, 0xfb00, 0xfb13, 0xfb13 -}; - -/* Interval lengths for start points in `lower_case_ranges` table. */ -static const uint8_t lit_lower_case_range_lengths[] JERRY_ATTR_CONST_DATA = -{ - 0x0005, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0008, 0x0003, 0x0002, 0x0003, - 0x0002, 0x0002, 0x0002, 0x0003, 0x0002, 0x0003, 0x0002, 0x0007, 0x0005 -}; - -/* The remaining lowercase conversions. The lowercase variant can be one-to-three character long. */ -static const uint16_t lit_lower_case_conversions[] JERRY_ATTR_CONST_DATA = -{ - 0x00df, 0x00df, 0x0149, 0x0149, 0x01c5, 0x01c6, 0x01c8, 0x01c9, 0x01cb, 0x01cc, - 0x01f0, 0x01f0, 0x01f2, 0x01f3, 0x0390, 0x0390, 0x03b0, 0x03b0, 0x03f4, 0x03b8, - 0x0587, 0x0587, 0x1e9e, 0x00df, 0x1f50, 0x1f50, 0x1f52, 0x1f52, 0x1f54, 0x1f54, - 0x1f56, 0x1f56, 0x1fbc, 0x1fb3, 0x1fcc, 0x1fc3, 0x1ffc, 0x1ff3, 0x2126, 0x03c9, - 0x212a, 0x006b, 0x212b, 0x00e5, 0x0130, 0x0069, 0x0307 -}; - -/* Number of one-to-one, one-to-two, and one-to-three lowercase conversions. */ -static const uint8_t lit_lower_case_conversion_counters[] JERRY_ATTR_CONST_DATA = -{ - 0x0016, 0x0001, 0x0000 -}; - -/* The remaining uppercase conversions. The uppercase variant can be one-to-three character long. */ -static const uint16_t lit_upper_case_conversions[] JERRY_ATTR_CONST_DATA = -{ - 0x00b5, 0x039c, 0x0130, 0x0130, 0x0131, 0x0049, 0x017f, 0x0053, 0x01c5, 0x01c4, - 0x01c8, 0x01c7, 0x01cb, 0x01ca, 0x01f2, 0x01f1, 0x0345, 0x0399, 0x03c2, 0x03a3, - 0x03d0, 0x0392, 0x03d1, 0x0398, 0x03d5, 0x03a6, 0x03d6, 0x03a0, 0x03f0, 0x039a, - 0x03f1, 0x03a1, 0x03f5, 0x0395, 0x1c80, 0x0412, 0x1c81, 0x0414, 0x1c82, 0x041e, - 0x1c83, 0x0421, 0x1c84, 0x0422, 0x1c85, 0x0422, 0x1c86, 0x042a, 0x1c87, 0x0462, - 0x1c88, 0xa64a, 0x1e9b, 0x1e60, 0x1fbe, 0x0399, 0x00df, 0x0053, 0x0053, 0x0149, - 0x02bc, 0x004e, 0x01f0, 0x004a, 0x030c, 0x0587, 0x0535, 0x0552, 0x1e96, 0x0048, - 0x0331, 0x1e97, 0x0054, 0x0308, 0x1e98, 0x0057, 0x030a, 0x1e99, 0x0059, 0x030a, - 0x1e9a, 0x0041, 0x02be, 0x1f50, 0x03a5, 0x0313, 0x1f87, 0x1f0f, 0x0399, 0x1f8f, - 0x1f0f, 0x0399, 0x1f97, 0x1f2f, 0x0399, 0x1f9f, 0x1f2f, 0x0399, 0x1fa7, 0x1f6f, - 0x0399, 0x1faf, 0x1f6f, 0x0399, 0x1fb2, 0x1fba, 0x0399, 0x1fb3, 0x0391, 0x0399, - 0x1fb4, 0x0386, 0x0399, 0x1fb6, 0x0391, 0x0342, 0x1fbc, 0x0391, 0x0399, 0x1fc2, - 0x1fca, 0x0399, 0x1fc3, 0x0397, 0x0399, 0x1fc4, 0x0389, 0x0399, 0x1fc6, 0x0397, - 0x0342, 0x1fcc, 0x0397, 0x0399, 0x1fd6, 0x0399, 0x0342, 0x1fe4, 0x03a1, 0x0313, - 0x1fe6, 0x03a5, 0x0342, 0x1ff2, 0x1ffa, 0x0399, 0x1ff3, 0x03a9, 0x0399, 0x1ff4, - 0x038f, 0x0399, 0x1ff6, 0x03a9, 0x0342, 0x1ffc, 0x03a9, 0x0399, 0xfb00, 0x0046, - 0x0046, 0xfb01, 0x0046, 0x0049, 0xfb02, 0x0046, 0x004c, 0xfb05, 0x0053, 0x0054, - 0xfb06, 0x0053, 0x0054, 0xfb13, 0x0544, 0x0546, 0xfb14, 0x0544, 0x0535, 0xfb15, - 0x0544, 0x053b, 0xfb16, 0x054e, 0x0546, 0xfb17, 0x0544, 0x053d, 0x0390, 0x0399, - 0x0308, 0x0301, 0x03b0, 0x03a5, 0x0308, 0x0301, 0x1f52, 0x03a5, 0x0313, 0x0300, - 0x1f54, 0x03a5, 0x0313, 0x0301, 0x1f56, 0x03a5, 0x0313, 0x0342, 0x1fb7, 0x0391, - 0x0342, 0x0399, 0x1fc7, 0x0397, 0x0342, 0x0399, 0x1fd2, 0x0399, 0x0308, 0x0300, - 0x1fd3, 0x0399, 0x0308, 0x0301, 0x1fd7, 0x0399, 0x0308, 0x0342, 0x1fe2, 0x03a5, - 0x0308, 0x0300, 0x1fe3, 0x03a5, 0x0308, 0x0301, 0x1fe7, 0x03a5, 0x0308, 0x0342, - 0x1ff7, 0x03a9, 0x0342, 0x0399, 0xfb03, 0x0046, 0x0046, 0x0049, 0xfb04, 0x0046, - 0x0046, 0x004c -}; - -/* Number of one-to-one, one-to-two, and one-to-three uppercase conversions. */ -static const uint8_t lit_upper_case_conversion_counters[] JERRY_ATTR_CONST_DATA = -{ - 0x001c, 0x002c, 0x0010 -}; diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-unicode-ranges.inc.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-unicode-ranges.inc.h deleted file mode 100755 index 1749feaf6..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/lit-unicode-ranges.inc.h +++ /dev/null @@ -1,252 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* This file is automatically generated by the gen-unicode.py script - * from UnicodeData-9.0.0.txt. Do not edit! */ - -/** - * Character interval starting points for the unicode letters. - * - * The characters covered by these intervals are from - * the following Unicode categories: Lu, Ll, Lt, Lm, Lo, Nl - */ -static const uint16_t lit_unicode_letter_interval_sps[] JERRY_ATTR_CONST_DATA = -{ - 0x00c0, 0x00d8, 0x00f8, 0x01f8, 0x02c6, 0x02e0, 0x0370, 0x0376, 0x037a, 0x0388, - 0x038e, 0x03a3, 0x03f7, 0x048a, 0x0531, 0x0561, 0x05d0, 0x05f0, 0x0620, 0x066e, - 0x0671, 0x06e5, 0x06ee, 0x06fa, 0x0712, 0x074d, 0x07ca, 0x07f4, 0x0800, 0x0840, - 0x08a0, 0x08b6, 0x0904, 0x0958, 0x0971, 0x0985, 0x098f, 0x0993, 0x09aa, 0x09b6, - 0x09dc, 0x09df, 0x09f0, 0x0a05, 0x0a0f, 0x0a13, 0x0a2a, 0x0a32, 0x0a35, 0x0a38, - 0x0a59, 0x0a72, 0x0a85, 0x0a8f, 0x0a93, 0x0aaa, 0x0ab2, 0x0ab5, 0x0ae0, 0x0b05, - 0x0b0f, 0x0b13, 0x0b2a, 0x0b32, 0x0b35, 0x0b5c, 0x0b5f, 0x0b85, 0x0b8e, 0x0b92, - 0x0b99, 0x0b9e, 0x0ba3, 0x0ba8, 0x0bae, 0x0c05, 0x0c0e, 0x0c12, 0x0c2a, 0x0c58, - 0x0c60, 0x0c85, 0x0c8e, 0x0c92, 0x0caa, 0x0cb5, 0x0ce0, 0x0cf1, 0x0d05, 0x0d0e, - 0x0d12, 0x0d54, 0x0d5f, 0x0d7a, 0x0d85, 0x0d9a, 0x0db3, 0x0dc0, 0x0e01, 0x0e32, - 0x0e40, 0x0e81, 0x0e87, 0x0e94, 0x0e99, 0x0ea1, 0x0eaa, 0x0ead, 0x0eb2, 0x0ec0, - 0x0edc, 0x0f40, 0x0f49, 0x0f88, 0x1000, 0x1050, 0x105a, 0x1065, 0x106e, 0x1075, - 0x10a0, 0x10d0, 0x10fc, 0x11fc, 0x124a, 0x1250, 0x125a, 0x1260, 0x128a, 0x1290, - 0x12b2, 0x12b8, 0x12c2, 0x12c8, 0x12d8, 0x1312, 0x1318, 0x1380, 0x13a0, 0x13f8, - 0x1401, 0x1501, 0x1601, 0x166f, 0x1681, 0x16a0, 0x16ee, 0x1700, 0x170e, 0x1720, - 0x1740, 0x1760, 0x176e, 0x1780, 0x1820, 0x1880, 0x1887, 0x18b0, 0x1900, 0x1950, - 0x1970, 0x1980, 0x19b0, 0x1a00, 0x1a20, 0x1b05, 0x1b45, 0x1b83, 0x1bae, 0x1bba, - 0x1c00, 0x1c4d, 0x1c5a, 0x1c80, 0x1ce9, 0x1cee, 0x1cf5, 0x1d00, 0x1e00, 0x1f00, - 0x1f18, 0x1f20, 0x1f48, 0x1f50, 0x1f5f, 0x1f80, 0x1fb6, 0x1fc2, 0x1fc6, 0x1fd0, - 0x1fd6, 0x1fe0, 0x1ff2, 0x1ff6, 0x2090, 0x210a, 0x2119, 0x212a, 0x212f, 0x213c, - 0x2145, 0x2160, 0x2c00, 0x2c30, 0x2c60, 0x2ceb, 0x2cf2, 0x2d00, 0x2d30, 0x2d80, - 0x2da0, 0x2da8, 0x2db0, 0x2db8, 0x2dc0, 0x2dc8, 0x2dd0, 0x2dd8, 0x3005, 0x3021, - 0x3031, 0x3038, 0x3041, 0x309d, 0x30a1, 0x30fc, 0x3105, 0x3131, 0x31a0, 0x31f0, - 0x3400, 0x3500, 0x3600, 0x3700, 0x3800, 0x3900, 0x3a00, 0x3b00, 0x3c00, 0x3d00, - 0x3e00, 0x3f00, 0x4000, 0x4100, 0x4200, 0x4300, 0x4400, 0x4500, 0x4600, 0x4700, - 0x4800, 0x4900, 0x4a00, 0x4b00, 0x4c00, 0x4d00, 0x4e00, 0x4f00, 0x5000, 0x5100, - 0x5200, 0x5300, 0x5400, 0x5500, 0x5600, 0x5700, 0x5800, 0x5900, 0x5a00, 0x5b00, - 0x5c00, 0x5d00, 0x5e00, 0x5f00, 0x6000, 0x6100, 0x6200, 0x6300, 0x6400, 0x6500, - 0x6600, 0x6700, 0x6800, 0x6900, 0x6a00, 0x6b00, 0x6c00, 0x6d00, 0x6e00, 0x6f00, - 0x7000, 0x7100, 0x7200, 0x7300, 0x7400, 0x7500, 0x7600, 0x7700, 0x7800, 0x7900, - 0x7a00, 0x7b00, 0x7c00, 0x7d00, 0x7e00, 0x7f00, 0x8000, 0x8100, 0x8200, 0x8300, - 0x8400, 0x8500, 0x8600, 0x8700, 0x8800, 0x8900, 0x8a00, 0x8b00, 0x8c00, 0x8d00, - 0x8e00, 0x8f00, 0x9000, 0x9100, 0x9200, 0x9300, 0x9400, 0x9500, 0x9600, 0x9700, - 0x9800, 0x9900, 0x9a00, 0x9b00, 0x9c00, 0x9d00, 0x9e00, 0x9f00, 0xa000, 0xa100, - 0xa200, 0xa300, 0xa400, 0xa4d0, 0xa500, 0xa600, 0xa610, 0xa62a, 0xa640, 0xa67f, - 0xa6a0, 0xa717, 0xa722, 0xa78b, 0xa7b0, 0xa7f7, 0xa803, 0xa807, 0xa80c, 0xa840, - 0xa882, 0xa8f2, 0xa90a, 0xa930, 0xa960, 0xa984, 0xa9e0, 0xa9e6, 0xa9fa, 0xaa00, - 0xaa40, 0xaa44, 0xaa60, 0xaa7e, 0xaab5, 0xaab9, 0xaadb, 0xaae0, 0xaaf2, 0xab01, - 0xab09, 0xab11, 0xab20, 0xab28, 0xab30, 0xab5c, 0xab70, 0xac00, 0xad00, 0xae00, - 0xaf00, 0xb000, 0xb100, 0xb200, 0xb300, 0xb400, 0xb500, 0xb600, 0xb700, 0xb800, - 0xb900, 0xba00, 0xbb00, 0xbc00, 0xbd00, 0xbe00, 0xbf00, 0xc000, 0xc100, 0xc200, - 0xc300, 0xc400, 0xc500, 0xc600, 0xc700, 0xc800, 0xc900, 0xca00, 0xcb00, 0xcc00, - 0xcd00, 0xce00, 0xcf00, 0xd000, 0xd100, 0xd200, 0xd300, 0xd400, 0xd500, 0xd600, - 0xd700, 0xd7b0, 0xd7cb, 0xf900, 0xfa00, 0xfa70, 0xfb00, 0xfb13, 0xfb1f, 0xfb2a, - 0xfb38, 0xfb40, 0xfb43, 0xfb46, 0xfbd3, 0xfcd3, 0xfd50, 0xfd92, 0xfdf0, 0xfe70, - 0xfe76, 0xff21, 0xff41, 0xff66, 0xffc2, 0xffca, 0xffd2, 0xffda -}; - -/** - * Character lengths for the unicode letters. - * - * The characters covered by these intervals are from - * the following Unicode categories: Lu, Ll, Lt, Lm, Lo, Nl - */ -static const uint8_t lit_unicode_letter_interval_lengths[] JERRY_ATTR_CONST_DATA = -{ - 0x0016, 0x001e, 0x00ff, 0x00c9, 0x000b, 0x0004, 0x0004, 0x0001, 0x0003, 0x0002, - 0x0013, 0x0052, 0x008a, 0x00a5, 0x0025, 0x0026, 0x001a, 0x0002, 0x002a, 0x0001, - 0x0062, 0x0001, 0x0001, 0x0002, 0x001d, 0x0058, 0x0020, 0x0001, 0x0015, 0x0018, - 0x0014, 0x0007, 0x0035, 0x0009, 0x000f, 0x0007, 0x0001, 0x0015, 0x0006, 0x0003, - 0x0001, 0x0002, 0x0001, 0x0005, 0x0001, 0x0015, 0x0006, 0x0001, 0x0001, 0x0001, - 0x0003, 0x0002, 0x0008, 0x0002, 0x0015, 0x0006, 0x0001, 0x0004, 0x0001, 0x0007, - 0x0001, 0x0015, 0x0006, 0x0001, 0x0004, 0x0001, 0x0002, 0x0005, 0x0002, 0x0003, - 0x0001, 0x0001, 0x0001, 0x0002, 0x000b, 0x0007, 0x0002, 0x0016, 0x000f, 0x0002, - 0x0001, 0x0007, 0x0002, 0x0016, 0x0009, 0x0004, 0x0001, 0x0001, 0x0007, 0x0002, - 0x0028, 0x0002, 0x0002, 0x0005, 0x0011, 0x0017, 0x0008, 0x0006, 0x002f, 0x0001, - 0x0006, 0x0001, 0x0001, 0x0003, 0x0006, 0x0002, 0x0001, 0x0003, 0x0001, 0x0004, - 0x0003, 0x0007, 0x0023, 0x0004, 0x002a, 0x0005, 0x0003, 0x0001, 0x0002, 0x000c, - 0x0025, 0x002a, 0x00ff, 0x004c, 0x0003, 0x0006, 0x0003, 0x0028, 0x0003, 0x0020, - 0x0003, 0x0006, 0x0003, 0x000e, 0x0038, 0x0003, 0x0042, 0x000f, 0x0055, 0x0005, - 0x00ff, 0x00ff, 0x006b, 0x0010, 0x0019, 0x004a, 0x000a, 0x000c, 0x0003, 0x0011, - 0x0011, 0x000c, 0x0002, 0x0033, 0x0057, 0x0004, 0x0021, 0x0045, 0x001e, 0x001d, - 0x0004, 0x002b, 0x0019, 0x0016, 0x0034, 0x002e, 0x0006, 0x001d, 0x0001, 0x002b, - 0x0023, 0x0002, 0x0023, 0x0008, 0x0003, 0x0003, 0x0001, 0x00bf, 0x00ff, 0x0015, - 0x0005, 0x0025, 0x0005, 0x0007, 0x001e, 0x0034, 0x0006, 0x0002, 0x0006, 0x0003, - 0x0005, 0x000c, 0x0002, 0x0006, 0x000c, 0x0009, 0x0004, 0x0003, 0x000a, 0x0003, - 0x0004, 0x0028, 0x002e, 0x002e, 0x0084, 0x0003, 0x0001, 0x0025, 0x0037, 0x0016, - 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0002, 0x0008, - 0x0004, 0x0004, 0x0055, 0x0002, 0x0059, 0x0003, 0x0028, 0x005d, 0x001a, 0x000f, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00b5, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00d5, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x008c, 0x002d, 0x00ff, 0x000c, 0x000f, 0x0001, 0x002e, 0x001e, - 0x004f, 0x0008, 0x0066, 0x0023, 0x0007, 0x000a, 0x0002, 0x0003, 0x0016, 0x0033, - 0x0031, 0x0005, 0x001b, 0x0016, 0x001c, 0x002e, 0x0004, 0x0009, 0x0004, 0x0028, - 0x0002, 0x0007, 0x0016, 0x0031, 0x0001, 0x0004, 0x0002, 0x000a, 0x0002, 0x0005, - 0x0005, 0x0005, 0x0006, 0x0006, 0x002a, 0x0009, 0x0072, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, - 0x00a3, 0x0016, 0x0030, 0x00ff, 0x006d, 0x0069, 0x0006, 0x0004, 0x0009, 0x000c, - 0x0004, 0x0001, 0x0001, 0x006b, 0x00ff, 0x006a, 0x003f, 0x0035, 0x000b, 0x0004, - 0x0086, 0x0019, 0x0019, 0x0058, 0x0005, 0x0005, 0x0005, 0x0002 -}; - -/** - * Those unicode letter characters that are not inside any of - * the intervals specified in lit_unicode_letter_interval_sps array. - * - * The characters are from the following Unicode categories: - * Lu, Ll, Lt, Lm, Lo, Nl - */ -static const uint16_t lit_unicode_letter_chars[] JERRY_ATTR_CONST_DATA = -{ - 0x00aa, 0x00b5, 0x00ba, 0x02ec, 0x02ee, 0x037f, 0x0386, 0x038c, 0x0559, 0x06d5, - 0x06ff, 0x0710, 0x07b1, 0x07fa, 0x081a, 0x0824, 0x0828, 0x093d, 0x0950, 0x09b2, - 0x09bd, 0x09ce, 0x0a5e, 0x0abd, 0x0ad0, 0x0af9, 0x0b3d, 0x0b71, 0x0b83, 0x0b9c, - 0x0bd0, 0x0c3d, 0x0c80, 0x0cbd, 0x0cde, 0x0d3d, 0x0d4e, 0x0dbd, 0x0e84, 0x0e8a, - 0x0e8d, 0x0ea5, 0x0ea7, 0x0ebd, 0x0ec6, 0x0f00, 0x103f, 0x1061, 0x108e, 0x10c7, - 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1f59, 0x1f5b, 0x1f5d, - 0x1fbe, 0x2071, 0x207f, 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, - 0x2d27, 0x2d2d, 0x2d6f, 0x2e2f, 0x3400, 0x4e00, 0xa8fb, 0xa8fd, 0xa9cf, 0xaa7a, - 0xaab1, 0xaac0, 0xaac2, 0xac00, 0xfb1d, 0xfb3e -}; - -/** - * Character interval starting points for non-letter character - * that can be used as a non-first character of an identifier. - * - * The characters covered by these intervals are from - * the following Unicode categories: Nd, Mn, Mc, Pc - */ -static const uint16_t lit_unicode_non_letter_ident_part_interval_sps[] JERRY_ATTR_CONST_DATA = -{ - 0x0300, 0x0483, 0x0591, 0x05c1, 0x05c4, 0x0610, 0x064b, 0x06d6, 0x06df, 0x06e7, - 0x06ea, 0x06f0, 0x0730, 0x07a6, 0x07c0, 0x07eb, 0x0816, 0x081b, 0x0825, 0x0829, - 0x0859, 0x08d4, 0x08e3, 0x093a, 0x093e, 0x0951, 0x0962, 0x0966, 0x0981, 0x09be, - 0x09c7, 0x09cb, 0x09e2, 0x09e6, 0x0a01, 0x0a3e, 0x0a47, 0x0a4b, 0x0a66, 0x0a81, - 0x0abe, 0x0ac7, 0x0acb, 0x0ae2, 0x0ae6, 0x0b01, 0x0b3e, 0x0b47, 0x0b4b, 0x0b56, - 0x0b62, 0x0b66, 0x0bbe, 0x0bc6, 0x0bca, 0x0be6, 0x0c00, 0x0c3e, 0x0c46, 0x0c4a, - 0x0c55, 0x0c62, 0x0c66, 0x0c81, 0x0cbe, 0x0cc6, 0x0cca, 0x0cd5, 0x0ce2, 0x0ce6, - 0x0d01, 0x0d3e, 0x0d46, 0x0d4a, 0x0d62, 0x0d66, 0x0d82, 0x0dcf, 0x0dd8, 0x0de6, - 0x0df2, 0x0e34, 0x0e47, 0x0e50, 0x0eb4, 0x0ebb, 0x0ec8, 0x0ed0, 0x0f18, 0x0f20, - 0x0f3e, 0x0f71, 0x0f86, 0x0f8d, 0x0f99, 0x102b, 0x1040, 0x1056, 0x105e, 0x1062, - 0x1067, 0x1071, 0x1082, 0x108f, 0x135d, 0x1712, 0x1732, 0x1752, 0x1772, 0x17b4, - 0x17e0, 0x180b, 0x1810, 0x1885, 0x1920, 0x1930, 0x1946, 0x19d0, 0x1a17, 0x1a55, - 0x1a60, 0x1a7f, 0x1a90, 0x1ab0, 0x1b00, 0x1b34, 0x1b50, 0x1b6b, 0x1b80, 0x1ba1, - 0x1bb0, 0x1be6, 0x1c24, 0x1c40, 0x1c50, 0x1cd0, 0x1cd4, 0x1cf2, 0x1cf8, 0x1dc0, - 0x1dfb, 0x203f, 0x20d0, 0x20e5, 0x2cef, 0x2de0, 0x302a, 0x3099, 0xa620, 0xa674, - 0xa69e, 0xa6f0, 0xa823, 0xa880, 0xa8b4, 0xa8d0, 0xa8e0, 0xa900, 0xa926, 0xa947, - 0xa980, 0xa9b3, 0xa9d0, 0xa9f0, 0xaa29, 0xaa4c, 0xaa50, 0xaa7b, 0xaab2, 0xaab7, - 0xaabe, 0xaaeb, 0xaaf5, 0xabe3, 0xabec, 0xabf0, 0xfe00, 0xfe20, 0xfe33, 0xfe4d, - 0xff10 -}; - -/** - * Character interval lengths for non-letter character - * that can be used as a non-first character of an identifier. - * - * The characters covered by these intervals are from - * the following Unicode categories: Nd, Mn, Mc, Pc - */ -static const uint8_t lit_unicode_non_letter_ident_part_interval_lengths[] JERRY_ATTR_CONST_DATA = -{ - 0x006f, 0x0004, 0x002c, 0x0001, 0x0001, 0x000a, 0x001e, 0x0006, 0x0005, 0x0001, - 0x0003, 0x0009, 0x001a, 0x000a, 0x0009, 0x0008, 0x0003, 0x0008, 0x0002, 0x0004, - 0x0002, 0x000d, 0x0020, 0x0002, 0x0011, 0x0006, 0x0001, 0x0009, 0x0002, 0x0006, - 0x0001, 0x0002, 0x0001, 0x0009, 0x0002, 0x0004, 0x0001, 0x0002, 0x000b, 0x0002, - 0x0007, 0x0002, 0x0002, 0x0001, 0x0009, 0x0002, 0x0006, 0x0001, 0x0002, 0x0001, - 0x0001, 0x0009, 0x0004, 0x0002, 0x0003, 0x0009, 0x0003, 0x0006, 0x0002, 0x0003, - 0x0001, 0x0001, 0x0009, 0x0002, 0x0006, 0x0002, 0x0003, 0x0001, 0x0001, 0x0009, - 0x0002, 0x0006, 0x0002, 0x0003, 0x0001, 0x0009, 0x0001, 0x0005, 0x0007, 0x0009, - 0x0001, 0x0006, 0x0007, 0x0009, 0x0005, 0x0001, 0x0005, 0x0009, 0x0001, 0x0009, - 0x0001, 0x0013, 0x0001, 0x000a, 0x0023, 0x0013, 0x0009, 0x0003, 0x0002, 0x0002, - 0x0006, 0x0003, 0x000b, 0x000e, 0x0002, 0x0002, 0x0002, 0x0001, 0x0001, 0x001f, - 0x0009, 0x0002, 0x0009, 0x0001, 0x000b, 0x000b, 0x0009, 0x0009, 0x0004, 0x0009, - 0x001c, 0x000a, 0x0009, 0x000d, 0x0004, 0x0010, 0x0009, 0x0008, 0x0002, 0x000c, - 0x0009, 0x000d, 0x0013, 0x0009, 0x0009, 0x0002, 0x0014, 0x0002, 0x0001, 0x0035, - 0x0004, 0x0001, 0x000c, 0x000b, 0x0002, 0x001f, 0x0005, 0x0001, 0x0009, 0x0009, - 0x0001, 0x0001, 0x0004, 0x0001, 0x0011, 0x0009, 0x0011, 0x0009, 0x0007, 0x000c, - 0x0003, 0x000d, 0x0009, 0x0009, 0x000d, 0x0001, 0x0009, 0x0002, 0x0002, 0x0001, - 0x0001, 0x0004, 0x0001, 0x0007, 0x0001, 0x0009, 0x000f, 0x000f, 0x0001, 0x0002, - 0x0009 -}; - -/** - * Those non-letter characters that can be used as a non-first - * character of an identifier and not included in any of the intervals - * specified in lit_unicode_non_letter_ident_part_interval_sps array. - * - * The characters are from the following Unicode categories: - * Nd, Mn, Mc, Pc - */ -static const uint16_t lit_unicode_non_letter_ident_part_chars[] JERRY_ATTR_CONST_DATA = -{ - 0x05bf, 0x05c7, 0x0670, 0x0711, 0x09bc, 0x09d7, 0x0a3c, 0x0a51, 0x0a75, 0x0abc, - 0x0b3c, 0x0b82, 0x0bd7, 0x0cbc, 0x0d57, 0x0dca, 0x0dd6, 0x0e31, 0x0eb1, 0x0f35, - 0x0f37, 0x0f39, 0x0fc6, 0x17dd, 0x18a9, 0x1ced, 0x2054, 0x20e1, 0x2d7f, 0xa66f, - 0xa802, 0xa806, 0xa80b, 0xa9e5, 0xaa43, 0xaab0, 0xaac1, 0xfb1e, 0xff3f -}; - -/** - * Unicode separator character interval starting points from Unicode category: Zs - */ -static const uint16_t lit_unicode_separator_char_interval_sps[] JERRY_ATTR_CONST_DATA = -{ - 0x2000 -}; - -/** - * Unicode separator character interval lengths from Unicode category: Zs - */ -static const uint8_t lit_unicode_separator_char_interval_lengths[] JERRY_ATTR_CONST_DATA = -{ - 0x000b -}; - -/** - * Unicode separator characters that are not in the - * lit_unicode_separator_char_intervals array. - * - * Unicode category: Zs - */ -static const uint16_t lit_unicode_separator_chars[] JERRY_ATTR_CONST_DATA = -{ - 0x1680, 0x180e, 0x202f, 0x205f, 0x3000 -}; diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/opcodes.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/opcodes.h deleted file mode 100755 index faafba7c7..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/opcodes.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef OPCODES_H -#define OPCODES_H - -#include "ecma-globals.h" -#include "vm-defines.h" - -/** \addtogroup vm Virtual machine - * @{ - * - * \addtogroup vm_opcodes Opcodes - * @{ - */ - -/** - * Number arithmetic operations. - */ -typedef enum -{ - NUMBER_ARITHMETIC_SUBSTRACTION, /**< substraction */ - NUMBER_ARITHMETIC_MULTIPLICATION, /**< multiplication */ - NUMBER_ARITHMETIC_DIVISION, /**< division */ - NUMBER_ARITHMETIC_REMAINDER, /**< remainder calculation */ -} number_arithmetic_op; - -/** - * Number bitwise logic operations. - */ -typedef enum -{ - NUMBER_BITWISE_LOGIC_AND, /**< bitwise AND calculation */ - NUMBER_BITWISE_LOGIC_OR, /**< bitwise OR calculation */ - NUMBER_BITWISE_LOGIC_XOR, /**< bitwise XOR calculation */ - NUMBER_BITWISE_SHIFT_LEFT, /**< bitwise LEFT SHIFT calculation */ - NUMBER_BITWISE_SHIFT_RIGHT, /**< bitwise RIGHT_SHIFT calculation */ - NUMBER_BITWISE_SHIFT_URIGHT, /**< bitwise UNSIGNED RIGHT SHIFT calculation */ - NUMBER_BITWISE_NOT, /**< bitwise NOT calculation */ -} number_bitwise_logic_op; - -ecma_value_t -vm_var_decl (vm_frame_ctx_t *frame_ctx_p, ecma_string_t *var_name_str_p); - -ecma_value_t -opfunc_equality (ecma_value_t left_value, ecma_value_t right_value); - -ecma_value_t -do_number_arithmetic (number_arithmetic_op op, ecma_value_t left_value, ecma_value_t right_value); - -ecma_value_t -opfunc_unary_operation (ecma_value_t left_value, bool is_plus); - -ecma_value_t -do_number_bitwise_logic (number_bitwise_logic_op op, ecma_value_t left_value, ecma_value_t right_value); - -ecma_value_t -opfunc_addition (ecma_value_t left_value, ecma_value_t right_value); - -ecma_value_t -opfunc_relation (ecma_value_t left_value, ecma_value_t right_value, bool left_first, bool is_invert); - -ecma_value_t -opfunc_in (ecma_value_t left_value, ecma_value_t right_value); - -ecma_value_t -opfunc_instanceof (ecma_value_t left_value, ecma_value_t right_value); - -ecma_value_t -opfunc_typeof (ecma_value_t left_value); - -void -opfunc_set_accessor (bool is_getter, ecma_value_t object, ecma_string_t *accessor_name_p, ecma_value_t accessor); - -ecma_value_t -vm_op_delete_prop (ecma_value_t object, ecma_value_t property, bool is_strict); - -ecma_value_t -vm_op_delete_var (ecma_value_t name_literal, ecma_object_t *lex_env_p); - -ecma_collection_t * -opfunc_for_in (ecma_value_t left_value, ecma_value_t *result_obj_p); - -/** - * @} - * @} - */ - -#endif /* !OPCODES_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/re-bytecode.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/re-bytecode.h deleted file mode 100755 index 715170bb1..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/re-bytecode.h +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RE_BYTECODE_H -#define RE_BYTECODE_H - -#if ENABLED (JERRY_BUILTIN_REGEXP) - -#include "ecma-globals.h" - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup regexparser Regular expression - * @{ - * - * \addtogroup regexparser_bytecode Bytecode - * @{ - */ - -/** - * Size of the RegExp bytecode cache - */ -#define RE_CACHE_SIZE 8u - -/** - * RegExp flags mask (first 10 bits are for reference count and the rest for the actual RegExp flags) - */ -#define RE_FLAGS_MASK 0x3F - -/** - * RegExp opcodes - */ -typedef enum -{ - RE_OP_EOF, - /* Group opcode order is important, because RE_IS_CAPTURE_GROUP is based on it. - * Change it carefully. Capture opcodes should be at first. - */ - RE_OP_CAPTURE_GROUP_START, /**< group start */ - RE_OP_CAPTURE_GREEDY_ZERO_GROUP_START, /**< greedy zero group start */ - RE_OP_CAPTURE_NON_GREEDY_ZERO_GROUP_START, /**< non-greedy zero group start */ - RE_OP_CAPTURE_GREEDY_GROUP_END, /**< greedy group end */ - RE_OP_CAPTURE_NON_GREEDY_GROUP_END, /**< non-greedy group end */ - RE_OP_NON_CAPTURE_GROUP_START, /**< non-capture group start */ - RE_OP_NON_CAPTURE_GREEDY_ZERO_GROUP_START, /**< non-capture greedy zero group start */ - RE_OP_NON_CAPTURE_NON_GREEDY_ZERO_GROUP_START, /**< non-capture non-greedy zero group start */ - RE_OP_NON_CAPTURE_GREEDY_GROUP_END, /**< non-capture greedy group end */ - RE_OP_NON_CAPTURE_NON_GREEDY_GROUP_END, /**< non-capture non-greedy group end */ - - RE_OP_MATCH, /**< match */ - RE_OP_CHAR, /**< any character */ - RE_OP_SAVE_AT_START, /**< save at start */ - RE_OP_SAVE_AND_MATCH, /**< save and match */ - RE_OP_PERIOD, /**< "." */ - RE_OP_ALTERNATIVE, /**< "|" */ - RE_OP_GREEDY_ITERATOR, /**< greedy iterator */ - RE_OP_NON_GREEDY_ITERATOR, /**< non-greedy iterator */ - RE_OP_ASSERT_START, /**< "^" */ - RE_OP_ASSERT_END, /**< "$" */ - RE_OP_ASSERT_WORD_BOUNDARY, /**< "\b" */ - RE_OP_ASSERT_NOT_WORD_BOUNDARY, /**< "\B" */ - RE_OP_LOOKAHEAD_POS, /**< lookahead pos */ - RE_OP_LOOKAHEAD_NEG, /**< lookahead neg */ - RE_OP_BACKREFERENCE, /**< "\[0..9]" */ - RE_OP_CHAR_CLASS, /**< "[ ]" */ - RE_OP_INV_CHAR_CLASS /**< "[^ ]" */ -} re_opcode_t; - -/** - * Compiled byte code data. - */ -typedef struct -{ - ecma_compiled_code_t header; /**< compiled code header */ - ecma_value_t source; /**< original RegExp pattern */ - uint32_t captures_count; /**< number of capturing brackets */ - uint32_t non_captures_count; /**< number of non capturing brackets */ -} re_compiled_code_t; - -/** - * Context of RegExp bytecode container - */ -typedef struct -{ - uint8_t *block_start_p; /**< start of bytecode block */ - uint8_t *block_end_p; /**< end of bytecode block */ - uint8_t *current_p; /**< current position in bytecode */ -} re_bytecode_ctx_t; - -re_opcode_t re_get_opcode (const uint8_t **bc_p); -ecma_char_t re_get_char (const uint8_t **bc_p); -uint32_t re_get_value (const uint8_t **bc_p); -uint32_t JERRY_ATTR_PURE re_get_bytecode_length (re_bytecode_ctx_t *bc_ctx_p); - -void re_initialize_regexp_bytecode (re_bytecode_ctx_t *bc_ctx_p); - -void re_append_opcode (re_bytecode_ctx_t *bc_ctx_p, const re_opcode_t opcode); -void re_append_u32 (re_bytecode_ctx_t *bc_ctx_p, const uint32_t value); -void re_append_char (re_bytecode_ctx_t *bc_ctx_p, const ecma_char_t input_char); -void re_append_jump_offset (re_bytecode_ctx_t *bc_ctx_p, uint32_t value); - -void re_insert_opcode (re_bytecode_ctx_t *bc_ctx_p, const uint32_t offset, const re_opcode_t opcode); -void re_insert_u32 (re_bytecode_ctx_t *bc_ctx_p, const uint32_t offset, const uint32_t value); -void re_bytecode_list_insert (re_bytecode_ctx_t *bc_ctx_p, - const size_t offset, - const uint8_t *bytecode_p, - const size_t length); - -#if ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) -void re_dump_bytecode (re_bytecode_ctx_t *bc_ctx); -#endif /* ENABLED (JERRY_REGEXP_DUMP_BYTE_CODE) */ - -/** - * @} - * @} - * @} - */ - -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ -#endif /* !RE_BYTECODE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/re-compiler.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/re-compiler.h deleted file mode 100755 index 8dd2a72e1..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/re-compiler.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RE_COMPILER_H -#define RE_COMPILER_H - -#if ENABLED (JERRY_BUILTIN_REGEXP) - -#include "ecma-globals.h" -#include "re-bytecode.h" -#include "re-parser.h" - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup regexparser Regular expression - * @{ - * - * \addtogroup regexparser_compiler Compiler - * @{ - */ - -/** - * Context of RegExp compiler - */ -typedef struct -{ - uint16_t flags; /**< RegExp flags */ - uint32_t captures_count; /**< number of capture groups */ - uint32_t non_captures_count; /**< number of non-capture groups */ - uint32_t highest_backref; /**< highest backreference */ - re_bytecode_ctx_t *bytecode_ctx_p; /**< pointer of RegExp bytecode context */ - re_token_t current_token; /**< current token */ - re_parser_ctx_t *parser_ctx_p; /**< pointer of RegExp parser context */ -} re_compiler_ctx_t; - -ecma_value_t -re_compile_bytecode (const re_compiled_code_t **out_bytecode_p, ecma_string_t *pattern_str_p, uint16_t flags); - -void re_cache_gc_run (void); - -/** - * @} - * @} - * @} - */ - -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ -#endif /* !RE_COMPILER_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/re-parser.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/re-parser.h deleted file mode 100755 index 7e3c2e2c6..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/re-parser.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RE_PARSER_H -#define RE_PARSER_H - -#if ENABLED (JERRY_BUILTIN_REGEXP) - -/** \addtogroup parser Parser - * @{ - * - * \addtogroup regexparser Regular expression - * @{ - * - * \addtogroup regexparser_bytecode Bytecode - * @{ - */ - -/** - * RegExp token type definitions - */ -typedef enum -{ - RE_TOK_EOF, /**< EOF */ - RE_TOK_BACKREFERENCE, /**< "\[0..9]" */ - RE_TOK_CHAR, /**< any character */ - RE_TOK_ALTERNATIVE, /**< "|" */ - RE_TOK_ASSERT_START, /**< "^" */ - RE_TOK_ASSERT_END, /**< "$" */ - RE_TOK_PERIOD, /**< "." */ - RE_TOK_START_CAPTURE_GROUP, /**< "(" */ - RE_TOK_START_NON_CAPTURE_GROUP, /**< "(?:" */ - RE_TOK_END_GROUP, /**< ")" */ - RE_TOK_ASSERT_START_POS_LOOKAHEAD, /**< "(?=" */ - RE_TOK_ASSERT_START_NEG_LOOKAHEAD, /**< "(?!" */ - RE_TOK_ASSERT_WORD_BOUNDARY, /**< "\b" */ - RE_TOK_ASSERT_NOT_WORD_BOUNDARY, /**< "\B" */ - RE_TOK_DIGIT, /**< "\d" */ - RE_TOK_NOT_DIGIT, /**< "\D" */ - RE_TOK_WHITE, /**< "\s" */ - RE_TOK_NOT_WHITE, /**< "\S" */ - RE_TOK_WORD_CHAR, /**< "\w" */ - RE_TOK_NOT_WORD_CHAR, /**< "\W" */ - RE_TOK_START_CHAR_CLASS, /**< "[ ]" */ - RE_TOK_START_INV_CHAR_CLASS, /**< "[^ ]" */ -} re_token_type_t; - -/** - * @} - * - * \addtogroup regexparser_parser Parser - * @{ - */ - -/** - * RegExp constant of infinite - */ -#define RE_ITERATOR_INFINITE ((uint32_t) - 1) - -/** - * Maximum number of decimal escape digits - */ -#define RE_MAX_RE_DECESC_DIGITS 9 - -/** - * RegExp token type - */ -typedef struct -{ - re_token_type_t type; /**< type of the token */ - uint32_t value; /**< value of the token */ - uint32_t qmin; /**< minimum number of token iterations */ - uint32_t qmax; /**< maximum number of token iterations */ - bool greedy; /**< type of iteration */ -} re_token_t; - -/** - * RegExp parser context - */ -typedef struct -{ - const lit_utf8_byte_t *input_start_p; /**< start of input pattern */ - const lit_utf8_byte_t *input_curr_p; /**< current position in input pattern */ - const lit_utf8_byte_t *input_end_p; /**< end of input pattern */ - int groups_count; /**< number of groups */ - uint32_t classes_count; /**< number of character classes */ -} re_parser_ctx_t; - -bool re_hex_lookup (re_parser_ctx_t *parser_ctx_p, uint32_t lookup); -uint32_t re_parse_octal (re_parser_ctx_t *parser_ctx_p); -ecma_value_t re_parse_iterator (re_parser_ctx_t *parser_ctx_p, re_token_t *re_token_p); -ecma_value_t re_parse_next_token (re_parser_ctx_t *parser_ctx_p, re_token_t *out_token_p); - -/** - * @} - * @} - * @} - */ - -#endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ -#endif /* !RE_PARSER_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/vm-defines.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/vm-defines.h deleted file mode 100755 index d757876e7..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/vm-defines.h +++ /dev/null @@ -1,69 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -#ifndef VM_DEFINES_H -#define VM_DEFINES_H - -#include "byte-code.h" -#include "ecma-globals.h" - -/** \addtogroup vm Virtual machine - * @{ - * - * \addtogroup vm_executor Executor - * @{ - */ - -/** - * Helper for += on uint16_t values. - */ -#define VM_PLUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) + (value)) - -/** - * Helper for -= on uint16_t values. - */ -#define VM_MINUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) - (value)) - -/** - * Context of interpreter, related to a JS stack frame - */ -typedef struct vm_frame_ctx_t -{ - const ecma_compiled_code_t *bytecode_header_p; /**< currently executed byte-code data */ - uint8_t *byte_code_p; /**< current byte code pointer */ - uint8_t *byte_code_start_p; /**< byte code start pointer */ - ecma_value_t *registers_p; /**< register start pointer */ - ecma_value_t *stack_top_p; /**< stack top pointer */ - ecma_value_t *literal_start_p; /**< literal list start pointer */ - ecma_object_t *lex_env_p; /**< current lexical environment */ -#if defined (JERRY_DEBUGGER) || ENABLED (JERRY_LINE_INFO) - struct vm_frame_ctx_t *prev_context_p; /**< previous context */ -#endif /* defined (JERRY_DEBUGGER) || ENABLED (JERRY_LINE_INFO) */ - ecma_value_t this_binding; /**< this binding */ - ecma_value_t block_result; /**< block result */ -#if ENABLED (JERRY_LINE_INFO) - ecma_value_t resource_name; /**< current resource name (usually a file name) */ - uint32_t current_line; /**< currently executed line */ -#endif /* ENABLED (JERRY_LINE_INFO) */ - uint16_t context_depth; /**< current context depth */ - uint8_t is_eval_code; /**< eval mode flag */ - uint8_t call_operation; /**< perform a call or construct operation */ -} vm_frame_ctx_t; - -/** - * @} - * @} - */ - -#endif /* !VM_DEFINES_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/vm-stack.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/vm-stack.h deleted file mode 100755 index 331c264b0..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/vm-stack.h +++ /dev/null @@ -1,61 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VM_STACK_H -#define VM_STACK_H - -#include "ecma-globals.h" - -/** \addtogroup vm Virtual machine - * @{ - * - * \addtogroup stack VM stack - * @{ - */ - -#define VM_CREATE_CONTEXT(type, end_offset) ((ecma_value_t) ((type) | (end_offset) << 4)) -#define VM_GET_CONTEXT_TYPE(value) ((vm_stack_context_type_t) ((value) & 0xf)) -#define VM_GET_CONTEXT_END(value) ((value) >> 4) - -/** - * Context types for the vm stack. - */ -typedef enum -{ - VM_CONTEXT_FINALLY_JUMP, /**< finally context with a jump */ - VM_CONTEXT_FINALLY_THROW, /**< finally context with a throw */ - VM_CONTEXT_FINALLY_RETURN, /**< finally context with a return */ - VM_CONTEXT_TRY, /**< try context */ - VM_CONTEXT_CATCH, /**< catch context */ - VM_CONTEXT_WITH, /**< with context */ -#if ENABLED (JERRY_ES2015_CLASS) - VM_CONTEXT_SUPER_CLASS, /**< super class context */ -#endif /* ENABLED (JERRY_ES2015_CLASS) */ - VM_CONTEXT_FOR_IN, /**< for-in context */ -#if ENABLED (JERRY_ES2015_FOR_OF) - VM_CONTEXT_FOR_OF, /**< for-of context */ -#endif /* ENABLED (JERRY_ES2015_FOR_OF) */ -} vm_stack_context_type_t; - -ecma_value_t *vm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, ecma_value_t *vm_stack_top_p); -bool vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, ecma_value_t **vm_stack_top_ref_p, - vm_stack_context_type_t finally_type, uint32_t search_limit); - -/** - * @} - * @} - */ - -#endif /* !VM_STACK_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/vm.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/vm.h deleted file mode 100755 index b2a2f25d2..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrycore/vm.h +++ /dev/null @@ -1,387 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef VM_H -#define VM_H - -#include "ecma-globals.h" -#include "jrt.h" -#include "vm-defines.h" - -/** \addtogroup vm Virtual machine - * @{ - * - * \addtogroup vm_executor Executor - * @{ - */ - -/** - * Each CBC opcode is transformed to three vm opcodes: - * - * - first opcode is a "get arguments" opcode which specifies - * the type (register, literal, stack, etc.) and number - * (from 0 to 2) of input arguments - * - second opcode is a "group" opcode which specifies - * the actual operation (add, increment, call, etc.) - * - third opcode is a "put result" opcode which specifies - * the destination where the result is stored (register, - * stack, etc.) - */ - -/** - * If VM_OC_GET_ARGS_INDEX(opcode) == VM_OC_GET_BRANCH, - * this flag signals that the branch is a backward branch. - */ -#define VM_OC_BACKWARD_BRANCH 0x4000 - -/** - * Position of "get arguments" opcode. - */ -#define VM_OC_GET_ARGS_SHIFT 7 - -/** - * Mask of "get arguments" opcode. - */ -#define VM_OC_GET_ARGS_MASK 0x7 - -/** - * Generate the binary representation of a "get arguments" opcode. - */ -#define VM_OC_GET_ARGS_CREATE_INDEX(V) (((V) & VM_OC_GET_ARGS_MASK) << VM_OC_GET_ARGS_SHIFT) - -/** - * Extract the "get arguments" opcode. - */ -#define VM_OC_GET_ARGS_INDEX(O) ((O) & (VM_OC_GET_ARGS_MASK << VM_OC_GET_ARGS_SHIFT)) - -/** - * Checks whether the result is stored somewhere. - */ -#define VM_OC_HAS_GET_ARGS(V) ((V) & (VM_OC_GET_ARGS_MASK << VM_OC_GET_ARGS_SHIFT)) - -/** - * Argument getters that are part of the opcodes. - */ -typedef enum -{ - VM_OC_GET_NONE = VM_OC_GET_ARGS_CREATE_INDEX (0), /**< do nothing */ - VM_OC_GET_BRANCH = VM_OC_GET_ARGS_CREATE_INDEX (1), /**< branch argument */ - VM_OC_GET_STACK = VM_OC_GET_ARGS_CREATE_INDEX (2), /**< pop one element from the stack */ - VM_OC_GET_STACK_STACK = VM_OC_GET_ARGS_CREATE_INDEX (3), /**< pop two elements from the stack */ - - VM_OC_GET_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (4), /**< resolve literal */ - VM_OC_GET_LITERAL_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (5), /**< resolve two literals */ - VM_OC_GET_STACK_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (6), /**< pop one element from the stack - * and resolve a literal */ - VM_OC_GET_THIS_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (7), /**< get this and resolve a literal */ -} vm_oc_get_types; - -/** - * Mask of "group" opcode. - */ -#define VM_OC_GROUP_MASK 0x7f - -/** - * Extract the "group" opcode. - */ -#define VM_OC_GROUP_GET_INDEX(O) ((O) & VM_OC_GROUP_MASK) - -/** - * Opcodes. - */ -typedef enum -{ - VM_OC_POP, /**< pop from stack */ - VM_OC_POP_BLOCK, /**< pop block */ - VM_OC_PUSH, /**< push one literal */ - VM_OC_PUSH_TWO, /**< push two literals */ - VM_OC_PUSH_THREE, /**< push three literals */ - VM_OC_PUSH_UNDEFINED, /**< push undefined value */ - VM_OC_PUSH_TRUE, /**< push true value */ - VM_OC_PUSH_FALSE, /**< push false value */ - VM_OC_PUSH_NULL, /**< push null value */ - VM_OC_PUSH_THIS, /**< push this */ - VM_OC_PUSH_0, /**< push number zero */ - VM_OC_PUSH_POS_BYTE, /**< push number between 1 and 256 */ - VM_OC_PUSH_NEG_BYTE, /**< push number between -1 and -256 */ - VM_OC_PUSH_LIT_0, /**< push literal and number zero */ - VM_OC_PUSH_LIT_POS_BYTE, /**< push literal and number between 1 and 256 */ - VM_OC_PUSH_LIT_NEG_BYTE, /**< push literal and number between -1 and -256 */ - VM_OC_PUSH_OBJECT, /**< push object */ - VM_OC_PUSH_NAMED_FUNC_EXPR, /**< push named function expression */ - VM_OC_SET_PROPERTY, /**< set property */ -#if ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) - VM_OC_SET_COMPUTED_PROPERTY, /**< set computed property */ -#endif /* ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */ - VM_OC_SET_GETTER, /**< set getter */ - VM_OC_SET_SETTER, /**< set setter */ - VM_OC_PUSH_UNDEFINED_BASE, /**< push undefined base */ - VM_OC_PUSH_ARRAY, /**< push array */ - VM_OC_PUSH_ELISON, /**< push elison */ - VM_OC_APPEND_ARRAY, /**< append array */ - VM_OC_IDENT_REFERENCE, /**< ident reference */ - VM_OC_PROP_REFERENCE, /**< prop reference */ - VM_OC_PROP_GET, /**< prop get */ - - /* These eight opcodes must be in this order. */ - VM_OC_PROP_PRE_INCR, /**< prefix increment of a property */ - VM_OC_PROP_PRE_DECR, /**< prop prefix decrement of a property */ - VM_OC_PROP_POST_INCR, /**< prop postfix increment of a property */ - VM_OC_PROP_POST_DECR, /**< prop postfix decrement of a property */ - VM_OC_PRE_INCR, /**< prefix increment */ - VM_OC_PRE_DECR, /**< prefix decrement */ - VM_OC_POST_INCR, /**< postfix increment */ - VM_OC_POST_DECR, /**< postfix decrement */ - - VM_OC_PROP_DELETE, /**< delete property */ - VM_OC_DELETE, /**< delete */ - - VM_OC_MOV_IDENT, /**< move identifier register reference */ - VM_OC_ASSIGN, /**< assign */ - VM_OC_ASSIGN_PROP, /**< assign property */ - VM_OC_ASSIGN_PROP_THIS, /**< assign prop this */ - - VM_OC_RET, /**< return */ - VM_OC_THROW, /**< throw */ - VM_OC_THROW_REFERENCE_ERROR, /**< throw reference error */ - - VM_OC_EVAL, /**< eval */ - VM_OC_CALL, /**< call */ - VM_OC_NEW, /**< new */ - VM_OC_RESOLVE_BASE_FOR_CALL, /**< resolve base value before call */ - VM_OC_ERROR, /**< error while the vm_loop is suspended */ - - VM_OC_JUMP, /**< jump */ - VM_OC_BRANCH_IF_STRICT_EQUAL, /**< branch if stric equal */ - - /* These four opcodes must be in this order. */ - VM_OC_BRANCH_IF_TRUE, /**< branch if true */ - VM_OC_BRANCH_IF_FALSE, /**< branch if false */ - VM_OC_BRANCH_IF_LOGICAL_TRUE, /**< branch if logical true */ - VM_OC_BRANCH_IF_LOGICAL_FALSE, /**< branch if logical false */ - - VM_OC_PLUS, /**< unary plus */ - VM_OC_MINUS, /**< unary minus */ - VM_OC_NOT, /**< not */ - VM_OC_BIT_NOT, /**< bitwise not */ - VM_OC_VOID, /**< void */ - VM_OC_TYPEOF_IDENT, /**< typeof identifier */ - VM_OC_TYPEOF, /**< typeof */ - - VM_OC_ADD, /**< binary add */ - VM_OC_SUB, /**< binary sub */ - VM_OC_MUL, /**< mul */ - VM_OC_DIV, /**< div */ - VM_OC_MOD, /**< mod */ - - VM_OC_EQUAL, /**< equal */ - VM_OC_NOT_EQUAL, /**< not equal */ - VM_OC_STRICT_EQUAL, /**< strict equal */ - VM_OC_STRICT_NOT_EQUAL, /**< strict not equal */ - VM_OC_LESS, /**< less */ - VM_OC_GREATER, /**< greater */ - VM_OC_LESS_EQUAL, /**< less equal */ - VM_OC_GREATER_EQUAL, /**< greater equal */ - VM_OC_IN, /**< in */ - VM_OC_INSTANCEOF, /**< instanceof */ - - VM_OC_BIT_OR, /**< bitwise or */ - VM_OC_BIT_XOR, /**< bitwise xor */ - VM_OC_BIT_AND, /**< bitwise and */ - VM_OC_LEFT_SHIFT, /**< left shift */ - VM_OC_RIGHT_SHIFT, /**< right shift */ - VM_OC_UNS_RIGHT_SHIFT, /**< unsigned right shift */ - - VM_OC_WITH, /**< with */ - VM_OC_FOR_IN_CREATE_CONTEXT, /**< for in create context */ - VM_OC_FOR_IN_GET_NEXT, /**< get next */ - VM_OC_FOR_IN_HAS_NEXT, /**< has next */ -#if ENABLED (JERRY_ES2015_FOR_OF) - VM_OC_FOR_OF_CREATE_CONTEXT, /**< for of create context */ - VM_OC_FOR_OF_GET_NEXT, /**< get next */ - VM_OC_FOR_OF_HAS_NEXT, /**< has next */ -#endif /* ENABLED (JERRY_ES2015_FOR_OF) */ - VM_OC_TRY, /**< try */ - VM_OC_CATCH, /**< catch */ - VM_OC_FINALLY, /**< finally */ - VM_OC_CONTEXT_END, /**< context end */ - VM_OC_JUMP_AND_EXIT_CONTEXT, /**< jump and exit context */ -#if ENABLED (JERRY_ES2015_CLASS) - VM_OC_CLASS_HERITAGE, /**< create a super class context */ - VM_OC_CLASS_INHERITANCE, /**< inherit properties from the 'super' class */ - VM_OC_PUSH_CLASS_CONSTRUCTOR_AND_PROTOTYPE, /**< push class constructor */ - VM_OC_SET_CLASS_CONSTRUCTOR, /**< set class constructor to the given function literal */ - VM_OC_PUSH_IMPL_CONSTRUCTOR, /**< create implicit class constructor */ - VM_OC_CLASS_EXPR_CONTEXT_END, /**< class expression heritage context end */ - VM_OC_CLASS_EVAL, /**< eval inside a class */ - VM_OC_SUPER_CALL, /**< call the 'super' constructor */ - VM_OC_SUPER_PROP_REFERENCE, /**< resolve super property reference */ - VM_OC_PUSH_SUPER, /**< push resolvable super reference */ - VM_OC_PUSH_CONSTRUCTOR_SUPER, /**< push 'super' inside a class constructor */ - VM_OC_PUSH_CONSTRUCTOR_THIS, /**< push 'this' inside a class constructor */ - VM_OC_CONSTRUCTOR_RET, /**< explicit return from a class constructor */ -#endif /* ENABLED (JERRY_ES2015_CLASS) */ -#if ENABLED (JERRY_DEBUGGER) - VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */ - VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */ -#endif /* ENABLED (JERRY_DEBUGGER) */ -#if ENABLED (JERRY_LINE_INFO) - VM_OC_RESOURCE_NAME, /**< resource name of the current function */ - VM_OC_LINE, /**< line number of the next statement */ -#endif /* ENABLED (JERRY_LINE_INFO) */ - VM_OC_NONE, /**< a special opcode for unsupported byte codes */ -} vm_oc_types; - -/** - * Unused opcodes, but required by byte-code types. - */ -typedef enum -{ -#if !ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) - VM_OC_SET_COMPUTED_PROPERTY = VM_OC_NONE, /**< set computed property is unused */ -#endif /* !ENABLED (JERRY_ES2015_OBJECT_INITIALIZER) */ -#if !ENABLED (JERRY_DEBUGGER) - VM_OC_BREAKPOINT_ENABLED = VM_OC_NONE, /**< enabled breakpoint for debugger is unused */ - VM_OC_BREAKPOINT_DISABLED = VM_OC_NONE, /**< disabled breakpoint for debugger is unused */ -#endif /* !ENABLED (JERRY_DEBUGGER) */ -#if !ENABLED (JERRY_LINE_INFO) - VM_OC_RESOURCE_NAME = VM_OC_NONE, /**< resource name of the current function is unused */ - VM_OC_LINE = VM_OC_NONE, /**< line number of the next statement is unused */ -#endif /* !ENABLED (JERRY_LINE_INFO) */ -#if !ENABLED (JERRY_ES2015_CLASS) - VM_OC_CLASS_HERITAGE = VM_OC_NONE, /**< create a super class context */ - VM_OC_CLASS_INHERITANCE = VM_OC_NONE, /**< inherit properties from the 'super' class */ - VM_OC_PUSH_CLASS_CONSTRUCTOR_AND_PROTOTYPE = VM_OC_NONE, /**< push class constructor */ - VM_OC_SET_CLASS_CONSTRUCTOR = VM_OC_NONE, /**< set class constructor to the given function literal */ - VM_OC_PUSH_IMPL_CONSTRUCTOR = VM_OC_NONE, /**< create implicit class constructor */ - VM_OC_CLASS_EXPR_CONTEXT_END = VM_OC_NONE, /**< class expression heritage context end */ - VM_OC_CLASS_EVAL = VM_OC_NONE, /**< eval inside a class */ - VM_OC_SUPER_CALL = VM_OC_NONE, /**< call the 'super' constructor */ - VM_OC_SUPER_PROP_REFERENCE = VM_OC_NONE, /**< resolve super property reference */ - VM_OC_PUSH_SUPER = VM_OC_NONE, /**< push resolvable super reference */ - VM_OC_PUSH_CONSTRUCTOR_SUPER = VM_OC_NONE, /**< push 'super' inside a class constructor */ - VM_OC_PUSH_CONSTRUCTOR_THIS = VM_OC_NONE, /**< push 'this' inside a class constructor */ - VM_OC_CONSTRUCTOR_RET = VM_OC_NONE, /**< explicit return from a class constructor */ -#endif /* !ENABLED (JERRY_ES2015_CLASS) */ -#if !ENABLED (JERRY_ES2015_FOR_OF) - VM_OC_FOR_OF_CREATE_CONTEXT = VM_OC_NONE, /**< for of create context */ - VM_OC_FOR_OF_GET_NEXT = VM_OC_NONE, /**< get next */ - VM_OC_FOR_OF_HAS_NEXT = VM_OC_NONE, /**< has next */ -#endif /* !ENABLED (JERRY_ES2015_FOR_OF) */ - VM_OC_UNUSED = VM_OC_NONE /**< placeholder if the list is empty */ -} vm_oc_unused_types; - -/** - * Decrement operator. - */ -#define VM_OC_DECREMENT_OPERATOR_FLAG 0x1 - -/** - * Postfix increment/decrement operator. - */ -#define VM_OC_POST_INCR_DECR_OPERATOR_FLAG 0x2 - -/** - * An named variable is updated by the increment/decrement operator. - */ -#define VM_OC_IDENT_INCR_DECR_OPERATOR_FLAG 0x4 - -/** - * Jump to target offset if input value is logical false. - */ -#define VM_OC_BRANCH_IF_FALSE_FLAG 0x1 - -/** - * Branch optimized for logical and/or opcodes. - */ -#define VM_OC_LOGICAL_BRANCH_FLAG 0x2 - -/** - * Bit index shift for non-static property initializers. - */ -#define VM_OC_NON_STATIC_SHIFT 14 - -/** - * This flag is set for static property initializers. - */ -#define VM_OC_NON_STATIC_FLAG (0x1 << VM_OC_NON_STATIC_SHIFT) - -/** - * Position of "put result" opcode. - */ -#define VM_OC_PUT_RESULT_SHIFT 10 - -/** - * Mask of "put result" opcode. - */ -#define VM_OC_PUT_RESULT_MASK 0xf - -/** - * Generate a "put result" opcode flag bit. - */ -#define VM_OC_PUT_RESULT_CREATE_FLAG(V) (((V) & VM_OC_PUT_RESULT_MASK) << VM_OC_PUT_RESULT_SHIFT) - -/** - * Checks whether the result is stored somewhere. - */ -#define VM_OC_HAS_PUT_RESULT(V) ((V) & (VM_OC_PUT_RESULT_MASK << VM_OC_PUT_RESULT_SHIFT)) - -/** - * Specify where the result is stored - */ -typedef enum -{ - VM_OC_PUT_IDENT = VM_OC_PUT_RESULT_CREATE_FLAG (0x1), - VM_OC_PUT_REFERENCE = VM_OC_PUT_RESULT_CREATE_FLAG (0x2), - VM_OC_PUT_STACK = VM_OC_PUT_RESULT_CREATE_FLAG (0x4), - VM_OC_PUT_BLOCK = VM_OC_PUT_RESULT_CREATE_FLAG (0x8), -} vm_oc_put_types; - -/** - * Non-recursive vm_loop: the vm_loop can be suspended - * to execute a call /construct operation. These return - * types of the vm_loop tells whether a call operation - * is in progress or the vm_loop is finished. - */ -typedef enum -{ - VM_NO_EXEC_OP, /**< do nothing */ - VM_EXEC_CALL, /**< invoke a function */ - VM_EXEC_SUPER_CALL, /**< invoke a function through 'super' keyword */ - VM_EXEC_CONSTRUCT, /**< construct a new object */ -} vm_call_operation; - -ecma_value_t vm_run_global (const ecma_compiled_code_t *bytecode_p); -ecma_value_t vm_run_eval (ecma_compiled_code_t *bytecode_data_p, uint32_t parse_opts); - -#if ENABLED (JERRY_ES2015_MODULE_SYSTEM) -ecma_value_t vm_run_module (const ecma_compiled_code_t *bytecode_p, ecma_object_t *lex_env_p); -#endif /* ENABLED (JERRY_ES2015_MODULE_SYSTEM) */ - -ecma_value_t vm_run (const ecma_compiled_code_t *bytecode_header_p, ecma_value_t this_binding_value, - ecma_object_t *lex_env_p, uint32_t parse_opts, const ecma_value_t *arg_list_p, - ecma_length_t arg_list_len); - -bool vm_is_strict_mode (void); -bool vm_is_direct_eval_form_call (void); - -ecma_value_t vm_get_backtrace (uint32_t max_depth); - -/** - * @} - * @} - */ - -#endif /* !VM_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/arg-internal.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/arg-internal.h deleted file mode 100755 index 3f9c4fe07..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/arg-internal.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_ARG_INTERNAL_H -#define JERRYX_ARG_INTERNAL_H - -#include "jerryscript.h" - -/** - * The iterator structor for JS arguments. - */ -struct jerryx_arg_js_iterator_t -{ - const jerry_value_t *js_arg_p; /**< the JS arguments */ - const jerry_length_t js_arg_cnt; /**< the total num of JS arguments */ - jerry_length_t js_arg_idx; /**< current index of JS argument */ -}; - -#endif /* !JERRYX_ARG_INTERNAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/debugger-sha1.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/debugger-sha1.h deleted file mode 100755 index 16fe56362..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/debugger-sha1.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef DEBUGGER_SHA1_H -#define DEBUGGER_SHA1_H - -#include "jerryscript-debugger-transport.h" - -#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) - -/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */ - -void jerryx_debugger_compute_sha1 (const uint8_t *input1, size_t input1_len, - const uint8_t *input2, size_t input2_len, - uint8_t output[20]); - -#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */ - -#endif /* !DEBUGGER_SHA1_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/handle-scope-internal.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/handle-scope-internal.h deleted file mode 100755 index 34d80a31f..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/handle-scope-internal.h +++ /dev/null @@ -1,89 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_HANDLE_SCOPE_INTERNAL_H -#define JERRYX_HANDLE_SCOPE_INTERNAL_H - -#include "jerryscript.h" -#include "jerryscript-port.h" -#include "jerryscript-ext/handle-scope.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#define JERRYX_HANDLE_SCOPE_ASSERT(x) \ - do \ - { \ - if (!(x)) \ - { \ - jerry_port_log (JERRY_LOG_LEVEL_ERROR, \ - "JerryXHandleScope: Assertion '%s' failed at %s(%s):%lu.\n", \ - #x, \ - __FILE__, \ - __func__, \ - (unsigned long) __LINE__); \ - jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \ - } \ - } while (0) - -/** MARK: - handle-scope-allocator.c */ -typedef struct jerryx_handle_scope_pool_s jerryx_handle_scope_pool_t; -/** - * A linear allocating memory pool for type jerryx_handle_scope_t, - * in which allocated item shall be released in reversed order of allocation - */ -struct jerryx_handle_scope_pool_s -{ - jerryx_handle_scope_t prelist[JERRYX_SCOPE_PRELIST_SIZE]; /**< inlined handle scopes in the pool */ - size_t count; /**< number of handle scopes in the pool */ - jerryx_handle_scope_dynamic_t *start; /**< start address of dynamically allocated handle scope list */ -}; - -jerryx_handle_scope_t * -jerryx_handle_scope_get_parent (jerryx_handle_scope_t *scope); - -jerryx_handle_scope_t * -jerryx_handle_scope_get_child (jerryx_handle_scope_t *scope); - -jerryx_handle_scope_t * -jerryx_handle_scope_alloc (void); - -void -jerryx_handle_scope_free (jerryx_handle_scope_t *scope); -/** MARK: - END handle-scope-allocator.c */ - -/** MARK: - handle-scope.c */ -void -jerryx_handle_scope_release_handles (jerryx_handle_scope scope); - -jerry_value_t -jerryx_hand_scope_escape_handle_from_prelist (jerryx_handle_scope scope, size_t idx); - -jerry_value_t -jerryx_handle_scope_add_handle_to (jerryx_handle_t *handle, jerryx_handle_scope scope); - -jerryx_handle_scope_status -jerryx_escape_handle_internal (jerryx_escapable_handle_scope scope, - jerry_value_t escapee, - jerry_value_t *result, - bool should_promote); -/** MARK: - END handle-scope.c */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* !JERRYX_HANDLE_SCOPE_INTERNAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/arg.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/arg.h deleted file mode 100755 index 8171bcf3c..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/arg.h +++ /dev/null @@ -1,198 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_ARG_H -#define JERRYX_ARG_H - -#include -#include -#include -#include "jerryscript.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/** - * The forward declaration of jerryx_arg_t. - */ -typedef struct jerryx_arg_t jerryx_arg_t; - -/** - * The forward declaration of jerryx_arg_js_iterator_t - */ -typedef struct jerryx_arg_js_iterator_t jerryx_arg_js_iterator_t; - -/** - * Signature of the transform function. - */ -typedef jerry_value_t (*jerryx_arg_transform_func_t) (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS args */ - const jerryx_arg_t *c_arg_p); /**< native arg */ - -/** - * The structure used in jerryx_arg_object_properties - */ -typedef struct -{ - const jerry_char_t **name_p; /**< property name list of the JS object */ - jerry_length_t name_cnt; /**< count of the name list */ - const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */ - jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */ -} jerryx_arg_object_props_t; - -/** - * The structure used in jerryx_arg_array - */ -typedef struct -{ - const jerryx_arg_t *c_arg_p; /**< points to the array of transformation steps */ - jerry_length_t c_arg_cnt; /**< the count of the `c_arg_p` array */ -} jerryx_arg_array_items_t; - -/** - * The structure defining a single validation & transformation step. - */ -struct jerryx_arg_t -{ - jerryx_arg_transform_func_t func; /**< the transform function */ - void *dest; /**< pointer to destination where func should store the result */ - uintptr_t extra_info; /**< extra information, specific to func */ -}; - -jerry_value_t jerryx_arg_transform_this_and_args (const jerry_value_t this_val, - const jerry_value_t *js_arg_p, - const jerry_length_t js_arg_cnt, - const jerryx_arg_t *c_arg_p, - jerry_length_t c_arg_cnt); - -jerry_value_t jerryx_arg_transform_args (const jerry_value_t *js_arg_p, - const jerry_length_t js_arg_cnt, - const jerryx_arg_t *c_arg_p, - jerry_length_t c_arg_cnt); - -jerry_value_t jerryx_arg_transform_object_properties (const jerry_value_t obj_val, - const jerry_char_t **name_p, - const jerry_length_t name_cnt, - const jerryx_arg_t *c_arg_p, - jerry_length_t c_arg_cnt); -jerry_value_t jerryx_arg_transform_array (const jerry_value_t array_val, - const jerryx_arg_t *c_arg_p, - jerry_length_t c_arg_cnt); - -/** - * Indicates whether an argument is allowed to be coerced into the expected JS type. - */ -typedef enum -{ - JERRYX_ARG_COERCE, /**< the transform inside will invoke toNumber, toBoolean or toString */ - JERRYX_ARG_NO_COERCE /**< the type coercion is not allowed. */ -} jerryx_arg_coerce_t; - -/** - * Indicates whether an argument is optional or required. - */ -typedef enum -{ - /** - * The argument is optional. If the argument is `undefined` the transform is - * successful and `c_arg_p->dest` remains untouched. - */ - JERRYX_ARG_OPTIONAL, - /** - * The argument is required. If the argument is `undefined` the transform - * will fail and `c_arg_p->dest` remains untouched. - */ - JERRYX_ARG_REQUIRED -} jerryx_arg_optional_t; - -/** - * Indicates the rounding policy which will be chosen to transform an integer. - */ -typedef enum -{ - JERRYX_ARG_ROUND, /**< round */ - JERRYX_ARG_FLOOR, /**< floor */ - JERRYX_ARG_CEIL /**< ceil */ -} jerryx_arg_round_t; - -/** - * Indicates the clamping policy which will be chosen to transform an integer. - * If the policy is NO_CLAMP, and the number is out of range, - * then the transformer will throw a range error. - */ -typedef enum -{ - JERRYX_ARG_CLAMP,/**< clamp the number when it is out of range */ - JERRYX_ARG_NO_CLAMP /**< throw a range error */ -} jerryx_arg_clamp_t; - -/* Inline functions for initializing jerryx_arg_t */ - -#define JERRYX_ARG_INTEGER(type) \ - static inline jerryx_arg_t \ - jerryx_arg_ ## type (type ## _t *dest, \ - jerryx_arg_round_t round_flag, \ - jerryx_arg_clamp_t clamp_flag, \ - jerryx_arg_coerce_t coerce_flag, \ - jerryx_arg_optional_t opt_flag); - -JERRYX_ARG_INTEGER (uint8) -JERRYX_ARG_INTEGER (int8) -JERRYX_ARG_INTEGER (uint16) -JERRYX_ARG_INTEGER (int16) -JERRYX_ARG_INTEGER (uint32) -JERRYX_ARG_INTEGER (int32) - -#undef JERRYX_ARG_INTEGER - -static inline jerryx_arg_t -jerryx_arg_number (double *dest, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_boolean (bool *dest, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_string (char *dest, uint32_t size, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_utf8_string (char *dest, uint32_t size, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_function (jerry_value_t *dest, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_native_pointer (void **dest, const jerry_object_native_info_t *info_p, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_ignore (void); -static inline jerryx_arg_t -jerryx_arg_custom (void *dest, uintptr_t extra_info, jerryx_arg_transform_func_t func); -static inline jerryx_arg_t -jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props_p, jerryx_arg_optional_t opt_flag); -static inline jerryx_arg_t -jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p, jerryx_arg_optional_t opt_flag); - -jerry_value_t -jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p, - const jerryx_arg_t *c_arg_p, - jerryx_arg_transform_func_t func); - -/* Helper functions for transform functions. */ -jerry_value_t jerryx_arg_js_iterator_pop (jerryx_arg_js_iterator_t *js_arg_iter_p); -jerry_value_t jerryx_arg_js_iterator_restore (jerryx_arg_js_iterator_t *js_arg_iter_p); -jerry_value_t jerryx_arg_js_iterator_peek (jerryx_arg_js_iterator_t *js_arg_iter_p); -jerry_length_t jerryx_arg_js_iterator_index (jerryx_arg_js_iterator_t *js_arg_iter_p); - -#include "arg.impl.h" - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* !JERRYX_ARG_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/arg.impl.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/arg.impl.h deleted file mode 100755 index 1b3111e5a..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/arg.impl.h +++ /dev/null @@ -1,443 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_ARG_IMPL_H -#define JERRYX_ARG_IMPL_H - -/* transform functions for each type. */ - -#define JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL(type) \ - jerry_value_t jerryx_arg_transform_ ## type (jerryx_arg_js_iterator_t *js_arg_iter_p, \ - const jerryx_arg_t *c_arg_p); \ - jerry_value_t jerryx_arg_transform_ ## type ## _optional (jerryx_arg_js_iterator_t *js_arg_iter_p, \ - const jerryx_arg_t *c_arg_p); - -#define JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT(type) \ - JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type) \ - JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type ## _strict) - -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint8) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int8) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint16) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int16) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint32) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int32) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (number) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (string) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (utf8_string) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (boolean) - -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (function) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (native_pointer) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (object_props) -JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (array_items) - -jerry_value_t jerryx_arg_transform_ignore (jerryx_arg_js_iterator_t *js_arg_iter_p, - const jerryx_arg_t *c_arg_p); - -#undef JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL -#undef JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT - -/** - * The structure indicates the options used to transform integer argument. - * It will be passed into jerryx_arg_t's extra_info field. - */ -typedef struct -{ - uint8_t round; /**< rounding policy */ - uint8_t clamp; /**< clamping policy */ -} jerryx_arg_int_option_t; - -/** - * The macro used to generate jerryx_arg_xxx for int type. - */ -#define JERRYX_ARG_INT(type) \ - static inline jerryx_arg_t \ - jerryx_arg_ ## type (type ## _t *dest, \ - jerryx_arg_round_t round_flag, \ - jerryx_arg_clamp_t clamp_flag, \ - jerryx_arg_coerce_t coerce_flag, \ - jerryx_arg_optional_t opt_flag) \ - { \ - jerryx_arg_transform_func_t func; \ - if (coerce_flag == JERRYX_ARG_NO_COERCE) \ - { \ - if (opt_flag == JERRYX_ARG_OPTIONAL) \ - { \ - func = jerryx_arg_transform_ ## type ## _strict_optional; \ - } \ - else \ - { \ - func = jerryx_arg_transform_ ## type ## _strict; \ - } \ - } \ - else \ - { \ - if (opt_flag == JERRYX_ARG_OPTIONAL) \ - { \ - func = jerryx_arg_transform_ ## type ## _optional; \ - } \ - else \ - { \ - func = jerryx_arg_transform_ ## type; \ - } \ - } \ - union \ - { \ - jerryx_arg_int_option_t int_option; \ - uintptr_t extra_info; \ - } u = { .int_option = { .round = (uint8_t) round_flag, .clamp = (uint8_t) clamp_flag } }; \ - return (jerryx_arg_t) \ - { \ - .func = func, \ - .dest = (void *) dest, \ - .extra_info = u.extra_info \ - }; \ - } - -JERRYX_ARG_INT (uint8) -JERRYX_ARG_INT (int8) -JERRYX_ARG_INT (uint16) -JERRYX_ARG_INT (int16) -JERRYX_ARG_INT (uint32) -JERRYX_ARG_INT (int32) - -#undef JERRYX_ARG_INT - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `number` JS argument and stores it into a C `double`. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_number (double *dest, /**< pointer to the double where the result should be stored */ - jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (coerce_flag == JERRYX_ARG_NO_COERCE) - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_number_strict_optional; - } - else - { - func = jerryx_arg_transform_number_strict; - } - } - else - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_number_optional; - } - else - { - func = jerryx_arg_transform_number; - } - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest - }; -} /* jerryx_arg_number */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `boolean` JS argument and stores it into a C `bool`. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_boolean (bool *dest, /**< points to the native bool */ - jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (coerce_flag == JERRYX_ARG_NO_COERCE) - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_boolean_strict_optional; - } - else - { - func = jerryx_arg_transform_boolean_strict; - } - } - else - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_boolean_optional; - } - else - { - func = jerryx_arg_transform_boolean; - } - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest - }; -} /* jerryx_arg_boolean */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `string` JS argument and stores it into a C `char` array. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_string (char *dest, /**< pointer to the native char array where the result should be stored */ - uint32_t size, /**< the size of native char array */ - jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (coerce_flag == JERRYX_ARG_NO_COERCE) - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_string_strict_optional; - } - else - { - func = jerryx_arg_transform_string_strict; - } - } - else - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_string_optional; - } - else - { - func = jerryx_arg_transform_string; - } - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest, - .extra_info = (uintptr_t) size - }; -} /* jerryx_arg_string */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `string` JS argument and stores it into a C utf8 `char` array. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_utf8_string (char *dest, /**< [out] pointer to the native char array where the result should be stored */ - uint32_t size, /**< the size of native char array */ - jerryx_arg_coerce_t coerce_flag, /**< whether type coercion is allowed */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (coerce_flag == JERRYX_ARG_NO_COERCE) - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_utf8_string_strict_optional; - } - else - { - func = jerryx_arg_transform_utf8_string_strict; - } - } - else - { - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_utf8_string_optional; - } - else - { - func = jerryx_arg_transform_utf8_string; - } - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest, - .extra_info = (uintptr_t) size - }; -} /* jerryx_arg_utf8_string */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `function` JS argument and stores it into a C `jerry_value_t`. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_function (jerry_value_t *dest, /**< pointer to the jerry_value_t where the result should be stored */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_function_optional; - } - else - { - func = jerryx_arg_transform_function; - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest - }; -} /* jerryx_arg_function */ - -/** - * Create a validation/transformation step (`jerryx_arg_t`) that expects to - * consume one `object` JS argument that is 'backed' with a native pointer with - * a given type info. In case the native pointer info matches, the transform - * will succeed and the object's native pointer will be assigned to *dest. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_native_pointer (void **dest, /**< pointer to where the resulting native pointer should be stored */ - const jerry_object_native_info_t *info_p, /**< expected the type info */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_native_pointer_optional; - } - else - { - func = jerryx_arg_transform_native_pointer; - } - - return (jerryx_arg_t) - { - .func = func, - .dest = (void *) dest, - .extra_info = (uintptr_t) info_p - }; -} /* jerryx_arg_native_pointer */ - -/** - * Create a jerryx_arg_t instance for ignored argument. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_ignore (void) -{ - return (jerryx_arg_t) - { - .func = jerryx_arg_transform_ignore - }; -} /* jerryx_arg_ignore */ - -/** - * Create a jerryx_arg_t instance with custom transform. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_custom (void *dest, /**< pointer to the native argument where the result should be stored */ - uintptr_t extra_info, /**< the extra parameter, specific to the transform function */ - jerryx_arg_transform_func_t func) /**< the custom transform function */ -{ - return (jerryx_arg_t) - { - .func = func, - .dest = dest, - .extra_info = extra_info - }; -} /* jerryx_arg_custom */ - -/** - * Create a jerryx_arg_t instance for object properties. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props, /**< pointer to object property mapping */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_object_props_optional; - } - else - { - func = jerryx_arg_transform_object_props; - } - - return (jerryx_arg_t) - { - .func = func, - .dest = NULL, - .extra_info = (uintptr_t) object_props - }; -} /* jerryx_arg_object_properties */ - -/** - * Create a jerryx_arg_t instance for array. - * - * @return a jerryx_arg_t instance. - */ -static inline jerryx_arg_t -jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p, /**< pointer to array items mapping */ - jerryx_arg_optional_t opt_flag) /**< whether the argument is optional */ -{ - jerryx_arg_transform_func_t func; - - if (opt_flag == JERRYX_ARG_OPTIONAL) - { - func = jerryx_arg_transform_array_items_optional; - } - else - { - func = jerryx_arg_transform_array_items; - } - - return (jerryx_arg_t) - { - .func = func, - .dest = NULL, - .extra_info = (uintptr_t) array_items_p - }; -} /* jerryx_arg_array */ - -#endif /* !JERRYX_ARG_IMPL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/autorelease.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/autorelease.h deleted file mode 100755 index f7cf7dea1..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/autorelease.h +++ /dev/null @@ -1,54 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_AUTORELEASE_H -#define JERRYX_AUTORELEASE_H - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#include "autorelease.impl.h" - -/* - * Macro for `const jerry_value_t` for which jerry_release_value () is - * automatically called when the variable goes out of scope. - * - * Example usage: - * static void foo (bool enable) - * { - * JERRYX_AR_VALUE_T bar = jerry_create_string (...); - * - * if (enable) { - * JERRYX_AR_VALUE_T baz = jerry_get_global_object (); - * - * // ... - * - * // jerry_release_value (baz) and jerry_release_value (bar) is called automatically before - * // returning, because `baz` and `bar` go out of scope. - * return; - * } - * - * // jerry_release_value (bar) is called automatically when the function returns, - * // because `bar` goes out of scope. - * } - */ -#define JERRYX_AR_VALUE_T __JERRYX_AR_VALUE_T_IMPL - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* !JERRYX_AUTORELEASE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/autorelease.impl.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/autorelease.impl.h deleted file mode 100755 index 558b17095..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/autorelease.impl.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_AUTORELEASE_IMPL_H -#define JERRYX_AUTORELEASE_IMPL_H - -#include "jerryscript.h" - -#ifdef __GNUC__ -/* - * Calls jerry_release_value (*value). - * The GCC __cleanup__ function must take a pointer to the variable to clean up. - * - * @return void - */ -static inline void -jerryx_autorelease_cleanup (const jerry_value_t *value) /**< jerry value */ -{ - jerry_release_value (*value); -} /* jerryx_autorelease_cleanup */ - -#define __JERRYX_AR_VALUE_T_IMPL const jerry_value_t __attribute__ ((__cleanup__(jerryx_autorelease_cleanup))) -#else /* !__GNUC__ */ -/* TODO: for other compilers */ -#error "No autorelease implementation for your compiler!" -#endif /* __GNUC__ */ - -#endif /* !JERRYX_AUTORELEASE_IMPL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/handle-scope.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/handle-scope.h deleted file mode 100755 index bd871fb73..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/handle-scope.h +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_HANDLE_SCOPE_H -#define JERRYX_HANDLE_SCOPE_H - -#include "jerryscript.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifndef JERRYX_HANDLE_PRELIST_SIZE -#define JERRYX_HANDLE_PRELIST_SIZE 20 -#endif - -#ifndef JERRYX_SCOPE_PRELIST_SIZE -#define JERRYX_SCOPE_PRELIST_SIZE 20 -#endif - -#define STATIC_ASSERT(COND,MSG) typedef char static_assertion_##MSG[(COND)?1:-1] - -STATIC_ASSERT (JERRYX_SCOPE_PRELIST_SIZE < 32, JERRYX_SCOPE_PRELIST_SIZE_must_be_less_than_size_of_uint8_t); - -#undef STATIC_ASSERT - -typedef struct jerryx_handle_t jerryx_handle_t; -/** - * Dynamically allocated handle in the scopes. - * Scopes has it's own size-limited linear storage of handles. Still there - * might be not enough space left for new handles, dynamically allocated - * `jerryx_handle_t` could ease the pre-allocated linear memory burden. - */ -struct jerryx_handle_t -{ - jerry_value_t jval; /**< jerry value of the handle bound to */ - jerryx_handle_t *sibling; /**< next sibling the the handle */ -}; - -#define JERRYX_HANDLE_SCOPE_FIELDS \ - jerry_value_t handle_prelist[JERRYX_HANDLE_PRELIST_SIZE]; \ - uint8_t prelist_handle_count; \ - bool escaped; \ - jerryx_handle_t *handle_ptr - -typedef struct jerryx_handle_scope_s jerryx_handle_scope_t; -typedef jerryx_handle_scope_t *jerryx_handle_scope; -typedef jerryx_handle_scope_t *jerryx_escapable_handle_scope; -/** - * Inlined simple handle scope type. - */ -struct jerryx_handle_scope_s -{ - JERRYX_HANDLE_SCOPE_FIELDS; /**< common handle scope fields */ -}; - - -typedef struct jerryx_handle_scope_dynamic_s jerryx_handle_scope_dynamic_t; -/** - * Dynamically allocated handle scope type. - */ -struct jerryx_handle_scope_dynamic_s -{ - JERRYX_HANDLE_SCOPE_FIELDS; /**< common handle scope fields */ - jerryx_handle_scope_dynamic_t *child; /**< child dynamically allocated handle scope */ - jerryx_handle_scope_dynamic_t *parent; /**< parent dynamically allocated handle scope */ -}; - -#undef JERRYX_HANDLE_SCOPE_FIELDS - -typedef enum -{ - jerryx_handle_scope_ok = 0, - - jerryx_escape_called_twice, - jerryx_handle_scope_mismatch, -} jerryx_handle_scope_status; - -jerryx_handle_scope_status -jerryx_open_handle_scope (jerryx_handle_scope *result); - -jerryx_handle_scope_status -jerryx_close_handle_scope (jerryx_handle_scope scope); - -jerryx_handle_scope_status -jerryx_open_escapable_handle_scope (jerryx_handle_scope *result); - -jerryx_handle_scope_status -jerryx_close_escapable_handle_scope (jerryx_handle_scope scope); - -jerryx_handle_scope_status -jerryx_escape_handle (jerryx_escapable_handle_scope scope, - jerry_value_t escapee, - jerry_value_t *result); - -/** - * Completely escape a handle from handle scope, - * leave life time management totally up to user. - */ -jerryx_handle_scope_status -jerryx_remove_handle (jerryx_escapable_handle_scope scope, - jerry_value_t escapee, - jerry_value_t *result); - -jerry_value_t -jerryx_create_handle (jerry_value_t jval); - -jerry_value_t -jerryx_create_handle_in_scope (jerry_value_t jval, jerryx_handle_scope scope); - -/** MARK: - handle-scope-allocator.c */ -jerryx_handle_scope_t * -jerryx_handle_scope_get_current (void); - -jerryx_handle_scope_t * -jerryx_handle_scope_get_root (void); -/** MARK: - END handle-scope-allocator.c */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* !JERRYX_HANDLE_SCOPE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/module.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/module.h deleted file mode 100755 index 1c1025d56..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/module.h +++ /dev/null @@ -1,151 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYX_MODULE_H -#define JERRYX_MODULE_H - -#include "jerryscript.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/** - * Declare the signature for the module initialization function. - */ -typedef jerry_value_t (*jerryx_native_module_on_resolve_t) (void); - -/** - * Declare the structure used to define a module. One should only make use of this structure via the - * JERRYX_NATIVE_MODULE macro declared below. - */ -typedef struct jerryx_native_module_t -{ - const jerry_char_t *name_p; /**< name of the module */ - const jerryx_native_module_on_resolve_t on_resolve_p; /**< function that returns a new instance of the module */ - struct jerryx_native_module_t *next_p; /**< pointer to next module in the list */ -} jerryx_native_module_t; - -/** - * Declare the constructor and destructor attributes. These evaluate to nothing if this extension is built without - * library constructor/destructor support. - */ -#ifdef ENABLE_INIT_FINI -#ifdef _MSC_VER -#error "`FEATURE_INIT_FINI` build flag isn't supported on Windows, because Microsoft Visual C/C++ Compiler \ -doesn't support library constructors and destructors." -#endif -#define JERRYX_MODULE_CONSTRUCTOR_ATTRIBUTE __attribute__((constructor)) -#define JERRYX_MODULE_DESTRUCTOR_ATTRIBUTE __attribute__((destructor)) -#define JERRYX_MODULE_REGISTRATION_QUALIFIER static -#else /* !ENABLE_INIT_FINI */ -#define JERRYX_MODULE_CONSTRUCTOR_ATTRIBUTE -#define JERRYX_MODULE_DESTRUCTOR_ATTRIBUTE -#define JERRYX_MODULE_REGISTRATION_QUALIFIER -#endif /* ENABLE_INIT_FINI */ - -/** - * Having two levels of macros allows strings to be used unquoted. - */ -#define JERRYX_NATIVE_MODULE(module_name, on_resolve_cb) \ - JERRYX_NATIVE_MODULE_IMPLEM(module_name, on_resolve_cb) - -#define JERRYX_NATIVE_MODULE_IMPLEM(module_name, on_resolve_cb) \ - static jerryx_native_module_t _ ## module_name ## _definition = \ - { \ - .name_p = (jerry_char_t *) #module_name, \ - .on_resolve_p = (on_resolve_cb), \ - .next_p = NULL \ - }; \ - \ - JERRYX_MODULE_REGISTRATION_QUALIFIER void \ - module_name ## _register (void) JERRYX_MODULE_CONSTRUCTOR_ATTRIBUTE; \ - JERRYX_MODULE_REGISTRATION_QUALIFIER void \ - module_name ## _register (void) \ - { \ - jerryx_native_module_register(&_##module_name##_definition); \ - } \ - \ - JERRYX_MODULE_REGISTRATION_QUALIFIER void \ - module_name ## _unregister (void) \ - JERRYX_MODULE_DESTRUCTOR_ATTRIBUTE; \ - JERRYX_MODULE_REGISTRATION_QUALIFIER void \ - module_name ## _unregister (void) \ - { \ - jerryx_native_module_unregister(&_##module_name##_definition); \ - } - -/** - * Register a native module. This makes it available for loading via jerryx_module_resolve, when - * jerryx_module_native_resolver is passed in as a possible resolver. - */ -void jerryx_native_module_register (jerryx_native_module_t *module_p); - -/** - * Unregister a native module. This removes the module from the list of available native modules, meaning that - * subsequent calls to jerryx_module_resolve with jerryx_module_native_resolver will not be able to find it. - */ -void jerryx_native_module_unregister (jerryx_native_module_t *module_p); - -/** - * Declare the function pointer type for canonical name resolution. - */ -typedef jerry_value_t (*jerryx_module_get_canonical_name_t) (const jerry_value_t name); /**< The name for which to - * compute the canonical - * name */ - -/** - * Declare the function pointer type for module resolution. - */ -typedef bool (*jerryx_module_resolve_t) (const jerry_value_t canonical_name, /**< The module's canonical name */ - jerry_value_t *result); /**< The resulting module, if the function returns - * true */ - -/** - * Declare the structure for module resolvers. - */ -typedef struct -{ - jerryx_module_get_canonical_name_t get_canonical_name_p; /**< function pointer to establish the canonical name of a - * module */ - jerryx_module_resolve_t resolve_p; /**< function pointer to resolve a module */ -} jerryx_module_resolver_t; - -/** - * Declare the JerryScript module resolver so that it may be added to an array of jerryx_module_resolver_t items and - * thus passed to jerryx_module_resolve. - */ -extern jerryx_module_resolver_t jerryx_module_native_resolver; - -/** - * Load a copy of a module into the current context using the provided module resolvers, or return one that was already - * loaded if it is found. - */ -jerry_value_t jerryx_module_resolve (const jerry_value_t name, - const jerryx_module_resolver_t **resolvers, - size_t count); - -/** - * Delete a module from the cache or, if name has the JavaScript value of undefined, clear the entire cache. - */ -void jerryx_module_clear_cache (const jerry_value_t name, - const jerryx_module_resolver_t **resolvers, - size_t count); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* !JERRYX_MODULE_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jext-common.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jext-common.h deleted file mode 100755 index 9c59e0b0d..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jext-common.h +++ /dev/null @@ -1,95 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JEXT_COMMON_H -#define JEXT_COMMON_H - -#include -#include - -#include "jerryscript.h" -#include "jerryscript-port.h" - -/* - * Make sure unused parameters, variables, or expressions trigger no compiler warning. - */ -#define JERRYX_UNUSED(x) ((void) (x)) - -/* - * Asserts - * - * Warning: - * Don't use JERRY_STATIC_ASSERT in headers, because - * __LINE__ may be the same for asserts in a header - * and in an implementation file. - */ -#define JERRYX_STATIC_ASSERT_GLUE_(a, b, c) a ## b ## _ ## c -#define JERRYX_STATIC_ASSERT_GLUE(a, b, c) JERRYX_STATIC_ASSERT_GLUE_ (a, b, c) -#define JERRYX_STATIC_ASSERT(x, msg) \ - enum { JERRYX_STATIC_ASSERT_GLUE (static_assertion_failed_, __LINE__, msg) = 1 / (!!(x)) } - -#ifndef JERRY_NDEBUG -void JERRY_ATTR_NORETURN -jerry_assert_fail (const char *assertion, const char *file, const char *function, const uint32_t line); -void JERRY_ATTR_NORETURN -jerry_unreachable (const char *file, const char *function, const uint32_t line); - -#define JERRYX_ASSERT(x) \ - do \ - { \ - if (JERRY_UNLIKELY (!(x))) \ - { \ - jerry_assert_fail (#x, __FILE__, __func__, __LINE__); \ - } \ - } while (0) - -#define JERRYX_UNREACHABLE() \ - do \ - { \ - jerry_unreachable (__FILE__, __func__, __LINE__); \ - } while (0) -#else /* JERRY_NDEBUG */ -#define JERRYX_ASSERT(x) \ - do \ - { \ - if (false) \ - { \ - JERRYX_UNUSED (x); \ - } \ - } while (0) - -#ifdef __GNUC__ -#define JERRYX_UNREACHABLE() __builtin_unreachable () -#endif /* __GNUC__ */ - -#ifdef _MSC_VER -#define JERRYX_UNREACHABLE() _assume (0) -#endif /* _MSC_VER */ - -#ifndef JERRYX_UNREACHABLE -#define JERRYX_UNREACHABLE() -#endif /* !JERRYX_UNREACHABLE */ - -#endif /* !JERRY_NDEBUG */ - -/* - * Logging - */ -#define JERRYX_ERROR_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__) -#define JERRYX_WARNING_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_WARNING, __VA_ARGS__) -#define JERRYX_DEBUG_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__) -#define JERRYX_TRACE_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__) - -#endif /* !JEXT_COMMON_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrylibm/jerry-libm-internal.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrylibm/jerry-libm-internal.h deleted file mode 100755 index fb29c7f44..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrylibm/jerry-libm-internal.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * This file is based on work under the following copyright and permission - * notice: - * - * Copyright (C) 2004 by Sun Microsystems, Inc. All rights reserved. - * - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * - * @(#)fdlibm.h 1.5 04/04/22 - */ - -#ifndef JERRY_LIBM_INTERNAL_H -#define JERRY_LIBM_INTERNAL_H - -/* Sometimes it's necessary to define __LITTLE_ENDIAN explicitly - but these catch some common cases. */ - - -#ifndef __LITTLE_ENDIAN -/* Check if compiler has byte order macro. Some older versions do not. - * If byte order is supported and set to little or target is among common - * cases checked define __LITTLE_ENDIAN. - */ -#if (defined (i386) || defined (__i386) || defined (__i386__) || \ - defined (i486) || defined (__i486) || defined (__i486__) || \ - defined (intel) || defined (x86) || defined (i86pc) || \ - defined (__alpha) || defined (__osf__) || \ - defined (__x86_64__) || defined (__arm__) || defined (__aarch64__) || \ - defined (__xtensa__) || defined (__MIPSEL)) || \ -(defined (__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)) -#define __LITTLE_ENDIAN -#endif -#endif /* !__LITTLE_ENDIAN */ - -#ifdef __LITTLE_ENDIAN -#define __HI(x) *(1 + (const int *) &x) -#define __LO(x) *(const int *) &x -typedef union -{ - double dbl; - struct - { - int lo; - int hi; - } as_int; -} double_accessor; -#else /* !__LITTLE_ENDIAN */ -#define __HI(x) *(const int *) &x -#define __LO(x) *(1 + (const int *) &x) - -typedef union -{ - double dbl; - struct - { - int hi; - int lo; - } as_int; -} double_accessor; -#endif /* __LITTLE_ENDIAN */ - -#ifndef NAN -#define NAN (0.0/0.0) -#endif - -/* - * ANSI/POSIX - */ -double acos (double x); -double asin (double x); -double atan (double x); -double atan2 (double y, double x); -double cos (double x); -double sin (double x); -double tan (double x); - -double exp (double x); -double log (double x); - -double pow (double x, double y); -double sqrt (double x); - -double ceil (double x); -double fabs (double x); -double floor (double x); -double fmod (double x, double y); - -int isnan (double x); -int finite (double x); - -double nextafter (double x, double y); - -/* - * Functions callable from C, intended to support IEEE arithmetic. - */ -double copysign (double x, double y); -double scalbn (double x, int n); - -#endif /* !JERRY_LIBM_INTERNAL_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrylibm/math.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrylibm/math.h deleted file mode 100755 index 496c24267..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerrylibm/math.h +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRY_LIBM_MATH_H -#define JERRY_LIBM_MATH_H - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* General Constants. */ -#define INFINITY (1.0/0.0) -#define NAN (0.0/0.0) -#define HUGE_VAL INFINITY - -#define isnan(x) ((x) != (x)) -#define isinf(x) (((x) == INFINITY) || ((x) == -INFINITY)) -#define isfinite(x) (!(isinf(x)) && (x != NAN)) - -/* Exponential and Logarithmic constants. */ -#define M_E 2.7182818284590452353602874713526625 -#define M_SQRT2 1.4142135623730950488016887242096981 -#define M_SQRT1_2 0.7071067811865475244008443621048490 -#define M_LOG2E 1.4426950408889634073599246810018921 -#define M_LOG10E 0.4342944819032518276511289189166051 -#define M_LN2 0.6931471805599453094172321214581765 -#define M_LN10 2.3025850929940456840179914546843642 - -/* Trigonometric Constants. */ -#define M_PI 3.1415926535897932384626433832795029 -#define M_PI_2 1.5707963267948966192313216916397514 -#define M_PI_4 0.7853981633974483096156608458198757 -#define M_1_PI 0.3183098861837906715377675267450287 -#define M_2_PI 0.6366197723675813430755350534900574 -#define M_2_SQRTPI 1.1283791670955125738961589031215452 - -/* Trigonometric functions. */ -double cos (double); -double sin (double); -double tan (double); -double acos (double); -double asin (double); -double atan (double); -double atan2 (double, double); - -/* Exponential and logarithmic functions. */ -double exp (double); -double log (double); - -/* Power functions. */ -double pow (double, double); -double sqrt (double); - -/* Rounding and remainder functions. */ -double ceil (double); -double floor (double); - -/* Other functions. */ -double fabs (double); -double fmod (double, double); - -double nextafter (double, double); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* !JERRY_LIBM_MATH_H */ diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryport/jerryscript-port-default.h b/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryport/jerryscript-port-default.h deleted file mode 100755 index ba7208140..000000000 --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryport/jerryscript-port-default.h +++ /dev/null @@ -1,50 +0,0 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef JERRYSCRIPT_PORT_DEFAULT_H -#define JERRYSCRIPT_PORT_DEFAULT_H - -#include - -#include "jerryscript.h" -#include "jerryscript-port.h" - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/** \addtogroup jerry_port_default Default Jerry engine port API - * These functions are only available if the default port of Jerry is used. - * @{ - */ - -jerry_log_level_t jerry_port_default_get_log_level (void); -void jerry_port_default_set_log_level (jerry_log_level_t level); - -void jerry_port_default_set_current_context (jerry_context_t *context_p); - -typedef void (* fatal_handler_t)(int code); - -void jerry_port_default_set_fatal_handler (fatal_handler_t handler); - -/** - * @} - */ - -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /* !JERRYSCRIPT_PORT_DEFAULT_H */ diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/CMakeLists.txt b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/CMakeLists.txt new file mode 100644 index 000000000..10a7fa2ea --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/CMakeLists.txt @@ -0,0 +1,64 @@ +#=============================================================================== +# @brief cmake file +# Copyright (c) CompanyNameMagicTag 2022-2023. All rights reserved. +#=============================================================================== +set(COMPONENT_NAME "storage_jsapi") + +set(SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/kvstorekit/src/nativeapi_kv_impl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/kvstorekit/src/nativeapi_kv.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/filekit/src/nativeapi_fs_impl.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/filekit/src/nativeapi_fs.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/common/src/nativeapi_common.cpp +) + +set(PUBLIC_HEADER +) + +set(PRIVATE_HEADER + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/jsi + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/base + ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/base + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/innerkits + ${ROOT_DIR}/middleware/services/gui/uikit/utils/interfaces/kits/ + ${CMAKE_CURRENT_SOURCE_DIR}/common/include + ${CMAKE_CURRENT_SOURCE_DIR}/kvstorekit/include + ${CMAKE_CURRENT_SOURCE_DIR}/filekit/include +) + +set(PRIVATE_DEFINES +) + +set(PUBLIC_DEFINES + FEATURE_MODULE_STORAGE +) + +# use this when you want to add ccflags like -include xxx +set(COMPONENT_PUBLIC_CCFLAGS +) +set(COMPONENT_CCFLAGS + -std=c++11 + -Wno-error + -Wno-unused-parameter + -fno-exceptions + -fno-unwind-tables + -fno-asynchronous-unwind-tables + -Wno-undef + -Wno-bitwise-op-parentheses + -Wno-shift-op-parentheses + -nostdlibinc + -nostdinc + -nostdlib + -Wno-c++11-narrowing + -Wno-error=unused-function +) + +set(WHOLE_LINK + true +) + +set(MAIN_COMPONENT + false +) + +build_component() diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/common/include/nativeapi_common.h b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/common/include/nativeapi_common.h new file mode 100644 index 000000000..c72848fe9 --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/common/include/nativeapi_common.h @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef JS_NATIVE_API_COMMON_H +#define JS_NATIVE_API_COMMON_H + +#include "jsi/jsi.h" + +namespace OHOS { +namespace ACELite { +struct FuncParams { + JSIValue args = JSI::CreateUndefined(); + JSIValue thisVal = JSI::CreateUndefined(); + bool flag = false; +}; + +class NativeapiCommon { +public: + static void FailCallBack(const JSIValue thisVal, const JSIValue args, int ret); + static void SuccessCallBack(const JSIValue thisVal, const JSIValue args, JSIValue jsiValue); + static bool IsValidJSIValue(const JSIValue* args, uint8_t argsNum); +private: + NativeapiCommon() = default; + ~NativeapiCommon() = default; +}; +} +} + +#endif /* JS_NATIVE_API_CALLBACK_H */ \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/common/include/nativeapi_config.h b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/common/include/nativeapi_config.h new file mode 100644 index 000000000..a0a83948a --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/common/include/nativeapi_config.h @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef JS_NATIVE_API_CONFIG_H +#define JS_NATIVE_API_CONFIG_H + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* __cplusplus */ + +#define FILE_NAME_MAX_LEN 300 +#define URI_NAME_MAX_LEN 128 +#define TEXT_MAX_READ_LEN 4096 +#define DIR_LEVEL 5 +#define ERROR_CODE "code" +#define TEXT "text" +#define FILE_URI "uri" +#define FILE_SOURCE_URI "srcUri" +#define FILE_DESTINATION_URI "dstUri" +#define FILE_LENGTH "length" +#define FILE_LAST_MODIFIED_TIME "lastModifiedTime" +#define FILE_TYPE "type" +#define FILE_POSITION "position" +#define FILE_APPEND "append" +#define FILE_BUFFER "buffer" +#define KV_KEY "key" +#define KV_VALUE "value" +#define DEFAULT "default" +#define FILE_PREFIX "internal://app" +#define DEFAULT_FOLDER_PATH "kvstore" +#define TYPE_FILE "file" +#define TYPE_DIR "dir" +#define FILE_LIST "fileList" +#define RECURSIVE "recursive" +#define SUB_FILES "subFiles" +#define ERR_NO_FILE "File or directory not exist" +#define ERR_IO_EXCEPTION "I/O error" +#define ERR_ILLEGAL_PARAM "Invalid parameter" +#define ERR_GENERAL "System error" +#define ERR_READ_TOO_LONG "The content of the file to be read exceeds 4KB" + +#define NATIVE_FEATURE_ON 1 +#define NATIVE_FEATURE_OFF 0 + +enum ErrorCode { + NATIVE_SUCCESS = 0, + ERROR_FR_NO_FILE = -2, + ERROR_DIR_NOT_EMPTY = -39, + ERROR_CODE_GENERAL = -200, + ERROR_CODE_PARAM = -202, + ERROR_CODE_IO = -300, + ERROR_CODE_NO_FILE = -301, + ERROR_CODE_READ_TOO_LONG = -302 +}; + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* __cplusplus */ + +#endif /* JS_NATIVE_API_COMMON_H */ \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/common/src/nativeapi_common.cpp b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/common/src/nativeapi_common.cpp new file mode 100644 index 000000000..181beb2c5 --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/common/src/nativeapi_common.cpp @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nativeapi_common.h" +#include "jsi/jsi_types.h" +#include "nativeapi_config.h" + +namespace OHOS { +namespace ACELite { +void NativeapiCommon::FailCallBack(const JSIValue thisVal, const JSIValue args, int ret) +{ + if (JSI::ValueIsUndefined(args)) { + return; + } + JSIValue errInfo; + if (ret == ERROR_CODE_IO) { + errInfo = JSI::CreateString(ERR_IO_EXCEPTION); + ret = (-ERROR_CODE_IO); + } else if ((ret == ERROR_CODE_PARAM) || (ret == ERROR_DIR_NOT_EMPTY)) { + errInfo = JSI::CreateString(ERR_ILLEGAL_PARAM); + ret = (-ERROR_CODE_PARAM); + } else if (ret == ERROR_FR_NO_FILE) { + errInfo = JSI::CreateString(ERR_NO_FILE); + ret = (-ERROR_CODE_NO_FILE); + } else if (ret == ERROR_CODE_READ_TOO_LONG) { + errInfo = JSI::CreateString(ERR_READ_TOO_LONG); + ret = (-ERROR_CODE_READ_TOO_LONG); + } else { + errInfo = JSI::CreateString(ERR_GENERAL); + ret = (-ERROR_CODE_GENERAL); + } + JSIValue errCode = JSI::CreateNumber(ret); + JSIValue fail = JSI::GetNamedProperty(args, CB_FAIL); + JSIValue complete = JSI::GetNamedProperty(args, CB_COMPLETE); + JSIValue argv[ARGC_TWO] = {errInfo, errCode}; + if (!JSI::ValueIsUndefined(fail)) { + JSI::CallFunction(fail, thisVal, argv, ARGC_TWO); + } + if (!JSI::ValueIsUndefined(complete)) { + JSI::CallFunction(complete, thisVal, nullptr, 0); + } + JSI::ReleaseValueList(fail, complete, errInfo, errCode, ARGS_END); +} + +void NativeapiCommon::SuccessCallBack(const JSIValue thisVal, const JSIValue args, JSIValue jsiValue) +{ + if (JSI::ValueIsUndefined(args)) { + return; + } + JSIValue success = JSI::GetNamedProperty(args, CB_SUCCESS); + JSIValue complete = JSI::GetNamedProperty(args, CB_COMPLETE); + if (!JSI::ValueIsUndefined(success)) { + if (JSI::ValueIsUndefined(jsiValue)) { + JSI::CallFunction(success, thisVal, nullptr, 0); + } else { + JSI::CallFunction(success, thisVal, &jsiValue, ARGC_ONE); + } + } + if (!JSI::ValueIsUndefined(complete)) { + JSI::CallFunction(complete, thisVal, nullptr, 0); + } + JSI::ReleaseValueList(success, complete, ARGS_END); +} + +bool NativeapiCommon::IsValidJSIValue(const JSIValue* args, uint8_t argsNum) +{ + if ((args == nullptr) || (argsNum == 0) || JSI::ValueIsUndefined(args[0])) { + return false; + } + return true; +} +} +} diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/include/nativeapi_fs.h b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/include/nativeapi_fs.h new file mode 100644 index 000000000..2a3c2b5fd --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/include/nativeapi_fs.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef JS_NATIVE_API_FS_H +#define JS_NATIVE_API_FS_H + +#include "jsi/jsi.h" +#include "nativeapi_config.h" + +namespace OHOS { +namespace ACELite { +class NativeapiFs { +public: + NativeapiFs() = default; + ~NativeapiFs() = default; + + static JSIValue MoveFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue CopyFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue DeleteFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue GetFileList(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue GetFileInfo(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue WriteTextFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue ReadTextFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue Access(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue CreateDir(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue RemoveDir(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + +#if (JS_FWK_TYPEDARRAY == NATIVE_FEATURE_ON) + static JSIValue ReadArrayFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue WriteArrayFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); +#endif /* JS_FWK_TYPEDARRAY */ +}; +void InitNativeApiFs(JSIValue exports); +} // ACELite +} // OHOS + +#endif /* JS_NATIVE_API_FS_H */ diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/include/nativeapi_fs_impl.h b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/include/nativeapi_fs_impl.h new file mode 100644 index 000000000..6b1fdd5b5 --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/include/nativeapi_fs_impl.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef JS_NATIVE_API_FS_IMPL_H +#define JS_NATIVE_API_FS_IMPL_H + +#include +#include +#include +#include "nativeapi_config.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif +#endif /* __cplusplus */ + +typedef struct { + char fileName[FILE_NAME_MAX_LEN + 1]; + off_t fileSize; + time_t fileMtime; + mode_t fileMode; +} FileMetaInfo; + +int StatImpl(const char* path, struct stat* buf); +int DeleteFileImpl(const char* src); +int CopyFileImpl(const char* src, const char* dest); +int WriteTextFile(const char* fileName, const void* buf, size_t len, bool append); +int WriteArrayFile(const char* fileName, const void* buf, size_t len, unsigned int position, bool append); +int ReadFileImpl(const char* fileName, void* text, size_t len, unsigned int position, size_t* actualLen); +int GetFileListImpl(const char* dirName, FileMetaInfo* fileList, unsigned int listNum); +int GetFileNum(const char* dirName); +int AccessImpl(const char* fileName); +int CreateDirImpl(const char* fileName, bool recursive); +int RemoveDirImpl(const char* fileName, bool recursive); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* __cplusplus */ + +#endif /* JS_NATIVE_API_FS_IMPL_H */ \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp new file mode 100644 index 000000000..439832093 --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs.cpp @@ -0,0 +1,595 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nativeapi_fs.h" +#include +#include "ace_log.h" +#include +#include "ability_env.h" +#include "js_async_work.h" +#include "nativeapi_common.h" +#include "nativeapi_fs_impl.h" + +namespace OHOS { +namespace ACELite { +namespace { +char g_uriFullPath[FILE_NAME_MAX_LEN + 1] = {0}; +const unsigned int PREFIX_LEN = strlen(FILE_PREFIX); + +bool IsValidPath(const char* path) +{ + if (path == nullptr) { + return false; + } + + size_t pathLen = strnlen(path, URI_NAME_MAX_LEN + 1); + if (pathLen > URI_NAME_MAX_LEN) { + return false; + } + if ((pathLen < PREFIX_LEN) || (strncmp(path, FILE_PREFIX, PREFIX_LEN) != 0)) { + return false; + } + if ((strstr(path, "/./") != nullptr) || (strstr(path, "/../") != nullptr)) { + return false; + } + if (strpbrk(path + PREFIX_LEN, "\"*+,:;<=>\?[]|\x7F")) { + return false; + } + return true; +} + +int GetFullPath(const char* uri, char* fullPath, int len) +{ + if (!IsValidPath(uri) || (fullPath == nullptr)) { + return ERROR_CODE_PARAM; + } + const char* dataPath = GetDataPath(); + if (dataPath == nullptr) { + return ERROR_CODE_PARAM; + } + if (memset_s(fullPath, len, 0x0, len) != EOK) { + return ERROR_CODE_GENERAL; + } + if (sprintf_s(fullPath, len, "%s%s", dataPath, uri + PREFIX_LEN) < 0) { + return ERROR_CODE_GENERAL; + } + return NATIVE_SUCCESS; +} + +JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, + uint8_t argsNum, AsyncWorkHandler ExecuteFunc, bool flag = false) +{ + JSIValue undefValue = JSI::CreateUndefined(); + if (!NativeapiCommon::IsValidJSIValue(args, argsNum)) { + return undefValue; + } + FuncParams* params = new(std::nothrow) FuncParams(); + if (params == nullptr) { + return undefValue; + } + params->thisVal = JSI::AcquireValue(thisVal); + params->args = JSI::AcquireValue(args[0]); + params->flag = flag; + JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); + return undefValue; +} + +void ExecuteCopyFile(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* src = JSI::GetStringProperty(args, FILE_SOURCE_URI); + char* dest = JSI::GetStringProperty(args, FILE_DESTINATION_URI); + char* destFullPath = nullptr; + JSIValue result = JSI::CreateUndefined(); + int ret = GetFullPath(src, g_uriFullPath, sizeof(g_uriFullPath)); + JSI::ReleaseString(src); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + destFullPath = reinterpret_cast(malloc(FILE_NAME_MAX_LEN + 1)); + if (destFullPath == nullptr) { + NativeapiCommon::FailCallBack(thisVal, args, ERROR_CODE_GENERAL); + goto EXIT; + } + ret = GetFullPath(dest, destFullPath, FILE_NAME_MAX_LEN + 1); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + ret = CopyFileImpl(g_uriFullPath, destFullPath); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + if (params->flag) { + ret = DeleteFileImpl(g_uriFullPath); + } + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + result = JSI::CreateString(dest); + NativeapiCommon::SuccessCallBack(thisVal, args, result); +EXIT: + JSI::ReleaseString(dest); + free(destFullPath); + JSI::ReleaseValueList(args, thisVal, result, ARGS_END); + delete params; +} + +void ExecuteDeleteAccess(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* src = JSI::GetStringProperty(args, FILE_URI); + int ret = GetFullPath(src, g_uriFullPath, sizeof(g_uriFullPath)); + JSI::ReleaseString(src); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + if (params->flag) { + ret = DeleteFileImpl(g_uriFullPath); + } else { + ret = AccessImpl(g_uriFullPath); + } + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + NativeapiCommon::SuccessCallBack(thisVal, args, JSI::CreateUndefined()); +EXIT: + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; +} + +int GetFileListInner(const char* path, const char* key, JSIValue& result) +{ + int fileNum = GetFileNum(g_uriFullPath); + if (fileNum <= 0) { + return fileNum; + } + FileMetaInfo* fileList = reinterpret_cast(malloc(fileNum * sizeof(FileMetaInfo))); + if (fileList == nullptr) { + return ERROR_CODE_GENERAL; + } + if (memset_s(fileList, fileNum * sizeof(FileMetaInfo), 0x0, fileNum * sizeof(FileMetaInfo)) != EOK) { + free(fileList); + return ERROR_CODE_GENERAL; + } + int ret = GetFileListImpl(g_uriFullPath, fileList, fileNum); + if (ret != NATIVE_SUCCESS) { + free(fileList); + return ret; + } + JSIValue arrayValue = JSI::CreateArray(fileNum); + for (int i = 0; i < fileNum; i++) { + JSIValue tmp = JSI::CreateObject(); + JSI::SetStringProperty(tmp, FILE_URI, fileList[i].fileName); + JSI::SetNumberProperty(tmp, FILE_LENGTH, fileList[i].fileSize); + JSI::SetNumberProperty(tmp, FILE_LAST_MODIFIED_TIME, fileList[i].fileMtime); + JSI::SetStringProperty(tmp, FILE_TYPE, TYPE_FILE); + if (S_ISDIR(fileList[i].fileMode)) { + JSI::SetStringProperty(tmp, FILE_TYPE, TYPE_DIR); + } + JSI::SetPropertyByIndex(arrayValue, i, tmp); + JSI::ReleaseValue(tmp); + } + free(fileList); + JSI::SetNamedProperty(result, key, arrayValue); + JSI::ReleaseValue(arrayValue); + return NATIVE_SUCCESS; +} + +void ExecuteGetFileList(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* uri = JSI::GetStringProperty(args, FILE_URI); + JSIValue result = JSI::CreateObject(); + int ret = GetFullPath(uri, g_uriFullPath, sizeof(g_uriFullPath)); + JSI::ReleaseString(uri); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + if (params->flag) { + ret = GetFileListInner(g_uriFullPath, FILE_LIST, result); + } else { + ret = GetFileListInner(g_uriFullPath, SUB_FILES, result); + } + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + NativeapiCommon::SuccessCallBack(thisVal, args, result); +EXIT: + JSI::ReleaseValueList(args, thisVal, result, ARGS_END); + delete params; +} + +void ExecuteGetFileInfo(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* src = JSI::GetStringProperty(args, FILE_URI); + bool recursive = JSI::GetBooleanProperty(args, RECURSIVE); + struct stat info = {0}; + JSIValue result = JSI::CreateObject(); + int ret = GetFullPath(src, g_uriFullPath, sizeof(g_uriFullPath)); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + ret = StatImpl(g_uriFullPath, &info); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + if (recursive && (S_ISDIR(info.st_mode))) { + JSI::ReleaseString(src); + ExecuteGetFileList(data); + return; + } + JSI::SetStringProperty(result, FILE_URI, src); + JSI::SetNumberProperty(result, FILE_LENGTH, info.st_size); + JSI::SetNumberProperty(result, FILE_LAST_MODIFIED_TIME, info.st_mtime); + JSI::SetStringProperty(result, FILE_TYPE, TYPE_FILE); + if (S_ISDIR(info.st_mode)) { + JSI::SetStringProperty(result, FILE_TYPE, TYPE_DIR); + } + NativeapiCommon::SuccessCallBack(thisVal, args, result); +EXIT: + JSI::ReleaseString(src); + JSI::ReleaseValueList(args, thisVal, result, ARGS_END); + delete params; +} + +void ExecuteWriteTextFile(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* src = JSI::GetStringProperty(args, FILE_URI); + char* text = JSI::GetStringProperty(args, TEXT); + bool append = JSI::GetBooleanProperty(args, FILE_APPEND); + int ret = GetFullPath(src, g_uriFullPath, sizeof(g_uriFullPath)); + JSI::ReleaseString(src); + if ((text == nullptr) || (ret != NATIVE_SUCCESS)) { + NativeapiCommon::FailCallBack(thisVal, args, ERROR_CODE_PARAM); + goto EXIT; + } + ret = WriteTextFile(g_uriFullPath, text, strlen(text), append); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + NativeapiCommon::SuccessCallBack(thisVal, args, JSI::CreateUndefined()); +EXIT: + JSI::ReleaseString(text); + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; +} + +int ReadTextInner(const char* src, int position, int length, JSIValue& result) +{ + if ((position < 0) || (length < 0)) { + return ERROR_CODE_PARAM; + } + if (length == 0) { + length = TEXT_MAX_READ_LEN; + } + int ret = GetFullPath(src, g_uriFullPath, sizeof(g_uriFullPath)); + if (ret != NATIVE_SUCCESS) { + return ret; + } + struct stat info = {0}; + ret = StatImpl(g_uriFullPath, &info); + if (ret != NATIVE_SUCCESS) { + return ret; + } + size_t readLen = (info.st_size > length) ? length : info.st_size; + if (readLen > TEXT_MAX_READ_LEN) { + return ERROR_CODE_READ_TOO_LONG; + } + char* text = reinterpret_cast(malloc(readLen + 1)); + if (text == nullptr) { + return ERROR_CODE_GENERAL; + } + size_t actualLen = 0; + ret = ReadFileImpl(g_uriFullPath, text, readLen, position, &actualLen); + if (ret != NATIVE_SUCCESS) { + free(text); + return ret; + } + text[actualLen] = '\0'; + JSI::SetStringProperty(result, TEXT, text); + free(text); + return NATIVE_SUCCESS; +} + +void ExecuteReadTextFile(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* src = JSI::GetStringProperty(args, FILE_URI); + double position = JSI::GetNumberProperty(args, FILE_POSITION); + double length = JSI::GetNumberProperty(args, FILE_LENGTH); + JSIValue result = JSI::CreateObject(); + int ret = ReadTextInner(src, static_cast(position), static_cast(length), result); + JSI::ReleaseString(src); + if (ret == NATIVE_SUCCESS) { + NativeapiCommon::SuccessCallBack(thisVal, args, result); + } else { + NativeapiCommon::FailCallBack(thisVal, args, ret); + } + JSI::ReleaseValueList(args, thisVal, result, ARGS_END); + delete params; +} + +void ExecuteDirFunc(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* src = JSI::GetStringProperty(args, FILE_URI); + int ret = GetFullPath(src, g_uriFullPath, sizeof(g_uriFullPath)); + JSI::ReleaseString(src); + bool recursive = JSI::GetBooleanProperty(args, RECURSIVE); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + if (params->flag) { + ret = CreateDirImpl(g_uriFullPath, recursive); + } else { + ret = RemoveDirImpl(g_uriFullPath, recursive); + } + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + NativeapiCommon::SuccessCallBack(thisVal, args, JSI::CreateUndefined()); +EXIT: + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; +} +#if (JS_FWK_TYPEDARRAY == NATIVE_FEATURE_ON) +int ReadArrayFileInner(const char* path, size_t len, unsigned int position, JSIValue& result) +{ + struct stat info = {0}; + int ret = StatImpl(path, &info); + if (ret != NATIVE_SUCCESS) { + return ret; + } + void* text = malloc(info.st_size + 1); + if (text == nullptr) { + return ERROR_CODE_GENERAL; + } + size_t actualLen = 0; + ret = ReadFileImpl(path, text, len, static_cast(position), &actualLen); + if (ret != NATIVE_SUCCESS) { + free(text); + return ret; + } + uint8_t* ptr = nullptr; + JSIValue arrayBuffer = JSI::CreateArrayBuffer(actualLen, ptr); + if (ptr == nullptr) { + free(text); + JSI::ReleaseValue(arrayBuffer); + return ERROR_CODE_GENERAL; + } + ret = memcpy_s(ptr, actualLen, text, actualLen); + free(text); + if (ret != EOK) { + JSI::ReleaseValue(arrayBuffer); + return ERROR_CODE_GENERAL; + } + JSIValue typedArray = JSI::CreateTypedArray(TypedArrayType::JSI_UINT8_ARRAY, actualLen, arrayBuffer, 0); + JSI::SetNamedProperty(result, FILE_BUFFER, typedArray); + JSI::ReleaseValueList(typedArray, arrayBuffer, ARGS_END); + return NATIVE_SUCCESS; +} + +void ExecuteReadArrayFile(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* src = JSI::GetStringProperty(args, FILE_URI); + double position = JSI::GetNumberProperty(args, FILE_POSITION); + double length = JSI::GetNumberProperty(args, FILE_LENGTH); + JSIValue result = JSI::CreateObject(); + int ret = ERROR_CODE_PARAM; + if ((position < 0) || (length < 0)) { + JSI::ReleaseString(src); + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + ret = GetFullPath(src, g_uriFullPath, sizeof(g_uriFullPath)); + JSI::ReleaseString(src); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + ret = ReadArrayFileInner(g_uriFullPath, static_cast(length), static_cast(position), result); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + NativeapiCommon::SuccessCallBack(thisVal, args, result); +EXIT: + JSI::ReleaseValueList(args, thisVal, result, ARGS_END); + delete params; +} + +void ExecuteWriteArrayFile(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* src = JSI::GetStringProperty(args, FILE_URI); + int ret = GetFullPath(src, g_uriFullPath, sizeof(g_uriFullPath)); + JSI::ReleaseString(src); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; + return; + } + JSIValue buffer = JSI::GetNamedProperty(args, FILE_BUFFER); + double position = JSI::GetNumberProperty(args, FILE_POSITION); + bool append = JSI::GetBooleanProperty(args, FILE_APPEND); + TypedArrayType type = TypedArrayType::JSI_INVALID_ARRAY; + size_t length = 0; + JSIValue arrayBuffer = JSI::CreateUndefined(); + size_t byteOffset = 0; + uint8_t* arrayPtr = JSI::GetTypedArrayInfo(buffer, type, length, arrayBuffer, byteOffset); + ret = ERROR_CODE_PARAM; + if ((position < 0) || (arrayPtr == nullptr) || (type != TypedArrayType::JSI_UINT8_ARRAY)) { + JSI::ReleaseValueList(buffer, arrayBuffer, ARGS_END); + NativeapiCommon::FailCallBack(thisVal, args, ERROR_CODE_PARAM); + goto EXIT; + } + ret = WriteArrayFile(g_uriFullPath, arrayPtr, length, static_cast(position), append); + JSI::ReleaseValueList(buffer, arrayBuffer, ARGS_END); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + NativeapiCommon::SuccessCallBack(thisVal, args, JSI::CreateUndefined()); +EXIT: + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; +} +#endif +} + +void InitNativeApiFs(JSIValue exports) +{ + JSI::SetModuleAPI(exports, "move", NativeapiFs::MoveFile); + JSI::SetModuleAPI(exports, "copy", NativeapiFs::CopyFile); + JSI::SetModuleAPI(exports, "delete", NativeapiFs::DeleteFile); + JSI::SetModuleAPI(exports, "list", NativeapiFs::GetFileList); + JSI::SetModuleAPI(exports, "get", NativeapiFs::GetFileInfo); + JSI::SetModuleAPI(exports, "readText", NativeapiFs::ReadTextFile); + JSI::SetModuleAPI(exports, "writeText", NativeapiFs::WriteTextFile); + JSI::SetModuleAPI(exports, "access", NativeapiFs::Access); + JSI::SetModuleAPI(exports, "mkdir", NativeapiFs::CreateDir); + JSI::SetModuleAPI(exports, "rmdir", NativeapiFs::RemoveDir); + +#if (JS_FWK_TYPEDARRAY == NATIVE_FEATURE_ON) + JSI::SetModuleAPI(exports, "readArrayBuffer", NativeapiFs::ReadArrayFile); + JSI::SetModuleAPI(exports, "writeArrayBuffer", NativeapiFs::WriteArrayFile); +#endif +} + +JSIValue NativeapiFs::MoveFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteCopyFile, true); +} + +JSIValue NativeapiFs::CopyFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteCopyFile); +} + +JSIValue NativeapiFs::DeleteFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteDeleteAccess, true); +} + +JSIValue NativeapiFs::GetFileList(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteGetFileList, true); +} + +JSIValue NativeapiFs::GetFileInfo(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteGetFileInfo); +} + +JSIValue NativeapiFs::WriteTextFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteWriteTextFile); +} + +JSIValue NativeapiFs::ReadTextFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteReadTextFile); +} + +JSIValue NativeapiFs::Access(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteDeleteAccess); +} + +JSIValue NativeapiFs::CreateDir(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteDirFunc, true); +} + +JSIValue NativeapiFs::RemoveDir(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteDirFunc); +} + +#if (JS_FWK_TYPEDARRAY == NATIVE_FEATURE_ON) +JSIValue NativeapiFs::ReadArrayFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteReadArrayFile); +} + +JSIValue NativeapiFs::WriteArrayFile(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteWriteArrayFile); +} +#endif +} // ACELite +} // OHOS diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs_impl.cpp b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs_impl.cpp new file mode 100644 index 000000000..ae7052fb3 --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/filekit/src/nativeapi_fs_impl.cpp @@ -0,0 +1,484 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nativeapi_fs_impl.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nativeapi_config.h" +#if (defined _WIN32 || defined _WIN64) +#include "shlwapi.h" +#endif + +#define BUFFER_SIZE 512 + +static bool IsValidPath(const char* path) +{ + if (path == NULL) { + return false; + } + size_t pathLen = strnlen(path, FILE_NAME_MAX_LEN + 1); + if ((pathLen == 0) || (pathLen > FILE_NAME_MAX_LEN)) { + return false; + } + return true; +} + +static int GetRealPath(const char* originPath, char* trustPath, size_t tPathLen) +{ +#if (defined _WIN32 || defined _WIN64) + if (PathCanonicalize(trustPath, originPath)) { + return NATIVE_SUCCESS; + } +#else + if (realpath(originPath, trustPath) != NULL) { + return NATIVE_SUCCESS; + } +#endif + + if (errno == ENOENT) { + if (strncpy_s(trustPath, tPathLen, originPath, strlen(originPath)) == EOK) { + return NATIVE_SUCCESS; + } + } + return ERROR_CODE_GENERAL; +} + +static int RmdirRecursive(const char* fileName) +{ + if (!IsValidPath(fileName)) { + return ERROR_CODE_PARAM; + } + int ret = ERROR_CODE_GENERAL; + DIR* fileDir = opendir(fileName); + if (fileDir == NULL) { + return ret; + } + struct dirent* dir = readdir(fileDir); + struct stat info = { 0 }; + char* fullPath = (char *)malloc(FILE_NAME_MAX_LEN + 1); + if (fullPath == NULL) { + goto MALLOC_ERROR; + } + while (dir != NULL) { + if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0) { + dir = readdir(fileDir); + continue; + } + if (memset_s(fullPath, FILE_NAME_MAX_LEN + 1, 0x0, FILE_NAME_MAX_LEN + 1) != EOK) { + goto EXIT; + } + if (sprintf_s(fullPath, FILE_NAME_MAX_LEN + 1, "%s/%s", fileName, dir->d_name) < 0) { + goto EXIT; + } + if (stat(fullPath, &info) != 0) { + goto EXIT; + } + if (S_ISDIR(info.st_mode)) { + ret = RmdirRecursive(fullPath); + } else { + ret = unlink(fullPath); + } + if (ret != NATIVE_SUCCESS) { + goto EXIT; + } + dir = readdir(fileDir); + } + ret = rmdir(fileName); + +EXIT: + free(fullPath); +MALLOC_ERROR: + closedir(fileDir); + return ret; +} + +static int MakeParent(const char* path, char* firstPath, size_t fPathLen, int* dirNum) +{ + size_t pathLen = strlen(path) + 1; + char* fullPath = (char *)malloc(pathLen); + if (fullPath == NULL) { + return ERROR_CODE_GENERAL; + } + if (strcpy_s(fullPath, pathLen, path) != EOK) { + free(fullPath); + return ERROR_CODE_GENERAL; + } + int ret = NATIVE_SUCCESS; + if (AccessImpl(fullPath) != NATIVE_SUCCESS) { + char* sep = strrchr(fullPath, '/'); + if (sep != NULL) { + *sep = 0; + MakeParent(fullPath, firstPath, fPathLen, dirNum); + *sep = '/'; + } + (*dirNum)++; + if (*dirNum > DIR_LEVEL) { + free(fullPath); + return ERROR_CODE_PARAM; + } +#if (defined _WIN32 || defined _WIN64) + ret = mkdir(fullPath); +#else + ret = mkdir(fullPath, S_IRUSR | S_IWUSR | S_IXUSR); +#endif + if ((ret == NATIVE_SUCCESS) && (*dirNum == 1)) { + if ((strcpy_s(firstPath, fPathLen, fullPath) != EOK)) { + free(fullPath); + return ERROR_CODE_GENERAL; + } + } + } + free(fullPath); + return ret; +} + +static int MkdirRecursive(const char* path) +{ + char* firstPath = (char *)malloc(FILE_NAME_MAX_LEN + 1); + if (firstPath == NULL) { + return ERROR_CODE_GENERAL; + } + if (memset_s(firstPath, FILE_NAME_MAX_LEN + 1, 0x0, FILE_NAME_MAX_LEN + 1) != EOK) { + free(firstPath); + return ERROR_CODE_GENERAL; + } + int dirNum = 0; + int ret = MakeParent(path, firstPath, FILE_NAME_MAX_LEN + 1, &dirNum); + if (ret != NATIVE_SUCCESS) { + RmdirRecursive(firstPath); + } + free(firstPath); + return ret; +} + +static int DoCopyFile(int fdSrc, int fdDest) +{ + char* dataBuf = (char *)malloc(BUFFER_SIZE); + if (dataBuf == NULL) { + return ERROR_CODE_GENERAL; + } + int nLen = read(fdSrc, dataBuf, BUFFER_SIZE); + while (nLen > 0) { + if (write(fdDest, dataBuf, nLen) != nLen) { + free(dataBuf); + return ERROR_CODE_IO; + } + nLen = read(fdSrc, dataBuf, BUFFER_SIZE); + } + free(dataBuf); + return (nLen < 0) ? ERROR_CODE_IO : NATIVE_SUCCESS; +} + +int StatImpl(const char* path, struct stat* buf) +{ + if (!IsValidPath(path) || (buf == NULL)) { + return ERROR_CODE_PARAM; + } + + if (stat(path, buf) != NATIVE_SUCCESS) { + return (-errno); + } + return NATIVE_SUCCESS; +} + +int DeleteFileImpl(const char* src) +{ + if (!IsValidPath(src)) { + return ERROR_CODE_PARAM; + } + + if (unlink(src) != NATIVE_SUCCESS) { + return (-errno); + } + return NATIVE_SUCCESS; +} + +int CopyFileImpl(const char* src, const char* dest) +{ + if (!IsValidPath(src) || !IsValidPath(dest)) { + return ERROR_CODE_PARAM; + } + char* realSrc = (char *)malloc(PATH_MAX); + if (realSrc == NULL) { + return ERROR_CODE_GENERAL; + } + if (GetRealPath(src, realSrc, PATH_MAX) != NATIVE_SUCCESS) { + free(realSrc); + return ERROR_CODE_GENERAL; + } + int fdSrc = open(realSrc, O_RDONLY, S_IRUSR); + free(realSrc); + realSrc = NULL; + if (fdSrc < 0) { + return (-errno); + } + char* realDest = (char *)malloc(PATH_MAX); + if (realDest == NULL) { + close(fdSrc); + return ERROR_CODE_GENERAL; + } + if (GetRealPath(dest, realDest, PATH_MAX) != NATIVE_SUCCESS) { + close(fdSrc); + free(realDest); + return ERROR_CODE_GENERAL; + } + int fdDest = open(realDest, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + free(realDest); + realDest = NULL; + if (fdDest < 0) { + close(fdSrc); + return (-errno); + } + int ret = DoCopyFile(fdSrc, fdDest); + close(fdSrc); + close(fdDest); + if (ret != NATIVE_SUCCESS) { + unlink(dest); + } + return ret; +} + +int WriteTextFile(const char* fileName, const void* buf, size_t len, bool append) +{ + if (!IsValidPath(fileName) || (buf == NULL)) { + return ERROR_CODE_PARAM; + } + char* resolvePath = (char *)malloc(PATH_MAX); + if (resolvePath == NULL) { + return ERROR_CODE_GENERAL; + } + if (GetRealPath(fileName, resolvePath, PATH_MAX) != NATIVE_SUCCESS) { + free(resolvePath); + return ERROR_CODE_GENERAL; + } + int fileHandle = -1; + if (append) { + fileHandle = open(resolvePath, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); + } else { + fileHandle = open(resolvePath, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + } + free(resolvePath); + if (fileHandle < 0) { + return (-errno); + } + int writeLen = write(fileHandle, buf, len); + close(fileHandle); + return (writeLen != len) ? ERROR_CODE_IO : NATIVE_SUCCESS; +} + +int WriteArrayFile(const char* fileName, const void* buf, size_t len, unsigned int position, bool append) +{ + if (!IsValidPath(fileName) || (buf == NULL)) { + return ERROR_CODE_PARAM; + } + char* resolvePath = (char *)malloc(PATH_MAX); + if (resolvePath == NULL) { + return ERROR_CODE_GENERAL; + } + if (GetRealPath(fileName, resolvePath, PATH_MAX) != NATIVE_SUCCESS) { + free(resolvePath); + return ERROR_CODE_GENERAL; + } + int fileHandle = -1; + if (append) { + fileHandle = open(resolvePath, O_RDWR | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR); + free(resolvePath); + resolvePath = NULL; + if (fileHandle < 0) { + return (-errno); + } + } else { + fileHandle = open(resolvePath, O_RDWR | O_CREAT, S_IRUSR | S_IWUSR); + free(resolvePath); + resolvePath = NULL; + if (fileHandle < 0) { + return (-errno); + } + if (lseek(fileHandle, position, SEEK_SET) != position) { + close(fileHandle); + return ERROR_CODE_IO; + } + } + int writeLen = write(fileHandle, buf, len); + close(fileHandle); + return (writeLen != len) ? ERROR_CODE_IO : NATIVE_SUCCESS; +} + +int ReadFileImpl(const char* fileName, void* text, size_t len, unsigned int position, size_t* actualLen) +{ + if (!IsValidPath(fileName) || (text == NULL)) { + return ERROR_CODE_PARAM; + } + char* resolvePath = (char *)malloc(PATH_MAX); + if (resolvePath == NULL) { + return ERROR_CODE_GENERAL; + } + if (GetRealPath(fileName, resolvePath, PATH_MAX) != NATIVE_SUCCESS) { + free(resolvePath); + return ERROR_CODE_GENERAL; + } + int fileHandle = open(resolvePath, O_RDONLY, S_IRUSR); + free(resolvePath); + resolvePath = NULL; + if (fileHandle < 0) { + return (-errno); + } + struct stat info = { 0 }; + if (fstat(fileHandle, &info) != 0) { + close(fileHandle); + return ERROR_CODE_IO; + } + if (position >= info.st_size) { + close(fileHandle); + return ERROR_CODE_PARAM; + } + if (len == 0) { + len = info.st_size - position; + } + if (lseek(fileHandle, position, SEEK_SET) != position) { + close(fileHandle); + return ERROR_CODE_IO; + } + int readLen = read(fileHandle, text, len); + close(fileHandle); + *actualLen = readLen; + return (readLen < 0) ? ERROR_CODE_IO : NATIVE_SUCCESS; +} + +int GetFileListImpl(const char* dirName, FileMetaInfo* fileList, unsigned int listNum) +{ + if (!IsValidPath(dirName) || (fileList == NULL)) { + return ERROR_CODE_PARAM; + } + int ret = ERROR_CODE_GENERAL; + DIR* fileDir = opendir(dirName); + if (fileDir == NULL) { + return ret; + } + int fileIndex = 0; + struct dirent* dir = readdir(fileDir); + struct stat fileStat = { 0 }; + char* fullFileName = (char *)malloc(FILE_NAME_MAX_LEN + 1); + if (fullFileName == NULL) { + goto EXIT; + } + while ((dir != NULL) && (fileIndex < listNum)) { + if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0) { + dir = readdir(fileDir); + continue; + } + if (memset_s(fullFileName, FILE_NAME_MAX_LEN + 1, 0x0, FILE_NAME_MAX_LEN + 1) != EOK) { + goto EXIT; + } + if (sprintf_s(fullFileName, FILE_NAME_MAX_LEN + 1, "%s/%s", dirName, dir->d_name) < 0) { + goto EXIT; + } + if (stat(fullFileName, &fileStat) != 0) { + goto EXIT; + } + if (strcpy_s(fileList[fileIndex].fileName, FILE_NAME_MAX_LEN + 1, fullFileName) != EOK) { + goto EXIT; + } + fileList[fileIndex].fileSize = fileStat.st_size; + fileList[fileIndex].fileMtime = fileStat.st_mtime; + fileList[fileIndex].fileMode = fileStat.st_mode; + fileIndex++; + dir = readdir(fileDir); + } + ret = NATIVE_SUCCESS; +EXIT: + free(fullFileName); + closedir(fileDir); + return ret; +} + +int GetFileNum(const char* dirName) +{ + int ret = AccessImpl(dirName); + if (ret != NATIVE_SUCCESS) { + return ret; + } + DIR* fileDir = opendir(dirName); + if (fileDir == NULL) { + return ERROR_CODE_PARAM; + } + struct dirent* dir = readdir(fileDir); + int sum = 0; + while (dir != NULL) { + if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0) { + dir = readdir(fileDir); + continue; + } + sum++; + dir = readdir(fileDir); + } + closedir(fileDir); + return (sum == 0) ? ERROR_CODE_IO : sum; +} + +int AccessImpl(const char* fileName) +{ + if (!IsValidPath(fileName)) { + return ERROR_CODE_PARAM; + } + if (access(fileName, F_OK) == F_OK) { + return NATIVE_SUCCESS; + } + return (-errno); +} + +int CreateDirImpl(const char* fileName, bool recursive) +{ + if (!IsValidPath(fileName)) { + return ERROR_CODE_PARAM; + } + if (AccessImpl(fileName) == NATIVE_SUCCESS) { + return NATIVE_SUCCESS; + } + if (recursive) { + return MkdirRecursive(fileName); + } +#if (defined _WIN32 || defined _WIN64) + int ret = mkdir(fileName); +#else + int ret = mkdir(fileName, S_IRUSR | S_IWUSR | S_IXUSR); +#endif + if (ret != NATIVE_SUCCESS) { + return (-errno); + } + return NATIVE_SUCCESS; +} + +int RemoveDirImpl(const char* fileName, bool recursive) +{ + int ret = AccessImpl(fileName); + if (ret != NATIVE_SUCCESS) { + return ret; + } + if (recursive) { + return RmdirRecursive(fileName); + } + if (rmdir(fileName) != NATIVE_SUCCESS) { + return (-errno); + } + return NATIVE_SUCCESS; +} \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/include/nativeapi_kv.h b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/include/nativeapi_kv.h new file mode 100644 index 000000000..78ec3067f --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/include/nativeapi_kv.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef JS_NATIVE_API_KV_H +#define JS_NATIVE_API_KV_H + +#include "jsi/jsi.h" + +namespace OHOS { +namespace ACELite { +class NativeapiKv { +public: + NativeapiKv() = default; + ~NativeapiKv() = default; + + static JSIValue Get(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue Set(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue Delete(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); + static JSIValue Clear(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum); +}; +} // ACELite +} // OHOS +#endif // JS_NATIVE_API_KV_H \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/debugger.h b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/include/nativeapi_kv_impl.h old mode 100755 new mode 100644 similarity index 53% rename from code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/debugger.h rename to code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/include/nativeapi_kv_impl.h index e229e25ec..3efa8891f --- a/code/sdk/open_source/openharmony/third_party/jerryscript/include/jerryext/jerryscript-ext/debugger.h +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/include/nativeapi_kv_impl.h @@ -1,5 +1,5 @@ -/* Copyright JS Foundation and other contributors, http://js.foundation - * +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -7,38 +7,34 @@ * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS + * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef JERRYX_DEBUGGER_H -#define JERRYX_DEBUGGER_H - -#include "jerryscript.h" -#include "jerryscript-debugger-transport.h" +#ifndef JS_FS_KV_API_H +#define JS_FS_KV_API_H #ifdef __cplusplus -extern "C" -{ +#if __cplusplus +extern "C" { +#endif #endif /* __cplusplus */ -void jerryx_debugger_after_connect (bool success); +#define KEY_MAX_LEN 32 +#define VALUE_MAX_LEN 128 -/* - * Message transmission interfaces. - */ -bool jerryx_debugger_tcp_create (uint16_t port); -bool jerryx_debugger_serial_create (const char *config); - -/* - * Message encoding interfaces. - */ -bool jerryx_debugger_ws_create (void); -bool jerryx_debugger_rp_create (void); +int InitKv(const char* dataPath); +int GetValue(const char* key, char* value); +int SetValue(const char* key, const char* value); +int DeleteValue(const char* key); +int ClearKVStore(const char* dataPath); #ifdef __cplusplus +#if __cplusplus } +#endif #endif /* __cplusplus */ -#endif /* !JERRYX_HANDLER_H */ + +#endif /* JS_FS_KV_API_H */ \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp new file mode 100644 index 000000000..b7c4676e6 --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv.cpp @@ -0,0 +1,294 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nativeapi_kv.h" +#include +#include +#include "ace_log.h" +#include "ability_env.h" +#include "js_async_work.h" +#include "nativeapi_common.h" +#include "nativeapi_config.h" +#include "nativeapi_kv_impl.h" + +namespace OHOS { +namespace ACELite { +namespace { +char g_kvFullPath[FILE_NAME_MAX_LEN + 1] = {0}; + +bool IsValidKey(const char* key) +{ + if (key == nullptr) { + return false; + } + size_t keyLen = strnlen(key, KEY_MAX_LEN + 1); + if ((keyLen == 0) || (keyLen > KEY_MAX_LEN)) { + return false; + } + if (strpbrk(key, "/\\\"*+,:;<=>\?[]|\x7F")) { + return false; + } + return true; +} + +int GetFullPath(const char* dataPath, const char* key) +{ + if (!IsValidKey(key) || (dataPath == nullptr)) { + return ERROR_CODE_PARAM; + } + if (memset_s(g_kvFullPath, sizeof(g_kvFullPath), 0x0, sizeof(g_kvFullPath)) != EOK) { + return ERROR_CODE_GENERAL; + } + if (sprintf_s(g_kvFullPath, sizeof(g_kvFullPath), "%s/%s/%s", dataPath, DEFAULT_FOLDER_PATH, key) < 0) { + return ERROR_CODE_GENERAL; + } + return NATIVE_SUCCESS; +} + +void GetDefault(const JSIValue thisVal, const JSIValue args) +{ + char* defaultValue = JSI::GetStringProperty(args, DEFAULT); + JSIValue result; + if (defaultValue == nullptr) { + result = JSI::CreateString(""); + } else { + result = JSI::CreateString(defaultValue); + } + JSI::ReleaseString(defaultValue); + NativeapiCommon::SuccessCallBack(thisVal, args, result); + JSI::ReleaseValue(result); +} + +int GetValueInner(const char* dataPath, const char* key, char* value) +{ + int ret = GetFullPath(dataPath, key); + if (ret != NATIVE_SUCCESS) { + return ret; + } + return GetValue(g_kvFullPath, value); +} + +int SetValueInner(const char* dataPath, const char* key, const char* value) +{ + int ret = GetFullPath(dataPath, key); + if (ret != NATIVE_SUCCESS) { + return ret; + } + return SetValue(g_kvFullPath, value); +} + +int DeleteValueInner(const char* dataPath, const char* key) +{ + int ret = GetFullPath(dataPath, key); + if (ret != NATIVE_SUCCESS) { + return ret; + } + return DeleteValue(g_kvFullPath); +} + +JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, + uint8_t argsNum, AsyncWorkHandler ExecuteFunc, bool flag) +{ + JSIValue undefValue = JSI::CreateUndefined(); + if (!NativeapiCommon::IsValidJSIValue(args, argsNum)) { + return undefValue; + } + FuncParams* params = new(std::nothrow) FuncParams(); + if (params == nullptr) { + return undefValue; + } + params->thisVal = JSI::AcquireValue(thisVal); + params->args = JSI::AcquireValue(args[0]); + params->flag = flag; + JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); + return undefValue; +} + +void ExecuteGet(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* key = JSI::GetStringProperty(args, KV_KEY); + const char* dataPath = GetDataPath(); + JSIValue result = JSI::CreateUndefined(); + int ret = ERROR_CODE_GENERAL; + char* value = reinterpret_cast(malloc(VALUE_MAX_LEN + 1)); + if (value == nullptr) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + ret = InitKv(dataPath); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + ret = GetValueInner(dataPath, key, value); + if (ret == ERROR_FR_NO_FILE) { + GetDefault(thisVal, args); + goto EXIT; + } + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + result = JSI::CreateString(value); + NativeapiCommon::SuccessCallBack(thisVal, args, result); +EXIT: + free(value); + JSI::ReleaseString(key); + JSI::ReleaseValueList(args, thisVal, result, ARGS_END); + delete params; +} + +void ExecuteSet(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + char* key = JSI::GetStringProperty(args, KV_KEY); + char* value = JSI::GetStringProperty(args, KV_VALUE); + const char* dataPath = GetDataPath(); + int ret = InitKv(dataPath); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + if ((key == nullptr) || !strlen(key)) { + NativeapiCommon::FailCallBack(thisVal, args, ERROR_CODE_PARAM); + goto EXIT; + } + if ((value == nullptr) || !strlen(value)) { + DeleteValueInner(dataPath, key); + NativeapiCommon::SuccessCallBack(thisVal, args, JSI::CreateUndefined()); + goto EXIT; + } + ret = SetValueInner(dataPath, key, value); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + goto EXIT; + } + NativeapiCommon::SuccessCallBack(thisVal, args, JSI::CreateUndefined()); +EXIT: + JSI::ReleaseString(key); + JSI::ReleaseString(value); + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; +} + +void ExecuteDelete(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + const char* dataPath = GetDataPath(); + int ret = InitKv(dataPath); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; + return; + } + char* key = JSI::GetStringProperty(args, KV_KEY); + ret = DeleteValueInner(dataPath, key); + JSI::ReleaseString(key); + if ((ret < 0) && (ret != ERROR_FR_NO_FILE)) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; + return; + } + NativeapiCommon::SuccessCallBack(thisVal, args, JSI::CreateUndefined()); + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; +} + +void ExecuteClear(void* data) +{ + FuncParams* params = reinterpret_cast(data); + if (params == nullptr) { + return; + } + JSIValue args = params->args; + JSIValue thisVal = params->thisVal; + const char* dataPath = GetDataPath(); + int ret = InitKv(dataPath); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; + return; + } + ret = ClearKVStore(dataPath); + if (ret != NATIVE_SUCCESS) { + NativeapiCommon::FailCallBack(thisVal, args, ret); + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; + return; + } + NativeapiCommon::SuccessCallBack(thisVal, args, JSI::CreateUndefined()); + JSI::ReleaseValueList(args, thisVal, ARGS_END); + delete params; +} +} + +void InitNativeApiKv(JSIValue exports) +{ + JSI::SetModuleAPI(exports, "get", NativeapiKv::Get); + JSI::SetModuleAPI(exports, "set", NativeapiKv::Set); + JSI::SetModuleAPI(exports, "delete", NativeapiKv::Delete); + JSI::SetModuleAPI(exports, "clear", NativeapiKv::Clear); +} + +JSIValue NativeapiKv::Get(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteGet, false); +} + +JSIValue NativeapiKv::Set(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteSet, false); +} + +JSIValue NativeapiKv::Delete(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteDelete, false); +} + +JSIValue NativeapiKv::Clear(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum) +{ + JSIValue undefValue = JSI::CreateUndefined(); + FuncParams* params = new(std::nothrow) FuncParams(); + if (params == nullptr) { + return undefValue; + } + params->thisVal = JSI::AcquireValue(thisVal); + if (NativeapiCommon::IsValidJSIValue(args, argsNum)) { + params->args = JSI::AcquireValue(args[0]); + } + JsAsyncWork::DispatchAsyncWork(reinterpret_cast(ExecuteClear), reinterpret_cast(params)); + return undefValue; +} +} // ACELite +} // OHOS diff --git a/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv_impl.cpp b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv_impl.cpp new file mode 100644 index 000000000..331c01ff7 --- /dev/null +++ b/code/sdk/open_source/openharmony/utils/native/lite/js/builtin/kvstorekit/src/nativeapi_kv_impl.cpp @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2020 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "nativeapi_kv_impl.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "nativeapi_config.h" +#if (defined _WIN32 || defined _WIN64) +#include "shlwapi.h" +#endif + +static char g_kvFolder[FILE_NAME_MAX_LEN + 1] = {0}; + +static bool IsValidValue(const char* value) +{ + if (value == NULL) { + return false; + } + size_t valueLen = strnlen(value, VALUE_MAX_LEN + 1); + if ((valueLen == 0) || (valueLen > VALUE_MAX_LEN)) { + return false; + } + return true; +} + +static int GetKvFolder(const char* dataPath) +{ + if (dataPath == NULL) { + return ERROR_CODE_PARAM; + } + if (memset_s(g_kvFolder, sizeof(g_kvFolder), 0x0, sizeof(g_kvFolder)) != EOK) { + return ERROR_CODE_GENERAL; + } + if (sprintf_s(g_kvFolder, sizeof(g_kvFolder), "%s/%s", dataPath, DEFAULT_FOLDER_PATH) < 0) { + return ERROR_CODE_GENERAL; + } + return NATIVE_SUCCESS; +} + +static int GetRealPath(const char* originPath, char* trustPath, size_t tPathLen) +{ +#if (defined _WIN32 || defined _WIN64) + if (PathCanonicalize(trustPath, originPath)) { + return NATIVE_SUCCESS; + } +#else + if (realpath(originPath, trustPath) != NULL) { + return NATIVE_SUCCESS; + } +#endif + + if (errno == ENOENT) { + if (strncpy_s(trustPath, tPathLen, originPath, strlen(originPath)) == EOK) { + return NATIVE_SUCCESS; + } + } + return ERROR_CODE_GENERAL; +} + +int InitKv(const char* dataPath) +{ + int ret = GetKvFolder(dataPath); + if (ret != NATIVE_SUCCESS) { + return ret; + } + if (access(g_kvFolder, F_OK) == F_OK) { + return NATIVE_SUCCESS; + } +#if (defined _WIN32 || defined _WIN64) + if (mkdir(g_kvFolder) != 0) { + return ERROR_CODE_GENERAL; + } +#else + if (mkdir(g_kvFolder, S_IRUSR | S_IWUSR | S_IXUSR) != 0) { + return ERROR_CODE_GENERAL; + } +#endif + return NATIVE_SUCCESS; +} + +int GetValue(const char* key, char* value) +{ + if ((key == NULL) || (value == NULL)) { + return ERROR_CODE_PARAM; + } + char* resolvePath = (char *)malloc(PATH_MAX); + if (resolvePath == NULL) { + return ERROR_CODE_GENERAL; + } + if (GetRealPath(key, resolvePath, PATH_MAX) != NATIVE_SUCCESS) { + free(resolvePath); + return ERROR_CODE_GENERAL; + } + int fileHandle = open(resolvePath, O_RDONLY, S_IRUSR); + free(resolvePath); + resolvePath = NULL; + if (fileHandle < 0) { + return (-errno); + } + int readLen = read(fileHandle, value, VALUE_MAX_LEN); + close(fileHandle); + fileHandle = -1; + if (readLen < 0) { + return ERROR_CODE_IO; + } + value[readLen] = '\0'; + return NATIVE_SUCCESS; +} + +int SetValue(const char* key, const char* value) +{ + if ((key == NULL) || (!IsValidValue(value))) { + return ERROR_CODE_PARAM; + } + char* resolvePath = (char *)malloc(PATH_MAX); + if (resolvePath == NULL) { + return ERROR_CODE_GENERAL; + } + if (GetRealPath(key, resolvePath, PATH_MAX) != NATIVE_SUCCESS) { + free(resolvePath); + return ERROR_CODE_GENERAL; + } + int fd = open(resolvePath, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); + free(resolvePath); + resolvePath = NULL; + if (fd < 0) { + return (-errno); + } + int ret = write(fd, value, strlen(value)); + close(fd); + return (ret < 0) ? ERROR_CODE_IO : NATIVE_SUCCESS; +} + +int DeleteValue(const char* key) +{ + if (key == NULL) { + return ERROR_CODE_PARAM; + } + if (unlink(key) != NATIVE_SUCCESS) { + return (-errno); + } + return NATIVE_SUCCESS; +} + +int ClearKVStore(const char* dataPath) +{ + int ret = GetKvFolder(dataPath); + if (ret != NATIVE_SUCCESS) { + return ret; + } + ret = ERROR_CODE_GENERAL; + DIR* fileDir = opendir(g_kvFolder); + if (fileDir == NULL) { + return ret; + } + struct dirent* dir = readdir(fileDir); + char* fullPath = (char *)malloc(FILE_NAME_MAX_LEN + 1); + if (fullPath == NULL) { + goto EXIT; + } + while (dir != NULL) { + if (strcmp(dir->d_name, ".") == 0 || strcmp(dir->d_name, "..") == 0) { + dir = readdir(fileDir); + continue; + } + if (memset_s(fullPath, FILE_NAME_MAX_LEN + 1, 0x0, FILE_NAME_MAX_LEN + 1) != EOK) { + goto EXIT; + } + if (sprintf_s(fullPath, FILE_NAME_MAX_LEN + 1, "%s/%s", g_kvFolder, dir->d_name) < 0) { + goto EXIT; + } + if (unlink(fullPath) != 0) { + goto EXIT; + } + dir = readdir(fileDir); + } + ret = NATIVE_SUCCESS; +EXIT: + free(fullPath); + closedir(fileDir); + return ret; +} \ No newline at end of file diff --git a/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/local_device_manager.h b/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/local_device_manager.h index d430193dd..027a02ed0 100755 --- a/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/local_device_manager.h +++ b/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/local_device_manager.h @@ -49,6 +49,7 @@ enum { LOCAL_MGR_MSG_ID_READ_REMOTE_RSSI_BLE, LOCAL_MGR_MSG_ID_PAIRED_KEYS, /* 上报BLE配对完成密钥 */ LOCAL_MGR_MSG_ID_REPORT_TERMINATE_ADV, /* 上报广播终止结果 */ + LOCAL_MGR_MSG_ID_CONN_PARAM_UPDATE, /* 连接参数更新 */ }; /* 发送本地设备管理模块消息 */ @@ -61,6 +62,7 @@ bool btsrv_is_bluetooth_enable(void); bool btsrv_is_bluetooth_disable(void); bool btsrv_set_local_addr(const bd_addr_t *bd_addr); +bool is_bts_auto_reconnect_enable(void); /* 本地设备运行模式设置和查询 */ uint32_t btsrv_set_local_device_mode(btsrv_local_device_mode mode); diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/include/sample_ble_ams.h b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/include/sample_ble_ams.h new file mode 100644 index 000000000..43ac2d7cc --- /dev/null +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/include/sample_ble_ams.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * + * Description: AMS Client Test module. + */ +/** + * @defgroup bluetooth_sample_ble_ams AMS TEST API + * @ingroup bluetooth + * @{ + */ + +#ifndef SAMPLE_BLE_AMS_H +#define SAMPLE_BLE_AMS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void ble_ams_client_at_cmd(uint8_t cmd_id, char **params, uint8_t params_cnt); + +/** + * @} + */ +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/include/sample_ble_ancs.h b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/include/sample_ble_ancs.h new file mode 100644 index 000000000..f05e2f927 --- /dev/null +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/include/sample_ble_ancs.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * + * Description: ANCS Client Test module. + */ +/** + * @defgroup bluetooth_sample_ble_ancs ANCS TEST API + * @ingroup bluetooth + * @{ + */ + +#ifndef SAMPLE_BLE_ANCS_H +#define SAMPLE_BLE_ANCS_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void ble_ancs_client_at_cmd(uint8_t cmd_id, char **params, uint8_t params_cnt); + +/** + * @} + */ +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/CMakeLists.txt b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/CMakeLists.txt index 0008d8951..8bdb7abfa 100755 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/CMakeLists.txt +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/CMakeLists.txt @@ -4,5 +4,7 @@ set( ${CMAKE_CURRENT_SOURCE_DIR}/sample_ble_bas.c ${CMAKE_CURRENT_SOURCE_DIR}/sample_ble_hid.c ${CMAKE_CURRENT_SOURCE_DIR}/sample_ble_fmp.c + ${CMAKE_CURRENT_SOURCE_DIR}/sample_ble_ancs.c + ${CMAKE_CURRENT_SOURCE_DIR}/sample_ble_ams.c ) set(BTH_SAMPLE_LIST "${BTH_SAMPLE_LIST}" "${bt_comm_src_list}" CACHE INTERNAL "bt ram obj list" FORCE) diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/sample_ble_ams.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/sample_ble_ams.c new file mode 100644 index 000000000..c150a67ab --- /dev/null +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/sample_ble_ams.c @@ -0,0 +1,320 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: This module include test function of AMS Client module. + */ +#include +#include +#include +#include "datatype.h" +#include "sdk_general.h" +#include "mpc_dispatch.h" +#include "bt_at_cmd_api.h" +#include "sample_common.h" +#include "ble_ams_client.h" +#include "sample_ble_ams.h" + +#define HEX_BYTE_CHAR_COUNT 2 + +/* AMS客户端接口命令id */ +typedef enum { + BLE_SAMPLE_AMS_CLIENT_REGISTER_CBK = 1, /* 1 注册AMS客户端回调函数 */ + BLE_SAMPLE_AMS_CLIENT_SETUP, /* 2 AMS客户端连接服务端 */ + BLE_SAMPLE_AMS_CLIENT_SUBSCRIBE_REMOTE_COMMNAD, /* 3 订阅远端命令 */ + BLE_SAMPLE_AMS_CLIENT_SUBSCRIBE_ENTITY_UPDATE, /* 4 订阅实体更新 */ + BLE_SAMPLE_AMS_CLIENT_SEND_REMOTE_CMD, /* 5 发送远端命令 */ + BLE_SAMPLE_AMS_CLIENT_REGISTER_INTERESTED_ENTITY_ATT, /* 6 注册感兴趣的实体属性 */ + BLE_SAMPLE_AMS_CLIENT_RETRIEVE_FULL_ENTITY_ATT, /* 7 请求加载完整实体属性 */ + BLE_SAMPLE_AMS_CLIENT_READ_FULL_ENTITY_ATT /* 8 读取完整实体属性 */ +} ble_ams_client_at_cmd_id_t; + +/* 命令处理函数接口 */ +typedef uint8_t (*ble_ams_client_at_func_t)(uint8_t argc, char **argv); + +/* AMS客户端AT命令id与接口对应关系 */ +typedef struct { + ble_ams_client_at_cmd_id_t id; + ble_ams_client_at_func_t func; +} ble_ams_client_at_hdl_info_t; + +/* 当前活跃媒体设备支持的远端命令 */ +ble_ams_remote_cmd_rpt_t *g_remote_cmd_supported = NULL; + +/* AMS服务建立结果回调 */ +static void ble_ams_client_setup_result_cbk(uint8_t client_id, uint16_t conn_id, errcode_t status) +{ + bts_info("[AMSClientSetupCBK]conn_id:%d status:0x%x\r\n", conn_id, status); +} + +/* AMS服务订阅结果回调 */ +static void ble_ams_client_subscribe_result_cbk(uint8_t client_id, uint16_t conn_id, + ams_client_subscribe_type_t type, gatt_status_t status) +{ + bts_info("[AMSClientSubscribeResultCBK]conn_id:%d type:%d status:0x%x\r\n", conn_id, type, status); +} + +/* AMS服务远端支持的命令上报 */ +static void ble_ams_client_remote_cmd_cbk(uint8_t client_id, uint16_t conn_id, + ble_ams_remote_cmd_rpt_t *remote_cmd, errcode_t status) +{ + if (status == ERRCODE_BT_SUCCESS) { + bts_sample_log_no_header("[AMSClientRemoteCMDCBK]conn_id:%d status:0x%x cmd_num=%d ", + conn_id, status, remote_cmd->cmd_num); + if (g_remote_cmd_supported != NULL) { + bt_os_free(g_remote_cmd_supported); + } + uint16_t length = sizeof(ble_ams_remote_cmd_rpt_t) + remote_cmd->cmd_num; + g_remote_cmd_supported = bt_os_new(length); + g_remote_cmd_supported->cmd_num = remote_cmd->cmd_num; + if (memcpy_s(g_remote_cmd_supported->remote_cmd, remote_cmd->cmd_num, + remote_cmd->remote_cmd, remote_cmd->cmd_num) != EOK) { + bts_error("[AMSClientSample] memcpy error!\r\n"); + bt_os_free(g_remote_cmd_supported); + return; + } + bts_sample_log_no_header("supported_cmd="); + for (int i = 0; i < remote_cmd->cmd_num; i++) { + bts_sample_log_no_header("0x%02x", remote_cmd->remote_cmd[i]); + } + bts_sample_log_no_header("\r\n"); + } else { + bts_info("[AMSClientRemoteCMDCBK]conn_id:%d status:0x%x\r\n", conn_id, status); + } +} + +/* AMS服务实体更新上报 */ +static void ble_ams_client_entity_update_cbk(uint8_t client_id, uint16_t conn_id, + ble_ams_entity_update_rpt_t *entity_update, errcode_t status) +{ + if (status == ERRCODE_BT_SUCCESS) { + bts_info( + "[AMSClientEntityUpdateCBK]conn_id:%d status:0x%x entityId=%d att_id=%d update_flags=0x%x value=%s\r\n", + conn_id, status, + entity_update->entity_id, + entity_update->att_id, + entity_update->entity_update_flags, + entity_update->value); + } else { + bts_info("[AMSClientEntityUpdateCBK]conn_id:%d status:0x%x\r\n", conn_id, status); + } +} + +/* AMS客户端写请求响应结果上报 */ +static void ble_ams_client_write_character_rsp_cbk(uint8_t client_id, uint16_t conn_id, + ams_client_write_character_type_t type, + gatt_status_t status) +{ + bts_info("[AMSClientWriteRSPCBK]conn_id:%d type:%d status:0x%x\r\n", conn_id, type, status); +} + +/* AMS客户端读请求响应结果上报 */ +static void ble_ams_client_read_full_attr_result_cbk(uint8_t client_id, uint16_t conn_id, + ble_ams_full_attr_value_t *read_result, + gatt_status_t status) +{ + if (status == ERRCODE_BT_SUCCESS) { + bts_info("[AMSClientReadFullAttrCBK]conn_id:%d status:0x%x value_len=%d value=%s\r\n", + conn_id, status, + read_result->value_len, + read_result->value); + } else { + bts_info("[AMSClientReadFullAttrCBK]conn_id:%d status:0x%x\r\n", conn_id, status); + } +} + +/* 注册AMS服务回调 */ +static uint8_t ble_ams_client_at_cmd_register_cbk(uint8_t argc, char **argv) +{ + ble_ams_client_callbacks_t cbk = {0}; + cbk.setup_cb = ble_ams_client_setup_result_cbk; + cbk.subscribe_cb = ble_ams_client_subscribe_result_cbk; + cbk.remote_cmd_cb = ble_ams_client_remote_cmd_cbk; + cbk.entity_update_cb = ble_ams_client_entity_update_cbk; + cbk.write_rsp_cb = ble_ams_client_write_character_rsp_cbk; + cbk.read_full_attr_result_cb = ble_ams_client_read_full_attr_result_cbk; + errcode_t ret = ble_ams_client_register_callbacks(&cbk); + bts_info("ble ams client register cbk ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* AMS客户端发起服务建立 */ +static uint8_t ble_ams_client_at_cmd_setup(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN2) { + bts_error("ble ams client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + errcode_t ret = ble_ams_client_setup_service(client_id, conn_id); + bts_info("ble ams client setup ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* AMS客户端订阅远端命令特征通知 */ +static uint8_t ble_ams_client_at_cmd_remote_cmd(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN3) { + bts_error("ble ams client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint8_t sub_flag = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + sub_flag = (uint8_t)atoi(argv[BT_INDEX_2]); + if (sub_flag > AMS_CLIENT_NOTIFY_ENABLE) { + bts_error("ble ams client argc invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + errcode_t ret = ble_ams_client_subscribe_remote_cmd(client_id, conn_id, sub_flag); + bts_info("ble ams client sub remote cmd ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* AMS客户端订阅实体更新特征通知 */ +static uint8_t ble_ams_client_at_cmd_entity_update(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN3) { + bts_error("ble ams client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint8_t sub_flag = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + sub_flag = (uint8_t)atoi(argv[BT_INDEX_2]); + if (sub_flag > AMS_CLIENT_NOTIFY_ENABLE) { + bts_error("ble ams client argc invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + errcode_t ret = ble_ams_client_subscribe_entity_update(client_id, conn_id, sub_flag); + bts_info("ble ams client sub entity update ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* AMS客户端发送远端命令 */ +static uint8_t ble_ams_client_at_cmd_send_remote_cmd(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN3) { + bts_error("ble ams client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint8_t remote_cmd = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + remote_cmd = (uint8_t)atoi(argv[BT_INDEX_2]); + if (remote_cmd > AMS_RMT_CMD_ID_BOOKMARK_TRACK) { + bts_error("ble ams client argc invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + errcode_t ret = ble_ams_client_send_remote_cmd(client_id, conn_id, remote_cmd); + bts_info("ble ams client send remote cmd ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* AMS客户端注册感兴趣的实体属性 */ +static uint8_t ble_ams_client_at_cmd_register_interested_entity_att(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN5) { + bts_error("ble ams client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint16_t att_num = 0; + uint8_t entity_id = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + entity_id = (uint8_t)atoi(argv[BT_INDEX_2]); + att_num = (uint16_t)atoi(argv[BT_INDEX_3]); + uint32_t len = strlen(argv[BT_INDEX_4]); + if (len != (att_num * HEX_BYTE_CHAR_COUNT)) { + bts_error("ble ams client argc att_num invalid :%u\r\n", att_num); + return MPC_BT_FAIL; + } + + ble_ams_interested_entity_attr_req_t *attr_req = bt_os_new(sizeof(ble_ams_interested_entity_attr_req_t) + att_num); + attr_req->entity_id = entity_id; + attr_req->att_num = att_num; + if (decode_hex_from_str(argv[BT_INDEX_4], attr_req->att_id) != EXT_ERR_SUCCESS) { + bt_os_free(attr_req); + bts_error("ble ams client decode attr fail!\r\n"); + return MPC_BT_FAIL; + } + errcode_t ret = ble_ams_client_register_interested_entity_attribute(client_id, conn_id, attr_req); + bts_info("ble ams client register interested attr ret:0x%x\r\n", ret); + bt_os_free(attr_req); + return MPC_BT_SUCC; +} + +/* AMS客户端请求加载完整的实体属性 */ +static uint8_t ble_ams_client_at_cmd_retrieve_full_attr(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN4) { + bts_error("ble ams client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint8_t entity_id = 0; + uint8_t attr_id = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + entity_id = (uint8_t)atoi(argv[BT_INDEX_2]); + attr_id = (uint8_t)atoi(argv[BT_INDEX_3]); + + ble_ams_full_entity_attr_cmd_t *full_attr = bt_os_new(sizeof(ble_ams_full_entity_attr_cmd_t)); + full_attr->entity_id = entity_id; + full_attr->att_id = attr_id; + errcode_t ret = ble_ams_client_retrieve_full_entity_attribute(client_id, conn_id, full_attr); + bts_info("ble ams client retrieve full attr ret:0x%x\r\n", ret); + bt_os_free(full_attr); + return MPC_BT_SUCC; +} + +/* AMS客户端读取完整的实体属性 */ +static uint8_t ble_ams_client_at_cmd_read_full_attr(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN2) { + bts_error("ble ams client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + + errcode_t ret = ble_ams_client_read_full_entity_attribute(client_id, conn_id); + bts_info("ble ams client read full attr ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* AMS客户端AT命令与接口对应关系 */ +static ble_ams_client_at_hdl_info_t g_ble_ams_client_at_hdl[] = { + { BLE_SAMPLE_AMS_CLIENT_REGISTER_CBK, ble_ams_client_at_cmd_register_cbk }, + { BLE_SAMPLE_AMS_CLIENT_SETUP, ble_ams_client_at_cmd_setup }, + { BLE_SAMPLE_AMS_CLIENT_SUBSCRIBE_REMOTE_COMMNAD, ble_ams_client_at_cmd_remote_cmd }, + { BLE_SAMPLE_AMS_CLIENT_SUBSCRIBE_ENTITY_UPDATE, ble_ams_client_at_cmd_entity_update }, + { BLE_SAMPLE_AMS_CLIENT_SEND_REMOTE_CMD, ble_ams_client_at_cmd_send_remote_cmd }, + { BLE_SAMPLE_AMS_CLIENT_REGISTER_INTERESTED_ENTITY_ATT, ble_ams_client_at_cmd_register_interested_entity_att }, + { BLE_SAMPLE_AMS_CLIENT_RETRIEVE_FULL_ENTITY_ATT, ble_ams_client_at_cmd_retrieve_full_attr }, + { BLE_SAMPLE_AMS_CLIENT_READ_FULL_ENTITY_ATT, ble_ams_client_at_cmd_read_full_attr }, +}; + +/* AMS客户端AT命令处理入口函数 */ +void ble_ams_client_at_cmd(uint8_t cmd_id, char **params, uint8_t params_cnt) +{ + size_t hdl_cnt = sizeof(g_ble_ams_client_at_hdl) / sizeof(ble_ams_client_at_hdl_info_t); + for (uint8_t i = 0; i < hdl_cnt; i++) { + if (g_ble_ams_client_at_hdl[i].id == cmd_id && g_ble_ams_client_at_hdl[i].func != NULL) { + (void)g_ble_ams_client_at_hdl[i].func(params_cnt, params); + return; + } + } +} \ No newline at end of file diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/sample_ble_ancs.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/sample_ble_ancs.c new file mode 100644 index 000000000..560afcd9b --- /dev/null +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/ble_at_sample/src/sample_ble_ancs.c @@ -0,0 +1,401 @@ +/* + * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. + * Description: This module include test function of ANCS Client module. + */ +#include +#include +#include +#include "datatype.h" +#include "sdk_general.h" +#include "mpc_dispatch.h" +#include "bt_at_cmd_api.h" +#include "ble_ancs_client.h" +#include "sample_ble_ancs.h" + +#define TEN 10 +#define ANCS_ATT_BYTE_LENGTH 6 +#define ANCS_DEC_CHAR_COUNT 2 +#define BYTE_BIT_COUNT 8 + +/* ANCS客户端接口命令id */ +typedef enum { + BLE_SAMPLE_ANCS_CLIENT_REGISTER_CBK = 1, /* 1 注册ANCS客户端回调函数 */ + BLE_SAMPLE_ANCS_CLIENT_SETUP, /* 2 ANCS客户端连接服务端 */ + BLE_SAMPLE_ANCS_CLIENT_SUBSCRIBE_NOTITY, /* 3 订阅通知 */ + BLE_SAMPLE_ANCS_CLIENT_SUBSCRIBE_DATA, /* 4 订阅数据 */ + BLE_SAMPLE_ANCS_CLIENT_PERFORM_ACTION, /* 5 执行操作 */ + BLE_SAMPLE_ANCS_CLIENT_NOTIFY_ATT_GET, /* 6 执行操作 */ + BLE_SAMPLE_ANCS_CLIENT_APP_ATT_GET /* 7 执行操作 */ +} ble_ancs_client_at_cmd_id_t; + +/* 命令处理函数接口 */ +typedef uint8_t (*ble_ancs_client_at_func_t)(uint8_t argc, char **argv); + +/* ANCS客户端AT命令id与接口对应关系 */ +typedef struct { + ble_ancs_client_at_cmd_id_t id; + ble_ancs_client_at_func_t func; +} ble_ancs_client_at_hdl_info_t; + +/* ANCS服务建立结果回调 */ +static void ble_ancs_client_setup_result_cbk(uint8_t client_id, uint16_t conn_id, errcode_t status) +{ + bts_info("[ANCSClientSetupCBK]conn_id:%d status:0x%x\r\n", conn_id, status); +} + +/* ANCS服务订阅结果回调 */ +static void ble_ancs_client_subscribe_result_cbk(uint8_t client_id, uint16_t conn_id, + ancs_client_subscribe_type_t type, gatt_status_t status) +{ + bts_info("[ANCSClientSubscribeResultCBK]conn_id:%d type:%d status:0x%x\r\n", conn_id, type, status); +} + +/* ANCS服务命令执行结果回调 */ +static void ble_ancs_client_write_result_cbk(uint8_t client_id, uint16_t conn_id, gatt_status_t status) +{ + bts_info("[ANCSClientCMDResultCBK]conn_id:%d status:0x%x\r\n", conn_id, status); +} + +/* ANCS服务消息通知回调 */ +static void ble_ancs_client_notify_source_cbk(uint8_t client_id, uint16_t conn_id, + ble_ancs_notification_src_t *notify_src, errcode_t status) +{ + if (status == ERRCODE_BT_SUCCESS) { + bts_info( + "[ANCSClientNotifySRCCBK]conn_id:%d status:0x%x notify_id:%lu " + "eventId:%d eventFlags:0x%x category_id:%d\r\n", + conn_id, status, + notify_src->notification_uid, + notify_src->event_id, + notify_src->event_flags, + notify_src->category_id); + } else { + bts_error("[ANCSClientNotifySRCCBK]conn_id:%d status:0x%x.\r\n", + conn_id, status); + } +} + +/* ANCS服务通知属性响应结果回调 */ +static void ble_ancs_client_notification_attr_rsp_cbk(uint8_t client_id, uint16_t conn_id, + ble_ancs_notification_attr_rsp_t *notify_attr_rsp, errcode_t status) +{ + if (status == ERRCODE_BT_SUCCESS) { + bts_info("[ANCSClientNotifyATTRSPCBK]conn_id:%d status:0x%x notify_uid:%lu\r\n", + conn_id, status, notify_attr_rsp->notification_uid); + + ble_ancs_attr_rsp_t *node = (ble_ancs_attr_rsp_t *)notify_attr_rsp->attr_rsp_lst.head; + uint16_t att_num = 1; + while (node != NULL) { + if (node != NULL) { + bts_info_no_header("[ANCSClientNotifyATTRSPCBK]att id:%d length:%lu att_value:%s\r\n", + node->att_id, node->att_length, node->att); + } + node = lnext(node); + if (att_num == notify_attr_rsp->att_num) { + break; + } + att_num = att_num + 1; + } + } else { + bts_error("[ANCSClientNotifyATTRSPCBK]conn_id:%d status:0x%x.\r\n", + conn_id, status); + } +} + +/* ANCS服务应用属性响应结果回调 */ +static void ble_ancs_client_app_attr_rsp_cbk(uint8_t client_id, uint16_t conn_id, + ble_ancs_app_attr_rsp_t *app_attr_rsp, errcode_t status) +{ + bts_info("[ANCSClientAPPATTRSPCBK]conn_id:%d status:0x%x\r\n", conn_id, status); + if (status == ERRCODE_BT_SUCCESS) { + ble_ancs_attr_rsp_t *node = (ble_ancs_attr_rsp_t *)app_attr_rsp->attr_rsp_lst.head; + uint16_t att_num = 1; + while (node != NULL) { + if (node != NULL && node->att_id == ANCS_APP_ATT_DISPLAY_NAME) { + bts_info_no_header("[ANCSClientAPPATTRSPCBK]app id:%s length:%lu app name:%s\r\n", + app_attr_rsp->app_id.id, node->att_length, node->att); + } + node = lnext(node); + if (att_num == app_attr_rsp->att_num) { + break; + } + att_num = att_num + 1; + } + } else { + bts_error("[ANCSClientAPPATTRSPCBK]conn_id:%d status:0x%x.\r\n", + conn_id, status); + } +} + +/* 注册ancs服务回调 */ +static uint8_t ble_ancs_client_at_cmd_register_cbk(uint8_t argc, char **argv) +{ + ble_ancs_client_callbacks_t cbk = {0}; + cbk.setup_cb = ble_ancs_client_setup_result_cbk; + cbk.subscribe_cb = ble_ancs_client_subscribe_result_cbk; + cbk.write_result_cb = ble_ancs_client_write_result_cbk; + cbk.notify_source_cb = ble_ancs_client_notify_source_cbk; + cbk.notify_attr_cb = ble_ancs_client_notification_attr_rsp_cbk; + cbk.app_attr_cb = ble_ancs_client_app_attr_rsp_cbk; + errcode_t ret = ble_ancs_client_register_callbacks(&cbk); + bts_info("ble ancs client register cbk ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* ANCS服务建立 */ +static uint8_t ble_ancs_client_at_cmd_setup(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN2) { + bts_error("ble ancs client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + errcode_t ret = ble_ancs_client_setup_service(client_id, conn_id); + bts_info("ble ancs client setup ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* 订阅通知 */ +static uint8_t ble_ancs_client_at_cmd_subscribe_notify(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN3) { + bts_error("ble ancs client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint8_t sub_flag = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + sub_flag = (uint8_t)atoi(argv[BT_INDEX_2]); + if (sub_flag > ANCS_CLIENT_NOTIFY_ENABLE) { + bts_error("ble ancs client argc invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + errcode_t ret = ble_ancs_client_subscribe_notification_source(client_id, conn_id, sub_flag); + bts_info("ble ancs client sub notify ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* 订阅数据 */ +static uint8_t ble_ancs_client_at_cmd_subscribe_data(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN3) { + bts_error("ble ancs client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint8_t sub_flag = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + sub_flag = (uint8_t)atoi(argv[BT_INDEX_2]); + if (sub_flag > ANCS_CLIENT_NOTIFY_ENABLE) { + bts_error("ble ancs client argc invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + + errcode_t ret = ble_ancs_client_subscribe_data_source(client_id, conn_id, sub_flag); + bts_info("ble ancs client sub data ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* 执行消息行为(积极或消极行为) */ +static uint8_t ble_ancs_client_at_cmd_perform_action(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN4) { + bts_error("ble ancs client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint32_t notify_uid = 0; + uint8_t action_id = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + notify_uid = (uint32_t)atoi(argv[BT_INDEX_2]); + action_id = (uint8_t)atoi(argv[BT_INDEX_3]); + if (action_id > ANCS_ACTION_RESERVED) { + bts_error("ble ancs client argc invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + ble_ancs_notification_action_req_t action_cmd = {0}; + action_cmd.notification_uid = notify_uid; + action_cmd.action_id = action_id; + errcode_t ret = ble_ancs_client_send_perform_notify_action_cmd(client_id, conn_id, &action_cmd); + bts_info("ble ancs client perform action ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* 十六进制字符转数值 */ +static uint8_t char_2_num(int8_t c) +{ + if (c >= '0' && c <= '9') { + return (uint8_t)(c - '0'); + } else if (c >= 'A' && c <= 'F') { + return (uint8_t)(c - 'A' + TEN); + } else if (c >= 'a' && c <= 'f') { + return (uint8_t)(c - 'a' + TEN); + } else { + return TD_U8_MAX; + } +} + +/* 十六进制字符转数值 */ +static uint8_t str_2_byte(const char *str) +{ + return ((char_2_num(str[0]) << TD_U4_BITS) + char_2_num(str[1])); +} + +/* 十六进制字符转属性请求参数结构体 */ +static void decode_att_req_from_str(const char *str, ble_ancs_attr_req_t *nums) +{ + uint32_t len = strlen(str); + uint32_t cnt = 0; + char *ptr_str = NULL; + uint16_t length_big_byte = 0; + uint16_t length_little_byte = 0; + ptr_str = str; + for (uint32_t i = 0; i < len - 1; i += ANCS_ATT_BYTE_LENGTH) { /* 6个字符为1组,2个字符为一个字节 */ + nums[cnt].att_id = str_2_byte(ptr_str); + ptr_str += ANCS_DEC_CHAR_COUNT; + length_big_byte = (((uint16_t)str_2_byte(ptr_str)) << BYTE_BIT_COUNT); + ptr_str += ANCS_DEC_CHAR_COUNT; + length_little_byte = ((uint16_t)str_2_byte(ptr_str)); + nums[cnt].att_max_length = (uint16_t)(length_big_byte | length_little_byte); + ptr_str += ANCS_DEC_CHAR_COUNT; + cnt++; + } +} + +/* 获取通知属性 */ +static uint8_t ble_ancs_client_at_cmd_get_notify_att(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN5) { + bts_error("ble ancs client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint32_t notify_uid = 0; + uint8_t att_num = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + notify_uid = (uint32_t)atoi(argv[BT_INDEX_2]); + att_num = (uint8_t)atoi(argv[BT_INDEX_3]); + if (att_num == 0) { + bts_error("ble ancs client notify att req att num is zero!\r\n"); + return MPC_BT_FAIL; + } + uint32_t len = strlen(argv[BT_INDEX_4]); + if ((att_num * ANCS_ATT_BYTE_LENGTH) != len) { + bts_error("ble ancs client notify att req att num is wrong!\r\n"); + return MPC_BT_FAIL; + } + + /* 获取来电通知属性 */ + ble_ancs_notification_attr_req_t *notify_attr_req = bt_os_new( + sizeof(ble_ancs_notification_attr_req_t) + (att_num * sizeof(ble_ancs_attr_req_t))); + notify_attr_req->att_num = att_num; + notify_attr_req->notification_uid = notify_uid; + decode_att_req_from_str(argv[BT_INDEX_4], notify_attr_req->attr); + errcode_t ret = ble_ancs_client_send_get_notify_att_cmd(client_id, conn_id, notify_attr_req); + bt_os_free(notify_attr_req); + bts_info("ble ancs client notify att get ret:0x%x\r\n", ret); + return MPC_BT_SUCC; +} + +/* 解析应用属性参数 */ +static uint8_t parse_app_att_req_param(ble_ancs_app_attr_req_t *app_attr_req, + uint16_t app_id_len, uint16_t att_num, char **argv) +{ + app_attr_req->att_num = att_num; + app_attr_req->app_id.len = app_id_len + 1; + uint8_t *id = bt_os_new(app_attr_req->app_id.len); + if (id == NULL) { + bts_error("[ANCSClientSample]app id memnew error!\r\n"); + app_attr_req->app_id.id = NULL; + return MPC_BT_FAIL; + } + if (memcpy_s(id, app_attr_req->app_id.len, (uint8_t *)argv[BT_INDEX_2], app_id_len) != EOK) { + bts_error("[ANCSClientSample]app id memcpy error!\r\n"); + bt_os_free(id); + app_attr_req->app_id.id = NULL; + return MPC_BT_FAIL; + } + *(id + app_id_len) = 0; /* This string is NULL-terminated */ + app_attr_req->app_id.id = id; + + /* 解析应用属性参数 */ + decode_att_req_from_str(argv[BT_INDEX_4], app_attr_req->attr_id); + return MPC_BT_SUCC; +} + +/* 获取应用属性 */ +static uint8_t ble_ancs_client_at_cmd_get_app_att(uint8_t argc, char **argv) +{ + if (argc != BT_AT_PARAM_LEN5) { + bts_error("ble ancs client argc num invalid :%u\r\n", argc); + return MPC_BT_FAIL; + } + + uint8_t client_id = 0; + uint16_t conn_id = 0; + uint8_t att_num = 0; + uint16_t app_id_len = 0; + client_id = (uint8_t)atoi(argv[BT_INDEX_0]); + conn_id = (uint16_t)atoi(argv[BT_INDEX_1]); + app_id_len = strlen(argv[BT_INDEX_2]); + att_num = (uint8_t)atoi(argv[BT_INDEX_3]); + if (att_num == 0) { + bts_error("ble ancs client notify att req att num is zero!\r\n"); + return MPC_BT_FAIL; + } + uint32_t len = strlen(argv[BT_INDEX_4]); + if ((att_num * ANCS_ATT_BYTE_LENGTH) != len) { + bts_error("ble ancs client notify att req att num is wrong!\r\n"); + return MPC_BT_FAIL; + } + + /* 获取应用属性 */ + ble_ancs_app_attr_req_t *app_attr_req = bt_os_new(sizeof(ble_ancs_app_attr_req_t) + (att_num * sizeof(uint8_t))); + uint8_t result = parse_app_att_req_param(app_attr_req, app_id_len, att_num, argv); + if (result != MPC_BT_SUCC) { + if (app_attr_req->app_id.id != NULL) { + bt_os_free(app_attr_req->app_id.id); + } + bt_os_free(app_attr_req); + return result; + } + errcode_t ret = ble_ancs_client_send_get_app_att_cmd(client_id, conn_id, app_attr_req); + bts_info("ble ancs client app att get ret:0x%x\r\n", ret); + bt_os_free(app_attr_req->app_id.id); + bt_os_free(app_attr_req); + return MPC_BT_SUCC; +} + +/* ANCS客户端AT命令与接口对应关系 */ +static ble_ancs_client_at_hdl_info_t g_ble_ancs_client_at_hdl[] = { + { BLE_SAMPLE_ANCS_CLIENT_REGISTER_CBK, ble_ancs_client_at_cmd_register_cbk }, + { BLE_SAMPLE_ANCS_CLIENT_SETUP, ble_ancs_client_at_cmd_setup }, + { BLE_SAMPLE_ANCS_CLIENT_SUBSCRIBE_NOTITY, ble_ancs_client_at_cmd_subscribe_notify }, + { BLE_SAMPLE_ANCS_CLIENT_SUBSCRIBE_DATA, ble_ancs_client_at_cmd_subscribe_data }, + { BLE_SAMPLE_ANCS_CLIENT_NOTIFY_ATT_GET, ble_ancs_client_at_cmd_get_notify_att }, + { BLE_SAMPLE_ANCS_CLIENT_APP_ATT_GET, ble_ancs_client_at_cmd_get_app_att }, + { BLE_SAMPLE_ANCS_CLIENT_PERFORM_ACTION, ble_ancs_client_at_cmd_perform_action }, +}; + +void ble_ancs_client_at_cmd(uint8_t cmd_id, char **params, uint8_t params_cnt) +{ + size_t hdl_cnt = sizeof(g_ble_ancs_client_at_hdl) / sizeof(ble_ancs_client_at_hdl_info_t); + for (uint8_t i = 0; i < hdl_cnt; i++) { + if (g_ble_ancs_client_at_hdl[i].id == cmd_id && g_ble_ancs_client_at_hdl[i].func != NULL) { + (void)g_ble_ancs_client_at_hdl[i].func(params_cnt, params); + return; + } + } +} diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_ams_client.h b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_ams_client.h new file mode 100644 index 000000000..39169e556 --- /dev/null +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_ams_client.h @@ -0,0 +1,977 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2024. All rights reserved. + * Description: BLE Apple Media Service Client module. + */ + +/** + * @defgroup bluetooth_bts_ams_client AMS CLIENT API + * @ingroup bluetooth + * @{ + */ +#ifndef BLE_AMS_CLIENT_H +#define BLE_AMS_CLIENT_H +#include "errcode.h" +#include "bth_stack.h" +#include "bth_stack_gatt.h" +#include "bts_gatt_client.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * @if Eng + * @brief Default value of Client Characteristic Configuration. + * @else + * @brief 客户端特征配置描述符的默认值。 + * @endif + */ +#define BLE_AMS_CLIENT_CHARACTERISTIC_CONFIGURATION_DEFAULT 0x0000 + +/** + * @if Eng + * @brief Client Characteristic Configuration value is notification. + * @else + * @brief 客户端特征配置描述符的值为通知。 + * @endif + */ +#define BLE_AMS_CLIENT_CHARACTERISTIC_CONFIGURATION_NOTIFICATION 0x0001 + +/** + * @if Eng + * @brief Enum of ams notify switch. + * @else + * @brief 通知开关 + * @endif + */ +typedef enum { + AMS_CLIENT_NOTIFY_DISABLE, /*!< @if Eng disable notify @else 关闭通知 @endif */ + AMS_CLIENT_NOTIFY_ENABLE, /*!< @if Eng enable notify @else 开启通知 @endif */ +} ams_client_notify_enable_t; + +/** + * @if Eng + * @brief Enum of remote command + * @else + * @brief 远端命令ID + * @endif + */ +typedef enum { + AMS_RMT_CMD_ID_PLAY = 0, /*!< @if Eng play @else 播放 @endif */ + AMS_RMT_CMD_ID_PAUSE = 1, /*!< @if Eng pause @else 暂停 @endif */ + AMS_RMT_CMD_ID_TOGGLE_PLAY_PAUSE = 2, /*!< @if Eng toggle play or pause @else 切换播放/暂停 @endif */ + AMS_RMT_CMD_ID_NEXT_TRACK = 3, /*!< @if Eng next track @else 下一首 @endif */ + AMS_RMT_CMD_ID_PREVIOUS_TRACK = 4, /*!< @if Eng previous track @else 上一首 @endif */ + AMS_RMT_CMD_ID_VOLUME_UP = 5, /*!< @if Eng volume up @else 调高音量 @endif */ + AMS_RMT_CMD_ID_VOLUME_DOWN = 6, /*!< @if Eng volume down @else 调低音量 @endif */ + AMS_RMT_CMD_ID_ADVANCE_REPEAT_MODE = 7, /*!< @if Eng advance repeat mode @else 高级重复模式 @endif */ + AMS_RMT_CMD_ID_ADVANCE_SHUFFLE_MODE = 8, /*!< @if Eng advance shuffle mode @else 高级随机模式 @endif */ + AMS_RMT_CMD_ID_SKIP_FORWARD = 9, /*!< @if Eng skip forward @else 跳过前一个 @endif */ + AMS_RMT_CMD_ID_SKIP_BACKWARD = 10, /*!< @if Eng skip backward @else 跳过后一个 @endif */ + AMS_RMT_CMD_ID_LIKE_TRACK = 11, /*!< @if Eng like track @else 喜欢 @endif */ + AMS_RMT_CMD_ID_DISLIKE_TRACK = 12, /*!< @if Eng dislike track @else 取消喜欢 @endif */ + AMS_RMT_CMD_ID_BOOKMARK_TRACK = 13, /*!< @if Eng bookmark track @else 标记喜欢或取消喜欢 @endif */ + AMS_RMT_CMD_ID_RESERVED /*!< @if Eng reserved @else 预留命令ID @endif */ +} ams_remote_cmd_id_t; + +/** + * @if Eng + * @brief Enum of entity id + * @else + * @brief 实体ID + * @endif + */ +typedef enum { + AMS_ENTITY_ID_PLAYER = 0, /*!< @if Eng player @else 播放器 @endif */ + AMS_ENTITY_ID_QUEUE = 1, /*!< @if Eng queue @else 播放列表 @endif */ + AMS_ENTITY_ID_TRACK = 2, /*!< @if Eng track @else 曲目 @endif */ + AMS_ENTITY_ID_RESERVED /*!< @if Eng reserved @else 预留实体ID @endif */ +} ams_entity_id_t; + +/** + * @if Eng + * @brief Enum of entity update flags + * @else + * @brief 实体更新标记 + * @endif + */ +typedef enum { + AMS_ENTITY_UPDATE_FLAG_TRUNCATED = (1 << 0), /*!< @if Eng truncated @else 销毁 @endif */ + AMS_ENTITY_UPDATE_FLAG_RESERVED /*!< @if Eng reserved @else 预留标记 @endif */ +} ams_entity_updata_flag_t; + +/** + * @if Eng + * @brief Enum of player attribute id + * @else + * @brief 播放器属性ID + * @endif + */ +typedef enum { + AMS_PALYER_ATT_ID_NAME = 0, /*!< @if Eng name @else 播放器名称 @endif */ + AMS_PALYER_ATT_ID_PLAYBACK_INFO = 1, /*!< @if Eng playback info @else 播放信息 @endif */ + AMS_PALYER_ATT_ID_VOLUME = 2, /*!< @if Eng volume @else 音量,0-1的浮点数 @endif */ + AMS_PALYER_ATT_ID_RESERVED /*!< @if Eng reserved @else 预留属性ID @endif */ +} ams_player_att_id_t; + +/** + * @if Eng + * @brief Enum of queue attribute id + * @else + * @brief 队列属性ID + * @endif + */ +typedef enum { + AMS_QUEUE_ATT_ID_INDEX = 0, /*!< @if Eng index @else 序号,从0开始 @endif */ + AMS_QUEUE_ATT_ID_COUNT = 1, /*!< @if Eng count @else 列表个数 @endif */ + AMS_QUEUE_ATT_ID_SHUFFLE_MODE = 2, /*!< @if Eng shuffle mode @else 随机模式 @endif */ + AMS_QUEUE_ATT_ID_REPEAT_MODE = 3, /*!< @if Eng repeat mode @else 重复模式 @endif */ + AMS_QUEUE_ATT_ID_RESERVED /*!< @if Eng reserved @else 预留属性ID @endif */ +} ams_queue_att_id_t; + + +/** + * @if Eng + * @brief Enum of track attribute id + * @else + * @brief 曲目属性ID + * @endif + */ +typedef enum { + AMS_TRACK_ATT_ID_ARTIST = 0, /*!< @if Eng artist @else 艺术家 @endif */ + AMS_TRACK_ATT_ID_ALBUM = 1, /*!< @if Eng album @else 专辑 @endif */ + AMS_TRACK_ATT_ID_TITLE = 2, /*!< @if Eng title @else 标题 @endif */ + AMS_TRACK_ATT_ID_DURATION = 3, /*!< @if Eng duration @else 音乐时长,秒级,浮点数 @endif */ + AMS_TRACK_ATT_ID_RESERVED /*!< @if Eng reserved @else 预留属性ID @endif */ +} ams_track_att_id_t; + +/** + * @if Eng + * @brief Enum of shuffle mode + * @else + * @brief 随机模式 + * @endif + */ +typedef enum { + AMS_SHUFFLE_MODE_OFF = 0, /*!< @if Eng off @else 关闭 @endif */ + AMS_SHUFFLE_MODE_ONE = 1, /*!< @if Eng one @else 随机模式1 @endif */ + AMS_SHUFFLE_MODE_ALL = 2, /*!< @if Eng all @else 随机模式2 @endif */ + AMS_SHUFFLE_MODE_RESERVED /*!< @if Eng reserved @else 预留随机模式 @endif */ +} ams_shuffle_mode_t; + +/** + * @if Eng + * @brief Enum of repeat mode + * @else + * @brief 重复模式 + * @endif + */ +typedef enum { + AMS_REPEAT_MODE_OFF = 0, /*!< @if Eng off @else 关闭 @endif */ + AMS_REPEAT_MODE_ONE = 1, /*!< @if Eng one @else 重复模式1 @endif */ + AMS_REPEAT_MODE_ALL = 2, /*!< @if Eng all @else 重复模式2 @endif */ + AMS_REPEAT_MODE_RESERVED /*!< @if Eng reserved @else 预留重复模式 @endif */ +} ams_repeat_mode_t; + +/** + * @if Eng + * @brief Enum of subscribe type + * @else + * @brief 订阅类型 + * @endif + */ +typedef enum { + AMS_CLIENT_SUBSCRIBE_REMOTE_CMD = 0, /*!< @if Eng subscribe remote command @else 订阅远端命令 @endif */ + AMS_CLIENT_SUBSCRIBE_ENTITY_UPDATE = 1, /*!< @if Eng subscribe entity update @else 订阅实体更新 @endif */ +} ams_client_subscribe_type_t; + + +/** + * @if Eng + * @brief Enum of write character + * @else + * @brief 写特征类型 + * @endif + */ +typedef enum { + AMS_CLIENT_WRITE_REMOTE_CMD = 0, /*!< @if Eng write remote command @else 写远端命令 @endif */ + AMS_CLIENT_WRITE_ENTITY_UPDATE = 1, /*!< @if Eng write entity update @else 写实体更新 @endif */ + AMS_CLIENT_WRITE_ENTITY_ATTRIBUTE = 2, /*!< @if Eng write entity attribute @else 写实体属性 @endif */ +} ams_client_write_character_type_t; + +/** + * @if Eng + * @brief Enum of ams character. + * @else + * @brief AMS服务特征。 + * @endif + */ +typedef enum { + AMS_CHAR_REMOTE_CMD, /*!< @if Eng remote command @else 远端命令 @endif */ + AMS_CHAR_ENTITY_UPDATE, /*!< @if Eng entity update @else 实体更新 @endif */ + AMS_CHAR_ENTITY_ATTR, /*!< @if Eng entity update @else 实体更新 @endif */ + AMS_CHAR_INVALID, /*!< @if Eng invalid @else 无效特征 @endif */ +} ams_character_t; + +/** + * @if Eng + * @brief Enum of ams error codes. + * @else + * @brief AMS客户端写和读特征响应错误码。 + * @endif + */ +typedef enum { + AMS_ERROR_CODE_INVALID_STATE = 0xA0, /*!< @if Eng Invalid State + @else 无效状态,客户端未发起服务建立 @endif */ + AMS_ERROR_CODE_INVALID_CMD = 0xA1, /*!< @if Eng Invalid command @else 无效命令 @endif */ + AMS_ERROR_CODE_ABSENT_ATTRIBUTE = 0xA2 /*!< @if Eng Absent attribute @else 属性为空 @endif */ +} ams_write_error_code_t; + +/** + * @if Eng + * @brief Struct of ams service. + * @else + * @brief AMS服务。 + * @endif + */ +typedef struct { + uint8_t client_id; /*!< @if Eng client id @else 客户端ID @endif */ + uint16_t conn_id; /*!< @if Eng connect id @else 连接ID @endif */ + uint16_t start_handle; /*!< @if Eng start handle @else 服务开始handle @endif */ + uint16_t end_handle; /*!< @if Eng end handle @else 服务结束handle @endif */ + gattc_discovery_character_result_t remote_cmd; /*!< @if Eng remote command @else 远端命令特征 @endif */ + gattc_discovery_character_result_t entity_update; /*!< @if Eng entity update @else 实体更新特征 @endif */ + gattc_discovery_character_result_t entity_attr; /*!< @if Eng entity attribute @else 实体属性特征 @endif */ + uint16_t remote_cmd_ccc_handle; /*!< @if Eng remote command ccc + @else 远端命令特征ccc描述符handle @endif */ + uint16_t entity_update_ccc_handle; /*!< @if Eng entity update ccc + @else 实体更新特征ccc描述符handle @endif */ +} ble_ams_service_t; + +/** + * @if Eng + * @brief Struct of interested entity attribute request. + * @else + * @brief 感兴趣实体属性请求。 + * @endif + */ +typedef struct { + uint8_t entity_id; /*!< @if Eng entity id @else 实体ID @endif */ + uint16_t att_num; /*!< @if Eng the count of attribute @else 属性个数 @endif */ + uint8_t att_id[0]; /*!< @if Eng the array of attribute @else 属性ID数组 @endif */ +} ble_ams_interested_entity_attr_req_t; + +/** + * @if Eng + * @brief Struct of full entity attribute request. + * @else + * @brief 完整实体属性请求。 + * @endif + */ +typedef struct { + uint8_t entity_id; /*!< @if Eng entity id @else 实体ID @endif */ + uint8_t att_id; /*!< @if Eng attribute id @else 属性ID @endif */ +} ble_ams_full_entity_attr_cmd_t; + +/** + * @if Eng + * @brief Struct of supported remote command. + * @else + * @brief 支持的远端命令。 + * @endif + */ +typedef struct { + uint16_t cmd_num; /*!< @if Eng the count of command @else 支持的远端命令个数 @endif */ + uint8_t remote_cmd[0]; /*!< @if Eng the array of remote command @else 支持的远端命令数组 @endif */ +} ble_ams_remote_cmd_rpt_t; + +/** + * @if Eng + * @brief Struct of entity update info. + * @else + * @brief 实体更新信息。 + * @endif + */ +typedef struct { + uint8_t entity_id; /*!< @if Eng entity id @else 实体ID @endif */ + uint8_t att_id; /*!< @if Eng attribute id @else 属性ID @endif */ + uint8_t entity_update_flags; /*!< @if Eng entity update flags @else 实体更新标记 @endif */ + uint16_t value_length; /*!< @if Eng the length of entity value @else 属性值长度 @endif */ + uint8_t value[0]; /*!< @if Eng entity value @else 属性值字节序(字符串,以0结尾),上层应用根据协议解析 @endif */ +} ble_ams_entity_update_rpt_t; + +/** + * @if Eng + * @brief Struct of full entity attribute. + * @else + * @brief 完整实体属性信息。 + * @endif + */ +typedef struct { + uint8_t entity_id; /*!< @if Eng entity id @else 实体ID @endif */ + uint8_t att_id; /*!< @if Eng attribute id @else 属性ID @endif */ + uint16_t value_len; /*!< @if Eng the length of entity value @else 属性值长度 @endif */ + uint8_t value[0]; /*!< @if Eng entity value @else 属性值字节序(字符串,以0结尾) @endif */ +} ble_ams_full_attr_value_t; + + +/** + * @if Eng + * @brief Callback invoked when client setup service complete. + * @par Callback invoked when client setup service complete. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] status error code{ @ref errcode_bt_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_def.h + * @see ble_ams_client_callbacks_t + * @else + * @brief AMS客户端服务建立完成回调函数。 + * @par AMS客户端服务建立完成回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] status 执行结果错误码{ @ref errcode_bt_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_def.h + * @see ble_ams_client_callbacks_t + * @endif + */ +typedef void (*ams_client_setup_result_cbk)(uint8_t client_id, uint16_t conn_id, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when client subscribe character notify complete. + * @par Callback invoked when client subscribe character notify complete. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] type subscribe type{ @ref ams_client_subscribe_type_t }. + * @param [in] status gatt error code{ @ref gatt_status_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_stru.h + * @see ble_ams_client_callbacks_t + * @else + * @brief AMS客户端订阅特征通知结果回调函数。 + * @par AMS客户端订阅特征通知结果回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] type 订阅类型{ @ref ams_client_subscribe_type_t }. + * @param [in] status gatt操作错误码{ @ref gatt_status_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_stru.h + * @see ble_ams_client_callbacks_t + * @endif + */ +typedef void (*ams_client_subscribe_result_cbk)(uint8_t client_id, uint16_t conn_id, + ams_client_subscribe_type_t type, gatt_status_t status); + +/** + * @if Eng + * @brief Callback invoked when remote service notify supported remote command. + * @par Callback invoked when remote service notify supported remote command. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] remote_cmd supported remote command{ @ref ble_ams_remote_cmd_rpt_t }. + * @param [in] status error code{ @ref errcode_bt_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_def.h + * @see ble_ams_client_callbacks_t + * @else + * @brief AMS远端服务通知支持的远端命令回调函数。 + * @par AMS远端服务通知支持的远端命令回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] remote_cmd 支持的远端命令{ @ref ble_ams_remote_cmd_rpt_t }. + * @param [in] status 操作错误码{ @ref errcode_bt_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_def.h + * @see ble_ams_client_callbacks_t + * @endif + */ +typedef void (*ams_client_remote_command_rpt_cbk)(uint8_t client_id, uint16_t conn_id, + ble_ams_remote_cmd_rpt_t *remote_cmd, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when remote service notify entity update info. + * @par Callback invoked when remote service notify entity update info. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] entity_update entity update info{ @ref ble_ams_entity_update_rpt_t }. + * @param [in] status error code{ @ref errcode_bt_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_def.h + * @see ble_ams_client_callbacks_t + * @else + * @brief AMS远端服务通知实体更新信息回调函数。 + * @par AMS远端服务通知实体更新信息回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] entity_update 实体更新信息{ @ref ble_ams_entity_update_rpt_t }. + * @param [in] status 操作错误码{ @ref errcode_bt_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_def.h + * @see ble_ams_client_callbacks_t + * @endif + */ +typedef void (*ams_client_entity_update_rpt_cbk)(uint8_t client_id, uint16_t conn_id, + ble_ams_entity_update_rpt_t *entity_update, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when client write remote character complete. + * @par Callback invoked when client write remote character complete. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] type character type{ @ref ams_client_write_character_type_t }. + * @param [in] status gatt error code{ @ref gatt_status_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_stru.h + * @see ble_ams_client_callbacks_t + * @else + * @brief AMS客户端写对端特征响应回调函数。 + * @par AMS客户端写对端特征响应回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] type 特征类型{ @ref ams_client_write_character_type_t }. + * @param [in] status gatt操作错误码{ @ref gatt_status_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_stru.h + * @see ble_ams_client_callbacks_t + * @endif + */ +typedef void (*ams_client_write_character_rsp_cbk)(uint8_t client_id, uint16_t conn_id, + ams_client_write_character_type_t type, + gatt_status_t status); + +/** + * @if Eng + * @brief Callback invoked when client read remote character complete. + * @par Callback invoked when client read remote character complete. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] read_result full attribute value{ @ref ble_ams_full_attr_value_t }. + * @param [in] status gatt error code{ @ref gatt_status_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_stru.h + * @see ble_ams_client_callbacks_t + * @else + * @brief AMS客户端读对端特征响应回调函数。 + * @par AMS客户端读对端特征响应回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] read_result 特征值{ @ref ble_ams_full_attr_value_t }. + * @param [in] status gatt操作错误码{ @ref gatt_status_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_stru.h + * @see ble_ams_client_callbacks_t + * @endif + */ +typedef void (*ams_client_read_full_attr_result_cbk)(uint8_t client_id, uint16_t conn_id, + ble_ams_full_attr_value_t *read_result, + gatt_status_t status); + +/** + * @if Eng + * @brief Struct of AMS client callback function. + * @else + * @brief AMS 客户端回调函数接口定义。 + * @endif + */ +typedef struct { + ams_client_setup_result_cbk setup_cb; /*!< @if Eng setup callback @else 客户端服务建立完成回调 @endif */ + ams_client_subscribe_result_cbk subscribe_cb; /*!< @if Eng subscribe callback + @else 订阅特征通知结果回调 @endif */ + ams_client_remote_command_rpt_cbk remote_cmd_cb; /*!< @if Eng suppported remote command callback + @else 远端服务通知支持的远端命令回调 @endif */ + ams_client_entity_update_rpt_cbk entity_update_cb; /*!< @if Eng entity update callback + @else 远端服务通知实体更新信息回调 @endif */ + ams_client_write_character_rsp_cbk write_rsp_cb; /*!< @if Eng write response callback + @else 客户端写请求响应回调 @endif */ + ams_client_read_full_attr_result_cbk read_full_attr_result_cb; /*!< @if Eng read response callback + @else 客户端读请求响应回调 @endif */ +} ble_ams_client_callbacks_t; + +/** + * @if Eng + * @brief The interface of AMS client setup service. + * @par The interface of AMS client setup service. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief AMS客户端发起服务建立。 + * @par AMS客户端发起服务建立。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ams_client_setup_service(uint8_t client_id, uint16_t conn_id); + +/** + * @if Eng + * @brief The interface of AMS client discovery service result callback. + * @par The interface of AMS client discovery service result callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] service service info. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_client.h + * @see + * @else + * @brief AMS客户端发现服务结果处理接口。 + * @par AMS客户端发现服务结果处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] service AMS 服务信息。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_client.h + * @see + * @endif + */ +void ble_ams_client_discovery_service_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_service_result_t *service); + +/** + * @if Eng + * @brief The interface of AMS client discovery character result callback. + * @par The interface of AMS client discovery character result callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] character character info. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_client.h + * @see + * @else + * @brief AMS客户端发现特征结果处理接口。 + * @par AMS客户端发现特征结果处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] character AMS 服务特征信息。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_client.h + * @see + * @endif + */ +void ble_ams_client_discovery_character_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_character_result_t *character); + +/** + * @if Eng + * @brief The interface of AMS client discovery descriptor result callback. + * @par The interface of AMS client discovery descriptor result callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] descriptor descriptor info. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_client.h + * @see + * @else + * @brief AMS客户端发现描述符结果处理接口。 + * @par AMS客户端发现描述符结果处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] descriptor AMS 服务特征描述符信息。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_client.h + * @see + * @endif + */ +void ble_ams_client_discovery_descriptor_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_descriptor_result_t *descriptor); + +/** + * @if Eng + * @brief The interface of AMS client receive notify info callback. + * @par The interface of AMS client receive notify info callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] data notify info. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_client.h + * @see + * @else + * @brief AMS客户端接收对端通知信息处理接口。 + * @par AMS客户端接收对端通知信息处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] data 对端通知信息。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_client.h + * @see + * @endif + */ +void ble_ams_client_notify_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data); + +/** + * @if Eng + * @brief The interface of AMS client write response callback. + * @par The interface of AMS client write response callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] status gatt status {@ref gatt_status_t}. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_stru.h + * @see + * @else + * @brief AMS客户端写请求响应结果处理接口。 + * @par AMS客户端写请求响应结果处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] status gatt 操作结果码 {@ref gatt_status_t}. + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_stru.h + * @see + * @endif + */ +void ble_ams_client_write_cbk(uint8_t client_id, uint16_t conn_id, uint16_t handle, gatt_status_t status); + +/** + * @if Eng + * @brief The interface of AMS client read response callback. + * @par The interface of AMS client read response callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] read_result read response result. + * @param [in] status gatt status {@ref gatt_status_t}. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_stru.h + * @li bts_gatt_client.h + * @see + * @else + * @brief AMS客户端读请求响应结果处理接口。 + * @par AMS客户端读请求响应结果处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] read_result 读请求响应结果. + * @param [in] status gatt 操作结果码 {@ref gatt_status_t}. + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_stru.h + * @li bts_gatt_client.h + * @see + * @endif + */ +void ble_ams_client_read_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *read_result, + gatt_status_t status); + +/** + * @if Eng + * @brief The interface of AMS client subscribe remote command character notify. + * @par The interface of AMS client subscribe remote command character notify. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] enable_flag enable/disable flag {@ref ams_client_notify_enable_t}. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief AMS客户端订阅远端命令特征通知接口。 + * @par AMS客户端订阅远端命令特征通知接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] enable_flag 开启/关闭标记。 {@ref ams_client_notify_enable_t}. + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ams_client_subscribe_remote_cmd(uint8_t client_id, uint16_t conn_id, + ams_client_notify_enable_t enable_flag); + +/** + * @if Eng + * @brief The interface of AMS client subscribe entity update character notify. + * @par The interface of AMS client subscribe entity update character notify. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] enable_flag enable/disable flag {@ref ams_client_notify_enable_t}. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief AMS客户端订阅实体更新特征通知接口。 + * @par AMS客户端订阅实体更新特征通知接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] enable_flag 开启/关闭标记。 {@ref ams_client_notify_enable_t}. + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ams_client_subscribe_entity_update(uint8_t client_id, uint16_t conn_id, + ams_client_notify_enable_t enable_flag); + +/** + * @if Eng + * @brief The interface of AMS client send remote command. + * @par The interface of AMS client send remote command, it is used for operating remote media action. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] cmd_id command id {@ref ams_remote_cmd_id_t}. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief AMS客户端发送远端命令接口。 + * @par AMS客户端发送远端命令接口,该接口用来控制对端媒体行为,例如播放/暂停,调节音量等 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] cmd_id 命令ID。 {@ref ams_remote_cmd_id_t}. + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ams_client_send_remote_cmd(uint8_t client_id, uint16_t conn_id, + ams_remote_cmd_id_t cmd_id); + +/** + * @if Eng + * @brief The interface of AMS client register interested entity attribute. + * @par The interface of AMS client register interested entity attribute. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] entity_attr_req interested entity attribute list. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief AMS客户端注册感兴趣的实体属性接口。 + * @par AMS客户端注册感兴趣的实体属性,当该实体属性更新时,对端会发送通知到本端。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] entity_attr_req 感兴趣的实体属性列表。 + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ams_client_register_interested_entity_attribute(uint8_t client_id, uint16_t conn_id, + ble_ams_interested_entity_attr_req_t *entity_attr_req); + +/** + * @if Eng + * @brief The interface of AMS client retrieve full entity attribute. + * @par The interface of AMS client retrieve full entity attribute. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] full_attr_req entity attribute. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief AMS客户端请求对端加载完整的实体属性信息接口。 + * @par AMS客户端请求对端加载完整的实体属性信息接口,稍后AMS客户端再发起读请求,读取完整的实体属性信息。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] full_attr_req 实体属性。 + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ams_client_retrieve_full_entity_attribute(uint8_t client_id, uint16_t conn_id, + ble_ams_full_entity_attr_cmd_t *full_attr_req); + +/** + * @if Eng + * @brief The interface of AMS client read full entity attribute. + * @par The interface of AMS client read full entity attribute. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief AMS客户端读取完整实体属性信息接口。 + * @par AMS客户端读取完整完整实体属性信息接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ams_client_read_full_entity_attribute(uint8_t client_id, uint16_t conn_id); + +/** + * @if Eng + * @brief The interface of AMS client register callback. + * @par The interface of AMS client register callback. + * @attention + * @param [in] func the pointer of callback struct. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief AMS客户端注册回调接口。 + * @par AMS客户端注册回调接口。 + * @attention + * @param [in] func 回调函数结构体指针。 + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ams_client_register_callbacks(ble_ams_client_callbacks_t *func); + +/** + * @if Eng + * @brief The interface of check service uuid whether or not AMS service. + * @par The interface of check service uuid whether or not AMS service. + * @attention + * @param [in] uuid service uuid. + * @retval true or false true:Yes, false:No. + * @par Dependency: + * @li + * @see + * @else + * @brief AMS客户端注册回调接口。 + * @par AMS客户端注册回调接口。 + * @attention + * @param [in] uuid 服务uuid。 + * @retval 是或否 是:是AMS服务,否:不是AMS服务. + * @par 依赖: + * @li + * @see + * @endif + */ +bool is_ble_ams_service(bt_uuid_t *uuid); + +/** + * @if Eng + * @brief The interface of AMS client clear stored remote ams service info by connect id. + * @par The interface of AMS client clear stored remote ams service info by connect id. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @retval #void no return value. + * @par Dependency: + * @li + * @see + * @else + * @brief AMS客户端根据连接ID清理存储的对端AMS服务信息。 + * @par AMS客户端根据连接ID清理存储的对端AMS服务信息。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @retval 无返回值。 + * @par 依赖: + * @li + * @see + * @endif + */ +void ble_ams_client_clear_remote_by_conn(uint8_t client_id, uint16_t conn_id); + +/** + * @if Eng + * @brief The interface of AMS client clear all stored remote ams service info. + * @par The interface of AMS client clear all stored remote ams service info. + * @attention + * @retval #void no return value. + * @par Dependency: + * @li + * @see + * @else + * @brief AMS客户端清理所有存储的对端AMS服务信息。 + * @par AMS客户端清理所有存储的对端AMS服务信息。 + * @attention + * @retval 无返回值。 + * @par 依赖: + * @li + * @see + * @endif + */ +void ble_ams_client_clear_remote_all(void); + +/** + * @} + */ +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_ancs_client.h b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_ancs_client.h new file mode 100644 index 000000000..4a7190972 --- /dev/null +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_ancs_client.h @@ -0,0 +1,947 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2024. All rights reserved. + * Description: BLE Apple Notification Center Service Client module. + */ + +/** + * @defgroup bluetooth_bts_ancs_client ANCS CLIENT API + * @ingroup bluetooth + * @{ + */ +#ifndef BLE_ANCS_CLIENT_H +#define BLE_ANCS_CLIENT_H +#include "errcode.h" +#include "sdk_list.h" +#include "bth_stack.h" +#include "bth_stack_gatt.h" +#include "bts_gatt_client.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @if Eng + * @brief Default value of Client Characteristic Configuration. + * @else + * @brief 客户端特征配置描述符的默认值。 + * @endif + */ +#define BLE_ANCS_CLIENT_CHARACTERISTIC_CONFIGURATION_DEFAULT 0x0000 + +/** + * @if Eng + * @brief Client Characteristic Configuration value is notification. + * @else + * @brief 客户端特征配置描述符的值为通知。 + * @endif + */ +#define BLE_ANCS_CLIENT_CHARACTERISTIC_CONFIGURATION_NOTIFICATION 0x0001 + +/** + * @if Eng + * @brief Enum of ancs notify switch. + * @else + * @brief 通知开关枚举值。 + * @endif + */ +typedef enum { + ANCS_CLIENT_NOTIFY_DISABLE, /*!< @if Eng disable notify @else 关闭通知 @endif */ + ANCS_CLIENT_NOTIFY_ENABLE, /*!< @if Eng enable notify @else 开启通知 @endif */ +} ancs_client_notify_enable_t; + +/** + * @if Eng + * @brief Enum of event id + * @else + * @brief 事件ID枚举值 + * @endif + */ +typedef enum { + ANCS_EVENT_ADDED = 0, /*!< @if Eng add @else 新增通知 @endif */ + ANCS_EVENT_MODIFIED = 1, /*!< @if Eng modify @else 修改通知 @endif */ + ANCS_EVENT_REMOEVD = 2, /*!< @if Eng remove @else 移除通知 @endif */ + ANCS_EVENT_RESERVED /*!< @if Eng reserved @else 预留事件ID @endif */ +} ancs_event_id_t; + +/** + * @if Eng + * @brief Enum of event flags + * @else + * @brief 事件标记枚举值 + * @endif + */ +typedef enum { + ANCS_EVENT_FLAG_SILENT = (1 << 0), /*!< @if Eng silent @else 安静 @endif */ + ANCS_EVENT_FLAG_IMPORTANT = (1 << 1), /*!< @if Eng important @else 重要 @endif */ + ANCS_EVENT_FLAG_PREEXISTING = (1 << 2), /*!< @if Eng preexisting @else 先存的 @endif */ + ANCS_EVENT_FLAG_POSITIVE_ACTION = (1 << 3), /*!< @if Eng positive action @else 积极活动 @endif */ + ANCS_EVENT_FLAG_NEGATIVE_ACTION = (1 << 4), /*!< @if Eng negative action @else 消极活动 @endif */ + ANCS_EVENT_FLAG_RESERVED /*!< @if Eng reserved @else 预留事件标记 @endif */ +} ancs_event_flags_t; + +/** + * @if Eng + * @brief Enum of command id + * @else + * @brief 命令ID枚举值 + * @endif + */ +typedef enum { + ANCS_CMD_GET_NOTIFY_ATT = 0, /*!< @if Eng Get notify attribute @else 获取通知属性 @endif */ + ANCS_CMD_GET_APP_ATT = 1, /*!< @if Eng Get app attribute @else 获取应用属性 @endif */ + ANCS_CMD_PERFORM_NOTIFY_ACTION = 2, /*!< @if Eng Perform notify action @else 处理通知 @endif */ + ANCS_CMD_RESERVED /*!< @if Eng reserved @else 预留命令ID @endif */ +} ancs_command_id_t; + +/** + * @if Eng + * @brief Enum of category id + * @else + * @brief 分类ID枚举值 + * @endif + */ +typedef enum { + ANCS_CATEGORY_OTHER = 0, /*!< @if Eng Other @else 其他 @endif */ + ANCS_CATEGORY_INCOMING_CALL = 1, /*!< @if Eng Incoming call @else 来电 @endif */ + ANCS_CATEGORY_MISSED_CALL = 2, /*!< @if Eng Missed call @else 未接来电 @endif */ + ANCS_CATEGORY_VOICE_MAIL = 3, /*!< @if Eng Voice mail @else 语音消息 @endif */ + ANCS_CATEGORY_SOCIAL = 4, /*!< @if Eng Social @else 社交 @endif */ + ANCS_CATEGORY_SCHEDULE = 5, /*!< @if Eng Schedule @else 计划 @endif */ + ANCS_CATEGORY_EMAIL = 6, /*!< @if Eng Email @else 邮件 @endif */ + ANCS_CATEGORY_NEWS = 7, /*!< @if Eng News @else 新闻 @endif */ + ANCS_CATEGORY_HEALTH_FITNESS = 8, /*!< @if Eng Health fitness @else 运动健康 @endif */ + ANCS_CATEGORY_BUSINESS_FINANCE = 9, /*!< @if Eng Business finance @else 商业金融 @endif */ + ANCS_CATEGORY_LOCATION = 10, /*!< @if Eng Location @else 位置 @endif */ + ANCS_CATEGORY_ENTERTAINMENT = 11, /*!< @if Eng Entertainment @else 娱乐 @endif */ + ANCS_CATEGORY_RESERVED /*!< @if Eng reserved @else 预留分类ID @endif */ +} ancs_category_id_t; + + +/** + * @if Eng + * @brief Enum of notify attribute id + * @else + * @brief 通知属性ID枚举值 + * @endif + */ +typedef enum { + ANCS_NOTIFY_ATT_APP_ID = 0, /*!< @if Eng App id @else 应用编号 @endif */ + ANCS_NOTIFY_ATT_TITLE = 1, /*!< @if Eng Title @else 标题 @endif */ + ANCS_NOTIFY_ATT_SUBTITLE = 2, /*!< @if Eng Subtitle @else 副标题 @endif */ + ANCS_NOTIFY_ATT_MESSAGE = 3, /*!< @if Eng Message @else 消息 @endif */ + ANCS_NOTIFY_ATT_MSG_SIZE = 4, /*!< @if Eng Message size @else 消息大小 @endif */ + ANCS_NOTIFY_ATT_DATE = 5, /*!< @if Eng Date @else 日期 @endif */ + ANCS_NOTIFY_ATT_POSITIVE_LABEL = 6, /*!< @if Eng Positive lable @else 积极活动标签 @endif */ + ANCS_NOTIFY_ATT_NEGATIVE_LABEL = 7, /*!< @if Eng Negative lable @else 消极活动标签 @endif */ + ANCS_NOTIFY_ATT_RESERVED /*!< @if Eng reserved @else 预留通知属性ID @endif */ +} ancs_notification_att_id_t; + +/** + * @if Eng + * @brief Enum of app attribute id + * @else + * @brief 应用属性ID枚举值 + * @endif + */ +typedef enum { + ANCS_APP_ATT_DISPLAY_NAME = 0, /*!< @if Eng Display name @else 应用显示名称 @endif */ + ANCS_APP_ATT_RESERVED /*!< @if Eng reserved @else 预留应用属性ID @endif */ +} ancs_app_att_id_t; + +/** + * @if Eng + * @brief Enum of action id + * @else + * @brief 活动ID枚举值 + * @endif + */ +typedef enum { + ANCS_ACTION_POSITIVE = 0, /*!< @if Eng Positive @else 积极活动 @endif */ + ANCS_ACTION_NEGATIVE = 1, /*!< @if Eng Negative @else 消极活动 @endif */ + ANCS_ACTION_RESERVED /*!< @if Eng Reserved @else 预留活动ID @endif */ +} ancs_action_id_t; + +/** + * @if Eng + * @brief Enum of subscribe type + * @else + * @brief 订阅类型 + * @endif + */ +typedef enum { + ANCS_CLIENT_SUBSCRIBE_NOTIFY = 0, /*!< @if Eng Subscribe notify @else 订阅通知 @endif */ + ANCS_CLIENT_SUBSCRIBE_DATA = 1, /*!< @if Eng Subscribe data @else 订阅数据 @endif */ +} ancs_client_subscribe_type_t; + +/** + * @if Eng + * @brief Enum of ancs servie character. + * @else + * @brief ANCS服务特征。 + * @endif + */ +typedef enum { + ANCS_CHAR_NOTIFY_SRC = 0, /*!< @if Eng Notify source @else 通知源 @endif */ + ANCS_CHAR_CTRL_POINT = 1, /*!< @if Eng Control point @else 控制点 @endif */ + ANCS_CHAR_DATA_SRC = 2, /*!< @if Eng Data Source @else 数据源 @endif */ + ANCS_CHAR_INVALID, +} ancs_character_t; + +/** + * @if Eng + * @brief Enum of ancs error codes. + * @else + * @brief ANCS客户端写特征响应错误码。 + * @endif + */ +typedef enum { + ANCS_ERROR_CODE_UNKNOW_CMD = 0xA0, /*!< @if Eng Unknown command @else 未知命令 @endif */ + ANCS_ERROR_CODE_INVALID_CMD = 0xA1, /*!< @if Eng Invalid command @else 无效命令 @endif */ + ANCS_ERROR_CODE_INVALID_PARAM = 0xA2, /*!< @if Eng Invalid parameter @else 无效参数 @endif */ + ANCS_ERROR_CODE_ACTION_FAILED = 0xA3 /*!< @if Eng The action was not performed @else 行为没有被执行 @endif */ +} ancs_write_error_code_t; + +/** + * @if Eng + * @brief Struct of ancs servie. + * @else + * @brief ANCS服务。 + * @endif + */ +typedef struct { + uint8_t client_id; /*!< @if Eng Client id @else 客户端ID @endif */ + uint16_t conn_id; /*!< @if Eng Connect id @else 连接ID @endif */ + uint16_t start_handle; /*!< @if Eng Start handle @else 开始handle @endif */ + uint16_t end_handle; /*!< @if Eng End handle @else 结束handle @endif */ + gattc_discovery_character_result_t notify_src; /*!< @if Eng Notify source @else 通知源 @endif */ + gattc_discovery_character_result_t ctl_point; /*!< @if Eng Control point @else 控制点 @endif */ + gattc_discovery_character_result_t data_src; /*!< @if Eng Data Source @else 数据源 @endif */ + uint16_t notify_src_ccc_handle; /*!< @if Eng Notify source CCC handle + @else 通知源CCC描述符handle @endif */ + uint16_t data_src_ccc_handle; /*!< @if Eng Data source CCC handle + @else 数据源CCC描述符handle @endif */ +} ble_ancs_service_t; + + +/** + * @if Eng + * @brief Struct of notification info. + * @else + * @brief 通知消息结构体。 + * @endif + */ +typedef struct { + uint8_t event_id; /*!< @if Eng Event id {@ref ancs_event_id_t} + @else 事件ID {@ref ancs_event_id_t} @endif */ + uint8_t event_flags; /*!< @if Eng Event flags {@ref ancs_event_flags_t} + @else 事件标记 {@ref ancs_event_flags_t} @endif */ + uint8_t category_id; /*!< @if Eng Category id {@ref ancs_category_id_t} + @else 分类ID {@ref ancs_category_id_t} @endif */ + uint8_t category_count; /*!< @if Eng Category count @else 分类消息个数 @endif */ + uint32_t notification_uid; /*!< @if Eng Notify uuid @else 通知ID @endif */ +} ble_ancs_notification_src_t; + +/** + * @if Eng + * @brief Struct of attribute request + * @else + * @brief 属性请求结构体。 + * @endif + */ +typedef struct { + uint8_t att_id; /*!< @if Eng Attribute id @else 属性ID @endif */ + uint16_t att_max_length; /*!< @if Eng Attribute max length + @else 属性值最大长度,仅用于通知属性【标题】【子标题】【消息】属性,其他属性传0 @endif */ +} ble_ancs_attr_req_t; + +/** + * @if Eng + * @brief Struct of notify attribute request + * @else + * @brief 通知属性请求结构体。 + * @endif + */ +typedef struct { + uint32_t notification_uid; /*!< @if Eng Notify uuid @else 通知ID @endif */ + uint16_t att_num; /*!< @if Eng Attribute num @else 属性个数 @endif */ + ble_ancs_attr_req_t attr[0]; /*!< @if Eng Attribute array @else 属性ID数组 @endif */ +} ble_ancs_notification_attr_req_t; + +/** + * @if Eng + * @brief Struct of attribute response + * @else + * @brief 属性响应结构体。 + * @endif + */ +typedef struct { + uint8_t att_id; /*!< @if Eng Attribute id @else 属性ID @endif */ + uint16_t att_length; /*!< @if Eng Attribute length @else 属性长度 @endif */ + uint8_t *att; /*!< @if Eng Attribute value @else 属性值 @endif */ +} ble_ancs_attr_rsp_t; + +/** + * @if Eng + * @brief Struct of notify attribute response + * @else + * @brief 通知属性响应结构体。 + * @endif + */ +typedef struct { + uint32_t notification_uid; /*!< @if Eng Notify uuid @else 通知ID @endif */ + uint16_t att_num; /*!< @if Eng Attribute num @else 属性个数 @endif */ + struct list_stru attr_rsp_lst; /*!< @if Eng Attribute list {@ref ble_ancs_attr_rsp_t} + @else 属性列表 {@ref ble_ancs_attr_rsp_t} @endif */ +} ble_ancs_notification_attr_rsp_t; + +/** + * @if Eng + * @brief Struct of APP id + * @else + * @brief 应用ID + * @endif + */ +typedef struct { + uint16_t len; /*!< @if Eng Length @else 长度 @endif */ + uint8_t *id; /*!< @if Eng Id @else ID @endif */ +} ble_ancs_app_id_t; + +/** + * @if Eng + * @brief Struct of app attribute request + * @else + * @brief 应用属性请求结构体。 + * @endif + */ +typedef struct { + ble_ancs_app_id_t app_id; /*!< @if Eng App id @else 应用ID @endif */ + uint16_t att_num; /*!< @if Eng Attribute num @else 属性个数 @endif */ + uint8_t attr_id[0]; /*!< @if Eng Attribute Array {@ref ancs_app_att_id_t} + @else 属性ID数组 {@ref ancs_app_att_id_t} @endif */ +} ble_ancs_app_attr_req_t; + +/** + * @if Eng + * @brief Struct of app attribute response + * @else + * @brief 应用属性响应结构体。 + * @endif + */ +typedef struct { + ble_ancs_app_id_t app_id; /*!< @if Eng App id @else 应用ID @endif */ + uint16_t att_num; /*!< @if Eng Attribute num @else 属性个数 @endif */ + struct list_stru attr_rsp_lst; /*!< @if Eng Attribute list {@ref ble_ancs_attr_rsp_t} + @else 属性列表 {@ref ble_ancs_attr_rsp_t} @endif */ +} ble_ancs_app_attr_rsp_t; + + +/** + * @if Eng + * @brief Struct of perform action request + * @else + * @brief 通知处理请求结构体。 + * @endif + */ +typedef struct { + uint32_t notification_uid; /*!< @if Eng Notify uuid @else 通知ID @endif */ + uint8_t action_id; /*!< @if Eng Action id {@ref ancs_action_id_t} + @else 行为ID {@ref ancs_action_id_t} @endif */ +} ble_ancs_notification_action_req_t; + +/** + * @if Eng + * @brief Callback invoked when client setup service complete. + * @par Callback invoked when client setup service complete. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] status error code{ @ref errcode_bt_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_def.h + * @see ble_ancs_client_callbacks_t + * @else + * @brief ANCS客户端服务建立完成回调函数。 + * @par ANCS客户端服务建立完成回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] status 执行结果错误码{ @ref errcode_bt_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_def.h + * @see ble_ancs_client_callbacks_t + * @endif + */ +typedef void (*ancs_client_setup_result_cbk)(uint8_t client_id, uint16_t conn_id, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when client subscribe character notify complete. + * @par Callback invoked when client subscribe character notify complete. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] type subscribe type{ @ref ancs_client_subscribe_type_t }. + * @param [in] status gatt error code{ @ref gatt_status_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_stru.h + * @see ble_ancs_client_callbacks_t + * @else + * @brief ANCS客户端订阅特征通知结果回调函数。 + * @par ANCS客户端订阅特征通知结果回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] type 订阅类型{ @ref ancs_client_subscribe_type_t }. + * @param [in] status gatt操作错误码{ @ref gatt_status_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_stru.h + * @see ble_ancs_client_callbacks_t + * @endif + */ +typedef void (*ancs_client_subscribe_result_cbk)(uint8_t client_id, uint16_t conn_id, + ancs_client_subscribe_type_t type, gatt_status_t status); + +/** + * @if Eng + * @brief Callback invoked when remote service push notify message. + * @par Callback invoked when remote service push notify message. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] notify_src notify message { @ref ble_ancs_notification_src_t }. + * @param [in] status error code{ @ref errcode_bt_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_def.h + * @see ble_ancs_client_callbacks_t + * @else + * @brief ANCS远端服务推送通知消息回调函数。 + * @par ANCS远端服务推送通知消息回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] notify_src 通知消息 { @ref ble_ancs_notification_src_t }. + * @param [in] status 操作错误码{ @ref errcode_bt_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_def.h + * @see ble_ancs_client_callbacks_t + * @endif + */ +typedef void (*ancs_client_notify_source_cbk)(uint8_t client_id, uint16_t conn_id, + ble_ancs_notification_src_t *notify_src, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when remote service push notify attribute info. + * @par Callback invoked when remote service push notify attribute info. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] notify_attr_rsp notify attribute info { @ref ble_ancs_notification_attr_rsp_t }. + * @param [in] status error code{ @ref errcode_bt_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_def.h + * @see ble_ancs_client_callbacks_t + * @else + * @brief ANCS远端服务推送通知属性信息回调函数。 + * @par ANCS远端服务推送通知属性信息回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] notify_attr_rsp 通知属性信息 { @ref ble_ancs_notification_attr_rsp_t }. + * @param [in] status 操作错误码{ @ref errcode_bt_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_def.h + * @see ble_ancs_client_callbacks_t + * @endif + */ +typedef void (*ancs_client_notification_attr_rsp_cbk)(uint8_t client_id, uint16_t conn_id, + ble_ancs_notification_attr_rsp_t *notify_attr_rsp, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when remote service push app attribute info. + * @par Callback invoked when remote service push app attribute info. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] app_attr_rsp app attribute info { @ref ble_ancs_app_attr_rsp_t }. + * @param [in] status error code{ @ref errcode_bt_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_def.h + * @see ble_ancs_client_callbacks_t + * @else + * @brief ANCS远端服务推送应用属性信息回调函数。 + * @par ANCS远端服务推送应用属性信息回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] app_attr_rsp 应用属性信息 { @ref ble_ancs_app_attr_rsp_t }. + * @param [in] status 操作错误码{ @ref errcode_bt_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_def.h + * @see ble_ancs_client_callbacks_t + * @endif + */ +typedef void (*ancs_client_app_attr_rsp_cbk)(uint8_t client_id, uint16_t conn_id, + ble_ancs_app_attr_rsp_t *app_attr_rsp, errcode_t status); + +/** + * @if Eng + * @brief Callback invoked when client write contro point complete. + * @par Callback invoked when client write contro point complete. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] status gatt error code{ @ref gatt_status_t }. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_stru.h + * @see ble_ancs_client_callbacks_t + * @else + * @brief AMS客户端写控制点特征响应回调函数。 + * @par AMS客户端写控制点特征响应回调函数。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] status gatt操作错误码{ @ref gatt_status_t }。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_stru.h + * @see ble_ancs_client_callbacks_t + * @endif + */ +typedef void (*ancs_client_write_result_cbk)(uint8_t client_id, uint16_t conn_id, gatt_status_t status); + +/** + * @if Eng + * @brief Struct of GATT client callback function. + * @else + * @brief GATT client回调函数接口定义。 + * @endif + */ +typedef struct { + ancs_client_setup_result_cbk setup_cb; /*!< @if Eng setup callback @else 客户端服务建立完成回调 @endif */ + ancs_client_subscribe_result_cbk subscribe_cb; /*!< @if Eng subscribe callback @else 订阅特征通知结果回调 @endif */ + ancs_client_notify_source_cbk notify_source_cb; /*!< @if Eng notify source callback + @else 远端服务推送通知消息回调 @endif */ + ancs_client_notification_attr_rsp_cbk notify_attr_cb; /*!< @if Eng notify attribute callback + @else 远端服务推送通知属性信息回调 @endif */ + ancs_client_app_attr_rsp_cbk app_attr_cb; /*!< @if Eng app attribute callback + @else 远端服务推送应用属性信息回调 @endif */ + ancs_client_write_result_cbk write_result_cb; /*!< @if Eng write result callback + @else 客户端写控制点特征请求响应回调 @endif */ +} ble_ancs_client_callbacks_t; + +/** + * @if Eng + * @brief The interface of ANCS client setup service. + * @par The interface of ANCS client setup service. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief ANCS客户端发起服务建立。 + * @par ANCS客户端发起服务建立。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ancs_client_setup_service(uint8_t client_id, uint16_t conn_id); + +/** + * @if Eng + * @brief The interface of ANCS client discovery service result callback. + * @par The interface of ANCS client discovery service result callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] service service info. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_client.h + * @see + * @else + * @brief ANCS客户端发现服务结果处理接口。 + * @par ANCS客户端发现服务结果处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] service ANCS 服务信息。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_client.h + * @see + * @endif + */ +void ble_ancs_client_discovery_service_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_service_result_t *service); + +/** + * @if Eng + * @brief The interface of ANCS client discovery character result callback. + * @par The interface of ANCS client discovery character result callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] character character info. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_client.h + * @see + * @else + * @brief ANCS客户端发现特征结果处理接口。 + * @par ANCS客户端发现特征结果处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] character ANCS 服务特征信息。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_client.h + * @see + * @endif + */ +void ble_ancs_client_discovery_character_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_character_result_t *character); + +/** + * @if Eng + * @brief The interface of ANCS client discovery descriptor result callback. + * @par The interface of ANCS client discovery descriptor result callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] descriptor descriptor info. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_client.h + * @see + * @else + * @brief ANCS客户端发现描述符结果处理接口。 + * @par ANCS客户端发现描述符结果处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] descriptor ANCS服务特征描述符信息。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_client.h + * @see + * @endif + */ +void ble_ancs_client_discovery_descriptor_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_descriptor_result_t *descriptor); + +/** + * @if Eng + * @brief The interface of ANCS client receive notify info callback. + * @par The interface of ANCS client receive notify info callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] data notify info. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_client.h + * @see + * @else + * @brief ANCS客户端接收对端通知信息处理接口。 + * @par ANCS客户端接收对端通知信息处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] data 对端通知信息。 + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_client.h + * @see + * @endif + */ +void ble_ancs_client_notify_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data); + +/** + * @if Eng + * @brief The interface of ANCS client write response callback. + * @par The interface of ANCS client write response callback. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] status gatt status {@ref gatt_status_t}. + * @retval #void no return value. + * @par Dependency: + * @li bts_gatt_stru.h + * @see + * @else + * @brief ANCS客户端写请求响应结果处理接口。 + * @par ANCS客户端写请求响应结果处理接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] status gatt 操作结果码 {@ref gatt_status_t}. + * @retval 无返回值。 + * @par 依赖: + * @li bts_gatt_stru.h + * @see + * @endif + */ +void ble_ancs_client_write_cbk(uint8_t client_id, uint16_t conn_id, uint16_t handle, gatt_status_t status); + +/** + * @if Eng + * @brief The interface of ANCS client subscribe notify source character notify. + * @par The interface of ANCS client subscribe notify source character notify. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] enable_flag enable/disable flag {@ref ancs_client_notify_enable_t}. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief ANCS客户端订阅通知源特征通知接口。 + * @par ANCS客户端订阅通知源特征通知接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] enable_flag 开启/关闭标记。 {@ref ancs_client_notify_enable_t}. + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ancs_client_subscribe_notification_source(uint8_t client_id, uint16_t conn_id, + ancs_client_notify_enable_t enable_flag); + +/** + * @if Eng + * @brief The interface of ANCS client subscribe data source character notify. + * @par The interface of ANCS client subscribe data source character notify. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] enable_flag enable/disable flag {@ref ancs_client_notify_enable_t}. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief ANCS客户端订阅数据源特征通知接口。 + * @par ANCS客户端订阅数据源特征通知接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] enable_flag 开启/关闭标记。 {@ref ancs_client_notify_enable_t}. + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ancs_client_subscribe_data_source(uint8_t client_id, uint16_t conn_id, + ancs_client_notify_enable_t enable_flag); + +/** + * @if Eng + * @brief The interface of ANCS client send get notify attribute command. + * @par The interface of ANCS client send get notify attribute command. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] notify_att_req notify attribute request {@ref ble_ancs_notification_attr_req_t}. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief ANCS客户端发送获取通知属性命令接口。 + * @par ANCS客户端发送获取通知属性命令接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] notify_att_req 通知属性请求。 {@ref ble_ancs_notification_attr_req_t}. + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ancs_client_send_get_notify_att_cmd(uint8_t client_id, uint16_t conn_id, + ble_ancs_notification_attr_req_t *notify_att_req); + +/** + * @if Eng + * @brief The interface of ANCS client send get app attribute command. + * @par The interface of ANCS client send get app attribute command. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] app_att_req app attribute request {@ref ble_ancs_app_attr_req_t}. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief ANCS客户端发送获取应用属性命令接口。 + * @par ANCS客户端发送获取应用属性命令接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] app_att_req 应用属性请求。 {@ref ble_ancs_app_attr_req_t}. + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ancs_client_send_get_app_att_cmd(uint8_t client_id, uint16_t conn_id, + ble_ancs_app_attr_req_t *app_att_req); + +/** + * @if Eng + * @brief The interface of ANCS client send perform notify action command. + * @par The interface of ANCS client send perform notify action command. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @param [in] action_req perform action request {@ref ble_ancs_notification_action_req_t}. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief ANCS客户端发送执行通知行为命令接口。 + * @par ANCS客户端发送执行通知行为命令接口。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @param [in] action_req 执行行为请求。 {@ref ble_ancs_notification_action_req_t}. + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ancs_client_send_perform_notify_action_cmd(uint8_t client_id, uint16_t conn_id, + ble_ancs_notification_action_req_t *action_req); + +/** + * @if Eng + * @brief The interface of ANCS client register callback. + * @par The interface of ANCS client register callback. + * @attention + * @param [in] func the pointer of callback struct. + * @retval errcode_t {@ref errcode_bt_t}. + * @par Dependency: + * @li bts_def.h + * @see + * @else + * @brief ANCS客户端注册回调接口。 + * @par ANCS客户端注册回调接口。 + * @attention + * @param [in] func 回调函数结构体指针。 + * @retval 操作错误码 {@ref errcode_bt_t}. + * @par 依赖: + * @li bts_def.h + * @see + * @endif + */ +errcode_t ble_ancs_client_register_callbacks(ble_ancs_client_callbacks_t *func); + +/** + * @if Eng + * @brief The interface of check service uuid whether or not ANCS service. + * @par The interface of check service uuid whether or not ANCS service. + * @attention + * @param [in] uuid service uuid. + * @retval true or false true:Yes, false:No. + * @par Dependency: + * @li + * @see + * @else + * @brief ANCS客户端注册回调接口。 + * @par ANCS客户端注册回调接口。 + * @attention + * @param [in] uuid 服务uuid。 + * @retval 是或否 是:是ANCS服务,否:不是ANCS服务. + * @par 依赖: + * @li + * @see + * @endif + */ +bool is_ble_ancs_service(bt_uuid_t *uuid); + +/** + * @if Eng + * @brief The interface of ANCS client clear stored remote ANCS service info by connect id. + * @par The interface of ANCS client clear stored remote ANCS service info by connect id. + * @attention + * @param [in] client_id client ID. + * @param [in] conn_id connect id. + * @retval #void no return value. + * @par Dependency: + * @li + * @see + * @else + * @brief ANCS客户端根据连接ID清理存储的对端ANCS服务信息。 + * @par ANCS客户端根据连接ID清理存储的对端ANCS服务信息。 + * @attention + * @param [in] client_id 客户端ID。 + * @param [in] conn_id 连接ID。 + * @retval 无返回值。 + * @par 依赖: + * @li + * @see + * @endif + */ +void ble_ancs_client_clear_remote_by_conn(uint8_t client_id, uint16_t conn_id); + +/** + * @if Eng + * @brief The interface of ANCS client clear all stored remote ANCS service info. + * @par The interface of ANCS client clear all stored remote ANCS service info. + * @attention + * @retval #void no return value. + * @par Dependency: + * @li + * @see + * @else + * @brief ANCS客户端清理所有存储的对端ANCS服务信息。 + * @par ANCS客户端清理所有存储的对端ANCS服务信息。 + * @attention + * @retval 无返回值。 + * @par 依赖: + * @li + * @see + * @endif + */ +void ble_ancs_client_clear_remote_all(void); + +/** + * @} + */ +#ifdef __cplusplus +} +#endif +#endif \ No newline at end of file diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_gatts_callbacks.h b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_gatts_callbacks.h index 2963b3a15..3dd3092fa 100755 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_gatts_callbacks.h +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/include/ble_gatts_callbacks.h @@ -14,6 +14,7 @@ extern "C" { errcode_t ble_server_register_gatt_callbacks(void); errcode_t ble_client_register_gatt_callbacks(void); +uint32_t ble_gatt_mtu_exchange_result_get(void); /** * @} diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/CMakeLists.txt b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/CMakeLists.txt index 1473bfd4d..b626a1df0 100755 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/CMakeLists.txt +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/CMakeLists.txt @@ -8,5 +8,7 @@ set( ${CMAKE_CURRENT_SOURCE_DIR}/ble_fmp_target.c ${CMAKE_CURRENT_SOURCE_DIR}/ble_fmp_locator.c ${CMAKE_CURRENT_SOURCE_DIR}/ble_gatts_callbacks.c + ${CMAKE_CURRENT_SOURCE_DIR}/ble_ancs_client.c + ${CMAKE_CURRENT_SOURCE_DIR}/ble_ams_client.c ) set(BTH_SAMPLE_LIST "${BTH_SAMPLE_LIST}" "${bt_comm_src_list}" CACHE INTERNAL "bt ram obj list" FORCE) diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_ams_client.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_ams_client.c new file mode 100644 index 000000000..56f352e4e --- /dev/null +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_ams_client.c @@ -0,0 +1,593 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2024. All rights reserved. + * Description: BLE Apple Media Service Client module. + */ + +#include +#include "sdk_list.h" +#include "errcode.h" +#include "btsrv_log.h" +#include "bts_le_gap.h" +#include "sdk_general.h" +#include "bts_uuid.h" +#include "ble_ams_client.h" + +#define BLE_CLIENT_CHARACTERISTIC_CONFIGURATION_UUID 0x2902 +#define AMS_ENTITY_UPDATE_NOTIFY_VALUE_OFFSET 3 +#define AMS_ENTITY_UPDATE_NOTIFY_FLAGS_OFFSET 2 +#define AMS_STRING_SUFFIX_ZERO_BYTE 1 + +#define u16_low_byte(uuid) ((uint8_t)((uuid) & 0x00FF)) +#define u16_high_byte(uuid) ((uint8_t)(((uuid) & 0xFF00) >> 8)) + +/* AMS服务UUID,小端序 */ +uint8_t ams_uuid[BT_UUID_MAX_LEN] = { + 0xDC, 0xF8, 0x55, 0xAD, 0x02, 0xC5, 0xF4, 0x8E, 0x3A, 0x43, 0x36, 0x0F, 0x2B, 0x50, 0xD3, 0x89}; + +/* AMS服务特征UUID-Remote Command,小端序 */ +uint8_t rmt_cmd_uuid[BT_UUID_MAX_LEN] = { + 0xC2, 0x51, 0xCA, 0xF7, 0x56, 0x0E, 0xDF, 0xB8, 0x8A, 0x4A, 0xB1, 0x57, 0xD8, 0x81, 0x3C, 0x9B}; + +/* AMS服务特征UUID-Entity Update,小端序 */ +uint8_t entity_update_uuid[BT_UUID_MAX_LEN] = { + 0x02, 0xC1, 0x96, 0xBA, 0x92, 0xBB, 0x0C, 0x9A, 0x1F, 0x41, 0x8D, 0x80, 0xCE, 0xAB, 0x7C, 0x2F}; + +/* AMS服务特征UUID-Entity Attribute,小端序 */ +uint8_t entity_att_uuid[BT_UUID_MAX_LEN] = { + 0xD7, 0xD5, 0xBB, 0x70, 0xA8, 0xA3, 0xAB, 0xA6, 0xD8, 0x46, 0xAB, 0x23, 0x8C, 0xF3, 0xB2, 0xC6}; + +/* AMS客户端回调函数结构体 */ +ble_ams_client_callbacks_t g_ams_callbacks_t = {0}; + +/* 对端AMS服务信息 */ +struct list_stru g_ble_ams_service_list = {NULL, NULL}; + +/* 根据连接ID查询存储的对端AMS服务信息 */ +static ble_ams_service_t* ams_service_remote_by_conn(uint8_t client_id, uint16_t conn_id) +{ + ble_ams_service_t *node = (ble_ams_service_t *)g_ble_ams_service_list.head; + while (node != NULL) { + if ((node->client_id == client_id) && (node->conn_id == conn_id)) { + return node; + } + node = lnext(node); + } + + return NULL; +} + +/* AMS客户端发起服务建立 */ +errcode_t ble_ams_client_setup_service(uint8_t client_id, uint16_t conn_id) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote != NULL) { + bts_error("ams client remote service is already exist,client_id:%u, conn_id:%u.\r\n", + client_id, conn_id); + return ERRCODE_BT_DONE; + } + + bt_uuid_t service_uuid = {0}; + service_uuid.uuid_len = BT_UUID_MAX_LEN; + if (memcpy_s(service_uuid.uuid, BT_UUID_MAX_LEN, ams_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[btsrv][ERROR] uuid memcpy fail!\r\n"); + return ERRCODE_BT_FAIL; + } + return gattc_discovery_service(client_id, conn_id, &service_uuid); +} + +/* 发现服务回调函数 */ +void ble_ams_client_discovery_service_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_service_result_t *service) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote != NULL) { + bts_error("ams client remote service is already exist,client_id:%u, conn_id:%u.\r\n", + client_id, conn_id); + return; + } + remote = bt_sdk_list_node_create(sizeof(ble_ams_service_t)); + if (remote == NULL) { + bts_info("ams client remote node create fail.\r\n"); + return; + } + remote->client_id = client_id; + remote->conn_id = conn_id; + remote->start_handle = service->start_hdl; + remote->end_handle = service->end_hdl; + bt_sdk_list_add_tail(&g_ble_ams_service_list, remote); + + /* 发现特征 */ + gattc_discovery_character_param_t param = {0}; + param.service_handle = remote->start_handle; + errcode_t ret = gattc_discovery_character(client_id, conn_id, ¶m); + bts_info("ams client discovery character ret:%u.\r\n", ret); +} + +/* AMS服务特征匹配 */ +static ams_character_t ams_char_match(bt_uuid_t *uuid) +{ + if (uuid->uuid_len != BT_UUID_MAX_LEN) { + return AMS_CHAR_INVALID; + } + bt_uuid_t char_uuid = {0}; + char_uuid.uuid_len = BT_UUID_MAX_LEN; + if (memcpy_s(char_uuid.uuid, BT_UUID_MAX_LEN, rmt_cmd_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[btsrv][ERROR] remote cmd uuid memcpy fail!\r\n"); + return AMS_CHAR_INVALID; + } + if (memcmp(&char_uuid, uuid, sizeof(bt_uuid_t)) == 0) { + return AMS_CHAR_REMOTE_CMD; + } + if (memcpy_s(char_uuid.uuid, BT_UUID_MAX_LEN, entity_update_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[btsrv][ERROR] entity update uuid memcpy fail!\r\n"); + return AMS_CHAR_INVALID; + } + if (memcmp(&char_uuid, uuid, sizeof(bt_uuid_t)) == 0) { + return AMS_CHAR_ENTITY_UPDATE; + } + if (memcpy_s(char_uuid.uuid, BT_UUID_MAX_LEN, entity_att_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[btsrv][ERROR] entity att uuid memcpy fail!\r\n"); + return AMS_CHAR_INVALID; + } + if (memcmp(&char_uuid, uuid, sizeof(bt_uuid_t)) == 0) { + return AMS_CHAR_ENTITY_ATTR; + } + return AMS_CHAR_INVALID; +} + +/* 发现特征回调函数 */ +void ble_ams_client_discovery_character_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_character_result_t *character) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + return; + } + + if ((character->declare_handle < remote->start_handle) || + (character->declare_handle > remote->end_handle)) { + bts_error("ams client remote service did not have this character_handle:%u conn_id:%u\n", + character->declare_handle, conn_id); + return; + } + + switch (ams_char_match(&(character->uuid))) { + case AMS_CHAR_REMOTE_CMD: { + remote->remote_cmd.declare_handle = character->declare_handle; + remote->remote_cmd.value_handle = character->value_handle; + remote->remote_cmd.properties = character->properties; + + /* 发现描述符 */ + gattc_discovery_descriptor(client_id, conn_id, character->declare_handle); + break; + } + + case AMS_CHAR_ENTITY_UPDATE: { + remote->entity_update.declare_handle = character->declare_handle; + remote->entity_update.value_handle = character->value_handle; + remote->entity_update.properties = character->properties; + + /* 发现描述符 */ + gattc_discovery_descriptor(client_id, conn_id, character->declare_handle); + break; + } + + case AMS_CHAR_ENTITY_ATTR: { + remote->entity_attr.declare_handle = character->declare_handle; + remote->entity_attr.value_handle = character->value_handle; + remote->entity_attr.properties = character->properties; + break; + } + + default: + bts_error("[btsrv][INFO] invalid character!\r\n"); + break; + } +} + +/* 发现描述符回调函数 */ +void ble_ams_client_discovery_descriptor_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_descriptor_result_t *descriptor) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + return; + } + + if (descriptor->descriptor_hdl < remote->start_handle || + descriptor->descriptor_hdl > remote->end_handle) { + bts_error("ams client remote service did not have this descriptor_handle:%u conn_id:%u\n", + descriptor->descriptor_hdl, conn_id); + return; + } + + /* 客户端特征配置描述符 */ + bt_uuid_t ccc_uuid = {0}; + bts_data_to_uuid_len2(BLE_CLIENT_CHARACTERISTIC_CONFIGURATION_UUID, &ccc_uuid); + if (!bts_uuid_is_equal(&ccc_uuid, &(descriptor->uuid))) { + return; + } + + uint16_t cmd_ccc_max_handle = remote->end_handle; + uint16_t entity_ccc_max_handle = remote->end_handle; + + if ((remote->entity_update.value_handle != 0) && + (remote->remote_cmd.value_handle != 0) && + (remote->remote_cmd.value_handle < remote->entity_update.value_handle)) { + cmd_ccc_max_handle = remote->entity_update.value_handle - 1; + } else if ((remote->remote_cmd.value_handle != 0) && + (remote->entity_update.value_handle != 0) && + (remote->remote_cmd.value_handle > remote->entity_update.value_handle)) { + entity_ccc_max_handle = remote->remote_cmd.value_handle - 1; + } + + if ((remote->remote_cmd.value_handle != 0) && + (descriptor->descriptor_hdl > remote->remote_cmd.value_handle) && + (descriptor->descriptor_hdl <= cmd_ccc_max_handle)) { + remote->remote_cmd_ccc_handle = descriptor->descriptor_hdl; + } else if ((remote->entity_update.value_handle != 0) && + (descriptor->descriptor_hdl > remote->entity_update.value_handle) && + (descriptor->descriptor_hdl <= entity_ccc_max_handle)) { + remote->entity_update_ccc_handle = descriptor->descriptor_hdl; + } + + if ((remote->remote_cmd_ccc_handle != 0) && + (remote->entity_update_ccc_handle != 0)) { + if (g_ams_callbacks_t.setup_cb != NULL) { + g_ams_callbacks_t.setup_cb(client_id, conn_id, ERRCODE_BT_SUCCESS); + } + } +} + +/* 处理远端命令上报信息 */ +static void remote_cmd_rpt_handle(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data) +{ + errcode_t status = ERRCODE_BT_SUCCESS; + ble_ams_remote_cmd_rpt_t *rpt_data = bt_os_new(sizeof(ble_ams_remote_cmd_rpt_t) + data->data_len); + rpt_data->cmd_num = data->data_len; + if (memcpy_s(rpt_data->remote_cmd, rpt_data->cmd_num, data->data, rpt_data->cmd_num) != EOK) { + bts_error("[btsrv][ERROR] remote cmd rpt memcpy fail!\r\n"); + status = ERRCODE_BT_MEMCPY_FAIL; + } + + if (g_ams_callbacks_t.remote_cmd_cb != NULL) { + g_ams_callbacks_t.remote_cmd_cb(client_id, conn_id, rpt_data, status); + } + bt_os_free(rpt_data); +} + +/* 处理实体更新上报信息 */ +static void entity_update_rpt_handle(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data) +{ + errcode_t status = ERRCODE_BT_SUCCESS; + uint16_t value_len = data->data_len - AMS_ENTITY_UPDATE_NOTIFY_VALUE_OFFSET; + ble_ams_entity_update_rpt_t *rpt_data = bt_os_new( + sizeof(ble_ams_entity_update_rpt_t) + value_len + AMS_STRING_SUFFIX_ZERO_BYTE); + rpt_data->entity_id = *(data->data); + rpt_data->att_id = *(data->data + sizeof(uint8_t)); + rpt_data->entity_update_flags = *(data->data + AMS_ENTITY_UPDATE_NOTIFY_FLAGS_OFFSET); + rpt_data->value_length = value_len + AMS_STRING_SUFFIX_ZERO_BYTE; + if (memcpy_s(rpt_data->value, rpt_data->value_length, + (data->data + AMS_ENTITY_UPDATE_NOTIFY_VALUE_OFFSET), value_len) != EOK) { + bts_error("[btsrv][ERROR] entity update rpt memcpy fail!\r\n"); + status = ERRCODE_BT_MEMCPY_FAIL; + } + rpt_data->value[rpt_data->value_length - 1] = 0; /* 字符串拼接末尾0 */ + + if (g_ams_callbacks_t.entity_update_cb != NULL) { + g_ams_callbacks_t.entity_update_cb(client_id, conn_id, rpt_data, status); + } + bt_os_free(rpt_data); +} + +/* 特征通知回调函数 */ +void ble_ams_client_notify_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + return; + } + + /* Remote Command */ + /* 数据格式:RemoteCommandID 1(1B)|RemoteCommandID 2(1B)|... */ + if (data->handle == remote->remote_cmd.value_handle) { + remote_cmd_rpt_handle(client_id, conn_id, data); + + /* Entity Update */ + /* 数据格式:EntityID(1B)|AttributeID(1B)|EntityUpdateFlags(1B)|Value(动态) */ + } else if (data->handle == remote->entity_update.value_handle) { + entity_update_rpt_handle(client_id, conn_id, data); + } +} + +/* AMS客户端订阅结果处理函数 */ +static void ble_ams_client_subscribe_result(uint8_t client_id, uint16_t conn_id, + ams_client_subscribe_type_t type, gatt_status_t status) +{ + if (g_ams_callbacks_t.subscribe_cb != NULL) { + g_ams_callbacks_t.subscribe_cb(client_id, conn_id, type, status); + } +} + +/* 注册感兴趣实体属性响应结果处理 */ +static void ble_ams_client_write_character_rsp(uint8_t client_id, uint16_t conn_id, + ams_client_write_character_type_t type, + gatt_status_t status) +{ + if (g_ams_callbacks_t.write_rsp_cb != NULL) { + g_ams_callbacks_t.write_rsp_cb(client_id, conn_id, type, status); + } +} + +/* 写请求响应回调函数 */ +void ble_ams_client_write_cbk(uint8_t client_id, uint16_t conn_id, uint16_t handle, gatt_status_t status) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + return; + } + + if (handle == (remote->remote_cmd_ccc_handle)) { + ble_ams_client_subscribe_result(client_id, conn_id, AMS_CLIENT_SUBSCRIBE_REMOTE_CMD, status); + } else if (handle == (remote->entity_update_ccc_handle)) { + ble_ams_client_subscribe_result(client_id, conn_id, AMS_CLIENT_SUBSCRIBE_ENTITY_UPDATE, status); + } else if (handle == (remote->entity_update.value_handle)) { + ble_ams_client_write_character_rsp(client_id, conn_id, AMS_CLIENT_WRITE_ENTITY_UPDATE, status); + } else if (handle == (remote->remote_cmd.value_handle)) { + ble_ams_client_write_character_rsp(client_id, conn_id, AMS_CLIENT_WRITE_REMOTE_CMD, status); + } else if (handle == (remote->entity_attr.value_handle)) { + ble_ams_client_write_character_rsp(client_id, conn_id, AMS_CLIENT_WRITE_ENTITY_ATTRIBUTE, status); + } +} + +/* 读请求响应回调函数 */ +void ble_ams_client_read_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *read_result, + gatt_status_t status) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + return; + } + + if (read_result->handle != remote->entity_attr.value_handle) { + return; + } + + ble_ams_full_attr_value_t *full_value = bt_os_new(sizeof(ble_ams_full_attr_value_t) + read_result->data_len + 1); + full_value->value_len = read_result->data_len + 1; + if (read_result->data_len != 0) { + if (memcpy_s(full_value->value, full_value->value_len, read_result->data, read_result->data_len) != EOK) { + bts_error("[btsrv][ERROR] read result memcpy fail!\r\n"); + bt_os_free(full_value); + return; + } + } + *(full_value->value + full_value->value_len - 1) = 0; /* 字符串末尾拼接0 */ + + if (g_ams_callbacks_t.read_full_attr_result_cb != NULL) { + g_ams_callbacks_t.read_full_attr_result_cb(client_id, conn_id, full_value, status); + } + bt_os_free(full_value); +} + +/* 订阅远端命令特征通知 */ +errcode_t ble_ams_client_subscribe_remote_cmd(uint8_t client_id, uint16_t conn_id, + ams_client_notify_enable_t enable_flag) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ams client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->remote_cmd_ccc_handle == 0) { + bts_error("ams client remote service did not discovery notify ccc, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + uint16_t ccc_value = BLE_AMS_CLIENT_CHARACTERISTIC_CONFIGURATION_DEFAULT; + if (enable_flag == AMS_CLIENT_NOTIFY_ENABLE) { + ccc_value = BLE_AMS_CLIENT_CHARACTERISTIC_CONFIGURATION_NOTIFICATION; + } + uint8_t notify_ccc_val[] = { + u16_low_byte(ccc_value), + u16_high_byte(ccc_value) + }; + gattc_handle_value_t value = {0}; + value.data_len = (uint16_t)sizeof(notify_ccc_val); + value.data = notify_ccc_val; + value.handle = remote->remote_cmd_ccc_handle; + return gattc_write_req(client_id, conn_id, &value); +} + +/* 订阅实体更新特征通知 */ +errcode_t ble_ams_client_subscribe_entity_update(uint8_t client_id, uint16_t conn_id, + ams_client_notify_enable_t enable_flag) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ams client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->entity_update_ccc_handle == 0) { + bts_error("ams client remote service did not discovery notify ccc, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + uint16_t ccc_value = BLE_AMS_CLIENT_CHARACTERISTIC_CONFIGURATION_DEFAULT; + if (enable_flag == AMS_CLIENT_NOTIFY_ENABLE) { + ccc_value = BLE_AMS_CLIENT_CHARACTERISTIC_CONFIGURATION_NOTIFICATION; + } + uint8_t notify_ccc_val[] = { + u16_low_byte(ccc_value), + u16_high_byte(ccc_value) + }; + gattc_handle_value_t value = {0}; + value.data_len = (uint16_t)sizeof(notify_ccc_val); + value.data = notify_ccc_val; + value.handle = remote->entity_update_ccc_handle; + return gattc_write_req(client_id, conn_id, &value); +} + +/* 发送远端命令 */ +errcode_t ble_ams_client_send_remote_cmd(uint8_t client_id, uint16_t conn_id, + ams_remote_cmd_id_t cmd_id) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ams client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->remote_cmd.value_handle == 0) { + bts_error("ams client did not discovery character, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + uint8_t data = (uint8_t)cmd_id; + gattc_handle_value_t value = {0}; + value.data_len = (uint16_t)sizeof(uint8_t); + value.data = &data; + value.handle = remote->remote_cmd.value_handle; + return gattc_write_req(client_id, conn_id, &value); +} + +/* 注册感兴趣的实体属性 */ +errcode_t ble_ams_client_register_interested_entity_attribute(uint8_t client_id, uint16_t conn_id, + ble_ams_interested_entity_attr_req_t *entity_attr_req) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ams client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->entity_update.value_handle == 0) { + bts_error("ams client did not discovery character, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (entity_attr_req->att_num == 0) { + bts_error("ams client attr req param error, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_PARAM_ERR; + } + + uint16_t data_length = sizeof(uint8_t) + (entity_attr_req->att_num) * sizeof(uint8_t); + uint8_t *data = bt_os_new(data_length); + uint8_t *pt_data = data; + *pt_data = entity_attr_req->entity_id; + pt_data = pt_data + 1; + for (int i = 0; i < entity_attr_req->att_num; i++) { + *(pt_data + i) = entity_attr_req->att_id[i]; + } + + gattc_handle_value_t value = {0}; + value.data_len = data_length; + value.data = data; + value.handle = remote->entity_update.value_handle; + errcode_t result = gattc_write_req(client_id, conn_id, &value); + bt_os_free(data); + return result; +} + +/* 获取完整的实体属性 */ +errcode_t ble_ams_client_retrieve_full_entity_attribute(uint8_t client_id, uint16_t conn_id, + ble_ams_full_entity_attr_cmd_t *full_attr_req) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ams client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->entity_attr.value_handle == 0) { + bts_error("ams client did not discovery character, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + gattc_handle_value_t value = {0}; + value.data_len = (uint16_t)sizeof(ble_ams_full_entity_attr_cmd_t); + value.data = full_attr_req; + value.handle = remote->entity_attr.value_handle; + return gattc_write_req(client_id, conn_id, &value); +} + +/* 读取完整的实体属性 */ +errcode_t ble_ams_client_read_full_entity_attribute(uint8_t client_id, uint16_t conn_id) +{ + ble_ams_service_t *remote = ams_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ams client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->entity_attr.value_handle == 0) { + bts_error("ams client did not discovery character, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + return gattc_read_req_by_handle(client_id, conn_id, remote->entity_attr.value_handle); +} + +/* 注册AMS客户端回调函数 */ +errcode_t ble_ams_client_register_callbacks(ble_ams_client_callbacks_t *func) +{ + if (memcpy_s(&g_ams_callbacks_t, sizeof(g_ams_callbacks_t), func, sizeof(ble_ams_client_callbacks_t)) != EOK) { + return ERRCODE_BT_MEMCPY_FAIL; + } + return ERRCODE_BT_SUCCESS; +} + +/* AMS服务判断 */ +bool is_ble_ams_service(bt_uuid_t *uuid) +{ + bt_uuid_t ams_service_uuid = {0}; + ams_service_uuid.uuid_len = BT_UUID_MAX_LEN; + if (memcpy_s(ams_service_uuid.uuid, BT_UUID_MAX_LEN, ams_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[BLE]service uuid memcpy error! \n"); + return false; + } + if (ams_service_uuid.uuid_len != uuid->uuid_len) { + return false; + } + + return (memcmp(uuid, &ams_service_uuid, sizeof(bt_uuid_t)) == 0 ? true : false); +} + +/* 根据连接ID清理存储的对端AMS服务信息 */ +void ble_ams_client_clear_remote_by_conn(uint8_t client_id, uint16_t conn_id) +{ + ble_ams_service_t *node = NULL; + node = ams_service_remote_by_conn(client_id, conn_id); + if (node != NULL) { + bt_sdk_list_remove(&g_ble_ams_service_list, node); + sdk_list_node_free(node); + } +} + +/* 清理所有存储的对端AMS服务信息 */ +void ble_ams_client_clear_remote_all(void) +{ + ble_ams_service_t *node = (ble_ams_service_t *)g_ble_ams_service_list.head; + ble_ams_service_t *cur_node = NULL; + while (node != NULL) { + cur_node = node; + node = lnext(node); + bt_sdk_list_remove(&g_ble_ams_service_list, cur_node); + sdk_list_node_free(cur_node); + cur_node = NULL; + } +} diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_ancs_client.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_ancs_client.c new file mode 100644 index 000000000..244b8ad62 --- /dev/null +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_ancs_client.c @@ -0,0 +1,896 @@ +/* + * Copyright (c) @CompanyNameMagicTag 2024. All rights reserved. + * Description: BLE Apple Notification Center Service Client module. + */ + +#include +#include "sdk_list.h" +#include "datatype.h" +#include "errcode.h" +#include "btsrv_log.h" +#include "bts_le_gap.h" +#include "sdk_general.h" +#include "bts_uuid.h" +#include "ble_gatts_callbacks.h" +#include "ble_ancs_client.h" + +#define BLE_CLIENT_CHARACTERISTIC_CONFIGURATION_UUID 0x2902 +#define ANCS_NOTIFY_ATT_ID_OFFSET 5 +#define ANCS_NOTIFY_ATT_MAX_LENGTH_BYTE 2 +#define ANCS_NOTIFY_ACTION_ID_OFFSET 5 +#define ANCS_NOTIFY_ATT_VALUE_OFFSET 3 +#define BLE_ATT_HEADER_LEN 3 +#define BLE_ANCS_DATA_MAX_LEN 512 +#define ANCS_NOTIFY_UUID_BYTE_LENGTH 4 +#define ANCS_NOTIFY_SOURCE_LENGTH 8 +#define ANCS_NOTIFY_ATT_DATA_HEADER_LENGTH 8 + +#define u16_low_byte(data) ((uint8_t)((data) & 0x00FF)) +#define u16_high_byte(data) ((uint8_t)(((data) & 0xFF00) >> 8)) +#define little_u8_2_u16(p) ((((uint16_t)(*((p) + 1))) << 8) | ((uint16_t)(*(p)))) +#define u32_2_little_first_byte(uuid) ((uint8_t)((uuid) & 0x000000FF)) +#define u32_2_little_second_byte(uuid) ((uint8_t)(((uuid) & 0x0000FF00) >> 8)) +#define u32_2_little_three_byte(uuid) ((uint8_t)(((uuid) & 0x00FF0000) >> 16)) +#define u32_2_little_four_byte(uuid) ((uint8_t)(((uuid) & 0xFF000000) >> 24)) +#define little_byte_2_u32(data) (((uint32_t)(*(data))) | \ + ((uint32_t)(((uint32_t)*((data) + BT_INDEX_1)) << 8)) | \ + ((uint32_t)(((uint32_t)*((data) + BT_INDEX_2)) << 16)) | \ + ((uint32_t)(((uint32_t)*((data) + BT_INDEX_3)) << 24))) + +/* ANCS服务UUID,小端序 */ +uint8_t ancs_uuid[BT_UUID_MAX_LEN] = { + 0xD0, 0x00, 0x2D, 0x12, 0x1E, 0x4B, 0x0F, 0xA4, 0x99, 0x4E, 0xCE, 0xB5, 0x31, 0xF4, 0x05, 0x79}; + +/* ANCS服务特征UUID-Notification Source,小端序 */ +uint8_t notify_src_uuid[BT_UUID_MAX_LEN] = { + 0xBD, 0x1D, 0xA2, 0x99, 0xE6, 0x25, 0x58, 0x8C, 0xD9, 0x42, 0x01, 0x63, 0x0D, 0x12, 0xBF, 0x9F}; + +/* ANCS服务特征UUID-Control Point,小端序 */ +uint8_t ctl_point_uuid[BT_UUID_MAX_LEN] = { + 0xD9, 0xD9, 0xAA, 0xFD, 0xBD, 0x9B, 0x21, 0x98, 0xA8, 0x49, 0xE1, 0x45, 0xF3, 0xD8, 0xD1, 0x69}; + +/* ANCS服务特征UUID-Data Source,小端序 */ +uint8_t data_src_uuid[BT_UUID_MAX_LEN] = { + 0xFB, 0x7B, 0x7C, 0xCE, 0x6A, 0xB3, 0x44, 0xBE, 0xB5, 0x4B, 0xD6, 0x24, 0xE9, 0xC6, 0xEA, 0x22}; + +ble_ancs_client_callbacks_t g_ancs_callbacks_t = {0}; +struct list_stru g_ble_ancs_service_list = {NULL, NULL}; /* ble_ancs_service_t */ + +/* 根据连接ID查询ANCS服务信息 */ +static ble_ancs_service_t* ancs_service_remote_by_conn(uint8_t client_id, uint16_t conn_id) +{ + ble_ancs_service_t *node = (ble_ancs_service_t *)g_ble_ancs_service_list.head; + while (node != NULL) { + if ((node->client_id == client_id) && (node->conn_id == conn_id)) { + return node; + } + node = lnext(node); + } + + return NULL; +} + +/* ANCS服务特征匹配 */ +static ancs_character_t ancs_char_match(bt_uuid_t *uuid) +{ + if (uuid->uuid_len != BT_UUID_MAX_LEN) { + return ANCS_CHAR_INVALID; + } + bt_uuid_t char_uuid = {0}; + char_uuid.uuid_len = BT_UUID_MAX_LEN; + if (memcpy_s(char_uuid.uuid, BT_UUID_MAX_LEN, notify_src_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[btsrv][ERROR] notify src uuid memcpy fail!\r\n"); + return ANCS_CHAR_INVALID; + } + if (memcmp(&char_uuid, uuid, sizeof(bt_uuid_t)) == 0) { + return ANCS_CHAR_NOTIFY_SRC; + } + if (memcpy_s(char_uuid.uuid, BT_UUID_MAX_LEN, ctl_point_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[btsrv][ERROR] ctl point uuid memcpy fail!\r\n"); + return ANCS_CHAR_INVALID; + } + if (memcmp(&char_uuid, uuid, sizeof(bt_uuid_t)) == 0) { + return ANCS_CHAR_CTRL_POINT; + } + if (memcpy_s(char_uuid.uuid, BT_UUID_MAX_LEN, data_src_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[btsrv][ERROR] data src uuid memcpy fail!\r\n"); + return ANCS_CHAR_INVALID; + } + if (memcmp(&char_uuid, uuid, sizeof(bt_uuid_t)) == 0) { + return ANCS_CHAR_DATA_SRC; + } + return ANCS_CHAR_INVALID; +} + +/* ANCS客户端发起服务建立 */ +errcode_t ble_ancs_client_setup_service(uint8_t client_id, uint16_t conn_id) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote != NULL) { + bts_error("ancs client remote service is already exist,client_id:%u, conn_id:%u.\r\n", + client_id, conn_id); + return ERRCODE_BT_DONE; + } + bt_uuid_t service_uuid = {0}; + service_uuid.uuid_len = BT_UUID_MAX_LEN; + if (memcpy_s(service_uuid.uuid, BT_UUID_MAX_LEN, ancs_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[btsrv][ERROR] uuid memcpy fail!\r\n"); + return ERRCODE_BT_FAIL; + } + return gattc_discovery_service(client_id, conn_id, &service_uuid); +} + +/* ANCS客户端发现服务回调处理函数 */ +void ble_ancs_client_discovery_service_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_service_result_t *service) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote != NULL) { + bts_error("ancs client remote service is already exist,client_id:%u, conn_id:%u.\r\n", + client_id, conn_id); + return; + } + remote = bt_sdk_list_node_create(sizeof(ble_ancs_service_t)); + if (remote == NULL) { + bts_info("ancs client remote node create fail.\r\n"); + return; + } + remote->client_id = client_id; + remote->conn_id = conn_id; + remote->start_handle = service->start_hdl; + remote->end_handle = service->end_hdl; + bt_sdk_list_add_tail(&g_ble_ancs_service_list, remote); + + /* 发现特征 */ + gattc_discovery_character_param_t param = {0}; + param.service_handle = remote->start_handle; + errcode_t ret = gattc_discovery_character(client_id, conn_id, ¶m); + bts_info("ancs client discovery character ret:%u.\r\n", ret); +} + +/* ANCS客户端发现特征回调处理函数 */ +void ble_ancs_client_discovery_character_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_character_result_t *character) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + return; + } + + if ((character->declare_handle < remote->start_handle) || + (character->declare_handle > remote->end_handle)) { + bts_error("ancs client remote service did not have this character_handle:%u conn_id:%u\n", + character->declare_handle, conn_id); + return; + } + + switch (ancs_char_match(&(character->uuid))) { + case ANCS_CHAR_NOTIFY_SRC: { + remote->notify_src.declare_handle = character->declare_handle; + remote->notify_src.value_handle = character->value_handle; + remote->notify_src.properties = character->properties; + + /* 发现描述符 */ + gattc_discovery_descriptor(client_id, conn_id, character->declare_handle); + break; + } + + case ANCS_CHAR_DATA_SRC: { + remote->data_src.declare_handle = character->declare_handle; + remote->data_src.value_handle = character->value_handle; + remote->data_src.properties = character->properties; + + /* 发现描述符 */ + gattc_discovery_descriptor(client_id, conn_id, character->declare_handle); + break; + } + + case ANCS_CHAR_CTRL_POINT: { + remote->ctl_point.declare_handle = character->declare_handle; + remote->ctl_point.value_handle = character->value_handle; + remote->ctl_point.properties = character->properties; + break; + } + + default: + bts_error("[btsrv][INFO] invalid character!\r\n"); + break; + } +} + +/* ANCS客户端发现描述符回调处理函数 */ +void ble_ancs_client_discovery_descriptor_cbk(uint8_t client_id, uint16_t conn_id, + gattc_discovery_descriptor_result_t *descriptor) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + return; + } + + if (descriptor->descriptor_hdl < remote->start_handle || + descriptor->descriptor_hdl > remote->end_handle) { + bts_error("ancs client remote service did not have this descriptor_handle:%u conn_id:%u\n", + descriptor->descriptor_hdl, conn_id); + return; + } + + /* 客户端特征配置描述符 */ + bt_uuid_t ccc_uuid = {0}; + bts_data_to_uuid_len2(BLE_CLIENT_CHARACTERISTIC_CONFIGURATION_UUID, &ccc_uuid); + if (!bts_uuid_is_equal(&ccc_uuid, &(descriptor->uuid))) { + return; + } + + uint16_t notify_ccc_max_handle = remote->end_handle; + uint16_t data_ccc_max_handle = remote->end_handle; + if ((remote->data_src.value_handle != 0) && + (remote->notify_src.value_handle != 0) && + (remote->notify_src.value_handle < remote->data_src.value_handle)) { + notify_ccc_max_handle = remote->data_src.value_handle - 1; + } else if ((remote->notify_src.value_handle != 0) && + (remote->data_src.value_handle != 0) && + (remote->notify_src.value_handle > remote->data_src.value_handle)) { + data_ccc_max_handle = remote->notify_src.value_handle - 1; + } + + if ((remote->notify_src.value_handle != 0) && + (descriptor->descriptor_hdl > remote->notify_src.value_handle) && + (descriptor->descriptor_hdl <= notify_ccc_max_handle)) { + remote->notify_src_ccc_handle = descriptor->descriptor_hdl; + } else if ((remote->data_src.value_handle != 0) && + (descriptor->descriptor_hdl > remote->data_src.value_handle) && + (descriptor->descriptor_hdl <= data_ccc_max_handle)) { + remote->data_src_ccc_handle = descriptor->descriptor_hdl; + } + + if ((remote->notify_src_ccc_handle != 0) && + (remote->data_src_ccc_handle != 0)) { + if (g_ancs_callbacks_t.setup_cb != NULL) { + g_ancs_callbacks_t.setup_cb(client_id, conn_id, ERRCODE_BT_SUCCESS); + } + } +} + +/* ANCS客户端订阅通知源特征通知 */ +errcode_t ble_ancs_client_subscribe_notification_source(uint8_t client_id, uint16_t conn_id, + ancs_client_notify_enable_t enable_flag) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ancs client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->notify_src_ccc_handle == 0) { + bts_error("ancs client remote service did not discovery notify ccc, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + uint16_t ccc_value = BLE_ANCS_CLIENT_CHARACTERISTIC_CONFIGURATION_DEFAULT; + if (enable_flag == ANCS_CLIENT_NOTIFY_ENABLE) { + ccc_value = BLE_ANCS_CLIENT_CHARACTERISTIC_CONFIGURATION_NOTIFICATION; + } + uint8_t notify_ccc_val[] = { + u16_low_byte(ccc_value), + u16_high_byte(ccc_value) + }; + gattc_handle_value_t value = {0}; + value.data_len = (uint16_t)sizeof(notify_ccc_val); + value.data = notify_ccc_val; + value.handle = remote->notify_src_ccc_handle; + return gattc_write_req(client_id, conn_id, &value); +} + +/* ANCS客户端订阅数据源特征通知 */ +errcode_t ble_ancs_client_subscribe_data_source(uint8_t client_id, uint16_t conn_id, + ancs_client_notify_enable_t enable_flag) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ancs client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->data_src_ccc_handle == 0) { + bts_error("ancs client remote service did not discovery data ccc, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + uint16_t ccc_value = BLE_ANCS_CLIENT_CHARACTERISTIC_CONFIGURATION_DEFAULT; + if (enable_flag == ANCS_CLIENT_NOTIFY_ENABLE) { + ccc_value = BLE_ANCS_CLIENT_CHARACTERISTIC_CONFIGURATION_NOTIFICATION; + } + uint8_t notify_ccc_val[] = { + u16_low_byte(ccc_value), + u16_high_byte(ccc_value) + }; + gattc_handle_value_t value = {0}; + value.data_len = (uint16_t)sizeof(notify_ccc_val); + value.data = notify_ccc_val; + value.handle = remote->data_src_ccc_handle; + return gattc_write_req(client_id, conn_id, &value); +} + +/* u32转小端序字节流 */ +static uint32_t convert_little_2_u32(uint8_t *data) +{ + return little_byte_2_u32(data); +} + +/* 释放【通知属性响应数据】申请的内存 */ +static void notify_att_rsp_free(ble_ancs_notification_attr_rsp_t *notify_att_rsp) +{ + ble_ancs_attr_rsp_t *node = notify_att_rsp->attr_rsp_lst.head; + ble_ancs_attr_rsp_t *cur_node = NULL; + /* 校验失败,清空队列 */ + while (node != NULL) { + cur_node = node; + node = lnext(node); + bt_sdk_list_remove(¬ify_att_rsp->attr_rsp_lst, cur_node); /* 出队 */ + bt_os_free(cur_node->att); + sdk_list_node_free(cur_node); + cur_node = NULL; + } + bt_os_free(notify_att_rsp); + return; +} + +/* 组装属性响应数据,兼容分包场景,只解析第一包 */ +static uint16_t ancs_att_rsp_package(ble_ancs_attr_rsp_t *attr_rsp, + uint8_t *data, uint16_t total_length, uint16_t offset_byte) +{ + if ((total_length - offset_byte) <= ANCS_NOTIFY_ATT_VALUE_OFFSET) { /* 最后一个属性只包含属性id或者属性长度 */ + attr_rsp->att_id = *data; + attr_rsp->att_length = 0; + attr_rsp->att = 0; + return 0; + } + attr_rsp->att_id = *data; + uint16_t data_length = little_u8_2_u16(data + 1); + attr_rsp->att_length = data_length + 1; /* 字符串以0结尾 */ + if (data_length != 0) { + uint8_t *att_data = bt_os_new(attr_rsp->att_length); + if (memset_s(att_data, attr_rsp->att_length, 0, attr_rsp->att_length) != EOK) { + bt_os_free(att_data); + attr_rsp->att_length = 0; + attr_rsp->att = 0; + return data_length; + } + uint16_t copy_length = data_length; + if ((total_length - offset_byte) < (data_length + ANCS_NOTIFY_ATT_VALUE_OFFSET)) { /* 最后一个属性 */ + copy_length = total_length - offset_byte - ANCS_NOTIFY_ATT_VALUE_OFFSET; + } + if (memcpy_s(att_data, attr_rsp->att_length, data + ANCS_NOTIFY_ATT_VALUE_OFFSET, copy_length) != EOK) { + bts_error("[btsrv][ERROR] addr memcpy fail!\r\n"); + bt_os_free(att_data); + attr_rsp->att_length = 0; + attr_rsp->att = 0; + return data_length; + } + att_data[attr_rsp->att_length - 1] = 0; /* 字符串以0结尾 */ + attr_rsp->att = att_data; + } else { + attr_rsp->att_length = 0; + attr_rsp->att = 0; + } + return data_length; +} + +/* 解析属性响应数据 */ +static uint16_t parse_att_rsp(uint8_t *data, uint16_t data_length, struct list_stru *attr_rsp_lst) +{ + uint16_t offset_byte = 0; + uint16_t att_num = 0; + uint16_t att_data_len = 0; + while (offset_byte < data_length) { + ble_ancs_attr_rsp_t *attr_rsp = (ble_ancs_attr_rsp_t *)bt_sdk_list_node_create(sizeof(ble_ancs_attr_rsp_t)); + if (attr_rsp != NULL) { + att_data_len = ancs_att_rsp_package(attr_rsp, data, data_length, offset_byte); + att_num += 1; + bt_sdk_list_add_tail(attr_rsp_lst, attr_rsp); + offset_byte = offset_byte + 1 + sizeof(uint16_t) + att_data_len; + data = data + 1 + sizeof(uint16_t) + att_data_len; + } + } + return att_num; +} + +/* 解析通知属性响应数据,响应数据格式:cmd_id(1B)|notify_uid(4B)|att_id1(1B)|att_id1_length(2B)|att_id1_data(动态)|... */ +static void notify_att_data_parse(uint8_t client_id, uint16_t conn_id, uint8_t *data, uint16_t data_length) +{ + ble_ancs_notification_attr_rsp_t *notify_att_rsp = NULL; + errcode_t result = ERRCODE_BT_SUCCESS; + if (data_length <= (ANCS_NOTIFY_ATT_DATA_HEADER_LENGTH - 1)) { + result = ERRCODE_BT_PARAM_ERR; + } else { + notify_att_rsp = bt_os_new(sizeof(ble_ancs_notification_attr_rsp_t)); + notify_att_rsp->notification_uid = convert_little_2_u32(data); + notify_att_rsp->att_num = 0; + notify_att_rsp->attr_rsp_lst.head = NULL; + notify_att_rsp->attr_rsp_lst.tail = NULL; + data = data + ANCS_NOTIFY_UUID_BYTE_LENGTH; + notify_att_rsp->att_num = parse_att_rsp(data, + data_length - ANCS_NOTIFY_UUID_BYTE_LENGTH, ¬ify_att_rsp->attr_rsp_lst); + } + + if (g_ancs_callbacks_t.notify_attr_cb != NULL) { + g_ancs_callbacks_t.notify_attr_cb(client_id, conn_id, notify_att_rsp, result); + } + + if (notify_att_rsp != NULL) { + notify_att_rsp_free(notify_att_rsp); + } +} + +/* 释放【应用属性响应结果】申请的内存 */ +static void app_att_rsp_free(ble_ancs_app_attr_rsp_t *app_att_rsp) +{ + ble_ancs_attr_rsp_t *node = app_att_rsp->attr_rsp_lst.head; + ble_ancs_attr_rsp_t *cur_node = NULL; + while (node != NULL) { + cur_node = node; + node = lnext(node); + bt_sdk_list_remove(&app_att_rsp->attr_rsp_lst, cur_node); /* 出队 */ + bt_os_free(cur_node->att); + sdk_list_node_free(cur_node); + cur_node = NULL; + } + if (app_att_rsp->app_id.id != NULL) { + bt_os_free(app_att_rsp->app_id.id); + } + bt_os_free(app_att_rsp); + return; +} + +/* 解析应用编号 */ +static void app_id_parse(ble_ancs_app_attr_rsp_t *app_att_rsp, uint8_t *data, uint16_t data_length) +{ + uint16_t app_id_len = 0; + for (int i = 0; i < data_length - 1; i++) { + app_id_len = app_id_len + 1; + if (*(data + i) == 0) { + break; + } + } + if (app_id_len != 0) { + app_att_rsp->app_id.len = app_id_len; + uint8_t *id = bt_os_new(app_id_len); + if (id != NULL) { + if (memcpy_s(id, app_id_len, data, app_id_len) != EOK) { + bt_os_free(id); + app_att_rsp->app_id.id = NULL; + return; + } + app_att_rsp->app_id.id = id; + return; + } + } + app_att_rsp->app_id.len = 0; + app_att_rsp->app_id.id = NULL; +} + +/* 解析应用属性响应结果,响应格式:cmd_id(1B)|app_id(动态长度,字符串字节流,以NULL结尾)|att_id1(1B)|att_id1_length(2B)|att_id1_data(动态)|... */ +static void app_att_data_parse(uint8_t client_id, uint16_t conn_id, uint8_t *data, uint16_t data_length) +{ + ble_ancs_app_attr_rsp_t *app_att_rsp = NULL; + errcode_t result = ERRCODE_BT_SUCCESS; + if (data_length <= 0) { + result = ERRCODE_BT_PARAM_ERR; + } else { + app_att_rsp = bt_os_new(sizeof(ble_ancs_app_attr_rsp_t)); + app_id_parse(app_att_rsp, data, data_length); + if ((app_att_rsp->app_id.len == 0) || (app_att_rsp->app_id.id == NULL)) { + result = ERRCODE_BT_PARAM_ERR; + } else { + app_att_rsp->att_num = 0; + app_att_rsp->attr_rsp_lst.head = NULL; + app_att_rsp->attr_rsp_lst.tail = NULL; + uint16_t app_id_len = app_att_rsp->app_id.len; + data = data + app_id_len; + app_att_rsp->att_num = parse_att_rsp(data, data_length - app_id_len, &app_att_rsp->attr_rsp_lst); + } + } + + if (g_ancs_callbacks_t.app_attr_cb != NULL) { + g_ancs_callbacks_t.app_attr_cb(client_id, conn_id, app_att_rsp, result); + } + + if (app_att_rsp != NULL) { + app_att_rsp_free(app_att_rsp); + } +} + +/* ANCS客户端通知消息处理函数,消息格式:event_id(1B)|event_flags(1B)|category_id(1B)|category_count(1B)|notify_uuid(4B) */ +static void notify_src_handle(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data) +{ + errcode_t result = ERRCODE_BT_SUCCESS; + ble_ancs_notification_src_t *notify_src_data = NULL; + if (data->data_len != ANCS_NOTIFY_SOURCE_LENGTH) { + result = ERRCODE_BT_PARAM_ERR; + } else { + uint8_t *pt_data = data->data; + notify_src_data = bt_os_new(sizeof(ble_ancs_notification_src_t)); + notify_src_data->event_id = *pt_data; + notify_src_data->event_flags = *(pt_data + BT_INDEX_1); + notify_src_data->category_id = *(pt_data + BT_INDEX_2); + notify_src_data->category_count = *(pt_data + BT_INDEX_3); + pt_data = pt_data + BT_INDEX_4; + notify_src_data->notification_uid = convert_little_2_u32(pt_data); + } + + if (g_ancs_callbacks_t.notify_source_cb != NULL) { + g_ancs_callbacks_t.notify_source_cb(client_id, conn_id, notify_src_data, result); + } + if (notify_src_data != NULL) { + bt_os_free(notify_src_data); + } +} + +/* ANCS客户端数据消息处理函数 */ +static void data_src_handle(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data) +{ + uint8_t *pt_data = data->data; + uint16_t data_length = data->data_len; + if ((data_length == (ble_gatt_mtu_exchange_result_get() - BLE_ATT_HEADER_LEN)) || + (data_length == BLE_ANCS_DATA_MAX_LEN)) { + bts_error("response is larger than MTU, please limit attribute length, client_id:%u conn_id:%u\n", + client_id, conn_id); + } + uint8_t cmd_id = *pt_data; + pt_data = pt_data + 1; + switch (cmd_id) { + /* 数据格式:cmd_id(1B)|notify_uid(4B)|att_id1(1B)|att_id1_length(2B)|att_id1_data(动态)|... */ + case ANCS_CMD_GET_NOTIFY_ATT:{ + notify_att_data_parse(client_id, conn_id, pt_data, data->data_len - 1); + break; + } + /* 数据格式:cmd_id(1B)|app_id(动态长度,字符串字节流,以NULL结尾)|att_id1(1B)|att_id1_length(2B)|att_id1_data(动态)|... */ + case ANCS_CMD_GET_APP_ATT:{ + app_att_data_parse(client_id, conn_id, pt_data, data->data_len - 1); + break; + } + default: + break; + } +} + +/* ANCS客户端接收对端通知处理函数 */ +void ble_ancs_client_notify_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + return; + } + + /* notification source */ + /* 数据格式:event_id(1B)|event_flags(1B)|category_id(1B)|category_count(1B)|notification_uid(4B) */ + if (data->handle == remote->notify_src.value_handle) { + notify_src_handle(client_id, conn_id, data); + /* data source */ + } else if (data->handle == remote->data_src.value_handle) { + data_src_handle(client_id, conn_id, data); + } +} + +/* ANCS客户端订阅结果处理函数 */ +static void ble_ancs_client_subscribe_result(uint8_t client_id, uint16_t conn_id, + ancs_client_subscribe_type_t type, gatt_status_t status) +{ + if (g_ancs_callbacks_t.subscribe_cb != NULL) { + g_ancs_callbacks_t.subscribe_cb(client_id, conn_id, type, status); + } +} + +/* ANCS客户端写请求响应结果处理函数 */ +static void ble_ancs_client_write_result(uint8_t client_id, uint16_t conn_id, gatt_status_t status) +{ + if (g_ancs_callbacks_t.write_result_cb != NULL) { + g_ancs_callbacks_t.write_result_cb(client_id, conn_id, status); + } +} + +/* ANCS客户端写请求响应处理函数 */ +void ble_ancs_client_write_cbk(uint8_t client_id, uint16_t conn_id, uint16_t handle, gatt_status_t status) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + return; + } + + if (handle == (remote->notify_src_ccc_handle)) { + ble_ancs_client_subscribe_result(client_id, conn_id, ANCS_CLIENT_SUBSCRIBE_NOTIFY, status); + } else if (handle == (remote->data_src_ccc_handle)) { + ble_ancs_client_subscribe_result(client_id, conn_id, ANCS_CLIENT_SUBSCRIBE_DATA, status); + } else if (handle == (remote->ctl_point.value_handle)) { + ble_ancs_client_write_result(client_id, conn_id, status); + } +} + +/* 校验通知属性是否需要拼接【最大长度】参数 */ +static bool is_followed_by_max_length_param(uint8_t att_id) +{ + bool is_followed = false; + switch (att_id) { + case ANCS_NOTIFY_ATT_TITLE: + case ANCS_NOTIFY_ATT_SUBTITLE: + case ANCS_NOTIFY_ATT_MESSAGE: + is_followed = true; + break; + default: + break; + } + return is_followed; +} + +/* u32转小端序 */ +static void u32_2_little(uint32_t notify_uid, uint8_t *pt_data) +{ + *(pt_data + BT_INDEX_1) = u32_2_little_first_byte(notify_uid); + *(pt_data + BT_INDEX_2) = u32_2_little_second_byte(notify_uid); + *(pt_data + BT_INDEX_3) = u32_2_little_three_byte(notify_uid); + *(pt_data + BT_INDEX_4) = u32_2_little_four_byte(notify_uid); +} + +/* 组装通知属性请求参数 */ +static errcode_t package_notify_att_req_param(ble_ancs_notification_attr_req_t *notify_att_req, uint8_t *pt_data) +{ + /* command id */ + *pt_data = ANCS_CMD_GET_NOTIFY_ATT; + + /* notification uuid 小端 */ + u32_2_little(notify_att_req->notification_uid, pt_data); + + /* 拼接ATT ID */ + pt_data = pt_data + ANCS_NOTIFY_ATT_ID_OFFSET; + for (int i = 0; i < notify_att_req->att_num; i++) { + /* 校验ATT ID */ + if (notify_att_req->attr[i].att_id > ANCS_NOTIFY_ATT_NEGATIVE_LABEL) { + return ERRCODE_BT_PARAM_ERR; + } + *(pt_data) = notify_att_req->attr[i].att_id; + pt_data = pt_data + 1; + + /* 属性带有最大长度参数,小端传输 */ + if (is_followed_by_max_length_param(notify_att_req->attr[i].att_id)) { + *(pt_data) = u16_low_byte(notify_att_req->attr[i].att_max_length); + *(pt_data + 1) = u16_high_byte(notify_att_req->attr[i].att_max_length); + pt_data = pt_data + ANCS_NOTIFY_ATT_MAX_LENGTH_BYTE; + } + } + return ERRCODE_BT_SUCCESS; +} + +/* 计算申请内存大小 */ +static uint16_t calc_notify_att_req_param_length(ble_ancs_notification_attr_req_t *notify_att_req) +{ + uint16_t data_len = sizeof(uint8_t) + sizeof(uint32_t) + + (notify_att_req->att_num) * sizeof(uint8_t); + for (int i = 0; i < notify_att_req->att_num; i++) { + /* 属性带有最大长度参数 */ + if (is_followed_by_max_length_param(notify_att_req->attr[i].att_id)) { + data_len += sizeof(uint16_t); + } + } + return data_len; +} + +/* 发送获取通知属性命令 */ +errcode_t ble_ancs_client_send_get_notify_att_cmd(uint8_t client_id, uint16_t conn_id, + ble_ancs_notification_attr_req_t *notify_att_req) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ancs client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->ctl_point.value_handle == 0) { + bts_error("ancs client remote service did not discovery character, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (notify_att_req->att_num == 0) { + bts_error("ancs client att num is invalid, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_PARAM_ERR; + } + + /* 计算请求数据长度 */ + uint16_t data_len = calc_notify_att_req_param_length(notify_att_req); + + /* 请求数据格式:cmd_id(1B)|notify_uid(4B)|att_id1(1B)|att_id2(1B)|att_id2_max_length(2B)|... */ + uint8_t *data = (uint8_t *)bt_os_new(data_len); + + /* 指向参数数据的指针,用于拼接参数移动指针 */ + uint8_t *pt_data = data; + errcode_t ret = package_notify_att_req_param(notify_att_req, pt_data); + if (ret != ERRCODE_BT_SUCCESS) { + bt_os_free(data); + return ret; + } + gattc_handle_value_t value = {0}; + value.handle = remote->ctl_point.value_handle; + value.data_len = data_len; + value.data = data; + errcode_t result = gattc_write_req(client_id, conn_id, &value); + bt_os_free(data); + return result; +} + +static errcode_t package_app_att_req_param(ble_ancs_app_attr_req_t *app_att_req, uint8_t *pt_data) +{ + /* command id */ + *pt_data = ANCS_CMD_GET_APP_ATT; + + /* app id ,字符串 */ + pt_data = pt_data + 1; + if (memcpy_s(pt_data, app_att_req->app_id.len, app_att_req->app_id.id, app_att_req->app_id.len) != EOK) { + bts_error("[btsrv][ERROR] app id memcpy fail!\r\n"); + return ERRCODE_BT_MALLOC_FAIL; + } + + /* 校验 att id */ + pt_data = pt_data + app_att_req->app_id.len; + for (int i = 0; i < app_att_req->att_num; i++) { + if (app_att_req->attr_id[i] > ANCS_APP_ATT_DISPLAY_NAME) { + return ERRCODE_BT_PARAM_ERR; + } + *(pt_data) = app_att_req->attr_id[i]; + pt_data = pt_data + 1; + } + + return ERRCODE_BT_SUCCESS; +} + +/* 发送获取应用属性命令 */ +errcode_t ble_ancs_client_send_get_app_att_cmd(uint8_t client_id, uint16_t conn_id, + ble_ancs_app_attr_req_t *app_att_req) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ancs client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->ctl_point.value_handle == 0) { + bts_error("ancs client remote service did not discovery character, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (app_att_req->att_num == 0) { + bts_error("ancs client att num is invalid, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_PARAM_ERR; + } + + if (app_att_req->app_id.len != strlen((char *)app_att_req->app_id.id) + 1) { + bts_error("[ANCSClient][AppIdentifier]string must be NULL-terminated!\r\n"); + return ERRCODE_BT_PARAM_ERR; + } + + /* 计算数据长度 */ + uint16_t data_len = sizeof(uint8_t) + app_att_req->app_id.len + + (app_att_req->att_num) * sizeof(uint8_t); + + /* 数据格式:cmd_id(1B)|app_id(动态)|att_id1(1B)|att_id2(1B)|... */ + uint8_t *data = (uint8_t *)bt_os_new(data_len); + /* 指向参数数据的指针,用于拼接参数移动指针 */ + uint8_t *pt_data = data; + errcode_t ret = package_app_att_req_param(app_att_req, pt_data); + if (ret != ERRCODE_BT_SUCCESS) { + bt_os_free(data); + return ret; + } + + gattc_handle_value_t value = {0}; + value.handle = remote->ctl_point.value_handle; + value.data_len = data_len; + value.data = data; + errcode_t result = gattc_write_req(client_id, conn_id, &value); + bt_os_free(data); + return result; +} + +/* 发送执行通知行为命令 */ +errcode_t ble_ancs_client_send_perform_notify_action_cmd(uint8_t client_id, uint16_t conn_id, + ble_ancs_notification_action_req_t *action_req) +{ + ble_ancs_service_t *remote = ancs_service_remote_by_conn(client_id, conn_id); + if (remote == NULL) { + bts_error("ancs client remote service is not exist, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + + if (remote->ctl_point.value_handle == 0) { + bts_error("ancs client remote service did not discovery character, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_NOT_READY; + } + if (action_req->action_id >= ANCS_ACTION_RESERVED) { + bts_error("ancs client action id is invalid, client_id:%u conn_id:%u\n", + client_id, conn_id); + return ERRCODE_BT_PARAM_ERR; + } + + /* 计算数据长度 */ + uint16_t data_len = sizeof(uint8_t) + sizeof(uint32_t) + sizeof(uint8_t); + + /* 数据格式:cmd_id(1B)|notify_uid(4B)|action_id(1B) */ + uint8_t *data = (uint8_t *)bt_os_new(data_len); + /* 指向参数数据的指针,用于拼接参数移动指针 */ + uint8_t *pt_data = data; + + /* command id */ + *pt_data = ANCS_CMD_PERFORM_NOTIFY_ACTION; + + /* notification uuid 小端 */ + u32_2_little(action_req->notification_uid, pt_data); + *(pt_data + ANCS_NOTIFY_ACTION_ID_OFFSET) = action_req->action_id; + + gattc_handle_value_t value = {0}; + value.handle = remote->ctl_point.value_handle; + value.data_len = data_len; + value.data = data; + errcode_t result = gattc_write_req(client_id, conn_id, &value); + bt_os_free(data); + return result; +} + +/* 注册ANCS客户端回调函数 */ +errcode_t ble_ancs_client_register_callbacks(ble_ancs_client_callbacks_t *func) +{ + if (memcpy_s(&g_ancs_callbacks_t, sizeof(g_ancs_callbacks_t), func, sizeof(ble_ancs_client_callbacks_t)) != EOK) { + return ERRCODE_BT_MEMCPY_FAIL; + } + return ERRCODE_BT_SUCCESS; +} + +/* ANCS服务判断 */ +bool is_ble_ancs_service(bt_uuid_t *uuid) +{ + bt_uuid_t ancs_service_uuid = {0}; + ancs_service_uuid.uuid_len = BT_UUID_MAX_LEN; + if (memcpy_s(ancs_service_uuid.uuid, BT_UUID_MAX_LEN, ancs_uuid, BT_UUID_MAX_LEN) != EOK) { + bts_error("[BLE]client discovery ancs memcpy error! \n"); + return false; + } + if (ancs_service_uuid.uuid_len != uuid->uuid_len) { + return false; + } + + return (memcmp(uuid, &ancs_service_uuid, sizeof(bt_uuid_t)) == 0 ? true : false); +} + +/* 根据连接ID清理本地存储的对端ANCS服务信息 */ +void ble_ancs_client_clear_remote_by_conn(uint8_t client_id, uint16_t conn_id) +{ + ble_ancs_service_t *node = NULL; + node = ancs_service_remote_by_conn(client_id, conn_id); + if (node != NULL) { + bt_sdk_list_remove(&g_ble_ancs_service_list, node); + sdk_list_node_free(node); + } +} + +/* 清理本地存储的所有对端ANCS服务信息 */ +void ble_ancs_client_clear_remote_all(void) +{ + ble_ancs_service_t *node = (ble_ancs_service_t *)g_ble_ancs_service_list.head; + ble_ancs_service_t *cur_node = NULL; + while (node != NULL) { + cur_node = node; + node = lnext(node); + bt_sdk_list_remove(&g_ble_ancs_service_list, cur_node); + sdk_list_node_free(cur_node); + cur_node = NULL; + } +} diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_gatts_callbacks.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_gatts_callbacks.c index 6bfd8e4ec..a4df99994 100755 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_gatts_callbacks.c +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/ble_profile/profiles/src/ble_gatts_callbacks.c @@ -12,9 +12,13 @@ #include "ble_bas_client.h" #include "ble_pro_dis_client.h" #include "ble_fmp_locator.h" +#include "ble_ancs_client.h" +#include "ble_ams_client.h" #include "bts_uuid.h" #include "ble_gatts_callbacks.h" +uint32_t g_ble_gatt_mtu_size = 23; + static bool bt_gatts_cmp_uuid(const bt_uuid_t *tgt_uuid, const bt_uuid_t *src_uuid) { uint8_t *tgt = (uint8_t *)bts_init_128bit_uuid(tgt_uuid); @@ -52,12 +56,6 @@ static void ble_server_service_add_cbk(uint8_t server_id, bt_uuid_t *uuid, uint1 bt_uuid_t fmp_service_uuid = {0}; bts_data_to_uuid_len2(FMP_IMMEDIATE_ALERT_SERVICE_UUID, &fmp_service_uuid); - bt_uuid_t alpay_service_uuid = {0}; - bts_data_to_uuid_len2(0x3802, &alpay_service_uuid); - - bt_uuid_t ble_service_uuid = {0}; - bts_data_to_uuid_len2(0x18e0, &ble_service_uuid); - if (bt_gatts_cmp_uuid(uuid, &hid_service_uuid) == true) { ble_hid_add_characters_and_descriptors(server_id, handle); gatts_start_service(server_id, handle); @@ -67,12 +65,8 @@ static void ble_server_service_add_cbk(uint8_t server_id, bt_uuid_t *uuid, uint1 } else if (bt_gatts_cmp_uuid(uuid, &fmp_service_uuid) == true) { fmp_target_add_alc_characteristic(server_id, handle); gatts_start_service(server_id, handle); - } else if (bt_gatts_cmp_uuid(uuid, &alpay_service_uuid) == true) { - ble_hid_add_characters_and_descriptors(server_id, handle); - gatts_start_service(server_id, handle); - }else if (bt_gatts_cmp_uuid(uuid, &ble_service_uuid) == true) { - ble_hid_add_characters_and_descriptors(server_id, handle); - gatts_start_service(server_id, handle); + } else { + bts_error("[BLE] server add service cbk, service uuid is not matched.\n"); } } @@ -127,11 +121,10 @@ static void ble_server_req_read_cbk(uint8_t server_id, uint16_t conn_id, gatts_r bts_info("[BLE]server read req server: %u status: %u conn_id:%hu handle: %hu \n", server_id, status, conn_id, cb_para->handle); } -#include "wearable_log.h" + static void ble_server_req_write_cbk(uint8_t server_id, uint16_t conn_id, gatts_req_write_cb_t *cb_para, errcode_t status) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "ble_server_req_write_cbk!!!!!!!!!\r\n"); bts_info("[BLE]server write req server: %u status: %u conn_id:%hu handle: %hu \n", server_id, status, conn_id, cb_para->handle); if (status != ERRCODE_BT_SUCCESS) { @@ -200,6 +193,10 @@ static void ble_client_discovery_service_cbk(uint8_t client_id, uint16_t conn_id ble_dis_client_discovery_service_cbk(client_id, conn_id, service); } else if (bt_gatts_cmp_uuid(&service->uuid, &fmp_service_uuid) == true) { fmp_locator_discovery_service_cbk(client_id, conn_id, service); + } else if (is_ble_ancs_service(&service->uuid)) { + ble_ancs_client_discovery_service_cbk(client_id, conn_id, service); + } else if (is_ble_ams_service(&service->uuid)) { + ble_ams_client_discovery_service_cbk(client_id, conn_id, service); } } @@ -224,6 +221,8 @@ static void ble_client_discovery_character_cbk(uint8_t client_id, uint16_t conn_ fmp_locator_discovery_characteristic_cbk(client_id, conn_id, character); } else { ble_dis_client_discovery_character_cbk(client_id, conn_id, character); + ble_ancs_client_discovery_character_cbk(client_id, conn_id, character); + ble_ams_client_discovery_character_cbk(client_id, conn_id, character); } } @@ -236,6 +235,8 @@ static void ble_client_discovery_descriptor_cbk(uint8_t client_id, uint16_t conn return; } ble_bas_client_discovery_descriptor_cbk(client_id, conn_id, descriptor); + ble_ancs_client_discovery_descriptor_cbk(client_id, conn_id, descriptor); + ble_ams_client_discovery_descriptor_cbk(client_id, conn_id, descriptor); } static void ble_client_read_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *read_result, @@ -243,17 +244,18 @@ static void ble_client_read_cbk(uint8_t client_id, uint16_t conn_id, gattc_handl { bts_info("[BLE]client read cbk client_id: %u conn_id: %hu status: %d handle: %hu \n", client_id, conn_id, status, read_result->handle); - if (status != ERRCODE_BT_SUCCESS) { - return; - } ble_bas_client_read_cbk(client_id, conn_id, read_result, status); ble_dis_client_read_cbk(client_id, conn_id, read_result, status); + ble_ams_client_read_cbk(client_id, conn_id, read_result, status); } static void ble_client_write_cbk(uint8_t client_id, uint16_t conn_id, uint16_t handle, gatt_status_t status) { bts_info("[BLE]client write cbk client_id: %u conn_id: %hu status: %d handle: %hu \n", client_id, conn_id, status, handle); + + ble_ancs_client_write_cbk(client_id, conn_id, handle, status); + ble_ams_client_write_cbk(client_id, conn_id, handle, status); } static void ble_client_notification_cbk(uint8_t client_id, uint16_t conn_id, gattc_handle_value_t *data, @@ -265,8 +267,16 @@ static void ble_client_notification_cbk(uint8_t client_id, uint16_t conn_id, gat return; } ble_bas_client_notify_characteristic_cbk(client_id, conn_id, data); + ble_ancs_client_notify_cbk(client_id, conn_id, data); + ble_ams_client_notify_cbk(client_id, conn_id, data); } +static void ble_client_mtu_exchange_result_cbk(uint8_t client_id, uint16_t conn_id, uint32_t mtu_size, errcode_t status) +{ + bts_info("[BLE]client MTU changed cbk: status: %u client_id: %u conn_id: %u mtu:%u.\r\n", + status, client_id, conn_id, mtu_size); + g_ble_gatt_mtu_size = mtu_size; +} errcode_t ble_client_register_gatt_callbacks(void) { @@ -278,6 +288,12 @@ errcode_t ble_client_register_gatt_callbacks(void) cb.read_cb = ble_client_read_cbk; cb.write_cb = ble_client_write_cbk; cb.notification_cb = ble_client_notification_cbk; + cb.mtu_changed_cb = ble_client_mtu_exchange_result_cbk; ret = gattc_register_callbacks(&cb); return ret; +} + +uint32_t ble_gatt_mtu_exchange_result_get(void) +{ + return g_ble_gatt_mtu_size; } \ No newline at end of file diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c index fa5c04431..f4196fdb2 100755 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gap.c @@ -11,6 +11,7 @@ #include "soc_errno.h" #include "bts_br_gap.h" #include "bts_le_gap.h" +#include "bts_feature.h" #include "bts_a2dp_source.h" #include "bts_br_gap.h" #include "bts_avrcp_controller.h" @@ -58,6 +59,11 @@ typedef enum { BTSRV_SAMPLE_GAP_SHOW_FOUND_LIST, /* 30 展示发现设备列表 */ BTSRV_SAMPLE_GAP_SET_CONN_REQ_ANSWER, /* 31 设置连接请求应答 */ + BTSRV_SAMPLE_GAP_SET_FEATURE_CONFIG, /* 32 蓝牙特性配置 */ + BTSRV_SAMPLE_GAP_GET_FEATURE_CONFIG, /* 33 蓝牙特性获取 */ + BTSRV_SAMPLE_GAP_RECONNECT_PHONE, /* 34 重连手机 */ + + BTSRV_SAMPLE_GAP_SET_INQUIRY_PARAM, /* 35 设置搜到参数 */ } btsrv_gap_sample_cmd_id; typedef enum { @@ -255,7 +261,7 @@ static void btsrv_sample_cmd_enable_bt(const char **params, int32_t params_cnt) { bts_unused(params); bts_unused(params_cnt); - + errcode_t ret = enable_bt_stack(); bts_sample_log("enable_bt_stack ret(errcode_t): %x\n", ret); } @@ -1104,6 +1110,21 @@ static void btsrv_sample_cmd_get_device_class(const char **params, int32_t param bts_sample_log("gap_get_device_class device_class: %d\n", ret); } +static void btsrv_sample_cmd_set_filter_device_class(const char **params, int32_t params_cnt) +{ + if (params_cnt != 2) { /* 2:参数个数 */ + bts_sample_log("gap_br_set_inquiry_paramters params_cnt error! need: device_class max_number\n"); + return; + } + + uint32_t dev_class = (uint32_t)atoi(params[0]); + uint8_t max_num = (uint8_t)atoi(params[1]); + bts_sample_log_with_func("dev_class:%u max_num:%u\n", dev_class, max_num); + int ret = gap_br_set_inquiry_paramters(dev_class, max_num); + + bts_sample_log("gap_br_set_inquiry_paramters ret: %d\n", ret); +} + static void btsrv_sample_cmd_update_found_list(const char **params, int32_t params_cnt) { bts_unused(params); @@ -1130,6 +1151,44 @@ static void btsrv_sample_cmd_set_connect_req_answer(const char **params, int32_t g_sample_gap_accept_conn = (bool)atoi(params[0]); } +static void btsrv_sample_cmd_set_feature_config(const char **params, int32_t params_cnt) +{ + bts_feature_t feature; + if (params_cnt != 1) { /* 1:参数个数 */ + bts_sample_log("btsrv_sample_cmd_set_feature_config params_cnt error! need: feature_config\n"); + return; + } + *(int *)&feature = atoi(params[0]); + bts_sample_log("feature:%d bt_auto_reconnect_closed:%d\n", *(int *)&feature, feature.bt_auto_reconnect_closed); + errcode_t ret = bts_set_features(&feature); + bts_sample_log("bts set features ret:%d\n", ret); +} + +static void btsrv_sample_cmd_get_feature_config(const char **params, int32_t params_cnt) +{ + bts_unused(params); + bts_unused(params_cnt); + bts_feature_t feature = bts_get_features(); + bts_sample_log("bts get features feature: bt_auto_reconnect_closed:%d.\n", feature.bt_auto_reconnect_closed); +} + +static void btsrv_sample_cmd_reconnect_phone(const char **params, int32_t params_cnt) +{ + errcode_t ret; + if (params_cnt != 1) { /* 1:参数个数 */ + bts_sample_log("reconnect phone param error! need: bd_addr.\n"); + return; + } + + bd_addr_t bd_addr; + if (decode_bd_addr_from_str(params[0], bd_addr.addr, BD_ADDR_LEN) != EXT_ERR_SUCCESS) { + bts_sample_log("reconnect phone decode addr error!\n"); + return; + } + ret = gap_reconnect_media_device(&bd_addr); + bts_sample_log("reconnect phone ret:%d.\n", ret); +} + btsrv_sample_cmd_hdl_info g_btsrv_gap_sample_hdls[] = { /* 0 */ { BTSRV_SAMPLE_GAP_ENABLE_BLE, btsrv_sample_cmd_enable_ble }, @@ -1166,12 +1225,23 @@ btsrv_sample_cmd_hdl_info g_btsrv_gap_sample_hdls[] = { { BTSRV_SAMPLE_GAP_GET_DEVICE_NAME, btsrv_sample_cmd_get_device_name }, { BTSRV_SAMPLE_GAP_GET_DEVICE_CLASS, btsrv_sample_cmd_get_device_class }, + /* 25 */ + { BTSRV_SAMPLE_GAP_PAIR_REQUEST_RELY, NULL }, + { BTSRV_SAMPLE_GAP_SET_DEVICE_PIN, NULL }, + { BTSRV_SAMPLE_GAP_SET_DEVICE_PAIRING_CONFIRMATION, NULL }, + { BTSRV_SAMPLE_GAP_SET_DEVICE_PASSKEY, NULL }, /* 29 */ { BTSRV_SAMPLE_GAP_UPDATE_FOUND_LIST, btsrv_sample_cmd_update_found_list }, /* 30 */ { BTSRV_SAMPLE_GAP_SHOW_FOUND_LIST, btsrv_sample_cmd_show_found_list }, - { BTSRV_SAMPLE_GAP_SET_CONN_REQ_ANSWER, btsrv_sample_cmd_set_connect_req_answer } + { BTSRV_SAMPLE_GAP_SET_CONN_REQ_ANSWER, btsrv_sample_cmd_set_connect_req_answer }, + { BTSRV_SAMPLE_GAP_SET_FEATURE_CONFIG, btsrv_sample_cmd_set_feature_config }, + { BTSRV_SAMPLE_GAP_GET_FEATURE_CONFIG, btsrv_sample_cmd_get_feature_config }, + { BTSRV_SAMPLE_GAP_RECONNECT_PHONE, btsrv_sample_cmd_reconnect_phone }, + + /* 35 */ + { BTSRV_SAMPLE_GAP_SET_INQUIRY_PARAM, btsrv_sample_cmd_set_filter_device_class }, }; void btsrv_gap_sample_cmd(uint32_t cmd_id, const char **params, int32_t params_cnt) diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gatt.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gatt.c index 33b445b4e..bdcc1fcae 100755 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gatt.c +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_core/sample_bts_gatt.c @@ -24,6 +24,8 @@ #include "ble_pro_dis_client.h" #include "ble_bas_client.h" #include "ble_fmp_locator.h" +#include "ble_ancs_client.h" +#include "ble_ams_client.h" #include "osal_task.h" #define BTSRV_LOG_DEBUG @@ -1500,8 +1502,8 @@ static void sample_gap_ble_scan_result_cbk(const gap_scan_result_data_t *scan_re scan_result_data->addr.addr[BT_INDEX_5]); } -static void sample_gap_ble_conn_state_change_cbk(uint16_t conn_id, bd_addr_t *addr, gap_acl_state_t conn_state, - gap_pair_state_t pair_state, gap_ble_disc_reason_t disc_reason) +static void sample_gap_ble_conn_state_change_cbk(uint16_t conn_id, bd_addr_t *addr, gap_ble_conn_state_t conn_state, + gap_ble_pair_state_t pair_state, gap_ble_disc_reason_t disc_reason) { bts_sample_log("ConnectStateChanged conn_id:%u addr:0x%02x:**:**:**:%02x:%02x addr_type:%u" "conn_state:%d pair_state:%d\r\n", conn_id, addr->addr[BT_INDEX_0], addr->addr[BT_INDEX_4], @@ -1511,6 +1513,8 @@ static void sample_gap_ble_conn_state_change_cbk(uint16_t conn_id, bd_addr_t *ad ble_dis_client_clear_remote_by_conn(1, conn_id); ble_bas_client_clear_remote_by_conn(1, conn_id); ble_fmp_locator_clear_remote_by_conn(1, conn_id); + ble_ancs_client_clear_remote_by_conn(1, conn_id); + ble_ams_client_clear_remote_by_conn(1, conn_id); } } @@ -1550,6 +1554,15 @@ static void sample_gap_ble_read_remote_rssi_cbk(uint16_t conn_id, int8_t rssi, e bts_sample_log("read remote rssi conn_id:%u rssi:%d status:%u\r\n", conn_id, rssi, status); } +static void sample_gap_ble_connect_param_update_cbk(uint16_t conn_id, errcode_t status, + const gap_ble_conn_param_update_t *param) +{ + bts_sample_log("connect param changed conn_id:%u status:%u", conn_id, status); + if (param != NULL) { + bts_sample_log(" interval:%u latency:%u timeout:%u\r\n", param->interval, param->latency, param->timeout); + } +} + /* 注册GATT回调 params: sample_mode fill_callbacks */ static void sample_gatt_cmd_ble_gatt_reg_cbk(char **params, int32_t params_cnt) { @@ -1579,7 +1592,7 @@ static void sample_gatt_cmd_ble_gatt_reg_cbk(char **params, int32_t params_cnt) sample_gap_ble_read_remote_rssi_cbk, sample_gap_ble_terminate_adv_cbk, sample_gap_ble_auth_complete_cbk, - NULL, + sample_gap_ble_connect_param_update_cbk, }; ret = gap_ble_register_callbacks(&cb); bts_sample_log("gap_ble_register_callbacks with funcs ret(errcode_t): %x\n", ret); diff --git a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_srv_shell.c b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_srv_shell.c index cb15dc7c6..745461c3f 100755 --- a/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_srv_shell.c +++ b/code/sdk/protocol/bt/host/bt/bts/bt_sample/bt_srv_shell.c @@ -22,6 +22,8 @@ #include "sample_bt_audio_hal.h" #include "sample_ble_fmp.h" #include "sample_pan_service.h" +#include "sample_ble_ancs.h" +#include "sample_ble_ams.h" #define BT_SRV_SAMPLE_CMD_ARGC_MIN 2 @@ -57,11 +59,13 @@ typedef enum { BTSRV_SAMPLE_CMD_GROUP_PAN = 22, /* 22 PAN 测试命令 */ BTSRV_SAMPLE_CMD_GROUP_HFP_AG = 23, /* 23 HFP-AG 测试命令 */ #endif + + BTSRV_SAMPLE_CMD_GROUP_ANCS_CLIENT = 24, /* 24 ANCS CLIENT 测试命令 */ + BTSRV_SAMPLE_CMD_GROUP_AMS_CLIENT = 25, /* 25 AMS CLIENT 测试命令 */ } btsrv_sample_cmd_group; #if (BTH_LE_ONLY == YES) || (BTH_BREDR_LE_DOUBLE == YES) static void ble_service_sample_cmd(int32_t module_id, int32_t cmd_id, char **params, int32_t params_num) { - if (params == NULL) { return; } @@ -102,6 +106,12 @@ static void ble_service_sample_cmd(int32_t module_id, int32_t cmd_id, char **par case BTSRV_SAMPLE_CMD_GROUP_FMP: ble_at_fmp_srv_cmd(cmd_id, params, params_num); break; + case BTSRV_SAMPLE_CMD_GROUP_ANCS_CLIENT: + ble_ancs_client_at_cmd(cmd_id, params, params_num); + break; + case BTSRV_SAMPLE_CMD_GROUP_AMS_CLIENT: + ble_ams_client_at_cmd(cmd_id, params, params_num); + break; default: bts_sample_log_with_func("invalid cmd group id\n"); break; diff --git a/code/sdk/protocol/bt/host/bt/bts/sdk/inc/stack_api/stack_gap_if.h b/code/sdk/protocol/bt/host/bt/bts/sdk/inc/stack_api/stack_gap_if.h index 9d60c127c..bfef91a10 100755 --- a/code/sdk/protocol/bt/host/bt/bts/sdk/inc/stack_api/stack_gap_if.h +++ b/code/sdk/protocol/bt/host/bt/bts/sdk/inc/stack_api/stack_gap_if.h @@ -482,7 +482,7 @@ int32_t btsdk_un_pair_device(uintptr_t dev_hdl); uintptr_t btsdk_add_remote_device(uint8_t *bd_addr, uint8_t addr_len); int32_t btsdk_update_remote_device_name(uintptr_t dev_hdl, uint8_t *name, uint16_t *plen); int32_t btsdk_update_remote_device_name_async(uintptr_t dev_hdl, gap_execute_command_cfm_cbk *cfm_cbk); -int32_t btsdk_start_device_discovery(uint32_t dev_class); +int32_t btsdk_start_device_discovery(uint32_t dev_class, uint8_t max_num, uint8_t max_seconds); int32_t btsdk_get_remote_device_address(uintptr_t dev_hdl, uint8_t *bd_addr, uint8_t addr_len); int32_t btsdk_create_acl_link(uintptr_t dev_hdl, uint8_t link_type); int32_t btsdk_create_acl_link_async(uintptr_t dev_hdl, uint8_t link_type, gap_create_connection_cfm_cbk *cfm_cbk); diff --git a/code/sdk/tools/bin/ohos_tools/ace-loader/jerry-snapshot.exe b/code/sdk/tools/bin/ohos_tools/ace-loader/jerry-snapshot.exe new file mode 100644 index 000000000..895c74cb5 Binary files /dev/null and b/code/sdk/tools/bin/ohos_tools/ace-loader/jerry-snapshot.exe differ diff --git a/code/sdk/tools/bin/ohos_tools/ace-loader/jerry.exe b/code/sdk/tools/bin/ohos_tools/ace-loader/jerry.exe new file mode 100644 index 000000000..3bdadfba0 Binary files /dev/null and b/code/sdk/tools/bin/ohos_tools/ace-loader/jerry.exe differ diff --git a/code/sdk/tools/pkg/bin/brandy/bt.bin b/code/sdk/tools/pkg/bin/brandy/bt.bin index 836484542..7f1cef247 100755 --- a/code/sdk/tools/pkg/bin/brandy/bt.bin +++ b/code/sdk/tools/pkg/bin/brandy/bt.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:78f3f87cbaa6a870dd9d831761ce739bc2bbafeda2bb6b81d16e996c4ec754ae -size 420744 +oid sha256:50235b92e206a09e815fe14c72151af459804ac9f4da442e5cd42c81c03a4498 +size 424520 diff --git a/code/sdk/tools/pkg/bin/brandy/dsp/max/dsp_main.bin b/code/sdk/tools/pkg/bin/brandy/dsp/max/dsp_main.bin index 4cad4b2f5..ee328bc72 100755 --- a/code/sdk/tools/pkg/bin/brandy/dsp/max/dsp_main.bin +++ b/code/sdk/tools/pkg/bin/brandy/dsp/max/dsp_main.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b7c477d213ca5deaa465b11198f183ffb199185c561987df857271b7b71a5277 -size 349752 +oid sha256:5fe2c957c1ebfe67a6b5d823b49f16c5045aae025364c8927b9b663aa1e21247 +size 349776 diff --git a/code/sdk/tools/pkg/bin/brandy/dsp/max/dsp_overlay.bin b/code/sdk/tools/pkg/bin/brandy/dsp/max/dsp_overlay.bin index 595a8c200..083a2aca2 100755 --- a/code/sdk/tools/pkg/bin/brandy/dsp/max/dsp_overlay.bin +++ b/code/sdk/tools/pkg/bin/brandy/dsp/max/dsp_overlay.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0cd5193c6cd78a21acec966babb67d79e9efd353483d89b42236c047e88b4640 -size 1281704 +oid sha256:8e8be28c68be08effa8cabbe2494bda1668226865698eea2a7f86e03800f54a5 +size 1282104 diff --git a/code/sdk/tools/pkg/bin/brandy/dsp/mini/dsp_main.bin b/code/sdk/tools/pkg/bin/brandy/dsp/mini/dsp_main.bin index 1d440b61b..038c4044d 100755 --- a/code/sdk/tools/pkg/bin/brandy/dsp/mini/dsp_main.bin +++ b/code/sdk/tools/pkg/bin/brandy/dsp/mini/dsp_main.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:75ed053796a4f34bc8c11c8dcf90678cf153d0a05f038157841945466d4b912e -size 330672 +oid sha256:9fd362db76e002ff8ddb9e37a86ecfe210de0ae3855d707365dbe23730560181 +size 330696 diff --git a/code/sdk/tools/pkg/bin/brandy/dsp/mini/dsp_overlay.bin b/code/sdk/tools/pkg/bin/brandy/dsp/mini/dsp_overlay.bin index 4c7c1f95c..d8fb02427 100755 --- a/code/sdk/tools/pkg/bin/brandy/dsp/mini/dsp_overlay.bin +++ b/code/sdk/tools/pkg/bin/brandy/dsp/mini/dsp_overlay.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:282ef40bfd40050b99c2f3db41f6a086a4ebd88f77259dae535b8d128c94d8fc -size 131344 +oid sha256:c0397c19b0a08c87dc2842df1b0fea27ca676ef760276757014c4118ce2ca331 +size 131728 diff --git a/code/sdk/tools/pkg/bin/brandy/dsp/normal/dsp_main.bin b/code/sdk/tools/pkg/bin/brandy/dsp/normal/dsp_main.bin index 6c33e8892..182eb09ab 100755 --- a/code/sdk/tools/pkg/bin/brandy/dsp/normal/dsp_main.bin +++ b/code/sdk/tools/pkg/bin/brandy/dsp/normal/dsp_main.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:51e4702e52a6ed1098fd9aca5fadd85259ff03da6f96e39b4a65a68f1a50a9b0 -size 344400 +oid sha256:3a529edcb039824693731bfdbf78a0de57c70dc1548f45fd38aec8e7882b7af3 +size 344424 diff --git a/code/sdk/tools/pkg/bin/brandy/dsp/normal/dsp_overlay.bin b/code/sdk/tools/pkg/bin/brandy/dsp/normal/dsp_overlay.bin index 01d0b4df1..8f8efc0eb 100755 --- a/code/sdk/tools/pkg/bin/brandy/dsp/normal/dsp_overlay.bin +++ b/code/sdk/tools/pkg/bin/brandy/dsp/normal/dsp_overlay.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0a9f0cc36776f99ebec1d033a56ba932aaecf0ca364ecc365f47d33189255645 -size 1025292 +oid sha256:740562d6fe2d0c9a86ee86394a065bd807a895e9a71a015fdf31adba93fc6ddc +size 1025692 diff --git a/code/sdk/tools/pkg/bin/brandy/ssb.bin b/code/sdk/tools/pkg/bin/brandy/ssb.bin index 94129ab0b..9ab642e75 100755 --- a/code/sdk/tools/pkg/bin/brandy/ssb.bin +++ b/code/sdk/tools/pkg/bin/brandy/ssb.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5298cfa289e41b441fa2aae9525ca38e009ad7d9451ed82815ba895fe150491b -size 74348 +oid sha256:32ab04bbf6a1acb89d6ecbf8b054d4bed2ce6120c51d7146014bd0e40e0f0f6f +size 74300 diff --git a/code/sdk/tools/pkg/chip_packet/brandy/packet.py b/code/sdk/tools/pkg/chip_packet/brandy/packet.py index d1696e5f3..b4451d336 100755 --- a/code/sdk/tools/pkg/chip_packet/brandy/packet.py +++ b/code/sdk/tools/pkg/chip_packet/brandy/packet.py @@ -24,14 +24,18 @@ from param_packet import gen_flash_part_bin from nv_binary import nv_begin # brandy packet -def build_brandy_other_bin(): +def build_brandy_other_bin(pack_style_str): ''' build brandy partition and nv ''' chip_dir = os.path.join(SDK_DIR, "build", "config", "target_config", "brandy") # 分区配置文件路径 partition_cfg = os.path.join(chip_dir, "param_sector", "param_sector.json") partition_bin = os.path.join(SDK_DIR, "output", "brandy", "partition_table.bin") # nv配置文件路径 - nv_config_json = os.path.join(chip_dir, "nv_bin_cfg", "mk_nv_bin_cfg.json") + nv_config_json = os.path.join(chip_dir, "nv_bin_cfg") + if pack_style_str.endswith("-user"): + nv_config_json = os.path.join(nv_config_json, "mk_nv_bin_cfg_user.json") + else: + nv_config_json = os.path.join(nv_config_json, "mk_nv_bin_cfg_eng.json") targets = ["acore"] # 输出路径 nv_output_path = os.path.join(SDK_DIR, "output", "brandy", "nv_bin") @@ -45,7 +49,7 @@ def build_brandy_other_bin(): def make_all_in_one_packet(pack_style_str): # make all in one packet - build_brandy_other_bin() + build_brandy_other_bin(pack_style_str) bin_dir = os.path.join(PKG_DIR, "bin", "brandy") application_dir = os.path.join(SDK_DIR, @@ -54,6 +58,7 @@ def make_all_in_one_packet(pack_style_str): "acore", pack_style_str) recovery_target = "%s-r" % pack_style_str + recovery_target = recovery_target.replace('-user', '') recovery_bin = os.path.join(SDK_DIR, "output", "brandy", diff --git a/patch_602_base_to_0521.txt b/patch_602_base_to_0521.txt new file mode 100644 index 000000000..28667eabe --- /dev/null +++ b/patch_602_base_to_0521.txt @@ -0,0 +1,87 @@ +【补丁名称】patch_602_base_to_0521 +【基础版本】b602 +【修复问题】 +BT合入内容 + 1、解决调用a2dp snk接口断开失败问题。 + 2、解决手表与android手机通过WRTM连接后取消配对后能搜到手表BT但是连接不上的问题。 + 3、客户需求:BT自动回连开关、BT回连接口。 + 4、解决BLE数传触发流控丢包后A核无感知的问题。 + 5、优化Bæ ¸BLE GAP事件上报流程,解决断连事件上报慢的问题。 + 6、解决BLE GATT断连处理中内存泄漏问题。 + 7、解决BR回连失败问题。 + 8、优化GATT服务发现、写请求等阻塞流程,从死等优化成60s超时。 + 9、配置MTU默认值为23,解决ios mut更新失败兼容性问题。 + 10、客户需求合入:inquiry参数配置接口,可配置参数:设备类型、最大设备数量。 + 11、新增维测日志。 + 12、配合btc解决BLE数传和通话共存场景下通话卡顿问题,具体方案是:BT通话和BLE共存时,BT通话结束,连接参数恢复成原先的值。 + 13、解决ble地址变化时BLE write响应上报不成功问题。 + 14、增加默认广播数据名字长度限制。 + 15、解决BT回连过程中,BLE数传ipc error问题。 + 16、解决MMI扫描内存不足问题 + 17、解决BLE配置广播数据后未清理内存导致系统内存资源不足问题 + 18、新增BLE ANCS/AMS Client功能 +PLT合入内容 + 1、dfx维测增强,增加bt panic场景bt ram,bt trace,preserve信息。 + 2、A核到Bæ ¸IPC消息判断B核深睡flag。 + 3、复位前保护,复位等待B核响应。 + 4、QSPI指针越界 + 5、解决屏幕概率显示黑线,增加gpu memretention配置 + 6、解决efuse写bit问题 + 7、SEC sha hash运算错误 + 8、适配2G NANDflash + 9、RTC定时问题 + 10、解决log dump重新配置狗超时 + 11、增加user target,默认开启离线日志 + 12、离线日志增加流控功能 + 13、优化windows编译路径长问题 + 14、nv配置区分user和eng版本,解决nv升级未生效问题 +GUI合入内容 + 1、支持蜂窝进入退出仿苹果动效 + 2、支持CoverFlow的松手惯性动效 + 3、支持Dump图片资源使用信息 + 4、优化视频页面截图以及跳转进入动效方案 + 5、解决图片资源加卸载过程中的内存异常问题 + 6、解决SVG解析失败问题 + 7、解决页面跳转崩溃问题 + 8、解决跑马灯因精度导致的抖动问题 + 9、解决触摸事件因不同页面控件地址相同导致的异常处理问题 + 10、关闭MapBuffer节省图形占用内存 + 11、解决弧形列表内存泄漏问题 + 12、解决UICrossView 已对齐时松手不上报ScrollEnd回调 + 13、预防通过UIView清除了其他焦点控件 + 14、修复内存分配时内存没对齐问题 + 15、修复问题:Text绘制应取交集,否则可能传超大区域导致VAU绘制报错 + 16、修复corssview UIMenuItem截图失败 +AUDIO&MEDIA合入内容 + 1、解决3A算法无法调参的问题 + 2、解决HSO命令行无法dump数据的问题,删去多余的realpath操作 + 3、支持使用seek的方式进行音视频的循环播放,提升性能 + 4、解决从本地音乐切换到蓝牙音乐频率不改变的问题 + 5、支持设置视频退出的同步和异步模式 +OHOS合入内容 + 1、支持音频资源文件打包到JS应用的需求 + 2、支持百度矢量地图,合入百度JSI接口的修改 + 3、解决自定义地图控件场景ref count反转导致挂死问题 +GPU合入内容: + 1、解决视频播放花屏问题以及低功耗时访问GPU寄存器问题 + 2、解决多线程场景下低功耗时GPU寄存器访问挂死问题 +NATIVE-JS sample合入内容 + 1、增加表盘管理 + 2、增加卡片管理 + 3、增加列表蜂窝切换 + 4、解决概率通话无声、耳机回连失败问题 +【修改影响】NA +【使用方法】 + 1、手动删除sdk_602版本以下文件: + code\sdk\application\wearable\nativeapp\nativeui\main\src\dial\parser\DialBinTypes.h + code\sdk\application\wearable\nativeapp\nativeui\main\src\dial\parser\DialBinParser.h + code\sdk\open_source\openharmony\third_party\jerryscript + 2、合入补丁内容到sdk_602版本目录 + 3、离线表盘工具、js开发配套工具存放在tools,视频表盘制作变更具体参考tools\dial_converter_tool\视频表盘制作变更.txt + 4、nativeapp新增资源存放在res目录 +【自测情况】 + 自验证范围: + 全功能冒烟 + 自验证target: + Native-js、target3 rc版本 +【是否合入版本】根据测试结果确定 \ No newline at end of file diff --git a/tools/ace-loader/jerry-snapshot.exe b/tools/ace-loader/jerry-snapshot.exe new file mode 100644 index 000000000..895c74cb5 Binary files /dev/null and b/tools/ace-loader/jerry-snapshot.exe differ diff --git a/tools/ace-loader/jerry.exe b/tools/ace-loader/jerry.exe new file mode 100644 index 000000000..3bdadfba0 Binary files /dev/null and b/tools/ace-loader/jerry.exe differ diff --git a/tools/dial_converter_tool/README.txt b/tools/dial_converter_tool/README.txt new file mode 100644 index 000000000..58d2c0f96 --- /dev/null +++ b/tools/dial_converter_tool/README.txt @@ -0,0 +1,11 @@ +usage: main.py [-h] [-file FILE] [-dir DIR] [-output OUTPUT] + +options: + -h, --help show this help message and exit + -file FILE, -f FILE The svg file need to be converted. + -dir DIR, -d DIR The directory needs to be converted. + -output OUTPUT output dir + +example: +windows: python .\main.py -dir .\instance\analogue_dial +windows: python .\main.py -dir .\instance\kaleidoscope_dial \ No newline at end of file diff --git a/tools/dial_converter_tool/common_types.py b/tools/dial_converter_tool/common_types.py new file mode 100644 index 000000000..444fc6edc --- /dev/null +++ b/tools/dial_converter_tool/common_types.py @@ -0,0 +1,26 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from enum import Enum +from ctypes import * + +class Point(Structure): + _fields_ = [ + ('x', c_short), + ('y', c_short), + ] + +class Rect(Structure): + _fields_ = [ + ('x', c_short), + ('y', c_short), + ('w', c_ushort), + ('h', c_ushort) + ] + +class ColorStop(Structure): + _fields_ = [ + ('stop', c_float), + ('color', c_uint), + ] \ No newline at end of file diff --git a/tools/dial_converter_tool/converter.py b/tools/dial_converter_tool/converter.py new file mode 100644 index 000000000..502ed3561 --- /dev/null +++ b/tools/dial_converter_tool/converter.py @@ -0,0 +1,184 @@ +#!/usr/bin/python +# coding: utf-8 +import os +import re +import struct +import ctypes +from ctypes import * +import xml.sax +from enum import Enum +import img_convert +import video_convert +from dial_static_img import DialStaticImg +from dial_sequence_img import DialSequenceImg +from dial_rotate_img import DialRotateImg +from dial_option_img import DialOptionImg +from dial_digital_img import DialDigitalImg +from dial_label import DialLabel +from dial_arc_label import DialArcLabel +from dial_box_progress import DialBoxProgress +from dial_arc_progress import DialArcProgress +from dial_video import DialVideo +from dial_click import DialClick +from dial_kaleidoscope import DialKaleidoscope + +class DialHeader(Structure): + _fields_ = [ + ('dialName', c_char * 16), + ('width', c_short), + ('height', c_short), + ('version', c_char * 16), + ('previewImgId', c_ushort), + ('description', c_char * 128), + ('imgoffset', c_uint), + ('period', c_ubyte), + ('dialViewCount', c_ubyte), + ] + + def __init__(self): + self.imgoffset = 0 + self.dialViewCount = 0 + self.period = 0 + self.viewType = [] + self.viewPt = [] + + def parse_attributes(self, attributes): + title = attributes["title"] + self.dialName = bytes(title, encoding = "utf8") + + description = attributes["description"] + self.description = bytes(description, encoding = "utf8") + + size = attributes["size"] + width,height = size.split(' ') + self.width = int(width) + self.height = int(height) + + version = attributes["version"] + self.version = bytes(version, encoding = "utf8") + + previewStr = attributes["preview_img"] + self.previewImgId = img_convert.instance.convert_img(previewStr) + + for attr in attributes.getNames(): + if attr == "tile_width": + tile_width = int(attributes["tile_width"]) + img_conver.instance.set_tile_width(tile_width) + + def add_view(self, viewObj, viewType): + self.viewPt.append(viewObj) + self.viewType.append(viewType) + self.dialViewCount += 1 + + def get_bytes(self): + ret = bytes(self) + for index in range(self.dialViewCount): + ret += struct.pack('@b', self.viewType[index]) + return ret + + def get_size(self): + return sizeof(self) + sizeof(c_ubyte) * self.dialViewCount + +class DialConvertTool(xml.sax.ContentHandler): + parser = xml.sax.make_parser() + DIAL_STATIC_IMG_TYPE = 0 + DIAL_SEQUENCE_IMG_TYPE = 1 + DIAL_ROTATE_IMG_TYPE = 2 + DIAL_OPTION_IMG_TYPE = 3 + DIAL_DIGITAL_IMG_TYPE = 4 + DIAL_LABEL_TYPE = 5 + DIAL_ARC_LABEL_TYPE = 6 + DIAL_BOX_PROGRESS_TYPE = 7 + DIAL_ARC_PROGRESS_TYPE = 8 + DIAL_VIDEO_TYPE = 9 + DIAL_CLICK_TYPE = 10 + DIAL_KALEIDOSCCOPE_TYPE = 11 + + def __init__(self): + self.inFile = "" + self.outPath = "" + self.header = DialHeader() + self.parser.setFeature(xml.sax.handler.feature_namespaces, 0) + self.parser.setContentHandler(self) + + def startElement(self, tag, attributes): + viewTypeArray = [] + if tag == "dial": + self.header.parse_attributes(attributes) + elif tag == "static_img": + view = DialStaticImg() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_STATIC_IMG_TYPE) + elif tag == "sequence_img": + view = DialSequenceImg() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_SEQUENCE_IMG_TYPE) + elif tag == "rotate_img": + view = DialRotateImg() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_ROTATE_IMG_TYPE) + elif tag == "option_img": + view = DialOptionImg() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_OPTION_IMG_TYPE) + elif tag == "digital_img": + view = DialDigitalImg() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_DIGITAL_IMG_TYPE) + elif tag == "label": + view = DialLabel() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_LABEL_TYPE) + elif tag == "arc_label": + view = DialArcLabel() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_ARC_LABEL_TYPE) + elif tag == "box_progress": + view = DialBoxProgress() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_BOX_PROGRESS_TYPE) + elif tag == "arc_progress": + view = DialArcProgress() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_ARC_PROGRESS_TYPE) + elif tag == "video": + view = DialVideo() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_VIDEO_TYPE) + elif tag == "click": + view = DialClick() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_CLICK_TYPE) + elif tag == "kaleidoscope": + view = DialKaleidoscope() + view.parse_attributes(attributes) + self.header.add_view(view, self.DIAL_KALEIDOSCCOPE_TYPE) + + def endElement(self, tag): + if tag == "dial": + # create & open dstfile + outputfile = self.outPath + "/" + os.path.basename(self.inFile)[:-3] + "bin" + fb = open(outputfile, 'wb') + os.chmod(outputfile, 0o0755) + self._write_data_to_bin(fb) + fb.close() + + def convert_xml_to_output(self, inFile, outPath): + self.inFile = inFile + self.outPath = outPath + self.parser.parse(inFile) + + def _write_data_to_bin(self, fb): + self.header.imgoffset += self.header.get_size() + for view in self.header.viewPt: + if self.header.period < view.period: + self.header.period = view.period + self.header.imgoffset += view.get_size() + + fb.write(self.header.get_bytes()) + for view in self.header.viewPt: + if isinstance(view, DialVideo): + view.offset += self.header.imgoffset + img_convert.instance.get_size() + fb.write(view.get_bytes()) + img_convert.instance.write_data_to_bin(fb) + video_convert.instance.write_data_to_bin(fb) diff --git a/tools/dial_converter_tool/dial_arc_label.py b/tools/dial_converter_tool/dial_arc_label.py new file mode 100644 index 000000000..5f493fab7 --- /dev/null +++ b/tools/dial_converter_tool/dial_arc_label.py @@ -0,0 +1,67 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Point + +class DialArcLabel(Structure): + _fields_ = [ + ('align', c_ubyte), + ('fontSize', c_ubyte), + ('center', Point), + ('radius', c_ushort), + ('rotateStart', c_short), + ('rotaeteEnd', c_short), + ('color', c_uint), + ('fontName', c_char * 64), + ('text', c_char * 64), + ('bindData', c_short), + ('isPeriod', c_bool) + ] + def __init__(self): + self.period = 0 + self.isPeriod = False + + def parse_attributes(self, attributes): + alignStr = attributes["align"] + if alignStr == "bottom": + self.align = 4 + elif alignStr == "top": + self.align = 3 + elif alignStr == "center": + self.align = 2 + elif alignStr == "right": + self.align = 1 + else: + self.align = 0 + + self.fontSize = int(attributes["font_size"]) + + x,y = attributes["center"].split(" ") + self.center.x = int(x) + self.center.y = int(y) + + self.radius = int(attributes["radius"]) + self.rotateStart = int(attributes["start_angle"]) + self.rotaeteEnd = int(attributes["end_angle"]) + self.color = int(attributes["color"], 16) + self.fontName = bytes(attributes["font"], encoding = "utf8") + self.text = bytes(attributes["text"], encoding = "utf8") + for attr in attributes.getNames(): + if attr == "bind_data": + self.bindData = int(attributes["bind_data"]) + elif attr == "period": + self.period = int(attributes["period"]) + if self.period != 0: + self.isPeriod = True + if self.isPeriod != 0 and self.bindData == 0: + print("[ERROR]:[bind_data] is not set, [period] cannot be set") + sys.exit(1) + + def get_bytes(self): + return bytes(self) + + def get_size(self): + return sizeof(self) \ No newline at end of file diff --git a/tools/dial_converter_tool/dial_arc_progress.py b/tools/dial_converter_tool/dial_arc_progress.py new file mode 100644 index 000000000..1ee9f56c2 --- /dev/null +++ b/tools/dial_converter_tool/dial_arc_progress.py @@ -0,0 +1,101 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Rect +from common_types import ColorStop +import img_convert + +class ProgressUnion(Union): + _fields_ = [ + ('stopCount', c_ubyte), + ('imgId', c_ushort), + ('color', c_uint), + ] + +class DialArcProgress(Structure): + _fields_ = [ + ('cap', c_ubyte), + ('isPeriod', c_bool), + ('radius', c_ushort), + ('startAngle', c_ushort), + ('endAngle', c_ushort), + ('lineWidth', c_ushort), + ('bindData', c_short), + ('bgColor', c_uint), + ('type', c_ubyte), + ('rect', Rect), + ('unionValue', ProgressUnion) + ] + + def __init__(self): + self.stop = [] + self.period = 0 + self.isPeriod = False + + def parse_attributes(self, attributes): + x,y,w,h = attributes["rect"].split(" ") + self.rect.x = int(x) + self.rect.y = int(y) + self.rect.w = int(w) + self.rect.h = int(h) + + cap = attributes["cap_type"] + if cap == "round": + self.cap = 1 + else: + self.cap = 0 + + self.radius = int(attributes["radius"]) + self.startAngle = int(attributes["start_angle"]) + self.endAngle = int(attributes["end_angle"]) + self.lineWidth = int(attributes["line_width"]) + self.bindData = int(attributes["bind_data"]) + + attrList = attributes.getNames() + for attr in attrList: + if attr == "img_name": + self.unionValue.imgId = img_convert.instance.convert_img(attributes["img_name"]) + self.type = 0 + break + elif attr == "color": + self.unionValue.color = int(attributes["color"], 16) + self.type = 1 + break + elif attr == "gradient_colors": + self.type = 2 + stopList = attributes["gradient_stops"].split(" ") + colorList = attributes["gradient_colors"].split(" ") + if len(stopList) != len(colorList): + print("[ERROR]:[gradient_stops] attr not equal [colorList] attr") + self.unionValue.stopCount = min(len(colorList), len(stopList)) + for index in range(self.unionValue.stopCount): + colorStop = ColorStop() + colorStop.stop = float(stopList[index]) + colorStop.color = int(colorList[index], 16) + self.stop.append(colorStop) + break + + if "period" in attrList: + self.period = int(attributes["period"]) + if (self.period != 0): + self.isPeriod = True + + if "background_color" in attrList: + self.bgColor = int(attributes["background_color"], 16) + + def get_bytes(self): + ret = bytes(self) + if self.type == 2: + for stop in self.stop: + ret += bytes(stop) + return ret + + def get_size(self): + ret = sizeof(self) + if self.type == 2: + for stop in self.stop: + ret += sizeof(stop) + return ret \ No newline at end of file diff --git a/tools/dial_converter_tool/dial_box_progress.py b/tools/dial_converter_tool/dial_box_progress.py new file mode 100644 index 000000000..b427fe6c0 --- /dev/null +++ b/tools/dial_converter_tool/dial_box_progress.py @@ -0,0 +1,103 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Rect +from common_types import ColorStop +import img_convert + +class ProgressUnion(Union): + _fields_ = [ + ('stopCount', c_ubyte), + ('imgId', c_ushort), + ('color', c_uint), + ] + +class DialBoxProgress(Structure): + _fields_ = [ + ('cap', c_ubyte), + ('direction', c_ubyte), + ('isPeriod', c_bool), + ('bindData', c_short), + ('bgColor', c_uint), + ('type', c_ubyte), + ('rect', Rect), + ('unionValue', ProgressUnion) + ] + + def __init__(self): + self.stop = [] + self.isPeriod = False + self.period = 0 + + def parse_attributes(self, attributes): + x,y,w,h = attributes["rect"].split(" ") + self.rect.x = int(x) + self.rect.y = int(y) + self.rect.w = int(w) + self.rect.h = int(h) + + cap = attributes["cap_type"] + if cap == "round": + self.cap = 1 + else: + self.cap = 0 + + direction = attributes["direction"] + if direction == "left_to_right": + self.direction = 0 + elif direction == "right_to_left": + self.direction = 1 + elif direction == "top_to_bottom": + self.direction = 2 + elif direction == "bottom_to_top": + self.direction = 3 + + self.bindData = int(attributes["bind_data"]) + + attrList = attributes.getNames() + for attr in attrList: + if attr == "img_name": + self.unionValue.imgId = img_convert.instance.convert_img(attributes["img_name"]) + self.type = 0 + break + elif attr == "color": + self.unionValue.color = int(attributes["color"], 16) + self.type = 1 + break + elif attr == "gradient_colors": + stopList = attributes["gradient_stops"].split(" ") + colorList = attributes["gradient_colors"].split(" ") + if len(stopList) != len(colorList): + print("[ERROR]:[gradient_stops] attr not equal [colorList] attr") + self.unionValue.stopCount = min(len(colorList), len(stopList)) + for index in range(self.unionValue.stopCount): + colorStop = ColorStop() + colorStop.stop = float(stopList[index]) + colorStop.color = int(colorList[index], 16) + self.stop.append(colorStop) + self.type = 2 + break + + if "period" in attrList: + self.period = int(attributes["period"]) + if (self.period != 0) : + self.isPeriod = True + if "background_color" in attrList: + self.bgColor = int(attributes["background_color"], 16) + + def get_bytes(self): + ret = bytes(self) + if self.type == 2: + for stop in self.stop: + ret += bytes(stop) + return ret + + def get_size(self): + ret = sizeof(self) + if self.type == 2: + for stop in self.stop: + ret += sizeof(stop) + return ret \ No newline at end of file diff --git a/tools/dial_converter_tool/dial_click.py b/tools/dial_converter_tool/dial_click.py new file mode 100644 index 000000000..957dd7d2a --- /dev/null +++ b/tools/dial_converter_tool/dial_click.py @@ -0,0 +1,46 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Rect + +class ClickTypeUnion(Union): + _fields_ = [ + ('sliceId', c_uint), + ('bundleName', c_char * 64) + ] + +class DialClick(Structure): + _fields_ = [ + ('type', c_ubyte), + ('rect', Rect), + ('unionType', ClickTypeUnion), + ] + + def __init__(self): + self.period = 0 + + def parse_attributes(self, attributes): + x,y,w,h = attributes["rect"].split(" ") + self.rect.x = int(x) + self.rect.y = int(y) + self.rect.w = int(w) + self.rect.h = int(h) + + for attr in attributes.getNames(): + if attr == "action_slice": + self.unionType.sliceId = int(attributes["action_slice"]) + self.type = 0 + break + elif attr == "action_bundle": + self.unionType.bundleName = bytes(attributes["action_bundle"], encoding = "utf8") + self.type = 1 + break + + def get_bytes(self): + return bytes(self) + + def get_size(self): + return sizeof(self) \ No newline at end of file diff --git a/tools/dial_converter_tool/dial_digital_img.py b/tools/dial_converter_tool/dial_digital_img.py new file mode 100644 index 000000000..a19c1b317 --- /dev/null +++ b/tools/dial_converter_tool/dial_digital_img.py @@ -0,0 +1,71 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Point +import img_convert + +class DialDigitalImg(Structure): + _fields_ = [ + ('alignType', c_ubyte, 4), + ('integerLength', c_ubyte, 4), + ('decimalPrecision', c_ubyte), + ('imgIds', c_ushort * 10), + ('signImgId', c_ushort), + ('decimalPointImgId', c_ushort), + ('space', c_ushort), + ('alignPosition', Point), + ('bindData', c_short), + ('isPeriod', c_bool) + ] + + def __init__(self): + self.period = 0 + self.isPeriod = False + + def parse_attributes(self, attributes): + imgNames = attributes["img_names"].split(",") + length = len(imgNames) + if length < 10: + print("[ERR]:tag:[digital_img] attr[img_names] less than 10!") + sys.exit(1) + else: + for index in range(10): + self.imgIds[index] = img_convert.instance.convert_img(imgNames[index]) + + self.space = int(attributes["space"]) + alignStr = attributes["align"] + if alignStr == "right": + self.alignType = 2 + elif alignStr == "center": + self.alignType = 1 + else: + self.alignType = 0 + x,y = attributes["align_pos"].split(" ") + self.alignPosition.x = int(x) + self.alignPosition.y = int(y) + self.bindData = int(attributes["bind_data"]) + + for attr in attributes.getNames(): + if attr == "sign_img_name": + signImgName = attributes["sign_img_name"] + self.signImgId = img_convert.instance.convert_img(signImgName) + elif attr == "integer_length": + self.integerLength = int(attributes["integer_length"]) + elif attr == "img_decimal_point": + decimalPointImgName = attributes["img_decimal_point"] + self.decimalPointImgId = img_convert.instance.convert_img(decimalPointImgName) + elif attr == "decimal_precision": + self.decimalPrecision = int(attributes["decimal_precision"]) + elif attr == "period": + self.period = int(attributes["period"]) + if self.period != 0: + self.isPeriod = True + + def get_bytes(self): + return bytes(self) + + def get_size(self): + return sizeof(self) \ No newline at end of file diff --git a/tools/dial_converter_tool/dial_kaleidoscope.py b/tools/dial_converter_tool/dial_kaleidoscope.py new file mode 100644 index 000000000..450a6dbfb --- /dev/null +++ b/tools/dial_converter_tool/dial_kaleidoscope.py @@ -0,0 +1,34 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +import img_convert + +class DialKaleidoscope(Structure): + _fields_ = [ + ('imgId', c_ushort), + ('rotateEventFactor', c_float), + ('rotateAnimatorValue', c_float) + ] + + def __init__(self): + self.imgId = 0 + self.rotateEventFactor = 1.0 + self.rotateAnimatorValue = 0.0 + self.period = 0 + + def parse_attributes(self, attributes): + self.imgId = img_convert.instance.convert_img(attributes["img_name"]) + for attr in attributes.getNames(): + if attr == "crown_rotate_step": + self.rotateEventFactor = float(attributes["crown_rotate_step"]) + elif attr == "animator_rotate_step": + self.rotateAnimatorValue = float(attributes["animator_rotate_step"]) + + def get_bytes(self): + return bytes(self) + + def get_size(self): + return sizeof(self) diff --git a/tools/dial_converter_tool/dial_label.py b/tools/dial_converter_tool/dial_label.py new file mode 100644 index 000000000..a2549bf68 --- /dev/null +++ b/tools/dial_converter_tool/dial_label.py @@ -0,0 +1,85 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Rect + +class DialLabel(Structure): + _fields_ = [ + ('breakMode', c_ubyte), + ('align', c_ubyte), + ('fontSize', c_ubyte), + ('isPeriod', c_bool), + ('rect', Rect), + ('color', c_uint), + ('fontName', c_char * 64), + ('text', c_char * 64), + ('bindData', c_short) + ] + + def __init__(self): + self.period = 0 + self.isPeriod = False + + def parse_attributes(self, attributes): + x,y,w,h = attributes["rect"].split(" ") + self.rect.x = int(x) + self.rect.y = int(y) + self.rect.w = int(w) + self.rect.h = int(h) + + mode = attributes["break_mode"] + if mode == "adapt": + self.breakMode = 0 + elif mode == "stretch": + self.breakMode = 1 + elif mode == "wrap": + self.breakMode = 2 + elif mode == "ellipsis": + self.breakMode = 3 + elif mode == "marquee": + self.breakMode = 4 + elif mode == "clip": + self.breakMode = 5 + else: + self.breakMode = 3 + print("[WARING][label:break_mode]Incorrect input:", mode) + + alignStr = attributes["align"] + if alignStr == "bottom": + self.align = 4 + elif alignStr == "top": + self.align = 3 + elif alignStr == "center": + self.align = 2 + elif alignStr == "right": + self.align = 1 + elif alignStr == "left": + self.align = 0 + else: + self.align = 0 + print("[WARING][label:align]Incorrect input:", alignStr) + + self.fontSize = int(attributes["font_size"]) + self.color = int(attributes["color"], 16) + self.fontName = bytes(attributes["font"], encoding = "utf8") + self.text = bytes(attributes["text"], encoding = "utf8") + + for attr in attributes.getNames(): + if attr == "bind_data": + self.bindData = int(attributes["bind_data"]) + elif attr == "period": + self.period = int(attributes["period"]) + if self.period != 0: + self.isPeriod = True + if self.isPeriod != 0 and self.bindData == 0: + print("[ERROR]:[bind_data] is not set, [period] cannot be set") + sys.exit(1) + + def get_bytes(self): + return bytes(self) + + def get_size(self): + return sizeof(self) \ No newline at end of file diff --git a/tools/dial_converter_tool/dial_option_img.py b/tools/dial_converter_tool/dial_option_img.py new file mode 100644 index 000000000..e5e318af4 --- /dev/null +++ b/tools/dial_converter_tool/dial_option_img.py @@ -0,0 +1,48 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Point +import img_convert + +class DialOptionImg(Structure): + _fields_ = [ + ('pos', Point), + ('bindData', c_short), + ('isPeriod', c_bool), + ('count', c_ubyte), + ] + + def __init__(self): + self.imgId = [] + self.period = 0 + self.isPeriod = False + + def parse_attributes(self, attributes): + x,y = attributes["position"].split(" ") + self.pos.x = int(x) + self.pos.y = int(y) + + self.bindData = int(attributes["bind_data"]) + + imgNames = attributes["img_names"].split(",") + self.count = len(imgNames) + for img in imgNames: + imgId = img_convert.instance.convert_img(img) + self.imgId.append(imgId) + + if "period" in attributes.getNames(): + self.period = int(attributes["period"]) + if self.period != 0: + self.isPeriod = True + + def get_bytes(self): + ret = bytes(self) + for index in range(self.count): + ret += struct.pack('@H', self.imgId[index]) + return ret + + def get_size(self): + return sizeof(self) + sizeof(c_ushort) * self.count \ No newline at end of file diff --git a/tools/dial_converter_tool/dial_rotate_img.py b/tools/dial_converter_tool/dial_rotate_img.py new file mode 100644 index 000000000..a7d6e2e02 --- /dev/null +++ b/tools/dial_converter_tool/dial_rotate_img.py @@ -0,0 +1,49 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Point +import img_convert + +class DialRotateImg(Structure): + _fields_ = [ + ('pos', Point), + ('center', Point), + ('rotateStart', c_short), + ('rotaeteEnd', c_short), + ('imgId', c_ushort), + ('bindData', c_short), + ('isPeriod', c_bool) + ] + + def __init__(self): + self.period = 0 + self.isPeriod = False + + def parse_attributes(self, attributes): + x,y = attributes["position"].split(" ") + self.pos.x = int(x) + self.pos.y = int(y) + + x,y = attributes["rotate_center"].split(" ") + self.center.x = round(float(x)) + self.center.y = round(float(y)) + + self.rotateStart = int(attributes["rotate_start"]) + self.rotaeteEnd = int(attributes["rotate_end"]) + + self.bindData = int(attributes["bind_data"]) + + self.imgId = img_convert.instance.convert_img(attributes["img_name"]) + if "period" in attributes.getNames(): + self.period = int(attributes["period"]) + if self.period != 0: + self.isPeriod = True + + def get_bytes(self): + return bytes(self) + + def get_size(self): + return sizeof(self) \ No newline at end of file diff --git a/tools/dial_converter_tool/dial_sequence_img.py b/tools/dial_converter_tool/dial_sequence_img.py new file mode 100644 index 000000000..09781e851 --- /dev/null +++ b/tools/dial_converter_tool/dial_sequence_img.py @@ -0,0 +1,52 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Point +import img_convert + +class DialSequenceImg(Structure): + _fields_ = [ + ('pos', Point), + ('interval', c_ushort), + ('repeat', c_bool), + ('imgNum', c_ubyte), + ] + + def __init__(self): + self.imgId = [] + self.period = 0 + + def parse_attributes(self, attributes): + x,y = attributes["position"].split(" ") + self.pos.x = int(x) + self.pos.y = int(y) + + if attributes["repeat"].lower() == "true": + self.repeat = True + elif attributes["repeat"].lower() == "false": + self.repeat = False + + interval = int(attributes["interval"]) + if interval < 0: + print("[ERROR]: [interval] attr less than 0") + sys.exit(1) + else: + self.interval = interval + + imgNames = attributes["img_names"].split(",") + self.imgNum = len(imgNames) + for img in imgNames: + imgId = img_convert.instance.convert_img(img) + self.imgId.append(imgId) + + def get_bytes(self): + ret = bytes(self) + for index in range(self.imgNum): + ret += struct.pack('@H', self.imgId[index]) + return ret + + def get_size(self): + return sizeof(self) + sizeof(c_ushort) * self.imgNum \ No newline at end of file diff --git a/tools/dial_converter_tool/dial_static_img.py b/tools/dial_converter_tool/dial_static_img.py new file mode 100644 index 000000000..4e8302e97 --- /dev/null +++ b/tools/dial_converter_tool/dial_static_img.py @@ -0,0 +1,46 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Point +import img_convert + +class DialStaticImg(Structure): + _fields_ = [ + ('pos', Point), + ('center', Point), + ('rotate', c_float), + ('imgId', c_ushort) + ] + + def __init__(self): + self.imgId = 0 + self.pos.x = 0 + self.pos.y = 0 + self.center.x = 0 + self.center.y = 0 + self.rotate = 0.0 + self.period = 0 + + def parse_attributes(self, attributes): + x,y = attributes["position"].split(" ") + self.pos.x = int(x) + self.pos.y = int(y) + + self.imgId = img_convert.instance.convert_img(attributes["img_name"]) + + for attr in attributes.getNames(): + if attr == "center": + x,y = attributes["center"].split(" ") + self.center.x = int(x) + self.center.y = int(y) + elif attr == "rotate": + self.rotate = float(attributes["rotate"]) + + def get_bytes(self): + return bytes(self) + + def get_size(self): + return sizeof(self) diff --git a/tools/dial_converter_tool/dial_video.py b/tools/dial_converter_tool/dial_video.py new file mode 100644 index 000000000..f83c85c15 --- /dev/null +++ b/tools/dial_converter_tool/dial_video.py @@ -0,0 +1,39 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +from xml.dom.minidom import parse +from ctypes import * +from common_types import Rect +import video_convert +import img_convert + +class DialVideo(Structure): + _fields_ = [ + ('rect', Rect), + ('offset', c_uint), + ('colorKey', c_uint), + ('imgId', c_uint), + ] + + def __init__(self): + self.period = 0 + + def parse_attributes(self, attributes): + x,y,w,h = attributes["rect"].split(" ") + self.rect.x = int(x) + self.rect.y = int(y) + self.rect.w = int(w) + self.rect.h = int(h) + + self.colorKey = int(attributes["color_key"], 16) + + self.offset = video_convert.instance.convert_video(attributes["source"]) + + self.imgId = img_convert.instance.convert_img(attributes["preview_frame"]) + + def get_bytes(self): + return bytes(self) + + def get_size(self): + return sizeof(self) \ No newline at end of file diff --git a/tools/dial_converter_tool/dll/linux_cs/libcodec.so b/tools/dial_converter_tool/dll/linux_cs/libcodec.so new file mode 100644 index 000000000..1b99f0b52 Binary files /dev/null and b/tools/dial_converter_tool/dll/linux_cs/libcodec.so differ diff --git a/tools/dial_converter_tool/dll/linux_es/libcodec.so b/tools/dial_converter_tool/dll/linux_es/libcodec.so new file mode 100644 index 000000000..ddb8838c4 Binary files /dev/null and b/tools/dial_converter_tool/dll/linux_es/libcodec.so differ diff --git a/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.dll b/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.dll new file mode 100644 index 000000000..21b76ed24 Binary files /dev/null and b/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.dll differ diff --git a/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.lib b/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.lib new file mode 100644 index 000000000..fcdc59feb Binary files /dev/null and b/tools/dial_converter_tool/dll/x64/release_cs/ICE_V5R1_BLOCK_HTC.lib differ diff --git a/tools/dial_converter_tool/dll/x64/release_es/ICE_V5R1_BLOCK_HTC.dll b/tools/dial_converter_tool/dll/x64/release_es/ICE_V5R1_BLOCK_HTC.dll new file mode 100644 index 000000000..4b74cd681 Binary files /dev/null and b/tools/dial_converter_tool/dll/x64/release_es/ICE_V5R1_BLOCK_HTC.dll differ diff --git a/tools/dial_converter_tool/dll/x64/release_es/ICE_V5R1_BLOCK_HTC.lib b/tools/dial_converter_tool/dll/x64/release_es/ICE_V5R1_BLOCK_HTC.lib new file mode 100644 index 000000000..811632bbd Binary files /dev/null and b/tools/dial_converter_tool/dll/x64/release_es/ICE_V5R1_BLOCK_HTC.lib differ diff --git a/tools/dial_converter_tool/img_convert.py b/tools/dial_converter_tool/img_convert.py new file mode 100644 index 000000000..50abf979a --- /dev/null +++ b/tools/dial_converter_tool/img_convert.py @@ -0,0 +1,300 @@ +import base64 +from PIL import Image +from io import BytesIO +import cv2 +import ctypes +from ctypes import * +from PIL import Image + +import os +import sys +import struct +import time +import platform +import numpy as np +import pickle as p +import requests +import matplotlib.pyplot as pyplot + +global dll +if platform.system().lower() == 'windows': + dll = ctypes.CDLL(r".\dll\x64\release_cs\ICE_V5R1_BLOCK_HTC.dll") +elif platform.system().lower() == 'linux': + dll = ctypes.CDLL(sys.path[0] + r"/dll/linux_cs/libcodec.so") + +class Header(ctypes.Structure): + _fields_ = [ + ("width", c_uint), + ("height", c_uint), + ("stride", c_uint), + ("pixel_format", c_uint), + ("tile_width", c_uint), + ("mode_alpha", c_uint), + ("mode_rgb", c_uint) + ] + +class BsData(ctypes.Structure): + _fields_ = [ + ("bs_data", POINTER(c_ubyte)), + ("data_size", c_uint), + ("cmp_ratio", c_uint), + ("is_valid", c_uint), + ("subjective_review", c_uint), + ("para", Header) + ] + +class AutoCmpOutput(ctypes.Structure): + _fields_ = [ + ("cmp_bs0", POINTER(BsData)), + ("cmp_bs1", POINTER(BsData)), + ("cmp_bs2", POINTER(BsData)), + ("cmp_bs3", POINTER(BsData)), + ("auto_cmp_mode", c_uint), + ("valid_bs_num", c_uint) + ] + +class CmpInput(ctypes.Structure): + _fields_ = [ + ("width", c_uint), + ("height", c_uint), + ("stride", c_uint), + ("pixel_format", c_uint), + ("tile_width", c_uint), + ("mode_alpha", c_uint), + ("mode_rgb", c_uint), + ("red_channel", POINTER(c_ubyte)), + ("green_channel", POINTER(c_ubyte)), + ("blue_channel", POINTER(c_ubyte)), + ("alpha_channel", POINTER(c_ubyte)) + ] + +class AutoCmpInput(ctypes.Structure): + _fields_ =[ + ("auto_cmp_mode", c_uint), + ("high_quality_mode", c_uint), + ("high_cmp_ratio_mode", c_uint), + ("cmp_in", POINTER(CmpInput)) + ] + +class BinHeader(ctypes.Structure): + _fields_ = [ + ("dirId", c_uint), + ("count", c_uint) + ] + +class SeekInfo(ctypes.Structure): + _fields_ = [ + ("offset", c_uint), + ("size", c_uint) + ] + +class ImageHeader(ctypes.Structure): + _fields_ = [ + ("colorMode", c_uint, 8), + ("version", c_uint, 4), + ("compressMode", c_uint, 4), + ("reserved", c_uint, 16), + ("width", c_ushort), + ("height", c_ushort) + ] + +class ImageConverTool(): + binHeader = BinHeader() + binHeader.dirId = 0xfef + seekInfo = [] + imageHeader = [] + imageData = [] + imageNum = 0 + isConvertedFile = [] + + def __init__(self): + self.markCurOffset = 0 + self.width = 0 + self.height = 0 + self.file_alpha = False + self.cmp_mode = "HFBC" + self.color_fmt = ' ' + self.align = 1 + self.tile_width = 6 + self.mode_alpha = 1 + self.mode_rgb = 1 + self.auto_cmp_mode = 0 + self.high_quality_mode = 0 + self.high_cmp_ratio_mode = 0 + self.version = 1 + + def set_tile_width(self, tile_width): + if tile_width not in self.tile_width_support: + print("[ERROR]:The tile_width value is not supported.") + sys.exit(1) + + self.tile_width = tile_width + + def _convert(self): + width, height = self.image.size + self.width = width + self.height = height + self.stride_pixel = (self.width + self.align - 1) // self.align * self.align + if len(self.image.split()) > 3: + self.file_alpha = True + else: + self.file_alpha = False + + # initialize CmpInput + cmp_input = CmpInput() + self._get_cmp_input(cmp_input) + auto_cmp_input = AutoCmpInput() + self._get_auto_cmp_input(auto_cmp_input, cmp_input) + + # call GetBufferSize to get buffer size + # initialize CmpOutput + auto_cmp_output = AutoCmpOutput() + + cmp_bs0 = BsData() + buf_size0 = dll.ice_v5r1_block_get_buffer_size(byref(cmp_input)) # 压缩后输出数据的大小 + cmp_bs0.bs_data = (c_ubyte * buf_size0)() + auto_cmp_output.cmp_bs0 = ctypes.cast(pointer(cmp_bs0), POINTER(BsData)) + ret = dll.ice_v5r1_block_htc_auto_cmp(byref(auto_cmp_input), byref(auto_cmp_output)) # 对输入数据进行压缩返回值是函数正常运行标志位 + + # add imageinfo to list + self.binHeader.count += 1 + + imageInfo = ImageHeader() + imageInfo.width = self.width + imageInfo.height = self.height + imageInfo.colorMode = self._get_color_mode() + imageInfo.version = 1 + imageInfo.compressMode = 4 + imageInfo.reserved = 0 + seekInfo = SeekInfo() + seekInfo.offset = self.markCurOffset + seekInfo.size = sizeof(imageInfo) + cmp_bs0.data_size + self.markCurOffset += seekInfo.size + self.seekInfo.append(seekInfo) + self.imageHeader.append(imageInfo) + self.imageData.append(cmp_bs0) + self.imageNum += 1 + return self.imageNum + + def _check_path(self, path): + if not os.path.exists(path): + print("[ERROR]:", path, "is not exist") + return False + else: + if (not path[-3:].lower() == "png") and (not path[-3:].lower() == "jpg"): + print("[ERROR]:", path, "is not jpg or png format image") + return False + return True + + def convert_img(self, path): + if path in self.isConvertedFile: + return self.isConvertedFile.index(path) + 1 + + if not self._check_path(path): + sys.exit(1) + + self.image = Image.open(path) + if self.image.mode == 'RGBA': + self.color_fmt = 'ARGB8888' + elif self.image.mode == 'RGB': + self.color_fmt = 'RGB888' + self.isConvertedFile.append(path) + return self._convert() + + def _get_cmp_px_format(self): + if self.color_fmt == 'RGB565': + return 2 + elif self.color_fmt == 'RGB888': + return 0 + elif self.color_fmt == 'ARGB8888': + return 1 + + def _get_color_mode(self): + if self.color_fmt == 'RGB565': + return 2 + elif self.color_fmt == 'RGB888': + return 1 + elif self.color_fmt == 'ARGB8888': + return 0 + + def _get_auto_cmp_input(self, auto_cmp_input, cmp_input): + auto_cmp_input.auto_cmp_mode = self.auto_cmp_mode + auto_cmp_input.high_quality_mode = self.high_quality_mode + auto_cmp_input.high_cmp_ratio_mode = self.high_cmp_ratio_mode + auto_cmp_input.cmp_in = ctypes.cast(pointer(cmp_input), POINTER(CmpInput)) + + def _get_cmp_input(self, cmp_input): + cmp_input.width = self.width + cmp_input.height = self.height + cmp_input.stride = self.width + cmp_input.tile_width = self.tile_width + cmp_input.mode_alpha = self.mode_alpha + cmp_input.mode_rgb = self.mode_rgb + cmp_input.pixel_format = self._get_cmp_px_format() + size = self.width * self.height + red = (c_ubyte * size)() + green = (c_ubyte * size)() + blue = (c_ubyte * size)() + alpha = (c_ubyte * size)() + + for row in range(self.height): + for col in range(self.width): + position = row * self.width + col + red[position] = self.image.getdata()[position][0] + green[position] = self.image.getdata()[position][1] + blue[position] = self.image.getdata()[position][2] + if self.file_alpha == False: + alpha[position] = 0xFF + else: + alpha[position] = self.image.getdata()[position][3] + cmp_input.red_channel = red + cmp_input.green_channel = green + cmp_input.blue_channel = blue + cmp_input.alpha_channel = alpha + + def write_data_to_bin(self, fb): + fb.write(bytes(self.binHeader)) + for seek in self.seekInfo: + fb.write(bytes(seek)) + + for index in range(0, self.imageNum): + bt = bytearray() + color_fmt = self.imageHeader[index].colorMode + header = color_fmt + (self.imageHeader[index].width << 32) + \ + (self.imageHeader[index].height << 48) + (self.imageHeader[index].version << 8) + header_bin = struct.pack(" + + + + + + + + + + + + + + \ No newline at end of file diff --git a/tools/dial_converter_tool/instance/analogue_dial/preview_img.JPG b/tools/dial_converter_tool/instance/analogue_dial/preview_img.JPG new file mode 100644 index 000000000..2b1ee8358 Binary files /dev/null and b/tools/dial_converter_tool/instance/analogue_dial/preview_img.JPG differ diff --git a/tools/dial_converter_tool/instance/analogue_dial/week/FIRDAY_IMAGE_PATH.png b/tools/dial_converter_tool/instance/analogue_dial/week/FIRDAY_IMAGE_PATH.png new file mode 100644 index 000000000..9c3993262 Binary files /dev/null and b/tools/dial_converter_tool/instance/analogue_dial/week/FIRDAY_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/analogue_dial/week/MONDAY_IMAGE_PATH.png b/tools/dial_converter_tool/instance/analogue_dial/week/MONDAY_IMAGE_PATH.png new file mode 100644 index 000000000..58d2cdd29 Binary files /dev/null and b/tools/dial_converter_tool/instance/analogue_dial/week/MONDAY_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/analogue_dial/week/SATURDAY_IMAGE_PATH.png b/tools/dial_converter_tool/instance/analogue_dial/week/SATURDAY_IMAGE_PATH.png new file mode 100644 index 000000000..861ad16a8 Binary files /dev/null and b/tools/dial_converter_tool/instance/analogue_dial/week/SATURDAY_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/analogue_dial/week/SUNDAY_IMAGE_PATH.png b/tools/dial_converter_tool/instance/analogue_dial/week/SUNDAY_IMAGE_PATH.png new file mode 100644 index 000000000..1a0947185 Binary files /dev/null and b/tools/dial_converter_tool/instance/analogue_dial/week/SUNDAY_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/analogue_dial/week/THURSDAY_IMAGE_PATH.png b/tools/dial_converter_tool/instance/analogue_dial/week/THURSDAY_IMAGE_PATH.png new file mode 100644 index 000000000..a2e27c6d8 Binary files /dev/null and b/tools/dial_converter_tool/instance/analogue_dial/week/THURSDAY_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/analogue_dial/week/TUESDAY_IMAGE_PATH.png b/tools/dial_converter_tool/instance/analogue_dial/week/TUESDAY_IMAGE_PATH.png new file mode 100644 index 000000000..c5b292dcb Binary files /dev/null and b/tools/dial_converter_tool/instance/analogue_dial/week/TUESDAY_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/analogue_dial/week/WEDNESDAY_IMAGE_PATH.png b/tools/dial_converter_tool/instance/analogue_dial/week/WEDNESDAY_IMAGE_PATH.png new file mode 100644 index 000000000..e099b5661 Binary files /dev/null and b/tools/dial_converter_tool/instance/analogue_dial/week/WEDNESDAY_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/kaleidoscope_dial/BIGCIRCLE_IMAGE_PATH.png b/tools/dial_converter_tool/instance/kaleidoscope_dial/BIGCIRCLE_IMAGE_PATH.png new file mode 100644 index 000000000..e6e382277 Binary files /dev/null and b/tools/dial_converter_tool/instance/kaleidoscope_dial/BIGCIRCLE_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/kaleidoscope_dial/HOURHAND.png b/tools/dial_converter_tool/instance/kaleidoscope_dial/HOURHAND.png new file mode 100644 index 000000000..77cf955da Binary files /dev/null and b/tools/dial_converter_tool/instance/kaleidoscope_dial/HOURHAND.png differ diff --git a/tools/dial_converter_tool/instance/kaleidoscope_dial/MEDCIRCLE_IMAGE_PATH.png b/tools/dial_converter_tool/instance/kaleidoscope_dial/MEDCIRCLE_IMAGE_PATH.png new file mode 100644 index 000000000..7a47b8f21 Binary files /dev/null and b/tools/dial_converter_tool/instance/kaleidoscope_dial/MEDCIRCLE_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/kaleidoscope_dial/MINUTEHAND.png b/tools/dial_converter_tool/instance/kaleidoscope_dial/MINUTEHAND.png new file mode 100644 index 000000000..f4b1dbe0f Binary files /dev/null and b/tools/dial_converter_tool/instance/kaleidoscope_dial/MINUTEHAND.png differ diff --git a/tools/dial_converter_tool/instance/kaleidoscope_dial/SECONDHAND.png b/tools/dial_converter_tool/instance/kaleidoscope_dial/SECONDHAND.png new file mode 100644 index 000000000..147de5f68 Binary files /dev/null and b/tools/dial_converter_tool/instance/kaleidoscope_dial/SECONDHAND.png differ diff --git a/tools/dial_converter_tool/instance/kaleidoscope_dial/SMALLCIRCLE_IMAGE_PATH.png b/tools/dial_converter_tool/instance/kaleidoscope_dial/SMALLCIRCLE_IMAGE_PATH.png new file mode 100644 index 000000000..54d990129 Binary files /dev/null and b/tools/dial_converter_tool/instance/kaleidoscope_dial/SMALLCIRCLE_IMAGE_PATH.png differ diff --git a/tools/dial_converter_tool/instance/kaleidoscope_dial/kaleidoscope_dial.xml b/tools/dial_converter_tool/instance/kaleidoscope_dial/kaleidoscope_dial.xml new file mode 100644 index 000000000..4c1511eb4 --- /dev/null +++ b/tools/dial_converter_tool/instance/kaleidoscope_dial/kaleidoscope_dial.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/tools/dial_converter_tool/instance/kaleidoscope_dial/preview_img.PNG b/tools/dial_converter_tool/instance/kaleidoscope_dial/preview_img.PNG new file mode 100644 index 000000000..9d7239d5c Binary files /dev/null and b/tools/dial_converter_tool/instance/kaleidoscope_dial/preview_img.PNG differ diff --git a/tools/dial_converter_tool/instance/kaleidoscope_dial/rabbit454.png b/tools/dial_converter_tool/instance/kaleidoscope_dial/rabbit454.png new file mode 100644 index 000000000..d937bf2d3 Binary files /dev/null and b/tools/dial_converter_tool/instance/kaleidoscope_dial/rabbit454.png differ diff --git a/tools/dial_converter_tool/main.py b/tools/dial_converter_tool/main.py new file mode 100644 index 000000000..cc57403c5 --- /dev/null +++ b/tools/dial_converter_tool/main.py @@ -0,0 +1,45 @@ +#!/usr/bin/python +# coding: utf-8 +# 1\ 解析命令 python main.py -d [DIR] -o [OUT_DIR] +# 2\ 循环执行svg解析写入 +import sys +import os +import argparse +from converter import DialConvertTool + +def GetParameters(): + parser = argparse.ArgumentParser() + + parser.add_argument('-file', '-f', type=str, default='', required=False, + help='The svg file need to be converted.') + + parser.add_argument('-dir', '-d', type=str, default='', required=False, + help='The directory needs to be converted.') + + parser.add_argument('-output', type=str, default=os.getcwd() + "/out", required=False, + help='output dir') + + config = parser.parse_args() + return config + +if __name__ == "__main__": + userInput = GetParameters() + outputPath = userInput.output + inputFile = userInput.file + inputDir = userInput.dir + # Create an output folder. + print("output dir : " + outputPath) + if not os.path.exists(outputPath): + os.mkdir(outputPath) + + if not os.path.isdir(inputFile) and inputFile[-3:].lower() == "xml": + print("input file : " + inputFile) + converter = DialConvertTool() + converter.convert_xml_to_output(inputFile, outputPath) + + files = os.listdir(inputDir) + print("input dir : " + inputDir) + for file in files: + if not os.path.isdir(file) and file[-3:].lower() == "xml": + converter = DialConvertTool() + converter.convert_xml_to_output(inputDir + "/" + file, outputPath) \ No newline at end of file diff --git a/tools/dial_converter_tool/video_convert.py b/tools/dial_converter_tool/video_convert.py new file mode 100644 index 000000000..d447a166b --- /dev/null +++ b/tools/dial_converter_tool/video_convert.py @@ -0,0 +1,32 @@ +#!/usr/bin/python +# coding: utf-8 +import sys +import struct +import ctypes +from ctypes import * + +class VideoConvertTool: + def __init__(self): + self.videoNum = 0 + self.videoName = [] + self.videoIndex = [] + self.videoData = bytearray() + + def convert_video(self, path): + if path in self.videoName: + index = self.videoName.index(path) + return self.videoIndex[index] + fp = open(path, 'rb') + data = fp.read() + fp.close() + self.videoName.append(path) + self.videoNum += 1 + ret = len(self.videoData) + self.videoIndex.append(ret) + self.videoData += data + return ret + + def write_data_to_bin(self, fb): + fb.write(self.videoData) + +instance = VideoConvertTool() diff --git "a/tools/dial_converter_tool/\350\247\206\351\242\221\350\241\250\347\233\230\345\210\266\344\275\234\345\217\230\346\233\264.txt" "b/tools/dial_converter_tool/\350\247\206\351\242\221\350\241\250\347\233\230\345\210\266\344\275\234\345\217\230\346\233\264.txt" new file mode 100644 index 000000000..8a9184b60 --- /dev/null +++ "b/tools/dial_converter_tool/\350\247\206\351\242\221\350\241\250\347\233\230\345\210\266\344\275\234\345\217\230\346\233\264.txt" @@ -0,0 +1,4 @@ +新增video的预览帧功能。video标签新增属性 preview_frame。 +1、历史表盘有视频表盘需要重新用新工具生成。 +2、使用video标签实例如下 + \ No newline at end of file