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
class
ClKeyboard
:
public
smacc2::ISmaccClient
33
{
34
public
:
35
ClKeyboard
();
36
virtual
~ClKeyboard
();
37
38
// Override the base class methods to call our setup
39
template
<
typename
TOrthogonal,
typename
TClient>
40
void
onComponentInitialization
()
41
42
// Clients utilize a composition based architecture for their components.
43
// In the function body below we create the components that will be used in this client.
44
45
{
46
// We start by creating a topic subscriber component from SMACC2s client core components.
47
// We use this to gain the topic funcionality interated with SMACC and the ability to post smacc events for transitions.
48
// We are using it to handle the reception of ros topic messages and to notify the other components in the client.
49
this->
createComponent
<
50
smacc2::client_core_components::CpTopicSubscriber<std_msgs::msg::UInt16>
, TOrthogonal,
51
ClKeyboard
>(
"/keyboard_unicode"
);
52
53
// This keyboard listener component requires CpTopicSubscriber.
54
// It is notified by the CpTopicSubscriber and processes the messages to decide which keyboard event must be posted and then posts it.
55
this->
createComponent<cl_keyboard::components::CpKeyboardListener1, TOrthogonal, ClKeyboard>
();
56
}
57
};
58
}
// namespace cl_keyboard
cl_keyboard::ClKeyboard
Definition
cl_keyboard.hpp:33
cl_keyboard::ClKeyboard::onComponentInitialization
void onComponentInitialization()
Definition
cl_keyboard.hpp:40
cl_keyboard::ClKeyboard::ClKeyboard
ClKeyboard()
cl_keyboard::ClKeyboard::~ClKeyboard
virtual ~ClKeyboard()
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_topic_subscriber.hpp
introspection.hpp
cp_keyboard_listener_1.hpp
cl_keyboard
Definition
cl_keyboard.hpp:31
smacc.hpp
Generated by
1.12.0