livox: rename handshakeTimeoutMs=>commandTimeoutMs

This commit is contained in:
2025-11-01 02:45:24 -04:00
parent 58e9b09995
commit c8474edad7
8 changed files with 38 additions and 33 deletions
+2 -2
View File
@@ -129,7 +129,7 @@ public:
void DeviceManager::getOrCreateDeviceReq(
const std::string &deviceIdentifier,
const std::shared_ptr<smo::ComponentThread>& componentThread,
int handshakeTimeoutMs, int retryDelayMs,
int commandTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort,
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback)
@@ -163,7 +163,7 @@ void DeviceManager::getOrCreateDeviceReq(
// Device doesn't exist, create a new one but don't add it to collection yet
auto newDevice = std::make_shared<Device>(
deviceIdentifier, componentThread,
handshakeTimeoutMs, retryDelayMs,
commandTimeoutMs, retryDelayMs,
smoIp, smoSubnetNbits,
dataPort, cmdPort, imuPort);
+1 -1
View File
@@ -26,7 +26,7 @@ public:
void getOrCreateDeviceReq(
const std::string &deviceIdentifier,
const std::shared_ptr<smo::ComponentThread>& componentThread,
int handshakeTimeoutMs, int retryDelayMs,
int commandTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort,
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback);
+7 -7
View File
@@ -90,7 +90,7 @@ std::string DiscoveredDevice::getDeviceTypeName(void) const
Device::Device(const std::string &deviceIdentifier,
const std::shared_ptr<smo::ComponentThread>& componentThread,
int handshakeTimeoutMs, int retryDelayMs,
int commandTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort)
: discoveredDevice(
@@ -99,7 +99,7 @@ Device::Device(const std::string &deviceIdentifier,
""),
nAttachedStimBuffs(0),
componentThread(componentThread),
handshakeTimeoutMs(handshakeTimeoutMs), retryDelayMs(retryDelayMs),
commandTimeoutMs(commandTimeoutMs), retryDelayMs(retryDelayMs),
smoIp(smoIp), detectedSmoListeningIp(""), smoSubnetNbits(smoSubnetNbits),
dataPort(dataPort), cmdPort(cmdPort), imuPort(imuPort),
heartbeatActive(false),
@@ -572,7 +572,7 @@ private:
* we will consider the handshake to have failed.
*/
timeoutTimer.expires_from_now(
boost::posix_time::milliseconds(device.handshakeTimeoutMs));
boost::posix_time::milliseconds(device.commandTimeoutMs));
timeoutTimer.async_wait(
std::bind(
@@ -651,7 +651,7 @@ private:
if (finalTimerFired
&& finalSocketState == SocketState::SOCKET_STILL_WAITING)
{
std::cerr << __func__ << ": Handshake timeout with "
std::cerr << __func__ << ": Command timeout with "
<< deviceIP << "(" << device.discoveredDevice.deviceIdentifier
<< ")" << std::endl;
@@ -1389,7 +1389,7 @@ protected:
{
// Setup timeout timer
timeoutTimer.expires_from_now(
boost::posix_time::milliseconds(device.handshakeTimeoutMs));
boost::posix_time::milliseconds(device.commandTimeoutMs));
timeoutTimer.async_wait(
std::bind(
@@ -1998,7 +1998,7 @@ public:
{
// Set up timeout timer
timeoutTimer.expires_from_now(boost::posix_time::milliseconds(
device.handshakeTimeoutMs));
device.commandTimeoutMs));
timeoutTimer.async_wait(
std::bind(&SetReturnModeReq::setReturnModeReq1_1,
this, request,
@@ -2245,7 +2245,7 @@ public:
{
// Set up timeout timer
timeoutTimer.expires_from_now(boost::posix_time::milliseconds(
device.handshakeTimeoutMs));
device.commandTimeoutMs));
timeoutTimer.async_wait(
std::bind(&GetReturnModeReq::getReturnModeReq1_1,
+2 -2
View File
@@ -74,7 +74,7 @@ class Device
public:
Device(const std::string &deviceIdentifier,
const std::shared_ptr<smo::ComponentThread>& componentThread,
int handshakeTimeoutMs, int retryDelayMs,
int commandTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort);
~Device();
@@ -152,7 +152,7 @@ public:
// Configuration
std::shared_ptr<smo::ComponentThread> componentThread;
int handshakeTimeoutMs, retryDelayMs;
int commandTimeoutMs, retryDelayMs;
std::string smoIp;
std::string detectedSmoListeningIp;
uint8_t smoSubnetNbits;
+2 -2
View File
@@ -10,7 +10,7 @@ extern "C" {
void livoxProto1_getOrCreateDeviceReq(
const std::string& deviceIdentifier,
const std::shared_ptr<smo::ComponentThread>& componentThread,
int handshakeTimeoutMs, int retryDelayMs,
int commandTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort,
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback
@@ -28,7 +28,7 @@ void livoxProto1_getOrCreateDeviceReq(
// Delegate to DeviceManager
protoState.deviceManager->getOrCreateDeviceReq(
deviceIdentifier, componentThread,
handshakeTimeoutMs, retryDelayMs,
commandTimeoutMs, retryDelayMs,
smoIp, smoSubnetNbits,
dataPort, cmdPort, imuPort,
callback);
+2 -2
View File
@@ -41,7 +41,7 @@ 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 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)
@@ -57,7 +57,7 @@ typedef std::function<
typedef void livoxProto1_getOrCreateDeviceReqFn(
const std::string& deviceIdentifier,
const std::shared_ptr<smo::ComponentThread>& componentThread,
int handshakeTimeoutMs, int retryDelayMs,
int commandTimeoutMs, int retryDelayMs,
const std::string& smoIp, uint8_t smoSubnetNbits,
uint16_t dataPort, uint16_t cmdPort, uint16_t imuPort,
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback);
+11 -11
View File
@@ -25,7 +25,7 @@ Each stim-buff-api is designed to work with specific stim-iface libraries that u
**Syntax**:
```
+idev | avia0 | pcloudIntensity | livoxGen1-pcloudIntensity(data-rate-hz=10) | livoxProto1(handshake-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+idev | avia0 | pcloudIntensity | livoxGen1-pcloudIntensity(data-rate-hz=10) | livoxProto1(command-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
```
**Stim-Buff-API**: `livoxGen1-pcloudIntensity`
@@ -37,15 +37,15 @@ Each stim-buff-api is designed to work with specific stim-iface libraries that u
**Syntax**:
```
+edev | avia0 | pcloud(format=xyz) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(handshake-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+edev | avia0 | pcloud(format=xyz) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(command-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
```
**Alternative Format Examples**:
```
+edev | avia0 | pcloud(format=spherical) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(handshake-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+edev | avia0 | pcloud(format=spherical-cartesian) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(handshake-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+edev | avia0 | pcloud(format=dual-cartesian) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(handshake-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+edev | avia0 | pcloud(format=dual-spherical) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(handshake-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+edev | avia0 | pcloud(format=spherical) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(command-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+edev | avia0 | pcloud(format=spherical-cartesian) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(command-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+edev | avia0 | pcloud(format=dual-cartesian) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(command-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+edev | avia0 | pcloud(format=dual-spherical) | livoxGen1-pcloud(data-rate-hz=10) | livoxProto1(command-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
```
**Stim-Buff-API**: `livoxGen1-pcloud`
@@ -67,7 +67,7 @@ Each stim-buff-api is designed to work with specific stim-iface libraries that u
**Syntax**:
```
+idev | avia0 | gyro | livoxGen1-gyro(data-rate-hz=100) | livoxProto1(handshake-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+idev | avia0 | gyro | livoxGen1-gyro(data-rate-hz=100) | livoxProto1(command-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
```
**Stim-Buff-API**: `livoxGen1-gyro`
@@ -79,7 +79,7 @@ Each stim-buff-api is designed to work with specific stim-iface libraries that u
**Syntax**:
```
+idev | avia0 | accel | livoxGen1-accel(data-rate-hz=100) | livoxProto1(handshake-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
+idev | avia0 | accel | livoxGen1-accel(data-rate-hz=100) | livoxProto1(command-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
```
**Stim-Buff-API**: `livoxGen1-accel`
@@ -91,10 +91,10 @@ Each stim-buff-api is designed to work with specific stim-iface libraries that u
The `livoxProto1` provider accepts the following parameters:
**handshake-timeout-ms** (optional):
- Specifies the timeout for handshake operations when connecting to devices
**command-timeout-ms** / **cmd-timeout-ms** (optional, synonyms):
- Specifies the timeout for command operations when communicating with devices
- Value: Integer number of milliseconds
- Example: `handshake-timeout-ms=1000` (1 second timeout)
- Example: `command-timeout-ms=1000` or `cmd-timeout-ms=1000` (1 second timeout)
- Default: 1000ms if not specified
**retry-delay-ms** (optional):
+11 -6
View File
@@ -554,9 +554,9 @@ extern "C" void livoxGen1_attachDeviceReq(
*/
/* The Livox Avia will generally respond to a handshake request within
* 50ms. So we set the handshake timeout to 300ms to be safe.
* 5ms.
*/
int handshakeTimeoutMs = 5; // Default: 5ms
int commandTimeoutMs = 5; // Default: 5ms
/* Based on testing on a Livox Avia, the device will generally resume
* sending broadcast advertisement dgrams after about 5 seconds at most.
* Generally, it will resume sending them within 1-2 seconds.
@@ -572,11 +572,16 @@ extern "C" void livoxGen1_attachDeviceReq(
// Parse optional integer parameters from provider params
for (const auto& param : desc->providerParams)
{
if (param.first == "handshake-timeout-ms")
if (param.first == "cmd-timeout-ms")
{
handshakeTimeoutMs = smo::device::DeviceAttachmentSpec
commandTimeoutMs = smo::device::DeviceAttachmentSpec
::parseRequiredParamAsInt(
desc->providerParams, "handshake-timeout-ms");
desc->providerParams, "cmd-timeout-ms");
} else if (param.first == "command-timeout-ms")
{
commandTimeoutMs = smo::device::DeviceAttachmentSpec
::parseRequiredParamAsInt(
desc->providerParams, "command-timeout-ms");
} else if (param.first == "retry-delay-ms")
{
retryDelayMs = smo::device::DeviceAttachmentSpec
@@ -630,7 +635,7 @@ extern "C" void livoxGen1_attachDeviceReq(
(*livoxProto1.livoxProto1_getOrCreateDeviceReq)(
desc->deviceSelector, // deviceIdentifier (broadcast code)
componentThread,
handshakeTimeoutMs, retryDelayMs,
commandTimeoutMs, retryDelayMs,
smoIp, smoSubnetNbits,
dataPort, cmdPort, imuPort,
{request, std::bind(