Files
salmanoff/commonLibs/livoxProto1/livoxProto1.h
T

110 lines
3.3 KiB
C++
Raw Normal View History

#ifndef LIVOXPROTO1_H
#define LIVOXPROTO1_H
#include <memory>
#include <string>
#include <cstdint>
#include <functional>
2026-05-28 20:13:12 -04:00
#include <spinscale/co/invokers.h>
#include <boost/asio/posix/stream_descriptor.hpp>
// Forward declarations
namespace smo {
2025-10-01 18:47:42 -04:00
namespace stim_buff {
struct SmoCallbacks;
}
2025-12-27 16:21:22 -04:00
}
namespace sscl {
class ComponentThread;
}
namespace livoxProto1 {
class Device;
}
2026-05-28 20:13:12 -04:00
struct LivoxProto1GetOrCreateDeviceResult
{
bool success = false;
std::shared_ptr<livoxProto1::Device> device;
};
struct LivoxProto1GetReturnModeResult
{
bool success = false;
uint8_t returnMode = 0;
};
#ifdef __cplusplus
extern "C" {
#endif
/**
* Initialize the Livox protocol library
* @param componentThread Component thread shared pointer
* @param smoCallbacks Callbacks provided by SMO
*/
typedef void livoxProto1_mainFn(
2025-12-27 16:21:22 -04:00
const std::shared_ptr<sscl::ComponentThread>& componentThread,
2025-10-01 18:47:42 -04:00
const smo::stim_buff::SmoCallbacks& smoCallbacks);
/**
* 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 commandTimeoutMs Command 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)
2026-05-28 20:13:12 -04:00
* @return LivoxProto1GetOrCreateDeviceResult (success + device on success,
* null device on failure)
*/
2026-05-28 20:13:12 -04:00
typedef sscl::co::ViralNonPostingInvoker<LivoxProto1GetOrCreateDeviceResult>
livoxProto1_getOrCreateDeviceCReqFn(
const std::string& deviceIdentifier,
2025-12-27 16:21:22 -04:00
const std::shared_ptr<sscl::ComponentThread>& componentThread,
int commandTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
2026-05-28 20:13:12 -04:00
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort);
typedef sscl::co::ViralNonPostingInvoker<bool> livoxProto1_destroyDeviceCReqFn(
std::shared_ptr<livoxProto1::Device> device);
typedef sscl::co::ViralNonPostingInvoker<bool>
livoxProto1_device_enablePcloudDataCReqFn(
std::shared_ptr<livoxProto1::Device> device);
typedef sscl::co::ViralNonPostingInvoker<bool>
livoxProto1_device_disablePcloudDataCReqFn(
std::shared_ptr<livoxProto1::Device> device);
typedef sscl::co::ViralNonPostingInvoker<LivoxProto1GetReturnModeResult>
livoxProto1_device_getReturnModeCReqFn(
std::shared_ptr<livoxProto1::Device> device);
typedef std::shared_ptr<boost::asio::posix::stream_descriptor>
livoxProto1_getPcloudDataFdDescFn(void);
livoxProto1_mainFn livoxProto1_main;
livoxProto1_exitFn livoxProto1_exit;
2026-05-28 20:13:12 -04:00
livoxProto1_getOrCreateDeviceCReqFn livoxProto1_getOrCreateDeviceCReq;
livoxProto1_destroyDeviceCReqFn livoxProto1_destroyDeviceCReq;
livoxProto1_device_enablePcloudDataCReqFn livoxProto1_device_enablePcloudDataCReq;
livoxProto1_device_disablePcloudDataCReqFn
livoxProto1_device_disablePcloudDataCReq;
livoxProto1_device_getReturnModeCReqFn livoxProto1_device_getReturnModeCReq;
livoxProto1_getPcloudDataFdDescFn livoxProto1_getPcloudDataFdDesc;
#ifdef __cplusplus
}
#endif
#endif // LIVOXPROTO1_H