participant-device.h 2.54 KB
Newer Older
1 2
/*
 * participant-device.h
3
 * Copyright (C) 2010-2018 Belledonne Communications SARL
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

20 21
#ifndef _L_PARTICIPANT_DEVICE_H_
#define _L_PARTICIPANT_DEVICE_H_
22 23 24

#include <string>

25
#include "address/identity-address.h"
26

27
#include "linphone/types.h"
28 29 30 31 32 33
#include "linphone/utils/general.h"

// =============================================================================

LINPHONE_BEGIN_NAMESPACE

34
class CallSession;
35
class Core;
36
class Participant;
37

38 39
class ParticipantDevice {
public:
40 41 42 43 44 45 46
	enum class State {
		Joining,
		Present,
		Leaving,
		Left
	};

47
	ParticipantDevice ();
48
	explicit ParticipantDevice (Participant *participant, const IdentityAddress &gruu);
49
	virtual ~ParticipantDevice ();
50 51 52

	bool operator== (const ParticipantDevice &device) const;

53 54
	std::shared_ptr<Core> getCore () const;

55
	inline const IdentityAddress &getAddress () const { return mGruu; }
56
	Participant *getParticipant () const { return mParticipant; }
57 58
	inline std::shared_ptr<CallSession> getSession () const { return mSession; }
	inline void setSession (std::shared_ptr<CallSession> session) { mSession = session; }
59 60
	inline State getState () const { return mState; }
	inline void setState (State newState) { mState = newState; }
61

62 63 64 65
	inline bool isSubscribedToConferenceEventPackage () const { return mConferenceSubscribeEvent != nullptr; }
	LinphoneEvent *getConferenceSubscribeEvent () const { return mConferenceSubscribeEvent; }
	void setConferenceSubscribeEvent (LinphoneEvent *ev);

66
	bool isValid () const { return mGruu.isValid(); }
67 68

private:
69
	Participant *mParticipant = nullptr;
70
	IdentityAddress mGruu;
71
	std::shared_ptr<CallSession> mSession;
72
	LinphoneEvent *mConferenceSubscribeEvent = nullptr;
73
	State mState = State::Joining;
74 75

	L_DISABLE_COPY(ParticipantDevice);
76 77
};

78 79
std::ostream &operator<< (std::ostream &stream, ParticipantDevice::State state);

80 81
LINPHONE_END_NAMESPACE

82
#endif // ifndef _L_PARTICIPANT_DEVICE_H_