RDK Documentation (Open Sourced RDK Components)
frontPanelIndicator.hpp
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 /**
22 * @defgroup devicesettings
23 * @{
24 * @defgroup ds
25 * @{
26 **/
27 
28 
29 #ifndef _DS_FRONTPANELINDICATOR_HPP_
30 #define _DS_FRONTPANELINDICATOR_HPP_
31 
32 #include "dsConstant.hpp"
33 #include "list.hpp"
34 #include "frontPanelIndicator.hpp"
35 #include "dsTypes.h"
36 #include "dsFPD.h"
37 #include <string>
38 #include "dsUtl.h"
39 
40 
41 /**
42  * @file frontPanelIndicator.hpp
43  * @brief Structures and classes for front panel indicator are defined here
44  * @ingroup frontPanelIndicator
45  */
46 namespace device {
47 
48 
49 /**
50  * @class FrontPanelIndicator
51  * @brief This class extents DSConstant to manage front panel indicators color, blink sequence
52  * and brightness.
53  * @ingroup devicesettingsclass
54  */
56 
57 public:
58  static FrontPanelIndicator & getInstance(int id);
59  static FrontPanelIndicator & getInstance(const std::string &name);
60 
61 
62 /**
63  * @class FrontPanelIndicator::Color
64  * @brief This class extents DSConstant to manage the color of the front panel indicator
65  * @ingroup devicesettingsclass
66  */
67  class Color : public DSConstant {
68  public:
69  static const int kBlue; //!< Indicates RGB value of blue color.
70  static const int kGreen; //!< Indicates RGB value of green color.
71  static const int kRed; //!< Indicates RGB value of red color.
72  static const int kYellow; //!< Indicates RGB value of yellow color.
73  static const int kOrange; //!< Indicates RGB value of orange color.
74  static const int kWhite; //!< Indicates RGB value of white color.
75  static const int kMax; //!< Indicates maximum number of pre-defined colors.
76 
77  static const Color & getInstance(int id);
78  static const Color & getInstance(const std::string &name);
79 
80  Color(int id);
81 
82 /**
83  * @fn FrontPanelIndicator::Color::~Color()
84  * @brief This function is the default destructor of class Color.
85  *
86  * @return None
87  */
88  virtual ~Color() {};
89  };
90 
91 
92 /**
93  * @class FrontPanelIndicator::Blink
94  * @brief This class supports to manage front panel indicator blink sequence.
95  * @ingroup devicesettingsclass
96  */
97  class Blink {
98  int _interval; //!< Indicates the blink interval for front panel indicators.
99  int _iteration; //!< Indicates the blink iteration for front panel indicators.
100  public:
101  Blink(int interval = 0, int iteration = 0);
102 
103 /**
104  * @fn FrontPanelIndicator::Blink::~Blink()
105  * @brief This function is the default destructor of Blink class.
106  *
107  * @return None
108  */
109  virtual ~Blink() {};
110 
111 
112 /**
113  * @fn FrontPanelIndicator::Blink::getInterval() const
114  * @brief This API is used to get the blink intervals of front panel indicator
115  *
116  * @return _interval Indicates the blink intervals
117  */
118  int getInterval() const {return _interval;};
119 
120 
121 /**
122  * @fn FrontPanelIndicator::Blink::getIteration() const
123  * @brief This API is used to get the blink iterations of front panel indicator
124  *
125  * @return _iteration Indicates the blink iterations
126  */
127  int getIteration() const {return _iteration;};
128 
129  };
130 
131 protected:
132  int _maxBrightness; //!< Indicates maximum brightness value for the FP indicators.
133  int _maxCycleRate; //!< Indicates maximum cycle rate for scrolling of LED.
134  int _brightness; //!< Indicates the brightness of the LED indicator.
135  int _levels; //!< Indicates the brightness level.
136  int _colorMode; //!< Indicates the color mode of the LED indicator (single or multicolor mode).
137  int _state; //!< Indicates the FP indicator is enabled if true.
138  Blink _blink; //!< A Blink instance to control blink iterations and intervals of the LED.
139  int _color;
140  uint32_t _color_rgb32; //!< Indicates the color id of the LED.
141 
142  static const char * kPropertyBrightness;
143  static const char * kPropertyColor;
144 
145 public:
146 
147  static const int kMessage; //!< Indicates id of meassage LED.
148  static const int kPower; //!< Indicates id of power LED.
149  static const int kRecord; //!< Indicates id of record LED.
150  static const int kRemote; //!< Indicates id of remote LED.
151  static const int kRFBypass; //!< Indicates id of RF bypass LED.
152  static const int kMax; //!< Indicates the maximum number of LEDS supported.
153 
154  int getBrightness();
155  void getBrightnessLevels(int &levels, int &min, int &max);
156  int getColorMode();
157 
158 
159 /**
160  * @fn Blink getBlink() const
161  * @brief This API gets the blink parameters of the front panel display like iterations and interval
162  *
163  * @param[out] _blink Is filled with the blink parameters set for front panel display
164  *
165  * @return None
166  */
167  const Blink getBlink() const {return _blink;};
168 
169 
170 /**
171  * @fn getMaxCycleRate() const
172  * @brief This API get the rate at which the LED is rotating/glowing during scrolling
173  *
174  * @return _maxCycleRate Returns the rate at which LED is rotating/glowing during scrolling
175  */
176  int getMaxCycleRate() const {return _maxCycleRate;};
177  void setBlink(const Blink &blink);
178  uint32_t getColor();
179 
180 
181  /*Old FP 1/2/3 APIs. - For Backward compatibility */
182  void setBrightness(const int &brightness,const bool toPersist = true);
183  void setColor(const Color & newColor,const bool toPersist = true);
184 
185 
186  /* Fp4 APIS - set rgb color value*/
187  void setColor(const uint32_t color,const bool toPersist = true);
188 
189  /* we still need this API to toggle the LED Power i.e Remote/Power */
190  void setState(const bool &enable);
191  /* Get LED ON/OFF state */
192  bool getState();
193 
194  const List<Color> getSupportedColors() const;;
195  FrontPanelIndicator(int id, int maxBrightness, int maxCycleRate, int levels,int colorMode);
196  virtual ~FrontPanelIndicator();
197 };
198 
199 }
200 
201 #endif /* _DS_FRONTPANELINDICATOR_HPP_ */
202 
203 
204 /** @} */
205 /** @} */
device::FrontPanelIndicator::kPower
static const int kPower
Indicates id of power LED.
Definition: frontPanelIndicator.hpp:148
device::FrontPanelIndicator::Blink::Blink
Blink(int interval=0, int iteration=0)
This API is a parameterized constructor for the nested class Blink.
Definition: frontPanelIndicator.cpp:202
device::FrontPanelIndicator::_maxBrightness
int _maxBrightness
Indicates maximum brightness value for the FP indicators.
Definition: frontPanelIndicator.hpp:132
device::FrontPanelIndicator::~FrontPanelIndicator
virtual ~FrontPanelIndicator()
This function is the default constructor for FrontPanelIndicator.
Definition: frontPanelIndicator.cpp:292
dsFPD.h
device::FrontPanelIndicator::kRecord
static const int kRecord
Indicates id of record LED.
Definition: frontPanelIndicator.hpp:149
device::FrontPanelIndicator::_blink
Blink _blink
A Blink instance to control blink iterations and intervals of the LED.
Definition: frontPanelIndicator.hpp:138
device::List
This class is implemented using templates and it is used to maintain a container with the list of sup...
Definition: list.hpp:51
device::FrontPanelIndicator::setColor
void setColor(const Color &newColor, const bool toPersist=true)
This API sets the color of the front panel indicator.
Definition: frontPanelIndicator.cpp:466
device::FrontPanelIndicator::getBrightnessLevels
void getBrightnessLevels(int &levels, int &min, int &max)
This function gets the maximum brightness, minimum brightness and the brightness level set for the fr...
Definition: frontPanelIndicator.cpp:406
device::FrontPanelIndicator::kMax
static const int kMax
Indicates the maximum number of LEDS supported.
Definition: frontPanelIndicator.hpp:152
dsConstant.hpp
This file defines DSConstant class which is inherited by most of the device settings classes.
device::FrontPanelIndicator::getColorMode
int getColorMode()
This function is used to get the color mode of the front panel indicator. The color mode is device sp...
Definition: frontPanelIndicator.cpp:422
dsTypes.h
Device Settings HAL types.
device::FrontPanelIndicator::getBlink
const Blink getBlink() const
This API gets the blink parameters of the front panel display like iterations and interval.
Definition: frontPanelIndicator.hpp:167
device::FrontPanelIndicator::_state
int _state
Indicates the FP indicator is enabled if true.
Definition: frontPanelIndicator.hpp:137
device::FrontPanelIndicator::kRemote
static const int kRemote
Indicates id of remote LED.
Definition: frontPanelIndicator.hpp:150
device::DSConstant
This class is used to store and manage the names and id's. It is derived by many classes like VideoRe...
Definition: dsConstant.hpp:52
frontPanelIndicator.hpp
Structures and classes for front panel indicator are defined here.
device::FrontPanelIndicator::setBrightness
void setBrightness(const int &brightness, const bool toPersist=true)
This API sets the brightness or intensity of the front panel indicators.
Definition: frontPanelIndicator.cpp:306
dsUtl.h
Device Settings HAL utilities.
device::DSConstant::enable
void enable()
This function is used to indicate that the port or port attribute calling this function are enabled.
Definition: dsConstant.hpp:164
device::FrontPanelIndicator::Color::~Color
virtual ~Color()
This function is the default destructor of class Color.
Definition: frontPanelIndicator.hpp:88
device::FrontPanelIndicator::Color::kBlue
static const int kBlue
Indicates RGB value of blue color.
Definition: frontPanelIndicator.hpp:69
device::FrontPanelIndicator::_brightness
int _brightness
Indicates the brightness of the LED indicator.
Definition: frontPanelIndicator.hpp:134
device::FrontPanelIndicator::Color::kGreen
static const int kGreen
Indicates RGB value of green color.
Definition: frontPanelIndicator.hpp:70
device::FrontPanelIndicator::_maxCycleRate
int _maxCycleRate
Indicates maximum cycle rate for scrolling of LED.
Definition: frontPanelIndicator.hpp:133
device::FrontPanelIndicator::getSupportedColors
const List< Color > getSupportedColors() const
This API gets the list of supported colors for front panel indicator.
Definition: frontPanelIndicator.cpp:549
device::FrontPanelIndicator::getState
bool getState()
This API gets the State of the specified LED indicators.
Definition: frontPanelIndicator.cpp:325
device::FrontPanelIndicator::Color::kWhite
static const int kWhite
Indicates RGB value of white color.
Definition: frontPanelIndicator.hpp:74
device::FrontPanelIndicator::getColor
uint32_t getColor()
This API gets the color of the front panel indicator/LED.
Definition: frontPanelIndicator.cpp:455
device::FrontPanelIndicator::kRFBypass
static const int kRFBypass
Indicates id of RF bypass LED.
Definition: frontPanelIndicator.hpp:151
device::FrontPanelIndicator::setBlink
void setBlink(const Blink &blink)
This API sets the blink iteration and blink interval for the LED.
Definition: frontPanelIndicator.cpp:436
device::FrontPanelIndicator::Color::getInstance
static const Color & getInstance(int id)
This function gets an instance of the Color with the specified id, only if the id passed is valid.
Definition: frontPanelIndicator.cpp:145
device::FrontPanelIndicator::Color::kYellow
static const int kYellow
Indicates RGB value of yellow color.
Definition: frontPanelIndicator.hpp:72
device::FrontPanelIndicator::_levels
int _levels
Indicates the brightness level.
Definition: frontPanelIndicator.hpp:135
device::FrontPanelIndicator::Color::kRed
static const int kRed
Indicates RGB value of red color.
Definition: frontPanelIndicator.hpp:71
device::FrontPanelIndicator::Color::kMax
static const int kMax
Indicates maximum number of pre-defined colors.
Definition: frontPanelIndicator.hpp:75
device::FrontPanelIndicator::getInstance
static FrontPanelIndicator & getInstance(int id)
This function gets the FrontPanelIndicator instance corresponding to the id parameter,...
Definition: frontPanelIndicator.cpp:208
device::FrontPanelIndicator
This class extents DSConstant to manage front panel indicators color, blink sequence and brightness.
Definition: frontPanelIndicator.hpp:55
device::FrontPanelIndicator::Color::kOrange
static const int kOrange
Indicates RGB value of orange color.
Definition: frontPanelIndicator.hpp:73
device::FrontPanelIndicator::FrontPanelIndicator
FrontPanelIndicator(int id, int maxBrightness, int maxCycleRate, int levels, int colorMode)
This function is a parameterised constructor of FrontPanelIndicator. It creates and initializes the F...
Definition: frontPanelIndicator.cpp:272
device::FrontPanelIndicator::_colorMode
int _colorMode
Indicates the color mode of the LED indicator (single or multicolor mode).
Definition: frontPanelIndicator.hpp:136
Color
This class extents DSConstant to manage the color of the front panel indicator.
device::FrontPanelIndicator::getMaxCycleRate
int getMaxCycleRate() const
This API get the rate at which the LED is rotating/glowing during scrolling.
Definition: frontPanelIndicator.hpp:176
device::FrontPanelIndicator::getBrightness
int getBrightness()
This API gets the brightness of the specified LED indicators.
Definition: frontPanelIndicator.cpp:374
device::FrontPanelIndicator::Color
Definition: frontPanelIndicator.hpp:67
device::FrontPanelIndicator::kMessage
static const int kMessage
Indicates id of meassage LED.
Definition: frontPanelIndicator.hpp:147
device::FrontPanelIndicator::setState
void setState(const bool &enable)
This API is used to enable or disable the front panel indicator.
Definition: frontPanelIndicator.cpp:350
device::FrontPanelIndicator::_color_rgb32
uint32_t _color_rgb32
Indicates the color id of the LED.
Definition: frontPanelIndicator.hpp:140