mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-29 09:09:21 +00:00
feat(c-wrapper): refactoring
This commit is contained in:
parent
a0f5602b1f
commit
78f8cfd4bf
5 changed files with 108 additions and 86 deletions
|
|
@ -21,6 +21,8 @@
|
|||
############################################################################
|
||||
|
||||
set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
||||
c-wrapper/api/c-event-log.h
|
||||
c-wrapper/c-tools.h
|
||||
c-wrapper/c-types.h
|
||||
content/content.h
|
||||
core/core.h
|
||||
|
|
@ -59,7 +61,7 @@ set(LINPHONE_CXX_OBJECTS_PRIVATE_HEADER_FILES
|
|||
)
|
||||
|
||||
set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
||||
c-wrapper/c-types.cpp
|
||||
c-wrapper/api/c-event-log.cpp
|
||||
content/content.cpp
|
||||
core/core.cpp
|
||||
cpim/header/cpim-core-headers.cpp
|
||||
|
|
|
|||
49
src/c-wrapper/api/c-event-log.cpp
Normal file
49
src/c-wrapper/api/c-event-log.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* c-event-log.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 "c-wrapper/c-tools.h"
|
||||
|
||||
#include "c-event-log.h"
|
||||
|
||||
#include "event-log/message-event.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
L_DECLARE_C_STRUCT_IMPL(EventLog, event_log);
|
||||
L_DECLARE_C_STRUCT_NEW_DEFAULT(EventLog, event_log);
|
||||
|
||||
LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *eventLog) {
|
||||
return static_cast<LinphoneEventLogType>(eventLog->cppPtr->getType());
|
||||
}
|
||||
|
||||
L_DECLARE_C_STRUCT_IMPL(MessageEvent, message_event);
|
||||
|
||||
LinphoneMessageEvent *linphone_message_event_new (LinphoneMessage *message) {
|
||||
LinphoneMessageEvent *object = _linphone_message_event_init();
|
||||
// TODO: call make_shared with cppPtr.
|
||||
object->cppPtr = make_shared<LINPHONE_NAMESPACE::MessageEvent>(nullptr);
|
||||
return object;
|
||||
}
|
||||
|
||||
LinphoneMessage *linphone_message_event_get_message (const LinphoneMessageEvent *messageEvent) {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
}
|
||||
50
src/c-wrapper/api/c-event-log.h
Normal file
50
src/c-wrapper/api/c-event-log.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* c-event-log.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_EVENT_LOG_H_
|
||||
#define _C_EVENT_LOG_H_
|
||||
|
||||
#include "c-wrapper/c-types.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_PUBLIC LinphoneEventLog *linphone_event_log_new ();
|
||||
LINPHONE_PUBLIC LinphoneEventLogType linphone_event_log_get_type (const LinphoneEventLog *event_log);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneCallEvent *linphone_call_event_new (LinphoneEventLogType type, LinphoneCall *call);
|
||||
LINPHONE_PUBLIC LinphoneCall *linphone_call_event_get_call (const LinphoneCallEvent *call_event);
|
||||
|
||||
LINPHONE_PUBLIC LinphoneConferenceEvent *linphone_conference_event_new (
|
||||
LinphoneEventLogType type,
|
||||
const LinphoneAddress *address
|
||||
);
|
||||
|
||||
LINPHONE_PUBLIC const LinphoneAddress *linphone_conference_event_get_address ();
|
||||
|
||||
LINPHONE_PUBLIC LinphoneConferenceParticipantEvent *linphone_conference_participant_event_new (
|
||||
LinphoneEventLogType type,
|
||||
const LinphoneAddress *conferenceAddress,
|
||||
const LinphoneAddress *participantAddress
|
||||
);
|
||||
|
||||
LINPHONE_PUBLIC const LinphoneAddress *linphone_conference_participant_event_get_participant_address ();
|
||||
|
||||
LINPHONE_PUBLIC LinphoneMessageEvent *linphone_message_event_new (LinphoneMessage *message);
|
||||
LINPHONE_PUBLIC LinphoneMessage *linphone_message_event_get_message (const LinphoneMessageEvent *message_event);
|
||||
|
||||
#endif // ifndef _C_EVENT_LOG_H_
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* types.cpp
|
||||
* c-tools.h
|
||||
* Copyright (C) 2017 Belledonne Communications SARL
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
|
|
@ -16,19 +16,14 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _C_TOOLS_H_
|
||||
#define _C_TOOLS_H_
|
||||
|
||||
// From coreapi.
|
||||
#include "private.h"
|
||||
|
||||
// Must be included before cpp headers.
|
||||
#include "c-types.h"
|
||||
// =============================================================================
|
||||
|
||||
#include "event-log/message-event.h"
|
||||
|
||||
// ================================================================²=============
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern "C" {
|
||||
#define L_DECLARE_C_STRUCT_IMPL(STRUCT, C_NAME) \
|
||||
struct _Linphone ## STRUCT { \
|
||||
belle_sip_object_t base; \
|
||||
|
|
@ -63,32 +58,4 @@ extern "C" {
|
|||
return object; \
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Event log.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
L_DECLARE_C_STRUCT_IMPL(EventLog, event_log);
|
||||
L_DECLARE_C_STRUCT_NEW_DEFAULT(EventLog, event_log);
|
||||
|
||||
LinphoneEventLogType event_log_get_type (const LinphoneEventLog *eventLog) {
|
||||
return static_cast<LinphoneEventLogType>(eventLog->cppPtr->getType());
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Message Event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
L_DECLARE_C_STRUCT_IMPL(MessageEvent, message_event);
|
||||
|
||||
LinphoneMessageEvent *message_event_new (LinphoneMessage *message) {
|
||||
LinphoneMessageEvent *object = _linphone_message_event_init();
|
||||
// TODO: call make_shared with cppPtr.
|
||||
object->cppPtr = make_shared<LINPHONE_NAMESPACE::MessageEvent>(nullptr);
|
||||
return object;
|
||||
}
|
||||
|
||||
LinphoneMessage *message_event_get_message (const LinphoneMessageEvent *messageEvent) {
|
||||
// TODO.
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
#endif // ifndef _C_TOOLS_H_
|
||||
|
|
@ -42,52 +42,6 @@ L_DECLARE_C_STRUCT(MessageEvent);
|
|||
// TODO: Remove me in the future.
|
||||
typedef struct SalAddress LinphoneAddress;
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Call Event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
LINPHONE_PUBLIC LinphoneCallEvent *call_event_new (LinphoneEventLogType type, LinphoneCall *call);
|
||||
LINPHONE_PUBLIC LinphoneCall *call_event_get_call (const LinphoneCallEvent *call_event);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Conference Event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
LINPHONE_PUBLIC LinphoneConferenceEvent *conference_event_new (
|
||||
LinphoneEventLogType type,
|
||||
const LinphoneAddress *address
|
||||
);
|
||||
|
||||
LINPHONE_PUBLIC const LinphoneAddress *conference_event_get_address ();
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Conference Participant Event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
LINPHONE_PUBLIC LinphoneConferenceParticipantEvent *conference_participant_event_new (
|
||||
LinphoneEventLogType type,
|
||||
const LinphoneAddress *conferenceAddress,
|
||||
const LinphoneAddress *participantAddress
|
||||
);
|
||||
|
||||
LINPHONE_PUBLIC const LinphoneAddress *conference_participant_event_get_participant_address ();
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Event log.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
LINPHONE_PUBLIC LinphoneEventLog *event_log_new ();
|
||||
LINPHONE_PUBLIC LinphoneEventLogType event_log_get_type (const LinphoneEventLog *event_log);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
// Message Event.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
LINPHONE_PUBLIC LinphoneMessageEvent *message_event_new (LinphoneMessage *message);
|
||||
LINPHONE_PUBLIC LinphoneMessage *message_event_get_message (const LinphoneMessageEvent *message_event);
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue