Callback.cpp
Go to the documentation of this file.
1 
2 #include "Callback.h"
3 
5 {
6  CallbackSkill::CallbackSkill() : SimpleSkill(GetSkillDescription())
7  {
8  }
9 
12  {
13  return SkillDescription{.skillId = skills::SkillID{.skillName = "ShowMeCallbacks"},
14  .description = "This skill does shows callbacks",
16  }
17 
19  CallbackSkill::main(const MainInput& in)
20  {
21  ARMARX_IMPORTANT << "Logging three updates via the callback";
22  auto up1 = std::make_shared<aron::data::Dict>();
23  up1->addElement("updateInfo", std::make_shared<aron::data::String>("Update 1"));
24 
25  in.callback(skills::SkillStatus::Running, up1);
26 
27  auto up2 = std::make_shared<aron::data::Dict>();
28  up2->addElement("updateInfo", std::make_shared<aron::data::String>("Update 2"));
29  in.callback(skills::SkillStatus::Running, up2);
30 
31  auto up3 = std::make_shared<aron::data::Dict>();
32  up3->addElement("updateInfo", std::make_shared<aron::data::String>("Update 3"));
33  in.callback(skills::SkillStatus::Running, up3);
34 
35  return {TerminatedSkillStatus::Succeeded, nullptr};
36  }
37 } // namespace armarx::skills::provider
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition: Logging.h:183
armarx::skills::SkillID::skillName
std::string skillName
Definition: SkillID.h:60
armarx::skills::SkillDescription
Definition: SkillDescription.h:18
Callback.h
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition: SkillDescription.h:20
armarx::skills::provider::CallbackSkill::GetSkillDescription
static SkillDescription GetSkillDescription()
Definition: Callback.cpp:11
armarx::skills::provider
Definition: BusyWaiting.cpp:6
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition: Skill.h:48
armarx::skills::SimpleSkill
Definition: SimpleSkill.h:9
armarx::skills::SimpleSkill::main
MainResult main() final
Override this method with the actual implementation. The callback is for status updates to the callin...
Definition: SimpleSkill.cpp:15
armarx::skills::SkillStatus::Running
@ Running
armarx::skills::SkillID
Definition: SkillID.h:17
armarx::skills::provider::CallbackSkill::CallbackSkill
CallbackSkill()
Definition: Callback.cpp:6
armarx::core::time::Duration::MilliSeconds
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition: Duration.cpp:55