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
+53 -17
View File
@@ -1,25 +1,61 @@
#ifndef LIVOX_PROTO1_API_H
#define LIVOX_PROTO1_API_H
#ifndef LIVOXPROTO1_H
#define LIVOXPROTO1_H
#include <string>
#include <vector>
#include <memory>
#include <map>
#include "livoxProto1Core.h"
#include "livoxProto1Device.h"
#include <string>
#include <cstdint>
// Forward declarations
namespace smo {
class ComponentThread;
}
namespace livoxProto1 {
class Device;
}
} // namespace livoxProto1
#ifdef __cplusplus
extern "C" {
typedef void (livoxProto1_mainFn)(
const std::shared_ptr<smo::ComponentThread> &componentThread);
typedef void (livoxProto1_exitFn)(void);
#endif
void livoxProto1_main(
const std::shared_ptr<smo::ComponentThread> &componentThread);
void livoxProto1_exit(void);
} // extern "C"
/**
* Initialize the Livox protocol library
* @param componentThread Component thread shared pointer
*/
typedef void livoxProto1_mainFn(
const std::shared_ptr<smo::ComponentThread>& componentThread);
#endif // LIVOX_PROTO1_API_H
/**
* Cleanup the Livox protocol library
*/
typedef void livoxProto1_exitFn(void);
/**
* Create a new Livox device connection
* @param deviceIdentifier The device identifier (broadcast code)
* @param componentThread Component thread for async operations
* @param handshakeTimeoutMs Handshake timeout in milliseconds (default: 1000)
* @param retryDelayMs Retry delay in milliseconds (default: 3000)
* @param smoIp SMO IP address (empty string for auto-detection)
* @param smoSubnetNbits SMO subnet mask bits (e.g., 24 for /24, 16 for /16)
* @param dataPort Data port for point cloud (default: 56000)
* @param cmdPort Command port (default: 56001)
* @param imuPort IMU port (default: 56002)
* @return Device pointer on success, nullptr on failure
*/
typedef std::shared_ptr<livoxProto1::Device> livoxProto1_getOrCreateDeviceFn(
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);
livoxProto1_mainFn livoxProto1_main;
livoxProto1_exitFn livoxProto1_exit;
livoxProto1_getOrCreateDeviceFn livoxProto1_getOrCreateDevice;
#ifdef __cplusplus
}
#endif
#endif // LIVOXPROTO1_H