* @see cec_get_device_menu_language
*/
virtual bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language) = 0;
+
+ /*!
+ * @see cec_get_device_vendor_id
+ */
+ virtual uint64_t GetDeviceVendorId(cec_logical_address iAddress) = 0;
};
};
#ifdef __cplusplus
extern DECLSPEC int cec_get_device_menu_language(CEC::cec_logical_address iLogicalAddress, CEC::cec_menu_language *language);
#else
-extern DECLSPEC cec_version cec_get_device_menu_language(cec_logical_address iLogicalAddress, cec_menu_language *language);
+extern DECLSPEC int cec_get_device_menu_language(cec_logical_address iLogicalAddress, cec_menu_language *language);
#endif
+
+/*!
+ * @brief Get the vendor ID of the device with the given logical address.
+ * @param iLogicalAddress The device to get the vendor id for.
+ * @return The vendor ID or 0 if it wasn't found.
+ */
+#ifdef __cplusplus
+extern DECLSPEC uint64_t cec_get_device_vendor_id(CEC::cec_logical_address iLogicalAddress);
+#else
+extern DECLSPEC uint64_t cec_get_device_vendor_id(cec_logical_address iLogicalAddress);
+#endif
+
#ifdef __cplusplus
};
#endif
return (strcmp(language->language, "???"));
}
+uint64_t CCECProcessor::GetDeviceVendorId(cec_logical_address iAddress)
+{
+ return m_busDevices[iAddress]->GetVendorId();
+}
+
bool CCECProcessor::Transmit(const cec_command &data)
{
bool bReturn(false);
virtual bool SwitchMonitoring(bool bEnable);
virtual cec_version GetDeviceCecVersion(cec_logical_address iAddress);
virtual bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language);
+ virtual uint64_t GetDeviceVendorId(cec_logical_address iAddress);
virtual cec_logical_address GetLogicalAddress(void) const { return m_iLogicalAddress; }
virtual uint16_t GetPhysicalAddress(void) const;
return false;
}
+uint64_t CLibCEC::GetDeviceVendorId(cec_logical_address iAddress)
+{
+ if (m_cec && iAddress >= CECDEVICE_TV && iAddress < CECDEVICE_BROADCAST)
+ return m_cec->GetDeviceVendorId(iAddress);
+ return 0;
+}
+
+
void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
{
if (m_cec)
virtual bool SwitchMonitoring(bool bEnable);
virtual cec_version GetDeviceCecVersion(cec_logical_address iAddress);
virtual bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language);
+ virtual uint64_t GetDeviceVendorId(cec_logical_address iAddress);
//@}
virtual void AddLog(cec_log_level level, const std::string &strMessage);
return -1;
}
+uint64_t cec_get_device_vendor_id(cec_logical_address iLogicalAddress)
+{
+ if (cec_parser)
+ return cec_parser->GetDeviceVendorId(iLogicalAddress);
+ return 0;
+}
+
//@}
return true;
}
+uint64_t CCECBusDevice::GetVendorId(void)
+{
+ if (m_iVendorId == CEC_VENDOR_UNKNOWN)
+ {
+ AddLog(CEC_LOG_NOTICE, "<< requesting vendor ID");
+ cec_command command;
+ cec_command::format(command, GetMyLogicalAddress(), GetLogicalAddress(), CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
+ CLockObject lock(&m_mutex);
+
+ if (m_processor->Transmit(command))
+ m_condition.Wait(&m_mutex, 1000);
+ }
+
+ return m_iVendorId;
+}
+
void CCECBusDevice::PollVendorId(void)
{
CLockObject lock(&m_mutex);
CCECBusDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress = 0);
virtual ~CCECBusDevice(void);
+ virtual cec_logical_address GetMyLogicalAddress(void) const;
+ virtual uint16_t GetMyPhysicalAddress(void) const;
+ virtual const char * GetVendorName(void) const { return CECVendorIdToString(m_iVendorId); }
+ virtual uint64_t GetVendorId(void);
+ virtual uint8_t GetVendorClass(void) const { return m_iVendorClass; }
+ 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 void SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress = 0);
+ virtual uint16_t GetPhysicalAddress(void) const { return m_iPhysicalAddress; }
+ virtual cec_version GetCecVersion(void);
+ virtual cec_menu_language & GetMenuLanguage(void);
- virtual cec_logical_address GetMyLogicalAddress(void) const;
- virtual uint16_t GetMyPhysicalAddress(void) const;
+ virtual bool PowerOn(void);
+ virtual bool Standby(void);
+ virtual bool SetOSDString(cec_display_control duration, const char *strMessage);
+ virtual void PollVendorId(void);
+ virtual void SetPhysicalAddress(uint16_t iNewAddress, uint16_t iOldAddress = 0);
virtual void SetCecVersion(cec_version newVersion);
virtual void SetMenuLanguage(const cec_menu_language &menuLanguage);
virtual void SetVendorId(const cec_datapacket &data);
virtual void SetVendorId(uint64_t iVendorId, uint8_t iVendorClass = 0);
- virtual const char *GetVendorName(void) const { return CECVendorIdToString(m_iVendorId); }
- virtual uint64_t GetVendorId(void) const { return m_iVendorId; }
- virtual uint8_t GetVendorClass(void) const { return m_iVendorClass; }
-
- virtual uint64_t GetLastActive(void) const { return m_iLastActive; }
virtual bool HandleCommand(const cec_command &command);
virtual CCECProcessor *GetProcessor() const { return m_processor; }
virtual CCECCommandHandler *GetHandler(void) const { return m_handler; };
- virtual cec_version GetCecVersion(void);
- virtual cec_menu_language &GetMenuLanguage(void);
- virtual void PollVendorId(void);
- virtual bool PowerOn(void);
- virtual bool Standby(void);
- virtual bool SetOSDString(cec_display_control duration, const char *strMessage);
virtual bool ReportCECVersion(void);
virtual bool ReportDeckStatus(void);
virtual bool ReportMenuState(bool bActive = true);
"ver {addr} get the CEC version of the specified device." << endl <<
"[ver 0] get the CEC version of the TV" << endl <<
endl <<
- "lang {addr get the menu language of the specified device." << endl <<
+ "ven {addr} get the vendor ID of the specified device." << endl <<
+ "[ven 0] get the vendor ID of the TV" << endl <<
+ endl <<
+ "lang {addr} get the menu language of the specified device." << endl <<
"[lang 0] get the menu language of the TV" << endl <<
endl <<
"[mon] {1|0} enable or disable CEC bus monitoring." << endl <<
}
}
}
+ else if (command == "ven")
+ {
+ CStdString strDev;
+ if (GetWord(input, strDev))
+ {
+ int iDev = atoi(strDev);
+ if (iDev >= 0 && iDev < 15)
+ {
+ uint64_t iVendor = parser->GetDeviceVendorId((cec_logical_address) iDev);
+ CStdString strLog;
+ strLog.Format("vendor id: %06x", iVendor);
+ cout << strLog.c_str() << endl;
+ }
+ }
+ }
else if (command == "ver")
{
CStdString strDev;