-
Notifications
You must be signed in to change notification settings - Fork 26
/
xfasr.h
45 lines (29 loc) · 757 Bytes
/
xfasr.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef XFASR_H
#define XFASR_H
#include "easywsclient.hpp"
#include "tinycthread.h"
using easywsclient::WebSocket;
#ifdef __cplusplus
extern "C"
{
#endif
#define BFLEN 500
typedef void(*on_message)(const std::string& message, void *arg);
typedef void(*on_close)(const std::string& asrtext, void *arg);
typedef struct asr_session {
WebSocket::pointer ws;
on_message handle_message;
on_close handle_event;
void *event_arg;//ÓÐÎÊÌâ²»ÓÃ
thrd_t thr;
mtx_t mutex;
char *asr_text;
} asr_session_t;
WebSocket::pointer init_asr(char* appid, char* key, asr_session_t* asr);
int send_data(asr_session_t* asr, char* buf, int buflen);
int send_end(asr_session_t* asr);
void deinit_asr(asr_session_t* asr);
#ifdef __cplusplus
}
#endif
#endif