OPAL Version 3.10.4

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files

- File List
- Globals

lidpluginmgr.h
Go to the documentation of this file.
1 /*
2 * lidpluginmgr.h
3 *
4 * Line Interface Device plugins manager
5 *
6 * Open Phone Abstraction Library (OPAL)
7 * Formally known as the Open H323 project.
8 *
9 * Copyright (C) 2005 Post Increment
10 *
11 * The contents of this file are subject to the Mozilla Public License
12 * Version 1.0 (the "License"); you may not use this file except in
13 * compliance with the License. You may obtain a copy of the License at
14 * http://www.mozilla.org/MPL/
15 *
16 * Software distributed under the License is distributed on an "AS IS"
17 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
18 * the License for the specific language governing rights and limitations
19 * under the License.
20 *
21 * The Original Code is Open Phone Abstraction Library.
22 *
23 * The Initial Developer of the Original Code is Post Increment
24 *
25 * Contributor(s): ______________________________________.
26 *
27 * $Revision: 24178 $
28 * $Author: rjongbloed $
29 * $Date: 2010-04-05 19:10:56 -0500 (Mon, 05 Apr 2010) $
30 */
31
32 #ifndef OPAL_LIDS_LIDPLUGINMGR_H
33 #define OPAL_LIDS_LIDPLUGINMGR_H
34
35 #ifdef P_USE_PRAGMA
36 #pragma interface
37 #endif
38
39 #include <opal/buildopts.h>
40
41 #include <ptlib/pluginmgr.h>
42 #include <ptlib/sound.h>
43 #include <lids/lidplugin.h>
44 #include <lids/lid.h>
45
46
47
48 class OpalPluginLIDRegistration : public OpalLIDRegistration
49 {
50 public:
51 OpalPluginLIDRegistration(const PluginLID_Definition & definition);
52
53 OpalLineInterfaceDevice * Create(void * param) const;
54
55 private:
56 PluginLID_Definition m_definition;
57 };
58
59
60 class OpalPluginLIDManager : public PPluginModuleManager
61 {
62 PCLASSINFO(OpalPluginLIDManager, PPluginModuleManager);
63 public:
64 OpalPluginLIDManager(PPluginManager * pluginMgr = NULL);
65 ~OpalPluginLIDManager();
66
67 virtual void OnLoadPlugin(PDynaLink & dll, INT code);
68 virtual void OnShutdown();
69
70 protected:
71 PList<OpalPluginLIDRegistration> m_registrations;
72 };
73
74
75
76 class OpalPluginLID : public OpalLineInterfaceDevice
77 {
78 PCLASSINFO(OpalPluginLID, OpalLineInterfaceDevice);
79 public:
80 OpalPluginLID(const PluginLID_Definition & definition);
81 ~OpalPluginLID();
82
85 virtual PBoolean Open(
86 const PString & device
87 );
88
91 virtual PBoolean Close();
92
96 virtual PString GetDeviceType() const;
97
102 virtual PString GetDeviceName() const;
103
106 virtual PStringArray GetAllNames() const;
107
113 virtual PString GetDescription() const;
114
117 virtual unsigned GetLineCount() const;
118
125 virtual PBoolean IsLineTerminal(
126 unsigned line
127 );
128
129
132 virtual PBoolean IsLinePresent(
133 unsigned line,
134 PBoolean force = false
135 );
136
137
143 virtual PBoolean IsLineOffHook(
144 unsigned line
145 );
146
152 virtual PBoolean SetLineOffHook(
153 unsigned line,
154 PBoolean newState = true
155 );
156
160 virtual PBoolean HookFlash(
161 unsigned line,
162 unsigned flashTime = 200
163 );
164
167 virtual PBoolean HasHookFlash(unsigned line);
168
169
180 virtual PBoolean IsLineRinging(
181 unsigned line,
182 DWORD * cadence = NULL
183 );
184
199 virtual PBoolean RingLine(
200 unsigned line,
201 PINDEX nCadence,
202 const unsigned * pattern = NULL,
203 unsigned frequency = 400
204 );
205
206
217 virtual PBoolean SetLineConnected(
218 unsigned line
219 );
220
228 virtual PBoolean IsLineConnected(
229 unsigned line
230 );
231
232
239 virtual PBoolean IsLineDisconnected(
240 unsigned line,
241 PBoolean checkForWink = true
242 );
243
244
247 virtual PBoolean SetLineToLineDirect(
248 unsigned line1,
249 unsigned line2,
250 PBoolean connect
251 );
252
255 virtual PBoolean IsLineToLineDirect(
256 unsigned line1,
257 unsigned line2
258 );
259
260
263 virtual OpalMediaFormatList GetMediaFormats() const;
264
267 virtual PBoolean SetReadFormat(
268 unsigned line,
269 const OpalMediaFormat & mediaFormat
270 );
271
274 virtual PBoolean SetWriteFormat(
275 unsigned line,
276 const OpalMediaFormat & mediaFormat
277 );
278
281 virtual OpalMediaFormat GetReadFormat(
282 unsigned line
283 );
284
287 virtual OpalMediaFormat GetWriteFormat(
288 unsigned line
289 );
290
293 virtual PBoolean StopReading(
294 unsigned line
295 );
296
299 virtual PBoolean StopWriting(
300 unsigned line
301 );
302
307 virtual PBoolean SetReadFrameSize(
308 unsigned line,
309 PINDEX frameSize
310 );
311
316 virtual PBoolean SetWriteFrameSize(
317 unsigned line,
318 PINDEX frameSize
319 );
320
324 virtual PINDEX GetReadFrameSize(
325 unsigned line
326 );
327
331 virtual PINDEX GetWriteFrameSize(
332 unsigned line
333 );
334
337 virtual PBoolean ReadFrame(
338 unsigned line,
339 void * buf,
340 PINDEX & count
341 );
342
345 virtual PBoolean WriteFrame(
346 unsigned line,
347 const void * buf,
348 PINDEX count,
349 PINDEX & written
350 );
351
352
355 virtual unsigned GetAverageSignalLevel(
356 unsigned line,
357 PBoolean playback
358 );
359
360
363 virtual PBoolean EnableAudio(
364 unsigned line,
365 PBoolean enable = true
366 );
367
370 virtual PBoolean IsAudioEnabled(
371 unsigned line
372 ) const;
373
374
379 virtual PBoolean SetRecordVolume(
380 unsigned line,
381 unsigned volume
382 );
383
388 virtual PBoolean SetPlayVolume(
389 unsigned line,
390 unsigned volume
391 );
392
397 virtual PBoolean GetRecordVolume(
398 unsigned line,
399 unsigned & volume
400 );
401
406 virtual PBoolean GetPlayVolume(
407 unsigned line,
408 unsigned & volume
409 );
410
411
415 virtual AECLevels GetAEC(
416 unsigned line
417 ) const;
418
422 virtual PBoolean SetAEC(
423 unsigned line,
424 AECLevels level
425 );
426
430 virtual PBoolean GetVAD(
431 unsigned line
432 ) const;
433
437 virtual PBoolean SetVAD(
438 unsigned line,
439 PBoolean enable
440 );
441
442
456 virtual PBoolean GetCallerID(
457 unsigned line,
458 PString & idString,
459 PBoolean full = false
460 );
461
483 virtual PBoolean SetCallerID(
484 unsigned line,
485 const PString & idString
486 );
487
490 virtual PBoolean SendVisualMessageWaitingIndicator(
491 unsigned line,
492 PBoolean on
493 );
494
495
499 virtual PBoolean PlayDTMF(
500 unsigned line,
501 const char * digits,
502 DWORD onTime = DefaultDTMFOnTime,
503 DWORD offTime = DefaultDTMFOffTime
504 );
505
515 virtual char ReadDTMF(
516 unsigned line
517 );
518
523 virtual PBoolean GetRemoveDTMF(
524 unsigned line
525 );
526
531 virtual PBoolean SetRemoveDTMF(
532 unsigned line,
533 PBoolean removeTones
534 );
535
536
539 virtual CallProgressTones IsToneDetected(
540 unsigned line
541 );
542
545 virtual CallProgressTones WaitForToneDetect(
546 unsigned line,
547 unsigned timeout = 3000
548 );
549
552 virtual PBoolean WaitForTone(
553 unsigned line,
554 CallProgressTones tone,
555 unsigned timeout = 3000
556 );
557
560 virtual bool SetToneParameters(
561 unsigned line,
562 CallProgressTones tone,
563 unsigned frequency1,
564 unsigned frequency2,
565 ToneMixingModes mode,
566 PINDEX numCadences,
567 const unsigned * onTimes,
568 const unsigned * offTimes
569 );
570
573 virtual PBoolean PlayTone(
574 unsigned line,
575 CallProgressTones tone
576 );
577
580 virtual PBoolean IsTonePlaying(
581 unsigned line
582 );
583
586 virtual PBoolean StopTone(
587 unsigned line
588 );
589
590
606 virtual CallProgressTones DialOut(
607 unsigned line,
608 const PString & number,
609 const DialParams & params = DialParams()
610 );
611
612
616 virtual unsigned GetWinkDuration(
617 unsigned line
618 );
619
623 virtual PBoolean SetWinkDuration(
624 unsigned line,
625 unsigned winkDuration
626 );
627
633 virtual PBoolean SetCountryCode(
634 T35CountryCodes country
635 );
636
639 virtual PStringList GetCountryCodeNameList() const;
640
641
642
643 protected:
644 PDECLARE_NOTIFIER(PThread, OpalPluginLID, TonePlayer);
645 bool StartTonePlayerThread(int tone);
646 void StopTonePlayerThread();
647
648 #if PTRACING
649 bool BadContext() const;
650 bool BadFunction(void * fnPtr, const char * fnName) const;
651 PluginLID_Errors CheckError(PluginLID_Errors error, const char * fnName) const;
652 #endif
653
654 const PluginLID_Definition & m_definition;
655 void * m_context;
656 PString m_deviceName;
657
658 PSoundChannel m_recorder;
659 PSoundChannel m_player;
660 PThread * m_tonePlayer;
661 PSyncPoint m_stopTone;
662 bool m_lockOutTones;
663 };
664
665
666 PFACTORY_LOAD(OpalPluginLIDManager);
667
668
669 #endif // OPAL_LIDS_LIDPLUGINMGR_H