blob: 5aaaa30a8d8880bc11633ee9b8b44460f8c9610b [file] [log] [blame]
Nicolas Jager6e30ad82016-08-26 13:00:27 -04001/**************************************************************************
atraczykb724d332016-08-30 15:25:59 -04002* Copyright (C) 2016 by Savoir-faire Linux *
Nicolas Jager6e30ad82016-08-26 13:00:27 -04003* Author: Jäger Nicolas <nicolas.jager@savoirfairelinux.com> *
4* Author: Traczyk Andreas <traczyk.andreas@savoirfairelinux.com> *
atraczykb724d332016-08-30 15:25:59 -04005* *
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**************************************************************************/
atraczykb724d332016-08-30 15:25:59 -040019
20using namespace concurrency;
21
22namespace RingClientUWP
23{
24
25/* delegate */
26delegate void IncomingCall(String^ accountId, String^ callId, String^ from);
27delegate void StateChange(String^ callId, String^ state, int code);
Nicolas Jager6e30ad82016-08-26 13:00:27 -040028delegate void IncomingAccountMessage(String^ accountId, String^ from, String^ payload);
29
atraczykb724d332016-08-30 15:25:59 -040030
31public ref class RingD sealed
32{
33public:
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
54internal:
55 /* functions */
56 void startDaemon();
57 void reloadAccountList();
Nicolas Jager655df542016-08-31 10:24:47 -040058 void sendAccountTextMessage(String^ message);
atraczykb724d332016-08-30 15:25:59 -040059
60 /* TODO : move members */
61 bool hasConfig;
62 std::string accountName;
63
64 /* events */
65 event IncomingCall^ incomingCall;
66 event StateChange^ stateChange;
Nicolas Jager6e30ad82016-08-26 13:00:27 -040067 event IncomingAccountMessage^ incomingAccountMessage;
atraczykb724d332016-08-30 15:25:59 -040068
69private:
70 /* sub classes */
atraczyk4464ace2016-09-01 09:37:37 -040071 enum class Request {
72 None,
73 AddRingAccount,
74 AddSIPAccount
75 };
atraczykb724d332016-08-30 15:25:59 -040076 ref class Task
77 {
atraczyk4464ace2016-09-01 09:37:37 -040078 internal:
79 Task(Request r) { request = r; }
atraczykb724d332016-08-30 15:25:59 -040080 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 Jager32ed1a22016-08-17 08:36:02 -040093}