trikRuntime
eventDeviceWorker.h
Go to the documentation of this file.
1 /* Copyright 2016 CyberTech Labs Ltd.
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 <QtCore/QObject>
18 #include <QtCore/QScopedPointer>
19 
21 
22 #include "deviceState.h"
23 
24 namespace trikControl {
25 
27 class EventDeviceWorker : public QObject
28 {
29  Q_OBJECT
30 
31 public:
36  EventDeviceWorker(const QString &deviceFilePath, DeviceState &state
37  , const trikHal::HardwareAbstractionInterface &hardwareAbstraction);
38 
39 signals:
45  void newEvent(int onEvent, int code, int value, int eventTime);
46 
47 private slots:
49  void onNewEvent(int eventType, int code, int value, const trikKernel::TimeVal &eventTime);
50 
51 private:
53  QScopedPointer<trikHal::EventFileInterface> mEventFile;
54 };
55 
56 }
TRIK через пункт меню Программирование добавлена индикация подключения Android геймпада TRIK с возможностью получать сырые события и фильтровать по типу и коду например pad onEvent(Events.Absolute).code(PadEventCodes.X).on.connect(...).-в частности
EventDeviceWorker(const QString &deviceFilePath, DeviceState &state, const trikHal::HardwareAbstractionInterface &hardwareAbstraction)
Constructor.
Definition: eventDeviceWorker.cpp:23
void newEvent(int onEvent, int code, int value, int eventTime)
Emitted when there is new event in an event file.
Worker for generic event device that uses HAL device file to listen to events. Meant to be run in sep...
Definition: eventDeviceWorker.h:27
Helper class to track device state (off, starting, ready, stopping, fail).
Definition: deviceState.h:26
Structure of a time value in a convenient format.
Definition: timeVal.h:20
Definition: trikCommunicator.h:27
Hardware abstraction, provides devices that are used to communicate with robot hardware or emulate it...
Definition: hardwareAbstractionInterface.h:29