trikRuntime
brickInterface.h
Go to the documentation of this file.
1 /* Copyright 2015 - 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/QStringList>
18 
19 #include "batteryInterface.h"
20 #include "colorSensorInterface.h"
21 #include "displayInterface.h"
22 #include "encoderInterface.h"
23 #include "eventDeviceInterface.h"
24 #include "fifoInterface.h"
25 #include "gamepadInterface.h"
26 #include "gyroSensorInterface.h"
27 #include "keysInterface.h"
28 #include "ledInterface.h"
29 #include "lineSensorInterface.h"
30 #include "motorInterface.h"
31 #include "markerInterface.h"
32 #include "objectSensorInterface.h"
33 #include "pwmCaptureInterface.h"
34 #include "sensorInterface.h"
35 #include "soundSensorInterface.h"
36 #include "vectorSensorInterface.h"
37 #include "cameraDeviceInterface.h"
38 #include "i2cDeviceInterface.h"
39 
40 #include "declSpec.h"
41 
42 namespace trikControl {
43 
46 class TRIKCONTROL_EXPORT BrickInterface : public QObject
47 {
48  Q_OBJECT
49 
50 public:
53  virtual void reset() = 0;
54 
56  virtual DisplayWidgetInterface *graphicsWidget() = 0;
57 
59  virtual QString configVersion() const = 0;
60 
61 public slots:
68  virtual void configure(const QString &portName, const QString &deviceName) = 0;
69 
71  virtual void playSound(const QString &soundFileName) = 0;
72 
74  virtual void playTone(int hzFreq, int msDuration) = 0;
75 
77  virtual void say(const QString &text) = 0;
78 
80  virtual void stop() = 0;
81 
83  virtual trikControl::MotorInterface *motor(const QString &port) = 0;
84 
86  virtual trikControl::PwmCaptureInterface *pwmCapture(const QString &port) = 0;
87 
89  virtual trikControl::SensorInterface *sensor(const QString &port) = 0;
90 
92  virtual QStringList motorPorts(MotorInterface::Type type) const = 0;
93 
95  virtual QStringList pwmCapturePorts() const = 0;
96 
98  virtual QStringList sensorPorts(SensorInterface::Type type) const = 0;
99 
101  virtual QStringList encoderPorts() const = 0;
102 
104  virtual trikControl::VectorSensorInterface *accelerometer() = 0;
105 
107  virtual trikControl::GyroSensorInterface *gyroscope() = 0;
108 
110  virtual trikControl::LineSensorInterface *lineSensor(const QString &port) = 0;
111 
113  virtual trikControl::ColorSensorInterface *colorSensor(const QString &port) = 0;
114 
116  virtual trikControl::ObjectSensorInterface *objectSensor(const QString &port) = 0;
117 
119  virtual trikControl::I2cDeviceInterface *i2c(int bus, int address) = 0;
120 
122  virtual QVector<uint8_t> getStillImage() = 0;
123 
125  virtual trikControl::SoundSensorInterface *soundSensor(const QString &port) = 0;
126 
128  virtual trikControl::EncoderInterface *encoder(const QString &port) = 0;
129 
131  virtual trikControl::BatteryInterface *battery() = 0;
132 
134  virtual trikControl::KeysInterface *keys() = 0;
135 
137  virtual trikControl::DisplayInterface *display() = 0;
138 
140  virtual trikControl::LedInterface *led() = 0;
141 
143  virtual trikControl::GamepadInterface *gamepad() = 0;
144 
146  virtual trikControl::FifoInterface *fifo(const QString &port) = 0;
147 
149  virtual trikControl::MarkerInterface *marker() = 0;
150 
154  virtual trikControl::EventDeviceInterface *eventDevice(const QString &deviceFile) = 0;
155 
157  virtual void stopEventDevice(const QString &deviceFile) = 0;
158 
159 signals:
162  void stopped();
163 };
164 
165 }
166 
167 Q_DECLARE_METATYPE(trikControl::BrickInterface *)
Uses virtual line sensor to detect x coordinate of a center of an object that was in camera&#39;s field o...
Definition: lineSensorInterface.h:29
Class for work with i2c.
Definition: i2cDeviceInterface.h:26
static const int port
Definition: trikCommunicatorTest.cpp:24
Controls light-emitting diode on a brick.
Definition: ledInterface.h:26
Interface that represents linux FIFO file, which is commonly used by various sensors.
Definition: fifoInterface.h:26
Interface for widget on which Brick draws its graphics. Can notify when it shows or hides itself...
Definition: displayWidgetInterface.h:30
Abstract motor. It is differently implemented by different motor types (like servo and power motors)...
Definition: motorInterface.h:26
Sensor that returns a vector.
Definition: vectorSensorInterface.h:29
Provides characteristics of PWM signal supplied to the port.
Definition: pwmCaptureInterface.h:27
Generic event device.
Definition: eventDeviceInterface.h:27
Provides battery voltage info.
Definition: batteryInterface.h:26
Encoder of power motor.
Definition: encoderInterface.h:26
#define TRIKCONTROL_EXPORT
Definition: declSpec.h:23
Definition: trikCommunicator.h:27
Uses virtual color sensor to detect dominant color in every cell of m * n grid of camera field of vie...
Definition: colorSensorInterface.h:27
Remote control of a robot via Android gamepad.
Definition: gamepadInterface.h:24
Abstract sensor, inherited by various sensor types.
Definition: sensorInterface.h:26
Class that returns raw and processed data from the gyroscope.
Definition: gyroSensorInterface.h:27
Provides ability to draw something on robot display.
Definition: displayInterface.h:28
Class for handling keys on a brick.
Definition: keysInterface.h:26
Type
Definition: motorInterface.h:31
Type
Definition: sensorInterface.h:31
Uses virtual sound sensor to detect angle of sound source.
Definition: soundSensorInterface.h:27
Controls marker.
Definition: markerInterface.h:27
Uses virtual line sensor to detect x coordinate of a center of an object that was in camera&#39;s field o...
Definition: objectSensorInterface.h:28
Interface representing TRIK controller board and devices installed on it, also provides access to per...
Definition: brickInterface.h:46