Apply profiles server-side rather than client-side, signal active profile update, forward loaded profile to local client for plugins

This commit is contained in:
Adam Honse
2026-02-03 11:36:29 -06:00
parent 6c26858823
commit 660ff71bf7
7 changed files with 456 additions and 103 deletions

View File

@@ -32,9 +32,9 @@ typedef void (*NetServerCallback)(void *);
typedef struct
{
NetPacketHeader header;
char * data;
unsigned int pkt_id;
unsigned int size;
SOCKET client_sock;
unsigned int client_protocol_version;
} NetworkServerControllerThreadQueueEntry;
@@ -128,6 +128,10 @@ public:
void SetProfileManager(ProfileManagerInterface* profile_manager_pointer);
void SetSettingsManager(SettingsManagerInterface* settings_manager_pointer);
void ProfileManager_ProfileAboutToLoad();
void SendRequest_ProfileManager_ActiveProfileChanged(std::string profile_name);
void SendRequest_ProfileManager_ProfileLoaded(std::string profile_json_string);
void SendRequest_RGBController_SignalUpdate(RGBController * controller_ptr, unsigned int update_reason);
private:
@@ -156,6 +160,8 @@ private:
std::shared_mutex controller_threads_mutex;
bool controller_updating;
NetworkServerControllerThread * profilemanager_thread;
/*-----------------------------------------------------*\
| Server clients |
\*-----------------------------------------------------*/
@@ -184,6 +190,8 @@ private:
ProfileManagerInterface* profile_manager;
SettingsManagerInterface* settings_manager;
unsigned int profile_about_to_load_acks;
unsigned int profile_about_to_load_count;
private:
#ifdef WIN32
/*-----------------------------------------------------*\
@@ -208,6 +216,7 @@ private:
void ConnectionThreadFunction(int socket_idx);
void ControllerListenThread(NetworkServerControllerThread * this_thread);
void ListenThreadFunction(NetworkClientInfo * client_sock);
void ProfileManagerListenThread(NetworkServerControllerThread * this_thread);
/*-----------------------------------------------------*\
| Server Protocol functions |
@@ -217,6 +226,13 @@ private:
void ProcessRequest_ClientString(SOCKET client_sock, unsigned int data_size, char * data);
void ProcessRequest_RescanDevices();
void ProcessRequest_ProfileManager_DeleteProfile(unsigned int data_size, char * data);
void ProcessRequest_ProfileManager_DownloadProfile(SOCKET client_sock, unsigned int data_size, char * data);
void ProcessRequest_ProfileManager_GetActiveProfile(SOCKET client_sock);
void ProcessRequest_ProfileManager_LoadProfile(unsigned int data_size, char * data);
void ProcessRequest_ProfileManager_SaveProfile(unsigned int data_size, char * data);
void ProcessRequest_ProfileManager_UploadProfile(unsigned int data_size, char * data);
void ProcessRequest_RGBController_AddSegment(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version);
void ProcessRequest_RGBController_ClearSegments(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version);
void ProcessRequest_RGBController_ResizeZone(unsigned int controller_id, unsigned char * data_ptr, unsigned int protocol_version);
@@ -242,6 +258,8 @@ private:
void SendRequest_DetectionStarted(SOCKET client_sock, unsigned int protocol_version);
void SendRequest_DeviceListChanged(SOCKET client_sock);
void SendRequest_ProfileManager_ProfileAboutToLoad();
/*-----------------------------------------------------*\
| Private helper functions |
\*-----------------------------------------------------*/