Library for my home monitoring classes and serial communication protocol. It monitors temperature and movement on the mbed application board.
Motion/Motion.h@0:3f846fc933a2, 2013-09-01 (annotated)
- Committer:
- groletter
- Date:
- Sun Sep 01 23:35:18 2013 +0000
- Revision:
- 0:3f846fc933a2
- Child:
- 2:84432add9142
My library for temperature and motion monitoring and communication over a USB Serial device. Requires host-side code.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
groletter | 0:3f846fc933a2 | 1 | #ifndef MOTION_H |
groletter | 0:3f846fc933a2 | 2 | #define MOTION_H |
groletter | 0:3f846fc933a2 | 3 | |
groletter | 0:3f846fc933a2 | 4 | #include <vector> |
groletter | 0:3f846fc933a2 | 5 | #include <string> |
groletter | 0:3f846fc933a2 | 6 | #include "HomeMonUtils.h" |
groletter | 0:3f846fc933a2 | 7 | |
groletter | 0:3f846fc933a2 | 8 | struct motion_vec { |
groletter | 0:3f846fc933a2 | 9 | double x; |
groletter | 0:3f846fc933a2 | 10 | double y; |
groletter | 0:3f846fc933a2 | 11 | double z; |
groletter | 0:3f846fc933a2 | 12 | }; |
groletter | 0:3f846fc933a2 | 13 | |
groletter | 0:3f846fc933a2 | 14 | class Motion { |
groletter | 0:3f846fc933a2 | 15 | private: |
groletter | 0:3f846fc933a2 | 16 | motion_vec min_motion; |
groletter | 0:3f846fc933a2 | 17 | int max_samples_limit; |
groletter | 0:3f846fc933a2 | 18 | int max_samples; |
groletter | 0:3f846fc933a2 | 19 | int sample_ptr; |
groletter | 0:3f846fc933a2 | 20 | bool wrapped_once; |
groletter | 0:3f846fc933a2 | 21 | std::vector<std::string> motion_samples; |
groletter | 0:3f846fc933a2 | 22 | |
groletter | 0:3f846fc933a2 | 23 | public: |
groletter | 0:3f846fc933a2 | 24 | Motion(); |
groletter | 0:3f846fc933a2 | 25 | motion_vec get_motion_thresh(void); |
groletter | 0:3f846fc933a2 | 26 | bool set_motion_thresh(motion_vec); |
groletter | 0:3f846fc933a2 | 27 | void add_sample(double motion_sample); |
groletter | 0:3f846fc933a2 | 28 | const std::vector<std::string> &get_samples(); |
groletter | 0:3f846fc933a2 | 29 | bool change_max_samples(int); |
groletter | 0:3f846fc933a2 | 30 | int get_max_samples(); |
groletter | 0:3f846fc933a2 | 31 | |
groletter | 0:3f846fc933a2 | 32 | }; |
groletter | 0:3f846fc933a2 | 33 | |
groletter | 0:3f846fc933a2 | 34 | #endif |