Package rospy :: Package impl :: Module tcpros_base :: Class TCPROSTransportProtocol

Class TCPROSTransportProtocol

source code

object --+
         |
        TCPROSTransportProtocol
Known Subclasses:

Abstraction of TCPROS connections. Implementations Services/Publishers/Subscribers must implement this protocol, which defines how messages are deserialized from an inbound connection (read_messages()) as well as which fields to send when creating a new connection (get_header_fields()).

Instance Methods
 
__init__(self, resolved_name, recv_data_class, queue_size=None, buff_size=65536)
ctor
source code
 
read_messages(self, b, msg_queue, sock) source code
dict
get_header_fields(self)
Header fields that should be sent over the connection.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, resolved_name, recv_data_class, queue_size=None, buff_size=65536)
(Constructor)

source code 

ctor

Parameters:
  • resolved_name (str) - resolved service or topic name
  • recv_data_class (Class) - message class for deserializing inbound messages
  • queue_size (int) - maximum number of inbound messages to maintain
  • buff_size (int) - receive buffer size (in bytes) for reading from the connection.
Overrides: object.__init__

read_messages(self, b, msg_queue, sock)

source code 
Parameters:
  • b, StringIO - read buffer
  • msg_queue ([Message]), [Message] - queue of deserialized messages
  • sock, socket - protocol can optionally read more data from the socket, but in most cases the required data will already be in b

get_header_fields(self)

source code 

Header fields that should be sent over the connection. The header fields are protocol specific (i.e. service vs. topic, publisher vs. subscriber).

Returns: dict
{str : str}: header fields to send over connection