* @return True when the keypress was acked, false otherwise.
*/
virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = false) = 0;
+
+ /*!
+ * @brief Get the OSD name of a device on the CEC bus.
+ * @param iAddress The device to get the OSD name for.
+ * @return The OSD name.
+ */
+ virtual cec_osd_name GetOSDName(cec_logical_address iAddress) = 0;
};
};
extern DECLSPEC int cec_send_key_release(cec_logical_address iDestination, int bWait);
#endif
+#ifdef __cplusplus
+extern DECLSPEC CEC::cec_osd_name cec_get_osd_name(CEC::cec_logical_address iAddress);
+#else
+extern DECLSPEC cec_osd_name cec_get_osd_name(cec_logical_address iAddress);
+#endif
#ifdef __cplusplus
};
cec_logical_address device;
} cec_menu_language;
+typedef struct cec_osd_name
+{
+ char name[14];
+ cec_logical_address device;
+} cec_osd_name;
+
typedef struct cec_log_message
{
char message[1024];
if (device && device->GetStatus() == CEC_DEVICE_STATUS_PRESENT)
{
device->GetPhysicalAddress();
- device->GetVendorId();
device->GetCecVersion();
- device->GetPowerStatus();
+ device->GetVendorId();
}
}
}
return m_busDevices[iAddress]->GetCecVersion();
}
+cec_osd_name CCECProcessor::GetDeviceOSDName(cec_logical_address iAddress)
+{
+ CStdString strOSDName = m_busDevices[iAddress]->GetOSDName();
+ cec_osd_name retVal;
+
+ snprintf(retVal.name, sizeof(retVal.name), "%s", strOSDName.c_str());
+ retVal.device = iAddress;
+
+ return retVal;
+}
+
bool CCECProcessor::GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language)
{
if (m_busDevices[iAddress])
virtual cec_version GetDeviceCecVersion(cec_logical_address iAddress);
virtual bool GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language);
virtual const std::string & GetDeviceName(void) { return m_strDeviceName; }
+ virtual cec_osd_name GetDeviceOSDName(cec_logical_address iAddress);
virtual uint64_t GetDeviceVendorId(cec_logical_address iAddress);
virtual cec_power_status GetDevicePowerStatus(cec_logical_address iAddress);
virtual cec_logical_address GetLogicalAddress(void) const { return m_logicalAddresses.primary; }
return false;
}
+cec_osd_name CLibCEC::GetOSDName(cec_logical_address iAddress)
+{
+ cec_osd_name retVal;
+ retVal.device = iAddress;
+ retVal.name[0] = 0;
+
+ if (m_cec)
+ retVal = m_cec->GetDeviceOSDName(iAddress);
+
+ return retVal;
+}
+
void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
{
if (m_cec)
virtual uint8_t MuteAudio(bool bWait = true);
virtual bool SendKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait = false);
virtual bool SendKeyRelease(cec_logical_address iDestination, bool bWait = false);
+ virtual cec_osd_name GetOSDName(cec_logical_address iAddress);
//@}
virtual void AddLog(cec_log_level level, const std::string &strMessage);
return -1;
}
+cec_osd_name cec_get_osd_name(cec_logical_address iAddress)
+{
+ cec_osd_name retVal;
+ retVal.device = iAddress;
+ retVal.name[0] = 0;
+
+ if (cec_parser)
+ retVal = cec_parser->GetOSDName(iAddress);
+
+ return retVal;
+}
+
//@}
return m_processor->GetPhysicalAddress();
}
+CStdString CCECBusDevice::GetOSDName(void)
+{
+ if (GetStatus() == CEC_DEVICE_STATUS_PRESENT)
+ {
+ CLockObject lock(&m_mutex);
+ if (m_strDeviceName.Equals(ToString(m_iLogicalAddress)))
+ {
+ lock.Leave();
+ RequestOSDName();
+ lock.Lock();
+ }
+ }
+
+ CLockObject lock(&m_mutex);
+ return m_strDeviceName;
+}
+
+bool CCECBusDevice::RequestOSDName(void)
+{
+ bool bReturn(false);
+ if (!MyLogicalAddressContains(m_iLogicalAddress))
+ {
+ CStdString strLog;
+ strLog.Format("<< requesting OSD name of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
+ AddLog(CEC_LOG_NOTICE, strLog);
+ cec_command command;
+ cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_OSD_NAME);
+ CLockObject lock(&m_transmitMutex);
+ if (m_processor->Transmit(command))
+ bReturn = m_condition.Wait(&m_transmitMutex, 1000);
+ }
+ return bReturn;
+}
+
uint16_t CCECBusDevice::GetPhysicalAddress(bool bRefresh /* = true */)
{
if (GetStatus() == CEC_DEVICE_STATUS_PRESENT)
virtual cec_menu_language & GetMenuLanguage(void);
virtual cec_logical_address GetMyLogicalAddress(void) const;
virtual uint16_t GetMyPhysicalAddress(void) const;
+ virtual CStdString GetOSDName(void);
virtual uint16_t GetPhysicalAddress(bool bRefresh = true);
virtual cec_power_status GetPowerStatus(void);
virtual CCECProcessor * GetProcessor(void) const { return m_processor; }
bool RequestPowerStatus(void);
bool RequestVendorId(void);
bool RequestPhysicalAddress(void);
+ bool RequestOSDName(void);
virtual void SetInactiveDevice(void);
virtual void SetActiveDevice(void);
"[ven] {addr} get the vendor ID of the specified device." << endl <<
"[lang] {addr} get the menu language of the specified device." << endl <<
"[pow] {addr} get the power status of the specified device." << endl <<
+ "[name] {addr} get the OSD name of the specified device." << endl <<
"[poll] {addr} poll the specified device." << endl <<
"[lad] lists active devices on the bus" << endl <<
"[ad] {addr} checks whether the specified device is active." << endl <<
}
}
}
+ else if (command == "name")
+ {
+ CStdString strDev;
+ if (GetWord(input, strDev))
+ {
+ int iDev = atoi(strDev);
+ if (iDev >= 0 && iDev < 15)
+ {
+ cec_osd_name name = parser->GetOSDName((cec_logical_address)iDev);
+ cout << "OSD name of device " << iDev << " is '" << name.name << "'" << endl;
+ }
+ }
+ }
else if (command == "lad")
{
cout << "listing active devices:" << endl;