Library for my home monitoring classes and serial communication protocol. It monitors temperature and movement on the mbed application board.

Dependents:   FinalProject

Embed: (wiki syntax)

« Back to documentation index

Motion Class Reference

Motion Class Reference

Motion class stores historical motion alert data and thresholding for alert generation. More...

#include <Motion.h>

Public Member Functions

 Motion ()
 Instantiate a motion class.
motion_vec get_motion_thresh (void)
 Allows host to retrieve motion threshold as a vector.
bool set_motion_thresh (motion_vec motion_thresh)
 Allows host to set the motion threshold.
void add_sample (double motion_sample)
 Adds a sample to the motion database.
const std::vector< std::string > & get_samples ()
 Returns all motion samples in the motion database.
bool change_max_samples (int num_samples)
 Allows the host to change the motion database size.
int get_max_samples ()
 Returns current database size.

Detailed Description

Motion class stores historical motion alert data and thresholding for alert generation.

Definition at line 18 of file Motion.h.


Constructor & Destructor Documentation

Motion (  )

Instantiate a motion class.

Initialization hard-coded to known good values. Use member functions to modify.

Definition at line 13 of file Motion.cpp.


Member Function Documentation

void add_sample ( double  motion_sample )

Adds a sample to the motion database.

Units are time in seconds since device booted.

Parameters:
motion_sample- represents seconds since device booted that a motion alert occurred.

Definition at line 46 of file Motion.cpp.

bool change_max_samples ( int  num_samples )

Allows the host to change the motion database size.

WARNING: This may cause sample to be lost due to vector resize operation

Parameters:
num_samples- new size of motion alert DB (max allowed currently 100)
return- pass/fail of operation

Definition at line 33 of file Motion.cpp.

int get_max_samples (  )

Returns current database size.

Parameters:
return- size in samples of motion alert DB

Definition at line 72 of file Motion.cpp.

motion_vec get_motion_thresh ( void   )

Allows host to retrieve motion threshold as a vector.

Parameters:
return- Returns a motion vector structure with x, y, and z threholds for motion.

Definition at line 68 of file Motion.cpp.

const std::vector< std::string > & get_samples ( void   )

Returns all motion samples in the motion database.

Parameters:
return- vector containing strings for all motion alerts (seconds since device booted)

Definition at line 76 of file Motion.cpp.

bool set_motion_thresh ( motion_vec  motion_thresh )

Allows host to set the motion threshold.

Parameters:
motion_thresh- Motion vector threshold setting
return- pass/faill for set

Definition at line 59 of file Motion.cpp.