LivoxProto1: ExecuteHandshake uses udpCommandDemuxer

UdpCommandDemuxer also now supports devices "under construction".
This commit is contained in:
2025-10-22 22:13:38 -04:00
parent 01ad1ff073
commit a4d99e5d4d
4 changed files with 231 additions and 170 deletions
+17 -2
View File
@@ -90,6 +90,18 @@ public:
uint8_t smoSubnetNbits;
uint16_t dataPort, cmdPort, imuPort;
// Static collection for devices being constructed (not yet in DeviceManager)
// Maps device IP to list of command-specific UDP handlers for that device
struct CommandHandler {
uint8_t cmd_set;
uint8_t cmd_id;
std::function<void(
const uint8_t* data, ssize_t bytesReceived,
const struct sockaddr_in& senderAddr)> handler;
};
static std::unordered_map<std::string, std::vector<CommandHandler>>
devicesUnderConstruction;
private:
// Heartbeat mechanism
void startHeartbeat();
@@ -162,8 +174,11 @@ public:
uint8_t cmd_set, uint8_t cmd_id,
std::function<void(
const uint8_t* data, ssize_t bytesReceived,
const struct sockaddr_in& senderAddr)> handler);
void unregisterUdpCommandHandler(uint8_t cmd_set, uint8_t cmd_id);
const struct sockaddr_in& senderAddr)> handler,
const std::string& deviceIP = "");
void unregisterUdpCommandHandler(
uint8_t cmd_set, uint8_t cmd_id, const std::string& deviceIP = "");
private:
// Point cloud data setup