Server sends a request to the client when the device list is updated

This commit is contained in:
Adam Honse 2020-09-27 22:12:34 +00:00
parent 854bc099f7
commit 60fd721586
5 changed files with 68 additions and 4 deletions

View file

@ -1,3 +1,14 @@
/*-----------------------------------------*\
| ResourceManager.cpp |
| |
| OpenRGB Resource Manager controls access |
| to application components including |
| RGBControllers, I2C interfaces, and |
| network SDK components |
| |
| Adam Honse (CalcProgrammer1) 9/27/2020 |
\*-----------------------------------------*/
#include "ResourceManager.h"
#include "ProfileManager.h"
@ -21,10 +32,13 @@ ResourceManager *ResourceManager::get()
ResourceManager::ResourceManager()
{
detection_percent = 100;
detection_string = "";
/*-------------------------------------------------------------------------*\
| Initialize Detection Variables |
\*-------------------------------------------------------------------------*/
detection_percent = 100;
detection_string = "";
detection_is_required = false;
DetectDevicesThread = nullptr;
DetectDevicesThread = nullptr;
/*-------------------------------------------------------------------------*\
| Initialize Server Instance |
@ -86,13 +100,19 @@ void ResourceManager::DeviceListChanged()
DeviceListChangeMutex.lock();
/*-------------------------------------------------*\
| Client info has changed, call the callbacks |
| Device list has changed, call the callbacks |
\*-------------------------------------------------*/
for(unsigned int callback_idx = 0; callback_idx < DeviceListChangeCallbacks.size(); callback_idx++)
{
DeviceListChangeCallbacks[callback_idx](DeviceListChangeCallbackArgs[callback_idx]);
}
/*-------------------------------------------------*\
| Device list has changed, inform all clients |
| connected to this server |
\*-------------------------------------------------*/
server->DeviceListChanged();
DeviceListChangeMutex.unlock();
}