friendev EtherDune TCP/IP library
/home/jander/temp/etherdune/Stateful.cpp
Go to the documentation of this file.
1 // EtherDune State tracking class
2 // Author: Javier Peletier <jm@friendev.com>
3 // Summary: Maintains a state variable and allows to pull out a state string representation for debugging
4 //
5 // Copyright (c) 2015 All Rights Reserved, http://friendev.com
6 //
7 // This source is subject to the GPLv2 license.
8 // Please see the License.txt file for more information.
9 // All other rights reserved.
10 //
11 // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
12 // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
13 // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
14 // PARTICULAR PURPOSE.
15 
16 #include "Stateful.h"
17 
18 
19 #define AC_LOGLEVEL 6
20 #include <ACLog.h>
21 ACROSS_MODULE("Stateful");
22 
28 void Stateful::setState(uint8_t newState, uint8_t timeout)
29 {
30  state = newState;
31  stateTimer = timeout;
32 
33  ACDEBUG("set state=%S", getStateString());
34 }
void setState(uint8_t newState, uint8_t timeout)
Changes to a new state
Definition: Stateful.cpp:28
ACROSS_MODULE("Stateful")
uint8_t stateTimer
state timer, in ticks
Definition: Stateful.h:34
uint8_t state
state code
Definition: Stateful.h:35