coffee.h
Go to the documentation of this file.
/*
* coffee.h
*
* Created on: Sep 25, 2017
* Author: sebastian
*/
#ifndef COFFEE_H_
#define COFFEE_H_
#include <csignal>
//define status
#define STATE_OFF 0
#define STATE_HEATING 1
#define STATE_INITALHEATING 2
#define STATE_IDLE 3
#define STATE_BREW 4
#define STATE_BREWMANUAL 5
#define STATE_CLEANING 6
#define STATE_ERROR 7
#define AMOUNT_PREINFUSION 3 //Preinfusion amount in ml
#define TIME_SOAK 3000//Time between preinfusion and infusion in ms
#define TIME_INFUSION 25000 //Infusion time in ms
#define AMOUNT_DBLESPRESSO 25.0 //Size of a double espresso in ml
void *coffeeThread(void *threadid);
void coffeeHandler (int signum, siginfo_t *siginfo, void *context);
int getSigValue(void);
bool SigValueEmpty(void);
void changeState(int newState);
int getState(void);
void brewTimeHandler (void);
void coffeeTerminate(void);
void coffeeBrew(void);
void coffeeIncreaseBrewCounter(void);
void coffeeIncreaseHeatingTime(uint64_t heatingTime);
#endif /* COFFEE_H_ */
SigValueEmpty
bool SigValueEmpty(void)
Definition: coffee.cpp:238
coffeeTerminate
void coffeeTerminate(void)
handles program termination
Definition: coffee.cpp:275
coffeeIncreaseHeatingTime
void coffeeIncreaseHeatingTime(uint64_t heatingTime)
Definition: coffee.cpp:350
getState
int getState(void)
Returns the current state of the FSM.
Definition: coffee.cpp:260
getSigValue
int getSigValue(void)
returns the Signal value from the last received Signal and clears the variable
Definition: coffee.cpp:232
coffeeIncreaseBrewCounter
void coffeeIncreaseBrewCounter(void)
Definition: coffee.cpp:340
coffeeHandler
void coffeeHandler(int signum, siginfo_t *siginfo, void *context)
Handler for the Signal send to this thread It saves the type of signal received and tracks the time b...
Definition: coffee.cpp:222
coffeeBrew
void coffeeBrew(void)
Brewing process.
Definition: coffee.cpp:285
heatingTime
double heatingTime
Definition: coffee.cpp:33
brewTimeHandler
void brewTimeHandler(void)
Counter for the brew time refresh every 200ms.
Definition: coffee.cpp:268
changeState
void changeState(int newState)
Changes the state of the machine to newState prints the change to the logger.
Definition: coffee.cpp:250
coffeeThread
void * coffeeThread(void *threadid)
Thread for the finite state machine It represents the current state of the machine and handles signal...
Definition: coffee.cpp:41