Skip to content
This repository has been archived by the owner on Jun 18, 2022. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Verstraeten committed May 24, 2018
2 parents 4593b63 + 223ecfa commit aae6f77
Show file tree
Hide file tree
Showing 35 changed files with 8,036 additions and 4,030 deletions.
8,191 changes: 4,375 additions & 3,816 deletions include/easylogging/easylogging++.h

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion include/kerberos/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#ifndef __Version_H_INCLUDED__ // if Version.h hasn't been included yet...
#define __Version_H_INCLUDED__ // #define this so the compiler knows it has been included

#define VERSION "2.5.1"
#define VERSION "2.6.0"
#define HADES "https://hades.kerberos.io"
#define CLOUD "https://cloud.kerberos.io"
#define SYMBOL_DIRECTORY "/etc/opt/kerberosio/symbols/"
Expand Down
2 changes: 1 addition & 1 deletion include/kerberos/Kerberos.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace kerberos
void setCaptureDelayTime(int delay){m_captureDelayTime=delay;};
void setParameters(StringMap & parameters)
{
LINFO << helper::printStringMap("Parameters passed from commandline:", parameters);
VLOG(1) << helper::printStringMap("Parameters passed from commandline:", parameters);
m_parameters = parameters;
};
StringMap getParameters(){return m_parameters;}
Expand Down
12 changes: 12 additions & 0 deletions include/kerberos/cloud/Cloud.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include "restclient-cpp/restclient.h"
#include <iostream>
#include <fstream>
#include "capture/Capture.h"
#include "cloud/ForwardStream.h"

namespace kerberos
{
Expand All @@ -49,6 +51,10 @@ namespace kerberos
pthread_t m_healthThread;
bool m_healthThread_running;

pthread_t m_livestreamThread;
pthread_mutex_t m_capture_lock;
bool m_livestreamThread_running;

std::string m_keyFile;
std::string m_productKey;
std::string m_name;
Expand All @@ -62,19 +68,25 @@ namespace kerberos
StringMap m_parameters;
RestClient::Connection * cloudConnection;
RestClient::Connection * pollConnection;
Capture * m_capturedevice;
ForwardStream fstream;

Cloud(){};
virtual ~Cloud(){};
virtual void setup(kerberos::StringMap & settings) = 0;
virtual bool upload(std::string pathToImage) = 0;
virtual bool doesExist(std::string pathToImage) = 0;

void setCapture(Capture * capture){m_capturedevice = capture;};
void disableCapture();
void startUploadThread();
void stopUploadThread();
void startPollThread();
void stopPollThread();
void startHealthThread();
void stopHealthThread();
void startLivestreamThread();
void stopLivestreamThread();

void scan();
void generateHash(kerberos::StringMap & settings);
Expand Down
75 changes: 75 additions & 0 deletions include/kerberos/cloud/ForwardStream.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
//
// Class: ForwardStream
// Description: ForwardStream
//
// Created: 16/04/2018
// Author: Cédric Verstraeten
// Mail: cedric@verstraeten.io
// Website: www.verstraeten.io
//
// The copyright to the computer program(s) herein
// is the property of Verstraeten.io, Belgium.
// The program(s) may be used and/or copied under
// the CC-NC-ND license model.
//
// https://doc.kerberos.io/license
//
/////////////////////////////////////////////////////

#ifndef __ForwardStream_H_INCLUDED__ // if ForwardStream.h hasn't been included yet...
#define __ForwardStream_H_INCLUDED__ // #define this so the compiler knows it has been included

#include "Exception.hpp"
#include "capture/Image.h"
#include "mosquittopp.h"
#include "writer.h"
#include "base64.h"
#include "Helper.h"
#include "machinery/io/Throttler.h"

namespace kerberos
{
class ForwardStream : public mosqpp::mosquittopp
{
private:
std::string m_server_ip;
unsigned short m_port;
std::string m_topic;
std::string m_motion_topic;
std::vector<int> m_encode_params;

public:
ForwardStream(){};
virtual ~ForwardStream()
{
disconnect();
loop_stop();
mosqpp::lib_cleanup();
};

std::string m_publicKey;
std::string m_deviceKey;
int m_lastReceived;
Throttler throttle;

void setup(std::string publickey, std::string deviceKey);
void setIp(const std::string server_ip){m_server_ip=server_ip;};
const char * getIp(){return m_server_ip.c_str();};
void setPort(const unsigned short port){m_port=port;};
unsigned short getPort(){return m_port;};
void setTopic(std::string topic){m_topic=topic;};
const char * getTopic(){return m_topic.c_str();};
void setMotionTopic(std::string motion_topic){m_motion_topic=motion_topic;};
const char * getMotionTopic(){return m_motion_topic.c_str();};
cv::Mat GetSquareImage(const cv::Mat& img, int target_width = 500);
bool forward(Image & cleanImage);
bool forwardRAW(uint8_t * data, int32_t length);
bool triggerMotion();
bool isRequestingLiveStream();

void on_connect(int rc);
void on_message(const struct mosquitto_message *message);
void on_subscribe(int mid, int qos_count, const int *granted_qos);
};
}
#endif
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
include_directories(${CMAKE_SOURCE_DIR}/include/encode)
include_directories(${CMAKE_SOURCE_DIR}/include/easylogging)

add_subdirectory(easylogging)
add_subdirectory(tinyxml)
add_subdirectory(executor)
add_subdirectory(filewatcher)
Expand Down
7 changes: 7 additions & 0 deletions src/easylogging/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
# Build library
add_library(EASYLOGGING_LIBRARY STATIC
easylogging++.cpp)

set(KERBEROS_DEPENDENCIES ${KERBEROS_DEPENDENCIES} EASYLOGGING_LIBRARY PARENT_SCOPE)
set(KERBEROS_LIBRARIES ${KERBEROS_LIBRARIES} EASYLOGGING_LIBRARY PARENT_SCOPE)
Loading

0 comments on commit aae6f77

Please sign in to comment.