UdpCmdDemux: formatting
This commit is contained in:
@@ -304,26 +304,33 @@ void UdpCommandDemuxer::processIncomingData()
|
|||||||
{
|
{
|
||||||
// Extract command set and command ID from the datagram
|
// Extract command set and command ID from the datagram
|
||||||
if (bytesReceived >= static_cast<ssize_t>(
|
if (bytesReceived >= static_cast<ssize_t>(
|
||||||
sizeof(livoxProto1::comms::Header) + sizeof(livoxProto1::comms::Command)))
|
sizeof(livoxProto1::comms::Header)
|
||||||
|
+ sizeof(livoxProto1::comms::Command)))
|
||||||
{
|
{
|
||||||
uint8_t cmd_set = receiveBuffer[sizeof(livoxProto1::comms::Header)];
|
uint8_t cmd_set = receiveBuffer[
|
||||||
uint8_t cmd_id = receiveBuffer[sizeof(livoxProto1::comms::Header) + 1];
|
sizeof(livoxProto1::comms::Header)];
|
||||||
|
uint8_t cmd_id = receiveBuffer[
|
||||||
|
sizeof(livoxProto1::comms::Header) + 1];
|
||||||
|
|
||||||
// Found matching device in temporary collection, invoke matching handlers
|
// Found matching dev in temp collection, invoke matching handlers
|
||||||
for (const auto& cmdHandler : tempIt->second)
|
for (const auto& cmdHandler : tempIt->second)
|
||||||
{
|
{
|
||||||
if (cmdHandler.cmd_set != cmd_set || cmdHandler.cmd_id != cmd_id)
|
if (cmdHandler.cmd_set != cmd_set
|
||||||
{ continue; }
|
|| cmdHandler.cmd_id != cmd_id)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
cmdHandler.handler(receiveBuffer, bytesReceived, senderAddr);
|
cmdHandler.handler(
|
||||||
|
receiveBuffer, bytesReceived, senderAddr);
|
||||||
}
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
std::cerr
|
std::cerr << __func__ << ": Temporary device handler "
|
||||||
<< __func__ << ": Temporary device handler exception for IP "
|
"exception for IP " << sourceIP << ": " << e.what()
|
||||||
<< sourceIP << ": " << e.what() << std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user