C

Qt Quick Ultralite Automotive Cluster Demo

// Copyright (C) 2024 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial
#ifndef LIGHTS_H
#define LIGHTS_H

#include <stdint.h>

namespace Simulation {
class Lights
{
public:
    enum LightType { ParkingLights, LowBeamHeadlights, TurnLeft, TurnRight, LIGHTS_NUM };

    Lights();
    void update(uint32_t tick);
    void setLightState(LightType light, bool enabled, uint32_t duration = 0);
    bool getLightState(LightType light) const;

private:
    void resetLight(LightType light, bool enabled = false);

    bool _lightStates[LIGHTS_NUM];
    uint32_t _lightTimers[LIGHTS_NUM];
};
} // namespace Simulation

#endif // LIGHTS_H