MCPcopy Create free account
hub / github.com/T-Troll/alienfx-tools / QueryCommand

Method QueryCommand

alienfx-gui/FXHelper.cpp:192–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190}
191
192void FXHelper::QueryCommand(WORD pid, LightQueryElement &lqe) {
193 if (updateAllowed) {
194 DeviceUpdateQuery* devQuery = &devLightQuery[pid];
195 if (!devQuery->haveNewElement) {
196 // create thread and event
197 devQuery->haveNewElement = CreateEvent(NULL, true, false, NULL);
198 LightQueryData* ld = new LightQueryData({ pid, this });
199 devQuery->updateThread = CreateThread(NULL, 0, CLightsProc, ld, 0, NULL);
200 DebugPrint("Light updates started for device " + to_string(pid) + ".\n");
201 }
202
203 if (WaitForSingleObject(haveLightFX, 0) == WAIT_TIMEOUT) {
204 if (wasLFX) {
205 wasLFX = false;
206 QueryAllDevs(LightQueryElement({ 0, 5 }));
207 QueryAllDevs(LightQueryElement({ 0, 2 }));
208 }
209 modifyQuery.lockWrite();
210 devQuery->lightQuery.push(lqe);
211 modifyQuery.unlockWrite();
212 SetEvent(devQuery->haveNewElement);
213 }
214 else
215 wasLFX = true;
216 }
217
218}
219
220// Clear light states before forced save
221void FXHelper::ClearAndRefresh(bool force) {

Callers 1

UpdateLightDevicesFunction · 0.80

Calls 3

lockWriteMethod · 0.80
unlockWriteMethod · 0.80
LightQueryElementClass · 0.70

Tested by

no test coverage detected