测试完成

This commit is contained in:
lmx
2025-10-31 09:40:15 +08:00
parent 517beaa1a8
commit eb7b89e434
23 changed files with 160001 additions and 159587 deletions

View File

@ -43,13 +43,16 @@
#include "vol_sync.h"
#include "bt_background.h"
#include "default_event_handler.h"
#include "debug.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
//宏定义
#define LOG_TAG_CONST EARPHONE
#define LOG_TAG "[EARPHONE]"
#define LOG_ERROR_ENABLE
#define LOG_DEBUG_ENABLE
#define LOG_INFO_ENABLE
#include "debug.h"
#if(USE_DMA_UART_TEST) //使用dm串口测试时不能同时打开
#define MY_SNIFF_EN 0
@ -57,6 +60,18 @@
#define MY_SNIFF_EN 1 //默认打开
#endif
#define ENABLE_XLOG 1
#ifdef xlog
#undef xlog
#endif
#if ENABLE_XLOG
#define xlog(format, ...) printf("[XT:%s] " format, __func__, ##__VA_ARGS__)
#else
#define xlog(format, ...) ((void)0)
#endif
//
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
//变量
extern u8 init_ok;
@ -65,22 +80,10 @@ unsigned char xtell_bl_state=0; //存放经典蓝牙的连接状态0断开
u8 bt_newname =0;
unsigned char xt_ble_new_name[9] = "CM-11111";
static u16 play_poweron_ok_timer_id = 0;
//
///////////////////////////////////////////////////////////////////////////////////////////////////
// u8 get_bt_init_status(void)
// {
// return init_ok;
// }
// u8 get_sniff_out_status()
// {
// return sniff_out;
// }
// void clear_sniff_out_status()
// {
// sniff_out = 0;
// }
extern int bt_hci_event_handler(struct bt_event *bt);
@ -93,19 +96,22 @@ extern int bt_hci_event_handler(struct bt_event *bt);
static int state_machine(struct application *app, enum app_state state, struct intent *it){
int error = 0;
static u8 tone_player_err = 0;
r_printf("bt_state_machine=%d\n", state);
xlog("bt_state_machine=%d\n", state);
switch (state) {
case APP_STA_CREATE:
xlog("APP_STA_CREATE\n");
/* set_adjust_conn_dac_check(0); */
STATUS *p_tone = get_tone_config();
tone_play_index(p_tone->bt_init_ok, 1);
break;
case APP_STA_START:
xlog("APP_STA_START\n");
if (!it) {
xlog("APP_STA_START:it none\n");
break;
}
switch (it->action) {
case ACTION_EARPHONE_MAIN:
xlog("ble init\n");
/*
* earphone 模式初始化
*/
@ -123,34 +129,42 @@ static int state_machine(struct application *app, enum app_state state, struct i
app_var.dev_volume = -1;
break;
case ACTION_A2DP_START: //蓝牙音频传输协议
xlog("ACTION_A2DP_START\n");
break;
case ACTION_BY_KEY_MODE:
xlog("ACTION_BY_KEY_MODE\n");
break;
case ACTION_TONE_PLAY:
STATUS *p_tone = get_tone_config();
tone_play_index(p_tone->bt_init_ok, 1);
xlog("ACTION_TONE_PLAY\n");
// STATUS *p_tone = get_tone_config();
// tone_play_index(p_tone->bt_init_ok, 1);
break;
case ACTION_DO_NOTHING:
xlog("ACTION_DO_NOTHING\n");
break;
}
break;
case APP_STA_PAUSE:
xlog("APP_STA_PAUSE\n");
break;
case APP_STA_RESUME:
xlog("APP_STA_RESUME\n");
//恢复前台运行
sys_auto_shut_down_disable();
sys_key_event_enable();
break;
case APP_STA_STOP:
xlog("APP_STA_STOP\n");
break;
case APP_STA_DESTROY:
xlog("APP_STA_DESTROY\n");
r_printf("APP_STA_DESTROY\n");
if (!app_var.goto_poweroff_flag) {
bt_app_exit(NULL);
}
break;
}
xlog("state machine error\n");
return error;
}