DESERT 3.5.1
Loading...
Searching...
No Matches
Msocket Class Reference

#include <msocket.h>

Inheritance diagram for Msocket:
Collaboration diagram for Msocket:

Public Member Functions

 Msocket (UWMdriver *, std::string)
 
 ~Msocket ()
 
virtual int openConnection ()
 
virtual void closeConnection ()
 
virtual int writeToModem (std::string)
 
int getSocket ()
 
 Msocket (UWMdriver *, std::string)
 
 ~Msocket ()
 
virtual int openConnection ()
 
virtual void closeConnection ()
 
virtual int writeToModem (std::string)
 
int getSocket ()
 
- Public Member Functions inherited from UWMconnector
 UWMconnector (UWMdriver *, std::string)
 
 ~UWMconnector ()
 
std::string readFromModem ()
 
void setDriverQueueLength (int length)
 
uint getDriverQueueLength ()
 
 UWMconnector (UWMdriver *, std::string)
 
 ~UWMconnector ()
 
std::string readFromModem ()
 
void setDriverQueueLength (int length)
 
uint getDriverQueueLength ()
 

Private Member Functions

void error (const char *)
 
void error (const char *)
 

Private Attributes

int sockfd
 
int portno
 
int rc
 
pthread_t thread_id
 
struct sockaddr_in serv_addr
 
std::string server_host
 
struct hostent * server
 
char msg_tx [_MAX_MSG_LENGTH]
 
int modem_queue_length
 

Additional Inherited Members

- Public Attributes inherited from UWMconnector
std::queue< msgModemqueueMsg
 
- Protected Attributes inherited from UWMconnector
UWMdriverpmDriver
 
std::string pathToDevice
 
uint driver_queue_length
 

Detailed Description

Class used to manage host/modem string exchange via TCP/IP connection (this class is a derived class of UWMconnector).

Definition at line 60 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.

Constructor & Destructor Documentation

◆ Msocket() [1/2]

Msocket::Msocket ( UWMdriver pmDriver_,
std::string  portno_ 
)

Class constructor.

Parameters
pmDriver_pointer to the UWMdriver object to link with this UWMconnector object.
pathToDevice_the path to the device that must be connected with NS-Miracle (e.g., the port "9200" for a TCP/IP connection)

Definition at line 50 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.cpp.

◆ ~Msocket() [1/2]

Msocket::~Msocket ( )

Class destructor.

Definition at line 69 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.cpp.

◆ Msocket() [2/2]

Msocket::Msocket ( UWMdriver ,
std::string   
)

Class constructor.

Parameters
pmDriver_pointer to the UWMdriver object to link with this UWMconnector object.
pathToDevice_the path to the device that must be connected with NS-Miracle (e.g., the port "9200" for a TCP/IP connection)

◆ ~Msocket() [2/2]

Msocket::~Msocket ( )

Class destructor.

Member Function Documentation

◆ closeConnection() [1/2]

virtual void Msocket::closeConnection ( )
virtual

Method to close the connection with the modem.

Reimplemented from UWMconnector.

◆ closeConnection() [2/2]

void Msocket::closeConnection ( )
virtual

Method to close the connection with the modem.

Reimplemented from UWMconnector.

Definition at line 108 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.cpp.

◆ error() [1/2]

void Msocket::error ( const char *  )
private

Method report errors.

Parameters
[in]msgpointer to an error message to report.

◆ error() [2/2]

void Msocket::error ( const char *  msg)
private

Method report errors.

Parameters
[in]msgpointer to an error message to report.

Definition at line 44 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.cpp.

◆ getSocket() [1/2]

int Msocket::getSocket ( )
inline

Method to read the pointer to the socket where to write (it is needed by the reading function invoked by the parallel thread)

Returns
Msocket::sockfd

Definition at line 129 of file DESERT_Addons/uwmphy_modem/msocket.h.

◆ getSocket() [2/2]

int Msocket::getSocket ( )
inline

Method to read the pointer to the socket where to write (it is needed by the reading function invoked by the parallel thread)

Returns
Msocket::sockfd

Definition at line 129 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.

◆ openConnection() [1/2]

virtual int Msocket::openConnection ( )
virtual

Method to open the connection with the modem.

Returns
_MODEM_OK (see uwmconnector.h) if everything went fine, any other int value otherwise.

Implements UWMconnector.

◆ openConnection() [2/2]

int Msocket::openConnection ( )
virtual

Method to open the connection with the modem.

Returns
_MODEM_OK (see uwmconnector.h) if everything went fine, any other int value otherwise.

Implements UWMconnector.

Definition at line 74 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.cpp.

◆ writeToModem() [1/2]

virtual int Msocket::writeToModem ( std::string  )
virtual

Method for writing to the modem.

Parameters
[in]strthe string to pass to the modem
Returns
w_bytes, the number of transmitted bytes

Implements UWMconnector.

◆ writeToModem() [2/2]

int Msocket::writeToModem ( std::string  str)
virtual

Method for writing to the modem.

Parameters
[in]strthe string to pass to the modem
Returns
w_bytes, the number of transmitted bytes

Implements UWMconnector.

Definition at line 115 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.cpp.

Member Data Documentation

◆ modem_queue_length

int Msocket::modem_queue_length
private

◆ msg_tx

char Msocket::msg_tx
private

Message to be transmitted host to modem.

Definition at line 74 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.

◆ portno

int Msocket::portno
private

Port number.

Definition at line 63 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.

◆ rc

int Msocket::rc
private

Indicator of the thread creation.

Definition at line 64 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.

◆ serv_addr

struct sockaddr_in Msocket::serv_addr
private

Structure to contain the Internet address to be used.

Definition at line 66 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.

◆ server

struct hostent * Msocket::server
private

Structure to define the server host.

Definition at line 73 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.

◆ server_host

std::string Msocket::server_host
private

Name of the server host on the Internet to which we want to be connected as client.

Definition at line 69 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.

◆ sockfd

int Msocket::sockfd
private

Pointer to the socket.

Definition at line 62 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.

◆ thread_id

pthread_t Msocket::thread_id
private

Id of a parallel thread.

Definition at line 65 of file DESERT_Framework/DESERT/physical/uwmphy_modem/msocket.h.


The documentation for this class was generated from the following files: