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

Added fake events GlobalState and RegistrationState

parent 63ab0f1a
......@@ -51,6 +51,7 @@ Platform::String^ Transports::ToString()
return "udp[" + udp + "] tcp[" + tcp + "] tls[" + tls + "]";
}
void LinphoneCore::SetContext(Platform::Object^ object)
{
......@@ -63,7 +64,7 @@ void LinphoneCore::ClearProxyConfigs()
void LinphoneCore::AddProxyConfig(LinphoneProxyConfig^ proxyCfg)
{
this->proxyCfgAdded = true;
}
void LinphoneCore::SetDefaultProxyConfig(LinphoneProxyConfig^ proxyCfg)
......@@ -118,6 +119,30 @@ void LinphoneCore::Iterate()
this->listener->CallState(this->call, LinphoneCallState::CallEnd);
this->call = nullptr;
}
if (this->listener != nullptr && this->startup)
{
this->listener->GlobalState(GlobalState::GlobalStartup, L"");
this->startup = false;
this->on = true;
}
else if (this->listener != nullptr && this->on)
{
this->listener->GlobalState(GlobalState::GlobalOn, L"");
this->on = false;
}
if (this->listener != nullptr && this->proxyCfgAdded && !this->on)
{
this->listener->RegistrationState(nullptr, RegistrationState::RegistrationInProgress, L"");
this->proxyCfgAdded = false;
this->proxyCfgRegistered = true;
}
else if (this->listener != nullptr && this->proxyCfgRegistered)
{
this->listener->RegistrationState(nullptr, RegistrationState::RegistrationOk, L"");
this->proxyCfgRegistered = false;
}
}
void LinphoneCore::Destroy()
......@@ -686,9 +711,13 @@ LinphoneCore::LinphoneCore(LinphoneCoreListener^ coreListener) :
callAccepted(false),
callEnded(false),
callConnected(false),
proxyCfgAdded(false),
proxyCfgRegistered(false),
startup(true),
on(false),
listener(coreListener)
{
}
LinphoneCore::~LinphoneCore()
......
......@@ -418,6 +418,12 @@ namespace Linphone
bool callAccepted;
bool callEnded;
bool callConnected;
bool proxyCfgAdded;
bool proxyCfgRegistered;
bool startup;
bool on;
LinphoneCore(LinphoneCoreListener^ coreListener);
~LinphoneCore();
......
No preview for this file type
......@@ -173,6 +173,13 @@ namespace Linphone.Model
return;
server.LinphoneCoreFactory.CreateLinphoneCore(this);
SettingsManager sm = new SettingsManager();
if (sm.Username != null && sm.Username.Length > 0 && sm.Domain != null && sm.Domain.Length > 0)
{
server.LinphoneCore.AddProxyConfig(null);
}
timer = new Timer(LinphoneCoreIterate, null, 1, 20);
Debug.WriteLine("[LinphoneManager] LinphoneCore created");
}
......@@ -354,7 +361,7 @@ namespace Linphone.Model
/// </summary>
public void GlobalState(GlobalState state, string message)
{
Debug.WriteLine("[LinphoneManager] Global state changed: " + state.ToString() + ", message=" + message);
}
/// <summary>
......@@ -419,7 +426,7 @@ namespace Linphone.Model
/// </summary>
public void RegistrationState(LinphoneProxyConfig config, RegistrationState state, string message)
{
Debug.WriteLine("[LinphoneManager] Registration state changed: " + state.ToString() + ", message=" + message);
}
/// <summary>
......
......@@ -47,6 +47,9 @@ namespace Linphone.Views
_appSettings.Proxy = Domain.Text;
_appSettings.OutboundProxy = OutboundProxy.IsChecked;
LinphoneManager.Instance.LinphoneCore.ClearProxyConfigs();
LinphoneManager.Instance.LinphoneCore.AddProxyConfig(new Core.LinphoneProxyConfig());
NavigationService.GoBack();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment