Library for my home monitoring classes and serial communication protocol. It monitors temperature and movement on the mbed application board.
Diff: Temperature/Temperature.h
- Revision:
- 2:84432add9142
- Parent:
- 0:3f846fc933a2
--- a/Temperature/Temperature.h Tue Sep 03 08:54:55 2013 +0000 +++ b/Temperature/Temperature.h Tue Sep 03 20:24:12 2013 +0000 @@ -4,6 +4,9 @@ #include <vector> #include <string> +/** Temperature class stores historical temperature data and tresholds for temperature alerts +* +*/ class Temperature { private: double max_temp_limit, min_temp_limit, period_limit, max_samples_limit; @@ -16,16 +19,78 @@ std::vector<std::string> temp_samples; public: + /** + * Creates a new temperature object. All parameters + * hard coded at first and methods used to set appropriately + * based on user's desires. + */ Temperature(); + /** + * Returns minimum temperature threshold + * + * @param return - mininum temperature threshold + */ double get_min(); + /** + * Returns maximum temperature threshold + * + * @param return - maximum temperature threshold + */ double get_max(); + /** + * Returns temperature sampling period in seconds + * + * @param return - temperature sampling period in seconds + */ double get_period(); - bool set_min(double); - bool set_max(double); - bool set_period(double); + /** + * Sets the minimum temperature threshold for alerts. + * + * @param min - new minimum temperature threshold for alerts + * @param return - indicates success or failure + */ + bool set_min(double min); + /** + * Sets the maximum temperature threshold for alerts. + * + * @param max - new maximum temperature threshold for alerts + * @param return - indicates success or failure + */ + bool set_max(double max); + /** + * Sets the temperature period in seconds to store temperature samples in DB + * + * @param period - termperature sampling period in seconds + * @param return - pass or fail of attempt + */ + bool set_period(double period); + /** + * Method to add a temperature sample to the database + * + * @param temp_sample - temperature sample to be stored to dB + */ void add_sample(double temp_sample); - bool change_max_samples(int); + /** + * Changes number of samples in temperature database. + * Current maximum is 100 samples + * WARNING: Changing this may trash samples since vector is resized. + * + * @param num_samples - Number of samples in DB + * @param return - pass fail of attemp + */ + bool change_max_samples(int num_samples); + /** + * Returns database size in temperature DB + * + * @param return - current size of temp DB in samples + */ int get_max_samples(); + /** + * Returns all temperature samples as strings in the database. + * number returned should match max_samples. + * + * @param return - Reference to vector containing temperature DB as strings + */ const std::vector<std::string> &get_samples(); };