trikRuntime
trikControl::BrickInterface Class Referenceabstract

Interface representing TRIK controller board and devices installed on it, also provides access to peripherals like motors and sensors. More...

#include <brickInterface.h>

Inheritance diagram for trikControl::BrickInterface:
Collaboration diagram for trikControl::BrickInterface:

Public Slots

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::MotorInterfacemotor (const QString &port)=0
 Returns reference to motor of a given type on a given port. More...
 
virtual trikControl::PwmCaptureInterfacepwmCapture (const QString &port)=0
 Returns reference to PWM signal capture device on a given port. More...
 
virtual trikControl::SensorInterfacesensor (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::VectorSensorInterfaceaccelerometer ()=0
 Returns on-board accelerometer. More...
 
virtual trikControl::GyroSensorInterfacegyroscope ()=0
 Returns on-board gyroscope. More...
 
virtual trikControl::LineSensorInterfacelineSensor (const QString &port)=0
 Returns high-level line detector sensor using camera on given port (video0 or video1). More...
 
virtual trikControl::ColorSensorInterfacecolorSensor (const QString &port)=0
 Returns high-level color sensor using camera on given port (video0 or video1). More...
 
virtual trikControl::ObjectSensorInterfaceobjectSensor (const QString &port)=0
 Returns high-level object detector sensor using camera on given port (video0 or video1). More...
 
virtual trikControl::I2cDeviceInterfacei2c (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::SoundSensorInterfacesoundSensor (const QString &port)=0
 Returns high-level sound detector sensor using microphones. More...
 
virtual trikControl::EncoderInterfaceencoder (const QString &port)=0
 Returns encoder on given port. More...
 
virtual trikControl::BatteryInterfacebattery ()=0
 Returns battery. More...
 
virtual trikControl::KeysInterfacekeys ()=0
 Returns keys on a control brick. More...
 
virtual trikControl::DisplayInterfacedisplay ()=0
 Returns class that provides drawing on display. More...
 
virtual trikControl::LedInterfaceled ()=0
 Returns LED control class. More...
 
virtual trikControl::GamepadInterfacegamepad ()=0
 Returns handler for Android gamepad. More...
 
virtual trikControl::FifoInterfacefifo (const QString &port)=0
 Returns custom FIFO file which can be used as sensor. More...
 
virtual trikControl::MarkerInterfacemarker ()=0
 Returns marker. More...
 
virtual trikControl::EventDeviceInterfaceeventDevice (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...
 

Signals

void stopped ()
 Emitted when all deferred deinitialization is completed and brick completely stopped. More...
 

Public Member Functions

virtual void reset ()=0
 Do reset (stop motors, reset keys, clear screen, etc). More...
 
virtual DisplayWidgetInterfacegraphicsWidget ()=0
 Returns a widget on which display output is drawn. More...
 
virtual QString configVersion () const =0
 Returns version of system configuration file. More...
 

Detailed Description

Interface representing TRIK controller board and devices installed on it, also provides access to peripherals like motors and sensors.

Member Function Documentation

virtual trikControl::VectorSensorInterface* trikControl::BrickInterface::accelerometer ( )
pure virtualslot

Returns on-board accelerometer.

virtual trikControl::BatteryInterface* trikControl::BrickInterface::battery ( )
pure virtualslot

Returns battery.

virtual trikControl::ColorSensorInterface* trikControl::BrickInterface::colorSensor ( const QString &  port)
pure virtualslot

Returns high-level color sensor using camera on given port (video0 or video1).

virtual void trikControl::BrickInterface::configure ( const QString &  portName,
const QString &  deviceName 
)
pure virtualslot

Configures given device on given port.

Port must be listed in model-config.xml, device shall be listed in system-config.xml, and device shall be able to be configured on a port (it is also described in system-config.xml). Previously configured device is properly shut down, and new device is created and initialized on a port. Method blocks caller thread until device is created. Note that this method does not initialize devices like camera sensors, "init" shall be called for them separately when they are configured (it is consistent with Brick constructor behavior).

virtual QString trikControl::BrickInterface::configVersion ( ) const
pure virtual

Returns version of system configuration file.

Implemented in trikControl::Brick.

virtual trikControl::DisplayInterface* trikControl::BrickInterface::display ( )
pure virtualslot

Returns class that provides drawing on display.

virtual trikControl::EncoderInterface* trikControl::BrickInterface::encoder ( const QString &  port)
pure virtualslot

Returns encoder on given port.

virtual QStringList trikControl::BrickInterface::encoderPorts ( ) const
pure virtualslot

Returns list of encoder ports.

virtual trikControl::EventDeviceInterface* trikControl::BrickInterface::eventDevice ( const QString &  deviceFile)
pure virtualslot

Returns custom event device that can be used as a sensor, for example, for custom gamepad support.

Creates new event device on first access to a file, then returns already opened device. Ownership retained by brick.

virtual trikControl::FifoInterface* trikControl::BrickInterface::fifo ( const QString &  port)
pure virtualslot

Returns custom FIFO file which can be used as sensor.

virtual trikControl::GamepadInterface* trikControl::BrickInterface::gamepad ( )
pure virtualslot

Returns handler for Android gamepad.

virtual QVector<uint8_t> trikControl::BrickInterface::getStillImage ( )
pure virtualslot

Returns QVector<uin8_t> with image using camera on given port (video0 or video1).

virtual DisplayWidgetInterface* trikControl::BrickInterface::graphicsWidget ( )
pure virtual

Returns a widget on which display output is drawn.

Implemented in trikControl::Brick.

virtual trikControl::GyroSensorInterface* trikControl::BrickInterface::gyroscope ( )
pure virtualslot

Returns on-board gyroscope.

virtual trikControl::I2cDeviceInterface* trikControl::BrickInterface::i2c ( int  bus,
int  address 
)
pure virtualslot

Returns i2c device object.

virtual trikControl::KeysInterface* trikControl::BrickInterface::keys ( )
pure virtualslot

Returns keys on a control brick.

virtual trikControl::LedInterface* trikControl::BrickInterface::led ( )
pure virtualslot

Returns LED control class.

virtual trikControl::LineSensorInterface* trikControl::BrickInterface::lineSensor ( const QString &  port)
pure virtualslot

Returns high-level line detector sensor using camera on given port (video0 or video1).

virtual trikControl::MarkerInterface* trikControl::BrickInterface::marker ( )
pure virtualslot

Returns marker.

virtual trikControl::MotorInterface* trikControl::BrickInterface::motor ( const QString &  port)
pure virtualslot

Returns reference to motor of a given type on a given port.

virtual QStringList trikControl::BrickInterface::motorPorts ( MotorInterface::Type  type) const
pure virtualslot

Retruns list of ports for motors of a given type.

virtual trikControl::ObjectSensorInterface* trikControl::BrickInterface::objectSensor ( const QString &  port)
pure virtualslot

Returns high-level object detector sensor using camera on given port (video0 or video1).

virtual void trikControl::BrickInterface::playSound ( const QString &  soundFileName)
pure virtualslot

Plays given music file on a speaker (in format accepted by aplay or cvlc utilities).

virtual void trikControl::BrickInterface::playTone ( int  hzFreq,
int  msDuration 
)
pure virtualslot

Generates sound with given frequency and given duration, plays it on a speaker.

virtual trikControl::PwmCaptureInterface* trikControl::BrickInterface::pwmCapture ( const QString &  port)
pure virtualslot

Returns reference to PWM signal capture device on a given port.

virtual QStringList trikControl::BrickInterface::pwmCapturePorts ( ) const
pure virtualslot

Returns list of PWM signal capture device ports.

virtual void trikControl::BrickInterface::reset ( )
pure virtual

Do reset (stop motors, reset keys, clear screen, etc).

We should call it before executing any script with this instance.

Implemented in trikControl::Brick.

virtual void trikControl::BrickInterface::say ( const QString &  text)
pure virtualslot

Uses text synthesis to say given text on a speaker.

virtual trikControl::SensorInterface* trikControl::BrickInterface::sensor ( const QString &  port)
pure virtualslot

Returns reference to sensor on a given port.

virtual QStringList trikControl::BrickInterface::sensorPorts ( SensorInterface::Type  type) const
pure virtualslot

Returns list of ports for sensors of a given type.

virtual trikControl::SoundSensorInterface* trikControl::BrickInterface::soundSensor ( const QString &  port)
pure virtualslot

Returns high-level sound detector sensor using microphones.

virtual void trikControl::BrickInterface::stop ( )
pure virtualslot

Stops all motors and shuts down all current activity.

virtual void trikControl::BrickInterface::stopEventDevice ( const QString &  deviceFile)
pure virtualslot

Stops listening given event device and destroys its watcher object.

void trikControl::BrickInterface::stopped ( )
signal

Emitted when all deferred deinitialization is completed and brick completely stopped.

Note that if there is no deferred deinitialization (no video sensors are on, for example), signal will NOT be emitted.


The documentation for this class was generated from the following file: