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