20 #include "ledmgrbase.hpp"
23 static blinkOp_t g_blink_pattern_slow_blink[] = {{500,
true}, {1000,
false}};
24 static blinkOp_t g_blink_pattern_double_blink[] = {{200,
true}, {100,
false}, {200,
true}, {1000,
false}};
25 static blinkOp_t g_blink_pattern_fast_blink[] = {{200,
true}, {100,
false}};
37 std::cout<<
"Size of the pattern list is "<<m_patterns.size()<<
"\n";
38 for(
int i = 0; i < m_patterns.size(); i++)
40 DEBUG(
"%x -- %x -- 0x%x\n", m_patterns[i].
id, m_patterns[i].num_sequences, (
unsigned int)m_patterns[i].sequence);
53 std::vector <indicator>::iterator iter;
54 for(iter = m_indicators.begin(); iter != m_indicators.end(); iter++)
56 if(0 == name.compare(iter->getName()))
62 if(iter == m_indicators.end())
64 ERROR(
"No matching indicator found!\n")
65 throw std::invalid_argument(
"No matching indicator found!");
75 m_is_powered_on =
false;
77 pthread_mutexattr_t mutex_attribute;
78 REPORT_IF_UNEQUAL(0, pthread_mutexattr_init(&mutex_attribute));
79 REPORT_IF_UNEQUAL(0, pthread_mutexattr_settype(&mutex_attribute, PTHREAD_MUTEX_ERRORCHECK));
80 REPORT_IF_UNEQUAL(0, pthread_mutex_init(&m_mutex, &mutex_attribute));
91 pthread_mutex_destroy(&m_mutex);
103 REPORT_IF_UNEQUAL(0, pthread_mutex_lock(&m_mutex));
104 m_is_powered_on = state;
105 REPORT_IF_UNEQUAL(0, pthread_mutex_unlock(&m_mutex));
116 REPORT_IF_UNEQUAL(0, pthread_mutex_lock(&m_mutex));
117 state = m_is_powered_on;
118 REPORT_IF_UNEQUAL(0, pthread_mutex_unlock(&m_mutex));
134 bool transition_detected =
false;
136 REPORT_IF_UNEQUAL(0, pthread_mutex_lock(&m_mutex));
139 if(0 == m_error_flags)
142 transition_detected =
true;
144 m_error_flags |= (0x01 << position);
148 unsigned int prev_flags = m_error_flags;
149 m_error_flags &= (0xFFFFFFFE << position);
150 if((0 != prev_flags) && (0 == m_error_flags))
153 transition_detected =
true;
156 REPORT_IF_UNEQUAL(0, pthread_mutex_unlock(&m_mutex));
157 return transition_detected;
161 ERROR(
"Position marker too large!\n");
188 return &m_patterns[type];