Add ini Configuration File
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
#include "VStarCam/Finder.h"
|
#include "VStarCam/Finder.h"
|
||||||
|
#include <INIReader.h>
|
||||||
#include <Logging.h>
|
#include <Logging.h>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -19,11 +20,19 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INIReader iniReader("VStarCamFinder.ini");
|
||||||
|
if (iniReader.ParseError() != 0)
|
||||||
|
{
|
||||||
|
Logging::Log(Logging::Severity::Error, "Can't read VStarCamFinder.ini");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
std::string ipAddress(argv[1]);
|
std::string ipAddress(argv[1]);
|
||||||
|
std::string listenAddress = iniReader.Get("VStarCamFinder", "ListenAddress", "0.0.0.0");
|
||||||
|
|
||||||
int port = 0;
|
int port = 0;
|
||||||
|
|
||||||
VStarCam::Finder finder("192.168.101.100");
|
VStarCam::Finder finder(listenAddress);
|
||||||
port = finder.GetPort(ipAddress);
|
port = finder.GetPort(ipAddress);
|
||||||
|
|
||||||
if (port != 0)
|
if (port != 0)
|
||||||
|
|||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
../../Libraries/inih
|
||||||
+1
-1
@@ -8,6 +8,7 @@ LIBRARIES += Utilities
|
|||||||
|
|
||||||
CFLAGS += -I$(ROOTPATH)/Libraries/asio/asio/include
|
CFLAGS += -I$(ROOTPATH)/Libraries/asio/asio/include
|
||||||
CFLAGS += -I$(ROOTPATH)/Libraries/clipp
|
CFLAGS += -I$(ROOTPATH)/Libraries/clipp
|
||||||
|
CFLAGS += -I$(ROOTPATH)/Libraries/inih
|
||||||
|
|
||||||
LFLAGS += -pthread
|
LFLAGS += -pthread
|
||||||
|
|
||||||
@@ -17,4 +18,3 @@ DEBUGDIR := .debug
|
|||||||
|
|
||||||
DEFAULTARCH := armv6-jessie
|
DEFAULTARCH := armv6-jessie
|
||||||
TARGETS += VStarCamFinder
|
TARGETS += VStarCamFinder
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@ int Finder::GetPort(const std::string& ipAddress)
|
|||||||
{
|
{
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << "Retrieving port for " << ipAddress << std::endl;
|
ss << "Retrieving port for " << ipAddress << std::endl;
|
||||||
Logging::Log(Logging::Severity::Info, ss.str());
|
Logging::Log(Logging::Severity::Debug, ss.str());
|
||||||
|
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(m_mutex);
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
@@ -49,7 +49,7 @@ int Finder::GetPort(const std::string& ipAddress)
|
|||||||
|
|
||||||
ss.str("");
|
ss.str("");
|
||||||
ss << "New port for " << ipAddress << ": " << port << std::endl;
|
ss << "New port for " << ipAddress << ": " << port << std::endl;
|
||||||
Logging::Log(Logging::Severity::Info, ss.str());
|
Logging::Log(Logging::Severity::Debug, ss.str());
|
||||||
|
|
||||||
return port;
|
return port;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user