SMACC2
Loading...
Searching...
No Matches
smacc2_client_library
keyboard_client
include
keyboard_client
cl_keyboard.hpp
Go to the documentation of this file.
1
// Copyright 2021 RobosoftAI Inc.
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#pragma once
16
17
#include <
keyboard_client/components/cp_keyboard_listener_1.hpp
>
18
19
#include <
smacc2/client_core_components/cp_topic_subscriber.hpp
>
20
21
#include <
smacc2/introspection/introspection.hpp
>
22
#include <
smacc2/smacc.hpp
>
23
24
#include <boost/asio.hpp>
25
#include <boost/asio/posix/stream_descriptor.hpp>
26
#include <iostream>
27
28
#include <std_msgs/msg/u_int16.hpp>
29
30
namespace
cl_keyboard
31
{
32
//------------------ KEYBOARD CLIENT ---------------------------------------------
33
34
class
ClKeyboard
:
public
smacc2::ISmaccClient
35
{
36
public
:
37
ClKeyboard
();
38
virtual
~ClKeyboard
();
39
40
// Override the base class methods to call our setup
41
template
<
typename
TOrthogonal,
typename
TClient>
42
void
onComponentInitialization
()
43
// clients utilizes a composition based architecture for their components
44
// here we define the list of components that this client will have in a component based architecture
45
{
46
// for listener we use dependency injection pattern where we reference the CpTopicSubscriber inside the smacc core
47
// this would be the basic subscription component to the topic
48
// we use this to gain the topic funcionality interated with SMACC and that post smacc events for transitions
49
// we are using it to handle ros topic messages reception and notifying other components in the client
50
this->
createComponent
<
51
smacc2::client_core_components::CpTopicSubscriber<std_msgs::msg::UInt16>
, TOrthogonal,
52
ClKeyboard
>(
"/keyboard_unicode"
);
53
54
// this keyboard subscriber component requires the first subscriber component
55
// it is notified by the CpTopicSubscriber and processes the messages to decide with keyboard event must be posted and then post it
56
this->
createComponent<cl_keyboard::components::CpKeyboardListener1, TOrthogonal, ClKeyboard>
();
57
}
58
};
59
}
// namespace cl_keyboard
cl_keyboard::ClKeyboard
Definition
cl_keyboard.hpp:35
cl_keyboard::ClKeyboard::onComponentInitialization
void onComponentInitialization()
Definition
cl_keyboard.hpp:42
cl_keyboard::ClKeyboard::ClKeyboard
ClKeyboard()
Definition
cl_keyboard.cpp:25
cl_keyboard::ClKeyboard::~ClKeyboard
virtual ~ClKeyboard()
Definition
cl_keyboard.cpp:27
smacc2::ISmaccClient
Definition
smacc_client.hpp:45
smacc2::ISmaccClient::createComponent
SmaccComponentType * createComponent(TArgs... targs)
Definition
smacc_client_impl.hpp:134
smacc2::client_core_components::CpTopicSubscriber
Definition
cp_topic_subscriber.hpp:35
cp_keyboard_listener_1.hpp
cp_topic_subscriber.hpp
introspection.hpp
cl_keyboard
Definition
cl_keyboard.hpp:31
smacc.hpp
Generated by
1.12.0