<?xml version="1.0" encoding="ISO-8859-1"?>
<ssc:StateChart xmlns:ssc="http://www.sinelabore.com/SSC/1_0" Version="1.0">
  <ssc:Header>#include &lt;stdio.h&gt;
#include &lt;stdint.h&gt;
#include &lt;stdbool.h&gt;
#include "coffee_ext.h"
#include "coffee.h"
#include "timer_service.h"
extern uint32_t brewTime;   /* seconds, set by the application */
extern bool withMilk;       /* the user's choice */</ssc:Header>
  <ssc:Action />
  <ssc:StateHeader />
  <ssc:AdditionalIncludesStates />
  <ssc:UseTimerService>yes</ssc:UseTimerService>
  <ssc:InitState Id="b1f0c2d4-1a2b-4c3d-8e9f-000000000001">
    <ssc:Transition ToState="Idle" FromState="b1f0c2d4-1a2b-4c3d-8e9f-000000000001" />
  </ssc:InitState>
  <ssc:State Name="Idle">
    <ssc:Transition Event="evStart" ToState="Brewing" FromState="Idle" />
  </ssc:State>
  <ssc:State Name="Brewing">
    <EntryCode>heaterOn();</EntryCode>
    <ExitCode>heaterOff();</ExitCode>
    <ssc:InnerTransition Event="every(1s)" ToState="Brewing" FromState="Brewing" Action="printf(&quot;.&quot;);" />
    <ssc:Transition Event="brewTimer: after(brewTime s)" ToState="b1f0c2d4-1a2b-4c3d-8e9f-000000000002" FromState="Brewing" />
  </ssc:State>
  <ssc:ChoiceState Name="C0" Id="b1f0c2d4-1a2b-4c3d-8e9f-000000000002">
    <ssc:Transition ToState="Frothing" FromState="b1f0c2d4-1a2b-4c3d-8e9f-000000000002" Guard="withMilk" />
    <ssc:Transition ToState="Ready" FromState="b1f0c2d4-1a2b-4c3d-8e9f-000000000002" Guard="else" />
  </ssc:ChoiceState>
  <ssc:State Name="Frothing">
    <EntryCode>frotherOn();</EntryCode>
    <ExitCode>frotherOff();</ExitCode>
    <ssc:Transition Event="after(3s)" ToState="Ready" FromState="Frothing" />
  </ssc:State>
  <ssc:State Name="Ready" />
</ssc:StateChart>
