SMACC2
Loading...
Searching...
No Matches
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
18
20
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
30namespace cl_keyboard
31{
32//------------------ KEYBOARD CLIENT ---------------------------------------------
33
35{
36public:
37 ClKeyboard();
38 virtual ~ClKeyboard();
39
40 // Override the base class methods to call our setup
41 template <typename TOrthogonal, typename TClient>
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<
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
57 }
58};
59} // namespace cl_keyboard
SmaccComponentType * createComponent(TArgs... targs)