8 #include <RHGenericDriver.h>
9 #include <RHTcpProtocol.h>
75 RH_TCP(
const char* server =
"localhost:4000");
110 virtual bool recv(uint8_t* buf, uint8_t* len);
119 virtual bool send(
const uint8_t* data, uint8_t len);
142 bool connectToServer();
145 void checkForEvents();
154 bool sendThisAddress(uint8_t thisAddress);
161 bool sendPacket(
const uint8_t* data, uint8_t len);
171 uint8_t _rxBuf[RH_TCP_MAX_PAYLOAD_LEN + 5];
176 void validateRxBuf();
180 volatile bool _rxBufFull;
volatile uint16_t _rxGood
Count of the number of successfully transmitted messaged.
Definition: RHGenericDriver.h:292
uint32_t length
Number of octets following, in network byte order.
Definition: RHTcpProtocol.h:39
uint8_t payload[RH_TCP_MAX_MESSAGE_LEN]
0 or more, length deduced from length above
Definition: RHTcpProtocol.h:61
volatile uint8_t _rxHeaderFrom
FROM header in the last received mesasge.
Definition: RHGenericDriver.h:265
uint8_t thisAddress
Node address.
Definition: RHTcpProtocol.h:49
uint8_t type
== RH_TCP_MESSAGE_TYPE_THISADDRESS
Definition: RHTcpProtocol.h:48
volatile uint8_t _rxHeaderTo
TO header in the last received mesasge.
Definition: RHGenericDriver.h:262
RH_TCP(const char *server="localhost:4000")
uint8_t from
Node address of the sender.
Definition: RHTcpProtocol.h:58
uint8_t flags
Message flags.
Definition: RHTcpProtocol.h:60
uint8_t _txHeaderFrom
FROM header to send in all messages.
Definition: RHGenericDriver.h:277
Abstract base class for a RadioHead driver.
Definition: RHGenericDriver.h:41
uint8_t _thisAddress
This node id.
Definition: RHGenericDriver.h:256
uint8_t type
One of RH_TCP_MESSAGE_TYPE_*.
Definition: RHTcpProtocol.h:40
bool _promiscuous
Whether the transport is in promiscuous mode.
Definition: RHGenericDriver.h:259
virtual void setThisAddress(uint8_t thisAddress)
Definition: RHGenericDriver.cpp:108
volatile uint8_t _rxHeaderFlags
FLAGS header in the last received mesasge.
Definition: RHGenericDriver.h:271
virtual void waitAvailable()
Generic RH_TCP message structure with message type.
Definition: RHTcpProtocol.h:37
uint32_t length
Number of octets following, in network byte order.
Definition: RHTcpProtocol.h:55
RH_TCP radio message passed to or from the simulator.
Definition: RHTcpProtocol.h:53
virtual bool send(const uint8_t *data, uint8_t len)
virtual bool recv(uint8_t *buf, uint8_t *len)
uint8_t _txHeaderId
ID header to send in all messages.
Definition: RHGenericDriver.h:280
uint8_t _txHeaderTo
TO header to send in all messages.
Definition: RHGenericDriver.h:274
uint8_t to
Node address of the recipient.
Definition: RHTcpProtocol.h:57
uint8_t _txHeaderFlags
FLAGS header to send in all messages.
Definition: RHGenericDriver.h:283
virtual bool waitAvailableTimeout(uint16_t timeout)
uint32_t length
Number of octets following, in network byte order.
Definition: RHTcpProtocol.h:47
volatile uint8_t _rxHeaderId
ID header in the last received mesasge.
Definition: RHGenericDriver.h:268
Driver to send and receive unaddressed, unreliable datagrams via sockets on a Linux simulator.
Definition: RH_TCP.h:67
virtual uint8_t maxMessageLength()
void setThisAddress(uint8_t address)
uint8_t type
== RH_TCP_MESSAGE_TYPE_PACKET
Definition: RHTcpProtocol.h:56
uint8_t id
Message sequence number.
Definition: RHTcpProtocol.h:59
RH_TCP message Notifies the server of thisAddress of this client.
Definition: RHTcpProtocol.h:45
virtual bool waitCAD()
Definition: RHGenericDriver.cpp:72