CallLog.cpp 2.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
CallLog.cpp
Copyright (C) 2015  Belledonne Communications, Grenoble, France
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 2
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, write to the Free Software
14
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
15 16 17 18 19 20 21
*/

#include "Address.h"
#include "ApiLock.h"
#include "CallLog.h"
#include "Enums.h"

22
using namespace BelledonneCommunications::Linphone::Native;
23

24
Platform::String^ CallLog::CallId::get()
25 26
{
	API_LOCK;
27
	return Utils::cctops(linphone_call_log_get_call_id(this->callLog));
28 29
}

30
CallDirection CallLog::Direction::get()
31 32
{
	API_LOCK;
33
	return (CallDirection)linphone_call_log_get_dir(this->callLog);
34 35
}

36
int CallLog::Duration::get()
37 38 39 40 41
{
	API_LOCK;
	return linphone_call_log_get_duration(this->callLog);
}

42
Address^ CallLog::FromAddress::get()
43 44
{
	API_LOCK;
45
	return (Address^)Utils::CreateAddress((void*)linphone_call_log_get_from_address(this->callLog));
46 47
}

48
Platform::Boolean CallLog::IsVideoEnabled::get()
49 50
{
	API_LOCK;
51
	return (linphone_call_log_video_enabled(this->callLog) == TRUE);
52 53
}

54
int64 CallLog::StartDate::get()
55 56
{
	API_LOCK;
57
	return linphone_call_log_get_start_date(this->callLog);
58 59
}

60
CallStatus CallLog::Status::get()
61 62
{
	API_LOCK;
63
	return (CallStatus)linphone_call_log_get_status(this->callLog);
64 65
}

66
Address^ CallLog::ToAddress::get()
67 68
{
	API_LOCK;
69
	return (Address^)Utils::CreateAddress((void*)linphone_call_log_get_to_address(this->callLog));
70 71
}

72
CallLog::CallLog(::LinphoneCallLog *cl)
73 74 75 76
	: callLog(cl)
{
	API_LOCK;
	RefToPtrProxy<CallLog^> *log = new RefToPtrProxy<CallLog^>(this);
77 78
	linphone_call_log_ref(this->callLog);
	linphone_call_log_set_user_data(this->callLog, log);
79 80
}

81
CallLog::~CallLog()
82 83
{
	API_LOCK;
84 85 86 87
	if (this->callLog != nullptr) {
		linphone_call_log_unref(this->callLog);
	}
	RefToPtrProxy<CallLog^> *log = reinterpret_cast<RefToPtrProxy<CallLog^> *>(linphone_call_log_get_user_data(this->callLog));
88 89
	delete log;
}