IRSOL
C++ code implementing socket server for interacting with Baumer camera.
server.cpp
Go to the documentation of this file.
1
17#include "irsol/irsol.hpp"
18
19#include <string>
20#include <thread>
21
22int
24{
25
26 irsol::initLogging("logs/camera-server.log");
28
29 IRSOL_LOG_INFO("Sample TCP camera server");
30
31 in_port_t port = 15099; // port used by existing clients
32
33 irsol::server::App app(port);
34 if(!app.start()) {
35 IRSOL_LOG_FATAL("Failed to start server.");
36 return 1;
37 }
38
39 IRSOL_LOG_INFO("Server running. Press 'q' to quit.");
40 while(true) {
41 char c = std::cin.get();
42 if(c == 'q') {
43 IRSOL_LOG_INFO("Stopping server...");
44 app.stop();
45 break;
46 } else {
47 IRSOL_LOG_WARN("Invalid input '{}'. Press 'q' to quit.", c);
48 }
49 }
50
51 return 0;
52}
Main server application that manages client connections and camera streaming.
Definition app.hpp:46
void stop()
Stops the server.
Definition app.cpp:39
bool start()
Starts the server.
Definition app.cpp:26
void initAssertHandler()
Initializes the assertion handler system.
Definition assert.cpp:14
#define IRSOL_LOG_FATAL(...)
Logs a fatal (critical) message using the default logger.
Definition logging.hpp:95
#define IRSOL_LOG_INFO(...)
Logs an info-level message using the default logger.
Definition logging.hpp:92
#define IRSOL_LOG_WARN(...)
Logs a warning-level message using the default logger.
Definition logging.hpp:93
void initLogging(const char *fileSinkFilename="logs/irsol.log", std::optional< spdlog::level::level_enum > minLogLevel=std::nullopt)
Initializes the irsol logging system.
Definition logging.cpp:108
int main()
Definition server.cpp:23