Saltware / Mbed 2 deprecated Water Play

Dependencies:   mbed DRV88255 TextLCD Ping mbed-rtos

Embed: (wiki syntax)

« Back to documentation index

SensorAlarmController Class Reference

The AlarmController monitors a Sensor and registers unsafe values. More...

#include <SensorAlarmController.h>

Inherits Controller.

Public Member Functions

 SensorAlarmController (bool threaded, int interval_ms, SensorController *sensor, float min_crit, float min_undesired, float max_crit, float max_undesired)
 Contructs a new AlarmController which monitors the given SensorController.
virtual void update ()
 Overrides update() in the Controller class.
virtual std::string getName ()
 Overrides get_name() in the Controller class.
bool isError ()
 Return true if there is an error condition and the alarm was raised.
std::string getErrorMessage ()
 Returns a message describing the last error.
bool isThreaded ()
 Returns whether or not this Controller is being threaded.
void run ()
 If this Controller is not threaded, update() is called.
int getIntervalMs ()
 Returns the interval between each iteration if threaded.
void setPriority (osPriority priority)
 Sets the underlying RTOS thread priority.
osPriority getPriority ()
 Returns the thread priority.

Static Public Member Functions

static void buzzOnce ()
 Activates the buzzer.

Protected Attributes

unsigned long num_iters
 The number of times run() is called.

Detailed Description

The AlarmController monitors a Sensor and registers unsafe values.

After a specified amount of time an alarm is raised by means of a buzzer.

Definition at line 14 of file SensorAlarmController.h.


Constructor & Destructor Documentation

SensorAlarmController ( bool  threaded,
int  interval_ms,
SensorController *  sensor,
float  min_crit,
float  min_undesired,
float  max_crit,
float  max_undesired 
)

Contructs a new AlarmController which monitors the given SensorController.

Definition at line 19 of file SensorAlarmController.h.


Member Function Documentation

void buzzOnce (  ) [static]

Activates the buzzer.

Definition at line 96 of file SensorAlarmController.cpp.

std::string getErrorMessage (  )

Returns a message describing the last error.

Definition at line 80 of file SensorAlarmController.cpp.

int getIntervalMs (  ) [inherited]

Returns the interval between each iteration if threaded.

Returns:
interval_ms as specified in the constructor.

Definition at line 29 of file Controller.cpp.

std::string getName (  ) [virtual]

Overrides get_name() in the Controller class.

Implements Controller.

Definition at line 72 of file SensorAlarmController.cpp.

osPriority getPriority (  ) [inherited]

Returns the thread priority.

Returns:
the thread priority.

Definition at line 39 of file Controller.cpp.

bool isError (  )

Return true if there is an error condition and the alarm was raised.

Definition at line 76 of file SensorAlarmController.cpp.

bool isThreaded (  ) [inherited]

Returns whether or not this Controller is being threaded.

Returns:
true if this Controller is being threaded, false otherwise.

Definition at line 13 of file Controller.cpp.

void run (  ) [inherited]

If this Controller is not threaded, update() is called.

Otherwise, the first time a thread is spawned which repeatedly calls update(). When the thread has already been spawned no action is taken.

Definition at line 17 of file Controller.cpp.

void setPriority ( osPriority  priority ) [inherited]

Sets the underlying RTOS thread priority.

See also:
cmis_os.h

Definition at line 33 of file Controller.cpp.

void update (  ) [virtual]

Overrides update() in the Controller class.

Implements Controller.

Definition at line 11 of file SensorAlarmController.cpp.


Field Documentation

unsigned long num_iters [protected, inherited]

The number of times run() is called.

Definition at line 66 of file Controller.h.