forked from mirrors/linphone-iphone
Add C wrapper for Participant class.
This commit is contained in:
parent
d458d1099f
commit
f4f3b90c9e
7 changed files with 158 additions and 1 deletions
|
|
@ -1723,7 +1723,8 @@ BELLE_SIP_TYPE_ID(LinphonePlayer),
|
|||
BELLE_SIP_TYPE_ID(LinphonePlayerCbs),
|
||||
BELLE_SIP_TYPE_ID(LinphoneEventLog),
|
||||
BELLE_SIP_TYPE_ID(LinphoneMessage),
|
||||
BELLE_SIP_TYPE_ID(LinphoneMessageEvent)
|
||||
BELLE_SIP_TYPE_ID(LinphoneMessageEvent),
|
||||
BELLE_SIP_TYPE_ID(LinphoneParticipant)
|
||||
BELLE_SIP_DECLARE_TYPES_END
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ set(C_API_HEADER_FILES
|
|||
c-address.h
|
||||
c-api.h
|
||||
c-event-log.h
|
||||
c-participant.h
|
||||
c-types.h
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -21,5 +21,6 @@
|
|||
|
||||
#include "linphone/api/c-address.h"
|
||||
#include "linphone/api/c-event-log.h"
|
||||
#include "linphone/api/c-participant.h"
|
||||
|
||||
#endif // ifndef _C_API_H_
|
||||
|
|
|
|||
88
include/linphone/api/c-participant.h
Normal file
88
include/linphone/api/c-participant.h
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
/*
|
||||
* c-participant.h
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _C_PARTICIPANT_H_
|
||||
#define _C_PARTICIPANT_H_
|
||||
|
||||
#include "linphone/api/c-types.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
/**
|
||||
* @addtogroup misc
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Increment reference count of LinphoneParticipant object.
|
||||
**/
|
||||
LINPHONE_PUBLIC LinphoneParticipant *linphone_participant_ref (LinphoneParticipant *participant);
|
||||
|
||||
/**
|
||||
* Decrement reference count of LinphoneParticipant object.
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_participant_unref (LinphoneParticipant *participant);
|
||||
|
||||
/**
|
||||
* Retrieve the user pointer associated with the conference participant.
|
||||
* @param[in] participant A LinphoneParticipant object
|
||||
* @return The user pointer associated with the participant.
|
||||
**/
|
||||
LINPHONE_PUBLIC void * linphone_participant_get_user_data(const LinphoneParticipant *participant);
|
||||
|
||||
/**
|
||||
* Assign a user pointer to the conference participant.
|
||||
* @param[in] participant A LinphoneParticipant object
|
||||
* @param[in] ud The user pointer to associate with the participant
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_participant_set_user_data(LinphoneParticipant *participant, void *ud);
|
||||
|
||||
/**
|
||||
* Get the address of a conference participant.
|
||||
* @param[in] participant A LinphoneParticipant object
|
||||
* @return The address of the participant
|
||||
*/
|
||||
LINPHONE_PUBLIC const LinphoneAddress * linphone_participant_get_address (const LinphoneParticipant *participant);
|
||||
|
||||
/**
|
||||
* Tells whether a conference participant is an administrator of the conference.
|
||||
* @param[in] participant A LinphoneParticipant object
|
||||
* @return A boolean value telling whether the participant is an administrator
|
||||
*/
|
||||
LINPHONE_PUBLIC bool_t linphone_participant_is_admin (const LinphoneParticipant *participant);
|
||||
|
||||
/**
|
||||
* Give the administrator rights or remove them to a conference participant.
|
||||
* @param[in] participant A LinphoneParticipant object
|
||||
* @param value A boolean value telling whether the participant should be an administrator or not
|
||||
*/
|
||||
LINPHONE_PUBLIC void linphone_participant_set_admin (LinphoneParticipant *participant, bool_t value);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif // ifdef __cplusplus
|
||||
|
||||
#endif // ifndef _C_PARTICIPANT_H_
|
||||
|
|
@ -80,6 +80,7 @@ typedef struct _LinphoneConferenceParticipantEvent LinphoneConferenceParticipant
|
|||
typedef struct _LinphoneEventLog LinphoneEventLog;
|
||||
typedef struct _LinphoneMessage LinphoneMessage;
|
||||
typedef struct _LinphoneMessageEvent LinphoneMessageEvent;
|
||||
typedef struct _LinphoneParticipant LinphoneParticipant;
|
||||
|
||||
// =============================================================================
|
||||
// C Enums.
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
|||
c-wrapper/api/c-call-params.cpp
|
||||
c-wrapper/api/c-chat-room.cpp
|
||||
c-wrapper/api/c-event-log.cpp
|
||||
c-wrapper/api/c-participant.cpp
|
||||
call/call.cpp
|
||||
chat/basic-chat-room.cpp
|
||||
chat/chat-message.cpp
|
||||
|
|
|
|||
64
src/c-wrapper/api/c-participant.cpp
Normal file
64
src/c-wrapper/api/c-participant.cpp
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* c-participant.cpp
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "linphone/api/c-participant.h"
|
||||
|
||||
#include "c-wrapper/c-tools.h"
|
||||
|
||||
#include "conference/participant.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
L_DECLARE_C_STRUCT_IMPL(Participant, Participant, participant,
|
||||
mutable LinphoneAddress *addressCache;
|
||||
);
|
||||
|
||||
LinphoneParticipant *linphone_participant_ref (LinphoneParticipant *participant) {
|
||||
belle_sip_object_ref(participant);
|
||||
return participant;
|
||||
}
|
||||
|
||||
void linphone_participant_unref (LinphoneParticipant *participant) {
|
||||
belle_sip_object_unref(participant);
|
||||
}
|
||||
|
||||
void * linphone_participant_get_user_data(const LinphoneParticipant *participant) {
|
||||
return L_GET_USER_DATA_FROM_C_STRUCT(participant, Participant, Participant);
|
||||
}
|
||||
|
||||
void linphone_participant_set_user_data(LinphoneParticipant *participant, void *ud) {
|
||||
L_SET_USER_DATA_FROM_C_STRUCT(participant, ud, Participant, Participant);
|
||||
}
|
||||
|
||||
const LinphoneAddress * linphone_participant_get_address (const LinphoneParticipant *participant) {
|
||||
LinphonePrivate::Address addr = L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant, Participant)->getAddress();
|
||||
if (participant->addressCache)
|
||||
linphone_address_unref(participant->addressCache);
|
||||
participant->addressCache = linphone_address_new(addr.asString().c_str());
|
||||
return participant->addressCache;
|
||||
}
|
||||
|
||||
bool_t linphone_participant_is_admin (const LinphoneParticipant *participant) {
|
||||
return L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant, Participant)->isAdmin();
|
||||
}
|
||||
|
||||
void linphone_participant_set_admin (LinphoneParticipant *participant, bool_t value) {
|
||||
L_GET_CPP_PTR_FROM_C_STRUCT(participant, Participant, Participant)->setAdmin(value);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue