libs: Add smohook for getting cmdline opts

This commit is contained in:
2025-11-07 14:59:28 -04:00
parent a7a85b0c1f
commit b598ca8594
7 changed files with 34 additions and 15 deletions
+2 -1
View File
@@ -3,6 +3,7 @@
#include <opts.h>
#include <componentThread.h>
#include "broadcastListener.h"
#include "core.h"
namespace livoxProto1 {
namespace comms {
@@ -96,7 +97,7 @@ void BroadcastListener::broadcastMsgInd(
if (deviceExists(broadcastCode))
{
// Device already exists, just log the update
if (OptionParser::getOptions().verbose)
if (getProtoState().smoCallbacks.OptionParser_getOptions().verbose)
{
std::cout << __func__
<< ": Received broadcast from known device: "
+1 -1
View File
@@ -114,7 +114,7 @@ public:
// Connection successful, add device to collection
context->deviceManager.devices.push_back(context->pendingDevice);
if (OptionParser::getOptions().verbose)
if (getProtoState().smoCallbacks.OptionParser_getOptions().verbose)
{
std::cout << __func__ << ": Successfully connected and added device "
<< context->pendingDevice->discoveredDevice.deviceIdentifier
+6 -6
View File
@@ -150,7 +150,7 @@ public:
// Fail early - if handshake failed, try next method
if (!success)
{
if (OptionParser::getOptions().verbose)
if (getProtoState().smoCallbacks.OptionParser_getOptions().verbose)
{
std::cout << __func__ << ": Trying to connect to device by "
<< "identifier" << "\n";
@@ -222,7 +222,7 @@ void Device::connectReq(smo::Callback<Device::connectReqCbFn> callback)
auto request = std::make_shared<ConnectReq>(*this, std::move(callback));
// Try connecting to known device first
if (OptionParser::getOptions().verbose) {
if (getProtoState().smoCallbacks.OptionParser_getOptions().verbose) {
std::cout << __func__ << ": Trying to connect to known device" << "\n";
}
@@ -316,7 +316,7 @@ void Device::connectToKnownDeviceReq(
return;
}
if (OptionParser::getOptions().verbose)
if (getProtoState().smoCallbacks.OptionParser_getOptions().verbose)
{
std::cout << __func__ << ": Detected SMO listening IP for known device "
<< request->device.discoveredDevice.deviceIdentifier
@@ -402,7 +402,7 @@ void Device::connectByDeviceIdentifierReq(
// For heuristic construction, always use the provided smoIp.
request->device.detectedSmoListeningIp = request->device.smoIp;
if (OptionParser::getOptions().verbose)
if (getProtoState().smoCallbacks.OptionParser_getOptions().verbose)
{
std::cout << __func__ << ": About to try to connect to device by "
<< "identifier (" << discoveredDevice.deviceIdentifier << ")"
@@ -720,7 +720,7 @@ private:
return;
}
if (OptionParser::getOptions().verbose)
if (getProtoState().smoCallbacks.OptionParser_getOptions().verbose)
{
std::cout << __func__ << ": Handshake successful with "
<< deviceIP << "("
@@ -1512,7 +1512,7 @@ protected:
response->command.cmd_id == 0x04 &&
response->ret_code == 0x00))
{
if (OptionParser::getOptions().verbose)
if (getProtoState().smoCallbacks.OptionParser_getOptions().verbose)
{
std::cout << __func__ << ": Failed to en/disable pcloud data "
"for device "