1 /*
2  * Presence.hpp
3  * Copyright (C) 2017  Belledonne Communications, Grenoble, France
4  *
5  * This program is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU General Public License
7  * as published by the Free Software Foundation; either version 2
8  * of the License, or (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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  *
19  *  Created on: February 2, 2017
20  *      Author: Ronan Abhamon
21  */
22 
23 #ifndef PRESENCE_H_
24 #define PRESENCE_H_
25 
26 #include <linphone++/linphone.hh>
27 #include <QObject>
28 
29 // =============================================================================
30 // A helper to get the presence level of a presence status and to get a
31 // presence status as string.
32 // =============================================================================
33 
34 class Presence : public QObject {
35   Q_OBJECT;
36 
37 public:
38   enum PresenceStatus {
39     Online = linphone::ConsolidatedPresenceOnline,
40     Busy = linphone::ConsolidatedPresenceBusy,
41     DoNotDisturb = linphone::ConsolidatedPresenceDoNotDisturb,
42     Offline = linphone::ConsolidatedPresenceOffline
43   };
44 
45   Q_ENUM(PresenceStatus);
46 
47   enum PresenceLevel {
48     Green,
49     Orange,
50     Red,
51     White
52   };
53 
54   Q_ENUM(PresenceLevel);
55 
Presence(QObject * parent=Q_NULLPTR)56   Presence (QObject *parent = Q_NULLPTR) : QObject(parent) {}
57 
58   ~Presence () = default;
59 
60   Q_INVOKABLE static PresenceLevel getPresenceLevel (const PresenceStatus &status);
61 
62   Q_INVOKABLE static QString getPresenceStatusAsString (const PresenceStatus &status);
63   Q_INVOKABLE static QString getPresenceLevelIconName (const PresenceLevel &level);
64 };
65 
66 #endif // PRESENCE_H_
67