| 37 | } |
| 38 | |
| 39 | void ScreenshotService::startTimed(const std::string& path, uint8_t delayInSeconds, uint8_t amount) { |
| 40 | auto lock = mutex.asScopedLock(); |
| 41 | if (!lock.lock(50 / portTICK_PERIOD_MS)) { |
| 42 | LOGGER.warn(LOG_MESSAGE_MUTEX_LOCK_FAILED); |
| 43 | return; |
| 44 | } |
| 45 | |
| 46 | if (task == nullptr || task->isFinished()) { |
| 47 | task = std::make_unique<ScreenshotTask>(); |
| 48 | mode = Mode::Timed; |
| 49 | task->startTimed(path, delayInSeconds, amount); |
| 50 | } else { |
| 51 | LOGGER.warn("Screenshot task already running"); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | bool ScreenshotService::onStart(ServiceContext& serviceContext) { |
| 56 | if (lv_screen_active() == nullptr) { |
no test coverage detected