struct in_addr in_addr_t={0};
ip_addr_t ip;
struct cat1_ws_init_t ip_sem={0};
-int opt = 1;
+ int opt = 1;
err_t ret=0;
}
+
+char *asr_recv_buf=NULL;//[1024]={0};
+WebSocketClient *asr_client;
+
+int32_t uapi_tts_paly_init(void);
+
+int32_t uapi_tts_paly_stop(void);
+
+uint32_t bk_websocket_tts_tick=0;
+
+uint8_t tts_reconnect=0;
+
+uint8_t asr_need_stop=0;
+
+
char recv_buf[1024]={0};
+
WebSocketClient *chat_client;
+
+WebSocketClient *tts_client;
+
+
+errcode_t chat_server_init(void);
+
+errcode_t tts_server_init(void);
+
+void tts_server_deinit(void);
+
+
+void uapi_UI_start_asr(void)
+{
+ asr_need_stop=0;
+
+ asr_server_init();
+
+ if(chat_client==NULL)
+ {
+ chat_server_init();
+ }
+ if(tts_client==NULL)
+ {
+ tts_server_init();
+ }
+
+
+
+ if(bk_websocket_tts_tick!=0)
+ {
+ tts_server_deinit();
+ tts_reconnect=1;
+ }
+}
+
+
+void uapi_UI_stop_start_asr_timeout(void)
+{
+ asr_need_stop=1;
+}
+
+void uapi_UI_stop_asr(void)
+{
+ stop_AudioCaptureProcess_AI();
+}
+
+
+
+
void send_ai_txt(uint8_t type,char *msg)
{
cJSON* dataJSON = cJSON_CreateObject();
/* code */
is_bk_websocket_chat=1;
- char url_buf[124]={0};
- if(chat_ws_url_init(url_buf))
- {
- printf("%s\r\n",url_buf);
- }
- else
- {
- is_bk_websocket_chat=0;
- return;
- }
+ // char url_buf[124]={0};
+ // if(chat_ws_url_init(url_buf))
+ // {
+ // printf("%s\r\n",url_buf);
+ // }
+ // else
+ // {
+ // is_bk_websocket_chat=0;
+ // return;
+ // }
uint8_t client_count=3;
while (client_count)
{
// http://118.145.158.207:22080ws://118.145.158.207:22080/chat/ws
- chat_client = init_websocket_client(url_buf,NULL,1);
+ // ws://amp.raisound.com/chat/ws?dt=%s&platform=chinamobiledevice&bot_type=jiutian-lan
+ chat_client = init_websocket_client("ws://118.145.158.207:22080/chat/ws?&platform=chinamobiledevice&bot_type=jiutian-lan",NULL,0);
if (chat_client== NULL) {
client_count--;
// http://118.145.158.207:22080ws://amp.raisound.com/asr/ws
-char *asr_recv_buf=NULL;//[1024]={0};
-WebSocketClient *asr_client;
-
-int32_t uapi_tts_paly_init(void);
-
-int32_t uapi_tts_paly_stop(void);
-
-uint32_t bk_websocket_tts_tick=0;
-
-uint8_t tts_reconnect=0;
-
-void tts_server_deinit(void);
-
-
-void uapi_UI_start_asr(void)
-{
- asr_server_init();
-
- if(bk_websocket_tts_tick!=0)
- {
- tts_server_deinit();
- tts_reconnect=1;
- }
-}
-
-void uapi_UI_stop_asr(void)
-{
- stop_AudioCaptureProcess_AI();
-}
uint8_t client_count=3;
- while (client_count)
+ while (client_count && asr_need_stop==0)
{
if (g_test_server_index == 1)
{
if (asr_client== NULL) {
printf("init_websocket_client fail %d\r\n",client_count);
client_count--;
-bk_sleep(1000);
+ bk_sleep(1000);
continue ;
}
else
break;
}
}
+
+ asr_need_stop=0;
+
if (asr_client== NULL){
+ bool state = false;
+ SendMsgToUIService(UI_AI_JUMP_TO_LISTENING_VIEW, 0, &state, sizeof(bool));
is_bk_websocket_asr=0;
return;
}
-WebSocketClient *tts_client;
-
void uapi_start_tts(void)
{