MCPcopy Create free account
hub / github.com/BlueAndi/Pixelix / process

Method process

lib/TimerService/src/TimerService.cpp:165–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165void TimerService::process()
166{
167 if (true == m_isRunning &&
168 (true == m_processTimer.isTimerRunning()) &&
169 (true == m_processTimer.isTimeout()))
170 {
171 ClockDrv& clockDrv = ClockDrv::getInstance();
172 struct tm time;
173
174 if (true == clockDrv.getTime(time))
175 {
176 MutexGuard<Mutex> guard(m_mutex);
177 size_t idx;
178
179 for (idx = 0U; idx < MAX_TIMER_COUNT; ++idx)
180 {
181 if (true == m_settings[idx].isEnabled())
182 {
183 if (true == m_settings[idx].isSignalling(time))
184 {
185 TimerSetting::DisplayState displayState = m_settings[idx].getDisplayState();
186 int16_t brightness = m_settings[idx].getBrightness();
187
188 if (TimerSetting::DISPLAY_STATE_ON == displayState)
189 {
190 LOG_INFO("Timer %u is switching display on.", idx);
191
192 DisplayMgr::getInstance().displayOn();
193 }
194 else if (TimerSetting::DISPLAY_STATE_OFF == displayState)
195 {
196 LOG_INFO("Timer %u is switching display off.", idx);
197
198 DisplayMgr::getInstance().displayOff();
199 }
200 else
201 {
202 ;
203 }
204
205 if ((0 <= brightness) && (255 >= brightness))
206 {
207 LOG_INFO("Timer %u is setting brightness to %d.", idx, brightness);
208
209 DisplayMgr::getInstance().setBrightness(static_cast<uint8_t>(brightness));
210 }
211 }
212 }
213 }
214 }
215
216 m_processTimer.restart();
217 }
218}
219
220/******************************************************************************
221 * Protected Methods

Callers

nothing calls this directly

Calls 11

isTimerRunningMethod · 0.80
isTimeoutMethod · 0.80
isSignallingMethod · 0.80
getDisplayStateMethod · 0.80
displayOnMethod · 0.80
displayOffMethod · 0.80
restartMethod · 0.80
getTimeMethod · 0.45
isEnabledMethod · 0.45
getBrightnessMethod · 0.45
setBrightnessMethod · 0.45

Tested by

no test coverage detected