trikRuntime
eventDevice.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/QSharedPointer>
18 #include <QThread>
19 
20 #include "eventDeviceInterface.h"
21 #include "deviceState.h"
22 
23 namespace trikHal {
24 class HardwareAbstractionInterface;
25 }
26 
27 namespace trikControl {
28 
29 class EventDeviceWorker;
30 
33 {
34  Q_OBJECT
35 
36 public:
40  EventDevice(const QString &eventFile, const trikHal::HardwareAbstractionInterface &hardwareAbstraction);
41 
42  ~EventDevice() override;
43 
44  EventInterface *onEvent(int eventType) override;
45 
46  Status status() const override;
47 
48 private:
50  QScopedPointer<EventDeviceWorker> mWorker;
51 
53  QThread mWorkerThread;
54 
56  DeviceState mState;
57 
60  QHash<int, QSharedPointer<EventInterface>> mEvents;
61 };
62 
63 }
TRIK через пункт меню Программирование добавлена индикация подключения Android геймпада TRIK с возможностью получать сырые события и фильтровать по типу и коду например pad onEvent(Events.Absolute).code(PadEventCodes.X).on.connect(...).-в частности
Helper class to track device state (off, starting, ready, stopping, fail).
Definition: deviceState.h:26
Implementation of generic event device that uses HAL device file to provide events.
Definition: eventDevice.h:32
Generic event device.
Definition: eventDeviceInterface.h:27
Represents event that can be produced by event device.
Definition: eventInterface.h:27
Status
Device status.
Definition: deviceInterface.h:33
Definition: trikCommunicator.h:27
Definition: brickFactory.h:21
Hardware abstraction, provides devices that are used to communicate with robot hardware or emulate it...
Definition: hardwareAbstractionInterface.h:29