Callback.cpp
Go to the documentation of this file.
1
2
#include "
Callback.h
"
3
4
#include "
RobotAPI/libraries/aron/core/data/variant/primitive/String.h
"
5
6
namespace
armarx::skills::provider
7
{
8
CallbackSkill::CallbackSkill
() :
SimpleSkill
(GetSkillDescription())
9
{
10
}
11
12
SkillDescription
13
CallbackSkill::GetSkillDescription
()
14
{
15
return
SkillDescription
{.
skillId
=
skills::SkillID
{.
skillName
=
"ShowMeCallbacks"
},
16
.description =
"This skill does shows callbacks"
,
17
.rootProfileDefaults =
armarx::aron::make_dict
(),
18
.timeout =
armarx::core::time::Duration::MilliSeconds
(1000)};
19
}
20
21
Skill::MainResult
22
CallbackSkill::main
(
const
MainInput& in)
23
{
24
ARMARX_IMPORTANT
<<
"Logging three updates via the callback"
;
25
auto
up1 = std::make_shared<aron::data::Dict>();
26
up1->addElement(
"updateInfo"
, std::make_shared<aron::data::String>(
"Update 1"
));
27
28
in.callback(
skills::SkillStatus::Running
, up1);
29
30
auto
up2 = std::make_shared<aron::data::Dict>();
31
up2->addElement(
"updateInfo"
, std::make_shared<aron::data::String>(
"Update 2"
));
32
in.callback(
skills::SkillStatus::Running
, up2);
33
34
auto
up3 = std::make_shared<aron::data::Dict>();
35
up3->addElement(
"updateInfo"
, std::make_shared<aron::data::String>(
"Update 3"
));
36
in.callback(
skills::SkillStatus::Running
, up3);
37
38
return
{
TerminatedSkillStatus::Succeeded
,
nullptr
};
39
}
40
}
// namespace armarx::skills::provider
armarx::skills::TerminatedSkillStatus::Succeeded
@ Succeeded
ARMARX_IMPORTANT
#define ARMARX_IMPORTANT
Definition:
Logging.h:190
armarx::aron::make_dict
aron::data::DictPtr make_dict(_Args &&... args)
Definition:
Dict.h:107
armarx::skills::SkillID::skillName
std::string skillName
Definition:
SkillID.h:41
armarx::skills::SkillDescription
Definition:
SkillDescription.h:17
Callback.h
armarx::skills::SkillDescription::skillId
SkillID skillId
Definition:
SkillDescription.h:19
armarx::skills::provider::CallbackSkill::GetSkillDescription
static SkillDescription GetSkillDescription()
Definition:
Callback.cpp:13
armarx::skills::provider
Definition:
BusyWaiting.cpp:6
armarx::skills::Skill::MainResult
A result struct for th main method of a skill.
Definition:
Skill.h:39
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:14
armarx::skills::provider::CallbackSkill::CallbackSkill
CallbackSkill()
Definition:
Callback.cpp:8
String.h
armarx::core::time::Duration::MilliSeconds
static Duration MilliSeconds(std::int64_t milliSeconds)
Constructs a duration in milliseconds.
Definition:
Duration.cpp:48
RobotAPI
components
skills
SkillProviderExample
Callback.cpp
Generated on Sat Mar 29 2025 09:17:26 for armarx_documentation by
1.8.17