A private doorbell project to serve an Android app with webcam pictures and microphone recordings when someone presses the button. Information is being spread via MQTT. https://www.taibsu.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.8 KiB

#include "heimdall.h"
#include "config.h"
#include "mqttClient.h"
// see https://de.pinout.xyz/pinout/pin10_gpio15 for details
#define GPIO_DOORBELL 15
#define GPIO_OPENER 18
int main(int argc, char* argv[]) {
Choose which options we want to parse from the config file.
The keys provided here will be passed to the config options map
and have their values parsed as well.
TODO: add log level (may need re-implementation of logger class)
std::vector<std::string> configOptions {
std::shared_ptr<tai::config> conf { std::make_shared<tai::config>(configOptions) };
// create our log file
std::string const& logfile { conf->options("logfile") };
if (!freopen(logfile.c_str(), "w", stderr)) {
// we can still write to stderr.
LOG_ERR("[main] Unable to create log file! Continuing without log.");
LOG_INF("[main] Starting heimdall program execution.");
LOG_DBG("[main] Log file: " + logfile);
// our doorbell class instance
tai::heimdall bell(GPIO_DOORBELL, GPIO_OPENER, conf);
std::shared_ptr<tai::mqttClient> mqttClient(bell.getMqttClient());
LOG_DBG("[main] Entering main loop.");
// stay alive!
while (true) {
// yippieeeeeeeeeee
LOG_INF("[main] heimdall program execution stopped.");