Class Server

Class Documentation

class Server

creates a TCP/IP server for the thermal daemon

Public Functions

inline Server()

class constructor

inline ~Server()

class deconstructor cleans up on exit

long telemetry(std::string args, std::string &retstring)

utility to stop/start/check status of telemetry

void exit_cleanly(void)

exit

long configure_thermald()

read and apply daemon config from configuration file

long configure_devices()

read and apply device config from configuration file

long configure_telemetry()

read and apply telemetry config from configuration file

long parse_lks_unit(std::string &input, int &lksnum, std::string &name, std::string &host, int &port)
long parse_lks_chan(std::string &input, int &lksnum, std::string &chan, bool &heater, std::string &label)
long parse_camp_chan(std::string &input)
void doit(Network::TcpSocket &sock)

the workhorse of each thread connetion

Public Members

int nbport

non-blocking port

int blkport

blocking port

int asyncport

asynchronous message port

std::string asyncgroup

asynchronous multicast group

int nonblocking_socket
int blocking_socket
std::atomic<int> cmd_num
Config config
Interface interface

the Interface class connects to the hardware

int telem_period
InterruptableSleepTimer telem_sleeptimer

allows interrupting telemetry

std::vector<std::string> db_info

info for constructing telemetry Database object

std::atomic<bool> telem_running

is the main telemetry thread running?

unsigned int telem_backoff_sec = 1

reconnect backoff (s); doubles to a cap on telemetry DB failure, reset on success

std::mutex conn_mutex

mutex to protect against simultaneous access to Accept()

Public Static Functions

static void new_log_day(std::string logpath)

creates a new logbook each day

static void block_main(Thermal::Server &tcs, Network::TcpSocket sock)

main function for blocking connection thread

static void thread_main(Thermal::Server &tcs, Network::TcpSocket sock)

main function for all non-blocked threads

static void async_main(Thermal::Server &tcs, Network::UdpSocket sock)

asynchronous message sending thread

static void telemetry_watchdog(Thermal::Server &server)

keeps the main telemetry thread running

static void dothread_telemetry(Thermal::Server &server)

main telemetry thread