1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-11-27 04:34:42 +01:00

Merge pull request #34 from UnigramDev/public

Signal bars in CX wrapper
This commit is contained in:
Gregory K 2017-09-02 07:20:15 +03:00 committed by GitHub
commit a8aff0e64c
2 changed files with 13 additions and 0 deletions

View File

@ -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<VoIPControllerWrapper^>(c->implData)->OnStateChangedInternal(state);
}
void VoIPControllerWrapper::OnSignalBarsChanged(VoIPController* c, int count){
reinterpret_cast<VoIPControllerWrapper^>(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;

View File

@ -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;
};