mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
feat(Event): provide a working call event
This commit is contained in:
parent
1f3bcb463c
commit
f9a078befa
17 changed files with 99 additions and 22 deletions
|
|
@ -69,6 +69,13 @@ cmake_dependent_option(ENABLE_ASSISTANT "Turn on assistant compiling." YES "ENAB
|
|||
|
||||
set(CMAKE_CXX_STANDARD 11)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG")
|
||||
|
||||
if(ENABLE_STATIC)
|
||||
set(LINPHONE_LIBS_FOR_TOOLS linphone-static)
|
||||
else()
|
||||
|
|
@ -259,7 +266,7 @@ if(LINPHONE_CPPFLAGS)
|
|||
endif()
|
||||
|
||||
if(ENABLE_DEBUG_LOGS)
|
||||
add_definitions("-DDEBUG")
|
||||
add_definitions("-DDEBUG_LOGS")
|
||||
endif()
|
||||
|
||||
set(STRICT_OPTIONS_CPP )
|
||||
|
|
|
|||
|
|
@ -107,8 +107,8 @@ int main(int argc, char *argv[]){
|
|||
password=argv[3];
|
||||
}
|
||||
signal(SIGINT,stop);
|
||||
//#define DEBUG
|
||||
#ifdef DEBUG
|
||||
//#define DEBUG_LOGS
|
||||
#ifdef DEBUG_LOGS
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ int main(int argc, char *argv[]){
|
|||
}
|
||||
|
||||
signal(SIGINT,stop);
|
||||
//#define DEBUG
|
||||
#ifdef DEBUG
|
||||
//#define DEBUG_LOGS
|
||||
#ifdef DEBUG_LOGS
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -133,8 +133,8 @@ int main(int argc, char *argv[]){
|
|||
big_file[sizeof(big_file)-1]=*"E";
|
||||
|
||||
signal(SIGINT,stop);
|
||||
//#define DEBUG
|
||||
#ifdef DEBUG
|
||||
//#define DEBUG_LOGS
|
||||
#ifdef DEBUG_LOGS
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
vtable.message_received=message_received;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
signal(SIGINT,stop);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LOGS
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||
*
|
||||
*/
|
||||
|
||||
#define DEBUG 1
|
||||
#define DEBUG_LOGS 1
|
||||
|
||||
#include "linphone/core.h"
|
||||
|
||||
|
|
@ -102,7 +102,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
signal(SIGINT,stop);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LOGS
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
signal(SIGINT,stop);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LOGS
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
signal(SIGINT,stop);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LOGS
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ int main(int argc, char *argv[]){
|
|||
|
||||
signal(SIGINT,stop);
|
||||
|
||||
#ifdef DEBUG
|
||||
#ifdef DEBUG_LOGS
|
||||
linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
|
||||
#endif
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ set(LINPHONE_CXX_OBJECTS_SOURCE_FILES
|
|||
message/message.cpp
|
||||
object/clonable-object.cpp
|
||||
object/object.cpp
|
||||
utils/general.cpp
|
||||
utils/utils.cpp
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,8 +16,34 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "event-p.h"
|
||||
|
||||
#include "call-event.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
// TODO.
|
||||
using namespace std;
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class CallEventPrivate : public EventPrivate {
|
||||
public:
|
||||
shared_ptr<Call> call;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
CallEvent::CallEvent (Type type, const shared_ptr<Call> &call) : Event(*new CallEventPrivate, type) {
|
||||
L_D(CallEvent);
|
||||
L_ASSERT(call);
|
||||
d->call = call;
|
||||
}
|
||||
|
||||
CallEvent::CallEvent (const CallEvent &src) : CallEvent(src.getType(), src.getCall()) {}
|
||||
|
||||
shared_ptr<Call> CallEvent::getCall () const {
|
||||
L_D(const CallEvent);
|
||||
return d->call;
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -19,6 +19,8 @@
|
|||
#ifndef _CALL_EVENT_H_
|
||||
#define _CALL_EVENT_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "event.h"
|
||||
|
||||
// =============================================================================
|
||||
|
|
@ -30,9 +32,11 @@ class CallEventPrivate;
|
|||
|
||||
class LINPHONE_PUBLIC CallEvent : public Event {
|
||||
public:
|
||||
CallEvent (const Call &message);
|
||||
CallEvent (Type type, const std::shared_ptr<Call> &message);
|
||||
CallEvent (const CallEvent &src);
|
||||
|
||||
std::shared_ptr<Call> getCall () const;
|
||||
|
||||
private:
|
||||
L_DECLARE_PRIVATE(CallEvent);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
|
||||
Event::Event () : ClonableObject(*new EventPrivate) {}
|
||||
|
||||
Event::Event (const Event &) : ClonableObject(*new EventPrivate) {
|
||||
// `src` parameter is useless.
|
||||
}
|
||||
Event::Event (const Event &) : ClonableObject(*new EventPrivate) {}
|
||||
|
||||
Event::Event (EventPrivate &p, Type type) : ClonableObject(p) {
|
||||
L_D(Event);
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@
|
|||
*/
|
||||
|
||||
#include "event-p.h"
|
||||
#include "message/message.h"
|
||||
|
||||
#include "message-event.h"
|
||||
|
||||
|
|
@ -36,6 +35,7 @@ public:
|
|||
|
||||
MessageEvent::MessageEvent (const shared_ptr<Message> &message) : Event(*new MessageEventPrivate, Event::MessageEvent) {
|
||||
L_D(MessageEvent);
|
||||
L_ASSERT(message);
|
||||
d->message = message;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,9 @@ Logger::~Logger () {
|
|||
|
||||
switch (d->level) {
|
||||
case Debug:
|
||||
ms_debug("%s", str.c_str());
|
||||
#if DEBUG_LOGS
|
||||
ms_debug("%s", str.c_str());
|
||||
#endif // if DEBUG_LOGS
|
||||
break;
|
||||
case Info:
|
||||
ms_message("%s", str.c_str());
|
||||
|
|
|
|||
31
src/utils/general.cpp
Normal file
31
src/utils/general.cpp
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* general.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 "logger/logger.h"
|
||||
|
||||
#include "general.h"
|
||||
|
||||
// =============================================================================
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
void l_assert (const char *condition, const char *file, int line) {
|
||||
lFatal() << "ASSERT: " << condition << " in " << file << " line " << line << ".";
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
@ -16,11 +16,11 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
// =============================================================================
|
||||
|
||||
#ifndef _GENERAL_H_
|
||||
#define _GENERAL_H_
|
||||
|
||||
// =============================================================================
|
||||
|
||||
#define LINPHONE_NAMESPACE LinphonePrivate
|
||||
#define LINPHONE_BEGIN_NAMESPACE namespace LINPHONE_NAMESPACE {
|
||||
#define LINPHONE_END_NAMESPACE }
|
||||
|
|
@ -72,6 +72,14 @@ LINPHONE_BEGIN_NAMESPACE
|
|||
#define L_D(CLASS) CLASS ## Private * const d = getPrivate();
|
||||
#define L_Q(CLASS) CLASS * const q = getPublic();
|
||||
|
||||
void l_assert (const char *condition, const char *file, int line);
|
||||
|
||||
#ifdef DEBUG
|
||||
#define L_ASSERT(CONDITION) static_cast<void>(false && (CONDITION))
|
||||
#else
|
||||
#define L_ASSERT(CONDITION) ((CONDITION) ? static_cast<void>(0) : l_assert(#CONDITION, __FILE__, __LINE__))
|
||||
#endif
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _GENERAL_H_
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue