| 1 | /* |
|---|
| 2 | * WengoPhone, a voice over Internet phone |
|---|
| 3 | * Copyright (C) 2004-2006 Wengo |
|---|
| 4 | * |
|---|
| 5 | * This program is free software; you can redistribute it and/or modify |
|---|
| 6 | * it under the terms of the GNU General Public License as published by |
|---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 8 | * (at your option) any later version. |
|---|
| 9 | * |
|---|
| 10 | * This program is distributed in the hope that it will be useful, |
|---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | * GNU General Public License for more details. |
|---|
| 14 | * |
|---|
| 15 | * You should have received a copy of the GNU General Public License |
|---|
| 16 | * along with this program; if not, write to the Free Software |
|---|
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|---|
| 18 | */ |
|---|
| 19 | |
|---|
| 20 | #ifndef OWWENBOXPLUGIN_H |
|---|
| 21 | #define OWWENBOXPLUGIN_H |
|---|
| 22 | |
|---|
| 23 | #include <wenbox/Wenbox.h> |
|---|
| 24 | |
|---|
| 25 | #include <util/StringList.h> |
|---|
| 26 | #include <util/Trackable.h> |
|---|
| 27 | #include <util/NonCopyable.h> |
|---|
| 28 | |
|---|
| 29 | class PhoneCall; |
|---|
| 30 | class Settings; |
|---|
| 31 | class UserProfile; |
|---|
| 32 | |
|---|
| 33 | /** |
|---|
| 34 | * Handles the Wenbox. |
|---|
| 35 | * |
|---|
| 36 | * Named WenboxPlugin rather than Wenbox since a class named Wenbox already exists. |
|---|
| 37 | * Wenbox is a USB phone device loaded at runtime via a .dll |
|---|
| 38 | * |
|---|
| 39 | * @see IWenbox |
|---|
| 40 | * @ingroup model |
|---|
| 41 | * @author Tanguy Krotoff |
|---|
| 42 | */ |
|---|
| 43 | class WenboxPlugin : NonCopyable, public Trackable { |
|---|
| 44 | public: |
|---|
| 45 | |
|---|
| 46 | /** |
|---|
| 47 | * Phone number buffer has been updated event. |
|---|
| 48 | * |
|---|
| 49 | * Example: |
|---|
| 50 | * buffer before: 0147 |
|---|
| 51 | * buffer now: 014708 |
|---|
| 52 | * |
|---|
| 53 | * @param sender this class |
|---|
| 54 | * @param phoneNumberBuffer phone number buffer |
|---|
| 55 | */ |
|---|
| 56 | Event<void (WenboxPlugin & sender, const std::string & phoneNumberBuffer)> phoneNumberBufferUpdatedEvent; |
|---|
| 57 | |
|---|
| 58 | WenboxPlugin(UserProfile & userProfile); |
|---|
| 59 | |
|---|
| 60 | ~WenboxPlugin(); |
|---|
| 61 | |
|---|
| 62 | /** |
|---|
| 63 | * @see IWenbox::setState() |
|---|
| 64 | */ |
|---|
| 65 | void setState(Wenbox::PhoneCallState state, const std::string & phoneNumber = ""); |
|---|
| 66 | |
|---|
| 67 | private: |
|---|
| 68 | |
|---|
| 69 | void openWenbox(); |
|---|
| 70 | |
|---|
| 71 | void closeWenbox(); |
|---|
| 72 | |
|---|
| 73 | void wenboxConfigChangedEventHandler(const std::string & key); |
|---|
| 74 | |
|---|
| 75 | void keyPressedEventHandler(IWenbox & sender, IWenbox::Key key); |
|---|
| 76 | |
|---|
| 77 | /** Code factorization. */ |
|---|
| 78 | PhoneCall * getActivePhoneCall() const; |
|---|
| 79 | |
|---|
| 80 | StringList getWenboxAudioDeviceId(bool outputAudioDeviceId) const; |
|---|
| 81 | |
|---|
| 82 | StringList getWenboxOutputAudioDeviceId() const; |
|---|
| 83 | |
|---|
| 84 | StringList getWenboxInputAudioDeviceId() const; |
|---|
| 85 | |
|---|
| 86 | void switchCurrentAudioDeviceToWenbox(); |
|---|
| 87 | |
|---|
| 88 | //Wenbox * _wenbox; |
|---|
| 89 | |
|---|
| 90 | UserProfile & _userProfile; |
|---|
| 91 | |
|---|
| 92 | std::string _phoneNumberBuffer; |
|---|
| 93 | }; |
|---|
| 94 | |
|---|
| 95 | #endif //OWWENBOXPLUGIN_H |
|---|