From ab1469a0b71660e0d802c7fb0b370991cfca2fe1 Mon Sep 17 00:00:00 2001 From: Lars Op den Kamp Date: Tue, 15 Nov 2011 00:21:18 +0100 Subject: [PATCH] cec: renamed enum methods. fixes potential macro collision with isset(). thanks davilla --- include/cectypes.h | 52 ++++++++++----------- src/LibCecSharp/LibCecSharp.cpp | 4 +- src/lib/AdapterCommunication.cpp | 2 +- src/lib/AdapterCommunication.h | 18 ++++---- src/lib/CECProcessor.cpp | 42 ++++++++--------- src/lib/CECProcessor.h | 2 +- src/lib/devices/CECAudioSystem.cpp | 8 ++-- src/lib/devices/CECBusDevice.cpp | 66 +++++++++++++-------------- src/lib/devices/CECPlaybackDevice.cpp | 4 +- src/testclient/main.cpp | 18 ++++---- 10 files changed, 108 insertions(+), 108 deletions(-) diff --git a/include/cectypes.h b/include/cectypes.h index 3f2fb98..c750b5e 100644 --- a/include/cectypes.h +++ b/include/cectypes.h @@ -158,13 +158,13 @@ typedef struct cec_device_type_list cec_device_type types[5]; #ifdef __cplusplus - void clear(void) + void Clear(void) { for (unsigned int iPtr = 0; iPtr < 5; iPtr++) types[iPtr] = CEC_DEVICE_TYPE_RESERVED; } - void add(const cec_device_type type) + void Add(const cec_device_type type) { for (unsigned int iPtr = 0; iPtr < 5; iPtr++) { @@ -176,7 +176,7 @@ typedef struct cec_device_type_list } } - bool isset(cec_device_type type) + bool IsSet(cec_device_type type) { bool bReturn(false); for (unsigned int iPtr = 0; !bReturn && iPtr < 5; iPtr++) @@ -187,7 +187,7 @@ typedef struct cec_device_type_list return bReturn; } - bool empty() + bool IsEmpty() { bool bReturn(true); for (unsigned int iPtr = 0; bReturn && iPtr < 5; iPtr++) @@ -518,19 +518,19 @@ typedef struct cec_logical_addresses int addresses[16]; #ifdef __cplusplus - void clear(void) + void Clear(void) { primary = CECDEVICE_UNKNOWN; for (unsigned int iPtr = 0; iPtr < 16; iPtr++) addresses[iPtr] = 0; } - bool empty(void) const + bool IsEmpty(void) const { return primary == CECDEVICE_UNKNOWN; } - uint16_t ackmask(void) const + uint16_t AckMask(void) const { uint16_t mask = 0; for (unsigned int iPtr = 0; iPtr < 16; iPtr++) @@ -539,7 +539,7 @@ typedef struct cec_logical_addresses return mask; } - void set(cec_logical_address address) + void Set(cec_logical_address address) { if (primary == CECDEVICE_UNKNOWN) primary = address; @@ -547,7 +547,7 @@ typedef struct cec_logical_addresses addresses[(int) address] = 1; } - void unset(cec_logical_address address) + void Unset(cec_logical_address address) { if (primary == address) primary = CECDEVICE_UNKNOWN; @@ -555,8 +555,8 @@ typedef struct cec_logical_addresses addresses[(int) address] = 0; } - bool isset(cec_logical_address address) const { return addresses[(int) address] == 1; } - bool operator[](uint8_t pos) const { return pos < 16 ? isset((cec_logical_address) pos) : false; } + bool IsSet(cec_logical_address address) const { return addresses[(int) address] == 1; } + bool operator[](uint8_t pos) const { return pos < 16 ? IsSet((cec_logical_address) pos) : false; } #endif } cec_logical_addresses; @@ -699,23 +699,23 @@ typedef struct cec_datapacket #ifdef __cplusplus cec_datapacket &operator =(const struct cec_datapacket &packet) { - clear(); + Clear(); for (uint8_t iPtr = 0; iPtr < packet.size; iPtr++) - push_back(packet[iPtr]); + PushBack(packet[iPtr]); return *this; } - bool empty(void) const { return size == 0; } - bool full(void) const { return size == 100; } + bool IsEmpty(void) const { return size == 0; } + bool IsFull(void) const { return size == 100; } uint8_t operator[](uint8_t pos) const { return pos < size ? data[pos] : 0; } - uint8_t at(uint8_t pos) const { return pos < size ? data[pos] : 0; } + uint8_t At(uint8_t pos) const { return pos < size ? data[pos] : 0; } - void shift(uint8_t iShiftBy) + void Shift(uint8_t iShiftBy) { if (iShiftBy >= size) { - clear(); + Clear(); } else { @@ -725,13 +725,13 @@ typedef struct cec_datapacket } } - void push_back(uint8_t add) + void PushBack(uint8_t add) { if (size < 100) data[size++] = add; } - void clear(void) + void Clear(void) { memset(data, 0, sizeof(data)); size = 0; @@ -766,9 +766,9 @@ typedef struct cec_command return *this; } - static void format(cec_command &command, cec_logical_address initiator, cec_logical_address destination, cec_opcode opcode) + static void Format(cec_command &command, cec_logical_address initiator, cec_logical_address destination, cec_opcode opcode) { - command.clear(); + command.Clear(); command.initiator = initiator; command.destination = destination; if (opcode != CEC_OPCODE_NONE) @@ -778,7 +778,7 @@ typedef struct cec_command } } - void push_back(uint8_t data) + void PushBack(uint8_t data) { if (initiator == CECDEVICE_UNKNOWN && destination == CECDEVICE_UNKNOWN) { @@ -791,10 +791,10 @@ typedef struct cec_command opcode = (cec_opcode) data; } else - parameters.push_back(data); + parameters.PushBack(data); } - void clear(void) + void Clear(void) { initiator = CECDEVICE_UNKNOWN; destination = CECDEVICE_UNKNOWN; @@ -803,7 +803,7 @@ typedef struct cec_command opcode_set = 0; opcode = CEC_OPCODE_FEATURE_ABORT; transmit_timeout = 1000; - parameters.clear(); + parameters.Clear(); }; #endif } cec_command; diff --git a/src/LibCecSharp/LibCecSharp.cpp b/src/LibCecSharp/LibCecSharp.cpp index c72e0dd..ea37291 100644 --- a/src/LibCecSharp/LibCecSharp.cpp +++ b/src/LibCecSharp/LibCecSharp.cpp @@ -421,12 +421,12 @@ public: bool Transmit(CecCommand ^ command) { cec_command ccommand; - cec_command::format(ccommand, (cec_logical_address)command->Initiator, (cec_logical_address)command->Destination, (cec_opcode)command->Opcode); + cec_command::Format(ccommand, (cec_logical_address)command->Initiator, (cec_logical_address)command->Destination, (cec_opcode)command->Opcode); ccommand.transmit_timeout = command->TransmitTimeout; ccommand.eom = command->Eom; ccommand.ack = command->Ack; for (unsigned int iPtr = 0; iPtr < command->Parameters->Size; iPtr++) - ccommand.parameters.push_back(command->Parameters->Data[iPtr]); + ccommand.parameters.PushBack(command->Parameters->Data[iPtr]); return m_libCec->Transmit(ccommand); } diff --git a/src/lib/AdapterCommunication.cpp b/src/lib/AdapterCommunication.cpp index 1aaf3c8..e772d35 100644 --- a/src/lib/AdapterCommunication.cpp +++ b/src/lib/AdapterCommunication.cpp @@ -64,7 +64,7 @@ CCECAdapterMessage::CCECAdapterMessage(const cec_command &command) if (command.opcode_set == 1) { push_back(MSGSTART); - push_escaped(command.parameters.empty() ? (uint8_t)MSGCODE_TRANSMIT_EOM : (uint8_t)MSGCODE_TRANSMIT); + push_escaped(command.parameters.IsEmpty() ? (uint8_t)MSGCODE_TRANSMIT_EOM : (uint8_t)MSGCODE_TRANSMIT); push_back((uint8_t) command.opcode); push_back(MSGEND); diff --git a/src/lib/AdapterCommunication.h b/src/lib/AdapterCommunication.h index d140a1b..1fdcf05 100644 --- a/src/lib/AdapterCommunication.h +++ b/src/lib/AdapterCommunication.h @@ -58,18 +58,18 @@ namespace CEC CStdString ToString(void) const; CStdString MessageCodeAsString(void) const; - bool empty(void) const { return packet.empty(); } + bool empty(void) const { return packet.IsEmpty(); } uint8_t operator[](uint8_t pos) const { return packet[pos]; } uint8_t at(uint8_t pos) const { return packet[pos]; } uint8_t size(void) const { return packet.size; } - void clear(void) { state = ADAPTER_MESSAGE_STATE_UNKNOWN; transmit_timeout = 0; packet.clear(); } - void shift(uint8_t iShiftBy) { packet.shift(iShiftBy); } - void push_back(uint8_t add) { packet.push_back(add); } - cec_adapter_messagecode message(void) const { return packet.size >= 1 ? (cec_adapter_messagecode) (packet.at(0) & ~(MSGCODE_FRAME_EOM | MSGCODE_FRAME_ACK)) : MSGCODE_NOTHING; } - bool eom(void) const { return packet.size >= 1 ? (packet.at(0) & MSGCODE_FRAME_EOM) != 0 : false; } - bool ack(void) const { return packet.size >= 1 ? (packet.at(0) & MSGCODE_FRAME_ACK) != 0 : false; } - cec_logical_address initiator(void) const { return packet.size >= 2 ? (cec_logical_address) (packet.at(1) >> 4) : CECDEVICE_UNKNOWN; }; - cec_logical_address destination(void) const { return packet.size >= 2 ? (cec_logical_address) (packet.at(1) & 0xF) : CECDEVICE_UNKNOWN; }; + void clear(void) { state = ADAPTER_MESSAGE_STATE_UNKNOWN; transmit_timeout = 0; packet.Clear(); } + void shift(uint8_t iShiftBy) { packet.Shift(iShiftBy); } + void push_back(uint8_t add) { packet.PushBack(add); } + cec_adapter_messagecode message(void) const { return packet.size >= 1 ? (cec_adapter_messagecode) (packet.At(0) & ~(MSGCODE_FRAME_EOM | MSGCODE_FRAME_ACK)) : MSGCODE_NOTHING; } + bool eom(void) const { return packet.size >= 1 ? (packet.At(0) & MSGCODE_FRAME_EOM) != 0 : false; } + bool ack(void) const { return packet.size >= 1 ? (packet.At(0) & MSGCODE_FRAME_ACK) != 0 : false; } + cec_logical_address initiator(void) const { return packet.size >= 2 ? (cec_logical_address) (packet.At(1) >> 4) : CECDEVICE_UNKNOWN; }; + cec_logical_address destination(void) const { return packet.size >= 2 ? (cec_logical_address) (packet.At(1) & 0xF) : CECDEVICE_UNKNOWN; }; bool is_error(void) const; void push_escaped(uint8_t byte); diff --git a/src/lib/CECProcessor.cpp b/src/lib/CECProcessor.cpp index b0bf49f..33fda20 100644 --- a/src/lib/CECProcessor.cpp +++ b/src/lib/CECProcessor.cpp @@ -54,9 +54,9 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, CAdapterCommunication *serComm m_controller(controller), m_bMonitor(false) { - m_logicalAddresses.clear(); - m_logicalAddresses.set(iLogicalAddress); - m_types.clear(); + m_logicalAddresses.Clear(); + m_logicalAddresses.Set(iLogicalAddress); + m_types.Clear(); for (int iPtr = 0; iPtr <= 16; iPtr++) m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, iPtr == iLogicalAddress ? iPhysicalAddress : 0); } @@ -69,7 +69,7 @@ CCECProcessor::CCECProcessor(CLibCEC *controller, CAdapterCommunication *serComm m_controller(controller), m_bMonitor(false) { - m_logicalAddresses.clear(); + m_logicalAddresses.Clear(); for (int iPtr = 0; iPtr < 16; iPtr++) { switch(iPtr) @@ -151,7 +151,7 @@ bool CCECProcessor::TryLogicalAddress(cec_logical_address address, unsigned int AddLog(CEC_LOG_NOTICE, strLog); /* only set our OSD name and active source for the primary device */ - if (m_logicalAddresses.empty()) + if (m_logicalAddresses.IsEmpty()) { m_busDevices[address]->m_strDeviceName = m_strDeviceName; m_busDevices[address]->m_bActiveSource = true; @@ -159,7 +159,7 @@ bool CCECProcessor::TryLogicalAddress(cec_logical_address address, unsigned int m_busDevices[address]->m_powerStatus = CEC_POWER_STATUS_STANDBY; m_busDevices[address]->m_cecVersion = CEC_VERSION_1_3A; - m_logicalAddresses.set(address); + m_logicalAddresses.Set(address); // TODO m_busDevices[address]->SetPhysicalAddress((uint16_t)CEC_DEFAULT_PHYSICAL_ADDRESS + ((uint16_t)iIndex * 0x100)); @@ -206,7 +206,7 @@ bool CCECProcessor::FindLogicalAddressAudioSystem(unsigned int iIndex) bool CCECProcessor::FindLogicalAddresses(void) { bool bReturn(true); - m_logicalAddresses.clear(); + m_logicalAddresses.Clear(); CStdString strLog; for (unsigned int iPtr = 0; iPtr < 5; iPtr++) @@ -237,7 +237,7 @@ void *CCECProcessor::Process(void) CCECAdapterMessage msg; { - if (m_logicalAddresses.empty() && !FindLogicalAddresses()) + if (m_logicalAddresses.IsEmpty() && !FindLogicalAddresses()) { CLockObject lock(&m_mutex); m_controller->AddLog(CEC_LOG_ERROR, "could not detect our logical addressed"); @@ -245,7 +245,7 @@ void *CCECProcessor::Process(void) return NULL; } - SetAckMask(m_logicalAddresses.ackmask()); + SetAckMask(m_logicalAddresses.AckMask()); { CLockObject lock(&m_mutex); @@ -257,7 +257,7 @@ void *CCECProcessor::Process(void) while (!IsStopped()) { - command.clear(); + command.Clear(); msg.clear(); { @@ -376,7 +376,7 @@ bool CCECProcessor::SetInactiveView(void) if (!IsRunning()) return false; - if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary]) + if (!m_logicalAddresses.IsEmpty() && m_busDevices[m_logicalAddresses.primary]) return m_busDevices[m_logicalAddresses.primary]->TransmitInactiveView(); return false; } @@ -401,8 +401,8 @@ bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress) strLog.Format("<< setting primary logical address to %1x", iLogicalAddress); m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str()); m_logicalAddresses.primary = iLogicalAddress; - m_logicalAddresses.set(iLogicalAddress); - return SetAckMask(m_logicalAddresses.ackmask()); + m_logicalAddresses.Set(iLogicalAddress); + return SetAckMask(m_logicalAddresses.AckMask()); } return true; @@ -424,7 +424,7 @@ bool CCECProcessor::SetMenuState(cec_menu_state state, bool bSendUpdate /* = tru bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress) { - if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary]) + if (!m_logicalAddresses.IsEmpty() && m_busDevices[m_logicalAddresses.primary]) { m_busDevices[m_logicalAddresses.primary]->SetPhysicalAddress(iPhysicalAddress); return SetActiveView(); @@ -442,7 +442,7 @@ bool CCECProcessor::SwitchMonitoring(bool bEnable) if (bEnable) return SetAckMask(0); else - return SetAckMask(m_logicalAddresses.ackmask()); + return SetAckMask(m_logicalAddresses.AckMask()); } bool CCECProcessor::PollDevice(cec_logical_address iAddress) @@ -561,9 +561,9 @@ void CCECProcessor::TransmitAbort(cec_logical_address address, cec_opcode opcode cec_command command; // TODO - cec_command::format(command, m_logicalAddresses.primary, address, CEC_OPCODE_FEATURE_ABORT); - command.parameters.push_back((uint8_t)opcode); - command.parameters.push_back((uint8_t)reason); + cec_command::Format(command, m_logicalAddresses.primary, address, CEC_OPCODE_FEATURE_ABORT); + command.parameters.PushBack((uint8_t)opcode); + command.parameters.PushBack((uint8_t)reason); Transmit(command); } @@ -624,7 +624,7 @@ bool CCECProcessor::ParseMessage(const CCECAdapterMessage &msg) { case MSGCODE_FRAME_START: { - m_currentframe.clear(); + m_currentframe.Clear(); if (msg.size() >= 2) { m_currentframe.initiator = msg.initiator(); @@ -638,7 +638,7 @@ bool CCECProcessor::ParseMessage(const CCECAdapterMessage &msg) { if (msg.size() >= 2) { - m_currentframe.push_back(msg[1]); + m_currentframe.PushBack(msg[1]); m_currentframe.eom = msg.eom(); } bEom = msg.eom(); @@ -665,7 +665,7 @@ void CCECProcessor::ParseCommand(cec_command &command) uint16_t CCECProcessor::GetPhysicalAddress(void) const { - if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary]) + if (!m_logicalAddresses.IsEmpty() && m_busDevices[m_logicalAddresses.primary]) return m_busDevices[m_logicalAddresses.primary]->GetPhysicalAddress(); return false; } diff --git a/src/lib/CECProcessor.h b/src/lib/CECProcessor.h index 8f8e892..3037501 100644 --- a/src/lib/CECProcessor.h +++ b/src/lib/CECProcessor.h @@ -66,7 +66,7 @@ namespace CEC virtual cec_power_status GetDevicePowerStatus(cec_logical_address iAddress); virtual cec_logical_address GetLogicalAddress(void) const { return m_logicalAddresses.primary; } virtual cec_logical_addresses GetLogicalAddresses(void) const { return m_logicalAddresses; } - virtual bool HasLogicalAddress(cec_logical_address address) const { return m_logicalAddresses.isset(address); } + virtual bool HasLogicalAddress(cec_logical_address address) const { return m_logicalAddresses.IsSet(address); } virtual uint16_t GetPhysicalAddress(void) const; virtual bool SetActiveView(void); diff --git a/src/lib/devices/CECAudioSystem.cpp b/src/lib/devices/CECAudioSystem.cpp index d6c6f70..67d25d6 100644 --- a/src/lib/devices/CECAudioSystem.cpp +++ b/src/lib/devices/CECAudioSystem.cpp @@ -90,8 +90,8 @@ bool CCECAudioSystem::TransmitAudioStatus(cec_logical_address dest) AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_REPORT_AUDIO_STATUS); - command.parameters.push_back((uint8_t) m_audioStatus); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_REPORT_AUDIO_STATUS); + command.parameters.PushBack((uint8_t) m_audioStatus); return m_processor->Transmit(command); } @@ -103,8 +103,8 @@ bool CCECAudioSystem::TransmitSystemAudioModeStatus(cec_logical_address dest) AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS); - command.parameters.push_back((uint8_t) m_systemAudioStatus); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS); + command.parameters.PushBack((uint8_t) m_systemAudioStatus); return m_processor->Transmit(command); } diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index ca91ba7..d4d3814 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -100,7 +100,7 @@ void CCECBusDevice::PollVendorId(void) m_iLastCommandSent = GetTimeMs(); cec_command command; - cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID); + cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID); if (m_processor->Transmit(command)) m_condition.Wait(&m_mutex, 1000); } @@ -119,7 +119,7 @@ bool CCECBusDevice::PowerOn(void) SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON); cec_command command; - cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_IMAGE_VIEW_ON); + cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_IMAGE_VIEW_ON); return m_processor->Transmit(command); } @@ -134,7 +134,7 @@ bool CCECBusDevice::Standby(void) AddLog(CEC_LOG_DEBUG, strLog.c_str()); cec_command command; - cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_STANDBY); + cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_STANDBY); return m_processor->Transmit(command); } @@ -151,7 +151,7 @@ cec_version CCECBusDevice::GetCecVersion(void) strLog.Format("<< requesting CEC version of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress); AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_CEC_VERSION); + cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_CEC_VERSION); CLockObject lock(&m_mutex); if (m_processor->Transmit(command)) m_condition.Wait(&m_mutex, 1000); @@ -176,7 +176,7 @@ cec_menu_language &CCECBusDevice::GetMenuLanguage(void) strLog.Format("<< requesting menu language of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress); AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_MENU_LANGUAGE); + cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_MENU_LANGUAGE); CLockObject lock(&m_mutex); if (m_processor->Transmit(command)) m_condition.Wait(&m_mutex, 1000); @@ -206,7 +206,7 @@ cec_power_status CCECBusDevice::GetPowerStatus(void) strLog.Format("<< requesting power status of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress); AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS); + cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS); CLockObject lock(&m_mutex); if (m_processor->Transmit(command)) m_condition.Wait(&m_mutex, 1000); @@ -226,7 +226,7 @@ const cec_vendor_id CCECBusDevice::GetVendorId(void) strLog.Format("<< requesting vendor ID of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress); AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID); + cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID); CLockObject lock(&m_mutex); if (m_processor->Transmit(command)) @@ -380,9 +380,9 @@ bool CCECBusDevice::TransmitActiveSource(void) AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE); - command.parameters.push_back((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF)); - command.parameters.push_back((uint8_t) (m_iPhysicalAddress & 0xFF)); + cec_command::Format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE); + command.parameters.PushBack((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF)); + command.parameters.PushBack((uint8_t) (m_iPhysicalAddress & 0xFF)); return m_processor->Transmit(command); } @@ -403,8 +403,8 @@ bool CCECBusDevice::TransmitCECVersion(cec_logical_address dest) AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_CEC_VERSION); - command.parameters.push_back((uint8_t)m_cecVersion); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_CEC_VERSION); + command.parameters.PushBack((uint8_t)m_cecVersion); return m_processor->Transmit(command); } @@ -416,9 +416,9 @@ bool CCECBusDevice::TransmitInactiveView(void) AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_INACTIVE_SOURCE); - command.parameters.push_back((m_iPhysicalAddress >> 8) & 0xFF); - command.parameters.push_back(m_iPhysicalAddress & 0xFF); + cec_command::Format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_INACTIVE_SOURCE); + command.parameters.PushBack((m_iPhysicalAddress >> 8) & 0xFF); + command.parameters.PushBack(m_iPhysicalAddress & 0xFF); return m_processor->Transmit(command); } @@ -430,8 +430,8 @@ bool CCECBusDevice::TransmitMenuState(cec_logical_address dest) AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_MENU_STATUS); - command.parameters.push_back((uint8_t)m_menuState); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_MENU_STATUS); + command.parameters.PushBack((uint8_t)m_menuState); return m_processor->Transmit(command); } @@ -443,9 +443,9 @@ bool CCECBusDevice::TransmitOSDName(cec_logical_address dest) AddLog(CEC_LOG_NOTICE, strLog.c_str()); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_SET_OSD_NAME); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_SET_OSD_NAME); for (unsigned int iPtr = 0; iPtr < m_strDeviceName.length(); iPtr++) - command.parameters.push_back(m_strDeviceName.at(iPtr)); + command.parameters.PushBack(m_strDeviceName.at(iPtr)); return m_processor->Transmit(command); } @@ -457,14 +457,14 @@ bool CCECBusDevice::TransmitOSDString(cec_logical_address dest, cec_display_cont AddLog(CEC_LOG_NOTICE, strLog.c_str()); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_SET_OSD_STRING); - command.parameters.push_back((uint8_t)duration); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_SET_OSD_STRING); + command.parameters.PushBack((uint8_t)duration); unsigned int iLen = strlen(strMessage); if (iLen > 13) iLen = 13; for (unsigned int iPtr = 0; iPtr < iLen; iPtr++) - command.parameters.push_back(strMessage[iPtr]); + command.parameters.PushBack(strMessage[iPtr]); return m_processor->Transmit(command); } @@ -476,10 +476,10 @@ bool CCECBusDevice::TransmitPhysicalAddress(void) AddLog(CEC_LOG_NOTICE, strLog.c_str()); cec_command command; - cec_command::format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS); - command.parameters.push_back((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF)); - command.parameters.push_back((uint8_t) (m_iPhysicalAddress & 0xFF)); - command.parameters.push_back((uint8_t) (m_type)); + cec_command::Format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS); + command.parameters.PushBack((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF)); + command.parameters.PushBack((uint8_t) (m_iPhysicalAddress & 0xFF)); + command.parameters.PushBack((uint8_t) (m_type)); return m_processor->Transmit(command); } @@ -496,7 +496,7 @@ bool CCECBusDevice::TransmitPoll(cec_logical_address dest) AddLog(CEC_LOG_NOTICE, strLog.c_str()); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_NONE); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_NONE); CLockObject lock(&m_mutex); bReturn = m_processor->Transmit(command); @@ -511,8 +511,8 @@ bool CCECBusDevice::TransmitPowerState(cec_logical_address dest) AddLog(CEC_LOG_NOTICE, strLog.c_str()); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_REPORT_POWER_STATUS); - command.parameters.push_back((uint8_t) m_powerStatus); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_REPORT_POWER_STATUS); + command.parameters.PushBack((uint8_t) m_powerStatus); return m_processor->Transmit(command); } @@ -535,11 +535,11 @@ bool CCECBusDevice::TransmitVendorID(cec_logical_address dest) AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID); - command.parameters.push_back((uint8_t) (((uint64_t)m_vendor >> 16) & 0xFF)); - command.parameters.push_back((uint8_t) (((uint64_t)m_vendor >> 8) & 0xFF)); - command.parameters.push_back((uint8_t) ((uint64_t)m_vendor & 0xFF)); + command.parameters.PushBack((uint8_t) (((uint64_t)m_vendor >> 16) & 0xFF)); + command.parameters.PushBack((uint8_t) (((uint64_t)m_vendor >> 8) & 0xFF)); + command.parameters.PushBack((uint8_t) ((uint64_t)m_vendor & 0xFF)); return m_processor->Transmit(command); } diff --git a/src/lib/devices/CECPlaybackDevice.cpp b/src/lib/devices/CECPlaybackDevice.cpp index 02b9d43..98ec750 100644 --- a/src/lib/devices/CECPlaybackDevice.cpp +++ b/src/lib/devices/CECPlaybackDevice.cpp @@ -75,8 +75,8 @@ bool CCECPlaybackDevice::TransmitDeckStatus(cec_logical_address dest) AddLog(CEC_LOG_NOTICE, strLog); cec_command command; - cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_DECK_STATUS); - command.push_back((uint8_t)m_deckStatus); + cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_DECK_STATUS); + command.PushBack((uint8_t)m_deckStatus); return m_processor->Transmit(command); } diff --git a/src/testclient/main.cpp b/src/testclient/main.cpp index de9f903..2e35dce 100644 --- a/src/testclient/main.cpp +++ b/src/testclient/main.cpp @@ -269,7 +269,7 @@ void ShowHelpConsole(void) int main (int argc, char *argv[]) { cec_device_type_list typeList; - typeList.clear(); + typeList.Clear(); int iArgPtr = 1; bool bSingleCommand(false); @@ -327,25 +327,25 @@ int main (int argc, char *argv[]) { if (!bSingleCommand) cout << "== using device type 'playback device'" << endl; - typeList.add(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); + typeList.Add(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); } else if (!strcmp(argv[iArgPtr + 1], "r")) { if (!bSingleCommand) cout << "== using device type 'recording device'" << endl; - typeList.add(CEC_DEVICE_TYPE_RECORDING_DEVICE); + typeList.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE); } else if (!strcmp(argv[iArgPtr + 1], "t")) { if (!bSingleCommand) cout << "== using device type 'tuner'" << endl; - typeList.add(CEC_DEVICE_TYPE_TUNER); + typeList.Add(CEC_DEVICE_TYPE_TUNER); } else if (!strcmp(argv[iArgPtr + 1], "a")) { if (!bSingleCommand) cout << "== using device type 'audio system'" << endl; - typeList.add(CEC_DEVICE_TYPE_AUDIO_SYSTEM); + typeList.Add(CEC_DEVICE_TYPE_AUDIO_SYSTEM); } else { @@ -385,11 +385,11 @@ int main (int argc, char *argv[]) } } - if (typeList.empty()) + if (typeList.IsEmpty()) { if (!bSingleCommand) cout << "No device type given. Using 'playback device'" << endl; - typeList.add(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); + typeList.Add(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); } ICECAdapter *parser = LibCecInit("CECTester", typeList); @@ -489,10 +489,10 @@ int main (int argc, char *argv[]) string strvalue; uint8_t ivalue; cec_command bytes; - bytes.clear(); + bytes.Clear(); while (GetWord(input, strvalue) && HexStrToInt(strvalue, ivalue)) - bytes.push_back(ivalue); + bytes.PushBack(ivalue); if (command == "txn") bytes.transmit_timeout = 0; -- 2.34.1