oven/oven.c File Reference

#include <stdio.h>
#include <tchar.h>
#include "simplehsm.h"

Enumerations

enum  oven_signals_t { SIG_OPEN_DOOR = SIG_USER, SIG_CLOSE_DOOR, SIG_TOASTING, SIG_BAKING }

Functions

stnext oven (int signal, void *param)
stnext heating (int signal, void *param)
stnext toasting (int signal, void *param)
stnext baking (int signal, void *param)
stnext doorOpen (int signal, void *param)
void show_status (simplehsm_t *hsm)
int _tmain (int argc, _TCHAR *argv[])

Variables

simplehsm_t hsm = {NULL}

Detailed Description

Author:
Daniel Newton <djpnewton@gmail.com>
Version:
1.0

LICENSE

Copyright (c) 2009 Daniel Newton

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

DESCRIPTION

A contrived oven state machine. A simple demo of the simplehsm C implementation.

Enumeration Type Documentation

The oven state machine signals

Enumerator:
SIG_OPEN_DOOR  The oven door has been opened
SIG_CLOSE_DOOR  The oven door has been closed
SIG_TOASTING  The toasting mode has been selected
SIG_BAKING  The baking mode has been selected


Function Documentation

int _tmain ( int  argc,
_TCHAR *  argv[] 
)

Main function of the oven program

Sets the initial state, sends a signal and then shows the state machine status

stnext baking ( int  signal,
void *  param 
)

The baking state

Parameters:
signal The signal to send to this state
param A signal specific parameter
Returns:
stnone if the signal is handled, otherwise the parent state (heating())

stnext doorOpen ( int  signal,
void *  param 
)

The doorOpen state

Parameters:
signal The signal to send to this state
param A signal specific parameter
Returns:
stnone if the signal is handled, otherwise the parent state (oven())

stnext heating ( int  signal,
void *  param 
)

The heating state. This state contains a deep history psuedostate.

Parameters:
signal The signal to send to this state
param A signal specific parameter
Returns:
stnone/stdeephist if the signal is handled, otherwise the parent state (oven())

stnext oven ( int  signal,
void *  param 
)

The top level oven state

Parameters:
signal The signal to send to this state
param A signal specific parameter
Returns:
Aways returns stnone indicating that this is the top level state

void show_status ( simplehsm_t hsm  ) 

Show the status of the oven state machine by showing what states it is currently in

Parameters:
hsm The oven state machine

stnext toasting ( int  signal,
void *  param 
)

The toasting state

Parameters:
signal The signal to send to this state
param A signal specific parameter
Returns:
stnone if the signal is handled, otherwise the parent state (heating())


Variable Documentation

simplehsm_t hsm = {NULL}

The Oven state machine object


Generated on Thu Feb 4 09:32:56 2010 for simplehsm(C) by  doxygen 1.5.9