epuckLEDs.hpp
Go to the documentation of this file.
1 /* Copyright 2008 Renato Florentino Garcia <fgar.renato@gmail.com>
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2, as
5  * published by the Free Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program. If not, see <http://www.gnu.org/licenses/>.
14  */
15 
16 #ifndef EPUCK_LEDS_HPP
17 #define EPUCK_LEDS_HPP
18 
19 #include "epuckInterface.hpp"
20 
31 class EpuckLEDs : public EpuckInterface
32 {
33 public:
34 
36  static const unsigned RING_LEDS_NUM = 8;
37 
39  struct LEDstate
40  {
42  bool front;
43  bool body;
44  };
45 
51  EpuckLEDs(const SerialPort* const serialPort);
52 
58  void SetRingLED(bool ringLED[RING_LEDS_NUM]);
59 
67  void SetRingLED(unsigned id, bool state);
68 
73  void SetFrontLED(bool state);
74 
79  void SetBodyLED(bool state);
80 
88  void ClearInternal();
89 
90 private:
91 
92  LEDstate ledState;
93 
94  void SendLEDState() const;
95 };
96 
97 
98 #endif /* EPUCK_LEDS_HPP */
bool ring[RING_LEDS_NUM]
The state of each of eighth ring LEDs.
Definition: epuckLEDs.hpp:41
void ClearInternal()
Turn off the internal representation of all e-puck LEDs.
Definition: epuckLEDs.cpp:103
const SerialPort *const serialPort
A SerialPort class instance shared among the device interfaces.
Definition: epuckInterface.hpp:59
This class controls the turn on and turn off of e-puck LEDs.
Definition: epuckLEDs.hpp:31
EpuckLEDs(const SerialPort *const serialPort)
EpuckLEDs class constructor.
Definition: epuckLEDs.cpp:18
void SetRingLED(bool ringLED[RING_LEDS_NUM])
Set the e-puck ring LEDs.
Header file of the EpuckInterface class and the struct EpuckInterface::Triple.
void SetBodyLED(bool state)
Set the e-puck body LED.
Definition: epuckLEDs.cpp:96
bool body
The state of body LED.
Definition: epuckLEDs.hpp:43
static const unsigned RING_LEDS_NUM
The quantity of LEDs in e-puck ring LEDs.
Definition: epuckLEDs.hpp:36
Base class for all concrete interfaces of e-puck.
Definition: epuckInterface.hpp:33
bool front
The state of front LED.
Definition: epuckLEDs.hpp:42
Struct with the state of e-puck LEDs.
Definition: epuckLEDs.hpp:39
void SetFrontLED(bool state)
Set the e-puck front LED.
Definition: epuckLEDs.cpp:89
Send and receive messages from e-puck.
Definition: serialPort.hpp:40