* @see cec_set_inactive_view
*/
virtual bool SetInactiveView(void) = 0;
+
+ /*!
+ * @see cec_set_osd_string
+ */
+ virtual bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage) = 0;
};
};
*/
extern DECLSPEC int cec_set_physical_address(uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS);
+/*!
+ * @brief Display a message on the TV.
+ * @brief The message to display.
+ * @return True when the command was sent, false otherwise.
+ */
+#ifdef __cplusplus
+extern DECLSPEC int cec_set_osd_string(CEC::cec_logical_address iLogicalAddress, CEC::cec_display_control duration, const char *strMessage);
+#else
+extern DECLSPEC int cec_set_osd_string(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
+#endif
+
#ifdef __cplusplus
};
#endif
CEC_DEVICE_TYPE_AUDIO_SYSTEM = 5
} ECecDeviceType;
-typedef enum
+typedef enum cec_display_control
{
CEC_DISPLAY_CONTROL_DISPLAY_FOR_DEFAULT_TIME = 0x00,
CEC_DISPLAY_CONTROL_DISPLAY_UNTIL_CLEARED = 0x40,
CEC_DISPLAY_CONTROL_CLEAR_PREVIOUS_MESSAGE = 0x80,
CEC_DISPLAY_CONTROL_RESERVED_FOR_FUTURE_USE = 0xC0
-} ECecDisplayControl;
+} cec_display_control;
typedef enum
{
return SetActiveView();
}
+bool CCECProcessor::SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage)
+{
+ CStdString strLog;
+ strLog.Format("<< display message '%s'", strMessage);
+ m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str());
+
+ cec_command command;
+ cec_command::format(command, m_iLogicalAddress, iLogicalAddress, CEC_OPCODE_SET_OSD_STRING);
+ command.parameters.push_back((uint8_t)duration);
+
+ for (unsigned int iPtr = 0; iPtr < strlen(strMessage); iPtr++)
+ command.parameters.push_back(strMessage[iPtr]);
+
+ return Transmit(command);
+}
+
bool CCECProcessor::TransmitFormatted(const cec_adapter_message &data, bool bWaitForAck /* = true */)
{
CLockObject lock(&m_mutex);
virtual bool Transmit(const cec_command &data, bool bWaitForAck = true);
virtual bool SetLogicalAddress(cec_logical_address iLogicalAddress);
virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress);
+ virtual bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
static const char *CECVendorIdToString(const uint64_t iVendorId);
return m_cec ? m_cec->SetInactiveView() : false;
}
+bool CLibCEC::SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage)
+{
+ return m_cec ? m_cec->SetOSDString(iLogicalAddress, duration, strMessage) : false;
+}
+
void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
{
if (m_cec)
virtual bool StandbyDevices(cec_logical_address address = CECDEVICE_BROADCAST);
virtual bool SetActiveView(void);
virtual bool SetInactiveView(void);
+ virtual bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
//@}
virtual void AddLog(cec_log_level level, const std::string &strMessage);
return -1;
}
+int cec_set_osd_string(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage)
+{
+ if (cec_parser)
+ return cec_parser->SetOSDString(iLogicalAddress, duration, strMessage) ? 1 : 0;
+ return -1;
+}
+
//@}
"pa {physical_address} change the physical address of the CEC adapter." << endl <<
"[pa 10 00] physical address 1.0.0.0" << endl <<
endl <<
+ "osd {addr} {string} set OSD message on the specified device." << endl <<
+ "[osd 0 Test Message] displays 'Test Message' on the TV" << endl <<
+ endl <<
"[ping] send a ping command to the CEC adapter." << endl <<
"[bl] to let the adapter enter the bootloader, to upgrade" << endl <<
" the flash rom." << endl <<
parser->SetPhysicalAddress(iPhysicalAddress);
}
}
+ else if (command == "osd")
+ {
+ bool bFirstWord(false);
+ string strAddr, strMessage, strWord;
+ uint8_t iAddr;
+ if (GetWord(input, strAddr) && HexStrToInt(strAddr, iAddr) && iAddr < 0xF)
+ {
+ while (GetWord(input, strWord))
+ {
+ if (bFirstWord)
+ {
+ bFirstWord = false;
+ strMessage.append(" ");
+ }
+ strMessage.append(strWord);
+ }
+ parser->SetOSDString((cec_logical_address) iAddr, CEC_DISPLAY_CONTROL_DISPLAY_FOR_DEFAULT_TIME, strMessage.c_str());
+ }
+ }
else if (command == "ping")
{
parser->PingAdapter();