<?xml version="1.0" encoding="UTF-8"?>
<model version="5.0.0" links="1">
 <documentation>QHsmTst is a contrived state machine from Chapter 2 of the PSiCC2 book for testing all possible transition topologies with up to 4-levels of state nesting.</documentation>
 <!--${qpn}-->
 <framework name="qpn"/>
 <!--${SMs}-->
 <package name="SMs" stereotype="0x02">
  <!--${SMs::ToastOven}-->
  <class name="ToastOven" superclass="qpn::QHsm">
   <documentation>Oven state machine</documentation>
   <!--${SMs::ToastOven::SM}-->
   <statechart properties="0x01">
    <!--${SMs::ToastOven::SM::initial}-->
    <initial target="../1">
     <initial_glyph conn="3,2,5,1,53,4,-4">
      <action box="2,-2,13,4"/>
     </initial_glyph>
    </initial>
    <!--${SMs::ToastOven::SM::doorClosed}-->
    <state name="doorClosed">
     <entry>PRINTF_S(&quot;%s;&quot;, &quot;door-Closed&quot;);</entry>
     <!--${SMs::ToastOven::SM::doorClosed::initial}-->
     <initial target="../8">
      <initial_glyph conn="40,10,4,0,10">
       <action box="0,-2,6,2"/>
      </initial_glyph>
     </initial>
     <!--${SMs::ToastOven::SM::doorClosed::history}-->
     <history type="deep" target="../8">
      <history_glyph conn="52,16,1,0,-8,4"/>
     </history>
     <!--${SMs::ToastOven::SM::doorClosed::TERMINATE}-->
     <tran trig="TERMINATE" target="../../3">
      <tran_glyph conn="52,30,1,0,16,2">
       <action box="0,-2,9,2"/>
      </tran_glyph>
     </tran>
     <!--${SMs::ToastOven::SM::doorClosed::OPEN}-->
     <tran trig="OPEN" target="../../2">
      <tran_glyph conn="52,10,1,3,8">
       <action box="0,-2,6,2"/>
      </tran_glyph>
     </tran>
     <!--${SMs::ToastOven::SM::doorClosed::TOAST}-->
     <tran trig="TOAST" target="../7/1">
      <tran_glyph conn="12,38,2,2,-6">
       <action box="0,-2,6,2"/>
      </tran_glyph>
     </tran>
     <!--${SMs::ToastOven::SM::doorClosed::BAKE}-->
     <tran trig="BAKE" target="../7/2">
      <tran_glyph conn="28,38,2,2,-6">
       <action box="0,-2,6,2"/>
      </tran_glyph>
     </tran>
     <!--${SMs::ToastOven::SM::doorClosed::OFF}-->
     <tran trig="OFF" target="../8">
      <tran_glyph conn="44,38,2,2,-10">
       <action box="0,-2,6,2"/>
      </tran_glyph>
     </tran>
     <!--${SMs::ToastOven::SM::doorClosed::heating}-->
     <state name="heating">
      <entry>PRINTF_S(&quot;%s;&quot;, &quot;heater-On&quot;);</entry>
      <exit>PRINTF_S(&quot;%s;&quot;, &quot;heater-Off&quot;);</exit>
      <!--${SMs::ToastOven::SM::doorClosed::heating::initial}-->
      <initial target="../1">
       <initial_glyph conn="14,16,4,0,8">
        <action box="0,-2,10,2"/>
       </initial_glyph>
      </initial>
      <!--${SMs::ToastOven::SM::doorClosed::heating::toasting}-->
      <state name="toasting">
       <entry>PRINTF_S(&quot;%s;&quot;, &quot;toasting&quot;);</entry>
       <state_glyph node="6,24,14,8">
        <entry box="1,2,5,2"/>
       </state_glyph>
      </state>
      <!--${SMs::ToastOven::SM::doorClosed::heating::baking}-->
      <state name="baking">
       <entry>PRINTF_S(&quot;%s;&quot;, &quot;baking&quot;);</entry>
       <state_glyph node="22,24,12,8">
        <entry box="1,2,5,2"/>
       </state_glyph>
      </state>
      <state_glyph node="4,11,32,23">
       <entry box="1,2,7,2"/>
       <exit box="1,4,5,2"/>
      </state_glyph>
     </state>
     <!--${SMs::ToastOven::SM::doorClosed::off}-->
     <state name="off">
      <entry>PRINTF_S(&quot;%s;&quot;, &quot;toaster-Off&quot;);</entry>
      <state_glyph node="38,20,12,8">
       <entry box="1,2,5,2"/>
      </state_glyph>
     </state>
     <state_glyph node="2,4,50,34">
      <entry box="1,2,5,2"/>
     </state_glyph>
    </state>
    <!--${SMs::ToastOven::SM::doorOpen}-->
    <state name="doorOpen">
     <entry>PRINTF_S(&quot;%s;&quot;, &quot;door-Open,lamp-On&quot;);</entry>
     <exit>PRINTF_S(&quot;%s;&quot;, &quot;lamp-Off&quot;);</exit>
     <!--${SMs::ToastOven::SM::doorOpen::CLOSE}-->
     <tran trig="CLOSE" target="../../1" cpref="../../1/1">
      <tran_glyph conn="60,16,3,1,-7">
       <action box="-6,-2,7,2"/>
      </tran_glyph>
     </tran>
     <!--${SMs::ToastOven::SM::doorOpen::TERMINATE}-->
     <tran trig="TERMINATE" target="../../3">
      <tran_glyph conn="70,26,2,0,6">
       <action box="0,0,8,2"/>
      </tran_glyph>
     </tran>
     <state_glyph node="60,4,18,22">
      <entry box="1,2,6,2"/>
      <exit box="1,4,5,2"/>
     </state_glyph>
    </state>
    <!--${SMs::ToastOven::SM::final}-->
    <state name="final">
     <entry>BSP_exit(); /* terminate the application */</entry>
     <state_glyph node="60,32,16,6">
      <entry box="1,2,5,2"/>
     </state_glyph>
    </state>
    <state_diagram size="80,40"/>
   </statechart>
  </class>
  <!--${SMs::AO_ToastOven}-->
  <attribute name="AO_ToastOven" type="ToastOven" visibility="0x00" properties="0x00"/>
  <!--${SMs::ToastOven_ctor}-->
  <operation name="ToastOven_ctor" type="void" visibility="0x00" properties="0x00">
   <code>ToastOven *me = &amp;l_oven;
QHsm_ctor(&amp;me-&gt;super, Q_STATE_CAST(&amp;ToastOven_initial));</code>
  </operation>
 </package>
 <!--${.}-->
 <directory name=".">
  <!--${.::history.h}-->
  <file name="history.h">
   <text>#ifndef HISTORY_H
#define HISTORY_H

enum ToastOvenSignals {
    OPEN_SIG = Q_USER_SIG,
    CLOSE_SIG,
    TOAST_SIG,
    BAKE_SIG,
    OFF_SIG,
    TERMINATE_SIG /* terminate the application */
};

extern QHsm * const the_oven; /* opaque pointer to the oven HSM */

$declare(SMs::ToastOven_ctor)

#endif /* HISTORY_H */
</text>
  </file>
  <!--${.::history.c}-->
  <file name="history.c">
   <text>#include &quot;qpn.h&quot;     /* QP-nano */
#include &quot;bsp.h&quot;     /* Board Support Package */
#include &quot;history.h&quot; /* Application interface */

#include &quot;safe_std.h&quot; /* portable &quot;safe&quot; &lt;stdio.h&gt;/&lt;string.h&gt; facilities */
#include &lt;stdlib.h&gt;

//Q_DEFINE_THIS_FILE

$declare(SMs::ToastOven)

static ToastOven l_oven; /* the only instance of the ToastOven class */

/* global-scope definitions -----------------------------------------*/
QHsm * const the_oven = (QHsm *)&amp;l_oven; /* the opaque pointer */

$define(SMs::ToastOven_ctor)
$define(SMs::ToastOven)</text>
  </file>
 </directory>
</model>
