demo工程暂存 优化菜单界面UI和功能
This commit is contained in:
@ -0,0 +1,101 @@
|
||||
#include "user_bt_a2dp.h"
|
||||
#include "lvgl.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "app_lvgl.h"
|
||||
#include "app_bt.h"
|
||||
#include "user_bt.h"
|
||||
|
||||
|
||||
#define BT_MUSIC_LOG printf
|
||||
|
||||
user_bt_media_t bt_media;
|
||||
|
||||
void user_bt_music_control(bt_enum_music_t control)
|
||||
{
|
||||
BtStatus status;
|
||||
|
||||
switch(control)
|
||||
{
|
||||
case BT_ENUM_MUSIC_PLAY:
|
||||
status = AVRCP_SetPanelKey(user_bt_env.dev[user_bt_env.last_active_index].rcp_chan, AVRCP_POP_PLAY, TRUE);
|
||||
break;
|
||||
|
||||
case BT_ENUM_MUSIC_PAUSE:
|
||||
status = AVRCP_SetPanelKey(user_bt_env.dev[user_bt_env.last_active_index].rcp_chan, AVRCP_POP_PAUSE, TRUE);
|
||||
break;
|
||||
|
||||
case BT_ENUM_MUSIC_PREVIOUS:
|
||||
status = AVRCP_SetPanelKey(user_bt_env.dev[user_bt_env.last_active_index].rcp_chan, AVRCP_POP_FORWARD, TRUE);
|
||||
break;
|
||||
|
||||
case BT_ENUM_MUSIC_NEXT:
|
||||
status = AVRCP_SetPanelKey(user_bt_env.dev[user_bt_env.last_active_index].rcp_chan, AVRCP_POP_BACKWARD, TRUE);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
BT_MUSIC_LOG("%s %d\r\n",__func__, status);
|
||||
}
|
||||
|
||||
void user_bt_sync_music_volume(uint8_t vol)
|
||||
{
|
||||
uint8_t buf[3];
|
||||
printf("%s %d %d\r\n", __func__, vol,__LINE__);
|
||||
buf[0] = 'E';
|
||||
buf[1] = 'E';
|
||||
buf[2] = vol * 127/ 100;
|
||||
printf("%s %d %d\r\n", __func__, __LINE__,buf[2]);
|
||||
app_at_cmd_recv_handler(buf,NULL);
|
||||
}
|
||||
|
||||
|
||||
void user_bt_set_music_playstatus(bool status)
|
||||
{
|
||||
bt_media.play_status = status;
|
||||
}
|
||||
|
||||
|
||||
bool user_bt_get_music_playstatus(void)
|
||||
{
|
||||
return bt_media.play_status;
|
||||
}
|
||||
|
||||
uint8_t user_bt_get_music_vol(void)
|
||||
{
|
||||
return bt_media.vol;
|
||||
}
|
||||
|
||||
void user_bt_set_music_vol(uint8_t vol)
|
||||
{
|
||||
bt_media.vol = vol;
|
||||
}
|
||||
|
||||
uint8_t *user_bt_get_music_songname(void)
|
||||
{
|
||||
return &bt_media.song[0];
|
||||
}
|
||||
|
||||
|
||||
void user_bt_song_lyric_notify(void)
|
||||
{
|
||||
gui_task_msg_send(MUSIC_CONTROL_EVT,NULL,0,NULL,0,NULL);
|
||||
}
|
||||
|
||||
|
||||
void user_bt_get_media_info(void)
|
||||
{
|
||||
BtStatus status;
|
||||
status = bt_get_media_info(user_bt_env.last_active_index,0x41);
|
||||
BT_MUSIC_LOG("%s %d\r\n",__func__, status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,47 @@
|
||||
#ifndef __USER_BT_A2DP_H
|
||||
#define __USER_BT_A2DP_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "app_at.h"
|
||||
|
||||
|
||||
|
||||
typedef enum{
|
||||
|
||||
BT_ENUM_MUSIC_PLAY,
|
||||
BT_ENUM_MUSIC_PAUSE,
|
||||
BT_ENUM_MUSIC_PREVIOUS,
|
||||
BT_ENUM_MUSIC_NEXT,
|
||||
//BT_ENUM_MUSIC_VOLUME_INC,
|
||||
//BT_ENUM_MUSIC_VOLUME_DEC,
|
||||
|
||||
}bt_enum_music_t;
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool play_status;
|
||||
uint8_t vol;
|
||||
uint16_t playlen;
|
||||
uint16_t playpos;
|
||||
uint8_t song[100];
|
||||
|
||||
}user_bt_media_t;
|
||||
extern user_bt_media_t bt_media;
|
||||
|
||||
|
||||
extern void user_bt_music_control(uint8_t control);
|
||||
extern void user_bt_sync_music_volume(uint8_t vol);
|
||||
extern void user_bt_set_music_playstatus(bool status);
|
||||
extern bool user_bt_get_music_playstatus(void);
|
||||
extern uint8_t user_bt_get_music_vol(void);
|
||||
extern void user_bt_set_music_vol(uint8_t vol);
|
||||
extern uint8_t *user_bt_get_music_songname(void);
|
||||
extern void user_bt_song_lyric_notify(void);
|
||||
extern void user_bt_get_media_info(void);
|
||||
|
||||
#endif /* __USER_BT_A2DP_H */
|
@ -0,0 +1,197 @@
|
||||
#include "user_bt_call.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "user_bt_common.h"
|
||||
#include "app_lvgl.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
#include "app_bt.h"
|
||||
#include "user_bt.h"
|
||||
|
||||
#define BT_CALL_LOG printf
|
||||
|
||||
#define BT_LOG_ENABLE 1
|
||||
#if BT_LOG_ENABLE
|
||||
#define BT_LOG printf
|
||||
#else
|
||||
#define BT_LOG
|
||||
#endif
|
||||
|
||||
call_info_t bt_call;
|
||||
//bool call_flag = 0;
|
||||
uint8_t call_incoming = 0; //呼入呼出状态
|
||||
bool call_complete = 0; //接通状态
|
||||
|
||||
xTimerHandle user_bt_call_timer;
|
||||
//0:呼出,1:接通,2:静音,3:通话结束
|
||||
//4:拨出失败,5:来电显示
|
||||
uint8_t call_mode;
|
||||
|
||||
void user_set_call_mode(uint8_t mode)
|
||||
{
|
||||
call_mode = mode;
|
||||
}
|
||||
|
||||
uint8_t user_get_call_mode(void)
|
||||
{
|
||||
return call_mode;
|
||||
}
|
||||
|
||||
void bt_hf_call_outgoing(uint8_t *number, uint8_t len)
|
||||
{
|
||||
BtStatus status;
|
||||
status = bt_dial_number(user_bt_env.last_active_index,&number[1],number[0]);
|
||||
|
||||
BT_CALL_LOG("%s %d \r\n", __func__,status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void bt_hf_call_hangup(void)
|
||||
{
|
||||
BtStatus status;
|
||||
status = bt_hang_up(user_bt_env.last_active_index);
|
||||
|
||||
BT_CALL_LOG("%s %d \r\n", __func__,status);
|
||||
}
|
||||
|
||||
|
||||
void bt_hf_call_answer(void)
|
||||
{
|
||||
BtStatus status;
|
||||
status = bt_answer_call(user_bt_env.last_active_index);
|
||||
|
||||
BT_CALL_LOG("%s %d \r\n", __func__,status);
|
||||
}
|
||||
|
||||
void user_bt_hf_mic_mute(bool mute)
|
||||
{
|
||||
if(mute)
|
||||
{
|
||||
__CODEC_SET_ADC_VOLUME(0);
|
||||
}else {
|
||||
__CODEC_SET_ADC_VOLUME(0x8000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void user_bt_hfcall_handle(uint8_t hf_call)
|
||||
{
|
||||
if(hf_call == 0) //挂断
|
||||
{
|
||||
if(call_complete)
|
||||
{
|
||||
call_complete = 0;
|
||||
gui_task_msg_send(PHONE_CALL_REJECT_EVT,NULL,0,NULL,0,NULL);
|
||||
}
|
||||
}
|
||||
else if(hf_call == 1) //接通
|
||||
{
|
||||
user_set_call_mode(HF_ENUM_CALL_CONNECTING);
|
||||
call_incoming = 0;
|
||||
call_complete = 1; //接通状态
|
||||
gui_task_msg_send(PHONE_CALL_OK_EVT,NULL,0,NULL,0,NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void user_bt_callsetup_handle(uint8_t hf_callsetup)
|
||||
{
|
||||
if(hf_callsetup == 0)
|
||||
{
|
||||
if(call_incoming == 1 || call_incoming == 2) //
|
||||
{
|
||||
call_incoming = 0;
|
||||
gui_task_msg_send(PHONE_CALL_REJECT_EVT,NULL,0,NULL,0,NULL);
|
||||
}
|
||||
}
|
||||
else if(hf_callsetup == 1) /* incoming call */
|
||||
{
|
||||
|
||||
|
||||
call_incoming = 1; //来电状态置1
|
||||
user_set_call_mode(5);
|
||||
|
||||
}
|
||||
else if(hf_callsetup == 2) /* outgoing call */
|
||||
{
|
||||
|
||||
|
||||
call_incoming = 2; //呼出状态
|
||||
user_set_call_mode(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void user_bt_set_calling_num(const char *num, uint8_t len)
|
||||
{
|
||||
|
||||
bt_call.number_len = len;
|
||||
memset(&bt_call.call_namber[0], 0, sizeof(bt_call.call_namber));
|
||||
memcpy(&bt_call.call_namber[0], num, len);
|
||||
|
||||
if(call_incoming)
|
||||
{
|
||||
gui_task_msg_send(PHONE_CALL_IN_EVT,NULL,0,NULL,0,NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void user_bt_get_calling_info(call_info_t * call)
|
||||
{
|
||||
#if 1
|
||||
call->number_len = bt_call.number_len;
|
||||
memset(call->call_namber,0,32);
|
||||
memcpy(call->call_namber,bt_call.call_namber,call->number_len);
|
||||
|
||||
//call->name_len = call_context[call->number_len] + 1;
|
||||
//memset(call->call_name,0,128);
|
||||
//memcpy(call->call_name, call_context+call->number_len+1, call->name_len);
|
||||
|
||||
#else
|
||||
if(call_context[0] > 0)
|
||||
{
|
||||
call->number_len = call_context[0];
|
||||
memset(call->call_namber,0,32);
|
||||
memcpy(call->call_namber,call_context+1,call->number_len);
|
||||
|
||||
call->name_len = call_context[call->number_len] + 1;
|
||||
memset(call->call_name,0,128);
|
||||
memcpy(call->call_name, call_context+call->number_len+1, call->name_len);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void user_bt_timer_call_handler( TimerHandle_t xTimer)
|
||||
{
|
||||
BT_LOG("%s \r\n",__func__);
|
||||
}
|
||||
|
||||
void user_bt_timer_call_init(void)
|
||||
{
|
||||
user_bt_call_timer = xTimerCreate("user_bt_call_timer", 100 , pdFALSE, NULL, user_bt_timer_call_handler);
|
||||
//xTimerStart(user_bt_call_timer,0);
|
||||
}
|
||||
|
||||
|
||||
void user_bt_hf_set_volume(uint8_t lev)
|
||||
{
|
||||
|
||||
if(lev == 0){
|
||||
|
||||
user_bt_set_local_volume(BT_VOL_HFP, 1);
|
||||
|
||||
}else{
|
||||
|
||||
user_bt_set_local_volume(BT_VOL_HFP, lev);
|
||||
}
|
||||
BT_LOG("%s %d \r\n", __func__, lev);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,53 @@
|
||||
#ifndef __USER_BT_CALL_H
|
||||
#define __USER_BT_CALL_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "driver_codec.h"
|
||||
#include "app_at.h"
|
||||
#include "fr_watch.h"
|
||||
typedef struct
|
||||
{
|
||||
uint8_t num_len;
|
||||
uint8_t num[15];
|
||||
|
||||
|
||||
}user_bt_call_t;
|
||||
|
||||
//0:呼出,1:接通,2:静音,3:通话结束
|
||||
//4:拨出失败,5:来电显示
|
||||
typedef enum
|
||||
{
|
||||
HF_ENUM_OUTGOING = 0,
|
||||
HF_ENUM_CALL_CONNECTING = 1,
|
||||
HF_ENUM_INCOMING = 5,
|
||||
}call_enum_state_t;
|
||||
|
||||
//mic mute
|
||||
enum{
|
||||
ENUM_MIC_CLOSE,
|
||||
ENUM_MIC_OPEN,
|
||||
};
|
||||
|
||||
extern void bt_hf_call_outgoing(uint8_t *number, uint8_t len);
|
||||
|
||||
extern void bt_hf_call_hangup(void);
|
||||
extern void bt_hf_call_answer(void);
|
||||
extern void user_bt_set_calling_num(const char *num, uint8_t len);
|
||||
extern void user_set_call_mode(uint8_t mode);
|
||||
extern uint8_t user_get_call_mode(void);
|
||||
extern void user_bt_get_calling_info(call_info_t * call);
|
||||
|
||||
extern void user_bt_callsetup_handle(uint8_t hf_callsetup);
|
||||
extern void user_bt_hfcall_handle(uint8_t hf_call);
|
||||
|
||||
extern void user_bt_hf_mic_mute(bool mute);
|
||||
|
||||
extern void user_bt_timer_call_init(void);
|
||||
extern void user_bt_hf_mic_mute(bool mute);
|
||||
|
||||
extern void user_bt_hf_set_volume(uint8_t lev);
|
||||
|
||||
#endif /* __USER_BT_CALL_H */
|
@ -0,0 +1,222 @@
|
||||
#include "user_bt_common.h"
|
||||
#include "lvgl.h"
|
||||
#include "FreeRTOS.h"
|
||||
|
||||
#define BT_COMM_ENABLE 1
|
||||
#if BT_COMM_ENABLE
|
||||
#define BT_COMM_LOG printf
|
||||
#else
|
||||
#define BT_COMM_LOG
|
||||
#endif
|
||||
|
||||
user_bt_vol_t user_bt_volum;
|
||||
bool system_bt_module = 0; //0:close 1:start
|
||||
|
||||
/*
|
||||
change phone volume to local spk vol
|
||||
*/
|
||||
bool user_bt_set_local_volume(enum bt_volume_type_t type,uint16_t vol)
|
||||
{
|
||||
|
||||
uint16_t avrcp_vol,hf_vol;
|
||||
|
||||
if((type >= BT_VOL_MAX)||(vol > 0xFFFF)){
|
||||
return false;
|
||||
}
|
||||
if(type == BT_VOL_HFP){
|
||||
|
||||
if(user_bt_env.dev[user_bt_env.last_active_index].conFlags&LINK_STATUS_SCO_CONNECTED){
|
||||
if(vol == 0){
|
||||
hf_vol = 0;
|
||||
}
|
||||
else{
|
||||
hf_vol = 0 + (USER_BT_HF_VOLUME_MAX*vol)/15;
|
||||
}
|
||||
|
||||
BT_COMM_LOG("%s %d %d \r\n",__func__,vol,hf_vol);
|
||||
codec_Set_DAC_Volume(hf_vol);
|
||||
}
|
||||
}
|
||||
else if(type == BT_VOL_MEDIA){
|
||||
|
||||
if(user_bt_env.dev[user_bt_env.last_active_index].conFlags&LINK_STATUS_MEDIA_PLAYING){
|
||||
if(vol >= USER_BT_VOLUM_MAX){
|
||||
avrcp_vol = 127;
|
||||
}
|
||||
else{
|
||||
avrcp_vol = (USER_BT_VOLUM_MAX*vol)/127;
|
||||
}
|
||||
BT_COMM_LOG("%s %d %d \r\n",__func__,vol,avrcp_vol);
|
||||
codec_Set_DAC_Volume(avrcp_vol);
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else if(type == BT_VOL_TONE){
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
local change volume send to phone
|
||||
*/
|
||||
bool user_bt_set_spk_volume(enum bt_volume_type_t type,uint16_t vol)
|
||||
{
|
||||
uint16_t avrcp_vol,hf_vol;
|
||||
|
||||
if((type >= BT_VOL_MAX)||(vol > 0xFFFF)){
|
||||
return false;
|
||||
}
|
||||
if(type == BT_VOL_HFP){
|
||||
|
||||
if(user_bt_env.dev[user_bt_env.last_active_index].conFlags&LINK_STATUS_SCO_CONNECTED){
|
||||
if(vol == 0){
|
||||
hf_vol = + (USER_BT_HF_VOLUME_MAX * 1)/15;
|
||||
vol = 1;
|
||||
}
|
||||
else{
|
||||
hf_vol = 0 + (USER_BT_HF_VOLUME_MAX*vol)/15;
|
||||
}
|
||||
|
||||
BT_COMM_LOG("%s %d %d \r\n",__func__,vol,hf_vol);
|
||||
bt_report_spk_volume(user_bt_env.last_active_index,vol);
|
||||
codec_Set_DAC_Volume(hf_vol);
|
||||
}
|
||||
}
|
||||
else if(type == BT_VOL_MEDIA){
|
||||
|
||||
if(user_bt_env.dev[user_bt_env.last_active_index].conFlags&LINK_STATUS_MEDIA_PLAYING){
|
||||
if(vol == 0x3f){
|
||||
avrcp_vol = USER_BT_VOLUM_MAX;
|
||||
}
|
||||
else{
|
||||
avrcp_vol = (USER_BT_VOLUM_MAX*vol)/127;
|
||||
}
|
||||
bt_set_media_volume(user_bt_env.last_active_index, vol);
|
||||
codec_Set_DAC_Volume(avrcp_vol);
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
}
|
||||
else if(type == BT_VOL_TONE){
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
user_bt_vol_t *user_bt_get_volume(void)
|
||||
{
|
||||
return (user_bt_vol_t *)&user_bt_volum.vol;
|
||||
}
|
||||
|
||||
uint8_t user_bt_volume_lev_convert(enum bt_volume_type_t type,uint8_t lev)
|
||||
{
|
||||
|
||||
|
||||
uint8_t vol;
|
||||
|
||||
if(type == BT_VOL_MEDIA)
|
||||
{
|
||||
vol = (lev * 127 / 100);
|
||||
}
|
||||
else if(type == BT_VOL_HFP)
|
||||
{
|
||||
vol = (lev * 15 / 100);
|
||||
}
|
||||
printf("%s %d \r\n", __func__,vol);
|
||||
return vol;
|
||||
}
|
||||
|
||||
uint8_t *user_bt_get_local_name(void)
|
||||
{
|
||||
extern uint8_t default_name[];
|
||||
return default_name;
|
||||
}
|
||||
uint8_t *user_bt_get_mac(void)
|
||||
{
|
||||
extern uint8_t bt_addr[];
|
||||
return bt_addr;
|
||||
}
|
||||
char *user_ble_get_local_name(void)
|
||||
{
|
||||
extern char local_device_name[];
|
||||
return local_device_name;
|
||||
}
|
||||
uint8_t *user_ble_get_mac(void)
|
||||
{
|
||||
extern uint8_t ble_static_addr[];
|
||||
return ble_static_addr;
|
||||
}
|
||||
|
||||
/*
|
||||
bt module enable/disable api
|
||||
system_bt_module param
|
||||
0:close
|
||||
1:start
|
||||
*/
|
||||
void user_bt_set_module(bool sat)
|
||||
{
|
||||
system_bt_module = sat;
|
||||
}
|
||||
|
||||
bool user_bt_get_module(void)
|
||||
{
|
||||
return system_bt_module;
|
||||
}
|
||||
|
||||
|
||||
void user_bt_disconnect(void)
|
||||
{
|
||||
BtStatus status;
|
||||
|
||||
status = bt_disconnect(&user_bt_env.dev[0].remote_bd, true); //强制断开bt
|
||||
BT_COMM_LOG("%s %d %d\r\n", __func__,__LINE__,status);
|
||||
}
|
||||
|
||||
void user_bt_off(void)
|
||||
{
|
||||
BtStatus status;
|
||||
|
||||
status = bt_disconnect(&user_bt_env.dev[0].remote_bd, true); //强制断开bt
|
||||
BT_COMM_LOG("%s %d %d\r\n", __func__,__LINE__,status);
|
||||
|
||||
status = bt_exit_pairing();
|
||||
|
||||
user_bt_set_module(false);
|
||||
|
||||
BT_COMM_LOG("%s %d %d\r\n", __func__,__LINE__,status);
|
||||
}
|
||||
|
||||
|
||||
void user_bt_on(void)
|
||||
{
|
||||
BtStatus status;
|
||||
|
||||
BtAccessModeInfo access_mode_nc = {
|
||||
.inqInterval = 0x800,
|
||||
.inqWindow = 0x12,
|
||||
.pageInterval = 0x800,
|
||||
.pageWindow = 0x12,
|
||||
};
|
||||
|
||||
status = bt_enter_pairing(BAM_GENERAL_ACCESSIBLE, &access_mode_nc);
|
||||
|
||||
user_bt_env.connect_times = 3;
|
||||
BT_COMM_LOG("bt reconnect addr %x %x %x %x %x %x \r\n",user_bt_env.last_dev_addr.A[0],
|
||||
user_bt_env.last_dev_addr.A[1],
|
||||
user_bt_env.last_dev_addr.A[2],
|
||||
user_bt_env.last_dev_addr.A[3],
|
||||
user_bt_env.last_dev_addr.A[4],
|
||||
user_bt_env.last_dev_addr.A[5]);
|
||||
status = bt_connect(&user_bt_env.last_dev_addr);
|
||||
|
||||
user_bt_set_module(true);
|
||||
|
||||
BT_COMM_LOG("status = %d\r\n",status);
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
#ifndef __USER_BT_COMMON_H
|
||||
#define __USER_BT_COMMON_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "driver_codec.h"
|
||||
#include "app_at.h"
|
||||
#include "user_bt.h"
|
||||
|
||||
#define USER_BT_VOLUM_MAX (0x1000)
|
||||
#define USER_BT_HF_VOLUME_MAX (0x2000)
|
||||
#define USER_BT_NAME "freq_bt"
|
||||
typedef struct
|
||||
{
|
||||
uint8_t vol;
|
||||
uint8_t lev;
|
||||
}user_bt_vol_t;
|
||||
|
||||
enum bt_volume_type_t{
|
||||
BT_VOL_HFP, //设置通话音量
|
||||
BT_VOL_MEDIA, //设置媒体音量
|
||||
BT_VOL_TONE, //设置提示音量
|
||||
BT_VOL_MAX,
|
||||
};
|
||||
|
||||
|
||||
extern void user_bt_set_volume(uint8_t vol);
|
||||
extern uint8_t user_bt_volume_lev_convert(enum bt_volume_type_t type,uint8_t lev);
|
||||
|
||||
extern uint8_t *user_bt_get_local_name(void);
|
||||
extern uint8_t *user_bt_get_mac(void);
|
||||
extern char *user_ble_get_local_name(void);
|
||||
extern uint8_t *user_ble_get_mac(void);
|
||||
|
||||
extern bool user_bt_set_spk_volume(enum bt_volume_type_t type,uint16_t vol);
|
||||
extern bool user_bt_set_local_volume(enum bt_volume_type_t type,uint16_t vol);
|
||||
|
||||
extern void user_bt_disconnect(void);
|
||||
extern void user_bt_off(void);
|
||||
extern void user_bt_on(void);
|
||||
|
||||
extern void user_bt_set_module(bool sat);
|
||||
extern bool user_bt_get_module(void);
|
||||
|
||||
|
||||
#endif /* __USER_BT_COMMON_H */
|
@ -0,0 +1,36 @@
|
||||
#include "user_bt_voice_recognition.h"
|
||||
#include "user_bt.h"
|
||||
#include "app_bt.h"
|
||||
|
||||
#define BT_VOICE_LOG printf
|
||||
|
||||
bool voice_active = 0;
|
||||
|
||||
void user_bt_voice_start_active(bool type)
|
||||
{
|
||||
BtStatus status;
|
||||
|
||||
if(type)
|
||||
{
|
||||
//memcpy(event->param, (void *)"CJ01", sizeof("CJ01"));
|
||||
status = bt_enable_voice_recognition(user_bt_env.last_active_index, true);
|
||||
|
||||
}else {
|
||||
//memcpy(event->param, (void *)"CJ00", sizeof("CJ01"));
|
||||
status = bt_enable_voice_recognition(user_bt_env.last_active_index, false);
|
||||
}
|
||||
|
||||
BT_VOICE_LOG("status = %d\r\n",status);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool user_bt_get_voice_active(void)
|
||||
{
|
||||
return voice_active;
|
||||
}
|
||||
|
||||
void user_bt_set_voice_active(bool active)
|
||||
{
|
||||
voice_active = active;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
#ifndef __USER_BT_VOICE_RECONGNITION_H
|
||||
#define __USER_BT_VOICE_RECONGNITION_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include "driver_codec.h"
|
||||
#include "app_at.h"
|
||||
#include "fr_watch.h"
|
||||
#include "FreeRTOS.h"
|
||||
#include "app_lvgl.h"
|
||||
#include "task.h"
|
||||
#include "timers.h"
|
||||
#include "app_task.h"
|
||||
|
||||
extern bool voice_active;
|
||||
extern void user_bt_voice_start_active(bool type);
|
||||
extern bool user_bt_get_voice_active(void);
|
||||
extern void user_bt_set_voice_active(bool active);
|
||||
|
||||
#endif /* __USER_BT_VOICE_RECONGNITION_H */
|
Reference in New Issue
Block a user