<?xml version="1.0" encoding="UTF-8"?>
<model version="4.5.1" links="0">
 <framework name="qpcpp"/>
 <package name="AOs" stereotype="0x02">
  <class name="Mission" superclass="qpcpp::QActive">
   <statechart properties="0x00">
    <initial target="../7">
     <action brief="StartMission"/>
     <initial_glyph conn="77,24,5,3,11">
      <action box="-1,-3,10,2"/>
     </initial_glyph>
    </initial>
    <state name="InitProfile">
     <documentation>Start CTD periodic FP command</documentation>
     <entry brief="State Entry Ops">doStdStateEntry();
doInitProfileStateEntry();</entry>
     <exit brief="State Exit Ops">doStdStateExit();
doInitProfileStateExit();</exit>
     <tran trig="IPDone" target="../../2">
      <tran_glyph conn="98,75,2,0,3">
       <action box="-6,1,10,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="88,67,21,8">
      <entry box="1,2,17,2"/>
      <exit box="1,4,17,2"/>
     </state_glyph>
    </state>
    <state name="FindNeutralBuoyancy">
     <entry brief="State Entry Ops">doStdStateEntry();
doFNBStateEntry();</entry>
     <exit brief="State Exit Ops">doStdStateExit();
doFNBStateExit();</exit>
     <tran trig="TIMEOUT" target="../../6">
      <tran_glyph conn="94,92,2,0,4">
       <action box="-7,0,10,2"/>
      </tran_glyph>
     </tran>
     <state name="FNB_CheckDepth">
      <entry>doStdStateEntry();
doFNBCheckDepthStateEntry();</entry>
      <exit>doStdStateExit();
doBFNBCheckDepthStateExit();</exit>
      <tran trig="Need to descend" target="../../2">
       <tran_glyph conn="122,89,1,3,16">
        <action box="1,0,14,2"/>
       </tran_glyph>
      </tran>
      <tran trig="FNB_CheckDepthTIMEOUT" target="..">
       <tran_glyph conn="122,87,1,0,14,-5,-23,3">
        <action box="-5,-5,22,2"/>
       </tran_glyph>
      </tran>
      <tran trig="FoundNeutral" target="../../../6">
       <tran_glyph conn="113,91,2,0,5">
        <action box="0,2,12,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="105,85,17,6">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state name="StartDescend">
      <tran trig="FNBDesending" target="../../1">
       <tran_glyph conn="155,89,1,0,3,-8,-48,4">
        <action box="-10,-7,13,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="138,85,17,6"/>
     </state>
     <state_glyph node="88,78,72,14">
      <entry box="1,2,17,2"/>
      <exit box="1,4,17,2"/>
     </state_glyph>
    </state>
    <state name="EmergencyAscend">
     <tran trig="atSurfaceRecovery" target="../../4">
      <tran_glyph conn="72,54,1,3,16">
       <action box="1,-2,13,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="47,50,25,8"/>
    </state>
    <state name="RecoverySurfaceOps">
     <entry>doStdStateEntry();
doRecoverySOStatEntry();</entry>
     <exit>doStdStateExit();
doRecoverySOStateExit();</exit>
     <tran trig="GotGo" target="../../1">
      <tran_glyph conn="98,63,2,0,4">
       <action box="-5,1,7,2"/>
      </tran_glyph>
     </tran>
     <tran trig="RecSO_TIMEOUT" target="../5">
      <tran_glyph conn="199,56,1,0,14,-10,-111,7">
       <action box="0,-10,15,2"/>
      </tran_glyph>
     </tran>
     <state name="DownloadRecoverySBD">
      <entry>doStdStateEntry();
doDownloadRecoverySBDStateEntry();</entry>
      <exit>doStdStateEntry();
doDownloadIRecoverySBDStateExit();</exit>
      <tran trig="RestartMission" target="../../../1">
       <tran_glyph conn="186,59,2,1,10,-77">
        <action box="-16,8,12,2"/>
       </tran_glyph>
      </tran>
      <tran trig="RecGotNewMission" target="../../../5">
       <tran_glyph conn="187,53,0,1,-13,-78">
        <action box="-11,-13,10,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="177,53,19,6">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state name="BuildRecoverySBD">
      <entry>doStdStateEntry();
doBuildRecSBD();</entry>
      <exit>doStdStateExit();
doBuildRecSBDStateExit();</exit>
      <tran trig="RecSBDBuilt" target="../../4">
       <tran_glyph conn="136,57,1,3,11">
        <action box="0,-2,10,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="119,53,17,6">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state name="DownloadRecSBD">
      <entry>doStdStateEntry();
doUploadRecSBDStateEntry();</entry>
      <exit>doStdStateExit();
doUploadRecSBDStateExit();</exit>
      <tran trig="RecSBDUploaded" target="../../2">
       <tran_glyph conn="163,57,1,3,14">
        <action box="0,-2,14,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="147,53,16,6">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state name="GetPosition">
      <entry>doStdStateEntry();
doRecGetPositionStateEntry();</entry>
      <exit>doStdSateExit();
doRecGetPositionStateExit();</exit>
      <tran trig="GotRecPosition" target="../../3">
       <tran_glyph conn="106,57,1,3,13">
        <action box="0,-2,13,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="95,53,11,6">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state_glyph node="88,48,111,15">
      <entry box="1,2,6,2"/>
      <exit box="1,4,6,2"/>
     </state_glyph>
    </state>
    <state name="InitMission">
     <entry brief="State Entry Ops">doStdStateEntry();
doInitMissionStateEntry();</entry>
     <exit brief="State Exit Ops">doStdStateExit();
doInitMissionStateExit();</exit>
     <tran trig="IMDone" target="../../4">
      <tran_glyph conn="98,42,2,0,6">
       <action box="-6,1,10,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="88,34,21,8">
      <entry box="1,2,17,2"/>
      <exit box="1,4,17,2"/>
     </state_glyph>
    </state>
    <state name="Profile">
     <documentation>Look for park depths
Look for anchor
</documentation>
     <entry brief="State Entry Ops">doStdStateEntry();
doDescendStateEntry();</entry>
     <exit brief="State Exit Ops">doStdStateExit();
doDescendStateExit(Descend</exit>
     <tran trig="TIMEOUT" target="../../8">
      <tran_glyph conn="97,131,2,0,7">
       <action box="-8,2,8,2"/>
      </tran_glyph>
     </tran>
     <state name="Park">
      <entry brief="State Entry Ops">doStdStateEntry();
doParkStateEntry();</entry>
      <exit brief="State Exit Ops">doStdStateExit();
doParkStateExit();</exit>
      <tran trig="ProfileSampleInstr" target="../../3">
       <tran_glyph conn="183,107,1,3,15">
        <action box="0,-2,14,2"/>
       </tran_glyph>
      </tran>
      <tran trig="DescParkTIMEOUT" target="../../5">
       <tran_glyph conn="167,110,2,2,5,-69,-5">
        <action box="-16,3,17,2"/>
       </tran_glyph>
      </tran>
      <tran trig="ParkCheckDandT" target="../../2">
       <tran_glyph conn="183,104,1,0,4,-4,-54,3">
        <action box="-10,-4,15,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="162,103,21,7">
       <entry box="1,2,17,2"/>
       <exit box="1,4,14,2"/>
      </state_glyph>
     </state>
     <state name="ProfileCheckDepthAndTime">
      <entry>doStdStateEntry();
doDescendCheckDepthStateEntry();</entry>
      <exit>doStdStateExit();
doDescendCheckDepthStateExit();</exit>
      <tran trig="AtParkPt" target="../../1">
       <tran_glyph conn="144,106,1,3,18">
        <action box="0,-2,10,2"/>
       </tran_glyph>
      </tran>
      <tran trig="SampleInstr" target="../../3">
       <tran_glyph conn="144,108,1,2,15,4,51,-2">
        <action box="0,-2,13,2"/>
       </tran_glyph>
      </tran>
      <tran trig="HitBottom" target="../../4">
       <tran_glyph conn="133,110,2,3,14,16">
        <action box="1,12,12,2"/>
       </tran_glyph>
      </tran>
      <tran trig="ProfileDone" target="../../../8">
       <tran_glyph conn="129,110,2,0,28">
        <action box="1,22,13,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="123,103,21,7">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state name="GetSamples">
      <tran trig="DoneSampling" target="../../2">
       <tran_glyph conn="207,103,0,0,-4,-78,4">
        <action box="-13,-4,13,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="198,103,18,7"/>
     </state>
     <state name="Anchor">
      <entry brief="State Entry Ops">doStdStateEntry();
doAnchorStateEntry();</entry>
      <exit brief="State Exit Ops">doStdStateExit();
doAnchorStateExit();</exit>
      <tran trig="AnchorOffBottom" target="../../5">
       <tran_glyph conn="149,127,3,2,-55,-17">
        <action box="-13,-2,13,2"/>
       </tran_glyph>
      </tran>
      <tran trig="AnchorCheckDandT" target="../../2">
       <tran_glyph conn="170,126,1,3,2,-6,-54,-12,5">
        <action box="-17,-8,19,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="149,121,21,8">
       <entry box="1,2,17,2"/>
       <exit box="1,4,17,2"/>
      </state_glyph>
     </state>
     <state name="StartVelocityController">
      <tran trig="ProfileVelCtrlrStarted" target="../../2">
       <tran_glyph conn="108,107,1,3,15">
        <action box="0,-2,21,3"/>
       </tran_glyph>
      </tran>
      <state_glyph node="89,103,19,7"/>
     </state>
     <state_glyph node="88,96,129,35">
      <entry box="1,2,17,2"/>
      <exit box="1,4,17,2"/>
     </state_glyph>
    </state>
    <state name="InitPlatform">
     <entry brief="Init state and init all sensors and devices">InitPlatform();
InitErrorHandler();
InitGPSDevice();
IntEngrLogger();
InitSciLogger();
InitBellowsPosSensor();
InitCTDepthSensor();
InitMSCSensor();
InitFLBBSensor();
InitOCRSensor();
InitOptodeSensor();

</entry>
     <exit brief="State Exit Ops">doStdStateExit();
doInitMissionStateExit();</exit>
     <tran trig="IPDone" target="../../5">
      <tran_glyph conn="98,26,2,0,8">
       <action box="-6,2,10,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="88,16,34,10">
      <entry box="1,2,28,2"/>
      <exit box="1,4,17,2"/>
     </state_glyph>
    </state>
    <state name="SurfaceOps">
     <entry brief="State Entry Ops">doStdStateEntry();
doSurfaceOpsStateEntry();</entry>
     <exit brief="State Exit Ops">doStdStateExit();
doSurfaceOpsStateExit();</exit>
     <state name="BuildSOSbd">
      <entry>doStdStateEntry();
doBuildIridiumMessage();</entry>
      <exit>doStdStateExit();
doBuildIridiumMessageStateExit();</exit>
      <tran trig="SO_SBDBuilt" target="../../1">
       <tran_glyph conn="131,150,1,3,12">
        <action box="0,-2,10,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="114,146,17,6">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state name="UploadSO_SBD">
      <entry>doStdStateEntry();
doUploadIridiumMessageStateEntry();</entry>
      <exit>doStdStateEntry();
doUploadIridiumMessageStateEntry();</exit>
      <tran trig="SO_SBDUploaded" target="../../3">
       <tran_glyph conn="159,150,1,3,17">
        <action box="0,-2,15,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="143,146,16,6">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state name="GetPosition">
      <entry>doStdStateEntry();
doGetPositionStatEntry();</entry>
      <exit>doStdSateExit();
soGetPositionStateExit();</exit>
      <tran trig="GotSOPosition" target="../../0">
       <tran_glyph conn="101,150,1,3,13">
        <action box="0,-2,10,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="90,146,11,6">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state name="DownloadRecSBD">
      <entry>doStdStateEntry();
doDownloadIridiumMessageStateEntry();</entry>
      <exit>doStdStateEntry();
doDownloadIridiumMessageStateEntry();</exit>
      <tran trig="SO_SBDUploaded" target="../../4/1">
       <tran_glyph conn="195,150,1,3,4,5,-100,9,10">
        <action box="-11,3,16,2"/>
       </tran_glyph>
      </tran>
      <state_glyph node="176,146,19,6">
       <entry box="1,2,6,2"/>
       <exit box="1,4,6,2"/>
      </state_glyph>
     </state>
     <state name="UploadFileActions">
      <tran trig="SOGotNewMission" target="../../../5">
       <tran_glyph conn="189,161,1,1,38,-124,-118">
        <action box="9,-2,16,2"/>
       </tran_glyph>
      </tran>
      <state name="Action1">
       <tran trig="Action1Done" target="../../2">
        <tran_glyph conn="124,163,1,3,9">
         <action box="0,-2,10,2"/>
        </tran_glyph>
       </tran>
       <state_glyph node="109,160,15,6"/>
      </state>
      <state name="Action2">
       <tran trig="Action2Done" target="../../3">
        <tran_glyph conn="148,163,1,3,11">
         <action box="0,-2,10,2"/>
        </tran_glyph>
       </tran>
       <state_glyph node="133,160,15,6"/>
      </state>
      <state name="Action3">
       <tran trig="SODone" target="../../../../1">
        <tran_glyph conn="176,163,1,1,47,-91,-114">
         <action box="31,-2,12,2"/>
        </tran_glyph>
       </tran>
       <state_glyph node="159,160,17,6"/>
      </state>
      <state_glyph node="105,156,84,12"/>
     </state>
     <state_glyph node="88,138,115,32">
      <entry box="1,2,17,2"/>
      <exit box="1,4,17,2"/>
     </state_glyph>
    </state>
    <state_diagram size="337,199"/>
   </statechart>
  </class>
  <class name="BuoyancyControllers" superclass="qpcpp::QActive">
   <statechart properties="0x00">
    <state name="BuoyancyControllers">
     <state name="InitVelocityController">
      <state_glyph node="27,15,17,6"/>
     </state>
     <state name="runVelocityController">
      <state_glyph node="27,25,17,6"/>
     </state>
     <state name="initDepthController">
      <state_glyph node="47,15,16,6"/>
     </state>
     <state name="runDepthController">
      <state_glyph node="47,25,16,6"/>
     </state>
     <state_glyph node="24,10,42,28"/>
    </state>
    <state_diagram size="80,50"/>
   </statechart>
  </class>
 </package>
 <directory name=".">
  <file name="Mission.c">
   <text>#include &quot;qpcpp.hpp&quot;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt; // for exit()

using namespace std;
using namespace QP;

enum { BSP_TICKS_PER_SEC = 100 };

extern &quot;C&quot; void Q_onAssert(char const * const module, int loc) {
    cout &lt;&lt; &quot;Assertion failed in &quot; &lt;&lt; module &lt;&lt; ':' &lt;&lt; loc &lt;&lt; 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 MissionSignals {
    TIMEOUT_SIG = Q_USER_SIG,
    MAX_SIG
};

//=============== ask QM to declare the Mission class ==================
$declare${AOs::Mission}

static Mission l_mission;
QActive * const AO_Mission = &amp;l_mission;

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

    QF::init(); // initialize the framework
    AO_Mission-&gt;start(1U, // priority
                     mission_queueSto, Q_DIM(mission_queueSto),
                     (void *)0, 0U); // no stack
    return QF::run(); // run the QF application
}

//================ ask QM to define the Mission class ==================
$define${AOs::Mission}
</text>
  </file>
  <file name="BuoyancyControllers.c">
   <text>#include &quot;qpcpp.hpp&quot;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt; // for exit()

using namespace std;
using namespace QP;

enum { BSP_TICKS_PER_SEC = 100 };

extern &quot;C&quot; void Q_onAssert(char const * const module, int loc) {
    cout &lt;&lt; &quot;Assertion failed in &quot; &lt;&lt; module &lt;&lt; ':' &lt;&lt; loc &lt;&lt; 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}

static BC l_bc;
QActive * const AO_BC = &amp;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-&gt;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 ==================
$define${AOs::BuoyancyControllers}
</text>
  </file>
 </directory>
</model>
