trikRuntime
trikHardwareAbstraction.h
Go to the documentation of this file.
1 /* Copyright 2015 Yurii Litvinov and 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 
18 
19 #include <QtCore/QScopedPointer>
20 
21 namespace trikHal {
22 namespace trik {
23 
26 {
27 public:
29  ~TrikHardwareAbstraction() override;
30 
31  MspI2cInterface &mspI2c() override;
32  MspUsbInterface &mspUsb() override;
34 
35  EventFileInterface *createEventFile(const QString &fileName, QThread &thread) const override;
36  FifoInterface *createFifo(const QString &fileName) const override;
37  InputDeviceFileInterface *createInputDeviceFile(const QString &fileName) const override;
38  OutputDeviceFileInterface *createOutputDeviceFile(const QString &fileName) const override;
39  QVector<uint8_t> captureV4l2StillImage(const QString &port, const QString &pathToPic) const override;
40 
41 private:
43  QScopedPointer<MspI2cInterface> mI2c;
44 
46  QScopedPointer<MspUsbInterface> mUsb;
47 
49  QScopedPointer<SystemConsoleInterface> mSystemConsole;
50 };
51 
52 }
53 }
Communicates with MSP processor over I2C bus.
Definition: mspI2cInterface.h:22
Event file abstraction. Can be opened or closed, when opened can emit signal containing event data...
Definition: eventFileInterface.h:27
static const int port
Definition: trikCommunicatorTest.cpp:24
~TrikHardwareAbstraction() override
Definition: trikHardwareAbstraction.cpp:38
EventFileInterface * createEventFile(const QString &fileName, QThread &thread) const override
Creates new event file, passes ownership to a caller.
Definition: trikHardwareAbstraction.cpp:57
MspI2cInterface & mspI2c() override
Returns MSP I2C bus implementation.
Definition: trikHardwareAbstraction.cpp:42
Communicates with MSP processor over USB bus.
Definition: mspUsbInterface.h:22
Input device file abstraction. Can read from a device file, thus communicating with a device driver...
Definition: inputDeviceFileInterface.h:22
OutputDeviceFileInterface * createOutputDeviceFile(const QString &fileName) const override
Creates new output device file, passes ownership to a caller.
Definition: trikHardwareAbstraction.cpp:72
InputDeviceFileInterface * createInputDeviceFile(const QString &fileName) const override
Creates new input device file, passes ownership to a caller.
Definition: trikHardwareAbstraction.cpp:67
MspUsbInterface & mspUsb() override
Returns MSP USB bus implementation.
Definition: trikHardwareAbstraction.cpp:47
Output device file abstraction.
Definition: outputDeviceFileInterface.h:23
Hardware abstraction layer for a real robot.
Definition: trikHardwareAbstraction.h:25
QVector< uint8_t > captureV4l2StillImage(const QString &port, const QString &pathToPic) const override
Returns QVector with info about picture pixels.
Definition: trikHardwareAbstraction.cpp:77
FifoInterface * createFifo(const QString &fileName) const override
Creates new FIFO, passes ownership to a caller.
Definition: trikHardwareAbstraction.cpp:62
TrikHardwareAbstraction()
Definition: trikHardwareAbstraction.cpp:31
SystemConsoleInterface & systemConsole() override
Returns system console wrapper, able to execute system command and launch processes.
Definition: trikHardwareAbstraction.cpp:52
Definition: brickFactory.h:21
Abstraction of Linux FIFO used to receive events. To write to FIFO, use OutputDeviceFileInterface.
Definition: fifoInterface.h:23
Hardware abstraction, provides devices that are used to communicate with robot hardware or emulate it...
Definition: hardwareAbstractionInterface.h:29
Represents console of an OS.
Definition: systemConsoleInterface.h:22