Update to use Libraries and fix include order
This commit is contained in:
@@ -1,34 +1,34 @@
|
||||
#include "Bluetooth/Device.h"
|
||||
#include "UniFi/Device.h"
|
||||
#include "Util/Device.h"
|
||||
#include "Util/INIh.h"
|
||||
#include <clipp.h>
|
||||
#include <Logging.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <signal.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#include <vector>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include "Util/clipp.h"
|
||||
#include "Util/Device.h"
|
||||
#include "Util/INIh.h"
|
||||
#include "Util/Logger.h"
|
||||
#include "UniFi/Device.h"
|
||||
#include "Bluetooth/Device.h"
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
setlogmask(LOG_UPTO(LOG_DEBUG));
|
||||
openlog("PresenceDetection", LOG_NDELAY | LOG_PID, LOG_USER);
|
||||
Logging::OpenLog();
|
||||
Logging::SetLogMask(Logging::Severity::Debug);
|
||||
|
||||
bool daemon = false;
|
||||
PresenceDetection::Util::clipp::group cli {
|
||||
PresenceDetection::Util::clipp::option("-d", "--daemon").set(daemon).doc("Run the process as Daemon")
|
||||
clipp::group cli {
|
||||
clipp::option("-d", "--daemon").set(daemon).doc("Run the process as Daemon")
|
||||
};
|
||||
|
||||
if (!PresenceDetection::Util::clipp::parse(argc, argv, cli))
|
||||
if (!clipp::parse(argc, argv, cli))
|
||||
{
|
||||
std::cout << PresenceDetection::Util::clipp::make_man_page(cli, argv[0]) << std::endl;
|
||||
std::cout << clipp::make_man_page(cli, argv[0]) << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ int main(int argc, char** argv)
|
||||
|
||||
if (daemon)
|
||||
{
|
||||
PresenceDetection::Util::Logger::Log(PresenceDetection::Util::Logger::Severity::Info, "Starting Daemon");
|
||||
Logging::Log(Logging::Severity::Info, "Starting Daemon");
|
||||
pid_t pid, sid;
|
||||
pid = fork();
|
||||
|
||||
@@ -164,7 +164,7 @@ int main(int argc, char** argv)
|
||||
int sig;
|
||||
sigwait(&wset,&sig);
|
||||
|
||||
PresenceDetection::Util::Logger::Log(PresenceDetection::Util::Logger::Severity::Info, "Stopping...");
|
||||
Logging::Log(Logging::Severity::Info, "Stopping...");
|
||||
|
||||
if (pUniFiDevice)
|
||||
pUniFiDevice->Stop();
|
||||
@@ -178,7 +178,7 @@ int main(int argc, char** argv)
|
||||
if (pBluetoothDevice)
|
||||
pBluetoothDevice->Wait();
|
||||
|
||||
closelog();
|
||||
Logging::CloseLog();
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
@@ -186,9 +186,9 @@ int main(int argc, char** argv)
|
||||
ss << "ERROR: " << e.what() << std::endl;
|
||||
|
||||
std::cerr << ss.str() << std::endl;
|
||||
PresenceDetection::Util::Logger::Log(PresenceDetection::Util::Logger::Severity::Error, ss.str());
|
||||
Logging::Log(Logging::Severity::Error, ss.str());
|
||||
|
||||
closelog();
|
||||
Logging::CloseLog();
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user