refactor: simplifying message queue
This commit is contained in:
@@ -76,6 +76,17 @@ class SPIT_Message {
|
||||
public:
|
||||
Header *getHeader() const { return m_Header.get(); }
|
||||
int getBytesCount() const { return m_BytesCount; }
|
||||
void setServerInfoInHeader(string clientId, string serverId) {
|
||||
if (!m_Header)
|
||||
return;
|
||||
m_Header->setClientID(clientId);
|
||||
m_Header->setServerID(serverId);
|
||||
}
|
||||
void setMessageNumber(uint8_t no) {
|
||||
if (!m_Header)
|
||||
return;
|
||||
m_Header->setMessageNumber(no);
|
||||
}
|
||||
|
||||
const string getServerID() const {
|
||||
if (!m_Header) {
|
||||
@@ -131,7 +142,6 @@ class SPIT_Message {
|
||||
|
||||
// Members
|
||||
private:
|
||||
std::vector<char> m_MessageBytes{};
|
||||
unique_ptr<OPPart> m_OPPart{};
|
||||
|
||||
// Receive
|
||||
@@ -148,13 +158,11 @@ class SPIT_Message {
|
||||
const OPPart *getOPPart() const { return m_OPPart.get(); }
|
||||
|
||||
private:
|
||||
bool parse();
|
||||
bool parse(std::vector<char> message);
|
||||
|
||||
// Send
|
||||
public:
|
||||
SPIT_Message(unique_ptr<OPPart> p_OPPart);
|
||||
bool fillBytes();
|
||||
const std::vector<char> *getMessageBytes();
|
||||
static std::vector<char> createMessage(OPPart & p_OPPart);
|
||||
|
||||
//------------------------------ Connection ----------------------------------
|
||||
|
||||
@@ -387,15 +395,15 @@ class SPIT_Message {
|
||||
static constexpr int BYTESLENGTH = 168;
|
||||
|
||||
private:
|
||||
bool m_Confirmed {};
|
||||
string m_SPITTypeID {};
|
||||
bool m_Fixed {};
|
||||
bool m_ServerRemote {};
|
||||
bool m_ServerProjectIndepended {};
|
||||
string m_SPITTypeGroupName {};
|
||||
string m_SPITTypeName {};
|
||||
long long m_Delay {};
|
||||
long long m_Duration {};
|
||||
bool m_Confirmed{};
|
||||
string m_SPITTypeID{};
|
||||
bool m_Fixed{};
|
||||
bool m_ServerRemote{};
|
||||
bool m_ServerProjectIndepended{};
|
||||
string m_SPITTypeGroupName{};
|
||||
string m_SPITTypeName{};
|
||||
long long m_Delay{};
|
||||
long long m_Duration{};
|
||||
|
||||
public:
|
||||
ReportSPITType(const ReportSPITType &orig);
|
||||
@@ -528,7 +536,6 @@ class SPIT_Message {
|
||||
void setDuration(long long p_Duration);
|
||||
void setActionAssigned(bool p_ActionAssigned) { m_ActionAssigned = p_ActionAssigned; }
|
||||
bool fillBytes(std::vector<char> &message);
|
||||
|
||||
};
|
||||
|
||||
//----------- RemoveSPITObject -----------
|
||||
|
||||
Reference in New Issue
Block a user