Commit c6cfebd2 authored by fmg005's avatar fmg005

changed method name from initialize to setup_conncetion

parent 133590d1
......@@ -5,12 +5,12 @@ using namespace CLA;
/* wrapper for tcp client */
Monitor::Monitor(std::shared_ptr<CLA::LOGGER>& logger) : m_logger(logger),
m_tcp_monitor_client(logger) {
m_tcp_monitor_client.initialize(); /* connection setup to server via tcp socket */
m_tcp_monitor_client.setup_connection(); /* connection setup to server via tcp socket */
}
Monitor::Monitor(std::shared_ptr<CLA::LOGGER>& logger, const string& topic, const
string& type) : m_logger(logger), m_tcp_monitor_client(logger, topic, type) {
m_tcp_monitor_client.initialize(); /* connection setup to server via tcp socket */
m_tcp_monitor_client.setup_connection(); /* connection setup to server via tcp socket */
}
void Monitor::send_patient_data (double data) {
......
......@@ -6,7 +6,7 @@ using namespace CLA;
Pump::Pump(std::shared_ptr<CLA::LOGGER>& logger, const string& substance,
const string& topic, const string& type) : m_logger(logger), m_substance(substance),
m_tcp_pump_client(topic, type, logger) {
m_tcp_pump_client.initialize(); /* connection setup to server via tcp socket */
m_tcp_pump_client.setup_connection(); /* setup connection to server via a tcp socket */
}
double Pump::getCurrentInfusionRate () {
......
......@@ -47,7 +47,7 @@ namespace CLA {
tcp_monitor_client(std::shared_ptr<CLA::LOGGER>&);
tcp_monitor_client(std::shared_ptr<CLA::LOGGER>&, const string&, const string&);
~tcp_monitor_client();
void initialize();
void setup_connection();
void send_data_to_server(double);
void send_patient_data(double);
void waiting_to_send();
......
......@@ -51,7 +51,7 @@ namespace CLA {
tcp_pump_client(std::shared_ptr<CLA::LOGGER>&);
tcp_pump_client(const string&, const string&, std::shared_ptr<CLA::LOGGER>&);
~tcp_pump_client();
void initialize();
void setup_connection();
double getCurrentInfusionRate(const string&);
double get_new_rate(const string&);
double waiting_for_new_rate(const string&);
......
......@@ -23,10 +23,10 @@ m_logger(logger) {
SOCKET_TIMEOUT_uSEC = 0;
}
void tcp_monitor_client::initialize() {
void tcp_monitor_client::setup_connection() {
/* create a UDP socket */
fd = socket(AF_INET, SOCK_STREAM, 0);
m_logger->info("Connecting to rosbridge server ...");
m_logger->debug("Connecting to rosbridge server for monitor data ...");
if (fd < 0) {
std::cerr <<"can not create socket"<<std::endl;
m_logger->error("Failed to create socket");
......@@ -60,7 +60,7 @@ void tcp_monitor_client::initialize() {
cerr <<"Can not write to socket\n";
m_logger->error("Can not write to socket");
}
m_logger->info("Advertise request sent to rosbridge server");
m_logger->debug("Advertise request to "+m_topic+" sent to rosbridge server");
}
void tcp_monitor_client::send_patient_data(double p_data) {
......
......@@ -31,10 +31,10 @@ m_logger(logger) {
m_current_rate = 0;
}
void tcp_pump_client::initialize() {
void tcp_pump_client::setup_connection() {
/* create a UDP socket */
fd = socket(AF_INET, SOCK_STREAM, 0);
m_logger->debug("Connecting to rosbridge server ...");
m_logger->debug("Connecting to rosbridge server for pump data ...");
if (fd < 0) {
std::cerr <<"can not create socket"<<std::endl;
m_logger->error("Failed to create socket");
......@@ -70,7 +70,7 @@ void tcp_pump_client::initialize() {
cerr <<"Can not write to socket\n";
m_logger->error("Can not write to socket");
}
m_logger->debug("subscription request sent to rosbridge server");
m_logger->debug("subscription to "+ m_topic+" request sent to rosbridge server");
}
double tcp_pump_client::getCurrentInfusionRate(const string& substance) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment