From 9d6c54772e9b73f1b131b2e76b31c7f6023b8e5a Mon Sep 17 00:00:00 2001 From: Fela Ameghino Date: Fri, 1 Sep 2017 12:56:52 +0200 Subject: [PATCH] Signal bars in CX wrapper --- os/windows/CXWrapper.cpp | 10 ++++++++++ os/windows/CXWrapper.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/os/windows/CXWrapper.cpp b/os/windows/CXWrapper.cpp index 5f71f3b..818ec53 100755 --- a/os/windows/CXWrapper.cpp +++ b/os/windows/CXWrapper.cpp @@ -40,6 +40,7 @@ VoIPControllerWrapper::VoIPControllerWrapper(){ controller=new VoIPController(); controller->implData=(void*)this; controller->SetStateCallback(VoIPControllerWrapper::OnStateChanged); + controller->SetSignalBarsCountCallback(VoIPControllerWrapper::OnSignalBarsChanged); stateCallback=nullptr; } @@ -136,11 +137,20 @@ void VoIPControllerWrapper::OnStateChanged(VoIPController* c, int state){ reinterpret_cast(c->implData)->OnStateChangedInternal(state); } +void VoIPControllerWrapper::OnSignalBarsChanged(VoIPController* c, int count){ + reinterpret_cast(c->implData)->OnSignalBarsChangedInternal(count); +} + void VoIPControllerWrapper::OnStateChangedInternal(int state){ if(stateCallback) stateCallback->OnCallStateChanged((CallState)state); } +void VoIPControllerWrapper::OnSignalBarsChangedInternal(int count){ + if(stateCallback) + stateCallback->OnSignalBarsChanged(count); +} + void VoIPControllerWrapper::SetConfig(double initTimeout, double recvTimeout, DataSavingMode dataSavingMode, bool enableAEC, bool enableNS, bool enableAGC, Platform::String^ logFilePath, Platform::String^ statsDumpFilePath){ voip_config_t config{0}; config.init_timeout=initTimeout; diff --git a/os/windows/CXWrapper.h b/os/windows/CXWrapper.h index d00d5fb..cc3e003 100755 --- a/os/windows/CXWrapper.h +++ b/os/windows/CXWrapper.h @@ -60,6 +60,7 @@ namespace libtgvoip{ public interface class IStateCallback{ void OnCallStateChanged(CallState newState); + void OnSignalBarsChanged(int count); }; public ref class VoIPControllerWrapper sealed{ @@ -85,7 +86,9 @@ namespace libtgvoip{ //static Platform::String^ TestAesIge(); private: static void OnStateChanged(tgvoip::VoIPController* c, int state); + static void OnSignalBarsChanged(tgvoip::VoIPController* c, int count); void OnStateChangedInternal(int state); + void OnSignalBarsChangedInternal(int count); tgvoip::VoIPController* controller; IStateCallback^ stateCallback; };