RDK Documentation (Open Sourced RDK Components)
ledmgr_types.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 LEDMGR_TYPES_H
20 #define LEDMGR_TYPES_H
21 #include <stdio.h>
22 
23 #define LOG(level, text, ...) do {\
24  printf("%s[%d] - %s: " text, __FUNCTION__, __LINE__, level, ##__VA_ARGS__);}while(0);
25 
26 #define ERROR(text, ...) do {\
27  printf("%s[%d] - %s: " text, __FUNCTION__, __LINE__, "ERROR", ##__VA_ARGS__);}while(0);
28 #define INFO(text, ...) do {\
29  printf("%s[%d] - %s: " text, __FUNCTION__, __LINE__, "INFO", ##__VA_ARGS__);}while(0);
30 
31 #ifdef DEBUG
32 #define DEBUG(text, ...) do {\
33  printf("%s[%d] - %s: " text, __FUNCTION__, __LINE__, "DEBUG", ##__VA_ARGS__);}while(0);
34 #else
35 #define DEBUG(text, ...)
36 #endif
37 
38 #define REPORT_IF_UNEQUAL(lhs, rhs) do {\
39  if((lhs) != (rhs)) LOG("ERROR", "Unexpected error!\n");}while(0);
40 
41 /**
42  * @addtogroup LED_TYPES
43  * @{
44  */
45 typedef enum
46 {
47  STATE_STEADY_ON = 0,
48  STATE_STEADY_OFF,
49  STATE_BLINKING,
50  STATE_UNKNOWN,
51 }indicatorState_t;
52 
53 typedef struct
54 {
55  unsigned int length; /**< milliseconds */
56  bool isOn;
57 }blinkOp_t;
58 
59 typedef struct
60 {
61  unsigned int id;
62  unsigned char num_sequences;
63  blinkOp_t * sequence; /**< Array of {duration, intensity} values in a defined sequence */
65 
66 /* @} */ // End of group LED_TYPES
67 
68 
69 #endif /*LEDMGR_TYPES_H*/
blinkPattern_t::sequence
blinkOp_t * sequence
Definition: ledmgr_types.hpp:63
blinkOp_t::length
unsigned int length
Definition: ledmgr_types.hpp:55