RDK Documentation (Open Sourced RDK Components)
ledmgrbase.hpp
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 #ifndef LEDMGRBASE_H
20 #define LEDMGRBASE_H
21 #include <vector>
22 #include "ledmgr_types.hpp"
23 #include "indicator.hpp"
24 #include "pthread.h"
25 #include "fp_profile.hpp"
26 
27 /**
28  * @addtogroup LED_TYPES
29  * @{
30  */
31 #define IARMBUS_OWNER_NAME "ledmgr"
32 
33 /* @} */ // End of group LED_TYPES
34 
35 
37 {
38  protected:
39  int m_is_powered_on;
40  unsigned int m_error_flags;
41  pthread_mutex_t m_mutex;
42  std::vector <blinkPattern_t> m_patterns;
43  std::vector <indicator> m_indicators;
44  /* Detect capabilies. Make a list of indicator objects. */
45  public:
46  ledMgrBase();
47  ~ledMgrBase();
48  virtual int createBlinkPatterns();
49  const blinkPattern_t * getPattern(blinkPatternType_t pattern) const;
50  void diagnostics();
51  indicator& getIndicator(const std::string &name);
52  virtual void handleCDLEvents(unsigned int event){}
53  virtual void handleModeChange(unsigned int mode){}
54  virtual void handleGatewayConnectionEvent(unsigned int state, unsigned int error){}
55  virtual void handleDeviceReset(const unsigned int sequence){}
56  virtual void handleDeviceResetAbort(){}
57  virtual void handleKeyPress(int key_code, int key_type){}
58  void setPowerState(int state);
59  int getPowerState();
60  bool setError(unsigned int position, bool value);
61 };
62 
63 #endif /*LEDMGRBASE_H*/
ledMgrBase::setError
bool setError(unsigned int position, bool value)
This API stores the error and returns the transition state in order to call appropriate ledmgr indica...
Definition: ledmgrbase.cpp:130
blinkPatternType_t
blinkPatternType_t
Definition: fp_profile.hpp:28
ledMgrBase::getPowerState
int getPowerState()
This function used to get the power state.
Definition: ledmgrbase.cpp:113
indicator
Definition: indicator.hpp:26
ledMgrBase
Definition: ledmgrbase.hpp:36
ledMgrBase::getIndicator
indicator & getIndicator(const std::string &name)
This API search for the matching indicator and return the indicator.
Definition: ledmgrbase.cpp:51
ledMgrBase::setPowerState
void setPowerState(int state)
This function sets the power state.
Definition: ledmgrbase.cpp:101
ledMgrBase::getPattern
const blinkPattern_t * getPattern(blinkPatternType_t pattern) const
This API return the desired pattern info with respect to pattern type.
Definition: ledmgrbase.cpp:186
ledMgrBase::createBlinkPatterns
virtual int createBlinkPatterns()
This API creates blink patterns using the pattern type, duration, sequence … etc. as parameters.
Definition: ledmgrbase.cpp:169
ledMgrBase::ledMgrBase
ledMgrBase()
Constructor function performs initialization.
Definition: ledmgrbase.cpp:73
ledMgrBase::diagnostics
void diagnostics()
This API prints pattern details include id, sequence.
Definition: ledmgrbase.cpp:35
ledMgrBase::~ledMgrBase
~ledMgrBase()
Destructor API.
Definition: ledmgrbase.cpp:89