livox: rename handshakeTimeoutMs=>commandTimeoutMs
This commit is contained in:
@@ -129,7 +129,7 @@ public:
|
|||||||
void DeviceManager::getOrCreateDeviceReq(
|
void DeviceManager::getOrCreateDeviceReq(
|
||||||
const std::string &deviceIdentifier,
|
const std::string &deviceIdentifier,
|
||||||
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
||||||
int handshakeTimeoutMs, int retryDelayMs,
|
int commandTimeoutMs, int retryDelayMs,
|
||||||
const std::string& smoIp, uint8_t smoSubnetNbits,
|
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,
|
||||||
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback)
|
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
|
// Device doesn't exist, create a new one but don't add it to collection yet
|
||||||
auto newDevice = std::make_shared<Device>(
|
auto newDevice = std::make_shared<Device>(
|
||||||
deviceIdentifier, componentThread,
|
deviceIdentifier, componentThread,
|
||||||
handshakeTimeoutMs, retryDelayMs,
|
commandTimeoutMs, retryDelayMs,
|
||||||
smoIp, smoSubnetNbits,
|
smoIp, smoSubnetNbits,
|
||||||
dataPort, cmdPort, imuPort);
|
dataPort, cmdPort, imuPort);
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public:
|
|||||||
void getOrCreateDeviceReq(
|
void getOrCreateDeviceReq(
|
||||||
const std::string &deviceIdentifier,
|
const std::string &deviceIdentifier,
|
||||||
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
||||||
int handshakeTimeoutMs, int retryDelayMs,
|
int commandTimeoutMs, int retryDelayMs,
|
||||||
const std::string& smoIp, uint8_t smoSubnetNbits,
|
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,
|
||||||
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback);
|
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback);
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ std::string DiscoveredDevice::getDeviceTypeName(void) const
|
|||||||
|
|
||||||
Device::Device(const std::string &deviceIdentifier,
|
Device::Device(const std::string &deviceIdentifier,
|
||||||
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
||||||
int handshakeTimeoutMs, int retryDelayMs,
|
int commandTimeoutMs, int retryDelayMs,
|
||||||
const std::string& smoIp, uint8_t smoSubnetNbits,
|
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)
|
||||||
: discoveredDevice(
|
: discoveredDevice(
|
||||||
@@ -99,7 +99,7 @@ Device::Device(const std::string &deviceIdentifier,
|
|||||||
""),
|
""),
|
||||||
nAttachedStimBuffs(0),
|
nAttachedStimBuffs(0),
|
||||||
componentThread(componentThread),
|
componentThread(componentThread),
|
||||||
handshakeTimeoutMs(handshakeTimeoutMs), retryDelayMs(retryDelayMs),
|
commandTimeoutMs(commandTimeoutMs), retryDelayMs(retryDelayMs),
|
||||||
smoIp(smoIp), detectedSmoListeningIp(""), smoSubnetNbits(smoSubnetNbits),
|
smoIp(smoIp), detectedSmoListeningIp(""), smoSubnetNbits(smoSubnetNbits),
|
||||||
dataPort(dataPort), cmdPort(cmdPort), imuPort(imuPort),
|
dataPort(dataPort), cmdPort(cmdPort), imuPort(imuPort),
|
||||||
heartbeatActive(false),
|
heartbeatActive(false),
|
||||||
@@ -572,7 +572,7 @@ private:
|
|||||||
* we will consider the handshake to have failed.
|
* we will consider the handshake to have failed.
|
||||||
*/
|
*/
|
||||||
timeoutTimer.expires_from_now(
|
timeoutTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(device.handshakeTimeoutMs));
|
boost::posix_time::milliseconds(device.commandTimeoutMs));
|
||||||
|
|
||||||
timeoutTimer.async_wait(
|
timeoutTimer.async_wait(
|
||||||
std::bind(
|
std::bind(
|
||||||
@@ -651,7 +651,7 @@ private:
|
|||||||
if (finalTimerFired
|
if (finalTimerFired
|
||||||
&& finalSocketState == SocketState::SOCKET_STILL_WAITING)
|
&& finalSocketState == SocketState::SOCKET_STILL_WAITING)
|
||||||
{
|
{
|
||||||
std::cerr << __func__ << ": Handshake timeout with "
|
std::cerr << __func__ << ": Command timeout with "
|
||||||
<< deviceIP << "(" << device.discoveredDevice.deviceIdentifier
|
<< deviceIP << "(" << device.discoveredDevice.deviceIdentifier
|
||||||
<< ")" << std::endl;
|
<< ")" << std::endl;
|
||||||
|
|
||||||
@@ -1389,7 +1389,7 @@ protected:
|
|||||||
{
|
{
|
||||||
// Setup timeout timer
|
// Setup timeout timer
|
||||||
timeoutTimer.expires_from_now(
|
timeoutTimer.expires_from_now(
|
||||||
boost::posix_time::milliseconds(device.handshakeTimeoutMs));
|
boost::posix_time::milliseconds(device.commandTimeoutMs));
|
||||||
|
|
||||||
timeoutTimer.async_wait(
|
timeoutTimer.async_wait(
|
||||||
std::bind(
|
std::bind(
|
||||||
@@ -1998,7 +1998,7 @@ public:
|
|||||||
{
|
{
|
||||||
// Set up timeout timer
|
// Set up timeout timer
|
||||||
timeoutTimer.expires_from_now(boost::posix_time::milliseconds(
|
timeoutTimer.expires_from_now(boost::posix_time::milliseconds(
|
||||||
device.handshakeTimeoutMs));
|
device.commandTimeoutMs));
|
||||||
timeoutTimer.async_wait(
|
timeoutTimer.async_wait(
|
||||||
std::bind(&SetReturnModeReq::setReturnModeReq1_1,
|
std::bind(&SetReturnModeReq::setReturnModeReq1_1,
|
||||||
this, request,
|
this, request,
|
||||||
@@ -2245,7 +2245,7 @@ public:
|
|||||||
{
|
{
|
||||||
// Set up timeout timer
|
// Set up timeout timer
|
||||||
timeoutTimer.expires_from_now(boost::posix_time::milliseconds(
|
timeoutTimer.expires_from_now(boost::posix_time::milliseconds(
|
||||||
device.handshakeTimeoutMs));
|
device.commandTimeoutMs));
|
||||||
|
|
||||||
timeoutTimer.async_wait(
|
timeoutTimer.async_wait(
|
||||||
std::bind(&GetReturnModeReq::getReturnModeReq1_1,
|
std::bind(&GetReturnModeReq::getReturnModeReq1_1,
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ class Device
|
|||||||
public:
|
public:
|
||||||
Device(const std::string &deviceIdentifier,
|
Device(const std::string &deviceIdentifier,
|
||||||
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
||||||
int handshakeTimeoutMs, int retryDelayMs,
|
int commandTimeoutMs, int retryDelayMs,
|
||||||
const std::string& smoIp, uint8_t smoSubnetNbits,
|
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);
|
||||||
~Device();
|
~Device();
|
||||||
@@ -152,7 +152,7 @@ public:
|
|||||||
|
|
||||||
// Configuration
|
// Configuration
|
||||||
std::shared_ptr<smo::ComponentThread> componentThread;
|
std::shared_ptr<smo::ComponentThread> componentThread;
|
||||||
int handshakeTimeoutMs, retryDelayMs;
|
int commandTimeoutMs, retryDelayMs;
|
||||||
std::string smoIp;
|
std::string smoIp;
|
||||||
std::string detectedSmoListeningIp;
|
std::string detectedSmoListeningIp;
|
||||||
uint8_t smoSubnetNbits;
|
uint8_t smoSubnetNbits;
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ extern "C" {
|
|||||||
void livoxProto1_getOrCreateDeviceReq(
|
void livoxProto1_getOrCreateDeviceReq(
|
||||||
const std::string& deviceIdentifier,
|
const std::string& deviceIdentifier,
|
||||||
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
||||||
int handshakeTimeoutMs, int retryDelayMs,
|
int commandTimeoutMs, int retryDelayMs,
|
||||||
const std::string& smoIp, uint8_t smoSubnetNbits,
|
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,
|
||||||
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback
|
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback
|
||||||
@@ -28,7 +28,7 @@ void livoxProto1_getOrCreateDeviceReq(
|
|||||||
// Delegate to DeviceManager
|
// Delegate to DeviceManager
|
||||||
protoState.deviceManager->getOrCreateDeviceReq(
|
protoState.deviceManager->getOrCreateDeviceReq(
|
||||||
deviceIdentifier, componentThread,
|
deviceIdentifier, componentThread,
|
||||||
handshakeTimeoutMs, retryDelayMs,
|
commandTimeoutMs, retryDelayMs,
|
||||||
smoIp, smoSubnetNbits,
|
smoIp, smoSubnetNbits,
|
||||||
dataPort, cmdPort, imuPort,
|
dataPort, cmdPort, imuPort,
|
||||||
callback);
|
callback);
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ typedef void livoxProto1_exitFn(void);
|
|||||||
* Create a new Livox device connection
|
* Create a new Livox device connection
|
||||||
* @param deviceIdentifier The device identifier (broadcast code)
|
* @param deviceIdentifier The device identifier (broadcast code)
|
||||||
* @param componentThread Component thread for async operations
|
* @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 retryDelayMs Retry delay in milliseconds (default: 3000)
|
||||||
* @param smoIp SMO IP address (empty string for auto-detection)
|
* @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 smoSubnetNbits SMO subnet mask bits (e.g., 24 for /24, 16 for /16)
|
||||||
@@ -57,7 +57,7 @@ typedef std::function<
|
|||||||
typedef void livoxProto1_getOrCreateDeviceReqFn(
|
typedef void livoxProto1_getOrCreateDeviceReqFn(
|
||||||
const std::string& deviceIdentifier,
|
const std::string& deviceIdentifier,
|
||||||
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
const std::shared_ptr<smo::ComponentThread>& componentThread,
|
||||||
int handshakeTimeoutMs, int retryDelayMs,
|
int commandTimeoutMs, int retryDelayMs,
|
||||||
const std::string& smoIp, uint8_t smoSubnetNbits,
|
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,
|
||||||
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback);
|
smo::Callback<livoxProto1_getOrCreateDeviceReqCbFn> callback);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Each stim-buff-api is designed to work with specific stim-iface libraries that u
|
|||||||
|
|
||||||
**Syntax**:
|
**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`
|
**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**:
|
**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**:
|
**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) | 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(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(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(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(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(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(command-timeout-ms=1000,retry-delay-ms=3000,smo-ip=192.168.1.50,smo-subnet-nbits=24) | 3JEDK380010Z39
|
||||||
```
|
```
|
||||||
|
|
||||||
**Stim-Buff-API**: `livoxGen1-pcloud`
|
**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**:
|
**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`
|
**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**:
|
**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`
|
**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:
|
The `livoxProto1` provider accepts the following parameters:
|
||||||
|
|
||||||
**handshake-timeout-ms** (optional):
|
**command-timeout-ms** / **cmd-timeout-ms** (optional, synonyms):
|
||||||
- Specifies the timeout for handshake operations when connecting to devices
|
- Specifies the timeout for command operations when communicating with devices
|
||||||
- Value: Integer number of milliseconds
|
- 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
|
- Default: 1000ms if not specified
|
||||||
|
|
||||||
**retry-delay-ms** (optional):
|
**retry-delay-ms** (optional):
|
||||||
|
|||||||
@@ -554,9 +554,9 @@ extern "C" void livoxGen1_attachDeviceReq(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* The Livox Avia will generally respond to a handshake request within
|
/* 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
|
/* Based on testing on a Livox Avia, the device will generally resume
|
||||||
* sending broadcast advertisement dgrams after about 5 seconds at most.
|
* sending broadcast advertisement dgrams after about 5 seconds at most.
|
||||||
* Generally, it will resume sending them within 1-2 seconds.
|
* 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
|
// Parse optional integer parameters from provider params
|
||||||
for (const auto& param : desc->providerParams)
|
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(
|
::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")
|
} else if (param.first == "retry-delay-ms")
|
||||||
{
|
{
|
||||||
retryDelayMs = smo::device::DeviceAttachmentSpec
|
retryDelayMs = smo::device::DeviceAttachmentSpec
|
||||||
@@ -630,7 +635,7 @@ extern "C" void livoxGen1_attachDeviceReq(
|
|||||||
(*livoxProto1.livoxProto1_getOrCreateDeviceReq)(
|
(*livoxProto1.livoxProto1_getOrCreateDeviceReq)(
|
||||||
desc->deviceSelector, // deviceIdentifier (broadcast code)
|
desc->deviceSelector, // deviceIdentifier (broadcast code)
|
||||||
componentThread,
|
componentThread,
|
||||||
handshakeTimeoutMs, retryDelayMs,
|
commandTimeoutMs, retryDelayMs,
|
||||||
smoIp, smoSubnetNbits,
|
smoIp, smoSubnetNbits,
|
||||||
dataPort, cmdPort, imuPort,
|
dataPort, cmdPort, imuPort,
|
||||||
{request, std::bind(
|
{request, std::bind(
|
||||||
|
|||||||
Reference in New Issue
Block a user