LivoxProto1: Implemented Device and getOrCreateDevice

Includes everything from sending heartbeat msgs to performing
the connection handshake. We also accept many params to
provider-params to customize and make things easier.
This commit is contained in:
2025-09-06 20:06:38 -04:00
parent 25234c4229
commit a0d577bf81
18 changed files with 1906 additions and 403 deletions
+29 -6
View File
@@ -1,14 +1,37 @@
#include <user/senseApiDesc.h>
#include <stdexcept>
#include "livoxProto1.h"
#include "livoxProto1Core.h"
#include "device.h"
#include "core.h"
extern "C" {
livoxProto1_mainFn livoxProto1_main;
livoxProto1_exitFn livoxProto1_exit;
std::shared_ptr<livoxProto1::Device> livoxProto1_getOrCreateDevice(
const std::string& deviceIdentifier,
const std::shared_ptr<smo::ComponentThread>& componentThread,
int handshakeTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort
)
{
// Get the global DeviceManager instance
auto& protoState = livoxProto1::getProtoState();
if (!protoState.deviceManager)
{
throw std::runtime_error(
std::string(__func__) + ": LivoxProto1 not initialized - call "
"livoxProto1_main first");
}
void livoxProto1_main(
const std::shared_ptr<smo::ComponentThread> &componentThread)
// Delegate to DeviceManager
return protoState.deviceManager->getOrCreateDevice(
deviceIdentifier, componentThread,
handshakeTimeoutMs, retryDelayMs,
smoIp, smoSubnetNbits,
dataPort, cmdPort, imuPort);
}
void livoxProto1_main(const std::shared_ptr<smo::ComponentThread>& componentThread)
{
livoxProto1::main(componentThread);
}