-
Notifications
You must be signed in to change notification settings - Fork 0
source docs
The Curl classes uses the libcurl C library to interact with the server when sending the data recorded by an attached sensor.
The constructor defines doDisplayMessages
to true.
The destructor calls notes to the standard output stream that a Curl object is being destroyed and then calls curl_global_cleanup()
, if initialised.
A public field that determines whether messages are displayed from within functions, describing execution details and success.
Initialises the Curl object. This calls curl_global_init()
and sets a private bool (isInitialised_
) to true.
Returns whether initialisation succeeded or not.
Sends a string (data
) to a server (destination
) using POST over HTTP.
Requires this.initialise()
to be called.
Returns whether the post operation succeeded or not.
The IMUReading struct is used by the IMUController class to return information retrieved by the IMU sensor,
- float temperature
- float humidity
The IMUController class uses the RTIMULib library to interact with a sensor and return the humidity and temperature recorded by it.
The IMUController class has an empty constructor.
The destructor calls notes to the standard output stream that an IMUController object is being destroyed.
Initialises the IMUController instance. This defines RTIMUSettings
, RTIMU
and RTHumidiy
typed private fields and checks that a valid sensor is connected.
Returns whether initialisation succeeded or not.
Gets the current humidity and temperature recorded by the sensor.
Requires this.initialise()
to be called.
Returns an IMUReading
struct that contains the recorded information. If either value cannot be retrieved, they will be returned as -1.
Uses the wiringPi library to read information from a connected water sensor. (Reads using pin 25 on a raspberry-pi.)
The constructor defines all private fields (timeAtLastRead_ = 0
, isInitialised = false
).
The destructor notes to the standard output stream that a WaterController object is being destroyed.
Initialises the WaterController object. This sets an interrupt counter to 0 and sets up the wiringPi
library to use pin 25 as an ISR to measure water flow. It also sets timeAtLastRead_
to be the current unix time.
Checks how many times the wiringPi library has called an interrupt to determine how much water has flowed through the sensor. This resets the interrupt counter and the recorded time at last read is set to now.
Requires this.initialise()
to be called.
Returns the calculated water flow in litres per seconds.
Does the same thing as read()
, except it does not change the interrupt counter or time since last read.
Requires this.initialise()
to be called.
Returns the calculated water flow in litres per seconds.
Used by getSensorTypefromUser(bool)
to return the chosen sensor type.
- NONE
- WATER
- IMU
Used by styleString(const std::string&, StringStyle)
and printStyled(const std::string&, StringStyle)
to determine how to style the string.
- DEFUALT
- GREEN
- RED
- BOLD
- BOLD_GREEN
- BOLD_RED
Returns a string the is the same as message
, except it is styled in a certain was (as determined by style
).
The same as styleString(const std::string&, StringStyle)
except is stream it to the standard output stream instead of returning.
Asks the user for which sensor type to use. If loopOnInvalidInput
is true
, the use will be repeatedly asked for input until their answer is either 'imu' or 'water'. If it is false
, the function will return SensorType::NONE
if the input is invalid.
Returns the sensor type entered by the user.
Gets the MAC Address from /sys/class/net/wlan0/address
.
Returns the MAC Address.
Returns a long long
that is equal to the current Unix Time.
Sleeps the current thread for a defined number of seconds.
Formats a string to work in an HTTP POST operation.
Returns the new string.