LivoxProto1: Device: misc logging, cleanup, bugfix
This commit is contained in:
@@ -233,6 +233,16 @@ public:
|
|||||||
bool success
|
bool success
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
if (!success)
|
||||||
|
{
|
||||||
|
std::cerr << __func__ << ": Failed to enable point cloud data for "
|
||||||
|
"device (" << context->device.discoveredDevice.deviceIdentifier
|
||||||
|
<< ") @(" << context->device.discoveredDevice.ipAddr << ").\n";
|
||||||
|
|
||||||
|
context->callOriginalCb(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
context->callOriginalCb(success);
|
context->callOriginalCb(success);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1697,7 +1707,8 @@ void Device::enablePcloudDataReq(
|
|||||||
{
|
{
|
||||||
std::cerr << __func__ << ": Failed to set up point cloud data socket"
|
std::cerr << __func__ << ": Failed to set up point cloud data socket"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
// Don't fail the command, but log the issue
|
request->callOriginalCallbackWithFailure();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send the start sampling command
|
// Send the start sampling command
|
||||||
@@ -1753,7 +1764,7 @@ bool Device::setupPcloudDataSocket()
|
|||||||
int fd;
|
int fd;
|
||||||
SocketRAII(int socketFd) : fd(socketFd) {}
|
SocketRAII(int socketFd) : fd(socketFd) {}
|
||||||
~SocketRAII() { if (fd >= 0) close(fd); }
|
~SocketRAII() { if (fd >= 0) close(fd); }
|
||||||
void commit() { fd = -1; } // Transfer ownership, prevent close
|
void release() { fd = -1; } // Release ownership, prevent close
|
||||||
int getFd() const { return fd; }
|
int getFd() const { return fd; }
|
||||||
bool isValid() const { return fd >= 0; }
|
bool isValid() const { return fd >= 0; }
|
||||||
};
|
};
|
||||||
@@ -1799,8 +1810,7 @@ bool Device::setupPcloudDataSocket()
|
|||||||
componentThread->getIoService(), socketGuard.getFd());
|
componentThread->getIoService(), socketGuard.getFd());
|
||||||
|
|
||||||
pcloudDataFd = socketGuard.getFd();
|
pcloudDataFd = socketGuard.getFd();
|
||||||
// Transfer ownership, prevent auto-close
|
socketGuard.release();
|
||||||
socketGuard.commit();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user