diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f2a446e5..1d6327254 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 diff --git a/src/c-wrapper/api/c-event-log.cpp b/src/c-wrapper/api/c-event-log.cpp new file mode 100644 index 000000000..c246aef3d --- /dev/null +++ b/src/c-wrapper/api/c-event-log.cpp @@ -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 . + */ + +#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(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(nullptr); + return object; +} + +LinphoneMessage *linphone_message_event_get_message (const LinphoneMessageEvent *messageEvent) { + // TODO. + return nullptr; +} diff --git a/src/c-wrapper/api/c-event-log.h b/src/c-wrapper/api/c-event-log.h new file mode 100644 index 000000000..38eea75aa --- /dev/null +++ b/src/c-wrapper/api/c-event-log.h @@ -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 . + */ + +#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_ diff --git a/src/c-wrapper/c-types.cpp b/src/c-wrapper/c-tools.h similarity index 63% rename from src/c-wrapper/c-types.cpp rename to src/c-wrapper/c-tools.h index 15180d577..1a4c23db3 100644 --- a/src/c-wrapper/c-types.cpp +++ b/src/c-wrapper/c-tools.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 . */ +#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(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(nullptr); - return object; -} - -LinphoneMessage *message_event_get_message (const LinphoneMessageEvent *messageEvent) { - // TODO. - return nullptr; -} -} +#endif // ifndef _C_TOOLS_H_ diff --git a/src/c-wrapper/c-types.h b/src/c-wrapper/c-types.h index d564aee72..51ff9cfe2 100644 --- a/src/c-wrapper/c-types.h +++ b/src/c-wrapper/c-types.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