From 037144a8424d5ae71a7778c4f1ee380e864d7640 Mon Sep 17 00:00:00 2001 From: Julian Tusch <urhrf@student.kit.edu> Date: Sun, 7 Apr 2024 19:52:06 +0200 Subject: [PATCH] split skillmanager into plugin and pluginuser, fixed errors --- .../libraries/skills/manager/CMakeLists.txt | 2 + .../manager/SkillManagerComponentPlugin.cpp | 265 ------------------ .../manager/SkillManagerComponentPlugin.h | 108 +------ .../SkillManagerComponentPluginUser.cpp | 262 +++++++++++++++++ .../manager/SkillManagerComponentPluginUser.h | 112 ++++++++ 5 files changed, 378 insertions(+), 371 deletions(-) create mode 100644 source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.cpp create mode 100644 source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.h diff --git a/source/RobotAPI/libraries/skills/manager/CMakeLists.txt b/source/RobotAPI/libraries/skills/manager/CMakeLists.txt index b45f4a929..7348013e3 100644 --- a/source/RobotAPI/libraries/skills/manager/CMakeLists.txt +++ b/source/RobotAPI/libraries/skills/manager/CMakeLists.txt @@ -17,8 +17,10 @@ armarx_add_library( SOURCES SkillManagerComponentPlugin.cpp + SkillManagerComponentPluginUser.cpp HEADERS SkillManagerComponentPlugin.h + SkillManagerComponentPluginUser.h ) add_library(RobotAPI::skills::manager ALIAS RobotAPISkillsManager) diff --git a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.cpp b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.cpp index da4772517..c6550db94 100644 --- a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.cpp +++ b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.cpp @@ -1,9 +1,7 @@ #include "SkillManagerComponentPlugin.h" -#include <any> #include <optional> #include <string> -#include <IceUtil/UUID.h> #include <ArmarXCore/core/Component.h> #include <ArmarXCore/core/time/DateTime.h> #include <ArmarXCore/core/time/ice_conversions.h> @@ -478,7 +476,6 @@ namespace armarx::plugins } //** Fluxio related methods - // TODO: trash std::vector<skills::FluxioSkill> SkillManagerComponentPlugin::getSkillList() @@ -523,7 +520,6 @@ namespace armarx::plugins } skills::FluxioSkill SkillManagerComponentPlugin::getSkill(const std::string& id){ - // TODO: take out the trash skills::FluxioSkill ret; return ret; } @@ -733,264 +729,3 @@ namespace armarx::plugins } } // namespace armarx::plugins - -namespace armarx -{ - SkillManagerComponentPluginUser::SkillManagerComponentPluginUser() - { - addPlugin(plugin); - } - - void - SkillManagerComponentPluginUser::addProvider(const skills::manager::dto::ProviderInfo& info, - const Ice::Current&) - { - auto i = skills::ProviderInfo::FromIce(info); - this->plugin->addProvider(i); - } - - void - SkillManagerComponentPluginUser::removeProvider( - const skills::manager::dto::ProviderID& provider, - const Ice::Current&) - { - auto i = skills::ProviderID::FromIce(provider); - this->plugin->removeProvider(i); - } - - skills::manager::dto::SkillStatusUpdate - SkillManagerComponentPluginUser::executeSkill( - const skills::manager::dto::SkillExecutionRequest& info, - const Ice::Current&) - { - auto e = skills::SkillExecutionRequest::FromIce(info); - return this->plugin->executeSkill(e).toManagerIce(); - } - - skills::manager::dto::SkillExecutionID - SkillManagerComponentPluginUser::executeSkillAsync( - const skills::manager::dto::SkillExecutionRequest& info, - const Ice::Current& current) - { - auto e = skills::SkillExecutionRequest::FromIce(info); - return this->plugin->executeSkillAsync(e).toManagerIce(); - } - - skills::provider::dto::ParameterUpdateResult - SkillManagerComponentPluginUser::updateSkillParameters( - const skills::manager::dto::SkillExecutionID& info, - const aron::data::dto::DictPtr& params, - const Ice::Current& current) - { - skills::provider::dto::ParameterUpdateResult ret; - auto a = armarx::aron::data::Dict::FromAronDictDTO(params); - auto e = skills::SkillExecutionID::FromIce(info); - ret.success = this->plugin->updateSkillParameters(e, a); - return ret; - } - - skills::provider::dto::AbortSkillResult - SkillManagerComponentPluginUser::abortSkill(const skills::manager::dto::SkillExecutionID& id, - const Ice::Current& current) - { - skills::provider::dto::AbortSkillResult ret; - auto i = skills::SkillExecutionID::FromIce(id); - ret.success = this->plugin->abortSkill(i); - return ret; - } - - skills::provider::dto::AbortSkillResult - SkillManagerComponentPluginUser::abortSkillAsync( - const skills::manager::dto::SkillExecutionID& id, - const Ice::Current& /*unused*/) - { - skills::provider::dto::AbortSkillResult ret; - auto i = skills::SkillExecutionID::FromIce(id); - ret.success = this->plugin->abortSkillAsync(i); - return ret; - } - - void - SkillManagerComponentPluginUser::updateStatusForSkill( - const skills::provider::dto::SkillStatusUpdate& statusUpdate, - const skills::callback::dto::ProviderID& pid, - const Ice::Current&) - { - (void)statusUpdate; - (void)pid; - // If you want to use the status, implement this method! - } - - skills::manager::dto::SkillDescriptionMap - SkillManagerComponentPluginUser::getSkillDescriptions(const Ice::Current& current) - { - skills::manager::dto::SkillDescriptionMap ret; - - auto m = this->plugin->getSkillDescriptions(); - - for (const auto& [k, v] : m) - { - ret.insert({k.toManagerIce(), v.toManagerIce()}); - } - - return ret; - } - - IceUtil::Optional<skills::manager::dto::SkillDescription> - SkillManagerComponentPluginUser::getSkillDescription(const skills::manager::dto::SkillID& id, - const Ice::Current& current) - { - auto e = skills::SkillID::FromIce(id); - auto o = this->plugin->getSkillDescription(e); - if (o.has_value()) - { - return o->toManagerIce(); - } - return {}; - } - - //** Fluxio related methods - - skills::manager::dto::FluxioSkillList - SkillManagerComponentPluginUser::getSkillList(const Ice::Current& current) - { - skills::manager::dto::FluxioSkillList ret; - - auto l = this->plugin->getSkillList(); - - for (const auto& s : l) - { - ret.push_back(s.toManagerIce()); - } - - return ret; - } - - skills::manager::dto::FluxioSkill - SkillManagerComponentPluginUser::getSkill(const std::string& id,const Ice::Current& current){ - return this->plugin->getSkill(id).toManagerIce(); - } - - void SkillManagerComponentPluginUser::updateSkill(const skills::manager::dto::FluxioSkill& skill,const Ice::Current& current){ - this->plugin->updateSkill(skills::FluxioSkill::FromIce(skill)); - } - - void SkillManagerComponentPluginUser::removeSkill(const std::string& id,const Ice::Current& current){ - this->plugin->removeSkill(id); - } - - bool SkillManagerComponentPluginUser::getSkillMutex(const std::string& skillId, const std::string& userId,const Ice::Current& current){ - return this->plugin->getSkillMutex(skillId, userId); - } - - void SkillManagerComponentPluginUser::deleteSkillMutex(const std::string& skillId, const std::string& userId,const Ice::Current& current){ - this->plugin->deleteSkillMutex(skillId, userId); - } - - void SkillManagerComponentPluginUser::removeSkillParameter(const std::string& skillId, const std::string& parameterId,const Ice::Current& current){ - this->plugin->removeSkillParameter(skillId, parameterId); - } - - skills::manager::dto::FluxioProfileList - SkillManagerComponentPluginUser::getProfileList(const Ice::Current& current){ - skills::manager::dto::FluxioProfileList ret; - - auto l = this->plugin->getProfileList(); - - for (const auto& s : l) - { - ret.push_back(s.toManagerIce()); - } - - return ret; - } - - IceUtil::Optional<skills::manager::dto::FluxioProfile> - SkillManagerComponentPluginUser::getProfile(const std::string& id,const Ice::Current& current){ - auto profile = this->plugin->getProfile(id); - - if (profile.has_value()) { - return profile->toManagerIce(); - } - return {}; - } - - skills::manager::dto::FluxioProfile SkillManagerComponentPluginUser::createProfile(skills::manager::dto::FluxioProfile profile,const Ice::Current& current){ - profile.id = IceUtil::generateUUID(); - this->plugin->createProfile(skills::FluxioProfile::FromIce(profile)); - return profile; - } - - void SkillManagerComponentPluginUser::updateProfile(skills::manager::dto::FluxioProfile profile,const Ice::Current& current){ - this->plugin->updateProfile(skills::FluxioProfile::FromIce(profile)); - } - - skills::manager::dto::FluxioProviderList - SkillManagerComponentPluginUser::getProviderList(const Ice::Current& current){ - skills::manager::dto::FluxioProviderList ret; - - auto l = this->plugin->getProviderList(); - - for (const auto& s : l) - { - ret.push_back(s.toManagerIce()); - } - - return ret; - } - - skills::manager::dto::FluxioProvider - SkillManagerComponentPluginUser::getProvider(const std::string& id,const Ice::Current& current){ - return this->plugin->getProvider(id).toManagerIce(); - } - - skills::manager::dto::FluxioSkillList - SkillManagerComponentPluginUser::getSkillsOfProvider(const std::string& id,const Ice::Current& current){ - skills::manager::dto::FluxioSkillList ret; - - auto l = this->plugin->getSkillsOfProvider(id); - - for (const auto& s : l) - { - ret.push_back(s.toManagerIce()); - } - - return ret; - } - - skills::manager::dto::FluxioSkill - SkillManagerComponentPluginUser::addSkillToProvider(const std::string& providerId,const skills::manager::dto::FluxioSkill& skill,const Ice::Current& current){ - return this->plugin->addSkillToProvider(providerId, skills::FluxioSkill::FromIce(skill)).toManagerIce(); - } - - //** end of Fluxio related methods - - IceUtil::Optional<skills::manager::dto::SkillStatusUpdate> - SkillManagerComponentPluginUser::getSkillExecutionStatus( - const skills::manager::dto::SkillExecutionID& executionId, - const Ice::Current& current) - { - auto e = skills::SkillExecutionID::FromIce(executionId); - auto o = this->plugin->getSkillExecutionStatus(e); - if (o.has_value()) - { - return o->toManagerIce(); - } - return {}; - } - - skills::manager::dto::SkillStatusUpdateMap - SkillManagerComponentPluginUser::getSkillExecutionStatuses(const Ice::Current& current) - { - skills::manager::dto::SkillStatusUpdateMap ret; - - auto m = this->plugin->getSkillExecutionStatuses(); - - for (const auto& [k, v] : m) - { - ret.insert({k.toManagerIce(), v.toManagerIce()}); - } - - return ret; - } -} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.h b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.h index b4fc10dd5..dce823d2f 100644 --- a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.h +++ b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPlugin.h @@ -1,12 +1,11 @@ #pragma once -#include <any> #include <mutex> -#include <list> #include <string> #include <ArmarXCore/core/ComponentPlugin.h> #include <ArmarXCore/core/ManagedIceObject.h> +#include "SkillManagerComponentPluginUser.h" #include <RobotAPI/interface/skills/SkillManagerInterface.h> #include <RobotAPI/libraries/skills/core/FluxioIdentificator.h> @@ -71,7 +70,7 @@ namespace armarx::plugins void removeSkill(const std::string& id); bool getSkillMutex(const std::string& skillId, const std::string& userId); - + void deleteSkillMutex(const std::string& skillId, const std::string& userId); void removeSkillParameter(const std::string& skillId, const std::string& parameterId); @@ -114,106 +113,3 @@ namespace armarx::plugins friend class armarx::SkillManagerComponentPluginUser; }; } // namespace armarx::plugins - -namespace armarx -{ - class SkillManagerComponentPluginUser : - virtual public ManagedIceObject, - virtual public skills::manager::dti::SkillManagerInterface - { - public: - SkillManagerComponentPluginUser(); - - void addProvider(const skills::manager::dto::ProviderInfo& providerInfo, - const Ice::Current& current) override; - void removeProvider(const skills::manager::dto::ProviderID& provider, - const Ice::Current& current) override; - - skills::manager::dto::SkillStatusUpdate - executeSkill(const skills::manager::dto::SkillExecutionRequest& info, - const Ice::Current& current) override; - - skills::manager::dto::SkillExecutionID - executeSkillAsync(const skills::manager::dto::SkillExecutionRequest& skillExecutionRequest, - const Ice::Current& current) override; - - skills::provider::dto::ParameterUpdateResult - updateSkillParameters(const skills::manager::dto::SkillExecutionID& executionId, - const aron::data::dto::DictPtr& params, - const Ice::Current& current) override; - - void updateStatusForSkill(const skills::provider::dto::SkillStatusUpdate& update, - const skills::callback::dto::ProviderID& id, - const Ice::Current& current) override; - - skills::provider::dto::AbortSkillResult - abortSkill(const skills::manager::dto::SkillExecutionID& id, - const Ice::Current& current) override; - - skills::provider::dto::AbortSkillResult - abortSkillAsync(const skills::manager::dto::SkillExecutionID& id, - const Ice::Current& current) override; - - - skills::manager::dto::SkillDescriptionMap - getSkillDescriptions(const Ice::Current& current) override; - - IceUtil::Optional<skills::manager::dto::SkillDescription> - getSkillDescription(const skills::manager::dto::SkillID& id, - const Ice::Current& current) override; - - - //** Fluxio related methods - - skills::manager::dto::FluxioSkillList - getSkillList(const Ice::Current& current) override; - - skills::manager::dto::FluxioSkill - getSkill(const std::string& id,const Ice::Current& current) override; - - void updateSkill(const skills::manager::dto::FluxioSkill& skill,const Ice::Current& current) override; - - void removeSkill(const std::string& id,const Ice::Current& current) override; - - bool getSkillMutex(const std::string& skillId, const std::string& userId,const Ice::Current& current) override; - - void deleteSkillMutex(const std::string& skillId, const std::string& userId,const Ice::Current& current) override; - - void removeSkillParameter(const std::string& skillId, const std::string& parameterId,const Ice::Current& current) override; - - skills::manager::dto::FluxioProfileList - getProfileList(const Ice::Current& current) override; - - IceUtil::Optional<skills::manager::dto::FluxioProfile> - getProfile(const std::string& id,const Ice::Current& current) override; - - skills::manager::dto::FluxioProfile - createProfile(skills::manager::dto::FluxioProfile profile,const Ice::Current& current) override; - - void updateProfile(skills::manager::dto::FluxioProfile profile,const Ice::Current& current) override; - - skills::manager::dto::FluxioProviderList - getProviderList(const Ice::Current& current) override; - - skills::manager::dto::FluxioProvider - getProvider(const std::string& id,const Ice::Current& current) override; - - skills::manager::dto::FluxioSkillList - getSkillsOfProvider(const std::string& id,const Ice::Current& current) override; - - skills::manager::dto::FluxioSkill - addSkillToProvider(const std::string& providerId,const skills::manager::dto::FluxioSkill& skill,const Ice::Current& current) override; - - //** end of Fluxio related methods - - IceUtil::Optional<skills::manager::dto::SkillStatusUpdate> - getSkillExecutionStatus(const skills::manager::dto::SkillExecutionID& executionId, - const Ice::Current& current) override; - - skills::manager::dto::SkillStatusUpdateMap - getSkillExecutionStatuses(const Ice::Current& current) override; - - private: - armarx::plugins::SkillManagerComponentPlugin* plugin = nullptr; - }; -} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.cpp b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.cpp new file mode 100644 index 000000000..0a11040af --- /dev/null +++ b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.cpp @@ -0,0 +1,262 @@ +#include "SkillManagerComponentPluginUser.h" + +namespace armarx +{ + SkillManagerComponentPluginUser::SkillManagerComponentPluginUser() + { + addPlugin(plugin); + } + + void + SkillManagerComponentPluginUser::addProvider(const skills::manager::dto::ProviderInfo& info, + const Ice::Current&) + { + auto i = skills::ProviderInfo::FromIce(info); + this->plugin->addProvider(i); + } + + void + SkillManagerComponentPluginUser::removeProvider( + const skills::manager::dto::ProviderID& provider, + const Ice::Current&) + { + auto i = skills::ProviderID::FromIce(provider); + this->plugin->removeProvider(i); + } + + skills::manager::dto::SkillStatusUpdate + SkillManagerComponentPluginUser::executeSkill( + const skills::manager::dto::SkillExecutionRequest& info, + const Ice::Current&) + { + auto e = skills::SkillExecutionRequest::FromIce(info); + return this->plugin->executeSkill(e).toManagerIce(); + } + + skills::manager::dto::SkillExecutionID + SkillManagerComponentPluginUser::executeSkillAsync( + const skills::manager::dto::SkillExecutionRequest& info, + const Ice::Current& current) + { + auto e = skills::SkillExecutionRequest::FromIce(info); + return this->plugin->executeSkillAsync(e).toManagerIce(); + } + + skills::provider::dto::ParameterUpdateResult + SkillManagerComponentPluginUser::updateSkillParameters( + const skills::manager::dto::SkillExecutionID& info, + const aron::data::dto::DictPtr& params, + const Ice::Current& current) + { + skills::provider::dto::ParameterUpdateResult ret; + auto a = armarx::aron::data::Dict::FromAronDictDTO(params); + auto e = skills::SkillExecutionID::FromIce(info); + ret.success = this->plugin->updateSkillParameters(e, a); + return ret; + } + + skills::provider::dto::AbortSkillResult + SkillManagerComponentPluginUser::abortSkill(const skills::manager::dto::SkillExecutionID& id, + const Ice::Current& current) + { + skills::provider::dto::AbortSkillResult ret; + auto i = skills::SkillExecutionID::FromIce(id); + ret.success = this->plugin->abortSkill(i); + return ret; + } + + skills::provider::dto::AbortSkillResult + SkillManagerComponentPluginUser::abortSkillAsync( + const skills::manager::dto::SkillExecutionID& id, + const Ice::Current& /*unused*/) + { + skills::provider::dto::AbortSkillResult ret; + auto i = skills::SkillExecutionID::FromIce(id); + ret.success = this->plugin->abortSkillAsync(i); + return ret; + } + + void + SkillManagerComponentPluginUser::updateStatusForSkill( + const skills::provider::dto::SkillStatusUpdate& statusUpdate, + const skills::callback::dto::ProviderID& pid, + const Ice::Current&) + { + (void)statusUpdate; + (void)pid; + // If you want to use the status, implement this method! + } + + skills::manager::dto::SkillDescriptionMap + SkillManagerComponentPluginUser::getSkillDescriptions(const Ice::Current& current) + { + skills::manager::dto::SkillDescriptionMap ret; + + auto m = this->plugin->getSkillDescriptions(); + + for (const auto& [k, v] : m) + { + ret.insert({k.toManagerIce(), v.toManagerIce()}); + } + + return ret; + } + + IceUtil::Optional<skills::manager::dto::SkillDescription> + SkillManagerComponentPluginUser::getSkillDescription(const skills::manager::dto::SkillID& id, + const Ice::Current& current) + { + auto e = skills::SkillID::FromIce(id); + auto o = this->plugin->getSkillDescription(e); + if (o.has_value()) + { + return o->toManagerIce(); + } + return {}; + } + + //** Fluxio related methods + + skills::manager::dto::FluxioSkillList + SkillManagerComponentPluginUser::getSkillList(const Ice::Current& current) + { + skills::manager::dto::FluxioSkillList ret; + + auto l = this->plugin->getSkillList(); + + for (const auto& s : l) + { + ret.push_back(s.toManagerIce()); + } + + return ret; + } + + skills::manager::dto::FluxioSkill + SkillManagerComponentPluginUser::getSkill(const std::string& id,const Ice::Current& current){ + return this->plugin->getSkill(id).toManagerIce(); + } + + void SkillManagerComponentPluginUser::updateSkill(const skills::manager::dto::FluxioSkill& skill,const Ice::Current& current){ + this->plugin->updateSkill(skills::FluxioSkill::FromIce(skill)); + } + + void SkillManagerComponentPluginUser::removeSkill(const std::string& id,const Ice::Current& current){ + this->plugin->removeSkill(id); + } + + bool SkillManagerComponentPluginUser::getSkillMutex(const std::string& skillId, const std::string& userId,const Ice::Current& current){ + return this->plugin->getSkillMutex(skillId, userId); + } + + void SkillManagerComponentPluginUser::deleteSkillMutex(const std::string& skillId, const std::string& userId,const Ice::Current& current){ + this->plugin->deleteSkillMutex(skillId, userId); + } + + void SkillManagerComponentPluginUser::removeSkillParameter(const std::string& skillId, const std::string& parameterId,const Ice::Current& current){ + this->plugin->removeSkillParameter(skillId, parameterId); + } + + skills::manager::dto::FluxioProfileList + SkillManagerComponentPluginUser::getProfileList(const Ice::Current& current){ + skills::manager::dto::FluxioProfileList ret; + + auto l = this->plugin->getProfileList(); + + for (const auto& s : l) + { + ret.push_back(s.toManagerIce()); + } + + return ret; + } + + IceUtil::Optional<skills::manager::dto::FluxioProfile> + SkillManagerComponentPluginUser::getProfile(const std::string& id,const Ice::Current& current){ + auto profile = this->plugin->getProfile(id); + + if (profile.has_value()) { + return profile->toManagerIce(); + } + return {}; + } + + skills::manager::dto::FluxioProfile SkillManagerComponentPluginUser::createProfile(const skills::manager::dto::FluxioProfile& profile,const Ice::Current& current){ + profile.id = IceUtil::generateUUID(); + this->plugin->createProfile(skills::FluxioProfile::FromIce(profile)); + return profile; + } + + void SkillManagerComponentPluginUser::updateProfile(const skills::manager::dto::FluxioProfile& profile,const Ice::Current& current){ + this->plugin->updateProfile(skills::FluxioProfile::FromIce(profile)); + } + + skills::manager::dto::FluxioProviderList + SkillManagerComponentPluginUser::getProviderList(const Ice::Current& current){ + skills::manager::dto::FluxioProviderList ret; + + auto l = this->plugin->getProviderList(); + + for (const auto& s : l) + { + ret.push_back(s.toManagerIce()); + } + + return ret; + } + + skills::manager::dto::FluxioProvider + SkillManagerComponentPluginUser::getProvider(const std::string& id,const Ice::Current& current){ + return this->plugin->getProvider(id).toManagerIce(); + } + + skills::manager::dto::FluxioSkillList + SkillManagerComponentPluginUser::getSkillsOfProvider(const std::string& id,const Ice::Current& current){ + skills::manager::dto::FluxioSkillList ret; + + auto l = this->plugin->getSkillsOfProvider(id); + + for (const auto& s : l) + { + ret.push_back(s.toManagerIce()); + } + + return ret; + } + + skills::manager::dto::FluxioSkill + SkillManagerComponentPluginUser::addSkillToProvider(const std::string& providerId,const skills::manager::dto::FluxioSkill& skill,const Ice::Current& current){ + return this->plugin->addSkillToProvider(providerId, skills::FluxioSkill::FromIce(skill)).toManagerIce(); + } + + //** end of Fluxio related methods + + IceUtil::Optional<skills::manager::dto::SkillStatusUpdate> + SkillManagerComponentPluginUser::getSkillExecutionStatus( + const skills::manager::dto::SkillExecutionID& executionId, + const Ice::Current& current) + { + auto e = skills::SkillExecutionID::FromIce(executionId); + auto o = this->plugin->getSkillExecutionStatus(e); + if (o.has_value()) + { + return o->toManagerIce(); + } + return {}; + } + + skills::manager::dto::SkillStatusUpdateMap + SkillManagerComponentPluginUser::getSkillExecutionStatuses(const Ice::Current& current) + { + skills::manager::dto::SkillStatusUpdateMap ret; + + auto m = this->plugin->getSkillExecutionStatuses(); + + for (const auto& [k, v] : m) + { + ret.insert({k.toManagerIce(), v.toManagerIce()}); + } + + return ret; + } +} // namespace armarx diff --git a/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.h b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.h new file mode 100644 index 000000000..69dda5b63 --- /dev/null +++ b/source/RobotAPI/libraries/skills/manager/SkillManagerComponentPluginUser.h @@ -0,0 +1,112 @@ +#pragma once + +#include "SkillManagerComponentPlugin.h" +#include <RobotAPI/interface/skills/SkillManagerInterface.h> + +namespace armarx::plugins +{ + class SkillManagerComponentPlugin; // forward declaration +} + +namespace armarx +{ + class SkillManagerComponentPluginUser : + virtual public ManagedIceObject, + virtual public skills::manager::dti::SkillManagerInterface + { + public: + SkillManagerComponentPluginUser(); + + void addProvider(const skills::manager::dto::ProviderInfo& providerInfo, + const Ice::Current& current) override; + void removeProvider(const skills::manager::dto::ProviderID& provider, + const Ice::Current& current) override; + + skills::manager::dto::SkillStatusUpdate + executeSkill(const skills::manager::dto::SkillExecutionRequest& info, + const Ice::Current& current) override; + + skills::manager::dto::SkillExecutionID + executeSkillAsync(const skills::manager::dto::SkillExecutionRequest& skillExecutionRequest, + const Ice::Current& current) override; + + skills::provider::dto::ParameterUpdateResult + updateSkillParameters(const skills::manager::dto::SkillExecutionID& executionId, + const aron::data::dto::DictPtr& params, + const Ice::Current& current) override; + + void updateStatusForSkill(const skills::provider::dto::SkillStatusUpdate& update, + const skills::callback::dto::ProviderID& id, + const Ice::Current& current) override; + + skills::provider::dto::AbortSkillResult + abortSkill(const skills::manager::dto::SkillExecutionID& id, + const Ice::Current& current) override; + + skills::provider::dto::AbortSkillResult + abortSkillAsync(const skills::manager::dto::SkillExecutionID& id, + const Ice::Current& current) override; + + + skills::manager::dto::SkillDescriptionMap + getSkillDescriptions(const Ice::Current& current) override; + + IceUtil::Optional<skills::manager::dto::SkillDescription> + getSkillDescription(const skills::manager::dto::SkillID& id, + const Ice::Current& current) override; + + + //** Fluxio related methods + + skills::manager::dto::FluxioSkillList + getSkillList(const Ice::Current& current) override; + + skills::manager::dto::FluxioSkill + getSkill(const std::string& id,const Ice::Current& current) override; + + void updateSkill(const skills::manager::dto::FluxioSkill& skill,const Ice::Current& current) override; + + void removeSkill(const std::string& id,const Ice::Current& current) override; + + bool getSkillMutex(const std::string& skillId, const std::string& userId,const Ice::Current& current) override; + + void deleteSkillMutex(const std::string& skillId, const std::string& userId,const Ice::Current& current) override; + + void removeSkillParameter(const std::string& skillId, const std::string& parameterId,const Ice::Current& current) override; + + skills::manager::dto::FluxioProfileList + getProfileList(const Ice::Current& current) override; + + IceUtil::Optional<skills::manager::dto::FluxioProfile> + getProfile(const std::string& id,const Ice::Current& current) override; + + skills::manager::dto::FluxioProfile + createProfile(const skills::manager::dto::FluxioProfile& profile,const Ice::Current& current) override; + + void updateProfile(const skills::manager::dto::FluxioProfile& profile,const Ice::Current& current) override; + + skills::manager::dto::FluxioProviderList + getProviderList(const Ice::Current& current) override; + + skills::manager::dto::FluxioProvider + getProvider(const std::string& id,const Ice::Current& current) override; + + skills::manager::dto::FluxioSkillList + getSkillsOfProvider(const std::string& id,const Ice::Current& current) override; + + skills::manager::dto::FluxioSkill + addSkillToProvider(const std::string& providerId,const skills::manager::dto::FluxioSkill& skill,const Ice::Current& current) override; + + //** end of Fluxio related methods + + IceUtil::Optional<skills::manager::dto::SkillStatusUpdate> + getSkillExecutionStatus(const skills::manager::dto::SkillExecutionID& executionId, + const Ice::Current& current) override; + + skills::manager::dto::SkillStatusUpdateMap + getSkillExecutionStatuses(const Ice::Current& current) override; + + private: + armarx::plugins::SkillManagerComponentPlugin* plugin = nullptr; + }; +} // namespace armarx -- GitLab