1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-11-27 12:44:37 +01:00

Signal bars in CX wrapper

This commit is contained in:
Fela Ameghino 2017-09-01 12:56:52 +02:00
parent 6e840a6992
commit 9d6c54772e
2 changed files with 13 additions and 0 deletions

View File

@ -40,6 +40,7 @@ VoIPControllerWrapper::VoIPControllerWrapper(){
controller=new VoIPController(); controller=new VoIPController();
controller->implData=(void*)this; controller->implData=(void*)this;
controller->SetStateCallback(VoIPControllerWrapper::OnStateChanged); controller->SetStateCallback(VoIPControllerWrapper::OnStateChanged);
controller->SetSignalBarsCountCallback(VoIPControllerWrapper::OnSignalBarsChanged);
stateCallback=nullptr; stateCallback=nullptr;
} }
@ -136,11 +137,20 @@ void VoIPControllerWrapper::OnStateChanged(VoIPController* c, int state){
reinterpret_cast<VoIPControllerWrapper^>(c->implData)->OnStateChangedInternal(state); reinterpret_cast<VoIPControllerWrapper^>(c->implData)->OnStateChangedInternal(state);
} }
void VoIPControllerWrapper::OnSignalBarsChanged(VoIPController* c, int count){
reinterpret_cast<VoIPControllerWrapper^>(c->implData)->OnSignalBarsChangedInternal(count);
}
void VoIPControllerWrapper::OnStateChangedInternal(int state){ void VoIPControllerWrapper::OnStateChangedInternal(int state){
if(stateCallback) if(stateCallback)
stateCallback->OnCallStateChanged((CallState)state); 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){ 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}; voip_config_t config{0};
config.init_timeout=initTimeout; config.init_timeout=initTimeout;

View File

@ -60,6 +60,7 @@ namespace libtgvoip{
public interface class IStateCallback{ public interface class IStateCallback{
void OnCallStateChanged(CallState newState); void OnCallStateChanged(CallState newState);
void OnSignalBarsChanged(int count);
}; };
public ref class VoIPControllerWrapper sealed{ public ref class VoIPControllerWrapper sealed{
@ -85,7 +86,9 @@ namespace libtgvoip{
//static Platform::String^ TestAesIge(); //static Platform::String^ TestAesIge();
private: private:
static void OnStateChanged(tgvoip::VoIPController* c, int state); static void OnStateChanged(tgvoip::VoIPController* c, int state);
static void OnSignalBarsChanged(tgvoip::VoIPController* c, int count);
void OnStateChangedInternal(int state); void OnStateChangedInternal(int state);
void OnSignalBarsChangedInternal(int count);
tgvoip::VoIPController* controller; tgvoip::VoIPController* controller;
IStateCallback^ stateCallback; IStateCallback^ stateCallback;
}; };