Started c wrapper for chat message callbacks

This commit is contained in:
Sylvain Berfini 2017-09-20 14:00:22 +02:00
parent 0cb5cc6345
commit c0d1e3ec72
6 changed files with 150 additions and 9 deletions

View file

@ -174,15 +174,6 @@ typedef struct _CallCallbackObj
void * _user_data;
}CallCallbackObj;
struct _LinphoneChatMessageCbs {
belle_sip_object_t base;
void *user_data;
LinphoneChatMessageCbsMsgStateChangedCb msg_state_changed;
LinphoneChatMessageCbsFileTransferRecvCb file_transfer_recv; /**< Callback to store file received attached to a #LinphoneChatMessage */
LinphoneChatMessageCbsFileTransferSendCb file_transfer_send; /**< Callback to collect file chunk to be sent for a #LinphoneChatMessage */
LinphoneChatMessageCbsFileTransferProgressIndicationCb file_transfer_progress_indication; /**< Callback to indicate file transfer progress */
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneChatMessageCbs);
typedef enum _LinphoneChatMessageDir{

View file

@ -78,6 +78,7 @@ set(C_API_HEADER_FILES
c-api.h
c-callbacks.h
c-chat-message.h
c-chat-message-cbs.h
c-chat-room.h
c-chat-room-cbs.h
c-event-log.h

View file

@ -0,0 +1,71 @@
/*
* c-chat-message-cbs.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_CHAT_MESSAGE_CBS_H_
#define _C_CHAT_MESSAGE_CBS_H_
#include "linphone/api/c-callbacks.h"
#include "linphone/api/c-types.h"
// =============================================================================
#ifdef __cplusplus
extern "C" {
#endif // ifdef __cplusplus
/**
* @addtogroup chatroom
* @{
*/
/**
* Acquire a reference to the chat room callbacks object.
* @param[in] cbs The chat room callbacks object
* @return The same chat room callbacks object
**/
LINPHONE_PUBLIC LinphoneChatMessageCbs * linphone_chat_message_cbs_ref (LinphoneChatMessageCbs *cbs);
/**
* Release reference to the chat room callbacks object.
* @param[in] cr The chat room callbacks object
**/
LINPHONE_PUBLIC void linphone_chat_message_cbs_unref (LinphoneChatMessageCbs *cbs);
/**
* Retrieve the user pointer associated with the chat room callbacks object.
* @param[in] cr The chat room callbacks object
* @return The user pointer associated with the chat room callbacks object
**/
LINPHONE_PUBLIC void * linphone_chat_message_cbs_get_user_data (const LinphoneChatMessageCbs *cbs);
/**
* Assign a user pointer to the chat room callbacks object.
* @param[in] cr The chat room callbacks object
* @param[in] ud The user pointer to associate with the chat room callbacks object
**/
LINPHONE_PUBLIC void linphone_chat_message_cbs_set_user_data (LinphoneChatMessageCbs *cbs, void *ud);
/**
* @}
*/
#ifdef __cplusplus
}
#endif // ifdef __cplusplus
#endif // ifndef _C_CHAT_MESSAGE_H_

View file

@ -88,8 +88,18 @@ typedef struct _LinphoneChatRoom LinphoneChatRoom;
*/
typedef struct _LinphoneChatRoomCbs LinphoneChatRoomCbs;
/**
* An chat message is the object that is sent and received through LinphoneChatRooms.
* @ingroup chatroom
*/
typedef struct _LinphoneMessage LinphoneMessage;
/**
* An object to handle the callbacks for the handling a LinphoneChatMessage objects.
* @ingroup chatroom
*/
typedef struct _LinphoneChatMessageCbs LinphoneChatMessageCbs;
/**
* The LinphoneParticipant object represents a participant of a conference.
* @ingroup misc

View file

@ -104,6 +104,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
c-wrapper/api/c-address.cpp
c-wrapper/api/c-call-params.cpp
c-wrapper/api/c-chat-message.cpp
c-wrapper/api/c-chat-message-cbs.cpp
c-wrapper/api/c-chat-room.cpp
c-wrapper/api/c-chat-room-cbs.cpp
c-wrapper/api/c-event-log.cpp

View file

@ -0,0 +1,67 @@
/*
* c-chat-message-cbs.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-chat-message-cbs.h"
// TODO: Remove me later.
#include "private.h"
// =============================================================================
struct _LinphoneChatMessageCbs {
belle_sip_object_t base;
void *userData;
LinphoneChatMessageCbsMsgStateChangedCb msg_state_changed;
LinphoneChatMessageCbsFileTransferRecvCb file_transfer_recv;
LinphoneChatMessageCbsFileTransferSendCb file_transfer_send;
LinphoneChatMessageCbsFileTransferProgressIndicationCb file_transfer_progress_indication;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneChatMessageCbs);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatMessageCbs);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneChatMessageCbs, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // marshal
FALSE
);
// =============================================================================
LinphoneChatMessageCbs * linphone_chat_message_cbs_new (void) {
return belle_sip_object_new(LinphoneChatMessageCbs);
}
LinphoneChatMessageCbs * linphone_chat_message_cbs_ref (LinphoneChatMessageCbs *cbs) {
belle_sip_object_ref(cbs);
return cbs;
}
void linphone_chat_message_cbs_unref (LinphoneChatMessageCbs *cbs) {
belle_sip_object_unref(cbs);
}
void * linphone_chat_message_cbs_get_user_data (const LinphoneChatMessageCbs *cbs) {
return cbs->userData;
}
void linphone_chat_message_cbs_set_user_data (LinphoneChatMessageCbs *cbs, void *ud) {
cbs->userData = ud;
}