diff --git a/src/DUNE/Control/BasicRemoteOperation.cpp b/src/DUNE/Control/BasicRemoteOperation.cpp index 837e0c9154..faad270840 100644 --- a/src/DUNE/Control/BasicRemoteOperation.cpp +++ b/src/DUNE/Control/BasicRemoteOperation.cpp @@ -66,7 +66,7 @@ namespace DUNE param("Additional Actions", m_additional_actions) .defaultValue("") - .description("Actions to be added to Remote Actions List"); + .description("Actions to be added to remote actions list (comma separated in the form Action:Type)"); m_actions.op = IMC::RemoteActionsRequest::OP_REPORT; @@ -148,21 +148,24 @@ namespace DUNE } void - BasicRemoteOperation::onResourceInitialization(void) + BasicRemoteOperation::setupAdditionalActions(const std::vector& additional_actions) { - std::vector> lst; - Utils::String::splitMulti(m_additional_actions, ",", "=", lst); - std::vector>::iterator it; - for (it = lst.begin(); it != lst.end(); ++it) + for (unsigned int i = 0; i < additional_actions.size(); ++i) { - if (it->size() != 2) continue; + if (Utils::String::ltrim(additional_actions[i]).size() < 3) + continue; + + std::vector parts; + Utils::String::split(additional_actions[i], ":", parts); - std::string action_name = it->at(0); + if (parts.size() != 2) continue; + + std::string action_name = parts[0]; action_name = Utils::String::ltrim(action_name); action_name = Utils::String::rtrim(action_name); if (action_name.empty()) continue; - std::string type_lowercase = it->at(1); + std::string type_lowercase = parts[1]; type_lowercase = Utils::String::ltrim(type_lowercase); type_lowercase = Utils::String::rtrim(type_lowercase); Utils::String::toLowerCase(type_lowercase); @@ -184,7 +187,12 @@ namespace DUNE addActionHalfSlider(action_name); } } + } + void + BasicRemoteOperation::onResourceInitialization(void) + { + setupAdditionalActions(m_additional_actions); setEntityState(IMC::EntityState::ESTA_NORMAL, Status::CODE_IDLE); } diff --git a/src/DUNE/Control/BasicRemoteOperation.hpp b/src/DUNE/Control/BasicRemoteOperation.hpp index c90ed9b092..ffc2f5dfc7 100644 --- a/src/DUNE/Control/BasicRemoteOperation.hpp +++ b/src/DUNE/Control/BasicRemoteOperation.hpp @@ -103,6 +103,9 @@ namespace DUNE (void)message; } + void + setupAdditionalActions(const std::vector& additional_actions); + virtual void onConnectionTimeout(void) { } @@ -159,7 +162,7 @@ namespace DUNE //! Control loops last reference uint32_t m_scope_ref; //! Additional Remote Operation Actions - std::string m_additional_actions; + std::vector m_additional_actions; //! IMC ID of the teleoperation source uint16_t m_teleop_src;