| 190 | } |
| 191 | |
| 192 | void 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 |
| 221 | void FXHelper::ClearAndRefresh(bool force) { |
no test coverage detected