Commit fe57dc38 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Added UserPointer to LinphoneCall to store VoipPhoneCall objects + Renamed...

Added UserPointer to LinphoneCall to store VoipPhoneCall objects + Renamed BackEnd namespace to Core
parent 0fa8ba66
...@@ -5,6 +5,6 @@ ...@@ -5,6 +5,6 @@
*/*/*/Thumbs.db */*/*/Thumbs.db
*/ARM/ */ARM/
*/x86/ */x86/
BackEndProxyStub/Linphone.BackEnd* CoreProxyStub/Linphone.Core*
ARM/ ARM/
Linphone.sdf Linphone.sdf
\ No newline at end of file
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
<Compile Include="RegistrationHelper.cs" /> <Compile Include="RegistrationHelper.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\BackEnd\BackEnd.vcxproj"> <ProjectReference Include="..\Core\Core.vcxproj">
<Project>{C8D75245-FFCF-4932-A228-C9CC8BB60B03}</Project> <Project>{C8D75245-FFCF-4932-A228-C9CC8BB60B03}</Project>
<Name>BackEnd</Name> <Name>BackEnd</Name>
</ProjectReference> </ProjectReference>
......
using Microsoft.Phone.Networking.Voip; using Microsoft.Phone.Networking.Voip;
using Linphone.BackEnd; using Linphone.Core;
using Linphone.BackEnd.OutOfProcess; using Linphone.Core.OutOfProcess;
using System.Diagnostics; using System.Diagnostics;
namespace Linphone.Agents namespace Linphone.Agents
......
using Microsoft.Phone.Networking.Voip; using Microsoft.Phone.Networking.Voip;
using System.Diagnostics; using System.Diagnostics;
using Linphone.BackEnd; using Linphone.Core;
using System.Threading; using System.Threading;
using Linphone.BackEnd.OutOfProcess; using Linphone.Core.OutOfProcess;
namespace Linphone.Agents namespace Linphone.Agents
{ {
......
using Microsoft.Phone.Networking.Voip; using Microsoft.Phone.Networking.Voip;
using Microsoft.Phone.Scheduler; using Microsoft.Phone.Scheduler;
using Linphone.BackEnd; using Linphone.Core;
using Linphone.BackEnd.OutOfProcess; using Linphone.Core.OutOfProcess;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Xml.Serialization; using System.Xml.Serialization;
...@@ -36,7 +36,7 @@ namespace Linphone.Agents ...@@ -36,7 +36,7 @@ namespace Linphone.Agents
String callerName = "", callerNumber = ""; String callerName = "", callerNumber = "";
Debug.WriteLine("[{0}] Incoming call from caller {1}, number {2}", "KeepAliveAgent", callerName, callerNumber); Debug.WriteLine("[{0}] Incoming call from caller {1}, number {2}", "KeepAliveAgent", callerName, callerNumber);
bool incomingCallProcessingStarted = BackEnd.Globals.Instance.CallController.OnIncomingCallReceived(callerName, "+33609668573", this.OnIncomingCallViewDismissed); bool incomingCallProcessingStarted = Globals.Instance.CallController.OnIncomingCallReceived(callerName, "+33609668573", this.OnIncomingCallViewDismissed);
if (!incomingCallProcessingStarted) if (!incomingCallProcessingStarted)
{ {
......
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// Ce code a été généré par un outil. // Ce code a été généré par un outil.
// Version du runtime :4.0.30319.18010 // Version du runtime :4.0.30319.18033
// //
// Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si // Les modifications apportées à ce fichier peuvent provoquer un comportement incorrect et seront perdues si
// le code est régénéré. // le code est régénéré.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace Linphone.BackEnd.OutOfProcess { namespace Linphone.Core.OutOfProcess {
internal sealed class RegistrationHelper { internal sealed class RegistrationHelper {
internal static string[] OutOfProcServerClassNames = new string[] { internal static string[] OutOfProcServerClassNames = new string[] {
"Linphone.BackEnd.OutOfProcess.Server"}; "Linphone.Core.OutOfProcess.Server"};
} }
} }
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
// A mutex used to protect objects accessible from the API surface exposed by this DLL // A mutex used to protect objects accessible from the API surface exposed by this DLL
std::recursive_mutex g_apiLock; std::recursive_mutex g_apiLock;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
// A mutex used to protect objects accessible from the API surface exposed by this DLL // A mutex used to protect objects accessible from the API surface exposed by this DLL
extern std::recursive_mutex g_apiLock; extern std::recursive_mutex g_apiLock;
......
#include "CallController.h" #include "CallController.h"
#include "Server.h" #include "Server.h"
using namespace Linphone::BackEnd; using namespace Linphone::Core;
using namespace Platform; using namespace Platform;
using namespace Windows::Foundation; using namespace Windows::Foundation;
using namespace Windows::Phone::Networking::Voip; using namespace Windows::Phone::Networking::Voip;
...@@ -17,7 +17,7 @@ bool CallController::OnIncomingCallReceived(Platform::String^ contactName, Platf ...@@ -17,7 +17,7 @@ bool CallController::OnIncomingCallReceived(Platform::String^ contactName, Platf
{ {
std::lock_guard<std::recursive_mutex> lock(g_apiLock); std::lock_guard<std::recursive_mutex> lock(g_apiLock);
VoipPhoneCall^ incomingCall = nullptr; VoipPhoneCall^ incomingCall = nullptr;
this->callerNumber = contactNumber; this->callerNumber = contactNumber;
try try
...@@ -57,7 +57,6 @@ void CallController::OnAcceptCallRequested(VoipPhoneCall^ incomingCall, CallAnsw ...@@ -57,7 +57,6 @@ void CallController::OnAcceptCallRequested(VoipPhoneCall^ incomingCall, CallAnsw
std::lock_guard<std::recursive_mutex> lock(g_apiLock); std::lock_guard<std::recursive_mutex> lock(g_apiLock);
incomingCall->NotifyCallActive(); incomingCall->NotifyCallActive();
this->currentCall = incomingCall;
if (this->onIncomingCallViewDismissed != nullptr) if (this->onIncomingCallViewDismissed != nullptr)
this->onIncomingCallViewDismissed(); this->onIncomingCallViewDismissed();
...@@ -78,28 +77,20 @@ void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallReje ...@@ -78,28 +77,20 @@ void CallController::OnRejectCallRequested(VoipPhoneCall^ incomingCall, CallReje
this->callerNumber = nullptr; this->callerNumber = nullptr;
} }
void CallController::EndCurrentCall() void CallController::EndCall(VoipPhoneCall^ call)
{ {
std::lock_guard<std::recursive_mutex> lock(g_apiLock); std::lock_guard<std::recursive_mutex> lock(g_apiLock);
if (this->currentCall == nullptr) call->NotifyCallEnded();
return;
this->currentCall->NotifyCallEnded();
if (this->callControllerListener != nullptr) if (this->callControllerListener != nullptr)
this->callControllerListener->CallEnded(); this->callControllerListener->CallEnded();
this->currentCall = nullptr;
} }
Platform::Boolean CallController::NewOutgoingCall(Platform::String^ number, Platform::String^ name) VoipPhoneCall^ CallController::NewOutgoingCall(Platform::String^ number, Platform::String^ name)
{ {
std::lock_guard<std::recursive_mutex> lock(g_apiLock); std::lock_guard<std::recursive_mutex> lock(g_apiLock);
if (this->currentCall != nullptr)
return false;
VoipPhoneCall^ outgoingCall = nullptr; VoipPhoneCall^ outgoingCall = nullptr;
this->callCoordinator->RequestNewOutgoingCall( this->callCoordinator->RequestNewOutgoingCall(
...@@ -110,13 +101,12 @@ Platform::Boolean CallController::NewOutgoingCall(Platform::String^ number, Plat ...@@ -110,13 +101,12 @@ Platform::Boolean CallController::NewOutgoingCall(Platform::String^ number, Plat
&outgoingCall); &outgoingCall);
outgoingCall->NotifyCallActive(); outgoingCall->NotifyCallActive();
this->currentCall = outgoingCall;
this->callerNumber = number; this->callerNumber = number;
if (this->callControllerListener != nullptr) if (this->callControllerListener != nullptr)
this->callControllerListener->NewCallStarted(number); this->callControllerListener->NewCallStarted(number);
return true; return outgoingCall;
} }
CallController::CallController() : CallController::CallController() :
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
ref class Globals; ref class Globals;
...@@ -23,13 +23,13 @@ namespace Linphone ...@@ -23,13 +23,13 @@ namespace Linphone
// Returns true if the incoming call processing was started, false otherwise. // Returns true if the incoming call processing was started, false otherwise.
bool OnIncomingCallReceived(Platform::String^ contactName, Platform::String^ contactNumber, IncomingCallViewDismissedCallback^ incomingCallViewDismissedCallback); bool OnIncomingCallReceived(Platform::String^ contactName, Platform::String^ contactNumber, IncomingCallViewDismissedCallback^ incomingCallViewDismissedCallback);
void EndCurrentCall(); void EndCall(Windows::Phone::Networking::Voip::VoipPhoneCall^ call);
Platform::Boolean NewOutgoingCall(Platform::String^ number, Platform::String^ name); Windows::Phone::Networking::Voip::VoipPhoneCall^ NewOutgoingCall(Platform::String^ number, Platform::String^ name);
void SetCallControllerListener(CallControllerListener^ listener); void SetCallControllerListener(CallControllerListener^ listener);
private: private:
friend ref class Linphone::BackEnd::Globals; friend ref class Linphone::Core::Globals;
CallControllerListener^ callControllerListener; CallControllerListener^ callControllerListener;
...@@ -52,8 +52,6 @@ namespace Linphone ...@@ -52,8 +52,6 @@ namespace Linphone
IncomingCallViewDismissedCallback^ onIncomingCallViewDismissed; IncomingCallViewDismissedCallback^ onIncomingCallViewDismissed;
Windows::Phone::Networking::Voip::VoipPhoneCall^ currentCall;
// Called by the VoipCallCoordinator when the user accepts an incoming call. // Called by the VoipCallCoordinator when the user accepts an incoming call.
void OnAcceptCallRequested(Windows::Phone::Networking::Voip::VoipPhoneCall^ sender, Windows::Phone::Networking::Voip::CallAnswerEventArgs^ args); void OnAcceptCallRequested(Windows::Phone::Networking::Voip::VoipPhoneCall^ sender, Windows::Phone::Networking::Voip::CallAnswerEventArgs^ args);
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
public interface class CallControllerListener public interface class CallControllerListener
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
public enum class CallDirection : int public enum class CallDirection : int
{ {
......
...@@ -12,14 +12,14 @@ ...@@ -12,14 +12,14 @@
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<ProjectGuid>{c8d75245-ffcf-4932-a228-c9cc8bb60b03}</ProjectGuid> <ProjectGuid>{c8d75245-ffcf-4932-a228-c9cc8bb60b03}</ProjectGuid>
<RootNamespace>Linphone.BackEnd</RootNamespace> <RootNamespace>Linphone.Core</RootNamespace>
<DefaultLanguage>en-US</DefaultLanguage> <DefaultLanguage>en-US</DefaultLanguage>
<VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath> <VCTargetsPath Condition="'$(VCTargetsPath11)' != '' and '$(VSVersion)' == '' and '$(VisualStudioVersion)' == ''">$(VCTargetsPath11)</VCTargetsPath>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion> <MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<TargetPlatformIdentifier>Windows Phone</TargetPlatformIdentifier> <TargetPlatformIdentifier>Windows Phone</TargetPlatformIdentifier>
<TargetPlatformVersion>8.0</TargetPlatformVersion> <TargetPlatformVersion>8.0</TargetPlatformVersion>
<WinMDAssembly>true</WinMDAssembly> <WinMDAssembly>true</WinMDAssembly>
<ProjectName>BackEnd</ProjectName> <ProjectName>Core</ProjectName>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'" Label="Configuration">
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "LinphoneCoreFactory.h" #include "LinphoneCoreFactory.h"
#include "LinphoneCore.h" #include "LinphoneCore.h"
using namespace Linphone::BackEnd; using namespace Linphone::Core;
using namespace Windows::Foundation; using namespace Windows::Foundation;
using namespace Windows::Phone::Media::Capture; using namespace Windows::Phone::Media::Capture;
...@@ -134,7 +134,7 @@ CallController^ Globals::CallController::get() ...@@ -134,7 +134,7 @@ CallController^ Globals::CallController::get()
if (this->callController == nullptr) if (this->callController == nullptr)
{ {
this->callController = ref new Linphone::BackEnd::CallController(); this->callController = ref new Linphone::Core::CallController();
} }
} }
...@@ -150,7 +150,7 @@ LinphoneCoreFactory^ Globals::LinphoneCoreFactory::get() ...@@ -150,7 +150,7 @@ LinphoneCoreFactory^ Globals::LinphoneCoreFactory::get()
if (this->linphoneCoreFactory == nullptr) if (this->linphoneCoreFactory == nullptr)
{ {
this->linphoneCoreFactory = ref new Linphone::BackEnd::LinphoneCoreFactory(); this->linphoneCoreFactory = ref new Linphone::Core::LinphoneCoreFactory();
} }
} }
...@@ -205,7 +205,7 @@ Globals::Globals() : ...@@ -205,7 +205,7 @@ Globals::Globals() :
} }
// Initialize the call controller // Initialize the call controller
this->callController = ref new Linphone::BackEnd::CallController(); this->callController = ref new Linphone::Core::CallController();
} }
Globals::~Globals() Globals::~Globals()
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
ref class CallController; ref class CallController;
ref class LinphoneCoreFactory; ref class LinphoneCoreFactory;
...@@ -32,19 +32,19 @@ namespace Linphone ...@@ -32,19 +32,19 @@ namespace Linphone
Globals^ get(); Globals^ get();
} }
property Linphone::BackEnd::CallController^ CallController property CallController^ CallController
{ {
Linphone::BackEnd::CallController^ get(); Linphone::Core::CallController^ get();
} }
property Linphone::BackEnd::LinphoneCoreFactory^ LinphoneCoreFactory property LinphoneCoreFactory^ LinphoneCoreFactory
{ {
Linphone::BackEnd::LinphoneCoreFactory^ get(); Linphone::Core::LinphoneCoreFactory^ get();
} }
property Linphone::BackEnd::LinphoneCore^ LinphoneCore property LinphoneCore^ LinphoneCore
{ {
Linphone::BackEnd::LinphoneCore^ get(); Linphone::Core::LinphoneCore^ get();
} }
private: private:
...@@ -73,9 +73,9 @@ namespace Linphone ...@@ -73,9 +73,9 @@ namespace Linphone
// An event that indicates that the background process is ready // An event that indicates that the background process is ready
HANDLE backgroundReadyEvent; HANDLE backgroundReadyEvent;
Linphone::BackEnd::CallController^ callController; Linphone::Core::CallController^ callController;
Linphone::BackEnd::LinphoneCoreFactory^ linphoneCoreFactory; Linphone::Core::LinphoneCoreFactory^ linphoneCoreFactory;
}; };
} }
} }
#include "LinphoneAddress.h" #include "LinphoneAddress.h"
#include "Server.h" #include "Server.h"
using namespace Linphone::BackEnd; using namespace Linphone::Core;
Platform::String^ LinphoneAddress::GetDisplayName() Platform::String^ LinphoneAddress::GetDisplayName()
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
public ref class LinphoneAddress sealed public ref class LinphoneAddress sealed
{ {
......
#include "LinphoneAuthInfo.h" #include "LinphoneAuthInfo.h"
#include "Server.h" #include "Server.h"
using namespace Linphone::BackEnd; using namespace Linphone::Core;
Platform::String^ LinphoneAuthInfo::GetUsername() Platform::String^ LinphoneAuthInfo::GetUsername()
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
public ref class LinphoneAuthInfo sealed public ref class LinphoneAuthInfo sealed
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "LinphoneCallParams.h" #include "LinphoneCallParams.h"
#include "Server.h" #include "Server.h"
using namespace Linphone::BackEnd; using namespace Linphone::Core;
LinphoneCallState LinphoneCall::GetState() LinphoneCallState LinphoneCall::GetState()
{ {
...@@ -112,3 +112,13 @@ Platform::String^ LinphoneCall::GetRemoteContact() ...@@ -112,3 +112,13 @@ Platform::String^ LinphoneCall::GetRemoteContact()
{ {
return nullptr; return nullptr;
} }
void LinphoneCall::UserPointer::set(Platform::Object^ up)
{
this->userPointer = up;
}
Platform::Object^ LinphoneCall::UserPointer::get()
{
return this->userPointer;
}
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
ref class LinphoneAddress; ref class LinphoneAddress;
ref class LinphoneCallLog; ref class LinphoneCallLog;
...@@ -61,6 +61,15 @@ namespace Linphone ...@@ -61,6 +61,15 @@ namespace Linphone
float GetPlayVolume(); float GetPlayVolume();
Platform::String^ GetRemoteUserAgent(); Platform::String^ GetRemoteUserAgent();
Platform::String^ GetRemoteContact(); Platform::String^ GetRemoteContact();
property Platform::Object^ UserPointer
{
Platform::Object^ get();
void set(Platform::Object^ up);
}
private:
Platform::Object^ userPointer;
}; };
} }
} }
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "CallDirection.h" #include "CallDirection.h"
#include "Server.h" #include "Server.h"
using namespace Linphone::BackEnd; using namespace Linphone::Core;
LinphoneAddress^ LinphoneCallLog::GetFrom() LinphoneAddress^ LinphoneCallLog::GetFrom()
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
ref class LinphoneAddress; ref class LinphoneAddress;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "PayloadType.h" #include "PayloadType.h"
#include "Server.h" #include "Server.h"
using namespace Linphone::BackEnd; using namespace Linphone::Core;
void LinphoneCallParams::SetAudioBandwidth() void LinphoneCallParams::SetAudioBandwidth()
{ {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
ref class PayloadType; ref class PayloadType;
......
#include "LinphoneCallStats.h" #include "LinphoneCallStats.h"
#include "Server.h" #include "Server.h"
using namespace Linphone::BackEnd; using namespace Linphone::Core;
MediaType LinphoneCallStats::GetMediaType() MediaType LinphoneCallStats::GetMediaType()
{ {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
public enum class MediaType : int public enum class MediaType : int
{ {
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "Server.h" #include "Server.h"
#include "CallController.h" #include "CallController.h"
using namespace Linphone::BackEnd; using namespace Linphone::Core;
using namespace Platform; using namespace Platform;
Transports::Transports() Transports::Transports()
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
namespace Linphone namespace Linphone
{ {
namespace BackEnd namespace Core
{ {
ref class LinphoneCoreFactory; ref class LinphoneCoreFactory;
ref class LinphoneProxyConfig; ref class LinphoneProxyConfig;
...@@ -217,7 +217,7 @@ namespace Linphone ...@@ -217,7 +217,7 @@ namespace Linphone
LpConfig^ GetConfig(); LpConfig^ GetConfig();
private: private:
friend ref class Linphone::BackEnd::LinphoneCoreFactory; friend ref class Linphone::Core::LinphoneCoreFactory;
LinphoneCore(); LinphoneCore();
~LinphoneCore(); ~LinphoneCore();
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include "LinphoneCoreListener.h" #include "LinphoneCoreListener.h"
#include "Server.h" #include "Server.h"