//$file${.::BuoyancyControllers.cpp} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//
// Model: CPF.qm
// File:  ${.::BuoyancyControllers.cpp}
//
// This code has been generated by QM 4.5.1 (https://www.state-machine.com/qm).
// DO NOT EDIT THIS FILE MANUALLY. All your changes will be lost.
//
// This program is open source software: you can redistribute it and/or
// modify it under the terms of the GNU General Public License as published
// by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
//$endhead${.::BuoyancyControllers.cpp} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#include "qpcpp.hpp"
#include "qep.hpp"
#include <iostream>
#include <stdlib.h> // for exit()

using namespace std;
using namespace QP;

enum { BSP_TICKS_PER_SEC = 100 };

extern "C" void Q_onAssert(char const * const module, int loc) {
    cout << "Assertion failed in " << module << ':' << loc << endl;
    exit(-1);
}
void QF::onStartup(void) {}
void QF::onCleanup(void) {}
void QP::QF_onClockTick(void) {
    QF::TICK_X(0U, (void *)0);  // perform the QF clock tick processing
}

enum BCSignals {
    TIMEOUT_SIG = Q_USER_SIG,
    MAX_SIG
};

//=============== ask QM to declare the Buoyancy Controllers class ==================
//$declare${AOs::BuoyancyControllers} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//${AOs::BuoyancyControllers} ................................................
class BuoyancyControllers : public QP::QActive {
protected:
    Q_STATE_DECL(initial);
    Q_STATE_DECL(BuoyancyControllers);
    Q_STATE_DECL(InitVelocityController);
    Q_STATE_DECL(runVelocityController);
    Q_STATE_DECL(initDepthController);
    Q_STATE_DECL(runDepthController);
};
//$enddecl${AOs::BuoyancyControllers} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

static BC l_bc;
QActive * const AO_BC = &l_bc;

int main() {
    // statically allocate event queue buffer for the Buoyancy Controllers AO
    static QEvt const *bc_queueSto[10];

    QF::init(); // initialize the framework
    AO_BC->start(1U, // priority
                     bc_queueSto, Q_DIM(bc_queueSto),
                     (void *)0, 0U); // no stack
    return QF::run(); // run the QF application
}

//================ ask QM to define the Buoyancy Controllers class ==================
//$skip${QP_VERSION} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
// Check for the minimum required QP version
#if (QP_VERSION < 650U) || (QP_VERSION != ((QP_RELEASE^4294967295U) % 0x3E8U))
#error qpcpp version 6.5.0 or higher required
#endif
//$endskip${QP_VERSION} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
//$define${AOs::BuoyancyControllers} vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
//${AOs::BuoyancyControllers} ................................................
//${AOs::BuoyancyControll~::SM} ..............................................
//${AOs::BuoyancyControll~::SM::BuoyancyControllers} .........................
Q_STATE_DEF(BuoyancyControllers, BuoyancyControllers) {
    QP::QState status_;
    switch (e->sig) {
        default: {
            status_ = super(&top);
            break;
        }
    }
    return status_;
}
//${AOs::BuoyancyControll~::SM::BuoyancyControll~::InitVelocityController} ...
Q_STATE_DEF(BuoyancyControllers, InitVelocityController) {
    QP::QState status_;
    switch (e->sig) {
        default: {
            status_ = super(&BuoyancyControllers);
            break;
        }
    }
    return status_;
}
//${AOs::BuoyancyControll~::SM::BuoyancyControll~::runVelocityController} ....
Q_STATE_DEF(BuoyancyControllers, runVelocityController) {
    QP::QState status_;
    switch (e->sig) {
        default: {
            status_ = super(&BuoyancyControllers);
            break;
        }
    }
    return status_;
}
//${AOs::BuoyancyControll~::SM::BuoyancyControll~::initDepthController} ......
Q_STATE_DEF(BuoyancyControllers, initDepthController) {
    QP::QState status_;
    switch (e->sig) {
        default: {
            status_ = super(&BuoyancyControllers);
            break;
        }
    }
    return status_;
}
//${AOs::BuoyancyControll~::SM::BuoyancyControll~::runDepthController} .......
Q_STATE_DEF(BuoyancyControllers, runDepthController) {
    QP::QState status_;
    switch (e->sig) {
        default: {
            status_ = super(&BuoyancyControllers);
            break;
        }
    }
    return status_;
}
//$enddef${AOs::BuoyancyControllers} ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
