From: Lars Op den Kamp Date: Sun, 6 Nov 2011 12:58:07 +0000 (+0100) Subject: cec: rename SetOSDString() to TransmitOSDString() + more cosmetics X-Git-Tag: upstream/2.2.0~1^2~101 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=38bdb94305cac92a7ac8ea31e2c1533dc17fb8dc;p=deb_libcec.git cec: rename SetOSDString() to TransmitOSDString() + more cosmetics --- diff --git a/src/lib/LibCEC.cpp b/src/lib/LibCEC.cpp index 7c87a8f..7fd3e6c 100644 --- a/src/lib/LibCEC.cpp +++ b/src/lib/LibCEC.cpp @@ -188,7 +188,9 @@ bool CLibCEC::SetInactiveView(void) bool CLibCEC::SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage) { - return m_cec && iLogicalAddress >= CECDEVICE_TV && iLogicalAddress <= CECDEVICE_BROADCAST ? m_cec->m_busDevices[(uint8_t)iLogicalAddress]->SetOSDString(duration, strMessage) : false; + return m_cec && iLogicalAddress >= CECDEVICE_TV && iLogicalAddress <= CECDEVICE_BROADCAST ? + m_cec->m_busDevices[m_cec->GetLogicalAddress()]->TransmitOSDString(iLogicalAddress, duration, strMessage) : + false; } bool CLibCEC::SwitchMonitoring(bool bEnable) diff --git a/src/lib/devices/CECBusDevice.cpp b/src/lib/devices/CECBusDevice.cpp index c3e45ec..6003565 100644 --- a/src/lib/devices/CECBusDevice.cpp +++ b/src/lib/devices/CECBusDevice.cpp @@ -242,25 +242,6 @@ void CCECBusDevice::SetMenuLanguage(const cec_menu_language &language) } } -bool CCECBusDevice::SetOSDString(cec_display_control duration, const char *strMessage) -{ - CStdString strLog; - strLog.Format("<< display message '%s'", strMessage); - AddLog(CEC_LOG_NOTICE, strLog.c_str()); - - cec_command command; - cec_command::format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_SET_OSD_STRING); - command.parameters.push_back((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]); - - return m_processor->Transmit(command); -} - void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */) { if (iNewAddress > 0) @@ -427,6 +408,25 @@ bool CCECBusDevice::TransmitOSDName(cec_logical_address dest) return m_processor->Transmit(command); } +bool CCECBusDevice::TransmitOSDString(cec_logical_address dest, cec_display_control duration, const char *strMessage) +{ + CStdString strLog; + strLog.Format("<< display message '%s'", strMessage); + 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); + + unsigned int iLen = strlen(strMessage); + if (iLen > 13) iLen = 13; + + for (unsigned int iPtr = 0; iPtr < iLen; iPtr++) + command.parameters.push_back(strMessage[iPtr]); + + return m_processor->Transmit(command); +} + bool CCECBusDevice::TransmitPhysicalAddress(void) { CStdString strLog; diff --git a/src/lib/devices/CECBusDevice.h b/src/lib/devices/CECBusDevice.h index 333d299..6959166 100644 --- a/src/lib/devices/CECBusDevice.h +++ b/src/lib/devices/CECBusDevice.h @@ -48,24 +48,27 @@ namespace CEC CCECBusDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0); virtual ~CCECBusDevice(void); - virtual bool MyLogicalAddressContains(cec_logical_address address) const; - virtual cec_logical_address GetMyLogicalAddress(void) const; - virtual uint16_t GetMyPhysicalAddress(void) const; - virtual const char * GetVendorName(void) { return GetVendor().AsString(); } - virtual cec_vendor_id GetVendorId(void) { return GetVendor().vendor; }; - virtual const cec_vendor & GetVendor(void); - virtual uint8_t GetVendorClass(void) const { return m_iVendorClass; } + virtual void AddLog(cec_log_level level, const CStdString &strMessage); + virtual bool HandleCommand(const cec_command &command); + virtual void PollVendorId(void); + virtual bool PowerOn(void); + virtual bool Standby(void); + + virtual cec_version GetCecVersion(bool bRefresh = true); + virtual CCECCommandHandler *GetHandler(void) const { return m_handler; }; virtual uint64_t GetLastActive(void) const { return m_iLastActive; } virtual cec_logical_address GetLogicalAddress(void) const { return m_iLogicalAddress; } - virtual uint16_t GetPhysicalAddress(void) const { return m_iPhysicalAddress; } - virtual cec_version GetCecVersion(bool bRefresh = true); virtual cec_menu_language & GetMenuLanguage(bool bRefresh = true); + virtual cec_logical_address GetMyLogicalAddress(void) const; + virtual uint16_t GetMyPhysicalAddress(void) const; + virtual uint16_t GetPhysicalAddress(void) const { return m_iPhysicalAddress; } virtual cec_power_status GetPowerStatus(bool bRefresh = true); - - virtual bool PowerOn(void); - virtual bool Standby(void); - virtual bool SetOSDString(cec_display_control duration, const char *strMessage); - virtual void PollVendorId(void); + virtual CCECProcessor * GetProcessor() const { return m_processor; } + virtual const cec_vendor & GetVendor(void); + virtual uint8_t GetVendorClass(void) const { return m_iVendorClass; } + virtual cec_vendor_id GetVendorId(void) { return GetVendor().vendor; }; + virtual const char * GetVendorName(void) { return GetVendor().AsString(); } + virtual bool MyLogicalAddressContains(cec_logical_address address) const; virtual void SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress = 0); virtual void SetCecVersion(const cec_version newVersion); @@ -74,25 +77,19 @@ namespace CEC virtual void SetVendorId(uint64_t iVendorId, uint8_t iVendorClass = 0); virtual void SetPowerStatus(const cec_power_status powerStatus); - virtual bool HandleCommand(const cec_command &command); - - virtual void AddLog(cec_log_level level, const CStdString &strMessage); - virtual CCECProcessor *GetProcessor() const { return m_processor; } - virtual CCECCommandHandler *GetHandler(void) const { return m_handler; }; - + virtual bool TransmitActiveSource(void); + virtual bool TransmitActiveView(void); virtual bool TransmitCECVersion(cec_logical_address dest); virtual bool TransmitDeckStatus(cec_logical_address dest); + virtual bool TransmitInactiveView(void); virtual bool TransmitMenuState(cec_logical_address dest); virtual bool TransmitOSDName(cec_logical_address dest); + virtual bool TransmitOSDString(cec_logical_address dest, cec_display_control duration, const char *strMessage); + virtual bool TransmitPhysicalAddress(void); virtual bool TransmitPowerState(cec_logical_address dest); virtual bool TransmitPoll(cec_logical_address dest); virtual bool TransmitVendorID(cec_logical_address dest); - virtual bool TransmitActiveView(void); - virtual bool TransmitInactiveView(void); - virtual bool TransmitPhysicalAddress(void); - virtual bool TransmitActiveSource(void); - protected: cec_device_type m_type; CStdString m_strDeviceName;