<?xml version="1.0" encoding="UTF-8"?>
<!-- car_alarm.xml - state chart XML file -->

<!-- Copyright (c) 2007-2008, Jason Breti (http://breti.org/codegen)   -->
<!-- All rights reserved.                                              -->
<!-- This code is released under the BSD License, as specified in the  -->
<!-- license.txt file.                                                 -->

<scxml initialstate="Initial">

  <state id="Initial">
    <transition event="BatteryOn">
      <target next="Unarmed"/>
    </transition>
  </state>
  
  <state id="Unarmed">
    <onentry>
      <function name="StopUnarmTimer"/>
    </onentry>

    <transition event="RemoteArm">
      <target next="Armed"/>
    </transition>
  </state>
  
  <state id="Armed">
    <onentry>
      <function name="LockDoors"/>
    </onentry>

    <transition event="RemoteUnarm">
      <target next="WaitingToUnarm"/>
    </transition>
  </state>
  
  <state id="WaitingToUnarm">
    <onentry>
      <function name="UnlockDoors"/>
      <function name="StartUnarmTimer"/>
    </onentry>

    <transition event="DoorsOpen">
      <target next="Unarmed"/>
    </transition>
    
    <transition event="UnarmTimerExpired">
      <target next="Armed"/>
    </transition>
  </state>
  
</scxml>


