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.

62 lines
1.5 KiB

#ifndef HEIMDALL_H
#define HEIMDALL_H
// output
#include <iostream>
// threading
#include <thread>
// 3rdparty libs
#include <cppgpio.hpp>
// config
#include "config.h"
// mqtt
#include "mqttClient.h"
namespace tai {
class heimdall
* @brief the PictureType "motion" uses a self-implemented way of returning the webcam
* picture using motion and some self-written php functions. Please consider using "raspistill"
* as your default picture type.
enum class PictureType
explicit heimdall(uint8_t gpio, uint8_t gpio_opener, std::shared_ptr<tai::config> conf);
// methods
void startMqttAndPlaySound();
void takePicture(PictureType type, std::vector<std::string> const& chat_id, bool notify_on_telegram);
void registerMqttListener();
std::shared_ptr<mqttClient> getMqttClient() { return _mqttClient; };
std::shared_ptr<tai::config> getConfig() { return _conf; };
// members
std::unique_ptr<GPIO::PushButton> _btn;
std::unique_ptr<GPIO::DigitalOut> _opener;
std::shared_ptr<tai::config> _conf;
std::shared_ptr<mqttClient> _mqttClient;
// methods
bool _isAudioStreamingServerRunning { false };
void _startAudioStreamingServer();
auto _prepareTelegramMsg(std::string const& chat_id, std::string const& message) -> std::string;
auto _prepareTelegramPhoto(std::string const& chat_id, std::string const& photo_path) -> std::string;
auto _urlEncode(std::string const& str) -> std::string;
} // namespace tai
#endif // HEIMDALL_H