Commit 4afab377 authored by Ghislain MARY's avatar Ghislain MARY

Stabilize API of C++/CX wrapper.

parent dd6ec7a0
......@@ -21,7 +21,7 @@ namespace Linphone
{
base.OnNavigatedTo(e);
LinphoneManager.Instance.Dispatcher = Dispatcher;
LinphoneManager.Instance.Core.IterateEnabled = true;
LinphoneManager.Instance.Core.IsIterateEnabled = true;
}
private void CallButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
......@@ -52,7 +52,7 @@ namespace Linphone
core.AddAuthInfo(authInfo);
proxy.Identity = string.Format("sip:{0}@{1}", UsernameTextBox.Text, ServerTextBox.Text);
proxy.ServerAddr = ServerTextBox.Text;
proxy.RegisterEnabled = true;
proxy.IsRegisterEnabled = true;
core.AddProxyConfig(proxy);
core.DefaultProxyConfig = proxy;
}
......
......@@ -32,13 +32,13 @@ void Linphone::Native::AuthInfo::Ha1::set(Platform::String^ ha1)
delete(cc);
}
Platform::String^ Linphone::Native::AuthInfo::Password::get()
Platform::String^ Linphone::Native::AuthInfo::Passwd::get()
{
API_LOCK;
return Utils::cctops(linphone_auth_info_get_passwd(this->auth_info));
}
void Linphone::Native::AuthInfo::Password::set(Platform::String^ password)
void Linphone::Native::AuthInfo::Passwd::set(Platform::String^ password)
{
API_LOCK;
const char *cc = Linphone::Native::Utils::pstoccs(password);
......
......@@ -48,7 +48,7 @@ namespace Linphone
/// <summary>
/// The authentication password.
/// </summary>
property Platform::String^ Password
property Platform::String^ Passwd
{
Platform::String^ get();
void set(Platform::String^ value);
......
......@@ -28,7 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Linphone::Native::CallStats^ Linphone::Native::Call::AudioStats::get()
{
API_LOCK;
return (Linphone::Native::CallStats^) Linphone::Native::Utils::CreateLinphoneCallStats(this->call, (int)Linphone::Native::MediaType::Audio);
return (Linphone::Native::CallStats^) Linphone::Native::Utils::CreateCallStats(this->call, (int)Linphone::Native::MediaType::Audio);
}
Platform::String^ Linphone::Native::Call::AuthenticationToken::get()
......@@ -58,7 +58,7 @@ float Linphone::Native::Call::AverageQuality::get()
Linphone::Native::CallLog^ Linphone::Native::Call::CallLog::get()
{
API_LOCK;
return (Linphone::Native::CallLog^) Linphone::Native::Utils::CreateLinphoneCallLog(linphone_call_get_call_log(this->call));
return (Linphone::Native::CallLog^) Linphone::Native::Utils::GetCallLog(linphone_call_get_call_log(this->call));
}
Platform::Boolean Linphone::Native::Call::CameraEnabled::get()
......@@ -73,6 +73,12 @@ void Linphone::Native::Call::CameraEnabled::set(Platform::Boolean enable)
linphone_call_enable_camera(this->call, enable);
}
Linphone::Native::CallParams^ Linphone::Native::Call::CurrentParams::get()
{
API_LOCK;
return (Linphone::Native::CallParams^) Linphone::Native::Utils::GetCallParams((void *)linphone_call_get_current_params(this->call));
}
float Linphone::Native::Call::CurrentQuality::get()
{
API_LOCK;
......@@ -115,7 +121,7 @@ void Linphone::Native::Call::EchoLimiterEnabled::set(Platform::Boolean enable)
linphone_call_enable_echo_limiter(this->call, enable);
}
Platform::Boolean Linphone::Native::Call::InConference::get()
Platform::Boolean Linphone::Native::Call::IsInConference::get()
{
API_LOCK;
return (linphone_call_is_in_conference(this->call) == TRUE);
......@@ -149,11 +155,7 @@ Linphone::Native::Address^ Linphone::Native::Call::RemoteAddress::get()
Linphone::Native::CallParams^ Linphone::Native::Call::RemoteParams::get()
{
API_LOCK;
Linphone::Native::CallParams^ params = nullptr;
if (linphone_call_get_remote_params(this->call) != nullptr) {
params = (Linphone::Native::CallParams^) Linphone::Native::Utils::CreateLinphoneCallParams(linphone_call_params_copy(linphone_call_get_remote_params(this->call)));
}
return params;
return (Linphone::Native::CallParams^) Linphone::Native::Utils::GetCallParams((void *)linphone_call_get_remote_params(this->call));
}
Platform::String^ Linphone::Native::Call::RemoteUserAgent::get()
......@@ -171,13 +173,7 @@ Linphone::Native::CallState Linphone::Native::Call::State::get()
Linphone::Native::CallStats^ Linphone::Native::Call::VideoStats::get()
{
API_LOCK;
return (Linphone::Native::CallStats^) Linphone::Native::Utils::CreateLinphoneCallStats(this->call, (int)Linphone::Native::MediaType::Video);
}
Linphone::Native::CallParams^ Linphone::Native::Call::GetCurrentParamsCopy()
{
API_LOCK;
return (Linphone::Native::CallParams^) Linphone::Native::Utils::CreateLinphoneCallParams(linphone_call_params_copy(linphone_call_get_current_params(this->call)));
return (Linphone::Native::CallStats^) Linphone::Native::Utils::CreateCallStats(this->call, (int)Linphone::Native::MediaType::Video);
}
void Linphone::Native::Call::SendVFURequest()
......
......@@ -89,6 +89,16 @@ namespace Linphone
void set(Platform::Boolean value);
}
/// <summary>
/// Gets the current local call parameters.
/// Do not change this params directly, make a copy with CallParams::Copy to do that.
/// </summary>
/// <returns>The current local call parameters</returns>
property CallParams^ CurrentParams
{
CallParams^ get();
}
/// <summary>
/// Obtain real time quality rating of the call.
/// Based on local RTP statistics and RTCP feedback, a quality rating is computed and updated during all the duration of the call.
......@@ -146,7 +156,7 @@ namespace Linphone
/// <summary>
/// Tells whether the call is in conference or not.
/// </summary>
property Platform::Boolean InConference
property Platform::Boolean IsInConference
{
Platform::Boolean get();
}
......@@ -187,6 +197,7 @@ namespace Linphone
/// <summary>
/// Gets the call parameters given by the remote peer.
/// This is useful for example to know if far end supports video or encryption.
/// Do not change this params directly, make a copy with CallParams::Copy to do that.
/// </summary>
property CallParams^ RemoteParams
{
......@@ -217,12 +228,6 @@ namespace Linphone
CallStats^ get();
}
/// <summary>
/// Gets a copy of the current local call parameters.
/// </summary>
/// <returns>A copy of the current local call parameters</returns>
CallParams^ GetCurrentParamsCopy();
/// <summary>
/// Requests remote side to send us a Video Fast Update.
/// </summary>
......
/*
CallController.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
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "Call.h"
#include "CallController.h"
#include "CallParams.h"
#include "Core.h"
#include "VideoPolicy.h"
using namespace Linphone::Native;
using namespace Platform;
using namespace Windows::Foundation;
//using namespace Windows::Phone::Networking::Voip;
//#define ACCEPT_WITH_VIDEO_OR_WITH_AUDIO_ONLY
#if 0
VoipPhoneCall^ CallController::OnIncomingCallReceived(Linphone::Native::Call^ call, Platform::String^ contactName, Platform::String^ contactNumber, IncomingCallViewDismissedCallback^ incomingCallViewDismissedCallback)
{
VoipPhoneCall^ incomingCall = nullptr;
this->call = call;
VoipCallMedia media = VoipCallMedia::Audio;
#ifdef ACCEPT_WITH_VIDEO_OR_WITH_AUDIO_ONLY
if (Globals::Instance->LinphoneCore->IsVideoSupported() && Globals::Instance->LinphoneCore->IsVideoEnabled()) {
bool automatically_accept = false;
CallParams^ remoteParams = call->GetRemoteParams();
VideoPolicy^ policy = Globals::Instance->LinphoneCore->GetVideoPolicy();
if (policy != nullptr) {
automatically_accept = policy->AutomaticallyAccept;
}
if ((remoteParams != nullptr) && remoteParams->IsVideoEnabled() && automatically_accept) {
media = VoipCallMedia::Audio | VoipCallMedia::Video;
}
}
#endif
if (!this->customIncomingCallView) {
TimeSpan ringingTimeout;
ringingTimeout.Duration = 90 * 10 * 1000 * 1000; // in 100ns units
try {
if (incomingCallViewDismissedCallback != nullptr)
this->onIncomingCallViewDismissed = incomingCallViewDismissedCallback;
// Ask the Phone Service to start a new incoming call
this->callCoordinator->RequestNewIncomingCall(
this->callInProgressPageUri + "?sip=" + contactNumber,
contactName,
contactNumber,
this->defaultContactImageUri,
this->voipServiceName,
this->linphoneImageUri,
"",
this->ringtoneUri,
media,
ringingTimeout,
&incomingCall);
}
catch(...) {
return nullptr;
}
incomingCall->AnswerRequested += this->acceptCallRequestedHandler;
incomingCall->RejectRequested += this->rejectCallRequestedHandler;
} else {
// When using the custom incoming call view, the VoipPhoneCall will be created when getting in the
// StreamsRunning state by calling NewIncomingCallForCustomIncomingCallView()
}
return incomingCall;
}
void CallController::OnAcceptCallRequested(VoipPhoneCall^ incomingCall, CallAnswerEventArgs^ args)
{
incomingCall->NotifyCallActive();
if (this->onIncomingCallViewDismissed != nullptr) {
this->onIncomingCallViewDismissed();
this->onIncomingCallViewDismissed = nullptr;
}
if (this->call != nullptr) {
#ifdef ACCEPT_WITH_VIDEO_OR_WITH_AUDIO_ONLY
CallParams^ params = call->GetCurrentParamsCopy();
if ((args->AcceptedMedia & VoipCallMedia::Video) == VoipCallMedia::Video) {
params->EnableVideo(true);
} else {
params->EnableVideo(false);
}
Globals::Instance->LinphoneCore->AcceptCallWithParams(this->call, params);
#else
Globals::Instance->LinphoneCore->AcceptCall(this->call);
#endif
}
}
void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallRejectEventArgs^ args)
{
if (this->onIncomingCallViewDismissed != nullptr) {
this->onIncomingCallViewDismissed();
this->onIncomingCallViewDismissed = nullptr;
}
//This will call notifyCallEnded on the call state changed callback
if (this->call != nullptr)
Globals::Instance->LinphoneCore->DeclineCall(this->call, this->declineReason);
}
VoipPhoneCall^ CallController::NewOutgoingCall(Platform::String^ number)
{
VoipPhoneCall^ outgoingCall = nullptr;
this->call = call;
VoipCallMedia media = VoipCallMedia::Audio;
if (Globals::Instance->LinphoneCore->VideoSupported && Globals::Instance->LinphoneCore->VideoEnabled) {
VideoPolicy^ policy = Globals::Instance->LinphoneCore->VideoPolicy;
if ((policy != nullptr) && policy->AutomaticallyInitiate) {
media = VoipCallMedia::Audio | VoipCallMedia::Video;
}
}
this->callCoordinator->RequestNewOutgoingCall(
this->callInProgressPageUri + "?sip=" + number,
number,
this->voipServiceName,
media,
&outgoingCall);
outgoingCall->NotifyCallActive();
return outgoingCall;
}
VoipPhoneCall^ CallController::NewIncomingCallForCustomIncomingCallView(Platform::String^ contactNumber)
{
VoipPhoneCall^ incomingCall = nullptr;
VoipCallMedia media = VoipCallMedia::Audio;
this->callCoordinator->RequestNewOutgoingCall(
this->callInProgressPageUri + "?sip=" + contactNumber,
contactNumber,
this->voipServiceName,
media,
&incomingCall);
return incomingCall;
}
#endif
void CallController::NotifyMute(bool isMuted)
{
#if 0
if (isMuted)
this->callCoordinator->NotifyMuted();
else
this->callCoordinator->NotifyUnmuted();
#endif
}
IncomingCallViewDismissedCallback^ CallController::IncomingCallViewDismissed::get()
{
return this->onIncomingCallViewDismissed;
}
void CallController::IncomingCallViewDismissed::set(IncomingCallViewDismissedCallback^ cb)
{
API_LOCK;
this->onIncomingCallViewDismissed = cb;
}
Platform::Boolean CallController::CustomIncomingCallView::get()
{
return this->customIncomingCallView;
}
void CallController::CustomIncomingCallView::set(Platform::Boolean value)
{
API_LOCK;
this->customIncomingCallView = value;
}
Reason CallController::DeclineReason::get()
{
return this->declineReason;
}
void CallController::DeclineReason::set(Linphone::Native::Reason value)
{
API_LOCK;
this->declineReason = value;
}
CallController::CallController() :
callInProgressPageUri(L"/Views/InCall.xaml"),
voipServiceName(nullptr),
defaultContactImageUri(nullptr),
linphoneImageUri(nullptr),
ringtoneUri(nullptr),
declineReason(Linphone::Native::Reason::Declined) //,
//callCoordinator(VoipCallCoordinator::GetDefault())
{
// URIs required for interactions with the VoipCallCoordinator
String^ installFolder = String::Concat(Windows::ApplicationModel::Package::Current->InstalledLocation->Path, "\\");
this->defaultContactImageUri = ref new Uri(installFolder, "Assets\\unknown.png");
this->voipServiceName = ref new String(L"Linphone");
this->linphoneImageUri = ref new Uri(installFolder, "Assets\\pnicon.png");
this->ringtoneUri = ref new Uri(installFolder, "Assets\\Sounds\\oldphone.wma");
//this->acceptCallRequestedHandler = ref new TypedEventHandler<VoipPhoneCall^, CallAnswerEventArgs^>(this, &CallController::OnAcceptCallRequested);
//this->rejectCallRequestedHandler = ref new TypedEventHandler<VoipPhoneCall^, CallRejectEventArgs^>(this, &CallController::OnRejectCallRequested);
}
CallController::~CallController()
{
}
/*
CallController.h
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
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#pragma once
//#include <windows.phone.networking.voip.h>
#include "Enums.h"
#include "ApiLock.h"
namespace Linphone
{
namespace Native
{
ref class Globals;
ref class LinphoneCall;
/// <summary>
/// Callback to be called when the PushNotification Agent has to be dismissed, i.e. after a call has been accepted, denied or stopped by the caller.
/// </summary>
public delegate void IncomingCallViewDismissedCallback();
/// <summary>
/// Provides methods and properties related to Windows.Phone.Networking.Voip.VoipPhoneCall calls.
/// </summary>
public ref class CallController sealed
{
public:
/// <summary>
/// Starts the system incoming call view.
/// </summary>
/// <param name="call">The incoming LinphoneCall to notify</param>
/// <param name="contactName">The display name of the caller</param>
/// <param name="contactNumber">The number or SIP URI of the caller</param>
/// <param name="incomingCallViewDismissedCallback">The callback to be called if the notified incoming call is dismissed by the user</param>
/// <returns>The system VoipPhoneCall that has been notified</returns>
//Windows::Phone::Networking::Voip::VoipPhoneCall^ OnIncomingCallReceived(LinphoneCall^ call, Platform::String^ contactName, Platform::String^ contactNumber, IncomingCallViewDismissedCallback^ incomingCallViewDismissedCallback);
/// <summary>
/// Starts an outgoing call using native VoipPhoneCall.
/// </summary>
/// <param name="number">The number of SIP URI to call</param>
/// <returns>The system VoipPhoneCall that has been initiated</returns>
//Windows::Phone::Networking::Voip::VoipPhoneCall^ NewOutgoingCall(Platform::String^ number);
/// <summary>
/// Starts an incoming call for custom incoming call view.
/// </summary>
/// <param name="contactNumber">The number or SIP URI of the caller</param>
/// <returns>The system VoipPhoneCall that has been created</returns>
//Windows::Phone::Networking::Voip::VoipPhoneCall^ NewIncomingCallForCustomIncomingCallView(Platform::String^ contactNumber);
/// <summary>
/// Notifies the system that the call needs to be muted/unmuted.
/// </summary>
/// <param name="isMuted">The new mute state</param>
void NotifyMute(bool isMuted);
/// <summary>
/// Changes the reason used when declining an incoming call.
/// </summary>
property Linphone::Native::Reason DeclineReason
{
Linphone::Native::Reason get();
void set(Linphone::Native::Reason cb);
}
/// <summary>
/// Callback to be called when the PushNotification Agent has to be dismissed, i.e. after a call has been accepted, denied or stopped by the caller.
/// </summary>
property IncomingCallViewDismissedCallback^ IncomingCallViewDismissed
{
IncomingCallViewDismissedCallback^ get();
void set(IncomingCallViewDismissedCallback^ cb);
}
/// <summary>
/// Property to tell that we will use our custom incoming call view instead of the one provided by the OS.
/// </summary>
property Platform::Boolean CustomIncomingCallView
{
Platform::Boolean get();
void set(Platform::Boolean value);
}
private:
friend ref class Linphone::Native::Globals;
Platform::String^ voipServiceName;
Platform::String^ callInProgressPageUri;
Linphone::Native::Reason declineReason;
// The URI to the contact image, jpg or png, 1mb max !
Windows::Foundation::Uri^ defaultContactImageUri;
// The URI to the linphone icon, 128kb max !
Windows::Foundation::Uri^ linphoneImageUri;
Windows::Foundation::Uri^ ringtoneUri;
//Windows::Phone::Networking::Voip::VoipCallCoordinator^ callCoordinator;
Linphone::Native::LinphoneCall^ call;
IncomingCallViewDismissedCallback^ onIncomingCallViewDismissed;
Platform::Boolean customIncomingCallView;
//void OnAcceptCallRequested(Windows::Phone::Networking::Voip::VoipPhoneCall^ sender, Windows::Phone::Networking::Voip::CallAnswerEventArgs^ args);
//void OnRejectCallRequested(Windows::Phone::Networking::Voip::VoipPhoneCall^ sender, Windows::Phone::Networking::Voip::CallRejectEventArgs^ args);
//Windows::Foundation::TypedEventHandler<Windows::Phone::Networking::Voip::VoipPhoneCall^, Windows::Phone::Networking::Voip::CallAnswerEventArgs^>^ acceptCallRequestedHandler;
//Windows::Foundation::TypedEventHandler<Windows::Phone::Networking::Voip::VoipPhoneCall^, Windows::Phone::Networking::Voip::CallRejectEventArgs^>^ rejectCallRequestedHandler;
CallController();
~CallController();
};
}
}
......@@ -38,34 +38,34 @@ int Linphone::Native::CallLog::Duration::get()
return linphone_call_log_get_duration(this->callLog);
}
Linphone::Native::Address^ Linphone::Native::CallLog::From::get()
Linphone::Native::Address^ Linphone::Native::CallLog::FromAddress::get()
{
API_LOCK;
return (Linphone::Native::Address^)Linphone::Native::Utils::CreateAddress((void*)linphone_call_log_get_from(this->callLog));
return (Linphone::Native::Address^)Linphone::Native::Utils::CreateAddress((void*)linphone_call_log_get_from_address(this->callLog));
}
int64 Linphone::Native::CallLog::StartDate::get()
Platform::Boolean Linphone::Native::CallLog::IsVideoEnabled::get()
{
API_LOCK;
return linphone_call_log_get_start_date(this->callLog);
return (linphone_call_log_video_enabled(this->callLog) == TRUE);
}
Linphone::Native::CallStatus Linphone::Native::CallLog::Status::get()
int64 Linphone::Native::CallLog::StartDate::get()
{
API_LOCK;
return (Linphone::Native::CallStatus)linphone_call_log_get_status(this->callLog);
return linphone_call_log_get_start_date(this->callLog);
}
Linphone::Native::Address^ Linphone::Native::CallLog::To::get()
Linphone::Native::CallStatus Linphone::Native::CallLog::Status::get()
{
API_LOCK;
return (Linphone::Native::Address^)Linphone::Native::Utils::CreateAddress((void*)linphone_call_log_get_to(this->callLog));
return (Linphone::Native::CallStatus)linphone_call_log_get_status(this->callLog);
}
Platform::Boolean Linphone::Native::CallLog::VideoEnabled::get()
Linphone::Native::Address^ Linphone::Native::CallLog::ToAddress::get()
{
API_LOCK;
return (linphone_call_log_video_enabled(this->callLog) == TRUE);
return (Linphone::Native::Address^)Linphone::Native::Utils::CreateAddress((void*)linphone_call_log_get_to_address(this->callLog));
}
Linphone::Native::CallLog::CallLog(::LinphoneCallLog *cl)
......@@ -73,12 +73,16 @@ Linphone::Native::CallLog::CallLog(::LinphoneCallLog *cl)
{
API_LOCK;
RefToPtrProxy<CallLog^> *log = new RefToPtrProxy<CallLog^>(this);
linphone_call_log_set_user_pointer(this->callLog, log);
linphone_call_log_ref(this->callLog);
linphone_call_log_set_user_data(this->callLog, log);
}
Linphone::Native::CallLog::~CallLog()
{
API_LOCK;
RefToPtrProxy<CallLog^> *log = reinterpret_cast<RefToPtrProxy<CallLog^> *>(linphone_call_log_get_user_pointer(this->callLog));
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));
delete log;
}
......@@ -60,11 +60,19 @@ namespace Linphone
/// <summary>
/// Gets the Address of the caller.
/// </summary>
property Address^ From
property Address^ FromAddress
{
Address^ get();
}
/// <summary>
/// Tells whether video was enabled at the end of the call.
/// </summary>
property Platform::Boolean IsVideoEnabled
{
Platform::Boolean get();
}
/// <summary>
/// Returns the start date/time of the call in seconds elpsed since January first 1970.
/// </summary>
......@@ -84,19 +92,11 @@ namespace Linphone
/// <summary>
/// Gets the Address of the callee.
/// </summary>
property Address^ To
property Address^ ToAddress
{
Address^ get();
}
/// <summary>
/// Tells whether video was enabled at the end of the call.
/// </summary>
property Platform::Boolean VideoEnabled
{
Platform::Boolean get();
}
private:
friend class Linphone::Native::Utils;
friend ref class Linphone::Native::Core;
......
......@@ -17,6 +17,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "CallParams.h"
#include "Core.h"
#include "PayloadType.h"
#include "VideoSize.h"
using namespace Platform;
......@@ -46,18 +47,30 @@ void Linphone::Native::CallParams::AudioDirection::set(Linphone::Native::MediaDi
linphone_call_params_set_audio_direction(this->params, (LinphoneMediaDirection)value);
}
Platform::Boolean Linphone::Native::CallParams::LowBandwidthEnabled::get()
Platform::Boolean Linphone::Native::CallParams::IsLowBandwidthEnabled::get()
{
API_LOCK;
return (linphone_call_params_low_bandwidth_enabled(this->params) == TRUE);
}
void Linphone::Native::CallParams::LowBandwidthEnabled::set(Platform::Boolean enable)
void Linphone::Native::CallParams::IsLowBandwidthEnabled::set(Platform::Boolean enable)
{
API_LOCK;
linphone_call_params_enable_low_bandwidth(this->params, enable);
}
Platform::Boolean Linphone::Native::CallParams::IsVideoEnabled::get()
{
API_LOCK;
return (linphone_call_params_video_enabled(this->params) == TRUE);
}
void Linphone::Native::CallParams::IsVideoEnabled::set(Platform::Boolean enable)
{
API_LOCK;
linphone_call_params_enable_video(this->params, enable);
}
Linphone::Native::MediaEncryption Linphone::Native::CallParams::MediaEncryption::get()
{
API_LOCK;
......@@ -70,24 +83,18 @@ void Linphone::Native::CallParams::MediaEncryption::set(Linphone::Native::MediaE
linphone_call_params_set_media_encryption(this->params, (LinphoneMediaEncryption) menc);
}
Windows::Foundation::Size Linphone::Native::CallParams::ReceivedVideoSize::get()
Linphone::Native::VideoSize^ Linphone::Native::CallParams::ReceivedVideoSize::get()
{
API_LOCK;
MSVideoSize vs = linphone_call_params_get_received_video_size(this->params);
Windows::Foundation::Size size;
size.Width = (float)vs.width;
size.Height = (float)vs.height;
return size;
return ref new Linphone::Native::VideoSize(vs.width, vs.height);
}
Windows::Foundation::Size Linphone::Native::CallParams::SentVideoSize::get()
Linphone::Native::VideoSize^ Linphone::Native::CallParams::SentVideoSize::get()
{
API_LOCK;
MSVideoSize vs = linphone_call_params_get_sent_video_size(this->params);
Windows::Foundation::Size size;
size.Width = (float)vs.width;
size.Height = (float)vs.height;
return size;
return ref new Linphone::Native::VideoSize(vs.width, vs.height);
}
Linphone::Native::PayloadType^ Linphone::Native::CallParams::UsedAudioCodec::get()
......@@ -124,23 +131,26 @@ void Linphone::Native::CallParams::VideoDirection::set(Linphone::Native::MediaDi
linphone_call_params_set_video_direction(this->params, (LinphoneMediaDirection)value);
}
Platform::Boolean Linphone::Native::CallParams::VideoEnabled::get()
Linphone::Native::CallParams^ Linphone::Native::CallParams::Copy()
{
API_LOCK;
return (linphone_call_params_video_enabled(this->params) == TRUE);
}
void Linphone::Native::CallParams::VideoEnabled::set(Platform::Boolean enable)
{
API_LOCK;
linphone_call_params_enable_video(this->params, enable);
::LinphoneCallParams *newParams = linphone_call_params_copy(this->params);
return ref new Linphone::Native::CallParams(newParams);
}
Linphone::Native::CallParams::CallParams(::LinphoneCallParams *call_params)
: params(call_params)
{
API_LOCK;
RefToPtrProxy<CallParams^> *proxy = new RefToPtrProxy<CallParams^>(this);
linphone_call_params_ref(this->params);
linphone_call_params_set_user_data(this->params, proxy);
}
Linphone::Native::CallParams::~CallParams()
{
if (this->params != nullptr) {
linphone_call_params_unref(this->params);
}
RefToPtrProxy<CallParams^> *proxy = reinterpret_cast< RefToPtrProxy<CallParams^> *>(linphone_call_params_get_user_data(this->params));
delete proxy;
}