/* * Copyright (c) 2023 Fancy Code. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SET_LED_STATE_H #define SET_LED_STATE_H #include "IDeviceManager.h" #include "LedControl.h" constexpr int LED_BLINKING_FAST_PERIOD = 500; constexpr int LED_BLINKING_SLOW_PERIOD = 1000; class SetLedState : public LedControlContext, public VSingleControl { public: SetLedState(const LedState &state, const unsigned int &keepAliveTime = KEEP_ALIVE_FOREVER, const unsigned int &blinkPeriod = LED_NOT_BLINK); virtual ~SetLedState() = default; StatusCode GetLedState(LedState &state) override; unsigned int GetKeepAliveTimeMs(void) override; unsigned int GetBlinkTimeMs(void) override; void DeleteState(void); public: static std::shared_ptr ControlLed(const std::string &ledName, const LedState &state, const long int &keepAliveTime = KEEP_ALIVE_FOREVER, const unsigned int &blinkPeriod = LED_NOT_BLINK); private: const LedState mState; unsigned int mKeepAliveTime; const unsigned int mBlinkPeriod; }; #endif