00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 #ifndef __OPAL_LIDPLUGIN_H
00050 #define __OPAL_LIDPLUGIN_H
00051
00052 #ifdef __cplusplus
00053 extern "C" {
00054 #endif
00055
00056 #include <time.h>
00057
00058 #ifdef _WIN32
00059 # ifdef PLUGIN_DLL_EXPORTS
00060 # define PLUGIN_DLL_API __declspec(dllexport)
00061 # else
00062 # define PLUGIN_DLL_API __declspec(dllimport)
00063 # endif
00064
00065 #else
00066
00067 #define PLUGIN_DLL_API
00068
00069 #endif
00070
00071 #ifdef PWLIB_PLUGIN_API_VERSION
00072 #undef PWLIB_PLUGIN_API_VERSION
00073 #endif
00074 #define PWLIB_PLUGIN_API_VERSION 1
00075
00077
00078
00079
00080 #define PLUGIN_LID_VERSION 1 // initial version
00081
00082 typedef int PluginLID_Boolean;
00083
00084 #ifndef FALSE
00085 #define FALSE 0
00086 #endif
00087 #ifndef TRUE
00088 #define TRUE 1
00089 #endif
00090
00091
00092 typedef enum PluginLID_Errors {
00093 PluginLID_NoError = 0,
00094 PluginLID_UnimplementedFunction,
00095 PluginLID_BadContext,
00096 PluginLID_InvalidParameter,
00097 PluginLID_NoSuchDevice,
00098 PluginLID_DeviceOpenFailed,
00099 PluginLID_UsesSoundChannel,
00100 PluginLID_DeviceNotOpen,
00101 PluginLID_NoSuchLine,
00102 PluginLID_OperationNotAllowed,
00103 PluginLID_NoMoreNames,
00104 PluginLID_BufferTooSmall,
00105 PluginLID_UnsupportedMediaFormat,
00106 PluginLID_NoDialTone,
00107 PluginLID_LineBusy,
00108 PluginLID_NoAnswer,
00109 PluginLID_Aborted,
00110 PluginLID_InternalError,
00111 PluginLID_NumErrors
00112 } PluginLID_Errors;
00113
00114
00115 enum PluginLID_CallProgressTones {
00116 PluginLID_NoTone = 0x00,
00117 PluginLID_DialTone = 0x01,
00118 PluginLID_RingTone = 0x02,
00119 PluginLID_BusyTone = 0x04,
00120 PluginLID_FastBusyTone = 0x08,
00121 PluginLID_ClearTone = 0x10,
00122 PluginLID_CNGTone = 0x20,
00123 PluginLID_MwiTone = 0x40,
00124 PluginLID_AllTones = 0x4f
00125 };
00126
00127
00128 typedef struct PluginLID_Definition
00129 {
00130 unsigned int apiVersion;
00131
00132
00133 time_t timestamp;
00134
00135 const char * name;
00136 const char * description;
00137 const char * manufacturer;
00138 const char * model;
00139 const char * revision;
00140 const char * manufacturerEmail;
00141 const char * manufacturerURL;
00142
00143 const char * author;
00144 const char * authorEmail;
00145 const char * authorURL;
00146 const char * copyright;
00147 const char * license;
00148 const char * version;
00149
00150 const void * userData;
00151
00152 void * (*Create)(const struct PluginLID_Definition * definition);
00153 void (*Destroy)(const struct PluginLID_Definition * definition, void * context);
00154
00155 PluginLID_Errors (*GetDeviceName)(void * context, unsigned index, char * name, unsigned size);
00156 PluginLID_Errors (*Open)(void * context, const char * device);
00157 PluginLID_Errors (*Close)(void * context);
00158
00159 PluginLID_Errors (*GetLineCount)(void * context, unsigned * count);
00160 PluginLID_Errors (*IsLineTerminal)(void * context, unsigned line, PluginLID_Boolean * isTerminal);
00161 PluginLID_Errors (*IsLinePresent)(void * context, unsigned line, PluginLID_Boolean forceTest, PluginLID_Boolean * present);
00162 PluginLID_Errors (*IsLineOffHook)(void * context, unsigned line, PluginLID_Boolean * offHook);
00163 PluginLID_Errors (*SetLineOffHook)(void * context, unsigned line, PluginLID_Boolean newState);
00164 PluginLID_Errors (*HookFlash)(void * context, unsigned line, unsigned flashTime);
00165 PluginLID_Errors (*HasHookFlash)(void * context, unsigned line, PluginLID_Boolean * flashed);
00166 PluginLID_Errors (*IsLineRinging)(void * context, unsigned line, unsigned long * cadence);
00167 PluginLID_Errors (*RingLine)(void * context, unsigned line, unsigned nCadence, const unsigned * pattern, unsigned frequency);
00168 PluginLID_Errors (*IsLineConnected)(void * context, unsigned line, PluginLID_Boolean checkForWink, PluginLID_Boolean * connected);
00169 PluginLID_Errors (*SetLineToLineDirect)(void * context, unsigned line1, unsigned line2, PluginLID_Boolean connect);
00170 PluginLID_Errors (*IsLineToLineDirect)(void * context, unsigned line1, unsigned line2, PluginLID_Boolean * connected);
00171
00172 PluginLID_Errors (*GetSupportedFormat)(void * context, unsigned index, char * mediaFormat, unsigned size);
00173 PluginLID_Errors (*SetReadFormat)(void * context, unsigned line, const char * mediaFormat);
00174 PluginLID_Errors (*SetWriteFormat)(void * context, unsigned line, const char * mediaFormat);
00175 PluginLID_Errors (*GetReadFormat)(void * context, unsigned line, char * mediaFormat, unsigned size);
00176 PluginLID_Errors (*GetWriteFormat)(void * context, unsigned line, char * mediaFormat, unsigned size);
00177 PluginLID_Errors (*StopReading)(void * context, unsigned line);
00178 PluginLID_Errors (*StopWriting)(void * context, unsigned line);
00179 PluginLID_Errors (*SetReadFrameSize)(void * context, unsigned line, unsigned frameSize);
00180 PluginLID_Errors (*SetWriteFrameSize)(void * context, unsigned line, unsigned frameSize);
00181 PluginLID_Errors (*GetReadFrameSize)(void * context, unsigned line, unsigned * frameSize);
00182 PluginLID_Errors (*GetWriteFrameSize)(void * context, unsigned line, unsigned * frameSize);
00183 PluginLID_Errors (*ReadFrame)(void * context, unsigned line, void * buffer, unsigned * count);
00184 PluginLID_Errors (*WriteFrame)(void * context, unsigned line, const void * buffer, unsigned count, unsigned * written);
00185
00186 PluginLID_Errors (*GetAverageSignalLevel)(void * context, unsigned line, PluginLID_Boolean playback, unsigned * signal);
00187
00188 PluginLID_Errors (*EnableAudio)(void * context, unsigned line, PluginLID_Boolean enable);
00189 PluginLID_Errors (*IsAudioEnabled)(void * context, unsigned line, PluginLID_Boolean * enable);
00190 PluginLID_Errors (*SetRecordVolume)(void * context, unsigned line, unsigned volume);
00191 PluginLID_Errors (*SetPlayVolume)(void * context, unsigned line, unsigned volume);
00192 PluginLID_Errors (*GetRecordVolume)(void * context, unsigned line, unsigned * volume);
00193 PluginLID_Errors (*GetPlayVolume)(void * context, unsigned line, unsigned * volume);
00194
00195 PluginLID_Errors (*GetAEC)(void * context, unsigned line, unsigned * level);
00196 PluginLID_Errors (*SetAEC)(void * context, unsigned line, unsigned level);
00197
00198 PluginLID_Errors (*GetVAD)(void * context, unsigned line, PluginLID_Boolean * enable);
00199 PluginLID_Errors (*SetVAD)(void * context, unsigned line, PluginLID_Boolean enable);
00200
00201 PluginLID_Errors (*GetCallerID)(void * context, unsigned line, char * idString, unsigned size, PluginLID_Boolean full);
00202 PluginLID_Errors (*SetCallerID)(void * context, unsigned line, const char * idString);
00203 PluginLID_Errors (*SendCallerIDOnCallWaiting)(void * context, unsigned line, const char * idString);
00204 PluginLID_Errors (*SendVisualMessageWaitingIndicator)(void * context, unsigned line, PluginLID_Boolean on);
00205
00206 PluginLID_Errors (*PlayDTMF)(void * context, unsigned line, const char * digits, unsigned onTime, unsigned offTime);
00207 PluginLID_Errors (*ReadDTMF)(void * context, unsigned line, char * digit);
00208 PluginLID_Errors (*GetRemoveDTMF)(void * context, unsigned line, PluginLID_Boolean * removeTones);
00209 PluginLID_Errors (*SetRemoveDTMF)(void * context, unsigned line, PluginLID_Boolean removeTones);
00210
00211 PluginLID_Errors (*IsToneDetected)(void * context, unsigned line, int * tone);
00212 PluginLID_Errors (*WaitForToneDetect)(void * context, unsigned line, unsigned timeout, int * tone);
00213 PluginLID_Errors (*WaitForTone)(void * context, unsigned line, int tone, unsigned timeout);
00214
00215 PluginLID_Errors (*SetToneFilterParameters)(void * context, unsigned line,
00216 unsigned tone,
00217 unsigned lowFrequency,
00218 unsigned highFrequency,
00219 unsigned numCadences,
00220 const unsigned * onTimes,
00221 const unsigned * offTimes);
00222 PluginLID_Errors (*PlayTone)(void * context, unsigned line, unsigned tone);
00223 PluginLID_Errors (*IsTonePlaying)(void * context, unsigned line, PluginLID_Boolean * playing);
00224 PluginLID_Errors (*StopTone)(void * context, unsigned line);
00225
00226 PluginLID_Errors (*DialOut)(void * context, unsigned line, const char * number, PluginLID_Boolean requireTones, unsigned uiDialDelay);
00227
00228 PluginLID_Errors (*GetWinkDuration)(void * context, unsigned line, unsigned * winkDuration);
00229 PluginLID_Errors (*SetWinkDuration)(void * context, unsigned line, unsigned winkDuration);
00230
00231 PluginLID_Errors (*SetCountryCode)(void * context, unsigned country);
00232
00233 PluginLID_Errors (*GetSupportedCountry)(void * context, unsigned index, unsigned * countryCode);
00234
00235 } PluginLID_Definition;
00236
00237
00238 #ifdef __cplusplus
00239
00240 #define PLUGIN_LID_CTOR() \
00241 static void * Create(const struct PluginLID_Definition * definition) { return new Context; } \
00242 Context()
00243
00244 #define PLUGIN_LID_DTOR() \
00245 static void Destroy(const struct PluginLID_Definition * definition, void * context) { delete (Context *)context; } \
00246 ~Context()
00247
00248 #define PLUGIN_FUNCTION_ARG0(fn) \
00249 static PluginLID_Errors fn(void * context) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(); } \
00250 PluginLID_Errors fn( )
00251
00252 #define PLUGIN_FUNCTION_ARG0(fn) \
00253 static PluginLID_Errors fn(void * context) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(); } \
00254 PluginLID_Errors fn( )
00255
00256 #define PLUGIN_FUNCTION_ARG1(fn, type1,var1) \
00257 static PluginLID_Errors fn(void * context, type1 var1) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1); } \
00258 PluginLID_Errors fn( type1 var1)
00259
00260 #define PLUGIN_FUNCTION_ARG2(fn, type1,var1, type2,var2) \
00261 static PluginLID_Errors fn(void * context, type1 var1, type2 var2) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1, var2); } \
00262 PluginLID_Errors fn( type1 var1, type2 var2)
00263
00264 #define PLUGIN_FUNCTION_ARG3(fn, type1,var1, type2,var2, type3,var3) \
00265 static PluginLID_Errors fn(void * context, type1 var1, type2 var2, type3 var3) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1, var2, var3); } \
00266 PluginLID_Errors fn( type1 var1, type2 var2, type3 var3)
00267
00268 #define PLUGIN_FUNCTION_ARG4(fn, type1,var1, type2,var2, type3,var3, type4,var4) \
00269 static PluginLID_Errors fn(void * context, type1 var1, type2 var2, type3 var3, type4 var4) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1, var2, var3, var4); } \
00270 PluginLID_Errors fn( type1 var1, type2 var2, type3 var3, type4 var4)
00271
00272 #define PLUGIN_FUNCTION_ARG7(fn, type1,var1, type2,var2, type3,var3, type4,var4, type5,var5, type6,var6, type7,var7) \
00273 static PluginLID_Errors fn(void * context, type1 var1, type2 var2, type3 var3, type4 var4, type5 var5, type6 var6, type7 var7) { return context == NULL ? PluginLID_BadContext : ((Context *)context)->fn(var1, var2, var3, var4, var5, var6, var7); } \
00274 PluginLID_Errors fn( type1 var1, type2 var2, type3 var3, type4 var4, type5 var5, type6 var6, type7 var7)
00275
00276 #endif // __cplusplus
00277
00278
00279 #define PLUGIN_LID_API_VER_FN PWLibPlugin_GetAPIVersion
00280 #define PLUGIN_LID_API_VER_FN_STR "PWLibPlugin_GetAPIVersion"
00281
00282 #define PLUGIN_LID_GET_LIDS_FN OpalPluginLID_GetDefinitions
00283 #define PLUGIN_LID_GET_LIDS_FN_STR "OpalPluginLID_GetDefinitions"
00284
00285
00286 typedef struct PluginLID_Definition * (* PluginLID_GetDefinitionsFunction)(unsigned * , unsigned );
00287
00288
00289 #define PLUGIN_LID_IMPLEMENTATION(defs) \
00290 extern "C" { \
00291 PLUGIN_DLL_API unsigned int PLUGIN_LID_API_VER_FN() { return PWLIB_PLUGIN_API_VERSION; } \
00292 PLUGIN_DLL_API PluginLID_Definition * PLUGIN_LID_GET_LIDS_FN(unsigned * count, unsigned version) \
00293 { *count = sizeof(defs)/sizeof(defs[0]); return defs; } \
00294 }
00295
00296
00297 #ifdef __cplusplus
00298 };
00299 #endif
00300
00301 #endif // __OPAL_LIDPLUGIN_H