-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed annoying type aliases and removed Fetch() function
- Loading branch information
1 parent
a330c8c
commit 61fba82
Showing
12 changed files
with
202 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,7 @@ class RoveCommEthernetTcp : public RoveCommServer | |
* @author OcelotEmpire ([email protected]) | ||
* @date 2023-12-21 | ||
******************************************************************************/ | ||
RoveCommEthernetTcp(RoveCommPort unPort) : RoveCommServer(unPort){}; | ||
RoveCommEthernetTcp(uint16_t unPort) : RoveCommServer(unPort){}; | ||
|
||
bool Init() override; | ||
void Shutdown() override; | ||
|
@@ -83,20 +83,20 @@ class RoveCommEthernetTcp : public RoveCommServer | |
void AcceptIncomingConnections(); | ||
|
||
private: | ||
void _register_socket(const RoveCommAddress& sAddress, RoveCommSocket nSocket, bool bIsIncoming); | ||
void _register_socket(const RoveCommAddress& sAddress, int nSocket, bool bIsIncoming); | ||
void _unregister_socket(const RoveCommAddress& sAddress); | ||
|
||
private: | ||
void OnRoveCommUpdate() override { AcceptIncomingConnections(); } | ||
|
||
// Socket for accepting connections from other devices | ||
RoveCommSocket m_nListeningSocket; | ||
int m_nListeningSocket; | ||
// All open connections (outgoing and incoming) | ||
std::map<RoveCommAddress, RoveCommSocket> m_mOpenSockets; | ||
std::map<RoveCommAddress, int> m_mOpenSockets; | ||
// The sockets that Write() will send() to | ||
std::map<RoveCommAddress, RoveCommSocket> m_mIncomingSockets; | ||
std::map<RoveCommAddress, int> m_mIncomingSockets; | ||
// Buffers to persist incomplete recv()'s | ||
std::map<RoveCommSocket, std::vector<char>> m_mReadBuffers; | ||
std::map<int, std::vector<char>> m_mReadBuffers; | ||
|
||
// fd_set's contain all sockets for interfacing with the c library | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,7 +40,7 @@ class RoveCommEthernetUdp : public RoveCommServer | |
* @author OcelotEmpire ([email protected]) | ||
* @date 2023-12-21 | ||
******************************************************************************/ | ||
RoveCommEthernetUdp(RoveCommPort unPort) : RoveCommServer(unPort){}; | ||
RoveCommEthernetUdp(uint16_t unPort) : RoveCommServer(unPort){}; | ||
|
||
bool Init() override; | ||
void Shutdown() override; | ||
|
@@ -53,7 +53,7 @@ class RoveCommEthernetUdp : public RoveCommServer | |
void Unsubscribe(const RoveCommAddress& address); | ||
|
||
private: | ||
RoveCommSocket m_nSocket; | ||
int m_nSocket; | ||
fd_set m_sReadSet; | ||
// these aren't meant to be read outside the class, so I'm being lazy and using the native struct type | ||
std::list<sockaddr_in> m_lSubscribers; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,10 +21,10 @@ | |
#include <stdlib.h> | ||
#include <string> | ||
|
||
using RoveCommVersionId = uint8_t; | ||
using RoveCommDataId = uint16_t; | ||
using RoveCommDataCount = uint16_t; | ||
using RoveCommDataType = uint8_t; | ||
// using RoveCommVersionId = uint8_t; | ||
// using RoveCommDataId = uint16_t; | ||
// using RoveCommDataCount = uint16_t; | ||
// using RoveCommDataType = uint8_t; | ||
|
||
namespace rovecomm | ||
{ | ||
|
@@ -37,7 +37,7 @@ namespace rovecomm | |
* @author OcelotEmpire ([email protected]) | ||
* @date 2024-01-15 | ||
******************************************************************************/ | ||
size_t DataTypeSize(RoveCommDataType ucDataType); | ||
size_t DataTypeSize(uint8_t ucDataType); | ||
} // namespace rovecomm | ||
|
||
/* | ||
|
@@ -63,10 +63,10 @@ namespace rovecomm | |
******************************************************************************/ | ||
struct RoveCommPacketHeader | ||
{ | ||
RoveCommVersionId ucVersionId; | ||
RoveCommDataId usDataId; | ||
RoveCommDataCount usDataCount; | ||
RoveCommDataType ucDataType; | ||
uint8_t ucVersionId; | ||
uint16_t usDataId; | ||
uint16_t usDataCount; | ||
uint8_t ucDataType; | ||
}; | ||
|
||
/****************************************************************************** | ||
|
@@ -95,14 +95,14 @@ class RoveCommPacket | |
public: | ||
RoveCommPacket() : RoveCommPacket(rovecomm::System::NO_DATA_DATA_ID, 0, rovecomm::DataTypes::INT8_T, nullptr){}; | ||
|
||
RoveCommPacket(RoveCommDataId usDataId, RoveCommDataCount usDataCount, RoveCommDataType ucDataType, std::unique_ptr<char>&& pData) : | ||
RoveCommPacket(uint16_t usDataId, uint16_t usDataCount, uint8_t ucDataType, std::unique_ptr<char>&& pData) : | ||
RoveCommPacket({rovecomm::ROVECOMM_VERSION, usDataId, usDataCount, ucDataType}, std::move(pData)){}; | ||
|
||
RoveCommPacket(RoveCommPacketHeader sHeader, std::unique_ptr<char>&& pData) : m_sHeader(sHeader), m_pData(std::move(pData)){}; | ||
|
||
// convenience constructors: | ||
|
||
RoveCommPacket(RoveCommDataId usDataId) : RoveCommPacket(usDataId, 0, rovecomm::DataTypes::UINT8_T, std::unique_ptr<char>{}){}; | ||
RoveCommPacket(uint16_t usDataId) : RoveCommPacket(usDataId, 0, rovecomm::DataTypes::UINT8_T, std::unique_ptr<char>{}){}; | ||
|
||
// example usage: RoveComm.SendTo(address, RoveCommPacket{rovecomm::AUTONOMY::REACHEDMARKER, 1}) | ||
// template<typename T> | ||
|
@@ -115,14 +115,13 @@ class RoveCommPacket | |
// for (int i = 0; i<) | ||
// }; | ||
|
||
|
||
inline RoveCommVersionId GetVersionId() const { return m_sHeader.ucVersionId; } | ||
inline uint8_t GetVersionId() const { return m_sHeader.ucVersionId; } | ||
|
||
inline RoveCommDataId GetDataId() const { return m_sHeader.usDataId; } | ||
inline uint16_t GetDataId() const { return m_sHeader.usDataId; } | ||
|
||
inline RoveCommDataCount GetDataCount() const { return m_sHeader.usDataCount; } | ||
inline uint16_t GetDataCount() const { return m_sHeader.usDataCount; } | ||
|
||
inline RoveCommDataType GetDataType() const { return m_sHeader.ucDataType; } | ||
inline uint8_t GetDataType() const { return m_sHeader.ucDataType; } | ||
|
||
/****************************************************************************** | ||
* @brief Get the size of the packet's data array (not including the header) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.