Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed DRV88255 TextLCD Ping mbed-rtos
Diff: AlarmController.h
- Revision:
- 52:eaddbde192f1
- Parent:
- 48:d7053e51b30a
diff -r 4a70184ff7dc -r eaddbde192f1 AlarmController.h --- a/AlarmController.h Fri Jun 17 11:02:01 2016 +0000 +++ b/AlarmController.h Fri Jun 17 11:38:26 2016 +0000 @@ -6,13 +6,18 @@ #include "PIDController.h" #include "testing.h" +/** The number of iterations before the AlarmController registers unsafe values */ #define STARTUP_ITERATIONS 10 - +/** The AlarmController monitors the Temperature/Salinity/Proximity sensors and registers unsafe values. + * After a specified amount of time an alarm is raised by means of a buzzer. + */ class AlarmController : public Controller { public: + + /** Contructs a new AlarmController which monitors the given Temperature/Salinity/Proximity controllers. */ AlarmController(bool threaded, int interval_ms, SensorController *temp, SensorController *salt, SensorController *proximity) : Controller(threaded, interval_ms) { this->temp = temp; @@ -22,34 +27,42 @@ this->error = false; this->tempiscrit = false; this->saltiscrit = false; - this->overflowiscrit = false; - + this->overflowiscrit = false; } + /** Overrides update() in the Controller class */ virtual void update(); + /** Overrides get_name() in the Controller class */ virtual std::string get_name(); + /** Return \a true if there is an error condition and the alarm was raised. */ bool is_error(); + /** Returns a message describing the last error */ char *get_error_message(); - - void buzzOnce(); - void raiseAlarmTemp(bool); - void raiseAlarmSalt(bool); - void raiseAlarmOverFlow(bool); private: SensorController *temp; SensorController *salt; - SensorController *proximity; - + SensorController *proximity; bool error; char *error_msg; + + /** Activates the buzzer */ + void buzzOnce(); - void activate_buzzer(); + /** Activates an alarm for the temperature controller */ + void raiseAlarmTemp(bool); + + /** Activates an alarm for the salinity controller */ + void raiseAlarmSalt(bool); + + /** Activates an alarm for the proximity controller */ + void raiseAlarmOverFlow(bool); + bool tempiscrit; bool saltiscrit; bool overflowiscrit;