trikRuntime
led.h
Go to the documentation of this file.
1 /* Copyright 2013 - 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/QObject>
18 #include <QtCore/QString>
19 #include <QtCore/QScopedPointer>
20 
21 #include "ledInterface.h"
22 #include "deviceState.h"
23 
24 namespace trikKernel {
25 class Configurer;
26 }
27 
28 namespace trikHal {
29 class HardwareAbstractionInterface;
30 class OutputDeviceFileInterface;
31 }
32 
33 namespace trikControl {
34 
36 class Led : public LedInterface
37 {
38  Q_OBJECT
39 
40 public:
43  Led(const trikKernel::Configurer &configurer, const trikHal::HardwareAbstractionInterface &hardwareAbstraction);
44 
45  ~Led() override;
46 
47  Status status() const override;
48 
49 public slots:
50  void red() override;
51 
52  void green() override;
53 
54  void orange() override;
55 
56  void off() override;
57 
58 private:
59  QScopedPointer<trikHal::OutputDeviceFileInterface> mRedDeviceFile;
60  QScopedPointer<trikHal::OutputDeviceFileInterface> mGreenDeviceFile;
61  DeviceState mState;
62 };
63 
64 }
Definition: analogSensor.h:23
Generic configuration helper, parses configuration XML files and presents configuration as a set of a...
Definition: configurer.h:28
Controls light-emitting diode on a brick.
Definition: ledInterface.h:26
Helper class to track device state (off, starting, ready, stopping, fail).
Definition: deviceState.h:26
Implementation of LED control for a real robot.
Definition: led.h:36
Status
Device status.
Definition: deviceInterface.h:33
Definition: trikCommunicator.h:27
Definition: brickFactory.h:21
Hardware abstraction, provides devices that are used to communicate with robot hardware or emulate it...
Definition: hardwareAbstractionInterface.h:29