trikRuntime
stubHardwareAbstraction.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 stub {
23 
26 {
27 public:
29  ~StubHardwareAbstraction() 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:
42  QScopedPointer<MspI2cInterface> mMspI2cBus;
43  QScopedPointer<MspUsbInterface> mMspUsbBus;
44  QScopedPointer<SystemConsoleInterface> mSystemConsole;
45 };
46 
47 }
48 }
QVector< uint8_t > captureV4l2StillImage(const QString &port, const QString &pathToPic) const override
Returns QVector with info about picture pixels.
Definition: stubHardwareAbstraction.cpp:77
InputDeviceFileInterface * createInputDeviceFile(const QString &fileName) const override
Creates new input device file, passes ownership to a caller.
Definition: stubHardwareAbstraction.cpp:67
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
Communicates with MSP processor over USB bus.
Definition: mspUsbInterface.h:22
Hardware abstraction for use without real robot.
Definition: stubHardwareAbstraction.h:25
Input device file abstraction. Can read from a device file, thus communicating with a device driver...
Definition: inputDeviceFileInterface.h:22
MspUsbInterface & mspUsb() override
Returns MSP USB bus implementation.
Definition: stubHardwareAbstraction.cpp:46
FifoInterface * createFifo(const QString &fileName) const override
Creates new FIFO, passes ownership to a caller.
Definition: stubHardwareAbstraction.cpp:62
OutputDeviceFileInterface * createOutputDeviceFile(const QString &fileName) const override
Creates new output device file, passes ownership to a caller.
Definition: stubHardwareAbstraction.cpp:72
StubHardwareAbstraction()
Definition: stubHardwareAbstraction.cpp:30
Output device file abstraction.
Definition: outputDeviceFileInterface.h:23
EventFileInterface * createEventFile(const QString &fileName, QThread &thread) const override
Creates new event file, passes ownership to a caller.
Definition: stubHardwareAbstraction.cpp:56
SystemConsoleInterface & systemConsole() override
Returns system console wrapper, able to execute system command and launch processes.
Definition: stubHardwareAbstraction.cpp:51
MspI2cInterface & mspI2c() override
Returns MSP I2C bus implementation.
Definition: stubHardwareAbstraction.cpp:41
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
~StubHardwareAbstraction() override
Definition: stubHardwareAbstraction.cpp:37
Represents console of an OS.
Definition: systemConsoleInterface.h:22