trikRuntime
|
Class representing TRIK controller board and devices installed on it, also provides access to peripherals like motors and sensors. More...
#include <brick.h>
Public Slots | |
void | configure (const QString &portName, const QString &deviceName) override |
void | playSound (const QString &soundFileName) override |
void | playTone (int hzFreq, int msDuration) override |
void | say (const QString &text) override |
void | stop () override |
MotorInterface * | motor (const QString &port) override |
PwmCaptureInterface * | pwmCapture (const QString &port) override |
SensorInterface * | sensor (const QString &port) override |
QStringList | motorPorts (MotorInterface::Type type) const override |
QStringList | pwmCapturePorts () const override |
QStringList | sensorPorts (SensorInterface::Type type) const override |
QStringList | encoderPorts () const override |
VectorSensorInterface * | accelerometer () override |
GyroSensorInterface * | gyroscope () override |
LineSensorInterface * | lineSensor (const QString &port) override |
ColorSensorInterface * | colorSensor (const QString &port) override |
ObjectSensorInterface * | objectSensor (const QString &port) override |
I2cDeviceInterface * | i2c (int bus, int address) override |
QVector< uint8_t > | getStillImage () override |
SoundSensorInterface * | soundSensor (const QString &port) override |
EncoderInterface * | encoder (const QString &port) override |
BatteryInterface * | battery () override |
KeysInterface * | keys () override |
DisplayInterface * | display () override |
LedInterface * | led () override |
GamepadInterface * | gamepad () override |
FifoInterface * | fifo (const QString &port) override |
MarkerInterface * | marker () override |
EventDeviceInterface * | eventDevice (const QString &deviceFile) override |
void | stopEventDevice (const QString &deviceFile) override |
Public Slots inherited from trikControl::BrickInterface | |
virtual void | configure (const QString &portName, const QString &deviceName)=0 |
Configures given device on given port. More... | |
virtual void | playSound (const QString &soundFileName)=0 |
Plays given music file on a speaker (in format accepted by aplay or cvlc utilities). More... | |
virtual void | playTone (int hzFreq, int msDuration)=0 |
Generates sound with given frequency and given duration, plays it on a speaker. More... | |
virtual void | say (const QString &text)=0 |
Uses text synthesis to say given text on a speaker. More... | |
virtual void | stop ()=0 |
Stops all motors and shuts down all current activity. More... | |
virtual trikControl::MotorInterface * | motor (const QString &port)=0 |
Returns reference to motor of a given type on a given port. More... | |
virtual trikControl::PwmCaptureInterface * | pwmCapture (const QString &port)=0 |
Returns reference to PWM signal capture device on a given port. More... | |
virtual trikControl::SensorInterface * | sensor (const QString &port)=0 |
Returns reference to sensor on a given port. More... | |
virtual QStringList | motorPorts (MotorInterface::Type type) const =0 |
Retruns list of ports for motors of a given type. More... | |
virtual QStringList | pwmCapturePorts () const =0 |
Returns list of PWM signal capture device ports. More... | |
virtual QStringList | sensorPorts (SensorInterface::Type type) const =0 |
Returns list of ports for sensors of a given type. More... | |
virtual QStringList | encoderPorts () const =0 |
Returns list of encoder ports. More... | |
virtual trikControl::VectorSensorInterface * | accelerometer ()=0 |
Returns on-board accelerometer. More... | |
virtual trikControl::GyroSensorInterface * | gyroscope ()=0 |
Returns on-board gyroscope. More... | |
virtual trikControl::LineSensorInterface * | lineSensor (const QString &port)=0 |
Returns high-level line detector sensor using camera on given port (video0 or video1). More... | |
virtual trikControl::ColorSensorInterface * | colorSensor (const QString &port)=0 |
Returns high-level color sensor using camera on given port (video0 or video1). More... | |
virtual trikControl::ObjectSensorInterface * | objectSensor (const QString &port)=0 |
Returns high-level object detector sensor using camera on given port (video0 or video1). More... | |
virtual trikControl::I2cDeviceInterface * | i2c (int bus, int address)=0 |
Returns i2c device object. More... | |
virtual QVector< uint8_t > | getStillImage ()=0 |
Returns QVector<uin8_t> with image using camera on given port (video0 or video1). More... | |
virtual trikControl::SoundSensorInterface * | soundSensor (const QString &port)=0 |
Returns high-level sound detector sensor using microphones. More... | |
virtual trikControl::EncoderInterface * | encoder (const QString &port)=0 |
Returns encoder on given port. More... | |
virtual trikControl::BatteryInterface * | battery ()=0 |
Returns battery. More... | |
virtual trikControl::KeysInterface * | keys ()=0 |
Returns keys on a control brick. More... | |
virtual trikControl::DisplayInterface * | display ()=0 |
Returns class that provides drawing on display. More... | |
virtual trikControl::LedInterface * | led ()=0 |
Returns LED control class. More... | |
virtual trikControl::GamepadInterface * | gamepad ()=0 |
Returns handler for Android gamepad. More... | |
virtual trikControl::FifoInterface * | fifo (const QString &port)=0 |
Returns custom FIFO file which can be used as sensor. More... | |
virtual trikControl::MarkerInterface * | marker ()=0 |
Returns marker. More... | |
virtual trikControl::EventDeviceInterface * | eventDevice (const QString &deviceFile)=0 |
Returns custom event device that can be used as a sensor, for example, for custom gamepad support. More... | |
virtual void | stopEventDevice (const QString &deviceFile)=0 |
Stops listening given event device and destroys its watcher object. More... | |
Public Member Functions | |
Brick (const QString &systemConfig, const QString &modelConfig, const QString &mediaPath) | |
Constructor. More... | |
Brick (trikHal::HardwareAbstractionInterface &hardwareAbstraction, const QString &systemConfig, const QString &modelConfig, const QString &mediaPath) | |
Secondary constructor, takes explicit hardware abstraction object. More... | |
~Brick () override | |
void | reset () override |
Do reset (stop motors, reset keys, clear screen, etc). More... | |
DisplayWidgetInterface * | graphicsWidget () override |
Returns a widget on which display output is drawn. More... | |
QString | configVersion () const override |
Returns version of system configuration file. More... | |
Additional Inherited Members | |
Signals inherited from trikControl::BrickInterface | |
void | stopped () |
Emitted when all deferred deinitialization is completed and brick completely stopped. More... | |
Class representing TRIK controller board and devices installed on it, also provides access to peripherals like motors and sensors.
Is NOT thread-safe.
Brick::Brick | ( | const QString & | systemConfig, |
const QString & | modelConfig, | ||
const QString & | mediaPath | ||
) |
Constructor.
systemConfig | - file name (with path) of system config, absolute or relative to current directory. |
modelConfig | - file name (with path) of model config, absolute or relative to current directory. |
mediaPath | - path to the directory with media files (it is expected to be ending with "/"). |
Brick::Brick | ( | trikHal::HardwareAbstractionInterface & | hardwareAbstraction, |
const QString & | systemConfig, | ||
const QString & | modelConfig, | ||
const QString & | mediaPath | ||
) |
Secondary constructor, takes explicit hardware abstraction object.
hardwareAbstraction | - hardware abstraction layer implementation. |
systemConfig | - file name (with path) of system config, absolute or relative to current directory. |
modelConfig | - file name (with path) of model config, absolute or relative to current directory. |
mediaPath | - path to the directory with media files (it is expected to be ending with "/"). |
|
override |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overridevirtual |
Returns version of system configuration file.
Implements trikControl::BrickInterface.
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overridevirtual |
Returns a widget on which display output is drawn.
Implements trikControl::BrickInterface.
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overridevirtual |
Do reset (stop motors, reset keys, clear screen, etc).
We should call it before executing any script with this instance.
Implements trikControl::BrickInterface.
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |
|
overrideslot |