static u8 issend_start_up=0;
+static u8 random_mt_test=0;
+
static u32 close_timerout = 0;
static u32 sleep_chumo_timerout = 0;
+static u32 tts_start_timerout = 0;
+
static u32 VC_pingping_timerout = 0;
static u32 VC_END_play_timerout = 0;
static char *AI_TTS_str = NULL;
aic_free(vc_cfg_tmp);
return 0;
}
+
void reset_VC_cfg(void)
{
vc_cfg.start_flag = 0xaaaa;
//vc_cfg.dev_type = DEV_ADS;//奥德赛
vc_cfg.dev_type = DEV_JSWM;//金山完美
//vc_cfg.dev_type = DEV_ALY;//阿里云
- // strcpy(vc_cfg.server_ip,"amp.raisound.com");//服务器地址
- // strcpy(vc_cfg.server_ip,"115.190.94.208:22080");//服务器地址
+ strcpy(vc_cfg.server_ip,"amp.raisound.com");//服务器地址
+
+ // strcpy(vc_cfg.server_ip,"115.190.94.208:22080");//服务器地址
- strcpy(vc_cfg.server_ip,"118.145.158.207:22080");//服务器地址
+ // strcpy(vc_cfg.server_ip,"118.145.158.207:22080");//服务器地址
- vc_cfg.VC_mode =2;//对话模式
+ vc_cfg.VC_mode =2; //对话模式
strcpy(vc_cfg.power_on_tone,"你好,请问您有什么需要我帮忙的吗?");//开机提示词
vc_cfg.VC_record_TYPE = VC_record_TYPE_PCM;//录音格式
vc_cfg.VC_play_TYPE = VC_play_TYPE_PCM;//播放格式
vc_cfg.VC_record_samplerate = 16000;//录音采样率
vc_cfg.VC_play_samplerate = 16000;//播放采样率
- vc_cfg.is_VAD = IS_VAD;//=1打开vad打断
- vc_cfg.is_KWS = IS_KWS;//=1打开本地语言打断
- vc_cfg.speech_rate = 0;//语速配置
- vc_cfg.vad_silence = 800;//vad断句时间 ms 500
- vc_cfg.VC_TTS_volume = 80;//音量
+ vc_cfg.is_VAD = IS_VAD; //=1打开vad打断
+ vc_cfg.is_KWS = IS_KWS; //=1打开本地语言打断
+ vc_cfg.speech_rate = 0; //语速配置
+ vc_cfg.vad_silence = 800; //vad断句时间 ms 500
+ vc_cfg.VC_TTS_volume = 80; //音量
}
+
int init_VC_cfg(void)
{
FILE *fp = NULL;
vc_cfg.VC_mode =2;//对话模式
+ reset_VC_cfg();
return 0;
}
int is_guanji=0;
+int ddh_is_close_dialog=0;
+
void aic_https_demotest();
int check_text(char *text,int ret_str_len)
}
}
- if(strstr(text,"音量") || strstr(text,"声音"))
- {
- if(strstr(text,"加")||(strstr(text,"大")&&!strstr(text,"太")) || (strstr(text,"太小")))
- {
- vc_cfg.VC_TTS_volume +=10;
- if(vc_cfg.VC_TTS_volume > 100)
- {
- vc_cfg.VC_TTS_volume = 100;
- AI_AMP_MSG_put("音量已最大。",strlen("音量已最大。"),VC_TTS_PLAY);
- //AI_TTS_str
- }else{
-
- tmp_data_len = snprintf(tmp_data,sizeof(tmp_data),"配置成功,当前音量%d。",vc_cfg.VC_TTS_volume);
- AI_AMP_MSG_put(tmp_data,tmp_data_len,VC_TTS_PLAY);
- }
- // if(vc_cfg.VC_mode != 0)
- app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
- // else{
-
- // if(vc_cfg.VC_TTS_volume > 80)
- // {
- // app_audio_set_master_volume(15*50/100);
- // }else{
+ if(strstr(text,"音量查询") || strstr(text,"查询音量"))
+ {
- // app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
- // }
- // }
+ tmp_data_len = snprintf(tmp_data,sizeof(tmp_data),"查询成功,当前音量%d。",vc_cfg.VC_TTS_volume);
+ AI_AMP_MSG_put(tmp_data,tmp_data_len,VC_TTS_PLAY);
+ ret = 0;
+ goto RET;
+ }
+ // if(strstr(text,"加")||(strstr(text,"大")&&!strstr(text,"太")) || (strstr(text,"太小")))
+ // {
+ // vc_cfg.VC_TTS_volume +=10;
+ // if(vc_cfg.VC_TTS_volume > 100)
+ // {
+ // vc_cfg.VC_TTS_volume = 100;
+ // AI_AMP_MSG_put("音量已最大。",strlen("音量已最大。"),VC_TTS_PLAY);
+ // //AI_TTS_str
+ // }else{
+
+ // tmp_data_len = snprintf(tmp_data,sizeof(tmp_data),"配置成功,当前音量%d。",vc_cfg.VC_TTS_volume);
+ // AI_AMP_MSG_put(tmp_data,tmp_data_len,VC_TTS_PLAY);
+ // }
+ // // if(vc_cfg.VC_mode != 0)
+ // app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
+ // // else{
+
+ // // if(vc_cfg.VC_TTS_volume > 80)
+ // // {
+
+ // // app_audio_set_master_volume(15*50/100);
+ // // }else{
+
+ // // app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
+ // // }
+ // // }
- is_save_VC_cfg = 1;
- ret = 0;
- goto RET;
- }else if(strstr(text,"减")||(strstr(text,"小")&&!strstr(text,"太")) || (strstr(text,"太大")))
- {
- vc_cfg.VC_TTS_volume -=10;
- if(vc_cfg.VC_TTS_volume < 0)
- {
- vc_cfg.VC_TTS_volume = 0;
- AI_AMP_MSG_put("音量已最小。",strlen("音量已最小。"),VC_TTS_PLAY);
- //AI_TTS_str
- }else{
-
- tmp_data_len = snprintf(tmp_data,sizeof(tmp_data),"配置成功,当前音量%d。",vc_cfg.VC_TTS_volume);
- AI_AMP_MSG_put(tmp_data,tmp_data_len,VC_TTS_PLAY);
- }
-
- // if(vc_cfg.VC_mode != 0)
- app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
- // else{
-
- // if(vc_cfg.VC_TTS_volume > 80)
- // {
-
- // app_audio_set_master_volume(15*50/100);
- // }else{
+ // is_save_VC_cfg = 1;
+ // ret = 0;
+ // goto RET;
+ // }else if(strstr(text,"减")||(strstr(text,"小")&&!strstr(text,"太")) || (strstr(text,"太大")))
+ // {
+ // vc_cfg.VC_TTS_volume -=10;
+ // if(vc_cfg.VC_TTS_volume < 0)
+ // {
+ // vc_cfg.VC_TTS_volume = 0;
+ // AI_AMP_MSG_put("音量已最小。",strlen("音量已最小。"),VC_TTS_PLAY);
+ // //AI_TTS_str
+ // }else{
+
+ // tmp_data_len = snprintf(tmp_data,sizeof(tmp_data),"配置成功,当前音量%d。",vc_cfg.VC_TTS_volume);
+ // AI_AMP_MSG_put(tmp_data,tmp_data_len,VC_TTS_PLAY);
+ // }
+
+ // // if(vc_cfg.VC_mode != 0)
+ // app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
+ // // else{
+
+ // // if(vc_cfg.VC_TTS_volume > 80)
+ // // {
+
+ // // app_audio_set_master_volume(15*50/100);
+ // // }else{
+
+ // // app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
+ // // }
+ // // }
+
+ // is_save_VC_cfg = 1;
+ // ret = 0;
+ // goto RET;
+ // }
+ // }
- // app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
- // }
- // }
- is_save_VC_cfg = 1;
- ret = 0;
- goto RET;
- }
- }
if(strstr(text,"切换"))
{
if(strstr(text,"对话模式") || strstr(text,"兑换模式"))
}else if(vc_cfg.VC_mode == 1)
{
- AI_AMP_MSG_put("已切换到单对话模式。长按按钮说话,说完松开即可。",strlen("已切换到单对话模式。长按按钮说话,说完松开即可。"),VC_TTS_PLAY);
+ AI_AMP_MSG_put("已切换到单对话模式。长按按钮说话,说完松开即可。",strlen("已切换到单对话模式。长按按钮说话,说完松开即可。"),VC_TTS_PLAY);
app_audio_set_master_volume(15*80/100);
}else
{
- app_audio_set_master_volume(15*80/100);
- AI_AMP_MSG_put("已切换到按键打断模式。我说话的时候需要短按按钮打断。",strlen("已切换到按键打断模式。我说话的时候需要短按按钮打断。"),VC_TTS_PLAY);
+ app_audio_set_master_volume(15*80/100);
+ AI_AMP_MSG_put("已切换到按键打断模式。我说话的时候需要短按按钮打断。",strlen("已切换到按键打断模式。我说话的时候需要短按按钮打断。"),VC_TTS_PLAY);
}
is_save_VC_cfg = 1;
ret = 0;
is_dialog_status=1;
+ ddh_is_close_dialog=1;
+
// AI_AMP_MSG_put(0,0,VC_CLOSE);
// ret = 0;
}
if(ret_str_len<16 && (strstr(text,"再见") || strstr(text,"拜拜") || strstr(text,"关闭对话")))
{
- tmp_data_len = snprintf(tmp_data,sizeof(tmp_data),"再见了,我会想你的。");
- AI_AMP_MSG_put(tmp_data,tmp_data_len,VC_TTS_PLAY_CLOSE);
+ // tmp_data_len = snprintf(tmp_data,sizeof(tmp_data),"再见了,我会想你的。");
+ // AI_AMP_MSG_put(tmp_data,tmp_data_len,VC_TTS_PLAY_CLOSE);
+ is_dialog_status=1;
+ ddh_is_close_dialog=1;
}
if(ret_str_len<16 && (strstr(text,"关机") ))
}
- if(type==1&&mode==1){
+ if(type==1&&mode==1){
#if SUPPORT_MOT
mot_nod_exp(12,2);
- uart_write(ui_uart_handle,cmd_ui, 7);
+ uart_write(ui_uart_handle,cmd_ui, 7);
}
void back_middle_statu_mot(){
}
+void random_statu_mot(){
+
+ //aos_sleep(1000);
+ u32 count_tmp = 0;
+ aos_get_queue_used_count(AI_VC_play_queue,&count_tmp);
+
+ bk_printf("random_statu_mot....\n");
+
+ if(count_tmp<=0)
+ return ;
+ //VC_END_play_timerout = 1;
+
+ if(random_mt_test%3==0)
+ mot_nod_exp(8,2);
+
+ if(random_mt_test%3==1)
+ mot_nod_exp(15,2);
+
+ if(random_mt_test%3==2)
+ mot_nod_exp(16,2);
+
+ random_mt_test++;
+
+
+}
+
void send_express_str_xinxinmao(char *exp_str){
{
#if SUPPORT_MOT
- mot_nod_exp(7,2);
+ mot_nod_exp(5,2); // mot_nod_exp(7,2);
#endif
cmd_ui[4]=0x02;
{
- close_timerout = 300;
+ close_timerout = 305;
if(is_dialog_status==0){
- sleep_chumo_timerout=180;
+ sleep_chumo_timerout=300;
+
+ }else{
+
+ if(vc_cfg.VC_mode==1){
+
+ if(ddh_is_close_dialog==0)
+ close_timerout=5;
+ // else{
+ // }
+
+ }
}
if(code == WS_TEXT)//字符串
if(strstr(recv_buff,"\"started\""))//开始
{
+ tts_start_timerout=0;
if(issend_start_up==0){
issend_start_up=1;
}
- bk_printf("002AI_ASR_str%s AI_ASR_str_tmp %s",AI_ASR_str,AI_ASR_str_tmp);
+ bk_printf("002AI_ASR_str%s AI_ASR_str_tmp %s",AI_ASR_str,AI_ASR_str_tmp);
bk_printf("play_file_stream_data:%d",VC_Play_flag);
if(has_tmp_result==0)
else if(strstr(recv_buff,"\"completed\""))//结束
{
VC_state = VC_State_End;//
+
+ if(vc_cfg.VC_mode==0&&strlen(AI_ASR_str_tmp)==0){
+
+ u32 count_tmp = 0;
+ aos_get_queue_used_count(AI_VC_play_queue,&count_tmp);
+
+ bk_printf("连续对话模式没有语音....\n");
+ if(count_tmp<=0)
+ VC_END_play_timerout = 1;
+
+ }
//AI_AMP_MSG_put(0,0,VC_RECORD_START);//打开录音
}else if(strstr(recv_buff,"\"event\":\"failed\""))//接口报错了
bk_printf("!!!!!!!!!!!!!!!!!!!!!!离线语音识别打断了!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n\n");
kws_clear();
- AI_AMP_MSG_put("我来了。",strlen("我来了。"),VC_TTS_PLAY);
+ AI_AMP_MSG_put("我来了。",strlen("我来了。"),VC_TTS_PLAY);
}
}
continue;
}
- AI_VC_put_record_data(vrecord_buf,ret);
+ AI_VC_put_record_data(vrecord_buf,ret);
+
+ audio_data(vrecord_buf,ret,21);
- audio_data(vrecord_buf,ret,21);
// if(vc_cfg.is_KWS)
// {
// int KWS_time = aos_get_tickcount();
// }
// }
//bk_printf("VAD:检测到说话了");
+
}else if(vad_status_t == 0 )//m没有说话
{
}
VC_state = VC_State_None;
- bk_printf("VAD:vad_status_t:%d",vad_status_t);
+ bk_printf("VAD:vad_status_t:%d",vad_status_t);
bk_printf("VAD:发送打断对话");
AI_AMP_MSG_put(0,0,VC_Cancel);//发送打断
}else
{
- if(VC_state > VC_State_SpeechStart){
+ if(VC_state > VC_State_SpeechStart)
+ {
bk_printf("VAD:有数据还没发:VC_state:%d\r\n\r\n",VC_state);
- AI_AMP_MSG_put("没听清,请再说一遍",strlen("没听清,请再说一遍"),VC_CONNECT_ERROR);
+ // AI_AMP_MSG_put("没听清,请再说一遍",strlen("没听清,请再说一遍"),VC_CONNECT_ERROR);
}
- // AI_VC_send_audio_create();//发送开始音频
- // bk_printf("VAD:发送开始音频");
-
- // char count_tmp = 200;
+ // AI_VC_send_audio_create();//发送开始音频
+ // bk_printf("VAD:发送开始音频");
+ // char count_tmp = 200;
}
vad_end_flag = 1;
- }else//没录音数据
+ }
+ else//没录音数据
{
if(VAD_status)
{
if(strstr(json_data,"action")){
+ tts_start_timerout=0;
bk_printf("action");
char *str_tmp = NULL;
}
+ if(strstr(json_data,"set_vol")){
+
+
+ char *str_tmp = NULL;
+
+ char action_str[500]={0};
+
+ str_tmp = strstr(json_data,"\"data\":\"");
+
+ if(str_tmp)//解析password
+ {
+
+ str_tmp += strlen("\"data\":\"");
+ int count = str_count(str_tmp,'\"');
+ bk_printf("count:%d",count);
+ if(count < sizeof(action_str))
+ {
+
+
+ memcpy(action_str,str_tmp,count);
+ action_str[count] = 0;
+ bk_printf("set_vol:%s",action_str);
+
+ if(strstr(action_str,"+10")){
+
+ if(vc_cfg.VC_TTS_volume<=90){
+ vc_cfg.VC_TTS_volume+=10;
+
+ app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
+ }
+
+ }else if(strstr(action_str,"-10")){
+
+ if(vc_cfg.VC_TTS_volume>10){
+ vc_cfg.VC_TTS_volume-=10;
+ app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
+ }
+
+ }else{
+
+ int temp_vol=atoi(action_str);
+
+ if(temp_vol>0&&temp_vol<=100){
+
+ bk_printf("temp_vol:%d",temp_vol);
+ vc_cfg.VC_TTS_volume=temp_vol;
+
+ app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
+
+
+ }
+
+ }
+ // if(is_guanji==0)
+ // send_express_str(action_str);
+ }
+
+ }
+
+ }
+
if(strstr(json_data,"emotion")){
bk_printf("emotion");
+ tts_start_timerout=0;
+
char *str_tmp = NULL;
char emotion_str[500]={0};
// wss://wsiot.raisound.com/iot-api/ws-hub/dev/v1?bz-dt=xxx
// ws(s)://wsiot-nocdn.raisound.com/ws-hub/dev/v1?bz-dt=
-#if 0
+#if 1
sprintf(url_iot,"ws://wsiot-nocdn.raisound.com/ws-hub/dev/v1?bz-dt=%s",get_token());
#else
AI_AMP_MSG_put(0,0,VC_CLOSE);
AI_AMP_MSG_put(0,0,CLOSE_IOT);
}
+
+ if(VC_state>=VC_State_TTSStart&&VC_state<VC_State_End){
+
+ tts_start_timerout++;
+
+ if(tts_start_timerout==15)
+ {
+ tts_start_timerout=0;
+
+ AI_AMP_MSG_put(0,0,RANDOM_MT);
+ }
+ }else
+ {
+ tts_start_timerout=0;
+
+ }
}
if(sleep_chumo_timerout>0)
is_dialog_status=1;
// VC_state = VC_State_End;
+ if(vc_cfg.VC_mode==0||vc_cfg.VC_mode==2)
+ AI_client_VC_synthesis("你好,我要去休息了,唤醒请说你好小七");
+ else{
+
+ AI_AMP_MSG_put(0,0,VC_CLOSE);
+ // AI_AMP_MSG_put(0,0,CLOSE_IOT);
- AI_client_VC_synthesis("你好,我要去休息了,唤醒请说你好小七");
+ close_timerout=2;
+ }
+ // if()
}
}
}
else{
- VAD_status = 0;
- // AI_AMP_MSG_put(0,0,VC_CLOSE);
+ if (VC_TTS_PLAY_EVENT == VC_TTS_PLAY_POWER_OFF)
+ {
+ AI_AMP_MSG_put(0,0,POWER_OFF);
+ }else if (VC_TTS_PLAY_EVENT == VC_TTS_PLAY_RESET)
+ {
+ AI_AMP_MSG_put(0,0,POWER_RESET);
+ }
+ VAD_status = 0;
+
+ ddh_is_close_dialog=0;
+
+ // AI_AMP_MSG_put(0,0,VC_CLOSE);
}
//AI_AMP_MSG_put(0,0,VC_RECORD_START);//开启录音
// AI_AMP_MSG_put(0,0,AI_MOT_BACK_MID);
- bk_msg_printf("VC_END_play_timerout=%d",VC_END_play_timerout);
+ bk_msg_printf("VC_END_play_timerout=%d",VC_END_play_timerout);
AI_AMP_MSG_put(0,0,AI_MOT_BACK_MID);
}
net_status_count++;
play_audio_file("C:/xinhaoruo1.mp3");
- if(net_status_count>=3)
- play_audio_file("C:/khye.mp3");
+ if(net_status_count>=3){
+
+ play_audio_file("C:/khye.mp3");
+ AI_AMP_MSG_put(0,0,POWER_RESET);
+
+ }
}else
AI_VC_stata = 1;
+
return ret;
}
char AI_VC_Close_lock = 0;
// aic_gpio_output(MOT_EN_REV,GPIO_OUTPUT_LVL_LOW);
// aic_gpio_output(GPIO_20,GPIO_OUTPUT_LVL_LOW );
#if SUPPORT_MOT
- // MTO_stop();
+ // MTO_stop();
// MTO_restert();
// MTO_restert_tb();
AI_ASR_str =NULL;
}
//app_logi("app_audio_stop2");
+
+ VC_state = VC_State_None;
AI_VC_stata = 0;
AI_VC_Close_lock = 0;
is_Low_power_warning =0;
}
chg_status_tmp = psy_info.bat_chg_status;
- // bk_printf("电量查询:psy_name:%s bat_vol:%d bat_cap:%d chg_status%d chg_type:%d bat_min_voltage:%d bat_max_voltage:%d\n",
-
- // psy_info.psy_name,
- // psy_info.bat_current_voltage,
- // psy_info.bat_capacity,
- // psy_info.bat_chg_status,
- // psy_info.bat_chg_type,
- // psy_info.bat_min_voltage,
- // psy_info.bat_max_voltage);
- //tmp_data_len = snprintf(tmp_data,sizeof(tmp_data),"当前电量为百分之%d。",psy_info.bat_capacity);
+ bk_printf("电量查询:psy_name:%s bat_vol:%d bat_cap:%d chg_status%d chg_type:%d bat_min_voltage:%d bat_max_voltage:%d\n",
+
+ psy_info.psy_name,
+ psy_info.bat_current_voltage,
+ psy_info.bat_capacity,
+ psy_info.bat_chg_status,
+ psy_info.bat_chg_type,
+ psy_info.bat_min_voltage,
+ psy_info.bat_max_voltage);
+ // tmp_data_len = snprintf(tmp_data,sizeof(tmp_data),"当前电量为百分之%d。",psy_info.bat_capacity);
}
// extern char *ota_url;
// ||is_dialog_status==1
- if((VC_state==VC_State_Listening&&VAD_status==0)||VC_state==VC_State_End||VC_state==VC_State_None){
+ //if((VC_state==VC_State_Listening&&VAD_status==0)||VC_state==VC_State_End) //||VC_state==VC_State_None
+ // {
bk_printf("VC_state11 %d.....\n",VC_state);
if(index_temp<5)
{
- AI_AMP_MSG_put(str_huashu[type][mode][index_temp],strlen(str_huashu[type][mode][index_temp]),VC_TTS_PLAY);
+ app_audio_set_master_volume(15*vc_cfg.VC_TTS_volume/100);
+
+ AI_AMP_MSG_put(str_huashu[type][mode][index_temp],strlen(str_huashu[type][mode][index_temp]),VC_TTS_PLAY);
+ is_dialog_status=0;
}
// AI_client_VC_synthesis(str_huashu[type][mode][index_temp]);
// play_audio_file("C:/chumo.mp3");
// return ;
- }else{
+ // }else{
- bk_printf("VC_state22 %d.....\n",VC_state);
+ // bk_printf("VC_state22 %d.....\n",VC_state);
- return ;
- }
+ // return ;
+ // }
// if(VC_Play_flag!=1){
int auth_vad_status=0;
+int auth_kws_status=0;
+
static void uart_recv_UI_handel(void *thread_input)
{
size_t read;
static void AI_AMP_2_5_task(void *thread_input)//做逻辑线程
{
- char count = 30;
+ char count = 20;
boolean pdp_activated ;
AI_AMP_MSG_queue_t AI_AMP_msg = {0};
// http://dmp-ota.tos-cn-guangzhou.volces.com/ota/2025_07_24/1948312805093978114gx306l_h3.diff
- bk_printf("FXH01_Version:%s",FXH01_Version);
- bk_printf("FXH01_Version:%s",FXH01_Version);
- bk_printf("FXH01_Version:%s",FXH01_Version);
+ bk_printf("FXH01_Version:%s",FXH01_Version);
+ bk_printf("FXH01_Version:%s",FXH01_Version);
+ bk_printf("FXH01_Version:%s",FXH01_Version);
//slp_register_sleep_hook(bk_task_suspend, AIC_NULL,
// bk_task_resume, AIC_NULL);
// snd_soc_component_write(codec, ES8311_ADC_REG17, es8311->adc_volume);
// snd_soc_component_write(codec, ES8311_DAC_REG32, es8311->dac_volume);
+ // aos_sleep(1000);
+
+ while(count --)
+ {
+ pdp_activated = aic_is_default_pdp_activated();
+ if(pdp_activated == TRUE)
+ break;
+ bk_printf("AI_AMP_2_5_init 等待注网..... \n");
+
+ // audio_play_tone(count%15,500);//播放提示音,测试用
+ // audio_play_tone(3,500);//播放提示音,测试用
+
+ aos_sleep(1000);
+ }
+
+
+ if(pdp_activated){
+
+ bk_printf("AI_AMP_2_5_init 入网成功..... \n");
+
+ }else{
+
+ bk_printf("AI_AMP_2_5_init 第一次入网失败..... \n");
+ aic_send_cfun_cmd(0);
+ aos_sleep(500);
+
+ aic_send_cfun_cmd(1);
+
+ aos_sleep(500);
+ count=20;
while(count --)
{
break;
bk_printf("AI_AMP_2_5_init 等待注网..... \n");
- //audio_play_tone(count%15,500);//播放提示音,测试用
- //audio_play_tone(3,500);//播放提示音,测试用
+ // audio_play_tone(count%15,500);//播放提示音,测试用
+ // audio_play_tone(3,500);//播放提示音,测试用
aos_sleep(1000);
+ }
+
}
bk_websocket_demo();
}
- // AI_VC_60S_timer
+ // AI_VC_60S_timer
// if(AI_VC_60S_timer == NULL)
// {
// AI_VC_60S_timer = aos_create_timer("AI_VC_60S_timer",
bk_printf("auth_vad token0: %s..... \n",get_token());
struct AuthInfo auth_info;
- // dmp_log_level = 10086;
+ // dmp_log_level = 10086;
- auth_info.server_addr=2;
+ // auth_info.server_addr=2;
strcpy(auth_info.dmp_token, get_token());
if(strlen(auth_info.dmp_token)>0){
- for(int i=0;i<3;i++){
+ for(int i=0;i<40;i++){
+
int ret=auth_vad(&auth_info);
if(ret==0){
- bk_printf("auth_vad fail token: %s..... \n",get_token());
+ bk_printf("auth_vad fail token: %s..... \n",get_token());
- }else{
+ }
+ else
+ {
- bk_printf("auth_vad success token: %s..... \n",get_token());
+ bk_printf("auth_vad success token: %s..... \n",get_token());
- auth_vad_status=1;
- break;
+ auth_vad_status=1;
+
+ break;
+
+ }
+
+ aos_sleep(100);
}
+ for(int i=0;i<40;i++){
+
+ int ret=auth_kws(&auth_info);
+
+ if(ret==0){
+
+ bk_printf("auth_kws fail token: %s..... \n",get_token());
+
+ }
+ else
+ {
+
+ bk_printf("auth_kws success token: %s..... \n",get_token());
+
+ auth_kws_status=1;
+
+ break;
+
+ }
+
+ aos_sleep(100);
+
}
- }else{
- play_audio_file_event("C:/xinhaoruo1.mp3");
- }
- if(auth_vad_status==0){
+ bk_printf("auth_vad_status: %d auth_kws_status %d..... \n",auth_vad_status,auth_kws_status);
- play_audio_file_event("C:/xinhaoruo1.mp3");
+ if(auth_vad_status==0||auth_kws_status==0)
+ {
- aos_sleep(2000);
+ // play_audio_file_event("C:/xinhaoruo1.mp3");
+ // aos_sleep(500);
+
+ }
+
+ }
+ else
+ {
+
+ // play_audio_file_event("C:/xinhaoruo1.mp3");
}
+
+
#ifdef exptest
aos_sleep(500);
// AI_client_IOT
}
+ break;
+ case RANDOM_MT:
+
+ random_statu_mot();
+
break;
case VC_START:
AI_VC_start(0);
aic_free(AI_AMP_msg.data);
}else
{
- aos_sleep(10);
+ aos_sleep(10);
}