C

Qt Quick Ultralite Motorcycle Cluster Demo

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

#include "simulation/smfwd.h"

namespace Simulation {
struct SimulationState : Machine::AbstractState
{
    void onEnter(const StateId &, const Layer &, Machine &) {}
    void onUpdate(uint32_t, const Layer &, Machine &) {}
    void onLeave(const StateId &, const Layer &, Machine &) {}
};

struct IntroState : public SimulationState
{
    IntroState(const StateId &nextState);

    void onEnter(const StateId &, const Layer &layer, Machine &sm);
    void onUpdate(uint32_t, const Layer &layer, Machine &sm);

private:
    enum Step {
        Step_Blank,
        Step_ShowLogo,
        Step_ShowBLinkers,
        Step_ShowTellTales,
        Step_ShowTachoScale,
        Step_ShowBottomElements,
        Step_ShowBgLines,
        Step_ShowBgRoad,
        Step_ShowSpeedometer,
        Step_ShowGauges,
        Step_RpmToMax,
        Step_RpmToZero,
        Step_Done
    } _step;

    StateId _nextState;
};

struct EndState : public SimulationState
{
    EndState(const StateId &nextState);
    void onEnter(const StateId &prevState, const Layer &layer, Machine &sm);
    void onUpdate(uint32_t, const Layer &layer, Machine &sm);
    void onLeave(const StateId &, const Layer &, Machine &);

private:
    enum Step {
        Step_Blank,
        Step_HideBgLines,
        Step_HideRoad,
        Step_HideGauges,
        Step_HideBottomElements,
        Step_HideTellTales,
        Step_HideTachoScale,
        Step_HideTacho,
        Step_HideTachoFramesTop,
        Step_Done
    } _step;
    StateId _nextState;
};

} // namespace Simulation
#endif // STATES_H