Nicolas Jager | 6e30ad8 | 2016-08-26 13:00:27 -0400 | [diff] [blame] | 1 | /**************************************************************************
|
atraczyk | b724d33 | 2016-08-30 15:25:59 -0400 | [diff] [blame] | 2 | * Copyright (C) 2016 by Savoir-faire Linux *
|
Nicolas Jager | 6e30ad8 | 2016-08-26 13:00:27 -0400 | [diff] [blame] | 3 | * Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
|
| 4 | * Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
|
atraczyk | b724d33 | 2016-08-30 15:25:59 -0400 | [diff] [blame] | 5 | * *
|
| 6 | * This program is free software; you can redistribute it and/or modify *
|
| 7 | * it under the terms of the GNU General Public License as published by *
|
| 8 | * the Free Software Foundation; either version 3 of the License, or *
|
| 9 | * (at your option) any later version. *
|
| 10 | * *
|
| 11 | * This program is distributed in the hope that it will be useful, *
|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
| 14 | * GNU General Public License for more details. *
|
| 15 | * *
|
| 16 | * You should have received a copy of the GNU General Public License *
|
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
| 18 | **************************************************************************/
|
atraczyk | b724d33 | 2016-08-30 15:25:59 -0400 | [diff] [blame] | 19 |
|
| 20 | using namespace concurrency;
|
| 21 |
|
| 22 | namespace RingClientUWP
|
| 23 | {
|
| 24 |
|
| 25 | /* delegate */
|
| 26 | delegate void IncomingCall(String^ accountId, String^ callId, String^ from);
|
| 27 | delegate void StateChange(String^ callId, String^ state, int code);
|
Nicolas Jager | 6e30ad8 | 2016-08-26 13:00:27 -0400 | [diff] [blame] | 28 | delegate void IncomingAccountMessage(String^ accountId, String^ from, String^ payload);
|
| 29 |
|
atraczyk | b724d33 | 2016-08-30 15:25:59 -0400 | [diff] [blame] | 30 |
|
| 31 | public ref class RingD sealed
|
| 32 | {
|
| 33 | public:
|
| 34 | /* functions */
|
| 35 |
|
| 36 | /* properties */
|
| 37 | static property RingD^ instance
|
| 38 | {
|
| 39 | RingD^ get()
|
| 40 | {
|
| 41 | static RingD^ instance_ = ref new RingD();
|
| 42 | return instance_;
|
| 43 | }
|
| 44 | }
|
| 45 |
|
| 46 | property bool daemonRunning
|
| 47 | {
|
| 48 | bool get()
|
| 49 | {
|
| 50 | return daemonRunning_;
|
| 51 | }
|
| 52 | }
|
| 53 |
|
| 54 | internal:
|
| 55 | /* functions */
|
| 56 | void startDaemon();
|
| 57 | void reloadAccountList();
|
Nicolas Jager | 655df54 | 2016-08-31 10:24:47 -0400 | [diff] [blame] | 58 | void sendAccountTextMessage(String^ message);
|
atraczyk | b724d33 | 2016-08-30 15:25:59 -0400 | [diff] [blame] | 59 |
|
| 60 | /* TODO : move members */
|
| 61 | bool hasConfig;
|
| 62 | std::string accountName;
|
| 63 |
|
| 64 | /* events */
|
| 65 | event IncomingCall^ incomingCall;
|
| 66 | event StateChange^ stateChange;
|
Nicolas Jager | 6e30ad8 | 2016-08-26 13:00:27 -0400 | [diff] [blame] | 67 | event IncomingAccountMessage^ incomingAccountMessage;
|
atraczyk | b724d33 | 2016-08-30 15:25:59 -0400 | [diff] [blame] | 68 |
|
| 69 | private:
|
| 70 | /* sub classes */
|
atraczyk | 4464ace | 2016-09-01 09:37:37 -0400 | [diff] [blame^] | 71 | enum class Request {
|
| 72 | None,
|
| 73 | AddRingAccount,
|
| 74 | AddSIPAccount
|
| 75 | };
|
atraczyk | b724d33 | 2016-08-30 15:25:59 -0400 | [diff] [blame] | 76 | ref class Task
|
| 77 | {
|
atraczyk | 4464ace | 2016-09-01 09:37:37 -0400 | [diff] [blame^] | 78 | internal:
|
| 79 | Task(Request r) { request = r; }
|
atraczyk | b724d33 | 2016-08-30 15:25:59 -0400 | [diff] [blame] | 80 | public:
|
| 81 | property Request request;
|
| 82 | };
|
| 83 |
|
| 84 | /* functions */
|
| 85 | RingD(); // singleton
|
| 86 | void dequeueTasks();
|
| 87 |
|
| 88 | /* members */
|
| 89 | std::string localFolder_;
|
| 90 | bool daemonRunning_ = false;
|
| 91 | std::queue<Task^> tasksList_;
|
| 92 | };
|
Nicolas Jager | 32ed1a2 | 2016-08-17 08:36:02 -0400 | [diff] [blame] | 93 | } |