66 lines
2.0 KiB
C++
66 lines
2.0 KiB
C++
/*
|
|
* 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.
|
|
*/
|
|
|
|
#include "LedManager.h"
|
|
#include "ILog.h"
|
|
|
|
LedManager::LedManager()
|
|
{
|
|
mLedHal = nullptr;
|
|
mCurrentState = NEW_LED_STATE;
|
|
mBlinkPeriod = LED_NOT_BLINK;
|
|
mKeepAliveTime = DEFAULT_KEEP_ALIVE_TIME;
|
|
mStateAliveTime = 0;
|
|
}
|
|
|
|
LedManager::LedManager(std::shared_ptr<VLedHal> &LedHal, const LedState &CurrentState,
|
|
const unsigned int &KeepAliveTime, const unsigned int &BlinkPeriod)
|
|
{
|
|
mLedHal = LedHal;
|
|
mCurrentState = CurrentState;
|
|
mKeepAliveTime = KeepAliveTime;
|
|
mBlinkPeriod = BlinkPeriod;
|
|
mStateAliveTime = 0;
|
|
}
|
|
|
|
std::shared_ptr<VLedHal> LedManager::GetLedHal(void) { return mLedHal; }
|
|
|
|
StatusCode LedManager::SetLedState(LedState &CurrentState, const unsigned int &KeepAliveTime,
|
|
const unsigned int &BlinkPeriod)
|
|
{
|
|
mCurrentState = CurrentState;
|
|
mKeepAliveTime = KeepAliveTime;
|
|
mBlinkPeriod = BlinkPeriod;
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
|
|
StatusCode LedManager::GetLedState(LedState &CurrentState)
|
|
{
|
|
CurrentState = mCurrentState;
|
|
return CreateStatusCode(STATUS_CODE_OK);
|
|
}
|
|
|
|
// StatusCode LedManager::BlinkOn(LedState CurrentState, unsigned int KeepAliveTime)
|
|
// {
|
|
// mKeepAliveTime = KeepAliveTime;
|
|
// return CreateStatusCode(STATUS_CODE_OK);
|
|
// }
|
|
|
|
// StatusCode LedManager::BlinkOff(void)
|
|
// {
|
|
// mCurrentState = LedState::LED_STATE_OFF;
|
|
// return CreateStatusCode(STATUS_CODE_OK);
|
|
// }
|