#ifndef _BASAPI_H
#define _BASAPI_H

#ifdef __cplusplus
extern "C" {
#endif

/* Basic definitions */
#ifndef FALSE
#define FALSE ( BOOL ) 0 
#endif
#ifndef TRUE
#define TRUE  ( BOOL ) 1 
#endif

/* Error IDs */
#define ERR_SUCCESS					(ERRORID)0   
#define ERR_MALLOC                  (ERRORID)1     /* memory allocation failed */
#define ERR_TASK_THREAD             (ERRORID)2     /* handle to an engine was used in another task or thread than the one that did the casrOpen */
#define ERR_APIINIT                 (ERRORID)3     /* casrSPIInit called more than once */
#define ERR_CONTEXT_WRONG_HANDLE    (ERRORID)4     /* context handle not present in the global list of imported contexts */
#define ERR_CONTEXT_IN_USE          (ERRORID)5     /* a casrCloseContext was attempted on a context that is still in use on some engine */
#define ERR_NULL_HANDLE             (ERRORID)6     /* a NULL handle was passed to some spi function */
#define ERR_WRONG_STATE             (ERRORID)7     /* an engine function was called on an engine that was in the wrong state */
#define ERR_DATA_WRONG_HANDLE       (ERRORID)8     /* data handle not present in the global list of imported data */
#define ERR_DATA_IN_USE             (ERRORID)9     /* a casrCloseData was attempted on a dataimport that is still in use on some engine */
#define ERR_UNKNOWN_PARAM           (ERRORID)10    /* parameter used in casr(Set|Get)Param not in range 1-14 */
#define ERR_INVALID_ENGINE          (ERRORID)11    /* handle to the engine not valid, probably because the engine has been closed */
#define ERR_LANGUAGE_MISMATCH       (ERRORID)12    /* attempt to activate context or session data that does not match the activated language */
#define ERR_WRONG_DATA              (ERRORID)13    /* an import of some data buffer with a wrong DataType field was attempted */
#define ERR_INVALID_DATA            (ERRORID)14    /* handle to the imported data not valid, probably because it has been closed */
#define ERR_TASK_THREAD_DATA        (ERRORID)15    /* handle to an imported data was used in another task or thread than the one that did the casrImportData */
#define ERR_INVALID_CONTEXT         (ERRORID)16    /* handle to the imported context not valid, probably because it has been closed */
#define ERR_TASK_THREAD_CONTEXT     (ERRORID)17    /* handle to a context was used in another task or thread than the one that did the casrImportContext */
#define ERR_INVALID_SPI             (ERRORID)18    /* handle to a SPI was invalid or was used in another task then the task the created the handle */
#define ERR_NULL_POINTER            (ERRORID)19    /* an null pointer has been passed to an spi command*/
#define ERR_INVALID_GENDER          (ERRORID)20    /* illegal value for CPARAM_SELECTGENDER (might also occur during casrActivate!) */
#define ERR_NO_USERWORD_TRAINING    (ERRORID)21    /* the currently active language is unable to do userword training */
#define ERR_NO_START_DETECTION      (ERRORID)22    /* attempted casrStartUserWordTraining with start detection enabled */
#define ERR_WRONG_SIZE              (ERRORID)23    /* A buffer with the wrong size has been passed */
#define ERR_UTTFORMAT_UNKNOWN       (ERRORID)24    /* Unknown utterance format */
#define ERR_INVALID_WORDID          (ERRORID)25    /* at least one wordID is out of range in casrSetActiveWords */
#define ERR_TIMEOUT				    (ERRORID)26    /* Timeout occured */



/* Parameter IDs */
#define CPARAM_TS_ENABLE      ( CPARAMID ) 1	
#define CPARAM_START_ENABLE   ( CPARAMID ) 2    
#define CPARAM_ENABLEPREMRES  ( CPARAMID ) 3	
#define CPARAM_TS             ( CPARAMID ) 4	
#define CPARAM_TIMEOUT        ( CPARAMID ) 5	
#define CPARAM_ACCURACY       ( CPARAMID ) 6	
#define CPARAM_REJECTION      ( CPARAMID ) 7	
#define CPARAM_GARBAGE        ( CPARAMID ) 8	
#define CPARAM_SENSITIVITY    ( CPARAMID ) 9	
#define CPARAM_MINSPEECH      ( CPARAMID ) 10	
#define CPARAM_AGCON          ( CPARAMID ) 11	
#define CPARAM_FARTALK        ( CPARAMID ) 12	
#define CPARAM_MAXNBEST       ( CPARAMID ) 13
#define CPARAM_SELECTGENDER	  ( CPARAMID ) 14

/* Gender types */
#define GENDER_MALE    0x00000001
#define GENDER_FEMALE  0x00000002
#define GENDER_CHILD   0x00000004
#define GENDER_BOY     0x00000008
#define GENDER_GIRL    0x00000010
#define GENDER_UNKNOWN 0xffffffff

/* Training prompt return codes */
#define PROMPT_OK     1	
#define PROMPT_NOK    2 
#define PROMPT_CANCEL 3 

/* Data types */
/*@doc ASRDEF
*/
#define DATA_LANG				(DWORD) 1 
#define DATA_CONTEXT			(DWORD) 2 
#define DATA_LANG_FIXED			(DWORD) 3
#define DATA_SESSIONDATA		(DWORD) 4
#define DATA_SESSIONDATA_FIXED	(DWORD) 5
#define DATA_LANG_V2			(DWORD) 10
#define DATA_LANG_V2_FIXED		(DWORD) 11



/************* Session Data *************************************/

typedef struct
{
  unsigned long DataType;
  unsigned long Size;
} SESSIONINFO,*PSESSIONINFO;


/* Type definitions ***********************************************************/

/* Basic types */

typedef int             BOOL; 
typedef unsigned long   DWORD, *PDWORD; 
typedef void            *PVOID;
typedef unsigned short  WORD, *PWORD;

/* Handle types */
typedef struct HASR__ *HASR, **PHASR; 
typedef struct HDATA__ *HDATA, **PHDATA;
typedef struct HCRITSECTION__ *HCRITSECTION;
typedef struct HCONT__ *HCONT, **PHCONT; 
typedef struct HAPI__ *HAPI, **PHAPI; 
/* Other simple types */
typedef short CASRLEVEL, *PCASRLEVEL; 
typedef DWORD CPARAMID; 
typedef DWORD CPARAMVALUE, *PCPARAMVALUE;
typedef DWORD CWORDID, *PCWORDID;
typedef DWORD ERRORID;
typedef PVOID PCONT;

/* Sample format enumeration type */

typedef enum _CSAMPLEFORMAT {
  PCM_16_11KHZ = 0
} CSAMPLEFORMAT;

/* Engine state enumeration type */
/* @enum CASRSTATE | Represents the current state of an engine.*/
typedef enum _CASRSTATE {
  CASR_BOOT       = 0,/* @emem CASR_BOOT | No contexts, language or user activated yet.*/
  CASR_DATAREADY  = 1,/* @emem CASR_DATAREADY | All necessary data is activated.*/
  CASR_IDLE       = 2,/* @emem CASR_IDLE | Context, language and user are activated.*/
  CASR_SLEEP      = 3,/* @emem CASR_SLEEP | Low CPU start detection.*/
  CASR_RUN        = 4,/* @emem CASR_RUN | Recognizing.*/
  CASR_RECOVER    = 5,/* @emem CASR_RECOVER | TS detected or <f CasrStop> called. Notifying the result.*/
  CASR_PROMPT     = 6,/* @emem CASR_PROMPT | Waiting for user feed-back during training to start the utterance.*/
  CASR_RECORD     = 7,/* @emem CASR_RECORD | Recording a user word utterance.*/
  CASR_ACCEPT     = 8,/* @emem CASR_ACCEPT | Waiting for user feed-back during training to accept an utterance.*/
  CASR_CONFIRM    = 9 /* @emem CASR_CONFIRM | Waiting for user feed-back during training to accept all the training data.*/
} CASRSTATE, *PCASRSTATE;

/* Abnormal condition enumeration type */
/* @enum ABNORMCOND | Type of the abnormal condition that occured.*/
typedef enum _ABNORMCOND {
  BADSNR        = 0,/* @emem BADSNR | The signal to noise ratio is too low.*/
  OVERLOAD      = 1,/* @emem OVERLOAD | The input signal is too loud.*/
  TOOQUIET      = 2,/* @emem TOOQUIET | The input signal is too soft.*/
  NOSIGNAL      = 3,/* @emem NOSIGNAL | No signal has been seen for a time after the start of the agc.*/
  GARBLEDSOUND  = 4,/* @emem GARBLEDSOUND | A very short non speech sound has been seen.*/
  POORMIC       = 5 /* @emem POORMIC | A poor microphone has been detected.*/
} ABNORMCOND;

/* Recognition result structure types */

/*@doc ASRSTRUCT
*/
/* @struct ALTERNATIVE | Formatted part of a recognition result.*/
typedef struct _ALTERNATIVE {
  int iConf;      /* @field int | iConf | The confidence level of this alternative. */
  long lScore;    /* @field long | lScore | Score for this, the lower the better. */
  CWORDID idWord; /* @field <t CWORDID> | idWord | ID of this alternative 
                        ( user word ids have an offset <t OFFSET_USERWORDID> ). */
} ALTERNATIVE, *PALTERNATIVE;

/* @struct TIMEINFO | Structure returning time information abaout the utterance that was said.
   All returned times are in number of samples received counting from the time <f CastStart> has 
   been called. A value of -1 (0xffffffff) means that no timing information is returned*/
typedef struct _TIMEINFO {
	DWORD	TimeBegin;	/* @field <t DWORD> | TimeBegin | Begin time of the corresponding utterance. */
	DWORD   TimeEnd;	/* @field <t DWORD> | TimeBegin | End time of the corresponding utterance. */
} TIMEINFO, *PTIMEINFO;

/* @struct RECWORD | Formatted part of a recognition result.*/
typedef struct _RECWORD {
  int iNbrAlternatives;	      /* @field int | iNbrAlternatives | Number of alternatives for this word. */
  TIMEINFO TimeInfo;          /* @field <t TIMEINFO> | TimeInfo | Contains the times of the begin and the end of this word.*/
  ALTERNATIVE *pAlternatives; /* @field <t ALERNATIVE> | pAlternatives | Array of containing all the alternatives. */
} RECWORD, *PRECWORD;

/* @struct SENTENCE | Formatted part of a recognition result.*/
typedef struct _SENTENCE {
  int iNbrWords;     /* @field int | iNbrWords | Number of words in this sentence. */
  int iConf;  	     /* @field int | iConf | Confidence level of this sentence. */
  long lScore;       /* @field long | lScore | Score for this sentence, the lower the better. */
  TIMEINFO TimeInfo; /* @field <t TIMEINFO> | TimeInfo | Contains the times of the begine and the end of this sentence. */
  PRECWORD pWords;   /* @field <t RECWORD> *| pWords | Array containing the words of this sentence. */
} SENTENCE, *PSENTENCE;

typedef enum _CASRRESULTTYPE {
  CASRRESULTTYPE_FINAL=0,
  CASRRESULTTYPE_PREMATURE,
  CASRRESULTTYPE_TIMEOUT
} CASRRESULTTYPE;

/* @struct CASRRESULT | Represents a formatted recognition result.*/
typedef struct _CASRRESULT {
  int iNbr;             /*@field int | iNbr | Number of recognition alternatives. */
  PSENTENCE pSentences; /*@field < t PSENTENCE> | pSentences | Array containing all sentences of the N-best result. */
  CASRRESULTTYPE Type;  
} CASRRESULT, *PCASRRESULT;

/* @struct USERDATA | Structure used to pass back userdata to the application*/
typedef struct _USERDATA {
  DWORD dwApiUserData;    /*@field DWORD| dwAPIUserData | User data of the API */
  DWORD dwEngineUserData; /*@field DWORD| dwEngineUserData | User data of the engine */
} USERDATA, *PUSERDATA;

/* Training prompt enumeration type */
/* @enum PROMPTYPE | Represents the different types of prompt notifications send 
   during user word training. The decision has to be notified to the engine with the 
   <f CasrAcknowledge> function call.*/
typedef enum _PROMPTTYPE {
  PROMPTTYPE_START = 0,
  PROMPTTYPE_ACCEPT,
  PROMPTTYPE_CONFIRM,
  PROMPTTYPE_TRAINEND,
  PROMPTTYPE_NOPROMPT
} PROMPTTYPE;



/* Recognition callback function types */


typedef unsigned char ( *CBRESULT )( PCASRRESULT pResult, PUSERDATA pUserData );

typedef unsigned char ( *CBSTATE )( CASRSTATE State, PUSERDATA pUserData );

typedef unsigned char ( *CBTRAIN )( PROMPTTYPE PromptType, PUSERDATA pUserData );

typedef unsigned char ( *CBABNORM )( ABNORMCOND AbnormalCondition, PUSERDATA pUserData );

typedef unsigned char ( *CBAGC )( WORD NewGain, PUSERDATA pUserData );

typedef unsigned char ( *CBASKCURRENTGAIN )( PUSERDATA pUserData );

/* Recognition callback function structure type */
typedef struct _CRECOGCALLBACKS {
  CBRESULT cbResult;                  /*@field <t CBRESULT> | cbResult | Result notification. */
  CBSTATE cbState;                    /*@field <t CBSTATE> | cbState | State notification. */
  CBTRAIN cbTrain;                    /*@field <t CBTRAIN> | cbTrain | User word training notification. */
  CBABNORM cbAbnorm;                  /*@field <t CBABNORM> | cbAbnorm | Abnormal condition notification. */
  CBAGC cbAgc;                        /*@field <t CBAGC> | cbAgc | Request to change the analog gain. */
  CBASKCURRENTGAIN cbAskCurrentGain;  /*@field <t CBASKCURRENTGAIN> | cbAskCurrentGain | Returns the current gain setting. */
} CRECOGCALLBACKS, *PCRECOGCALLBACKS;

/* OS callback function types */
typedef void * ( *CBMALLOC )( DWORD dwSize, PUSERDATA pUserData );

typedef void ( *CBFREE )( PVOID pMem, PUSERDATA pUserData );

typedef void * ( *CBREALLOC )( PVOID Ptr, DWORD dwSize, PUSERDATA pUserData );

typedef int ( *CBGETCURTASK )( PUSERDATA pUserData );

typedef int ( *CBGETCURTHREAD )( PUSERDATA pUserData );

typedef HCRITSECTION ( *CBCREATECRITICALSECTION )( PUSERDATA pUserData );

typedef BOOL ( *CBDELETECRITICALSECTION )( HCRITSECTION hCritSection,  PUSERDATA pUserData  );

typedef BOOL ( *CBENTERCRITICALSECTION )( HCRITSECTION hCritSection,  PUSERDATA pUserData  );

typedef BOOL ( *CBLEAVECRITICALSECTION )( HCRITSECTION hCritSection,  PUSERDATA pUserData  );


/********** OS Callbacks *********************************************************/

/* OS callback function structure type */
typedef struct _COSCALLBACKS {
  CBMALLOC cbMalloc;              /*@field <t CBMALLOC> | cbMalloc | Memory allocation function. */
  CBFREE cbFree;                  /*@field <t CBFREE> | cbFree | Memory freeing function. */
  CBREALLOC cbRealloc;            /*@field <t CBREALLOC> | cbRealloc | Memory re-allocation function. */
  CBGETCURTASK cbGetCurTask;      /*@field <t CBGETCURTASK> | cbGetCurThread | Get ID of current task
                                     (only useful in multitasking environments). */
  CBGETCURTHREAD cbGetCurThread;  /*@field <t CBGETCURTHREAD> | cbGetCurThread | Get ID of current thread 
                                     (only useful in multithreading environments). */
  CBCREATECRITICALSECTION cbCreateCriticalSection; /*@field <t CBCREATECRITICALSECTION> |  cbCreateCriticalSection | function for creation and initialization of a critical section
                                     (only useful in multithreading environments).*/
  CBDELETECRITICALSECTION cbDeleteCriticalSection; /*@field <t CBDELETECRITICALSECTION> |  cbDeleteCriticalSection | function for deleting a critical section
                                     (only useful in multithreading environments).*/
  CBENTERCRITICALSECTION cbEnterCriticalSection; /*@field <t CBENTERCRITICALSECTION> |  cbEnterCriticalSection | function for entering a critical section
                                     (only useful in multithreading environments).*/
  CBLEAVECRITICALSECTION cbLeaveCriticalSection; /*@field <t CBLEAVECRITICALSECTION> |  cbLeaveCriticalSection | function for leaving a critical section
                                     (only useful in multithreading environments).*/
} COSCALLBACKS, *PCOSCALLBACKS;

/* Parameter list structure type */

typedef struct _CPARAMLIST {
  DWORD cparam_ts_enable; /*@field <t DWORD> | cparam_ts_enable | Trailing silence detection on or of.*/
  DWORD cparam_start_enable;/*@field <t DWORD> | cparam_start_enable | Low CPU start detection on or of.*/
  DWORD cparam_enablepremres;/*@field <t DWORD> | cparam_enablepremres | Generation of premature results enabled or disabled.*/
  DWORD cparam_ts;/*@field <t DWORD> | cparam_ts | Minimum amount of trailing silence.*/
  DWORD cparam_timeout;/*@field <t DWORD> | cparam_timeout | Maximum amount of time the engine can recognize.*/
  DWORD cparam_accuracy;/*@field <t DWORD> | cparam_accuracy | Accuracy of the recognizer.*/
  DWORD cparam_rejection;/*@field <t DWORD> | cparam_rejection | Penalty for the rejection word.*/
  DWORD cparam_garbage;/*@field <t DWORD> | cparam_garbage | Penalty for the garbage model.*/
  DWORD cparam_sensitivity;/*@field <t DWORD> | cparam_sensitivity | Sensitivity of the low CPU speech detection.*/
  DWORD cparam_minspeech;/*@field <t DWORD> | cparam_minspeech | Minimum amount of speech the low CPU detection system has to see befor begine of speech is detected.*/
  DWORD cparam_agcon;/*@field <t DWORD> | cparam_agcon | AGC on or of.*/
  DWORD cparam_fartalk;/*@field <t DWORD> | cparam_fartalk | Close talk or far talk microphone.*/
  DWORD cparam_maxnbest;/*@field <t DWORD> | cparam_maxnbest | Maximum number of sentences in the result.*/
  DWORD cparam_selectgender;
} CPARAMLIST, *PCPARAMLIST;
/* @type PCPARAMLIST | pointer to <t CPARAMLIST>. */

#define LANGVERSIONINFOLENGTH  128

/* Data type structure type */
/* @struct DATA | Structure representing data buffer information.*/
typedef struct {
  DWORD dwDataType;
  DWORD dwSize;
  char             aVersionInfo[LANGVERSIONINFOLENGTH];
} DATA, *PDATA;

/* Function declarations ******************************************************/

ERRORID CasrAcquisition(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to an engine installed opened with 
              <f CasrOpen> [INPUT].*/
  CSAMPLEFORMAT SampleFormat,/*@parm <t CSAMPLEFORMAT> | SampleFormat | Format of the 
                             samples in pSampleBuf [INPUT].*/
  PVOID pSampleBuf,/*@parm <t PVOID> | pSampleBuf | Buffer containing the samples [INPUT].*/
  DWORD dwBufSize/*@parm < t DWORD> | dwBufSize | Length (in bytes) of the sample buffer [INPUT].*/
);

ERRORID CasrActivateContext(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  HCONT hCont/*@parm <t HCONT> | hCont | Context handle, returned by the <f CasrImportContext> function. 
                  If hCont equals NULL the active context is de-activated [INPUT].*/
);

ERRORID CasrActivateData(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  HDATA hData/*@parm <t HDATA> | hData | Handle of the data returned by the <f CasrImportData> function [INPUT].*/
);

ERRORID CasrAPIClose(
  HAPI hApi /*@parm <t HAPI> | hApi | Handle to the API instance [INPUT].*/
);

ERRORID CasrAPIInit(
  PCOSCALLBACKS pApiOsCallbacks,/*@parm <t PCOSCALLBACKS> | pOsCallbacks | Pointer to the <t COSCALLBACKS> structure 
                                   containing all the OS callbacks [INPUT].*/
  DWORD ApiUserData,/*@parm <t DWORD> | ApiUserData | User data [INPUT].*/
  PHAPI phApi /*@parm <t PHAPI> | phApi | Address where the handle to the API will be written [OUTPUT].*/
);

ERRORID CasrClose(
  HASR hAsr/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
);

ERRORID CasrCloseContext(
  HCONT hCont/*@parm <t HCONT> | hCont | Handle to the context [INPUT].*/
);

ERRORID CasrCloseData(
  HDATA hData/*@parm <t HDATA> | hData | Handle to the data [INPUT].*/
);

ERRORID CasrExportData(
  HASR hAsr,
  DWORD DataType,
  PVOID *ppBuf,
  PDWORD pdwSize
);

ERRORID CasrGainSet(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  WORD Gain/*@parm <t WORD> | Gain | The value of the current analog gain. This has to be a value between 1 
		   (minimum) and 65535 (maximum). 0 should not be passed because it means that 
		   there will be no signal [INPUT].*/
);

ERRORID CasrGetActivatedContext(
  HASR hAsr, /*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  PHCONT phCont/*@parm <t PHCONT> | phCont | Pointer to the context handle [OUTPUT].*/
);

ERRORID CasrGetActivatedData(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  PHDATA *ppData,/*@parm <t PHDATA> *| ppData | Address of a variable that will receive the pointer to the 
                    allocated buffer [OUTPUT].*/
  PDWORD pdwSize/*@parm <t PDWORD> | pdwSize | Address of a variable where the size of the array will be written [OUTPUT].*/
);

ERRORID CasrGetActiveWords(
  HASR hAsr,/*@parm  <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  PCWORDID *ppActiveWords,/*@parm <t PCWORDID> *| ppActiveWords | Address of a variable where the pointer to the array 
                                 containing the ID’s of the active words is written to [OUTPUT].*/
  PDWORD pdwSize/*@parm <t PDWORD> | pdwSize | Address of a variable where the size of the array will be written [OUTPUT].*/
);

ERRORID CasrGetAPIVersion(
  HAPI hApi, /*@parm <t HASR> | hApi | Handle to the API instance [INPUT].*/
  PDWORD pdwAPIVersion/*@parm <t PDWORD> | pdwAPIVersion | The DWORD has the following format:<nl>
					         <tab>0xMMmmbbbb<nl>
                             <tab>-<gt> MM	Major version number<nl>
                             <tab>-<gt> mm	Minor version number<nl>
                             <tab>-<gt> bbbb	Build number<nl>
							 [OUTPUT].
                       */
);

ERRORID CasrGetParam(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  CPARAMID ParamId,/*@parm <t CPARAMID> | ParamId | ID of the parameter to get [INPUT].*/
  PCPARAMVALUE pParamvalue/*@parm <t PCPARAMVALUE> | pParamValue | Address of the variable 
                            where the engine parameter will be written [OUTPUT].*/
);

ERRORID CasrGetParamList(
  HASR hAsr, /*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  PCPARAMLIST pParamList/*@parm <t PCPARAMLIST> | pParamList | Address of the struct 
                               where the engine parameters will be written [OUTPUT].*/
);

ERRORID CasrGetSignalLevel(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  PCASRLEVEL pLevel/*@parm <t PCASRLEVEL> | pLevel | Address of the variable where the current signal level will 
                          be written [OUPUT].*/
);

ERRORID CasrGetSNR(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  PCASRLEVEL pSNR /*@parm <t PCASRLEVEL> | pSNR | Address of the variable where the SNR will be written [OUPUT].*/
);

ERRORID CasrGetSPIVersion(
  HAPI hApi,/*@parm <t HAPI> | hApi | Handle to the API instance [INPUT].*/
  PDWORD pdwSPIVersion/*@parm <t PDWORD> | pdwSPIVersion | The DWORD has the following format:<nl>
					         <tab>0xMMmmbbbb<nl>
                             <tab>-<gt> MM	Major version number<nl>
                             <tab>-<gt> mm	Minor version number<nl>
                             <tab>-<gt> bbbb	Build number<nl>
							 [OUTPUT].
                       */
);

ERRORID CasrGetState(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  PCASRSTATE pState/*@parm <t PCASRSTATE> | pState | Address of a variable where the 
                    current engine state will be written [OUTPUT].*/
);

ERRORID CasrImportContext(
  HAPI hApi, /*@parm <t HASR> | hApi | Handle to the API instance [INPUT].*/
  PCONT pCont,/*@parm <t PCONT> | pCont | Read only buffer containing a context [INPUT]. 
                   This data can be shared between different engine instances.*/
  BOOL IsPermanent,/*@parm <t BOOL> | IsPermanent | TRUE if the buffer pointed to is permanent (stays in memory) 
                           and can be used as such as long as HCONT is valid [INPUT].*/
  PHCONT phCont/*@parm <t PHCONT> | phCont | Handle of the context. This context can than be used on different 
                    engines [OUTPUT].*/
);

ERRORID CasrImportData(
  HAPI hApi,
  PDATA pData,
  BOOL IsPermanent,
  PHDATA phData
);

ERRORID CasrOpen(
  HAPI hApi, /*@parm <t HASR> | hApi | Handle to the API instance [INPUT].*/
  PCRECOGCALLBACKS pRecogCallbacks,/*@parm <t PCRECOGCALLBACKS> | pRecogCallbacks |to a structure containing a set of 
								   callback functions that can be used by the engine [INPUT].*/
  DWORD dwUserData,/*@parm <t DWORD> | dwUserData | DWORD that will be returned with every callback used to notify
                          some information to the application. This can be used to assign 
						  user-data to an engine instance [INPUT].*/
  PHASR phAsr/*@parm <t PHASR> | phAsr | Handle of an engine instance [OUTPUT].*/ 
);

ERRORID CasrSetActiveWords(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  PCWORDID pidWords,/*@parm <t PCWORDID> | pidWords | Array containing the ID’s of all words that must be enabled. 
                           All the words that are not in this array will be disabled [INPUT].*/
  DWORD NbrWords/*@parm <t DWORD> | NbrWords | Number of word ID’s in pidWords [INPUT].*/
);

ERRORID CasrSetActiveWordsWithCheck(HASR hAsr, PCWORDID pidWords, DWORD NbrWords);

ERRORID CasrSetParam(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  CPARAMID ParamId,/*@parm <t CPARAMID> | ParamId | ID of the parameter to set [INPUT].*/
  CPARAMVALUE ParamValue/*@parm <t CPARAMVALUE> | ParamValue | New value of the parameter [INPUT].*/
);

ERRORID CasrSetParamList(
  HASR hAsr,/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
  PCPARAMLIST pParamList/*@parm <t PCPARAMLIST> | pParamList | Adress of structure containing the new values of all the 
                               parameters [INPUT].*/
);

ERRORID CasrStart(
  HASR hAsr/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
);

ERRORID CasrStop(
  HASR hAsr/*@parm <t HASR> | hAsr | Handle to the engine instance [INPUT].*/
);
#ifdef __cplusplus
}
#endif

#endif
