Add back pointer to the Participant in a ParticipantDevice.

This commit is contained in:
Ghislain MARY 2018-02-12 14:44:57 +01:00
parent 2ad51e7a0e
commit 790b948683
3 changed files with 9 additions and 5 deletions

View file

@ -29,9 +29,8 @@ LINPHONE_BEGIN_NAMESPACE
ParticipantDevice::ParticipantDevice () {}
ParticipantDevice::ParticipantDevice (const IdentityAddress &gruu) {
mGruu = gruu;
}
ParticipantDevice::ParticipantDevice (const Participant *participant, const IdentityAddress &gruu)
: mParticipant(participant), mGruu(gruu) {}
ParticipantDevice::~ParticipantDevice () {
if (mConferenceSubscribeEvent)

View file

@ -23,6 +23,7 @@
#include <string>
#include "address/identity-address.h"
#include "linphone/types.h"
#include "linphone/utils/general.h"
@ -31,6 +32,7 @@
LINPHONE_BEGIN_NAMESPACE
class CallSession;
class Participant;
class ParticipantDevice {
public:
@ -42,12 +44,13 @@ public:
};
ParticipantDevice ();
explicit ParticipantDevice (const IdentityAddress &gruu);
explicit ParticipantDevice (const Participant *participant, const IdentityAddress &gruu);
virtual ~ParticipantDevice ();
bool operator== (const ParticipantDevice &device) const;
inline const IdentityAddress &getAddress () const { return mGruu; }
const Participant *getParticipant () const { return mParticipant; }
inline std::shared_ptr<CallSession> getSession () const { return mSession; }
inline void setSession (std::shared_ptr<CallSession> session) { mSession = session; }
inline State getState () const { return mState; }
@ -60,6 +63,7 @@ public:
bool isValid () const { return mGruu.isValid(); }
private:
const Participant *mParticipant = nullptr;
IdentityAddress mGruu;
std::shared_ptr<CallSession> mSession;
LinphoneEvent *mConferenceSubscribeEvent = nullptr;

View file

@ -47,10 +47,11 @@ shared_ptr<CallSession> ParticipantPrivate::createSession (
// -----------------------------------------------------------------------------
shared_ptr<ParticipantDevice> ParticipantPrivate::addDevice (const IdentityAddress &gruu) {
L_Q();
shared_ptr<ParticipantDevice> device = findDevice(gruu);
if (device)
return device;
device = make_shared<ParticipantDevice>(gruu);
device = make_shared<ParticipantDevice>(q, gruu);
devices.push_back(device);
return device;
}