2025-09-06 20:06:38 -04:00
|
|
|
#ifndef LIVOXPROTO1_H
|
|
|
|
|
#define LIVOXPROTO1_H
|
2025-09-05 00:08:25 -04:00
|
|
|
|
2025-11-03 22:18:45 -04:00
|
|
|
#include <boostAsioLinkageFix.h>
|
2025-09-05 00:08:25 -04:00
|
|
|
#include <memory>
|
2025-09-06 20:06:38 -04:00
|
|
|
#include <string>
|
|
|
|
|
#include <cstdint>
|
2025-09-09 12:07:49 -04:00
|
|
|
#include <functional>
|
2025-09-27 18:30:09 -04:00
|
|
|
#include <callback.h>
|
2025-11-02 19:16:22 -04:00
|
|
|
#include <boost/asio/posix/stream_descriptor.hpp>
|
2025-09-05 00:08:25 -04:00
|
|
|
|
2025-09-06 20:06:38 -04:00
|
|
|
// Forward declarations
|
|
|
|
|
namespace smo {
|
2025-10-01 18:47:42 -04:00
|
|
|
namespace stim_buff {
|
2025-09-09 12:07:49 -04:00
|
|
|
struct SmoCallbacks;
|
|
|
|
|
}
|
2025-09-06 20:06:38 -04:00
|
|
|
class ComponentThread;
|
|
|
|
|
}
|
2025-09-05 00:08:25 -04:00
|
|
|
|
2025-09-06 20:06:38 -04:00
|
|
|
namespace livoxProto1 {
|
|
|
|
|
class Device;
|
|
|
|
|
}
|
2025-09-05 00:08:25 -04:00
|
|
|
|
2025-09-06 20:06:38 -04:00
|
|
|
#ifdef __cplusplus
|
2025-09-05 00:08:25 -04:00
|
|
|
extern "C" {
|
2025-09-06 20:06:38 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Initialize the Livox protocol library
|
|
|
|
|
* @param componentThread Component thread shared pointer
|
2025-09-09 12:07:49 -04:00
|
|
|
* @param smoCallbacks Callbacks provided by SMO
|
2025-09-06 20:06:38 -04:00
|
|
|
*/
|
|
|
|
|
typedef void livoxProto1_mainFn(
|
2025-09-09 12:07:49 -04:00
|
|
|
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
2025-10-01 18:47:42 -04:00
|
|
|
const smo::stim_buff::SmoCallbacks& smoCallbacks);
|
2025-09-06 20:06:38 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 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
|
2025-11-01 02:45:24 -04:00
|
|
|
* @param commandTimeoutMs Command timeout in milliseconds (default: 1000)
|
2025-09-06 20:06:38 -04:00
|
|
|
* @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
|
|
|
|
|
*/
|
2025-09-09 12:07:49 -04:00
|
|
|
typedef std::function<
|
|
|
|
|
void(bool success, std::shared_ptr<livoxProto1::Device> device)>
|
|
|
|
|
livoxProto1_getOrCreateDeviceReqCbFn;
|
|
|
|
|
|
|
|
|
|
typedef void livoxProto1_getOrCreateDeviceReqFn(
|
2025-09-06 20:06:38 -04:00
|
|
|
const std::string& deviceIdentifier,
|
|
|
|
|
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
2025-11-01 02:45:24 -04:00
|
|
|
int commandTimeoutMs, int retryDelayMs,
|
2025-09-06 20:06:38 -04:00
|
|
|
const std::string& smoIp, uint8_t smoSubnetNbits,
|
2025-09-09 12:07:49 -04:00
|
|
|
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort,
|
2025-09-27 18:30:09 -04:00
|
|
|
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback);
|
2025-09-09 12:07:49 -04:00
|
|
|
|
|
|
|
|
typedef std::function<void(bool success)> livoxProto1_destroyDeviceReqCbFn;
|
|
|
|
|
typedef void livoxProto1_destroyDeviceReqFn(
|
|
|
|
|
std::shared_ptr<livoxProto1::Device> device,
|
2025-09-27 18:30:09 -04:00
|
|
|
smo::Callback<livoxProto1_destroyDeviceReqCbFn> callback);
|
2025-09-09 12:07:49 -04:00
|
|
|
|
2025-10-25 12:53:07 -04:00
|
|
|
typedef std::function<void(bool success)>
|
|
|
|
|
livoxProto1_device_enablePcloudDataReqCbFn;
|
|
|
|
|
typedef void livoxProto1_device_enablePcloudDataReqFn(
|
|
|
|
|
std::shared_ptr<livoxProto1::Device> device,
|
|
|
|
|
smo::Callback<livoxProto1_device_enablePcloudDataReqCbFn> callback);
|
|
|
|
|
|
|
|
|
|
typedef std::function<void(bool success)>
|
|
|
|
|
livoxProto1_device_disablePcloudDataReqCbFn;
|
|
|
|
|
typedef void livoxProto1_device_disablePcloudDataReqFn(
|
|
|
|
|
std::shared_ptr<livoxProto1::Device> device,
|
|
|
|
|
smo::Callback<livoxProto1_device_disablePcloudDataReqCbFn> callback);
|
|
|
|
|
|
2025-10-30 11:49:54 -04:00
|
|
|
typedef std::function<void(bool success, uint8_t returnMode)>
|
|
|
|
|
livoxProto1_device_getReturnModeReqCbFn;
|
|
|
|
|
typedef void livoxProto1_device_getReturnModeReqFn(
|
|
|
|
|
std::shared_ptr<livoxProto1::Device> device,
|
|
|
|
|
smo::Callback<livoxProto1_device_getReturnModeReqCbFn> callback);
|
2025-09-06 20:06:38 -04:00
|
|
|
|
2025-11-01 22:41:58 -04:00
|
|
|
typedef std::shared_ptr<boost::asio::posix::stream_descriptor>
|
|
|
|
|
livoxProto1_getPcloudDataFdDescFn(void);
|
|
|
|
|
|
2025-09-06 20:06:38 -04:00
|
|
|
livoxProto1_mainFn livoxProto1_main;
|
|
|
|
|
livoxProto1_exitFn livoxProto1_exit;
|
2025-09-09 12:07:49 -04:00
|
|
|
livoxProto1_getOrCreateDeviceReqFn livoxProto1_getOrCreateDeviceReq;
|
|
|
|
|
livoxProto1_destroyDeviceReqFn livoxProto1_destroyDeviceReq;
|
2025-10-25 12:53:07 -04:00
|
|
|
livoxProto1_device_enablePcloudDataReqFn livoxProto1_device_enablePcloudDataReq;
|
|
|
|
|
livoxProto1_device_disablePcloudDataReqFn
|
|
|
|
|
livoxProto1_device_disablePcloudDataReq;
|
2025-10-30 11:49:54 -04:00
|
|
|
livoxProto1_device_getReturnModeReqFn livoxProto1_device_getReturnModeReq;
|
2025-11-01 22:41:58 -04:00
|
|
|
livoxProto1_getPcloudDataFdDescFn livoxProto1_getPcloudDataFdDesc;
|
2025-09-05 00:08:25 -04:00
|
|
|
|
2025-09-06 20:06:38 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
2025-09-05 00:08:25 -04:00
|
|
|
|
2025-10-25 12:53:07 -04:00
|
|
|
#endif // LIVOXPROTO1_H
|