Main Page · Modules · All Classes · Class Hierarchy
MALedsController.hpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #pragma once
23 
24 #include "core/MANum.hpp"
25 #include "MAController.hpp"
26 
27 #include <MCThreadLocalData.hpp>
28 
29 #include <boost/scoped_ptr.hpp>
30 #include <boost/unordered_map.hpp>
31 
32 class MADevice;
33 class MALedsController;
35 class MARobotState;
36 
42 namespace MA
43 {
47 typedef boost::unordered_map<std::string, bool> TransitionLedModeMap;
49 typedef TransitionLedModeMap::iterator TransitionLedModeMapIter;
50 };
51 
56 {
57 public:
59  virtual ~MALedsController();
60 
61 private:
62  virtual void UpdateRobotState(MARobotState& robot_state) override;
63 public:
64  virtual MA::DeviceList GetMotors() const override;
65  virtual int StartTransition(const std::string& name) override;
66  virtual void StopTransition(const std::string& name) override;
67  static int GetFaceMode();
68  void ResetSkitterFaceMode();
69  void SetMaximumValue(float new_value);
70  float GetMaximumValue() const;
71  int GetShownBatteryLevel() const;
72  void ClearFace();
73  virtual MA::DeviceGeneratorsMap GetSkitTransitionGenerators(MA::SkitBaseSPtr skit) override;
74 private:
75  void AddGenerator(MA::DeviceGeneratorsMap& device_generators, MADevice& device,
76  MAGeneratorContainer& container, bool permanent = false);
77  MA_DECLARE_TRANSITION_ACTION(ShowAwakenEyes)
78  MA_DECLARE_TRANSITION_ACTION(ShowSleepingEyes)
79  MA_DECLARE_TRANSITION_ACTION(ShowBatteryChargingAnim)
80  MA_DECLARE_TRANSITION_ACTION(ShowCrownStrokedAnim)
81  MA_DECLARE_TRANSITION_ACTION(ShowHappyAnim)
82  MA_DECLARE_TRANSITION_ACTION(ShowSadAnim)
83  MA_DECLARE_TRANSITION_ACTION(ShowBatteryLevel)
84  MA_DECLARE_TRANSITION_ACTION(ShowDataUploadStatus)
85  MA_DECLARE_TRANSITION_ACTION(ShowClientConnectedStatus)
86  MA_DECLARE_TRANSITION_ACTION(ShowNoNetworkStatus)
87  MA_DECLARE_TRANSITION_ACTION(ShowStartup)
88  MA_DECLARE_TRANSITION_ACTION(ShowAngryFace)
89  MA_DECLARE_TRANSITION_ACTION(HeavyCalculation)
90  MA_DECLARE_TRANSITION_ACTION(SwitchSoundProfile)
91  MA_DECLARE_TRANSITION_ACTION(NormalVolumeControl)
92  MA_DECLARE_TRANSITION_ACTION(AdaptiveVolumeControl)
93  MA_DECLARE_TRANSITION_ACTION(ShowPickUpMode)
94  MA_DECLARE_TRANSITION_ACTION(ShowGameMode)
95  MA_DECLARE_TRANSITION_ACTION(FadeOutEarsGreen)
96  MA_DECLARE_TRANSITION_ACTION(FadeOutEarsRed)
97  MA_DECLARE_TRANSITION_ACTION(FadeOutCrownWhite)
98 
99 protected:
101  boost::scoped_ptr<MADevice> BackFBlue;
103  boost::scoped_ptr<MADevice> BackFWhite;
105  boost::scoped_ptr<MADevice> BackMOrange;
107  boost::scoped_ptr<MADevice> BackMWhite;
109  boost::scoped_ptr<MADevice> BackRRed;
111  boost::scoped_ptr<MADevice> BackRWhite;
113  boost::scoped_ptr<MADevice> HeadWifi;
115  boost::scoped_ptr<MADevice> HeadYellow;
117  boost::scoped_ptr<MADevice> HeadWhite;
119  boost::scoped_ptr<MADevice> EarsRed;
121  boost::scoped_ptr<MADevice> EarsGreen;
123  boost::scoped_ptr<MADevice> EarsBlue;
125  boost::scoped_ptr<MADevice> Face[14];
127  MA::TransitionLedModeMap TransitionLedModes;
132  /*
133  * Maximum led value
134  * 0.05 - minimum 1.0 - maximum
135  */
136  MANum<float> MaximumValue;
137 };
138 
boost::scoped_ptr< MADevice > HeadWifi
Head WiFi LED.
boost::scoped_ptr< MADevice > BackFWhite
Back fore white LED.
int LedModeForSkitter
LED mode for Skitter skits.
int ShownBatteryLevel
The shown battery level on the LEDs.
boost::scoped_ptr< MADevice > EarsGreen
Ears green LED.
boost::scoped_ptr< MADevice > BackMWhite
Back middle white LED.
Base class for the controllers.
Device class.
Definition: MADevice.hpp:57
boost::scoped_ptr< MADevice > HeadYellow
Head yellow LED.
boost::scoped_ptr< MADevice > BackFBlue
Back fore blue LED.
boost::scoped_ptr< MADevice > BackRWhite
Back rear white LED.
boost::scoped_ptr< MADevice > BackRRed
Back rear red LED.
Generator container class.
Leds controller class.
boost::scoped_ptr< MADevice > BackMOrange
Back middle orange LED.
A wrapper class to cover boost::thread_specific_ptr/folly::ThreadLocal API on certain targets...
MA::TransitionLedModeMap TransitionLedModes
The map of the special transition LED modes.
Robot state.
boost::scoped_ptr< MADevice > EarsBlue
Ears blue LED.
boost::scoped_ptr< MADevice > HeadWhite
Head white LED.
boost::scoped_ptr< MADevice > EarsRed
Ears red LED.