27#include <shared_mutex>
29#include <unordered_map>
64 using CallbackMap = std::unordered_map<uint16_t, std::vector<CallbackEntry<T>>>;
68 std::tuple<CallbackMap<int8_t>,
97#if defined(__ROVECOMM_TESTS_MODE__) && __ROVECOMM_TESTS_MODE__ == 1
124 template<
typename manifest::ManifestEntry Entry>
132 template<
typename manifest::ManifestEntry Entry>
144 template<
typename manifest::ManifestEntry Entry>
147 return On(Entry.DATA_ID, fnCallback);
ExternalIncludes.h is a file that is included in the RoveComm library to include external dependencie...
Defines Global Constants within RoveComm C++.
RoveComm Packet Definition.
AutonomyThread()
Definition AutonomyThread.hpp:75
IPS & GetIPS()
Accessor for the Frame I P S private member.
Definition AutonomyThread.hpp:242
void PooledLinearCode() override
The pooled linear code for the TCP class. This method is not implemented and will do nothing.
Definition RoveCommTCP.cpp:451
void Clear(const CallbackHandle &stHandle)
Remove the one callback identified by a handle from On(). Other callbacks for the same data ID stay r...
Definition RoveCommTCP.cpp:251
void Close()
Closes the TCP socket.
Definition RoveCommTCP.cpp:459
std::tuple< CallbackMap< int8_t >, CallbackMap< uint8_t >, CallbackMap< int16_t >, CallbackMap< uint16_t >, CallbackMap< int32_t >, CallbackMap< uint32_t >, CallbackMap< float >, CallbackMap< double >, CallbackMap< char > > m_tpCallbackMaps
Definition RoveCommTCP.h:77
void ProcessPacket(std::span< const uint8_t > stData)
Processes a received packet and invokes the appropriate callback function from the vector of TCP call...
Definition RoveCommTCP.cpp:329
struct sockaddr_in m_saClientAddr
Definition RoveCommTCP.h:93
std::unordered_map< uint16_t, std::vector< CallbackEntry< T > > > CallbackMap
Definition RoveCommTCP.h:64
struct sockaddr_in m_saTCPServerAddr
Definition RoveCommTCP.h:91
ssize_t WriteTo(std::span< const EntryType< Entry > > spData, const manifest::AddressEntry &stIPAddress=manifest::Helpers::FindBoardById(Entry.DATA_ID).ADDRESS, int nPort=manifest::General::ETHERNET_UDP_PORT)
Definition RoveCommTCP.h:125
std::atomic_int m_nTCPSocket
Definition RoveCommTCP.h:90
std::atomic_int m_nCurrentTCPClientSocket
Definition RoveCommTCP.h:92
void ThreadedContinuousCode() override
The threaded continuous code for the TCP class. This method calls the ReceiveTCPPacketAndCallback met...
Definition RoveCommTCP.cpp:436
void RemoveCallback(const CallbackHandle &stHandle)
Remove the one callback identified by a handle from this node's map for payload type T.
Definition RoveCommTCP.cpp:285
ssize_t WriteTo(std::initializer_list< EntryType< Entry > > ilData, const manifest::AddressEntry &stIPAddress=manifest::Helpers::FindBoardById(Entry.DATA_ID).ADDRESS, int nPort=manifest::General::ETHERNET_UDP_PORT)
Definition RoveCommTCP.h:133
~RoveCommTCP()
Destroy the RoveCommTCP::RoveCommTCP object.
Definition RoveCommTCP.cpp:57
CallbackHandle On(const uint16_t unDataId, std::function< void(const RoveCommPacket< T > &)> fnCallback)
Register a callback for TCP packets with the given data ID. The callback belongs to this node: packet...
Definition RoveCommTCP.cpp:227
bool Init(const manifest::AddressEntry &stIPAddress={0, 0, 0, 0}, int nPort=manifest::General::ETHERNET_TCP_PORT)
Initializes a TCP socket and binds it to the specified IP address and port. And then starts the threa...
Definition RoveCommTCP.cpp:76
constexpr CallbackMap< T > & GetCallbackMap()
Definition RoveCommTCP.h:81
std::shared_mutex m_muCallbackMutex
Definition RoveCommTCP.h:94
ssize_t WriteTo(const RoveCommPacket< T > &stPacket, const manifest::AddressEntry &stIPAddress, int nPort=manifest::General::ETHERNET_UDP_PORT)
Sends a TCP packet to the specified client IP address and port. The data is packed into a RoveCommDat...
Definition RoveCommTCP.cpp:162
uint64_t m_ullNextCallbackID
Definition RoveCommTCP.h:78
RoveCommTCP()
Construct a new RoveCommTCP::RoveCommTCP object.
Definition RoveCommTCP.cpp:41
CallbackHandle On(std::function< void(const RoveCommPacket< EntryType< Entry > > &)> fnCallback)
Definition RoveCommTCP.h:145
void ReceiveAndCallback()
Receives a TCP packet from a client and invokes the appropriate callback function from the vector of ...
Definition RoveCommTCP.cpp:364
std::mutex m_muSocketSendMutex
Definition RoveCommTCP.h:95
const int ETHERNET_UDP_PORT
Definition RoveCommManifest.h:889
const int ETHERNET_TCP_PORT
Definition RoveCommManifest.h:890
const BoardEntry & FindBoardById(uint16_t unDataId)
Definition RoveCommManifest.h:1202
The RoveComm namespace contains all of the functionality for the RoveComm library....
Definition RoveCommConsts.h:23
typename manifest::Helpers::RoveCommToCType< Entry.DATA_TYPE >::c_type EntryType
Definition RoveCommPacket.h:114
RoveCommPacket< EntryType< Entry > > CreatePacket()
Definition RoveCommPacket.h:117
IP Address Object for RoveComm. Default is 0.0.0.0.
Definition RoveCommManifest.h:63
Identifies one callback registered with a node's On(), so Clear() can remove that callback without to...
Definition RoveCommPacket.h:104
The RoveCommPacket struct is used to store data in a packet format for transmission over a network....
Definition RoveCommPacket.h:75
Definition RoveCommTCP.h:57
uint64_t ullID
Definition RoveCommTCP.h:58
std::function< void(const RoveCommPacket< T > &)> fnCallback
Definition RoveCommTCP.h:59