cun
This commit is contained in:
@ -1663,7 +1663,8 @@ void send_version_to_sibling(void)
|
||||
data[2] = ver >> 8;
|
||||
tws_api_send_data_to_sibling(data, sizeof(data), TWS_FUNC_ID_SEQ_RAND_SYNC);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -1690,3 +1691,4 @@ void send_data_to_ble_client(const u8* data, u16 length)
|
||||
// printf("Insufficient buffer space to send data: Length %d\n", length);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
* notifications.
|
||||
*/
|
||||
// *****************************************************************************
|
||||
|
||||
#if 0
|
||||
#include "system/app_core.h"
|
||||
#include "system/includes.h"
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
#if (TCFG_BLE_DEMO_SELECT == DEF_BLE_DEMO_WIRELESS_MIC_CLIENT)
|
||||
|
||||
#define SUPPORT_TEST_BOX_BLE_MASTER_TEST_EN 1
|
||||
#define SUPPORT_TEST_BOX_BLE_MASTER_TEST_EN 0
|
||||
#define SHOW_RX_DATA_RATE 1
|
||||
#define SHOW_TX_DATA_RATE 1
|
||||
|
||||
@ -189,8 +189,8 @@ static void default_report_data_deal(att_data_report_t *report_data, target_uuid
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const u8 test_remoter_name1[] = "AC637N_MX(BLE)";//
|
||||
static const u8 test_remoter_name1[] = "CM-22222";
|
||||
// static const u8 test_remoter_name1[] = "AC637N_MX(BLE)";//
|
||||
/* static const u8 test_remoter_name2[] = "AC630N_HID567(BLE)";// */
|
||||
static u16 default_client_write_handle;
|
||||
static u16 test_client_timer = 0;
|
||||
@ -275,7 +275,7 @@ static const client_conn_cfg_t client_conn_config_default = {
|
||||
#endif
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
static client_conn_cfg_t *client_config = NULL; //(void *) &client_conn_config_default ;
|
||||
static client_conn_cfg_t *client_config = (void *) &client_conn_config_default ;
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@ -729,7 +729,7 @@ static bool resolve_adv_report(u8 *adv_address, u8 data_length, u8 *data, s8 rss
|
||||
log_info_hexdump(adv_address, 6);
|
||||
adv_data_pt[lenght - 1] = tmp32;
|
||||
//-------
|
||||
#if 1 //无线麦产线通过识别特殊字符串进行近距离连接测试
|
||||
#if 0 //无线麦产线通过识别特殊字符串进行近距离连接测试
|
||||
if (0 == memcmp(adv_data_pt, SPECIFIC_STRING, strlen(SPECIFIC_STRING))) {
|
||||
flag_specific_adv_name = 1;
|
||||
flag_need_judge_rssi = 1;
|
||||
@ -1483,12 +1483,12 @@ void bt_ble_init(void)
|
||||
put_buf(match_name, config_name_len);
|
||||
printf("%s", match_name);
|
||||
#endif
|
||||
if (0 == memcmp(match_name, SPECIFIC_STRING, strlen(SPECIFIC_STRING))) {
|
||||
match_name = &match_name[strlen(SPECIFIC_STRING)];
|
||||
printf("specific scan%s", match_name);
|
||||
flag_specific_sacn = 1;
|
||||
// if (0 == memcmp(match_name, SPECIFIC_STRING, strlen(SPECIFIC_STRING))) {
|
||||
// match_name = &match_name[strlen(SPECIFIC_STRING)];
|
||||
// printf("specific scan%s", match_name);
|
||||
// flag_specific_sacn = 1;
|
||||
|
||||
}
|
||||
// }
|
||||
|
||||
set_ble_work_state(BLE_ST_INIT_OK);
|
||||
conn_pair_vm_do(&conn_pair_info, 0);
|
||||
@ -1557,10 +1557,25 @@ void client_send_conn_param_update(void)
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------------
|
||||
//lmx
|
||||
void rcsp_adv_fill_mac_addr(u8 *mac_addr_buf)
|
||||
{
|
||||
#if (MUTIl_CHARGING_BOX_EN)
|
||||
u8 *mac_addr = get_chargebox_adv_addr();
|
||||
if (mac_addr) {
|
||||
swapX(mac_addr, mac_addr_buf, 6);
|
||||
}
|
||||
|
||||
/* printf("mac_addr:"); */
|
||||
/* printf_buf(mac_addr_buf, 6); */
|
||||
|
||||
#else
|
||||
swapX(bt_get_mac_addr(), mac_addr_buf, 6);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
@ -19,11 +19,11 @@
|
||||
// AI配置 //
|
||||
//*********************************************************************************//
|
||||
#define CONFIG_APP_BT_ENABLE
|
||||
|
||||
#define BLE_WIRELESS_CLIENT_EN 1 //作为主设备,lmx
|
||||
#ifdef CONFIG_APP_BT_ENABLE
|
||||
#define TRANS_DATA_EN 0
|
||||
#define RCSP_BTMATE_EN 0
|
||||
#define RCSP_ADV_EN 1
|
||||
#define RCSP_ADV_EN 0
|
||||
#define AI_APP_PROTOCOL 0
|
||||
#define LL_SYNC_EN 0
|
||||
#define TUYA_DEMO_EN 0
|
||||
|
||||
@ -204,31 +204,31 @@ int app_protocol_sys_event_handler(struct sys_event *event);
|
||||
#define EARPHONE_STATE_SNIFF(a)
|
||||
#define EARPHONE_STATE_ROLE_SWITCH(a)
|
||||
|
||||
#else
|
||||
int adv_earphone_state_init();
|
||||
int adv_earphone_state_set_page_scan_enable();
|
||||
int adv_earphone_state_get_connect_mac_addr();
|
||||
int adv_earphone_state_cancel_page_scan();
|
||||
int adv_earphone_state_enter_soft_poweroff();
|
||||
int adv_earphone_state_tws_init(int paired);
|
||||
int adv_earphone_state_tws_connected(int first_pair, u8 *comm_addr);
|
||||
int adv_sys_event_handler_specific(struct sys_event *event);
|
||||
int adv_earphone_state_sniff(u8 state);
|
||||
int adv_earphone_state_role_switch(u8 role);
|
||||
// #else
|
||||
// int adv_earphone_state_init();
|
||||
// int adv_earphone_state_set_page_scan_enable();
|
||||
// int adv_earphone_state_get_connect_mac_addr();
|
||||
// int adv_earphone_state_cancel_page_scan();
|
||||
// int adv_earphone_state_enter_soft_poweroff();
|
||||
// int adv_earphone_state_tws_init(int paired);
|
||||
// int adv_earphone_state_tws_connected(int first_pair, u8 *comm_addr);
|
||||
// int adv_sys_event_handler_specific(struct sys_event *event);
|
||||
// int adv_earphone_state_sniff(u8 state);
|
||||
// int adv_earphone_state_role_switch(u8 role);
|
||||
|
||||
#define EARPHONE_STATE_INIT() adv_earphone_state_init()
|
||||
#define EARPHONE_STATE_SET_PAGE_SCAN_ENABLE() adv_earphone_state_set_page_scan_enable()
|
||||
#define EARPHONE_STATE_GET_CONNECT_MAC_ADDR() adv_earphone_state_get_connect_mac_addr()
|
||||
#define EARPHONE_STATE_CANCEL_PAGE_SCAN() adv_earphone_state_cancel_page_scan()
|
||||
#define EARPHONE_STATE_ENTER_SOFT_POWEROFF() adv_earphone_state_enter_soft_poweroff()
|
||||
#define EARPHONE_STATE_TWS_INIT(a) adv_earphone_state_tws_init(a)
|
||||
#define EARPHONE_STATE_TWS_CONNECTED(a, b) adv_earphone_state_tws_connected(a,b)
|
||||
#define SYS_EVENT_HANDLER_SPECIFIC(a) adv_sys_event_handler_specific(a)
|
||||
#define SYS_EVENT_REMAP(a) 0
|
||||
#define EARPHONE_STATE_SNIFF(a) adv_earphone_state_sniff(a)
|
||||
#define EARPHONE_STATE_ROLE_SWITCH(a) adv_earphone_state_role_switch(a)
|
||||
// #define EARPHONE_STATE_INIT() adv_earphone_state_init()
|
||||
// #define EARPHONE_STATE_SET_PAGE_SCAN_ENABLE() adv_earphone_state_set_page_scan_enable()
|
||||
// #define EARPHONE_STATE_GET_CONNECT_MAC_ADDR() adv_earphone_state_get_connect_mac_addr()
|
||||
// #define EARPHONE_STATE_CANCEL_PAGE_SCAN() adv_earphone_state_cancel_page_scan()
|
||||
// #define EARPHONE_STATE_ENTER_SOFT_POWEROFF() adv_earphone_state_enter_soft_poweroff()
|
||||
// #define EARPHONE_STATE_TWS_INIT(a) adv_earphone_state_tws_init(a)
|
||||
// #define EARPHONE_STATE_TWS_CONNECTED(a, b) adv_earphone_state_tws_connected(a,b)
|
||||
// #define SYS_EVENT_HANDLER_SPECIFIC(a) adv_sys_event_handler_specific(a)
|
||||
// #define SYS_EVENT_REMAP(a) 0
|
||||
// #define EARPHONE_STATE_SNIFF(a) adv_earphone_state_sniff(a)
|
||||
// #define EARPHONE_STATE_ROLE_SWITCH(a) adv_earphone_state_role_switch(a)
|
||||
|
||||
#endif
|
||||
// #endif
|
||||
|
||||
|
||||
#else
|
||||
@ -246,6 +246,7 @@ int adv_earphone_state_role_switch(u8 role);
|
||||
#define EARPHONE_STATE_ROLE_SWITCH(a)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@ -203,8 +203,8 @@ void cfg_file_parse(u8 idx)
|
||||
} else if (ret >= LOCAL_NAME_LEN) {
|
||||
memset(bt_cfg.edr_name, 0x00, LOCAL_NAME_LEN);
|
||||
// memcpy(bt_cfg.edr_name, tmp, LOCAL_NAME_LEN);
|
||||
extern char xt_ble_new_name[9];
|
||||
memcpy(bt_cfg.edr_name, xt_ble_new_name, LOCAL_NAME_LEN);
|
||||
// extern char xt_ble_new_name[9];
|
||||
// memcpy(bt_cfg.edr_name, xt_ble_new_name, LOCAL_NAME_LEN);
|
||||
bt_cfg.edr_name[LOCAL_NAME_LEN - 1] = 0;
|
||||
} else {
|
||||
memset(bt_cfg.edr_name, 0x00, LOCAL_NAME_LEN);
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
#include "system/app_core.h"
|
||||
#include "system/includes.h"
|
||||
#include "btstack/btstack_task.h"
|
||||
@ -5,7 +6,7 @@
|
||||
#include "le_common.h"
|
||||
#include "ble_user.h"
|
||||
|
||||
#if 1 //ENABLE_THIS_TEST
|
||||
#if 0 //ENABLE_THIS_TEST
|
||||
|
||||
#define LOG_TAG_CONST EARPHONE
|
||||
#define LOG_TAG "[BLE_TEST]"
|
||||
|
||||
1569
apps/earphone/xtell_Sensor/client_handler.c
Normal file
1569
apps/earphone/xtell_Sensor/client_handler.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,15 @@
|
||||
#include "system/includes.h"
|
||||
/*#include "btcontroller_config.h"*/
|
||||
#include "btstack/btstack_task.h"
|
||||
#include "app_config.h"
|
||||
#include "app_action.h"
|
||||
#include "asm/pwm_led.h"
|
||||
#include "tone_player.h"
|
||||
#include "gpio.h"
|
||||
#include "app_main.h"
|
||||
#include "asm/charge.h"
|
||||
#include "update.h"
|
||||
#include "update_loader_download.h"
|
||||
#include "app_power_manage.h"
|
||||
#include "app_charge.h"
|
||||
#include "bt_profile_cfg.h"
|
||||
#include "dev_manager/dev_manager.h"
|
||||
#include "update_loader_download.h"
|
||||
#include "avctp_user.h"
|
||||
#include "debug.h"
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//宏定义
|
||||
#define ENABLE_XLOG 1
|
||||
@ -41,45 +32,31 @@
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//变量
|
||||
|
||||
//-------------------------------------------------------------------------------------------------//
|
||||
// 外部函数/变量声明
|
||||
//-------------------------------------------------------------------------------------------------//
|
||||
extern APP_VAR app_var;
|
||||
u16 close_BL_number=0;
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//函数定义
|
||||
extern void timer_2ms_handler();
|
||||
extern void app_var_init(void);
|
||||
void app_earphone_play_voice_file(const char *name);
|
||||
void clr_wdt(void);
|
||||
extern void check_power_on_key(void);
|
||||
extern int cpu_reset_by_soft();
|
||||
extern int audio_dec_init();
|
||||
extern int audio_enc_init();
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------------------------------//
|
||||
// 系统主函数 app_main
|
||||
//-------------------------------------------------------------------------------------------------//
|
||||
|
||||
|
||||
|
||||
/*充电拔出,CPU软件复位, 不检测按键,直接开机*/
|
||||
static void app_poweron_check(int update)
|
||||
{
|
||||
if (!update && cpu_reset_by_soft()) {
|
||||
app_var.play_poweron_tone = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
void create_process(u16* pid,char* name, void *priv, void (*func)(void *priv), u32 msec){
|
||||
/**
|
||||
* @brief 创建一个周期性执行的系统定时器任务
|
||||
*/
|
||||
void create_process(u16* pid, const char* name, void *priv, void (*func)(void *priv), u32 msec){
|
||||
xlog("1 name=%s, pid =%d\n",name,*pid);
|
||||
if (*pid != 0) return;
|
||||
*pid = sys_timer_add(priv, func, msec);
|
||||
xlog("2 name=%s, pid =%d\n",name,*pid);
|
||||
}
|
||||
void close_process(u16* pid,char* name){
|
||||
|
||||
/**
|
||||
* @brief 关闭一个系统定时器任务
|
||||
*/
|
||||
void close_process(u16* pid, const char* name){
|
||||
xlog("name=%s,pid =%d\n",name,*pid);
|
||||
if (*pid == 0) return;
|
||||
sys_timer_del(*pid);
|
||||
@ -87,43 +64,39 @@ void close_process(u16* pid,char* name){
|
||||
}
|
||||
|
||||
|
||||
void close_BL(){
|
||||
/**开机默认关闭 经典蓝牙 */
|
||||
// close_BL_flag++;
|
||||
xlog("xtell Classic Bluetooth off\n");
|
||||
user_send_cmd_prepare(USER_CTRL_DISCONNECTION_HCI, 0, NULL); //断开此时经典蓝牙的连接,经典蓝牙还是可以被发现
|
||||
delay_2ms(50);
|
||||
user_send_cmd_prepare(USER_CTRL_WRITE_SCAN_DISABLE, 0, NULL); //关闭蓝牙可发现,已连接时不能操作
|
||||
delay_2ms(50);
|
||||
user_send_cmd_prepare(USER_CTRL_WRITE_CONN_DISABLE, 0, NULL); //关闭蓝牙可连接,
|
||||
// sys_timer_del(close_BL_number); //删除定时器任务
|
||||
close_process(&close_BL_number,__func__);
|
||||
/*充电拔出,CPU软件复位, 不检测按键,直接开机*/
|
||||
static void app_poweron_check(int update)
|
||||
{
|
||||
extern int cpu_reset_by_soft();
|
||||
if (!update && cpu_reset_by_soft()) {
|
||||
app_var.play_poweron_tone = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void xtell_set_ble_name(char* name){
|
||||
|
||||
}
|
||||
|
||||
|
||||
extern u32 timer_get_ms(void);
|
||||
/**
|
||||
* @brief 应用层主入口
|
||||
*/
|
||||
void xtell_app_main()
|
||||
{
|
||||
int update = 0;
|
||||
u32 addr = 0, size = 0;
|
||||
struct intent it;
|
||||
|
||||
xlog("==============xtell_app_main start================\n");
|
||||
log_info("app_main\n");
|
||||
extern u32 timer_get_ms(void);
|
||||
app_var.start_time = timer_get_ms();
|
||||
|
||||
|
||||
|
||||
// 检查是否有固件升级
|
||||
if (!UPDATE_SUPPORT_DEV_IS_NULL()) {
|
||||
update = update_result_deal();
|
||||
}
|
||||
|
||||
// 初始化应用层变量
|
||||
extern void app_var_init(void);
|
||||
app_var_init();
|
||||
|
||||
// 根据充电状态决定进入 idle 模式还是 handler 模式
|
||||
if (get_charge_online_flag()) {
|
||||
#if(TCFG_SYS_LVD_EN == 1)
|
||||
vbat_check_init();
|
||||
@ -144,30 +117,5 @@ void xtell_app_main()
|
||||
xlog("==============handler end================\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
//开机必须延时关闭经典蓝牙,不然底层代码会再次把蓝牙 打开
|
||||
// create_process(&close_BL_number, "close_BL",NULL, close_BL, 3000);
|
||||
|
||||
|
||||
|
||||
|
||||
u8 mac_data[6];
|
||||
extern void rcsp_adv_fill_mac_addr(u8 *mac_addr_buf);
|
||||
rcsp_adv_fill_mac_addr(mac_data); //读取MAC地址
|
||||
xlog("xtell BT mac data:%x:%x:%x:%x:%x:%x",mac_data[0],mac_data[1],mac_data[2],mac_data[3],mac_data[4],mac_data[5]);
|
||||
|
||||
|
||||
user_send_cmd_prepare(USER_CTRL_WRITE_SCAN_ENABLE, 0, NULL); //打开蓝牙可发现,已连接时不能操作
|
||||
delay_2ms(50);
|
||||
user_send_cmd_prepare(USER_CTRL_WRITE_CONN_ENABLE, 0, NULL); //打开蓝牙可连接
|
||||
delay_2ms(50);
|
||||
|
||||
|
||||
|
||||
xlog("==============xtell_app_end================\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -302,8 +302,8 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
ble_bqb_test_thread_init();
|
||||
} else {
|
||||
#if !TCFG_WIRELESS_MIC_ENABLE
|
||||
bt_ble_init();
|
||||
xtell_ble_central_test_start();
|
||||
// bt_ble_init();
|
||||
// xtell_ble_central_test_start(); //xtell
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@ -337,7 +337,7 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
bt_newname =1;
|
||||
u8 temp[5]={0xBB,0xBE,0x02,0x04,0x00};
|
||||
temp[4] = xtell_bl_state; //经典蓝牙连接状态
|
||||
send_data_to_ble_client(&temp,5);
|
||||
// send_data_to_ble_client(&temp,5);
|
||||
}
|
||||
earphone_change_pwr_mode(PWR_DCDC15, 3000);
|
||||
sys_auto_shut_down_disable();
|
||||
@ -370,7 +370,7 @@ static int bt_connction_status_event_handler(struct bt_event *bt)
|
||||
bt_newname=0;
|
||||
u8 temp[5]={0xBB,0xBE,0x02,0x04,0x00};
|
||||
temp[4] = xtell_bl_state; //经典蓝牙连接状态
|
||||
send_data_to_ble_client(&temp,5);
|
||||
// send_data_to_ble_client(&temp,5);
|
||||
}
|
||||
if (app_var.goto_poweroff_flag) {
|
||||
/*关机不播断开提示音*/
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -61,4 +61,4 @@ copy /b text.bin + data.bin + mov_slot.bin + data_code.bin + aec.bin + aac.bin +
|
||||
|
||||
del !bankfiles! common.bin text.bin data.bin bank.bin
|
||||
copy eq_cfg_hw_less.bin eq_cfg_hw.bin
|
||||
call download/earphone/download_app_ota.bat
|
||||
call download/earphone/download.bat
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
0
objs/apps/common/device/usb/device/cdc.c.o-826e812c
Normal file
0
objs/apps/common/device/usb/device/cdc.c.o-826e812c
Normal file
Reference in New Issue
Block a user