• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*---------------------------------------------------------------------------*
2  *  EventLog.c  *
3  *                                                                           *
4  *  Copyright 2007, 2008 Nuance Communciations, Inc.                               *
5  *                                                                           *
6  *  Licensed under the Apache License, Version 2.0 (the 'License');          *
7  *  you may not use this file except in compliance with the License.         *
8  *                                                                           *
9  *  You may obtain a copy of the License at                                  *
10  *      http://www.apache.org/licenses/LICENSE-2.0                           *
11  *                                                                           *
12  *  Unless required by applicable law or agreed to in writing, software      *
13  *  distributed under the License is distributed on an 'AS IS' BASIS,        *
14  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
15  *  See the License for the specific language governing permissions and      *
16  *  limitations under the License.                                           *
17  *                                                                           *
18  *---------------------------------------------------------------------------*/
19 
20 #include "SR_EventLog.h"
21 #include "SR_EventLogImpl.h"
22 #include "pmemory.h"
23 #include "plog.h"
24 
25 
SR_EventLogDestroy(SR_EventLog * self)26 ESR_ReturnCode SR_EventLogDestroy(SR_EventLog* self)
27 {
28   if (self == NULL)
29   {
30     PLogError(L("ESR_INVALID_ARGUMENT"));
31     return ESR_INVALID_ARGUMENT;
32   }
33   return self->destroy(self);
34 }
35 
SR_EventLogToken(SR_EventLog * self,const LCHAR * token,const LCHAR * value)36 ESR_ReturnCode SR_EventLogToken(SR_EventLog* self, const LCHAR* token, const LCHAR *value)
37 {
38   if (self == NULL)
39   {
40     PLogError(L("ESR_INVALID_ARGUMENT"));
41     return ESR_INVALID_ARGUMENT;
42   }
43   return self->token(self, token, value);
44 }
45 
SR_EventLogTokenInt(SR_EventLog * self,const LCHAR * token,int value)46 ESR_ReturnCode SR_EventLogTokenInt(SR_EventLog* self, const LCHAR* token, int value)
47 {
48   if (self == NULL)
49   {
50     PLogError(L("ESR_INVALID_ARGUMENT"));
51     return ESR_INVALID_ARGUMENT;
52   }
53   return self->tokenInt(self, token, value);
54 }
55 
SR_EventLogTokenPointer(SR_EventLog * self,const LCHAR * token,void * value)56 ESR_ReturnCode SR_EventLogTokenPointer(SR_EventLog* self, const LCHAR* token, void* value)
57 {
58   if (self == NULL)
59   {
60     PLogError(L("ESR_INVALID_ARGUMENT"));
61     return ESR_INVALID_ARGUMENT;
62   }
63   return self->tokenPointer(self, token, value);
64 }
65 
SR_EventLogTokenUint16_t(SR_EventLog * self,const LCHAR * token,asr_uint16_t value)66 ESR_ReturnCode SR_EventLogTokenUint16_t(SR_EventLog* self, const LCHAR* token, asr_uint16_t value)
67 {
68   if (self == NULL)
69   {
70     PLogError(L("ESR_INVALID_ARGUMENT"));
71     return ESR_INVALID_ARGUMENT;
72   }
73   return self->tokenUint16_t(self, token, value);
74 }
75 
SR_EventLogTokenSize_t(SR_EventLog * self,const LCHAR * token,size_t value)76 ESR_ReturnCode SR_EventLogTokenSize_t(SR_EventLog* self, const LCHAR* token, size_t value)
77 {
78   if (self == NULL)
79   {
80     PLogError(L("ESR_INVALID_ARGUMENT"));
81     return ESR_INVALID_ARGUMENT;
82   }
83   return self->tokenSize_t(self, token, value);
84 }
85 
SR_EventLogTokenBool(SR_EventLog * self,const LCHAR * token,ESR_BOOL value)86 ESR_ReturnCode SR_EventLogTokenBool(SR_EventLog* self, const LCHAR* token, ESR_BOOL value)
87 {
88   if (self == NULL)
89   {
90     PLogError(L("ESR_INVALID_ARGUMENT"));
91     return ESR_INVALID_ARGUMENT;
92   }
93   return self->tokenBool(self, token, value);
94 }
95 
SR_EventLogTokenFloat(SR_EventLog * self,const LCHAR * token,float value)96 ESR_ReturnCode SR_EventLogTokenFloat(SR_EventLog* self, const LCHAR* token, float value)
97 {
98   if (self == NULL)
99   {
100     PLogError(L("ESR_INVALID_ARGUMENT"));
101     return ESR_INVALID_ARGUMENT;
102   }
103   return self->tokenFloat(self, token, value);
104 }
105 
SR_EventLogEventSession(SR_EventLog * self)106 ESR_ReturnCode SR_EventLogEventSession(SR_EventLog* self)
107 {
108   if (self == NULL)
109   {
110     PLogError(L("ESR_INVALID_ARGUMENT"));
111     return ESR_INVALID_ARGUMENT;
112   }
113   return self->eventSession(self);
114 }
115 
SR_EventLogEvent(SR_EventLog * self,const LCHAR * eventName)116 ESR_ReturnCode SR_EventLogEvent(SR_EventLog* self, const LCHAR *eventName)
117 {
118   if (self == NULL)
119   {
120     PLogError(L("ESR_INVALID_ARGUMENT"));
121     return ESR_INVALID_ARGUMENT;
122   }
123   return self->event(self, eventName);
124 }
125 
SR_EventLogAudioOpen(SR_EventLog * self,const LCHAR * audio_type,size_t sample_rate,size_t sample_size)126 ESR_ReturnCode SR_EventLogAudioOpen(SR_EventLog* self, const LCHAR* audio_type, size_t sample_rate, size_t sample_size)
127 {
128   if (self == NULL)
129   {
130     PLogError(L("ESR_INVALID_ARGUMENT"));
131     return ESR_INVALID_ARGUMENT;
132   }
133   return self->audioOpen(self, audio_type, sample_rate, sample_size);
134 }
135 
SR_EventLogAudioClose(SR_EventLog * self)136 ESR_ReturnCode SR_EventLogAudioClose(SR_EventLog* self)
137 {
138   if (self == NULL)
139   {
140     PLogError(L("ESR_INVALID_ARGUMENT"));
141     return ESR_INVALID_ARGUMENT;
142   }
143   return self->audioClose(self);
144 }
145 
SR_EventLogAudioWrite(SR_EventLog * self,void * buffer,size_t num_bytes)146 ESR_ReturnCode SR_EventLogAudioWrite(SR_EventLog* self, void* buffer, size_t num_bytes)
147 {
148   if (self == NULL)
149   {
150     PLogError(L("ESR_INVALID_ARGUMENT"));
151     return ESR_INVALID_ARGUMENT;
152   }
153   return self->audioWrite(self, buffer, num_bytes);
154 }
155 
SR_EventLogAudioGetFilename(SR_EventLog * self,LCHAR * waveformFilename,size_t * len)156 ESR_ReturnCode SR_EventLogAudioGetFilename(SR_EventLog* self, LCHAR* waveformFilename, size_t* len)
157 {
158   if (self == NULL)
159   {
160     PLogError(L("ESR_INVALID_ARGUMENT"));
161     return ESR_INVALID_ARGUMENT;
162   }
163   return self->audioGetFilename(self, waveformFilename, len);
164 }
165