CEC_VENDOR_SAMSUNG = 0x00F0,
CEC_VENDOR_LG = 0xE091,
CEC_VENDOR_UNKNOWN = 0
-} vendor_id;
+} cec_vendor_id;
+
+typedef struct cec_vendor
+{
+ const char *AsString(void) const
+ {
+ switch (vendor)
+ {
+ case CEC_VENDOR_SAMSUNG:
+ return "Samsung";
+ case CEC_VENDOR_LG:
+ return "LG";
+ default:
+ return "Unknown";
+ }
+ }
+
+ cec_vendor_id vendor;
+} cec_vendor;
//default physical address 1.0.0.0, HDMI port 1
#define CEC_DEFAULT_PHYSICAL_ADDRESS 0x1000
m_iLogicalAddress(iLogicalAddress),
m_powerStatus(CEC_POWER_STATUS_UNKNOWN),
m_processor(processor),
- m_iVendorId(0),
m_iVendorClass(CEC_VENDOR_UNKNOWN),
m_iLastActive(0),
m_cecVersion(CEC_VERSION_UNKNOWN)
m_menuLanguage.language[iPtr] = '?';
m_menuLanguage.language[3] = 0;
m_menuLanguage.device = iLogicalAddress;
+ m_vendor.vendor = CEC_VENDOR_UNKNOWN;
}
CCECBusDevice::~CCECBusDevice(void)
void CCECBusDevice::SetVendorId(uint64_t iVendorId, uint8_t iVendorClass /* = 0 */)
{
- m_iVendorId = iVendorId;
+ m_vendor.vendor = (cec_vendor_id)iVendorId;
m_iVendorClass = iVendorClass;
switch (iVendorId)
return true;
}
-uint64_t CCECBusDevice::GetVendorId(void)
+const cec_vendor &CCECBusDevice::GetVendor(void)
{
- if (m_iVendorId == CEC_VENDOR_UNKNOWN)
+ if (m_vendor.vendor == CEC_VENDOR_UNKNOWN)
{
AddLog(CEC_LOG_NOTICE, "<< requesting vendor ID");
cec_command command;
m_condition.Wait(&m_mutex, 1000);
}
- return m_iVendorId;
+ return m_vendor;
}
void CCECBusDevice::PollVendorId(void)
{
CLockObject lock(&m_mutex);
if (m_iLastActive > 0 && m_iLogicalAddress != CECDEVICE_BROADCAST &&
- m_iVendorId == CEC_VENDOR_UNKNOWN &&
+ m_vendor.vendor == CEC_VENDOR_UNKNOWN &&
GetTimeMs() - m_iLastActive > 5000)
{
m_iLastActive = GetTimeMs();
return m_powerStatus;
}
-
-const char *CCECBusDevice::CECVendorIdToString(const uint64_t iVendorId)
-{
- switch (iVendorId)
- {
- case CEC_VENDOR_SAMSUNG:
- return "Samsung";
- case CEC_VENDOR_LG:
- return "LG";
- default:
- return "Unknown";
- }
-}
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 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 uint64_t GetLastActive(void) const { return m_iLastActive; }
virtual cec_logical_address GetLogicalAddress(void) const { return m_iLogicalAddress; }
virtual bool BroadcastPhysicalAddress(void);
virtual bool BroadcastActiveSource(void);
- static const char *CECVendorIdToString(const uint64_t iVendorId);
-
protected:
uint16_t m_iPhysicalAddress;
cec_logical_address m_iLogicalAddress;
cec_menu_language m_menuLanguage;
CCECProcessor *m_processor;
CCECCommandHandler *m_handler;
- uint64_t m_iVendorId;
+ cec_vendor m_vendor;
uint8_t m_iVendorClass;
uint64_t m_iLastActive;
cec_version m_cecVersion;