trikRuntime
hardwareAbstractionInterface.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 
17 #include "QtCore/QVector"
20 #include "eventFileInterface.h"
21 #include "fifoInterface.h"
22 #include "mspI2cInterface.h"
23 #include "mspUsbInterface.h"
24 #include "systemConsoleInterface.h"
25 
26 namespace trikHal {
27 
30 {
31  Q_DISABLE_COPY(HardwareAbstractionInterface)
32 public:
33  HardwareAbstractionInterface() = default;
34 
35  virtual ~HardwareAbstractionInterface() = default;
36 
38  virtual MspI2cInterface &mspI2c() = 0;
39 
41  virtual MspUsbInterface &mspUsb() = 0;
42 
45 
49  virtual EventFileInterface *createEventFile(const QString &fileName, QThread &thread) const = 0;
50 
53  virtual FifoInterface *createFifo(const QString &fileName) const = 0;
54 
57  virtual InputDeviceFileInterface *createInputDeviceFile(const QString &fileName) const = 0;
58 
61  virtual OutputDeviceFileInterface *createOutputDeviceFile(const QString &fileName) const = 0;
62 
66  virtual QVector<uint8_t> captureV4l2StillImage(const QString &port, const QString &pathToPic) const = 0;
67 };
68 
69 }
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
virtual FifoInterface * createFifo(const QString &fileName) const =0
Creates new FIFO, passes ownership to a caller.
Input device file abstraction. Can read from a device file, thus communicating with a device driver...
Definition: inputDeviceFileInterface.h:22
virtual SystemConsoleInterface & systemConsole()=0
Returns system console wrapper, able to execute system command and launch processes.
virtual MspI2cInterface & mspI2c()=0
Returns MSP I2C bus implementation.
Output device file abstraction.
Definition: outputDeviceFileInterface.h:23
virtual ~HardwareAbstractionInterface()=default
virtual EventFileInterface * createEventFile(const QString &fileName, QThread &thread) const =0
Creates new event file, passes ownership to a caller.
virtual OutputDeviceFileInterface * createOutputDeviceFile(const QString &fileName) const =0
Creates new output device file, passes ownership to a caller.
virtual InputDeviceFileInterface * createInputDeviceFile(const QString &fileName) const =0
Creates new input device file, passes ownership to a caller.
virtual MspUsbInterface & mspUsb()=0
Returns MSP USB bus implementation.
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
virtual QVector< uint8_t > captureV4l2StillImage(const QString &port, const QString &pathToPic) const =0
Returns QVector with info about picture pixels.
Represents console of an OS.
Definition: systemConsoleInterface.h:22