SR_EventLog.h

00001 /*---------------------------------------------------------------------------*
00002  *  SR_EventLog.h  *
00003  *                                                                           *
00004  *  Copyright 2007 Nuance Communciations, Inc.                               *
00005  *                                                                           *
00006  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
00007  *  you may not use this file except in compliance with the License.         *
00008  *                                                                           *
00009  *  You may obtain a copy of the License at                                  *
00010  *      http://www.apache.org/licenses/LICENSE-2.0                           *
00011  *                                                                           *
00012  *  Unless required by applicable law or agreed to in writing, software      *
00013  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
00014  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 
00015  *  See the License for the specific language governing permissions and      *
00016  *  limitations under the License.                                           *
00017  *                                                                           *
00018  *---------------------------------------------------------------------------*/
00019 
00020 #ifndef __SR_EventLog_H
00021 #define __SR_EventLog_H
00022 
00023 
00024 
00025 #include "SR_EventLogPrefix.h"
00026 #include "ptypes.h"
00027 #include "ESR_ReturnCode.h"
00028 
00029 
00044 #define OSI_LOG_LEVEL_BASIC 0x01
00045 
00048 #define OSI_LOG_LEVEL_AUDIO 0x02
00049 
00052 #define OSI_LOG_LEVEL_ADDWD 0x04
00053 
00057 #define SR_EventLogToken_BASIC(log, loglevel, tokenName, value) \
00058   ((loglevel & OSI_LOG_LEVEL_BASIC) ? \
00059    log->token(log, tokenName, value) : ESR_SUCCESS ) \
00060 
00061 
00064 #define SR_EventLogTokenInt_BASIC(log, loglevel, tokenName, value)  \
00065   ((loglevel & OSI_LOG_LEVEL_BASIC) ? \
00066    log->tokenInt(log, tokenName, value) : ESR_SUCCESS ) \
00067 
00068 
00071 #define SR_EventLogTokenUint16_t_BASIC(log, loglevel, tokenName, value)  \
00072   ((loglevel & OSI_LOG_LEVEL_BASIC) ? \
00073    log->tokenUint16_t(log, tokenName, value) : ESR_SUCCESS ) \
00074 
00075 
00078 #define SR_EventLogTokenSize_t_BASIC(log, loglevel, tokenName, value)  \
00079   ((loglevel & OSI_LOG_LEVEL_BASIC) ? \
00080    log->tokenSize_t(log, tokenName, value) : ESR_SUCCESS ) \
00081 
00082 
00085 #define SR_EventLogTokenBool_BASIC(log, loglevel, tokenName, value)  \
00086   ((loglevel & OSI_LOG_LEVEL_BASIC) ? \
00087    log->tokenBool(log, tokenName, value) : ESR_SUCCESS ) \
00088 
00089 
00092 #define SR_EventLogTokenFloat_BASIC(log, loglevel, tokenName, value)  \
00093   ((loglevel & OSI_LOG_LEVEL_BASIC) ? \
00094    log->tokenFloat(log, tokenName, value) : ESR_SUCCESS ) \
00095 
00096 
00099 #define SR_EventLogEvent_BASIC(log, loglevel, eventName) \
00100   ((loglevel & OSI_LOG_LEVEL_BASIC) ? \
00101    log->event(log, eventName) : ESR_SUCCESS ) \
00102 
00103 
00106 #define SR_EventLogToken_AUDIO(log, loglevel, tokenName, value) \
00107   ((loglevel & OSI_LOG_LEVEL_AUDIO) ? \
00108    log->token(log, tokenName, value) : ESR_SUCCESS ) \
00109 
00110 
00113 #define SR_EventLogTokenInt_AUDIO(log, loglevel, tokenName, value)  \
00114   ((loglevel & OSI_LOG_LEVEL_AUDIO) ? \
00115    log->tokenInt(log, tokenName, value) : ESR_SUCCESS ) \
00116 
00117 
00120 #define SR_EventLogEvent_AUDIO(log, loglevel, eventName) \
00121   ((loglevel & OSI_LOG_LEVEL_AUDIO) ? \
00122    log->event(log, eventName) : ESR_SUCCESS ) \
00123 
00124 
00127 typedef struct SR_EventLog_t
00128 {
00134      ESR_ReturnCode(*destroy)(struct SR_EventLog_t* self);
00135 
00143      ESR_ReturnCode(*token)(struct SR_EventLog_t* self, const LCHAR* token, const LCHAR *value);
00144 
00152      ESR_ReturnCode(*tokenInt)(struct SR_EventLog_t* self, const LCHAR* token, int value);
00153 
00161      ESR_ReturnCode(*tokenUint16_t)(struct SR_EventLog_t* self, const LCHAR* token, asr_uint16_t value);
00162 
00170      ESR_ReturnCode(*tokenSize_t)(struct SR_EventLog_t* self, const LCHAR* token, size_t value);
00171 
00179         ESR_ReturnCode(*tokenBool)(struct SR_EventLog_t* self, const LCHAR* token, ESR_BOOL value);
00180 
00188      ESR_ReturnCode(*tokenFloat)(struct SR_EventLog_t* self, const LCHAR* token, float value);
00189 
00196      ESR_ReturnCode(*event)(struct SR_EventLog_t* self, const LCHAR* eventName);
00197 
00198 
00204      ESR_ReturnCode(*eventSession)(struct SR_EventLog_t* self);
00205 
00215      ESR_ReturnCode(*audioOpen)(struct SR_EventLog_t* self, const LCHAR* audio_type, size_t sample_rate, size_t sample_size);
00216 
00223      ESR_ReturnCode(*audioClose)(struct SR_EventLog_t* self);
00224 
00232      ESR_ReturnCode(*audioWrite)(struct SR_EventLog_t* self, void* buffer, size_t num_bytes);
00233 
00241      ESR_ReturnCode(*audioGetFilename)(struct SR_EventLog_t* self, LCHAR* waveformFilename, size_t* len);
00242 }
00243 SR_EventLog;
00244 
00250 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogCreate(SR_EventLog** self);
00251 
00257 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogDestroy(SR_EventLog* self);
00258 
00266 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogToken(SR_EventLog* self, const LCHAR* token, const LCHAR *value);
00267 
00275 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogTokenInt(SR_EventLog* self, const LCHAR* token, int value);
00276 
00284 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogTokenUint16_t(SR_EventLog* self, const LCHAR* token, asr_uint16_t value);
00285 
00293 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogTokenSize_t(SR_EventLog* self, const LCHAR* token, size_t value);
00294 
00302 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogTokenBool(SR_EventLog* self, const LCHAR* token, ESR_BOOL value);
00303 
00311 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogTokenFloat(SR_EventLog* self, const LCHAR* token, float value);
00312 
00318 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogEventSession(SR_EventLog* self);
00319 
00326 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogEvent(SR_EventLog* self, const LCHAR* eventName);
00327 
00337 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogAudioOpen(SR_EventLog* self, const LCHAR* audio_type, size_t sample_rate, size_t sample_size);
00338 
00344 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogAudioClose(SR_EventLog* self);
00345 
00353 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogAudioWrite(SR_EventLog* self, void* buffer, size_t num_bytes);
00354 
00362 SREC_EVENTLOG_API ESR_ReturnCode SR_EventLogAudioGetFilename(SR_EventLog* self, LCHAR* waveformFilename, size_t* len);
00363 
00369 #endif /* __SR_EventLog_H */

Generated on Thu May 1 15:37:25 2008 for SREC by  doxygen 1.5.3