Files
salmanoff/commonLibs/livoxProto1/livoxProto1.cpp
T

65 lines
1.5 KiB
C++
Raw Normal View History

#include <stdexcept>
#include "livoxProto1.h"
#include "device.h"
#include "core.h"
extern "C" {
void livoxProto1_getOrCreateDeviceReq(
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_getOrCreateDeviceReqCbFn callback
)
{
// 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");
}
// Delegate to DeviceManager
protoState.deviceManager->getOrCreateDeviceReq(
deviceIdentifier, componentThread,
handshakeTimeoutMs, retryDelayMs,
smoIp, smoSubnetNbits,
dataPort, cmdPort, imuPort,
callback);
}
void livoxProto1_destroyDeviceReq(
std::shared_ptr<livoxProto1::Device> device,
livoxProto1_destroyDeviceReqCbFn callback
)
{
auto& protoState = livoxProto1::getProtoState();
if (!protoState.deviceManager)
{
throw std::runtime_error(std::string(__func__)
+ ": DeviceManager not initialized");
}
2025-09-16 18:36:11 -04:00
protoState.deviceManager->destroyDeviceReq(
device, callback);
}
void livoxProto1_main(
const std::shared_ptr<smo::ComponentThread>& componentThread,
const smo::sense_api::SmoCallbacks& smoCallbacks)
{
livoxProto1::main(componentThread, smoCallbacks);
}
void livoxProto1_exit(void)
{
livoxProto1::exit();
}
} // extern "C"