livoxProto1: Implement async getOrCreateDeviceReq+destroyDeviceReq

These are now both fully asynchronous. They also work fully
and both connect and disconnect to/from the Avia just fine,
in all tested scenarios.
This commit is contained in:
2025-09-09 12:07:49 -04:00
parent 48121ec84c
commit 20cdf64afb
9 changed files with 1041 additions and 269 deletions
+22 -4
View File
@@ -4,9 +4,13 @@
#include <memory>
#include <string>
#include <cstdint>
#include <functional>
// Forward declarations
namespace smo {
namespace sense_api {
struct SmoCallbacks;
}
class ComponentThread;
}
@@ -21,9 +25,11 @@ extern "C" {
/**
* Initialize the Livox protocol library
* @param componentThread Component thread shared pointer
* @param smoCallbacks Callbacks provided by SMO
*/
typedef void livoxProto1_mainFn(
const std::shared_ptr<smo::ComponentThread>& componentThread);
const std::shared_ptr<smo::ComponentThread>& componentThread,
const smo::sense_api::SmoCallbacks& smoCallbacks);
/**
* Cleanup the Livox protocol library
@@ -43,16 +49,28 @@ typedef void livoxProto1_exitFn(void);
* @param imuPort IMU port (default: 56002)
* @return Device pointer on success, nullptr on failure
*/
typedef std::shared_ptr<livoxProto1::Device> livoxProto1_getOrCreateDeviceFn(
typedef std::function<
void(bool success, std::shared_ptr<livoxProto1::Device> device)>
livoxProto1_getOrCreateDeviceReqCbFn;
typedef void livoxProto1_getOrCreateDeviceReqFn(
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);
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort,
livoxProto1_getOrCreateDeviceReqCbFn callback);
typedef std::function<void(bool success)> livoxProto1_destroyDeviceReqCbFn;
typedef void livoxProto1_destroyDeviceReqFn(
std::shared_ptr<livoxProto1::Device> device,
livoxProto1_destroyDeviceReqCbFn callback);
livoxProto1_mainFn livoxProto1_main;
livoxProto1_exitFn livoxProto1_exit;
livoxProto1_getOrCreateDeviceFn livoxProto1_getOrCreateDevice;
livoxProto1_getOrCreateDeviceReqFn livoxProto1_getOrCreateDeviceReq;
livoxProto1_destroyDeviceReqFn livoxProto1_destroyDeviceReq;
#ifdef __cplusplus
}