- /* open a new connection */
- if (!m_communication->Open(strPort, iBaudRate, iTimeoutMs))
- {
- m_controller->AddLog(CEC_LOG_ERROR, "could not open a connection");
+ return bReturn;
+}
+
+bool CCECProcessor::Initialise(void)
+{
+ bool bReturn(false);
+ CLockObject lock(m_mutex);
+ if (!m_logicalAddresses.IsEmpty())
+ m_logicalAddresses.Clear();
+
+ if (!FindLogicalAddresses())
+ {
+ m_controller->AddLog(CEC_LOG_ERROR, "could not detect our logical addresses");
+ return bReturn;
+ }
+
+ /* only set our OSD name for the primary device */
+ m_busDevices[m_logicalAddresses.primary]->m_strDeviceName = m_strDeviceName;
+
+ /* get the vendor id from the TV, so we are using the correct handler */
+ m_busDevices[CECDEVICE_TV]->RequestVendorId();
+ ReplaceHandlers();
+
+ if ((bReturn = SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true)) == false)
+ {
+ CStdString strLog;
+ strLog.Format("unable to set the correct HDMI port (HDMI %d on %s(%x)", m_iHDMIPort, ToString(m_iBaseDevice), (uint8_t)m_iBaseDevice);
+ m_controller->AddLog(CEC_LOG_ERROR, strLog);
+ }
+ else
+ m_bInitialised = true;
+
+ return bReturn;
+}
+
+bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = 38400 */, uint32_t iTimeoutMs /* = 10000 */)
+{
+ bool bReturn(false);
+
+ {
+ CLockObject lock(m_mutex);
+ if (!OpenConnection(strPort, iBaudRate, iTimeoutMs))