#ifndef _SRCWSAPI_H_
#define _SRCWSAPI_H_

#ifdef __cplusplus
extern "C" {
#endif

typedef struct _SRCParam
{
	const char* URL;
	const char* appKey;
	const char* appSecret;
	const char* cuid;
	const char* severVadThresh1;
	const char* severVadThresh2;
	const char* timeOutResponseInMsec;
	const char* timeOutSpeechInMsec;
	const char* speakerId;
	const char* userId;
	const char* useClientVad;
	const char* wkupSdkVersion;
	const char* waitConnectTimeInMsec;
} SRCParam;

enum SRC_ERROR
{
	SRC_SUCCESS              = 0,
	SRC_WS_ERROR             = 1,
	SRC_WS_DISCONNECT        = 2,
	SRC_SERVER_ERROR         = 3,
	SRC_SERVER_TIMEOUT       = 4,
	SRC_HANDLE_NULL_ERROR    = 5,
};

enum VAD_STATUS
{
	SRC_VAD_LOOKING_FOR_SPEECH = 0,
	SRC_VAD_IN_SPEECH = 1,
	SRC_VAD_END_SPEECH = 2,
	SRC_VAD_TIMEOUT_RESPONSE = 3,
	SRC_VAD_TIMEOUT_SPEECH = 4,
};

enum REC_STATUS
{
	SRC_REC_SENT_AUDIO_SUCCESS          = 1000,
	SRC_REC_SENT_AUDIO_FAILED           = 1001,
	SRC_REC_SENT_AUDIO_END_DETECTED     = 1002,
	SRC_REC_NLU_SUCCESS                 = 3100,
	SRC_REC_ASR_FAILED                  = 3101,
	SRC_REC_THIRDPARTY_FAILED		    = 3102,
	SRC_REC_NLU_FAILED				    = 3103,
	SRC_REC_AUTHEN_SUCCESS              = 4000,
	SRC_REC_NO_AUTHEN                   = 4001,
	SRC_REC_MISS_IDENTITY_PARAM         = 4002,
	SRC_REC_IDENTITY_CHECK_FAILED       = 4003,
	SRC_REC_MISS_CUID                   = 4004,
	SRC_REC_MISS_APPID                  = 4005,
	SRC_REC_MISS_PTC_OR_ILLEGAL         = 4006,
	SRC_REC_MISS_RATE_OR_ILLEGAL        = 4007,
	SRC_REC_MISS_CHUCK_INDEX            = 4008,
	SRC_REC_SESSION_INTERNEL_ERROR      = 5001,
	SRC_REC_SESSION_OVERLOADED          = 5002,
	SRC_REC_SESSION_BADLUCK             = 5003,
	SRC_REC_JASON_ERROR                 = 5004,
	SRC_REC_CHUNK_INFO_ERROR            = 5005,
	SRC_REC_REC_SESSIONID_ERROR         = 5006,
};

typedef void(*LogCallBackFunc)(int logLevel, const char* log);

void SRCWsSetLogFunc(LogCallBackFunc logFunc);

void SRCWsSetUPParam(const char* strKey, const char* strValue);

void SRCWsSetSPParam(const char* strKey, const char* strValue);

int SRCWsCreat();

const char* SRCWsSessionBegin(SRCParam srcParam, int *retCode);

int SRCWsAudioWrite(const char* sessionID, const short *audioData, unsigned int audioLen, int vadStat, int *retCode);

const char* SRCWsGetResult(const char* sessionID, int *retCode);
	
int SRCWsSessionEnd(const char* sessionID);
	
const char* SRCWsGetVersion();

int SRCWsDestroy();
#ifdef __cplusplus
};
#endif

#endif // _SRCWSAPI_H_
