From: snickersun@163.com Date: Wed, 3 Jul 2024 03:10:12 +0000 (+0800) Subject: Revert "Merge branch sdk602patch0626 into sdk602patch0521 (Conflict resolved online) X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=refs%2Fchanges%2F439%2F1;p=mirrors%2FFD230.git Revert "Merge branch sdk602patch0626 into sdk602patch0521 (Conflict resolved online) # Conflicts: # code/sdk/application/wearable/fd230app/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp # code/sdk/application/wearable/fd230app/nativeui/heart_blood/health_service/health_service.cpp " --- diff --git a/code/sdk/application/brandy/brandy_recovery/main.c b/code/sdk/application/brandy/brandy_recovery/main.c index 8ab629fa6..3f761f3c5 100755 --- a/code/sdk/application/brandy/brandy_recovery/main.c +++ b/code/sdk/application/brandy/brandy_recovery/main.c @@ -40,7 +40,6 @@ #include "arch_port.h" #include "flash_porting.h" #include "clocks_switch.h" -#include "pm_clocks.h" #include "pmu_pg.h" #include "efuse.h" #if defined(__LITEOS__) @@ -61,12 +60,9 @@ #define IMG_SEC 0 #define IMG_HIFI 1 #define SW_PRINT_DELAY 200ULL - -#define CSR_WST_VAL 0x4 -#define CSR_WST_POS 0xb -#define XIP_CACHE_INTR_MASK 0xa3006128 -#define XIP_CACHE_WRITE_DATA_DELAY_INTR_MASK 0x8 -#define XIP_CACHE_ENABLE_WRITE_INTR_MASK 0x1 +#define CSR_WST_VAL 0x4 // 向寄存器目标位写入的值(0b100) +#define CSR_WST_POS 0xb // 寄存器偏移,结合CSR_WST_VAL改变11、12、13位的值 +#define CSR_WST_MASK 0xffffc7ff extern uint32_t __l2m_gpu_text_start; extern uint32_t __l2m_gpu_text_load; @@ -76,7 +72,6 @@ extern uint32_t __l2m_gpu_bss_end; extern uint32_t __l2m_gpu_data_start; extern uint32_t __l2m_gpu_data_load; extern uint32_t __l2m_gpu_data_end; -#ifndef CONFIG_PSRAM_SUPPORT extern uint32_t __l2m_dsp_text_start; extern uint32_t __l2m_dsp_text_load; extern uint32_t __l2m_dsp_text_end; @@ -85,7 +80,6 @@ extern uint32_t __l2m_dsp_bss_end; extern uint32_t __l2m_dsp_data_start; extern uint32_t __l2m_dsp_data_load; extern uint32_t __l2m_dsp_data_end; -#endif extern char __heap_start; extern void *g_intheap_size; @@ -138,26 +132,42 @@ static void OsCacheInit(void) static void copy_from_flash_to_l2ram(void) { + errno_t ret; uint32_t size = (uint32_t)(&__l2m_gpu_text_end) - (uint32_t)(&__l2m_gpu_text_start); - (void)memcpy_s((void *)((uint32_t)(&__l2m_gpu_text_start)), size, (void *)(uint32_t)(&__l2m_gpu_text_load), size); + ret = memcpy_s((void *)((uint32_t)(&__l2m_gpu_text_start)), size, (void *)(uint32_t)(&__l2m_gpu_text_load), size); + if (ret != EOK) { + PRINT("l2m gpu text memcpy fail."NEWLINE); + } size = (uint32_t)(&__l2m_gpu_data_end) - (uint32_t)(&__l2m_gpu_data_start); - (void)memcpy_s((void *)((uint32_t)(&__l2m_gpu_data_start)), size, (void *)(uint32_t)(&__l2m_gpu_data_load), size); + ret = memcpy_s((void *)((uint32_t)(&__l2m_gpu_data_start)), size, (void *)(uint32_t)(&__l2m_gpu_data_load), size); + if (ret != EOK) { + PRINT("l2m gpu data memcpy fail."NEWLINE); + } size = (uint32_t)(&__l2m_gpu_bss_end) - (uint32_t)(&__l2m_gpu_bss_start); - (void)memset_s((void *)((uint32_t)(&__l2m_gpu_bss_start)), size, 0, size); - -#ifndef CONFIG_PSRAM_SUPPORT + ret = memset_s((void *)((uint32_t)(&__l2m_gpu_bss_start)), size, 0, size); + if (ret != EOK) { + PRINT("l2m gpu bss memset fail."NEWLINE); + } #if DSP_L2RAM_AREA_SIZE < DSP_L2RAM_AREA_TOTAL size = (uint32_t)(&__l2m_dsp_text_end) - (uint32_t)(&__l2m_dsp_text_start); - (void)memcpy_s((void *)((uint32_t)(&__l2m_dsp_text_start)), size, (void *)(uint32_t)(&__l2m_dsp_text_load), size); + ret = memcpy_s((void *)((uint32_t)(&__l2m_dsp_text_start)), size, (void *)(uint32_t)(&__l2m_dsp_text_load), size); + if (ret != EOK) { + PRINT("l2m dsp text memcpy fail."NEWLINE); + } size = (uint32_t)(&__l2m_dsp_data_end) - (uint32_t)(&__l2m_dsp_data_start); - (void)memcpy_s((void *)((uint32_t)(&__l2m_dsp_data_start)), size, (void *)(uint32_t)(&__l2m_dsp_data_load), size); + ret = memcpy_s((void *)((uint32_t)(&__l2m_dsp_data_start)), size, (void *)(uint32_t)(&__l2m_dsp_data_load), size); + if (ret != EOK) { + PRINT("l2m dsp data memcpy fail."NEWLINE); + } size = (uint32_t)(&__l2m_dsp_bss_end) - (uint32_t)(&__l2m_dsp_bss_start); - (void)memset_s((void *)((uint32_t)(&__l2m_dsp_bss_start)), size, 0, size); -#endif + ret = memset_s((void *)((uint32_t)(&__l2m_dsp_bss_start)), size, 0, size); + if (ret != EOK) { + PRINT("l2m dsp bss memset fail."NEWLINE); + } #endif } @@ -167,6 +177,7 @@ static void service_init(void) hal_register_exception_dump_callback(log_exception_dump); uapi_partition_init(); + PRINT("partition init success"NEWLINE); } static void pio_func_init(void) @@ -231,10 +242,7 @@ static void chip_xip_init(void) { hal_xip_init(); hal_xip_config_interrupt_type(XIP_0, XIP_INTR_NMI); - write_csr(0x7d0, read_csr(0x7d0) | (CSR_WST_VAL << CSR_WST_POS)); - // Mask interrupts caused by CACHE2AHBM module state machine timeout - reg16_clrbit(XIP_CACHE_INTR_MASK, XIP_CACHE_WRITE_DATA_DELAY_INTR_MASK); - reg16_clrbit(XIP_CACHE_INTR_MASK, XIP_CACHE_ENABLE_WRITE_INTR_MASK); + write_csr(0x7d0, (read_csr(0x7d0) & CSR_WST_MASK) | (CSR_WST_VAL << CSR_WST_POS)); // 调整写cache的阈值,防止opi xip报nmi中断 } static void chip_enable_ulp_ram(void) @@ -243,17 +251,6 @@ static void chip_enable_ulp_ram(void) writew(0x5700450c, 0x1); } -static void clocks_set_xip_div(void) -{ - // xip cache div = 2 - writew(0xa3006014, 0x1); // sync mode = 1, high freq - regw_clrbits(0xa3006000, 0x24, 0x0, 0x1); // close xip cache clk en - regw_clrbits(0xa3006000, 0x24, 0x3, 0x1); // close xip cache div en - regw_setbits(0xa3006000, 0x24, 0x4, 0x2, 0x2); // xip cache div = 2 from xip_opi - regw_setbits(0xa3006000, 0x24, 0x3, 0x1, 0x1); // open xip cache div en - regw_setbits(0xa3006000, 0x24, 0x0, 0x1, 0x1); // open xip cache clk en -} - static void chip_init(void) { chip_enable_ulp_ram(); @@ -280,8 +277,7 @@ static void chip_init(void) uapi_dma_init(); uapi_dma_open(); - clocks_set_xip_div(); - uapi_clocks_init(); + cpu_trace_enable_mcpu_repeat(); uapi_pm_control(PM_SDIO_POWER_UP_AND_RUN); } diff --git a/code/sdk/application/brandy/brandy_standard/thread_init.c b/code/sdk/application/brandy/brandy_standard/thread_init.c index ba6357925..ca5eaea39 100755 --- a/code/sdk/application/brandy/brandy_standard/thread_init.c +++ b/code/sdk/application/brandy/brandy_standard/thread_init.c @@ -74,9 +74,6 @@ #include "time.h" #include "log_panic.h" #include "nandflash_config.h" -#ifdef SUPPORT_AUTO_OTA -#include "auto_ota_service.h" -#endif #define EMMC_BASE_ADDR 0x52062000 @@ -90,7 +87,6 @@ #define TASK_PRIORITY_DFX_MSG (osPriority_t)(18) #define TASK_PRIORITY_TRANSMIT (osPriority_t)(20) #define TASK_PRIORITY_SAVE_FILE (osPriority_t)(36) -#define TASK_PRIORITY_AUTO_OTA (osPriority_t)(36) #define BTH_SDK_STACK_SIZE 0xC00 #define AT_GRAPHIC_STACK_SIZE 0xC00 @@ -103,7 +99,6 @@ #define AT_OHOSFWK_STACK_SIZE 0xC00 #define APP_MAIN_STACK_SIZE 0xC00 #define SAVE_FILE_STACK_SIZE 0xC00 -#define AUTO_OTA_STACK_SIZE 0xC00 #define TIME_MAX 64 #define USEC_TO_MILLI 1000 @@ -135,7 +130,7 @@ app_task_definition_t g_app_tasks[] = { { { "bt_sdk", 0, NULL, 0, NULL, BTH_SDK_STACK_SIZE, TASK_PRIORITY_SDK, 0, 0 }, (osThreadFunc_t)bt_acore_task_main, NULL, NULL, USE_DTCM_MEM }, #ifdef SUPPORT_AT_CMD - { { "at_cmd", 0, NULL, 0, NULL, 0xC00, TASK_PRIORITY_APP, 0, 0 }, + { { "at_cmd", 0, NULL, 0, NULL, 0x1C00, TASK_PRIORITY_APP, 0, 0 }, (osThreadFunc_t)at_cmd_task_process_handler, NULL, (CreateQueueFunction_t)at_cmd_task_queue_init, USE_EXTEND_MEM }, #endif @@ -181,10 +176,6 @@ app_task_definition_t g_app_tasks[] = { #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 }, -#ifdef SUPPORT_AUTO_OTA - { { "auto_ota", 0, NULL, 0, NULL, AUTO_OTA_STACK_SIZE, TASK_PRIORITY_AUTO_OTA, 0, 0 }, - (osThreadFunc_t)auto_ota_task_main, NULL, NULL, USE_EXTEND_MEM }, -#endif }; osSemaphoreId_t get_save_file_semaphore(void) diff --git a/code/sdk/application/wearable/CMakeLists.txt b/code/sdk/application/wearable/CMakeLists.txt index fc120e421..955d2b24c 100755 --- a/code/sdk/application/wearable/CMakeLists.txt +++ b/code/sdk/application/wearable/CMakeLists.txt @@ -12,6 +12,3 @@ add_subdirectory_if_exist(service) add_subdirectory_if_exist(ohos_startup) add_subdirectory_if_exist(xts_adapt) add_subdirectory_if_exist(alipay) -if("SUPPORT_AUTO_OTA" IN_LIST DEFINES) - add_subdirectory_if_exist(auto_ota) -endif() \ No newline at end of file diff --git a/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c b/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c index d311c6554..0d0072a87 100644 --- a/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c +++ b/code/sdk/application/wearable/alipay/service/alipay_bluetooth.c @@ -14,49 +14,32 @@ #include "osal_task.h" #include "alipay_feature.h" #include "securec.h" -#ifdef SUPPORT_AT_OHOSFWK -#include "BluetoothWrapper.h" +#ifdef JS_ENABLE +#include "msg_center_msg.h" #endif +#include "wearable_log.h" +#ifdef SUPPORT_ALIPAY_SEC +#include "bleService.h" +#include "alipay_bluetooth.h" -/* Gatt service UUID */ -#define ALIPAYY_SERVICE_ID 0x0238 -/* Gatt Characteristic UUID */ -#define ALIPAYY_CHARACTERISTIC_ID 0x024A -/* Client Characteristic Configuration UUID */ -#define ALIPAYY_BLE_UUID_CLIENT_CHARACTERISTIC_CONF 0x2902 -/* Gatt Characteristic max length */ -#define ALIPAY_CHARACTERISTIC_MAX_LENGTH 256 -#define ALIPAY_BLE_ADV_ID 1 -#define ALIPAY_BLE_ADV_DATA_MAX_LENGTH 31 -#define ALIPAY_BLE_ADV_BLE_NAME_MAX_LENGTH 13 // 31-4-2-3-9 = 13 -#define ALIPAY_BLE_NAME_LENGTH 20 -#define ALIPAY_BLE_ADV_MAC_HEAD_LENTH 4 -#define ALIPAY_BLE_ADV_MAC_LENTH 10 -#define ALIPAY_BLE_ADV_TYPE_LENTH 3 -#define ALIPAY_BLE_ADV_UUID_LENTH 4 -#define ALIPAY_BLE_DEFAULT_NAME "WatchDemo" -#define ALIPAY_BLE_DEFAULT_NAME_LEN 9 -#define ALIPAY_DESC_HANDLE_NUM 2 - +static uint8_t alipay_scan_data[16] ={0}; // Alipay 蓝牙模块全局变量 static gap_ble_callbacks_t g_alipay_gapble_cbs; static gatts_callbacks_t g_alipay_gatts_cbs; static bool g_alipay_adv_start_state = false; static uint16_t g_alipay_server_id = 1; -static uint16_t g_alipay_characteristic_handle = 0; -static uint16_t g_alipay_descriptor_handle[ALIPAY_DESC_HANDLE_NUM] = { 0 }; -static uint16_t g_alipay_svr_handle = 0; +static uint16_t g_alipay_server_handle = 0; static uint16_t g_alipay_conn_id = 0; static uint8_t g_alipay_character_buf[ALIPAY_CHARACTERISTIC_MAX_LENGTH] = {0}; static bool g_alipay_ble_init_flag = false; static const uint8_t alipay_adv_type[ALIPAY_BLE_ADV_TYPE_LENTH] = {2, 1, 2}; static const uint8_t alipay_adv_uuid[ALIPAY_BLE_ADV_UUID_LENTH] = {0x3, 0x3, 0x02, 0x38}; -static bool svr_alipay_get_adv_start_state(void) +bool svr_alipay_get_adv_start_state(void) { return g_alipay_adv_start_state; } -static void svr_alipay_set_adv_start_state(bool state) +void svr_alipay_set_adv_start_state(bool state) { g_alipay_adv_start_state = state; } @@ -65,37 +48,57 @@ void svr_alipay_ble_adv_stop(void) { gap_ble_stop_adv(ALIPAY_BLE_ADV_ID); } - +void svr_alipay_ble_adv_start_t(void) +{ + gap_ble_start_adv(ALIPAY_BLE_ADV_ID); +} /* adapt ios adv data. */ static void svr_alipay_ble_adv_data_set(int adv_id) { - uint8_t ble_name[ALIPAY_BLE_NAME_LENGTH] = {0}; - uint8_t ble_name_len = ALIPAY_BLE_NAME_LENGTH; - uint8_t adv_data[ALIPAY_BLE_ADV_DATA_MAX_LENGTH] = {0}; + uint8_t ble_name[32] = {0}; + uint8_t ble_name_len = 32; + uint8_t adv_data[31] = {0}; uint8_t adv_data_len = 0; - uint8_t ble_data_name[ALIPAY_BLE_ADV_BLE_NAME_MAX_LENGTH + 1 ] = {0}; // +TYPE LENGTH + uint8_t scan_data_len = 0; + uint8_t ble_data_name[13 + 1 ] = {0}; // +TYPE LENGTH uint8_t ble_data_mac_switch[BD_ADDR_LEN] = {0}; - uint8_t adv_mac_head[ALIPAY_BLE_ADV_MAC_LENTH] = {0x9, 0x16, 0x02, 0x38}; + uint8_t adv_mac_head[10] = {0x9, 0x16, 0x02, 0x38}; gap_ble_config_adv_data_t adv_data_info; memset_s(&adv_data_info, sizeof(gap_ble_config_adv_data_t), 0, sizeof(gap_ble_config_adv_data_t)); + unsigned char addr[6] = {0}; + unsigned int len = 6; + errcode_t ret = 0; + + + bd_addr_t addr_info; + memset(addr,0,6); + bluetooth_get_local_addr(&addr[0],len); + char watchName[32]; + memset_s(watchName, sizeof(watchName), 0, sizeof(watchName)); + (void)sprintf_s(watchName, sizeof(watchName), "%s",ALIPAY_BLE_DEFAULT_NAME); + // (void)sprintf_s(watchName, sizeof(watchName), "%s",BLE_DEFAULT_NAME); + + ret = bluetooth_set_local_name((unsigned char*)watchName, strlen((char*)watchName) + 1); + if (ret == false) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bt SetLocalName ret = 0x%x", ret); + } - int32_t ret = gap_ble_get_local_name(ble_name, &ble_name_len); + + ret = bluetooth_get_local_name(ble_name, &ble_name_len); if (ret != 0) { - ALIPAY_PRINT_ERR(0, "gap_ble_get_local_name fail, name:%s,len:%u,ret:%u.", ble_name, ble_name_len, ret); - memset_s(ble_name, ALIPAY_BLE_NAME_LENGTH, 0, ALIPAY_BLE_NAME_LENGTH); - memcpy_s(ble_name, ALIPAY_BLE_NAME_LENGTH, ALIPAY_BLE_DEFAULT_NAME, ALIPAY_BLE_DEFAULT_NAME_LEN); - ble_name_len = ALIPAY_BLE_DEFAULT_NAME_LEN + 1; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_ble_get_local_name fail, name:%s,len:%u,ret:%u.", ble_name, ble_name_len, ret); + memset_s(ble_name, 32, 0, 32); + memcpy_s(ble_name, 32,ALIPAY_BLE_DEFAULT_NAME, 32); + ble_name_len = 32 + 1; } - ALIPAY_PRINT_DEBUG(0, "gap_ble_get_local_name name:%s,len:%u,ret:%u.", ble_name, ble_name_len, ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_ble_get_local_name name:%s,len:%u,ret:%u.", ble_name, ble_name_len, ret); - bd_addr_t addr_info; - ret = gap_ble_get_local_addr(&addr_info); - ALIPAY_PRINT_DEBUG(0, "gap_ble_get_local_addr, ret:%u.", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "gap_ble_get_local_addr, ret:%u.", ret); memcpy_s(adv_data, sizeof(alipay_adv_type), alipay_adv_type, sizeof(alipay_adv_type)); adv_data_len = sizeof(alipay_adv_type); - if (ble_name_len > ALIPAY_BLE_ADV_BLE_NAME_MAX_LENGTH) { - ble_name_len = ALIPAY_BLE_ADV_BLE_NAME_MAX_LENGTH; + if (ble_name_len > 13) { + ble_name_len = 13; } ble_data_name[0] = ble_name_len; ble_data_name[1] = 0x9; @@ -104,24 +107,44 @@ static void svr_alipay_ble_adv_data_set(int adv_id) memcpy_s(adv_data + adv_data_len, ble_name_len + 1, ble_data_name, ble_name_len + 1); adv_data_len = adv_data_len + ble_name_len + 1; - memcpy_s(adv_data + adv_data_len, sizeof(alipay_adv_uuid), alipay_adv_uuid, sizeof(alipay_adv_uuid)); - adv_data_len = adv_data_len + sizeof(alipay_adv_uuid); + // memcpy_s(adv_data + adv_data_len, sizeof(alipay_adv_uuid), alipay_adv_uuid, sizeof(alipay_adv_uuid));//这是tx power + // adv_data_len = adv_data_len + sizeof(alipay_adv_uuid); + int k = BD_ADDR_LEN; for (int i = 0; i < BD_ADDR_LEN; i++) { - ble_data_mac_switch[--k] = addr_info.addr[i]; + ble_data_mac_switch[--k] = addr[i]; } - ALIPAY_PRINT_DEBUG(0, "ble_info:%02x:%02x:%02x:%02x:%02x:%02x", ble_data_mac_switch[0], ble_data_mac_switch[1], + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ble_info:%02x:%02x:%02x:%02x:%02x:%02x", ble_data_mac_switch[0], ble_data_mac_switch[1], ble_data_mac_switch[2], ble_data_mac_switch[3], ble_data_mac_switch[4], ble_data_mac_switch[5]); - memcpy_s(adv_mac_head + ALIPAY_BLE_ADV_MAC_HEAD_LENTH, BD_ADDR_LEN, ble_data_mac_switch, BD_ADDR_LEN); + memcpy_s(adv_mac_head + 4, BD_ADDR_LEN, ble_data_mac_switch, BD_ADDR_LEN); memcpy_s(adv_data + adv_data_len, sizeof(adv_mac_head), adv_mac_head, sizeof(adv_mac_head)); adv_data_len = adv_data_len + sizeof(adv_mac_head); - adv_data_info.adv_data = adv_data; - adv_data_info.adv_length = adv_data_len; - ALIPAY_PRINT_DEBUG(0, "adv_data_info.adv_length:%u.", adv_data_len); - - gap_ble_set_adv_data(adv_id, &adv_data_info); + memset(alipay_scan_data,0,16); + + alipay_scan_data[0] = 0x09;//长度 + alipay_scan_data[1] = 0xff;//数据类型 manufactory data + alipay_scan_data[2] = 'J'; + alipay_scan_data[3] = 'H'; + alipay_scan_data[4] = ble_data_mac_switch[0]; + alipay_scan_data[5] = ble_data_mac_switch[1]; + alipay_scan_data[6] = ble_data_mac_switch[2]; + alipay_scan_data[7] = ble_data_mac_switch[3]; + alipay_scan_data[8] = ble_data_mac_switch[4]; + alipay_scan_data[9] = ble_data_mac_switch[5]; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "adv_data_info.adv_length.scan_data_len:%d\r\n",scan_data_len); + scan_data_len = 10; + if (scan_data_len > 16){ + scan_data_len = 16; + } + adv_data_info.scan_rsp_data = alipay_scan_data;//扫描数据 + adv_data_info.scan_rsp_length = scan_data_len;//扫描长度 + adv_data_info.adv_data = adv_data;//广播数据 + adv_data_info.adv_length = adv_data_len;//广播长度 + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "adv_data_info.adv_length:%u. scan_data_len:%d\r\n", adv_data_len,scan_data_len); + ret = gap_ble_set_adv_data(adv_id, &adv_data_info); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "alipay avd:%x\r\n", ret); return; } @@ -146,31 +169,40 @@ void svr_alipay_ble_adv_start(void) gap_ble_set_adv_param(adv_id, &adv_para); gap_ble_set_local_appearance(GAP_BLE_APPEARANCE_TYPE_GENERIC_WATCH); svr_alipay_ble_adv_data_set(adv_id); - bool ret = gap_ble_start_adv(adv_id); + errcode_t ret = gap_ble_start_adv(adv_id); if (ret) { - ALIPAY_PRINT_ERR(0, "svr_alipay_ble_adv_start bt gap_ble_start_adv ret = 0x%x", ret); + ALIPAY_PRINT_ERR(0, "svr_alipay_ble_adv_start bt gap_ble_start_adv errror ret = 0x%x", ret); } - ALIPAY_PRINT_DEBUG(0, "svr_alipay_ble_adv_start bt gap_ble_start_adv ret = 0x%x", ret); + ALIPAY_PRINT_ERR(0, "svr_alipay_ble_adv_start bt gap_ble_start_adv ret = 0x%x", ret); } - +// extern void svr_alipay_reset_init(void); static void svr_alipay_ble_connstate_change_cb(unsigned short 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) + { - ALIPAY_PRINT_DEBUG(0, "BleConnStateChangeCallback conn_id 0x%x, conn_state 0x%x, pair_state 0x%x", conn_id, + ALIPAY_PRINT_ERR(0, "BleConnStateChangeCallback conn_id 0x%x, conn_state 0x%x, pair_state 0x%x", conn_id, conn_state, pair_state); - if (GAP_BLE_STATE_DISCONNECTED == conn_state) { - g_alipay_conn_id = 0; + 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 { - g_alipay_conn_id = conn_id; + svr_alipay_set_adv_start_state(false); + #ifdef JS_ENABLE + SendMsgToMsgCenterService(BT_CONNECTED_TO_MSGCENTER, 0, NULL, 0); + #endif } } static void svr_alipay_ble_adv_start_cb(uint8_t adv_id, adv_status_t status) { - if (adv_id == ALIPAY_BLE_ADV_ID) { - ALIPAY_PRINT_DEBUG(0, "BleAdvStartCallback adv_id: %d, status:%d\n", adv_id, status); - svr_alipay_set_adv_start_state(true); - } + ALIPAY_PRINT_DEBUG(0, "BleAdvStartCallback adv_id: %d, status:%d\n", adv_id, status); + svr_alipay_set_adv_start_state(true); } static void svr_alipay_ble_set_adv_data_cb(uint8_t adv_id, errcode_t status) @@ -178,28 +210,20 @@ static void svr_alipay_ble_set_adv_data_cb(uint8_t adv_id, errcode_t status) ALIPAY_PRINT_DEBUG(0, "BleAdvSetDataCallback adv_id: %d, status:%d\n", adv_id, status); } -static void svr_alipay_ble_terminate_adv_cb(uint8_t adv_id, adv_status_t status) -{ - if (adv_id == ALIPAY_BLE_ADV_ID) { - ALIPAY_PRINT_DEBUG(0, "BleTerminateAdvCallback adv_id: %d, status:%d\n", adv_id, status); - svr_alipay_set_adv_start_state(false); - } -} - static void svr_alipay_ble_adv_stop_cb(uint8_t adv_id, adv_status_t status) { - if (adv_id == ALIPAY_BLE_ADV_ID) { - ALIPAY_PRINT_DEBUG(0, "BleAdvStopCallback adv_id: %d, status:%d\n", adv_id, status); - svr_alipay_set_adv_start_state(false); - } + ALIPAY_PRINT_DEBUG(0, "BleAdvStopCallback adv_id: %d, status:%d\n", adv_id, status); } - +// static uint16_t alipay_server_handle = 0; static void svr_alipay_bt_gatts_service_add_cb(uint8_t server_id, bt_uuid_t *uuid, uint16_t srv_handle, errcode_t status) { - if ((uuid->uuid_len == sizeof(uint16_t)) && (*((uint16_t *)uuid->uuid) == ALIPAYY_SERVICE_ID)) { - ALIPAY_PRINT_DEBUG(0, "BtGattsServiceAddCallback 0x%x 0x%x 0x%x 0x%x", - status, server_id, srv_handle, *((uint16_t *)uuid->uuid)); + // alipay_server_handle = srv_handle; + ALIPAY_PRINT_DEBUG(0, "BtGattsServiceAddCallback 0x%x 0x%x 0x%x 0x%x", status, server_id, srv_handle, + *((uint16_t *)uuid->uuid)); + int ret; + // if ((uuid->uuid_len == sizeof(uint16_t)) && (*((uint16_t *)uuid->uuid) == ALIPAYY_SERVICE_ID)) + { uint16_t id = ALIPAYY_CHARACTERISTIC_ID; gatts_add_chara_info_t character; uint16_t value = 0; @@ -213,20 +237,23 @@ static void svr_alipay_bt_gatts_service_add_cb(uint8_t server_id, bt_uuid_t *uui character.value_len = ALIPAY_CHARACTERISTIC_MAX_LENGTH; character.value = g_alipay_character_buf; - int ret = gatts_add_characteristic(server_id, srv_handle, &character); + ret = gatts_add_characteristic(server_id, srv_handle, &character); if (ret != ERRCODE_SUCC) { ALIPAY_PRINT_ERR(0, "gatts_add_characteristic fail, ret:%u.\r\n", ret); } - g_alipay_svr_handle = srv_handle; } } static void svr_alipay_bt_gatts_characteristic_add_cb(uint8_t server_id, bt_uuid_t *uuid, uint16_t srv_handle, gatts_add_character_result_t *result, errcode_t status) { - if ((uuid->uuid_len == sizeof(uint16_t)) && (*((uint16_t *)uuid->uuid) == ALIPAYY_CHARACTERISTIC_ID)) { - ALIPAY_PRINT_DEBUG(0, "BtGattsCharacteristicAddCallback 0x%x 0x%x 0x%x 0x%x 0x%x", - status, server_id, srv_handle, result->handle, result->value_handle); + ALIPAY_PRINT_DEBUG(0, "BtGattsCharacteristicAddCallback 0x%x 0x%x 0x%x 0x%x 0x%x", status, server_id, srv_handle, + result->handle, result->value_handle); + + g_alipay_server_handle = result->value_handle; + + // if ((uuid->uuid_len == sizeof(uint16_t)) && (*((uint16_t *)uuid->uuid) == ALIPAYY_CHARACTERISTIC_ID)) + { uint8_t bas_ccc_val[] = { 0x01, 0x00 @@ -264,28 +291,73 @@ static void svr_alipay_bt_gatts_characteristic_add_cb(uint8_t server_id, bt_uuid if (ret != ERRCODE_SUCC) { ALIPAY_PRINT_ERR(0, "gatts_start_service fail, ret:%u.\r\n", ret); } - g_alipay_characteristic_handle = result->value_handle; } } - +//添加alipay 特征和描述符 +void svr_alipay_bt_gatts_characteristic_add_dec(uint8_t server_id,uint16_t srv_handle) +{ + int ret = 0; + uint16_t id = ALIPAYY_CHARACTERISTIC_ID; + gatts_add_chara_info_t character; + uint16_t value = 0; + + memset_s(&character, sizeof(gatts_add_chara_info_t), 0, sizeof(gatts_add_chara_info_t)); + character.chara_uuid.uuid_len = sizeof(id); + memcpy_s(character.chara_uuid.uuid, sizeof(character.chara_uuid.uuid), (char *)&id, sizeof(id)); + character.permissions = GATT_ATTRIBUTE_PERMISSION_READ | GATT_ATTRIBUTE_PERMISSION_WRITE; + character.properties = + GATT_CHARACTER_PROPERTY_BIT_READ | GATT_CHARACTER_PROPERTY_BIT_WRITE | GATT_CHARACTER_PROPERTY_BIT_NOTIFY; + character.value_len = ALIPAY_CHARACTERISTIC_MAX_LENGTH; + character.value = g_alipay_character_buf; + + ret = gatts_add_characteristic(server_id, srv_handle, &character); + if (ret != ERRCODE_SUCC) { + ALIPAY_PRINT_ERR(0, "gatts_add_characteristic fail, ret:%u.\r\n", ret); + } + uint8_t bas_ccc_val[] = { + 0x01, + 0x00 + }; + bt_uuid_t ccc_uuid = { 0 }; + bts_data_to_uuid_len2(0x2902, &ccc_uuid); + gatts_add_desc_info_t descriptor; + descriptor.desc_uuid = ccc_uuid; + descriptor.permissions = GATT_ATTRIBUTE_PERMISSION_READ | GATT_ATTRIBUTE_PERMISSION_WRITE; + descriptor.value_len = (uint16_t)sizeof(bas_ccc_val); + descriptor.value = bas_ccc_val; + + ret = gatts_add_descriptor(server_id, srv_handle, &descriptor); + if (ret != ERRCODE_SUCC) { + ALIPAY_PRINT_ERR(0, "gatts_add_descriptor fail, ret:%u.\r\n", ret); + } + bd_addr_t addr_info; + gatts_add_desc_info_t descriptor_ap; + gap_ble_get_local_addr(&addr_info); + bts_data_to_uuid_len2(0x4b02, &ccc_uuid); + descriptor_ap.desc_uuid = ccc_uuid; + descriptor_ap.permissions = GATT_ATTRIBUTE_PERMISSION_READ | GATT_ATTRIBUTE_PERMISSION_WRITE; + descriptor_ap.value_len = BD_ADDR_LEN; + uint8_t ble_data_mac_switch[BD_ADDR_LEN] = {0}; + int k = BD_ADDR_LEN; + for (int i = 0; i < BD_ADDR_LEN; i++) { + ble_data_mac_switch[--k] = addr_info.addr[i]; + } + descriptor_ap.value = ble_data_mac_switch; + ret = gatts_add_descriptor(server_id, srv_handle, &descriptor_ap); + if (ret != ERRCODE_SUCC) { + ALIPAY_PRINT_ERR(0, "gatts_add_descriptor second fail, ret:%u.\r\n", ret); + } +} static void svr_alipay_bt_gatts_descriptor_add_cb(uint8_t server_id, bt_uuid_t *uuid, uint16_t srv_handle, uint16_t desc_handle, errcode_t status) { - if (g_alipay_svr_handle == srv_handle) { - ALIPAY_PRINT_DEBUG(0, "BtGattsDescriptorAddCallback 0x%x 0x%x 0x%x 0x%x", status, server_id, srv_handle, - desc_handle); - static uint8_t desc_handle_count = 0; - desc_handle_count = desc_handle_count % ALIPAY_DESC_HANDLE_NUM; - g_alipay_descriptor_handle[desc_handle_count] = desc_handle; - desc_handle_count++; - } + ALIPAY_PRINT_DEBUG(0, "BtGattsDescriptorAddCallback 0x%x 0x%x 0x%x 0x%x", status, server_id, srv_handle, + desc_handle); } static void svr_alipay_bt_gatts_service_start_cb(uint8_t server_id, uint16_t srv_handle, errcode_t status) { - if (g_alipay_svr_handle == srv_handle) { - ALIPAY_PRINT_DEBUG(0, "BtGattsServiceStartCallback 0x%x 0x%x 0x%x", status, server_id, srv_handle); - } + ALIPAY_PRINT_DEBUG(0, "BtGattsServiceStartCallback 0x%x 0x%x 0x%x", status, server_id, srv_handle); } static void svr_alipay_bt_gatts_service_stop_cb(uint8_t server_id, uint16_t srv_handle, errcode_t status) @@ -307,16 +379,11 @@ static void svr_alipay_bt_gatts_req_read_cb(uint8_t server_id, uint16_t conn_id, static void svr_alipay_bt_gatts_req_write_cb(uint8_t server_id, uint16_t conn_id, gatts_req_write_cb_t *write_cb_para, errcode_t status) { - if ((g_alipay_characteristic_handle == write_cb_para->handle) || - (g_alipay_descriptor_handle[0] == write_cb_para->handle) || - (g_alipay_descriptor_handle[1] == write_cb_para->handle)) { - ALIPAY_PRINT_DEBUG(0, "write callback,handle:%u str:%s len:%u", - write_cb_para->handle, write_cb_para->value, write_cb_para->length); - uint8_t *msg_data = write_cb_para->value; - errcode_t ret = svr_alipay_msg_write(ALIPAY_MSG_BT, msg_data, write_cb_para->length, false); - if (ret != ERRCODE_SUCC) { - ALIPAY_PRINT_ERR(0, "svr_alipay_msg_write fail, ret:%u.\r\n", ret); - } + ALIPAY_PRINT_ERR(0, "write callback,str:%s len:%u", write_cb_para->value, write_cb_para->length); + uint8_t *msg_data = write_cb_para->value; + errcode_t ret = svr_alipay_msg_write(ALIPAY_MSG_BT, msg_data, write_cb_para->length, false); + if (ret != ERRCODE_SUCC) { + ALIPAY_PRINT_ERR(0, "svr_alipay_msg_write fail, ret:%u.\r\n", ret); } return; } @@ -324,13 +391,13 @@ static void svr_alipay_bt_gatts_req_write_cb(uint8_t server_id, uint16_t conn_id void svr_alipay_bt_gatts_noyify(uint8_t *data, uint16_t data_len) { gatts_ntf_ind_t data_info; - data_info.attr_handle = g_alipay_characteristic_handle; + data_info.attr_handle = alipay_handle; data_info.value = data; data_info.value_len = data_len; - errcode_t ret = gatts_notify_indicate(g_alipay_server_id, g_alipay_conn_id, &data_info); - ALIPAY_PRINT_DEBUG(0, "gatts_notify_indicate ret:0x%x. serverid:%u,conn_id:%u,handle:%u.", ret, g_alipay_server_id, - g_alipay_conn_id, g_alipay_characteristic_handle); + errcode_t ret = gatts_notify_indicate(g_ble_server_id, g_ble_conn_id, &data_info); + ALIPAY_PRINT_ERR(0, "gatts_notify_indicate ret:0x%x. serverid:%u,conn_id:%u,handle:%u.", ret, g_ble_server_id, + g_ble_conn_id, alipay_handle); } static void svr_alipay_btcallback_reg(void) @@ -339,12 +406,7 @@ static void svr_alipay_btcallback_reg(void) g_alipay_gapble_cbs.start_adv_cb = svr_alipay_ble_adv_start_cb; g_alipay_gapble_cbs.stop_adv_cb = svr_alipay_ble_adv_stop_cb; g_alipay_gapble_cbs.set_adv_data_cb = svr_alipay_ble_set_adv_data_cb; - g_alipay_gapble_cbs.terminate_adv_cb = svr_alipay_ble_terminate_adv_cb; -#ifndef SUPPORT_AT_OHOSFWK gap_ble_register_callbacks(&g_alipay_gapble_cbs); -#else - wrapper_gap_ble_register_callbacks(&g_alipay_gapble_cbs); -#endif g_alipay_gatts_cbs.add_service_cb = svr_alipay_bt_gatts_service_add_cb; g_alipay_gatts_cbs.add_characteristic_cb = svr_alipay_bt_gatts_characteristic_add_cb; @@ -355,58 +417,64 @@ static void svr_alipay_btcallback_reg(void) g_alipay_gatts_cbs.read_request_cb = svr_alipay_bt_gatts_req_read_cb; g_alipay_gatts_cbs.write_request_cb = svr_alipay_bt_gatts_req_write_cb; g_alipay_gatts_cbs.mtu_changed_cb = NULL; -#ifndef SUPPORT_AT_OHOSFWK gatts_register_callbacks(&g_alipay_gatts_cbs); -#else - wrapper_gatts_register_callbacks(&g_alipay_gatts_cbs); -#endif } +//gatts_unregister_server void svr_alipay_bt_init_gatts(void) { - uint16_t service_id = ALIPAYY_SERVICE_ID; - uint8_t server_id = 0; - bt_uuid_t uuid; int ret; - - uuid.uuid_len = sizeof(service_id); - memcpy_s(uuid.uuid, sizeof(uuid.uuid), (char *)&service_id, sizeof(service_id)); -#ifndef SUPPORT_AT_OHOSFWK - ret = gatts_register_server(&uuid, &server_id); /* 注册gatt server */ -#else - ret = wrapper_gatts_register_server(&uuid, &server_id); /* 注册gatt server */ -#endif + bt_uuid_t alipay_service_uuid = {0}; + bts_data_to_uuid_len2(ALIPAYY_SERVICE_ID, &alipay_service_uuid); + //只有一个服务,永远是1 + ret = gatts_add_service(1, &alipay_service_uuid, true); if (ret != ERRCODE_SUCC) { - ALIPAY_PRINT_ERR(0, "gatts_register_server ret:%u.\r\n", ret); - } - ALIPAY_PRINT_DEBUG(0, "gatts_register_server ret: 0x%x server_id = 0x%x", ret, server_id); - g_alipay_server_id = server_id; - uuid.uuid_len = sizeof(service_id); - memcpy_s(uuid.uuid, sizeof(uuid.uuid), (char *)&service_id, sizeof(service_id)); -#ifndef SUPPORT_AT_OHOSFWK - ret = gatts_add_service(server_id, &uuid, true); -#else - ret = wrapper_gatts_add_service(server_id, &uuid, true); -#endif - if (ret != ERRCODE_SUCC) { - ALIPAY_PRINT_ERR(0, "gatts_add_service ret:%u.\r\n", ret); + ALIPAY_PRINT_ERR(0, "svr_alipay_bt_init_gatts ret:%u.\r\n", ret); } + return; + // uint16_t id = ALIPAYY_SERVICE_ID; + // uint16_t srevr_id = ALIPAYY_SERVICE_ID; + // uint16_t ser_id = 0x1fff; + // uint8_t serverId = 0; + // bt_uuid_t uuid; + // errcode_t ret = 0; + // uuid.uuid_len = (uint8_t)sizeof(srevr_id); + // memcpy_s(uuid.uuid, sizeof(uuid.uuid), (char *)&srevr_id, sizeof(srevr_id)); + // ret = gatts_register_server(&uuid, &serverId); /* 注册gatt server */ + // WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gatts_register_server ret: 0x%x serverId = 0x%x uuid.uuid_len:%d", ret, serverId,uuid.uuid_len); + // g_alipay_server_id = serverId; + // // svr_alipay_bt_init_gatts(); + // bt_uuid_t ble_service_uuid = {0}; + // bts_data_to_uuid_len2(id, &ble_service_uuid); + // ret = gatts_add_service(serverId, &ble_service_uuid, true); + // return; + +} +void alipay_unregist_server(void) +{ + svr_alipay_ble_adv_stop(); + gatts_delete_all_services(g_alipay_server_id); + gatts_unregister_server(g_alipay_server_id); + g_alipay_ble_init_flag = false; + g_alipay_server_id = 1; + g_alipay_server_handle = 0; + g_alipay_conn_id = 0; } void svr_alipay_bluetooth_init(void) { -#ifndef SUPPORT_AT_OHOSFWK bool ret = enable_bt_stack(); if (ret != ERRCODE_SUCC) { ALIPAY_PRINT_ERR(0, "enable_bt_stack ret:%u.\r\n", ret); } -#endif if (g_alipay_ble_init_flag == true) { - return; + // return; } svr_alipay_btcallback_reg(); svr_alipay_bt_init_gatts(); + svr_alipay_ble_adv_start(); g_alipay_ble_init_flag = true; return; } +#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/auto_ota/CMakeLists.txt b/code/sdk/application/wearable/auto_ota/CMakeLists.txt deleted file mode 100644 index ab05cf1fe..000000000 --- a/code/sdk/application/wearable/auto_ota/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -#=============================================================================== -# @brief cmake make file -# Copyright (c) 2023 @CompanyNameMagicTag -#=============================================================================== -set(COMPONENT_NAME "auto_ota") - -set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/auto_ota_service.c -) - -set(PUBLIC_HEADER - ${CMAKE_CURRENT_SOURCE_DIR} -) - -set(PRIVATE_HEADER - ${ROOT_DIR}/protocol/bt/host/bt/bts/sdk/inc - ${ROOT_DIR}/protocol/bt/host/bt/bts/sdk/inc/stack_api - ${ROOT_DIR}/protocol/bt/host/bt/bts/sdk/src/inc - ${ROOT_DIR}/protocol/bt/host/bt/bts/host/inc - ${ROOT_DIR}/protocol/bt/host/bt/bts/service/wear/gdk/inc - ${ROOT_DIR}/protocol/bt/host/bt/bts/sdk/src/stack_api - ${ROOT_DIR}/protocol/bt/host/bt/bts/bg_common/include/log - ${ROOT_DIR}/protocol/bt/host/bt/bts/bg_common/include/sdk_common - ${ROOT_DIR}/protocol/bt/host/bt/bts/bg_common/include/host - ${ROOT_DIR}/protocol/bt/host/bt/bts/bg_common/include/hci - ${ROOT_DIR}/protocol/bt/host/bt/bts/bg_common/include/gdk_common - ${ROOT_DIR}/protocol/bt/host/bt/bts/bg_common/include/ahi_common - ${ROOT_DIR}/protocol/bt/host/bt/bts/bg_common/include/ahi_a - ${ROOT_DIR}/protocol/bt/host/bt/bts/brandy_service/service/src - ${ROOT_DIR}/protocol/bt/host/bt/bts/brandy_service/service/src/base - ${ROOT_DIR}/protocol/bt/host/bt/bts/bt_sample/sample_common -) - -set(PRIVATE_DEFINES -) - -set(PUBLIC_DEFINES -) - -# use this when you want to add ccflags like -include xxx -set(COMPONENT_PUBLIC_CCFLAGS -) - -set(COMPONENT_CCFLAGS - -Wno-implicit-function-declaration - -Wno-unused-parameter - -Wno-int-conversion -) - -set(WHOLE_LINK - true -) - -set(MAIN_COMPONENT - false -) - -build_component() diff --git a/code/sdk/application/wearable/auto_ota/auto_ota_service.c b/code/sdk/application/wearable/auto_ota/auto_ota_service.c deleted file mode 100644 index 3f7d962b2..000000000 --- a/code/sdk/application/wearable/auto_ota/auto_ota_service.c +++ /dev/null @@ -1,601 +0,0 @@ -/** - * Copyright (c) CompanyNameMagicTag 2021-2022. All rights reserved. - * Description: Power display service. - * Author: - * Create: - */ - -#include -#include -#include -#include "cmsis_os2.h" -#include "systick.h" -#include "soc_errno.h" -#include "common_def.h" -#include "bts_def.h" -#include "bts_br_gap.h" -#include "oal_interface.h" -#include "wearable_log.h" -#include "local_device_manager.h" -#include "remote_device_manager.h" -#include "spp_service.h" -#include "bts_spp.h" -#include "btsrv_log.h" -#include "bts_feature.h" -#include "auto_ota_service.h" -#include "msg_center_ota.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define AUTO_OTA_RETRY_TIMES 5 -#define AUTO_OTA_SEM_TIMEOUT (60*60*1000) /* 等待信号量超时时间,考虑资源大包传输时间长场景 */ -#define AUTO_OTA_DELAY_MS 100 -#define AUTO_OTA_SPP_TASK_STACK_SIZE 2048 -#define AUTO_OTA_SPP_TASK_PRI 20 -#define ADDR_MAC_LEN 6 -#define AUTO_OTA_RECORD_DEV_MAX_NUM 200 /* 设计成客户可定制 */ -#define AUTO_OTA_SCAN_WAIT_TIME (25*1000) /* 客户可定制 */ -#define AUTO_OTA_UPDATE_RSSI_WAIT_TIME (20*1000) /* 客户可定制 */ -#define AUTO_OTA_INQUERY_DEV_NUM 20 /* 客户可定制 */ -#define AUTO_OTA_OPRATE_DELAY_MS (2*1000) /* 客户可定制 */ -#define AUTO_OTA_ACL_CONN_DELAY (6*1000) /* 客户可定制 */ -#define AUTO_OTA_SPP_RECONN_TIMEOUT 10000 /* 客户可定制 */ -#define AUTO_OTA_WAIT_PREPARE_TIMEOUT (2 * 1000) /* 客户可定制, 用于更换升级包场景 */ -#define AUTO_OTA_DEV_NAME_PREFIX "Watch" /* 客户基于自己产品定义修改bt name前缀,用于黑名单管理 */ -#define AUTO_OTA_DEV_NAME_PREFIX_LEN 5 -#define AUTO_OTA_DST_UPG_VER_PATH "/user/dst_ver.txt" - -bool g_auto_ota_found_list_init = false; -struct osal_list_head g_auto_ota_found_dev_list_head; -osSemaphoreId_t g_auto_ota_transmit_done_sem = NULL; -uint8_t g_auto_ota_upload_mode = 0; /* 默认是0,不阻塞auto_ota */ -uint8_t g_auto_ota_mac_tmp[ADDR_MAC_LEN] = {0}; -static bool g_anti_back_link_flag = false; - -typedef struct auto_ota_record_dev { - uint8_t addr[ADDR_MAC_LEN]; /* mac地址 */ - uint8_t has_been_updated; /* 标记是否已经升级 */ - uint8_t reserved; /* 对齐 */ -} auto_ota_record_dev_t; - -static auto_ota_record_dev_t g_auto_ota_record_dev[AUTO_OTA_RECORD_DEV_MAX_NUM]; - -typedef struct { - struct osal_list_head node; - bd_addr_t bd_addr; - uint8_t name[BD_NAME_LEN]; - int32_t cod; - int32_t rssi; -} auto_ota_found_dev_list_node; - -typedef struct { - uint32_t sample_mode; - spp_create_socket_para_t socket_params; - bd_addr_t addr; -} auto_ota_spp_connect_task_params; - -/* 数据管理 */ -void auto_ota_dev_init(void) -{ - for (uint8_t i = 0; i < AUTO_OTA_RECORD_DEV_MAX_NUM; i++) { - (void)memset_s(&g_auto_ota_record_dev[i], sizeof(auto_ota_record_dev_t), 0, sizeof(auto_ota_record_dev_t)); - } - return; -} - -void auto_ota_dev_add(uint8_t *addr) -{ - for (uint16_t i = 0; i < AUTO_OTA_RECORD_DEV_MAX_NUM; i++) { - if (g_auto_ota_record_dev[i].has_been_updated == 0) { - (void)memcpy_s(g_auto_ota_record_dev[i].addr, ADDR_MAC_LEN, addr, ADDR_MAC_LEN); - g_auto_ota_record_dev[i].has_been_updated = 1; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "to add record dev_mac : ****%02x%02x%02x%02x\r\n", - g_auto_ota_record_dev[i].addr[3], g_auto_ota_record_dev[i].addr[2], g_auto_ota_record_dev[i].addr[1], - g_auto_ota_record_dev[i].addr[0]); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "alloc index = %d\r\n", i); - return; - } - } -} - -bool auto_ota_dev_del(uint8_t *addr) -{ - for (uint16_t i = 0; i < AUTO_OTA_RECORD_DEV_MAX_NUM; i++) { - if (g_auto_ota_record_dev[i].has_been_updated == 1 && - memcmp(g_auto_ota_record_dev[i].addr, addr, ADDR_MAC_LEN) == 0) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "found! to del record dev_mac : ****%02x%02x%02x%02x\r\n", - g_auto_ota_record_dev[i].addr[3], g_auto_ota_record_dev[i].addr[2], g_auto_ota_record_dev[i].addr[1], - g_auto_ota_record_dev[i].addr[0]); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "free index = %d\r\n", i); - (void)memset_s(g_auto_ota_record_dev[i].addr, ADDR_MAC_LEN, 0, ADDR_MAC_LEN); - g_auto_ota_record_dev[i].has_been_updated = 0; - return true; - } - } - - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "dev_del: no found dev_mac.\r\n"); - return false; -} - -bool auto_ota_dev_found(uint8_t *addr) -{ - for (uint16_t i = 0; i < AUTO_OTA_RECORD_DEV_MAX_NUM; i++) { - if (g_auto_ota_record_dev[i].has_been_updated == 1 && - memcmp(g_auto_ota_record_dev[i].addr, addr, ADDR_MAC_LEN) == 0) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "no need to record dev_mac: ****%02x%02x%02x%02x\r\n", - g_auto_ota_record_dev[i].addr[3], g_auto_ota_record_dev[i].addr[2], g_auto_ota_record_dev[i].addr[1], - g_auto_ota_record_dev[i].addr[0]); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "taken index = %d\r\n", i); - return true; - } - } - return false; -} - -void auto_ota_dev_show(void) -{ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "auto_ota total dev info :"); - for (uint16_t i = 0; i < AUTO_OTA_RECORD_DEV_MAX_NUM; i++) { - if (g_auto_ota_record_dev[i].has_been_updated == 1) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "already record dev_mac : ****%02x%02x%02x%02x\r\n", - g_auto_ota_record_dev[i].addr[3], g_auto_ota_record_dev[i].addr[2], g_auto_ota_record_dev[i].addr[1], - g_auto_ota_record_dev[i].addr[0]); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "taken index = %d\r\n", i); - } - } -} - -/* 黑名单处理 */ -static bool auto_ota_dev_check_dev_name(unsigned char *dev_name) -{ - if (strncmp((const char *)dev_name, AUTO_OTA_DEV_NAME_PREFIX, AUTO_OTA_DEV_NAME_PREFIX_LEN) == 0) { - return true; - } else { - return false; - } -} - -/* 重置发现设备链表 */ -void auto_ota_reset_found_dev_list(void) -{ - if (!g_auto_ota_found_list_init) { - g_auto_ota_found_list_init = true; - OSAL_INIT_LIST_HEAD(&g_auto_ota_found_dev_list_head); - return; - } - - while (osal_list_empty(&g_auto_ota_found_dev_list_head) == false) { - struct osal_list_head *node = g_auto_ota_found_dev_list_head.next; - osal_list_del(node); - oal_mem_free(node); - } -} - -bool auto_ota_bt_start_discovery(void) -{ - auto_ota_reset_found_dev_list(); - (void)gap_br_set_inquiry_paramters(0, AUTO_OTA_INQUERY_DEV_NUM); - for (uint8_t i = 0; i < AUTO_OTA_RETRY_TIMES; i++) { - bool res = gap_br_start_discovery(); - if (res != true) { - osDelay(AUTO_OTA_DELAY_MS); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "gap_br_start_discovery fail.\r\n"); - continue; - } else { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "gap_br_start_discovery succ.\r\n"); - return true; - } - } - return false; -} - -/* 新增节点 */ -static void auto_ota_add_node_to_found_dev_list(const bd_addr_t *bd_addr, const uint8_t *name, int32_t cod, int32_t rssi) -{ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "auto_ota_add_node, addr: ****%02x%02x%02x%02x, name: %s", - bd_addr->addr[3], bd_addr->addr[2], bd_addr->addr[1], bd_addr->addr[0], name); /* addr下标 0 1 2 3 */ - - auto_ota_found_dev_list_node *node = - (auto_ota_found_dev_list_node *)(void *)oal_mem_alloc(sizeof(auto_ota_found_dev_list_node)); - if (node == NULL) { - return; - } - (void)memset_s(node, sizeof(auto_ota_found_dev_list_node), 0, sizeof(auto_ota_found_dev_list_node)); - - if (memcpy_s(&node->bd_addr, sizeof(node->bd_addr), bd_addr, sizeof(bd_addr_t)) != EOK) { - oal_mem_free(node); - return; - } - - if (memcpy_s(node->name, sizeof(node->name), name, BD_NAME_LEN) != EOK) { - oal_mem_free(node); - return; - } - - node->cod = cod; - node->rssi = rssi; - osal_list_add_tail((struct osal_list_head *)node, &g_auto_ota_found_dev_list_head); -} - -static void auto_ota_sort_found_dev_list(void) -{ - struct osal_list_head *list_head = &g_auto_ota_found_dev_list_head; - - for (struct osal_list_head *node1 = list_head->next; node1 != NULL && node1 != list_head; node1 = node1->next) { - auto_ota_found_dev_list_node *dev_info1 = (auto_ota_found_dev_list_node *)node1; - for (struct osal_list_head *node2 = node1->next; node2 != NULL && node2 != list_head; node2 = node2->next) { - auto_ota_found_dev_list_node *dev_info2 = (auto_ota_found_dev_list_node *)node2; - - /* rssi大的在前 */ - if (dev_info1->rssi >= dev_info2->rssi) { - continue; - } - - /* 交换两个节点的信息 */ - auto_ota_found_dev_list_node tmp_node; - uint32_t ret = - (uint32_t)memcpy_s(&tmp_node, sizeof(tmp_node), dev_info1, sizeof(auto_ota_found_dev_list_node)); - ret |= (uint32_t)memcpy_s(&dev_info1->bd_addr, - sizeof(auto_ota_found_dev_list_node) - sizeof(struct osal_list_head), - &dev_info2->bd_addr, - sizeof(auto_ota_found_dev_list_node) - sizeof(struct osal_list_head)); - ret |= (uint32_t)memcpy_s(&dev_info2->bd_addr, - sizeof(auto_ota_found_dev_list_node) - sizeof(struct osal_list_head), - &tmp_node.bd_addr, - sizeof(auto_ota_found_dev_list_node) - sizeof(struct osal_list_head)); - if (ret != EOK) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "swap fail %x\n", ret); - } - } - } -} - -/* 异步返回,更新RSSI */ -static void auto_ota_update_found_dev_node_rssi(const bd_addr_t *bd_addr, int32_t rssi) -{ - struct osal_list_head *list_head = &g_auto_ota_found_dev_list_head; - struct osal_list_head *node = list_head->next; - - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER,"will update rssi, addr: ****%02x%02x%02x%02x, rssi = %d\n", - bd_addr->addr[3], bd_addr->addr[2], bd_addr->addr[1], bd_addr->addr[0], rssi); /* addr下标 0 1 2 3 */ - - while (node != NULL && node != list_head) { - auto_ota_found_dev_list_node *dev_info = (auto_ota_found_dev_list_node *)node; - if (memcmp(dev_info->bd_addr.addr, bd_addr->addr, BD_ADDR_LEN) == 0) { - dev_info->rssi = rssi; - return; - } - - node = node->next; - } -} - -static void auto_ota_gap_read_remote_rssi_event_callback(const bd_addr_t *bd_addr, int rssi, int status) -{ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, - " addr: ****%02x%02x%02x%02x rssi: %d status: %d\n", - bd_addr->addr[3], bd_addr->addr[2], /* addr下标 2 3 */ - bd_addr->addr[1], bd_addr->addr[0], rssi, status); /* addr下标 0 1 */ - - if (status == ERRCODE_BT_SUCCESS) { - auto_ota_update_found_dev_node_rssi(bd_addr, rssi); - } -} - -static bool auto_ota_get_top_dev_to_connect(void) -{ - struct osal_list_head *list_head = &g_auto_ota_found_dev_list_head; - uint8_t blank_addr[ADDR_MAC_LEN] = {0}; - - for (struct osal_list_head *node = list_head->next; node != NULL && node != list_head; node = node->next) { - auto_ota_found_dev_list_node *dev_info = (auto_ota_found_dev_list_node *)node; - if (memcmp(dev_info->bd_addr.addr, blank_addr, ADDR_MAC_LEN) == 0) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "ignore zero addr, name: %s\n", dev_info->name); - continue; - } - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, - "plan to connect addr: ****%02x%02x%02x%02x name: \"%s\" cod: %x rssi: %d\n", - dev_info->bd_addr.addr[3], dev_info->bd_addr.addr[2], /* addr下标 3 2 */ - dev_info->bd_addr.addr[1], dev_info->bd_addr.addr[0], /* addr下标 1 0 */ - dev_info->name, - dev_info->cod, - dev_info->rssi); - - for (uint8_t i = 0; i < AUTO_OTA_RETRY_TIMES; i++) { - if (gap_connect_remote_device(&(dev_info->bd_addr)) != true) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "to connect acl fail\r\n"); - osDelay(100); - } else { - osDelay(AUTO_OTA_ACL_CONN_DELAY); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "to connect acl succ\r\n"); - return true; - } - } - } - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "no found_device\n"); - return false; -} - -static void auto_ota_discovery_result_callback(const bd_addr_t *bd_addr) -{ - unsigned char length = BD_NAME_LEN; - unsigned char *device_name = (unsigned char *)(void *)oal_mem_alloc(length); - if (device_name == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "gap_discovery_result_callback malloc error!\n"); - return; - } - (void)memset_s(device_name, length, 0, length); - - bool ret1 = gap_get_device_name(bd_addr, device_name, &length); - int cod = gap_get_device_class(bd_addr); - bool ret2 = gap_read_remote_rssi_value(bd_addr); - - if (auto_ota_dev_found(bd_addr->addr) != true && auto_ota_dev_check_dev_name(device_name) == true) { - auto_ota_add_node_to_found_dev_list(bd_addr, device_name, cod, 0); - } - - return; -} - -static bool auto_ota_upg_check(void) -{ - errcode_t ret = ERRCODE_SUCC; - - /* 目标版本从文件读取,方便客户每次推送不同版本 */ - FILE *fp = NULL; - - fp = fopen(AUTO_OTA_DST_UPG_VER_PATH, "rb"); - if (fp == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "open %s fail.\r\n", AUTO_OTA_DST_UPG_VER_PATH); - return false; - } - - fseek(fp, 0L, SEEK_END); - long file_len = ftell(fp); - char *dst_ver = (char *)malloc(sizeof(char) * (file_len + 1)); - if (dst_ver == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "malloc fail, file_len = %d.\r\n", file_len); - return false; - } - - fseek(fp, 0L, SEEK_SET); - if (fread(dst_ver, file_len, 1, fp) != 1) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "fread fail, file_len = %d.\r\n", file_len); - free(dst_ver); - dst_ver = NULL; - return false; - } - fclose(fp); - dst_ver[file_len] = '\0'; - - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "dst_ver = %s, file_len = %d.\r\n", dst_ver, file_len); - - ret = msg_center_send_data(MSGCENTER_CMD_OTA, MSGCENTER_TYPE_ID_OTA_UPG_CHECK, dst_ver, strlen(dst_ver)); - if (ret != ERRCODE_SUCC) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "send upgrade version check fail, ret = %d\r\n", ret); - free(dst_ver); - dst_ver = NULL; - return false; - } - - free(dst_ver); - dst_ver = NULL; - return true; -} - -static int auto_ota_spp_client_connect_task_body(void *data) -{ - auto_ota_spp_connect_task_params *task_params = (auto_ota_spp_connect_task_params *)data; - spp_create_socket_para_t *socket_param = &task_params->socket_params; - - int ret = spp_connect(socket_param, &task_params->addr); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "spp_connect ret: %x\n", ret); - - oal_mem_free(data); - return OSAL_SUCCESS; -} - -/* client连接server */ -bool auto_ota_spp_connect(const char *spp_uuid, const bd_addr_t *addr) -{ - uint8_t uuid_len = (uint8_t)strlen(spp_uuid); - auto_ota_spp_connect_task_params *task_params = - (auto_ota_spp_connect_task_params *)oal_mem_alloc(sizeof(auto_ota_spp_connect_task_params)); - - if (generate_uuid_from_string(spp_uuid, uuid_len + 1, &task_params->socket_params.uuid) != EXT_ERR_SUCCESS) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "generate uuid fail\n"); - return false; - } - - task_params->sample_mode = 0; - task_params->socket_params.socket_type = SPP_SOCKET_RFCOMM; - task_params->socket_params.is_encrypt = true; - (void)memcpy_s(&(task_params->addr.addr), BD_ADDR_LEN, addr->addr, BD_ADDR_LEN); - - osal_task *task = osal_kthread_create(auto_ota_spp_client_connect_task_body, task_params, - "auto_ota_spp_client_connect_task", AUTO_OTA_SPP_TASK_STACK_SIZE); - if (task == NULL) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "create task fail\n"); - return false; - } - int ret = osal_kthread_set_priority(task, AUTO_OTA_SPP_TASK_PRI); - if (ret != OSAL_SUCCESS) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "set pri error: %08x\n", ret); - } - - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "create task success.\n"); - - bool is_connected = false; - uint64_t start_time = uapi_tcxo_get_ms(); - uint64_t current_time; - while (is_connected == false) { - is_connected = is_spp_connected(0); - osDelay(AUTO_OTA_OPRATE_DELAY_MS); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "spp reconnecting.\r\n"); - current_time = uapi_tcxo_get_ms(); - if (current_time - start_time > AUTO_OTA_SPP_RECONN_TIMEOUT || is_connected == true) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "spp connect %s.\r\n", is_connected == true ? "Succ" : "Fail"); - break; - } - } - - /* 升级版本号校验 */ - bool res = auto_ota_upg_check(); - if (res != true) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "auto_ota_upg_check fail.\n"); - return false; - } - - return true; -} - -static void auto_ota_acl_state_changed_callback(const bd_addr_t *bd_addr, gap_acl_state_t state, unsigned int reason) -{ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "acl cb, state %d, reason %x", state, reason); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "addr: ****%02x%02x%02x%02x", - bd_addr->addr[3], bd_addr->addr[2], bd_addr->addr[1], bd_addr->addr[0]); /* mac下标 0 1 2 3 */ - char uuid[] = {"1101"}; - if (state == GAP_ACL_STATE_CONNECTED) { - if (g_anti_back_link_flag == true) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "anti back link addr: ****%02x%02x%02x%02x", - bd_addr->addr[3], bd_addr->addr[2], bd_addr->addr[1], bd_addr->addr[0]); /* mac下标 0 1 2 3 */ - return; - } - bool res = auto_ota_spp_connect(uuid, bd_addr); - if (res != true) { - (void)osSemaphoreRelease(g_auto_ota_transmit_done_sem); - return; - } - /* spp trans回调中释放信号量最准确,故此处临时记录mac地址 */ - (void)memcpy_s(g_auto_ota_mac_tmp, ADDR_MAC_LEN, (const char *)bd_addr->addr, ADDR_MAC_LEN); - g_anti_back_link_flag = true; - } -} - -void auto_ota_gap_register_callbacks(void) -{ - gap_call_backs_t cb = { - NULL, - auto_ota_acl_state_changed_callback, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - auto_ota_discovery_result_callback, - NULL, - NULL, - NULL, - NULL, - NULL, - auto_ota_gap_read_remote_rssi_event_callback, - NULL - }; - (void)gap_register_callbacks(&cb); -} - -errcode_t auto_ota_enable_bt(void) -{ -#if defined(SW_UART_DEBUG) || defined(SW_RTT_DEBUG) - g_bth_log_type_level = 0xFF2; /* BTSRV_LOG_UART_INFO */ -#endif - bts_feature_t feature = {0}; - feature.bt_auto_reconnect_closed = 1; - - auto_ota_gap_register_callbacks(); - bts_set_features(&feature); /* 关闭client回链 */ - errcode_t res = enable_bt_stack(); - if (res != 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "bt enable fail, ret = %d\r\n", res); - return ERRCODE_FAIL; - } else { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "bt enable ok\r\n"); - return ERRCODE_SUCC; - } -} - -void auto_ota_task_init(void) -{ - g_auto_ota_transmit_done_sem = osSemaphoreNew(1, 0, NULL); - if (!g_auto_ota_transmit_done_sem) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "sem creat fail!\r\n"); - return; - } -} - -void auto_ota_task_main(void) -{ - errcode_t ret; - - auto_ota_dev_init(); - auto_ota_task_init(); - - if (auto_ota_enable_bt() != ERRCODE_SUCC) { - return; - } - - while (1) { - if (g_auto_ota_upload_mode == 1) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "enter upload fwpkg mode, auto_ota not run!\r\n"); - osDelay(AUTO_OTA_WAIT_PREPARE_TIMEOUT); - continue; - } - - /* 保证最开始不会有配对信息回连,可能导致Bæ ¸wait等回连 */ - if (gap_remove_all_pairs() != true) { - osDelay(AUTO_OTA_DELAY_MS); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "remove all pairs fail, auto retry...\r\n"); - continue; - } - osDelay(AUTO_OTA_OPRATE_DELAY_MS); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "gap_remove_all_pairs ok\r\n"); - - /* scan */ - if (auto_ota_bt_start_discovery() != true) { - osDelay(AUTO_OTA_DELAY_MS); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "start discovery fail, auto retry...\r\n"); - continue; - } - - osDelay(AUTO_OTA_SCAN_WAIT_TIME); /* 保证能扫到设备 */ - - (void)gap_br_cancel_discovery(); - osDelay(AUTO_OTA_UPDATE_RSSI_WAIT_TIME); - auto_ota_sort_found_dev_list(); /* 根据rssi降序排序 */ - /* connect */ - if (auto_ota_get_top_dev_to_connect() != true) { - osDelay(AUTO_OTA_DELAY_MS); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "connect fail, auto retry...\r\n"); - continue; - } - - osSemaphoreAcquire(g_auto_ota_transmit_done_sem, AUTO_OTA_SEM_TIMEOUT); - - /* clean, spp资源内部释放 */ - spp_disconnect(0); - /* 删除配对时会disconnect ACL */ - if (gap_remove_all_pairs() != true) { - osDelay(AUTO_OTA_DELAY_MS); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "remove all pairs fail, auto retry...\r\n"); - continue; - } - osDelay(AUTO_OTA_OPRATE_DELAY_MS); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "gap_remove_all_pairs ok\r\n"); - - osDelay(AUTO_OTA_DELAY_MS); - auto_ota_dev_show(); - memset_s(g_auto_ota_mac_tmp, sizeof(g_auto_ota_mac_tmp), 0, sizeof(g_auto_ota_mac_tmp)); - g_anti_back_link_flag = false; - osDelay(AUTO_OTA_DELAY_MS); - } - - return; -} - -#ifdef __cplusplus -} -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/auto_ota/auto_ota_service.h b/code/sdk/application/wearable/auto_ota/auto_ota_service.h deleted file mode 100644 index 322835e4b..000000000 --- a/code/sdk/application/wearable/auto_ota/auto_ota_service.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: broadcast service api - * Author: CompanyName - * Create: 2021-11-11 - */ - -#ifndef AUTO_OTA_SERVICE_H -#define AUTO_OTA_SERVICE_H - -#include "stdint.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - -void auto_ota_dev_add(uint8_t *addr); -bool auto_ota_dev_del(uint8_t *addr); -void auto_ota_dev_show(void); -void auto_ota_task_main(void); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ -#endif /* AUTO_OTA_SERVICE_H */ diff --git a/code/sdk/application/wearable/fd230app/CMakeLists.txt b/code/sdk/application/wearable/fd230app/CMakeLists.txt index 7010e6088..26b8b4f4e 100644 --- a/code/sdk/application/wearable/fd230app/CMakeLists.txt +++ b/code/sdk/application/wearable/fd230app/CMakeLists.txt @@ -8,7 +8,7 @@ set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/nativelauncher/include/slices/main ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/screennotify/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/include + ) set(PRIVATE_HEADER @@ -37,7 +37,6 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_card/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/add_card/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial/include - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/key/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/phone/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/player/include @@ -58,9 +57,7 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/alipay/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/alipay/include/AlipayList ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/alipay/include/AlipayTrans - - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/themestyle/include - + ${UI_SAMPLE_ROOT}/components ${CMAKE_CURRENT_SOURCE_DIR}/../service/smart_voice/smart_voice_service/interfaces/innerkits/native_c/include ${CMAKE_CURRENT_SOURCE_DIR}/../service/smart_voice/voice_engine_hal/interfaces/innerkits/native_c/include @@ -68,6 +65,7 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/../../battery ${CMAKE_CURRENT_SOURCE_DIR}/../../../drivers/drivers/driver/rtc_unified ${CMAKE_CURRENT_SOURCE_DIR}/../../../kernel/liteos/liteos_v207.1.0/Huawei_LiteOS/compat/linux/include/uapi/linux/ + ${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/src/ui/frameworks @@ -82,8 +80,6 @@ set(PRIVATE_HEADER ${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 - ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/innerkits - ${ROOT_DIR}/middleware/services/gui/uikit/ui/frameworks ${ROOT_DIR}/middleware/services/gui/uikit/surface/interfaces/kits ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits ${ROOT_DIR}/middleware/services/gui/uikit/ui/interfaces/kits/components @@ -170,7 +166,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothModel.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothWrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/MainBluetoothView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/TipsConnFailMessageView.cpp @@ -287,9 +282,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial/src/SetDialModel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial/src/SetDialPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial/src/SetDialView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/src/SetDialStyleModel.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/src/SetDialStylePresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/src/SetDialStyleView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/key/src/KeyInputListener.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/screennotify/src/ui_screennotify.cpp diff --git a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h index 0bca5bf66..6b9ee61a5 100644 --- a/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/fd230app/nativelauncher/include/UiConfig.h @@ -277,10 +277,6 @@ namespace OHOS static constexpr const char *PNG_APPLIST_AIVOICE_IMAGE = APP_LIST_PATH "/aivoice.bin"; // AI Voice(人工智能语音) static constexpr const char *PNG_APPLIST_SLEEP_IMAGE = APP_LIST_PATH "/sleeping.bin"; // 睡眠 - // AppList hexagon icon - static constexpr const char *PNG_APPLIST_DEFAULT_IMG = APP_RES_PATH"/regular_hexagon.bin"; - static constexpr const char *PNG_APPLIST_NOTSETUSE_IMG = APP_RES_PATH"/regular_hexagon_inverse.bin"; - /* ---------------------------------- 快速训练 ---------------------------------- */ static constexpr const char *PNG_TRAING_BOUTTONMORE_IMAGE = APP_RES_PATH "/Training/More.bin"; static constexpr const char *PNG_TRAING_BUTTONGRONG_IMAGE = APP_RES_PATH "/Training/Bouttonground.bin"; diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/include/AppItemView.h b/code/sdk/application/wearable/fd230app/nativeui/applist/include/AppItemView.h index 080a52e0f..0d5166ad1 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/include/AppItemView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/include/AppItemView.h @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-08 16:43:48 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-07-02 19:45:18 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-05-06 16:52:38 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/applist/include/AppItemView.h */ @@ -42,7 +42,7 @@ private: //UILabel label_; //AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr }; UILabelExt labelExt_; - AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr,nullptr,STR_EXERCISE_GENERAL, nullptr }; + AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr,STR_EXERCISE_GENERAL, nullptr }; }; class HexagonsItemView : public UIImageView { @@ -55,7 +55,7 @@ public: private: HexagonsItemView(const HexagonsItemView &); HexagonsItemView &operator = (const HexagonsItemView &); - AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr,nullptr,STR_EXERCISE_GENERAL, nullptr }; + AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr,STR_EXERCISE_GENERAL, nullptr }; }; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/include/ApplistModel.h b/code/sdk/application/wearable/fd230app/nativeui/applist/include/ApplistModel.h index 8ea91609f..1aa5a8738 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/include/ApplistModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/include/ApplistModel.h @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-04-08 16:43:48 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-07-02 20:03:25 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-05-06 16:57:20 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/applist/include/ApplistModel.h */ /* @@ -21,7 +21,6 @@ #include"language/font/ui_resource_string.h" #include "ohos_types.h" -#include "ThemeStyleModel.h" #define APP_MAX_NUM 50 namespace OHOS { @@ -29,22 +28,11 @@ typedef struct { AppViewId id; const char *iconLarge; const char *iconSmall; - const char *iconHexagon; const char *label; uint16_t TextId; const char *uid; } AppItem; - -#define AppListStyle ThemeStyle - -// typedef enum : uint16_t -// { -// APPLIST_STYLE, // 列表显示 -// HEXAGONS_STYLE, // 蜂窝显示 -// FOOTBALL_STYLE, //足球 -// MAX_THEME_STYLE, -// } AppListStyle; class ApplistPresenter; class ApplistModel { public: @@ -60,8 +48,7 @@ public: int GetHeadItemY(void); void ApplistUpdate(void); void SetPresenter(ApplistPresenter *p); - AppListStyle GetCurrentStyle(void); - + bool GetIsUseListStyle(void); private: ApplistModel(); ApplistModel(const ApplistModel &); @@ -69,7 +56,7 @@ private: virtual ~ApplistModel(); ApplistPresenter *presenter{nullptr}; - AppItem applist[APP_MAX_NUM] = { VIEW_INVALID, nullptr, nullptr, nullptr,nullptr,STR_EXERCISE_GENERAL, nullptr }; + AppItem applist[APP_MAX_NUM] = { VIEW_INVALID, nullptr, nullptr, nullptr,STR_EXERCISE_GENERAL, nullptr }; BundleInfo *bundleInfos = nullptr; int32 bundleLen = 0; uint8 appLen = 0; diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp index 5c32ff9b5..dff4a565e 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistModel.cpp @@ -21,7 +21,7 @@ #include "applist/include/ApplistPresenter.h" #include "SetDesktopModel.h" #include "themestyle/include/ThemeStyleModel.h" -#include "set_desktop/include/SetDesktopView.h" + namespace OHOS { /**- APPLSIT @@ -60,46 +60,46 @@ namespace OHOS * - 设置 */ const AppItem g_nativeAppList[] = { - {VIEW_BLOODOXY, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_DEFAULT_IMG,"血氧", STR_BLOOD_OXYGEN, nullptr}, - {VIEW_HEART, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_DEFAULT_IMG,"心率", STR_HEART_RATE, nullptr}, - {VIEW_TRAINING, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_DEFAULT_IMG,"训练", STR_TRAINING, nullptr}, - {VIEW_TRAINING_RECORD, PNG_APPLIST_TRAINING_RECORD_IMAGE, PNG_APPLIST_TRAINING_RECORD_IMAGE, PNG_APPLIST_DEFAULT_IMG,"训练记录", STR_TRAINING_RECORD, nullptr}, - {VIEW_COMPASS, PNG_APPLIST_COMPASS_IMAGE, PNG_APPLIST_COMPASS_IMAGE, PNG_APPLIST_DEFAULT_IMG,"指南针", STR_COMPASS, nullptr}, - {VIEW_MAIN_PHONE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_CALLER_IMAGE,PNG_APPLIST_DEFAULT_IMG,"电话", STR_PHONE, nullptr}, - {VIEW_CALLER_LOG, PNG_APPLIST_CALLLOG_IMAGE, PNG_APPLIST_CALLLOG_IMAGE, PNG_APPLIST_DEFAULT_IMG,"常用联系人", STR_FAVORITE_CONTACTS, nullptr}, - {VIEW_WEATHER, PNG_APPLIST_WEATHER_IMAGE, PNG_APPLIST_WEATHER_IMAGE, PNG_APPLIST_DEFAULT_IMG,"天气", STR_WEATHER, nullptr}, - {VIEW_GOAL, PNG_APPLIST_GOAL_IMAGE, PNG_APPLIST_GOAL_IMAGE, PNG_APPLIST_DEFAULT_IMG,"活动", STR_ACTIVITY, nullptr}, - {VIEW_SET_DIAL, PNG_APPLIST_CHANGEDIAL_IMAGE, PNG_APPLIST_CHANGEDIAL_IMAGE, PNG_APPLIST_DEFAULT_IMG,"更换表盘", STR_WATCH_FACE, nullptr}, - {VIEW_THEME_STYLE, PNG_APPLIST_THEME_IMAGE, PNG_APPLIST_THEME_IMAGE, PNG_APPLIST_DEFAULT_IMG,"显示方式", STR_DISPLAY_MODE, nullptr}, - {VIEW_ADD_CARD, PNG_APPLIST_CARDSET_IMAGE, PNG_APPLIST_CARDSET_IMAGE, PNG_APPLIST_DEFAULT_IMG,"卡片管理", STR_CARD_MANAGEMENT, nullptr}, - {VIEW_SLEEP, PNG_APPLIST_SLEEP_IMAGE, PNG_APPLIST_SLEEP_IMAGE, PNG_APPLIST_DEFAULT_IMG,"睡眠", STR_SLEEP, nullptr}, - {VIEW_RECORD, PNG_APPLIST_RECORD_IMAGE, PNG_APPLIST_RECORD_IMAGE, PNG_APPLIST_DEFAULT_IMG,"录音", STR_RECORD, nullptr}, - {VIEW_RESPIRATORY_TRAINING, PNG_APPLIST_BREATHE_IMAGE, PNG_APPLIST_BREATHE_IMAGE, PNG_APPLIST_DEFAULT_IMG,"呼吸训练", STR_BREATH_TRAINING, nullptr}, - {VIEW_TAKEPHOTOS, PNG_APPLIST_TACKEPHOTOS_IMAGE, PNG_APPLIST_TACKEPHOTOS_IMAGE,PNG_APPLIST_DEFAULT_IMG, "遥控拍照", STR_REMOTE_SHOOTING, nullptr}, + {VIEW_BLOODOXY, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_SPO2_IMAGE, "血氧", STR_BLOOD_OXYGEN, nullptr}, + {VIEW_HEART, PNG_APPLIST_HEART_IMAGE, PNG_APPLIST_HEART_IMAGE, "心率", STR_HEART_RATE, nullptr}, + {VIEW_TRAINING, PNG_APPLIST_TRAINING_IMAGE, PNG_APPLIST_TRAINING_IMAGE, "训练", STR_TRAINING, nullptr}, + {VIEW_TRAINING_RECORD, PNG_APPLIST_TRAINING_RECORD_IMAGE, PNG_APPLIST_TRAINING_RECORD_IMAGE, "训练记录", STR_TRAINING_RECORD, nullptr}, + {VIEW_COMPASS, PNG_APPLIST_COMPASS_IMAGE, PNG_APPLIST_COMPASS_IMAGE, "指南针", STR_COMPASS, nullptr}, + {VIEW_MAIN_PHONE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_CALLER_IMAGE, "电话", STR_PHONE, nullptr}, + {VIEW_CALLER_LOG, PNG_APPLIST_CALLLOG_IMAGE, PNG_APPLIST_CALLLOG_IMAGE, "常用联系人", STR_FAVORITE_CONTACTS, nullptr}, + {VIEW_WEATHER, PNG_APPLIST_WEATHER_IMAGE, PNG_APPLIST_WEATHER_IMAGE, "天气", STR_WEATHER, nullptr}, + {VIEW_GOAL, PNG_APPLIST_GOAL_IMAGE, PNG_APPLIST_GOAL_IMAGE, "活动", STR_ACTIVITY, nullptr}, + {VIEW_SET_DIAL, PNG_APPLIST_CHANGEDIAL_IMAGE, PNG_APPLIST_CHANGEDIAL_IMAGE, "更换表盘", STR_WATCH_FACE, nullptr}, + {VIEW_THEME_STYLE, PNG_APPLIST_THEME_IMAGE, PNG_APPLIST_THEME_IMAGE, "显示方式", STR_DISPLAY_MODE, nullptr}, + {VIEW_ADD_CARD, PNG_APPLIST_CARDSET_IMAGE, PNG_APPLIST_CARDSET_IMAGE, "卡片管理", STR_CARD_MANAGEMENT, nullptr}, + {VIEW_SLEEP, PNG_APPLIST_SLEEP_IMAGE, PNG_APPLIST_SLEEP_IMAGE, "睡眠", STR_SLEEP, nullptr}, + {VIEW_RECORD, PNG_APPLIST_RECORD_IMAGE, PNG_APPLIST_RECORD_IMAGE, "录音", STR_RECORD, nullptr}, + {VIEW_RESPIRATORY_TRAINING, PNG_APPLIST_BREATHE_IMAGE, PNG_APPLIST_BREATHE_IMAGE, "呼吸训练", STR_BREATH_TRAINING, nullptr}, + {VIEW_TAKEPHOTOS, PNG_APPLIST_TACKEPHOTOS_IMAGE, PNG_APPLIST_TACKEPHOTOS_IMAGE, "遥控拍照", STR_REMOTE_SHOOTING, nullptr}, #ifdef SUPPORT_ALIPAY_SEC - {VIEW_MAIN_ALIPAY, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_DEFAULT_IMG,"支付宝", STR_ALIPAY, nullptr}, + {VIEW_MAIN_ALIPAY, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_ALIPAY_IMAGE, "支付宝", STR_ALIPAY, nullptr}, #endif - {VIEW_MAIN_COUNTDOWN, PNG_APPLIST_COUNTDOWN_IMAGE, PNG_APPLIST_COUNTDOWN_IMAGE, PNG_APPLIST_DEFAULT_IMG,"计时器", STR_TIMER, nullptr}, - {VIEW_FIND_PHONE, PNG_APPLIST_FINDPHONE_IMAGE, PNG_APPLIST_FINDPHONE_IMAGE,PNG_APPLIST_DEFAULT_IMG, "查找手机", STR_FIND_PHONE, nullptr}, - {VIEW_BRIGHTNESSLEVEL, PNG_APPLIST_BRIGHTNESSLEVEL_IMAGE, PNG_APPLIST_BRIGHTNESSLEVEL_IMAGE,PNG_APPLIST_DEFAULT_IMG, "亮度调节", STR_BRIGHTNESS_ADJUSTMENT, nullptr}, - {VIEW_SOUND_VIBRATION, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_DEFAULT_IMG,"声音", STR_SOUND, nullptr}, - {VIEW_CLASSIC_BLUETOOTH, PNG_APPLIST_BLUETOOTH_IMAGE, PNG_APPLIST_BLUETOOTH_IMAGE, PNG_APPLIST_DEFAULT_IMG,"蓝牙", STR_BLUETOOTH, nullptr}, - {VIEW_DNOTDISTURB, PNG_APPLIST_DISTURB_IMAGE, PNG_APPLIST_DISTURB_IMAGE, PNG_APPLIST_DEFAULT_IMG,"勿扰模式", STR_DO_NOT_DISTURB, nullptr}, - {VIEW_MESSAGE, PNG_APPLIST_MESSAGE_IMAGE, PNG_APPLIST_MESSAGE_IMAGE, PNG_APPLIST_DEFAULT_IMG,"消息通知", STR_MESSAGE_NOTIFICATION, nullptr}, - {VIEW_SAVEELE, PNG_APPLIST_SAVEELE_IMAGE, PNG_APPLIST_SAVEELE_IMAGE, PNG_APPLIST_DEFAULT_IMG,"省电模式", STR_POWER_SAVE_MODE, nullptr}, - {VIEW_FLASHLIGHT, PNG_APPLIST_FLASHLIGHT_IMAGE, PNG_APPLIST_FLASHLIGHT_IMAGE, PNG_APPLIST_DEFAULT_IMG,"手电筒", STR_FLASHLIGHT, nullptr}, - {VIEW_SETTING, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_DEFAULT_IMG,"设置", STR_SETTINGS, nullptr}, - //{VIEW_AI_VOICE, PNG_APPLIST_AIVOICE_IMAGE, PNG_APPLIST_AIVOICE_IMAGE, PNG_APPLIST_DEFAULT_IMG,"AI Voice", STR_AI_VOICE, nullptr}, + {VIEW_MAIN_COUNTDOWN, PNG_APPLIST_COUNTDOWN_IMAGE, PNG_APPLIST_COUNTDOWN_IMAGE, "计时器", STR_TIMER, nullptr}, + {VIEW_FIND_PHONE, PNG_APPLIST_FINDPHONE_IMAGE, PNG_APPLIST_FINDPHONE_IMAGE, "查找手机", STR_FIND_PHONE, nullptr}, + {VIEW_BRIGHTNESSLEVEL, PNG_APPLIST_BRIGHTNESSLEVEL_IMAGE, PNG_APPLIST_BRIGHTNESSLEVEL_IMAGE, "亮度调节", STR_BRIGHTNESS_ADJUSTMENT, nullptr}, + {VIEW_SOUND_VIBRATION, PNG_APPLIST_VOICE_IMAGE, PNG_APPLIST_VOICE_IMAGE, "声音", STR_SOUND, nullptr}, + {VIEW_CLASSIC_BLUETOOTH, PNG_APPLIST_BLUETOOTH_IMAGE, PNG_APPLIST_BLUETOOTH_IMAGE, "蓝牙", STR_BLUETOOTH, nullptr}, + {VIEW_DNOTDISTURB, PNG_APPLIST_DISTURB_IMAGE, PNG_APPLIST_DISTURB_IMAGE, "勿扰模式", STR_DO_NOT_DISTURB, nullptr}, + {VIEW_MESSAGE, PNG_APPLIST_MESSAGE_IMAGE, PNG_APPLIST_MESSAGE_IMAGE, "消息通知", STR_MESSAGE_NOTIFICATION, nullptr}, + {VIEW_SAVEELE, PNG_APPLIST_SAVEELE_IMAGE, PNG_APPLIST_SAVEELE_IMAGE, "省电模式", STR_POWER_SAVE_MODE, nullptr}, + {VIEW_FLASHLIGHT, PNG_APPLIST_FLASHLIGHT_IMAGE, PNG_APPLIST_FLASHLIGHT_IMAGE, "手电筒", STR_FLASHLIGHT, nullptr}, + {VIEW_SETTING, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_SETTING_IMAGE, "设置", STR_SETTINGS, nullptr}, + //{VIEW_AI_VOICE, PNG_APPLIST_AIVOICE_IMAGE, PNG_APPLIST_AIVOICE_IMAGE, "AI Voice", STR_AI_VOICE, nullptr}, #if 0 /*屏蔽Slice*/ - {VIEW_LANGUAGE_SWITCH, PNG_CONNECT_PHONE_IMAGE, PNG_CONNECT_PHONE_IMAGE, PNG_APPLIST_DEFAULT_IMG,"语言切换", nullptr}, - {VIEW_MAIN_TEMP, PNG_APPLIST_TEMP_IMAGE, PNG_APPLIST_TEMP_IMAGE, PNG_APPLIST_DEFAULT_IMG,"体温", nullptr}, - {VIEW_OFFLINEVOICE, PNG_APPLIST_VOCASSIST_IMAGE, PNG_APPLIST_VOCASSIST_IMAGE, PNG_APPLIST_DEFAULT_IMG,"语音助手", nullptr}, - {VIEW_UISAMPLE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_DEFAULT_IMG,"示例", nullptr}, - {VIEW_MESSAGE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_DEFAULT_IMG,"信息通知", nullptr}, - {VIEW_INDOORWALK, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_DEFAULT_IMG,"室内步行", nullptr}, - {VIEW_INDOORWALK, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_DEFAULT_IMG,"室内步行",STR_ACTIVITY, nullptr}, + {VIEW_LANGUAGE_SWITCH, PNG_CONNECT_PHONE_IMAGE, PNG_CONNECT_PHONE_IMAGE, "语言切换", nullptr}, + {VIEW_MAIN_TEMP, PNG_APPLIST_TEMP_IMAGE, PNG_APPLIST_TEMP_IMAGE, "体温", nullptr}, + {VIEW_OFFLINEVOICE, PNG_APPLIST_VOCASSIST_IMAGE, PNG_APPLIST_VOCASSIST_IMAGE, "语音助手", nullptr}, + {VIEW_UISAMPLE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_UI_SAMPLE_IMAGE, "示例", nullptr}, + {VIEW_MESSAGE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_CALLER_IMAGE, "信息通知", nullptr}, + {VIEW_INDOORWALK, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_WALK_IMAGE, "室内步行", nullptr}, + {VIEW_INDOORWALK, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_WALK_IMAGE, "室内步行",STR_ACTIVITY, nullptr}, #endif }; @@ -177,7 +177,6 @@ namespace OHOS applist[appLen].id = VIEW_EXTERN_APP; applist[appLen].iconLarge = bundleInfos[len].smallIconPath; applist[appLen].iconSmall = bundleInfos[len].smallIconPath; - applist[appLen].iconHexagon = bundleInfos[len].bigIconPath; applist[appLen].label = bundleInfos[len].label; applist[appLen].uid = bundleInfos[len].bundleName; @@ -245,15 +244,8 @@ namespace OHOS presenter = p; } - AppListStyle ApplistModel::GetCurrentStyle(void) + bool ApplistModel::GetIsUseListStyle(void) { - uint8_t currenStyle = SetDesktopView::GetInstance()->GetCurrentSelectedStyle(); - if (currenStyle == 1) { // 1: hexagons desktop style - return HEXAGONS_STYLE; - } else if (currenStyle == 2) { // 2: football desktop style - return FOOTBALL_STYLE; - } else { - return APPLIST_STYLE; - } + return (ThemeStyleModel::GetInstance().GetAppListDisplayStyle() == APPLIST_STYLE); } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp index 13e77d442..894097b44 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/applist/src/ApplistPresenter.cpp @@ -190,7 +190,7 @@ namespace OHOS { bool ApplistPresenter::GetIsUseListStyle(void) { - return model->GetCurrentStyle() == APPLIST_STYLE; + return model->GetIsUseListStyle(); } ApplistView* ApplistPresenter::GetAppListView() diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothWrapper.h b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothWrapper.h deleted file mode 100644 index 3c645feb1..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/include/BluetoothWrapper.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: BluetoothWrapper - * Author: - * Create: 2021-10-13 - */ -#ifndef BLUETOOTH_WRAPPER_H -#define BLUETOOTH_WRAPPER_H - -#include "common_def.h" -#include "bts_def.h" -#include "bts_gatt_stru.h" -#include "bts_gatt_server.h" -#include "bts_le_gap.h" - -#ifdef __cplusplus -extern "C" { -#endif - -errcode_t wrapper_gap_ble_register_callbacks(gap_ble_callbacks_t *func); -errcode_t wrapper_gatts_register_callbacks(gatts_callbacks_t *func); -void wrapper_ble_register(void); -errcode_t wrapper_gatts_register_server(bt_uuid_t *app_uuid, uint8_t *server_id); -errcode_t wrapper_gatts_add_service(uint8_t server_id, bt_uuid_t *service_uuid, bool is_primary); -void wrapper_gatts_service_start(void); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothWrapper.cpp b/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothWrapper.cpp deleted file mode 100644 index fd9dd57f0..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/bluetooth/src/BluetoothWrapper.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: BluetoothModel view - * Author: - * Create: 2021-10-13 - */ - -#include -#include "BluetoothWrapper.h" - -#ifdef __cplusplus -extern "C" { -#endif - -static bool gatts_register_flag = false; -static uint8_t gatts_server_id = 0; -std::list g_gap_ble_callback_list; -std::list g_gatts_callback_list; -std::list g_uuid_list; -std::list g_svr_handle_list; - -errcode_t wrapper_gap_ble_register_callbacks(gap_ble_callbacks_t *func) -{ - g_gap_ble_callback_list.push_back(*func); - return ERRCODE_SUCC; -} - -errcode_t wrapper_gatts_register_callbacks(gatts_callbacks_t *func) -{ - g_gatts_callback_list.push_back(*func); - return ERRCODE_SUCC; -} - -void wrapper_gap_ble_enable_callback(errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.ble_enable_cb != nullptr) { - callback.ble_enable_cb(status); - } - } -} - -void wrapper_gap_ble_disable_callback(errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.ble_disable_cb != nullptr) { - callback.ble_disable_cb(status); - } - } -} - -void wrapper_gap_ble_start_adv_callback(uint8_t adv_id, adv_status_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.start_adv_cb) { - callback.start_adv_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_stop_adv_callback(uint8_t adv_id, adv_status_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.stop_adv_cb) { - callback.stop_adv_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_set_adv_data_callback(uint8_t adv_id, errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.set_adv_data_cb) { - callback.set_adv_data_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_set_adv_param_callback(uint8_t adv_id, errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.set_adv_param_cb) { - callback.set_adv_param_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_scan_result_callback(gap_scan_result_data_t *scan_result_data) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.scan_result_cb) { - callback.scan_result_cb(scan_result_data); - } - } -} - -void wrapper_gap_ble_set_scan_param_callback(errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.set_scan_param_cb) { - callback.set_scan_param_cb(status); - } - } -} - -void wrapper_gap_ble_connect_state_changed_callback(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) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.conn_state_change_cb) { - callback.conn_state_change_cb(conn_id, addr, conn_state, pair_state, disc_reason); - } - } -} - -void wrapper_gap_ble_paired_complete_callback(uint16_t conn_id, const bd_addr_t *addr, errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.pair_result_cb) { - callback.pair_result_cb(conn_id, addr, status); - } - } -} - -void wrapper_gap_ble_terminate_adv_callback(uint8_t adv_id, adv_status_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.terminate_adv_cb) { - callback.terminate_adv_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_read_rssi_callback(uint16_t conn_id, int8_t rssi, errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.read_rssi_cb) { - callback.read_rssi_cb(conn_id, rssi, status); - } - } -} - -void wrapper_gap_ble_auth_complete_callback(uint16_t conn_id, const bd_addr_t *addr, - errcode_t status, const ble_auth_info_evt_t* evt) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.auth_complete_cb) { - callback.auth_complete_cb(conn_id, addr, status, evt); - } - } -} - -void wrapper_gap_ble_connect_param_update_callback(uint16_t conn_id, errcode_t status, - const gap_ble_conn_param_update_t *param) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.conn_param_update_cb) { - callback.conn_param_update_cb(conn_id, status, param); - } - } -} - -void wrapper_gatts_add_service_callback(uint8_t server_id, bt_uuid_t *uuid, uint16_t handle, errcode_t status) -{ - g_svr_handle_list.push_back(handle); - for (auto callback : g_gatts_callback_list) { - if (callback.add_service_cb) { - callback.add_service_cb(server_id, uuid, handle, status); - } - } -} -void wrapper_gatts_add_characteristic_callback(uint8_t server_id, bt_uuid_t *uuid, uint16_t service_handle, - gatts_add_character_result_t *result, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.add_characteristic_cb) { - callback.add_characteristic_cb(server_id, uuid, service_handle, result, status); - } - } -} -void wrapper_gatts_add_descriptor_callback(uint8_t server_id, bt_uuid_t *uuid, uint16_t service_handle, - uint16_t handle, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.add_descriptor_cb) { - callback.add_descriptor_cb(server_id, uuid, service_handle, handle, status); - } - } -} -void wrapper_gatts_start_service_callback(uint8_t server_id, uint16_t handle, errcode_t status) -{ - bool skip_flag = true; - for (auto svr_handle : g_svr_handle_list) { - if (svr_handle == handle) { - skip_flag = false; - } - } - if (!skip_flag) { - for (auto callback : g_gatts_callback_list) { - if (callback.start_service_cb) { - callback.start_service_cb(server_id, handle, status); - } - } - wrapper_gatts_service_start(); - } -} -void wrapper_gatts_stop_service_callback(uint8_t server_id, uint16_t handle, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.stop_service_cb) { - callback.stop_service_cb(server_id, handle, status); - } - } -} -void wrapper_gatts_delete_all_service_callback(uint8_t server_id, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.delete_service_cb) { - callback.delete_service_cb(server_id, status); - } - } -} -void wrapper_gatts_read_request_callback(uint8_t server_id, uint16_t conn_id, gatts_req_read_cb_t *read_cb_para, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.read_request_cb) { - callback.read_request_cb(server_id, conn_id, read_cb_para, status); - } - } -} -void wrapper_gatts_write_request_callback(uint8_t server_id, uint16_t conn_id, gatts_req_write_cb_t *write_cb_para, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.write_request_cb) { - callback.write_request_cb(server_id, conn_id, write_cb_para, status); - } - } -} -void wrapper_gatts_mtu_changed_callback(uint8_t server_id, uint16_t conn_id, uint16_t mtu_size, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.mtu_changed_cb) { - callback.mtu_changed_cb(server_id, conn_id, mtu_size, status); - } - } -} - -static gap_ble_callbacks_t g_wrapper_gap_ble_callbacks = { - .ble_enable_cb = wrapper_gap_ble_enable_callback, - .ble_disable_cb = wrapper_gap_ble_disable_callback, - .set_adv_data_cb = wrapper_gap_ble_set_adv_data_callback, - .set_adv_param_cb = wrapper_gap_ble_set_adv_param_callback, - .set_scan_param_cb = wrapper_gap_ble_set_scan_param_callback, - .start_adv_cb = wrapper_gap_ble_start_adv_callback, - .stop_adv_cb = wrapper_gap_ble_stop_adv_callback, - .scan_result_cb = wrapper_gap_ble_scan_result_callback, - .conn_state_change_cb = wrapper_gap_ble_connect_state_changed_callback, - .pair_result_cb = wrapper_gap_ble_paired_complete_callback, - .read_rssi_cb = wrapper_gap_ble_read_rssi_callback, - .terminate_adv_cb = wrapper_gap_ble_terminate_adv_callback, - .auth_complete_cb = wrapper_gap_ble_auth_complete_callback, - .conn_param_update_cb = wrapper_gap_ble_connect_param_update_callback, -}; - -static gatts_callbacks_t g_wrapper_gatts_callbacks = { - .add_service_cb = wrapper_gatts_add_service_callback, - .add_characteristic_cb = wrapper_gatts_add_characteristic_callback, - .add_descriptor_cb = wrapper_gatts_add_descriptor_callback, - .start_service_cb = wrapper_gatts_start_service_callback, - .stop_service_cb = wrapper_gatts_stop_service_callback, - .delete_service_cb = wrapper_gatts_delete_all_service_callback, - .read_request_cb = wrapper_gatts_read_request_callback, - .write_request_cb = wrapper_gatts_write_request_callback, - .mtu_changed_cb = wrapper_gatts_mtu_changed_callback, -}; - -void wrapper_ble_register(void) -{ - gap_ble_register_callbacks(&g_wrapper_gap_ble_callbacks); - gatts_register_callbacks(&g_wrapper_gatts_callbacks); -} - - -errcode_t wrapper_gatts_register_server(bt_uuid_t *app_uuid, uint8_t *server_id) -{ - errcode_t ret = ERRCODE_SUCC; - if (gatts_register_flag) { - *server_id = gatts_server_id; - ret = ERRCODE_SUCC; - } else { - gatts_register_flag = true; - ret = gatts_register_server(app_uuid, server_id); - gatts_server_id = *server_id; - } - return ret; -} - -errcode_t wrapper_gatts_add_service(uint8_t server_id, bt_uuid_t *service_uuid, bool is_primary) -{ - g_uuid_list.push_back(*service_uuid); - return ERRCODE_SUCC; -} - -void wrapper_gatts_service_start(void) -{ - if (!g_uuid_list.empty()) { - bt_uuid_t &uuid = g_uuid_list.front(); - // 服务异步添加,需要保证当前服务start后,再添加下一个服务 - (void)gatts_add_service(gatts_server_id, &uuid, true); - g_uuid_list.pop_front(); - } else { - g_svr_handle_list.clear(); - } -} - -#ifdef __cplusplus -} -#endif diff --git a/code/sdk/application/wearable/fd230app/nativeui/connectnewphone/src/ConnectOpenView.cpp b/code/sdk/application/wearable/fd230app/nativeui/connectnewphone/src/ConnectOpenView.cpp index fbc3e9262..b68888a45 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/connectnewphone/src/ConnectOpenView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/connectnewphone/src/ConnectOpenView.cpp @@ -7,7 +7,7 @@ #include "wearable_log.h" #include "UiConfig.h" #include "ConnectPhonePresenter.h" -#include "custom_utils.h" + namespace OHOS { static ConnectOpenView *g_pConnectOpenView{nullptr}; ConnectOpenView::ConnectOpenView() @@ -45,10 +45,7 @@ void ConnectOpenView::ShowUpBackView() return; } watchNameLabel->SetPosition(0, 165, HORIZONTAL_RESOLUTION, 45); // 0:x 244:y 454:width 45:height - uint8_t btname[32]={0}; - uint32_t len=sizeof(btname); - uapi_get_nv_btname(btname,&len); - watchNameLabel->SetText((char*)btname); + watchNameLabel->SetText(ConnectPhonePresenter::GetInstance()->getWatchName()); watchNameLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); // 40:font data watchNameLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); watchNameLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, diff --git a/code/sdk/application/wearable/fd230app/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp index deb576cbd..67014059c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp @@ -11,6 +11,7 @@ #include "bts_le_gap.h" #include "drag_event.h" #include "cmsis_os.h" +#include "tcxo.h" #include "UiConfig.h" #include "wearable_log.h" @@ -76,11 +77,11 @@ void ConnectPhonePresenter::RemovePair() unsigned int connedDevicesNum = 0; bool ret = gap_get_paired_devices_num(&connedDevicesNum); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Setup GapGetPariedDevicesNum ret = %d, num = %d", ret, connedDevicesNum); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Setup GetPariedDevicesNum ret = %d, num = %d", ret, connedDevicesNum); if (connedDevicesNum != 0) { gap_paired_device_info_t *devInfo = (gap_paired_device_info_t *)malloc(sizeof(gap_paired_device_info_t) * connedDevicesNum); - if (devInfo == nullptr) { + if (devInfo == NULL) { return; } ret = gap_get_paired_devices_list(devInfo, (int *)&connedDevicesNum); @@ -94,18 +95,27 @@ void ConnectPhonePresenter::RemovePair() } free(devInfo); } - - (void)gap_ble_remove_all_pairs(); } void ConnectPhonePresenter::ConfirmOnClick() { bool ret; + + memset_s(watchName, sizeof(watchName), 0, sizeof(watchName)); + (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) { + 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) { + if (ret == false) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectPhonePresenter bt gap_br_set_bt_scan_mode ret = 0x%x", ret); } +#ifndef SUPPORT_ALIPAY_SEC BleAdvStart(); +#endif } bool ConnectPhonePresenter::OnDrag(UIView& view, const DragEvent& event) @@ -121,4 +131,9 @@ bool ConnectPhonePresenter::OnDrag(UIView& view, const DragEvent& event) return true; } +char* ConnectPhonePresenter::getWatchName() +{ + return watchName; } + +} \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialDigitalImgView.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialDigitalImgView.h index 2817eabc9..443c325ee 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialDigitalImgView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialDigitalImgView.h @@ -39,7 +39,7 @@ public: private: void SetNumImg(UIImageView* img, const ImageInfo *info); void FillIntegerPart(uint16_t intVal); - void FillDecimalPart(float data); + void FillDecimalPart(uint16_t intVal); void HandlePosition(); bool CreateImageViews(float data); diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialViewGroup.h b/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialViewGroup.h index 8f139fbfa..d50a7d395 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialViewGroup.h +++ b/code/sdk/application/wearable/fd230app/nativeui/main/include/dial/DialViewGroup.h @@ -112,14 +112,11 @@ public: * @brief This function is invoked when the function SetHorCurrentPage() is called. */ void OnActive(void) override; - - void OnInactive(void) override; - + private: bool resLoadStatus{false}; - private: void ProcessData(DialDataType type, DialView* view); std::unordered_map dataTypeMap_; diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp index 993177c91..d2e7b35ea 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/MainPresenterSample.cpp @@ -308,15 +308,16 @@ namespace OHOS { return; } - int32_t playerState; - PlayersModel::GetInstance()->GetPlayerCtr()->GetPlayerState(playerState); - state_ = playersView->GetPlayerButtonState(); - if ((playerState != PLAYER_STARTED) && (state_ == UICheckBox::UICheckBoxState::SELECTED)) { - playersView->SetPlayerButtonState(UICheckBox::UICheckBoxState::UNSELECTED); - } else if ((playerState == PLAYER_STARTED) && (state_ == UICheckBox::UICheckBoxState::UNSELECTED)) { - playersView->SetPlayerButtonState(UICheckBox::UICheckBoxState::SELECTED); - } - if (state_ == UICheckBox::UICheckBoxState::SELECTED) { + state_ = playersView->GetPlayerButtonState(); + if (state_ == UICheckBox::UICheckBoxState::SELECTED) + { + int32_t playerState; + PlayersModel::GetInstance()->GetPlayerCtr()->GetPlayerState(playerState); + if (playerState != PLAYER_STARTED) + { + playersView->SetPlayerButtonState(UICheckBox::UICheckBoxState::UNSELECTED); + return; + } PlayersModel::GetInstance()->GetPlayerCtr()->GetCurrentTime(playerCurrentTime_); PlayersModel::GetInstance()->GetDuration(playerMusicDuration_); if (playerMusicDuration_ != 0) diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialDigitalImgView.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialDigitalImgView.cpp index 065036851..04ccf1052 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialDigitalImgView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialDigitalImgView.cpp @@ -89,18 +89,9 @@ void DialDigitalImgView::SetNumImg(UIImageView* img, const ImageInfo *info) currentIndex_++; } -static uint8_t GetValueLength(uint16_t value) -{ - uint8_t length = 1; - if (value > 0) { - length = log10(value) + 1; - } - return length; -} - void DialDigitalImgView::FillIntegerPart(uint16_t intVal) { - uint8_t length = GetValueLength(intVal); + uint8_t length = log10(intVal) + 1; if (length < allocIntegerLen_) { for (uint8_t i = 0; i < (allocIntegerLen_ - length); i++) { SetNumImg(imgs_[currentIndex_], numInfo_[0]); @@ -112,21 +103,18 @@ void DialDigitalImgView::FillIntegerPart(uint16_t intVal) } } -void DialDigitalImgView::FillDecimalPart(float data) +void DialDigitalImgView::FillDecimalPart(uint16_t intVal) { - uint8_t startIndex = GetValueLength(static_cast(abs(data))) + 1; - char dataStr[10] = {'\0'}; // 10: max number of digits. - sprintf_s(dataStr, 10, "%f", data); // 10: size of dataStr - - for (uint8_t i = 0; i < decimalPrecision_; i++) { - uint8_t index = startIndex + i; - if ((index < 10) && (dataStr[index] != '\0')) { // 10: size of dataStr - uint8_t val = dataStr[index] - '0'; - SetNumImg(imgs_[currentIndex_], numInfo_[val]); - } else { + uint8_t length = log10(intVal) + 1; + if (length < decimalPrecision_) { + for (uint8_t i = 0; i < (decimalPrecision_ - length); i++) { SetNumImg(imgs_[currentIndex_], numInfo_[0]); } } + for (uint8_t i = 0; i < length; i++) { + uint8_t curNum = static_cast(intVal / (pow(10, length - i - 1))) % 10; // 10: conversion + SetNumImg(imgs_[currentIndex_], numInfo_[curNum]); + } } void DialDigitalImgView::HandlePosition() @@ -146,7 +134,6 @@ void DialDigitalImgView::HandlePosition() for (uint8_t i = 0; i < currentIndex_; i++) { parent_->Add(imgs_[i]); imgs_[i]->SetPosition(curX, alignPos_.y); - imgs_[i]->Invalidate(); curX += imgs_[i]->GetWidth() + space_; } } @@ -154,9 +141,8 @@ void DialDigitalImgView::HandlePosition() bool DialDigitalImgView::CreateImageViews(float data) { uint8_t imgCnt = 0; - uint16_t integer = static_cast(abs(data)); - - uint8_t actualIntegerLen = GetValueLength(integer); + uint32_t integer = static_cast(abs(data)); + uint8_t actualIntegerLen = log10(integer) + 1; if (integerLength_ == 0) { imgCnt = actualIntegerLen; @@ -178,7 +164,6 @@ bool DialDigitalImgView::CreateImageViews(float data) if (imgCnt_ != 0) { for (uint8_t i = 0; i < imgCnt_; i++) { if (parent_ != nullptr) { - imgs_[i]->Invalidate(); parent_->Remove(imgs_[i]); } } @@ -225,7 +210,9 @@ void DialDigitalImgView::HandleFloatData(float data) if (decimalPrecision_ != 0 && decimalPointInfo_ != nullptr) { SetNumImg(imgs_[currentIndex_], decimalPointInfo_); - FillDecimalPart(data); + // 10: conversion + uint16_t decimalVal = static_cast((abs(data) - intVal) * (pow(10, decimalPrecision_))); + FillDecimalPart(decimalVal); } HandlePosition(); value_ = data; diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialViewGroup.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialViewGroup.cpp index ec66f2cb6..c0185778d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialViewGroup.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/DialViewGroup.cpp @@ -397,16 +397,4 @@ void DialViewGroup::OnActive(void) kaleidoscope_->StartRotateAnimator(); } } - -void DialViewGroup::OnInactive(void) -{ - if (video_ != nullptr) { - if (!video_->IsStopped()) { - video_->StopPlay(); - } - } else if (kaleidoscope_ != nullptr) { - kaleidoscope_->StopRotateAnimator(); - kaleidoscope_->ClearFocus(); - } -} } diff --git a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/parser/DialBinParser.cpp b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/parser/DialBinParser.cpp index a61df4821..b2978d168 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/parser/DialBinParser.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/main/src/dial/parser/DialBinParser.cpp @@ -93,21 +93,21 @@ bool DialBinParser::GetDialPreviewInfo(FILE* fp, DialPreviewInfo* info) if (memcpy_s(info->dialName, DIAL_NAME_MAX_LEN, dialHeader->dialName, DIAL_NAME_MAX_LEN) != EOK) { GRAPHIC_LOGE("[%s: %d]memcpy_s dial name fail!\n", __FUNCTION__, __LINE__); - UIFree(dialHeader); + free(dialHeader); return false; } if (memcpy_s(info->description, DIAL_DESCRIPTION_MAX_LEN, dialHeader->description, DIAL_DESCRIPTION_MAX_LEN) != EOK) { GRAPHIC_LOGE("[%s: %d]memcpy_s dial description fail!\n", __FUNCTION__, __LINE__); - UIFree(dialHeader); + free(dialHeader); return false; } info->imgId = dialHeader->previewImgId | dirId_; info->offset = dialHeader->imageOffset; - UIFree(dialHeader); + free(dialHeader); return true; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp index 055adb27a..bada5b8de 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phoneservice/src/PhoneService.cpp @@ -1093,43 +1093,41 @@ 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); - void *publishData = malloc(size); - if (publishData == nullptr) { + /* 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; } - ret = memcpy_s(publishData, size, (const void *)&callsInfo, size); + request->msgId = topic; + ret = memcpy_s(request->data, size, (const void *)&callsInfo, size); if (ret != EOK) { - free(publishData); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish memcpy_s fail! ret = %d", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish memcpy_s rateDataTmp fail! ret:%d", ret); return; } - - Request request = { - .msgId = topic, - .len = size, - .msgValue = 0, - .data = publishData, - }; + request->len = size; + request->msgValue = 0; /* public request */ api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); if (api == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetFeatureApi failed"); - free(publishData); + 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"); - free(publishData); + SAMGR_FreeRequestMsg(request); return; } - broadcastApi->PublishTopic((IUnknown *)broadcastApi, &request); + broadcastApi->PublishTopic((IUnknown *)broadcastApi, request); broadcastApi->Release((IUnknown *)broadcastApi); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish end!!"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/rtcservice/src/RtcService.cpp b/code/sdk/application/wearable/fd230app/nativeui/rtcservice/src/RtcService.cpp index 423c7e6ea..088111b52 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/rtcservice/src/RtcService.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/rtcservice/src/RtcService.cpp @@ -82,6 +82,7 @@ static BOOL ServiceMessageHandle(Service *service, Request *request) if (request == nullptr) { return FALSE; } + SAMGR_FreeRequestMsg(request); return TRUE; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h index 1365f7ac6..500f1a030 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopModel.h @@ -18,7 +18,6 @@ typedef enum { APPLIST_STYLE, //列表显示 HEXAGONS_STYLE, //蜂窝显示 - FOOTBALL_STYLE } DesktopStyle; namespace OHOS { diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h index b208dcf87..165c6d95a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopPresenter.h @@ -22,7 +22,6 @@ namespace OHOS { static const char *SET_DESKTOP_LIST = "setdesktopList"; static const char *SET_DESKTOP_HEXAGONS = "setdesktopHexagons"; -static const char *SET_DESKTOP_FOOTBALL = "setdesktopFootball"; class SetDesktopView; class SetDesktopModel; @@ -43,7 +42,7 @@ public: bool OnDrag(UIView& view, const DragEvent& event) override; bool OnKeyAct(UIView &view, const KeyEvent &event) override; // 增加按键事件 - uint8_t GetCurrentStyle(void); + bool GetHexagonsStyleState(void); private: }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopView.h b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopView.h index 1a6a808c9..d1827c77a 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/include/SetDesktopView.h @@ -36,21 +36,15 @@ public: void OnSetUpView() override; void OnTearDownView() override; void OnStop() override; - void UpdateSelectedStyle(uint8_t selectedStyle); - uint8_t GetCurrentSelectedStyle(void); - + void UpdateSelectedStyle(bool hexagonsSelected); private: - void InitFootballItem(); UILabel titleText; UIToggleButton hexagonsBtn; UIToggleButton listBtn; - UIToggleButton footballBtn_; UIImageView hexagonsImage; UIImageView listImage; - UIImageView footballImage_; UILabel listText; UILabel hexagonsText; - UILabel footballText_; }; } #endif // SET_DESKTOP_VIEW_H diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp index 17459538a..c84a75079 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopModel.cpp @@ -30,8 +30,6 @@ namespace OHOS { (void)UtilsGetValue("applist_style", temp, STYLE_VALUE_LEN); if (strcmp(temp, "hexagons") == 0) { style = HEXAGONS_STYLE; - } else if (strcmp(temp, "football") == 0) { - style = FOOTBALL_STYLE; } else { style = APPLIST_STYLE; } @@ -44,8 +42,6 @@ namespace OHOS { (void)UtilsSetValue("applist_style", "list"); } else if (style == HEXAGONS_STYLE) { (void)UtilsSetValue("applist_style", "hexagons"); - } else if (style == FOOTBALL_STYLE) { - (void)UtilsSetValue("applist_style", "football"); } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp index abc616b65..527a7283b 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopPresenter.cpp @@ -71,26 +71,17 @@ namespace OHOS { SetDesktopModel::GetInstance().SetDesktopStyle(HEXAGONS_STYLE); } else if (strcmp(view.GetViewId(), SET_DESKTOP_LIST) == 0) { SetDesktopModel::GetInstance().SetDesktopStyle(APPLIST_STYLE); - } else if (strcmp(view.GetViewId(), SET_DESKTOP_FOOTBALL) == 0) { - SetDesktopModel::GetInstance().SetDesktopStyle(FOOTBALL_STYLE); } //uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); //NativeAbility::GetInstance().ChangeSlice(preSlice); NativeAbility::GetInstance().Back(); return true; } - uint8_t SetDesktopPresenter::GetCurrentStyle(void) + bool SetDesktopPresenter::GetHexagonsStyleState(void) { - DesktopStyle style = SetDesktopModel::GetInstance().GetDesktopStyle(); - if (style == HEXAGONS_STYLE) { - return 1; // 1: hexagons style enum index - } else if (style == FOOTBALL_STYLE) { - return 2; // 2: football style enum index - } - return 0; + return (SetDesktopModel::GetInstance().GetDesktopStyle() == HEXAGONS_STYLE); } - bool SetDesktopPresenter::OnKeyAct(UIView &view, const KeyEvent &event) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDesktopPresenter::OnKeyAct"); diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopView.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopView.cpp index 90c134da5..9609c70a5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_desktop/src/SetDesktopView.cpp @@ -47,43 +47,41 @@ void SetDesktopView::OnSetUpView() titleText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); container_->Add(&titleText); - listImage.SetPosition(0, 135, 190, 190); + listImage.SetPosition(25, 135, 190, 190); listImage.SetSrc(PNG_SET_DESKTOP_BG_IMAGE); container_->Add(&listImage); - listBtn.SetPosition(22, 157, 148, 148); + listBtn.SetPosition(47, 157, 148, 148); listBtn.SetImages(PNG_SET_DESKTOP_LIST_IMAGE, PNG_SET_DESKTOP_LIST_IMAGE); listBtn.SetViewId(SET_DESKTOP_LIST); container_->Add(&listBtn); - listText.SetPosition(61, 328, 200, 60); + listText.SetPosition(96, 328, 200, 60); listText.SetText("列表"); listText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); listText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); listText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); container_->Add(&listText); - hexagonsImage.SetPosition(150, 135, 190, 190); + hexagonsImage.SetPosition(247, 135, 190, 190); hexagonsImage.SetSrc(PNG_SET_DESKTOP_BG_IMAGE); container_->Add(&hexagonsImage); - hexagonsBtn.SetPosition(172, 157, 148, 148); + hexagonsBtn.SetPosition(267, 157, 148, 148); hexagonsBtn.SetImages(PNG_SET_DESKTOP_HEXAGONS_IMAGE, PNG_SET_DESKTOP_HEXAGONS_IMAGE); hexagonsBtn.SetViewId(SET_DESKTOP_HEXAGONS); container_->Add(&hexagonsBtn); - hexagonsText.SetPosition(218, 328, 200, 60); + hexagonsText.SetPosition(305, 328, 200, 60); hexagonsText.SetText("蜂窝"); hexagonsText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); hexagonsText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); hexagonsText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); container_->Add(&hexagonsText); - InitFootballItem(); listBtn.SetOnClickListener(presenter_); hexagonsBtn.SetOnClickListener(presenter_); - footballBtn_.SetOnClickListener(presenter_); - UpdateSelectedStyle(presenter_->GetCurrentStyle()); + UpdateSelectedStyle(presenter_->GetHexagonsStyleState()); } void SetDesktopView::OnTearDownView() @@ -103,48 +101,11 @@ void SetDesktopView::OnStop() } } -void SetDesktopView::UpdateSelectedStyle(uint8_t selectedStyle) +void SetDesktopView::UpdateSelectedStyle(bool hexagonsSelected) { - hexagonsImage.SetVisible(false); - hexagonsBtn.SetState(false); - listImage.SetVisible(false); - listBtn.SetState(false); - footballImage_.SetVisible(false); - footballBtn_.SetState(false); - - if (selectedStyle == 1) { // 1: select hexagons style - hexagonsImage.SetVisible(true); - hexagonsBtn.SetState(true); - } else if (selectedStyle == 2) { // 2: select football style - footballImage_.SetVisible(true); - footballBtn_.SetState(true); - } else { - listImage.SetVisible(true); - listBtn.SetState(true); - } -} - -void SetDesktopView::InitFootballItem() -{ - footballImage_.SetPosition(300, 135, 190, 190); - footballImage_.SetSrc(PNG_SET_DESKTOP_BG_IMAGE); - container_->Add(&footballImage_); - - footballBtn_.SetPosition(322, 157, 148, 148); - footballBtn_.SetImages(PNG_SET_DESKTOP_HEXAGONS_IMAGE, PNG_SET_DESKTOP_HEXAGONS_IMAGE); - footballBtn_.SetViewId(SET_DESKTOP_FOOTBALL); - container_->Add(&footballBtn_); - - footballText_.SetPosition(368, 328, 200, 60); - footballText_.SetText("足球"); - footballText_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - footballText_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - footballText_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - container_->Add(&footballText_); -} - -uint8_t SetDesktopView::GetCurrentSelectedStyle() -{ - return presenter_->GetCurrentStyle(); + listImage.SetVisible(!hexagonsSelected); + hexagonsImage.SetVisible(hexagonsSelected); + hexagonsBtn.SetState(hexagonsSelected); + listBtn.SetState(!hexagonsSelected); } } diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialPresenter.h b/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialPresenter.h index fb895078b..1af1cc92c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialPresenter.h +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialPresenter.h @@ -11,7 +11,6 @@ #include "SetDialModel.h" #include "Presenter.h" #include "components/ui_view.h" -#include "components/ui_roller_view.h" #include "KeyInputListener.h" #include "ModelListenerSample.h" @@ -23,8 +22,7 @@ class SetDialView; class SetDialModel; class SetDialPresenter : public Presenter, public UIView::OnClickListener, public ModelListenerSample, - public UICoverflowView::OnCoverflowScrollListener, - public UIRollerView::OnScrollListener { + public UICoverflowView::OnCoverflowScrollListener { public: SetDialPresenter(); ~SetDialPresenter() override; @@ -37,7 +35,6 @@ public: void OnTickEvent() override; void Notify() override {} bool OnScroll() override; - void OnScroll(UIRollerView* roller, std::string currentItemName, float currentItemAngle) override; bool OnClick(UIView &view, const ClickEvent &event) override; void ResetTickTimer(void); private: diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialView.h b/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialView.h index 0a0408dfd..0a7f564fe 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialView.h +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/include/SetDialView.h @@ -11,7 +11,6 @@ #include "View.h" #include "components/ui_view_group.h" #include "components/ui_coverflow_view.h" -#include "components/ui_roller_view.h" #include "window/window.h" #include "BaseView.h" #include "ChangeSliceListener.h" @@ -21,12 +20,6 @@ namespace OHOS { static constexpr uint8_t DIVISOR_TWO = 2; class SetDialPresenter; -enum class DialStyle { - COVERFLOW = 0, - ROLLER, - STYLE_NUM -}; - class SetDialView : public View { public: SetDialView(); @@ -43,14 +36,10 @@ public: void OnTearDownView() override; void OnStop() override; void CoverflowViewScroll(void); - void RollerViewScroll(std::string currentItemName, float currentItemAngle); uint8_t GetCoverflowPage(void); private: void SetUpCoverflowView(void); - void SetUpRollerView(void); UICoverflowView coverflow_; - UIRollerView rollerView_; - int16_t rollerItemNum_ = 0; UILabel label_; uint8_t lastIndex_; }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp index 2dc21b60e..6ad00d507 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialPresenter.cpp @@ -67,11 +67,6 @@ namespace OHOS { return true; } - void SetDialPresenter::OnScroll(UIRollerView* roller, std::string currentItemName, float currentItemAngle) - { - view_->RollerViewScroll(currentItemName, currentItemAngle); - } - size_t SetDialPresenter::GetDialCount(void) { return model->GetDialCount(); diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialView.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialView.cpp index 82a55d015..daa69cd6f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/set_dial/src/SetDialView.cpp @@ -8,7 +8,6 @@ #include #include "SetDialView.h" #include "SetDialPresenter.h" -#include "SetDialStyleModel.h" namespace OHOS { SetDialView::SetDialView() @@ -27,11 +26,7 @@ void SetDialView::OnStart() View::OnStart(); SetContainerView(new UIViewGroup()); container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - if (SetDialStyleModel::GetInstance().GetStyle() == DialStyle::COVERFLOW) { - SetUpCoverflowView(); - } else { - SetUpRollerView(); - } + SetUpCoverflowView(); } void SetDialView::SetUpCoverflowView(void) @@ -40,7 +35,6 @@ void SetDialView::SetUpCoverflowView(void) coverflow_.SetIntercept(true); coverflow_.SetOnCoverflowListener(presenter_); coverflow_.SetOnClickListener(presenter_); - coverflow_.SetThrowDrag(true); std::vector &dialInfo = presenter_->GetDialInfo(); for (auto iter : dialInfo) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialView::SetUpCoverflowView %s", @@ -55,43 +49,11 @@ void SetDialView::SetUpCoverflowView(void) label_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label_.SetText(dialInfo[lastIndex_].dialName.c_str()); label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - + container_->Add(&coverflow_); container_->Add(&label_); } -void SetDialView::SetUpRollerView(void) -{ - rollerView_.SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - rollerView_.SetItemSize(150, 150); // 150: item size - rollerView_.SetThrowDrag(true); - rollerView_.SetItemPadding(80); // 80: item padding - container_->Add(&rollerView_); - - std::vector &dialInfo = presenter_->GetDialInfo(); - for (auto iter : dialInfo) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialView::SetUpRollerView %s", - iter.dialName.c_str()); - bool succ = rollerView_.AddItem(iter.dialName, iter.preImageInfo); - rollerItemNum_ += succ ? 1 : 0; - } - float scalerCoef = 0.55; - uint16_t w = Screen::GetInstance().GetWidth(); - uint16_t h = Screen::GetInstance().GetHeight(); - rollerView_.SetItemSize(w * scalerCoef, h * scalerCoef); - lastIndex_ = presenter_->GetPageIndex(); - rollerView_.SetCurrentItem(dialInfo[lastIndex_].dialName); - rollerView_.SetOnClickListener(presenter_); - rollerView_.SetOnScrollListener(presenter_); - - label_.SetPosition(127, 50, 200, 50); - label_.SetTextColor(Color::White()); - label_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label_.SetText(dialInfo[lastIndex_].dialName.c_str()); - label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - container_->Add(&label_); -} - void SetDialView::OnSetUpView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialView::OnSetUpView"); @@ -149,29 +111,6 @@ void SetDialView::CoverflowViewScroll(void) presenter_->ResetTickTimer(); } -void SetDialView::RollerViewScroll(std::string currentItemName, float currentItemAngle) -{ - const float baseAngle = 360.0; - const float halfBaseAngle = 180.0; - if (FloatMoreEqual(currentItemAngle, halfBaseAngle)) { - currentItemAngle -= baseAngle; - } - if (currentItemAngle < 0) { - currentItemAngle = -currentItemAngle; - } - float maxAngle = baseAngle / rollerItemNum_; - float coef = 1.0 - 1.0 / (maxAngle) * currentItemAngle; - label_.SetStyle(STYLE_TEXT_OPA, coef * OPA_OPAQUE); - label_.SetText(currentItemName.c_str()); - std::vector &dialInfo = presenter_->GetDialInfo(); - for (uint8_t i = 0; i < dialInfo.size(); ++i) { - if (dialInfo[i].dialName == currentItemName) { - lastIndex_ = i; - } - } - presenter_->ResetTickTimer(); -} - uint8_t SetDialView::GetCoverflowPage(void) { return lastIndex_; diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStyleModel.h b/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStyleModel.h deleted file mode 100644 index c27e3007a..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStyleModel.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStyleModel.h - * Author: - * Create: 2024-06-06 - */ - -#ifndef SET_DIAL_STYLE_MODEL_H -#define SET_DIAL_STYLE_MODEL_H -#include "SetDialView.h" -#include "components/ui_view.h" - -namespace OHOS { -class SetDialStyleModel { -public: - static SetDialStyleModel& GetInstance() - { - static SetDialStyleModel model; - return model; - } - - void SetStyle(DialStyle style); - DialStyle GetStyle(); - -private: - constexpr static uint8_t MAX_LEN = 32; - const char key_[MAX_LEN] = "set_dial_style"; - struct { - const DialStyle style; - const char value[MAX_LEN]; - } values_[static_cast(DialStyle::STYLE_NUM)] = { - {DialStyle::COVERFLOW, "DialStyle::COVERFLOW"}, - {DialStyle::ROLLER, "DialStyle::ROLLER"}, - }; - SetDialStyleModel(); - ~SetDialStyleModel(); - SetDialStyleModel(const SetDialStyleModel&) = delete; - SetDialStyleModel& operator=(const SetDialStyleModel&) = delete; -}; -} // OHOS -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStylePresenter.h b/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStylePresenter.h deleted file mode 100644 index fda918ece..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStylePresenter.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStylePresenter.h - * Author: - * Create: 2024-06-06 - */ - -#ifndef SET_DIAL_STYLE_PRESENTER_H -#define SET_DIAL_STYLE_PRESENTER_H -#include "SetDialView.h" -#include "components/ui_view.h" -#include "Presenter.h" - -namespace OHOS { -class SetDialStyleModel; -class SetDialStyleView; -class SetDialStylePresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SetDialStylePresenter(); - ~SetDialStylePresenter(); - SetDialStylePresenter(const SetDialStylePresenter&) = delete; - SetDialStylePresenter& operator=(const SetDialStylePresenter&) = delete; - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - DialStyle GetCurrentStyle() const - { - return curStyle_; - } - -private: - DialStyle curStyle_ = DialStyle::COVERFLOW; -}; - -} // OHOS -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStyleView.h b/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStyleView.h deleted file mode 100644 index 3b1a93221..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/include/SetDialStyleView.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStyleView.h - * Author: - * Create: 2024-06-06 - */ - -#ifndef SET_DIAL_STYLE_VIEW_H -#define SET_DIAL_STYLE_VIEW_H -#include "components/ui_view.h" -#include "components/ui_label.h" -#include "components/ui_view_group.h" -#include "components/ui_toggle_button.h" -#include "SetDialView.h" -#include "View.h" - -namespace OHOS { -class SetDialStylePresenter; -class SetDialStyleView : public View { -public: - SetDialStyleView(); - ~SetDialStyleView() override; - SetDialStyleView(const SetDialStyleView &) = delete; - SetDialStyleView& operator=(const SetDialStyleView &) = delete; - - void OnStart() override; - void OnSetUpView() override; - void OnStop() override; - void OnClick(UIView &view); - -private: - UILabel labelCover_; - UILabel labelRoller_; - UIToggleButton btnCover_; - UIToggleButton btnRoller_; - struct { - UIToggleButton *btn; - DialStyle style; - } styleTable_[static_cast(DialStyle::STYLE_NUM)] = { - {&btnCover_, DialStyle::COVERFLOW}, - {&btnRoller_, DialStyle::ROLLER}, - }; -}; -} // OHOS -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStyleModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStyleModel.cpp deleted file mode 100644 index 81d833aef..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStyleModel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStyleModel.cpp - * Author: - * Create: 2024-06-06 - */ - -#include "SetDialStyleModel.h" -#include "kv_store.h" - -namespace OHOS { -void SetDialStyleModel::SetStyle(DialStyle style) -{ - int len = sizeof(values_) / sizeof(values_[0]); - for (int i = 0; i < len; ++i) { - if (values_[i].style == style) { - UtilsSetValue(key_, values_[i].value); - break; - } - } -} - -DialStyle SetDialStyleModel::GetStyle() -{ - int len = sizeof(values_) / sizeof(values_[0]); - char temp[MAX_LEN]; - UtilsGetValue(key_, temp, MAX_LEN); - for (int i = 0; i < len; ++i) { - if (strcmp(temp, values_[i].value) == 0) { - return values_[i].style; - } - } - return DialStyle::COVERFLOW; -} - -SetDialStyleModel::SetDialStyleModel() -{ -} - -SetDialStyleModel::~SetDialStyleModel() -{ -} -} // OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStylePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStylePresenter.cpp deleted file mode 100644 index 6dbc2837a..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStylePresenter.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStylePresenter.cpp - * Author: - * Create: 2024-06-06 - */ - -#include "SetDialStyleView.h" -#include "SetDialStyleModel.h" -#include "SetDialStylePresenter.h" - -namespace OHOS { -SetDialStylePresenter::SetDialStylePresenter() -{ - Attach(&SetDialStyleModel::GetInstance()); -} - -SetDialStylePresenter::~SetDialStylePresenter() -{ -} - -bool SetDialStylePresenter::OnClick(UIView &view, const ClickEvent &event) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialStylePresenter::OnClick"); - view_->OnClick(view); - return true; -} - -bool SetDialStylePresenter::OnDrag(UIView& view, const DragEvent& event) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialStylePresenter::OnDrag"); - UNUSED(view); - 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"); - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(preSlice); - } - return true; -} -} // OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStyleView.cpp b/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStyleView.cpp deleted file mode 100644 index 86901f059..000000000 --- a/code/sdk/application/wearable/fd230app/nativeui/set_dial_style/src/SetDialStyleView.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStyleView.cpp - * Author: - * Create: 2024-06-06 - */ - -#include "SetDialStyleView.h" -#include "SetDialStyleModel.h" -#include "SetDialStylePresenter.h" - -namespace OHOS { -SetDialStyleView::SetDialStyleView() -{ -} - -SetDialStyleView::~SetDialStyleView() -{ -} - -void SetDialStyleView::OnStart() -{ - View::OnStart(); - SetContainerView(new UIViewGroup); - if (container_ == nullptr) { - return; - } - container_->SetDraggable(true); - container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - container_->SetOnDragListener(presenter_); - container_->SetTouchable(true); -} - -void SetDialStyleView::OnSetUpView() -{ - if (container_ == nullptr) { - return; - } - View::OnSetUpView(); - labelCover_.SetPosition(96, 328, 200, 60); - labelCover_.SetText("Coverflow"); - container_->Add(&labelCover_); - - labelRoller_.SetPosition(305, 328, 200, 60); - labelRoller_.SetText("Roller"); - container_->Add(&labelRoller_); - - btnCover_.SetPosition(47, 157, 148, 148); - container_->Add(&btnCover_); - btnRoller_.SetPosition(267, 157, 148, 148); - container_->Add(&btnRoller_); - - const DialStyle style = SetDialStyleModel::GetInstance().GetStyle(); - int len = sizeof(styleTable_) / sizeof(styleTable_[0]); - for (int i = 0; i < len; ++i) { - if (style == styleTable_[i].style) { - styleTable_[i].btn->SetState(true); - } else { - styleTable_[i].btn->SetState(false); - } - } - - btnCover_.SetOnClickListener(presenter_); - btnRoller_.SetOnClickListener(presenter_); -} - -void SetDialStyleView::OnStop() -{ - View::OnStop(); - if (container_ != nullptr) { - container_->RemoveAll(); - delete container_; - container_ = nullptr; - } -} - -void SetDialStyleView::OnClick(UIView &view) -{ - const UIToggleButton *ptr = dynamic_cast(&view); - if (ptr == nullptr) { - return; - } - int len = sizeof(styleTable_) / sizeof(styleTable_[0]); - for (int i = 0; i < len; ++i) { - if (ptr == styleTable_[i].btn) { - styleTable_[i].btn->SetState(true); - SetDialStyleModel::GetInstance().SetStyle(styleTable_[i].style); - } else { - styleTable_[i].btn->SetState(false); - } - } -} -} // OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleModel.h b/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleModel.h index 00dd7e39a..2b5f3371c 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleModel.h +++ b/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleModel.h @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-06-14 09:40:13 - * @LastEditors: SnickerSun snickersun@163.com - * @LastEditTime: 2024-07-02 20:02:35 + * @LastEditors: luozheng 1732036298@qq.com + * @LastEditTime: 2024-06-18 14:42:57 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/themestyle/include/ThemeStyleModel.h */ #ifndef SET_THEMESTYLE_MODEL_H @@ -20,13 +20,11 @@ namespace OHOS static constexpr const char *THEMESTYLE_KEY = "applist_style"; static constexpr const char *THEMESTYLE_VALUE_LIST = "list"; static constexpr const char *THEMESTYLE_VALUE_HEXAGONS = "hexagons"; - static constexpr const char *THEMESTYLE_VALUE_FOOTBALL = "football"; typedef enum : uint16_t { APPLIST_STYLE, // 列表显示 HEXAGONS_STYLE, // 蜂窝显示 - FOOTBALL_STYLE, //足球 MAX_THEME_STYLE, } ThemeStyle; @@ -34,7 +32,6 @@ namespace OHOS const std::map ThemeStyleMap = { {ThemeStyle::APPLIST_STYLE, THEMESTYLE_VALUE_LIST}, {ThemeStyle::HEXAGONS_STYLE, THEMESTYLE_VALUE_HEXAGONS}, - {ThemeStyle::FOOTBALL_STYLE, THEMESTYLE_VALUE_FOOTBALL}, // 在此处添加更多的映射关系 }; @@ -42,7 +39,6 @@ namespace OHOS const std::unordered_map ReverseThemeStyleMap = { {THEMESTYLE_VALUE_LIST, ThemeStyle::APPLIST_STYLE}, {THEMESTYLE_VALUE_HEXAGONS, ThemeStyle::HEXAGONS_STYLE}, - {THEMESTYLE_VALUE_FOOTBALL, ThemeStyle::FOOTBALL_STYLE}, // 在此处添加更多的映射关系 }; diff --git a/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp b/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp index 8a12eaab0..06b501c5d 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp @@ -266,6 +266,7 @@ void ServiceMsgProcess(Request *request) std::bind(&OHOS::DisplayBrightnessModel::UpdateBrightnessValueOfSlider, OHOS::DisplayBrightnessModel::GetInstance())); break; } + SAMGR_FreeRequestMsg(request); #endif /* -------------------------------------------------------------------------- */ WEARABLE_LOGI(WEARABLE_LOG_MODULE_UI_SERVICE, "UiServiceMsgId = %d",request->msgId); @@ -277,6 +278,8 @@ void ServiceMsgProcess(Request *request) break; } } + //释放请求消息 + SAMGR_FreeRequestMsg(request); /* -------------------------------------------------------------------------- */ } @@ -301,33 +304,19 @@ TaskConfig GetServiceTaskConfig(Service *service) //发送msg static int32_t SendMsg(int32_t msgId, uint32_t msgValue, void *data, int32_t dataLen) { - int32_t ret; - void *sendData = nullptr; - if (dataLen > 0) { - sendData = malloc(dataLen); - if (sendData == nullptr) { - return FALSE; - } - ret = memcpy_s(sendData, dataLen, data, dataLen); - if (ret != EOK) { - free(sendData); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uiservice sendMsg memcpy_s fail! ret = %d", ret); - return FALSE; - } + Request *request = SAMGR_AllocRequestMsg(0, PLATFORM_CORE, UI_SVR_ID, dataLen); + if (request == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "SAMGR_AllocRequestMsg failed"); + return FALSE; + } + request->msgId = msgId; + request->msgValue = msgValue; + if (data != nullptr) { + (void)memcpy_s(request->data, dataLen, data, dataLen); } - Request request = { - .msgId = msgId, - .len = dataLen, - .msgValue = msgValue, - .data = sendData, - }; - - ret = SAMGR_SendRequest(IUNKNOWN_GetIdentity(GET_IUNKNOWN(g_uiService)), &request, nullptr); + int32_t ret = SAMGR_SendRequest(IUNKNOWN_GetIdentity(GET_IUNKNOWN(g_uiService)), request, nullptr); if (ret != 0) { - if (sendData != nullptr) { - free(sendData); - } WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "SendMsg failed ret = %d ", ret); return FALSE; } diff --git a/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h b/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h index df3e84145..e7b25f52e 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h +++ b/code/sdk/application/wearable/nativeabilityfwk/include/SliceTransition.h @@ -49,7 +49,6 @@ private: void TransitionStart(TransitionCallback* transition, uint32_t duration); bool SaveTargetSnapshot(UIView* view); ImageInfo RectifySnapshot(ImageInfo& dstInfo); - bool isTransAnimInterrupted_ = false; }; } // namespace OHOS #endif // SLICE_TRANSITION_H diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp index 7daacf004..311cba0e8 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/Ability.cpp @@ -118,9 +118,6 @@ ListsNode* Ability::Find(const uint16_t sliceId) */ void Ability::ChangeSlice(const uint16_t targetSliceId, TransitionType type, const uint16_t priority) { - if (GetCurSliceId() == targetSliceId) { - return; - } if (osal_atomic_read(&transitionCount_) <= 0) { osal_atomic_inc(&transitionCount_); // onStop释放当前页面需要和当前页面的事件监听异步执行,否则会出现自己杀掉自己的情况 diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp index edf6b2d41..20226e665 100755 --- a/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/SliceTransition.cpp @@ -86,11 +86,6 @@ void SliceTransition::ClearTransitionResource() bool SliceTransition::SetTransitionType(TransitionType type) { - isTransAnimInterrupted_ = false; - if ((animator_ != nullptr) && (animator_->GetState() != Animator::STOP)) { - animator_->Stop(); - isTransAnimInterrupted_ = true; - } transitionCallback_ = TransitionManager::GetInstance().GetTransition(type); if (transitionCallback_ == nullptr) { return false; @@ -135,7 +130,7 @@ bool SliceTransition::SaveCurrentSnapshot(UIView* view) } ImageInfo info = {{0}}; - if (RootView::GetInstance()->isSystemViewEmpty() && !view->IsVideoContained() && !isTransAnimInterrupted_) { + if (RootView::GetInstance()->isSystemViewEmpty() && !view->IsVideoContained()) { if (!Screen::GetInstance().GetCurrentScreenBitmap(info)) { return false; } @@ -212,19 +207,15 @@ void SliceTransition::Transition(UIView* current, UIView* target) void SliceTransition::StopAnimator() { - if (animator_ != nullptr) { - animator_->Stop(); - } + animator_->Stop(); NativeAbility::GetInstance().OnTransitionEnd(); - if (transitionCallback_ != nullptr) { - if (transitionCallback_->enableCurrentSnapshot_) { - RootView::GetInstance()->Remove(currentSnapshot_); - } + if (transitionCallback_->enableCurrentSnapshot_) { + RootView::GetInstance()->Remove(currentSnapshot_); + } - if (transitionCallback_->enableTargetSnapshot_) { - RootView::GetInstance()->Remove(targetSnapshot_); - targetView_->SetVisible(true); - } + if (transitionCallback_->enableTargetSnapshot_) { + RootView::GetInstance()->Remove(targetSnapshot_); + targetView_->SetVisible(true); } ClearTransitionResource(); } diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.cpp index 8ba2871c6..fd7b9ba08 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.cpp @@ -73,12 +73,4 @@ void BackToHexagonsTransition::TransitionAlg(uint32_t time) target_->Scale(targetScale, focusIndex_); focusView_->SetOpaScale(OPA_OPAQUE - opa); } - -void BackToHexagonsTransition::OnTransitionEnd() -{ - if ((target_ != nullptr) && (focusView_ != nullptr)) { - target_->Scale(TARGET_SCALE_END, focusIndex_); - focusView_->SetOpaScale(OPA_OPAQUE); - } -} } // namespace OHOS diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.h b/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.h index 4738a88d8..2e261b2c2 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.h +++ b/code/sdk/application/wearable/nativeabilityfwk/src/transition/BackToHexagonsTransition.h @@ -18,7 +18,6 @@ public: ~BackToHexagonsTransition() override {} void OnTransitionStart(UIImageView* current, UIView* target) override; void TransitionAlg(uint32_t time) override; - void OnTransitionEnd() override; private: UIImageView* current_ = nullptr; UICustomHexagonsList* target_ = nullptr; diff --git a/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.cpp b/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.cpp index 6bb2b1e1f..863b6e847 100644 --- a/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.cpp +++ b/code/sdk/application/wearable/nativeabilityfwk/src/transition/HexagonsTransition.cpp @@ -39,7 +39,7 @@ void HexagonsTransition::OnTransitionStart(UIView* current, UIImageView* target) current_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); Vector2 delta = Vector2(current_->GetWidth() / 2, current_->GetHeight() / 2) - current_->GetCurrentPosition(focusIndex_); - opaStart_ = focusView_->GetOpaScale(); + opaStart_ = current->GetOpaScale(); scaleStart_ = current_->GetGlobalScale(); Rect rect = focusView_->GetRect(); float xScale = target_->GetWidth() * 1.0f / rect.GetWidth(); diff --git a/code/sdk/application/wearable/nativeapp/CMakeLists.txt b/code/sdk/application/wearable/nativeapp/CMakeLists.txt index 85ce56bac..0e72a0e7e 100755 --- a/code/sdk/application/wearable/nativeapp/CMakeLists.txt +++ b/code/sdk/application/wearable/nativeapp/CMakeLists.txt @@ -7,7 +7,6 @@ set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/nativelauncher/include ${CMAKE_CURRENT_SOURCE_DIR}/nativelauncher/include/slices/main ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/screennotify/include - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/include ) set(PRIVATE_HEADER @@ -34,7 +33,6 @@ set(PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_card/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/add_card/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial/include - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/key/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/player/include ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/applist/include @@ -122,7 +120,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothHeadsetEvent.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothModel.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothWrapper.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/MainBluetoothView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/bluetooth/src/TipsConnFailMessageView.cpp @@ -230,9 +227,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial/src/SetDialModel.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial/src/SetDialPresenter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial/src/SetDialView.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/src/SetDialStyleModel.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/src/SetDialStylePresenter.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/set_dial_style/src/SetDialStyleView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/key/src/KeyInputListener.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/compass/src/CompassControlView.cpp ${CMAKE_CURRENT_SOURCE_DIR}/nativeui/compass/src/CompassCalibrationView.cpp diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h index fa4182e25..1c77878c0 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/AppViewIDs.h @@ -52,7 +52,6 @@ typedef enum : uint16_t { VIEW_SET_CARD, VIEW_ADD_CARD, VIEW_SET_DIAL, - VIEW_SET_DIAL_STYLE, VIEW_MAX_INTER_APP, // 在此之前添加native应用ID. VIEW_EXTERN_APP = 0xFFFE, // 三方应用 VIEW_INVALIDE_APP = 0xFFFF, diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h index b05347ecd..cadd1ee31 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/NativeLauncher.h @@ -47,7 +47,6 @@ public: void InitSetCardSlice(void); void InitAddCardSlice(void); void InitSetDialSlice(void); - void InitSetDialStyleSlice(void); private: void InitAllNativeSlices(void); diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h b/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h index aacff824b..7f1935264 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/include/UiConfig.h @@ -330,9 +330,6 @@ namespace OHOS { static constexpr const char *PNG_ALIPAY_PAY_ICON_WHITE = APP_RES_PATH"/ALIPAY_PAY_ICON_WHITE.bin"; static constexpr const char *PNG_ALIPAY_PAY_ICON_GREY = APP_RES_PATH"/ALIPAY_PAY_ICON_GREY.bin"; - // AppList hexagon icon - static constexpr const char *PNG_APPLIST_DEFAULT_IMG = APP_RES_PATH"/regular_hexagon.bin"; - static constexpr const char *PNG_APPLIST_NOTSETUSE_IMG = APP_RES_PATH"/regular_hexagon_inverse.bin"; // 室内步行 static constexpr const char *PNG_APPLIST_WALK_IMAGE = APP_RES_PATH"/APPLIST_WALK.bin"; // Applist图标 diff --git a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp index 034db97eb..a1e55d1bf 100755 --- a/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp +++ b/code/sdk/application/wearable/nativeapp/nativelauncher/src/NativeLauncher.cpp @@ -74,8 +74,6 @@ #include "AddCardPresenter.h" #include "SetDialView.h" #include "SetDialPresenter.h" -#include "SetDialStylePresenter.h" -#include "SetDialStyleView.h" #ifdef JS_ENABLE #include "product_adapter.h" #endif @@ -117,7 +115,6 @@ static const AppViewMapper SLICE_MAPPER[] = { {VIEW_SET_CARD, &NativeLauncher::InitSetCardSlice}, {VIEW_ADD_CARD, &NativeLauncher::InitAddCardSlice}, {VIEW_SET_DIAL, &NativeLauncher::InitSetDialSlice}, - {VIEW_SET_DIAL_STYLE, &NativeLauncher::InitSetDialStyleSlice}, }; static const ViewIdToString VIEW_MAPPER[] = { @@ -146,7 +143,6 @@ static const ViewIdToString VIEW_MAPPER[] = { {VIEW_SET_CARD, "SetCard"}, {VIEW_ADD_CARD, "AddCard"}, {VIEW_SET_DIAL, "SetDial"}, - {VIEW_SET_DIAL_STYLE, "SetDialStyle"}, }; NativeLauncher::NativeLauncher() {} @@ -446,14 +442,4 @@ void NativeLauncher::InitSetDialSlice(void) NativeAbility::GetInstance().AddSliceProxy(VIEW_SET_DIAL, setDialView); } -void NativeLauncher::InitSetDialStyleSlice(void) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "NativeLauncher::InitSetDialStyleSlice"); - SliceProxy *setDialStyleView = new AbilitySliceProxy; - if (setDialStyleView == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "setDialStyleView"); - return; - } - NativeAbility::GetInstance().AddSliceProxy(VIEW_SET_DIAL_STYLE, setDialStyleView); -} } 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 9f514d675..56ba901ed 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alarmclocktimerconfig/src/AlarmClockTimerConfig.cpp @@ -30,43 +30,41 @@ void AlarmTimerEventPublish(uint16 topic, AlarmClockEventData data) { int32 ret; uint32 size = sizeof(AlarmClockEventData); + Request *request = nullptr; BroadcastApi *broadcastApi = nullptr; IUnknown *api = nullptr; WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmTimerEventPublish topic=%u!!", topic); - void *publishData = malloc(size); - if (publishData == nullptr) { + /* 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; } - ret = memcpy_s(publishData, size, (const void *)&data, size); + request->msgId = topic; + ret = memcpy_s(request->data, size, (const void *)&data, size); if (ret != EOK) { - free(publishData); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmTimerEventPublish memcpy_s fail! ret = %d", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AlarmTimerEventPublish memcpy_s rateDataTmp fail! ret = %d", ret); return; } - - Request request = { - .msgId = topic, - .len = size, - .msgValue = 0, - .data = publishData, - }; + request->len = size; + request->msgValue = 0; /* public request */ api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); if (api == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetFeatureApi failed"); - free(publishData); + 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"); - free(publishData); + SAMGR_FreeRequestMsg(request); return; } - broadcastApi->PublishTopic((IUnknown *)broadcastApi, &request); + broadcastApi->PublishTopic((IUnknown *)broadcastApi, request); broadcastApi->Release((IUnknown *)broadcastApi); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlarmTimerEventPublish end!!"); 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 9cbbaf25a..4f0d4bb69 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/include/AlipayModel.h @@ -58,7 +58,6 @@ public: int32_t AlipayGetAidCode(int8_t *aidStr); void AlipayUnbind(void); bool AlipayStartBind(void); - bool AlipayFinishBind(void); bool AlipayStartSwitchTimer(uint16_t time); void AlipayStopBindTimer(void); void AlipayStopSwitchTimer(); 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 12c2d604c..888dff2ae 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayMainView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayMainView.cpp @@ -224,12 +224,9 @@ void AlipayMainView::DropView(UIView &view) WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayMainView::DropView::container[ALIPAY_BIND_ANI_VIEW]"); ChangeView(ALIPAY_BIND_ANI_VIEW, ALIPAY_BIND_EXIT_VIEW); } else if (&view == container[ALIPAY_LIST_VIEW] || &view == container[ALIPAY_BIND_VIEW]) { - if (&view == container[ALIPAY_BIND_VIEW]) { - AlipayModel::GetInstance()->AlipayFinishBind(); - } AlipayModel::GetInstance()->AlipayStopSwitchTimer(); + AlipayModel::GetInstance()->AlipayStopBindTimer(); NativeAbility::GetInstance().ChangeSlice(VIEW_APPLIST); - } else if (&view == container[ALIPAY_TRANS_LIST_VIEW]) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayMainView::DropView::container[ALIPAY_TRANS_LIST_VIEW]"); ChangeView(ALIPAY_TRANS_LIST_VIEW, ALIPAY_LIST_VIEW); 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 0414fd48b..353c788d4 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayModel.cpp @@ -60,9 +60,10 @@ void AlipayBindCallBackProc(void *argument) return; } else if (ALIPAY_INTER_STATUS_BINDING_OK == status && reFlag == 1) { AlipayModel::GetInstance()->AlipaySetRefreshFlag(0); - AlipayModel::GetInstance()->AlipayFinishBind(); + AlipayModel::GetInstance()->AlipayStopBindTimer(); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayBindCallBackProc ALIPAY_INTER_STATUS_BINDING_OK"); AlipayModel::GetInstance()->AlipaySetBindFlag(true); + AlipayMainView::GetInstance()->ChangeView(currentView, ALIPAY_BIND_RES_VIEW); } else if (ALIPAY_INTER_STATUS_BINDING_FAIL == status && reFlag == 1) { AlipayModel::GetInstance()->AlipayStopBindTimer(); @@ -100,13 +101,6 @@ bool AlipayModel::AlipayStartBind(void) return true; } -bool AlipayModel::AlipayFinishBind(void) -{ - AlipayStopBindTimer(); - alipayApi->bind_finish(); - return true; -} - void AlipaySwitchTimerCallBackProc(void *argument) { UNUSED(argument); 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 bf1f2b2f4..ef16fe90f 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/alipay/src/AlipayPresenter.cpp @@ -85,7 +85,6 @@ bool AlipayPresenter::OnDrag(UIView &view, const DragEvent &event) void AlipayPresenter::ClickExitAlipay(UIView &view) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "AlipayPresenter::ClickExitAlipay start"); - AlipayModel::GetInstance()->AlipayFinishBind(); uint16 preSlice = NativeAbility::GetInstance().GetPreSliceId(); NativeAbility::GetInstance().ChangeSlice(preSlice); return; 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 8aacc9e39..31eae8f9b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/AppItemView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/AppItemView.h @@ -47,18 +47,6 @@ private: AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr }; }; -class FootballItemView : public UIImageView { -public: - explicit FootballItemView() {} - ~FootballItemView() {} - void SetItemInfo(const AppItem &itemInfo); - AppViewId GetViewId(); - const char *GetAppUid(); -private: - FootballItemView(const FootballItemView &); - FootballItemView &operator = (const FootballItemView &); - AppItem itemInfo_ = { VIEW_INVALID, nullptr, nullptr, nullptr, nullptr }; -}; } #endif diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h index 164879867..135071023 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistModel.h @@ -19,17 +19,10 @@ typedef struct { AppViewId id; const char *iconLarge; const char *iconSmall; - const char *iconHexagon; const char *label; const char *uid; } AppItem; -enum AppListStyle { - APPLIST_STYLE, - HEXAGONS_STYLE, - FOOTBALL_STYLE -}; - class ApplistPresenter; class ApplistModel { public: @@ -45,8 +38,7 @@ public: int GetHeadItemY(void); void ApplistUpdate(void); void SetPresenter(ApplistPresenter *p); - AppListStyle GetCurrentStyle(void); - + bool GetIsUseListStyle(void); private: ApplistModel(); ApplistModel(const ApplistModel &); 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 cf7bcd62f..bcb6ec7fa 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistPresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistPresenter.h @@ -37,7 +37,7 @@ namespace OHOS { int GetHeadItemY(void); uint8_t GetListItemNum(void); ApplistView* GetAppListView(); - AppListStyle GetCurrentStyle(void); + bool GetIsUseListStyle(void); private: AppItemView *itemViewSele{nullptr}; 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 401408eb9..a1c5e91cc 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/include/ApplistView.h @@ -9,15 +9,12 @@ #define APPLIST_VIEW_H #include "View.h" -#include "animator/animator_manager.h" #include "components/root_view.h" #include "components/ui_view_group.h" #include "components/ui_scroll_view.h" #include "components/ui_label.h" #include "components/ui_list.h" #include "components/ui_custom_hexagons_list.h" -#include "components/ui_icosahedron_view.h" -#include "gfx_utils/list.h" #include "window/window.h" #include "ohos_types.h" #include "BaseView.h" @@ -69,42 +66,6 @@ private: bool continueDrag{false}; }; -class FootballAnimatorCallback : public AnimatorCallback { -public: - explicit FootballAnimatorCallback(UIView* view, int16_t startPos, int16_t endPos) - : startPos_(startPos), - endPos_(endPos), - startTime_(0), - animator_(new Animator(this, view, 1000, false)) {} // 1000:duration of animator_, in milliseconds. - - ~FootballAnimatorCallback() override - { - if (animator_ != nullptr) { - delete animator_; - animator_ = nullptr; - } - } - - void Callback(UIView* view) override; - - Animator* GetAnimator() const - { - return animator_; - } - - void SetStartTime(uint32_t time) - { - isStartAnim_ = false; - startTime_ = time; - } -protected: - int16_t startPos_; - int16_t endPos_; - uint32_t startTime_; - bool isStartAnim_ = false; - Animator* animator_; -}; - class ApplistPresenter; class ApplistView : public View { public: @@ -119,34 +80,24 @@ public: void AddAppItemToList(const AppItem &item); void ClearAppItemToList(); void RefreshAppList(void); - private: - /* for list style */ + void HexagonsStyleOnStart(); void ListStyleOnStart(); + void HexagonsStyleOnSetUpView(); void ListStyleOnSetUpView(); + void HexagonsStyleOnStop(); void ListStyleOnStop(); + + /* for list style */ ApplistAdapter *listAdapter_{nullptr}; UIList *contentList_{nullptr}; UIView::OnDragListener *dragListener{nullptr}; /* for hexagons style */ - void HexagonsStyleOnStart(); - void HexagonsStyleOnSetUpView(); - void HexagonsStyleOnStop(); UICustomHexagonsList* hexagonsList_{nullptr}; - List listHexagonsView_; + std::list listHexagonsView_; uint16_t imgSize_ = 0; uint16_t imgDistance_ = 0; - - /* for football style */ - void FootballStyleOnStart(); - void FootballStyleOnSetUpView(); - void FootballStyleOnStop(); - UIIcosahedronView* footballList_ = nullptr; - List footballItemList_; - ImageInfo* footballDefaultImg_ = nullptr; - FootballAnimatorCallback* callback_ = nullptr; - Animator* enterAnimator_ = nullptr; }; } #endif // APPLIST_VIEW_H \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/AppItemView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/AppItemView.cpp index 9a56529b4..cd35ebb0f 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/AppItemView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/AppItemView.cpp @@ -103,19 +103,4 @@ namespace OHOS { { return itemInfo_.uid; } - - void FootballItemView::SetItemInfo(const AppItem &itemInfo) - { - itemInfo_ = itemInfo; - } - - AppViewId FootballItemView::GetViewId() - { - return itemInfo_.id; - } - - const char *FootballItemView::GetAppUid() - { - return itemInfo_.uid; - } } 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 c83dc49f7..c7fd860ca 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistModel.cpp @@ -16,22 +16,23 @@ #include "UiConfig.h" #include "ApplistModel.h" #include "ApplistPresenter.h" -#include "SetDesktopView.h" +#include "SetDesktopModel.h" namespace OHOS { const AppItem g_nativeAppList[] = { - {VIEW_MAIN_ALARM, PNG_APPLIST_ALARM_IMAGE, PNG_APPLIST_ALARM_IMAGE, PNG_APPLIST_DEFAULT_IMG, "闹钟", nullptr}, - {VIEW_BLOODOXY_SAMPLE, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_DEFAULT_IMG, "血氧饱和度", nullptr}, - {VIEW_SETTING, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_DEFAULT_IMG, "设置", nullptr}, - {VIEW_CALLER_SAMPLE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_DEFAULT_IMG, "通话记录", nullptr}, - {VIEW_COMPASS, PNG_APPLIST_COMPASS_IMAGE, PNG_APPLIST_COMPASS_IMAGE, PNG_APPLIST_DEFAULT_IMG, "指南针", nullptr}, - {VIEW_OFFLINEVOICE, PNG_APPLIST_VOCASSIST_IMAGE, PNG_APPLIST_VOCASSIST_IMAGE, PNG_APPLIST_DEFAULT_IMG, "语音助手", nullptr}, - {VIEW_MAIN_TEMP, PNG_APPLIST_TEMP_IMAGE, PNG_APPLIST_TEMP_IMAGE, PNG_APPLIST_DEFAULT_IMG, "体温", nullptr}, - {VIEW_INDOORWALK, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_DEFAULT_IMG, "室内步行", nullptr}, - {VIEW_UISAMPLE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_DEFAULT_IMG, "示例", nullptr}, + {VIEW_MAIN_ALARM, PNG_APPLIST_ALARM_IMAGE, PNG_APPLIST_ALARM_IMAGE, "闹钟", nullptr}, + {VIEW_BLOODOXY_SAMPLE, PNG_APPLIST_SPO2_IMAGE, PNG_APPLIST_SPO2_IMAGE, "血氧饱和度", nullptr}, + {VIEW_SETTING, PNG_APPLIST_SETTING_IMAGE, PNG_APPLIST_SETTING_IMAGE, "设置", nullptr}, + {VIEW_CALLER_SAMPLE, PNG_APPLIST_CALLER_IMAGE, PNG_APPLIST_CALLER_IMAGE, "通话记录", nullptr}, + {VIEW_COMPASS, PNG_APPLIST_COMPASS_IMAGE, PNG_APPLIST_COMPASS_IMAGE, "指南针", nullptr}, + {VIEW_OFFLINEVOICE, PNG_APPLIST_VOCASSIST_IMAGE, PNG_APPLIST_VOCASSIST_IMAGE, "语音助手", nullptr}, + {VIEW_MAIN_TEMP, PNG_APPLIST_TEMP_IMAGE, PNG_APPLIST_TEMP_IMAGE, "体温", nullptr}, + {VIEW_INDOORWALK, PNG_APPLIST_WALK_IMAGE, PNG_APPLIST_WALK_IMAGE, "室内步行", nullptr}, + {VIEW_UISAMPLE, PNG_APPLIST_UI_SAMPLE_IMAGE, PNG_APPLIST_UI_SAMPLE_IMAGE, "示例", nullptr}, #ifdef SUPPORT_ALIPAY_SEC - {VIEW_MAIN_ALIPAY, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_DEFAULT_IMG, "支付宝", nullptr}, + {VIEW_MAIN_ALIPAY, PNG_APPLIST_ALIPAY_IMAGE, PNG_APPLIST_ALIPAY_IMAGE, "支付宝", nullptr}, #endif + }; ApplistModel &ApplistModel::GetInstance(void) @@ -100,7 +101,6 @@ namespace OHOS { VIEW_EXTERN_APP, bundleInfos[len].smallIconPath, bundleInfos[len].smallIconPath, - bundleInfos[len].bigIconPath, bundleInfos[len].label, bundleInfos[len].bundleName }; @@ -164,15 +164,8 @@ namespace OHOS { presenter = p; } - AppListStyle ApplistModel::GetCurrentStyle(void) + bool ApplistModel::GetIsUseListStyle(void) { - uint8_t currenStyle = SetDesktopView::GetInstance()->GetCurrentSelectedStyle(); - if (currenStyle == 1) { // 1: hexagons desktop style - return HEXAGONS_STYLE; - } else if (currenStyle == 2) { // 2: football desktop style - return FOOTBALL_STYLE; - } else { - return APPLIST_STYLE; - } + return (SetDesktopModel::GetInstance().GetDesktopStyle() == APPLIST_STYLE); } } 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 39c2411ba..cf68b21b4 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistPresenter.cpp @@ -94,12 +94,15 @@ namespace OHOS { AppViewId viewId = VIEW_INVALID; char *uid = nullptr; TransitionType type = TransitionType::TRANSITION_INVALID; - AppListStyle style = GetCurrentStyle(); - if (style == AppListStyle::FOOTBALL_STYLE) { - FootballItemView *itemView = dynamic_cast(&view); + 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 if (style == AppListStyle::HEXAGONS_STYLE) { + } else { HexagonsItemView *itemView = dynamic_cast(&view); UIHexagonsList* hexagonsView = dynamic_cast(itemView->GetParent()); if (hexagonsView == nullptr || itemView == nullptr) { @@ -111,14 +114,6 @@ namespace OHOS { hexagonsView->SetDraggable(false); hexagonsView->Scale(1.0f, itemView->GetViewIndex()); // switch focus to click view type = TransitionType::TRANSITION_HEXAGONS; - } else { - 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(); } WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistPresenter::OnClick viewid = %d", viewId); if (viewId < VIEW_MAX_INTER_APP) { @@ -183,9 +178,9 @@ namespace OHOS { return model->GetAppListNum(); } - AppListStyle ApplistPresenter::GetCurrentStyle(void) + bool ApplistPresenter::GetIsUseListStyle(void) { - return model->GetCurrentStyle(); + return model->GetIsUseListStyle(); } ApplistView* ApplistPresenter::GetAppListView() 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 e7cd3732d..0f3d9bbf3 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/applist/src/ApplistView.cpp @@ -9,8 +9,6 @@ #include "ApplistView.h" #include "ApplistPresenter.h" #include "AppItemView.h" -#include "common/image_cache_manager.h" -#include "hal_tick.h" namespace OHOS { static constexpr int16 NUM_2 = 2; @@ -40,50 +38,16 @@ ApplistView::~ApplistView() delete hexagonsList_; hexagonsList_ = nullptr; } - if (callback_ != nullptr) { - delete callback_; - callback_ = nullptr; - } - enterAnimator_ = nullptr; } void ApplistView::OnStart() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStart "); View::OnStart(); - AppListStyle style = presenter_->GetCurrentStyle(); - if (style == AppListStyle::FOOTBALL_STYLE) { - FootballStyleOnStart(); - } else if (style == AppListStyle::HEXAGONS_STYLE) { - HexagonsStyleOnStart(); - } else { + if (presenter_->GetIsUseListStyle()) { ListStyleOnStart(); - } -} - -void ApplistView::FootballStyleOnStart() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::FootballStyleOnStart "); - if (footballList_ == nullptr) { - footballList_ = new UIIcosahedronView(); - } - footballList_->SetThrowDrag(true); - if (footballDefaultImg_ == nullptr) { - footballDefaultImg_ = ImageCacheManager::GetInstance().LoadSingleRes(PNG_APPLIST_NOTSETUSE_IMG); - if (footballDefaultImg_ == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "load res faild"); - return; - } - } - if (callback_ == nullptr) { - callback_ = new FootballAnimatorCallback(footballList_, 30, 250); // 30: Initial Size 250: Final display size - } - footballList_->SetDefaultImage(footballDefaultImg_); - footballList_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - enterAnimator_ = callback_->GetAnimator(); - SetContainerView(footballList_); - if (callback_ != nullptr) { - callback_->SetStartTime(HALTick::GetInstance().GetTime()); + } else { + HexagonsStyleOnStart(); } } @@ -93,7 +57,8 @@ void ApplistView::HexagonsStyleOnStart() if (hexagonsList_ == nullptr) { hexagonsList_ = new UICustomHexagonsList(); } - hexagonsList_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); + hexagonsList_->SetPosition(0, 0, + 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_); @@ -146,27 +111,16 @@ void ApplistView::OnSetUpView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnSetUpView"); View::OnSetUpView(); - AppListStyle style = presenter_->GetCurrentStyle(); - if (style == AppListStyle::FOOTBALL_STYLE) { - FootballStyleOnSetUpView(); - } else if (style == AppListStyle::HEXAGONS_STYLE) { - HexagonsStyleOnSetUpView(); - } else { + if (presenter_->GetIsUseListStyle()) { ListStyleOnSetUpView(); - } -} - -void ApplistView::FootballStyleOnSetUpView() -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnSetUpView"); - if (enterAnimator_ != nullptr) { - enterAnimator_->Start(); + } else { + HexagonsStyleOnSetUpView(); } } void ApplistView::HexagonsStyleOnSetUpView() { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnSetUpView"); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnSetUpView "); } void ApplistView::ListStyleOnSetUpView() @@ -205,13 +159,10 @@ void ApplistView::OnTearDownView() void ApplistView::OnStop() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::OnStop"); - AppListStyle style = presenter_->GetCurrentStyle(); - if (style == AppListStyle::FOOTBALL_STYLE) { - FootballStyleOnStop(); - } else if (style == AppListStyle::HEXAGONS_STYLE) { - HexagonsStyleOnStop(); - } else { + if (presenter_->GetIsUseListStyle()) { ListStyleOnStop(); + } else { + HexagonsStyleOnStop(); } View::OnStop(); if (container_ != nullptr) { @@ -224,39 +175,16 @@ void ApplistView::OnStop() return; } -void ApplistView::FootballStyleOnStop() -{ - if (enterAnimator_ != nullptr) { - enterAnimator_->Stop(); - } - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::FootballStyleOnStop"); - if (footballDefaultImg_ != nullptr) { - ImageCacheManager::GetInstance().UnloadSingleRes(PNG_APPLIST_NOTSETUSE_IMG); - footballDefaultImg_ = nullptr; - } - if (footballList_ != nullptr) { - footballList_->RemoveAll(); - } - ListNode* viewNode = footballItemList_.Head(); - while (viewNode != footballItemList_.End()) { - delete(viewNode->data_); - viewNode = viewNode->next_; - } - footballItemList_.Clear(); -} - void ApplistView::HexagonsStyleOnStop() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::HexagonsStyleOnStop"); if (hexagonsList_ != nullptr) { hexagonsList_->RemoveAll(); } - ListNode* viewNode = listHexagonsView_.Head(); - while (viewNode != listHexagonsView_.End()) { - delete(viewNode->data_); - viewNode = viewNode->next_; + for (auto iter : listHexagonsView_) { + delete iter; } - listHexagonsView_.Clear(); + listHexagonsView_.clear(); } void ApplistView::ListStyleOnStop() @@ -270,72 +198,42 @@ void ApplistView::ListStyleOnStop() void ApplistView::AddAppItemToList(const AppItem &item) { - AppListStyle style = presenter_->GetCurrentStyle(); - if (style == AppListStyle::FOOTBALL_STYLE) { - FootballItemView* itemView = new FootballItemView(); - itemView->SetItemInfo(item); - itemView->SetSrc(item.iconHexagon); - itemView->SetTouchable(true); - itemView->SetOnClickListener(presenter_); - footballList_->Add(itemView); - footballItemList_.PushBack(itemView); - } else if (style == AppListStyle::HEXAGONS_STYLE) { + if (presenter_->GetIsUseListStyle()) { + listAdapter_->AddListItem(item); + } else { HexagonsItemView *itemView = new HexagonsItemView(); itemView->SetItemInfo(item); itemView->SetSrc(item.iconSmall); itemView->SetTouchable(true); itemView->SetOnClickListener(presenter_); + hexagonsList_->Add(itemView); - listHexagonsView_.PushBack(itemView); - } else { - listAdapter_->AddListItem(item); + listHexagonsView_.push_back(itemView); } } void ApplistView::ClearAppItemToList() { - AppListStyle style = presenter_->GetCurrentStyle(); - if (style == FOOTBALL_STYLE) { - FootballStyleOnStop(); - } else if (style == AppListStyle::HEXAGONS_STYLE) { - HexagonsStyleOnStop(); - } else { + if (presenter_->GetIsUseListStyle()) { listAdapter_->ClearItem(); + } else { + if (hexagonsList_ != nullptr) { + hexagonsList_->RemoveAll(); + } + for (auto iter : listHexagonsView_) { + delete iter; + } + listHexagonsView_.clear(); } } void ApplistView::RefreshAppList(void) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ApplistView::RefreshAppList"); - AppListStyle style = presenter_->GetCurrentStyle(); - if (style == AppListStyle::FOOTBALL_STYLE) { - footballList_->RefreshIcosahedron(); - } else if (style == AppListStyle::HEXAGONS_STYLE) { - hexagonsList_->LayoutChildren(true); - } else { + if (presenter_->GetIsUseListStyle()) { contentList_->RefreshList(); + } else { + hexagonsList_->LayoutChildren(true); } } - -void FootballAnimatorCallback::Callback(UIView *view) -{ - if (HALTick::GetInstance().GetElapseTime(startTime_) < 300) { - return; - } - if (!isStartAnim_) { - animator_->Stop(); - animator_->Start(); - isStartAnim_ = true; - } - UIIcosahedronView* footView = dynamic_cast(view); - int16_t el = EasingEquation::LinearEaseNone(startPos_, endPos_, animator_->GetRunTime(), animator_->GetTime()); - footView->SetSideLength(el); - footView->RefreshIcosahedron(); - const Vector3 rotateStart(Screen::GetInstance().GetWidth() / 2.0, // 2.0: divisor - Screen::GetInstance().GetHeight() / 2.0, 0); // 2.0: divisor - const Vector3 rotateEnd(0, 0, 0); - // 270 : stop angle - int16_t angle = EasingEquation::LinearEaseNone(0, 270, animator_->GetRunTime(), animator_->GetTime()); - footView->RotatePlanes(angle, rotateStart, rotateEnd); -} } 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 04ddcc144..1c9347e95 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothModel.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothModel.h @@ -80,15 +80,12 @@ public: void SetAdvStartState(bool state); int ConnectRemoteDevice(const bd_addr_t *addr); bool ConnectRemoteCheck(const bd_addr_t *addr); - char* getWatchName(void); - private: BluetoothModel(); int16_t callerid{0}; void SetUpListCase(); void SetUpConnedDevicesList(); bool FindNameByAddr(BluetoothCaseInfo &listInfo, BluetoothCaseInfo *caseInfo); - void InitBluetoothInfo(void); bool aclConnected{false}; BluetoothCaseInfo tempMacValue{}; bd_addr_t lastConnedAddr{}; @@ -104,7 +101,6 @@ private: bool tagReturnToDeviceListView{false}; bool tagScanDeviceClicked{false}; bool advStartState{false}; - char watchName[BD_NAME_LEN] = { 0 }; }; #ifdef __cplusplus diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothWrapper.h b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothWrapper.h deleted file mode 100644 index 3c645feb1..000000000 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/include/BluetoothWrapper.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: BluetoothWrapper - * Author: - * Create: 2021-10-13 - */ -#ifndef BLUETOOTH_WRAPPER_H -#define BLUETOOTH_WRAPPER_H - -#include "common_def.h" -#include "bts_def.h" -#include "bts_gatt_stru.h" -#include "bts_gatt_server.h" -#include "bts_le_gap.h" - -#ifdef __cplusplus -extern "C" { -#endif - -errcode_t wrapper_gap_ble_register_callbacks(gap_ble_callbacks_t *func); -errcode_t wrapper_gatts_register_callbacks(gatts_callbacks_t *func); -void wrapper_ble_register(void); -errcode_t wrapper_gatts_register_server(bt_uuid_t *app_uuid, uint8_t *server_id); -errcode_t wrapper_gatts_add_service(uint8_t server_id, bt_uuid_t *service_uuid, bool is_primary); -void wrapper_gatts_service_start(void); - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file 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 c3e8a5204..c26c7f573 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothEarPhoneView.cpp @@ -228,12 +228,8 @@ void BluetoothEarPhoneView::BtEnable() WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable Bt is Discovering"); return; } else { - results = gap_br_set_bt_scan_mode(GAP_SCAN_MODE_NONE, 0); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "gap_br_set_bt_scan_mode results %d", results); - results = gap_br_set_inquiry_paramters(DEVICE_MAJOR_CLASS_AUDIO_VIDEO, 0); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "gap_br_set_inquiry_paramters results %d", results); results = gap_br_start_discovery(); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "gap_br_start_discovery results %d", results); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable StartBtDiscovery results %d", results); } if (g_stopScanHandle != nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "BluetoothEarPhoneView::BtEnable g_stopScanHandle != nullptr"); 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 029f6142a..e11693cab 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothModel.cpp @@ -6,7 +6,6 @@ */ #include #include "BluetoothModel.h" -#include "BluetoothWrapper.h" #include "BluetoothPresenter.h" #include "ConnectPhonePresenter.h" #include "BluetoothView.h" @@ -26,13 +25,10 @@ #include "alipay_feature.h" #endif #include "bts_a2dp_sink.h" -#include "bts_feature.h" #include "bt_audio_hal_interface.h" #include "audio_manager_c_wrapper.h" #include "bts_avrcp_target.h" #include "msg_center_msg.h" -#include "dfx_channel.h" -#include "tcxo.h" namespace OHOS { @@ -46,11 +42,6 @@ constexpr uint16_t BLUETOOTH_MAX_NUM = 20; 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}; -static uint16_t g_sample_svr_handle = 0; -static uint16_t g_sample_characteristic_handle = 0; -static uint16_t g_diag_characteristic_handle = 0; -constexpr uint16_t g_sample_adv_id = 2; -static bd_addr_t g_bd_addr = { 0 }; void BluetoothModel::SetBluetoothCalleridStatus(int16_t value) { @@ -73,70 +64,22 @@ BluetoothModel *BluetoothModel::GetInstance(void) return &instance; } -char* BluetoothModel::getWatchName(void) -{ - return watchName; -} - -void BluetoothModel::InitBluetoothInfo(void) -{ - errcode_t ret; - unsigned char nameLen = BD_NAME_LEN; - memset_s(watchName, sizeof(watchName), 0, sizeof(watchName)); - ret = bluetooth_get_local_name((unsigned char *)watchName, &nameLen); - // 为了实验室测试需要,客户需要自己修改 - if ((nameLen == strlen("WatchDemo") + 1) && (strcmp("WatchDemo", watchName) == 0)) { - uint32_t currentUs = uapi_tcxo_get_us(); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "currentUs 0x%x", currentUs); - // 设置蓝牙名称 - (void)sprintf_s(watchName, sizeof(watchName), "Watch%x", (currentUs & 0xFFFF)); - ret = bluetooth_set_local_name((unsigned char*)watchName, strlen((char*)watchName) + 1); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "bluetooth_set_local_name %s ret = %u", watchName, ret); - - // 设置蓝牙地址 - bd_addr_t addr = {{0x0, 0x0, 0x33, 0x44, 0x55, 0x66} ,0}; - addr.addr[0] = currentUs & 0xFF; - addr.addr[1] = (currentUs & 0XFF00) >> 8; - ret = bluetooth_set_local_addr(addr.addr, BD_ADDR_LEN); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "bluetooth_set_local_addr [0x%x:0x%x] ret = %u", addr.addr[0], addr.addr[1], ret); - } else { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "watchName: %s", watchName); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "nameLen: %u", nameLen); - } -} - void BluetoothModel::Init() { -#ifndef SUPPORT_AUTO_OTA - errcode_t ret; - - // 设置自动回连,ios一键双连依赖此配置 - bts_feature_t bts_feature = { 0 }; - bts_feature.bt_auto_reconnect_closed = 0; - ret = bts_set_features(&bts_feature); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "bt bts_set_features ret = %u", ret); - - ret = enable_bt_stack(); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "bt enable_bt_stack ret = %u", ret); - - // 设置安全连接 - gap_ble_sec_params_t sec_param = { 1, GAP_BLE_IO_CAPABILITY_NOINPUTNOOUTPUT, 1, GAP_BLE_GAP_SECURITY_MODE1_LEVEL3 }; - ret = gap_ble_set_sec_param(&sec_param); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "bt gap_ble_set_sec_param ret = %u", ret); + bool ret = enable_bt_stack(); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "bt enable_bt_stack ret = %d", ret); - InitBluetoothInfo(); BtInitCallBacks(); - wrapper_ble_register(); #ifdef SUPPORT_ALIPAY_SEC svr_alipay_bluetooth_init(); -#endif +#else BtInitCallBacksEx(); BtInitGatts(); +#endif BtInitSpp(); SetUpListCase(); SetUpConnedDevicesList(); -#endif } void BluetoothModel::SetCaseListClear() @@ -539,7 +482,7 @@ void BtGapReadRemoteRssiEventCallback(const bd_addr_t *bdAddr, int rssi, int sta void BtGapDiscoveryStateChangedCallback(int status) { UNUSED(status); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "bt BtGapDiscoveryStateChangedCallback %d", status); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "bt BtGapDiscoveryStateChangedCallback %d", status); } static void ChangeScanView() @@ -644,7 +587,7 @@ void BtGapPairConfirmedCallback(const bd_addr_t *bdAddr, int req_type, int numbe // 回调:扫描结果处理/发现结果上报 void BtGapDiscoveryResultCallback(const bd_addr_t *bdAddr) { - if ((gap_get_device_class(bdAddr) & DEVICE_MAJOR_CLASS_PHONE) != 0) { + if ((gap_get_device_class(bdAddr) & 0x200) != 0) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "BtGapDiscoveryResultCallback: Mobile Phone Device"); return; } @@ -931,86 +874,54 @@ static void BleConnStateChangeCallback(unsigned short connId, bd_addr_t *addr, g 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); - (void)memcpy_s(&g_bd_addr, sizeof(bd_addr_t), addr, sizeof(bd_addr_t)); } } static void BleAdvStartCallback(uint8_t advId, adv_status_t status) { - if (g_sample_adv_id == advId) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BleAdvStartCallback advId: %d, status:%d\n", advId, status); - BluetoothModel::GetInstance()->SetAdvStartState(true); - } + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BleAdvStartCallback advId: %d, status:%d\n", advId, status); + BluetoothModel::GetInstance()->SetAdvStartState(true); } static void BleAdvStopCallback(uint8_t advId, adv_status_t status) { - if (g_sample_adv_id == advId) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BleAdvStopCallback advId: %d, status:%d\n", advId, status); - BluetoothModel::GetInstance()->SetAdvStartState(false); - } -} - -static void BleAdvTerminateCallback(uint8_t advId, adv_status_t status) -{ - if (g_sample_adv_id == advId) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BleAdvTerminateCallback advId: %d, status:%d\n", advId, status); - BluetoothModel::GetInstance()->SetAdvStartState(false); - // 此处开广播是为了实验室测试需要,客户需要自己修改 - BleAdvStart(); - } + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BleAdvStopCallback advId: %d, status:%d\n", advId, status); } static void BtGattsServiceAddCallback(uint8_t serverId, bt_uuid_t *uuid, uint16_t srvcHandle, errcode_t status) { + int ret; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsServiceAddCallback 0x%x 0x%x 0x%x", + status, serverId, srvcHandle); + if ((uuid->uuid_len == sizeof(uint16_t)) && (*((uint16_t*)uuid->uuid) == 0x1FF0)) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsServiceAddCallback 0x%x 0x%x 0x%x", - status, serverId, srvcHandle); - uint16_t sample_id = 0x1FF1; - uint16_t diag_id = 0x1FF2; + uint16_t id = 0x1FF1; gatts_add_chara_info_t character; uint16_t value = 0; memset_s(&character, sizeof(gatts_add_chara_info_t), 0, sizeof(gatts_add_chara_info_t)); - character.chara_uuid.uuid_len = sizeof(sample_id); - memcpy_s(character.chara_uuid.uuid, sizeof(character.chara_uuid.uuid), (char *)&sample_id, sizeof(sample_id)); + character.chara_uuid.uuid_len = sizeof(id); + memcpy_s(character.chara_uuid.uuid, sizeof(character.chara_uuid.uuid), (char *)&id, sizeof(id)); character.permissions = GATT_ATTRIBUTE_PERMISSION_WRITE; - character.properties = GATT_CHARACTER_PROPERTY_BIT_WRITE_NO_RSP; - character.value_len = (uint16_t)sizeof(value); - character.value = (uint8_t *)(&value); - int ret = gatts_add_characteristic(serverId, srvcHandle, &character); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gatts_add_characteristic sample ret 0x%x", ret); - - memset_s(&character, sizeof(gatts_add_chara_info_t), 0, sizeof(gatts_add_chara_info_t)); - character.chara_uuid.uuid_len = sizeof(diag_id); - memcpy_s(character.chara_uuid.uuid, sizeof(character.chara_uuid.uuid), (char *)&diag_id, sizeof(diag_id)); - character.permissions = GATT_ATTRIBUTE_PERMISSION_WRITE | GATT_ATTRIBUTE_PERMISSION_READ; - character.properties = GATT_CHARACTER_PROPERTY_BIT_WRITE | GATT_CHARACTER_PROPERTY_BIT_READ; + character.properties = GATT_CHARACTER_PROPERTY_BIT_WRITE; character.value_len = (uint16_t)sizeof(value); character.value = (uint8_t *)(&value); ret = gatts_add_characteristic(serverId, srvcHandle, &character); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gatts_add_characteristic diag ret 0x%x", ret); - - g_sample_svr_handle = srvcHandle; + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gatts_add_characteristic ret 0x%x", ret); } } static void BtGattsCharacteristicAddCallback(uint8_t serverId, bt_uuid_t *uuid, uint16_t srvcHandle, gatts_add_character_result_t *result, errcode_t status) { + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsCharacteristicAddCallback 0x%x 0x%x 0x%x", + status, serverId, srvcHandle); + if ((uuid->uuid_len == sizeof(uint16_t)) && (*((uint16_t*)uuid->uuid) == 0x1FF1)) { - g_sample_characteristic_handle = result->value_handle; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsCharacteristicAddCallback 0x%x 0x%x 0x%x 0x%x", - status, serverId, srvcHandle, g_sample_characteristic_handle); - } - if ((uuid->uuid_len == sizeof(uint16_t)) && (*((uint16_t*)uuid->uuid) == 0x1FF2)) { - g_diag_characteristic_handle = result->value_handle; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsCharacteristicAddCallback 0x%x 0x%x 0x%x 0x%x", - status, serverId, srvcHandle, g_diag_characteristic_handle); - } - if (g_sample_characteristic_handle != 0 && g_diag_characteristic_handle !=0) { int ret = gatts_start_service(serverId, srvcHandle); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gatts_start_service ret 0x%x", ret); } @@ -1018,17 +929,13 @@ static void BtGattsCharacteristicAddCallback(uint8_t serverId, bt_uuid_t *uuid, static void BtGattsDescriptorAddCallback(uint8_t serverId, bt_uuid_t *uuid, uint16_t srvcHandle, uint16_t descriptorHandle, errcode_t status) { - if (g_sample_svr_handle == srvcHandle) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsDescriptorAddCallback 0x%x 0x%x 0x%x 0x%x", - status, serverId, srvcHandle, descriptorHandle); - } + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsDescriptorAddCallback 0x%x 0x%x 0x%x 0x%x", + status, serverId, srvcHandle, descriptorHandle); } static void BtGattsServiceStartCallback(uint8_t serverId, uint16_t srvcHandle, errcode_t status) { - if (g_sample_svr_handle == srvcHandle) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsServiceStartCallback 0x%x 0x%x 0x%x", status, serverId, srvcHandle); - } + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsServiceStartCallback 0x%x 0x%x 0x%x", status, serverId, srvcHandle); } static void BtGattsServiceStopCallback(uint8_t serverId, uint16_t srvcHandle, errcode_t status) @@ -1048,37 +955,7 @@ static void BtGattsRequestReadCallback(uint8_t serverId, uint16_t connId, gatts_ static void BtGattsRequestWriteCallback(uint8_t serverId, uint16_t connId, gatts_req_write_cb_t *writeCbPara, errcode_t status) { - if (g_sample_characteristic_handle == writeCbPara->handle) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsRequestWriteCallback"); - if (writeCbPara->length == 9) { - uint8_t ctkd[] = {'o', 'p', 'e', 'n', ' ', 'c', 't', 'k', 'd'}; - if (memcmp(ctkd, writeCbPara->value, writeCbPara->length) == 0) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "enable ctkd"); - // 一键双连使能(依赖安全连接参数配置) - errcode_t ret = gap_ble_set_ctkd_enable(true); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gap_ble_set_ctkd_enable ret = %u", ret); - - // 发起ble配对 - ret = gap_ble_pair_remote_device(&g_bd_addr); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gap_ble_pair_remote_device ret = %u ", ret); - } - } else if (writeCbPara->length == 10) { - uint8_t ctkd[] = {'c', 'l', 'o', 's', 'e', ' ', 'c', 't', 'k', 'd'}; - if (memcmp(ctkd, writeCbPara->value, writeCbPara->length) == 0) { - // 一键双连去使能 - errcode_t ret = gap_ble_set_ctkd_enable(false); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gap_ble_set_ctkd_disable ret = %u", ret); - } - } - } else if (g_diag_characteristic_handle == writeCbPara->handle) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "diag_gatt_write_req_cbk"); - diag_gatt_write_req_cbk(serverId, connId, writeCbPara, status); - } -} - -static void BtGattsMtuChangedCallback(uint8_t serverId, uint16_t connId, uint16_t mtuSize, errcode_t status) -{ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsMtuChangedCallback connId = %u mtuSize = %u", connId, mtuSize); + WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BtGattsRequestWriteCallback"); } static void BtA2dpSnkAcceptTimerStop(void) @@ -1254,8 +1131,7 @@ void BtInitCallBacksEx() g_gapBleCallbacks.conn_state_change_cb = BleConnStateChangeCallback; g_gapBleCallbacks.start_adv_cb = BleAdvStartCallback; g_gapBleCallbacks.stop_adv_cb = BleAdvStopCallback; - g_gapBleCallbacks.terminate_adv_cb = BleAdvTerminateCallback; - wrapper_gap_ble_register_callbacks(&g_gapBleCallbacks); + gap_ble_register_callbacks(&g_gapBleCallbacks); g_btGattsCallbacks.add_service_cb = BtGattsServiceAddCallback; g_btGattsCallbacks.add_characteristic_cb = BtGattsCharacteristicAddCallback; @@ -1265,8 +1141,8 @@ 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 = BtGattsMtuChangedCallback; - wrapper_gatts_register_callbacks(&g_btGattsCallbacks); + g_btGattsCallbacks.mtu_changed_cb = nullptr; + gatts_register_callbacks(&g_btGattsCallbacks); } void BtInitGatts(void) @@ -1279,15 +1155,13 @@ void BtInitGatts(void) uuid.uuid_len = sizeof(ser_id); memcpy_s(uuid.uuid, sizeof(uuid.uuid), (char *)&ser_id, sizeof(ser_id)); - ret = wrapper_gatts_register_server(&uuid, &serverId); /* 注册gatt server */ + ret = gatts_register_server(&uuid, &serverId); /* 注册gatt server */ WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gatts_register_server ret: 0x%x serverId = 0x%x", ret, serverId); uuid.uuid_len = sizeof(id); memcpy_s(uuid.uuid, sizeof(uuid.uuid), (char *)&id, sizeof(id)); - ret = wrapper_gatts_add_service(serverId, &uuid, true); + ret = gatts_add_service(serverId, &uuid, true); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "gatts_add_service ret: 0x%x", ret); - - wrapper_gatts_service_start(); } static uint8_t Char2Num(int8_t c) @@ -1392,7 +1266,7 @@ void BtInitSpp(void) void BleAdvStart(void) { - int advId = g_sample_adv_id; + int advId = 1; if (BluetoothModel::GetInstance()->GetAdvStartState()) { WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "BleAdvStart already started"); gap_ble_stop_adv(advId); diff --git a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothWrapper.cpp b/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothWrapper.cpp deleted file mode 100644 index fd9dd57f0..000000000 --- a/code/sdk/application/wearable/nativeapp/nativeui/bluetooth/src/BluetoothWrapper.cpp +++ /dev/null @@ -1,318 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: BluetoothModel view - * Author: - * Create: 2021-10-13 - */ - -#include -#include "BluetoothWrapper.h" - -#ifdef __cplusplus -extern "C" { -#endif - -static bool gatts_register_flag = false; -static uint8_t gatts_server_id = 0; -std::list g_gap_ble_callback_list; -std::list g_gatts_callback_list; -std::list g_uuid_list; -std::list g_svr_handle_list; - -errcode_t wrapper_gap_ble_register_callbacks(gap_ble_callbacks_t *func) -{ - g_gap_ble_callback_list.push_back(*func); - return ERRCODE_SUCC; -} - -errcode_t wrapper_gatts_register_callbacks(gatts_callbacks_t *func) -{ - g_gatts_callback_list.push_back(*func); - return ERRCODE_SUCC; -} - -void wrapper_gap_ble_enable_callback(errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.ble_enable_cb != nullptr) { - callback.ble_enable_cb(status); - } - } -} - -void wrapper_gap_ble_disable_callback(errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.ble_disable_cb != nullptr) { - callback.ble_disable_cb(status); - } - } -} - -void wrapper_gap_ble_start_adv_callback(uint8_t adv_id, adv_status_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.start_adv_cb) { - callback.start_adv_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_stop_adv_callback(uint8_t adv_id, adv_status_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.stop_adv_cb) { - callback.stop_adv_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_set_adv_data_callback(uint8_t adv_id, errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.set_adv_data_cb) { - callback.set_adv_data_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_set_adv_param_callback(uint8_t adv_id, errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.set_adv_param_cb) { - callback.set_adv_param_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_scan_result_callback(gap_scan_result_data_t *scan_result_data) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.scan_result_cb) { - callback.scan_result_cb(scan_result_data); - } - } -} - -void wrapper_gap_ble_set_scan_param_callback(errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.set_scan_param_cb) { - callback.set_scan_param_cb(status); - } - } -} - -void wrapper_gap_ble_connect_state_changed_callback(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) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.conn_state_change_cb) { - callback.conn_state_change_cb(conn_id, addr, conn_state, pair_state, disc_reason); - } - } -} - -void wrapper_gap_ble_paired_complete_callback(uint16_t conn_id, const bd_addr_t *addr, errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.pair_result_cb) { - callback.pair_result_cb(conn_id, addr, status); - } - } -} - -void wrapper_gap_ble_terminate_adv_callback(uint8_t adv_id, adv_status_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.terminate_adv_cb) { - callback.terminate_adv_cb(adv_id, status); - } - } -} - -void wrapper_gap_ble_read_rssi_callback(uint16_t conn_id, int8_t rssi, errcode_t status) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.read_rssi_cb) { - callback.read_rssi_cb(conn_id, rssi, status); - } - } -} - -void wrapper_gap_ble_auth_complete_callback(uint16_t conn_id, const bd_addr_t *addr, - errcode_t status, const ble_auth_info_evt_t* evt) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.auth_complete_cb) { - callback.auth_complete_cb(conn_id, addr, status, evt); - } - } -} - -void wrapper_gap_ble_connect_param_update_callback(uint16_t conn_id, errcode_t status, - const gap_ble_conn_param_update_t *param) -{ - for (auto callback : g_gap_ble_callback_list) { - if (callback.conn_param_update_cb) { - callback.conn_param_update_cb(conn_id, status, param); - } - } -} - -void wrapper_gatts_add_service_callback(uint8_t server_id, bt_uuid_t *uuid, uint16_t handle, errcode_t status) -{ - g_svr_handle_list.push_back(handle); - for (auto callback : g_gatts_callback_list) { - if (callback.add_service_cb) { - callback.add_service_cb(server_id, uuid, handle, status); - } - } -} -void wrapper_gatts_add_characteristic_callback(uint8_t server_id, bt_uuid_t *uuid, uint16_t service_handle, - gatts_add_character_result_t *result, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.add_characteristic_cb) { - callback.add_characteristic_cb(server_id, uuid, service_handle, result, status); - } - } -} -void wrapper_gatts_add_descriptor_callback(uint8_t server_id, bt_uuid_t *uuid, uint16_t service_handle, - uint16_t handle, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.add_descriptor_cb) { - callback.add_descriptor_cb(server_id, uuid, service_handle, handle, status); - } - } -} -void wrapper_gatts_start_service_callback(uint8_t server_id, uint16_t handle, errcode_t status) -{ - bool skip_flag = true; - for (auto svr_handle : g_svr_handle_list) { - if (svr_handle == handle) { - skip_flag = false; - } - } - if (!skip_flag) { - for (auto callback : g_gatts_callback_list) { - if (callback.start_service_cb) { - callback.start_service_cb(server_id, handle, status); - } - } - wrapper_gatts_service_start(); - } -} -void wrapper_gatts_stop_service_callback(uint8_t server_id, uint16_t handle, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.stop_service_cb) { - callback.stop_service_cb(server_id, handle, status); - } - } -} -void wrapper_gatts_delete_all_service_callback(uint8_t server_id, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.delete_service_cb) { - callback.delete_service_cb(server_id, status); - } - } -} -void wrapper_gatts_read_request_callback(uint8_t server_id, uint16_t conn_id, gatts_req_read_cb_t *read_cb_para, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.read_request_cb) { - callback.read_request_cb(server_id, conn_id, read_cb_para, status); - } - } -} -void wrapper_gatts_write_request_callback(uint8_t server_id, uint16_t conn_id, gatts_req_write_cb_t *write_cb_para, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.write_request_cb) { - callback.write_request_cb(server_id, conn_id, write_cb_para, status); - } - } -} -void wrapper_gatts_mtu_changed_callback(uint8_t server_id, uint16_t conn_id, uint16_t mtu_size, errcode_t status) -{ - for (auto callback : g_gatts_callback_list) { - if (callback.mtu_changed_cb) { - callback.mtu_changed_cb(server_id, conn_id, mtu_size, status); - } - } -} - -static gap_ble_callbacks_t g_wrapper_gap_ble_callbacks = { - .ble_enable_cb = wrapper_gap_ble_enable_callback, - .ble_disable_cb = wrapper_gap_ble_disable_callback, - .set_adv_data_cb = wrapper_gap_ble_set_adv_data_callback, - .set_adv_param_cb = wrapper_gap_ble_set_adv_param_callback, - .set_scan_param_cb = wrapper_gap_ble_set_scan_param_callback, - .start_adv_cb = wrapper_gap_ble_start_adv_callback, - .stop_adv_cb = wrapper_gap_ble_stop_adv_callback, - .scan_result_cb = wrapper_gap_ble_scan_result_callback, - .conn_state_change_cb = wrapper_gap_ble_connect_state_changed_callback, - .pair_result_cb = wrapper_gap_ble_paired_complete_callback, - .read_rssi_cb = wrapper_gap_ble_read_rssi_callback, - .terminate_adv_cb = wrapper_gap_ble_terminate_adv_callback, - .auth_complete_cb = wrapper_gap_ble_auth_complete_callback, - .conn_param_update_cb = wrapper_gap_ble_connect_param_update_callback, -}; - -static gatts_callbacks_t g_wrapper_gatts_callbacks = { - .add_service_cb = wrapper_gatts_add_service_callback, - .add_characteristic_cb = wrapper_gatts_add_characteristic_callback, - .add_descriptor_cb = wrapper_gatts_add_descriptor_callback, - .start_service_cb = wrapper_gatts_start_service_callback, - .stop_service_cb = wrapper_gatts_stop_service_callback, - .delete_service_cb = wrapper_gatts_delete_all_service_callback, - .read_request_cb = wrapper_gatts_read_request_callback, - .write_request_cb = wrapper_gatts_write_request_callback, - .mtu_changed_cb = wrapper_gatts_mtu_changed_callback, -}; - -void wrapper_ble_register(void) -{ - gap_ble_register_callbacks(&g_wrapper_gap_ble_callbacks); - gatts_register_callbacks(&g_wrapper_gatts_callbacks); -} - - -errcode_t wrapper_gatts_register_server(bt_uuid_t *app_uuid, uint8_t *server_id) -{ - errcode_t ret = ERRCODE_SUCC; - if (gatts_register_flag) { - *server_id = gatts_server_id; - ret = ERRCODE_SUCC; - } else { - gatts_register_flag = true; - ret = gatts_register_server(app_uuid, server_id); - gatts_server_id = *server_id; - } - return ret; -} - -errcode_t wrapper_gatts_add_service(uint8_t server_id, bt_uuid_t *service_uuid, bool is_primary) -{ - g_uuid_list.push_back(*service_uuid); - return ERRCODE_SUCC; -} - -void wrapper_gatts_service_start(void) -{ - if (!g_uuid_list.empty()) { - bt_uuid_t &uuid = g_uuid_list.front(); - // 服务异步添加,需要保证当前服务start后,再添加下一个服务 - (void)gatts_add_service(gatts_server_id, &uuid, true); - g_uuid_list.pop_front(); - } else { - g_svr_handle_list.clear(); - } -} - -#ifdef __cplusplus -} -#endif 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 e7b833b96..2920e0667 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/include/ConnectPhonePresenter.h +++ b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/include/ConnectPhonePresenter.h @@ -43,7 +43,10 @@ public: bool OnDrag(UIView& view, const DragEvent& event) override; void ConfirmOnClick(); void RemovePair(); + char* getWatchName(); + 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 6c9359595..47ad06a7b 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectOpenView.cpp @@ -7,7 +7,6 @@ #include "wearable_log.h" #include "UiConfig.h" #include "ConnectPhonePresenter.h" -#include "BluetoothModel.h" namespace OHOS { static ConnectOpenView *g_pConnectOpenView{nullptr}; @@ -46,7 +45,7 @@ void ConnectOpenView::ShowUpBackView() return; } watchNameLabel->SetPosition(0, 165, HORIZONTAL_RESOLUTION, 45); // 0:x 244:y 454:width 45:height - watchNameLabel->SetText(BluetoothModel::GetInstance()->getWatchName()); + watchNameLabel->SetText(ConnectPhonePresenter::GetInstance()->getWatchName()); watchNameLabel->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 40); // 40:font data watchNameLabel->SetStyle(STYLE_BACKGROUND_COLOR, OPA_OPAQUE); watchNameLabel->SetAlign(UITextLanguageAlignment::TEXT_ALIGNMENT_CENTER, 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 6644d0e44..06a0bce1e 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/connectnewphone/src/ConnectPhonePresenter.cpp @@ -11,6 +11,7 @@ #include "bts_le_gap.h" #include "drag_event.h" #include "cmsis_os.h" +#include "tcxo.h" #include "UiConfig.h" #include "wearable_log.h" @@ -76,7 +77,7 @@ void ConnectPhonePresenter::RemovePair() unsigned int connedDevicesNum = 0; bool ret = gap_get_paired_devices_num(&connedDevicesNum); - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Setup GapGetPariedDevicesNum ret = %d, num = %d", ret, connedDevicesNum); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Setup GetPariedDevicesNum ret = %d, num = %d", ret, connedDevicesNum); if (connedDevicesNum != 0) { gap_paired_device_info_t *devInfo = (gap_paired_device_info_t *)malloc(sizeof(gap_paired_device_info_t) * connedDevicesNum); @@ -94,18 +95,27 @@ void ConnectPhonePresenter::RemovePair() } free(devInfo); } - - (void)gap_ble_remove_all_pairs(); } void ConnectPhonePresenter::ConfirmOnClick() { bool ret; + + memset_s(watchName, sizeof(watchName), 0, sizeof(watchName)); + (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) { + 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) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ConnectPhonePresenter bt gap_br_set_bt_scan_mode ret = 0x%x", ret); } +#ifndef SUPPORT_ALIPAY_SEC BleAdvStart(); +#endif } bool ConnectPhonePresenter::OnDrag(UIView& view, const DragEvent& event) @@ -120,4 +130,9 @@ bool ConnectPhonePresenter::OnDrag(UIView& view, const DragEvent& event) return true; } +char* ConnectPhonePresenter::getWatchName() +{ + return watchName; } + +} \ No newline at end of file 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 2817eabc9..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 @@ -39,7 +39,7 @@ public: private: void SetNumImg(UIImageView* img, const ImageInfo *info); void FillIntegerPart(uint16_t intVal); - void FillDecimalPart(float data); + void FillDecimalPart(uint16_t intVal); void HandlePosition(); bool CreateImageViews(float data); 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 db348cc74..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 @@ -111,8 +111,6 @@ public: */ void OnActive(void) override; - void OnInactive(void) override; - private: void ProcessData(DialDataType type, DialView* view); std::unordered_map dataTypeMap_; 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 d734feb2e..8c9f3c229 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/MainPresenterSample.cpp @@ -218,15 +218,14 @@ void MainPresenterSample::SetCircleProgress() if (playbackProgress == nullptr) { return; } - int32_t playerState; - PlayersModel::GetInstance()->GetPlayerCtr()->GetPlayerState(playerState); state_ = playersView->GetPlayerButtonState(); - if ((playerState != PLAYER_STARTED) && (state_ == UICheckBox::UICheckBoxState::SELECTED)) { - playersView->SetPlayerButtonState(UICheckBox::UICheckBoxState::UNSELECTED); - } else if ((playerState == PLAYER_STARTED) && (state_ == UICheckBox::UICheckBoxState::UNSELECTED)) { - playersView->SetPlayerButtonState(UICheckBox::UICheckBoxState::SELECTED); - } if (state_ == UICheckBox::UICheckBoxState::SELECTED) { + int32_t playerState; + PlayersModel::GetInstance()->GetPlayerCtr()->GetPlayerState(playerState); + if (playerState != PLAYER_STARTED) { + playersView->SetPlayerButtonState(UICheckBox::UICheckBoxState::UNSELECTED); + return; + } PlayersModel::GetInstance()->GetPlayerCtr()->GetCurrentTime(playerCurrentTime_); PlayersModel::GetInstance()->GetDuration(playerMusicDuration_); if (playerMusicDuration_ != 0) { diff --git a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp index 065036851..04ccf1052 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/main/src/dial/DialDigitalImgView.cpp @@ -89,18 +89,9 @@ void DialDigitalImgView::SetNumImg(UIImageView* img, const ImageInfo *info) currentIndex_++; } -static uint8_t GetValueLength(uint16_t value) -{ - uint8_t length = 1; - if (value > 0) { - length = log10(value) + 1; - } - return length; -} - void DialDigitalImgView::FillIntegerPart(uint16_t intVal) { - uint8_t length = GetValueLength(intVal); + uint8_t length = log10(intVal) + 1; if (length < allocIntegerLen_) { for (uint8_t i = 0; i < (allocIntegerLen_ - length); i++) { SetNumImg(imgs_[currentIndex_], numInfo_[0]); @@ -112,21 +103,18 @@ void DialDigitalImgView::FillIntegerPart(uint16_t intVal) } } -void DialDigitalImgView::FillDecimalPart(float data) +void DialDigitalImgView::FillDecimalPart(uint16_t intVal) { - uint8_t startIndex = GetValueLength(static_cast(abs(data))) + 1; - char dataStr[10] = {'\0'}; // 10: max number of digits. - sprintf_s(dataStr, 10, "%f", data); // 10: size of dataStr - - for (uint8_t i = 0; i < decimalPrecision_; i++) { - uint8_t index = startIndex + i; - if ((index < 10) && (dataStr[index] != '\0')) { // 10: size of dataStr - uint8_t val = dataStr[index] - '0'; - SetNumImg(imgs_[currentIndex_], numInfo_[val]); - } else { + uint8_t length = log10(intVal) + 1; + if (length < decimalPrecision_) { + for (uint8_t i = 0; i < (decimalPrecision_ - length); i++) { SetNumImg(imgs_[currentIndex_], numInfo_[0]); } } + for (uint8_t i = 0; i < length; i++) { + uint8_t curNum = static_cast(intVal / (pow(10, length - i - 1))) % 10; // 10: conversion + SetNumImg(imgs_[currentIndex_], numInfo_[curNum]); + } } void DialDigitalImgView::HandlePosition() @@ -146,7 +134,6 @@ void DialDigitalImgView::HandlePosition() for (uint8_t i = 0; i < currentIndex_; i++) { parent_->Add(imgs_[i]); imgs_[i]->SetPosition(curX, alignPos_.y); - imgs_[i]->Invalidate(); curX += imgs_[i]->GetWidth() + space_; } } @@ -154,9 +141,8 @@ void DialDigitalImgView::HandlePosition() bool DialDigitalImgView::CreateImageViews(float data) { uint8_t imgCnt = 0; - uint16_t integer = static_cast(abs(data)); - - uint8_t actualIntegerLen = GetValueLength(integer); + uint32_t integer = static_cast(abs(data)); + uint8_t actualIntegerLen = log10(integer) + 1; if (integerLength_ == 0) { imgCnt = actualIntegerLen; @@ -178,7 +164,6 @@ bool DialDigitalImgView::CreateImageViews(float data) if (imgCnt_ != 0) { for (uint8_t i = 0; i < imgCnt_; i++) { if (parent_ != nullptr) { - imgs_[i]->Invalidate(); parent_->Remove(imgs_[i]); } } @@ -225,7 +210,9 @@ void DialDigitalImgView::HandleFloatData(float data) if (decimalPrecision_ != 0 && decimalPointInfo_ != nullptr) { SetNumImg(imgs_[currentIndex_], decimalPointInfo_); - FillDecimalPart(data); + // 10: conversion + uint16_t decimalVal = static_cast((abs(data) - intVal) * (pow(10, decimalPrecision_))); + FillDecimalPart(decimalVal); } HandlePosition(); value_ = data; 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 a8866df8a..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 @@ -363,16 +363,4 @@ void DialViewGroup::OnActive(void) kaleidoscope_->StartRotateAnimator(); } } - -void DialViewGroup::OnInactive(void) -{ - if (video_ != nullptr) { - if (!video_->IsStopped()) { - video_->StopPlay(); - } - } else if (kaleidoscope_ != nullptr) { - kaleidoscope_->StopRotateAnimator(); - kaleidoscope_->ClearFocus(); - } -} } 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 a61df4821..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 @@ -93,21 +93,21 @@ bool DialBinParser::GetDialPreviewInfo(FILE* fp, DialPreviewInfo* info) if (memcpy_s(info->dialName, DIAL_NAME_MAX_LEN, dialHeader->dialName, DIAL_NAME_MAX_LEN) != EOK) { GRAPHIC_LOGE("[%s: %d]memcpy_s dial name fail!\n", __FUNCTION__, __LINE__); - UIFree(dialHeader); + free(dialHeader); return false; } if (memcpy_s(info->description, DIAL_DESCRIPTION_MAX_LEN, dialHeader->description, DIAL_DESCRIPTION_MAX_LEN) != EOK) { GRAPHIC_LOGE("[%s: %d]memcpy_s dial description fail!\n", __FUNCTION__, __LINE__); - UIFree(dialHeader); + free(dialHeader); return false; } info->imgId = dialHeader->previewImgId | dirId_; info->offset = dialHeader->imageOffset; - UIFree(dialHeader); + free(dialHeader); return true; } 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 79d973850..e90405d2c 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/phoneservice/src/PhoneService.cpp @@ -1092,43 +1092,41 @@ 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); - void *publishData = malloc(size); - if (publishData == nullptr) { + /* 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; } - ret = memcpy_s(publishData, size, (const void *)&callsInfo, size); + request->msgId = topic; + ret = memcpy_s(request->data, size, (const void *)&callsInfo, size); if (ret != EOK) { - free(publishData); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish memcpy_s fail! ret = %d", ret); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish memcpy_s rateDataTmp fail! ret:%d", ret); return; } - - Request request = { - .msgId = topic, - .len = size, - .msgValue = 0, - .data = publishData, - }; + request->len = size; + request->msgValue = 0; /* public request */ api = SAMGR_GetInstance()->GetFeatureApi(BROADCAST_SERVICE_NAME, BROADCAST_FEATURE_NAME); if (api == nullptr) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GetFeatureApi failed"); - free(publishData); + 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"); - free(publishData); + SAMGR_FreeRequestMsg(request); return; } - broadcastApi->PublishTopic((IUnknown *)broadcastApi, &request); + broadcastApi->PublishTopic((IUnknown *)broadcastApi, request); broadcastApi->Release((IUnknown *)broadcastApi); WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HfpIncomingEventPublish end!!"); 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 bd99bcdb1..8e13b59db 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/rtcservice/src/RtcService.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/rtcservice/src/RtcService.cpp @@ -82,6 +82,7 @@ static BOOL ServiceMessageHandle(Service *service, Request *request) if (request == nullptr) { return FALSE; } + SAMGR_FreeRequestMsg(request); return TRUE; } 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 a15493541..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 @@ -17,7 +17,6 @@ typedef enum { APPLIST_STYLE, HEXAGONS_STYLE, - FOOTBALL_STYLE } DesktopStyle; namespace OHOS { 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 31a578c2a..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 @@ -14,7 +14,6 @@ namespace OHOS { static const char *SET_DESKTOP_LIST = "setdesktopList"; static const char *SET_DESKTOP_HEXAGONS = "setdesktopHexagons"; -static const char *SET_DESKTOP_FOOTBALL = "setdesktopFootball"; class SetDesktopView; class SetDesktopModel; @@ -31,7 +30,7 @@ public: bool OnClick(UIView &view, const ClickEvent &event) override; bool OnDrag(UIView& view, const DragEvent& event) override; - uint8_t GetCurrentStyle(void); + 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 1a6a808c9..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 @@ -36,21 +36,15 @@ public: void OnSetUpView() override; void OnTearDownView() override; void OnStop() override; - void UpdateSelectedStyle(uint8_t selectedStyle); - uint8_t GetCurrentSelectedStyle(void); - + void UpdateSelectedStyle(bool hexagonsSelected); private: - void InitFootballItem(); UILabel titleText; UIToggleButton hexagonsBtn; UIToggleButton listBtn; - UIToggleButton footballBtn_; UIImageView hexagonsImage; UIImageView listImage; - UIImageView footballImage_; UILabel listText; UILabel hexagonsText; - UILabel footballText_; }; } #endif // SET_DESKTOP_VIEW_H 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 180bcd91b..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 @@ -28,8 +28,6 @@ namespace OHOS { (void)UtilsGetValue("applist_style", temp, STYLE_VALUE_LEN); if (strcmp(temp, "hexagons") == 0) { style = HEXAGONS_STYLE; - } else if (strcmp(temp, "football") == 0) { - style = FOOTBALL_STYLE; } else { style = APPLIST_STYLE; } @@ -42,8 +40,6 @@ namespace OHOS { (void)UtilsSetValue("applist_style", "list"); } else if (style == HEXAGONS_STYLE) { (void)UtilsSetValue("applist_style", "hexagons"); - } else if (style == FOOTBALL_STYLE) { - (void)UtilsSetValue("applist_style", "football"); } } 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 34eef7a2f..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 @@ -50,22 +50,14 @@ namespace OHOS { SetDesktopModel::GetInstance().SetDesktopStyle(HEXAGONS_STYLE); } else if (strcmp(view.GetViewId(), SET_DESKTOP_LIST) == 0) { SetDesktopModel::GetInstance().SetDesktopStyle(APPLIST_STYLE); - } else if (strcmp(view.GetViewId(), SET_DESKTOP_FOOTBALL) == 0) { - SetDesktopModel::GetInstance().SetDesktopStyle(FOOTBALL_STYLE); } uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); NativeAbility::GetInstance().ChangeSlice(preSlice); return true; } - uint8_t SetDesktopPresenter::GetCurrentStyle(void) + bool SetDesktopPresenter::GetHexagonsStyleState(void) { - DesktopStyle style = SetDesktopModel::GetInstance().GetDesktopStyle(); - if (style == HEXAGONS_STYLE) { - return 1; // 1: hexagons style enum index - } else if (style == FOOTBALL_STYLE) { - return 2; // 2: football style enum index - } - return 0; + return (SetDesktopModel::GetInstance().GetDesktopStyle() == HEXAGONS_STYLE); } } diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopView.cpp index f736926c0..c5f2b49df 100644 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopView.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/set_desktop/src/SetDesktopView.cpp @@ -43,43 +43,41 @@ void SetDesktopView::OnSetUpView() titleText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); container_->Add(&titleText); - listImage.SetPosition(0, 135, 190, 190); + listImage.SetPosition(25, 135, 190, 190); listImage.SetSrc(PNG_SET_DESKTOP_BG_IMAGE); container_->Add(&listImage); - listBtn.SetPosition(22, 157, 148, 148); + listBtn.SetPosition(47, 157, 148, 148); listBtn.SetImages(PNG_SET_DESKTOP_LIST_IMAGE, PNG_SET_DESKTOP_LIST_IMAGE); listBtn.SetViewId(SET_DESKTOP_LIST); container_->Add(&listBtn); - listText.SetPosition(61, 328, 200, 60); + listText.SetPosition(96, 328, 200, 60); listText.SetText("列表"); listText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); listText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); listText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); container_->Add(&listText); - hexagonsImage.SetPosition(150, 135, 190, 190); + hexagonsImage.SetPosition(247, 135, 190, 190); hexagonsImage.SetSrc(PNG_SET_DESKTOP_BG_IMAGE); container_->Add(&hexagonsImage); - hexagonsBtn.SetPosition(172, 157, 148, 148); + hexagonsBtn.SetPosition(267, 157, 148, 148); hexagonsBtn.SetImages(PNG_SET_DESKTOP_HEXAGONS_IMAGE, PNG_SET_DESKTOP_HEXAGONS_IMAGE); hexagonsBtn.SetViewId(SET_DESKTOP_HEXAGONS); container_->Add(&hexagonsBtn); - hexagonsText.SetPosition(218, 328, 200, 60); + hexagonsText.SetPosition(305, 328, 200, 60); hexagonsText.SetText("蜂窝"); hexagonsText.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); hexagonsText.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); hexagonsText.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); container_->Add(&hexagonsText); - InitFootballItem(); listBtn.SetOnClickListener(presenter_); hexagonsBtn.SetOnClickListener(presenter_); - footballBtn_.SetOnClickListener(presenter_); - UpdateSelectedStyle(presenter_->GetCurrentStyle()); + UpdateSelectedStyle(presenter_->GetHexagonsStyleState()); } void SetDesktopView::OnTearDownView() @@ -99,48 +97,11 @@ void SetDesktopView::OnStop() } } -void SetDesktopView::UpdateSelectedStyle(uint8_t selectedStyle) +void SetDesktopView::UpdateSelectedStyle(bool hexagonsSelected) { - hexagonsImage.SetVisible(false); - hexagonsBtn.SetState(false); - listImage.SetVisible(false); - listBtn.SetState(false); - footballImage_.SetVisible(false); - footballBtn_.SetState(false); - - if (selectedStyle == 1) { // 1: select hexagons style - hexagonsImage.SetVisible(true); - hexagonsBtn.SetState(true); - } else if (selectedStyle == 2) { // 2: select football style - footballImage_.SetVisible(true); - footballBtn_.SetState(true); - } else { - listImage.SetVisible(true); - listBtn.SetState(true); - } -} - -void SetDesktopView::InitFootballItem() -{ - footballImage_.SetPosition(300, 135, 190, 190); - footballImage_.SetSrc(PNG_SET_DESKTOP_BG_IMAGE); - container_->Add(&footballImage_); - - footballBtn_.SetPosition(322, 157, 148, 148); - footballBtn_.SetImages(PNG_SET_DESKTOP_HEXAGONS_IMAGE, PNG_SET_DESKTOP_HEXAGONS_IMAGE); - footballBtn_.SetViewId(SET_DESKTOP_FOOTBALL); - container_->Add(&footballBtn_); - - footballText_.SetPosition(368, 328, 200, 60); - footballText_.SetText("足球"); - footballText_.SetLineBreakMode(UILabel::LINE_BREAK_ADAPT); - footballText_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - footballText_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - container_->Add(&footballText_); -} - -uint8_t SetDesktopView::GetCurrentSelectedStyle() -{ - return presenter_->GetCurrentStyle(); + listImage.SetVisible(!hexagonsSelected); + hexagonsImage.SetVisible(hexagonsSelected); + hexagonsBtn.SetState(hexagonsSelected); + listBtn.SetState(!hexagonsSelected); } } 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 fb895078b..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 @@ -11,7 +11,6 @@ #include "SetDialModel.h" #include "Presenter.h" #include "components/ui_view.h" -#include "components/ui_roller_view.h" #include "KeyInputListener.h" #include "ModelListenerSample.h" @@ -23,8 +22,7 @@ class SetDialView; class SetDialModel; class SetDialPresenter : public Presenter, public UIView::OnClickListener, public ModelListenerSample, - public UICoverflowView::OnCoverflowScrollListener, - public UIRollerView::OnScrollListener { + public UICoverflowView::OnCoverflowScrollListener { public: SetDialPresenter(); ~SetDialPresenter() override; @@ -37,7 +35,6 @@ public: void OnTickEvent() override; void Notify() override {} bool OnScroll() override; - void OnScroll(UIRollerView* roller, std::string currentItemName, float currentItemAngle) override; bool OnClick(UIView &view, const ClickEvent &event) override; void ResetTickTimer(void); private: 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 0a0408dfd..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 @@ -11,7 +11,6 @@ #include "View.h" #include "components/ui_view_group.h" #include "components/ui_coverflow_view.h" -#include "components/ui_roller_view.h" #include "window/window.h" #include "BaseView.h" #include "ChangeSliceListener.h" @@ -21,12 +20,6 @@ namespace OHOS { static constexpr uint8_t DIVISOR_TWO = 2; class SetDialPresenter; -enum class DialStyle { - COVERFLOW = 0, - ROLLER, - STYLE_NUM -}; - class SetDialView : public View { public: SetDialView(); @@ -43,14 +36,10 @@ public: void OnTearDownView() override; void OnStop() override; void CoverflowViewScroll(void); - void RollerViewScroll(std::string currentItemName, float currentItemAngle); uint8_t GetCoverflowPage(void); private: void SetUpCoverflowView(void); - void SetUpRollerView(void); UICoverflowView coverflow_; - UIRollerView rollerView_; - int16_t rollerItemNum_ = 0; UILabel label_; uint8_t lastIndex_; }; 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 c00324134..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 @@ -67,11 +67,6 @@ namespace OHOS { return true; } - void SetDialPresenter::OnScroll(UIRollerView* roller, std::string currentItemName, float currentItemAngle) - { - view_->RollerViewScroll(currentItemName, currentItemAngle); - } - size_t SetDialPresenter::GetDialCount(void) { return model->GetDialCount(); 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 82a55d015..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 @@ -8,7 +8,6 @@ #include #include "SetDialView.h" #include "SetDialPresenter.h" -#include "SetDialStyleModel.h" namespace OHOS { SetDialView::SetDialView() @@ -27,11 +26,7 @@ void SetDialView::OnStart() View::OnStart(); SetContainerView(new UIViewGroup()); container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - if (SetDialStyleModel::GetInstance().GetStyle() == DialStyle::COVERFLOW) { - SetUpCoverflowView(); - } else { - SetUpRollerView(); - } + SetUpCoverflowView(); } void SetDialView::SetUpCoverflowView(void) @@ -40,7 +35,6 @@ void SetDialView::SetUpCoverflowView(void) coverflow_.SetIntercept(true); coverflow_.SetOnCoverflowListener(presenter_); coverflow_.SetOnClickListener(presenter_); - coverflow_.SetThrowDrag(true); std::vector &dialInfo = presenter_->GetDialInfo(); for (auto iter : dialInfo) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialView::SetUpCoverflowView %s", @@ -55,43 +49,11 @@ void SetDialView::SetUpCoverflowView(void) label_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); label_.SetText(dialInfo[lastIndex_].dialName.c_str()); label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - + container_->Add(&coverflow_); container_->Add(&label_); } -void SetDialView::SetUpRollerView(void) -{ - rollerView_.SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - rollerView_.SetItemSize(150, 150); // 150: item size - rollerView_.SetThrowDrag(true); - rollerView_.SetItemPadding(80); // 80: item padding - container_->Add(&rollerView_); - - std::vector &dialInfo = presenter_->GetDialInfo(); - for (auto iter : dialInfo) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialView::SetUpRollerView %s", - iter.dialName.c_str()); - bool succ = rollerView_.AddItem(iter.dialName, iter.preImageInfo); - rollerItemNum_ += succ ? 1 : 0; - } - float scalerCoef = 0.55; - uint16_t w = Screen::GetInstance().GetWidth(); - uint16_t h = Screen::GetInstance().GetHeight(); - rollerView_.SetItemSize(w * scalerCoef, h * scalerCoef); - lastIndex_ = presenter_->GetPageIndex(); - rollerView_.SetCurrentItem(dialInfo[lastIndex_].dialName); - rollerView_.SetOnClickListener(presenter_); - rollerView_.SetOnScrollListener(presenter_); - - label_.SetPosition(127, 50, 200, 50); - label_.SetTextColor(Color::White()); - label_.SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); - label_.SetText(dialInfo[lastIndex_].dialName.c_str()); - label_.SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - container_->Add(&label_); -} - void SetDialView::OnSetUpView() { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialView::OnSetUpView"); @@ -149,29 +111,6 @@ void SetDialView::CoverflowViewScroll(void) presenter_->ResetTickTimer(); } -void SetDialView::RollerViewScroll(std::string currentItemName, float currentItemAngle) -{ - const float baseAngle = 360.0; - const float halfBaseAngle = 180.0; - if (FloatMoreEqual(currentItemAngle, halfBaseAngle)) { - currentItemAngle -= baseAngle; - } - if (currentItemAngle < 0) { - currentItemAngle = -currentItemAngle; - } - float maxAngle = baseAngle / rollerItemNum_; - float coef = 1.0 - 1.0 / (maxAngle) * currentItemAngle; - label_.SetStyle(STYLE_TEXT_OPA, coef * OPA_OPAQUE); - label_.SetText(currentItemName.c_str()); - std::vector &dialInfo = presenter_->GetDialInfo(); - for (uint8_t i = 0; i < dialInfo.size(); ++i) { - if (dialInfo[i].dialName == currentItemName) { - lastIndex_ = i; - } - } - presenter_->ResetTickTimer(); -} - uint8_t SetDialView::GetCoverflowPage(void) { return lastIndex_; diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleModel.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleModel.h deleted file mode 100644 index c27e3007a..000000000 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleModel.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStyleModel.h - * Author: - * Create: 2024-06-06 - */ - -#ifndef SET_DIAL_STYLE_MODEL_H -#define SET_DIAL_STYLE_MODEL_H -#include "SetDialView.h" -#include "components/ui_view.h" - -namespace OHOS { -class SetDialStyleModel { -public: - static SetDialStyleModel& GetInstance() - { - static SetDialStyleModel model; - return model; - } - - void SetStyle(DialStyle style); - DialStyle GetStyle(); - -private: - constexpr static uint8_t MAX_LEN = 32; - const char key_[MAX_LEN] = "set_dial_style"; - struct { - const DialStyle style; - const char value[MAX_LEN]; - } values_[static_cast(DialStyle::STYLE_NUM)] = { - {DialStyle::COVERFLOW, "DialStyle::COVERFLOW"}, - {DialStyle::ROLLER, "DialStyle::ROLLER"}, - }; - SetDialStyleModel(); - ~SetDialStyleModel(); - SetDialStyleModel(const SetDialStyleModel&) = delete; - SetDialStyleModel& operator=(const SetDialStyleModel&) = delete; -}; -} // OHOS -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStylePresenter.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStylePresenter.h deleted file mode 100644 index fda918ece..000000000 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStylePresenter.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStylePresenter.h - * Author: - * Create: 2024-06-06 - */ - -#ifndef SET_DIAL_STYLE_PRESENTER_H -#define SET_DIAL_STYLE_PRESENTER_H -#include "SetDialView.h" -#include "components/ui_view.h" -#include "Presenter.h" - -namespace OHOS { -class SetDialStyleModel; -class SetDialStyleView; -class SetDialStylePresenter : public Presenter, - public UIView::OnClickListener, - public UIView::OnDragListener { -public: - SetDialStylePresenter(); - ~SetDialStylePresenter(); - SetDialStylePresenter(const SetDialStylePresenter&) = delete; - SetDialStylePresenter& operator=(const SetDialStylePresenter&) = delete; - bool OnClick(UIView &view, const ClickEvent &event) override; - bool OnDrag(UIView& view, const DragEvent& event) override; - DialStyle GetCurrentStyle() const - { - return curStyle_; - } - -private: - DialStyle curStyle_ = DialStyle::COVERFLOW; -}; - -} // OHOS -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleView.h b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleView.h deleted file mode 100644 index 3b1a93221..000000000 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/include/SetDialStyleView.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStyleView.h - * Author: - * Create: 2024-06-06 - */ - -#ifndef SET_DIAL_STYLE_VIEW_H -#define SET_DIAL_STYLE_VIEW_H -#include "components/ui_view.h" -#include "components/ui_label.h" -#include "components/ui_view_group.h" -#include "components/ui_toggle_button.h" -#include "SetDialView.h" -#include "View.h" - -namespace OHOS { -class SetDialStylePresenter; -class SetDialStyleView : public View { -public: - SetDialStyleView(); - ~SetDialStyleView() override; - SetDialStyleView(const SetDialStyleView &) = delete; - SetDialStyleView& operator=(const SetDialStyleView &) = delete; - - void OnStart() override; - void OnSetUpView() override; - void OnStop() override; - void OnClick(UIView &view); - -private: - UILabel labelCover_; - UILabel labelRoller_; - UIToggleButton btnCover_; - UIToggleButton btnRoller_; - struct { - UIToggleButton *btn; - DialStyle style; - } styleTable_[static_cast(DialStyle::STYLE_NUM)] = { - {&btnCover_, DialStyle::COVERFLOW}, - {&btnRoller_, DialStyle::ROLLER}, - }; -}; -} // OHOS -#endif \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleModel.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleModel.cpp deleted file mode 100644 index 81d833aef..000000000 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleModel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStyleModel.cpp - * Author: - * Create: 2024-06-06 - */ - -#include "SetDialStyleModel.h" -#include "kv_store.h" - -namespace OHOS { -void SetDialStyleModel::SetStyle(DialStyle style) -{ - int len = sizeof(values_) / sizeof(values_[0]); - for (int i = 0; i < len; ++i) { - if (values_[i].style == style) { - UtilsSetValue(key_, values_[i].value); - break; - } - } -} - -DialStyle SetDialStyleModel::GetStyle() -{ - int len = sizeof(values_) / sizeof(values_[0]); - char temp[MAX_LEN]; - UtilsGetValue(key_, temp, MAX_LEN); - for (int i = 0; i < len; ++i) { - if (strcmp(temp, values_[i].value) == 0) { - return values_[i].style; - } - } - return DialStyle::COVERFLOW; -} - -SetDialStyleModel::SetDialStyleModel() -{ -} - -SetDialStyleModel::~SetDialStyleModel() -{ -} -} // OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStylePresenter.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStylePresenter.cpp deleted file mode 100644 index 6dbc2837a..000000000 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStylePresenter.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStylePresenter.cpp - * Author: - * Create: 2024-06-06 - */ - -#include "SetDialStyleView.h" -#include "SetDialStyleModel.h" -#include "SetDialStylePresenter.h" - -namespace OHOS { -SetDialStylePresenter::SetDialStylePresenter() -{ - Attach(&SetDialStyleModel::GetInstance()); -} - -SetDialStylePresenter::~SetDialStylePresenter() -{ -} - -bool SetDialStylePresenter::OnClick(UIView &view, const ClickEvent &event) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialStylePresenter::OnClick"); - view_->OnClick(view); - return true; -} - -bool SetDialStylePresenter::OnDrag(UIView& view, const DragEvent& event) -{ - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "SetDialStylePresenter::OnDrag"); - UNUSED(view); - 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"); - uint16_t preSlice = NativeAbility::GetInstance().GetPreSliceId(); - NativeAbility::GetInstance().ChangeSlice(preSlice); - } - return true; -} -} // OHOS \ No newline at end of file diff --git a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp b/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp deleted file mode 100644 index 86901f059..000000000 --- a/code/sdk/application/wearable/nativeapp/nativeui/set_dial_style/src/SetDialStyleView.cpp +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2024. All rights reserved. - * Description: SetDialStyleView.cpp - * Author: - * Create: 2024-06-06 - */ - -#include "SetDialStyleView.h" -#include "SetDialStyleModel.h" -#include "SetDialStylePresenter.h" - -namespace OHOS { -SetDialStyleView::SetDialStyleView() -{ -} - -SetDialStyleView::~SetDialStyleView() -{ -} - -void SetDialStyleView::OnStart() -{ - View::OnStart(); - SetContainerView(new UIViewGroup); - if (container_ == nullptr) { - return; - } - container_->SetDraggable(true); - container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - container_->SetOnDragListener(presenter_); - container_->SetTouchable(true); -} - -void SetDialStyleView::OnSetUpView() -{ - if (container_ == nullptr) { - return; - } - View::OnSetUpView(); - labelCover_.SetPosition(96, 328, 200, 60); - labelCover_.SetText("Coverflow"); - container_->Add(&labelCover_); - - labelRoller_.SetPosition(305, 328, 200, 60); - labelRoller_.SetText("Roller"); - container_->Add(&labelRoller_); - - btnCover_.SetPosition(47, 157, 148, 148); - container_->Add(&btnCover_); - btnRoller_.SetPosition(267, 157, 148, 148); - container_->Add(&btnRoller_); - - const DialStyle style = SetDialStyleModel::GetInstance().GetStyle(); - int len = sizeof(styleTable_) / sizeof(styleTable_[0]); - for (int i = 0; i < len; ++i) { - if (style == styleTable_[i].style) { - styleTable_[i].btn->SetState(true); - } else { - styleTable_[i].btn->SetState(false); - } - } - - btnCover_.SetOnClickListener(presenter_); - btnRoller_.SetOnClickListener(presenter_); -} - -void SetDialStyleView::OnStop() -{ - View::OnStop(); - if (container_ != nullptr) { - container_->RemoveAll(); - delete container_; - container_ = nullptr; - } -} - -void SetDialStyleView::OnClick(UIView &view) -{ - const UIToggleButton *ptr = dynamic_cast(&view); - if (ptr == nullptr) { - return; - } - int len = sizeof(styleTable_) / sizeof(styleTable_[0]); - for (int i = 0; i < len; ++i) { - if (ptr == styleTable_[i].btn) { - styleTable_[i].btn->SetState(true); - SetDialStyleModel::GetInstance().SetStyle(styleTable_[i].style); - } else { - styleTable_[i].btn->SetState(false); - } - } -} -} // OHOS \ No newline at end of file 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 61b893dbd..71fed048f 100755 --- a/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp +++ b/code/sdk/application/wearable/nativeapp/nativeui/settings/src/SettingModel.cpp @@ -29,7 +29,6 @@ namespace OHOS { settings[index++] = {VIEW_SET_DESKTOP, PNG_SETTTING_DESKTOP_IMAGE, "桌面", true}; settings[index++] = {VIEW_SET_DIAL, PNG_SETTTING_DESKTOP_IMAGE, "表盘", true}; settings[index++] = {VIEW_SET_CARD, PNG_SETTTING_DESKTOP_IMAGE, "卡片", true}; - settings[index++] = {VIEW_SET_DIAL_STYLE, PNG_SETTTING_DESKTOP_IMAGE, "表盘风格", true}; usedLen = index; } 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 64fd4eef6..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 @@ -169,6 +169,7 @@ void ServiceMsgProcess(Request *request) uapi_pm_remove_sleep_veto(PM_ID_SCREEN); break; } + SAMGR_FreeRequestMsg(request); } BOOL ServiceMessageHandle(Service *service, Request *request) @@ -191,33 +192,19 @@ TaskConfig GetServiceTaskConfig(Service *service) static int32_t SendMsg(int32_t msgId, uint32_t msgValue, void *data, int32_t dataLen) { - int32_t ret; - void *sendData = nullptr; - if (dataLen > 0) { - sendData = malloc(dataLen); - if (sendData == nullptr) { - return FALSE; - } - ret = memcpy_s(sendData, dataLen, data, dataLen); - if (ret != EOK) { - free(sendData); - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "uiservice sendMsg memcpy_s fail! ret = %d", ret); - return FALSE; - } + Request *request = SAMGR_AllocRequestMsg(0, PLATFORM_CORE, UI_SVR_ID, dataLen); + if (request == nullptr) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "SAMGR_AllocRequestMsg failed"); + return FALSE; + } + request->msgId = msgId; + request->msgValue = msgValue; + if (data != nullptr) { + (void)memcpy_s(request->data, dataLen, data, dataLen); } - Request request = { - .msgId = msgId, - .len = dataLen, - .msgValue = msgValue, - .data = sendData, - }; - - ret = SAMGR_SendRequest(IUNKNOWN_GetIdentity(GET_IUNKNOWN(g_uiService)), &request, nullptr); + int32_t ret = SAMGR_SendRequest(IUNKNOWN_GetIdentity(GET_IUNKNOWN(g_uiService)), request, nullptr); if (ret != 0) { - if (sendData != nullptr) { - free(sendData); - } WEARABLE_LOGE(WEARABLE_LOG_MODULE_UI_SERVICE, "SendMsg failed ret = %d ", ret); return FALSE; } 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 c3842503d..6f7d3b84c 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -22,10 +22,10 @@ #include "phoneaddressmodel.h" #include "LanguageInit.h" #include "ConfigModel.h" +#include "uiservice/include/ui_service.h" // #include "TraingCardPresenter.h" #ifdef FD230 -#include "uiservice/include/ui_service.h" #include "TraingModel.h" #include "WeatherModel.h" #include "SleepModel.h" @@ -422,6 +422,7 @@ void get_sedent_param( msg_sedent_set_param_info_t * data) data->sedent_time = p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SEDENTARY_REMINDERTIME); data->frequenc = p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_SEDENTARY_INTERVAL); + return; } @@ -429,74 +430,45 @@ void get_sedent_param( msg_sedent_set_param_info_t * data) void ble_set_dial_by_id(uint16_t id) { - #ifdef FD230 return OHOS::SetDialModel::GetInstance().UpdateDialSetting(id); -#endif } uint16_t ble_get_dial_id(void) { -#ifdef FD230 return OHOS::SetDialModel::GetInstance().GetCurrentDialID(); -#else - return 0; -#endif } bool ble_is_dial_install_by_id(uint16_t id) { -#ifdef FD230 return OHOS::SetDialModel::GetInstance().IsDialInstalled(id); -#else - return false; -#endif } int ble_get_dial_num(void) { -#ifdef FD230 return OHOS::SetDialModel::GetInstance().GetDialCount(); -#else - return 1; -#endif } bool ble_delete_dial(uint16_t id) { - -#ifdef FD230 if(id==OHOS::SetDialModel::GetInstance().GetCurrentDialID()) return false; else return OHOS::SetDialModel::GetInstance().UninstallDial(id); -#else - return false; -#endif } int get_all_dial_id( char * buf) { -#ifdef FD230 return OHOS::SetDialModel::GetInstance().GetAllDialIDs(buf); -#else -return 0; -#endif } bool dial_file_save(void ) { -#ifdef FD230 return OHOS::SetDialModel::GetInstance().saveDialfile(); -#else - return true; -#endif } void install_Register_dial( char * name,uint16_t id) { -#ifdef FD230 return OHOS::SetDialModel::GetInstance().RegisterDial(id,name); -#endif } @@ -1216,9 +1188,7 @@ void set_vibrationremiander(uint8_t falg)//设置震动模式 OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); p_ConfigModel->SetVibrationReminder(falg); uapi_vibrationModeSet(falg); - #ifdef FD230 SendMsgToUIService(UI_UPDATE_VIBRATION_MODE,0,nullptr,0); - #endif return ; } @@ -1227,9 +1197,7 @@ void set_SilentMode(uint8_t falg)//设置静音模式 OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); p_ConfigModel->SetSilentMode(falg); uapi_setSilentMode(falg); - #ifdef FD230 SendMsgToUIService(UI_UPDATE_SILENT_MODE,0,nullptr,0); - #endif return; } /*设置自动获取实时数据开关*/ @@ -1266,9 +1234,7 @@ void set_brigthness(uint8_t data) //设置屏幕亮度 data = maxbrightness; p_ConfigModel->SetBrightness(data); uapi_setScreenBrightness(data); -#ifdef FD230 SendMsgToUIService(UI_UPDATE_BRIGHTNESS_VALUE,0,nullptr,0); -#endif return; } void Set_DmpChangeMode(int state) @@ -1341,9 +1307,7 @@ void set_ScreenDuration(int data) //设置亮屏时长 { OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); p_ConfigModel->SetScreenDuration(data); -#ifdef FD230 SendMsgToUIService(UI_UPDATE_SCREEN_DURATION,0,nullptr,0); -#endif return; } @@ -1357,9 +1321,7 @@ void Set_RaiseToWake(bool value) //抬婉亮屏开关 { OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); p_ConfigModel->SetRaiseToWake(value); -#ifdef FD230 SendMsgToUIService(UI_UPDATE_RAISETOBRIGHTNESS,0,nullptr,0); -#endif return; } @@ -1374,9 +1336,7 @@ void Set_SystemVolume(int value) //设置系统音量 OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); p_ConfigModel->SetSystemVolume(value); uapi_systemVolumeSet(value); -#ifdef FD230 SendMsgToUIService(UI_UPDATE_SYSTEM_VOLUME,0,nullptr,0); -#endif return; } @@ -1391,9 +1351,7 @@ void Set_CallVolume(int value) //设置通话音量 OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance(); p_ConfigModel->SetCallVolume(value); uapi_callVolumeSet(value); -#ifdef FD230 SendMsgToUIService(UI_UPDATE_CALL_VOLUME,0,nullptr,0); -#endif return; } @@ -1493,9 +1451,7 @@ void set_weather_one_data(int tempMin, int iconDay,int fxDate, int tempMax, char void ble_UpdateMainWeatherData(void) { -#ifdef FD230 SendMsgToUIService(UI_UPDATE_WEATHER_DATA,0,nullptr,0); -#endif } message_infor_t message_infor_s; void read_message_data(void) diff --git a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c index 56f2665c6..5c2594cc6 100644 --- a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c +++ b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c @@ -192,9 +192,6 @@ static BOOL SendLocalMessage(const Identity *id, Request *req) req, req->msgId, req->len, req->data); int32_t ret = SAMGR_SendRequest(id, req, NULL); if (ret != OHOS_SUCCESS) { - if (req->data != NULL) { - free(req->data); - } WEARABLE_LOGE(WEARABLE_LOG_MODULE_BROADCASE_SERVICE, "SAMGR_SendRequest failed. ret=%d ", ret); return FALSE; } @@ -230,27 +227,19 @@ static BOOL SendInnerMessage(const TopicSubscriberInfo *topicSubscriberInfo, int continue; } - /* 在当前核内给对应服务发送消息 */ - Request tmpReq = { - .msgId = req->msgId, - .len = req->len, - .msgValue = req->msgValue, - .data = NULL, - }; - if (tmpReq.len != 0) { - tmpReq.data = malloc(tmpReq.len); - if (tmpReq.data != NULL) { - (void)memcpy_s(tmpReq.data, tmpReq.len, req->data, req->len); - } else { - break; - } + /* 在当前核内给对应服务发送消息。(共享内存时,消息分配,相当于零拷贝) zero-copy */ + Request *tmpReq = SAMGR_ZeroCopyMsg(req); + if (tmpReq == NULL) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_BROADCASE_SERVICE, "SAMGR_AllocRequestMsg failed! subIdx=%u, len=%u", + subIdx, req->len); + break; } - SendLocalMessage(subscriber->identity, &tmpReq); + WEARABLE_LOGD(WEARABLE_LOG_MODULE_BROADCASE_SERVICE, "subIdx=%u, topicIdx=%u, tmpReq=0x%p", + subIdx, topicIdx, tmpReq); + + SendLocalMessage(subscriber->identity, tmpReq); } } - if (req->data != NULL) { - free(req->data); - } MUTEX_Unlock(topicSubscriberInfo->mutex); return TRUE; } @@ -559,9 +548,7 @@ int32_t PublishTopicMsgImpl(const TopicSubscriberInfo *topicSubscriberInfo, Requ int16_t topicIdx = GetTopicIndex(topicTable->topics, topicTable->count, req->msgId); if (topicIdx == INVALID_INDEX) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_BROADCASE_SERVICE, "topic not exist! msgId=%u", req->msgId); - if (req->data != NULL) { - free(req->data); - } + SAMGR_FreeRequestMsg(req); return ret; } WEARABLE_LOGD(WEARABLE_LOG_MODULE_BROADCASE_SERVICE, "topic=%u, topicIdx=%u", req->msgId, topicIdx); @@ -580,5 +567,7 @@ int32_t PublishTopicMsgImpl(const TopicSubscriberInfo *topicSubscriberInfo, Requ if (isInnerCore) { SendInnerMessage(topicSubscriberInfo, topicIdx, req); } + + SAMGR_FreeRequestMsg(req); return OHOS_SUCCESS; } diff --git a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt index 08f6efb7c..c514708ce 100644 --- a/code/sdk/application/wearable/service/msg_center/CMakeLists.txt +++ b/code/sdk/application/wearable/service/msg_center/CMakeLists.txt @@ -105,7 +105,6 @@ set(COMPONENT_NAME "msg_center_adapt") set(PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_SOURCE_DIR}/include/vendor_app - ${CMAKE_CURRENT_SOURCE_DIR}/include/ota ) set(PRIVATE_HEADER @@ -153,7 +152,6 @@ set(PRIVATE_HEADER ${ROOT_DIR}/middleware/utils/fs/include/fs ${ROOT_DIR}/include/middleware/services/bts/br ${ROOT_DIR}/include/middleware/services/bts/common - ${ROOT_DIR}/application/auto_ota ) if("JS_ENABLE" IN_LIST DEFINES) @@ -204,13 +202,6 @@ set(SOURCES ) endif() -if("SUPPORT_AUTO_OTA_SERVER" IN_LIST DEFINES) -set(SOURCES - ${SOURCES} - ${CMAKE_CURRENT_SOURCE_DIR}/src/ota/msg_center_ota.cpp -) -endif() - set(COMPONENT_PUBLIC_CCFLAGS ) 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 5ee51f2c9..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 bba3ff9a8..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_protocol.h b/code/sdk/application/wearable/service/msg_center/include/msg_center_protocol.h index 26c7c1e90..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 @@ -201,19 +201,11 @@ typedef enum msg_center_alipay_type_id { } msg_center_alipay_type_id_t; -typedef enum msg_center_ota_type_id { - MSGCENTER_TYPE_ID_OTA_UPG_START = 0x1, - MSGCENTER_TYPE_ID_OTA_UPG_CHECK = 0x2, - MSGCENTER_TYPE_ID_OTA_UPG_CHECK_RESULT = 0x3, - -} msg_center_ota_type_id_t; - typedef enum msg_center_cmd_id { MSGCENTER_CMD_XIAODU = 0x1, MSGCENTER_CMD_NAVIGATION = 0x2, MSGCENTER_CMD_VECTOR_NAVI = 0x3, MSGCENTER_CMD_ALIPAY = 0x4, - MSGCENTER_CMD_OTA = 0x5, MSGCENTER_CMD_MAX } msg_center_cmd_id_t; @@ -320,7 +312,7 @@ 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); +diag_frame_fid_t msg_center_get_trans_channel(); void msg_center_set_trans_channel(diag_frame_fid_t select); #ifdef __cplusplus diff --git a/code/sdk/application/wearable/service/msg_center/include/ota/msg_center_ota.h b/code/sdk/application/wearable/service/msg_center/include/ota/msg_center_ota.h deleted file mode 100644 index bd1a84dab..000000000 --- a/code/sdk/application/wearable/service/msg_center/include/ota/msg_center_ota.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2021-2021. All rights reserved. - * Description: broadcast service api - * Author: CompanyName - * Create: 2021-11-11 - */ - -#ifndef MSG_CENTER_OTA_H -#define MSG_CENTER_OTA_H - -#include "msg_center_protocol.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -errcode_t msg_center_ota_rec_upg_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); -errcode_t msg_center_ota_rec_upg_check(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); -errcode_t msg_center_ota_rec_upg_check_result(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len); -void msg_center_ota_upgrade_start(void); - -#ifdef __cplusplus -#if __cplusplus -} -#endif -#endif -#endif /* MSG_CENTER_OTA_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 index 468970f03..906a03f5d 100644 Binary files a/code/sdk/application/wearable/service/msg_center/libs/libbaidumapsdk.a 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 2d66f4823..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 @@ -11,7 +11,6 @@ #include "wearable_log.h" #include "baidu_app.h" #include "alipay_app.h" -#include "msg_center_ota.h" #ifdef __cplusplus extern "C" { @@ -104,11 +103,6 @@ msg_center_cmd_map_t g_msg_center_type_tbl[] = { { MSGCENTER_CMD_ALIPAY, MSGCENTER_TYPE_ID_ALIPAY_CLOSE, msg_center_alipay_close}, { MSGCENTER_CMD_ALIPAY, MSGCENTER_TYPE_ID_ALIPAY_TIME_SYNC, msg_center_alipay_time_sync}, #endif -#ifdef SUPPORT_AUTO_OTA_SERVER - { MSGCENTER_CMD_OTA, MSGCENTER_TYPE_ID_OTA_UPG_START, msg_center_ota_rec_upg_start}, - { MSGCENTER_CMD_OTA, MSGCENTER_TYPE_ID_OTA_UPG_CHECK, msg_center_ota_rec_upg_check}, - { MSGCENTER_CMD_OTA, MSGCENTER_TYPE_ID_OTA_UPG_CHECK_RESULT, msg_center_ota_rec_upg_check_result}, -#endif }; msg_center_cmd_map_t *msg_center_get_cmd_tbl_ops(uint8_t idx) 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 5d0943264..625779c52 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 @@ -312,12 +312,10 @@ void MsgCenterNotifyONtimeProc(const Topic topic, Request* req) void MsgCenterNotifystepProc(const Topic topic, Request* req) { unused(req); -#ifdef FD230 if(OHOS::GoalView::GetInstance()) { OHOS::GoalView::GetInstance()->GoalViewrefresh(); } -#endif // The alarm notification is not displayed if the incoming call notification is already being processed // cywee_save_data(); @@ -1016,10 +1014,9 @@ void MsgCenterNotifyActivityExtraInfoProc(const Topic topic, Request* req) { unused(topic); } -#ifdef FD230 + static SLEEP_T sleep_data = {0}; static NAP_T nap_data = {0}; -#endif static int state_num = 0; void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) @@ -1070,9 +1067,6 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) case INACTIVITY_MODE_SLEEPING_OUTPUT: uapi_get_timestampe_ss(×tamp); - -#ifdef FD230 - if(state_num < 20) { sleep_data.sleep_status[state_num].timestamp = timestamp; @@ -1088,7 +1082,6 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) { sleep_data.wake_up_timestamp = timestamp; } -#endif break; //小睡 @@ -1096,16 +1089,12 @@ void MsgCenterNotifyInactivityProc(const Topic topic, Request *req) if(cywee_Inactivity_Info->status == 6) //0进入睡眠 1潜睡 2深睡 3清醒 4结束睡眠 6入睡 7出睡最后一笔输出 8未出睡最后一笔输出 12快速动眼 13取消入睡 { uapi_get_timestampe_ss(×tamp); -#ifdef FD230 nap_data.fall_asleep_timestamp = timestamp; -#endif } else if(cywee_Inactivity_Info->status == 14) { uapi_get_timestampe_ss(×tamp); -#ifdef FD230 nap_data.wake_up_timestamp = timestamp; -#endif } break; @@ -1136,7 +1125,7 @@ void MsgCenterNotifyInactivityAccumulateTimeProc(const Topic topic, Request* req WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "memcpy_s cywee_Inactivity_Accumulate_Time_Info failed, ret = %d", rets); return; } -#ifdef FD230 + if(nap_data.wake_up_timestamp != 0) { nap_data.total_time = cywee_Inactivity_Accumulate_Time_Info->total_time; @@ -1157,7 +1146,6 @@ void MsgCenterNotifyInactivityAccumulateTimeProc(const Topic topic, Request* req set_sleep_data(&sleep_data); memset(&sleep_data,0,sizeof(SLEEP_T)); state_num = 0; -#endif free(cywee_Inactivity_Accumulate_Time_Info); cywee_Inactivity_Accumulate_Time_Info = NULL; } diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp index 0ccbe24f7..107229844 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/message_notification.cpp @@ -7,9 +7,7 @@ #include "bleEvent.h" #include "components/ui_label_ext.h" #include "uicomponents/UIComponents.h" -#ifdef FD230 #include "message/include/MessageModel.h" -#endif #include "message_notification.h" #include "string" #include "vibrator_service.h" @@ -93,7 +91,6 @@ namespace OHOS return nullptr; } MessageGroupView->SetOnDragListener(dragListener); - #ifdef FD230 /*获取最新message*/ MessageData *data = MessageModel::GetInstance().GetNewestData(); if (data != nullptr) @@ -102,7 +99,6 @@ namespace OHOS timeStr = data->labelTime; messageStr = data->labelDetails; } - #endif /*初始化label*/ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "InitView"); /* -------------------------------------------------------------------------- */ @@ -155,25 +151,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "messageLabel is ok"); /*加载清除按键*/ -#ifdef FD230 InitButtonExt(deleteButton, 0, 366, 466, 100, DELETEBUTTON, STR_CLOSE, 30); -#else - deleteButton = new UILabelButtonExt(); - if (deleteButton == nullptr) - { - return nullptr; // 内存分配失败,返回 - } - deleteButton->SetPosition(0, 366); - deleteButton->Resize(466,100); - deleteButton->SetViewId(DELETEBUTTON); - deleteButton->SetText("Close"); - deleteButton->SetStyle(STYLE_TEXT_FONT, 30); - deleteButton->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 30); - deleteButton->SetStyle(STYLE_BACKGROUND_COLOR, 0xff191919); - deleteButton->SetStyleForState(STYLE_BACKGROUND_COLOR, 0xff191919, UIButton::PRESSED); - deleteButton->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED); - deleteButton->SetVisible(true); -#endif const char *buttonImgSrc = "/user/res/466x100button.bin"; deleteButton->SetImageSrc(buttonImgSrc, buttonImgSrc); UIView::OnTouchListener *TouchListener = static_cast(&MessageViewEventListener::GetInstance()); diff --git a/code/sdk/application/wearable/service/msg_center/src/ota/msg_center_ota.cpp b/code/sdk/application/wearable/service/msg_center/src/ota/msg_center_ota.cpp deleted file mode 100644 index 7ae4e61b3..000000000 --- a/code/sdk/application/wearable/service/msg_center/src/ota/msg_center_ota.cpp +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (c) CompanyNameMagicTag 2023-2023. All rights reserved. - * Description: ota upgrade handle. - * This file should be changed only infrequently and with great care. - */ -#include "build_version.h" -#include "securec.h" -#include "soc_osal.h" -#include "diag_service.h" -#include "upg.h" -#include "upg_common_porting.h" -#include "upg_definitions.h" -#include "diag_common.h" -#include "transmit_st.h" -#include "transmit_item.h" -#include "transmit_write_read.h" -#include "dfx_resource_id.h" -#include "dfx_file_operation.h" -#include "msg_center_protocol.h" -#include "wearable_log.h" -#include "upg_porting.h" -#ifdef SUPPORT_AUTO_OTA -#include "auto_ota_service.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef SUPPORT_AUTO_OTA -extern osSemaphoreId_t g_auto_ota_transmit_done_sem; -extern uint8_t g_auto_ota_mac_tmp[]; -#endif -#ifndef unused -#define unused(var) (void)(var) -#endif - -/* 固定升级包文件长度, "/user/update.fwpkg"*/ -#define UPGRADE_FILE_LEN 19 - -static errcode_t msg_center_ota_upgrade_request_call_back(bool is_finished, uintptr_t usr_data) -{ - unused(usr_data); - errcode_t ret = ERRCODE_SUCC; - /* 目的端升级路径,建议固定 */ - uint32_t package_len = 0; - const char *file_name = "/user/update.fwpkg"; - FILE *fp = fopen(file_name, "rb"); - if (fp == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "open %s fail.\r\n", file_name); - return ERRCODE_FAIL; - } - fseek(fp, 0L, SEEK_END); - package_len = ftell(fp); - fclose(fp); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "send file_len = %d\n", package_len); - - // 文件传输结果判断 - if (is_finished) { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "transmit success\n"); - // 文件传输成功,向Watch发送请求升级指令 - ret = msg_center_send_data(MSGCENTER_CMD_OTA, MSGCENTER_TYPE_ID_OTA_UPG_START, &package_len, sizeof(package_len)); - if (ret != ERRCODE_SUCC) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "send upgrade command fail, ret = %d\r\n", ret); - return ERRCODE_FAIL; - } -#ifdef SUPPORT_AUTO_OTA - auto_ota_dev_add(g_auto_ota_mac_tmp); - (void)osSemaphoreRelease(g_auto_ota_transmit_done_sem); -#endif - return ret; - } else { - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "transmit fail\n"); -#ifdef SUPPORT_AUTO_OTA - (void)osSemaphoreRelease(g_auto_ota_transmit_done_sem); -#endif - return ret; - } -} - -static errcode_t msg_center_src_send_file_start(transmit_type_t transmit_type, diag_addr dst, uint32_t total_size, - const char *file_name, bool re_transmit, transmit_result_hook handler) -{ - diag_option_t option = DIAG_OPTION_INIT_VAL; - option.peer_addr = dst; - - switch (transmit_type) { - case TRANSMIT_TYPE_SAVE_FILE: - case TRANSMIT_TYPE_SAVE_OTA_IMG: - case TRANSMIT_TYPE_WRITE_MEMORY: - case TRANSMIT_TYPE_WRITE_FLASH: - break; - default: - return ERRCODE_INVALID_PARAM; - } - - transmit_item_t *item = transmit_item_init(0); - if (item == NULL) { - return ERRCODE_FAIL; - } - - transmit_item_init_file_name(item, file_name, strlen(file_name)); - transmit_item_init_permanent(item, false); - transmit_item_init_local_start(item, true); - transmit_item_init_local_src(item, true); - transmit_item_init_remote_type(item, transmit_type); - transmit_item_init_local_type(item, TRANSMIT_LOCAL_TYPE_READ_FILE); - transmit_item_init_read_handler(item, file_read_data, (uintptr_t)item); - transmit_item_init_option(item, &option); - transmit_item_init_down_machine(item, false); - transmit_item_init_total_size(item, total_size); - transmit_item_init_result_handler(item, handler, (uintptr_t)item); - transmit_item_init_re_trans(item, re_transmit); - - if (transmit_item_init_is_success(item) == false) { - transmit_item_deinit(item); - return ERRCODE_FAIL; - } - -#if (CONFIG_DFX_SUPPORT_FILE_SYSTEM == DFX_YES) - item->file_fd = dfx_file_open_for_read(item->file_name); - if (item->file_fd < 0) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "[ERR][transmit src]file : %s open failed, fd = %d\r\n", - item->file_name, item->file_fd); - item->file_fd = 0; - transmit_item_deinit(item); - return ERRCODE_FAIL; - } -#endif - - transmit_item_enable(item); - return ERRCODE_SUCC; -} - -void msg_center_ota_upgrade_start(void) -{ - const char *file_name = "/user/update.fwpkg"; - uint32_t total_size; - errcode_t ret; - FILE *fp = fopen(file_name, "rb"); - if (fp == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "open %s fail.\r\n", file_name); - return; - } - fseek(fp, 0L, SEEK_END); - total_size = ftell(fp); - fclose(fp); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "read file size = %d\r\n", total_size); - - ret = msg_center_src_send_file_start(TRANSMIT_TYPE_SAVE_FILE, DIAG_FRAME_FID_PHONE, total_size, file_name, - false, msg_center_ota_upgrade_request_call_back); - if (ret != ERRCODE_SUCC) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "transmit_src_send_file_start fail, ret = %d\r\n", ret); - return; - } - - return; -} - -errcode_t msg_center_ota_rec_upg_start(uint8_t cmd_id, uint8_t type, void *usr_data, uint16_t usr_len) -{ - errcode_t ret = ERRCODE_SUCC; - uint8_t *tlv_payload = (uint8_t *)msg_center_get_tlv_payload(usr_data); - /* 收到升级指令 */ - upg_prepare_info_t info; - info.package_len = *(uint32_t *)tlv_payload; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "upg_prepare running......, rec file_len = %d\r\n", info.package_len); - ret = uapi_upg_prepare(&info); - if (ret != ERRCODE_SUCC) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "upg_prepare err, ret = 0x%x\r\n", ret); - return ret; - } - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "upg_prepare success!!!!\r\n"); - - ret = uapi_upg_request_upgrade(false); - if (ret != ERRCODE_SUCC) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "upg_request err, ret = 0x%x\r\n", ret); - return ret; - } - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "upg request success!!!!\r\n"); - - ret = uapi_upg_start(); - if (ret != ERRCODE_SUCC) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "upg_request start, ret = 0x%x\r\n", ret); - return ret; - } - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "upg start success!!!!\r\n"); - - upg_reboot(); - return ERRCODE_SUCC; -} - -/* 客户逻辑实现 */ -__attribute__((weak)) errcode_t msg_center_ota_upg_version_check(char *dst_ver, char *src_ver) -{ - unused(dst_ver); - unused(src_ver); - /* 客户版本号校验逻辑 */ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "upg version check default pass!\r\n"); - /* 客户检查本地剩余空间是否足够容纳升级包大小 */ - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "upg space check default pass!\r\n"); - return ERRCODE_SUCC; -} - -__attribute__((weak)) char * msg_center_ota_get_src_ver(void) -{ - char *src_ver = "XXX_YYY"; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "get src version : %s\r\n", src_ver); - return src_ver; -} - -errcode_t msg_center_ota_rec_upg_check(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; - errcode_t res = ERRCODE_SUCC; - uint8_t check_succ = 1; - uint8_t check_fail = 0; - - char *dst_ver = (char *)malloc(payload_len + 1); - if (dst_ver == nullptr) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "rec_dst_version: malloc failed.\r\n"); - return ERRCODE_FAIL; - } - - (void)memcpy_s(dst_ver, payload_len, tlv_payload, payload_len); - dst_ver[payload_len] = '\0'; - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "rec_dst_version: %s\r\n", dst_ver); - - ret = msg_center_ota_upg_version_check(dst_ver, msg_center_ota_get_src_ver()); - if (ret != ERRCODE_SUCC) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_MSG_CENTER, "upg version check fail, no need upg!\r\n"); - res = msg_center_send_data(cmd_id, MSGCENTER_TYPE_ID_OTA_UPG_CHECK_RESULT, &check_fail, sizeof(check_fail)); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "send upg check fail, result = %d\r\n", res); - free(dst_ver); - dst_ver = NULL; - return ret; - } - - free(dst_ver); - dst_ver = NULL; - res = msg_center_send_data(cmd_id, MSGCENTER_TYPE_ID_OTA_UPG_CHECK_RESULT, &check_succ, sizeof(check_succ)); - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "send upg check succ, result = %d\r\n", res); - - return ERRCODE_SUCC; -} - -errcode_t msg_center_ota_rec_upg_check_result(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 upg_check_result = *tlv_payload; - - WEARABLE_LOGI(WEARABLE_LOG_MODULE_MSG_CENTER, "upg_check_result = %d\r\n", upg_check_result); - if (upg_check_result) { - msg_center_ota_upgrade_start(); - } else { -#ifdef SUPPORT_AUTO_OTA - (void)osSemaphoreRelease(g_auto_ota_transmit_done_sem); -#endif - } - - return ERRCODE_SUCC; -} - -#ifdef __cplusplus -} -#endif \ No newline at end of file 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 8d42d975a..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 @@ -20,7 +20,6 @@ #include "baidumap_msg_center.h" #include "baidumap.h" #include "soc_osal.h" -#include "watchdog.h" #ifdef __cplusplus extern "C" { @@ -461,8 +460,6 @@ static void msg_center_transfer_longbuf(char *data, uint8_t type) 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); - free(file_content); - file_content = nullptr; return; } fclose(fp); @@ -801,7 +798,6 @@ static errcode_t msg_center_vector_navi_rec_common_proc(uint8_t cmd_id, uint8_t } display_api->set_screen_set_keepon_timeout(600000); // 600000ms #endif - uapi_watchdog_kick(); char *data = (char *)malloc(payload_len + 1); if (data == nullptr) { 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 252652459..3ba87d6bc 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 @@ -175,16 +175,6 @@ uint32_t g_app_emmc_clk = SDIOM_SRC_CLK_FREQ_LVL_98M_VAL; #define COMBINE_FILE_PATH "/user/test/ssb_c.bin" #endif -#ifdef SUPPORT_AUTO_OTA -extern uint8_t g_auto_ota_upload_mode; -#ifndef ONE_ADDR_LEN -#define ONE_ADDR_LEN 2 -#endif -#ifndef ADDR_MAC_LEN -#define ADDR_MAC_LEN 6 -#endif -#endif - const uint8_t g_decrypt_aes_salt[AES_SALT_LENGTH] = { 0x0 }; const uint8_t g_decrypt_aes_iv[AES_IV_LENGTH] = { 0x0 }; // The length of the GID must be 32 bytes and cannot be changed. @@ -2662,104 +2652,6 @@ static uint32_t mcu_file_combine_test(uint8_t *para, uint32_t para_len) } #endif -#ifdef JS_ENABLE -static uint32_t mcu_get_trans_channel_test(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(para_len); - unused(para); - msg_center_get_trans_channel(); - - return ERRCODE_SUCC; -} - -static uint32_t mcu_set_trans_channel_test(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(para_len); - char *ptr = (char *)para; - uint32_t select = strtoul(ptr, NULL, 10); /* 10进制 */ - msg_center_set_trans_channel(select); - - return ERRCODE_SUCC; -} -#endif - -#ifdef SUPPORT_AUTO_OTA -static uint32_t mcu_auto_ota_block(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(para_len); - unused(para); - g_auto_ota_upload_mode = 1;// 阻塞等待升级包上传 - wstp_print("auto_ota block!\r\n"); - return ERRCODE_SUCC; -} - -static uint32_t mcu_auto_ota_run(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(para_len); - unused(para); - g_auto_ota_upload_mode = 0; // 升级包上传完成后auto_ota继续执行 - wstp_print("auto_ota run!\r\n"); - return ERRCODE_SUCC; -} - -static uint32_t mcu_auto_ota_del_mac(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(para_len); - wstp_print("para = %s\r\n", para); - uint8_t addr[ADDR_MAC_LEN] = {0}; - char tmp[ONE_ADDR_LEN + 1] = {0}; - char *p = (char *)para; - - for (uint8_t i = 0; i < ADDR_MAC_LEN; i++) { - memcpy_s(tmp, ONE_ADDR_LEN + 1, p, ONE_ADDR_LEN); - tmp[ONE_ADDR_LEN] = '\0'; - addr[i] = strtol(tmp, NULL, 16); // 16进制 - p = p + ONE_ADDR_LEN; - } - - wstp_print("mcu_auto_ota_del_mac, mac = %02x%02x%02x%02x%02x%02x\r\n", addr[5], addr[4], addr[3], addr[2], addr[1], - addr[0]); - bool res = auto_ota_dev_del(addr); - wstp_print("auto_ota_dev_del, res = %d\r\n", res); - - return ERRCODE_SUCC; -} - -static uint32_t mcu_auto_ota_add_mac(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(para_len); - wstp_print("enter mcu_auto_ota_add_mac\r\n"); - wstp_print("para = %s\r\n", para); - uint8_t addr[ADDR_MAC_LEN] = {0}; - char tmp[ONE_ADDR_LEN + 1] = {0}; - char *p = (char *)para; - - for (uint8_t i = 0; i < ADDR_MAC_LEN; i++) { - memcpy_s(tmp, ONE_ADDR_LEN + 1, p, ONE_ADDR_LEN); - tmp[ONE_ADDR_LEN] = '\0'; - addr[i] = strtol(tmp, NULL, 16); // 16进制 - p = p + ONE_ADDR_LEN; - } - - wstp_print("mcu_auto_ota_add_mac, mac = %02x%02x%02x%02x%02x%02x\r\n", addr[5], addr[4], addr[3], addr[2], addr[1], - addr[0]); - auto_ota_dev_add(addr); - - return ERRCODE_SUCC; -} - -static uint32_t mcu_auto_ota_show_mac(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(para_len); - unused(para); - wstp_print("enter mcu_auto_ota_show_mac\r\n"); - - auto_ota_dev_show(); - - return ERRCODE_SUCC; -} -#endif - static const app_process_table g_app_funcs[] = { { RESET, mcu_os_sys_reset }, { FSTEST, mcu_fs_test }, @@ -2847,17 +2739,6 @@ static const app_process_table g_app_funcs[] = { #ifdef SUPPORT_FILE_SPLIT_COMBINE { FILESPLIT, mcu_file_spilt_test }, { FILECOMBINE, mcu_file_combine_test }, -#endif -#ifdef JS_ENABLE - { GETTRANSCHAN, mcu_get_trans_channel_test }, - { SETTRANSCHAN, mcu_set_trans_channel_test }, -#endif -#ifdef SUPPORT_AUTO_OTA - { AUTOOTABLOCK, mcu_auto_ota_block }, - { AUTOOTARUN, mcu_auto_ota_run }, - { AUTOOTADELMAC, mcu_auto_ota_del_mac }, - { AUTOOTAADDMAC, mcu_auto_ota_add_mac }, - { AUTOOTASHOWMAC, mcu_auto_ota_show_mac }, #endif { CAT1PWRON, cat1_power_on}, { CAT1RESET, cat1_reset}, diff --git a/code/sdk/application/wstp/at_service/app/app_cmd_manager.c b/code/sdk/application/wstp/at_service/app/app_cmd_manager.c index cba41cc45..7106e096a 100755 --- a/code/sdk/application/wstp/at_service/app/app_cmd_manager.c +++ b/code/sdk/application/wstp/at_service/app/app_cmd_manager.c @@ -932,80 +932,6 @@ static uint32_t app_file_combine_test(uint8_t *para, uint32_t para_len, char *st } #endif -#ifdef JS_ENABLE -static uint32_t app_get_trans_channel_test(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(str_cmd); - if (para == NULL) { - return ERRCODE_FAIL; - } - app_pkg_msg_send(GETTRANSCHAN, DIAG_CONTROL_FALSE, para, para_len); - return ERRCODE_SUCC; -} - -static uint32_t app_set_trans_channel_test(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(str_cmd); - if (para == NULL) { - return ERRCODE_FAIL; - } - app_pkg_msg_send(SETTRANSCHAN, DIAG_CONTROL_FALSE, para, para_len); - return ERRCODE_SUCC; -} -#endif - -#ifdef SUPPORT_AUTO_OTA -static uint32_t app_auto_ota_block(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(str_cmd); - if (para == NULL) { - return ERRCODE_FAIL; - } - app_pkg_msg_send(AUTOOTABLOCK, DIAG_CONTROL_FALSE, para, para_len); - return ERRCODE_SUCC; -} - -static uint32_t app_auto_ota_run(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(str_cmd); - if (para == NULL) { - return ERRCODE_FAIL; - } - app_pkg_msg_send(AUTOOTARUN, DIAG_CONTROL_FALSE, para, para_len); - return ERRCODE_SUCC; -} - -static uint32_t app_auto_ota_del_mac(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(str_cmd); - if (para == NULL) { - return ERRCODE_FAIL; - } - app_pkg_msg_send(AUTOOTADELMAC, DIAG_CONTROL_FALSE, para, para_len); - return ERRCODE_SUCC; -} - -static uint32_t app_auto_ota_add_mac(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(str_cmd); - if (para == NULL) { - return ERRCODE_FAIL; - } - app_pkg_msg_send(AUTOOTAADDMAC, DIAG_CONTROL_FALSE, para, para_len); - return ERRCODE_SUCC; -} - -static uint32_t app_auto_ota_show_mac(uint8_t *para, uint32_t para_len, char *str_cmd) -{ - unused(str_cmd); - if (para == NULL) { - return ERRCODE_FAIL; - } - app_pkg_msg_send(AUTOOTASHOWMAC, DIAG_CONTROL_FALSE, para, para_len); - return ERRCODE_SUCC; -} -#endif - static const at_cmd_table_t g_app_cmd[] = { /* 无参数无特殊处理AT命令 */ { "AT^HEAPINFO", parse_heap_info_handle, "" }, @@ -1118,17 +1044,6 @@ static const at_cmd_table_t g_app_cmd[] = { #ifdef SUPPORT_FILE_SPLIT_COMBINE { "AT^FILESPLIT", app_file_split_test, "" }, /* 注意,执行此操作前提是传入待分隔文件 */ { "AT^FILECOMBINE", app_file_combine_test, "" }, -#endif -#ifdef JS_ENABLE - { "AT^GETTRANSCHAN", app_get_trans_channel_test, "" }, - { "AT^SETTRANSCHAN", app_set_trans_channel_test, "" }, -#endif -#ifdef SUPPORT_AUTO_OTA - { "AT^AUTOOTABLOCK", app_auto_ota_block, "" }, - { "AT^AUTOOTARUN", app_auto_ota_run, "" }, - { "AT^AUTOOTADELMAC", app_auto_ota_del_mac, "" }, - { "AT^AUTOOTAADDMAC", app_auto_ota_add_mac, "" }, - { "AT^AUTOOTASHOWMAC", app_auto_ota_show_mac, "" }, #endif { "AT^CAT1PWRON", app_cat1pwron, "" }, { "AT^CAT1RESET", app_cat1reset, ""}, diff --git a/code/sdk/application/wstp/at_service/app/app_msg_manager.h b/code/sdk/application/wstp/at_service/app/app_msg_manager.h index f66a02228..187c4a7e6 100755 --- a/code/sdk/application/wstp/at_service/app/app_msg_manager.h +++ b/code/sdk/application/wstp/at_service/app/app_msg_manager.h @@ -105,16 +105,9 @@ typedef enum { ALIPAYVERIFY = 0x4A, ALIPAYRESET = 0x4B, FORCEDEEPSLEEP = 0x4C, - GETTRANSCHAN = 0x4D, - SETTRANSCHAN = 0x4E, - AUTOOTABLOCK = 0x4F, - AUTOOTARUN = 0x50, - AUTOOTADELMAC = 0x51, - AUTOOTAADDMAC = 0x52, - AUTOOTASHOWMAC = 0x53, - ADCMANUDATA = 0x54, - CAT1PWRON = 0x55, - CAT1RESET = 0x56, + ADCMANUDATA = 0x4D, + CAT1PWRON = 0x4E, + CAT1RESET = 0x4F, MSG_ID_MAX_BUTT, } app_msg_id; diff --git a/code/sdk/bootloader/flashboot/brandy/main.c b/code/sdk/bootloader/flashboot/brandy/main.c index ff509faac..66513382f 100755 --- a/code/sdk/bootloader/flashboot/brandy/main.c +++ b/code/sdk/bootloader/flashboot/brandy/main.c @@ -56,14 +56,11 @@ #include "clocks_switch_priv.h" #include "main.h" #include "hal_uart_v120_regs_op.h" -#include "hal_pmu_vdd.h" #ifdef CFG_DRIVERS_NANDFLASH #include "nandflash_config.h" #endif -#define CFG_PMU_PROTECT_WDT_RESET 1 - #define FLASH_INIT_DATA 0xff #define FLASH_CHECK_LEN 16 #define FLASH_FIRST_PAGE 0 @@ -619,105 +616,6 @@ extern uint32_t __rtt_bss_end; extern uint32_t __rtt_bss_start; #endif -#if CFG_PMU_PROTECT_WDT_RESET == 1 -void software_delay_us(uint32_t delay) -{ -#define SOFT_DELAY_COUNT 40 - volatile uint32_t val = delay; - volatile uint32_t count; - - while (--val > 0) { - count = SOFT_DELAY_COUNT; - while (count-- > 0) { - ; - } - } -} - -static void clear_wdt_reset_cause(void) -{ - for (uint16_t i = 0; i < UINT16_MAX; i++) { - writew(0x57004304, 0x1); - if (reg16_getbit(0x57004300, 0) == 0) { - break; - } - } -} - -static void pmu_protect_config_and_reset(bool rom_codeloadered) -{ - // codeloader - if (rom_codeloadered == true) { - writew(0x5702c010, 0x0); - return; - } - - // wdt reset - if (reg16_getbit(0x57004300, 0) == 1) { - if (readw(0x5702c010) == 0x5a00) { - clear_wdt_reset_cause(); - writew(0x5702c010, 0x0); - } - return; - } - - if (readw(0x5702c010) == 0x5a00) { - writew(0x5702c010, 0x0); - return; - } - - PRINT("first reset, 0x%x \r\n", readw(0x5702c010)); - - writew(0x5702c010, 0x5a00); - uapi_tcxo_delay_ms(10ULL); - - writew(0x52000700, 0x0); // disable nmi int - watchdog_turnon_clk(); - uapi_watchdog_init(CHIP_WDT_TIMEOUT_2S); - uapi_watchdog_enable(WDT_MODE_RESET); - - pmu_vdd0p8_power_vset(HAL_PMU_VDD0P8_1P0_1P100V); - writew(0x57028104, 0xF); - writew(0x57028184, 0x1); - - hal_pmu_intldo1_set_voltage(HAL_PMU_INTLDO1_LEVEL_1P92V); - - writew(0x5700412c, 0x1e); // set short_pd and softtime_adj - writew(0x57004138, 0x1e); - - // DBB CCRG 16M - writew(0x5500060c, 0x103); // cpu 8 div - writew(0x5500060c, 0x113); - writew(0x55000614, 0x13); // perp ls 16M - writew(0x55000618, 0x13); // perp uart 16M - writew(0x5500061c, 0x13); // perp spi 16M - writew(0x55000620, 0x13); // combus ch0 16M - writew(0x55000624, 0x13); // combus ch0 16M - writew(0x5500062c, 0x13); // membus 16M - writew(0x55000630, 0x13); // xip opi 16M - writew(0x55000634, 0x13); // xip qspi 16M - hal_clocks_set_aon_bus_div(4); // aon bus 8M - - writew(0x57004130, 0x1822); // 1.9->2.0v - reg16_setbit(0x57004124, POS_14); // vo_det 0->1 - writew(0x57004108, 0x14C0); // detect threshodd 1.85->1.7v - uapi_tcxo_delay_ms(100UL); - - // 32k -> 1M 2s -> 64ms - writew(0x57000060, 0x1820); - writew(0x57000064, 0x601); - writew(0x57000068, 0x1601); - - writew(0x57004110, 0x3); - software_delay_us(5UL); - writew(0x57004110, 0x7); - - // wait wdt reset - while (1) { - } -} -#endif - void main(void) { errno_t ret = 0; @@ -737,16 +635,11 @@ void main(void) uapi_systick_init(); watchdog_init(); hal_xip_init(); - + hw_init(); #ifdef SW_UART_DEBUG sw_debug_uart_init(UART_L_BAUDRATE); PRINT("SSb Debug uart init succ\r\n"); #endif - -#if CFG_PMU_PROTECT_WDT_RESET == 1 - pmu_protect_config_and_reset(rom_codeloadered); -#endif - hw_init(); uapi_ulp_systick_self_verification(); show_reboot_info(); diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index 6e729b28c..57cd7f380 100755 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -25,7 +25,7 @@ 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', 'audio_at_service', 'media_at_service', 'bt_manager_at_service', - "audio_proc", "audio_dump", "audio_probe", "gpu_proc", 'bts_header'], + "audio_proc", "audio_dump", "audio_probe", "gpu_proc"], 'ram_component_set': ['bgh', 'media_mini', 'gpu', 'graphic_lvgl_mini', 'dfx_set'], 'image_analysis': True, 'dsp_version': 'mini', @@ -148,7 +148,7 @@ target = { 'ram_component': ["algorithm", "dfx_port_brandy", "dfx_update", 'dfx_nv', "osal", "arch_port", "-:testsuite", "liteos_port", 'lcd', 'qspi_display', 'dfx_file_operation', 'psram', 'hal_mipi', 'mipi_tx', 'non_os', 'touch', - 'ulp_aon', 'hal_l2ram', 'bt_manager_at_service', + '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', "audio_proc", "audio_dump", "audio_probe", "power_manager", "gpu_proc", 'bts_header', diff --git a/code/sdk/build/config/target_config/brandy/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml b/code/sdk/build/config/target_config/brandy/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml index efe9232a9..c649dba9e 100755 --- a/code/sdk/build/config/target_config/brandy/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml +++ b/code/sdk/build/config/target_config/brandy/hdb_config/database_template/acore/system/hdbcfg/mss_cmd_db.xml @@ -240,10 +240,6 @@ - - - - diff --git a/code/sdk/build/config/target_config/common_config.py b/code/sdk/build/config/target_config/common_config.py index 09b1d90a3..5a65f6ad0 100755 --- a/code/sdk/build/config/target_config/common_config.py +++ b/code/sdk/build/config/target_config/common_config.py @@ -116,7 +116,7 @@ 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', 'bms_sign_mode', 'ace', 'ace_adapt', 'permission', 'appverify', 'jerryscript','js_player', 'js_audio_capturer', 'i18n', + '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'], diff --git a/code/sdk/drivers/boards/brandy_evb/linker/recovery/acore.prelds b/code/sdk/drivers/boards/brandy_evb/linker/recovery/acore.prelds index 8e716a5cb..96586a06d 100755 --- a/code/sdk/drivers/boards/brandy_evb/linker/recovery/acore.prelds +++ b/code/sdk/drivers/boards/brandy_evb/linker/recovery/acore.prelds @@ -23,9 +23,8 @@ MEMORY PSRAM_HEAP : ORIGIN = PSRAM_HEAP_ADDR, LENGTH = PSRAM_HEAP_LENGTH L2M_GPU_PROGRAM : ORIGIN = L2M_GPU_RAM_SHARE_MCU_ORIGIN, LENGTH = L2M_GPU_RAM_MCU_SHARE_LENGTH -#ifndef CONFIG_PSRAM_SUPPORT L2M_DSP_PROGRAM : ORIGIN = L2M_DSP_RAM_RESERVED_ORIGIN, LENGTH = L2M_DSP_RAM_RESERVED_LENGTH + L2M_DSP_RAM_MCU_SHARE_LENGTH + L2M_DSP_RAM_DSP_SHARE_LENGTH -#endif + ITCM : ORIGIN = APP_ITCM_ORIGIN + APP_VECTORS_LENGTH, LENGTH = APP_ITCM_LENGTH - APP_VECTORS_LENGTH DTCM : ORIGIN = APP_RAM_ORIGIN, LENGTH = APP_RAM_LENGTH @@ -116,7 +115,6 @@ SECTIONS __l2m_gpu_data_end = .; } > L2M_GPU_PROGRAM AT > FLASH_PROGRAM __l2m_gpu_data_size = __l2m_gpu_data_end - __l2m_gpu_data_start; -#ifndef CONFIG_PSRAM_SUPPORT #if DSP_L2RAM_AREA_SIZE > 0 .l2m_dsp_text : { @@ -150,7 +148,37 @@ SECTIONS } > L2M_DSP_PROGRAM AT > FLASH_PROGRAM __l2m_dsp_data_size = __l2m_dsp_data_end - __l2m_dsp_data_start; #endif -#endif +} + +SECTIONS +{ + .flash_text : + { + . = ALIGN(8); + /* open_source */ + *open_source/sdio*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + + *utils/sec_boot*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *utils/dfx/dfx_reboot/cpu_utils/libcpu_utils*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *utils/dfx/libdfx_panic*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *utils/dfx/libdfx_log*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *utils/dfx/libdfx*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *common/testsuite*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *utils/algorithm*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *utils/partition/libpartition*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *open_source/lzma/liblzma*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *libhal_uart*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *driver/uart/uart_cmsis/libuart_cmsis*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *drivers/chips/brandy/libbrandy_pmu*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + . = ALIGN(8); + } > FLASH_PROGRAM + + .flash_data : + { + . = ALIGN(8); + KEEP(*( SORT (.liteos.table.*))) + . = ALIGN(8); + } > FLASH_PROGRAM } SECTIONS @@ -163,6 +191,9 @@ SECTIONS __ramtext_begin__ = .; KEEP (*(.flash_version)) + + /* Drivers */ + /* middleware/utils */ *utils/connectivity*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *utils/lib_utils*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) @@ -170,21 +201,10 @@ SECTIONS *utils/cpu_utils*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *utils/cpu_load*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *utils/preserve*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - *utils/sec_boot*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - *utils/dfx*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - *utils/algorithm*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - *utils/partition/libpartition*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - *utils/update*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - - /* middleware/chips */ - *middleware/chips/brandy*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) /* Kernel */ *kernel/osal*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - *kernel/dpal*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - *kernel/non_os*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - /* Drivers */ *libhal*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *driver/uart*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *driver/eflash*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) @@ -192,7 +212,7 @@ SECTIONS *driver*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *drivers/boards*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) *drivers/chips*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - + *kernel/non_os*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) /* platfrom */ *application/brandy*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) @@ -206,25 +226,12 @@ SECTIONS SORT(*libriscv.a:*.o*) (*.text *.text* .rodata .rodata* .srodata .srodata*) #endif - /* open_source */ - *open_source/sdio*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - *liblzma*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - - SORT(*libc.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libcmsis.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libcsysdeps.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libdriverbase.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libinit.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libinterrupt.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*liblinux.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libm.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libposix.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libsec.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libtargets.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + *libsec.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *libposix.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *libcsysdeps.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libsegger*.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libgfx_rm.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) - SORT(*libclang_rt.builtins-riscv32.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + *utils/update*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) + *middleware/chips/brandy/update*.a:*.o* (.text .text* .rodata .rodata* .srodata .srodata*) KEEP (*(.gdb_debug)) @@ -332,6 +339,21 @@ SECTIONS . = ALIGN(8); /* TODO: add close component code here begin */ /* new liteos libs config */ + SORT(*libc.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libcmsis.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libcsysdeps.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libdriverbase.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libinit.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libinterrupt.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*liblinux.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libm.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libposix.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libsec:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libtargets.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + + SORT(*libsegger*.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libgfx_rm.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) + SORT(*libclang_rt.builtins-riscv32.a:*.o*) (.text .text* .rodata .rodata* .srodata .srodata*) *(.ramtext) *(.text) *(.text*) diff --git a/code/sdk/drivers/chips/brandy/porting/dma/dma_porting.c b/code/sdk/drivers/chips/brandy/porting/dma/dma_porting.c index fce484bab..b4440fad9 100755 --- a/code/sdk/drivers/chips/brandy/porting/dma/dma_porting.c +++ b/code/sdk/drivers/chips/brandy/porting/dma/dma_porting.c @@ -337,10 +337,12 @@ errcode_t dmac_port_config_periph(dma_channel_t ch, void dma_port_add_sleep_veto(void) { + uapi_pm_add_sleep_veto(PM_ID_DMA); return; } void dma_port_remove_sleep_veto(void) { + uapi_pm_remove_sleep_veto(PM_ID_DMA); return; } diff --git a/code/sdk/drivers/chips/brandy/porting/include/i2c_porting.h b/code/sdk/drivers/chips/brandy/porting/include/i2c_porting.h index b13c12fab..2d2a9c259 100755 --- a/code/sdk/drivers/chips/brandy/porting/include/i2c_porting.h +++ b/code/sdk/drivers/chips/brandy/porting/include/i2c_porting.h @@ -35,8 +35,6 @@ extern "C" { #define I2C_3_SCL_PIN S_MGPIO17 #define I2C_3_SDA_PIN S_MGPIO18 -#define I2C_DMA_TIMEOUT_MS 100 - typedef struct { volatile uint32_t con; /*!< I2c control register. Offset: 00h. */ volatile uint32_t tar; /*!< I2c target address register. Offset: 04h. */ diff --git a/code/sdk/drivers/drivers/driver/audio/source/core/common/probe/probe.c b/code/sdk/drivers/drivers/driver/audio/source/core/common/probe/probe.c index efa10f86d..8a89e71fd 100755 --- a/code/sdk/drivers/drivers/driver/audio/source/core/common/probe/probe.c +++ b/code/sdk/drivers/drivers/driver/audio/source/core/common/probe/probe.c @@ -255,35 +255,3 @@ td_void probe_add_msg_crc_fail(audio_core_id core_id) } *crc_fail += 1; } - -td_void probe_add_msg_int_fail(audio_core_id core_id) -{ - volatile td_u32 *msg_int_fail = TD_NULL; - - if (g_probe_ctx == TD_NULL) { - return; - } - - if (core_id == AUDIO_CORE_DSP0) { - msg_int_fail = &(g_probe_ctx->core_status[DSP_CORE0].msg_int_fail); - } else { - msg_int_fail = &(g_probe_ctx->core_status[DSP_CORE1].msg_int_fail); - } - *msg_int_fail += 1; -} - -td_void probe_add_msg_int_retrigger(audio_core_id core_id) -{ - volatile td_u32 *msg_int_retrigger = TD_NULL; - - if (g_probe_ctx == TD_NULL) { - return; - } - - if (core_id == AUDIO_CORE_DSP0) { - msg_int_retrigger = &(g_probe_ctx->core_status[DSP_CORE0].msg_int_retrigger); - } else { - msg_int_retrigger = &(g_probe_ctx->core_status[DSP_CORE1].msg_int_retrigger); - } - *msg_int_retrigger += 1; -} diff --git a/code/sdk/drivers/drivers/driver/audio/source/core/common/probe/probe.h b/code/sdk/drivers/drivers/driver/audio/source/core/common/probe/probe.h index a0c5900aa..6d299485b 100755 --- a/code/sdk/drivers/drivers/driver/audio/source/core/common/probe/probe.h +++ b/code/sdk/drivers/drivers/driver/audio/source/core/common/probe/probe.h @@ -30,7 +30,4 @@ td_void probe_add_msg_ack_timeout(audio_core_id core_id); td_void probe_add_msg_underflow(audio_core_id core_id); td_void probe_add_msg_crc_fail(audio_core_id core_id); -td_void probe_add_msg_int_fail(audio_core_id core_id); -td_void probe_add_msg_int_retrigger(audio_core_id core_id); - #endif diff --git a/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c b/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c index 3b8757c26..a86cdd32b 100755 --- a/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c +++ b/code/sdk/drivers/drivers/driver/audio/source/drv/aoe/drv_ao.c @@ -190,6 +190,12 @@ td_s32 sap_ioctl_ao_open(td_u32 cmd, td_void *arg, td_void *file) param = (sap_ao_open *)arg; attr = ¶m->attr; + ret = drv_ao_load_aef(); + if (ret != AUDIO_SUCCESS) { + sap_err_log_fun(drv_ao_load_aef, ret); + return ret; + } + ret = drv_msg_ao_open(&ao_handle, param->snd_id, attr); if (ret != AUDIO_SUCCESS) { sap_err_log_fun(drv_msg_ao_open, ret); @@ -216,12 +222,6 @@ td_s32 sap_ioctl_ao_open(td_u32 cmd, td_void *arg, td_void *file) } #endif - ret = drv_ao_load_aef(); - if (ret != AUDIO_SUCCESS) { - sap_err_log_fun(drv_ao_load_aef, ret); - return ret; - } - audio_unused(cmd); audio_unused(file); return AUDIO_SUCCESS; diff --git a/code/sdk/drivers/drivers/driver/audio/source/include/audio_struct.h b/code/sdk/drivers/drivers/driver/audio/source/include/audio_struct.h index f1087c252..168e3fc2f 100755 --- a/code/sdk/drivers/drivers/driver/audio/source/include/audio_struct.h +++ b/code/sdk/drivers/drivers/driver/audio/source/include/audio_struct.h @@ -527,10 +527,6 @@ typedef struct { td_u32 msg_ack_timeout; td_u32 msg_underflow; td_u32 msg_crc_fail; - - /* msg int status */ - td_u32 msg_int_fail; - td_u32 msg_int_retrigger; } probe_status_info; typedef struct { diff --git a/code/sdk/drivers/drivers/driver/i2c/i2c.c b/code/sdk/drivers/drivers/driver/i2c/i2c.c index f0a86ca56..0addfefff 100755 --- a/code/sdk/drivers/drivers/driver/i2c/i2c.c +++ b/code/sdk/drivers/drivers/driver/i2c/i2c.c @@ -16,8 +16,6 @@ #if defined(CONFIG_I2C_SUPPORT_DMA) && (CONFIG_I2C_SUPPORT_DMA == 1) #include "dma.h" #include "hal_dma.h" -#include "pm_definition.h" -#include "pm_veto.h" #endif /* CONFIG_I2C_SUPPORT_DMA */ #include "i2c_porting.h" @@ -474,21 +472,16 @@ static errcode_t i2c_write_by_dma(i2c_bus_t bus, uint16_t dev_addr, hal_i2c_buff /* if the lenth is 0 here, send stop byte straightforward */ if (buffer_wrap.len != 0) { - uapi_pm_add_sleep_veto(PM_ID_I2C_DMA); ret = i2c_transmit_dma(bus, &buffer_wrap); if (ret != ERRCODE_SUCC) { - uapi_pm_remove_sleep_veto(PM_ID_I2C_DMA); return ret; } /* wait for trans */ - if (osal_sem_down_timeout(&(g_dma_trans[bus].dma_sem), I2C_DMA_TIMEOUT_MS) != OSAL_SUCCESS) { - uapi_dma_end_transfer(g_dma_trans[bus].write_channel - 1); - uapi_pm_remove_sleep_veto(PM_ID_I2C_DMA); + if (osal_sem_down(&(g_dma_trans[bus].dma_sem)) != OSAL_SUCCESS) { g_dma_trans[bus].write_channel = 0; return ERRCODE_I2C_DMA_TRANSFER_ERROR; } - uapi_pm_remove_sleep_veto(PM_ID_I2C_DMA); g_dma_trans[bus].write_channel = 0; if (!g_dma_trans[bus].trans_succ) { return ERRCODE_I2C_DMA_TRANSFER_ERROR; @@ -544,8 +537,7 @@ static errcode_t i2c_read_by_dma(i2c_bus_t bus, uint16_t dev_addr, hal_i2c_buffe /* 从模式在这里接收信号量,主模式在发送读命令之后接收信号量 */ if (!i2c_ctrl->master_flag) { - if (osal_sem_down_timeout(&(g_dma_trans[bus].dma_sem), I2C_DMA_TIMEOUT_MS) != OSAL_SUCCESS) { - uapi_dma_end_transfer(g_dma_trans[bus].write_channel - 1); + if (osal_sem_down(&(g_dma_trans[bus].dma_sem)) != OSAL_SUCCESS) { g_dma_trans[bus].write_channel = 0; return ERRCODE_I2C_DMA_TRANSFER_ERROR; } @@ -579,9 +571,7 @@ static errcode_t i2c_read_do_send_cmd(i2c_bus_t bus, hal_i2c_buffer_wrap_t *data } /* 发送len - 1个命令的dma中断 */ - if (osal_sem_down_timeout(&(g_dma_trans[bus].dma_sem), I2C_DMA_TIMEOUT_MS) != OSAL_SUCCESS) { - uapi_dma_end_transfer(g_dma_trans[bus].write_channel - 1); - uapi_dma_end_transfer(g_dma_trans[bus].read_channel - 1); + if (osal_sem_down(&(g_dma_trans[bus].dma_sem)) != OSAL_SUCCESS) { g_dma_trans[bus].write_channel = 0; g_dma_trans[bus].read_channel = 0; return ERRCODE_I2C_DMA_TRANSFER_ERROR; @@ -592,8 +582,7 @@ static errcode_t i2c_read_do_send_cmd(i2c_bus_t bus, hal_i2c_buffer_wrap_t *data buffer_wrap.len = 1; hal_funcs->ctrl(bus, I2C_CTRL_FLUSH_RX_FIFO, (uintptr_t)&buffer_wrap); /* 等待接收数据的dma中断释放信号量 */ - if (osal_sem_down_timeout(&(g_dma_trans[bus].dma_sem), I2C_DMA_TIMEOUT_MS) != OSAL_SUCCESS) { - uapi_dma_end_transfer(g_dma_trans[bus].read_channel - 1); + if (osal_sem_down(&(g_dma_trans[bus].dma_sem)) != OSAL_SUCCESS) { g_dma_trans[bus].read_channel = 0; (void)hal_funcs->ctrl(bus, I2C_CTRL_READ_RESTORE, (uintptr_t)NULL); return ERRCODE_I2C_DMA_TRANSFER_ERROR; @@ -1038,30 +1027,24 @@ errcode_t uapi_i2c_master_read(i2c_bus_t bus, uint16_t dev_addr, i2c_data_t *dat #if defined(CONFIG_I2C_SUPPORT_POLL_AND_DMA_AUTO_SWITCH) && (CONFIG_I2C_SUPPORT_POLL_AND_DMA_AUTO_SWITCH == 1) if (buffer_wrap.len > CONFIG_I2C_POLL_AND_DMA_AUTO_SWITCH_THRESHOLD) { uapi_i2c_set_dma_mode(bus, true); - uapi_pm_add_sleep_veto(PM_ID_I2C_DMA); errcode_t ret = i2c_read_by_dma(bus, dev_addr, &buffer_wrap); if (ret != ERRCODE_SUCC) { - uapi_pm_remove_sleep_veto(PM_ID_I2C_DMA); i2c_mutex_unlock(bus); return ret; } ret = i2c_read_do_send_cmd(bus, &buffer_wrap); - uapi_pm_remove_sleep_veto(PM_ID_I2C_DMA); i2c_mutex_unlock(bus); return ret; } uapi_i2c_set_dma_mode(bus, false); #else if (g_i2c_ctrl[bus].operate_type == I2C_DATA_OPERATION_TYPE_DMA) { - uapi_pm_add_sleep_veto(PM_ID_I2C_DMA); errcode_t ret = i2c_read_by_dma(bus, dev_addr, &buffer_wrap); if (ret != ERRCODE_SUCC) { - uapi_pm_remove_sleep_veto(PM_ID_I2C_DMA); i2c_mutex_unlock(bus); return ret; } ret = i2c_read_do_send_cmd(bus, &buffer_wrap); - uapi_pm_remove_sleep_veto(PM_ID_I2C_DMA); i2c_mutex_unlock(bus); return ret; } @@ -1226,18 +1209,14 @@ errcode_t uapi_i2c_slave_read(i2c_bus_t bus, i2c_data_t *data) #if defined(CONFIG_I2C_SUPPORT_POLL_AND_DMA_AUTO_SWITCH) && (CONFIG_I2C_SUPPORT_POLL_AND_DMA_AUTO_SWITCH == 1) if (buffer_wrap.len > CONFIG_I2C_POLL_AND_DMA_AUTO_SWITCH_THRESHOLD) { uapi_i2c_set_dma_mode(bus, true); - uapi_pm_add_sleep_veto(PM_ID_I2C_DMA); ret = i2c_read_by_dma(bus, I2C_DEFAULT_DEV_ADDRESS, &buffer_wrap); - uapi_pm_remove_sleep_veto(PM_ID_I2C_DMA); i2c_mutex_unlock(bus); return ret; } uapi_i2c_set_dma_mode(bus, false); #else if (g_i2c_ctrl[bus].operate_type == I2C_DATA_OPERATION_TYPE_DMA) { - uapi_pm_add_sleep_veto(PM_ID_I2C_DMA); ret = i2c_read_by_dma(bus, I2C_DEFAULT_DEV_ADDRESS, &buffer_wrap); - uapi_pm_remove_sleep_veto(PM_ID_I2C_DMA); i2c_mutex_unlock(bus); return ret; } diff --git a/code/sdk/drivers/drivers/driver/spi/spi.c b/code/sdk/drivers/drivers/driver/spi/spi.c index f5e16379b..298aeddb4 100755 --- a/code/sdk/drivers/drivers/driver/spi/spi.c +++ b/code/sdk/drivers/drivers/driver/spi/spi.c @@ -16,8 +16,6 @@ #include "dma.h" #include "hal_dma.h" #include "securec.h" -#include "pm_definition.h" -#include "pm_veto.h" #define DMA_SPI_TRANSFER_WIDTH_WORD 4 #define DMA_SPI_TRANSFER_WIDTH_HALF_WORD 2 @@ -592,21 +590,16 @@ static errcode_t spi_write_dma(spi_bus_t bus, const spi_xfer_data_t *data, uint3 g_dma_trans_tx[bus].channel = channel + 1; g_dma_trans_tx[bus].trans_succ = false; - uapi_pm_add_sleep_veto(PM_ID_SPI_DMA); if (uapi_dma_start_transfer(channel) != ERRCODE_SUCC) { - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); g_dma_trans_tx[bus].channel = 0; return ERRCODE_SPI_DMA_CONFIG_ERROR; } if (osal_sem_down_timeout(&(g_dma_trans_tx[bus].dma_sem), timeout) != OSAL_SUCCESS) { - uapi_dma_end_transfer(channel); - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); g_dma_trans_tx[bus].channel = 0; return ERRCODE_SPI_DMA_TRANSFER_ERROR; } - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); g_dma_trans_tx[bus].channel = 0; if (!g_dma_trans_tx[bus].trans_succ) { @@ -633,7 +626,7 @@ static void spi_dma_rx_config(dma_ch_user_peripheral_config_t *transfer_config, transfer_config->src = data_addr; } -static errcode_t spi_read_dma(spi_bus_t bus, const spi_xfer_data_t *data, uint32_t timeout) +static errcode_t spi_read_dma(spi_bus_t bus, const spi_xfer_data_t *data) { dma_ch_user_peripheral_config_t transfer_config = { 0 }; uint8_t channel = DMA_CHANNEL_NONE; @@ -667,21 +660,16 @@ static errcode_t spi_read_dma(spi_bus_t bus, const spi_xfer_data_t *data, uint32 g_dma_trans_rx[bus].channel = channel + 1; g_dma_trans_rx[bus].trans_succ = false; - uapi_pm_add_sleep_veto(PM_ID_SPI_DMA); if (uapi_dma_start_transfer(channel) != ERRCODE_SUCC) { - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); g_dma_trans_rx[bus].channel = 0; return ERRCODE_SPI_DMA_CONFIG_ERROR; } - if (osal_sem_down_timeout(&(g_dma_trans_rx[bus].dma_sem), timeout) != OSAL_SUCCESS) { - uapi_dma_end_transfer(channel); - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); + if (osal_sem_down(&(g_dma_trans_rx[bus].dma_sem)) != OSAL_SUCCESS) { g_dma_trans_rx[bus].channel = 0; return ERRCODE_SPI_DMA_TRANSFER_ERROR; } - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); g_dma_trans_rx[bus].channel = 0; if (!g_dma_trans_rx[bus].trans_succ) { @@ -775,7 +763,7 @@ static inline void spi_writeread_dma_clear_trans(spi_bus_t bus, uint8_t channel_ uapi_dma_end_transfer(channel_tx); } -static errcode_t spi_writeread_dma(spi_bus_t bus, const spi_xfer_data_t *data, uint32_t timeout) +static errcode_t spi_writeread_dma(spi_bus_t bus, const spi_xfer_data_t *data) { uint8_t channel_rx = 0; uint8_t channel_tx = 0; @@ -784,39 +772,32 @@ static errcode_t spi_writeread_dma(spi_bus_t bus, const spi_xfer_data_t *data, u return ERRCODE_SPI_DMA_CONFIG_ERROR; } - uapi_pm_add_sleep_veto(PM_ID_SPI_DMA); if (uapi_dma_start_transfer(channel_rx) != ERRCODE_SUCC) { - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); g_dma_trans_rx[bus].channel = 0; return ERRCODE_SPI_DMA_CONFIG_ERROR; } if (spi_write_dma_config(bus, &channel_tx, data) != ERRCODE_SUCC) { uapi_dma_end_transfer(channel_rx); - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); return ERRCODE_SPI_DMA_CONFIG_ERROR; } if (uapi_dma_start_transfer(channel_tx) != ERRCODE_SUCC) { uapi_dma_end_transfer(channel_rx); - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); g_dma_trans_tx[bus].channel = 0; return ERRCODE_SPI_DMA_CONFIG_ERROR; } - if (osal_sem_down_timeout(&(g_dma_trans_tx[bus].dma_sem), timeout) != OSAL_SUCCESS) { + if (osal_sem_down(&(g_dma_trans_tx[bus].dma_sem)) != OSAL_SUCCESS) { spi_writeread_dma_clear_trans(bus, channel_tx, channel_rx); - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); return ERRCODE_SPI_DMA_TRANSFER_ERROR; } - if (osal_sem_down_timeout(&(g_dma_trans_rx[bus].dma_sem), timeout) != OSAL_SUCCESS) { + if (osal_sem_down(&(g_dma_trans_rx[bus].dma_sem)) != OSAL_SUCCESS) { spi_writeread_dma_clear_trans(bus, channel_tx, channel_rx); - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); return ERRCODE_SPI_DMA_TRANSFER_ERROR; } - uapi_pm_remove_sleep_veto(PM_ID_SPI_DMA); g_dma_trans_tx[bus].channel = 0; g_dma_trans_rx[bus].channel = 0; @@ -1098,7 +1079,7 @@ static errcode_t spi_master_read_dma(spi_bus_t bus, const spi_xfer_data_t *data, if (spi_get_attr_tmod(bus) == HAL_SPI_TRANS_MODE_RX) { return spi_read_by_writeread(bus, data, timeout); } - return spi_read_dma(bus, data, timeout); + return spi_read_dma(bus, data); } #endif /* NOT CONFIG_SPI_SUPPORT_POLL_AND_DMA_AUTO_SWITCH */ @@ -1168,7 +1149,7 @@ errcode_t uapi_spi_master_writeread(spi_bus_t bus, const spi_xfer_data_t *data, if (data->rx_bytes > CONFIG_SPI_AUTO_SWITCH_DMA_THRESHOLD || data->tx_bytes > CONFIG_SPI_AUTO_SWITCH_DMA_THRESHOLD) { uapi_spi_set_dma_mode(bus, true, NULL); - ret = spi_writeread_dma(bus, data, timeout_tmp); + ret = spi_writeread_dma(bus, data); spi_mutex_unlock(bus); return ret; } @@ -1176,7 +1157,7 @@ errcode_t uapi_spi_master_writeread(spi_bus_t bus, const spi_xfer_data_t *data, #else #if defined(CONFIG_SPI_SUPPORT_DMA) && (CONFIG_SPI_SUPPORT_DMA == 1) if (g_dma_trans_tx[bus].is_enable && g_dma_trans_rx[bus].is_enable) { - ret = spi_writeread_dma(bus, data, timeout_tmp); + ret = spi_writeread_dma(bus, data); spi_mutex_unlock(bus); return ret; } @@ -1257,7 +1238,7 @@ errcode_t uapi_spi_slave_read(spi_bus_t bus, const spi_xfer_data_t *data, uint32 #if defined(CONFIG_SPI_SUPPORT_POLL_AND_DMA_AUTO_SWITCH) && (CONFIG_SPI_SUPPORT_POLL_AND_DMA_AUTO_SWITCH == 1) if (data->rx_bytes > CONFIG_SPI_AUTO_SWITCH_DMA_THRESHOLD) { uapi_spi_set_dma_mode(bus, true, NULL); - ret = spi_read_dma(bus, data, timeout_tmp); + ret = spi_read_dma(bus, data); spi_mutex_unlock(bus); return ret; } @@ -1265,7 +1246,7 @@ errcode_t uapi_spi_slave_read(spi_bus_t bus, const spi_xfer_data_t *data, uint32 #else #if defined(CONFIG_SPI_SUPPORT_DMA) && (CONFIG_SPI_SUPPORT_DMA == 1) if (g_dma_trans_rx[bus].is_enable) { - ret = spi_read_dma(bus, data, timeout_tmp); + ret = spi_read_dma(bus, data); spi_mutex_unlock(bus); return ret; } diff --git a/code/sdk/drivers/drivers/driver/uart/uart.c b/code/sdk/drivers/drivers/driver/uart/uart.c index 9f0eb298c..b6000fff2 100755 --- a/code/sdk/drivers/drivers/driver/uart/uart.c +++ b/code/sdk/drivers/drivers/driver/uart/uart.c @@ -14,8 +14,6 @@ #if defined(CONFIG_UART_SUPPORT_DMA) #include "dma_porting.h" #include "dma.h" -#include "pm_definition.h" -#include "pm_veto.h" #endif /** @@ -72,7 +70,7 @@ static uart_tx_state_t g_uart_tx_state_array[UART_BUS_MAX_NUM]; static uart_tx_state_t *g_uart_tx_state[UART_BUS_MAX_NUM]; #if defined(CONFIG_UART_SUPPORT_DMA) -#define UART_DMA_TRANSFER_TIMEOUT_MS 1000 +#define DMA_UART_TRANSFER_TIMEOUT_MS 1000 #define UART_DMA_TRANS_MEMORY_TO_PERIPHERAL_DMA 1 #define UART_DMA_TRANS_PERIPHERAL_TO_MEMORY_DMA 2 #define UART_DMA_TRANSFER_DIR_MEM_TO_PERIPHERAL 0 @@ -554,21 +552,16 @@ int32_t uapi_uart_write_by_dma(uart_bus_t bus, const void *buffer, uint32_t leng g_dma_trans[bus].channel = dma_ch + 1; g_dma_trans[bus].trans_succ = false; - uapi_pm_add_sleep_veto(PM_ID_UART_DMA); if (uapi_dma_start_transfer(dma_ch) != ERRCODE_SUCC) { - uapi_pm_remove_sleep_veto(PM_ID_UART_DMA); g_dma_trans[bus].channel = 0; return UART_DMA_START_TRANSFER_FAIL; } - if (osal_sem_down_timeout(&(g_dma_trans[bus].dma_sem), UART_DMA_TRANSFER_TIMEOUT_MS) != OSAL_SUCCESS) { - uapi_dma_end_transfer(dma_ch); - uapi_pm_remove_sleep_veto(PM_ID_UART_DMA); + if (osal_sem_down_timeout(&(g_dma_trans[bus].dma_sem), DMA_UART_TRANSFER_TIMEOUT_MS) != OSAL_SUCCESS) { g_dma_trans[bus].channel = 0; return UART_DMA_TRANSFER_TIMEOUT; } - uapi_pm_remove_sleep_veto(PM_ID_UART_DMA); g_dma_trans[bus].channel = 0; if (!g_dma_trans[bus].trans_succ) { @@ -635,21 +628,16 @@ int32_t uapi_uart_read_by_dma(uart_bus_t bus, const void *buffer, uint32_t lengt g_dma_trans[bus].channel = dma_ch + 1; g_dma_trans[bus].trans_succ = false; - uapi_pm_add_sleep_veto(PM_ID_UART_DMA); if (uapi_dma_start_transfer(dma_ch) != ERRCODE_SUCC) { - uapi_pm_remove_sleep_veto(PM_ID_UART_DMA); g_dma_trans[bus].channel = 0; return -1; } - if (osal_sem_down_timeout(&(g_dma_trans[bus].dma_sem), UART_DMA_TRANSFER_TIMEOUT_MS) != OSAL_SUCCESS) { - uapi_dma_end_transfer(dma_ch); - uapi_pm_remove_sleep_veto(PM_ID_UART_DMA); + if (osal_sem_down(&(g_dma_trans[bus].dma_sem)) != OSAL_SUCCESS) { g_dma_trans[bus].channel = 0; return -1; } - uapi_pm_remove_sleep_veto(PM_ID_UART_DMA); g_dma_trans[bus].channel = 0; if (!g_dma_trans[bus].trans_succ) { diff --git a/code/sdk/drivers/drivers/hal/dma/v100/hal_dmac_v100.c b/code/sdk/drivers/drivers/hal/dma/v100/hal_dmac_v100.c index 7572eaed9..bd6f02442 100755 --- a/code/sdk/drivers/drivers/hal/dma/v100/hal_dmac_v100.c +++ b/code/sdk/drivers/drivers/hal/dma/v100/hal_dmac_v100.c @@ -163,7 +163,6 @@ static void hal_dmac_v100_ch_enable(dma_channel_t ch, bool en) } else { hal_dma_lli_free(ch); uapi_reg_setbit(&tmp_dma_regs->dma_ch_en, (uint32_t)tmp_dma_ch + HAL_DMA_CH_EN_WE_OFFSET); - g_hal_dma_channel[ch].state = HAL_DMA_CH_STATE_CLOSED; } } diff --git a/code/sdk/drivers/drivers/hal/reboot/hal_reboot.c b/code/sdk/drivers/drivers/hal/reboot/hal_reboot.c index acca28fde..e09b25251 100755 --- a/code/sdk/drivers/drivers/hal/reboot/hal_reboot.c +++ b/code/sdk/drivers/drivers/hal/reboot/hal_reboot.c @@ -133,7 +133,7 @@ void hal_reboot_chip(void) 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) && !defined(BUILD_RECOVERY_IMAGE) +#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); diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index de3bc37c6..3bab5bf2a 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -67,11 +67,7 @@ static int sedentary_interval = 1; static int sedentary_interval_count = 0; -#ifdef FD230 static int cywee_switch = 1; -#else -static int cywee_switch = 0; -#endif int cm__hs1__init(void); int cm__hs1__deinit(void); diff --git a/code/sdk/include/middleware/services/bts/ble/bts_le_gap.h b/code/sdk/include/middleware/services/bts/ble/bts_le_gap.h index 3d66b491f..ae840b961 100755 --- a/code/sdk/include/middleware/services/bts/ble/bts_le_gap.h +++ b/code/sdk/include/middleware/services/bts/ble/bts_le_gap.h @@ -522,7 +522,7 @@ typedef struct { /** * @if Eng - * @brief Enum of ble authentication result. + * @brief Enum of sle authentication result. * @else * @brief BLE认证结果。 * @endif @@ -1520,27 +1520,6 @@ errcode_t gap_ble_disconnect_remote_device(const bd_addr_t *addr); */ errcode_t gap_ble_set_sec_param(gap_ble_sec_params_t *params); -/** - * @if Eng - * @brief Use this funtion to set ctkd enable. - * @par Use this funtion to set ctkd enable. - * @attention NULL - * @param [in] param ctkd enable, true:enable,false:disable - * @retval errcode_t { @ref errcode_bt_t } - * @par Dependency: - * @li bts_def.h - * @else - * @brief 设置一键双连开关。 - * @par 设置一键双连开关。 - * @attention 无 - * @param [in] param 一键双连开关 true:打开 false:关闭 - * @retval 执行结果错误码。 { @ref errcode_bt_t } - * @par 依赖: - * @li bts_def.h - * @endif - */ -errcode_t gap_ble_set_ctkd_enable(bool ctkd_enable); - /** * @if Eng * @brief Use this funtion to read rssi of remote device. diff --git a/code/sdk/include/middleware/services/bts/common/bts_feature.h b/code/sdk/include/middleware/services/bts/common/bts_feature.h index 42cfc673f..5c13978ab 100644 --- a/code/sdk/include/middleware/services/bts/common/bts_feature.h +++ b/code/sdk/include/middleware/services/bts/common/bts_feature.h @@ -32,9 +32,7 @@ extern "C" { typedef struct { uint32_t bt_auto_reconnect_closed:1; /*!< @if Eng BT reconnect feature. @else 蓝牙回连特性。 @endif */ - uint32_t bt_a2dp_snk_closed : 1; /*!< @if Eng BT A2DP SNK feature. - @else 蓝牙A2DP SNK特性。 @endif */ - uint32_t reserved:30; /*!< @if Eng Featrues reserved for future. + uint32_t reserved:31; /*!< @if Eng Featrues reserved for future. @else 保留字段。 @endif */ } bts_feature_t; diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/a2dp_snk_service.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/a2dp_snk_service.c.xml index 9081ff4ca..0fe8d10ca 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/a2dp_snk_service.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/a2dp_snk_service.c.xml @@ -1,57 +1,57 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/app_style.cpp.xml index 308065ce2..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 24286d25e..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 edf505557..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/bt_data_config.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/bt_data_config.c.xml index 912220401..d6dfba59e 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/bt_data_config.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/bt_data_config.c.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/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 23fc7329d..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 @@ -52,27 +52,27 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ 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 be14d17bf..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 @@ -105,19 +105,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/bundle_mgr_service.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/bundle_mgr_service.cpp.xml index 01ff7f430..35908452f 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/bundle_mgr_service.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/bundle_mgr_service.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/bundlems_slite_client.cpp.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/bundlems_slite_client.cpp.xml index 06794b0c6..e169c7b30 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/bundlems_slite_client.cpp.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/bundlems_slite_client.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/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 41d02663f..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,134 +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 2b52c377a..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/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 d59532b81..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 @@ -4,4 +4,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/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 f75dcbfa2..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/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 e58052582..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,15 +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 8ab28bf04..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 e66a69e4f..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 116bec4c1..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_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 a881298a3..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 @@ -40,7 +40,7 @@ - - - + + + \ 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 e2fef883c..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 5b549c3df..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 4a36f5268..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 4e5c0b9f5..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 cbb9bfe79..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/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 1c84d85dd..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,94 +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/mpc_trans.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/mpc_trans.c.xml index b7a750eb1..7e1f35e3d 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/mpc_trans.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/mpc_trans.c.xml @@ -3,22 +3,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/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 f7d415b0f..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 57174de75..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 @@ -1,81 +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/sdk_general_gap.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml index df39006dc..7061ef0e6 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/sdk_general_gap.c.xml @@ -1,44 +1,41 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 4ec47658b..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 @@ -1,70 +1,67 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml index ff86239b5..7a8e6c662 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/spp_service.c.xml @@ -36,15 +36,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/stack_av_if.c.xml b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/stack_av_if.c.xml index eb6570bc3..138712af8 100644 --- a/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/stack_av_if.c.xml +++ b/code/sdk/interim_binary/brandy/acore/build_hso_cfg/hso_database/xml/base/closed_comp/stack_av_if.c.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/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 index 06707514c..9cb8a703c 100644 --- 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 @@ -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/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 index 6c6fb96ee..e4a5ae044 100644 --- 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 @@ -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/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 index 102176720..6b960ad9a 100644 --- 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 @@ -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/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 index 6a4b694fa..6c53c2df6 100644 --- 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 @@ -1,12 +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_sea.c.xml b/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/core_sea.c.xml index 2541a892c..d473a38a7 100755 --- a/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/core_sea.c.xml +++ b/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/core_sea.c.xml @@ -1,88 +1,88 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + \ No newline at end of file diff --git a/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/dsp_main.c.xml b/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/dsp_main.c.xml index d8c9c7973..27334a565 100755 --- a/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/dsp_main.c.xml +++ b/code/sdk/interim_binary/brandy/audio/build_hso_cfg/hso_database/xml/base/dsp_core/dsp_main.c.xml @@ -1,30 +1,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + \ 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 27025ebea..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 @@ -179,9 +179,8 @@ - - - + + @@ -307,22 +306,22 @@ - - - - - + + + + + - + - + - + - + @@ -374,8 +373,8 @@ - - + + @@ -413,15 +412,14 @@ - - - - - - - - - + + + + + + + + @@ -438,7 +436,7 @@ - + @@ -488,27 +486,25 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + @@ -746,45 +742,45 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1091,43 +1087,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1973,11 +1965,10 @@ - - - - - + + + + @@ -2027,8 +2018,8 @@ - - + + @@ -2186,13 +2177,10 @@ - - - - - - - + + + + @@ -2338,21 +2326,21 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -2614,8 +2602,6 @@ - - @@ -2663,8 +2649,8 @@ - - + + @@ -2719,13 +2705,13 @@ - - - - - - - + + + + + + + @@ -3059,11 +3045,11 @@ - - - - - + + + + + @@ -3071,26 +3057,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -3103,54 +3089,54 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3317,24 +3303,24 @@ - - - - - - - - - + + + + + + + + + - - - - + + + + @@ -3371,11 +3357,8 @@ - - - - - + + @@ -3420,21 +3403,21 @@ - - - - - - - - - - - - + + + + + + + + + + + + + - - + @@ -3486,22 +3469,21 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + @@ -3574,41 +3556,38 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -3616,8 +3595,6 @@ - - @@ -3678,20 +3655,11 @@ - - - - - - - - - - - - - - + + + + + @@ -3744,10 +3712,10 @@ - - - - + + + + @@ -3904,24 +3872,27 @@ - - - - + + + + - - - - + + + + + - - - - - + + + + + + + @@ -4404,32 +4375,34 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4594,42 +4567,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/a2dp_hlp_ram.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/a2dp_hlp_ram.c.xml index 592929159..c35c5ac30 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/a2dp_hlp_ram.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/a2dp_hlp_ram.c.xml @@ -1,6 +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/ahib_mpc.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ahib_mpc.c.xml index 0b04414b8..1b8860bc2 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ahib_mpc.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ahib_mpc.c.xml @@ -2,7 +2,7 @@ - + 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 e1beb2154..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 @@ -12,13 +12,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/ble_conf.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_conf.c.xml index edd5dec81..041bb7830 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_conf.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ble_conf.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/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 5e05148d8..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 @@ -31,41 +31,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 e6e159dce..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 @@ -3,26 +3,26 @@ - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -35,52 +35,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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_av.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_av.c.xml index 4a907ae1c..27cb7a178 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_av.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_av.c.xml @@ -1,17 +1,17 @@ - - - - - + + + + + - + - + - + - + \ 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 80a7f158c..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,36 +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_ahi_hfp.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_hfp.c.xml index d0a5a0530..d924aa4f5 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_hfp.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_ahi_hfp.c.xml @@ -1,8 +1,7 @@ - - - - - - - + + + + + + \ 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_dft.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_dft.c.xml index e9c3af7ad..ca08936a9 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_dft.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/bt_dft.c.xml @@ -66,43 +66,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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 d6cbbc200..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 @@ -68,11 +68,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_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 27e258d6e..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 5bd18d414..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_br.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_br.c.xml index 3e75d5be1..f65b5d6ec 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_br.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_hlp_br.c.xml @@ -1,4 +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/gap_ui.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_ui.c.xml index 5b2413f2b..e051899f4 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_ui.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gap_ui.c.xml @@ -5,6 +5,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/gdk_cmsis.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gdk_cmsis.c.xml index be49d5722..728ac59a9 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gdk_cmsis.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/gdk_cmsis.c.xml @@ -4,6 +4,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_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 ebca41a84..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_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 fb8a3f082..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 f6281d342..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,6 +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/ipc.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ipc.c.xml index ea655be31..d4fc447c3 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ipc.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ipc.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/ld_fm_ram.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ld_fm_ram.c.xml index d1b295c18..d799f54ef 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ld_fm_ram.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/ld_fm_ram.c.xml @@ -1,23 +1,21 @@ - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + \ 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 b4ba4186e..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,9 +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/packet_dl.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/packet_dl.c.xml index cc30b2798..51d637b23 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/packet_dl.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/packet_dl.c.xml @@ -1,12 +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/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 1b4dd880b..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,6 +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/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 9d3d3bf48..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 8722fa0b6..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 @@ -2,40 +2,37 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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_hlp.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_hlp.c.xml index f883b78ea..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,15 +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/sdk_pbap.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_pbap.c.xml index 5e461bae4..7e8c52735 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_pbap.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sdk_pbap.c.xml @@ -1,7 +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/security_main.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/security_main.c.xml index b67bee17f..bdd6edad5 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/security_main.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/security_main.c.xml @@ -1,10 +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/smp_ui.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/smp_ui.c.xml index b83b5b233..8c7cf1015 100644 --- 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 @@ -1,10 +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/sppui.c.xml b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sppui.c.xml index 8392f1469..7259bd07d 100755 --- a/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sppui.c.xml +++ b/code/sdk/interim_binary/brandy/bt/build_hso_cfg/hso_database/xml/base/bt_core/sppui.c.xml @@ -1,5 +1,5 @@ - - - - + + + + \ 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 d674673ce..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 4ce35cb9c..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 22fdbfafc..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 420cba03b..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 b96a938ea..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 fe618d221..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 789518409..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 fb9a2bdf1..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/interim_binary/brandy/libs/media/evb_standard/libjs_audio_capturer.a b/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_capturer.a deleted file mode 100644 index 696f7292d..000000000 Binary files a/code/sdk/interim_binary/brandy/libs/media/evb_standard/libjs_audio_capturer.a and /dev/null differ diff --git a/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt b/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt index 245ab4270..4b5183c4b 100755 --- a/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt +++ b/code/sdk/middleware/chips/brandy/dfx/CMakeLists.txt @@ -6,7 +6,6 @@ set(COMPONENT_NAME "dfx_port_brandy") set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/dfx_channel.c - ${CMAKE_CURRENT_SOURCE_DIR}/diag_audio.c ${CMAKE_CURRENT_SOURCE_DIR}/dfx_system_init.c ${CMAKE_CURRENT_SOURCE_DIR}/diag_adapt_cmd_mem.c ${CMAKE_CURRENT_SOURCE_DIR}/last_dump_adapt.c diff --git a/code/sdk/middleware/chips/brandy/dfx/dfx_channel.c b/code/sdk/middleware/chips/brandy/dfx/dfx_channel.c index 89e5b19cb..4f65673e9 100755 --- a/code/sdk/middleware/chips/brandy/dfx/dfx_channel.c +++ b/code/sdk/middleware/chips/brandy/dfx/dfx_channel.c @@ -25,8 +25,8 @@ #endif #include "bts_gatt_server.h" + #define DIAG_SER_DATA_MFS 990 -#define DIAG_SER_GATT_DATA_MFS 500 #ifdef SUPPORT_ALIPAY_SEC #define DIAG_SER_DATA_MAX_LEN 0x3000 #else @@ -112,7 +112,7 @@ static errcode_t diag_channel_bt_gatt_output(void *fd, dfx_data_type_t data_type return ret; } -void diag_gatt_write_req_cbk(uint8_t server_id, uint16_t conn_id, gatts_req_write_cb_t *write_cb_para, +static void diag_gatt_write_req_cbk(uint8_t server_id, uint16_t conn_id, gatts_req_write_cb_t *write_cb_para, errcode_t status) { g_diag_gatt_hdl = write_cb_para->handle; @@ -123,11 +123,9 @@ void diag_gatt_write_req_cbk(uint8_t server_id, uint16_t conn_id, gatts_req_writ static void diag_channel_register_bt_gatt_callback(void) { -#ifndef SUPPORT_AT_OHOSFWK gatts_callbacks_t cb = {0}; cb.write_request_cb = diag_gatt_write_req_cbk; (void)gatts_register_callbacks(&cb); -#endif } errcode_t diag_cmd_uart_config(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option) @@ -275,11 +273,6 @@ errcode_t diag_register_channel(void) if (uapi_diag_channel_set_tx_hook(DIAG_CHANNEL_ID_2, diag_channel_bt_gatt_output) != ERRCODE_SUCC) { return ERRCODE_FAIL; } - - if (uapi_diag_channel_set_mfs(DIAG_CHANNEL_ID_2, DIAG_SER_GATT_DATA_MFS, DIAG_SER_DATA_MAX_LEN) != ERRCODE_SUCC) { - return ERRCODE_FAIL; - } - diag_channel_register_bt_gatt_callback(); #endif /* CONFIG_DFX_SUPPORT_DIAG_CONNECT_BLE */ return ERRCODE_SUCC; diff --git a/code/sdk/middleware/chips/brandy/dfx/dfx_channel.h b/code/sdk/middleware/chips/brandy/dfx/dfx_channel.h index 001e1350b..ccf14e3e3 100755 --- a/code/sdk/middleware/chips/brandy/dfx/dfx_channel.h +++ b/code/sdk/middleware/chips/brandy/dfx/dfx_channel.h @@ -8,24 +8,9 @@ #include #include "errcode.h" #include "diag.h" -#include "bts_gatt_server.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ void diag_uart_rx_proc(uint8_t *buffer, uint16_t length); errcode_t diag_register_channel(void); errcode_t diag_cmd_uart_config(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option); errcode_t diag_cmd_set_offline_log(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option); -void diag_gatt_write_req_cbk(uint8_t server_id, uint16_t conn_id, gatts_req_write_cb_t *write_cb_para, - errcode_t status); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ #endif \ No newline at end of file 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 b395d9451..f7a112ad8 100755 --- a/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c +++ b/code/sdk/middleware/chips/brandy/dfx/dfx_system_init.c @@ -40,7 +40,6 @@ #include "soc_log_uart_instance.h" #include "sample_data_adapt.h" #include "dfx_channel.h" -#include "diag_audio.h" #include "transmit.h" #include "log_file.h" #include "soc_log_strategy.h" @@ -109,10 +108,6 @@ const diag_cmd_reg_obj_t g_diag_default_cmd_tbl[] = { { DIAG_CMD_SET_OFFLINE_LOG, DIAG_CMD_SET_OFFLINE_LOG, diag_cmd_set_offline_log }, { DIAG_CMD_ID_DIAG_DFX_REQ, DIAG_CMD_ID_DIAG_DFX_END, diag_dfx_cmd }, { DIAG_CMD_ID_DBG_STAT_QUERY, DIAG_CMD_ID_DBG_STAT_QUERY, diag_cmd_stat_query }, -#ifdef SUPPORT_MEDIA_AUDIO_MANAGER - { DIAG_CMD_AUDIO_SEE_EFFECT_REQ, DIAG_CMD_AUDIO_SEE_EFFECT_REQ, diag_see_param_trans }, - { DIAG_CMD_AUDIO_SAVE_SEE_EFFECT_REQ, DIAG_CMD_AUDIO_SAVE_SEE_EFFECT_REQ, diag_see_param_save }, -#endif }; static unsigned long g_dfx_osal_queue_id = DFX_INVALID_QUEUE_ID; diff --git a/code/sdk/middleware/chips/brandy/dfx/diag_audio.c b/code/sdk/middleware/chips/brandy/dfx/diag_audio.c deleted file mode 100644 index d9163347f..000000000 --- a/code/sdk/middleware/chips/brandy/dfx/diag_audio.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright (c) @CompanyNameMagicTag 2024-2024. All rights reserved. - * Description: audio diag - * Author: audio - * Create: 2024-06-06 - */ - -#include "diag.h" -#ifdef CONFIG_NV_FEATURE_SUPPORT -#include "nv.h" -#endif -#ifdef SUPPORT_MEDIA_AUDIO_MANAGER -#include "audio_manager_c_wrapper.h" -#endif -#include "debug_print.h" -#include "soc_diag_cmd_id.h" -#include "diag_audio.h" - -#define GET_SEE_PARAM_FIRST_POS 0 -#define DEBUGKITS_READ_PARAM_TAG 0xff -#define PARSE_EFFECT_PARAM_FLAG_POS 0 - -#define audio_unused(var) (void)(var) - -/* - * Debugkit menu点击通知 读取/配置 3A算法参数 - * - * 当点击Read时,读取当前3A算法参数 - * 当点击Write时,将界面中的3A算法参数配置下去,并使能到算法中 - */ -#ifdef SUPPORT_MEDIA_AUDIO_MANAGER -errcode_t diag_see_param_trans(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option) -{ - errcode_t ret; - uint8_t *param = (uint8_t *)cmd_param; - - if (cmd_param_size != NV_AUDIO_VQE_PARAM_SIZE * sizeof(uint32_t)) { - PRINT("[audio][diag] cmd_param_size invalid\r\n"); - return ERRCODE_FAIL; - } - - if (param[GET_SEE_PARAM_FIRST_POS] != DEBUGKITS_READ_PARAM_TAG) { - /* set param , this func return 0 when success */ - ret = AudioManagerSetSeaParam((uint8_t *)param, cmd_param_size); - if (ret != ERRCODE_SUCC) { - PRINT("[audio][diag] set param fail\r\n"); - return ERRCODE_FAIL; - } - } else { - /* get param , this func return 0 when success */ - ret = AudioManagerGetSeaParam((uint8_t *)param, cmd_param_size); - if (ret != ERRCODE_SUCC) { - PRINT("[audio][diag] get param fail\r\n"); - return ERRCODE_FAIL; - } - } - - return uapi_diag_report_packet(cmd_id, option, (uint8_t *)cmd_param, (uint16_t)cmd_param_size, true); -} - -static errcode_t audio_manager_save_sea_param(uint8_t *sea_param, uint16_t len) -{ - if (sea_param == NULL || len != sizeof(audio_vqe_param_t)) { - PRINT("[audio_manager_save_sea_param]sea_param null or len invalid"); - return ERRCODE_INVALID_PARAM; - } - -#ifdef CONFIG_NV_FEATURE_SUPPORT - errcode_t nv_op = uapi_nv_write((uint16_t)NV_ID_AUDIO_VQE_PARAM, sea_param, len); - if (nv_op != ERRCODE_SUCC) { - return ERRCODE_FAIL; - } -#endif - return ERRCODE_SUCC; -} - -/* debugkit menu点击Save保存所有3A参数 */ -errcode_t diag_see_param_save(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option) -{ - audio_vqe_param_t *nv_data = (audio_vqe_param_t *)malloc(sizeof(audio_vqe_param_t)); - if (nv_data == NULL) { - PRINT("[audio][diag] malloc fail\r\n"); - return ERRCODE_MALLOC; - } - (void)memset_s(nv_data, sizeof(audio_vqe_param_t), 0, sizeof(audio_vqe_param_t)); - - nv_data->size = NV_AUDIO_VQE_PARAM_SIZE; - errcode_t ret = AudioManagerGetSeaParam((uint8_t *)nv_data->data, NV_AUDIO_VQE_PARAM_SIZE * sizeof(uint32_t)); - if (ret != ERRCODE_SUCC) { - free(nv_data); - PRINT("[audio][diag] get param fail\r\n"); - return ERRCODE_FAIL; - } - - errcode_t nv_op = audio_manager_save_sea_param((uint8_t *)nv_data, (uint16_t)sizeof(audio_vqe_param_t)); - if (nv_op != ERRCODE_SUCC) { - free(nv_data); - PRINT("[audio][diag] save param nv fail\r\n"); - return ERRCODE_FAIL; - } - free(nv_data); - - errcode_t op = uapi_diag_report_packet(cmd_id, option, &ret, sizeof(uint8_t), true); - if (op != ERRCODE_SUCC) { - PRINT("[audio][diag] read rpt fail %u\r\n", op); - } - - audio_unused(cmd_param); - audio_unused(cmd_param_size); - return op; -} -#endif /* SUPPORT_MEDIA_AUDIO_MANAGER */ \ No newline at end of file diff --git a/code/sdk/middleware/chips/brandy/dfx/diag_audio.h b/code/sdk/middleware/chips/brandy/dfx/diag_audio.h deleted file mode 100644 index f703ca625..000000000 --- a/code/sdk/middleware/chips/brandy/dfx/diag_audio.h +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Copyright (c) @CompanyNameMagicTag 2024-2024. All rights reserved. - * Description: adapt sdt - * This file should be changed only infrequently and with great care. - * Author: audio - * Create: 2024-06-06 - */ - -#ifndef DIAG_AUDIO_H -#define DIAG_AUDIO_H -#include -#include "errcode.h" -#include "diag.h" - -#define NV_AUDIO_VQE_PARAM_SIZE 48 - -typedef struct { - uint32_t size; - uint32_t data[NV_AUDIO_VQE_PARAM_SIZE]; -} audio_vqe_param_t; - -errcode_t diag_see_param_save(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option); -errcode_t diag_see_param_trans(uint16_t cmd_id, void *cmd_param, uint16_t cmd_param_size, diag_option_t *option); -#endif \ No newline at end of file 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 ac157e7f9..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 @@ -185,7 +185,6 @@ typedef enum { JSI_UTILS_CPP, MSG_CENTER_CMD_CPP, MSG_CENTER_CPP, - MSG_CENTER_OTA_CPP, MSG_CENTER_CUSTOMER_CPP, MSG_CENTER_PROTOCOL_CPP, ALARM_NOTIFICATION_CPP, 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 13d1422a0..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 @@ -87,7 +87,6 @@ typedef enum { IMAGE_COMPONENT_CPP, INPUT_BUTTON_COMPONENT_CPP, INPUT_CHECKBOX_COMPONENT_CPP, - INPUT_EDITTEXT_COMPONENT_CPP, INPUT_RADIO_COMPONENT_CPP, LIST_ADAPTER_CPP, LIST_COMPONENT_CPP, @@ -119,7 +118,6 @@ typedef enum { DIRECTIVE_WATCHER_CALLBACK_CPP, JSI_CPP, APP_MODULE_CPP, - DEVICE_MODULE_CPP, DFX_MODULE_CPP, DIALOG_MODULE_CPP, LOCALE_MODULE_CPP, diff --git a/code/sdk/middleware/chips/brandy/dfx/include/soc_diag_cmd_id.h b/code/sdk/middleware/chips/brandy/dfx/include/soc_diag_cmd_id.h index 9af7894d1..b14d14b91 100755 --- a/code/sdk/middleware/chips/brandy/dfx/include/soc_diag_cmd_id.h +++ b/code/sdk/middleware/chips/brandy/dfx/include/soc_diag_cmd_id.h @@ -50,10 +50,9 @@ #define DIAG_CMD_SET_TIME diag_cmd_id_comb(0x23) /* PQUI cmd [0x24, 0x2F] */ -#define DIAG_CMD_AUDIO_HAID_REQ diag_cmd_id_comb(0x24) -#define DIAG_CMD_AUDIO_SWS_EFFECT_REQ diag_cmd_id_comb(0x25) -#define DIAG_CMD_AUDIO_SEE_EFFECT_REQ diag_cmd_id_comb(0x26) -#define DIAG_CMD_AUDIO_SAVE_SEE_EFFECT_REQ diag_cmd_id_comb(0x2f) +#define DIAG_CMD_AUDIO_HAID_REQ diag_cmd_id_comb(0x24) +#define DIAG_CMD_AUDIO_SWS_EFFECT_REQ diag_cmd_id_comb(0x25) +#define DIAG_CMD_AUDIO_SEE_EFFECT_REQ diag_cmd_id_comb(0x26) /* NV read and write commands [0x30, 0x33] */ #define DIAG_CMD_NV_RD diag_cmd_id_comb(0x30) diff --git a/code/sdk/middleware/chips/brandy/exception/exception_riscv.c b/code/sdk/middleware/chips/brandy/exception/exception_riscv.c index ab3b9c2ae..d5d4119a4 100755 --- a/code/sdk/middleware/chips/brandy/exception/exception_riscv.c +++ b/code/sdk/middleware/chips/brandy/exception/exception_riscv.c @@ -465,7 +465,6 @@ static void show_system_panic_info(const exc_context_t *exc_buf_addr) static void disable_watchdog(void) { -#ifndef BUILD_APPLICATION_SSB #ifdef SUPPORT_WATCHDOG #if MASTER_BY_BRANDY_ONLY /* If the clock of the watchdog is not enabled, the next operation register triggers an exception. */ @@ -475,7 +474,8 @@ static void disable_watchdog(void) #if MASTER_BY_BRANDY_ONLY watchdog_turnoff_clk(); #endif -#endif +#else + return; #endif } diff --git a/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json index 00e520f62..e71b83266 100644 --- a/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json +++ b/code/sdk/middleware/chips/brandy/nv/nv_config/cfg/eng/acore/app.json @@ -40,14 +40,14 @@ "key_id": "0x2101", "key_status": "alive", "structure_type": "btsrv_local_device_info_t", - "attributions": 4, + "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": 4, + "attributions": 1, "value": [0] }, "btsrv_tx_power_info":{ @@ -61,7 +61,7 @@ "key_id": "0x2104", "key_status": "alive", "structure_type": "bth_product_data_config_t", - "attributions": 4, + "attributions": 1, "value": [0] }, "audio_vqe_param":{ @@ -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 index dde3b2fa1..11a5df878 100644 --- 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 @@ -40,14 +40,14 @@ "key_id": "0x2101", "key_status": "alive", "structure_type": "btsrv_local_device_info_t", - "attributions": 4, + "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": 4, + "attributions": 1, "value": [0] }, "btsrv_tx_power_info":{ @@ -61,7 +61,7 @@ "key_id": "0x2104", "key_status": "alive", "structure_type": "bth_product_data_config_t", - "attributions": 4, + "attributions": 1, "value": [0] }, "audio_vqe_param":{ @@ -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/pm/include/pm_definition.h b/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h index 5517b07a1..fafe30770 100755 --- a/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h +++ b/code/sdk/middleware/chips/brandy/pm/include/pm_definition.h @@ -41,9 +41,6 @@ typedef enum { PM_ID_JPEG, PM_ID_JS, PM_ID_MSGCENTER, - PM_ID_SPI_DMA, - PM_ID_I2C_DMA, - PM_ID_UART_DMA, PM_ID_HEART,//新增,心率芯片 PM_ID_MOTOR,//新增,马达 PM_ID_GSENSOR,//新增,加速计 diff --git a/code/sdk/middleware/chips/brandy/pm/pm.c b/code/sdk/middleware/chips/brandy/pm/pm.c index c07591e72..8dbe186db 100755 --- a/code/sdk/middleware/chips/brandy/pm/pm.c +++ b/code/sdk/middleware/chips/brandy/pm/pm.c @@ -230,9 +230,6 @@ const char* pm_id_name_arr[] ={ "PM_ID_JPEG", "PM_ID_JS", "PM_ID_MSGCENTER", - "PM_ID_SPI_DMA", - "PM_ID_I2C_DMA", - "PM_ID_UART_DMA", "PM_ID_HEART",//新增,心率芯片 "PM_ID_MOTOR",//新增,马达 "PM_ID_GSENSOR",//新增,加速计 diff --git a/code/sdk/middleware/chips/brandy/update/include/upg_common_porting.h b/code/sdk/middleware/chips/brandy/update/include/upg_common_porting.h index ad8fe59bd..11a640df6 100755 --- a/code/sdk/middleware/chips/brandy/update/include/upg_common_porting.h +++ b/code/sdk/middleware/chips/brandy/update/include/upg_common_porting.h @@ -15,15 +15,15 @@ extern "C" { #endif #endif -#if defined (MEMORY_MINI) || defined (SUPPORT_AUTO_OTA_SERVER) -#define UPG_FILE_PATH "/user/" -#define UPG_RES_INDEX_PATH "/user/res_index.bin" -#define UPG_FILE_NAME "/user/update.fwpkg" -#else +// #if MEMORY_MINI +// #define UPG_FILE_PATH "/user/" +// #define UPG_RES_INDEX_PATH "/user/res_index.bin" +// #define UPG_FILE_NAME "/user/update.fwpkg" +// #else #define UPG_FILE_PATH "/update/" #define UPG_RES_INDEX_PATH "/update/res_index.bin" #define UPG_FILE_NAME "/update/update.fwpkg" -#endif +// #endif #define UPG_FLASH_SIZE (FLASH_MAX_END - FLASH_START) #define UPG_FLASH_PAGE_SIZE FLASH_PAGE_SIZE /* Bytes per sector */ 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 56a7a095e..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 @@ -449,7 +449,6 @@ static td_s32 vau_draw_hardware(td_handle handle, const ext_vau_surface_list *su vau_err("vau_draw_make_paint failed"); return ret; } - vau_draw_make_matrix(m, &sw_node->hw_node); vau_draw_make_src1(src1, &sw_node->hw_node); vau_draw_make_dst(surface_list->dst_surface, &sw_node->hw_node); diff --git a/code/sdk/middleware/services/gpu/api/vau/soc_vau_api.c b/code/sdk/middleware/services/gpu/api/vau/soc_vau_api.c index 47a3a54ea..a4dd9148e 100755 --- a/code/sdk/middleware/services/gpu/api/vau/soc_vau_api.c +++ b/code/sdk/middleware/services/gpu/api/vau/soc_vau_api.c @@ -15,7 +15,6 @@ #ifdef CONFIG_VAU_DRAW_DIRECTLY #include "vau_draw.h" #endif -#include "vau_hal_apb.h" #define VAU_SRC_SURFACE_CNT_MAX 20 #define VAU_GRADIENT_RATIO 128 @@ -944,16 +943,3 @@ td_s32 uapi_vau_wait_for_done(td_handle handle) return EXT_SUCCESS; } - -td_s32 uapi_vau_set_cubic_threshold(td_float cubic_threshold) -{ - // cubic_threshold Range: 1.0/0.5/0.25/0.125 - if ((cubic_threshold != 0.125) && (cubic_threshold != 0.25) && (cubic_threshold != 0.5) && - (cubic_threshold != 1.0)) { - vau_err("input val [%f] is wrong, need equal 0.125 or 0.25 or 0.5 or 1.0", cubic_threshold); - return EXT_FAILURE; - } - - vau_hal_apb_set_cubic_threshold(cubic_threshold); - return EXT_SUCCESS; -} 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 63889bdc7..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 */ @@ -247,19 +247,6 @@ td_void vau_hal_apb_vector_draw_init(td_void) vau_hal_apb_vector_draw_init_sample(); } -td_void vau_hal_apb_set_cubic_threshold(td_float cubic_threshold) -{ - u_vau_draw_threshold_cubic cubic; - - if (cubic_threshold != 0) { - cubic.bits.threshold_cubic = cubic_threshold; - uapi_reg_write(HAL_VAU_DRAW_THRESHOLD_CUBIC, cubic.u32); - } else { - cubic.bits.threshold_cubic = 0.125; /* 0.125 : default threshold for cubic split */ - uapi_reg_write(HAL_VAU_DRAW_THRESHOLD_CUBIC, cubic.u32); - } -} - td_void vau_hal_apb_vector_cmddata_range(td_u32 type, td_u32 start, td_u32 end) { if (type == VAU_VECTOR_RANGE_CMD) { diff --git a/code/sdk/middleware/services/gpu/drv/vau/hal/vau_hal_apb.h b/code/sdk/middleware/services/gpu/drv/vau/hal/vau_hal_apb.h index 4f5064686..56889751a 100755 --- a/code/sdk/middleware/services/gpu/drv/vau/hal/vau_hal_apb.h +++ b/code/sdk/middleware/services/gpu/drv/vau/hal/vau_hal_apb.h @@ -32,7 +32,7 @@ td_void vau_hal_apb_print_reg(td_u32 base, td_u32 start, td_u32 end); td_void vau_hal_apb_print_all_reg(td_void); td_void vau_hal_apb_vector_cmddata_range(td_u32 type, td_u32 start, td_u32 end); td_void vau_hal_apb_sram_ctrl(td_bool lp_en); -td_void vau_hal_apb_set_cubic_threshold(td_float cubic_threshold); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/middleware/services/gui/hal/common/include/graphic_hardware_config.h b/code/sdk/middleware/services/gui/hal/common/include/graphic_hardware_config.h index d989347d6..692f6f248 100755 --- a/code/sdk/middleware/services/gui/hal/common/include/graphic_hardware_config.h +++ b/code/sdk/middleware/services/gui/hal/common/include/graphic_hardware_config.h @@ -159,7 +159,7 @@ #define MEM_POOL_UI_POOL_SIZE PSRAM_GUI_MEM_POOL_SIZE #define MEM_POOL_UI_FONT PSRAM_GUI_MEM_POOL_ADDR #if PSRAM_DENSITY_MB == 16 -#define MEM_POOL_UI_FONT_SIZE 0x132000 +#define MEM_POOL_UI_FONT_SIZE 0x100000 #else #define MEM_POOL_UI_FONT_SIZE 0x380000 #endif 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 821e28a4a..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 e2d1e495a..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 1f6453e6c..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 048b824df..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 904c630e4..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 8afdc3f1c..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 @@ -226,8 +226,7 @@ static int32_t AllocMem(const AllocInfo *info, BufferHandle **handle) } uint8_t *pool = g_poolId; - if (((info->usage & HBM_USE_MEM_FONT) == HBM_USE_MEM_FONT) || - ((info->usage & HBM_USE_MEM_PATH) == HBM_USE_MEM_PATH)){ + if ((info->usage & HBM_USE_MEM_FONT) == HBM_USE_MEM_FONT) { pool = g_fontPoolId; } @@ -269,8 +268,7 @@ static void FreeMem(BufferHandle *handle) } #endif } - } else if (((handle->usage & HBM_USE_MEM_FONT) == HBM_USE_MEM_FONT) || - ((handle->usage & HBM_USE_MEM_PATH) == HBM_USE_MEM_PATH)){ + } else if ((handle->usage & HBM_USE_MEM_FONT) == HBM_USE_MEM_FONT) { LosFreeMem(g_fontPoolId, handle->virAddr); } else { LosFreeMem(g_poolId, handle->virAddr); 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 213b424c9..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 fbd2d9546..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 66d9bc246..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/components/ui_coverflow_view.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_coverflow_view.h index b63760281..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 @@ -64,18 +64,6 @@ public: */ void SetRotateAngle(float angle); - /** - * @brief Obtains the component type. - * - * @return Returns the component type, as defined in {@link UIViewType}. - * @since 1.0 - * @version 1.0 - */ - UIViewType GetViewType() const override - { - return UI_COVER_FLOW; - } - /** * @brief Represents a listener for swipe of the coverflow view. */ 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 128e27107..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 @@ -208,17 +208,7 @@ public: return UI_CROSS_VIEW; } - /** - * @brief Set background blur radius. Default value is 10. - * @since 1.0 - * @version 1.0 - */ - void SetBlurRadius(uint16_t radius) { - blurRadius_ = radius; - } - private: - uint16_t blurRadius_ = 10; void UpdateCardPageIndex(); static constexpr uint16_t INVALID_VIEW_INDEX = 0xff; bool loop_ = false; 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 index 552f8ba17..e483fa414 100644 --- 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 @@ -25,17 +25,6 @@ public: UIIcosahedronView(); virtual ~UIIcosahedronView(); - /** - * @brief Obtains the view type. - * @return Returns the view type. - * @since 1.0 - * @version 1.0 - */ - UIViewType GetViewType() const override - { - return UI_ICOSAHEDRON_VIEW; - } - /** * @brief Set the edge length of the icosahedron. * @@ -64,34 +53,11 @@ public: */ bool RotatePlanes(int16_t angle, const Vector3& pivotStart, const Vector3& pivotEnd); - /** - * @brief Set default Image,the default picture will be used if less than 20 faces are set - * @param src Pointer to a ImageInfo struct, which is the source img for kaleidoscope img. - * the size of img must match the size of screen. - */ - void SetDefaultImage(ImageInfo* src) + UIViewType GetViewType() const override { - defaultSrc_ = src; + return UI_ICOSAHEDRON_VIEW; } - /** - * @brief set luminance compensation factor, adjust brightness. - * - * @param value Indicates luminance compensation factor. - * Multiple of the original base compensation setting. - */ - void SetLuminanceFactor(float value) - { - luminanceFactor_ = value; - } - /** - * @brief Draws this image view. - * - * @param invalidatedArea Indicates the area to draw. - * @since 1.0 - * @version 1.0 - */ - void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override; protected: bool OnDragStartEvent(const DragEvent& event); bool OnDragEvent(const DragEvent& event); @@ -142,10 +108,6 @@ private: Vector3 rotateEnd_; }; Matrix4 CalculateRotateMatrix(TriangularPlane dst); - uint8_t GetCurrentPlaneOpt(Vector4 normal); - - void AdjustScaleAndTranslate(Vector3& scale, - Vector3& translate, int16_t widgetWidth, int16_t widgetHeight); Point startPoint_; uint16_t sideLen_; @@ -158,8 +120,6 @@ private: Animator inertiaAnimator_; inertiaAnimatorCallback inertiaCallback_; float lastAngle_; - ImageInfo* defaultSrc_; - float luminanceFactor_; }; } // 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_label_button_ext.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_label_button_ext.h index 4fdf21b6e..0e6b10ec1 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_label_button_ext.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_label_button_ext.h @@ -54,7 +54,6 @@ public: * @version 1.0 */ UILabelButtonExt() {} - /** * @brief A destructor used to delete the UILabelButtonExt instance. * @@ -62,18 +61,7 @@ public: * @version 1.0 */ ~UILabelButtonExt() override {} - - /** - * @brief Obtains the view type. - * @return Returns the view type. - * @since 1.0 - * @version 1.0 - */ - UIViewType GetViewType() const override - { - return UI_LABEL_BUTTON_EXT; - } - + /** * @brief Set the text id * diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_label_ext.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_label_ext.h index 12a4b7ec1..9d9d24270 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_label_ext.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/components/ui_label_ext.h @@ -62,16 +62,6 @@ public: */ ~UILabelExt() override {} - /** - * @brief Obtains the view type. - * @return Returns the view type. - * @since 1.0 - * @version 1.0 - */ - UIViewType GetViewType() const override - { - return UI_LABEL_EXT; - } /** * @brief Set the text id * @@ -84,7 +74,6 @@ public: */ void ForceResetText() override; - void SetTextTransformMap(TransformMap& transMap); protected: void InitLabelText() override; }; 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 d4279dec8..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 @@ -185,7 +185,7 @@ private: bool isStopped_ = true; bool isLayerInit_ : 1; uint8_t flushCount_; - std::shared_ptr surface_ = nullptr; + LiteSurface* surface_ = nullptr; SurfaceBuffer* lastFlushedBuffer_ = nullptr; SurfaceBuffer* currentBuffer_ = nullptr; GraphicMutex lock_; 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 4a4cd6183..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 @@ -35,9 +35,9 @@ #ifndef GRAPHIC_LITE_UI_MENU_ITEM_H #define GRAPHIC_LITE_UI_MENU_ITEM_H #include "graphic_config.h" -#include "components/ui_view_group.h" -#include "components/ui_label_ext.h" +#include "components/ui_button.h" #include "components/ui_image_view.h" +#include "common/text.h" namespace OHOS { /** @@ -46,7 +46,7 @@ namespace OHOS { * @since 1.0 * @version 1.0 */ -class UIMenuItem : public UIViewGroup { +class UIMenuItem : public UIButton { public: UIMenuItem(const UIMenuItem &) = delete; UIMenuItem &operator=(const UIMenuItem &) = delete; @@ -113,9 +113,8 @@ public: */ void SetText(const char* text) { - InitUILabelExt(); - label_->SetText(text); - ReMeasure(); + InitText(); + text_->SetText(text); } /** * @brief Sets the alignment mode for this text. @@ -126,8 +125,8 @@ public: */ void SetAlign(UITextLanguageAlignment align) { - InitUILabelExt(); - label_->SetAlign(align, TEXT_ALIGNMENT_CENTER); + InitText(); + text_->SetAlign(align, TEXT_ALIGNMENT_CENTER); } /** @@ -139,8 +138,8 @@ public: */ void SetDirect(UITextLanguageDirect direct) { - InitUILabelExt(); - label_->SetDirect(direct); + InitText(); + text_->SetDirect(direct); } /** @@ -152,8 +151,7 @@ public: */ void SetLabelStyle(Style& labelStyle) { - InitUILabelExt(); - label_->SetStyle(labelStyle); + textStyle_ = labelStyle; } /** @@ -166,8 +164,7 @@ public: */ void SetLabelStyle(uint8_t key, int64_t value) { - InitUILabelExt(); - label_->SetStyle(key, value); + textStyle_.SetStyle(key, value); } /** @@ -179,8 +176,7 @@ public: */ void SetTextColor(ColorType color) { - InitUILabelExt(); - label_->SetTextColor(color); + textStyle_.textColor_ = color; } /** @@ -193,8 +189,8 @@ public: */ void SetFont(const char* name, uint8_t size) { - InitUILabelExt(); - label_->SetFont(name, size); + InitText(); + text_->SetFont(name, size); } /** @@ -206,35 +202,27 @@ public: */ void SetFontId(uint8_t fontId) { - InitUILabelExt(); - label_->SetFontId(fontId); + InitText(); + text_->SetFontId(fontId); } /** - * @brief Sets the line break mode for this text. + * @brief Init text. * - * @param lineBreakMode Indicates the line break mode to set. * @since 1.0 * @version 1.0 */ - void SetLineBreakMode(const uint8_t lineBreakMode) + void InitText() { - labelLineBreakMode_ = lineBreakMode; - needRefresh_ = true; - } - - /** - * @brief Set the text id. - * - * @param textId Indicates text id. - * @since 1.0 - * @version 1.0 - */ - void SetTextId(uint16_t textId) - { - InitUILabelExt(); - label_->SetTextId(textId); - ReMeasure(); + if (text_ == nullptr) { + text_ = new Text(); + if (text_ == nullptr) { + return; + } + text_->SetAlign(TEXT_ALIGNMENT_CENTER, TEXT_ALIGNMENT_CENTER); + UpdateRect(); + SetScaleCenter(); + } } /** @@ -260,7 +248,8 @@ public: void SetImgOffset(int16_t offset) { imgOffset_ = offset; - needRefresh_ = true; + UpdateRect(); + SetScaleCenter(); } /** @@ -273,7 +262,8 @@ public: void SetTextOffset(int16_t offset) { textOffset_ = offset; - needRefresh_ = true; + UpdateRect(); + SetScaleCenter(); } /** @@ -285,7 +275,6 @@ public: void SetScaleAlignMode(ScaleAlignMode mode) { transAlignMode_ = mode; - needRefresh_ = true; } /** @@ -301,26 +290,25 @@ public: void ReMeasure() override; void OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) override; + void DumpImgInfo() override; private: - void InitUILabelExt(); - void InitUIImageView(); - void SetScaleCenter(); - - UIImageView* image_; - UILabelExt* label_; - Rect textOrigRect_; - Rect imgOrigRect_; - uint8_t labelLineBreakMode_; - bool needRefresh_; + UIImageView* image_ = nullptr; + Style textStyle_; + Rect textRect_; + Rect imgRect_; int16_t imgOffset_ = 0; int16_t textOffset_ = 20; // 20: default text offset. + Text* text_ = nullptr; Vector2 textScaleCenter_ = {0.0, 0.0}; Vector2 imgScaleCenter_ = {0.0, 0.0}; Vector2 itemScaleCenter_ = {0.0, 0.0}; ScaleAlignMode transAlignMode_ = ScaleAlignMode::ALIGN_ITEM_CENTER; UIImageView::ImageResizeMode resizeMode_ = UIImageView::CONTAIN; + void UpdateRect(); + void SetScaleCenter(); + void UpdateTransformMap(); }; } #endif // GRAPHIC_LITE_UI_MENU_ITEM_H 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 index f5b6c0843..24465f648 100644 --- 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 @@ -32,133 +32,108 @@ public: virtual ~UIRollerView() override; /** - * @brief Set item size, which is the size of image in DisplayMode. - */ + * @brief Set item size, which is the size of image in DisplayMode. + */ void SetItemSize(uint16_t width, uint16_t height); /** - * @brief Set item padding. - */ + * @brief Set item padding. + */ void SetItemPadding(uint16_t padding); /** - * @brief Set mirror img opacity. - */ + * @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. - */ + * @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. - */ + * @brief Get sensitivity factor. Default value is 1.0. + */ float GetSensitivityFactor(); /** - * @brief Add an item. - */ - bool AddItem(std::string name, const ImageInfo* src); + * @brief Add an item. + */ + void AddItem(std::string name, const ImageInfo* src); /** - * @brief Remove an item. - */ + * @brief Remove an item. + */ void RemoveItem(std::string name); /** - * @brief Clear all items. - */ + * @brief Clear all items. + */ void ClearAll(); /** - * @brief Get current item name. - */ + * @brief Get current item name. + */ std::string GetCurrentItemName(); /** - * @brief Get current item, which contains 2 imgs. - */ + * @brief Get current item, which contains 2 imgs. + */ UIViewGroup* GetCurrentItem(); /** - * @brief Set current item. - */ + * @brief Set current item. + */ void SetCurrentItem(std::string name, bool enableAnimator = false); /** - * @brief Set current mode, choose from [DISPLAY, COVER]. - */ + * @brief Set current mode, choose from [DISPLAY, COVER]. + */ void SetMode(RollerViewMode mode, bool enableAnimator = false); /** - * @brief Mode change listener. - */ + * @brief Mode change listener. + */ class OnModeChangeListener : public HeapBase { public: /** - * @brief Called when RollerViewMode is changed. - */ + * @brief Called when RollerViewMode is changed. + */ virtual void OnModeChange(UIRollerView* view, RollerViewMode targetMode) = 0; virtual ~OnModeChangeListener() {} }; /** - * @brief Get OnModeChangeListener. - */ + * @brief Get OnModeChangeListener. + */ OnModeChangeListener*& GetOnModeChangeListener() { return onModeChangeListener_; } /** - * @brief Set OnModeChangeListener. - */ + * @brief Set OnModeChangeListener. + */ void SetOnModeChangeListener(OnModeChangeListener* onModeChangeListener) { onModeChangeListener_ = onModeChangeListener; } /** - * @brief Scroll listener. - */ - class OnScrollListener : public HeapBase { - public: - virtual void OnScroll(UIRollerView* roller, std::string currentItemName, float currentItemAngle) = 0; - virtual ~OnScrollListener() {} - }; - - /** - * @brief Set OnScrollListener. - */ - void SetOnScrollListener(OnScrollListener* onScrollListener) - { - onScrollListener_ = onScrollListener; - } - - /** - * @brief Get GetOnScrollListener. - */ - OnScrollListener*& GetOnScrollListener() - { - return onScrollListener_; - } - - /** - * @brief Get current mode. - */ + * @brief Get current mode. + */ RollerViewMode GetMode(); /** - * @brief Set camera distance. If not set, default distance is 1000. - */ + * @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. - */ + * @brief Set absolute y coordinate of camera. + Default value is GetY() - GetHeight() / 3. + */ void SetCamY(int16_t y); UIViewType GetViewType() const override @@ -279,8 +254,7 @@ private: 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_ = nullptr; - OnScrollListener* onScrollListener_ = nullptr; + OnModeChangeListener* onModeChangeListener_; float ConvertDistanceToAngle(int16_t distance); bool IsInCurrentItemRange(float angle); void InitImg(UIView* img); diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/include/gfx_utils/mem_check.h b/code/sdk/middleware/services/gui/uikit/proprietary/include/gfx_utils/mem_check.h index ae77edaa7..eaaf4814f 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/include/gfx_utils/mem_check.h +++ b/code/sdk/middleware/services/gui/uikit/proprietary/include/gfx_utils/mem_check.h @@ -74,7 +74,6 @@ struct MemRecord { struct MemAllocInfo { uintptr_t address; int32_t size; - int16_t count; struct MemAllocInfo* next; }; @@ -130,14 +129,6 @@ public: */ void MemCheckInit(); - void EnableLeakCheck(bool enable); - - void Crash(int16_t cnt, int32_t sz) - { - crashCnt_ = cnt; - leakSize_ = sz; - } - #ifndef VERSION_IOT void CollectMemory(uint32_t delayTime); void SaveRecordInfo(); @@ -164,11 +155,6 @@ private: int32_t delayTime_ = 0; ThreadId recordThreadId = nullptr; int32_t totalSize = 0; - bool enableLeakCheck_ = false; - MemAllocInfo *leakHead_ = nullptr; - int16_t crashCnt_ = -1; - int16_t leakCount_ = 0; - int32_t leakSize_ = 0; }; } // namespace OHOS 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 99d71820a..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 @@ -138,7 +138,6 @@ void UIInputMethod::Input(UI_KEYCODE key) } else { DealNormalKey(key); } - RefreshUi(); } void UIInputMethod::InputPinyin(UI_KEYCODE key) @@ -177,7 +176,6 @@ void UIInputMethod::InputPinyin(UI_KEYCODE key) } break; } - RefreshUi(); } void UIInputMethod::ShowHanziPageList() @@ -188,7 +186,6 @@ void UIInputMethod::ShowHanziPageList() if (pinyinPreview_->GetText() != nullptr && strlen(pinyinPreview_->GetText()) != 0) { hanziList_->SetVisible(true); } - RefreshUi(); } void UIInputMethod::HideHanziPageList() @@ -240,7 +237,6 @@ bool UIInputMethod::OnClick(UIView& view, const ClickEvent& event) previeBox_->InsertHanzi(u8hanzi); HideHanziPageList(); HidePinyinPreview(); - RefreshUi(); return true; } @@ -340,7 +336,6 @@ void UIInputMethod::SetupHanziCandidate() hanziList_->SetIntercept(false); hanziList_->SetAdapter(hanziAdapter_); hanziList_->SetScrollStateListener(this); - hanziList_->SetOnDragListener(this); hanziList_->SetVisible(false); inputMethod_->Add(hanziList_); } 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 e3537227c..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 @@ -35,7 +35,7 @@ namespace OHOS { static constexpr int16_t YUV_WIDTH_ALIGNMENT = 128; UILiteSurfaceView::UILiteSurfaceView() : isLayerInit_(false), flushCount_(0) { - surface_ = std::make_shared(); + surface_ = new LiteSurface(); if (surface_ == nullptr) { GRAPHIC_LOGE("new LiteSurface failed\n"); return; @@ -65,15 +65,15 @@ UILiteSurfaceView::~UILiteSurfaceView() LowPowerManager::GetInstance()->PowerUnLock(); }); - if (preView_ != nullptr) { - delete preView_; - preView_ = nullptr; + if (surface_ != nullptr) { + delete surface_; + surface_ = nullptr; } } Surface* UILiteSurfaceView::GetSurface() const { - return surface_.get(); + return surface_; } void UILiteSurfaceView::SetPosition(int16_t x, int16_t y, int16_t width, int16_t height) @@ -161,6 +161,11 @@ void UILiteSurfaceView::SetSurfaceColorkey(ColorType color) void UILiteSurfaceView::InitLayer() { + if (surface_ == nullptr) { + GRAPHIC_LOGE("surface_ is null!\n"); + return; + } + Rect rect(GetRect()); int16_t width = rect.GetWidth(); int16_t height = rect.GetHeight(); @@ -186,7 +191,7 @@ void UILiteSurfaceView::InitLayer() #ifdef VERSION_IOT bool UILiteSurfaceView::GetBitmap(ImageInfo& bitmap) { - if (lastFlushedBuffer_ == nullptr || isStopped_) { + if (lastFlushedBuffer_ == nullptr) { UIView::GetBitmap(bitmap); } else { CscYuvBuf yuv = {0}; @@ -325,12 +330,12 @@ void UILiteSurfaceView::OnBufferAvailable() ++flushCount_; } lock_.Unlock(); - std::weak_ptr ws = surface_; + if (isLastFrame) { isStopped_ = true; GraphicService::GetInstance()->PostGraphicEvent( - [&, ws] { - if (!ws.expired()) { + [&] { + if (surface_ != nullptr) { DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, false, 0); LiteMGfxEngine::GetInstance()->ClearHardwareLayer(); LiteMGfxEngine::GetInstance()->EnableAsyncMode(true); @@ -342,13 +347,11 @@ void UILiteSurfaceView::OnBufferAvailable() } else if (isStopped_) { isStopped_ = false; GraphicService::GetInstance()->PostGraphicEvent( - [&, ws] { - if (!ws.expired()) { - LiteMGfxEngine::GetInstance()->EnableAsyncMode(false); - LiteMGfxEngine::GetInstance()->AddHardwareLayer(this); - DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, true, colorKey_.full); - InitLayer(); - } + [&] { + LiteMGfxEngine::GetInstance()->EnableAsyncMode(false); + LiteMGfxEngine::GetInstance()->AddHardwareLayer(this); + DisplayDev::GetInstance()->SetLayerColorKey(LAYER_0, true, colorKey_.full); + InitLayer(); }); } 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 77679c6d4..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 @@ -14,139 +14,142 @@ */ #include "components/ui_menu_item.h" -#include "components/root_view.h" namespace OHOS { constexpr uint32_t IMG_TO_TEXT_GAP = 20; // 20: the gap between img and text -UIMenuItem::UIMenuItem() : image_(nullptr), label_(nullptr), - labelLineBreakMode_(UILabel::LineBreakMode::LINE_BREAK_ELLIPSIS), needRefresh_(false) +UIMenuItem::UIMenuItem() { + SetStyleForState(STYLE_BORDER_RADIUS, 0, UIButton::RELEASED); + SetStyleForState(STYLE_BORDER_RADIUS, 0, UIButton::PRESSED); + SetStyleForState(STYLE_BORDER_RADIUS, 0, UIButton::INACTIVE); + SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::RELEASED); + SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::PRESSED); + SetStyleForState(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT, UIButton::INACTIVE); + textStyle_ = StyleDefault::GetDefaultStyle(); } UIMenuItem::~UIMenuItem() { if (image_ != nullptr) { - Remove(image_); delete image_; image_ = nullptr; } - if (label_ != nullptr) { - Remove(label_); - delete label_; - label_ = nullptr; + if (text_ != nullptr) { + delete text_; + text_ = nullptr; } } void UIMenuItem::SetScaleCenter() { - int16_t itemOrigX = GetContentRect().GetX(); if (transAlignMode_ == ScaleAlignMode::ALIGN_TEXT_LEFT) { - textScaleCenter_ = Vector2{0.0, textOrigRect_.GetHeight() / 2.0f}; - imgScaleCenter_ = Vector2{textOrigRect_.GetLeft() - imgOrigRect_.GetLeft(), textScaleCenter_.y_}; - itemScaleCenter_ = Vector2{textOrigRect_.GetLeft() - itemOrigX, textScaleCenter_.y_}; + 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) { - imgScaleCenter_ = Vector2{0.0, imgOrigRect_.GetHeight() / 2.0f}; - textScaleCenter_ = Vector2{imgOrigRect_.GetLeft() - textOrigRect_.GetLeft(), imgScaleCenter_.y_}; - itemScaleCenter_ = Vector2{imgOrigRect_.GetLeft() - itemOrigX, imgScaleCenter_.y_}; + 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) { - itemScaleCenter_ = Vector2{GetWidth() / 2.0f, GetHeight() / 2.0f}; - textScaleCenter_ = Vector2{itemOrigX + itemScaleCenter_.x_ - textOrigRect_.GetLeft(), - itemScaleCenter_.y_}; - imgScaleCenter_ = Vector2{itemOrigX + itemScaleCenter_.x_ - imgOrigRect_.GetLeft(), - itemScaleCenter_.y_}; + Rect rect = GetOrigRect(); + 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}; } } -void UIMenuItem::ReMeasure() +void UIMenuItem::UpdateRect() { - Rect contentRect = GetContentRect(); - if (needRefresh_) { - if (image_ != nullptr) { - image_->SetPosition(imgOffset_, 0, GetHeight(), GetHeight()); - } - if (label_ != nullptr) { - if (image_ != nullptr) { - label_->SetPosition(image_->GetX() + image_->GetWidth() + textOffset_, 0, - GetWidth() - image_->GetWidth(), GetHeight()); - } else { - label_->SetPosition(textOffset_, 0, GetWidth(), GetHeight()); - } - label_->SetLineBreakMode(labelLineBreakMode_); - } - } - needRefresh_ = false; + Rect rect = GetOrigRect(); if (image_ != nullptr) { - imgOrigRect_ = contentRect; - imgOrigRect_.SetX(contentRect.GetX() + imgOffset_); - imgOrigRect_.SetWidth(GetHeight()); + imgRect_ = Rect(rect.GetX(), rect.GetY(), rect.GetX() + rect.GetHeight(), rect.GetY() + rect.GetHeight()); + imgRect_.SetX(rect.GetX() + imgOffset_); + image_->SetPosition(imgRect_.GetX(), imgRect_.GetY(), rect.GetHeight(), rect.GetHeight()); } - if (label_ != nullptr) { - textOrigRect_ = contentRect; - textOrigRect_.SetLeft(imgOrigRect_.GetRight() + textOffset_); + if (text_ != nullptr) { + textRect_ = rect; + textRect_.SetLeft(imgRect_.GetRight() + textOffset_); + text_->ReMeasureTextSize(textRect_, textStyle_); } +} - SetScaleCenter(); - +void UIMenuItem::UpdateTransformMap() +{ TransformMap transMap = GetTransformMap(); if (image_ != nullptr) { - transMap.SetTransMapRect(imgOrigRect_); + transMap.SetTransMapRect(imgRect_); transMap.Scale(transMap.GetScaleCoef(), Vector3{imgScaleCenter_.x_, imgScaleCenter_.y_, 0.0}); image_->SetTransformMap(transMap); } - if (label_ != nullptr) { - transMap.SetTransMapRect(textOrigRect_); + if (text_ != nullptr) { transMap.Scale(transMap.GetScaleCoef(), Vector3{textScaleCenter_.x_, textScaleCenter_.y_, 0.0}); - label_->SetTextTransformMap(transMap); + transMap.SetCameraPosition(Vector2{-textRect_.GetX(), -textRect_.GetY()}); + transMap.SetTransMapRect(textRect_); + text_->SetTransformMap(transMap); } } -void UIMenuItem::SetImageSrc(const char* imgSrc) +void UIMenuItem::ReMeasure() { - InitUIImageView(); - image_->SetSrc(imgSrc); - ReMeasure(); + UpdateRect(); + UpdateTransformMap(); } -void UIMenuItem::SetImageSrc(const ImageInfo* imgSrc) +void UIMenuItem::SetImageSrc(const char* imgSrc) { - InitUIImageView(); + if (image_ == nullptr) { + image_ = new UIImageView(); + if (image_ == nullptr) { + GRAPHIC_LOGE("new image_ failed"); + return; + } + image_->SetResizeMode(resizeMode_); + image_->SetAutoEnable(false); + } image_->SetSrc(imgSrc); - ReMeasure(); -} - -void UIMenuItem::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) -{ - BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, GetRect(), invalidatedArea, *style_, opaScale_); + UpdateRect(); + SetScaleCenter(); } -void UIMenuItem::InitUIImageView() +void UIMenuItem::SetImageSrc(const ImageInfo* imgSrc) { if (image_ == nullptr) { image_ = new UIImageView(); if (image_ == nullptr) { - GRAPHIC_LOGE("new UIImageView failed"); + GRAPHIC_LOGE("new image_ failed"); return; } image_->SetResizeMode(resizeMode_); image_->SetAutoEnable(false); - Add(image_); - needRefresh_ = true; } + image_->SetSrc(imgSrc); + UpdateRect(); + SetScaleCenter(); } -void UIMenuItem::InitUILabelExt() +void UIMenuItem::OnDraw(BufferInfo& gfxDstBuffer, const Rect& invalidatedArea) { - if (label_ == nullptr) { - label_ = new UILabelExt(); - if (label_ == nullptr) { - GRAPHIC_LOGE("new UILabelExt failed"); - return; + BaseGfxEngine::GetInstance()->DrawRect(gfxDstBuffer, GetRect(), invalidatedArea, *style_, opaScale_); + if (text_ != nullptr) { + Rect rect; + rect.Intersect(invalidatedArea, textRect_); + if (rect.GetLeft() < 0) { + rect.SetLeft(0); } - Add(label_); - needRefresh_ = true; + if (rect.GetTop() < 0) { + rect.SetTop(0); + } + + OpacityType opa = GetMixOpaScale(); + uint16_t ellipsisIndex = text_->GetEllipsisIndex(textRect_, textStyle_); + text_->OnDraw(gfxDstBuffer, rect, rect, textRect_, 0, textStyle_, ellipsisIndex, opa); + } + + if (image_ != nullptr) { + image_->OnDraw(gfxDstBuffer, invalidatedArea); } } @@ -159,4 +162,5 @@ void UIMenuItem::DumpImgInfo() const ImageInfo* info = image_->GetImageInfo(); PrintImgInfo(info); } + } // namespace OHOS 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 babd2f769..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 @@ -77,28 +77,6 @@ void DumpMemoryCmd(int argc, char *argv[]) MemCheck::GetInstance()->DumpMemInfo(); } -void LeakPanic(int argc, char *argv[]) -{ - if (argc != 2) { // 2: param num - GRAPHIC_LOGE("param err."); - return; - } - int16_t cnt = 0; - int32_t sz = 0; - char* end = nullptr; - cnt = strtol(argv[0], &end, 0); - if (end == argv[0]) { - GRAPHIC_LOGE("first para is not a number."); - return; - } - sz = strtol(argv[1], &end, 0); - if (end == argv[1]) { - GRAPHIC_LOGE("second para is not a number."); - return; - } - MemCheck::GetInstance()->Crash(cnt, sz); -} - void DumpImgCmd(int argc, char *argv[]) { ImageCacheManager::GetInstance().Dump(); @@ -521,7 +499,6 @@ struct DfxCmd g_dfxCmdList[] = { {"dumpmem", OHOS::DumpMemoryCmd}, {"mem_monitor", OHOS::SetMemMonitorCmd}, {"dumpimg", OHOS::DumpImgCmd}, - {"leak_panic", OHOS::LeakPanic}, #endif #if ENABLE_DEBUG {"inject_rotate", OHOS::InjectRotateEvent}, 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 fc79dc33b..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 @@ -33,8 +33,7 @@ namespace OHOS { * @brief Provides the functions related to UIInputMethod. */ class UIInputMethod : public InputMethodManager::InputMethodListener, - public UIView::OnClickListener, public ListScrollListener, - public UIView::OnDragListener { + public UIView::OnClickListener, public ListScrollListener { class HanziAdapter : public AbstractAdapter { public: ~HanziAdapter() override {}; @@ -120,19 +119,6 @@ private: void DealDelKey(); void DealPinyinDelKey(); - bool OnDrag(UIView& view, const DragEvent& event) override - { - RefreshUi(); - return false; - } - - void RefreshUi() - { - if (inputMethod_ != nullptr) { - inputMethod_->Invalidate(); - } - } - UIViewGroup* inputMethod_ = nullptr; UITextPreviewBox* previeBox_ = nullptr; // soft keyboard edit box UIEditText* edit_ = nullptr; // user creat edit box diff --git a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp index 5f1e89493..2643b2779 100755 --- a/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp +++ b/code/sdk/middleware/services/gui/uikit/proprietary/src/utils/frameworks/mem_check.cpp @@ -32,9 +32,8 @@ #include "hal_tick.h" #include "securec.h" #include "hals/gralloc_engines.h" -#ifdef __LITEOS__ -#include "los_exc.h" -#endif + + #define SUPPRESS_DUMP 0 namespace OHOS { @@ -97,28 +96,11 @@ void MemCheck::MemCheckInit() return; } -void MemCheck::EnableLeakCheck(bool enable) -{ - enableLeakCheck_ = enable; - if (enableLeakCheck_) { - leakCount_ = 0; - leakHead_ = nullptr; - } else { - MemAllocInfo *info = leakHead_; - for (; info != nullptr; info = info->next) { - GRAPHIC_LOGE("leakcheck: [%d] addr %p size %d", info->count, info->address, info->size); - } - crashCnt_ = -1; - leakSize_ = 0; - } -} - int MemCheck::MemAdd(int size, uintptr_t address) { if (!initSuc) { return -1; } - MemAllocInfo* allocNote = (MemAllocInfo*)malloc(sizeof(MemAllocInfo)); if (allocNote == nullptr) { GRAPHIC_LOGE("MemAdd malloc failed\n"); @@ -127,25 +109,9 @@ int MemCheck::MemAdd(int size, uintptr_t address) allocNote->address = address; allocNote->size = size; allocNote->next = nullptr; - allocNote->count = -1; allocTail->next = allocNote; allocTail = allocNote; totalSize += allocNote->size; - if (enableLeakCheck_) { - leakCount_++; - allocNote->count = leakCount_; - if (leakHead_ == nullptr) { - leakHead_ = allocNote; - } - if (leakCount_ == crashCnt_) { - if (leakSize_ != allocNote->size) { - GRAPHIC_LOGE("size not right!"); - } -#ifdef __LITEOS__ - LOS_Panic("mem leak here!\n"); -#endif - } - } #ifndef VERSION_IOT if (!isBeyondTime()) { @@ -166,13 +132,10 @@ int MemCheck::MemDelete(uintptr_t address) if (!initSuc) { return -1; } - int32_t currNodeSize = 0; MemAllocInfo* allocPtr = allocHead; while (allocPtr->next != nullptr) { if (allocPtr->next->address == address) { - MemAllocInfo *cur = allocPtr->next; - leakHead_ = (enableLeakCheck_ && (leakHead_ == cur)) ? cur->next : leakHead_; currNodeSize = allocPtr->next->size; totalSize -= currNodeSize; MemAllocInfo* tmpInfo = allocPtr->next; 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 e21c511d4..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 @@ -147,6 +147,8 @@ 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)); coverflow_->Add(g_faceInfo[i].name, src); diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.cpp deleted file mode 100644 index f8eb0d962..000000000 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.cpp +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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 "menu_item_adapter.h" -#include "components/ui_menu_item.h" -#include "common/image_cache_manager.h" -#include "graphic_config.h" -#include "ui_test_list_ext.h" -#include "securec.h" -#include "ui_test_list_fps/ui_list_fps_res.h" - -namespace OHOS { -uint16_t MenuItemAdapter::GetCount() -{ - return nodeList_.Size(); -} - -void MenuItemAdapter::ClearText() -{ - ListNode* node = nodeList_.Begin(); - while (node != nodeList_.End()) { - if (node->data_) { - if (node->data_->txt) { - UIFree(reinterpret_cast(node->data_->txt)); - node->data_->txt = nullptr; - } - UIFree(reinterpret_cast(node->data_)); - node->data_ = nullptr; - } - node = node->next_; - } - nodeList_.Clear(); - ImageCacheManager::GetInstance().UnloadAllInMultiRes(LIST_FPS); -} - -void MenuItemAdapter::SetFont(const char* name, uint8_t size) -{ - if (name == nullptr) { - return; - } - - if (fontName_ != nullptr) { - if (strcmp(fontName_, name) == 0) { - fontSize_ = size; - return; - } else { - UIFree(fontName_); - fontName_ = nullptr; - } - } - - uint32_t nameLen = static_cast(strlen(name)); - if ((nameLen == 0) || (nameLen > MAX_TEXT_LENGTH)) { - return; - } - - fontName_ = static_cast(UIMalloc(nameLen + 1)); - if (fontName_ == nullptr) { - return; - } - if (memcpy_s(fontName_, nameLen, name, nameLen) != EOK) { - UIFree(fontName_); - fontName_ = nullptr; - return; - } - fontName_[nameLen] = '\0'; - fontSize_ = size; -} - -void MenuItemAdapter::FreeNode(ItemNode* node) -{ - if (node != nullptr) { - if (node->txt) { - UIFree(reinterpret_cast(node->txt)); - node->txt = nullptr; - } - UIFree(reinterpret_cast(node)); - node = nullptr; - } -} - -void MenuItemAdapter::SetData(const List* data) -{ - if (data == nullptr) { - return; - } - if (!nodeList_.IsEmpty()) { - ClearText(); - } - ListNode* node = data->Begin(); - while (node != data->End()) { - ItemNode* tmpNode = static_cast(UIMalloc(sizeof(ItemNode))); - if (tmpNode == nullptr) { - return; - } - - tmpNode->resId = node->data_->resId; - uint32_t len = strlen(node->data_->txt); - tmpNode->txt = static_cast(UIMalloc(len + 1)); - if (tmpNode->txt == nullptr) { - FreeNode(tmpNode); - return; - } - if (memcpy_s(tmpNode->txt, len + 1, node->data_->txt, len) != EOK) { - FreeNode(tmpNode); - return; - } - tmpNode->txt[len] = '\0'; - tmpNode->imgInfo = nullptr; - - nodeList_.PushBack(tmpNode); - node = node->next_; - } -} - -UIView* MenuItemAdapter::GetView(UIView* inView, int16_t index) -{ - if (nodeList_.IsEmpty() || index > nodeList_.Size() - 1 || index < 0) { - return nullptr; - } - - ListNode* node = nodeList_.Begin(); - for (uint16_t i = 0; i < index; i++) { - node = node->next_; - } - UIMenuItem* item = nullptr; - if (inView == nullptr) { - item = new UIMenuItem(); - if (item == nullptr) { - return nullptr; - } - item->Resize(width_, height_); - item->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - item->SetImgResizeMode(UIImageView::ImageResizeMode::CENTER); - item->SetFont(fontName_, fontSize_); - item->SetAlign(TEXT_ALIGNMENT_CENTER); - item->SetScaleAlignMode(UIMenuItem::ScaleAlignMode::ALIGN_ITEM_CENTER); - item->SetLineBreakMode(UILabel::LineBreakMode::LINE_BREAK_MARQUEE); - } else { - item = static_cast(inView); - } - - if (item != nullptr) { - if (node->data_->imgInfo == nullptr) { - node->data_->imgInfo = ImageCacheManager::GetInstance().LoadOneInMultiRes(node->data_->resId, LIST_FPS); - } - item->SetImageSrc(node->data_->imgInfo); - item->SetText(node->data_->txt); - item->SetViewIndex(index); - } - return item; -} -} // namespace OHOS diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.h deleted file mode 100644 index f80c5cb75..000000000 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/menu_item_adapter.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 MENU_ITEM_ADAPTER_H -#define MENU_ITEM_ADAPTER_H -#include "menu_item_adapter.h" -#include "components/abstract_adapter.h" -#include "components/ui_image_view.h" -#include "gfx_utils/list.h" -#include "ui_test_list_fps/image_text_adapter.h" - -namespace OHOS { -class MenuItemAdapter : public AbstractAdapter { -public: - MenuItemAdapter() : imageWidth_(0), imageHeight_(0), width_(0), height_(0), fontName_(nullptr), fontSize_(0) {} - - ~MenuItemAdapter() override - { - if (fontName_ != nullptr) { - UIFree(fontName_); - fontName_ = nullptr; - } - ClearText(); - } - - void SetWidth(int16_t width) - { - width_ = width; - } - - void SetHeight(int16_t height) - { - height_ = height; - } - - void SetImageWidth(int16_t width) - { - imageWidth_ = width; - } - - void SetImageHeight(int16_t height) - { - imageHeight_ = height; - } - - UIView* GetView(UIView* inView, int16_t index) override; - uint16_t GetCount() override; - void SetData(const List* data); - void SetFont(const char* name, uint8_t size); - -private: - void ClearText(void); - void FreeNode(ItemNode* node); - List nodeList_; - uint16_t imageWidth_; - uint16_t imageHeight_; - uint16_t width_; - uint16_t height_; - char* fontName_; - uint8_t fontSize_; -}; -} // namespace OHOS -#endif // IMAGE_TEXT_ADAPTER_H diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/ui_test_list_ext.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/ui_test_list_ext.cpp deleted file mode 100644 index 873dae387..000000000 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/ui_test_list_ext.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * 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 "ui_test_list_ext.h" -#include "animator/animator_manager.h" -#include "common/screen.h" -#include "components/ui_label.h" -#include "components/ui_label_button.h" -#include "components/ui_image_view.h" -#include "core/render_manager.h" -#include "graphic_config.h" -#include "securec.h" -#include "ui_test_list_fps/ui_list_fps_res.h" - -namespace OHOS { -static const int16_t LIST_WIDTH = 454; -static const int16_t LIST_HEIGHT = 454; -static const int16_t SCROLL_STEP = 10; -static const uint16_t ITEM_WIDTH = 400; -static const uint16_t ITEM_HEIGHT = 100; -static const uint16_t IMAGE_WIDTH = 100; -static const uint16_t LIST_FONT_SIZE = 40; -static int16_t g_scrollStep = 10; -static int16_t g_scrollDistance = 0; -static int16_t g_scrollMax = 0; - -static ItemNode g_itemNode[] = { - {APPLIST_ALARM, "闹钟"}, - {BLUETOOTH_TITLE, "蓝牙"}, - {APPLIST_CALLER_IMAGE, "通话记录"}, - {APPLIST_COMPASS_IMAGE, "指南针"}, - {APPLIST_SETTING, "设置"}, - {APPLIST_SPO2, "血氧饱和度"}, - {APPLIST_VOCASSIST_IMAGE, "语音助手"}, - {APPLIST_ALARM, "长文本滚动测试ABCD"}, - {BLUETOOTH_TITLE, "蓝牙"}, - {APPLIST_CALLER_IMAGE, "通话记录"}, - {APPLIST_COMPASS_IMAGE, "指南针"}, - {APPLIST_SETTING, "设置"}, - {APPLIST_SPO2, "血氧饱和度"}, - {APPLIST_VOCASSIST_IMAGE, "语音助手"} -}; - -void UITestListExt::SetUp() -{ - if (data_ == nullptr) { - data_ = new List(); - if (data_ == nullptr) { - return; - } - for (uint8_t i = 0; i < (sizeof(g_itemNode) / sizeof(ItemNode)); ++i) { - data_->PushBack(&g_itemNode[i]); - } - } -} - -void UITestListExt::TearDown() -{ - if (animator_ != nullptr) { - animator_->Stop(); - delete animator_; - animator_ = nullptr; - } - - if (list_ != nullptr) { - list_->SetLoopState(false); - list_->SetAdapter(nullptr); - list_->RefreshList(); - delete list_; - list_ = nullptr; - } - - if (data_ != nullptr) { - data_->Clear(); - delete data_; - data_ = nullptr; - } - - if (adapter_ != nullptr) { - delete adapter_; - adapter_ = nullptr; - } -} - - -bool UITestListExt::TestList::OnPressEvent(const PressEvent& event) -{ - if (animator_ != nullptr) { - animator_->Stop(); - } - return UIList::OnPressEvent(event); -} - -bool UITestListExt::TestList::OnLongPressEvent(const LongPressEvent& event) -{ - if (animator_ != nullptr) { - animator_->Start(); - } - return true; -} - -void UITestListExt::TestList::SetAnimator(Animator* animator) -{ - animator_ = animator; -} - -void UITestListExt::ListExtFpsCallback::Callback(UIView* view) -{ - UIList* list = static_cast(view); - if (list != nullptr) { - if (g_scrollDistance <= 0) { - g_scrollStep = -1 * g_scrollStep; - g_scrollDistance = g_scrollMax; - } - list->ScrollBy(g_scrollStep); - g_scrollDistance -= abs(g_scrollStep); - } -} - -UIView* UITestListExt::GetTestView() -{ - UIListScrollTestFPS(); - return list_; -} - -void UITestListExt::UIListScrollTestFPS() -{ - g_scrollMax = (sizeof(g_itemNode) / sizeof(ItemNode)) * ITEM_HEIGHT - LIST_HEIGHT; - g_scrollDistance = g_scrollMax; - - adapter_ = new MenuItemAdapter(); - if (adapter_ == nullptr) { - TearDown(); - return; - } - adapter_->SetWidth(ITEM_WIDTH); - adapter_->SetHeight(ITEM_HEIGHT); - adapter_->SetImageWidth(IMAGE_WIDTH); - adapter_->SetImageHeight(ITEM_HEIGHT); - adapter_->SetFont(DEFAULT_VECTOR_FONT_FILENAME, LIST_FONT_SIZE); - adapter_->SetData(data_); - if (list_ == nullptr) { - list_ = new TestList(); - } - list_->SetPosition(0, 0, LIST_WIDTH, LIST_HEIGHT); - list_->SetAdapter(adapter_); - list_->SetScrollStateListener(this); - list_->SetThrowDrag(true); - list_->SetStyle(STYLE_BACKGROUND_OPA, OPA_TRANSPARENT); - list_->SetMaxScrollDistance(1000); // 1000: max scroll distance - list_->SetSwipeACCLevel(800); // 800: compensation distance - list_->SetDragACCLevel(5); // 5: drag acceleration - list_->SetYScrollBarVisible(true); - if (animator_ == nullptr) { - animator_ = new Animator(&callback_, list_, DEFAULT_TASK_PERIOD, true); - } - list_->SetAnimator(animator_); -} -} // namespace OHOS diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/ui_test_list_ext.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/ui_test_list_ext.h deleted file mode 100644 index 9ff2ec341..000000000 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_list_ext/ui_test_list_ext.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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_TEST_LIST_EXT_H -#define UI_TEST_LIST_EXT_H - -#include "ui_test_list_ext.h" -#include "components/ui_list_ext.h" -#include "menu_item_adapter.h" -#include "ui_test.h" -#include "gfx_utils/sys_info.h" - -namespace OHOS { -class UITestListExt : public UITest, UIView::OnClickListener, ListScrollListener { -public: - UITestListExt() : data_(nullptr), animator_(nullptr), list_(nullptr), adapter_(nullptr) {} - ~UITestListExt() override {} - void SetUp() override; - void TearDown() override; - UIView* GetTestView() override; - void UIListScrollTestFPS(); - -protected: - class ListExtFpsCallback : public AnimatorCallback { - public: - ListExtFpsCallback() {} - - ~ListExtFpsCallback() override {} - - void Callback(UIView* view) override; - }; - class TestList : public UIListExt { - public: - void SetAnimator(Animator* animator); - bool OnPressEvent(const PressEvent& event) override; - bool OnLongPressEvent(const LongPressEvent& event) override; - private: - Animator* animator_ = nullptr; - }; - Animator* animator_; - ListExtFpsCallback callback_; - TestList* list_; - -private: - List* data_; - MenuItemAdapter* adapter_; -}; -} // namespace OHOS -#endif // UI_TEST_LIST_FPS_H diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_roller_view/ui_test_roller_view.cpp b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_roller_view/ui_test_roller_view.cpp deleted file mode 100644 index c05ad0b60..000000000 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_roller_view/ui_test_roller_view.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) @CompanyNameMagicTag. 2024. All rights reserved. - */ - -#include "ui_test_roller_view.h" -#include "components/ui_roller_view.h" -#include "common/image_cache_manager.h" -#include "gfx_utils/image_info.h" - -namespace OHOS { - -struct RollerItemStruct { - const char* name; - const char* path; - ImageInfo* info; -}; - -static constexpr uint8_t ITEM_CNT = 6; -static RollerItemStruct g_rollerItems[ITEM_CNT] = { - {"planet", RES_PATH"/planet.bin", nullptr}, - {"kaleidoscope", RES_PATH"/kaleidoscope.bin", nullptr}, - {"rainbow", RES_PATH"/rainbow.bin", nullptr}, - {"kaleidoscope1", RES_PATH"/kaleidoscope.bin", nullptr}, - {"planet1", RES_PATH"/planet.bin", nullptr}, - {"rainbow1", RES_PATH"/rainbow.bin", nullptr}, -}; - -void UITestRollerView::CreateButton(UILabelButton*& button, const char* text, int16_t x, int16_t y) -{ - button = new UILabelButton(); - button->SetPosition(x, y, 100, 40); // 100: width, 40: height - button->SetText(text); - button->SetOnClickListener(this); - button->SetVisible(isBtnVisible_); - container_->Add(button); -} - -void UITestRollerView::SetUp() -{ - container_ = new UIViewGroup(); - container_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - container_->SetStyle(STYLE_BACKGROUND_OPA, OPA_OPAQUE); - container_->SetStyle(STYLE_BACKGROUND_COLOR, Color::Black().full); - - rollerView_ = new UIRollerView(); - rollerView_->SetPosition(0, 0, Screen::GetInstance().GetWidth(), Screen::GetInstance().GetHeight()); - rollerView_->SetItemSize(150, 150); // 150: item size - rollerView_->SetThrowDrag(true); - rollerView_->SetItemPadding(80); // 80: item padding - container_->Add(rollerView_); - - for (uint8_t i = 0; i < ITEM_CNT; i++) { - if (g_rollerItems[i].info == nullptr) { - g_rollerItems[i].info = ImageCacheManager::GetInstance().LoadSingleRes(g_rollerItems[i].path); - } - rollerView_->AddItem(g_rollerItems[i].name, g_rollerItems[i].info); - } - - rollerView_->SetCurrentItem("rainbow1", false); - rollerView_->SetOnClickListener(this); - rollerView_->SetOnModeChangeListener(this); - - CreateButton(removeCurrentBtn_, "remove", 60, 320); // 60, 320: x y - CreateButton(addBackBtn_, "add", 180, 320); // 180, 320: x y - CreateButton(clearBtn_, "clear", 300, 320); // 300, 320: x y - CreateButton(alignBtn_, "align", 60, 370); // 60, 370: x y - CreateButton(switchAnimBtn_, "switchAnim", 180, 370); // 180, 370: x y - CreateButton(switchBtn_, "switch", 300, 370); // 300, 370: x y -} - -void UITestRollerView::HideOrShowBtn() -{ - bool isVisible = (isBtnVisible_) ? false : true; - removeCurrentBtn_->SetVisible(isVisible); - addBackBtn_->SetVisible(isVisible); - clearBtn_->SetVisible(isVisible); - alignBtn_->SetVisible(isVisible); - switchAnimBtn_->SetVisible(isVisible); - switchBtn_->SetVisible(isVisible); - isBtnVisible_ = isVisible; -} -void UITestRollerView::OnModeChange(UIRollerView* view, RollerViewMode targetMode) -{ - printf("RollerView Change Mode to %d!\n", targetMode); -} - -bool UITestRollerView::OnClick(UIView& view, const ClickEvent& event) -{ - if (&view == rollerView_) { - if (event.GetCurrentPos().y > (view.GetY()+ view.GetHeight() - 50)) { // 50: offset - HideOrShowBtn(); - } else { - RollerViewMode mode = rollerView_->GetMode(); - RollerViewMode setMode = (mode == DISPLAY) ? COVER : DISPLAY; - rollerView_->SetMode(setMode, true); - } - } else if (&view == removeCurrentBtn_) { - rollerView_->RemoveItem(rollerView_->GetCurrentItemName()); - } else if (&view == addBackBtn_) { - for (uint8_t i = 0; i < ITEM_CNT; i++) { - if (g_rollerItems[i].info == nullptr) { - g_rollerItems[i].info = ImageCacheManager::GetInstance().LoadSingleRes(g_rollerItems[i].path); - } - rollerView_->AddItem(g_rollerItems[i].name, g_rollerItems[i].info); - } - } else if (&view == clearBtn_) { - rollerView_->ClearAll(); - } else if (&view == alignBtn_) { - printf("Align kaleidoscope."); - rollerView_->SetCurrentItem("kaleidoscope", true); - } else if (&view == switchBtn_) { - RollerViewMode mode = rollerView_->GetMode(); - RollerViewMode setMode = (mode == DISPLAY) ? COVER : DISPLAY; - rollerView_->SetMode(setMode, false); - } else if (&view == switchAnimBtn_) { - RollerViewMode mode = rollerView_->GetMode(); - RollerViewMode setMode = (mode == DISPLAY) ? COVER : DISPLAY; - rollerView_->SetMode(setMode, true); - } - return true; -} - -void UITestRollerView::TearDown() -{ - container_->Remove(rollerView_); - delete rollerView_; - rollerView_ = nullptr; - - DeleteChildren(container_); - removeCurrentBtn_ = nullptr; - addBackBtn_ = nullptr; - clearBtn_ = nullptr; - alignBtn_ = nullptr; - switchAnimBtn_ = nullptr; - switchBtn_ = nullptr; - container_ = nullptr; - - isBtnVisible_ = false; -} - -const UIView* UITestRollerView::GetTestView() -{ - return container_; -} -} diff --git a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_roller_view/ui_test_roller_view.h b/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_roller_view/ui_test_roller_view.h deleted file mode 100644 index cfcbf33a3..000000000 --- a/code/sdk/middleware/services/gui/uikit/sample/uitest/components/ui_test_roller_view/ui_test_roller_view.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) @CompanyNameMagicTag. 2024. All rights reserved. - */ - -#ifndef UI_TEST_ROLLER_VIEW_H -#define UI_TEST_ROLLER_VIEW_H - -#include "ui_test.h" -#include "components/ui_roller_view.h" -#include "components/ui_image_view.h" -#include "components/ui_label_button.h" - -namespace OHOS { -class UITestRollerView : public UITest, public UIView::OnClickListener, UIRollerView::OnModeChangeListener { -public: - UITestRollerView() {} - ~UITestRollerView() override {} - void SetUp() override; - void TearDown() override;; - const UIView* GetTestView() override; - bool OnClick(UIView& view, const ClickEvent& event) override; - void OnModeChange(UIRollerView* view, RollerViewMode targetMode) override; -private: - void CreateButton(UILabelButton*& button, const char* text, int16_t x, int16_t y); - void HideOrShowBtn(); - - UIViewGroup* container_ = nullptr; - UIRollerView* rollerView_ = nullptr; - - UILabelButton* removeCurrentBtn_ = nullptr; - UILabelButton* addBackBtn_ = nullptr; - UILabelButton* clearBtn_ = nullptr; - UILabelButton* alignBtn_ = nullptr; - UILabelButton* switchAnimBtn_ = nullptr; - UILabelButton* switchBtn_ = nullptr; - - bool isBtnVisible_ = false; -}; -} -#endif \ No newline at end of file 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 8491893bf..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 @@ -25,7 +25,6 @@ #include "ui_test_image_fps/ui_test_image_fps.h" #include "ui_test_key/ui_test_key.h" #include "ui_test_list/ui_test_list.h" -#include "ui_test_list_ext/ui_test_list_ext.h" #include "ui_test_qrcode/ui_test_qrcode.h" #if ENABLE_DEBUG && ENABLE_ROTATE_INPUT #include "ui_test_rotate_injector/ui_test_rotate_injector.h" @@ -79,7 +78,6 @@ #include "ui_test_map/ui_test_map.h" #include "ui_test_coverflow/ui_test_coverflow.h" #include "ui_test_kaleidoscope/ui_test_kaleidoscope.h" -#include "ui_test_roller_view/ui_test_roller_view.h" namespace OHOS { void UITestGroup::AddTestCase(TestCaseInfo testCaseInfo) @@ -102,7 +100,6 @@ void UITestGroup::SetUpTestCase() testCaseList_->PushBack(TestCaseInfo{"蜂窝表盘", new UITestHexagonsList()}); #endif testCaseList_->PushBack(TestCaseInfo{"滑动列表", new UITestListFPS()}); - testCaseList_->PushBack(TestCaseInfo{"缩放型滑动列表", new UITestListExt()}); testCaseList_->PushBack(TestCaseInfo{"扫秒", new UITestSweepClock()}); testCaseList_->PushBack(TestCaseInfo{"指南针", new UITestCompass()}); testCaseList_->PushBack(TestCaseInfo{"界面切换", new UITestClockDial()}); @@ -122,7 +119,6 @@ void UITestGroup::SetUpTestCase() #endif testCaseList_->PushBack(TestCaseInfo{"覆盖流", new UITestCoverflow()}); #endif - testCaseList_->PushBack(TestCaseInfo{"滚筒", new UITestRollerView()}); #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/components/ui_arc_label.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_arc_label.cpp index da9e2d9e5..b87f6366c 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_arc_label.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_arc_label.cpp @@ -19,7 +19,6 @@ #include "engines/gfx/gfx_engine_manager.h" #include "font/ui_font.h" #include "themes/theme_manager.h" -#include namespace OHOS { UIArcLabel::UIArcLabel() @@ -184,7 +183,7 @@ void UIArcLabel::MeasureArcTextInfo() return; } - float arcAngle; + uint16_t arcAngle; if (startAngle_ < endAngle_) { arcAngle = endAngle_ - startAngle_; arcTextInfo_.direct = TEXT_DIRECT_LTR; // Clockwise @@ -198,12 +197,7 @@ void UIArcLabel::MeasureArcTextInfo() float maxLength = static_cast((UI_PI * radius_ * arcAngle) / SEMICIRCLE_IN_DEGREE); arcTextInfo_.lineStart = 0; arcTextInfo_.lineEnd = TypedText::GetNextLine(&text[arcTextInfo_.lineStart], style_->letterSpace_, maxLength); - arcTextInfo_.startAngle = startAngle_; - if (arcTextInfo_.startAngle >= 360.0f) { - arcTextInfo_.startAngle -= floor(startAngle_ / 360.0f) * 360.0f; - } else if (arcTextInfo_.startAngle < 0.0f) { - arcTextInfo_.startAngle += ceil(-startAngle_ / 360.0f) * 360.0f; - } + arcTextInfo_.startAngle = startAngle_ % CIRCLE_IN_DEGREE; int16_t actLength = TypedText::GetTextWidth(&text[arcTextInfo_.lineStart], arcTextInfo_.lineEnd - arcTextInfo_.lineStart, style_->letterSpace_); if ((arcLabelText_->GetHorAlign() != TEXT_ALIGNMENT_LEFT) && (actLength < maxLength)) { diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_arc_scroll_bar.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_arc_scroll_bar.cpp index b332f5832..3e7d6fcd8 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_arc_scroll_bar.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_arc_scroll_bar.cpp @@ -92,7 +92,7 @@ void UIArcScrollBar::ClearPath() void UIArcScrollBar::DrawArcByHWPath(BufferInfo &dst, ArcInfo arc, uint8_t barLayer, const Rect &mask, uint16_t opa) { - if (!mask.IsValid() || mask.GetWidth() <= 0 || mask.GetHeight() <= 0) { + if (!mask.IsValid() || mask.GetHeight() <= 0 || mask.GetWidth() <= 0) { return; } uint32_t cmdNum; 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 d64c95439..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 @@ -13,7 +13,6 @@ * limitations under the License. */ -#include "hal_tick.h" #include "components/ui_label.h" #include "font/ui_font.h" #include "gfx_utils/graphic_log.h" @@ -25,8 +24,8 @@ public: LabelAnimator(uint16_t textX, uint16_t labelX, int16_t startPos, UIView* view) : Animator(this, view, 0, true), startPos_(startPos), - textWidth_(textX), - labelWidth_(labelX), + textX_(textX), + labelX_(labelX), offsetX_(startPos), waitCount_(ANIM_WAIT_COUNT), speed_(0), @@ -49,8 +48,8 @@ public: void UpdateWidth(uint16_t textWidth, uint16_t labelWidth) { - textWidth_ = textWidth; - labelWidth_ = labelWidth; + textX_ = textWidth; + labelX_ = labelWidth; waitCount_ = ANIM_WAIT_COUNT; preRunTime_ = 0; decimal_ = 0; @@ -60,33 +59,6 @@ public: } void Callback(UIView* view) override - { - switch (animatorMode_) { - case UILabel::LINE_BREAK_MARQUEE: - MarqueeCallback(view); - break; - case UILabel::LINE_BREAK_OSCILLATION: - OscillationCallback(view); - break; - default: - GRAPHIC_LOGE("erorr animation!"); - break; - } - } - - void SetAnimatorSpeed(uint16_t animSpeed) - { - speed_ = animSpeed; - decimal_ = 0; - } - - void SetAnimatorMode(UILabel::LineBreakMode mode) - { - animatorMode_ = mode; - } - -private: - void MarqueeCallback(UIView* view) { if (view == nullptr) { return; @@ -114,64 +86,27 @@ private: offsetX_ -= 1; // At lest move one pixel decimal_ = 0; } - offsetX_ = ((offsetX_ - labelWidth_) % (textWidth_ + labelWidth_)) + labelWidth_; + offsetX_ = ((offsetX_ - labelX_) % (textX_ + labelX_)) + labelX_; static_cast(view)->offsetX_ = offsetX_; view->Invalidate(); } - void OscillationCallback(UIView* view) + void SetAnimatorSpeed(uint16_t animSpeed) { - if (view == nullptr) { - return; - } - if (waitCount_ > 0) { - waitCount_--; - return; - } - if (startFlag_) { - startTime_ = HALTick::GetInstance().GetTime(); - startFlag_ = false; - } - - uint32_t time = HALTick::GetInstance().GetElapseTime(startTime_); - float x0 = startPos_; - float x1 = 1.0 * labelWidth_ - textWidth_; - float factor = 200000; // slow down the speed - float t = time * speed_ / factor; - float t1 = 1.0; - float period = 2.0; - while (t < 0) { - t += period; - } - while (t > period) { - t -= period; - } - float x = 0; - if (t >=0 && t < t1) { - x = (x1 - x0) * t / t1 + x0; - } else { - x = (x0 - x1) * (t - t1) / t1 + x1; - } - - UILabel *label = dynamic_cast(view); - if (label != nullptr) { - label->offsetX_ = MATH_ROUND(x); - label->Invalidate(); - } + speed_ = animSpeed; + decimal_ = 0; } +private: static constexpr uint8_t ANIM_WAIT_COUNT = 50; int16_t startPos_; - uint16_t textWidth_; - uint16_t labelWidth_; + uint16_t textX_; + uint16_t labelX_; int16_t offsetX_; uint16_t waitCount_; uint16_t speed_; uint32_t preRunTime_; - bool startFlag_ = true; - uint32_t startTime_ = 0; float decimal_; - UILabel::LineBreakMode animatorMode_ = UILabel::LINE_BREAK_MARQUEE; }; UILabel::UILabel() @@ -252,7 +187,7 @@ void UILabel::SetLineBreakMode(const uint8_t lineBreakMode) } lineBreakMode_ = lineBreakMode; if ((lineBreakMode_ == LINE_BREAK_ADAPT) || (lineBreakMode_ == LINE_BREAK_STRETCH) || - (lineBreakMode_ == LINE_BREAK_MARQUEE) || (lineBreakMode_ == LINE_BREAK_OSCILLATION)) { + (lineBreakMode_ == LINE_BREAK_MARQUEE)) { labelText_->SetExpandWidth(true); } else { labelText_->SetExpandWidth(false); @@ -262,7 +197,7 @@ void UILabel::SetLineBreakMode(const uint8_t lineBreakMode) } else { labelText_->SetExpandHeight(false); } - if (lineBreakMode_ != LINE_BREAK_MARQUEE && lineBreakMode_ != LINE_BREAK_OSCILLATION) { + if (lineBreakMode_ != LINE_BREAK_MARQUEE) { offsetX_ = 0; if (hasAnimator_) { animator_.animator->Stop(); @@ -374,10 +309,7 @@ void UILabel::ReMeasure() labelText_->ReMeasureTextWidthInEllipsisMode(GetContentRect(), style, ellipsisIndex_); break; case LINE_BREAK_MARQUEE: - RemeasureForAnimation(textSize.x, LINE_BREAK_MARQUEE); - break; - case LINE_BREAK_OSCILLATION: - RemeasureForAnimation(textSize.x, LINE_BREAK_OSCILLATION); + RemeasureForMarquee(textSize.x); break; default: break; @@ -387,7 +319,7 @@ void UILabel::ReMeasure() } } -void UILabel::RemeasureForAnimation(int16_t textWidth, LineBreakMode mode) +void UILabel::RemeasureForMarquee(int16_t textWidth) { int16_t rectWidth = GetWidth(); if (textWidth > rectWidth) { @@ -405,7 +337,6 @@ void UILabel::RemeasureForAnimation(int16_t textWidth, LineBreakMode mode) GRAPHIC_LOGE("new LabelAnimator fail"); return; } - animator->SetAnimatorMode(mode); animator->SetAnimatorSpeed(animator_.speed); animator_.animator = animator; hasAnimator_ = true; 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 35b3350ca..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 @@ -71,10 +71,6 @@ void UISwipeView::Remove(UIView* view) void UISwipeView::MoveHeadOrTailChild() { - if (childrenTail_ == childrenHead_) { - return; - } - if (loop_) { if (direction_ == HORIZONTAL) { while (childrenHead_->GetX() >= 0) { diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp index 5fd45f15b..23a1ee206 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/components/ui_view_group.cpp @@ -160,47 +160,6 @@ void UIViewGroup::RemoveAll() OnChildChanged(); } -void UIViewGroup::RemoveAndDeleteAllRecursively(UIViewGroup*& group) -{ - if (group == nullptr) { - GRAPHIC_LOGE("param group is nullptr !!"); - return; - } - - UIViewType type = group->GetViewType(); - if ((type == UI_DIGITAL_CLOCK) || (type == UI_PICKER) || (type == UI_TIME_PICKER) || (type == UI_MENU_ITEM) || - (type == UI_IMAGE_PICKER) || (type == UI_ROLLER_VIEW) || (type == UI_COVER_FLOW)) { - delete group; - group = nullptr; - return; - } - - if (type == UI_CROSS_VIEW) { - GRAPHIC_LOGE("Need to remove UICardPage in UICrossView manully !!"); - delete group; - group = nullptr; - return; - } - - UIView* node = group->GetChildrenHead(); - UIView* tmp = nullptr; - while (node != nullptr) { - tmp = node; - node = node->GetNextSibling(); -#if LOCAL_RENDER - RootView::GetInstance()->RemoveViewFromInvalidMap(tmp); -#endif - if (tmp->IsViewGroup()) { - UIViewGroup* tmpGroup = dynamic_cast(tmp); - RemoveAndDeleteAllRecursively(tmpGroup); - } else { - delete tmp; - } - } - delete group; - group = nullptr; -} - void UIViewGroup::GetTargetView(const Point& point, UIView** last) { if (last == nullptr) { diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_label.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_label.cpp index 888f92f90..9bdfdf865 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_label.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_label.cpp @@ -125,8 +125,8 @@ void DrawLabel::DrawArcText(BufferInfo& gfxDstBuffer, #if CAPABILITY_HWDRAW_LETTER_VECTOR LabelLetterInfo letterInfo{Point { MATH_ROUND(posX), MATH_ROUND(posY) }, mask, style.textColor_, opaScale, - 0, 0, letter, arcTextInfo.direct, fontId, 0, 0, nullptr, posX, posY }; - DrawUtils::GetInstance()->DrawArcLablePath(gfxDstBuffer, letterInfo, rotateAngle); + 0, 0, letter, arcTextInfo.direct, fontId, 0, 0, nullptr}; + DrawUtils::GetInstance()->DrawArcLablePath(gfxDstBuffer, letterInfo, static_cast(rotateAngle)); #else DrawLetterWithRotate(gfxDstBuffer, mask, fontId, letter, Point { MATH_ROUND(posX), MATH_ROUND(posY) }, static_cast(rotateAngle), style.textColor_, opaScale); diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.cpp b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.cpp index 943688dea..d56e28b99 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.cpp +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.cpp @@ -348,7 +348,7 @@ void DrawUtils::DrawLetterVectorPath(BufferInfo& gfxDstBuffer, const LabelLetter } void DrawUtils::DrawArcLablePath(BufferInfo& gfxDstBuffer, const LabelLetterInfo& letterInfo, - const float& rotateAngle) const + const int16_t& rotateAngle) const { UIFont* fontEngine = UIFont::GetInstance(); GlyphPathData path; @@ -366,25 +366,17 @@ void DrawUtils::DrawArcLablePath(BufferInfo& gfxDstBuffer, const LabelLetterInfo return; } - float x = letterInfo.x; - float y = letterInfo.y + head.ascender; + Rect rectLetter; + rectLetter.SetPosition(letterInfo.pos.x, letterInfo.pos.y + head.ascender); + rectLetter.Resize(path.width, path.height); + TransformMap transMap(rectLetter); + Vector2 pivot = {0, 0}; + Vector2 scale = {path.scale, path.scale}; + transMap.Scale(scale, pivot); + pivot.y_ = - head.ascender; + transMap.Rotate(rotateAngle, pivot); - Matrix4 mat; - Matrix4 rotate = Matrix4::Rotate(rotateAngle, - Vector3(x, y - head.ascender, 0), Vector3(x, y - head.ascender, 1)); - Matrix4 scale = Matrix4::Scale(Vector3(path.scale, path.scale, 1), Vector3(x, y, 0)); - mat = rotate * scale; - Matrix4 translateFromCamera = Matrix4::Translate(Vector3(-x, -y, 0)); - Matrix4 translateToCamera = Matrix4::Translate(Vector3(x, y, 0)); - Matrix4 perspectiveMatrix; - perspectiveMatrix[2][2] = 0.0f; - perspectiveMatrix[2][3] = -1.0f / 1000; // 1000: default camera distance - perspectiveMatrix = translateToCamera * (perspectiveMatrix * translateFromCamera); - - mat = perspectiveMatrix * mat; - mat = mat * translateToCamera; - - const float* srcMat = mat.GetData(); + const float* srcMat = transMap.GetTransformMatrix().GetData(); VGUMatrix3 matrix; if (memset_s(&matrix, sizeof(VGUMatrix3), 0, sizeof(VGUMatrix3)) != EOK) { GRAPHIC_LOGE("DrawLetter memset_s error\n"); diff --git a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.h b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.h index b548afe29..d3175abdc 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.h +++ b/code/sdk/middleware/services/gui/uikit/ui/frameworks/draw/draw_utils.h @@ -91,9 +91,6 @@ struct LabelLetterInfo { uint8_t shapingId; uint8_t fontSize; TransformMap* transMap; - - float x; - float y; }; struct TransformInitState { @@ -307,7 +304,7 @@ public: const OpacityType& opa) const; #if CAPABILITY_HWDRAW_LETTER_VECTOR void DrawArcLablePath(BufferInfo& gfxDstBuffer, const LabelLetterInfo& letterInfo, - const float& rotateAngle) const; + const int16_t& rotateAngle) const; #endif private: using DrawTriangleTransformFuc = void (*)(const TriangleScanInfo& triangle, const ColorMode bufferMode); 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 87fcdeb34..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 @@ -201,17 +201,6 @@ public: onKeyActListener_ = nullptr; } - /** - * @brief Get the listener for monitoring physical key events. - * - * @since 1.0 - * @version 1.0 - */ - OnKeyActListener* GetOnKeyActListener() - { - return onKeyActListener_; - } - /** * @brief Listens for the input events triggered by a virtual device other than * human touching or physical pressing. diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_arc_label.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_arc_label.h index eb095a4f7..2a8e6710d 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_arc_label.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_arc_label.h @@ -277,7 +277,7 @@ public: * @since 1.0 * @version 1.0 */ - void SetArcTextAngle(float startAngle, float endAngle) + void SetArcTextAngle(int16_t startAngle, int16_t endAngle) { if ((startAngle_ != startAngle) || (endAngle_ != endAngle)) { startAngle_ = startAngle; @@ -293,7 +293,7 @@ public: * @since 1.0 * @version 1.0 */ - float GetArcTextStartAngle() const + int16_t GetArcTextStartAngle() const { return startAngle_; } @@ -305,7 +305,7 @@ public: * @since 1.0 * @version 1.0 */ - float GetArcTextEndAngle() const + int16_t GetArcTextEndAngle() const { return endAngle_; } @@ -383,8 +383,8 @@ private: bool needRefresh_; Point textSize_; uint16_t radius_; - float startAngle_; - float endAngle_; + int16_t startAngle_; + int16_t endAngle_; Point arcCenter_; TextOrientation orientation_; diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_label.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_label.h index 59dac9ddc..30f0223da 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_label.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_label.h @@ -76,11 +76,6 @@ public: * If this text is too long, it will be rolled to display. */ LINE_BREAK_MARQUEE, - /** - * The width and height of this label remain unchanged. - * If this text is too long, it will be scrolled back and forth to display. - */ - LINE_BREAK_OSCILLATION, /** * The width and height of this label remain unchanged. * If this text is too long, it will be cropped to display. @@ -424,7 +419,7 @@ protected: private: friend class LabelAnimator; - void RemeasureForAnimation(int16_t textWidth, LineBreakMode mode = LINE_BREAK_MARQUEE); + void RemeasureForMarquee(int16_t textWidth); bool needRefresh_ : 1; bool useTextColor_ : 1; 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 c97493d4a..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 @@ -111,14 +111,12 @@ enum UIViewType : uint8_t { #endif UI_MENU_ITEM, UI_CARD_PAGE, - UI_COVER_FLOW, UI_CROSS_VIEW, UI_BARCODE, UI_MAP_VIEW, UI_KALEIDOSCOPE_VIEW, UI_ROLLER_VIEW, UI_HEXAGONS_LIST, - UI_IMAGE_PICKER, UI_ICOSAHEDRON_VIEW, UI_NUMBER_MAX }; diff --git a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view_group.h b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view_group.h index c05695b89..ea5c8e92b 100755 --- a/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view_group.h +++ b/code/sdk/middleware/services/gui/uikit/ui/interfaces/kits/components/ui_view_group.h @@ -114,18 +114,6 @@ public: */ virtual void RemoveAll(); - /** - * @brief Removes and delete all child views recursively. this method have some limitation: - * 1. Some UI group views delete children in their destructor function, don't delete them repeatly in this - * function in this situation. some special treatment has already been done for below basic UI group views: - * UIPicker UITimePicker UIImagePicker UIDigitalClock UIRollerView UICoverFlow UIMenuItem - * However, the custom UI group views was ignored in this function, so be carefully when using this method. - * 2. Not all children in UICrossView are deleted in this method, you should remove UICardPages in addtion. - * @since 1.0 - * @version 1.0 - */ - static void RemoveAndDeleteAllRecursively(UIViewGroup*& group); - /** * @brief Obtains the target child view that is visible and can respond to touch events based on given coordinates. * diff --git a/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/input_event_info.h b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/input_event_info.h index e3c304e32..19b1f640e 100755 --- a/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/input_event_info.h +++ b/code/sdk/middleware/services/gui/uikit/utils/interfaces/kits/gfx_utils/input_event_info.h @@ -49,10 +49,10 @@ struct RawEvent { uint16_t state; #endif }; - uint16_t keyId; /* key type device use this param for touched key id */ #if ENABLE_ROTATE_INPUT int16_t rotate; /* rotate type device used this param for rotate */ #endif + uint16_t keyId; /* key type device use this param for touched key id */ }; #ifdef VERSION_IOT uint16_t state; diff --git a/code/sdk/middleware/services/media/foundation/audio_capturer/CMakeLists.txt b/code/sdk/middleware/services/media/foundation/audio_capturer/CMakeLists.txt index 9721edaa5..2d9104a46 100755 --- a/code/sdk/middleware/services/media/foundation/audio_capturer/CMakeLists.txt +++ b/code/sdk/middleware/services/media/foundation/audio_capturer/CMakeLists.txt @@ -14,4 +14,4 @@ ]] add_subdirectory(frameworks f) -add_subdirectory(interfaces/kits/audio_capturer_lite js_buildin) +add_subdirectory(interfaces/kits/audio_captuer_lite js_buildin) diff --git a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/CMakeLists.txt b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_captuer_lite/CMakeLists.txt old mode 100644 new mode 100755 similarity index 98% rename from code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/CMakeLists.txt rename to code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_captuer_lite/CMakeLists.txt index 0a75a5887..5762a7676 --- a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/CMakeLists.txt +++ b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_captuer_lite/CMakeLists.txt @@ -5,7 +5,7 @@ enable_language(CXX) -set(COMPONENT_NAME "js_audio_capturer") +set(COMPONENT_NAME "js_audio_captuer") set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/recording_module.cpp diff --git a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_captuer_lite/recording_module.cpp old mode 100644 new mode 100755 similarity index 93% rename from code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp rename to code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_captuer_lite/recording_module.cpp index a7c012aeb..18bf34101 --- a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.cpp +++ b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_captuer_lite/recording_module.cpp @@ -328,7 +328,7 @@ static int32_t ActivateAudioInterrupt(AudioSession &sessionId) } MEDIA_INFO_LOG("sessionId:%d", sessionId); g_captureInterruptListener = std::make_shared(); - g_sample.interrupt = { AUDIO_STREAM_VOICE_ASSISTANT, sessionId, g_captureInterruptListener }; + g_sample.interrupt = { AUDIO_STREAM_VOICE_RECORD, sessionId, g_captureInterruptListener }; if (g_amInstance.ActivateAudioInterrupt(g_sample.interrupt) == INTERRUPT_FAILED) { MEDIA_ERR_LOG("ActivateAudioInterrupt failed"); @@ -419,7 +419,7 @@ int32_t AudioCaptureStart_sample(int32_t argc, const char **argv) audioCapturerInfo.sessionID = sessionId; audioCapturerInfo.inputSource = AUDIO_MIC; - audioCapturerInfo.streamType = AUDIO_STREAM_VOICE_ASSISTANT; + audioCapturerInfo.streamType = AUDIO_STREAM_VOICE_RECORD; ret = AudioCaptureSetInfo(audioCapturerInfo); if (ret != 0) { g_audioCap.reset(); @@ -456,22 +456,22 @@ int32_t AudioCaptureStart_sample(int32_t argc, const char **argv) namespace OHOS { namespace ACELite { -JSIValue AudioCapturerModule::Start(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +JSIValue AudioCaptuerModule::Start(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) { const char *pars[6] = {"","","16000","1","16","/user/log/xiaodu/xiaodu.pcm"}; return JSI::CreateBoolean(AudioCaptureStart_sample(6,pars)); } -JSIValue AudioCapturerModule::Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) +JSIValue AudioCaptuerModule::Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize) { g_sample.needStop = true; return JSI::CreateBoolean(0); } -void InitAudioCapturerModule(JSIValue exports) +void InitAudioCaptuerModule(JSIValue exports) { - JSI::SetModuleAPI(exports, "Start", AudioCapturerModule::Start); - JSI::SetModuleAPI(exports, "Stop", AudioCapturerModule::Stop); + JSI::SetModuleAPI(exports, "Start", AudioCaptuerModule::Start); + JSI::SetModuleAPI(exports, "Stop", AudioCaptuerModule::Stop); } } diff --git a/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_captuer_lite/recording_module.h old mode 100644 new mode 100755 similarity index 77% rename from code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h rename to code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_captuer_lite/recording_module.h index e720e60a3..a0ab93c3b --- a/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h +++ b/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_captuer_lite/recording_module.h @@ -25,17 +25,17 @@ int32_t AudioCaptureSample(int32_t argc, const char *argv[]); namespace OHOS { namespace ACELite { -class AudioCapturerModule final : public MemoryHeap { +class AudioCaptuerModule final : public MemoryHeap { public: /** * constructor */ - AudioCapturerModule() = default; + AudioCaptuerModule() = default; /** * desconstructor */ - ~AudioCapturerModule() = default; + ~AudioCaptuerModule() = default; /** * Start */ @@ -47,7 +47,7 @@ public: static JSIValue Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); }; -void InitAudioCapturerModule(JSIValue exports); +void InitAudioCaptuerModule(JSIValue exports); } } 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 749c4593d..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 @@ -158,16 +158,4 @@ int32_t AudioManager::DumpInfo(AudioManagerDebugInfo &audioManagerInfo) CHK_NULL_RETURN(impl_, AUDIO_ERROR, "impl_ is nullptr"); return impl_->DumpInfo(audioManagerInfo); } - -int32_t AudioManager::SetParam(AudioLinkDirection direction, const char *param, uint32_t len) -{ - CHK_NULL_RETURN(impl_, AUDIO_ERROR, "impl_ is nullptr"); - return impl_->SetParam(direction, param, len); -} - -int32_t AudioManager::GetParam(AudioLinkDirection direction, char *param, uint32_t len) -{ - CHK_NULL_RETURN(impl_, AUDIO_ERROR, "impl_ is nullptr"); - return impl_->GetParam(direction, param, len); -} } // namespace Audio diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager_impl.cpp b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager_impl.cpp index ac5f3362e..bcf6fa4f2 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager_impl.cpp +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager_impl.cpp @@ -248,14 +248,4 @@ int32_t AudioManager::AudioManagerImpl::DumpInfo(AudioManagerDebugInfo &audioMan } return AUDIO_SUCCESS; } - -int32_t AudioManager::AudioManagerImpl::SetParam(AudioLinkDirection direction, const char *param, uint32_t len) -{ - return AudioServiceSetParam(direction, param, len); -} - -int32_t AudioManager::AudioManagerImpl::GetParam(AudioLinkDirection direction, char *param, uint32_t len) -{ - return AudioServiceGetParam(direction, param, len); -} } // namespace Audio diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager_impl.h b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager_impl.h index 2a6dc4cf8..edeb3e669 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager_impl.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiomanager/cpp/audio_manager_impl.h @@ -38,8 +38,7 @@ public: int32_t ActivateAudioInterrupt(AudioInterrupt &interrupt); int32_t DeactivateAudioInterrupt(AudioInterrupt &interrupt); int32_t DumpInfo(AudioManagerDebugInfo &audioManagerInfo); - int32_t SetParam(AudioLinkDirection direction, const char *param, uint32_t len); - int32_t GetParam(AudioLinkDirection direction, char *param, uint32_t len); + private: static void InterruptListenerImpl(uintptr_t owner, uintptr_t userData, int32_t type, int32_t hint); int32_t ConvertIAudioInterrupt(AudioInterrupt &interrupt, AudioInterruptProxy &interruptInternal); diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/include/audio_service.h b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/include/audio_service.h index a6b987a26..b432a7652 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/include/audio_service.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/include/audio_service.h @@ -319,10 +319,6 @@ typedef int32_t (*AudioServiceHaidEventCallback)(int32_t eventType, void *param, int32_t AudioServiceRegCallBack(AudioServiceHaidEventCallback callBack, void *context); -int32_t AudioServiceSetParam(AudioLinkDirection direction, const char *param, uint32_t len); - -int32_t AudioServiceGetParam(AudioLinkDirection direction, char *param, uint32_t len); - #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c index 4afc7dec8..154a2c4ed 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/audio_service.c @@ -357,28 +357,6 @@ int32_t AudioServiceRegCallBack(AudioServiceHaidEventCallback callBack, void *co return ret; } -int32_t AudioServiceSetParam(AudioLinkDirection direction, const char *param, uint32_t len) -{ - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); - CHK_NULL_RETURN(param, AUDIO_INVALID_PARAMS, "param is NULL"); - int32_t ret = StreamManagerSetParam(direction, param, len); - if (ret != AUDIO_SUCCESS) { - ALOGE("Audio Service set param failed!"); - } - return ret; -} - -int32_t AudioServiceGetParam(AudioLinkDirection direction, char *param, uint32_t len) -{ - CHK_FAILED_RETURN(g_audioSVCInited, true, AUDIO_NO_INIT, "Audio Service not init"); - CHK_NULL_RETURN(param, AUDIO_INVALID_PARAMS, "param is NULL"); - int32_t ret = StreamManagerGetParam(direction, param, len); - if (ret != AUDIO_SUCCESS) { - ALOGE("Audio Service get param failed!"); - } - return ret; -} - #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c index af22a8ca3..577a24214 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/devicemanager/src/device_hal.c @@ -43,7 +43,6 @@ typedef struct { static StreamTypeMap g_mapStreamType[] = { { AUDIO_STREAM_MUSIC, AUDIO_IN_MEDIA }, { AUDIO_STREAM_NOTIFICATION, AUDIO_IN_MEDIA }, - { AUDIO_STREAM_VOICE_ASSISTANT, AUDIO_IN_MEDIA }, { AUDIO_STREAM_VOICE_RECORD, AUDIO_IN_MEDIA }, { AUDIO_STREAM_A2DP_MUSIC, AUDIO_IN_MEDIA }, { AUDIO_STREAM_VOICE_CALL, AUDIO_IN_COMMUNICATION }, diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/brandy/policy_default_config.h b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/brandy/policy_default_config.h index e3ea34fb0..d825cbeab 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/brandy/policy_default_config.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/brandy/policy_default_config.h @@ -241,12 +241,12 @@ static AudioStrategy g_defaultPriorityToStrategies[][OUTPUT_STRATEGY_MAP_COLUMN_ {STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_NONE, STRATEGY_REJECT, STRATEGY_MIX, STRATEGY_REJECT, STRATEGY_MIX, STRATEGY_MIX, STRATEGY_DELAY, STRATEGY_DELAY}, {STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_NONE, - STRATEGY_MIX, STRATEGY_REJECT, STRATEGY_MIX, STRATEGY_MIX, STRATEGY_MIX, STRATEGY_MIX}, + STRATEGY_MIX, STRATEGY_REJECT, STRATEGY_MIX, STRATEGY_MIX, STRATEGY_DELAY, STRATEGY_DELAY}, {STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_NONE, STRATEGY_REJECT, STRATEGY_MIX, STRATEGY_MIX, STRATEGY_REJECT, STRATEGY_DELAY}, {STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_NONE, STRATEGY_MIX, STRATEGY_MIX, STRATEGY_REJECT, STRATEGY_DELAY}, - {STRATEGY_EXCLUSIVE, STRATEGY_MIX, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, + {STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_MIX, STRATEGY_NONE, STRATEGY_MIX, STRATEGY_MIX, STRATEGY_MIX}, {STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_EXCLUSIVE, STRATEGY_MIX, STRATEGY_MIX, STRATEGY_NONE, STRATEGY_MIX, STRATEGY_MIX}, diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/hifi_clock_freq_manager.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/hifi_clock_freq_manager.c index 748384589..889f7550c 100644 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/hifi_clock_freq_manager.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/policymanager/src/hifi_clock_freq_manager.c @@ -159,11 +159,6 @@ static HifiClockFreqContext g_hifiClockFreqList[] = { .deviceType = IN_BUILTIN_MIC, .hifiMode = HIFI_LPM_CLK_LEVEL1, }, - { - .streamType = AUDIO_STREAM_VOICE_ASSISTANT, - .deviceType = IN_BUILTIN_MIC, - .hifiMode = HIFI_LPM_CLK_LEVEL2, - }, { .streamType = AUDIO_STREAM_A2DP_MUSIC, .deviceType = OUT_BUILTIN_SPEAKER, diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/source_handle.h b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/source_handle.h index 339a93ccd..9328a7e96 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/source_handle.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/source_handle.h @@ -171,8 +171,6 @@ StreamDebugInfo DumpSourceInfo(uintptr_t handle); int32_t SetSourceParam(uintptr_t handle, const char *keyValueList, size_t len); -int32_t GetSourceParam(uintptr_t handle, char *keyValueList, size_t len); - #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/stream_manager.h b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/stream_manager.h index 0f5f1fe26..ca3c2827d 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/stream_manager.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/stream_manager.h @@ -181,10 +181,6 @@ int32_t StreamMgrDumpInfo(AudioStreamDebugInfo *audioStreamInfo); int32_t StreamManagerDeactivateCorrespondingStream(AudioSession sessionID, AudioStreamType streamType); -int32_t StreamManagerSetParam(AudioLinkDirection direction, const char *param, uint32_t len); - -int32_t StreamManagerGetParam(AudioLinkDirection direction, char *param, uint32_t len); - #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/track_handle.h b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/track_handle.h index d3d24f282..854c5ca81 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/track_handle.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/include/track_handle.h @@ -228,8 +228,6 @@ StreamDebugInfo DumpTrackInfo(uintptr_t handle); int32_t SetTrackParam(uintptr_t handle, const char *keyValueList, size_t len); -int32_t GetTrackParam(uintptr_t handle, char *keyValueList, size_t len); - int32_t DeactivateCorrespondingTrack(uintptr_t handle); #ifdef __cplusplus diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/source_handle.c b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/source_handle.c index 4d5b0bf36..109c3a1b3 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/source_handle.c +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audioservice/src/streammanager/src/source_handle.c @@ -429,20 +429,3 @@ int32_t SetSourceParam(uintptr_t handle, const char *keyValueList, size_t len) } return AUDIO_SUCCESS; } - -int32_t GetSourceParam(uintptr_t handle, char *keyValueList, size_t len) -{ - SourceHandleContext *context = (SourceHandleContext *)handle; - CHK_NULL_RETURN(context, AUDIO_ERROR, "source handle is NULL"); - CHK_NULL_RETURN(keyValueList, AUDIO_ERROR, "keyValueList is NULL"); - if (context->capture == NULL) { - ALOGE("not create capture"); - return AUDIO_ERROR; - } - int32_t ret = context->capture->attr.GetExtraParams((AudioHandle)context->capture, keyValueList, (int32_t)len); - if (ret != AUDIO_SUCCESS) { - ALOGE("call get extra params failed "); - return AUDIO_ERROR; - } - return AUDIO_SUCCESS; -} \ No newline at end of file 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 5ce62d53f..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 @@ -1187,150 +1187,6 @@ int32_t StreamManagerDeactivateCorrespondingStream(AudioSession sessionID, Audio return ret; } -static int32_t GetStreamOutParamValue(char *param, uint32_t len) -{ - bool isFound = false; - for (uint32_t i = 0; i < CONCURRENT_ACTIVE_STREAM_MAX_NUM; i++) { - if (!IsValidStream(g_streamMgrContext.simpleInfos[i].streamId, - g_streamMgrContext.simpleInfos[i].active)) { - continue; - } - uint32_t deviceId = GetStreamDeviceId(g_streamMgrContext.simpleInfos[i].streamHandle); - if (deviceId == OUT_BLUETOOTH_SCO) { - continue; - } - isFound = true; - uintptr_t streamHandle = g_streamMgrContext.simpleInfos[i].streamHandle; - int32_t ret = GetTrackParam(streamHandle, param, len); - if (ret != AUDIO_SUCCESS) { - ALOGE("get track param failed, ret:%d.", ret); - return AUDIO_ERROR; - } - } - if (!isFound) { - ALOGI("not find match out stream!"); - return AUDIO_ERROR; - } - return AUDIO_SUCCESS; -} - -static int32_t SetStreamOutParamValue(const char *param, uint32_t len) -{ - bool isFound = false; - for (uint32_t i = 0; i < CONCURRENT_ACTIVE_STREAM_MAX_NUM; i++) { - if (!IsValidStream(g_streamMgrContext.simpleInfos[i].streamId, - g_streamMgrContext.simpleInfos[i].active)) { - continue; - } - uint32_t deviceId = GetStreamDeviceId(g_streamMgrContext.simpleInfos[i].streamHandle); - if (deviceId == OUT_BLUETOOTH_SCO) { - continue; - } - isFound = true; - uintptr_t streamHandle = g_streamMgrContext.simpleInfos[i].streamHandle; - int32_t ret = SetTrackParam(streamHandle, param, len); - if (ret != AUDIO_SUCCESS) { - ALOGE("set track param failed, ret:%d.", ret); - return AUDIO_ERROR; - } - } - if (!isFound) { - ALOGE("not find match out stream!"); - return AUDIO_ERROR; - } - return AUDIO_SUCCESS; -} - -static int32_t GetStreamInParamValue(char *param, uint32_t len) -{ - bool isFound = false; - for (uint32_t i = 0; i < MAX_STREAM_IN_NUM; i++) { - StreamSimpleInfo curStreamInfo = g_streamMgrContext.curInputStreamInfo[i]; - if (!IsValidStream(curStreamInfo.streamId, curStreamInfo.active)) { - continue; - } - uint32_t deviceId = GetSourceDeviceId(curStreamInfo.streamHandle); - if (deviceId == IN_BLUETOOTH_SCO) { - continue; - } - isFound = true; - int32_t ret = GetSourceParam(curStreamInfo.streamHandle, param, len); - if (ret != AUDIO_SUCCESS) { - ALOGE("get source param failed, ret:%d.", ret); - return AUDIO_ERROR; - } - } - if (!isFound) { - ALOGE("not find match in stream!"); - return AUDIO_ERROR; - } - return AUDIO_SUCCESS; -} - -static int32_t SetStreamInParamValue(const char *param, uint32_t len) -{ - bool isFound = false; - for (uint32_t i = 0; i < MAX_STREAM_IN_NUM; i++) { - StreamSimpleInfo curStreamInfo = g_streamMgrContext.curInputStreamInfo[i]; - if (!IsValidStream(curStreamInfo.streamId, curStreamInfo.active)) { - continue; - } - uint32_t deviceId = GetSourceDeviceId(curStreamInfo.streamHandle); - if (deviceId == IN_BLUETOOTH_SCO) { - continue; - } - isFound = true; - int32_t ret = SetSourceParam(curStreamInfo.streamHandle, param, len); - if (ret != AUDIO_SUCCESS) { - ALOGE("set source param failed, ret:%d.", ret); - return AUDIO_ERROR; - } - } - if (!isFound) { - ALOGE("not find match in stream!"); - return AUDIO_ERROR; - } - return AUDIO_SUCCESS; -} - -int32_t StreamManagerSetParam(AudioLinkDirection direction, const char *param, uint32_t len) -{ - int32_t ret = AUDIO_SUCCESS; - MediaMutexLock(g_mutex); - switch (direction) { - case AUDIO_DOWN_LINK: - ret = SetStreamOutParamValue(param, len); - break; - case AUDIO_UP_LINK: - ret = SetStreamInParamValue(param, len); - break; - default: - ALOGI("not find match direction!"); - return AUDIO_ERROR; - } - MediaMutexUnLock(g_mutex); - return ret; -} - -int32_t StreamManagerGetParam(AudioLinkDirection direction, char *param, uint32_t len) -{ - int32_t ret = AUDIO_SUCCESS; - MediaMutexLock(g_mutex); - switch (direction) { - case AUDIO_DOWN_LINK: - ret = GetStreamOutParamValue(param, len); - break; - case AUDIO_UP_LINK: - ret = GetStreamInParamValue(param, len); - break; - default: - ALOGE("not find match direction!"); - return AUDIO_ERROR; - } - MediaMutexUnLock(g_mutex); - return ret; -} - #ifdef __cplusplus #if __cplusplus } 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 8f0729494..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 @@ -135,7 +135,6 @@ static bool CheckRenderValid(const struct AudioRender *render) CHK_NULL_RETURN(render->attr.GetCurrentChannelId, false, "render attr GetCurrentChannelId is NULL"); CHK_NULL_RETURN(render->attr.SetExtraParams, false, "render attr SetExtraParams is NULL"); - CHK_NULL_RETURN(render->attr.GetExtraParams, false, "render attr GetExtraParams is NULL"); CHK_NULL_RETURN(render->scene.SelectScene, false, "render scene SelectScene is NULL"); @@ -947,25 +946,6 @@ int32_t SetTrackParam(uintptr_t handle, const char *keyValueList, size_t len) return AUDIO_SUCCESS; } -int32_t GetTrackParam(uintptr_t handle, char *keyValueList, size_t len) -{ - TrackHandleContext *context = (TrackHandleContext *)handle; - CHK_NULL_RETURN(context, AUDIO_ERROR, "TrackHandleContext *context is NULL"); - CHK_NULL_RETURN(keyValueList, AUDIO_ERROR, "TrackHandleContext *keyValueList is NULL"); - if (len == 0) { - ALOGE("len invalid "); - return AUDIO_ERROR; - } - if (context->render != NULL) { - int32_t ret = context->render->attr.GetExtraParams((AudioHandle)context->render, keyValueList, (int32_t)len); - if (ret != AUDIO_SUCCESS) { - ALOGE("get extra data failed! ret = %d", ret); - return ret; - } - } - return AUDIO_SUCCESS; -} - int32_t DeactivateCorrespondingTrack(uintptr_t handle) { TrackHandleContext *context = (TrackHandleContext *)handle; diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/include/cpp/audio_stream_in.h b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/include/cpp/audio_stream_in.h index 8565658c8..f588c33ed 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/include/cpp/audio_stream_in.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/include/cpp/audio_stream_in.h @@ -35,8 +35,7 @@ public: int32_t SetInputDevice(int32_t deviceId, AudioRendererConfig &renderConfig) const; int32_t ObtainBuffer(CapturerBuffer &buffer, bool isBlocking) const; int32_t Release() const; - int32_t SetParam(const char *keyValueList, int32_t len) const; - int32_t GetParam(char *keyValueList, int32_t len); + private: uintptr_t streamHandle_; void *mutex; diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/include/cpp/audio_stream_out.h b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/include/cpp/audio_stream_out.h index 9cf4c4be1..8fe796489 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/include/cpp/audio_stream_out.h +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/include/cpp/audio_stream_out.h @@ -39,8 +39,8 @@ public: int32_t GetBufferFrameSize() const; int32_t GetBufferUnderflowTimes() const; // del DFX StreamDebugInfo DumpInfo() const; - int32_t SetParam(const char *keyValueList, int32_t len) const; - int32_t GetParam(char *keyValueList, int32_t len); + int32_t SetParam(std::string &keyValueList) const; + private: uintptr_t streamHandle_; void *mutex; diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/src/cpp/audio_stream_in.cpp b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/src/cpp/audio_stream_in.cpp index 02cee7f51..874d15c3e 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/src/cpp/audio_stream_in.cpp +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/src/cpp/audio_stream_in.cpp @@ -161,30 +161,4 @@ int32_t AudioStreamIn::Release() const MediaMutexUnLock(mutex); return AUDIO_SUCCESS; } - -int32_t AudioStreamIn::SetParam(const char *keyValueList, int32_t len) const -{ - MediaMutexLock(mutex); - int32_t ret = SetSourceParam(streamHandle_, keyValueList, len); - if (ret != AUDIO_SUCCESS) { - ALOGE("AudioStreamIn::SetParam call SetSourceParam failed, ret:%d.", ret); - MediaMutexUnLock(mutex); - return AUDIO_ERROR; - } - MediaMutexUnLock(mutex); - return AUDIO_SUCCESS; -} - -int32_t AudioStreamIn::GetParam(char *keyValueList, int32_t len) -{ - MediaMutexLock(mutex); - int32_t ret = GetSourceParam(streamHandle_, keyValueList, len); - if (ret != AUDIO_SUCCESS) { - ALOGE("AudioStreamIn::GetParam call GetSourceParam failed, ret:%d.", ret); - MediaMutexUnLock(mutex); - return AUDIO_ERROR; - } - MediaMutexUnLock(mutex); - return AUDIO_SUCCESS; -} } diff --git a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/src/cpp/audio_stream_out.cpp b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/src/cpp/audio_stream_out.cpp index 459318375..d53d4e70a 100755 --- a/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/src/cpp/audio_stream_out.cpp +++ b/code/sdk/middleware/services/media/foundation/audiomanager/frameworks/audiostream/src/cpp/audio_stream_out.cpp @@ -132,7 +132,7 @@ int32_t AudioStreamOut::Release() const } int32_t AudioStreamOut::StreamWrite(const uint8_t *buffer, uint64_t userSize, uint64_t &writtenSize, - AudioRendererConfig &renderConfig) const + AudioRendererConfig &renderConfig) const { MediaMutexLock(mutex); int32_t ret = StreamWriteTrack(streamHandle_, buffer, userSize, &writtenSize); @@ -281,10 +281,12 @@ StreamDebugInfo AudioStreamOut::DumpInfo() const return info; } -int32_t AudioStreamOut::SetParam(const char *keyValueList, int32_t len) const +int32_t AudioStreamOut::SetParam(std::string &keyValueList) const { MediaMutexLock(mutex); - int32_t ret = SetTrackParam(streamHandle_, keyValueList, len); + size_t len = keyValueList.size(); + const char *keyValueStr = keyValueList.c_str(); + int32_t ret = SetTrackParam(streamHandle_, keyValueStr, len); if (ret != AUDIO_SUCCESS) { ALOGE("AudioStreamOut::SetParam call SetTrackParam failed, ret:%d.", ret); MediaMutexUnLock(mutex); @@ -293,17 +295,4 @@ int32_t AudioStreamOut::SetParam(const char *keyValueList, int32_t len) const MediaMutexUnLock(mutex); return AUDIO_SUCCESS; } - -int32_t AudioStreamOut::GetParam(char *keyValueList, int32_t len) -{ - MediaMutexLock(mutex); - int32_t ret = GetTrackParam(streamHandle_, keyValueList, len); - if (ret != AUDIO_SUCCESS) { - ALOGE("AudioStreamOut::GetParam call GetTrackParam failed, ret:%d.", ret); - MediaMutexUnLock(mutex); - return AUDIO_ERROR; - } - MediaMutexUnLock(mutex); - return AUDIO_SUCCESS; -} } 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 0219c6608..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 @@ -331,10 +331,6 @@ public: int32_t DumpInfo(AudioManagerDebugInfo &audioManagerInfo); - int32_t SetParam(AudioLinkDirection direction, const char *param, uint32_t len); - - int32_t GetParam(AudioLinkDirection direction, char *param, uint32_t len); - private: AudioManager() noexcept; class AudioManagerImpl; 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 971752c4f..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 @@ -695,7 +695,8 @@ int32_t AudioSink::SetParam(std::string &key, const DataType type, const void *v free(buf); return SINK_INVALID_OP; } - ret = outStream_->SetParam(buf, bufLen); + std::string keyValueList(buf); + ret = outStream_->SetParam(keyValueList); if (buf != nullptr) { free(buf); buf = nullptr; diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp index 1740728fd..7cb3310cb 100755 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.cpp @@ -10,7 +10,6 @@ #include #include #include -#include "securec.h" #include "audio_utils.h" #include "audio_errors.h" #include "audio_manager.h" @@ -28,23 +27,13 @@ using Audio::AudioStreamOut; using Audio::InterruptListener; using Audio::AudioInterrupt; +#define LOG_MODULE_NAME "AudioManagerCWrapper" +#define BUFFER_SIZE 20 + #ifdef __cplusplus extern "C" { #endif -#define LOG_MODULE_NAME "AudioManagerCWrapper" -#define BUFFER_SIZE 120 -#define VQE_PREFIX_LEN 18 -#define PEQ_PREFIX_LEN 50 -#define NV_AUDIO_PEQ_PARAM_SIZE 41 -#define NV_AUDIO_VQE_PARAM_SIZE 53 -#define PEQ_PARAM_SIZE (NV_AUDIO_PEQ_PARAM_SIZE * sizeof(uint32_t)) -#define VQE_PARAM_SIZE (NV_AUDIO_VQE_PARAM_SIZE * sizeof(uint32_t)) -#define SEA_BUFFER_SIZE (VQE_PARAM_SIZE + VQE_PREFIX_LEN) -#define AEF_BUFFER_SIZE (PEQ_PARAM_SIZE + PEQ_PREFIX_LEN) -#define PEQ_PREFIX_LEN 50 - - static AudioManager& g_amInstance = AudioManager::GetInstance(); static std::shared_ptr g_streamIn = nullptr; static std::shared_ptr g_streamOut = nullptr; @@ -263,8 +252,14 @@ int32_t AudioStreamOutSetMute(bool mute) int32_t AudioManagerSetSeaEnable(bool enable) { - std::string str("seaenable = " + std::to_string(enable)); - int32_t ret = g_streamOut->SetParam(str.c_str(), str.size()); + char buf[BUFFER_SIZE] = { 0 }; + int32_t ret = snprintf(buf, BUFFER_SIZE, "%s = %d", "seaenable", enable); + if (ret < 0) { + ALOGE("sprintf_s failed"); + return AUDIO_ERROR; + } + std::string str(buf); + ret = g_streamOut->SetParam(str); if (ret != AUDIO_SUCCESS) { ALOGE("set sea enable failed"); return AUDIO_ERROR; @@ -396,82 +391,6 @@ int32_t AudioManagerA2dpSinkSetParam(AudioFormatConfig config) return AUDIO_SUCCESS; } -int32_t AudioManagerSetSeaParam(const uint8_t *seaParam, uint16_t len) -{ - if (seaParam == NULL) { - ALOGE("sea_param null"); - return AUDIO_INVALID_PARAMS; - } - char *seaBuf = (char *)malloc(SEA_BUFFER_SIZE); - if (seaBuf == NULL) { - ALOGE("malloc fail"); - return AUDIO_NO_MEM; - } - if (memset_s(seaBuf, SEA_BUFFER_SIZE, 0, SEA_BUFFER_SIZE) != EOK) { - ALOGE("memset_s fail"); - free(seaBuf); - return AUDIO_NO_MEM; - } - int32_t prefixLen = sprintf_s(seaBuf, SEA_BUFFER_SIZE, "%s = %u:", "setseaparam", len); - if (prefixLen < 0) { - ALOGE("sprintf_s failed"); - free(seaBuf); - return AUDIO_ERROR; - } - if (memcpy_s(seaBuf + prefixLen, SEA_BUFFER_SIZE - prefixLen, seaParam, len) != EOK) { - ALOGE("memcpy_s failed"); - free(seaBuf); - return AUDIO_ERROR; - } - int32_t ret = g_amInstance.SetParam(AUDIO_UP_LINK, seaBuf, BUFFER_SIZE); - if (ret != AUDIO_SUCCESS) { - ALOGE("set param failed"); - free(seaBuf); - return AUDIO_ERROR; - } - free(seaBuf); - ALOGE("set param success!"); - return AUDIO_SUCCESS; -} - -int32_t AudioManagerGetSeaParam(uint8_t *seaParam, uint16_t len) -{ - if (seaParam == NULL) { - ALOGE("sea_param null"); - return AUDIO_INVALID_PARAMS; - } - char *seaBuf = (char *)malloc(SEA_BUFFER_SIZE); - if (seaBuf == NULL) { - ALOGE("malloc fail"); - return AUDIO_NO_MEM; - } - if (memset_s(seaBuf, SEA_BUFFER_SIZE, 0, SEA_BUFFER_SIZE) != EOK) { - ALOGE("memset_s fail"); - free(seaBuf); - return AUDIO_NO_MEM; - } - int32_t prefixLen = sprintf_s(seaBuf, SEA_BUFFER_SIZE, "%s = %u", "getseaparam", len); - if (prefixLen < 0) { - ALOGE("sprintf_s failed"); - free(seaBuf); - return AUDIO_ERROR; - } - int32_t ret = g_amInstance.GetParam(AUDIO_UP_LINK, seaBuf, SEA_BUFFER_SIZE); - if (ret != AUDIO_SUCCESS) { - ALOGE("get param failed"); - free(seaBuf); - return AUDIO_ERROR; - } - if (memcpy_s(seaParam, SEA_BUFFER_SIZE, seaBuf, len) != EOK) { - ALOGE("memcpy_s failed"); - free(seaBuf); - return AUDIO_ERROR; - } - free(seaBuf); - ALOGE("get param success!"); - return AUDIO_SUCCESS; -} - static void WaitA2dpStartWhenDelay(AudioManagerA2dpContext *a2dpContext) { while (true) { @@ -485,7 +404,7 @@ static void WaitA2dpStartWhenDelay(AudioManagerA2dpContext *a2dpContext) } } -static int32_t DisConnectBluetoothA2dpDevice(void) +static int32_t DisConnectBluetoothA2dpDevice(AudioManagerA2dpContext *a2dpContext) { if (CheckA2dpSourceConnectState()) { int32_t ret = g_amInstance.SetDeviceConnectionState(OUT_BLUETOOTH_A2DP, @@ -498,7 +417,7 @@ static int32_t DisConnectBluetoothA2dpDevice(void) return AUDIO_SUCCESS; } -static int32_t ConnectBluetoothA2dpDevice(void) +static int32_t ConnectBluetoothA2dpDevice(AudioManagerA2dpContext *a2dpContext) { if (CheckA2dpSourceConnectState()) { int32_t ret = g_amInstance.SetDeviceConnectionState(OUT_BLUETOOTH_A2DP, @@ -511,25 +430,6 @@ static int32_t ConnectBluetoothA2dpDevice(void) return AUDIO_SUCCESS; } -static int32_t AudioManagerA2dpSessionInitInner(AudioManagerA2dpContext *a2dpContext) -{ - AudioSession sessionID = g_amInstance.MakeSessionId(); - if (sessionID == AUDIO_SESSION_ID_NONE) { - ALOGE("get sessionid fail.\n"); - return AUDIO_ERROR; - } - g_a2dpInputConfig.sessionID = sessionID; - g_a2dpRenderConfig.sessionID = sessionID; - std::shared_ptr listener = - std::make_shared(a2dpContext); - if (listener == nullptr || listener.get() == nullptr) { - ALOGE("listener is nullptr"); - return AUDIO_ERROR; - } - a2dpContext->interrupt = { AUDIO_STREAM_A2DP_MUSIC, sessionID, listener }; - return AUDIO_SUCCESS; -} - static int32_t AudioManagerA2dpSessionInit(AudioManagerA2dpContext *a2dpContext) { bool success = g_amInstance.Initialize(); @@ -537,14 +437,23 @@ static int32_t AudioManagerA2dpSessionInit(AudioManagerA2dpContext *a2dpContext) ALOGE("audio manager init failed"); return AUDIO_ERROR; } - int32_t ret = 0; while (true) { - ret = AudioManagerA2dpSessionInitInner(a2dpContext); - if (ret != AUDIO_SUCCESS) { + AudioSession sessionID = g_amInstance.MakeSessionId(); + if (sessionID == AUDIO_SESSION_ID_NONE) { + ALOGE("get sessionid fail.\n"); return AUDIO_ERROR; } + g_a2dpInputConfig.sessionID = sessionID; + g_a2dpRenderConfig.sessionID = sessionID; + std::shared_ptr listener = + std::make_shared(a2dpContext); + if (listener == nullptr || listener.get() == nullptr) { + ALOGE("listener is nullptr"); + return AUDIO_ERROR; + } + a2dpContext->interrupt = { AUDIO_STREAM_A2DP_MUSIC, sessionID, listener }; /* After the delayed stream is woken up, the focus needs to be applied for again - because the focus may be outdated and the policy needs to be obtained again. */ + because the focus may be outdated and the policy needs to be obtained again.*/ int32_t strategy = g_amInstance.ActivateAudioInterrupt(a2dpContext->interrupt); if (strategy == INTERRUPT_FAILED) { ALOGE("activate audio interrupt faild"); @@ -553,7 +462,8 @@ static int32_t AudioManagerA2dpSessionInit(AudioManagerA2dpContext *a2dpContext) if (strategy == INTERRUPT_DELAYED) { WaitA2dpStartWhenDelay(a2dpContext); if (a2dpContext->isA2dpSinkStopped) { - goto EXIT; + g_amInstance.DeactivateAudioInterrupt(a2dpContext->interrupt); + return AUDIO_ERROR; } continue; } @@ -561,14 +471,14 @@ static int32_t AudioManagerA2dpSessionInit(AudioManagerA2dpContext *a2dpContext) } a2dpContext->isA2dpSinkResumed = false; a2dpContext->isA2dpSinkPause = false; - ret = DisConnectBluetoothA2dpDevice(); + int32_t ret = DisConnectBluetoothA2dpDevice(a2dpContext); if (ret != AUDIO_SUCCESS) { goto EXIT; } ret = g_amInstance.SetDeviceConnectionState(IN_BLUETOOTH_A2DP, AUDIO_DEVICE_CONNECTED); if (ret != AUDIO_SUCCESS) { - ConnectBluetoothA2dpDevice(); + ConnectBluetoothA2dpDevice(a2dpContext); goto EXIT; } return AUDIO_SUCCESS; @@ -709,7 +619,7 @@ static int32_t AudioManagerA2dpDeinit(AudioManagerA2dpContext *a2dpContext, bool if (ret != AUDIO_SUCCESS) { ALOGE("AudioManagerSetDeviceConnectionState fail.\n"); } - ConnectBluetoothA2dpDevice(); + ConnectBluetoothA2dpDevice(a2dpContext); ret = g_amInstance.DeactivateAudioInterrupt(a2dpContext->interrupt); if (ret != AUDIO_SUCCESS) { return ret; diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.h b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.h index 11ae9e094..b53b7cf77 100755 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.h +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/audio_manager_c_wrapper.h @@ -54,10 +54,6 @@ int32_t AudioStreamOutStop(void); int32_t AudioStreamOutDeinit(void); -int32_t AudioManagerSetSeaParam(const uint8_t *seaParam, uint16_t len); - -int32_t AudioManagerGetSeaParam(uint8_t *seaParam, uint16_t len); - int32_t AudioManagerA2dpSinkSetParam(AudioFormatConfig config); int32_t AudioManagerA2dpSinkCreate(void); diff --git a/code/sdk/middleware/services/media/foundation/sample/wrapper/player_sample_wrapper.cpp b/code/sdk/middleware/services/media/foundation/sample/wrapper/player_sample_wrapper.cpp index 22b1dea4c..556dd2bb2 100755 --- a/code/sdk/middleware/services/media/foundation/sample/wrapper/player_sample_wrapper.cpp +++ b/code/sdk/middleware/services/media/foundation/sample/wrapper/player_sample_wrapper.cpp @@ -19,7 +19,6 @@ #include #include #include -#include #ifdef SUPPORT_SYS_PRCTL #include #endif @@ -53,7 +52,7 @@ const uint32_t STREAM_FLAG_EOS = 4; const uint32_t STREAM_FLAG_PARTIAL_FRAME = 8; const uint32_t MAX_ARGC = 5; #define MEDIA_PATH_MAX 260 -#define MEDIA_MAX_PLAYER_TASK 6 + #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) #define IS_OK(ret) \ @@ -109,7 +108,7 @@ typedef struct { AudioInterrupt interrupt; MediaThreadIdHandle playTask; bool isSingleLoop; - std::atomic taskAlive; + bool taskAlive; std::shared_ptr player; AudioStreamType streamType; } SampleParam; @@ -120,22 +119,6 @@ typedef struct TagIdleBuffer { size_t size; } IdleBuffer; -typedef struct { - MediaThreadIdHandle playTask; - AudioStreamType streamType; -} PlayerTaskContext; - -static PlayerTaskContext g_playerTask[MEDIA_MAX_PLAYER_TASK] = { - {nullptr, AUDIO_STREAM_INVALID}, - {nullptr, AUDIO_STREAM_INVALID}, - {nullptr, AUDIO_STREAM_INVALID}, - {nullptr, AUDIO_STREAM_INVALID}, - {nullptr, AUDIO_STREAM_INVALID}, - {nullptr, AUDIO_STREAM_INVALID}, -}; - -static MediaMutexHandle g_playerTaskMutex = NULL; - static const char *g_songList[] = { "/user/test/cai.mp3", "/user/test/guyongzhe_8k_2ch_8k_0x20000.mp3" @@ -150,9 +133,6 @@ static AudioManager& g_amInstance = AudioManager::GetInstance(); static TestSample g_sample; static TestSample g_tonePlayersample; -static void WaitPlayerTaskEnd(SampleParam *sampleParam); -static void StorePlayerTaskInfo(SampleParam *sampleParam); - typedef enum { MEDIA_AUDIO_PLAY_START, // 00 MEDIA_AUDIO_PLAY_PAUSE, // 01 @@ -615,11 +595,13 @@ static int32_t PlayerTaskInitInfo(SampleParam *sampleParam, AudioSession &sessio sampleParam->testSample.mutex = MediaMutexCreate(nullptr); if (sampleParam->testSample.mutex == nullptr) { MEDIA_ERR_LOG("create mutex failed"); + sampleParam->taskAlive = false; return -1; } sampleParam->testSample.cond = MediaThreadCondCreate(); if (sampleParam->testSample.cond == nullptr) { MEDIA_ERR_LOG("create cond failed"); + sampleParam->taskAlive = false; (void)MediaMutexDestroy(&sampleParam->testSample.mutex); return -1; } @@ -633,12 +615,13 @@ static int32_t PlayerTaskInitInfo(SampleParam *sampleParam, AudioSession &sessio std::make_shared(sampleParam->testSample); sampleParam->interrupt = { sampleParam->streamType, sessionId, playerInterruptListener }; /* After the delayed stream is woken up, the focus needs to be applied for again - because the focus may be outdated and the policy needs to be obtained again. */ + because the focus may be outdated and the policy needs to be obtained again.*/ int32_t strategy = g_amInstance.ActivateAudioInterrupt(sampleParam->interrupt); if (strategy == INTERRUPT_FAILED) { MEDIA_ERR_LOG("ActivateAudioInterrupt failed"); (void)MediaMutexDestroy(&sampleParam->testSample.mutex); (void)MediaThreadCondDestroy(&sampleParam->testSample.cond); + sampleParam->taskAlive = false; return -1; } if (strategy == INTERRUPT_DELAYED) { @@ -647,6 +630,7 @@ static int32_t PlayerTaskInitInfo(SampleParam *sampleParam, AudioSession &sessio (void)MediaMutexDestroy(&sampleParam->testSample.mutex); (void)MediaThreadCondDestroy(&sampleParam->testSample.cond); g_amInstance.DeactivateAudioInterrupt(sampleParam->interrupt); + sampleParam->taskAlive = false; return -1; } continue; @@ -682,7 +666,8 @@ static void PlayerStreamExit(SampleParam *sampleParam) MediaMutexDestroy(&sampleParam->testSample.mutex); MediaThreadCondDestroy(&sampleParam->testSample.cond); - sampleParam->taskAlive.store(false); + sampleParam->taskAlive = false; + MEDIA_INFO_LOG("PlayerTaskEntry exit"); } void WaitPlayCompletedOrStop(SampleParam *sampleParam) @@ -708,7 +693,6 @@ static void *PlayerTaskEntry(void *priv) std::shared_ptr player = sampleParam->player; int32_t ret = PlayerTaskInitInfo(sampleParam, sessionId); if (ret != 0) { - sampleParam->taskAlive.store(false); return nullptr; } MediaMutexLock(sampleParam->testSample.mutex); @@ -734,7 +718,10 @@ static void *PlayerTaskEntry(void *priv) ret = player->Play(); if (ret != 0) { MediaMutexUnLock(sampleParam->testSample.mutex); - goto EXIT; + PlayerRunExit(sampleParam); + PlayerStreamExit(sampleParam); + MEDIA_INFO_LOG("PlayerTaskEntry exit"); + return nullptr; } if (sampleParam->isSingleLoop) { // enable loop @@ -742,12 +729,16 @@ static void *PlayerTaskEntry(void *priv) if (ret != 0) { MEDIA_ERR_LOG("EnableSingleLooping failed:%d", ret); } + sampleParam->isSingleLoop = player->IsSingleLooping(); + if (!sampleParam->isSingleLoop) { + MEDIA_ERR_LOG("IsSingleLooping failed IsSingleLooping:%d", sampleParam->isSingleLoop); + } + MEDIA_INFO_LOG("IsSingleLooping:%d", sampleParam->isSingleLoop); } + sampleParam->taskAlive = true; WaitPlayCompletedOrStop(sampleParam); -EXIT: PlayerRunExit(sampleParam); PlayerStreamExit(sampleParam); - MEDIA_INFO_LOG("PlayerTaskEntry exit"); return nullptr; } @@ -823,7 +814,7 @@ static int32_t PlaySampleStop(SampleParam *sampleParam) sampleParam->testSample.isStop = true; MediaThreadCondSignal(sampleParam->testSample.cond); MediaMutexUnLock(sampleParam->testSample.mutex); - WaitPlayerTaskEnd(sampleParam); + MEDIA_ERR_LOG("success"); return 0; } @@ -960,7 +951,13 @@ static int32_t PlaySampleSwitchSong(SampleParam *sampleParam) sampleParam->testSample.isStop = true; MediaThreadCondSignal(sampleParam->testSample.cond); MediaMutexUnLock(sampleParam->testSample.mutex); - WaitPlayerTaskEnd(sampleParam); + + while (sampleParam->taskAlive) { + // loop sleep 100ms for the previous music exits + // the previous playerTask thread have detached therefore can't use MediaThreadJoin + usleep(LOOP_WAIT_PLAY_EXIT_SLEEP_TIME_US); + } + if (strncmp(sampleParam->control, "prevsong", strlen("prevsong")) == 0) { if (g_currentSongIndex == 0) { g_currentSongIndex = g_totalSongEntries - 1; @@ -991,14 +988,14 @@ static int32_t PlaySampleSwitchSong(SampleParam *sampleParam) return -1; } - MediaThreadattr attr = { "playerTask", 0x1800, THREAD_SCHED_INVALID, 80, false }; + MediaThreadattr attr = { "playerTask", 0x1800, THREAD_SCHED_INVALID, 80, true }; MediaThreadIdHandle taskHandle = MediaThreadCreate(PlayerTaskEntry, sampleParam, &attr); if (taskHandle == nullptr) { MEDIA_ERR_LOG("thread create failed"); return -1; } sampleParam->playTask = taskHandle; - StorePlayerTaskInfo(sampleParam); + MEDIA_INFO_LOG("next/previous end"); return 0; } @@ -1100,7 +1097,7 @@ static int32_t PlayerSampleInit(SampleParam **sampleParam, int32_t argc, const c MEDIA_ERR_LOG("malloc failed"); return -1; } - (*sampleParam)->taskAlive.store(false); + (*sampleParam)->taskAlive = false; if (memset_s(*sampleParam, sizeof(SampleParam), 0, sizeof(SampleParam)) != EOK) { MEDIA_ERR_LOG("memset_s failed"); } @@ -1160,60 +1157,6 @@ static int32_t HandlePlayerSampleCmd(SampleParam *sampleParam, const char** argv } } -static void WaitPlayerTaskEnd(SampleParam *sampleParam) -{ - MediaInitStaticMutexLock(&g_playerTaskMutex); - MediaMutexLock(g_playerTaskMutex); - for (size_t i = 0; i < MEDIA_MAX_PLAYER_TASK; i++) { - if (g_playerTask[i].playTask == nullptr || - g_playerTask[i].streamType == AUDIO_STREAM_INVALID) { - continue; - } - if (sampleParam->playTask == g_playerTask[i].playTask && - sampleParam->streamType == g_playerTask[i].streamType) { - MediaMutexUnLock(g_playerTaskMutex); - MediaThreadJoin(&sampleParam->playTask); - MediaMutexLock(g_playerTaskMutex); - g_playerTask[i].streamType = AUDIO_STREAM_INVALID; - g_playerTask[i].playTask = nullptr; - break; - } - } - MediaMutexUnLock(g_playerTaskMutex); -} - -static bool FindAndUpdateplayerTask(SampleParam *sampleParam) -{ - for (size_t i = 0; i < MEDIA_MAX_PLAYER_TASK; i++) { - if (g_playerTask[i].playTask == sampleParam->playTask || - g_playerTask[i].streamType == sampleParam->streamType) { - g_playerTask[i].streamType = sampleParam->streamType; - g_playerTask[i].playTask = sampleParam->playTask; - return true; - } - } - return false; -} - -static void StorePlayerTaskInfo(SampleParam *sampleParam) -{ - MediaInitStaticMutexLock(&g_playerTaskMutex); - MediaMutexLock(g_playerTaskMutex); - if (FindAndUpdateplayerTask(sampleParam)) { - MediaMutexUnLock(g_playerTaskMutex); - return; - } - for (size_t i = 0; i < MEDIA_MAX_PLAYER_TASK; i++) { - if (g_playerTask[i].playTask == nullptr && - g_playerTask[i].streamType == AUDIO_STREAM_INVALID) { - g_playerTask[i].streamType = sampleParam->streamType; - g_playerTask[i].playTask = sampleParam->playTask; - break; - } - } - MediaMutexUnLock(g_playerTaskMutex); -} - int32_t PlayerSample(int32_t argc, const char** argv) { SourceType sourceType = SourceType::SOURCE_TYPE_FD; @@ -1227,12 +1170,8 @@ int32_t PlayerSample(int32_t argc, const char** argv) } MEDIA_INFO_LOG("argv[0]:%s", argv[0]); /* todo :Modifying playback keywords */ - if (strncmp(g_sampleParam->control, "xx", strlen("xx")) == 0) { - if (g_sampleParam->taskAlive.load()) { - MEDIA_ERR_LOG("playerTask exists, Enter the stop command first"); - return -1; - } - g_sampleParam->taskAlive.store(true); + if (!g_sampleParam->taskAlive && strncmp(g_sampleParam->control, "xx", strlen("xx")) == 0) { + g_sampleParam->taskAlive = true; if (argc < 4) { /* 4: invalid argc */ goto FREE; } @@ -1253,18 +1192,18 @@ int32_t PlayerSample(int32_t argc, const char** argv) MEDIA_ERR_LOG("input path too long"); goto FREE; } - WaitPlayerTaskEnd(g_sampleParam); - MediaThreadattr attr = { "playerTask", 0x1800, THREAD_SCHED_INVALID, 80, false }; + MediaThreadattr attr = { "playerTask", 0x1800, THREAD_SCHED_INVALID, 80, true }; MediaThreadIdHandle taskHandle = MediaThreadCreate(PlayerTaskEntry, g_sampleParam, &attr); if (taskHandle == nullptr) { MEDIA_ERR_LOG("thread create failed"); goto FREE; } g_sampleParam->playTask = taskHandle; - StorePlayerTaskInfo(g_sampleParam); - } else { - ret = HandlePlayerSampleCmd(g_sampleParam, argv); + } else if (g_sampleParam->taskAlive && strncmp(g_sampleParam->control, "xx", strlen("xx")) == 0) { /* 2: xx */ + MEDIA_ERR_LOG("playerTask exists, Enter the stop command first"); } + // will free g_sampleParam when play exit + ret = HandlePlayerSampleCmd(g_sampleParam, argv); MEDIA_INFO_LOG("PlayerSample end"); return ret; @@ -1287,12 +1226,8 @@ int32_t TonePlayerSampleTest(int32_t argc, const char *argv[]) } MEDIA_INFO_LOG("argv[0]:%s", argv[0]); /* todo :Modifying playback keywords */ - if (strncmp(g_tonePlayersampleParam->control, "xx", strlen("xx")) == 0) { - if (g_tonePlayersampleParam->taskAlive.load()) { - MEDIA_ERR_LOG("playerTask exists, Enter the stop command first"); - return -1; - } - g_tonePlayersampleParam->taskAlive.store(true); + if (!g_tonePlayersampleParam->taskAlive && strncmp(g_tonePlayersampleParam->control, "xx", strlen("xx")) == 0) { + g_tonePlayersampleParam->taskAlive = true; if (argc < 4) { /* 4: invalid argc */ goto FREE; } @@ -1313,17 +1248,16 @@ int32_t TonePlayerSampleTest(int32_t argc, const char *argv[]) MEDIA_ERR_LOG("input path too long"); goto FREE; } - WaitPlayerTaskEnd(g_tonePlayersampleParam); - MediaThreadattr attr = { "tonePlayerTask", 0x1800, THREAD_SCHED_INVALID, 80, false }; + MediaThreadattr attr = { "tonePlayerTask", 0x1800, THREAD_SCHED_INVALID, 80, true }; MediaThreadIdHandle taskHandle = MediaThreadCreate(PlayerTaskEntry, g_tonePlayersampleParam, &attr); if (taskHandle == nullptr) { MEDIA_ERR_LOG("thread create failed"); goto FREE; } g_tonePlayersampleParam->playTask = taskHandle; - StorePlayerTaskInfo(g_tonePlayersampleParam); - } else { - ret = HandlePlayerSampleCmd(g_tonePlayersampleParam, argv); + } else if (g_tonePlayersampleParam->taskAlive && + strncmp(g_tonePlayersampleParam->control, "xx", strlen("xx")) == 0) { /* 2: xx */ + MEDIA_ERR_LOG("tonePlayerTask exists, Enter the stop command first"); } MEDIA_INFO_LOG("tonePlayerSample end"); return ret; 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 207d0af67..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 @@ -266,12 +266,7 @@ static void SendBackgroundFrame(MediaVideoPlay *videoPlay) MEDIA_ERR_LOG("request the last buffer failed"); break; } - LiteSurface *liteSurface = dynamic_cast(videoPlay->surface_); - if (liteSurface == nullptr) { - MEDIA_ERR_LOG("liteSurface is null!"); - break; - } - videoPlay->surface_->CancelBuffer(liteSurface->GetBackBuf()); + usleep(WAIT_SURFACE_DEINIT_SUCCESS_US); } if (buf != nullptr) { buf->format = PIXEL_FMT_BUTT; @@ -380,7 +375,7 @@ void *MediaVideoPlay::VideoPlayThread(void *arg) MEDIA_ERR_LOG("release audio focus failed\n"); return nullptr; } - MEDIA_ERR_LOG("exit all!\n"); + MEDIA_INFO_LOG("exit all!\n"); return nullptr; } @@ -496,7 +491,6 @@ int32_t MediaVideoPlay::GetDumpInfo(PlayerDebugInfo *playerInfo) int32_t MediaVideoPlay::StopVideoPlay(void) { - MEDIA_ERR_LOG("StopVideoPlay start!"); MediaMutexLock(mutex_); if (!isPlayed_) { MEDIA_INFO_LOG("video play is not start,can not stop!"); @@ -522,7 +516,6 @@ int32_t MediaVideoPlay::StopVideoPlay(void) MediaMutexUnLock(mutex_); if (isSyncExitMode_) { MediaThreadJoin(&threadHandle_); - dynamic_cast(surface_)->ClearBuffers(); // clear buffers safely in sync mode to reduce peak memory } play = nullptr; return MEDIA_OK; 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 2643ad4b4..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 @@ -62,7 +62,7 @@ public: bool isPureVideo_ = false; static MediaVideoPlay *play; private: - bool isSyncExitMode_ = true; + bool isSyncExitMode_ = false; static void *VideoPlayThread(void *arg); void DestroyVideoPlaySource(void); }; diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/include/plugin_common.h b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/include/plugin_common.h index 3ede93522..eb135f078 100755 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/include/plugin_common.h +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/include/plugin_common.h @@ -41,13 +41,6 @@ typedef enum { AUDIO_MOD_SOUND } AudioSDKModuleType; -#ifdef AUDIO_SDK_SUPPORT -typedef struct { - enum AudioFormat audioFormat; - uapi_acodec_id codecId; -} AudioFormatMapping; -#endif - #define INVALID_ID (-1) // convert sample rate to number of samples per frame @@ -56,7 +49,7 @@ typedef struct { #define VOLUME_MIN 0.0f #define VOLUME_MAX 1.0f -#define MAX_KEY_STR_SIZE 30 +#define MAX_KEY_STR_SIZE 12 #define MAX_KEY_VALUE_SIZE 512 #define GET_AUDIO_POSITION_INTERVAL_US 10000 @@ -96,9 +89,6 @@ int32_t AudioSDKDetach(AudioSDKModuleType modType, td_handle srcHandle, td_handl int32_t SaveToggleConfig(uapi_audio_toggle_config *toggleConfig, const char *value, uint32_t valueLen); -int32_t GetParamByValue(uint8_t *param, uint32_t paramLen, const char *value, - uint32_t valueLen, uint32_t configLen); - int32_t SetSeaEnable(td_handle seaHandle, const char *value, uint32_t valueLen); #endif diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/src/plugin_common.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/src/plugin_common.c index 8bceeda23..6c71537b4 100755 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/src/plugin_common.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/common/src/plugin_common.c @@ -7,7 +7,7 @@ #include "plugin_common.h" #include #include -#include + #include "media_hal_common.h" #include "audio_types.h" @@ -72,41 +72,57 @@ bool IsRawFormat(enum AudioFormat audioFormat) } #ifdef AUDIO_SDK_SUPPORT -static AudioFormatMapping g_audioFormatMap[] = { - {AUDIO_FORMAT_PCM_8_BIT, UAPI_ACODEC_ID_PCM}, - {AUDIO_FORMAT_PCM_16_BIT, UAPI_ACODEC_ID_PCM}, - {AUDIO_FORMAT_PCM_24_BIT, UAPI_ACODEC_ID_PCM}, - {AUDIO_FORMAT_PCM_32_BIT, UAPI_ACODEC_ID_PCM}, - {AUDIO_FORMAT_AAC_MAIN, UAPI_ACODEC_ID_AAC}, - {AUDIO_FORMAT_AAC_LC, UAPI_ACODEC_ID_AAC}, - {AUDIO_FORMAT_AAC_LD, UAPI_ACODEC_ID_AAC}, - {AUDIO_FORMAT_AAC_ELD, UAPI_ACODEC_ID_AAC}, - {AUDIO_FORMAT_AAC_HE_V1, UAPI_ACODEC_ID_AAC}, - {AUDIO_FORMAT_AAC_HE_V2, UAPI_ACODEC_ID_AAC}, - {AUDIO_FORMAT_SBC, UAPI_ACODEC_ID_SBC}, - {AUDIO_FORMAT_MP3, UAPI_ACODEC_ID_MP3}, - {AUDIO_FORMAT_mSBC, UAPI_ACODEC_ID_MSBC}, - {AUDIO_FORMAT_FLAC, UAPI_ACODEC_ID_FLAC}, - {AUDIO_FORMAT_OPUS, UAPI_ACODEC_ID_OPUS}, - {AUDIO_FORMAT_VORBIS, UAPI_ACODEC_ID_VORBIS}, - {AUDIO_FORMAT_APE, UAPI_ACODEC_ID_APE}, - {AUDIO_FORMAT_SILK, UAPI_ACODEC_ID_SILK}, - {AUDIO_FORMAT_L2HC, UAPI_ACODEC_ID_L2HC}, -}; - bool AudioConvertAudioFormatToCodecId(enum AudioFormat audioFormat, uapi_acodec_id *codecId) { if (codecId == NULL) { return false; } - for (uint32_t i = 0; i < sizeof(g_audioFormatMap) / sizeof(AudioFormatMapping); i++) { - if (g_audioFormatMap[i].audioFormat == audioFormat) { - *codecId = g_audioFormatMap[i].codecId; - return true; - } + + switch (audioFormat) { + case AUDIO_FORMAT_PCM_8_BIT: + case AUDIO_FORMAT_PCM_16_BIT: + case AUDIO_FORMAT_PCM_24_BIT: + case AUDIO_FORMAT_PCM_32_BIT: + *codecId = UAPI_ACODEC_ID_PCM; + break; + case AUDIO_FORMAT_AAC_MAIN: + case AUDIO_FORMAT_AAC_LC: + case AUDIO_FORMAT_AAC_LD: + case AUDIO_FORMAT_AAC_ELD: + case AUDIO_FORMAT_AAC_HE_V1: + case AUDIO_FORMAT_AAC_HE_V2: + *codecId = UAPI_ACODEC_ID_AAC; + break; + case AUDIO_FORMAT_SBC: + *codecId = UAPI_ACODEC_ID_SBC; + break; + case AUDIO_FORMAT_MP3: + *codecId = UAPI_ACODEC_ID_MP3; + break; + case AUDIO_FORMAT_mSBC: + *codecId = UAPI_ACODEC_ID_MSBC; + break; + case AUDIO_FORMAT_FLAC: + *codecId = UAPI_ACODEC_ID_FLAC; + break; + case AUDIO_FORMAT_OPUS: + *codecId = UAPI_ACODEC_ID_OPUS; + break; + case AUDIO_FORMAT_VORBIS: + *codecId = UAPI_ACODEC_ID_VORBIS; + break; + case AUDIO_FORMAT_APE: + *codecId = UAPI_ACODEC_ID_APE; + break; + case AUDIO_FORMAT_SILK: + *codecId = UAPI_ACODEC_ID_SILK; + break; + default: + MEDIA_HAL_LOGW(MODULE_NAME, "Invalid audioFormat: 0x%x", audioFormat); + return false; } - MEDIA_HAL_LOGW(MODULE_NAME, "Invalid audioFormat: 0x%x", audioFormat); - return false; + + return true; } static int32_t AudioSDKInputInit(void) @@ -727,27 +743,6 @@ int32_t UpdateCurrentPosition(td_handle trackHandle, struct AudioTimeStamp *time return MEDIA_HAL_OK; } -int32_t GetParamByValue(uint8_t *param, uint32_t paramLen, const char *value, - uint32_t valueLen, uint32_t configLen) -{ - uint32_t prefixlen = 0; - for (uint32_t i = 0; i < valueLen; i++) { - if (value[i] == ':') { - prefixlen = i + 1; - break; - } - } - if (prefixlen == 0) { - MEDIA_HAL_LOGE(MODULE_NAME, "prefix is not found."); - return MEDIA_HAL_ERR; - } - if (memcpy_s(param, paramLen, value + prefixlen, configLen) != EOK) { - MEDIA_HAL_LOGE(MODULE_NAME, "set spk cali coef memcpy_s failed!"); - return MEDIA_HAL_ERR; - } - return MEDIA_HAL_OK; -} - int32_t SetSeaEnable(td_handle seaHandle, const char *value, uint32_t valueLen) { int32_t seaStatus = 0; diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c index d560c86b1..da27f825d 100755 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_in.c @@ -34,17 +34,12 @@ extern "C" { #endif #define MODULE_NAME "AudioPrimarySubPortIn" +#define SEA_ENABLE "seaenable" /* need fix: used for external buffer allocation, internal means samples per frame */ #define AUDIO_HAL_FRAME_COUNT 1024 #define VOLUME_UNIT 100 -#define MIC_VOLUME "micvolume" -#define MIC_TYPE "mictype" -#define SEA_ENABLE "seaenable" -#define GET_SEA_PARAM "getseaparam" -#define SET_SEA_PARAM "setseaparam" -#define SEA_PARAM_LEN 256 static enum AudioFormat g_supportFormats[] = { AUDIO_FORMAT_PCM_16_BIT, @@ -642,68 +637,15 @@ int32_t AudioPrimarySubPortInGetVolume(AudioHandle trackHandle, float *volume) return MEDIA_HAL_OK; } #ifdef AUDIO_SDK_SUPPORT -static int32_t PrimarySetSeaEnable(AudioHandle trackHandle, char *value, uint32_t valueLen) +static int32_t PrimarySetSeaEnable(AudioHandle trackHandle, const char *value, uint32_t valueLen) { SubPortTrackInContext *portTrackInCtx = (SubPortTrackInContext *)trackHandle; CHK_NULL_RETURN(value, MEDIA_HAL_INVALID_PARAM, "input param value is null"); -#ifdef MELODY_AUDIO_SUPPORT - if (!portTrackInCtx->isNeedOpenSea) { - MEDIA_HAL_LOGE(MODULE_NAME, "the sea is not open. can not set sea options!"); - return MEDIA_HAL_ERR; - } -#endif return SetSeaEnable(portTrackInCtx->seaHandle, value, valueLen); } -static int32_t SetSeaParam(AudioHandle trackHandle, char *value, uint32_t valueLen) -{ - MEDIA_HAL_UNUSED(valueLen); - SubPortTrackInContext *portTrackInCtx = (SubPortTrackInContext *)trackHandle; - CHK_NULL_RETURN(value, MEDIA_HAL_INVALID_PARAM, "input param value is null"); - uint32_t paramLen = 0; - uint8_t configFlag[MAX_KEY_STR_SIZE] = { 0 }; - int32_t ret = sscanf_s(value, "%s = %u:", configFlag, MAX_KEY_STR_SIZE, ¶mLen); - if (ret == -1) { - MEDIA_HAL_LOGE(MODULE_NAME, "set aef param sscanf_s failed!"); - return MEDIA_HAL_ERR; - } - uint8_t param[SEA_PARAM_LEN] = { 0 }; - ret = GetParamByValue(param, SEA_PARAM_LEN, value, valueLen, paramLen); - if (ret != MEDIA_HAL_OK) { - return ret; - } - ret = uapi_sea_set_param(portTrackInCtx->seaHandle, UAPI_SEA_AFE_SEE, (const td_void *)param, paramLen); - if (ret != MEDIA_HAL_OK) { - MEDIA_HAL_LOGE(MODULE_NAME, "set aef param failed! ret = %d", ret); - return ret; - } - return MEDIA_HAL_OK; -} - -static int32_t GetSeaParam(AudioHandle trackHandle, char *value, uint32_t valueLen) -{ - MEDIA_HAL_UNUSED(valueLen); - SubPortTrackInContext *portTrackInCtx = (SubPortTrackInContext *)trackHandle; - CHK_NULL_RETURN(value, MEDIA_HAL_INVALID_PARAM, "input param value is null"); - uint8_t configFlag[MAX_KEY_STR_SIZE] = { 0 }; - uint32_t paramLen = 0; - int32_t ret = sscanf_s((const char *)value, "%s = %u", configFlag, MAX_KEY_STR_SIZE, ¶mLen); - if (ret == -1) { - MEDIA_HAL_LOGE(MODULE_NAME, "set aef param sscanf_s failed!"); - return MEDIA_HAL_ERR; - } - ret = uapi_sea_get_param(portTrackInCtx->seaHandle, UAPI_SEA_AFE_SEE, (td_void *)value, paramLen); - if (ret != MEDIA_HAL_OK) { - MEDIA_HAL_LOGE(MODULE_NAME, "get aef param failed! ret = %d", ret); - return ret; - } - return MEDIA_HAL_OK; -} - static struct AudioPortInvoke g_primaryInInvokeFuncList[] = { {SEA_ENABLE, PrimarySetSeaEnable, true}, - {SET_SEA_PARAM, SetSeaParam, false}, - {GET_SEA_PARAM, GetSeaParam, false}, }; #endif @@ -721,7 +663,6 @@ int32_t AudioPrimarySubPortInInvoke(AudioHandle trackHandle, enum InvokeID invok break; } case INVOKE_ID_SET_EXTRA_PARAMS: - case INVOKE_ID_GET_EXTRA_PARAMS: { size_t size = sizeof(g_primaryInInvokeFuncList) / sizeof(struct AudioPortInvoke); ret = ExtraParamsInvoke(trackHandle, invokeAttr, g_primaryInInvokeFuncList, (uint32_t)size); diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_out.c b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_out.c index 0ea866480..c94fdd104 100755 --- a/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_out.c +++ b/code/sdk/middleware/services/media/hal/audio/plugins/brandy/primary/primary_sub_port_out.c @@ -17,11 +17,7 @@ #include "soc_uapi_sound.h" #endif -#if defined(BRANDY_PRODUCT_EVB) -#include "product_evb_standard.h" -#elif defined(BRANDY_PRODUCT_EVB4) -#include "product_evb4_standard.h" -#endif + #include "plugin_common.h" #include "media_hal_common.h" @@ -33,15 +29,6 @@ extern "C" { #define MODULE_NAME "AudioPrimarySubPortOut" #define EXTRA_DATA "extradata" -#define VOLUME_TOGGLE_DATA "vtoggle" -#define NOTIFY_TOGGLE_DATA "ntoggle" -#define SPEAKER_CALI_COEF_CONFIG_DATA "spkcali" -#define AEF_ENABLE "aefenable" -#define SET_DB_VOLUME "setdbvol" -#define GET_AEF_PARAM "getaefparam" -#define SET_AEF_PARAM "setaefparam" -#define SPEAKER_CALI_COEF_CONFIG_LEN 96 -#define AEF_PARAM_LEN 256 #ifdef AUDIO_SDK_SUPPORT #define AO_DEV_MAX_NUM UAPI_SND_MAX @@ -1024,93 +1011,33 @@ int32_t AudioPrimarySubPortOutTrackGetVolume(AudioHandle trackHandle, float *vol return MEDIA_HAL_OK; } -#ifdef AUDIO_SDK_SUPPORT -static int32_t SetExtraParam(AudioHandle trackHandle, char *value, uint32_t valueLen) -{ - MEDIA_HAL_UNUSED(valueLen); - SubPortTrackOutContext *portTrackOutCtx = (SubPortTrackOutContext *)trackHandle; - int32_t ret = SetExtraData(&portTrackOutCtx->inputAttr, value, (uint32_t)(strlen(value) + 1)); - CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "set Extra data failed"); - return MEDIA_HAL_OK; -} - -static int32_t SetAefParam(AudioHandle trackHandle, char *value, uint32_t valueLen) -{ - MEDIA_HAL_UNUSED(valueLen); - SubPortTrackOutContext *portTrackOutCtx = (SubPortTrackOutContext *)trackHandle; - CHK_NULL_RETURN(value, MEDIA_HAL_INVALID_PARAM, "input param value is null"); - uint32_t paramLen = 0; - uint8_t configFlag[MAX_KEY_STR_SIZE] = { 0 }; - uint32_t cmd = 0; - int32_t ret = sscanf_s(value, "%s = %u#%u:", configFlag, MAX_KEY_STR_SIZE, &cmd, ¶mLen); - if (ret == -1) { - MEDIA_HAL_LOGE(MODULE_NAME, "set aef param sscanf_s failed!"); - return MEDIA_HAL_ERR; - } - uint8_t param[AEF_PARAM_LEN] = { 0 }; - ret = GetParamByValue(param, AEF_PARAM_LEN, value, valueLen, paramLen); - if (ret != MEDIA_HAL_OK) { - return ret; - } - ret = uapi_snd_set_aef_param(portTrackOutCtx->subPortCtx->sndHandle, BUILTIN_SND_OUT_PORT, cmd, - (const td_void *)param, paramLen); - if (ret != MEDIA_HAL_OK) { - MEDIA_HAL_LOGE(MODULE_NAME, "set aef param failed! ret = %d", ret); - return ret; - } - return MEDIA_HAL_OK; -} - -static int32_t GetAefParam(AudioHandle trackHandle, char *value, uint32_t valueLen) -{ - MEDIA_HAL_UNUSED(valueLen); - SubPortTrackOutContext *portTrackOutCtx = (SubPortTrackOutContext *)trackHandle; - CHK_NULL_RETURN(value, MEDIA_HAL_INVALID_PARAM, "input param value is null"); - uint8_t configFlag[MAX_KEY_STR_SIZE] = { 0 }; - uint32_t cmd = 0; - uint32_t paramLen = 0; - int32_t ret = sscanf_s((const char *)value, "%s = %u#%u", configFlag, MAX_KEY_STR_SIZE, &cmd, ¶mLen); - if (ret == -1) { - MEDIA_HAL_LOGE(MODULE_NAME, "get aef param sscanf_s failed!"); - return MEDIA_HAL_ERR; - } - ret = uapi_snd_get_aef_param(portTrackOutCtx->subPortCtx->sndHandle, BUILTIN_SND_OUT_PORT, cmd, - (td_void *)value, paramLen); - if (ret != MEDIA_HAL_OK) { - MEDIA_HAL_LOGE(MODULE_NAME, "get aef param failed! ret = %d", ret); - return ret; - } - return MEDIA_HAL_OK; -} - -static struct AudioPortInvoke g_primaryOutInvokeFuncList[] = { - {EXTRA_DATA, SetExtraParam, true}, - {SET_AEF_PARAM, SetAefParam, false}, - {GET_AEF_PARAM, GetAefParam, false}, -}; -#endif - int32_t AudioPrimarySubPortOutInvoke(AudioHandle trackHandle, enum InvokeID invokeID, struct InvokeAttr *invokeAttr) { #ifdef AUDIO_SDK_SUPPORT + SubPortTrackOutContext *portTrackOutCtx = (SubPortTrackOutContext *)trackHandle; + char keyFlag[MAX_KEY_STR_SIZE] = { 0 }; + char value[MAX_KEY_VALUE_SIZE] = { 0 }; int32_t ret = 0; switch (invokeID) { case INVOKE_ID_GET_CHANNEL_ID: - { - SubPortTrackOutContext *portTrackOutCtx = (SubPortTrackOutContext *)trackHandle; *((uint32_t *)invokeAttr->request) = portTrackOutCtx->inputAdpHandle; invokeAttr->replyBytes = (uint64_t)sizeof(uint32_t); MEDIA_HAL_LOGI(MODULE_NAME, "data channel id: 0x%x", *((uint32_t *)invokeAttr->request)); break; - } case INVOKE_ID_SET_EXTRA_PARAMS: - case INVOKE_ID_GET_EXTRA_PARAMS: - { - size_t size = sizeof(g_primaryOutInvokeFuncList) / sizeof(struct AudioPortInvoke); - ret = ExtraParamsInvoke(trackHandle, invokeAttr, g_primaryOutInvokeFuncList, (uint32_t)size); - CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "extra param invoke failed!"); + ret = ParseKeyValueForExtra(invokeAttr, keyFlag, MAX_KEY_STR_SIZE, value, MAX_KEY_VALUE_SIZE); + CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "ParseKeyValueForExtra failed"); + if (strcmp(keyFlag, EXTRA_DATA) == 0) { + ret = SetExtraData(&portTrackOutCtx->inputAttr, value, (uint32_t)(strlen(value) + 1)); + CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "set Extra data failed"); + } else if (strcmp(keyFlag, "vtoggle") == 0) { + ret = SaveToggleConfig(&portTrackOutCtx->volumeToggleConfig, value, (uint32_t)(strlen(value) + 1)); + CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "save volume toggle config failed"); + } else if (strcmp(keyFlag, "ntoggle") == 0) { + ret = SaveToggleConfig(&portTrackOutCtx->notifyToggleConfig, value, (uint32_t)(strlen(value) + 1)); + CHK_FAILED_RETURN(ret, MEDIA_HAL_OK, ret, "save notify toggle config failed"); + } break; - } default: MEDIA_HAL_LOGW(MODULE_NAME, "invalid invoke id: %d", invokeID); return MEDIA_HAL_INVALID_PARAM; diff --git a/code/sdk/middleware/services/media/hal/audio/plugins/plugin_include/audio_port_plugin.h b/code/sdk/middleware/services/media/hal/audio/plugins/plugin_include/audio_port_plugin.h index fc75a8146..631fdd707 100755 --- a/code/sdk/middleware/services/media/hal/audio/plugins/plugin_include/audio_port_plugin.h +++ b/code/sdk/middleware/services/media/hal/audio/plugins/plugin_include/audio_port_plugin.h @@ -56,7 +56,6 @@ enum InvokeID { INVOKE_ID_GET_CHANNEL_ID = 0, /* CurrentChannelId. The value type is uint32_t. */ INVOKE_ID_CONFIG_VQE = 1, /* Config vqe for usage scenes see {@link VqeScene} */ INVOKE_ID_SET_EXTRA_PARAMS = 2, /* Set extra params. The format is key=value. Separate by semicolons (;) */ - INVOKE_ID_GET_EXTRA_PARAMS = 3, /* Get extra params. */ }; enum PluginInvokeId { diff --git a/code/sdk/middleware/services/media/hal/audio/src/audio_adapter.c b/code/sdk/middleware/services/media/hal/audio/src/audio_adapter.c index 272cc6124..a5601d87d 100755 --- a/code/sdk/middleware/services/media/hal/audio/src/audio_adapter.c +++ b/code/sdk/middleware/services/media/hal/audio/src/audio_adapter.c @@ -239,7 +239,6 @@ static int32_t HwRenderInit(const struct AudioHwAdapter *hwAdapter, struct Audio hwRender->common.attr.GetSampleAttributes = AudioRenderGetSampleAttributes; hwRender->common.attr.GetCurrentChannelId = AudioRenderGetCurrentChannelId; hwRender->common.attr.SetExtraParams = AudioRenderSetExtraParams; - hwRender->common.attr.GetExtraParams = AudioRenderGetExtraParams; hwRender->common.scene.CheckSceneCapability = AudioRenderCheckSceneCapability; hwRender->common.scene.SelectScene = AudioRenderSelectScene; hwRender->common.volume.SetMute = AudioRenderSetMute; @@ -375,7 +374,6 @@ static int32_t HwCaptureInit(const struct AudioHwAdapter *hwAdapter, hwCapture->common.attr.GetSampleAttributes = AudioCaptureGetSampleAttributes; hwCapture->common.attr.GetCurrentChannelId = AudioCaptureGetCurrentChannelId; hwCapture->common.attr.SetExtraParams = AudioCaptureSetExtraParams; - hwCapture->common.attr.GetExtraParams = AudioCaptureGetExtraParams; hwCapture->common.scene.CheckSceneCapability = AudioCaptureCheckSceneCapability; hwCapture->common.scene.SelectScene = AudioCaptureSelectScene; hwCapture->common.volume.SetMute = AudioCaptureSetMute; diff --git a/code/sdk/middleware/services/media/hal/audio/src/audio_capture.c b/code/sdk/middleware/services/media/hal/audio/src/audio_capture.c index a21a5b820..87a680209 100755 --- a/code/sdk/middleware/services/media/hal/audio/src/audio_capture.c +++ b/code/sdk/middleware/services/media/hal/audio/src/audio_capture.c @@ -196,28 +196,6 @@ int32_t AudioCaptureSetExtraParams(AudioHandle handle, const char *keyValueList) return MEDIA_HAL_OK; } -int32_t AudioCaptureGetExtraParams(AudioHandle handle, char *keyValueList, int32_t listLenth) -{ - CHK_NULL_RETURN(handle, MEDIA_HAL_INVALID_PARAM, "input param handle null"); - CHK_NULL_RETURN(keyValueList, MEDIA_HAL_INVALID_PARAM, "input param keyValueList null"); - - struct AudioHwCapture *hwCapture = (struct AudioHwCapture *)handle; - MediaHalMutexLock(hwCapture->mutex); - struct InvokeAttr invokeAttr = {}; - invokeAttr.request = (void *)keyValueList; - invokeAttr.replyBytes = (uint64_t)listLenth; - int32_t ret = hwCapture->trackHandle->Invoke(hwCapture->trackHandle, INVOKE_ID_GET_EXTRA_PARAMS, &invokeAttr); - if (ret != MEDIA_HAL_OK) { - MediaHalMutexUnLock(hwCapture->mutex); - MEDIA_HAL_LOGE(MODULE_NAME, "AudioPortTrack Invoke INVOKE_ID_GET_EXTRA_PARAMS failed: 0x%x", ret); - return ret; - } - MediaHalMutexUnLock(hwCapture->mutex); - - MEDIA_HAL_LOGI(MODULE_NAME, "success"); - return MEDIA_HAL_OK; -} - int32_t AudioCaptureCheckSceneCapability(AudioHandle handle, const struct AudioSceneDescriptor *scene, bool *supported) { diff --git a/code/sdk/middleware/services/media/hal/audio/src/audio_internal.h b/code/sdk/middleware/services/media/hal/audio/src/audio_internal.h index 7968dbc11..2e0c784ae 100755 --- a/code/sdk/middleware/services/media/hal/audio/src/audio_internal.h +++ b/code/sdk/middleware/services/media/hal/audio/src/audio_internal.h @@ -135,7 +135,6 @@ int32_t AudioRenderSetSampleAttributes(AudioHandle handle, const struct AudioSam int32_t AudioRenderGetSampleAttributes(AudioHandle handle, struct AudioSampleAttributes *attrs); int32_t AudioRenderGetCurrentChannelId(AudioHandle handle, uint32_t *channelId); int32_t AudioRenderSetExtraParams(AudioHandle handle, const char *keyValueList); -int32_t AudioRenderGetExtraParams(AudioHandle handle, char *keyValueList, int32_t listLenth); int32_t AudioRenderCheckSceneCapability(AudioHandle handle, const struct AudioSceneDescriptor *scene, bool *supported); int32_t AudioRenderSelectScene(AudioHandle handle, const struct AudioSceneDescriptor *scene); @@ -166,7 +165,6 @@ int32_t AudioCaptureSetSampleAttributes(AudioHandle handle, const struct AudioSa int32_t AudioCaptureGetSampleAttributes(AudioHandle handle, struct AudioSampleAttributes *attrs); int32_t AudioCaptureGetCurrentChannelId(AudioHandle handle, uint32_t *channelId); int32_t AudioCaptureSetExtraParams(AudioHandle handle, const char *keyValueList); -int32_t AudioCaptureGetExtraParams(AudioHandle handle, char *keyValueList, int32_t listLenth); int32_t AudioCaptureCheckSceneCapability(AudioHandle handle, const struct AudioSceneDescriptor *scene, bool *supported); int32_t AudioCaptureSelectScene(AudioHandle handle, const struct AudioSceneDescriptor *scene); diff --git a/code/sdk/middleware/services/media/hal/audio/src/audio_render.c b/code/sdk/middleware/services/media/hal/audio/src/audio_render.c index 38250d028..6b78c642d 100755 --- a/code/sdk/middleware/services/media/hal/audio/src/audio_render.c +++ b/code/sdk/middleware/services/media/hal/audio/src/audio_render.c @@ -266,28 +266,6 @@ int32_t AudioRenderSetExtraParams(AudioHandle handle, const char *keyValueList) return MEDIA_HAL_OK; } -int32_t AudioRenderGetExtraParams(AudioHandle handle, char *keyValueList, int32_t listLenth) -{ - CHK_NULL_RETURN(handle, MEDIA_HAL_INVALID_PARAM, "input param handle null"); - CHK_NULL_RETURN(keyValueList, MEDIA_HAL_INVALID_PARAM, "input param keyValueList null"); - - struct AudioHwRender *hwRender = (struct AudioHwRender *)handle; - MediaHalMutexLock(hwRender->mutex); - struct InvokeAttr invokeAttr = {}; - invokeAttr.request = (void *)keyValueList; - invokeAttr.requestBytes = (uint64_t)listLenth; - int32_t ret = hwRender->trackHandle->Invoke(hwRender->trackHandle, INVOKE_ID_GET_EXTRA_PARAMS, &invokeAttr); - if (ret != MEDIA_HAL_OK) { - MediaHalMutexUnLock(hwRender->mutex); - MEDIA_HAL_LOGE(MODULE_NAME, "AudioPortTrack Invoke INVOKE_ID_GET_EXTRA_PARAMS failed: 0x%x", ret); - return ret; - } - MediaHalMutexUnLock(hwRender->mutex); - - MEDIA_HAL_LOGI(MODULE_NAME, "success"); - return MEDIA_HAL_OK; -} - int32_t AudioRenderCheckSceneCapability(AudioHandle handle, const struct AudioSceneDescriptor *scene, bool *supported) diff --git a/code/sdk/middleware/utils/common_headers/drivers/gpu/soc_vau_api.h b/code/sdk/middleware/utils/common_headers/drivers/gpu/soc_vau_api.h index 47ec95a35..15291ae04 100755 --- a/code/sdk/middleware/utils/common_headers/drivers/gpu/soc_vau_api.h +++ b/code/sdk/middleware/utils/common_headers/drivers/gpu/soc_vau_api.h @@ -169,21 +169,6 @@ td_s32 uapi_vau_parse_cmp_header(td_u8 *head, td_u32 size, ext_vau_cmp_header *i */ td_s32 uapi_vau_wait_for_done(td_handle handle); -/** - * @if Eng - * @brief set_cubic_threshold. - * @param [in] td_float cubic_threshold. - * @retval EXT_SUCCESS Success. - * @retval Other Failure. - * @else - * @brief 设置三次贝塞尔阈值 - * @param [in] cubic_threshold 阈值 - * @retval EXT_SUCCESS 成功 - * @retval Other 失败 - * @endif - */ -td_s32 uapi_vau_set_cubic_threshold(td_float cubic_threshold); - /** * @} */ diff --git a/code/sdk/middleware/utils/dfx/CMakeLists.txt b/code/sdk/middleware/utils/dfx/CMakeLists.txt index d7b1eab77..d5a904b8b 100755 --- a/code/sdk/middleware/utils/dfx/CMakeLists.txt +++ b/code/sdk/middleware/utils/dfx/CMakeLists.txt @@ -127,7 +127,6 @@ else() ${CMAKE_CURRENT_SOURCE_DIR}/diag/diag_cmd_router/include ${CMAKE_CURRENT_SOURCE_DIR}/diag_transmit/include ${CMAKE_CURRENT_SOURCE_DIR}/diag_transmit/dfx_include - ${CMAKE_CURRENT_SOURCE_DIR}/diag_transmit/ ) endif() diff --git a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/zdiag_audio_probe.c b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/zdiag_audio_probe.c index 4a139cde7..3f3f77c34 100755 --- a/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/zdiag_audio_probe.c +++ b/code/sdk/middleware/utils/dfx/diag_dfx_cmd/diag_audio_probe/zdiag_audio_probe.c @@ -57,10 +57,6 @@ typedef struct { uint32_t msg_ack_timeout; uint32_t msg_underflow; uint32_t msg_crc_fail; - - /* msg int status */ - uint32_t msg_int_fail; - uint32_t msg_int_retrigger; } probe_status_info; typedef struct { @@ -198,9 +194,6 @@ static void core_probe_output(uint32_t core_id, const probe_status_info *status) "msg_success = %u, illegal_param = %u, ack_timeout = %u, underflow = %u, crc_fail = %u.\n", status->msg_success, status->msg_illegal_param, status->msg_ack_timeout, status->msg_underflow, status->msg_crc_fail); - - /* msg int status */ - DIAG_PROBE_REPORT("msg_int_fail = %u, msg_int_retrigger = %u.\n", status->msg_int_fail, status->msg_int_retrigger); } static void audio_probe_output(void) diff --git a/code/sdk/middleware/utils/dfx/diag_transmit/dfx_include/transmit_st.h b/code/sdk/middleware/utils/dfx/diag_transmit/dfx_include/transmit_st.h index 7d9771fa1..e2e5aeeac 100755 --- a/code/sdk/middleware/utils/dfx/diag_transmit/dfx_include/transmit_st.h +++ b/code/sdk/middleware/utils/dfx/diag_transmit/dfx_include/transmit_st.h @@ -8,12 +8,6 @@ #include -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - typedef enum { TRANSMIT_STATE_NOTIFY_INVALID_ID = 10, TRANSMIT_STATE_NOTIFY_FINISH, @@ -118,10 +112,4 @@ typedef struct { uint32_t reason; } transmit_stop_pkt_t; -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ - #endif diff --git a/code/sdk/middleware/utils/dfx/diag_transmit/transmit_item.h b/code/sdk/middleware/utils/dfx/diag_transmit/transmit_item.h index 5355320f9..d83763155 100755 --- a/code/sdk/middleware/utils/dfx/diag_transmit/transmit_item.h +++ b/code/sdk/middleware/utils/dfx/diag_transmit/transmit_item.h @@ -9,12 +9,6 @@ #include "transmit_st.h" #include "diag.h" -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - #define TRANSMIT_OUT_TIME 30 #define TRANSMIT_RETRY_TIME 1 @@ -136,10 +130,4 @@ errcode_t transmit_item_module_init(void); errcode_t transmit_msg_proc_hook_register(uint32_t msg_id_start, uint32_t msg_id_end, transmit_register_hook hook); errcode_t transmit_msg_proc_hook_unregister(transmit_register_hook hook); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ #endif /* TRANSMIT_ITEM_H */ diff --git a/code/sdk/middleware/utils/dfx/diag_transmit/transmit_write_read.h b/code/sdk/middleware/utils/dfx/diag_transmit/transmit_write_read.h index 74de55137..9f0b670a0 100755 --- a/code/sdk/middleware/utils/dfx/diag_transmit/transmit_write_read.h +++ b/code/sdk/middleware/utils/dfx/diag_transmit/transmit_write_read.h @@ -8,20 +8,9 @@ #include "transmit_item.h" -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - int32_t bus_read_data(uintptr_t usr_data, uint32_t offset, uint8_t *buf, uint32_t len); int32_t buf_write_data(uintptr_t usr_data, uint32_t offset, uint8_t *buf, uint32_t len); int32_t file_read_data(uintptr_t usr_data, uint32_t offset, uint8_t *buf, uint32_t len); int32_t file_write_data(uintptr_t usr_data, uint32_t offset, uint8_t *buf, uint32_t len); -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ #endif \ No newline at end of file diff --git a/code/sdk/middleware/utils/dfx/file_operation/dfx_file_operation.h b/code/sdk/middleware/utils/dfx/file_operation/dfx_file_operation.h index d556b975c..4ef625037 100644 --- a/code/sdk/middleware/utils/dfx/file_operation/dfx_file_operation.h +++ b/code/sdk/middleware/utils/dfx/file_operation/dfx_file_operation.h @@ -11,12 +11,6 @@ #include "dfx_feature_config.h" #include "common_def.h" -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - typedef struct { bool is_dir; const char *name; @@ -135,10 +129,4 @@ static inline void dfx_file_close(int32_t fd) } #endif /* CONFIG_DFX_SUPPORT_FILE_SYSTEM == DFX_YES */ - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ #endif /* __TRANSMIT_FILE_OPERATION_H__ */ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-r/libfs_yaffs2.a index 169751cd9..0c5c45cba 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js/libfs_yaffs2.a index 5732c59e4..99a52e22b 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-native-js/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target1-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target1-r/libfs_yaffs2.a index 2afb70e81..5d0e5db5c 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target1-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target1-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target1/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target1/libfs_yaffs2.a index 29623ed81..dca4325ac 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target1/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target1/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target3-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target3-r/libfs_yaffs2.a index f58886cd6..915e1d41a 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target3-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target3-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target3/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target3/libfs_yaffs2.a index 96e28c734..243b694c4 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target3/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target3/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target4-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target4-r/libfs_yaffs2.a index a9a009e2a..e8453ac5a 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target4-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target4-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target4/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target4/libfs_yaffs2.a index da5ece74c..7234e45b5 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target4/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target4/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target5-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target5-r/libfs_yaffs2.a index 93b676067..f2c25f1ec 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target5-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target5-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-target5/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-target5/libfs_yaffs2.a index d16d30518..5befd2cb5 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-target5/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-target5/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-xts-r/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-xts-r/libfs_yaffs2.a index 40599e6cb..69efcc6a7 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-xts-r/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-xts-r/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/brandy-xts/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/brandy-xts/libfs_yaffs2.a index 9a542dd15..152755aaf 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/brandy-xts/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/brandy-xts/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a b/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a index 1c31928f1..dfd6ca307 100755 Binary files a/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a and b/code/sdk/middleware/utils/fs/yaffs2/testsuite-brandy-sdk/libfs_yaffs2.a differ diff --git a/code/sdk/middleware/utils/fs/yaffs2/yaffs/direct/include/yaffsfs.h b/code/sdk/middleware/utils/fs/yaffs2/yaffs/direct/include/yaffsfs.h index 8d2956e3c..3b7f73152 100755 --- a/code/sdk/middleware/utils/fs/yaffs2/yaffs/direct/include/yaffsfs.h +++ b/code/sdk/middleware/utils/fs/yaffs2/yaffs/direct/include/yaffsfs.h @@ -175,15 +175,14 @@ int yaffs_unmount2(const YCHAR *path, int force); * yaffs_sync() does a full sync, including checkpoint. */ int yaffs_sync(const YCHAR *path); +#ifdef YAFFS_EXTEND_SUPPORT +int yaffs_remount(const YCHAR *path, int force, int read_only); int yaffs_format(const YCHAR *path, int unmount_flag, int force_unmount_flag, int remount_flag); -#ifdef YAFFS_EXTEND_SUPPORT -int yaffs_remount(const YCHAR *path, int force, int read_only); - /* * yaffs_sync() does a full sync, including checkpoint. * yaffs_sync_files() just flushes the cache and does not write a checkpoint. diff --git a/code/sdk/open_source/openharmony/base/startup/bootstrap_lite/source/bootstrap_service.c b/code/sdk/open_source/openharmony/base/startup/bootstrap_lite/source/bootstrap_service.c index 7d68968b6..0a9a1f894 100755 --- a/code/sdk/open_source/openharmony/base/startup/bootstrap_lite/source/bootstrap_service.c +++ b/code/sdk/open_source/openharmony/base/startup/bootstrap_lite/source/bootstrap_service.c @@ -112,8 +112,16 @@ static void OnInitTimeout(void* args) return; } - Request request = {.msgId = BOOT_INIT_TIMEOUT, .msgValue = 0}; + Request *request = SAMGR_AllocRequestMsg(0, PLATFORM_CORE, BOOTSTRAP_SVR_ID, 0); + if (request == NULL) { + return; + } + request->msgId = BOOT_INIT_TIMEOUT; + request->msgValue = 0; - SAMGR_SendRequest(&bootstrap->identity, &request, NULL); + int ret = SAMGR_SendRequest(&bootstrap->identity, request, NULL); + if (ret != EC_SUCCESS) { + SAMGR_FreeRequestMsg(request); + } } diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/CMakeLists.txt b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/CMakeLists.txt index b7c150a01..6bc252d73 100755 --- a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/CMakeLists.txt +++ b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/CMakeLists.txt @@ -20,8 +20,6 @@ set(PUBLIC_HEADER set(PRIVATE_HEADER ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/base - ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/context - ${ROOT_DIR}/open_source/openharmony/foundation/ace/ace_engine_lite/base ${ROOT_DIR}/application/wearable/ohos_deps ${ROOT_DIR}/middleware/services/gui/uikit/proprietary/src/utils/innerkits diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js/libams.a index 31894302a..bbe39f801 100755 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-native-js/libams.a differ diff --git a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-xts/libams.a b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-xts/libams.a index 26e3fed79..2faac3d92 100755 Binary files a/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-xts/libams.a and b/code/sdk/open_source/openharmony/foundation/aafwk/aafwk_lite/brandy-xts/libams.a differ 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 91489b6fd..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 @@ -32,6 +32,7 @@ set(PRIVATE_HEADER ${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 @@ -208,7 +209,6 @@ set(PRIVATE_HEADER ${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}/middleware/services/gui/uikit/ui/interfaces/kits/common ${ROOT_DIR}/open_source/openharmony/drivers/peripheral/display/interfaces/include ${ROOT_DIR}/application/wearable/ohos_deps ${ROOT_DIR}/open_source/openharmony/third_party/cJSON @@ -236,7 +236,6 @@ set(SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/components/input_button_component.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/input_checkbox_component.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/input_radio_component.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/components/input_edittext_component.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/list_adapter.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/list_component.cpp ${CMAKE_CURRENT_SOURCE_DIR}/components/marquee_component.cpp @@ -253,7 +252,6 @@ set(SOURCES ${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/device_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 @@ -421,6 +419,7 @@ 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 diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/js_fwk_common.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/js_fwk_common.h index 2dd037a99..a25975081 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/js_fwk_common.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/base/js_fwk_common.h @@ -111,7 +111,6 @@ constexpr char COMMON_STYLE_OPACITY[] = "opacity"; constexpr char COMMON_STYLE_COLOR[] = "color"; #endif // FEATURE_COMPONENT_ANALOG_CLOCK constexpr uint8_t DEFAULT_FONT_SIZE = 30; -constexpr uint8_t FONT_FAMILY_FILE_NAME_SIZE = 128; #ifdef FEATURE_COMPONENT_CANVAS constexpr uint8_t DEFAULT_FONT_LETTERSPACE = 2; #endif // FEATURE_COMPONENT_CANVAS 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 f047f4e67..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 @@ -109,9 +109,6 @@ enum { KEYWORD(EASE_IN_OUT, ease-in-out) // animation time function value KEYWORD(EASE_OUT, ease-out) // animation time function value KEYWORD(ELLIPSIS, ellipsis) // text overflow type -#if (FEATURE_COMPONENT_EDITTEXT == 1) - KEYWORD(EDITTEXTTYPE, editTextType) // text overflow type -#endif // FEATURE_COMPONENT_EDITTEXT #ifdef FEATURE_COMPONENT_DATE_PICKER KEYWORD(END, end) // date picker-view attr #endif // FEATURE_COMPONENT_DATE_PICKER @@ -176,9 +173,6 @@ enum { KEYWORD(MARGIN_TOP, marginTop) // common style margin top KEYWORD(MARQUEE, marquee) // marquee tag name KEYWORD(MAX, max) // common attributes -#if (FEATURE_COMPONENT_EDITTEXT == 1) - KEYWORD(MAX_LENGTH, maxlength) // maxlength of input -#endif // FEATURE_COMPONENT_EDITTEXT KEYWORD(MIN, min) // common attributes, analog-clock minute KEYWORD(MINI, mini) // text font size type #ifdef FEATURE_DATE_FORMAT @@ -201,9 +195,6 @@ enum { KEYWORD(PADDING_LEFT, paddingLeft) KEYWORD(PADDING_RIGHT, paddingRight) KEYWORD(PADDING_TOP, paddingTop) -#if (FEATURE_COMPONENT_EDITTEXT == 1) - KEYWORD(PASSWORD, password) // type of input component -#endif // FEATURE_COMPONENT_EDITTEXT KEYWORD(PERCENT, percent) KEYWORD(PICKER_VIEW, picker-view) // tag name KEYWORD(REF, ref) // common attribute @@ -214,10 +205,6 @@ enum { KEYWORD(PIVOT_X, pivotX) // clock-hand pivot-x KEYWORD(PIVOT_Y, pivotY) // clock-hand pivot-y #endif // FEATURE_COMPONENT_ANALOG_CLOCK -#if (FEATURE_COMPONENT_EDITTEXT == 1) - KEYWORD(PLACEHOLDER, placeholder) // placeholder of edittext - KEYWORD(PLACEHOLDER_COLOR, placeholderColor) // placeholder-color of edittext -#endif // FEATURE_COMPONENT_EDITTEXT KEYWORD(PROGRESS, progress) // progress tag name #ifdef FEATURE_COMPONENT_QRCODE KEYWORD(QRCODE, qrcode) // qrcode tag name @@ -297,9 +284,9 @@ enum { KEYWORD(TRANSLATE_X, translateX) // animation transform x KEYWORD(TRANSLATE_Y, translateY) // animation transform y KEYWORD(TRUE, true) // common attributes -#if ((FEATURE_COMPONENT_ANALOG_CLOCK == 1) || (FEATURE_COMPONENT_EDITTEXT == 1)) +#ifdef FEATURE_COMPONENT_ANALOG_CLOCK KEYWORD(TYPE, type) // clock-hand type -#endif // (FEATURE_COMPONENT_ANALOG_CLOCK == 1) || (FEATURE_COMPONENT_EDITTEXT == 1) +#endif // FEATURE_COMPONENT_ANALOG_CLOCK KEYWORD(VALUE, value) // common attributes KEYWORD(VERTICAL, vertical) // swiper attr vertical #ifdef FEATURE_COMPONENT_VIDEO 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 fff3f6fbc..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 97280be94..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/component.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.h index 3d0097957..7e0cf9e15 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/component.h @@ -233,15 +233,6 @@ public: void AlignDimensions(const ConstrainedParameter ¶m); void EnableTransmitSwipe(); - int16_t GetHeight() const - { - return (height_.type == TYPE_PIXEL) ? height_.value.pixel : INVALID_PIXEL_VALUE; - } - int16_t GetWidth() const - { - return (width_.type == TYPE_PIXEL) ? width_.value.pixel : INVALID_PIXEL_VALUE; - } - protected: void SetComponentName(uint16_t name) { @@ -439,6 +430,15 @@ protected: { return styleItem->GetValueType() == STYLE_PROP_VALUE_TYPE_STRING; } + int16_t GetHeight() const + { + return (height_.type == TYPE_PIXEL) ? height_.value.pixel : INVALID_PIXEL_VALUE; + } + int16_t GetWidth() const + { + return (width_.type == TYPE_PIXEL) ? width_.value.pixel : INVALID_PIXEL_VALUE; + } + jerry_value_t *GetDomElementPointer() { return &nativeElement_; 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 a53e5557f..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 @@ -38,9 +38,6 @@ #include "input_button_component.h" #include "input_checkbox_component.h" #include "input_radio_component.h" -#if (FEATURE_COMPONENT_EDITTEXT == 1) -#include "input_edittext_component.h" -#endif // FEATURE_COMPONENT_EDITTEXT #include "js_fwk_common.h" #include "key_parser.h" #include "keys.h" @@ -161,13 +158,7 @@ public: component = new InputCheckboxComponent(options, children, styleManager); } else if (id == K_RADIO) { component = new InputRadioComponent(options, children, styleManager); - } -#if (FEATURE_COMPONENT_EDITTEXT == 1) - else if (id == K_TEXT || id == K_PASSWORD) { - component = new InputEditTextComponent(options, children, styleManager); - } -#endif // FEATURE_COMPONENT_EDITTEXT - else { + } else { // default type is input button component = new InputButtonComponent(options, children, styleManager); } diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp index 8f63c5fbd..fb8b080d0 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.cpp @@ -150,20 +150,5 @@ bool ViewOnSwipeListener::OnDragEnd(UIView& view, const DragEvent &event) return isStopPropagation_; } - -void ValueChangeListener::OnChange(UIView &view, const char *value) -{ - if (IS_UNDEFINED(fn_)) { - return; - } - - jerry_value_t textValue = jerry_create_string(reinterpret_cast(value)); - jerry_value_t args[1] = {textValue}; - if (jerry_value_is_function(fn_)) { - CallJSFunctionAutoRelease(fn_, UNDEFINED, args, 1); - } - ReleaseJerryValue(textValue, VA_ARG_END_FLAG); - return; -} } // namespace ACELite } // namespace OHOS diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.h index 375f8670b..124b8f7ed 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/event_listener.h @@ -27,7 +27,6 @@ #include "ui_scroll_view.h" #include "ui_slider.h" #include "ui_toggle_button.h" -#include "ui_edit_text.h" namespace OHOS { namespace ACELite { @@ -83,22 +82,6 @@ private: bool isChanging_; // the flag to avoid change event cycle execute }; -class ValueChangeListener final : public OHOS::UIEditText::OnChangeListener { -public: - ACE_DISALLOW_COPY_AND_MOVE(ValueChangeListener); - explicit ValueChangeListener(jerry_value_t fn) - : fn_(jerry_acquire_value(fn)) {} - - ~ValueChangeListener() - { - jerry_release_value(fn_); - } - - void OnChange(UIView& view, const char* value) override; -private: - jerry_value_t fn_; -}; - class ViewOnClickListener final : public UIView::OnClickListener { public: ACE_DISALLOW_COPY_AND_MOVE(ViewOnClickListener); diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/input_edittext_component.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/input_edittext_component.cpp deleted file mode 100644 index fa0e81bdc..000000000 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/input_edittext_component.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2020-2022 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" -#if (FEATURE_COMPONENT_EDITTEXT == 1) -#include "input_edittext_component.h" -#include "ace_log.h" -#include "key_parser.h" -#include "keys.h" -#include "product_adapter.h" - -namespace OHOS { -namespace ACELite { -bool InputEditTextComponent::CreateNativeViews() -{ - fontSize_ = ProductAdapter::GetDefaultFontSize(); - // set font family - if (!CopyFontFamily(fontFamily_, ProductAdapter::GetDefaultFontFamilyName())) { - return false; - } - return true; -} - -void InputEditTextComponent::ReleaseNativeViews() -{ - if (onValueChangeListener_ != nullptr) { - delete onValueChangeListener_; - onValueChangeListener_ = nullptr; - } - ACE_FREE(fontFamily_); -} - -bool InputEditTextComponent::SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) -{ - switch (attrKeyId) { - case K_TYPE: - if (jerry_value_is_string(attrValue)) { - char *type = MallocStringOf(attrValue); - if (type == nullptr) { - HILOG_ERROR(HILOG_MODULE_ACE, "type is nullptr"); - return false; - } - if (strcmp(type, "password")) { - edittext_.SetInputType(InputType::TEXT_TYPE); - } else { - edittext_.SetInputType(InputType::PASSWORD_TYPE); - } - ACE_FREE(type); - return true; - } - HILOG_ERROR(HILOG_MODULE_ACE, "the edittext type is error value"); - break; - case K_VALUE: - if (jerry_value_is_string(attrValue)) { - char *value = MallocStringOf(attrValue); - if (value == nullptr) { - HILOG_ERROR(HILOG_MODULE_ACE, "value is nullptr"); - return false; - } - edittext_.SetText(value); - ACE_FREE(value); - return true; - } - HILOG_ERROR(HILOG_MODULE_ACE, "the edittext value is error value"); - break; - case K_PLACEHOLDER: - if (jerry_value_is_string(attrValue)) { - char *placeholder = MallocStringOf(attrValue); - if (placeholder == nullptr) { - HILOG_ERROR(HILOG_MODULE_ACE, "placeholder is nullptr"); - return false; - } - edittext_.SetPlaceholder(placeholder); - ACE_FREE(placeholder); - return true; - } - HILOG_ERROR(HILOG_MODULE_ACE, "the edittext placeholder is error value"); - break; - case K_MAX_LENGTH: - if (jerry_value_is_number(attrValue)) { - uint16_t maxLenth = IntegerOf(attrValue); - edittext_.SetMaxLength(maxLenth); - return true; - } - HILOG_ERROR(HILOG_MODULE_ACE, "the edittext maxLenth is error value"); - break; - default: - return false; - } - return false; -} - -bool InputEditTextComponent::RegisterPrivateEventListener(uint16_t eventTypeId, - jerry_value_t funcValue, - bool isStopPropagation) -{ - if (eventTypeId == K_CHANGE) { - if (onValueChangeListener_) { - HILOG_ERROR(HILOG_MODULE_ACE, "valueChange listener existed"); - return false; - } - onValueChangeListener_ = new ValueChangeListener(funcValue); - if (onValueChangeListener_ == nullptr) { - HILOG_ERROR(HILOG_MODULE_ACE, "create valueChange listener failed"); - return false; - } - edittext_.SetOnChangeListener(onValueChangeListener_); - return true; - } - return false; -} - -bool InputEditTextComponent::ApplyPrivateStyle(const AppStyleItem *style) -{ - bool result = true; - uint16_t styleKey = GetStylePropNameId(style); - if (!KeyParser::IsKeyValid(styleKey)) { - return false; - } - switch (styleKey) { - case K_FONT_SIZE: - result = SetFontSize(style); - break; - case K_COLOR: - result = SetColor(*style); - break; - case K_PLACEHOLDER_COLOR: - result = SetPlaceholderColor(*style); - break; - default: - result = false; - break; - } - return result; -} - -void InputEditTextComponent::PostUpdate(uint16_t attrKeyId) -{ - if (!KeyParser::IsKeyValid(attrKeyId)) { - HILOG_ERROR(HILOG_MODULE_ACE, "input component post update check args failed"); - return; - } - switch (attrKeyId) { - case K_VALUE: - break; - case K_FONT_SIZE: - case K_FONT_FAMILY: - if (fontFamily_ != nullptr) { - edittext_.SetFont(fontFamily_, fontSize_); - } - break; - default: - break; - } -} - -uint8_t InputEditTextComponent::GetFontSize() -{ - return fontSize_; -} - - -bool InputEditTextComponent::SetFontSize(const AppStyleItem *style) -{ - fontSize_ = GetStylePixelValue(style); - return true; -} - -bool InputEditTextComponent::SetColor(const AppStyleItem &style) -{ - uint32_t color = 0; - uint8_t alpha = OPA_OPAQUE; - if (GetStyleColorValue(&style, color, alpha)) { - edittext_.SetStyle(STYLE_TEXT_COLOR, GetRGBColor(color).full); - edittext_.SetStyle(STYLE_TEXT_OPA, alpha); - return true; - } - return false; -} - -bool InputEditTextComponent::SetPlaceholderColor(const AppStyleItem &style) -{ - uint32_t color = 0; - OHOS::ColorType color32; - uint8_t alpha = OPA_OPAQUE; - if (GetStyleColorValue(&style, color, alpha)) { - color32.full = (alpha << 24) | color; // 24:alpha bit offset in color32 - edittext_.SetPlaceholderColor(color32); - return true; - } - return false; -} -} // namespace ACELite -} // namespace OHOS -#endif // FEATURE_COMPONENT_VIDEO \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/input_edittext_component.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/input_edittext_component.h deleted file mode 100644 index c345c2456..000000000 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/input_edittext_component.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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_INPUT_EDIT_TEXT_COMPONENT_H -#define OHOS_ACELITE_INPUT_EDIT_TEXT_COMPONENT_H -#include "acelite_config.h" -#if (FEATURE_COMPONENT_EDITTEXT == 1) -#include "component.h" -#include "flex_layout.h" -#include "non_copyable.h" -#include "key_parser.h" -#include "ui_edit_text.h" - -namespace OHOS { -namespace ACELite { -class InputEditTextComponent final : public Component { -public: - - ACE_DISALLOW_COPY_AND_MOVE(InputEditTextComponent); - InputEditTextComponent() = delete; - InputEditTextComponent(jerry_value_t options, jerry_value_t children, AppStyleManager *manager) - : Component(options, children, manager), - onValueChangeListener_(nullptr), - fontFamily_(nullptr), - fontSize_(DEFAULT_FONT_SIZE) - { - SetComponentName(K_INPUT); - } - ~InputEditTextComponent() override {}; - bool CreateNativeViews() override; - void ReleaseNativeViews() override; - bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override; - bool RegisterPrivateEventListener(uint16_t eventTypeId, jerry_value_t funcValue, bool isStopPropagation) override; - bool ApplyPrivateStyle(const AppStyleItem *style) override; - void PostUpdate(uint16_t attrKeyId) override; - uint8_t GetFontSize(); -protected: - UIView *GetComponentRootView() const override - { - return const_cast(&edittext_); - } - -private: - bool SetFontSize(const AppStyleItem *style); - bool SetColor(const AppStyleItem &style); - bool SetPlaceholderColor(const AppStyleItem &style); - UIEditText edittext_; - ValueChangeListener* onValueChangeListener_; - char *fontFamily_; - uint8_t fontSize_; -}; -} // namespace ACELite -} // namespace OHOS -#endif // FEATURE_COMPONENT_EDITTEXT -#endif // OHOS_ACELITE_INPUT_EDIT_TEXT_COMPONENT_H \ No newline at end of file diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_adapter.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_adapter.cpp index abf9cec2d..765686e23 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_adapter.cpp +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/components/list_adapter.cpp @@ -23,7 +23,6 @@ #include "directive/descriptor_utils.h" #include "fatal_handler.h" #include "securec.h" -#include "text_component.h" namespace OHOS { namespace ACELite { @@ -297,61 +296,6 @@ void ListAdapter::BuildItemViewTree(const JSValue element) const } } Component::BuildViewTree(component, nullptr, parentParam); - - //text componet adapts to height and width in list-item - - int16_t allh = 0; - int16_t allw = 0; - - if (direction_ == UIList::VERTICAL) { - if (component->GetDimension(K_HEIGHT).type == DimensionType::TYPE_UNKNOWN) { - JSValue children = component->GetChildren(); - uint16_t length = JSArray::Length(children); - - for (uint16_t idx = 0; idx < length; ++idx) { - JSValue key = JSArray::Get(children, idx); - - Component *chidrenComponent = ComponentUtils::GetComponentFromBindingObject(key); - - if (chidrenComponent->GetComponentName() == K_TEXT){ - TextComponent* textComponent = reinterpret_cast(chidrenComponent); - UILabel *uiLabel = textComponent->GetUILabelView(); - int16_t chidrenComponentHeight = uiLabel->GetHeight(); - allh += chidrenComponentHeight; - }else{ - int16_t chidrenComponentHeight = chidrenComponent->GetHeight(); - allh += chidrenComponentHeight; - } - } - - component->SetHeight(allh); - Component::BuildViewTree(component, nullptr, parentParam); - } - } else { - if (component->GetDimension(K_WIDTH).type == DimensionType::TYPE_UNKNOWN) { - JSValue children = component->GetChildren(); - uint16_t length = JSArray::Length(children); - - for (uint16_t idx = 0; idx < length; ++idx) { - JSValue key = JSArray::Get(children, idx); - - Component *chidrenComponent = ComponentUtils::GetComponentFromBindingObject(key); - - if (chidrenComponent->GetComponentName() == K_TEXT){ - TextComponent* textComponent = reinterpret_cast(chidrenComponent); - UILabel *uiLabel = textComponent->GetUILabelView(); - int16_t chidrenComponentWidth = uiLabel->GetWidth(); - allw += chidrenComponentWidth; - }else{ - int16_t chidrenComponentWidth = chidrenComponent->GetWidth(); - allw += chidrenComponentWidth; - } - } - - component->SetWidth(allw); - Component::BuildViewTree(component, nullptr, parentParam); - } - } component->OnViewAttached(); } 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 11f151a3d..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 @@ -30,7 +30,6 @@ public: TextComponent() = delete; TextComponent(jerry_value_t options, jerry_value_t children, AppStyleManager* styleManager); ~TextComponent() override {} - UILabel* GetUILabelView() const; protected: bool CreateNativeViews() override; @@ -38,6 +37,7 @@ protected: UIView *GetComponentRootView() const override; bool SetPrivateAttribute(uint16_t attrKeyId, jerry_value_t attrValue) override; bool ApplyPrivateStyle(const AppStyleItem* styleItem) override; + UILabel* GetUILabelView() const; void OnViewAttached() override; void PostUpdate(uint16_t attrKeyId) override; diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/acelite_config.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/acelite_config.h index 9fef1e282..2b332f1d0 100755 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/acelite_config.h +++ b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/interfaces/acelite_config.h @@ -37,13 +37,6 @@ */ #define FEATURE_COMPONENT_CANVAS -/** - * enable edittext component Feature - */ -#ifndef FEATURE_COMPONENT_EDITTEXT -#define FEATURE_COMPONENT_EDITTEXT 1 -#endif - /** * enable QRcode component */ @@ -170,7 +163,7 @@ /** * support device module */ -#define FEATURE_MODULE_DEVICE +//xx00 #define FEATURE_MODULE_DEVICE /** * date time module diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/device_module.cpp b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/device_module.cpp deleted file mode 100644 index 6598ea0c9..000000000 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/device_module.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/* - * 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 -#include "ace_log.h" -#include "js_app_context.h" -#include "js_async_work.h" -#include "product_adapter.h" -#include -#include "device_module.h" -#include "media_log.h" -#include "global.h" -#include "screen.h" - -namespace OHOS { -namespace ACELite { - -const char * const DeviceModule::DEVICE_BRAND = "brand"; -const char * const DeviceModule::DEVICE_MANUFACTURER = "manufacturer"; -const char * const DeviceModule::DEVICE_MODEL = "model"; -const char * const DeviceModule::DEVICE_PRODUCT = "product"; -const char * const DeviceModule::DEVICE_LANGUAGE = "language"; -const char * const DeviceModule::DEVICE_REGION = "region"; -const char * const DeviceModule::DEVICE_WINDOW_WIDTH_NAME = "windowWidth"; -const char * const DeviceModule::DEVICE_WINDOW_HEIGHT_NAME = "windowHeight"; -const char * const DeviceModule::DEVICE_SCREEN_DENSITY_NAME = "screenDensity"; -const char * const DeviceModule::DEVICE_SCREEN_SHAPE = "screenShape"; -const uint32_t DeviceModule::DEVICE_SCREEN_DENSITY = 326; -const uint8_t DeviceModule::DEVICE_API_VERSION = 4; -const char * const DeviceModule::DEVICE_TYPE = "deviceType"; -const char * const DeviceModule::DEVICE_API_VERSION_NAME = "apiVersion"; - -bool DeviceModule::GetBrand(JSIValue result) -{ bool ret = true; - const char *brand = DEVICE_BRAND; - if (brand == nullptr) { - ret = false; - } else { - JSI::SetStringProperty(result, DEVICE_BRAND, brand); - } - return ret; -} - -bool DeviceModule::GetManufacturer(JSIValue result) -{ - bool ret = true; - const char *manufacturer = DEVICE_MANUFACTURER; - if (manufacturer == nullptr) { - ret = false; - } else { - JSI::SetStringProperty(result, DEVICE_MANUFACTURER, manufacturer); - } - return ret; -} - -bool DeviceModule::GetModel(JSIValue result) -{ - bool ret = true; - const char *mode = DEVICE_MODEL; - if (mode == nullptr) { - ret = false; - } else { - JSI::SetStringProperty(result, DEVICE_MODEL, mode); - } - return ret; -} - -bool DeviceModule::GetProduct(JSIValue result) -{ - bool ret = true; - const char *product = DEVICE_PRODUCT; - if (product == nullptr) { - ret = false; - } else { - JSI::SetStringProperty(result, DEVICE_PRODUCT, product); - } - return ret; -} - -const char* DeviceModule::translateText(char* input) -{ - if (strcmp(input, "zh") == 0) { - return "Chinese"; - } else if (strcmp(input, "en") == 0) { - return "English"; - } else { - return "Chinese"; - } -} - -bool DeviceModule::GetLanguage(JSIValue result) -{ - bool ret = true; - char language[MAX_LANGUAGE_LENGTH + 1] = { 0 }; - uint8_t res = GLOBAL_GetLanguage(language, MAX_LANGUAGE_LENGTH); - JSI::SetStringProperty(result, DEVICE_LANGUAGE, translateText(language)); - return ret; -} - -bool DeviceModule::GetRegion(JSIValue result) -{ - bool ret = true; - const char *region = DEVICE_REGION; - if (region == nullptr) { - ret = false; - } else { - JSI::SetStringProperty(result, DEVICE_REGION, region); - } - return ret; -} - -bool DeviceModule::GetScreenInfo(JSIValue result) -{ - Screen &screen = Screen::GetInstance(); - ScreenShape screenShapetmp = screen.GetScreenShape(); - uint32_t windowHeight = screen.GetHeight(); - uint32_t windowWidth = screen.GetWidth(); - uint32_t screenDensity = DEVICE_SCREEN_DENSITY; - const char* screenShape = screenShapetmp ? "circle" : "rect"; - - JSI::SetStringProperty(result, DEVICE_SCREEN_SHAPE, screenShape); - JSI::SetNumberProperty(result, DEVICE_WINDOW_WIDTH_NAME, static_cast(windowWidth)); - JSI::SetNumberProperty(result, DEVICE_WINDOW_HEIGHT_NAME, static_cast(windowHeight)); - JSI::SetNumberProperty(result, DEVICE_SCREEN_DENSITY_NAME, static_cast(screenDensity)); - return true; -} - -bool DeviceModule::GetDeviceType(JSIValue result) -{ - bool ret = true; - const char *deviceType = DEVICE_TYPE; - if (deviceType == nullptr) { - ret = false; - } else { - JSI::SetStringProperty(result, DEVICE_TYPE, deviceType); - } - return ret; -} - -bool DeviceModule::GetApiVersion(JSIValue result) -{ - bool ret = true; - uint8_t apiVersion = DEVICE_API_VERSION; - JSI::SetNumberProperty(result, DEVICE_API_VERSION_NAME, apiVersion); - return ret; -} - -JSIValue DeviceModule::GetInfo(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum) -{ - return ExecuteAsyncWork(thisVal, args, argsNum, ExecuteGetDeviceInfo); -} - -JSIValue DeviceModule::ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc) -{ - JSIValue undefValue = JSI::CreateUndefined(); - if ((args == nullptr) || (argsNum == 0) || (JSI::ValueIsUndefined(args[0]))) { - HILOG_ERROR(HILOG_MODULE_ACE, "Error in obtaining device information parameters"); - return undefValue; - } - DeviceParams* params = new(std::nothrow) DeviceParams(); - if (params == nullptr) { - return undefValue; - } - params->thisVal = JSI::AcquireValue(thisVal); - params->args = JSI::AcquireValue(args[0]); - JsAsyncWork::DispatchAsyncWork(ExecuteFunc, reinterpret_cast(params)); - return undefValue; -} - -void DeviceModule::ExecuteGetDeviceInfo(void* data) -{ - DeviceParams* params = reinterpret_cast(data); - if (params == nullptr) { - return; - } - JSIValue args = params->args; - JSIValue thisVal = params->thisVal; - JSIValue result = JSI::CreateObject(); - - if (GetBrand(result) && GetManufacturer(result) && GetModel(result) && GetProduct(result) - && GetLanguage(result) && GetRegion(result) && GetScreenInfo(result) && - GetApiVersion(result) && GetDeviceType(result)) - { - SuccessCallBack(thisVal, args, result); - } else { - FailCallBack(thisVal, args, -1); - } - - JSI::ReleaseValueList(args, thisVal, result, ARGS_END); - delete params; -} - -void DeviceModule::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); -} - -void DeviceModule::FailCallBack(const JSIValue thisVal, const JSIValue args, int ret) -{ - if (JSI::ValueIsUndefined(args)) { - return; - } - JSIValue errInfo; - errInfo = JSI::CreateString("GetDeviceInfo faild"); - 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); -} - -} // namespace ACELite -} // namespace OHOS diff --git a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/device_module.h b/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/device_module.h deleted file mode 100644 index 775edc074..000000000 --- a/code/sdk/open_source/openharmony/foundation/ace/ace_engine_lite/modules/device_module.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 OHOS_ACELITE_DEVICE_MODULE_H -#define OHOS_ACELITE_DEVICE_MODULE_H - -#include -#include "acelite_config.h" -#include "jsi.h" -#include "js_async_work.h" -#include "non_copyable.h" -#include "product_adapter.h" -#include "abilityms_slite_client.h" - -namespace OHOS { -namespace ACELite { - -struct DeviceParams { - JSIValue args = JSI::CreateUndefined(); - JSIValue thisVal = JSI::CreateUndefined(); -}; - -class DeviceModule final : public MemoryHeap { -public: - ACE_DISALLOW_COPY_AND_MOVE(DeviceModule); - DeviceModule() = default; - ~DeviceModule() = default; - static const char * const DEVICE_BRAND; - static const char * const DEVICE_MANUFACTURER; - static const char * const DEVICE_MODEL; - static const char * const DEVICE_PRODUCT; - static const char * const DEVICE_LANGUAGE; - static const char * const DEVICE_REGION; - static const char * const DEVICE_WINDOW_WIDTH_NAME; - static const char * const DEVICE_WINDOW_HEIGHT_NAME; - static const char * const DEVICE_SCREEN_DENSITY_NAME; - static const char * const DEVICE_SCREEN_SHAPE; - static const uint32_t DEVICE_SCREEN_DENSITY; - static const uint8_t DEVICE_API_VERSION; - static const char * const DEVICE_TYPE; - static const char * const DEVICE_API_VERSION_NAME; - static JSIValue GetInfo(const JSIValue thisVal, const JSIValue *args, uint8_t argsNum); - static bool GetBrand(JSIValue result); - static bool GetManufacturer(JSIValue result); - static bool GetModel(JSIValue result); - static bool GetProduct(JSIValue result); - static bool GetLanguage(JSIValue result); - static bool GetRegion(JSIValue result); - static bool GetScreenInfo(JSIValue result); - static bool GetDeviceType(JSIValue result); - static bool GetApiVersion(JSIValue result); - static const char* translateText(char* input); - -private: - static JSIValue ExecuteAsyncWork(const JSIValue thisVal, const JSIValue* args, uint8_t argsNum, AsyncWorkHandler ExecuteFunc); - static void SuccessCallBack(const JSIValue thisVal, const JSIValue args, JSIValue jsiValue); - static void FailCallBack(const JSIValue thisVal, const JSIValue args, int ret); - static void ExecuteGetDeviceInfo(void *data); - -}; - -void InitDeviceModule(JSIValue exports) -{ - JSI::SetModuleAPI(exports, "getInfo", DeviceModule::GetInfo); -} - -} // namespace ACELite -} // namespace OHOS -#endif // OHOS_ACELITE_APP_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 731ee5bd9..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 @@ -32,7 +32,7 @@ extern void InitRouterModule(JSIValue exports); extern void InitAppModule(JSIValue exports); #ifdef FEATURE_MODULE_AUDIO extern void InitAudioModule(JSIValue exports); -extern void InitAudioCapturerModule(JSIValue exports); +extern void InitAudioCaptuerModule(JSIValue exports); extern void InitBaiduMapComponentModule(JSIValue exports); #endif // FEATURE_MODULE_AUDIO #ifdef FEATURE_ACELITE_DFX_MODULE @@ -50,9 +50,9 @@ extern void InitNativeApiFs(JSIValue exports); extern void InitNativeApiKv(JSIValue exports); #endif -#ifdef FEATURE_MODULE_DEVICE -extern void InitDeviceModule(JSIValue exports); -#endif +// #ifdef FEATURE_MODULE_DEVICE +// extern void InitDeviceModule(JSIValue exports); +// #endif // #ifdef FEATURE_MODULE_GEO // extern void InitLocationModule(JSIValue exports); @@ -87,7 +87,7 @@ const Module OHOS_MODULES[] = { {"app", InitAppModule}, #ifdef FEATURE_MODULE_AUDIO {"audio", InitAudioModule}, - {"audiocapturer", InitAudioCapturerModule}, + {"audiocaptuer", InitAudioCaptuerModule}, #endif #ifdef FEATURE_MODULE_BAIDU {"baidumapcomponent",InitBaiduMapComponentModule}, @@ -110,9 +110,9 @@ const Module OHOS_MODULES[] = { {"file", InitNativeApiFs}, {"storage", InitNativeApiKv}, #endif -#ifdef FEATURE_MODULE_DEVICE - {"device", InitDeviceModule}, -#endif +// #ifdef FEATURE_MODULE_DEVICE +// {"device", InitDeviceModule}, +// #endif // #ifdef FEATURE_MODULE_GEO // {"geolocation", InitLocationModule}, // #endif 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 d39cac67c..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 b81389216..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/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h b/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_captuer_lite/recording_module.h old mode 100644 new mode 100755 similarity index 77% rename from code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h rename to code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_captuer_lite/recording_module.h index e720e60a3..729062b9e --- a/code/sdk/middleware/services/media/foundation/audio_capturer/interfaces/kits/audio_capturer_lite/recording_module.h +++ b/code/sdk/open_source/openharmony/foundation/multimedia/audio_capturer/interfaces/kits/audio_captuer_lite/recording_module.h @@ -1,55 +1,55 @@ -/* -* Copyright (c) CompanyNameMagicTag. 2021-2021. All rights reserved. -* Description: audio capture wrapper -* Author: Media Software Group -* Create: 2021-09-13 -*/ - -#ifndef AUDIOCAPTURER_MODULE_H -#define AUDIOCAPTURER_MODULE_H - -#include -#include "jsi.h" -#include "audio_capturer.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int32_t AudioCaptureSample(int32_t argc, const char *argv[]); - - -#ifdef __cplusplus -}; -#endif - -namespace OHOS { -namespace ACELite { -class AudioCapturerModule final : public MemoryHeap { -public: - /** - * constructor - */ - AudioCapturerModule() = default; - - /** - * desconstructor - */ - ~AudioCapturerModule() = default; - /** - * Start - */ - static JSIValue Start(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); - - /** - * Stop - */ - static JSIValue Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); -}; - -void InitAudioCapturerModule(JSIValue exports); -} -} - - -#endif +/* +* Copyright (c) CompanyNameMagicTag. 2021-2021. All rights reserved. +* Description: audio capture wrapper +* Author: Media Software Group +* Create: 2021-09-13 +*/ + +#ifndef AUDIOCAPTURER_MODULE_H +#define AUDIOCAPTURER_MODULE_H + +#include +#include "jsi.h" +#include "audio_capturer.h" + +#ifdef __cplusplus +extern "C" { +#endif + +int32_t AudioCaptureSample(int32_t argc, const char *argv[]); + + +#ifdef __cplusplus +}; +#endif + +namespace OHOS { +namespace ACELite { +class AudioCaptuerModule final : public MemoryHeap { +public: + /** + * constructor + */ + AudioCaptuerModule() = default; + + /** + * desconstructor + */ + ~AudioCaptuerModule() = default; + /** + * Start + */ + static JSIValue Start(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); + + /** + * Stop + */ + static JSIValue Stop(const JSIValue thisVal, const JSIValue *args, uint8_t argsSize); +}; + +void InitAudioCaptuerModule(JSIValue exports); +} +} + + +#endif diff --git a/code/sdk/protocol/bt/host/bt/bts/bg_common/include/ahi_a/mpc_trans.h b/code/sdk/protocol/bt/host/bt/bts/bg_common/include/ahi_a/mpc_trans.h index b193b681c..bd57de7bf 100755 --- a/code/sdk/protocol/bt/host/bt/bts/bg_common/include/ahi_a/mpc_trans.h +++ b/code/sdk/protocol/bt/host/bt/bts/bg_common/include/ahi_a/mpc_trans.h @@ -17,7 +17,7 @@ extern "C" { #endif #endif -#define ACORE_MAX_PKT_RETRY_CNT 3 + #define WRITE_PROPERTY_ERR_TIMES 100 #define BT_ACORE_TASK_QUEUE_SIZE 500 typedef enum { diff --git a/code/sdk/protocol/bt/host/bt/bts/bg_common/include/ahi_common/mpc_code_def.h b/code/sdk/protocol/bt/host/bt/bts/bg_common/include/ahi_common/mpc_code_def.h deleted file mode 100644 index 34e7c9cbe..000000000 --- a/code/sdk/protocol/bt/host/bt/bts/bg_common/include/ahi_common/mpc_code_def.h +++ /dev/null @@ -1,580 +0,0 @@ -/* - * Copyright (c) @CompanyNameMagicTag 2022-2023. All rights reserved. - * Description: test at cmd proc - */ -#ifndef MPC_CODE_DEF_H -#define MPC_CODE_DEF_H -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -typedef enum { - MPC_COMMAND_BLE_BASE = 0x10, - MPC_COMMAND_BR_BASE = 0x30, - MPC_COMMAND_GLE_BASE = 0x50, - MPC_COMMAND_TEST_BASE = 0x70, -} mc_service_base; - -typedef enum { - BT_DEVICE_MGR_SVR = MPC_COMMAND_BLE_BASE, - BLE_CONNECT_SVR, - BT_MANAGER_SVR, - BT_DESKTOP_SVR, -} mc_service_type_ble; - -typedef enum { - GLE_MANAGER_SVR = MPC_COMMAND_GLE_BASE, -} mc_service_type_gle; - -typedef enum { - MC_BT_SRV_A2DP = MPC_COMMAND_BR_BASE, - MC_BT_SRV_AVRCP, - MC_BT_SRV_HFP, - MC_BT_SRV_PBAP, - MC_BT_SRV_GAP, - MC_BT_SRV_GAP_EVENT, - MC_BT_SRV_SPP, - MC_BT_SRV_PAN, - MC_BT_SVR_BRANDY_MAX, -} mc_service_type_br; - -typedef enum { - MC_BT_FACTORY_TEST_SVR = MPC_COMMAND_TEST_BASE, - MC_BT_SRV_BRANDY_PTS, - MC_BT_SRV_DONGLE_TEST -} mc_service_type_test; - -/* service_id: MC_BT_FACTORY_TEST_SVR */ -typedef enum { - MC_BT_DFT_BT_BASE = 0x00, - MC_BT_DFT_CHECK_EFLASH = 0x01, - MC_BT_DFT_RF_TEST_ON = 0x02, - MC_BT_DFT_RF_TX_ONOFF = 0x03, - MC_BT_DFT_READ_HW_VERSION = 0x04, - MC_BT_DFT_READ_VOLTAGE = 0x05, - MC_BT_DFT_RESERVED_1306 = 0x06, - MC_BT_DFT_WRITE_BDADDR = 0x07, - MC_BT_DFT_READ_BDADDR = 0x08, - MC_BT_DFT_NAME_WRITE = 0x09, - MC_BT_DFT_NAME_READ = 0x0A, - MC_BT_DFT_READ_BT_VERSION = 0x0B, - MC_BT_DFT_READ_MFI_ID = 0x0C, - MC_BT_DFT_SQIF_RW_CHECK = 0x0D, - MC_BT_DFT_MICA_LOOP = 0x0E, - MC_BT_DFT_MICB_LOOP = 0x0F, - MC_BT_DFT_MIC_CALIBRATION = 0x10, - MC_BT_DFT_ENTER_DFU_MODE = 0x11, - MC_BT_DFT_FACTORY_MODE = 0x12, - MC_BT_DFT_RESET_PDL = 0x13, - MC_BT_DFT_READ_USB_PORT = 0x14, - MC_BT_DFT_SET_USB_PORT = 0x15, - MC_BT_DFT_PSKEY_READ = 0x16, - MC_BT_DFT_ENTER_PAIRING = 0x17, - MC_BT_DFT_TEMP_READ = 0x18, - MC_BT_DFT_RESET = 0x19, - MC_BT_DFT_ENTER_DUT_MODE = 0x1A, - MC_BT_DFT_POWER_ON = 0x1B, - MC_BT_DFT_POWER_OFF = 0x1C, - MC_BT_DFT_SET_SIG_CMD = 0x1D, - MC_BT_DFT_RF_BLE_TX_MODE = 0x25, - MC_BT_DFT_RF_BLE_RX_MODE = 0x26, - MC_BT_DFT_RF_RESET_RX_COUNT = 0x27, - MC_BT_DFT_RF_READ_RX_COUNT = 0x28, - MC_BT_DFT_RF_BREDR_TX_MODE = 0x2B, - MC_BT_DFT_RF_BREDR_RX_MODE = 0x2C, - MC_BT_DFT_CALI_POWER_INIT = 0x2D, - MC_BT_DFT_CALI_POWER_START = 0x2E, - MC_BT_DFT_CALI_POWER_END = 0x2F, - MC_BT_DFT_OPERATION_CALIBRATION = 0x30, - MC_BT_DFT_TRANSPARENT_TRANS = 0x31, - MC_BT_DFT_DISCONNECT_LINK = 0x32, - MC_BT_DFT_QUERY_CON_INFO = 0x33, - MC_BT_DFT_QUERY_PAIRED_DEVICE_INFO = 0x34, - MC_BT_DFT_BLE_DEV_INFO = 0x37, - MC_BT_DFT_ADDR_INFO_SET = 0x39, - MC_BT_DFT_GATT_GAP_REG = 0x3A, - MC_BT_DFT_RF_RX_COUNT_RSP = 0x3B, - MC_BT_DFT_SET_VENDOR_CMD = 0x3C, -} mc_bt_dft_command_type; - -/* service_id: BT_DEVICE_MGR_SVR */ -typedef enum { - MC_BT_DEV_GET_VERSION = 0x01, - MC_BT_DEV_RESET_FACTORY = 0x02, - MC_BT_DEV_BAT_VALUE = 0x03, - MC_BT_DEV_BAT_STATE = 0x04, - MC_BT_DEV_START_COMP = 0x05, - MC_BT_DEV_INFO = 0x06, - MC_BT_DEV_BT_LOST_REMIND = 0x07, - MC_BT_MANAGER_RECOVER_CALIBRATION_DATA = 0x08, - MC_BT_MANAGER_RECOVER_SMP_KEYS = 0x09, - MC_BT_MANAGER_RECOVER_PRODUCT_TYPE = 0x0a, - MC_BT_MANAGER_RECOVER_SYS_CONFIG = 0x0b, - MC_BT_MANAGER_SET_LOCAL_ADDR = 0x0c, - MC_BT_MANAGER_SET_LOCAL_NAME = 0x0d, - MC_BT_MANAGER_REPORT_SMP_KEYS = 0x0e, -} mc_bt_dev_manager_command_type; - -/* service_id: BLE_CONNECT_SVR */ -typedef enum { - MC_BLE_CONN_STATE = 0x01, - MC_BLE_PAIR_MODE = 0x02, - MC_BLE_DISCONN = 0x03, - MC_BLE_QUERY_CONN_STATE = 0x04, - MC_BLE_ENTER_HV_MODE = 0x05, - MC_BLE_BPM_DATA = 0x06, - MC_BLE_DEL_PAIR_INFO = 0x07, // MCU notify BLE delete pair infomation - MC_BLE_RPT_HRS_MODE = 0x08, // BLE report hrs mode - MC_BLE_RPT_SAIS_MODE = 0x09, // BLE report sais mode - MC_BLE_ADV_ENABLE = 0x0A, - MC_BLE_CONNECT_PEER = 0x0B, - MC_BLE_SET_PRODUCT_TYPE = 0x0C, - MC_BLE_MTU_INQUERY = 0x0D, - MC_BLE_CONN_UPDATE = 0x0E, - - /* General Interface for Stack */ - MC_BLE_L2CAP_REG_PSM = 0x20, - MC_BLE_L2CAP_UNREG_PSM, - MC_BLE_L2CAP_CREDIT_CH_REQ, - MC_BLE_L2CAP_CREDIT_CH_RSP, - MC_BLE_L2CAP_CREDIT_CH_RX, - MC_BLE_L2CAP_CH_TX, - MC_BLE_L2CAP_CREDIT_FLOW_CTRL, /* 0x25 */ - MC_BLE_L2CAP_DISCONNECTION, - MC_BLE_L2CAP_SET_CONFIG_PARAMS, - MC_BLE_L2CAP_CONNECT, - - /* General Interface for gatt server Stack */ - MC_BLE_GATT_CREATE_SERVER = 0x40, - MC_BLE_GATT_CREATE_SERVICE = 0x41, - MC_BLE_GATT_ADD_INCLUDE_SERVICE = 0x42, - MC_BLE_GATT_ADD_CHARACTER = 0x43, - MC_BLE_GATT_ADD_DESC = 0x44, - MC_BLE_GATT_START_SERVICE = 0x45, - MC_BLE_GATT_SEND_RESPONSE = 0x46, - MC_BLE_GATT_UPDATE_CHARACTER_VALUE = 0x47, - MC_BLE_GATT_UPDATE_DESCRIPTOR_VALUE = 0x48, - MC_BLE_GATT_GET_GAP_ATTTIBUTE = 0x49, - MC_BLE_GATT_SET_GAP_ATTTIBUTE = 0x4A, - MC_BLE_GATT_MULTIPLE_VALUE_NTF = 0x4B, - MP_BLE_GATT_MTU_SET_PARAM = 0x4C, - MC_BLE_GATT_WRITE_IND = 0x4D, - MC_BLE_GATT_READ_IND = 0x4E, - MC_BLE_GATT_STOP_SERVICE = 0x4F, - MC_BLE_GATT_MTU_CHANGED = 0x50, - - /* General Interface for gatt client Stack */ - MC_BLE_GATT_DISCOVERY_SERVICE = 0x51, - MC_BLE_GATT_DISCOVERY_INCLUDE = 0x52, - MC_BLE_GATT_DISCOVERY_CHARACTER = 0x53, - MC_BLE_GATT_DISCOVERY_CHARACTER_BY_UUID = 0x54, - MC_BLE_GATT_DISCOVERY_DESCRIPTOR = 0x55, - MC_BLE_GATT_DISCOVERY_DESCRIPTOR_BY_HANDLE = 0x56, - MC_BLE_GATT_READ_CHARACTER = 0x57, - MC_BLE_GATT_READ_CHARACTER_BY_UUID = 0x58, - MC_BLE_GATT_READ_MULTIPLE_CHARACTER = 0x59, - MC_BLE_GATT_MULTIPLE_VALUE_READ_CHARACTER = 0x5A, - MC_BLE_GATT_WRITE_CHARACTER = 0x5B, - MC_BLE_GATT_RELIABLE_WRITE_CHARACTER = 0x5C, - MC_BLE_GATT_READ_DESCRIPTOR = 0x5D, - MC_BLE_GATT_WRITE_DESCRIPTOR = 0x5E, - MC_BLE_GATT_MTU_CONFIG = 0x5F, - MC_BLE_GATT_VALUE_NOTIFICATION = 0x60, - MC_BLE_GATT_GET_HID_DEVICE_REPORT = 0x61, - MC_BLE_GATT_SET_ATT_MIN_KEY_SIZE = 0x62, - MC_BLE_GATT_SET_ATT_CONFIG_PARAM = 0x63, - MC_BLE_GATT_UPDATE_CHARACTER_VALUE_BY_UUID = 0x64, - MC_BLE_GATT_DISCOVERY_SERVICE_COMPMLETE = 0x65, - MC_BLE_GATT_DISCOVERY_CHARACTER_COMPMLETE = 0x66, - MC_BLE_GATT_DISCOVERY_DESCRIPTOR_COMPMLETE = 0x67, - MC_BLE_GATT_READ_CHARACTER_COMPLETE = 0x68, - - MC_BLE_GAP_ADV_RPT = 0x70, - MC_BLE_GAP_UPDATE_CONN_PARAMS = 0x71, - MC_BLE_GAP_EXT_ADV_ENABLE = 0x72, - MC_BLE_GAP_ADD_WHITE_LIST = 0x73, - MC_BLE_GAP_RMV_WHITE_LIST = 0x74, - - MC_BLE_GAP_GET_LOCAL_APPEARANCE = 0x75, - MC_BLE_GAP_SET_LOCAL_APPEARANCE = 0x76, - MC_BLE_GAP_SET_PERIOD_ADVERTISING = 0x77, - MC_BLE_GAP_DIS_PERIOD_ADVERTISING = 0x78, - MC_BLE_GAP_SET_PERIOD_ADV_LIST = 0x79, - MC_BLE_GAP_PERIOD_ADV_CREATE_SYNC = 0x7a, - MC_BLE_GAP_PERIOD_ADV_TERMINATE_SYNC = 0x7b, - - MC_BLE_GAP_DIS_EXTERN_ADV = 0x7c, - MC_BLE_GAP_SET_EXTERN_ADV = 0x7d, - MC_BLE_GAP_RMV_EXTERN_ADV = 0x7e, - MC_BLE_GAP_DIS_EXTERN_SCAN = 0x7f, - MC_BLE_GAP_SET_EXTERN_SCAN = 0x80, - MC_BLE_GAP_SET_RANDOM_ADDR = 0x81, - MC_BLE_GAP_GET_WHITE_LIST = 0x82, - MC_BLE_GAP_CON_USE_WHITE_LIST = 0x83, - MC_BLE_GAP_SET_GLOABL_VALUE = 0x84, - MC_BLE_GAP_SET_CONN_PARAM = 0x85, - MC_BLE_GAP_SET_HCI_LE_EVENT_MASK = 0x86, - MC_BLE_GAP_SET_ADDR_RESOLVE = 0x87, - MC_BLE_GAP_ADV_SET_TERMINATED = 0x88, - MC_BLE_READ_RSSI = 0x89, - MC_BLE_SET_HCI_LINK_KEY = 0x8A, - MC_BLE_SET_PHY = 0x8B, - MC_BLE_SET_DATA_LENGTH = 0x8C, - - MC_BLE_SMP_SET_SEC_PARAM = 0xA0, - MC_BLE_SMP_PASSKEY_REQ = 0xA1, - MC_BLE_SMP_PASSKEY_NOTIFY = 0xA2, - MC_BLE_SMP_PAIR_COMPLETE = 0xA3, - MC_BLE_SMP_REMOVE_PAIR_INFO = 0xA4, - MC_BLE_SMP_SET_KEY_FROM_BTC = 0xA5, - MC_BLE_SMP_REMOVE_PAIR_DEVICE = 0xA6, - MC_BLE_SMP_REPORT_PAIRED_KEYS = 0xA7, - MC_BLE_SMP_CTKD_PARAM = 0xA8, - /* General Interface for Stack */ -} mc_ble_conn_manager_command_type; - -/* service_id: BT_DESKTOP_SVR */ -typedef enum { - MC_BT_DESKTOP_BASE = 0x00, - MC_BT_DESKTOP_KEYBOARD_INPUT = 0x01, - MC_BT_DESKTOP_KEYBOARD_OUTPUT = 0x02, - MC_BT_DESKTOP_MOUSE_INPUT = 0x03, -} mc_bt_desktop_command_type; - -/* service_id: BT_MANAGER_SVR */ -typedef enum { - MC_BT_MANAGER_SYNC_REQ = 0x01, - MC_BT_MANAGER_SYNC_RSP = 0x02, - MC_BT_MANAGER_CHANGE_REQ = 0x03, - MC_BT_MANAGER_CHANGE_RSP = 0x04, - MC_BT_MANAGER_LOCK_STATE_NOTIFY = 0x05, - MC_BT_MANAGER_FAC_RESET = 0x06, - MC_BT_MANAGER_DEV_SHUTDOWN = 0x07, - MC_BT_MANAGER_DEV_HIGHT_POWER = 0x08, - MC_BT_MANAGER_SELFIND_INFO_NOTIFY = 0x09, /* Only used to Selfind adv func */ - MC_BT_MANAGER_TRANSPARENT = 0x0A, - MC_BT_MANAGER_PDL_OPERATION = 0x0B, /* Transmit the storage info of PDL to BT Core */ - MC_BT_MANAGER_RESET_TYPE = 0x0C, - MC_BT_MANAGER_PRODUCT_MODE = 0x0D, - MC_BT_MANAGER_MODE_CHANGE = 0x0E, -} mc_bt_manager_command_type; - -/* service_id: MC_BT_SRV_DONGLE_TEST */ -typedef enum { - MC_BT_DONGLE_TEST -} mc_dongle_test_command_type; - -typedef enum { - MC_GENERAL_CMD_L2CAP1 = 0x2, - MC_GENERAL_CMD_L2CAP2 = 0x3, - MC_GENERAL_CMD_GATT1 = 0x4, - MC_GENERAL_CMD_GATT2 = 0x5, - MC_GENERAL_CMD_GATT3 = 0x6, - MC_GENERAL_CMD_GAP1 = 0x7, - MC_GENERAL_CMD_GAP2 = 0x8, - MC_GENERAL_CMD_GAP3 = 0x9, - MC_GENERAL_CMD_SMP = 0xA, - MC_GENERAL_CMD_NUM, -} mc_general_cmd_t; - -/* service_id: MC_BT_SRV_GAP */ -typedef enum { - GAP_SDK_INIT = 0x00, - GAP_SDK_DISCONNECT, - GAP_SDK_CONNECT_EX, - GAP_SDK_START_DEFAULT_BT, - GAP_IF_START_DEVICE_DISCOVERY, - GAP_IF_SET_DISCOVERY_MODE, - GAP_IF_GET_DISCOVERY_MODE, - GAP_IF_STOP_DISCOVERY, - GAP_IF_CREATE_ACL, - GAP_IF_GET_REMOTE_DEV_HANDLE, - GAP_IF_IS_DEVICE_CONNECTED, - GAP_IF_DISCONNECT_ACL_HANDLE, - GAP_IF_PAIR_DEVICE, - GAP_IF_UNPAIR_DEVICE, - GAP_IF_ADD_RMT_DEVICE, - GAP_IF_UPDATE_RMT_DEVICE_NAME, - GAP_IF_GET_LOCAL_ADDR, - GAP_IF_SET_LOCAL_ADDR, - GAP_IF_GET_LOCAL_NAME, - GAP_IF_SET_LOCAL_NAME, - GAP_IF_GET_RMT_DEV_ADDR, - GAP_IF_BROWSE_RMT_SERVICE, - GAP_IF_SET_VOICE_SHM_ID, - GAP_IF_RECONNECT_PHONE, - GAP_IF_SET_TX_POWER, - GAP_IF_SDK_DONE, - GAP_IF_CREATE_ACL_ASYNC, - GAP_IF_UPDATE_RMT_DEVICE_NAME_ASYNC, - GAP_IF_READ_RSSI_BR, - GAP_IF_SET_ACTIVE_SCENE, - GAP_IF_SET_INQUIRY_SCAN_PARAM, - GAP_IF_RESTORE_REMOTE_DEVICE, - GAP_IF_GET_LINK_MODE, - GAP_IF_SET_BR_SECURE_PARAM -} mpc_bt_stack_gap_opcode; - -/* service_id: MC_BT_SRV_A2DP */ -typedef enum { - MC_BT_SRV_A2DP_CONNECT, - MC_BT_SRV_A2DP_DISCONNECT, - MC_BT_SRV_A2DP_STREAM_START, - MC_BT_SRV_A2DP_STREAM_SUSPEND, - MC_BT_SRV_A2DP_SET_AUDIO_SHMID, - MC_BT_SRV_A2DP_SET_STREAM_CODEX, - MC_BT_SRV_A2DP_RPT_REMOTE_SEP_CAP, - MC_BT_SRV_A2DP_RPT_STREAM_STATE, - MC_BT_SRV_A2DP_RPT_STREAM_CONFIG, - MC_BT_SRV_A2DP_RPT_STREAM_REJECT, - MC_BT_SRV_A2DP_STREAM_START_ACCEPT, - MC_BT_SRV_A2DP_SNK_UNREGISTER_SERVICE, - MC_BT_SRC_A2DP_MAX, -} mc_bt_a2dp_command_type; - -/* service_id: MC_BT_SRV_HFP */ -typedef enum { - MC_BT_SRV_HFP_DAIL, - MC_BT_SRV_HFP_CANCEL_CALL, - MC_BT_SRV_HFP_3WAY_HANDLE, - MC_BT_SRV_HFP_ANSWER_CALL, - MC_BT_SRV_HFP_SPK_VOL, - MC_BT_SRV_HFP_MIC_VOL, - MC_BT_SRV_HFP_AUDIO_CONN_TRANS, - MC_BT_SRV_HFP_TX_DTMF, - MC_BT_SRV_HFP_GET_CURRENT_CALL, - MC_BT_SRV_VOICE_RECOGNITION, - MC_BT_SRV_HFP_SCO_ACCEPT, - MC_BT_SRV_HFP_HF_CMD_CBK, - MC_BT_SRV_HFP_AG_ANSWER_CALL, - MC_BT_SRV_HFP_AG_CANCEL_CALL, - MC_BT_SRV_HFP_AG_AUDIO_CONN_TRANS, - MC_BT_SRV_HFP_AG_SEND_NETWORK_EVENT, - MC_BT_SRV_HFP_AG_SEND_CURRENT_CALL, - MC_BT_SRV_HFP_AG_SPK_VOL, - MC_BT_SRV_HFP_AG_MIC_VOL, - MC_BT_SRV_HFP_AG_SEND_SUBSCRIBER_NUMBER, - MC_BT_SRV_HFP_AG_SEND_BATTERY_CHARGE, - MC_BT_SRV_HFP_AG_SEND_CMEE_ERROR, - MC_BT_SRV_HFP_AG_SEND_NETWORK_OPERATOR, - MC_BT_SRV_HFP_AG_SET_INDICATOR_VAL, - MC_BT_SRV_HFP_AG_SEND_INCOMING_EVENT, - MC_BT_SRV_HFP_AG_CHANGE_INBAND_RING_SETTING, - MC_BT_SRV_HFP_AG_CMD_CBK, - MC_BT_SRV_HFP_AG_ORIGINATE_CALL, - MC_BT_SRC_HFP_MAX, -} mc_bt_hfp_command_type; - -/* service_id: MC_BT_SRV_AVRCP */ -typedef enum { - MC_BT_SRV_AVRCP_CT_REG_SRV, - MC_BT_SRV_AVRCP_CT_REG_NOTIFY, - MC_BT_SRV_AVRCP_CT_GET_CAP, - MC_BT_SRV_AVRCP_CT_PASS_THROUGH, - MC_BT_SRV_AVRCP_CT_GET_ELEMENT_ATTR, - MC_BT_SRV_AVRCP_CT_GET_PLAY_STATUS, - MC_BT_SRV_AVRCP_CT_SET_ABSOLUTE_VOL_REQ, - MC_BT_SRV_AVRCP_TG_SET_ABSOLUTE_VOL_RSP, - MC_BT_SRV_AVRCP_TG_EVT_PLAY_STATUS_CHG, - MC_BT_SRV_AVRCP_TG_EVT_TRACK_CHG, - MC_BT_SRV_AVRCP_TG_EVT_TRACK_REACH_END, - MC_BT_SRV_AVRCP_TG_EVT_TRACK_REACH_START, - MC_BT_SRV_AVRCP_TG_EVT_PLAY_POS_CHG, - MC_BT_SRV_AVRCP_TG_EVT_PLAY_CONTENT_CHG, - MC_BT_SRV_AVRCP_TG_EVT_AVAILABLE_PLAYER_CHG, - MC_BT_SRV_AVRCP_TG_EVT_ADDR_PLAYER_CHG, - MC_BT_SRV_AVRCP_TG_EVT_UIDS_CHG, - MC_BT_SRV_AVRCP_TG_EVT_VOL_CHG, - MC_BT_SRV_AVRCP_CT_GET_CAPAILITIES_RSP, - MC_BT_SRV_AVRCP_TG_CMD_CBK, - MC_BT_SRV_AVRCP_CT_EVT_RSP_CBK, - MC_BT_SRC_AVRCP_MAX, -} mc_bt_avrcp_command_type; - -/* service_id: MC_BT_SRV_PBAP */ -typedef enum { - MC_BT_SRV_PBAP_PULL_PHONEDBOOK, - MC_BT_SRV_PBAP_PULL_CARDLIST, - MC_BT_SRV_PBAP_PULL_CARDENTRY, - MC_BT_SRV_PBAP_SET_PATH, - MC_BT_SRV_PBAP_CANCEL_TRANSFER, - MC_BT_SRV_PBAP_WRITE_FILE, - MC_BT_SRV_PBAP_APP_EVENT, -} mc_bt_pbap_command_type; - -/* service_id: MC_BT_SRV_SPP */ -typedef enum { - MC_BT_SRV_SPP_REGISTER, - MC_BT_SRV_SPP_READ_STREAM, - MC_BT_SRV_SPP_WRITE_STREAM, - MC_BT_SRV_SPP_APP_EVENT, - MC_BT_SRV_SPP_UNREGISTER, - MC_BT_SRC_SPP_MAX, -} mc_bt_spp_command_type; - -typedef enum { - MC_BT_SRV_PAN_CONNECT, - MC_BT_SRV_PAN_DISCONNECT, - MC_BT_SRV_PAN_SETUP_CONN, - MC_BT_SRV_PAN_FILTER_PROTOCOL, - MC_BT_SRV_PAN_FILTER_MULTIADDR, - MC_BT_SRV_PAN_ETHERNET_REQ, - MC_BT_SRV_PAN_NET_STATE_CHANGE, - MC_BT_SRV_PAN_FILTER_PROTOCOL_RESULT, - MC_BT_SRV_PAN_FILTER_MULTIADDR_RESULT, - MC_BT_SRV_PAN_RPT_ETHERNET, - MC_BT_SRV_PAN_REGISTER_CBK, - MC_BT_SRC_PAN_MAX, -} mc_bt_pan_command_type; -/* service_id: MC_BT_SRV_BRANDY_PTS */ -typedef enum { - /* GAP COMMAND */ - MC_BT_SRV_PTS_CREAT_ACL, - MC_BT_SRV_PTS_SEC_MODE_SET, - MC_BT_SRV_PTS_VISUAL_MODE_SET, - MC_BT_SRV_PTS_BOND_MODE_SET, - MC_BT_SRV_PTS_DISCONNECT_BY_ADDR, - MC_BT_SRV_PTS_ENABLE_DISCOVERY, - MC_BT_SRV_PTS_PAIR_RMTDEV, - MC_BT_SRV_PTS_IO_ABILLITY, - MC_BT_SRV_PTS_SET_BT_DEFAULT, - MC_BT_SRV_PTS_SET_SECU_LEVEL, - MC_BT_SRV_PTS_UNPAIR_RMTDEV, - MC_BT_SRV_PTS_ENCRYPTLINK, - MC_BT_SRV_PTS_ADD_RMTDEV, - /* L2CAP COMMAND */ - MC_BT_SRV_PTS_L2CAP_CONNECT_RSP, - MC_BT_SRV_PTS_L2CAP_DISCONNECT_REQ, - MC_BT_SRV_PTS_L2CAP_CONNECT_REQ, - /* PBAP COMMAND */ - MC_BT_SRV_PTS_PBAP_CONNECT_REQ, - MC_BT_SRV_PTS_PBAP_DISCONNECT_REQ, - /* AVRCP COMMAND */ - MC_BT_SRV_PTS_AVRCP_CONN, - MC_BT_SRV_PTS_AVRCP_SET_ADDRESSED_PLAYER, - MC_BT_SRV_PTS_AVRCP_SET_BROWSED_PLAYER, - MC_BT_SRV_PTS_AVRCP_FLOADER_ITEMS, - MC_BT_SRV_PTS_AVRCP_GET_TOTAL_NUM_OF_ITEMS, - MC_BT_SRV_PTS_AVRCP_SEARCH, - MC_BT_SRV_PTS_AVRCP_SET_ABSOLUTE_VOLUME, - MC_BT_SRV_PTS_AVRCP_REGISTER_NOTIFICATION, - MC_BT_SRV_PTS_AVCTP_CONT_BROW_SET, - MC_BT_SRV_PTS_AVCTP_CONT_BROW_REL, - MC_BT_SRV_PTS_AVRCP_PASS_THROUGT, - MC_BT_SRV_PTS_AVRCP_SUB_UNIT_INFO, - MC_BT_SRV_PTS_AVRCP_UNIT_INFO, - MC_BT_SRV_PTS_AVRCP_REGISTER_SEP, - MC_BT_SRV_PTS_AVRCP_PASS_THROUGH_RSP, - MC_BT_SRV_PTS_AVRCP_SET_ABSOLUTE_VOL_RSP, - MC_BT_SRV_PTS_AVRCP_GET_CAPABILITIES_RSP, - MC_BT_SRV_PTS_AVRCP_EVENT_PLAYER_APP_SET_CMD_RSP, - MC_BT_SRV_PTS_AVRCP_EVENT_VOL_CHANGED_RSP, - MC_BT_SRV_PTS_AVRCP_TG_SET_VOL_CHANGED, - MC_BT_SRV_PTS_AVRCP_EVENT_TRACK_CHANGED_RSP, - MC_BT_SRV_PTS_AVRCP_CT_EVENT_GET_FOLDER_ITEMS_RSP, - MC_BT_SRV_PTS_AVRCP_CHANGE_PATH, - MC_BT_SRV_PTS_AVRCP_PLAY_ITEM, - MC_BT_SRV_PTS_AVRCP_ADD_TO_NOW_PLAYING, - MC_BT_SRV_PTS_AVRCP_SET_BROWSED_PLAYER_RSP, - MC_BT_SRV_PTS_AVRCP_SET_ADDRESSED_PLAYER_RSP, - MC_BT_SRV_PTS_AVRCP_GET_PLAY_STATUS_RSP, - MC_BT_SRV_PTS_AVRCP_GET_ELEMENT_ATTRIBUTES_RSP, - MC_BT_SRV_PTS_AVRCP_TG_REJECT_REGISTER_NOTIFICATION, - MC_BT_SRV_PTS_AVRCP_EVENT_PLAYER_APP_SET_CHANGED_RSP, - MC_BT_SRV_PTS_AVRCP_GET_FOLDER_ITEMS_RSP, - MC_BT_SRV_PTS_AVRCP_GET_FOLDER_ITEMS_OTHER_RSP, - MC_BT_SRV_PTS_AVRCP_EVENT_ADDR_PLAYER_CHANGED_RSP, - MC_BT_SRV_PTS_AVRCP_EVENT_AVAILABLE_PLAYERS_CHANGED_RSP, - MC_BT_SRV_PTS_AVRCP_TG_EVENT_UID_CHANGED_RSP, - MC_BT_SRV_PTS_AVRCP_GET_FOLDER_ITEMS_ONE_EXTERN_RSP, - MC_BT_SRV_PTS_AVRCP_GET_FOLDER_ITEMS_TWO_EXTERN_RSP, - MC_BT_SRV_PTS_AVRCP_GET_FOLDER_ITEMS_THREE_EXTERN_RSP, - MC_BT_SRV_PTS_AVRCP_STATE_INIT, - MC_BT_SRV_PTS_AVRCP_GET_ELEMENT_ATTRIBUTES_FRAGMENT_RSP, - /* HFP COMMAND */ - MC_BT_SRV_PTS_AUDIO_CONN_HFP, - MC_BT_SRV_PTS_HF_NETWORK_OP_REQ_HFP, - MC_BT_SRV_PTS_HF_SPK_VOL_HFP, - MC_BT_SRV_PTS_HF_MIC_VOL_HFP, - MC_BT_SRV_PTS_HF_GET_SUB_SCRIBER_NUM, - MC_BT_SRV_PTS_HF_GET_CURRENT_CALLS, - MC_BT_SRV_PTS_HF_DISABLE_NREC, - MC_BT_SRV_PTS_HF_GET_RESPONSE_HOLD_STATUS, - MC_BT_SRV_PTS_HF_SET_EXTENDED_ERRORS, - MC_BT_SRV_PTS_HF_GET_PHONE_MANU_MODEL, - MC_BT_SRV_PTS_HF_GET_HOLD_INCOMING_CALL, - MC_BT_SRV_PTS_HF_ACCEPT_HELD_INCOMMING_CALL, - MC_BT_SRV_PTS_HF_REJECT_INCOMING_CALL, - MC_BT_SRV_PTS_HF_ANSWER_CALL, - MC_BT_SRV_PTS_HF_HOLD_INCOMING_CALL, - MC_BT_SRV_PTS_HF_CANCEL_INCOMING_CALL, - MC_BT_SRV_PTS_HF_CANCEL_CALL, - MC_BT_SRV_PTS_HF_TAG_PHONENUM, - MC_BT_SRV_PTS_HF_SET_VOICE_RECONITION_REQ, - MC_BT_SRV_PTS_HF_TRANSMIT_DTMF_CODE, - MC_BT_SRV_PTS_HF_DIAL, - MC_BT_SRV_PTS_HF_DIAL_SECOND_CALL, - MC_BT_SRV_PTS_HF_LAST_NUM_REDIAL, - MC_BT_SRV_PTS_HF_SLC_CONN, - MC_BT_SRV_PTS_HF_SLC_DISCONN, - MC_BT_SRV_PTS_HF_GET_AG_FEATURES, - MC_BT_SRV_PTS_HF_3_WAY_CALLING_CHLD_0, - MC_BT_SRV_PTS_HF_3_WAY_CALLING_CHLD_1, - MC_BT_SRV_PTS_HF_3_WAY_CALLING_CHLD_2, - MC_BT_SRV_PTS_HF_3_WAY_CALLING_CHLD_3, - MC_BT_SRV_PTS_HF_3_WAY_CALLING_CHLD_4, - MC_BT_SRV_PTS_HF_REPT_CHANGED_CODEC_CAP, - /* RFCOMM COMMAND */ - MC_BT_SRV_PTS_RFCOMM_CONN_REQ, - MC_BT_SRV_PTS_RFCOMM_DISCONN_REQ, - MC_BT_SRV_PTS_RFCOMM_CONN_RSP, - MC_BT_SRV_PTS_RFCOMM_DATA_REQ, - MC_BT_SRV_PTS_RFCOMM_RLS_REQ, - MC_BT_SRV_PTS_RFCOMM_REG_SERVER, - /* SDP COMMAND */ - MC_BT_SRV_PTS_SDP_SA_ADD_ATTR, - MC_BT_SRV_PTS_SDP_SSA_ADD_ATTR, - MC_BT_SRV_PTS_SDP_SSA_ADDI_DESC, - MC_BT_SRV_PTS_SDP_ADD_RECORD, - MC_BT_SRV_PTS_SDP_RM_RECORD, - /* AVCTP COMMAND */ - MC_BT_SRV_PTS_AVCTP_CONN, - MC_BT_SRV_PTS_AVCTP_DISCONN, - MC_BT_SRV_PTS_AVCTP_CT_NFR, - MC_BT_SRV_PTS_AVCTP_CT_FRA, - MC_BT_SRV_PTS_AVCTP_TG_FRA, - /* A2DP COMMAND */ - MC_BT_SRV_PTS_A2DP_SRC_CONN, - MC_BT_SRV_PTS_A2DP_SRC_DISCONN, - MC_BT_SRV_PTS_A2DP_SRC_SEND_STREAM, - MC_BT_SRV_PTS_A2DP_SRC_SUSPEND_STREAM, - /* AVDTP */ - MC_BT_SRV_PTS_AVDTP_GET_CONF, - MC_BT_SRV_PTS_AVDTP_REGIST_CAP, - MC_BT_SRV_PTS_AVDTP_ABORT, - /* PBAP COMMAND */ - MC_BT_SRV_PTS_PBAP_CONNECT, - MC_BT_SRV_PTS_PBAP_DISCONNECT, - MC_BT_SRV_PTS_PBAP_PULL_PB, - MC_BT_SRV_PTS_PBAP_PULL_CARD_LIST, - MC_BT_SRV_PTS_PBAP_PULL_PB_ENTRY, - MC_BT_SRV_PTS_PBAP_SET_PB_REQ, - MC_BT_SRV_PTS_PBPA_ABORT_PULL_ACTION, - /* BNEP */ - MC_BT_SRV_PTS_PAN_CONNECT, - MC_BT_SRV_PTS_PAN_DISCONNECT, - MC_BT_SRV_PTS_PAN_FILTER_MULTIADDR, - MC_BT_SRV_PTS_PAN_ETHERNET_REQ -} mc_bt_pts_command_type; - -#define BT_SHIFT_BITS_8 8 -#define cmd_id_2_opcode(service_id, command_id) (((service_id) << BT_SHIFT_BITS_8) | (command_id)) - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cpluscplus */ -#endif /* __cpluscplus */ -#endif /* end of MPC_CODE_DEF_H */ diff --git a/code/sdk/protocol/bt/host/bt/bts/bg_common/include/hci/hci_hlp.h b/code/sdk/protocol/bt/host/bt/bts/bg_common/include/hci/hci_hlp.h deleted file mode 100644 index dc1c0628b..000000000 --- a/code/sdk/protocol/bt/host/bt/bts/bg_common/include/hci/hci_hlp.h +++ /dev/null @@ -1,966 +0,0 @@ - -/* - * Copyright (c) @CompanyNameMagicTag 2021-2022. All rights reserved. - */ - -/* --------------------------------------------------------------------------- -Module Name: - hci_hlp.h -Abstract: - This module defines HCI internal structure, macro & functions. ---------------------------------------------------------------------------- */ - -#ifndef G_HCI_HLP_H -#define G_HCI_HLP_H - -#include "hci_ui.h" - -#pragma pack(1) - -#define ATT_UUID128_LEN 16 -#define ATT_UUID32_LEN 4 -#define ATT_UUID16_LEN 2 - -#define HCI_BTC_INIT_EVENT_MASK_SIZE 0X8 /* WRITE EVENT_MASK_SIZE OF BTC */ - -#define HCI_OPCODE_BITS_NUM 16 - -#define DEC_STEP 10 - -typedef struct { - uint8_t length; - uint8_t sub_ev_code; /* a1 */ - /* HCI_OPS_SET_EVENT_MASK */ - uint8_t event_mask[HCI_BTC_INIT_EVENT_MASK_SIZE]; - /* HCI_OPS_SET_EVENT_MASK_PAGE_2 */ - uint8_t event_mask_page2[HCI_BTC_INIT_EVENT_MASK_SIZE]; - /* HCI_OPS_LE_SET_EVENT_MASK */ - uint8_t le_event_mask[HCI_BTC_INIT_EVENT_MASK_SIZE]; - /* HCI_OPS_WRITE_PAGE_SCAN_ACTIVITY */ - uint16_t page_scan_interval; /* Interval Time */ - uint16_t page_scan_window; /* Scan Window Time */ - /* HCI_OPS_WRITE_LE_HOST_SUPPORT */ - uint8_t le_supported_host; - uint8_t simultaneous_le_host; - /* HCI_OPS_LE_WRITE_SUGGESTED_DEFAULT_DATA_LENGTH */ - uint16_t suggested_maxtx_octets; - uint16_t suggested_maxtx_time; - /* HCI_OPS_LE_SET_DEFAULT_PHY */ - uint8_t all_phys; - uint8_t tx_phys; - uint8_t rx_phys; - /* HCI_OPS_WRITE_PAGE_SCAN_TYPE */ - uint8_t page_scan_type; - /* HCI_OPS_WRITE_AFH_CHANNEL_ASSESSMENT_MODE */ - uint8_t afh_channel_assessment_mode; - /* HCI_OPS_WRITE_INQUIRY_MODE */ - uint8_t inquiry_mode; - /* HCI_OPS_SET_CONTROLLER_TO_HOST_FLOW_CONTROL */ - uint8_t flow_control_enable; - /* HCI_OPS_WRITE_SIMPLE_PAIRING_MODE */ - uint8_t simple_pairing_mode; - /* HCI_OPS_WRITE_CONNECTION_ACCEPT_TIMEOUT */ - uint16_t conn_accept_timeout; - /* HCI_OPS_WRITE_DEFAULT_LINK_POLICY_SETTINGS */ - uint16_t link_policy_settings; - - void *_rom; -} fast_reset_write_btc_init_cmd; -#pragma pack() - -typedef struct { - uint16_t subrate; - uint16_t latency; -} hci_subrate; - -fast_reset_write_btc_init_cmd fast_reset_init_write_cmd(void); - -#define HCI_OPC_RESET_FAST_SET_BTC_INIT 0xFC0B - -#define HCI_OPS_RESET_FAST_SET_BTC_INIT 0x0d30FC0B /* ((0x0F << 24) 'R' | (0x30 << 16) | 0xFC0B | 0x0000) */ - -#define HCI_INTERNAL_FUNCTION 1 /* Only used by hci_le.h to exclude internal functions for other modules */ - -extern struct fsm_inst *hci_fsminst; -extern uint8_t g_is_bth_with_smart_wear; -/* --------------------------------------------------------------------------- */ -/* HCI Interface Macros */ -/* --------------------------------------------------------------------------- */ -enum { - /* Ret in hci_command_check_block */ - HCI_CMD_ALLOW, - HCI_CMD_BLOCK_BYNUM, /* Number of hci command packet limited */ - HCI_CMD_BLOCK_BYOPCODE, /* Same operation is outstanding */ - HCI_CMD_BLOCK_BYRESET, /* Reset is outstanding, pendding other commands */ - - /* Debug Only */ - HCI_CMD_ADD, - HCI_CMD_REMOVE -}; - -struct hci_bit_pointer_stru { /* For hci_coding_get_bits */ - uint8_t *p; /* Current Octet pointer */ - uint8_t off; /* Keep current octet remaining bits usage offset */ -}; - -struct hci_x_param_stru { - uint8_t len; - uint8_t data[1]; -}; - -struct hci_rtx_timer_stru { - uint8_t ampid; /* to find local controller node */ - uint16_t opcode; /* to find command node in local, only in sent section */ -}; - -struct hci_local_timer_stru { - void *local; /* to find local controller node */ - uint8_t id; /* etc, HCI_LOCALRTX_ID_ADVSCAN_TIME_LIMITED */ -}; - -struct hci_acl_link_timer_stru { - void *acllink; -}; - -/* --------------------------------------------------------------------------- */ -/* Local/Remote Object structure */ -/* --------------------------------------------------------------------------- */ -enum { /* timeout[x] in struct hci_local_stru */ - HCI_LINFO_TIMEOUT_PAGE, /* *0.625, include extended page timeout */ - HCI_LINFO_TIMEOUT_CONN_ACCEPT, - HCI_LINFO_TIMEOUT_EXTENDED_INQUIRY_LENGTH, /* *0.625 */ - - HCI_LINFO_TIMEOUT_SLOTS /* x counter */ -}; - -enum { /* packet_length[x] & packet_num[x] in struct hci_local_stru */ - HCI_LINFO_PACKET_ACL, - HCI_LINFO_PACKET_LE, /* Maybe different with ACL, check HCI_LINFO_MASK_LE_SHARE_ACL_BUFFER */ - HCI_LINFO_PACKET_DATABLOCK, - HCI_LINFO_PACKET_CONTROLLER_TO_HOST, - - HCI_LINFO_PACKET_SLOTS /* x counter */ -}; - -enum { /* mask in struct hci_local_stru */ - HCI_LINFO_MASK_IN_PERIODIC_INQUIRY_MODE = 0x00000001, - - /* Two methods of data flow control are defined: 'packet-based' flow control and - 'data-block-based' flow control, known as buffer management */ - HCI_LINFO_MASK_BLOCK_BASED_DATA_FLOW_CONTROL = 0x00000002, - HCI_LINFO_MASK_LOOPBACK_MODE = 0x00000004, /* Loopback mode, not used now */ - HCI_LINFO_MASK_SET_EVENT_FILTER_INQUIRY = 0x00000008, - - /* Limited scan/advertise for LE, scan + adv toghter? */ - HCI_LINFO_MASK_LIMITED = 0x00000010, - /* Static address only generate once when power on, use to control generate only once */ - HCI_LINFO_MASK_STATIC_ADDRESS = 0x00000020, - HCI_LINFO_MASK_LE_ADV_PARAMETER = 0x00000040, /* New LE_ADV_Parameter */ - HCI_LINFO_MASK_BONDABLE = 0x00000080, /* Local bondable */ - /* LE Advertise/Scan Fast to Slow automaticly, when it comes slow, bit removed */ - HCI_LINFO_MASK_FAST_AUTO_SLOW = 0x00000200, - /* State QoS already called stoped, otherwise is data processing */ - HCI_LINFO_MASK_QOS_STOP = 0x00000400, - HCI_LINFO_MASK_CONTROLLER_TO_HOST_FLOW_CONTROL = 0x00000800, - /* LE_Read_Buffer_Size return 0, shared between BR/EDR and LE transports */ - HCI_LINFO_MASK_LE_SHARE_ACL_BUFFER = 0x00001000, - HCI_LINFO_MASK_SECURE_SIMPLE_PAIRING_ENABLE = 0x00002000, - HCI_LINFO_MASK_SECURE_CONNECTION_ENABLE = 0x00004000, - - HCI_LINFO_MASK_ADV_ENABLED = 0x00008000, /* Mesh test */ - HCI_LINFO_MASK_SCAN_ENABLED = 0x00010000, - HCI_LINFO_MASK_LE_SCAN_PARAMETER = 0x00020000, - HCI_LINFO_MASK_LE_SCAN_ENABLE_PARAMETER = 0x00040000, - HCI_LINFO_MASK_RESOLVABLE_ADDRESS = 0x00080000, /* Local random address is set to RPA */ - HCI_LINFO_MASK_NONE_RESOLVABLE_ADDRESS = 0x00100000, /* Local random address is set to None-RPA */ - /* Local shall be the link master when accept the connection request */ - HCI_LINFO_MASK_BR_LINK_MASTER = 0x00200000, - HCI_LINFO_MASK_RESET_KEEP_BITS = (HCI_LINFO_MASK_BONDABLE | HCI_LINFO_MASK_QOS_STOP) -}; - -enum { /* Timer event of struct hci_local_stru */ - /* Timer[x] */ - HCI_LOCALRTX_ID_ADVSCAN = 0, - HCI_LOCALRTX_ID_LE_PRIVATE_ADDRESS_CHANGE = 1, - HCI_LOCALRTX_ID_UNKNOWN_ACLDATA_FREE = 2, - HCI_LOCALRTX_ID_AUTO_SNIFF = 3, /* ACL link auto-sniff timer, by YDX, 2019.3.20 */ - HCI_LOCALRTX_ID_TIMER_COUNT, /* Num of Local Timer, 3 */ - - /* Events */ - HCI_LOCALRTX_LE_ADVERTISE_TIME_LIMITED = 1, /* Time Limited, DONOT change sequence, 1 */ - HCI_LOCALRTX_LE_SCAN_TIME_LIMITED = 2, /* Time Limited, DONOT change sequence, 2 */ - HCI_LOCALRTX_LE_ADVERTISE_FAST_AUTO_SLOW = 3, /* Fast to slow, DONOT change sequence, 3 */ - HCI_LOCALRTX_LE_SCAN_FAST_AUTO_SLOW = 4, /* Fast to slow, DONOT change sequence, 4 */ - HCI_LOCALRTX_LE_RESOLVABLE_ADDRESS_CHANGE = 5, /* Change address */ - HCI_LOCALRTX_LE_NON_RESOLVABLE_ADDRESS_CHANGE = 6, /* Change address */ - HCI_LOCALRTX_UNKNOWN_ACLDATA = 7, /* Cache ACL data before connection handle awares */ - HCI_LOCALRTX_AUTO_SNIFF = 8 /* ACL link auto-sniff timer, by YDX, 2019.3.20 */ -}; - -enum { /* le_status in local controller object struct hci_local_stru */ - /* Bitmask */ - HCI_LEISA_IDLE = 0, - HCI_LEISA_INITIATE = 1, - HCI_LEISA_SCAN = 2, - HCI_LEISA_ADV = 3, - HCI_LEISA_SA = 4, - - HCI_LEISA_ENABLE = 0x80, - HCI_LEISA_DISABLE = 0x40, - HCI_LEISA_TRANSIST = (0x80 | 0x40), - - HCI_LEISA_IDLE2SCAN = HCI_LEISA_ENABLE | (HCI_LEISA_IDLE << 3) | (HCI_LEISA_SCAN), - HCI_LEISA_SCAN2IDLE = HCI_LEISA_DISABLE | (HCI_LEISA_SCAN << 3) | (HCI_LEISA_IDLE), - HCI_LEISA_IDLE2ADV = HCI_LEISA_ENABLE | (HCI_LEISA_IDLE << 3) | (HCI_LEISA_ADV), - HCI_LEISA_ADV2IDLE = HCI_LEISA_DISABLE | (HCI_LEISA_ADV << 3) | (HCI_LEISA_IDLE), - HCI_LEISA_SCAN2SA = HCI_LEISA_ENABLE | (HCI_LEISA_SCAN << 3) | (HCI_LEISA_SA), - HCI_LEISA_SA2SCAN = HCI_LEISA_DISABLE | (HCI_LEISA_SA << 3) | (HCI_LEISA_SCAN), - HCI_LEISA_ADV2SA = HCI_LEISA_ENABLE | (HCI_LEISA_ADV << 3) | (HCI_LEISA_SA), - HCI_LEISA_SA2ADV = HCI_LEISA_DISABLE | (HCI_LEISA_SA << 3) | (HCI_LEISA_ADV), - HCI_LEISA_SA2IDLE = HCI_LEISA_DISABLE | (HCI_LEISA_SA << 3) | (HCI_LEISA_IDLE), -}; - -enum { - HCI_LEISA_SCAN_ENABLE = 0x80, - HCI_LEISA_ADV_ENABLE = 0x40, - HCI_LEISA_SCAN_DISABLE = 0x20, - HCI_LEISA_ADV_DISABLE = 0x10 -}; - -#define HCI_ADVERTISING_TYPE_DISABLED 0xFF -#define HCI_LE_SCAN_TYPE_DISABLED 0xFF - -#define hci_leisa_go(t, s, d) ((t) | ((s) << 3) | (d)) -#define hci_leisa_from(a) (((a) >> 3) & 0x07) -#define hci_leisa_to(a) ((a) & 0x07) - -#define hci_linfo_packet_slotamp(local_) \ - ((((local_)->mask & HCI_LINFO_MASK_BLOCK_BASED_DATA_FLOW_CONTROL) != 0) \ - ? HCI_LINFO_PACKET_DATABLOCK \ - : HCI_LINFO_PACKET_ACL) - -#define hci_linfo_packet_slot(local_, link_) (((link_)->link.type == HCI_LINK_TYPE_LE) \ - ? (((local_)->mask & HCI_LINFO_MASK_LE_SHARE_ACL_BUFFER) != 0) \ - ? HCI_LINFO_PACKET_ACL \ - : HCI_LINFO_PACKET_LE \ - : (((local_)->mask & HCI_LINFO_MASK_BLOCK_BASED_DATA_FLOW_CONTROL) != 0) \ - ? HCI_LINFO_PACKET_DATABLOCK \ - : HCI_LINFO_PACKET_ACL) - -enum { /* type of the LE_ControllerAddrNodeList_xxx */ - HCI_CANODE_MASK_WHITELIST = 0x01, - HCI_CANODE_MASK_RESOLVINGLIST = 0x02 -}; - -#if (defined(CONFIG_LE) && defined(CONFIG_BREDR_HCI)) -/* Dual Mode */ -#define LOCAL_ADDR_NUM 3 /* HCI_ADDR_IDENTITY, HCI_ADDR_PRIVATE, HCI_ADDR_BREDR */ -#define HCI_ADDR_BREDR 2 /* After HCI_ADDR_PRIVATE */ -#else -#define HCI_ADDR_BREDR HCI_ADDR_IDENTITY /* LE Only or BREDR Only, Public is IDENTITY */ -#ifdef CONFIG_LE -/* LE Only */ -#define LOCAL_ADDR_NUM 2 /* HCI_ADDR_IDENTITY/HCI_ADDR_BREDR, HCI_ADDR_PRIVATE */ -#else -/* BREDR Only */ -#define LOCAL_ADDR_NUM 1 /* HCI_ADDR_IDENTITY/HCI_ADDR_BREDR */ -#endif -#endif - -struct le_set_scan_adv_stru { - uint8_t enable; - uint8_t type; - uint8_t limited; - uint8_t speed; - uint8_t white; -}; - -struct hci_local_stru { /* Local controller include BREDR/AMP */ - HANDLE tl_hdl; /* Transport Layer Handle */ - transport_layer_stru *func; /* Transport Layer Functions */ - /* Limited advertising or scanning for LE, NOCP delay control */ - struct fsm_timer *timer[HCI_LOCALRTX_ID_TIMER_COUNT]; - /* QoS send buffer list, etc, HCI_LINFO_PACKET_DATABLOCK */ - struct bth_list_stru acldata_list[CONFIG_HCI_LOCAL_ACLDATA_LIST_LEN]; - /* QoS callback list, data source instance, to control go/stop */ - struct bth_list_stru qos_cbk; - struct bth_list_stru cmd_list; /* Level 1, struct hci_command_node_stru */ - /* Node as struct hci_controller_addr_node_stru, WhiteList and ResolvingList */ - struct bth_list_stru controller_addr_list; - /* Unknown ACLdata before connection handle awares, a patch for driver */ - struct bth_list_stru unknown_data; - /* Pointer to the 1st pendding command in cmd_list, pendcmd is not sent yet */ - struct hci_command_node_stru *pendcmd; - /* etc: HCI_ADDR_IDENTITY, AMP controller does not have BD, cap only vailed in [0 = Public] */ - struct hci_address_stru addr[LOCAL_ADDR_NUM]; - /* Saves the public address of the device and assigns a value to addr[HCI_ADDR_IDENTITY] if necessary. */ - uint8_t public_addr[BD_ADDR_LEN]; - /* Saves the static address of the device and assigns a value to addr[HCI_ADDR_IDENTITY] if necessary. */ - uint8_t static_addr[BD_ADDR_LEN]; - hci_mp_int dcounter[2]; /* etc: HCI_DCOUNTER_SEND */ - - uint32_t mask; /* Bitmask etc:HCI_LINFO_MASK_IN_PERIODIC_INQUIRY_MODE */ - uint32_t timeout[HCI_LINFO_TIMEOUT_SLOTS]; /* [x] as HCI_LINFO_TIMEOUT_PAGE */ - uint16_t packet_length[HCI_LINFO_PACKET_SLOTS]; /* [x] as HCI_LINFO_PACKET_ACL */ - uint16_t packet_num[HCI_LINFO_PACKET_SLOTS]; /* [x] as HCI_LINFO_PACKET_ACL */ - uint8_t hci_version; /* HCI_HCI_VERSION_4_0 */ - uint8_t supported_commands[64]; /* Supported Command Bit mask table */ - uint8_t lmp_features[HCI_LMP_FEATURE_MAX_PAGE][8]; /* extended features 8 pages? current allocate 2 page? */ -#ifdef CONFIG_LE - uint8_t le_features[8]; /* LE features */ - uint8_t le_states[8]; /* LE supported states */ - uint8_t white_list_size; /* From LE_Read_White_List_Size returns */ - uint8_t resolving_list_size; /* From LE_Read_Resolving_List_Size returns */ - uint16_t max_adv_data_length; /* From LE_Read_Maximum_Advertising_Data_length returns */ - uint8_t num_adv_sets; /* From LE_Read_Number_Of_Supported_Advertising_Sets returns */ - uint8_t prd_dev_list_size; /* From LE_Read_Periodic_Avertiser_List_Size returns */ - - uint8_t leisa_tar; /* HCI_LEISA_ADV_ENABLE */ - uint8_t leisa_cur; /* HCI_LEISA_ADV */ - uint8_t is_le_ext_adving; - struct le_set_scan_adv_stru adv_set; /* ADV setting - For compatibility */ - struct le_set_scan_adv_stru scan_set; /* SCAN setting - For compatibility */ - struct hci_le_set_advertising_parameters_stru *adv_par; /* Legacy Advertising parameters */ - struct hci_le_ext_scan_parameters_stru *scan_par; /* Extended Scan parameters */ - struct hci_le_ext_scan_enable_stru scan_enable_par; /* Extended Scan Enable parameters */ -#endif - - uint8_t cap; /* etc: HCI_ADDRESS_CAP_LE */ -#ifdef MULTIPLE_TRANSPORT_LAYER_SUPPORT - uint8_t ampid; /* HCI allocated local Controller ID */ -#endif - /* From Command_Status and Command_Complete num_hci_command_packets */ - uint8_t cmd_num; - - void *_rom; -}; - -/* --------------------------------------------------------------------------- */ -/* Root Object structure */ -/* --------------------------------------------------------------------------- */ -#define HCI_AFH_MAP_MAX_LEN 11 -struct hci_root_stru { /* hci_fsminst->user_data, HCI Root */ - struct bth_list_stru local; /* struct hci_local_stru, Local controllers */ - struct bth_list_stru remote; /* struct hci_remote_stru, Remote devices */ - struct bth_list_stru link; /* struct hci_link_stru, Links, include unestablished */ - struct bth_list_stru evcbk; /* struct HCI_EvCBKStru, HCI user callbacks */ - struct bth_list_stru evcbk_prime; /* struct HCI_EvCBKStru, adv report HCI user callbacks */ - /* struct hci_security_info_stru, security requirement registered by GAP */ - struct bth_list_stru security; - tl_callback_stru *tlbase; /* Poor transport layer interface.... */ - uint8_t io_capability; /* etc: HCI_IO_CAPABILITY_DISPLAYONLY */ - uint8_t afhmap[HCI_AFH_MAP_MAX_LEN]; /* 81bits, AFH RF Channels map for BREDR, LE, WIFI */ - - void *_rom; -}; - -/* --------------------------------------------------------------------------- */ -/* Link Object structures */ -/* --------------------------------------------------------------------------- */ -struct hci_link_stru { /* Common header of a Link */ - struct hci_local_stru *local; - struct hci_remote_stru *remote; - uint16_t connection_handle; /* ACL/LE/Log Handle */ - uint8_t type; /* HCI_LINK_TYPE_ACL, HCI_LINK_TYPE_LE, HCI_LINK_TYPE_LOG */ -}; - -enum { /* Timer event */ - HCI_ACLLINK_TIMER_LAZYRTX = 1, - HCI_ACLLINK_TIMER_TRANSRTX /* for L2CAP LE Update parameter */ -}; - -enum { /* ACL status, status in HCI_ACLHDL level, in L2CAP_ACLLinkStru/hci_le_link_stru */ - HCI_ACL_DATARECV = 0x80, /* status Bitmask, Valid status to receive ACL data */ - /* Connecting or Cancel, LE command has no BD, so only one outstanding command may exist */ - HCI_ACL_LECONN = 0x40, - /* Disconnecting or Cancel, only local initiated disconnection may lead to reconnect */ - HCI_ACL_LOCAL_DISCONNECT = 0x20, - - HCI_ACL_IDLE = (0), - /* Before connection complete, active or passive or raced */ - HCI_ACL_CONNECTING = (1 | HCI_ACL_LECONN), - HCI_ACL_READY = (2), - HCI_ACL_READY_WITH_REMOTE_INFO = (3 | HCI_ACL_DATARECV), - HCI_ACL_DISCONNECTING = (4 | HCI_ACL_DATARECV | HCI_ACL_LOCAL_DISCONNECT), - HCI_ACL_CANCEL = (5 | HCI_ACL_LECONN | HCI_ACL_LOCAL_DISCONNECT), - /* Idle, but waiting for local status changes, etc, local is scaning, disable before initiate connection */ - HCI_ACL_LECONNECT_WAITLOCAL = (6) -}; - -struct hci_recv_context_stru { - struct bth_list_stru recvdata_list; /* Uncompleted l2cap acl data packets, struct buff_stru ** */ - uint16_t receive_num; /* Controller to host outstanding packet before NoCP */ -}; - -struct hci_send_context_stru { - uint16_t sending_num; /* Host to controller outstanding packet before NoCP */ -}; - -enum { - HCI_CURRENT_MODE_EXITING = 0xFF -}; - -struct hci_acl_link_stru { /* Each remote shall have only one ACL-U */ - struct hci_link_stru link; - struct hci_send_context_stru send; - struct hci_recv_context_stru recv; - - /* Common part of ACL/LE */ - struct fsm_timer *timer; /* ACL lazy idle timer, delay ACL disconnection */ - /* Delay timer before killing LE Link due to LE Connection Cancel. - to prevent from executing another LE Create Connection Command before LE Connection Complete event returned. */ - struct fsm_timer *cancel_timer; - uint8_t ref_count; /* + -, How many cid session and echo/info ref this hci_hdl */ - uint8_t status; /* etc: HCI_ACL_CONNECTING */ - uint8_t mask; /* etc: HCI_ACLMASK_INITIATOR */ - uint8_t response_num; /* Waiting for accept/reject the incoming connection upper cbk counter */ - - /* Different part with LE */ - uint8_t link_mode; /* etc: HCI_CURRENT_MODE_SNIFF, + HCI_CURRENT_MODE_EXITING */ - uint8_t link_role; /* link role when accept incoming connection request */ - /* ACL link auto-sniff, by YDX, 2019.3.20 */ - uint8_t idle_seconds; /* current idle duration (*2s) */ - uint8_t tr_occured; /* 0 - No data transfer. 1 - data transfer. */ - /* Sniff parameters. NULL means auto-sniff is not required for this link */ - struct hci_auto_sniff_par_stru *sniff_par; - uint8_t active_disc_reason; /* For Print Disconnect Reason */ - hci_subrate subrate_par; /* add for same size with le link */ - - void *_rom; -}; - -/* Note: struct hci_acl_link_stru And struct hci_le_link_stru Must be Same Size */ - -/* Header part shall be equal to struct hci_acl_link_stru, Each remote shall have only one LE-U */ -struct hci_le_link_stru { - struct hci_link_stru link; - struct hci_send_context_stru send; - struct hci_recv_context_stru recv; - - /* Common part of ACL/LE */ - struct fsm_timer *timer; /* ACL lazy idle timer, delay ACL disconnection */ - /* Delay timer before killing LE Link due to LE Connection Cancel. - to prevent from executing another LE Create Connection Command before LE Connection Complete event returned. */ - struct fsm_timer *cancel_timer; - uint8_t ref_count; /* + -, so signed, How many cid session and echo/info ref this hci_hdl */ - uint8_t status; /* etc: HCI_ACL_CONNECTING */ - uint8_t mask; /* etc: HCI_ACLMASK_INITIATOR */ - uint8_t response_num; /* Waiting for accept/reject the incoming connection upper cbk counter */ - /* Different part with ACL */ - uint8_t le_features[8]; /* LE Read Remote used features, ACL is in remote object */ - uint8_t active_disc_reason; /* For Print Disconnect Reason */ - hci_subrate subrate_par; /* subrate parameters. NULL means no subrate event for this le link */ - - void *_rom; -}; - -struct hci_log_link_stru { /* Physical link is removed since handle is allocated by host */ - struct hci_link_stru link; - struct hci_send_context_stru send; - uint8_t tx_flow_spec_id; -}; - -struct hci_io_capability_req { - uint8_t bond; - uint8_t init; - uint8_t mitm; -}; - -struct hci_set_channel_classification_stru { - uint32_t c; /* Central Frequency, etc,2412 */ - uint32_t w; /* Bandwidth, 22,40 */ - uint8_t mask; /* etc, HCI_SETAFH_OCCUPY */ -}; - -#define HCI_CMDSTRU void -#define hci_cmdpar(arg_) ((HCI_CMDSTRU *)(arg_)) -#define HCI_CMDNEW MEM_NEW(sizeof(HCI_CMDSTRU)) - -/* --------------------------------------------------------------------------- */ -/* HCI data/Command Related */ -/* --------------------------------------------------------------------------- */ - -struct hci_tl_recv_stru { /* Arg in hcic_tl_recv_event */ - HANDLE host_hdl; - uint8_t *data; /* Newed by HCI */ - uint8_t *end; /* end pointer of data, the 0xFD after last octet of valid data */ -}; - -enum { /* Command RTX timeout */ - /* Since the maximum response timeout is strongly dependent on the HCI-Transport Layer used, - it is recommended to use a default value of one second for this timer */ - HCI_TIME_CMDRTX = CONFIG_HCI_TIME_CMDRTX, /* Before Command status */ - HCI_TIME_CMDERTX = CONFIG_HCI_TIME_CMDERTX, /* After Command status */ - HCI_TIME_CMDPINCODE = CONFIG_HCI_TIME_PINCODE, /* Both side user PIN Code input time */ - HCI_TIME_CMDDELTA = CONFIG_HCI_TIME_DELTA, /* Addtional time for calcuated time */ - /* ACL connection cast time, so when no body use ACLLink, still waiting some seconds */ - HCI_TIME_ACLLAZY = CONFIG_HCI_TIME_ACLLAZY, - HCI_TIME_ACCEPT_CONNECTION_TIMEOUT = CONFIG_HCI_TIME_ACCEPT_CONNECTION, /* 0x0001~0xB540, 0.625~29s */ - HCI_TIME_LE_CREATE_CONNECTION = CONFIG_HCI_TIME_LE_CREATE_CONNECTION -}; - -enum { /* Flag in hci_local_remove_one */ - HCI_LOCAL_REMOVE, - HCI_LOCAL_RESET -}; - -enum { /* addhead in HCI_CommandL2_AddNode */ - HCI_CMDL2_ADDHEAD, - HCI_CMDL2_ADDTAIL -}; - -enum { /* return in hci_set_event_filter_inquiry_check */ - HCI_SET_EVENT_FILTER_ACTION_ADD_INQUIRY, - HCI_SET_EVENT_FILTER_ACTION_CLEAR_INQUIRY, - HCI_SET_EVENT_FILTER_ACTION_CLEAR_ALL, - HCI_SET_EVENT_FILTER_ACTION_OTHER -}; - -enum { /* Returning of hci_security_link_key_good */ - HCI_SECURITY_LINKKEY_GOOD = 0, - HCI_SECURITY_LINKKEY_NOTEXIST = 1, - HCI_SECURITY_LINKKEY_BAD = 2 -}; - -/* HCI internal callback function dispatcher */ -typedef void (HCI_CbkTableFunc) (struct hci_local_stru *local, void *par); - -#define HCI_ROOT ((struct hci_root_stru *)(hci_fsminst->user_data)) -#define HCI_LOCALLIST (&(HCI_ROOT->local)) -#define HCI_REMOTELIST (&(HCI_ROOT->remote)) -#define HCI_LINKLIST (&(HCI_ROOT->link)) /* ACL,LE,Logical Links */ -#define HCI_EVCBKLIST (&(HCI_ROOT->evcbk)) /* Callback Tables */ -#define HCI_EVCBKLIST_PRIME (&(HCI_ROOT->evcbk_prime)) /* Prime Callback Tables */ -#define HCI_SECURITYLIST (&(HCI_ROOT->security)) -#define HCI_SECURITY_LOCALIO (HCI_ROOT->io_capability) -#define HCI_SECURITY_LOCALIO_GET ((HCI_SECURITY_LOCALIO != \ - HCI_IO_CAPABILITY_KEYBOARDDISPLAY) ? HCI_SECURITY_LOCALIO : HCI_IO_CAPABILITY_DISPLAYYESNO) -#define HCI_AFHMAP (HCI_ROOT->afhmap) -#define HCI_SUPCMDGAP_LAST \ - (&hci_table_supportcmdgap[(sizeof(hci_table_supportcmdgap) / sizeof(struct hci_op_code_gap_stru)) - 1]) -#define HCI_EVGAP_LAST \ - (&hci_table_evgap[(sizeof(hci_table_evgap) / sizeof(struct hci_index_gap_stru)) - 1]) -#define HCI_EVOP_LAST (&g_hci_table_evop[g_hci_table_evop_size - 1]) -#define hci_codingp_event(evi_) (&hci_table_coding_event[hci_table_codingoff_event[(evi_)]]) -/* ACL or LE */ -#define hci_linkevo(link_) (((link_)->link.type == \ - HCI_LINK_TYPE_ACL) ? HCI_EVO_ACL_DATA_IND : HCI_EVO_LE_DATA_IND) -#define hci_cmderr(op_) (((op_) << 16) | HCI_EVO_COMMAND_ERROR) /* HCI_OPC_ for hci_cbk */ -#define hci_command_send_internal(local_, par_, link_, opscode_) hci_command_send_core((local_), \ - hci_command_create_node((par_), (link_), (opscode_))) -#define hci_key_unauthenticated(type_) (((type_) != \ - HCI_KEY_TYPE_AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P192) && \ - ((type_) != HCI_KEY_TYPE_AUTHENTICATED_COMBINATION_KEY_GENERATED_FROM_P256)) - -/* Macro components of struinfo */ -#define hci_stru2reqoff(struinfo_) ((uint8_t)(struinfo_)) /* Req struinfo offset */ -/* Ret struinfo offset, 0xFF for not exist */ -#define hci_stru2retoff(struinfo_) ((uint8_t)((struinfo_) >> 8)) - -/* uint32_t op_ev */ -#define hci_opev(o, e) (((o) << 16) | (e)) -#define hci_op(s) ((uint16_t)((s) >> 16)) -#define hci_ev(s) ((uint16_t)(s)) - -/* HCI is little endian */ -#define HCI_DECODE2BYTE decode2byte_little -#define HCI_DECODE4BYTE decode4byte_little -#define HCI_ENCODE2BYTE encode2byte_little -#define HCI_ENCODE4BYTE encode4byte_little - -/* --------------------------------------------------------------------------- */ -/* HCI Structure < -> BitStream Macros */ -/* --------------------------------------------------------------------------- */ -#ifdef CONFIG_ALIGN_FOURBYTES -#define CONFIG_ALIGN_BTYES 4 -#elif defined(CONFIG_ALIGN_TWOBYTES) -#define CONFIG_ALIGN_BTYES 2 -#else /* defined(CONFIG_ALIGN_ONEBYTE) */ -#define CONFIG_ALIGN_BTYES 1 -#endif -#define hci_padstep(s) (min(CONFIG_ALIGN_BTYES, (s))) -#define hci_padding(p, \ - l) ((p) += ((hci_padstep(l) - ((uint32_t)(uintptr_t)(p) % hci_padstep(l))) % hci_padstep(l))) - -enum { - HCI_CODE_0BITS = 0x00, - HCI_CODE_2BITS = 0x01, - HCI_CODE_4BITS = 0x02, - HCI_CODE_8BITS = 0x03, - - /* 2Bits Basic type Items */ - HCI_CODE_N1 = 0x00, /* Num */ - HCI_CODE_U1 = 0x01, /* 1Oct - uint8_t */ - HCI_CODE_U2 = 0x02, /* 2Oct - uint16_t */ - HCI_CODE_U4 = 0x03 /* 4Oct - uint32_t */ -}; - -enum { /* flag in hci_coding_len */ - HCI_CODING_INSTRU = 0x01, /* Src input is structure, not air */ - HCI_CODING_OUTSRC = 0x02, /* output src length, not dst */ - - /* Input stru, Output stru length */ - HCI_CODING_GETSTRULEN = (HCI_CODING_INSTRU | HCI_CODING_OUTSRC), - HCI_CODING_GETAIR = (HCI_CODING_INSTRU), /* Get PDU or length of PDU to the controller */ - HCI_CODING_GETSTRU = 0 /* GET structure or its length to upper layer */ -}; - -enum { /* event in hcic_security_request */ - HCI_SECURITY_EVENT_REQUEST = 1, - HCI_SECURITY_EVENT_ABORT = 2 -}; - -enum { /* Bitmask in authentication_requirements enum */ - HCI_AUTHENTICATION_REQUIREMENTS_NOMITM = 0x00, - HCI_AUTHENTICATION_REQUIREMENTS_MITM = 0x01 -}; - -enum { - HCI_ACLDATA_MASK_SENTOUT = 0x01, /* send out succefully or not */ - HCI_ACLDATA_MASK_ADDTAIL = 0x02 /* Add head or tail */ -}; - -enum { /* mask in hci_acl_link_disconnect_deal */ - HCI_ACLLINK_DISCONNECT_NOW = 0x01, - HCI_ACLLINK_DISCONNECT_EMERGENCY = 0x02 -}; - -/* Move here since SMP are using this to store SMPD address */ -enum { /* index of addr[x] in struct hci_local_stru / struct hci_remote_stru */ - /* Public or Static, distinguish by the 49th bit in addr, for BREDR / LE */ - HCI_ADDR_IDENTITY = 0, - /* Used in Local object, RPA or nRPA, Only for LE, by LESetRandomAddress */ - HCI_ADDR_PRIVATE = 1, - /* Used in Remote object, current LE link(or advertising remote using) address */ - HCI_ADDR_LELINK = 1 -}; - -/* --------------------------------------------------------------------------- */ -/* Function Definations */ -/* --------------------------------------------------------------------------- */ -/* --------------------------------------------------------------------------- -Description: - This function is called to send a packet into Transport Layer. ---------------------------------------------------------------------------- */ -void hci_tl_send_data(struct hci_local_stru *local, uint8_t *data, uint32_t len); - -uint8_t hci_dt_get_ev_index(uint8_t evcode); -uint32_t hci_dt_get_sup_cmd_bit_index(uint16_t opcode); - -void hci_cbk(struct hci_local_stru *local, void *context, void *arg, uint32_t len, uint32_t op_ev); -#ifdef CONFIG_BREDR_HCI -uint8_t hci_cbk_get_num(uint16_t index); -#endif -void le_set_scan_parmeters(struct hci_local_stru *local, uint8_t type, uint8_t limited, - uint8_t speed); -void le_set_advertising_parameters(struct hci_local_stru *local, uint8_t type, - uint8_t limited, uint8_t speed, uint8_t white); -void le_set_direct_advertising_parameters(struct hci_local_stru *local, - struct hci_address_stru *peer, uint8_t type, uint8_t limited, uint8_t speed, uint8_t white); - -void le_isa_check(struct hci_local_stru *local); -void le_isa_connect_complete(struct hci_local_stru *local); -void le_isa_target(struct hci_local_stru *local, uint8_t tar); -void le_isa_enable_result(struct hci_local_stru *local, uint8_t success); -void le_isa_go_idle(struct hci_local_stru *local); -void le_isa_set_op_report(const struct hci_local_stru *local, uint8_t op_id, uint8_t op_state); -struct hci_le_link_stru *le_link_find_on_local(const struct hci_local_stru *local); -void hci_local_start_timer(struct hci_local_stru *local, uint8_t *prompt, - uint32_t timeout, uint8_t restart, uint8_t event, uint8_t id); -void hci_local_init(struct hci_local_stru *local); -void hci_local_remove_unknown_acl_data(struct hci_local_stru *local); -void hci_local_remove(struct hci_local_stru *local); -void hci_local_remove_one(struct hci_local_stru *local, uint8_t flag); -void hci_local_changed_notify(struct hci_local_stru *local, HANDLE tl_hdl, uint8_t action); -struct hci_local_stru *hci_local_find_by_hdl(const HANDLE host_hdl); -#ifdef NOT_USED_YET -struct hci_local_stru *hci_local_find_by_addr(struct hci_address_stru *l); -#endif -struct hci_local_stru *hci_local_find_by_id(uint8_t ampid); -struct hci_local_stru *hci_local_find_by_tlhdl(HANDLE tl_hdl); - -/* ACL link auto-sniff, by YDX, 2019.3.20 */ -void hci_auto_sniff_stop_timer(struct hci_local_stru *local); -void hci_auto_sniff_rtx(struct hci_local_stru *local); -void hcic_auto_sniff_set(const struct fsm_inst *fi, uint8_t event, - struct hci_auto_sniff_req_stru *req); -#ifdef CHIP_BRANDY -struct hci_remote_stru *hci_remote_find_by_bd(uint8_t *bd); -#endif -void hci_remote_remove(struct hci_remote_stru *remote); -void hci_remote_remove_unuse(struct hci_remote_stru *remote); -void hci_remote_set_to_die(uint8_t cap); -struct hci_remote_stru *hci_remote_find_by_addr(struct hci_address_stru *r); - -void *hci_link_create(struct hci_local_stru *local, struct hci_remote_stru *remote, uint8_t type); -void hci_link_remove_by_lr(const void *lr); -void hci_link_remove_all(void); -void hci_link_remove(struct hci_acl_link_stru *link, uint8_t reason); -void *hci_link_find_by_hdl(const struct hci_local_stru *local, uint16_t handle); -void bth_hci_acl_data_recv(struct hci_acl_link_stru *link, struct buff_stru *in, uint8_t pb); -uint8_t bth_hci_acl_data_recombination_check(struct buff_stru *fst_pkt, struct buff_stru *next_pkt); -void hci_acl_link_disconnect_send(struct hci_acl_link_stru *link, uint8_t reason, uint8_t mask); -uint8_t hci_acl_link_disconnect_deal(struct hci_acl_link_stru *link, uint8_t mask); -void hci_acl_link_controller2host_fc(struct hci_acl_link_stru *link, uint8_t force); - -struct hci_acl_link_stru *hci_acl_link_find_by_bd_type(struct hci_local_stru *local, uint8_t *bd, - uint8_t type, uint8_t linktype); -#define hci_acl_link_find_by_bd(local_, bd_) hci_acl_link_find_by_bd_type((local_), (bd_), \ - HCI_OWN_ADDRESS_TYPE_PUBLIC_DEVICE_ADDRESS, HCI_LINK_TYPE_ACL) - -void hci_acl_link_cbk(struct hci_acl_link_stru *link, uint16_t reason_job); -void hci_acl_link_ready(struct hci_acl_link_stru *link); -void hci_acl_link_create_connection_cancel(struct hci_acl_link_stru *link, uint8_t mask); -void hcic_acl_link_un_ref(const struct fsm_inst *fi, uint8_t event, struct hci_acl_link_stru *link); -void hcic_acl_link_kill(const struct fsm_inst *fi, uint8_t event, struct hci_acl_link_stru *link); -void hci_acl_link_create_connection(struct hci_acl_link_stru *link); -void hci_acl_link_connection_cancel_delay_start(struct hci_acl_link_stru *link, uint8_t status); -struct hci_acl_link_stru *hci_acl_link_find_by_lr(const struct hci_local_stru *local, - const struct hci_remote_stru *remote, uint8_t linktype); -struct hci_acl_link_stru *hci_acl_link_find_by_ptr(const void *acl); - -void bth_hci_recv_acl_data(const struct fsm_inst *fi, uint8_t type, struct buff_stru *in); -void hcic_tl_recv_sco_data(const struct fsm_inst *fi, uint8_t event, struct buff_stru *in); - -void list_qo_s_remove_all(struct hci_local_stru *local); -void list_qos_check_cbk(struct hci_local_stru *local); - -uint16_t hci_set_packet_type(struct hci_local_stru *local, uint8_t link_type); -void hci_set_synchronous_param(struct hci_local_stru *local, struct hci_synchronous_connection_stru *in, - struct hci_synchronous_connection_stru *esco); -uint8_t hci_set_event_filter_inquiry_check(struct hci_set_event_filter_stru *par); - -uint8_t hci_command_check_support(struct hci_local_stru *local, uint16_t opcode); -void hci_command_send_core(struct hci_local_stru *local, struct hci_command_node_stru *cmd); -struct hci_command_node_stru *hci_command_create_node(void *par, void *context, uint32_t opscode); -uint8_t hci_command_check_block(struct hci_local_stru *local, struct hci_command_node_stru *cmd); -void hci_struct_to_stream_data(struct hci_command_node_stru *cmd, uint8_t *dst, uint16_t stream_len); -void hci_command_remove(struct hci_local_stru *local, struct hci_command_node_stru *cmd, void *arg, uint16_t len, - uint16_t status, uint16_t evindex); -void hci_command_remove_by_local(struct hci_command_node_stru *in); -#define hci_command_remove_error(local_, cmd_, status_) hci_command_remove((local_), (cmd_), NULL, 0, (status_), \ - HCI_EVO_COMMAND_ERROR) - -void hci_command_check_send(struct hci_local_stru *local); -struct hci_command_error_stru *hci_command_error_new(struct hci_command_node_stru *cmd, uint16_t *lenout, - uint16_t status); -/* Could be NULL */ -void hci_command_remove_by_context(struct hci_local_stru *local, void *context, uint16_t status); -struct hci_command_node_stru *hci_command_find_by_op_code(struct hci_local_stru *local, uint16_t opcode); -struct hci_command_node_stru *hci_command_find_by_ev_index(struct hci_local_stru *local, - const void *link, uint8_t evindex, uint16_t opcode); -#ifdef CONFIG_BREDR_HCI -void hci_command_remove_by_op_code(struct hci_local_stru *local, uint16_t opcode, uint16_t status); -#endif -void hci_command_send_emergency(struct hci_local_stru *local, void *par, uint32_t opscode); -void hci_cmd_send_internal_func(struct hci_local_stru *local, void *par, void *context, uint32_t opscode); -void hci_cmd_rmv_err_func(struct hci_local_stru *local, struct hci_command_node_stru *cmd, uint16_t status); -void hci_acl_data_send_pendding(struct hci_local_stru *local, uint8_t slot); -#ifdef NOT_USED_YET -int hci_tl_recv_data(HANDLE host_hdl, uint8_t *data, uint32_t len); -#endif -int hci_tl_recv_data_buff(HANDLE host_hdl, struct buff_stru *buff); -void hcic_tl_recv_event(const struct fsm_inst *fi, uint8_t type, struct hci_tl_recv_stru *in); - -uint8_t hci_coding_get_bits(struct hci_bit_pointer_stru *bp, uint8_t len); -uint16_t hci_coding_len(uint8_t *src, uint8_t *end, const uint8_t *p, uint8_t flag); -void hci_coding(uint8_t *src, uint8_t *end, uint8_t *dst, const uint8_t *p, uint8_t flag); -void hci_internal_cbk(HANDLE host_hdl, void *context, void *par, uint32_t evindex); -void hci_internal_cbk_reg(void); - -#ifdef CONFIG_HCI_NEW_STREAM_STRUCT_CONVERSION -uint16_t hci_stream_to_struct(uint8_t event_index, uint8_t *in_stream, void **out_stru); -uint16_t hci_struct_to_stream(struct hci_command_node_stru *cmd, uint8_t **out_stream); -uint16_t hci_cmd_cmplete_stream_to_struct(struct hci_command_complete_ev_stru *in, void **out_stru); -uint16_t hci_le_meta_stream_to_struct(struct hci_le_meta_ev_stru *ev, void **out_stru); -#endif -void hci_ev_command_status_restart_ertx(struct hci_local_stru *local, struct hci_command_node_stru *cmd); -void hci_ev_command_status(struct hci_local_stru *local, struct hci_command_status_ev_stru *in); -void hci_ev_command_complete(struct hci_local_stru *local, struct hci_command_complete_ev_stru *in); -void hci_ev_loopback_command(struct hci_local_stru *local, struct hci_loopback_command_ev_stru *ev); - -void hci_ev_link_key_request(struct hci_local_stru *local, struct hci_link_key_request_ev_stru *ev); -void hci_ev_pin_code_request(struct hci_local_stru *local, struct hci_pin_code_request_ev_stru *ev); -void hci_ev_authentication_complete(struct hci_local_stru *local, struct hci_authentication_complete_ev_stru *ev); -void hci_ev_encryption_change(struct hci_local_stru *local, struct hci_encryption_change_ev_stru *ev); -void hci_ev_io_capability_request(struct hci_local_stru *local, struct hci_io_capability_request_ev_stru *ev); -void hci_ev_io_capability_response(struct hci_local_stru *local, struct hci_io_capability_response_ev_stru *ev); -void hci_ev_user_confirmation_request(struct hci_local_stru *local, struct hci_user_confirmation_request_ev_stru *ev); -void hci_ev_remote_oob_data_request(struct hci_local_stru *local, struct hci_remote_oob_data_request_ev_stru *ev); -void hci_ev_simple_pairing_complete(struct hci_local_stru *local, struct hci_simple_pairing_complete_ev_stru *ev); - -void hci_ev_connection_complete(struct hci_local_stru *local, struct hci_connection_complete_ev_stru *ev); -void hci_ev_connection_request(struct hci_local_stru *local, struct hci_connection_request_ev_stru *ev); -void hci_ev_synchronous_connection_complete(struct hci_local_stru *local, - struct hci_synchronous_connection_complete_ev_stru *ev); -void hci_ev_disconnection_complete(struct hci_local_stru *local, struct hci_disconnection_complete_ev_stru *ev); -void hci_op_create_connection_cancel(struct hci_local_stru *local, struct hci_create_connection_cancel_comp_stru *ev); -void hci_ev_number_of_cmp_pkt_rom(struct hci_local_stru *local, struct hci_number_of_completed_packets_ev_stru *ev); -uint32_t hci_ev_cmd_status_restart_ertx_rom(struct hci_local_stru *local, struct hci_command_node_stru *cmd); -struct hci_command_node_stru *hci_cmd_find_by_cmd_status_evt_rom(struct hci_local_stru *local, uint16_t opcode); -void hci_ev_hardware_error_rom(struct hci_local_stru *local, - const struct hci_hardware_error_ev_stru *ev); -#ifdef CONFIG_BREDR_HCI -void hci_ev_remote_supported_features_cap(const struct hci_local_stru *local, - struct hci_remote_stru *remote, uint8_t page); -#endif -void hci_op_read_local_supported_cmd_rom(struct hci_local_stru *local, - struct hci_read_local_supported_commands_comp_stru *ev); -void hci_op_read_local_feature_page0rom(struct hci_local_stru *local, uint8_t *fea); -void hci_op_read_local_feature_page0(struct hci_local_stru *local, const uint8_t *fea); -void hci_op_read_buffer_size_rom(struct hci_local_stru *local, struct hci_read_buffer_size_comp_stru *ev); - -void hcic_init(void); -#ifdef CONFIG_BT_STACK_DONE -void hcic_done(struct fsm_inst *fi, uint8_t event, const void *arg); -#endif -void hcic_cleanup(const struct fsm_inst *fi, uint8_t event, const void *arg); -void hcic_cbk_reg(const struct fsm_inst *fi, uint8_t event, struct hci_cbk_node_stru *arg); -void hcic_cbk_prime_reg(const struct fsm_inst *fi, uint8_t event, struct hci_cbk_node_stru *arg); -void hcic_cbk_un_reg(const struct fsm_inst *fi, uint8_t event, const struct hci_cbk_line_stru *table); -void hcic_commandl1_input(const struct fsm_inst *fi, uint8_t event, struct hci_command_node_stru *in); -void hcic_commandl2_input(const struct fsm_inst *fi, uint8_t event, struct hci_command_queue_stru *queue); -void hcic_command_rtx(const struct fsm_inst *fi, uint8_t event, struct hci_rtx_timer_stru *rts); -void hcic_tl_reg(const struct fsm_inst *fi, uint8_t event, struct hci_local_stru *local); -void hcic_tl_un_reg(const struct fsm_inst *fi, uint8_t event, void *tl_hdl); -void hcic_acl_data_send(const struct fsm_inst *fi, uint8_t event, struct buff_stru *arg); -#ifdef CONFIG_BREDR_HCI -void hcic_sco_data_send(const struct fsm_inst *fi, uint8_t event, struct buff_stru *arg); -#endif -void hcic_create_sco_connection(const struct fsm_inst *fi, uint8_t event, struct hci_create_scoui_stru *in); -void hcic_acl_link_disconnect(const struct fsm_inst *fi, uint8_t event, struct hci_disconnect_stru *par); -void hcic_acl_link_connection_response(struct fsm_inst *fi, uint8_t event, - struct hci_acl_connection_response_ui_stru *in); -void hcic_synchronous_connection_response(const struct fsm_inst *fi, uint8_t event, - struct hci_synchronous_connection_response_ui_stru *in); -void hcic_synchronous_enhanced_connection_response(const struct fsm_inst *fi, uint8_t event, - struct hci_synchronous_enhanced_connection_response_ui_stru *in); -#ifdef CONFIG_BREDR_HCI -void hcic_set_channel_classification(const struct fsm_inst *fi, uint8_t event, - struct hci_set_channel_classification_stru *par); -#endif -void hcic_set_default_link_role(const struct fsm_inst *fi, uint8_t event, void *arg); - -void hci_security_go(struct hci_acl_link_stru *link); -void hci_security_result_ev(struct hci_local_stru *local, uint16_t hdl, uint16_t mask, uint16_t status); -void hci_security_clear_remote_by_acl_link(struct hci_acl_link_stru *link); -void hcic_security_authorized(const struct fsm_inst *fi, uint8_t event, struct hci_security_author_req_stru *in); -void hcic_security_request(const struct fsm_inst *fi, uint8_t event, struct hci_security_node_stru *in); -void hcic_security_require_reg(const struct fsm_inst *fi, uint8_t event, struct hci_security_info_stru *info); -void hcic_security_require_un_reg(const struct fsm_inst *fi, uint8_t event, - struct hci_security_info_stru *info); -void hcic_security_set_local_io(const struct fsm_inst *fi, uint8_t io_capability, void *arg); -void hcic_security_set_bondable(const struct fsm_inst *fi, uint8_t bondable, void *arg); -void hcic_security_set_oob(const struct fsm_inst *fi, uint8_t event, struct hci_security_remote_oob_stru *in); -void hcic_security_read_local_oob_data(const struct fsm_inst *fi, uint8_t event, void *arg); -void hcic_security_link_key_recover(const struct fsm_inst *fi, uint8_t event, - struct hci_security_link_key_recover_stru *in); -void hcic_security_link_key_remove(const struct fsm_inst *fi, uint8_t event, uint8_t *bd); -void hcic_security_pin_code_reply(const struct fsm_inst *fi, uint8_t event, struct hci_pin_code_request_reply_stru *in); -void hcic_security_pairing_confirmation(const struct fsm_inst *fi, uint8_t event, uint8_t *bd); - -/* Used in DBG */ -struct hci_security_info_stru *hci_security_object_find(struct hci_security_info_stru *node, - struct hci_security_info_stru *in); -/* Used in DBG */ -uint8_t hci_security_link_key_good(struct hci_local_stru *local, struct hci_remote_stru *remote, - struct hci_security_node_stru *node); -void hcic_security_le_keys_recover(const struct fsm_inst *fi, uint8_t event, struct bth_list_stru *list); -void hcic_security_le_keys_remove(const struct fsm_inst *fi, uint8_t event, struct hci_address_stru *addr); -void hci_security_authorization_cbk_rom(struct hci_acl_link_stru *link, struct hci_security_node_stru *node, - uint16_t evi); -uint8_t hci_security_check_support_ssp(struct hci_local_stru *local, struct hci_remote_stru *remote); -uint8_t hci_security_check_support_sc(struct hci_local_stru *local, struct hci_remote_stru *remote); -void hci_security_go_rom(struct hci_acl_link_stru *link); -void hci_security_pendding_cbk(struct hci_security_node_stru *node, uint8_t type); -void hci_security_authorization_cbk(struct hci_acl_link_stru *link, struct hci_security_node_stru *node, uint16_t evi); -void hci_security_complete(struct hci_acl_link_stru *link, uint16_t result); -void hci_secu_result_ev_rom(struct hci_local_stru *local, uint16_t hdl, uint16_t mask, uint16_t status); -void hci_security_handle_auth_failed(struct hci_acl_link_stru *link, struct hci_remote_stru *remote, uint16_t status); -void hci_secu_clr_rmt_by_acl_link_rom(struct hci_acl_link_stru *link); -void hci_security_end(struct hci_security_node_stru *node, uint16_t result); -void hcic_secu_req_rom(const struct fsm_inst *fi, uint8_t event, - struct hci_security_node_stru *in); -void hcic_secu_le_keys_recover_rom(const struct fsm_inst *fi, uint8_t event, struct bth_list_stru *list); -void hcic_secu_pin_code_reply_rom(const struct fsm_inst *fi, uint8_t event, struct hci_pin_code_request_reply_stru *in); -void hcic_secu_pairing_confirm_rom(const struct fsm_inst *fi, uint8_t response, uint8_t *bd); -void hcic_secu_link_key_recover_rom(const struct fsm_inst *fi, uint8_t event, - struct hci_security_link_key_recover_stru *in); -void hci_ev_link_key_req_rom(struct hci_local_stru *local, struct hci_link_key_request_ev_stru *ev); -void hci_ev_pin_code_req_rom(struct hci_local_stru *local, struct hci_pin_code_request_ev_stru *ev); -void hci_ev_encryption_change_rom(struct hci_local_stru *local, struct hci_encryption_change_ev_stru *ev); -bool hci_ev_io_secu_pair_hdl_rom(struct hci_local_stru *local, struct hci_remote_stru *remote, - void *reply, struct hci_io_capability_request_ev_stru *ev, - struct hci_io_capability_req *capaility_req); -uint8_t hci_security_link_key_good_rom(struct hci_local_stru *local, struct hci_remote_stru *remote, - struct hci_security_node_stru *node); - -uint8_t le_controller_addr_node_list_count(struct hci_local_stru *local, uint8_t type); /* Used in DBG */ - -void hcic_iso_data_send(const struct fsm_inst *fi, uint8_t event, struct buff_stru *arg); -#ifdef CONFIG_BREDR_HCI -uint8_t hci_get_stream_len_by_filter_type(uint8_t filter_type, uint8_t filter_condition_type); -#endif -uint8_t *hci_stream_to_struct_cpy_stream(const uint8_t *stream, uint8_t len); -void hci_coding_endian(uint8_t **src, uint8_t **dest, uint8_t len); -uint8_t hci_coding_get_max_ele(struct hci_bit_pointer_stru *bp); -struct hci_command_node_stru *hci_command_find_by_context(struct hci_local_stru *local, const void *context); -void list_qos_cbk(struct hci_local_stru *local, uint8_t action); -struct buff_stru *list_qo_s_get(struct bth_list_stru *list); -void list_qo_s_free_buf(struct hci_local_stru *local, struct buff_stru *buf); -uint8_t list_qo_s_add(struct hci_local_stru *local, struct buff_stru *buf, uint8_t mask, uint8_t slot); -void list_qo_s_remove_hdl(struct hci_local_stru *local, uint16_t hdl); -void hci_acl_data_mp_add(hci_mp_int *r, uint32_t len); -bool hci_check_bit(const uint8_t *buf, uint8_t evindex); -void *hci_cmd_new_auth_req(void); -void *hci_cmd_new_set_conn_encrypt(void); -void *hci_cmd_new_pin_code_rply(void); -void *hci_cmd_new_pin_code_neg_rply(void); -void *hci_cmd_new_link_key_neg_rply(void); -void *hci_cmd_new_secu_link_key_ask4(void); -void *hci_cmd_new_link_key_rply(void); -uint8_t bth_hci_recv_acl_data_header_proc(const struct hci_local_stru *local, - struct buff_stru *in, uint8_t *pb, uint16_t *handle, uint8_t *header_len); - -typedef void (HciAclDataSendPenddingCb)(struct hci_local_stru *local, uint8_t slot); -typedef void (HciCmdSendInternalCb)(struct hci_local_stru *local, void *par, void *context, uint32_t opscode); -typedef void (HciCmdRmvErrCb)(struct hci_local_stru *local, struct hci_command_node_stru *cmd, uint16_t status); -typedef void (HciCmdRmvCb)(struct hci_local_stru *local, struct hci_command_node_stru *cmd, void *arg, - uint16_t len, uint16_t status, uint16_t evindex); -typedef void (HciCbkCb)(struct hci_local_stru *local, void *context, void *arg, uint32_t len, uint32_t op_ev); -typedef void (HciAutoSniffStopTimerCb)(struct hci_local_stru *local); -typedef void (HciEvRmtSupportedFeatCapCb)(struct hci_local_stru *local, struct hci_remote_stru *remote, uint8_t page); -typedef uint8_t (HciCmdCheckSupportCb)(struct hci_local_stru *local, uint16_t opcode); -typedef void (HciOpReadLocalFeatPage0Cb)(struct hci_local_stru *local, uint8_t *fea); -typedef void (HciLocalChangedNotifyCb)(struct hci_local_stru *local, HANDLE tl_hdl, uint8_t action); -typedef void (HciRemoteGetAddrCb)(struct hci_remote_stru *remote, struct hci_address_stru *addr); -typedef uint8_t (HciSecuChkSupportSSPCb)(struct hci_local_stru *local, struct hci_remote_stru *remote); -typedef uint8_t (HciSecuChkSupportSCCb)(struct hci_local_stru *local, struct hci_remote_stru *remote); -typedef void (HciSecurityPenddingCbkCb)(struct hci_security_node_stru *node, uint8_t type); -typedef void (HciSecuAuthCbkCb)(struct hci_acl_link_stru *link, - struct hci_security_node_stru *node, uint16_t evi); -typedef void (HciSecuCmpCb)(struct hci_acl_link_stru *link, uint16_t result); -typedef uint8_t (HciSecuLkKeyGoodCb)(struct hci_local_stru *local, struct hci_remote_stru *remote, - struct hci_security_node_stru *node); -typedef void (HciSecuGoCb)(struct hci_acl_link_stru *link); -typedef void (HciSecuHdlAuthFailedCb)(struct hci_acl_link_stru *link, struct hci_remote_stru *remote, uint16_t status); -typedef void (HciSecuEndCb)(struct hci_security_node_stru *node, uint16_t result); -typedef struct hci_local_stru* (HciLocalFindByIDCb)(uint8_t ampid); -typedef bool (HciCheckBitCb)(uint8_t *buf, uint8_t evindex); -typedef struct hci_remote_stru* (HciRmtFindCreateCb)(uint8_t *bd, uint8_t atype, uint8_t cap); -typedef struct hci_remote_stru* (HciRmtFindByBDCb)(uint8_t *bd); -typedef void (HciSecuResultEvCb)(struct hci_local_stru *local, uint16_t hdl, uint16_t mask, uint16_t status); -typedef void* (HciCmdNewAuthReqCb)(void); -typedef void* (HciCmdNewSetConnEncryptCb)(void); -typedef void* (HciCmdNewPinCodeRplyCb)(void); -typedef void* (HciCmdNewPinCodeNegRplyCb)(void); -typedef void* (HciCmdNewLinkKeyNegRplyCb)(void); -typedef void* (HciCmdNewSecuLinkKeyAsk4Cb)(void); -typedef void* (HciCmdNewLinkKeyRplyCb)(void); -typedef void (HciSecuAuthCb)(struct hci_security_author_req_stru *in); -/* Expend to visit more vars */ -typedef void (HciLinkRmvFun)(struct hci_acl_link_stru *link, uint8_t reason); -typedef uint8_t (HciCmpAddrCb)(struct hci_address_stru *s, struct hci_address_stru *r); - -#endif /* G_HCI_HLP_H */ - diff --git a/code/sdk/protocol/bt/host/bt/bts/bg_common/include/hci/hci_ui.h b/code/sdk/protocol/bt/host/bt/bts/bg_common/include/hci/hci_ui.h deleted file mode 100644 index 1a966c986..000000000 --- a/code/sdk/protocol/bt/host/bt/bts/bg_common/include/hci/hci_ui.h +++ /dev/null @@ -1,1078 +0,0 @@ -/* - * Copyright (c) @CompanyNameMagicTag 1999-2015. All rights reserved. - */ - -/* --------------------------------------------------------------------------- -Module Name: - hci_ui.h -Abstract: - This module defines HCI interface structure, macro & functions. ---------------------------------------------------------------------------- */ - -#ifndef G_HCI_UI_H -#define G_HCI_UI_H - -#include "hci_stru.h" -#include "sysdep.h" - -#define HCI_HANDLE_BIT_NUM 16 -#define OCTET_BIT_LEN 8 - -#ifdef HUAWEI_ADAPT_VENDOR -#define HCI_TLPKT_COMMAND 0x01 -#define HCI_TLPKT_ACLDATA 0x02 -#define HCI_TLPKT_SCODATA 0x03 -#define HCI_TLPKT_EVENT 0x04 - -#endif /* HUAWEI_ADAPT_VENDOR */ - -enum { /* data type use in tl adapter */ - HCI_DATATYPE_COMMAND = 1, - HCI_DATATYPE_ACL = 2, - HCI_DATATYPE_SCO = 3, - HCI_DATATYPE_EVENT = 4, - /* added for iso event */ - HCI_DATATYPE_ISO = 5, - HCI_DATATYPE_GLE_CMD = 0xA1, - HCI_DATATYPE_GLE_EVENT = 0xA2, - HCI_DATATYPE_GLE_ACB = 0xA3, - HCI_DATATYPE_GLE_ICB = 0xA4, -}; - -enum { /* data type use for distinguish BLE or GLE */ - HCI_DATATYPE_BLE = 0, - HCI_DATATYPE_GLE = 1, -}; -/* --------------------------------------------------------------------------- */ -/* HCI Transport Layer Interface */ -/* --------------------------------------------------------------------------- */ -/* ----------------------------------------------------------------------------- -In the function Func_Startup & Func_StartSco : - if return values is 0, means successfully; - if return values is not 0, means not successfully; -In the function Func_Send : - return values is the number of bytes you send successfully; -In the function Func_GetType : - return values is the AMP type MACROs; ------------------------------------------------------------------------------ */ -typedef int (func_receive) (HANDLE host_hdl, uint8_t *p_buf, uint32_t len); -typedef int (func_receive_buff) (HANDLE host_hdl, struct buff_stru *buff); - -typedef struct _tl_callback_stru { - func_receive *receive; - func_receive_buff *receive_buff; -} tl_callback_stru; - -typedef int (func_startup) (HANDLE tl_hdl, tl_callback_stru *p_callback, HANDLE host_hdl); -typedef void (func_shutdown) (HANDLE tl_hdl); -typedef int (func_send) (HANDLE tl_hdl, uint8_t *p_buf, uint32_t len); -typedef int (func_start_sco) (HANDLE tl_hdl, uint16_t sco_hdl); -typedef void (func_stop_sco) (HANDLE tl_hdl, uint16_t sco_hdl); -typedef unsigned char (func_get_type) (HANDLE tl_hdl); - -typedef struct _transport_layer_stru { - func_get_type *get_type; - func_startup *startup; - func_shutdown *shutdown; - func_send *send; - func_start_sco *start_sco; - func_stop_sco *stop_sco; -} transport_layer_stru; - -/* Range: 0x000-0xEFF (0xF00 - 0xFFF Reserved for future use) */ -#define HCI_INVAILD_HANDLE 0xFFFF -#define HCI_AMPID_BREDR 0 /* type/id in struct hci_local_stru */ -#define hci_opcode(g, c) (((g) << 10) | (c)) -#define hci_ogf(o) ((uint8_t)((o) >> 10)) /* 6bits */ -#define hci_ocf(o) ((o) & ((1 << 10) - 1)) /* 10bits */ -#define HCI_AUTH_FAIL_RETRY_TIMES 3 - -enum { /* OGF for Command Code, 6 bits */ - HCI_OGF_LINKCONTROL = 0x01, - HCI_OGF_LINKPOLICY = 0x02, - HCI_OGF_CONTROLLER_BASEBAND = 0x03, - HCI_OGF_INFORMATIONAL_PARAM = 0x04, - HCI_OGF_STATUS_PARAM = 0x05, - HCI_OGF_TESTING = 0x06, - HCI_OGF_LE = 0x08, - HCI_OGF_VENDOR = 0x3F -}; - -/* --------------------------------------------------------------------------- */ -/* HCI UI Interface structure */ -/* --------------------------------------------------------------------------- */ -enum { /* cap in hci_available_addr_cap */ - HCI_ADDRESS_CAP_LE = 0x01, /* and LELink shall exist when this bit set */ - HCI_ADDRESS_CAP_BREDR = 0x02, - HCI_ADDRESS_CAP_IDENTITY = 0x04, /* as identity address exist(BREDR or SMPD or LELink) */ - HCI_ADDRESS_CAP_MAIN = (HCI_ADDRESS_CAP_BREDR | HCI_ADDRESS_CAP_LE), /* AMPID = 0 */ - HCI_ADDRESS_CAP_80211 = 0x08, - HCI_ADDRESS_CAP_UWB = 0x10, - HCI_ADDRESS_CAP_AMP = (HCI_ADDRESS_CAP_80211 | HCI_ADDRESS_CAP_UWB), /* AMPID != 0 */ - - /* HCI Internal used bitmask to deliver information */ - /* Internal use when remote is found by identity, need to update it into lelink, not in any object */ - HCI_ADDRESS_CAP_LELINK_UPDATE = 0x80, - /* Do not generate remote change notify since there is another behind this call */ - HCI_ADDRESS_CAP_DONOT_CHANGE_NOTIFY = 0x40, - HCI_ADDRESS_CAP_INFO = - (HCI_ADDRESS_CAP_LELINK_UPDATE | HCI_ADDRESS_CAP_DONOT_CHANGE_NOTIFY) -}; - -struct hci_address_stru { - uint8_t bd[BD_ADDR_LEN]; /* 6octets, 48bits */ - /* etc, HCI_OWN_ADDRESS_TYPE_PUBLIC_DEVICE_ADDRESS = HCI_PEER_ADDRESS_TYPE_PUBLIC_DEVICE_ADDRESS */ - uint8_t atype; - uint8_t cap; /* etc, HCI_ADDRESS_CAP_LE, reserved for compatibility only. */ -}; - -struct hci_controller_addr_node_stru { - struct hci_address_stru addr; - uint8_t mask; /* etc, HCI_CANODE_MASK_WHITELIST */ -}; - -#define HCI_ROLE_DEFAULT (HCI_ROLE_SLAVE+1) /* Default role setting */ -struct hci_acl_connection_response_ui_stru { /* UI Input in hci_acl_connection_response */ - struct hci_connection_request_ev_stru *ev; - uint8_t link_role; /* HCI_ROLE_SLAVE, HCI_ROLE_MASTER or HCI_ROLE_DEFAULT */ - /* etc: HCI_OPS_REJECT_CONNECTION_REQUEST, HCI_OPS_ACCEPT_CONNECTION_REQUEST */ - uint32_t opscode; -}; - -struct hci_synchronous_connection_stru { /* Common part for hci_set_synchronous_param */ - uint32_t transmit_bandwidth; - uint32_t receive_bandwidth; - uint16_t max_latency; - uint16_t voice_setting; - uint8_t retransmission_effort; - uint16_t packet_type; -}; - -struct hci_synchronous_connection_response_ui_stru { /* UI Input in hci_synchronous_connection_response */ - struct hci_connection_request_ev_stru *ev; /* event received */ - struct hci_synchronous_connection_stru par; /* eSCO Parameters */ - /* etc: HCI_OPS_REJECT_SYNCHRONOUS_CONNECTION_REQUEST, HCI_OPS_ACCEPT_SYNCHRONOUS_CONNECTION_REQUEST */ - uint32_t opscode; -}; - -struct hci_synchronous_enhanced_connection_response_ui_stru { - struct hci_enhanced_accept_synchronous_connection_request_stru par; - uint32_t opscode; -}; - -struct hci_create_scoui_stru { /* UI Input in hci_synchronous_connection_response */ - struct hci_address_stru addr; /* Remote addr */ - struct hci_synchronous_connection_stru par; /* eSCO Parameters */ -}; - -/* ----------------------------------------------------------------------------- -Description: - Upper protocol callback function for HCI. - hdl: (arg length(2octets) << 16) | ampid(1octet). - context: upper defined address. - arg: parameter for this op_ev. - op_ev: (opcode(passive is 0x0000) << 16) | evindex(include HCI_EVO_ or HCI_EVI) ------------------------------------------------------------------------------ */ -typedef void (HCI_CbkFunc)(HANDLE hdl, void *context, void *arg, uint32_t op_ev); - -struct hci_cbk_line_stru { /* UI cbk func jump martix */ - uint16_t id; /* HCI_OPC_ or HCI_EVI_(EVO) */ - void *func; /* HCI_CbkFunc for external, HCI_CbkTableFunc for internal */ -}; - -enum { - HCI_CBK_TYPE_INTERNAL = 1, - HCI_CBK_TYPE_EXTERNAL = 2, -}; - -struct hci_cbk_node_stru { - const struct hci_cbk_line_stru *table; - uint32_t size; - uint8_t type; -}; - -enum { /* action in struct hci_qo_s_cbk_node_stru *f */ - HCI_QOS_ACTION_GO = 0, - HCI_QOS_ACTION_STOP = 1 -}; - -struct hci_qo_s_cbk_node_stru { /* for hci_qos_reg */ - void (*f)(uint8_t action); /* etc, HCI_QOS_ACTION_GO */ - uint8_t idx; /* to match Unreg with Reg */ -}; - -/* cbk arg for HCI_EVO_COMMAND_ERROR, also for L2 command finish/cancel */ -struct hci_command_error_stru { - uint16_t status; /* Extended by HCI_STATUS_RTX, include COMMAND_STATUS failed */ - uint16_t opcode; /* HCI_OPC_ */ - uint8_t req[1]; /* Varable length, visit as void *, check platform CPU */ -}; - -/* ----------------------------------------------------------------------------- -Description: - Level 2 Command Node Queue finished callback. ------------------------------------------------------------------------------ */ -typedef void (hci_l2queue_cbk_func)(HANDLE hdl, void *context, struct hci_command_error_stru *arg, uint16_t len); - -#define HCI_COMMAND_MASK_TRANSPARENT 0x01 /* The input command parameter is in the PDU format */ - -struct hci_command_node_stru { /* Level 1 command node */ - struct fsm_timer *timer; /* RTX/ERTX Timer */ - void *par; /* raw structure for context. */ - void *context; /* application context pointer */ - hci_l2queue_cbk_func *qcbk; /* Level 2 queue, when this command finished for any reason, cbk */ - uint16_t opcode; /* etc: HCI_OPC_INQUIRY */ -#ifndef CONFIG_HCI_NEW_STREAM_STRUCT_CONVERSION - uint16_t struinfo; /* Command & Return structure convert info */ -#endif - /* Waiting for this event for complete, if command op may wait more than 1 event, check table for patch */ - uint8_t evindex; - uint8_t mask; /* HCI_COMMAND_MASK_TRANSPARENT */ -#ifdef CONFIG_HCI_NEW_STREAM_STRUCT_CONVERSION - uint8_t par_stru_len; /* length of par, which is a struct */ - uint8_t recv_cmd_status_evt; /* FALSE: Hasn't received cmd_status_evt, TRUE: Has received cmd_status_evt */ -#endif - uint8_t ampid; - void *_rom; -}; - -struct hci_command_queue_stru { /* Level 2 command queue node */ - struct bth_list_stru list; /* node is struct hci_command_node_stru */ - hci_l2queue_cbk_func *qcbk; /* Use to cbk when queue finished */ - /* cbk arg by caller, this shall be a unique memory address used as a marker of this l2 queue */ - void *context; - uint8_t ampid; /* target controller id */ -}; - -union hci_set_event_filter_condition_in_union { - struct hci_set_event_filter_condition_in_stru { - uint8_t class_of_device[3]; - uint8_t class_of_device_mask[3]; - } c; - uint8_t bd[6]; -}; - -struct hci_set_event_filter_in_stru { /* UI Interface for hci_set_event_filter */ - uint8_t filter_type; - uint8_t filter_condition_type; /* optional */ - union hci_set_event_filter_condition_in_union condition; - uint8_t auto_accept_flag; /* optional */ -}; - -enum { /* flag in struct hci_inquiry_in_stru */ - HCI_INQUIRY_FLAG_ENTER_PERIOIDIC_MODE = 0, - HCI_INQUIRY_FLAG_EXIT_PERIOIDIC_MODE = 1, - HCI_INQUIRY_FLAG_INQUIRY = 2, - HCI_INQUIRY_FLAG_INQUIRY_CANCEL = 3, - - HCI_INQUIRY_FLAG_CLASS_OF_DEVICE = 0x80, /* Set_Event_Filter */ - HCI_INQUIRY_FLAG_BD = 0x40, /* Set_Event_Filter */ - HCI_INQUIRY_FLAG_SET_EVENT_FILTER = (HCI_INQUIRY_FLAG_CLASS_OF_DEVICE | HCI_INQUIRY_FLAG_BD) -}; - -struct hci_inquiry_in_stru { /* input arg for hci_inquiry */ - hci_l2queue_cbk_func *cbk; - void *context; - uint16_t max_period_len; - uint16_t min_period_len; - uint8_t lap[3]; - uint8_t inquiry_len; - uint8_t num_responses; - uint8_t flag; /* HCI_INQUIRY_FLAG_xxx */ - union hci_set_event_filter_condition_in_union condition; -}; - -struct hci_eir_data_node_stru { /* Node in hci_extended_inquiry_response_decode */ -#ifdef CONFIG_SUB_STRUCTURE_ALIGNED_FIXED - uint8_t padding[2]; /* For ARM Linux GCC, substru is algined by 4 octets */ -#endif - uint8_t len; /* 1 type + x length */ - uint8_t eir_data_type; /* etc:HCI_EIR_DATATYPE_FLAGS */ - union { - /* General data pointer */ - uint8_t p[1]; - - /* HCI_EIR_DATATYPE_SHORTENED_LOCAL_NAME, - HCI_EIR_DATATYPE_COMPLETE_LOCAL_NAME */ - struct hci_eir_data_name_stru { - uint8_t data[1]; /* len - 1 octets */ - } name; - - /* HCI_EIR_DATATYPE_FLAGS */ - uint8_t flags; /* etc, HCI_EIR_FLAGS_BREDR_NOT_SUPPORTED */ - - /* HCI_EIR_DATATYPE_MANUFACTURER_SPECIFIC_DATA */ - struct hci_eir_data_manufacturer_data_stru { - uint8_t company_identifier_code[2]; - uint8_t data[1]; /* len - 1 - 2 octets */ - } manufacturer_data; -#ifdef ENABLE_CHANGE_DEVICE_NAME - /* HCI_EIR_DATATYPE_MANUFACTURER_SPECIFIC_DATA */ - struct hci_eir_data_device_id_stru { - uint8_t vendor_id_src[2]; // two bytes in device id profile - uint8_t vendor_id[2]; // two bytes in device id profile - uint8_t product_id[2]; // two bytes in device id profile - uint8_t version[2]; // two bytes in device id profile - } device_id_data; -#endif - /* HCI_EIR_DATATYPE_TX_POWER_LEVEL */ - uint8_t tx_power_level; /* -127 to + 127dBm, pathloss = Tx Power Level - RSSI */ - - /* HCI_EIR_DATATYPE_SLAVE_CONNECTION_INTERVAL_RANGE, only for LE AD */ - struct hci_eir_data_slave_connection_interval_range_stru { - uint8_t conn_interval_min[2]; - uint8_t conn_interval_max[2]; - /* The first 2 octets defines the minimum value for the connection interval, the second 2oct for maximum */ - } slave_connection_interval_range; - - /* HCI_EIR_DATATYPE_INCOMPLETE_LIST_OF_16BIT_SERVICE_CLASS_UUIDS, - HCI_EIR_DATATYPE_COMPLETE_LIST_OF_16BIT_SERVICE_CLASS_UUIDS, - HCI_EIR_DATATYPE_LIST_OF_16BIT_SERVICE_SOLICITATION_UUIDS, - HCI_EIR_DATATYPE_INCOMPLETE_LIST_OF_32BIT_SERVICE_CLASS_UUIDS, - HCI_EIR_DATATYPE_COMPLETE_LIST_OF_32BIT_SERVICE_CLASS_UUIDS, - HCI_EIR_DATATYPE_LIST_OF_32BIT_SERVICE_SOLICITATION_UUIDS, - HCI_EIR_DATATYPE_INCOMPLETE_LIST_OF_128BIT_SERVICE_CLASS_UUIDS, - HCI_EIR_DATATYPE_COMPLETE_LIST_OF_128BIT_SERVICE_CLASS_UUIDS, - HCI_EIR_DATATYPE_LIST_OF_128BIT_SERVICE_SOLICITATION_UUIDS */ - uint8_t uuid[1]; /* 2,4,or 16 octets */ - - /* HCI_EIR_DATATYPE_SERVICE_DATA_16BIT_UUID */ - struct hci_eir_data_service_data16stru { - uint8_t uuid16[2]; - uint8_t data[1]; /* len - 1 - 2 octets */ - } service_data16; - - /* HCI_EIR_DATATYPE_SERVICE_DATA_32BIT_UUID */ - struct hci_eir_data_service_data32stru { - uint8_t uuid32[4]; - uint8_t data[1]; /* len - 1 - 4 octets */ - } service_data32; - - /* HCI_EIR_DATATYPE_SERVICE_DATA_128BIT_UUID */ - struct hci_eir_data_service_data128stru { - uint8_t uuid128[16]; - uint8_t data[1]; /* len - 1 - 16 octets */ - } service_data128; - - /* HCI_EIR_DATATYPE_APPEARANCE, only for LE AD */ - uint8_t appearance[2]; - - /* HCI_EIR_DATATYPE_PUBLIC_TARGET_ADDRESS, - HCI_EIR_DATATYPE_RANDOM_TARGET_ADDRESS, only for LE AD */ - uint8_t addr[6]; /* Multiples of 6 octets */ - - /* HCI_EIR_DATATYPE_LE_BLUETOOTH_DEVICE_ADDRESS, only for LE AD */ - /* The least significant bit of the most significant octet defines if the Device Address is a - Public Address or a Random Address. LSB = 1 Then Random Device Address. - LSB = 0 Then Public Device Address. Bits 1 to 7 in the most significant octet are reserved for future use */ - uint8_t leaddr[7]; /* 7 octets */ - - /* HCI_EIR_DATATYPE_LE_ROLE */ - uint8_t le_role; /* etc, HCI_LE_ROLE_ONLY_PERIPHERAL_ROLE_SUPPORTED */ - - /* HCI_EIR_DATATYPE_ADVERTISING_INTERVAL, only for LE AD */ - uint8_t advertising_interval[2]; /* Units: 0.625 msec */ - - /* Following only for Vol3, Part C, 5.2.2.7 OOB data Block format */ - /* HCI_EIR_DATATYPE_CLASS_OF_DEVICE */ - uint8_t class_of_device[3]; - - /* HCI_EIR_DATATYPE_SIMPLE_PAIRING_HASH_C192 */ - /* HCI_EIR_DATATYPE_SIMPLE_PAIRING_HASH_C256 */ - uint8_t simple_pairing_hash_c[16]; /* 16 octets */ - - /* HCI_EIR_DATATYPE_SIMPLE_PAIRING_RANDOMIZER_R192 */ - /* HCI_EIR_DATATYPE_SIMPLE_PAIRING_RANDOMIZER_R256 */ - uint8_t simple_pairing_randomizer_r[16]; /* 16 octets */ - - /* HCI_EIR_DATATYPE_LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE */ - uint8_t lesc_confirmation[16]; - - /* HCI_EIR_DATATYPE_LE_SECURE_CONNECTIONS_RANDOM_VALUE */ - uint8_t lesc_random[16]; - } u; -}; /* all member uint8_t, so no pendding at all, visit from &node->len */ - -/* ACL link auto-sniff, by YDX, 2019.3.20 */ -struct hci_auto_sniff_par_stru { - uint8_t idle_time; /* Idle time in seconds before entering sniff mode */ - uint16_t sniff_max_interval; /* sniff maximum interval */ - uint16_t sniff_min_interval; /* sniff minimum interval */ - uint16_t sniff_attempt; /* sniff attempt */ - uint16_t sniff_timeout; /* sniff timeout */ -}; - -struct hci_auto_sniff_req_stru { - uint8_t bd[6]; - struct hci_auto_sniff_par_stru *par; -}; - -/* --------------------------------------------------------------------------- */ -/* callback for HCI_EVO_Events */ -/* --------------------------------------------------------------------------- */ -enum { - /* Local born without buffer size, without BD, just used to active waiting, for TL-REG caller */ - HCI_LOCALCONTROLLER_TLREG_FINISH, - HCI_LOCALCONTROLLER_REMOVE, /* Local controller removed */ - HCI_LOCALCONTROLLER_NOTIFY_BUFFER_SIZE, /* ACL/LE buffer size, or data block size */ - HCI_LOCALCONTROLLER_NOTIFY_AMPINFO, /* AMP status notify, temply saved in le_status */ - HCI_LOCALCONTROLLER_NOTIFY_BREDR_LE_CAP /* BREDR or LE or DuleMode */ -}; - -struct hci_local_controller_changed_stru { /* par of HCI_EVO_LOCALCONTROLLER_CHANGED */ - HANDLE tl_hdl; - struct hci_address_stru addr; /* Local Read_BDADDR for BD and feature to get cap */ - uint16_t max_pdusize; /* 1500 */ - uint8_t ampid; /* HCI_AMPID_BREDR */ - uint8_t action; /* etc: HCI_LOCALCONTROLLER_TLREG_FINISH */ - uint8_t amp_status; /* HCI_AMP_STATUS_NO_CAPACITY */ - uint8_t cap; /* etc: HCI_ADDRESS_CAP_LE */ -}; - -#define HCI_MPN 2 /* 2*uint,64bits,enough? */ - -typedef struct { - uint32_t num[HCI_MPN]; -} hci_mp_int; - -enum { /* dcounter[x] in struct hci_local_stru */ - HCI_DCOUNTER_SEND, - HCI_DCOUNTER_RECV -}; - -struct hci_info_read_local_stru { - struct hci_address_stru br_addr; /* BREDR address - Shall be all 0s in LE-only mode */ - /* Identity address - May be public or static if LE supported. Otherwise, shall be all 0s. */ - struct hci_address_stru id_addr; - /* Random address - May be all 0s, or RPA, or None-RPA if LE supported. Otherwise, shall be all 0s. */ - struct hci_address_stru rd_addr; - hci_mp_int dcounter[2]; /* etc: HCI_DCOUNTER_SEND */ - uint8_t hci_version; - uint8_t ampid; -}; - -#define HCI_REMOTE_INFO_SRC_INQUIRY 1 -#define HCI_REMOTE_INFO_SRC_CONNECT_REQ 2 -/* The upper two provide device_of_class */ -#define HCI_REMOTE_INFO_SRC_ADV_REPORT 3 -#define HCI_REMOTE_INFO_SRC_SCAN_RESPONSE 4 -#define HCI_REMOTE_INFO_SRC_REMOTE_FEATURES 5 -#define HCI_REMOTE_INFO_SRC_OTHER 0xFF - -struct hci_remote_info_stru { - /* Could be Public from BREDR, from LE, or Random from LE, or converted by SMP into public, just a reference */ - struct hci_address_stru addr; - uint8_t src; /* HCI_REMOTE_INFO_SRC_INQUIRY_RESULT etc. */ - /* etc, HCI_CLASS_OF_DEVICE_LIMITED_DISCOVERABLE_MODE, 23~13 for bitmask, 12~8 for enum major, 7~2 for minor, - 1~0 are 0 */ - uint8_t class_of_device[3]; - uint8_t page_scan_repetition_mode; /* etc: HCI_PAGE_SCAN_REPETITION_MODE_R2 */ - - /* BR/EDR Range: -128 <= N <= 127 (signed integer) Units: dB */ - /* AMP: Range: AMP type specific (signed integer) Units: dBm */ - /* LE: Range: -127 to 20, 127 (signed integer) Units: dBm */ - uint8_t rssi; - uint8_t eir_len; - uint8_t eir[1]; /* Variable length */ -}; - -/* SDU segment flag */ -enum { - QOS_SDU_START = 0x01, /* 0x01 start of SDU, a bitmask */ - QOS_SDU_END = 0x80, /* 0x80 end of SDU, a bitmask */ - QOS_SDU_CONTINUE = 0x02 /* 0x02, not start, not end */ -}; - -struct hci_l2cap_data_cfm_stru { /* QoS DataCfm */ - uint16_t cid; -}; - -struct hci_info_read_link_security_stru { /* = struct HCI_ACLLinkSecurityStru part */ - uint16_t mask; /* etc: HCI_SECURITY_AUTHENTICATE, HCI_SECURITY_LINKKEY */ -}; - -struct hci_info_read_le_size_number_stru { /* All LE Controller size or number limitations */ - uint8_t white_list_size; /* White list size */ - uint8_t resolving_list_size; /* Resolving list size */ - uint16_t max_adv_data_length; /* Maximum advertising data length */ - uint8_t number_of_adv_sets; /* Number of advertising sets supported */ - uint8_t prd_dev_list_size; /* Periodic advertiser list size */ - - void *_rom; -}; -enum { /* result of struct hci_security_author_req_stru */ - HCI_SECURITY_AUTHOR_PASS, - HCI_SECURITY_AUTHOR_NOTALLOW -}; - -struct hci_security_author_req_stru { /* par of HCI_EVO_AUTHORIZATION_REQUEST */ - struct hci_address_stru addr[2]; /* x in HCI_LOCAL */ - uint16_t hcihdl; /* Based on a link object */ - uint16_t channel; /* PSM for L2CAP Server channel for RFCOMM */ - uint8_t proto_id; /* etc: PROT_L2CAP, PROT_RFCOMM */ - uint8_t result; /* etc: HCI_SECURITY_AUTHOR_PASS */ -}; - -enum { /* parameter values of hci_le_set_op_report_stru::op_id */ - HCI_LE_SETOP_SET_ADV_ENABLE, - HCI_LE_SETOP_CURRENT_ADV_STATE, /* Report current advertising state */ - HCI_LE_SETOP_ADV_NOT_ALLOWED, /* Advertising can't be enabled/disabled */ - HCI_LE_SETOP_SET_SCAN_ENABLE, - HCI_LE_SETOP_CURRENT_SCAN_STATE, /* Report current scan state */ - HCI_LE_SETOP_SCAN_NOT_ALLOWED, /* LE scan can't be enabled/disabled */ - - HCI_LE_SETOP_RANDOM_ADDR_UPDATE, /* Local random address is updated */ -}; - -/* Parameter values of HCI_EVO_LE_SET_SCAN_ADV_STEP */ -struct hci_le_set_op_report_stru { - uint8_t op_id; /* Operation being executed */ - uint8_t op_value; /* 0 - Disable 1 - Enable. */ -}; - -/* Parameter values of HCI_EVO_PAIRCFM_ASK4 */ -struct hci_security_pair_cfm_ask4stru { - uint8_t remote_bd[6]; /* remote BD_ADDR */ - uint8_t initiator; /* 0 - Remote initiates pairing 1 - Local initiates pairing */ - uint8_t bond; /* HCI_BOND_NOBOND/HCI_BOND_DEDICATED/HCI_BOND_GENERAL */ -}; - -/* Parameter values of HCI_EVO_ENCRYPTION_CHANGED */ -struct hci_security_encryption_changed_stru { - uint8_t remote_bd[6]; /* remote BD_ADDR */ - uint8_t encryption_result; /* encryption result */ -}; - -enum { /* HCI Command Error Internal reason */ - HCI_STATUS_NO_FLOWCONTROL = 0x0100, /* for HCI_OPC_HOST_NUMBER_OF_COMPLETED_PACKETS */ - HCI_STATUS_NOT_SUPPORTED, - HCI_STATUS_RTX, - HCI_STATUS_CANCELED, - HCI_STATUS_LOCAL_CONTROLLER_REMOVED, - HCI_STATUS_MITM_NOT_SATISIFIED, /* Were requested for MITM, but for IO or other reason, result is non_MITM */ - HCI_STATUS_LINK_DISCONNECTED, /* Some link-related cmd should be removed when link disconnected */ -}; - -enum { /* For hci_cbk Additional event section in struct HCI_EvCBKStru, added enum for HCI_EVI_xxx */ - HCI_EVO_ACLLINK = HCI_EVI_ENDLINE, /* Create/Delete/1st Ready, struct hci_link_cbk_stru */ - HCI_EVO_LELINK, /* LE, struct hci_link_cbk_stru */ - /* eSCO, HCI_EVI_CONNECTION_REQUEST, waiting for Connection_Response */ - HCI_EVO_ESCOLINK, - HCI_EVO_LOCALCONTROLLER_CHANGED, /* struct hci_local_controller_changed_stru */ - HCI_EVO_REMOTECONTROLLER_CHANGED, /* struct hci_remote_info_stru */ - HCI_EVO_ACL_DATA_IND, /* struct buff_stru */ - HCI_EVO_PHY_DATA_IND, /* struct buff_stru */ - HCI_EVO_LE_DATA_IND, /* struct buff_stru */ - HCI_EVO_SCO_DATA_IND, /* struct buff_stru */ - - /* HCI Internal filter event from EVI_ */ - HCI_EVO_COMMAND_ERROR, /* Command Terminate reason for OpCbk, struct hci_command_error_stru */ - /* Shall Register OPC(Cover Error) before EVI(Cover Passive) with one function */ - - HCI_EVO_AUTHORIZATION_REQUEST, /* struct hci_security_author_req_stru */ - HCI_EVO_AUTHORIZATION_ABORT, /* struct hci_security_author_req_stru */ - /* struct hci_user_confirmation_request_ev_stru, Popup a window and display something */ - HCI_EVO_SECURITY_DISPLAY, - HCI_EVO_LINK_KEY_SAVE, /* struct hci_security_link_key_save_stru, app to save bonded linkkey */ - HCI_EVO_LINK_KEY_ASK4, /* struct hci_security_link_key_ask4stru, ask for linkkey */ - HCI_EVO_PIN_CODE, /* struct hci_pin_code_request_ev_stru, ask for PINCode */ - HCI_EVO_COMMAND_COMPLETE, /* return parameter in command_complete */ - HCI_EVO_LOOPBACK, /* struct hci_loopback_command_ev_stru */ - HCI_EVO_L2CAP_DATACFM, /* struct hci_l2cap_data_cfm_stru */ - HCI_EVO_REMOTE_OOB_DATA_REQUEST, /* struct hci_remote_oob_data_request_stru */ - HCI_EVO_NO_FLOW_CONTROL, /* NULL */ - HCI_EVO_LE_SET_OP_REPORT, /* struct hci_le_set_op_report_stru */ - HCI_EVO_PAIRCFM_ASK4, /* struct hci_security_pair_cfm_ask4stru */ - HCI_EVO_ENCRYPTION_CHANGED, /* struct hci_security_encryption_changed_stru */ - - HCI_EVO_GLELINK, - HCI_EVO_GLE_DATA_IND, -}; - -enum { /* Bitmask in hci_acl_link_ref */ - /* input r is the acllink object, no need to find again */ - HCI_ACLLINK_ACLOBJECT = 0x8000, - HCI_ACLLINK_LE = 0x4000, - - /* UI interface */ - HCI_ACLLINK_REF_BREDR = (0x0001), - HCI_ACLLINK_REF_LE = (0x0002 | HCI_ACLLINK_LE) -}; - -enum { /* Job in struct hci_link_cbk_stru, for HCI_EVO_LELINK & HCI_EVO_ACLLINK */ - HCI_LINKCBK_CREATE, /* to create a shadow obj */ - HCI_LINKCBK_DELETE, /* Disconnected, kill shadow obj */ - HCI_LINKCBK_CONNECTED, /* Connected, Notify hcihdl, address, role, etc */ - HCI_LINKCBK_READY /* Ready to use the link for upper */ -}; - -enum { /* mask in HCI_Set_Channel_Classification */ - HCI_SETAFH_OCCUPY = 0x01, /* otherwise release */ - HCI_SETAFH_SENDCMD = 0x02 /* or later */ -}; - -enum { /* mask in struct hci_link_stru / struct hci_link_cbk_stru */ - /* Local initiated connection, local manage disconnect of the link */ - HCI_ACLMASK_INITIATOR = 0x01, - /* Before connection complete is judged, two bits may exist simultaneously */ - HCI_ACLMASK_ACCEPTOR = 0x08, - /* Connection complete OK/ACL already exist received, only disconnect can kill link */ - HCI_ACLMASK_CONNECTION_COMPLETED = 0x10, - - /* Master or Slave(Unknown yet), only for LE since Role_Change is not watched */ - HCI_ACLMASK_MASTER = 0x02, - HCI_ACLMASK_RECVDATA_TAIL_UNCOMPLETE = 0x04 /* Recedata list tail node is a uncomplete L2CAP segments head - or is complete but waiting for link status change to ready(GetRemoteInfo) */ -}; - -enum { /* addr[x] in struct hci_link_cbk_stru */ - HCI_LOCAL = 0, - HCI_REMOTE = 1 -}; - -enum { - BTH_LINK_BR = 0, - BTH_LINK_BLE = 1, - BTH_LINK_GLE = 2, -}; -struct hci_link_cbk_stru { /* Cbk arg of hci_acl_link_cbk */ - void *hci; /* Host link handle */ - uint16_t hdl; /* Controller link handle */ - /* HCI_LOCAL(Current used) & HCI_REMOTE(Public/Static Prefered, or CurLink) */ - struct hci_address_stru addr[2]; - uint8_t mask; /* etc: HCI_ACLMASK_INITIATOR, This is only valid when ready */ - uint8_t job; /* etc: HCI_LINKCBK_CREATE */ - uint8_t reason; /* etc: HCI_STATUS_CONNECTION_FAILED_TO_BE_ESTABLISHED */ - - void *_rom; -}; - -struct hci_physical_link_stru { /* in of HCI_PhysicalLink */ - void *acllink; /* As handle */ - uint8_t *assoc; /* Remote assoc, sub mem */ - uint32_t opscode; /* HCI_OPS_ACCEPT_PHYSICAL_LINK or HCI_OPS_CREATE_PHYSICAL_LINK */ - uint16_t assoc_len; - uint8_t phyhdl; - uint8_t ampid; - - void *_rom; -}; - -enum { /* fea in struct smp_key_stru */ - SMP_KEYFEA_ECDH = 0x01, /* By ECDH */ - SMP_KEYFEA_MITM = 0x02, /* Authenticated */ - SMP_KEYFEA_LTK_SEND = 0x04, /* Ability to been encrypt as a slave */ - SMP_KEYFEA_LTK_RECV = 0x08, /* Ability to encrypt as a master */ - SMP_KEYFEA_CSRK_ENCODE = 0x10, /* Ability to encode the signing data */ - SMP_KEYFEA_CSRK_DECODE = 0x20, /* Ability to decode/verify the signing data */ - SMP_KEYFEA_IRK_SEND = 0x40, /* Ability to use RPA, remote could recognize */ - SMP_KEYFEA_IRK_RECV = 0x80 /* Ability to decode remote`s RPA */ -}; - -struct smp_key_stru { /* Master role security database */ - /* as Security Level, both side share this length, by pairing_request and response min */ - uint8_t ltk_len; - uint8_t fea; /* etc, SMP_KEYFEA_ECDH */ - - /* Local sent to remote information */ - uint8_t div[2]; /* 16bits, 2octets, Peripherial(slave) distributed DIV for remote(Master) */ - - /* Remote sent to local, or LESC derived on both sides */ - uint8_t ltk[16]; /* corresponding to Public/Static address or IRK(RPA) */ - uint8_t ediv[2]; /* eDIV and Rand are only used in legacy LTK encryption(no LESC) */ - uint8_t rand[8]; /* Encryption keys */ - uint8_t irk[16]; /* Resolveable address */ - /* Signature, CSRK_DECODE. CSRK_ENCODE is generated by d1(ER, DIV, 1) locally */ - uint8_t csrk[16]; -}; - -struct smp_key_store_stru { /* Keys that indexes by addr */ - struct hci_address_stru addr; /* peer address, is dule-mode? */ - struct smp_key_stru key; /* Bonding information */ -}; -#define HCI_SEC_LINKKEY_MAX_LEN 16 -struct hci_security_remote_stru { - /* from hci_ev_io_capability_response */ - uint8_t io_capability; /* [033],Enum */ - uint8_t authentication_requirements; /* [035],Enum, Remote */ - - uint8_t pin_code_len; /* Default PINCode Length, if 0, PINCode not valid */ - uint8_t pin_code[HCI_PIN_CODE_MAX_LEN]; /* Default PINCode */ - - /* Remote OOB info, local have peer`s */ - /* Local recieves Remote`s OOB, [034],Enum etc, HCI_OOB_DATA_PRESENT_OOB_AUTHENTICATION_DATA_NOT_PRESENT */ - uint8_t oob_data_present; - - /* LE Keys by SMP */ - struct smp_key_stru *lekey; - /* Local send OOB to Remote, OOB need to generate PK[LOCAL] and R[Local] before pairing, - sk[32] + pk[64] + tk(r)[16] */ - uint8_t *oob_pkr; - - /* align */ - struct bth_list_stru reqlist; /* struct hci_security_node_stru */ - uint16_t mask; /* etc: HCI_SECURITY_AUTHENTICATE, HCI_SECURITY_LINKKEY */ - uint8_t link_key[HCI_SEC_LINKKEY_MAX_LEN]; - uint8_t key_type; /* etc: HCI_KEY_TYPE_COMBINATION_KEY */ - /* Pairing Failes 3 consecutive times, ACLLink disconnect with error code 0x05 - Authentication Failure */ - uint8_t fail_counter; -}; - -struct hci_remote_oob_data_request_stru { - uint8_t bd[BD_ADDR_LEN]; - /* 0 = HCI_OPS_REMOTE_OOB_DATA_REQUEST_REPLY / 1 = HCI_OPS_REMOTE_OOB_EXTENDED_DATA_REQUEST_REPLY */ - uint8_t extended; -}; - -enum { /* mask in struct hci_remote_stru */ - /* hci_ev_read_remote_extended_features or hci_ev_remote_host_supported_features_notification */ - HCI_REMOTEMASK_CONTROLLER_FEATURES = 0x01, /* Page 0 */ - HCI_REMOTEMASK_HOST_FEATURES = 0x02, /* Page 1, When got remote host features, don`t ask again */ - /* Got remote IO Capability Response, use to detect Request before or after Response */ - HCI_REMOTEMASK_IO_CAPABILITY_RESPONSE = 0x04, - HCI_REMOTEMASK_IO_CAPABILITY_REQUEST = 0x08, - HCI_REMOTEMASK_IO_CAPABILITY_ROUND = - (HCI_REMOTEMASK_IO_CAPABILITY_REQUEST | HCI_REMOTEMASK_IO_CAPABILITY_RESPONSE), - HCI_REMOTEMASK_BREDR_PAIRING_ONPROGRESS = 0x10, - /* When start inquiry or scan, set this cap to die if not seen */ - HCI_REMOTEMASK_TO_DIE = 0x20, - HCI_REMOTEMASK_ASK4_LINK_KEY = 0x40, /* When asking for Link Key from the APP */ - HCI_REMOTEMASK_ASK4_PAIRING_CONFIRMATION = 0x80 -}; - -enum { - HCI_REMOTE_MIN = 0, - HCI_REMOTE_MAX = 1 -}; - -#define HCI_LMP_FEATURE_MAX_PAGE 3 /* 0, 1, 2, for local & remote */ - -struct hci_remote_stru { /* Only Remote Primary BREDR/LE controller, AMP is not a remote obj */ - struct hci_security_remote_stru sec; - /* etc: HCI_ADDR_IDENTITY, HCI use current address, whatever type it is, the address for controller */ - struct hci_address_stru addr[2]; - /* etc: HCI_REMOTE_MIN, Min, Max, [210],Time, From AD Perpherial Perfered Parameter */ - uint16_t conn_interval[2]; - uint16_t clock_offset; /* etc: HCI_CLOCK_OFFSET_VALID | x */ - uint8_t cap; /* etc: HCI_ADDRESS_CAP_LE */ - uint8_t page_scan_repetition_mode; /* etc: HCI_PAGE_SCAN_REPETITION_MODE_R0 */ - uint16_t mask; /* etc: HCI_REMOTEMASK_HOST_FEATURES */ - /* extended features 8 pages? current allocate 3 page? need bitmask if we have already asked */ - uint8_t lmp_features[HCI_LMP_FEATURE_MAX_PAGE][8]; - void *_gle; -}; - -enum { /* mode in struct HCI_SecuritySetModeStru */ - HCI_SECURITY_MODE1, /* No Security, Forbidden in 2.1, expection is SDP */ - HCI_SECURITY_MODE2, /* Service Level Security, 3 & 1 is part of 2, so treat as 2 */ - HCI_SECURITY_MODE3, /* Link Level Security, HCI_OPS_WRITE_AUTHENTICATION_ENABLE */ - /* Mode2, but Forced to Auth/Encrypt, expection is SDP, HCI_OPC_WRITE_SIMPLE_PAIRING_MODE */ - HCI_SECURITY_MODE4 -}; - -enum { /* Additional enum bit mask identifies the types of Security OOB data available */ - HCI_OOB_DATA_NOT_PRESENT = 0x00, - HCI_OOB_DATA_P192_CR_VALUE_PRESENT = 0x01, - HCI_OOB_DATA_P256_CR_VALUE_PRESENT = 0x02, - HCI_OOB_DATA_P192_AND_P256_CR_VALUE_PRESENT = 0x03, - HCI_OOB_DATA_SMP_TK_VALUE_PRESENT = 0x10, - HCI_OOB_DATA_SECURE_SMP_CR_VALUE_PRESENT = 0x20, - HCI_OOB_DATA_SMP_TK_AND_SECURE_SMP_CR_VALUE_PRESENT = 0x30 -}; - -struct hci_security_remote_oob_stru { /* Remote Controller Security OOB data */ - struct hci_address_stru addr; /* Remote Addr */ - - /* Direction for: HCI_OPS_IO_CAPABILITY_REQUEST_REPLY and SMP Pairing_Request / Security_Request */ - /* [034],Enum etc, HCI_OOB_DATA_PRESENT_OOB_AUTHENTICATION_DATA_NOT_PRESENT */ - uint8_t oob_data_present; -}; - -struct hci_security_link_key_recover_stru { /* in of hci_security_link_key_recover */ - uint8_t bd[BD_ADDR_LEN]; /* [123],Val */ - uint8_t link_key[HCI_SEC_LINKKEY_MAX_LEN]; /* [173],Val */ - uint8_t key_type; /* etc: HCI_KEY_TYPE_COMBINATION_KEY */ - uint8_t accept; /* TRUE for Reply or recover key, FALSE for Negative Reply */ -}; - -enum { /* mask in struct hci_security_node_stru */ - /* authentication, ask this device is allowed or not? we are initiator of HCI_Authentication_Requested */ - HCI_SECURITY_AUTHENTICATE = 0x0001, - HCI_SECURITY_AUTHORIZE = 0x0002, /* authorization, popup to ask if this PSM is allowed? */ - HCI_SECURITY_ENCRYPT = 0x0004, /* encryption is required on node, encrypted on remote */ - HCI_SECURITY_MITM = 0x0008, /* authentication with keytype check for MITM, Level 3 */ - HCI_SECURITY_P256 = 0x0010, /* AES-CCM, P256 ECDH */ - /* Incoming channel, upper layer concept, this is not security direction! */ - HCI_SECURITY_INCOMING = 0x0020, - - /* Other internal masks for remote->sec.mask, also encrypt, mitm, p256, authenticate */ - /* Authorization callback ongoing, for abort, only for require node */ - HCI_SECURITY_AUTHORIZE_ONGOING = 0x8000, - HCI_SECURITY_LINKKEY = 0x1000, /* LinkKey validation, go for authencation for it */ - HCI_SECURITY_BAD_LINKKEY = 0x0800, /* LinkKey Level not enough, a temp procedure mask */ - HCI_SECURITY_BONDED = 0x0400, /* Bonded, linkkey is bonded or unbonded(temp) */ - HCI_SECURITY_BONDABLE = 0x0200 /* Bondable */ -}; - -enum { /* Result in Security callback */ - HCI_SECURITY_CBK_COMPLETE = 0, - HCI_SECURITY_CBK_PENDDING = (1 << 16) -}; - -struct hci_security_info_stru { /* node in HCI_SECURITYLIST */ - uint16_t channel; /* PSM or server channel */ - uint16_t mask; /* etc: HCI_SECURITY_AUTHENTICATE */ - uint8_t proto_id; /* etc: PROT_L2CAP */ -}; - -#ifdef BTH_AUDIO_OVER_DSP -#pragma pack(2) -struct hci_share_mem_for_voice_data_stru { - uint16_t sync_hdl; /* connect handle */ - uint32_t stream_out_mem; /* memory for voice data transmission from dsp to BTC */ - uint32_t stream_in_mem; /* memory for voice data transmission from BTC to dsp */ - uint16_t enable; /* enable/disable the memory */ -}; -#pragma pack() -#endif - -enum { /* Bond in struct hci_security_node_stru */ - HCI_BOND_NOBOND = 0, /* No Bond */ - HCI_BOND_DEDICATED = 1, /* Without a L2CAP/RFCOMM channel */ - HCI_BOND_GENERAL = 2 /* With a L2CAP/RFCOMM channel */ -}; - -struct hci_security_node_stru { /* node in link->sec.reqlist */ - struct hci_security_info_stru info; /* Must in 1st item for searching */ - /* Security Caller cbk, HCI_SMCbkFunc *, but dead-lock called, so void *, for KEIL compile reason */ - void *cbk; - uint16_t hcihdl; /* Based on a link object */ - uint8_t bond; /* etc: HCI_BOND_DEDICATED */ -}; - -/* ----------------------------------------------------------------------------- -Description: - Security Request ListNode callback. ------------------------------------------------------------------------------ */ -typedef void (HCI_SMCbkFunc)(struct hci_security_node_stru *node, uint32_t result); - -#define HCI_SECURITY_LINK_KEY_REQUEST_REPLY_STRU hci_security_link_key_recover_stru /* For compatibility */ - -struct hci_security_link_key_ask4stru { /* HCI_EVO_LINK_KEY_ASK4 */ - uint8_t local_bd[BD_ADDR_LEN]; /* [123],Val */ - uint8_t remote_bd[BD_ADDR_LEN]; /* [123],Val */ -}; - -struct hci_security_link_key_save_stru { /* HCI_EVO_LINK_KEY_SAVE */ - uint8_t local_bd[BD_ADDR_LEN]; /* [123],Val */ - uint8_t remote_bd[BD_ADDR_LEN]; /* [123],Val */ - uint8_t link_key[16]; /* [173],Val */ - uint8_t key_type; /* etc: HCI_KEY_TYPE_COMBINATION_KEY */ -}; - -#ifdef CONFIG_JITWS -/* Macro components of HCI_OPS_ */ -/* Ret struinfo offset or EVI selector bitmask */ -#define hci_ops2mask(ops_) (((uint16_t)ops_ >= 0xFC00)? 0:((ops_) & 0x8000)) -/* OPCode, remove 0x8000 bitmask */ -#define hci_ops2opc(ops_) (((uint16_t)ops_ >= \ - 0xFC00)?(uint16_t)(ops_):((uint16_t)((ops_) & 0x7FFF))) -#ifdef CONFIG_HCI_NEW_STREAM_STRUCT_CONVERSION -#define hci_ops2strulen(ops_) ((uint8_t)((ops_) >> 16)) /* struct lenght of opcode */ -#else -#define hci_ops2reqoff(ops_) ((uint8_t)((ops_) >> 16)) /* Req struinfo offset */ -#endif -#define hci_ops2retevi(ops_) ((uint8_t)((ops_) >> 24)) /* Ret struinfo offset or EVI */ - -#define hci_set_off(p, evindex_) ((p)[(evindex_) >> 3] &= ~((1 << ((evindex_) & 7)))) -#define hci_set_bit(p, evindex_) ((p)[(evindex_) >> 3] |= (1 << ((evindex_) & 7))) -#define hci_check_bit(p, evindex_) ((p)[(evindex_) >> 3] & (1 << ((evindex_) & 7))) -#else - -/* Macro components of HCI_OPS_ */ -#define hci_ops2mask(ops_) ((ops_) & 0x8000) /* Ret struinfo offset or EVI selector bitmask */ -#define hci_ops2opc(ops_) ((uint16_t)((ops_) & 0x7FFF)) /* OPCode, remove 0x8000 bitmask */ -#ifdef CONFIG_HCI_NEW_STREAM_STRUCT_CONVERSION -#define hci_ops2strulen(ops_) ((uint8_t)((ops_) >> 16)) /* struct lenght of opcode */ -#else -#define hci_ops2reqoff(ops_) ((uint8_t)((ops_) >> 16)) /* Req struinfo offset */ -#endif -#define hci_ops2retevi(ops_) ((uint8_t)((ops_) >> 24)) /* Ret struinfo offset or EVI */ - -#define hci_set_off(p, evindex_) ((p)[(evindex_) >> 3] &= ~((1 << ((evindex_) & 7)))) -#define hci_set_bit(p, evindex_) ((p)[(evindex_) >> 3] |= (1 << ((evindex_) & 7))) -#define hci_check_bit(p, evindex_) ((p)[(evindex_) >> 3] & (1 << ((evindex_) & 7))) -#endif -/* ----------------------------------------------------------------------------- -Description: - HCI LE UI structures. ------------------------------------------------------------------------------ */ -/* Parameters of Extended Scan */ -struct hci_le_ext_scan_parameters_stru { - /* Extended Scann Parameters */ - /* Policy to filter advertising packets, one of t_hci_scanning_filter_policy, e.g. - HCI_SCANNING_FILTER_POLICY_ACCEPT_ALL */ - uint8_t scan_filter_policy; - uint8_t scan_phys; /* Scanning PHYs, combination of t_hci_scanning_ph_ys, e.g. HCI_SCANNING_PHYS_1M */ - /* type of the scan of 1M PHY. one of t_hci_le_scan_type, e.g. HCI_LE_SCAN_TYPE_PASSIVE_SCANNING */ - uint8_t scan_type_1m; - /* type of the scan of Coded PHY. one of t_hci_le_scan_type, e.g. HCI_LE_SCAN_TYPE_PASSIVE_SCANNING */ - uint8_t scan_type_coded; - /* Parameters for 1M PHY */ - /* Time interval from when the Controller started its last scan until it begins the subsequent scan on the - primary advertising channel, 0x0004 - 0xFFFF. N*0.625ms */ - uint16_t scan_interval_1m; - /* Duration of the scan on the primary advertising channel, 0x0004 - 0xFFFF. N*0.625ms */ - uint16_t scan_window_1m; - /* Parameters for 1M Coded PHY */ - /* Time interval from when the Controller started its last scan until it begins the subsequent scan on the - primary advertising channel, 0x0004 - 0xFFFF. N*0.625ms */ - uint16_t scan_interval_coded; - /* Duration of the scan on the primary advertising channel, 0x0004 - 0xFFFF. N*0.625ms */ - uint16_t scan_window_coded; -}; - -/* Parameters of Extended Scan Enable */ -struct hci_le_ext_scan_enable_stru { - /* One of t_hci_filter_duplicates, e.g. HCI_FILTER_DUPLICATES_DUPLICATE_FILTERING_DISABLED */ - uint8_t filter_duplicate; - uint8_t limited; /* e.g. LE_DISCOVERYMODE_GENERAL */ - uint16_t duration; /* Scan duration, 0x0001 - 0xFFFF. N*0.625ms */ - uint16_t period; /* Scan period, 0x0001 - 0xFFFF. N*1.28s */ -}; - -struct hci_white_addr_list { - uint8_t count; - struct hci_controller_addr_node_stru *addr_list; -}; - -/* --------------------------------------------------------------------------- */ -/* UI Functions */ -/* --------------------------------------------------------------------------- */ -void hcih_init(void); -#ifdef CONFIG_BT_STACK_DONE -void hci_done(void); -#endif -void hci_cleanup(void); - -void hci_cbk_reg(const struct hci_cbk_line_stru *table, uint32_t size); -void hci_cbk_prime_reg(const struct hci_cbk_line_stru *table, uint32_t size); -void hci_cbk_un_reg(const struct hci_cbk_line_stru *table); -void hci_cbk_un_reg_sync(const struct hci_cbk_line_stru *table); - -void hci_tl_reg(HANDLE tl_hdl, transport_layer_stru *func); -void hci_tl_un_reg(HANDLE tl_hdl); - -void *hci_acl_link_ref(struct hci_address_stru *r, uint32_t flag); -void hci_acl_link_un_ref(void *hci); -void hci_acl_link_kill(void *hci); - -BOOL hci_get_remote_addr_by_acl_hdl(uint16_t conn_hdl, struct hci_address_stru *rmt_addr); -BOOL hci_get_remote_link_key_by_acl_hdl(uint16_t conn_hdl, uint8_t *link_key); - -void hci_create_sco_connection(struct hci_create_scoui_stru *in); -void hci_acl_connection_response(struct hci_acl_connection_response_ui_stru *in); -void hci_synchronous_connection_response(struct hci_synchronous_connection_response_ui_stru *in); -void hci_enhanced_synchronous_connection_response( - struct hci_synchronous_enhanced_connection_response_ui_stru *in); -void hci_set_default_link_role(uint8_t is_master); - -void hci_command_send_amp(void *context, void *par, uint32_t opscode, uint8_t ampid); -void hci_command_send_vendor(void *context, void *par, uint16_t opcode, uint8_t evi, uint8_t paramlen, uint8_t ampid); -void hci_commandl2_send_queue(struct hci_command_queue_stru *queue); -/* context when create queue */ -#ifdef CONFIG_BREDR_HCI -void hci_commandl2_cancel_queue(void *context, uint8_t ampid); -#endif -void hci_cmd_send_func(void *context, void *par, uint32_t opscode); -#define hci_command_send(context_, par_, opscode_) hci_command_send_amp((context_), (par_), (opscode_), \ - HCI_AMPID_BREDR) - -struct hci_command_queue_stru *hci_commandl2_new_queue(hci_l2queue_cbk_func *cbk, void *context, uint8_t ampid); -struct hci_command_node_stru *hci_commandl2_new_node(struct bth_list_stru *list, uint32_t opscode); -struct hci_set_event_filter_stru *hci_set_event_filter(struct hci_set_event_filter_in_stru *in); -void hci_controller_init(hci_l2queue_cbk_func *cbk, void *context, uint8_t ampid); -void hci_controller_reconfig(hci_l2queue_cbk_func *cbk, void *context, uint8_t ampid); -void *hci_inquiry(struct hci_inquiry_in_stru *in); -void hci_disconnect(uint16_t connection_handle, hci_active_dis_reason reason); -void hci_acl_data_send(struct buff_stru *data, uint32_t cid_hcihdl, uint8_t ampid); -void hci_sco_data_send(struct buff_stru *data, uint16_t scohdl); -void hci_set_auto_sniff(uint8_t *bd, struct hci_auto_sniff_par_stru *par); - -uint8_t hci_compare_addr(struct hci_address_stru *s, struct hci_address_stru *r); -uint8_t hci_compare_bd(struct hci_address_stru *addr, const uint8_t *bd); -uint8_t hci_compare_addr_non_0(struct hci_address_stru *s, struct hci_address_stru *r); -uint8_t hci_compare_all_num(uint8_t *p, uint8_t num, uint32_t len); -#ifdef NOT_USED_YET -uint8_t hci_available_addr_cap(struct hci_address_stru *r); -#endif -uint8_t hci_available_addr_cap2(const struct hci_remote_stru *remote); -uint8_t hci_secure_connection_supported(struct hci_remote_stru *remote); -void hci_remote_new_cap_addr(struct hci_remote_stru *remote, struct hci_address_stru *r, uint8_t cap); -struct hci_remote_stru *hci_remote_find_create(uint8_t *bd, uint8_t atype, uint8_t cap); -void hci_remote_change_notify(uint8_t src, struct hci_remote_stru *remote, uint8_t *class_of_device, uint8_t rssi, - uint8_t *eir, uint8_t eir_len); - -uint8_t hci_extended_inquiry_response_encode(struct bth_list_stru *in, uint8_t *out, uint8_t *end); -uint8_t hci_extended_inquiry_response_decode(struct bth_list_stru *list, uint8_t *eir, uint8_t *end); - -struct hci_info_read_local_stru *hci_info_read_local(uint8_t ampid); -void hci_info_read_link_security(struct hci_info_read_link_security_stru *out, void *acl); -void hci_info_read_le_size_number(struct hci_info_read_le_size_number_stru *out, uint8_t ampid); - -void hci_security_set_bondable(uint8_t bondable); -void hci_security_set_oob(struct hci_security_remote_oob_stru *in); -void hci_security_read_local_oob_data(void); -void hci_security_set_local_io(uint8_t io_capability); -void hci_security_request(struct hci_security_node_stru *in); -void hci_security_abort(struct hci_security_node_stru *in); -void hci_security_authorized(struct hci_security_author_req_stru *in); -void hci_security_require_reg(struct hci_security_info_stru *in); -void hci_security_require_un_reg(struct hci_security_info_stru *in); -void hci_security_pin_code_reply(struct hci_pin_code_request_reply_stru *in); -void hci_security_pairing_confirmation(uint8_t *bd, uint8_t response); - -void hci_security_link_key_recover(struct hci_security_link_key_recover_stru *in); -#define HCI_SECURITY_LINKKEY_REPLY hci_security_link_key_recover /* For compatibility */ -void hci_security_link_key_remove(uint8_t *bd); -void hci_security_le_keys_recover(struct bth_list_stru *list); -void hci_security_le_keys_remove(struct hci_address_stru *addr); - -uint8_t *hci_security_get_sc_link_key(void *hci); -/* 6 octets */ -uint32_t hci_security_passkey_entry_input(uint8_t *in); -uint8_t hci_security_get_local_io(void); -uint8_t hci_security_get_bondable(void); -#ifdef CONFIG_SMP_LESC_LINKKEY -uint8_t hci_security_get_bredr_pairing_status(const struct hci_remote_stru *remote); -#endif - -uint32_t hci_command_get_len(const void *stru, uint32_t opscode); -/* Central Frequency, etc,2412 */ -/* Bandwidth, 22,40 */ -void hci_set_channel_classification(uint32_t c, uint32_t w, - /* etc, HCI_SETAFH_OCCUPY */ - uint8_t mask); -#ifdef NOT_USED_YET -void hci_qos_reg(void (*f)(uint8_t action), uint8_t idx); -void hci_qos_un_reg(void (*f)(uint8_t action), uint8_t idx); -const uint8_t *bt_get_le_mac(void); -#endif -void hci_iso_data_send(struct buff_stru *data); - -enum { /* Returning of l2cap_header_check */ - L2CAP_HEADERCHECK_OK = 0, - L2CAP_HEADERCHECK_ERROR = 1, - L2CAP_HEADERCHECK_KEEPWAIT = 2 -}; - -uint16_t hci_get_mobile_connection_handle(uint8_t *bd); -#if (BTH_WITH_SMART_WEAR == YES) -uint8_t hci_page0feature_find_by_remote_addr(uint8_t *addr); -#endif -void hmac_sha256(uint8_t *key, uint32_t key_len, uint8_t *data, uint32_t data_len); - -void hci_le_set_event_mask(uint8_t isset, uint8_t *mask); - -#endif /* G_HCI_UI_H */ - diff --git a/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/connection_manager.h b/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/connection_manager.h index dcde3b11f..42e550195 100755 --- a/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/connection_manager.h +++ b/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/connection_manager.h @@ -11,7 +11,6 @@ #include "bth_stack_gap.h" #include "stack_def.h" #include "btsrv_task.h" -#include "bts_br_gap.h" #include "datatype.h" #include "bts_def.h" @@ -96,9 +95,5 @@ void btsrv_ble_smp_pair_keys_notify_cbk(uint16_t event, void *arg); void bt_srv_conn_callback_register(void); int32_t btsrv_start_phone_reconnect_timer(bd_addr_t *addr); void btsrv_stop_phone_reconnect_timer(void); -bool btsrv_exist_conn_node_of_type(bool phone); -void btsrv_notify_gap_acl_state_changed(const bd_addr_t *addr, gap_acl_state_t state, unsigned int reason); -void btsrv_access_ble_conn_lock(void); -void btsrv_release_ble_conn_lock(void); #endif /* __BTSRV_CONNECTION_MANAGER_H__ */ 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 3625d6a5a..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 @@ -63,7 +63,6 @@ bool btsrv_is_bluetooth_disable(void); bool btsrv_set_local_addr(const bd_addr_t *bd_addr); bool is_bts_auto_reconnect_enable(void); -bool is_bts_a2dp_snk_enable(void); /* 本地设备运行模式设置和查询 */ uint32_t btsrv_set_local_device_mode(btsrv_local_device_mode mode); diff --git a/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/remote_device_manager.h b/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/remote_device_manager.h index 2f5a05bb3..6cf0a283e 100755 --- a/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/remote_device_manager.h +++ b/code/sdk/protocol/bt/host/bt/bts/brandy_service/service/src/base/remote_device_manager.h @@ -56,7 +56,7 @@ void btsrv_remote_device_init(void); void btsrv_remote_device_deinit(void); remote_device_list_node *btsrv_get_remote_paired_phone_node(void); remote_device_list_node *btsrv_find_remote_dev_node(const uint8_t *bd_addr, uint32_t dev_hdl, bool add); -uint32_t btsrv_get_remote_dev_addr_by_hdl(uint32_t dev_hdl, bd_addr_t *addr); +uint32_t btsrv_get_remote_dev_addr_by_hdl(uint32_t dev_hdl, const bd_addr_t *addr); void btsrv_set_remote_dev_status_found_2_none(void); void btsrv_handle_remote_device_found(uint32_t dev_hdl, bt_sdk_dev_found_info *info); @@ -70,13 +70,4 @@ bool btsrv_get_pair_state(uint32_t dev_hdl); /* 维测:打印远端设备信息链表 */ void btsrv_dfx_show_remote_dev_list(void); -/* 配置BLE安全连接标记 */ -void btsrv_set_ble_sc_flag(bool is_enable); -/* 获取BLE安全连接标记 */ -bool btsrv_get_ble_sc_flag(void); -/* 配置BLE一键双连标记 */ -void btsrv_set_ble_ctkd_flag(bool is_enable); -/* 获取BLE一键双连标记 */ -bool btsrv_get_ble_ctkd_flag(void); - #endif /* __REMOTE_DEVICE_MANAGER_H__ */ 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 d118c69b4..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 @@ -89,7 +89,6 @@ struct osal_list_head g_sample_found_dev_list_head; void reset_found_dev_list(void) { if (!g_sample_found_list_init) { - g_sample_found_list_init = true; OSAL_INIT_LIST_HEAD(&g_sample_found_dev_list_head); return; } @@ -792,7 +791,6 @@ static void sample_gap_discovery_result_callback(const bd_addr_t *bd_addr) bts_sample_log_no_header("\n"); add_node_to_found_dev_list(bd_addr, device_name, cod, 0); - bt_os_free(device_name); } static void sample_gap_pair_requested_callback(const bd_addr_t *bd_addr) @@ -1163,7 +1161,7 @@ static void btsrv_sample_cmd_set_feature_config(const char **params, int32_t par *(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:0x%x\n", ret); + 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) 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 3b3d66243..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 @@ -125,10 +125,6 @@ typedef enum { BTSRV_SAMPLE_GATT_BLE_SET_SEC_PARAM, /* 58 设置安全参数信息 */ BTSRV_SAMPLE_GATTC_SPEED = 59, BTSRV_SAMPLE_GATTS_SPEED = 60, - - /* 61 */ - BTSRV_SAMPLE_GATT_BLE_SET_CTKD_ENABLE, /* 61 设置一键双连开关 */ - } btsrv_gatt_sample_cmd_id; static int32_t g_btsrv_sample_server_id = 0; @@ -1732,19 +1728,6 @@ static void sample_gatts_speed(const char **params, int32_t params_cnt) bt_os_free(ind_para.value); } -static void sample_gatt_cmd_ble_ctkd_param(const char **params, int32_t params_cnt) -{ - errcode_t ret; - if (params_cnt != 1) { /* 1:参数个数 */ - bts_sample_log("ble secure ctkd param error! need: bd_addr.\n"); - return; - } - - bool ctkd_enable = (bool)atoi(params[0]); - ret = gap_ble_set_ctkd_enable(ctkd_enable); - bts_sample_log("set ble ctkd ret:0x%x.\n", ret); -} - typedef void (*ble_at_gatt_cmd_handle_func)(char **params, int32_t params_cnt); typedef struct { uint32_t id; @@ -1827,15 +1810,12 @@ ble_at_gatt_cmd_hdl_info g_btsrv_gatt_sample_hdls[] = { { BTSRV_SAMPLE_GATT_BLE_SET_DATA_LEN, sample_gatt_cmd_ble_set_data_len }, { BTSRV_SAMPLE_GATT_BLE_GET_CONN_PARAM, sample_gatt_cmd_ble_get_conn_param }, - /* 56 */ + /* 55 */ { BTSRV_SAMPLE_GATTS_SHOW_LIST, sample_gatts_show_service_list }, { BTSRV_SAMPLE_GATTC_CONN_LIST, NULL }, { BTSRV_SAMPLE_GATT_BLE_SET_SEC_PARAM, sample_gatt_cmd_ble_set_sec_param }, { BTSRV_SAMPLE_GATTC_SPEED, sample_gattc_speed}, { BTSRV_SAMPLE_GATTS_SPEED, sample_gatts_speed}, - - /* 61 */ - { BTSRV_SAMPLE_GATT_BLE_SET_CTKD_ENABLE, sample_gatt_cmd_ble_ctkd_param}, }; void btsrv_gatt_sample_cmd(uint32_t cmd_id, char **params, int32_t params_cnt) diff --git a/code/sdk/protocol/bt/host/bt/bts/sdk/inc/stack_api/stack_av_if.h b/code/sdk/protocol/bt/host/bt/bts/sdk/inc/stack_api/stack_av_if.h index 300099826..315c6567c 100755 --- a/code/sdk/protocol/bt/host/bt/bts/sdk/inc/stack_api/stack_av_if.h +++ b/code/sdk/protocol/bt/host/bt/bts/sdk/inc/stack_api/stack_av_if.h @@ -448,7 +448,6 @@ int32_t btsdk_a2dp_set_audio_shmid(uint32_t stream_hdl, bool enable, uint32_t sh int32_t btsdk_a2dp_stream_start(void *stream_hdl); int32_t btsdk_a2dp_stream_suspend(void *stream_hdl); int32_t a2dp_src_set_stream_codec_req(bool reconfig, const void *stream_hdl, const void *cfg, uint32_t size); -int32_t btsdk_unregistera2dpsnk_service(void); void btsdk_a2dp_reg_cbk(const btsdka2dp_cbk *a2dp_cbk); void btsdk_a2dp_snk_reg_cbk(const btsdka2dp_cbk *a2dp_cbk); diff --git a/code/sdk/protocol/bt/host/bt/bts/sdk/src/stack_api/CMakeLists.txt b/code/sdk/protocol/bt/host/bt/bts/sdk/src/stack_api/CMakeLists.txt deleted file mode 100644 index 385c93442..000000000 --- a/code/sdk/protocol/bt/host/bt/bts/sdk/src/stack_api/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -add_subdirectory_if_exist(gap) -if(${CHIP} MATCHES "brandy") - set( - bt_comm_src_list - ${CMAKE_CURRENT_SOURCE_DIR}/stack_mpc.c - ${CMAKE_CURRENT_SOURCE_DIR}/stack_gap_if.c - ${CMAKE_CURRENT_SOURCE_DIR}/stack_av_if.c - ${CMAKE_CURRENT_SOURCE_DIR}/stack_avrcp_if.c - ${CMAKE_CURRENT_SOURCE_DIR}/stack_dft_if.c - ${CMAKE_CURRENT_SOURCE_DIR}/stack_hfp_if.c - ${CMAKE_CURRENT_SOURCE_DIR}/stack_pbap_if.c - ${CMAKE_CURRENT_SOURCE_DIR}/stack_spp_if.c - ${CMAKE_CURRENT_SOURCE_DIR}/stack_pan_if.c - ) - set(BTH_SDK_LIST "${BTH_SDK_LIST}" "${bt_comm_src_list}" CACHE INTERNAL "bt ram obj list" FORCE) -endif() diff --git a/code/sdk/protocol/bt/host/bt/bts/sdk/src/stack_api/gap/CMakeLists.txt b/code/sdk/protocol/bt/host/bt/bts/sdk/src/stack_api/gap/CMakeLists.txt deleted file mode 100644 index 6129569ee..000000000 --- a/code/sdk/protocol/bt/host/bt/bts/sdk/src/stack_api/gap/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -set( - bt_comm_src_list - ${CMAKE_CURRENT_SOURCE_DIR}/advertising_scan.c -) -set(BTH_SDK_LIST "${BTH_SDK_LIST}" "${bt_comm_src_list}" CACHE INTERNAL "bt ram obj list" FORCE) - diff --git a/code/sdk/protocol/bt/host/bt/bts/sdk/src/stack_api/stack_mpc.h b/code/sdk/protocol/bt/host/bt/bts/sdk/src/stack_api/stack_mpc.h deleted file mode 100644 index 9a527ff13..000000000 --- a/code/sdk/protocol/bt/host/bt/bts/sdk/src/stack_api/stack_mpc.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright (c) @CompanyNameMagicTag 2021-2022. All rights reserved. - * Description: sdk common - * Author: @CompanyNameTag - * Create: 2021-09-01 - */ -#ifndef STACK_API_H -#define STACK_API_H - -#include -#include "soc_osal.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif -#endif - -#define HEADER_FIELD_LEN 1 -#define BT_STACK_SHIFT_8 8 - -#define IPC_MAX_FIELD_LEN 24 - -/* 同步或者异步接口调用 */ -typedef enum { - STACK_API_SYNC = 0, - STACK_API_ASYNC, -} t_stack_api_flag; - -typedef void (stack_api_cfm_cb)(void *context, uint32_t result, void *parameter); - -struct handle_param { - uint16_t opcode; - uint8_t field_len; - uint8_t field_id[0]; -}; - -struct handle_struct { - uint8_t sync_flag; /* 用于标记调用该接口的操作是异步还是同步 */ - uint16_t opcode; - uint8_t field_len; - uint8_t *field_id; - osal_semaphore sem; /* 针对同步调用模式下 , 需要等待的信号量的handle id */ - uint16_t out_len; /* 调用结束后结果长度 */ - uint8_t *out_data; /* 调用结束后结果数据 */ - stack_api_cfm_cb *cfm_cbk; /* 针对异步调用的场景,需要注册的回调接口 */ -}; - -void stack_mpc_init_handle(void); -void stack_mpc_deinit_handle(void); -struct handle_struct *stack_mpc_find_handle(uint16_t opcode, uint8_t field_len, uint8_t *field_id); -struct handle_struct *stack_mpc_create_handle(uint8_t sync_flag, struct handle_param *param, void *cbk); -uint32_t stack_mpc_wait_handle(struct handle_struct *hdl); -uint8_t stack_mpc_delete_handle(struct handle_struct *hdl); -uint8_t stack_mpc_activate_handle(uint16_t opcode, uint8_t field_len, uint8_t *field_id, - uint16_t out_len, const uint8_t *out_data); -int32_t stack_mpc_msg_send_sync(struct handle_param *param, uint16_t in_len, - uint8_t *in_para, uint16_t *out_len, uint8_t **out_value); -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cpluscplus */ -#endif /* __cpluscplus */ -#endif /* STACK_API_H */ diff --git a/code/sdk/tools/pkg/bin/brandy/bt.bin b/code/sdk/tools/pkg/bin/brandy/bt.bin index 61a61d88d..b73d8b128 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:722262aca924ef0156bc2cda810f9687d668b627c7846adb03d0c30c2aff90b1 -size 425472 +oid sha256:1aeac35f55a5b6611664a0ba2e8df7978d338ae5997a05936f6a72bf63d68502 +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 0769cfb63..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:52718d4082ae98fca23b0b5e19bd01a07bcb42bb9f7f152e203854f8bac7bd7a -size 350088 +oid sha256:5fe2c957c1ebfe67a6b5d823b49f16c5045aae025364c8927b9b663aa1e21247 +size 349776 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 bf844e961..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:37c3879f164d520afa160bee7505eabd501840aca871b3077033ebc3bfbe0c23 -size 331008 +oid sha256:9fd362db76e002ff8ddb9e37a86ecfe210de0ae3855d707365dbe23730560181 +size 330696 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 5208ee43b..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:7ef85fa292de2d6ccfd8009f7a758234cf2fa4d5a2df9def4e8fc46f0765ba6b -size 344736 +oid sha256:3a529edcb039824693731bfdbf78a0de57c70dc1548f45fd38aec8e7882b7af3 +size 344424