1
0
Fork 0

sending methods are constant

This commit is contained in:
Kevin Matz 2023-05-15 11:40:43 -04:00
parent 654dfed224
commit ba2927e6ee
2 changed files with 10 additions and 8 deletions

View File

@ -89,7 +89,7 @@ Responder::~Responder()
* @brief Responder::send
* @param buffer
*/
void Responder::send(const std::vector<uint8_t> &buffer)
void Responder::send(const std::vector<uint8_t> &buffer) const
{
if (auto sp = sender_.lock())
(*sp)(buffer); // sender still exists
@ -100,7 +100,7 @@ void Responder::send(const std::vector<uint8_t> &buffer)
* @brief Responder::send
* @param response
*/
void Responder::send(const MsgPtr response)
void Responder::send(const MsgPtr response) const
{
if (!response)
return;
@ -116,6 +116,8 @@ void Responder::send(const MsgPtr response)
|| response->mdb.cc == SET_COMMAND_RESPONSE))
return;
/// \cite RDM 6.2.5 Source UID
/// The Source UID is the UID of the device originating this packet.
response->source = uid;
/// \cite RDM 6.2.8.2 Message Count field for Responder Generated Messages
@ -123,11 +125,11 @@ void Responder::send(const MsgPtr response)
/// field shall remain at 255 until the number of queued messages is reduced
/// below that number.
response->messageCount = std::min(queued_messages_.size(),
(size_t)std::numeric_limits<uint8_t>::max());
(size_t)std::numeric_limits<uint8_t>::max());
std::vector<uint8_t> data;
response->write(data);
send(data);
std::vector<uint8_t> buffer;
response->write(buffer);
send(buffer);
}

View File

@ -52,8 +52,8 @@ public:
};
};
virtual void send(const std::vector<uint8_t> &buffer);
virtual void send(const MsgPtr message);
virtual void send(const std::vector<uint8_t> &buffer) const;
virtual void send(const MsgPtr message) const;
virtual void receive(const std::vector<uint8_t> &buffer);
virtual void receive(const MsgPtr message);