本文整理汇总了C++中ola::ToHex方法的典型用法代码示例。如果您正苦于以下问题:C++ ola::ToHex方法的具体用法?C++ ola::ToHex怎么用?C++ ola::ToHex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ola
的用法示例。
在下文中一共展示了ola::ToHex方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessTuple
/**
* This processes each (control, data) tuple according to the state machine
*/
void RDMSniffer::ProcessTuple(uint8_t control_byte, uint8_t data_byte) {
if (control_byte & DATA_MASK) {
// this is an actual byte of data
switch (m_state) {
case IDLE:
case MAB:
m_state = DATA;
m_frame.Reset();
case DATA:
m_frame.AddByte(data_byte);
break;
default:
OLA_WARN << "Unknown transition from state " << m_state
<< ", with data " << ToHex(control_byte) << " "
<< ToHex(data_byte);
}
} else {
// control byte
if (data_byte == 0) {
switch (m_state) {
case BREAK:
m_state = MAB;
break;
default:
OLA_WARN << "Unknown transition from state " << m_state
<< ", with data " << ToHex(control_byte) << " "
<< ToHex(data_byte);
}
} else if (data_byte == 1) {
switch (m_state) {
case IDLE:
m_state = BREAK;
break;
case DATA:
ProcessFrame();
m_state = BREAK;
break;
default:
OLA_WARN << "Unknown transition from state " << m_state
<< ", with data " << ToHex(control_byte) << " "
<< ToHex(data_byte);
}
} else if (data_byte == 2) {
switch (m_state) {
case IDLE:
case BREAK:
case MAB:
break;
case DATA:
m_state = IDLE;
ProcessFrame();
}
} else {
OLA_WARN << "Unknown transition from state " << m_state
<< ", with data " << ToHex(control_byte) << " "
<< ToHex(data_byte);
}
}
}
示例2: DisplayAlternateFrame
/**
* Display a non (DMX/RDM) frame
*/
void RDMSniffer::DisplayAlternateFrame() {
unsigned int slot_count = m_frame.Size() - 1;
MaybePrintTimestamp();
cout << "SC " << ToHex(m_frame[0]) << " " << slot_count << ":";
unsigned int slots_to_display = std::min(
slot_count,
static_cast<unsigned int>(m_options.dmx_slot_limit));
DisplayRawData(1, slots_to_display);
}
示例3: DisplayRawData
/**
* Dump out the raw data if we couldn't parse it correctly.
*/
void RDMSniffer::DisplayRawData(unsigned int start, unsigned int end) {
for (unsigned int i = start; i <= end; i++) {
cout << ToHex(m_frame[i], false) << " ";
}
cout << endl;
}