11#ifndef INCLUDED_LIBCYBERRADIO_NDR651_CLIENTSOCKET_H
12#define INCLUDED_LIBCYBERRADIO_NDR651_CLIENTSOCKET_H
19#include <sys/socket.h>
23#include <boost/thread/mutex.hpp>
24#include "LibCyberRadio/Common/BasicList.h"
26#define RX_BUFF_SIZE 1024
52 ClientSocket(
const std::string& hostname,
unsigned int port,
78 bool sendCmd(
const std::string& cmd);
95 float timeout,
bool print);
111 std::string _serverHostname;
115 char _rxBuff[RX_BUFF_SIZE];
116 void _clearRxBuff(
void) { memset(_rxBuff, 0, RX_BUFF_SIZE); }
117 void _tcpRx(
void) { recv(_sockfd, _rxBuff, RX_BUFF_SIZE, 0); }
119 boost::mutex _trxMutex;
bool connectToServer(void)
Connects to the server.
bool isConnected(void)
Gets whether or not the socket is connected.
bool sendCmd(const std::string &cmd)
Sends a command to the server.
bool getRsp(BasicStringList &rsp, float timeout)
Gets a command response from the server.
virtual ~ClientSocket()
Destroys a ClientSocket object.
ClientSocket(const std::string &hostname, unsigned int port, bool debug=true)
Constructs a ClientSocket object.
bool disconnect(void)
Disconnects from the server.
bool sendCmdAndGetRsp(const std::string &cmd, BasicStringList &rsp, float timeout, bool print)
Sends a command to the server and gets the response.
Provides programming elements for controlling the CyberRadio Solutions NDR651 radio.
Defines functionality for LibCyberRadio applications.
BASIC_LIST_CONTAINER< std::string > BasicStringList
Type representing a list of strings.