* @see cec_set_osd_string
*/
virtual bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage) = 0;
+
+ /*!
+ * @see cec_switch_monitoring
+ */
+ virtual bool SwitchMonitoring(bool bEnable) = 0;
};
};
extern DECLSPEC int cec_set_osd_string(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
#endif
+extern DECLSPEC int cec_switch_monitoring(int bEnable);
+
#ifdef __cplusplus
};
#endif
#define MSGESC 0xFD
#define ESCOFFSET 3
#define CEC_MIN_VERSION 6
-#define CEC_LIB_VERSION 7
+#define CEC_LIB_VERSION 8
#define CEC_BUTTON_TIMEOUT 500
#ifdef __cplusplus
m_iLogicalAddress(iLogicalAddress),
m_strDeviceName(strDeviceName),
m_communication(serComm),
- m_controller(controller)
+ m_controller(controller),
+ m_bMonitor(false)
{
for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
m_vendorIds[iPtr] = CEC_VENDOR_UNKNOWN;
return Transmit(command);
}
+bool CCECProcessor::SwitchMonitoring(bool bEnable)
+{
+ CStdString strLog;
+ strLog.Format("== %s monitoring mode ==", bEnable ? "enabling" : "disabling");
+ m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str());
+
+ m_bMonitor = bEnable;
+ if (bEnable)
+ return m_communication && m_communication->SetAckMask(0);
+ else
+ return m_communication && m_communication->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress);
+}
+
bool CCECProcessor::TransmitFormatted(const cec_adapter_message &data, bool bWaitForAck /* = true */)
{
CLockObject lock(&m_mutex);
}
m_controller->AddLog(CEC_LOG_DEBUG, dataStr.c_str());
+ if (m_bMonitor)
+ return;
+
if (command.destination == m_iLogicalAddress)
{
switch(command.opcode)
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);
+ virtual bool SwitchMonitoring(bool bEnable);
static const char *CECVendorIdToString(const uint64_t iVendorId);
CLibCEC *m_controller;
uint64_t m_vendorIds[16];
uint8_t m_vendorClasses[16];
+ bool m_bMonitor;
};
};
return m_cec ? m_cec->SetOSDString(iLogicalAddress, duration, strMessage) : false;
}
+bool CLibCEC::SwitchMonitoring(bool bEnable)
+{
+ return m_cec ? m_cec->SwitchMonitoring(bEnable) : false;
+}
+
void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
{
if (m_cec)
virtual bool SetActiveView(void);
virtual bool SetInactiveView(void);
virtual bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
+ virtual bool SwitchMonitoring(bool bEnable);
//@}
virtual void AddLog(cec_log_level level, const std::string &strMessage);
return -1;
}
+int cec_switch_monitoring(int bEnable)
+{
+ if (cec_parser)
+ return cec_parser->SwitchMonitoring(bEnable == 1) ? 1 : 0;
+ return -1;
+}
+
//@}
using namespace CEC;
using namespace std;
-#define CEC_TEST_CLIENT_VERSION 7
+#define CEC_TEST_CLIENT_VERSION 8
#include <cecloader.h>
"osd {addr} {string} set OSD message on the specified device." << endl <<
"[osd 0 Test Message] displays 'Test Message' on the TV" << endl <<
endl <<
+ "[mon] {1|0} enable or disable CEC bus monitoring." << 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->PingAdapter();
}
+ else if (command == "mon")
+ {
+ CStdString strEnable;
+ if (GetWord(input, strEnable) && (strEnable.Equals("0") || strEnable.Equals("1")))
+ {
+ parser->SwitchMonitoring(strEnable.Equals("1"));
+ }
+ }
else if (command == "bl")
{
parser->StartBootloader();