*/
virtual cec_logical_addresses GetLogicalAddresses(void) = 0;
+ /*!
+ * @brief Get libCEC's current configuration.
+ * @param configuration The configuration.
+ * @return True when the configuration was updated, false otherwise.
+ */
+ virtual bool GetCurrentConfiguration(libcec_configuration *configuration) = 0;
+
virtual const char *ToString(const cec_menu_state state) = 0;
virtual const char *ToString(const cec_version version) = 0;
virtual const char *ToString(const cec_power_status status) = 0;
#endif
#ifdef __cplusplus
-extern DECLSPEC int cec_initialise(CEC::libcec_configuration *configuration);
+extern DECLSPEC int cec_initialise(const CEC::libcec_configuration *configuration);
#else
-extern DECLSPEC int cec_initialise(libcec_configuration *configuration);
+extern DECLSPEC int cec_initialise(const libcec_configuration *configuration);
#endif
#ifdef __cplusplus
extern DECLSPEC cec_logical_addresses cec_get_logical_addresses(void);
#endif
+#ifdef __cplusplus
+extern DECLSPEC int cec_get_current_configuration(CEC::libcec_configuration *configuration);
+#else
+extern DECLSPEC int cec_get_current_configuration(libcec_configuration *configuration);
+#endif
+
+
#ifdef __cplusplus
};
#endif
return 1;
bool bAddressOk(false);
- uint16_t iAddress(0xFFFF);
while (!bAddressOk)
{
- iAddress = FindPhysicalAddress();
+ uint16_t iAddress = FindPhysicalAddress();
PrintToStdOut("Physical address: %4X", iAddress);
PrintToStdOut("Is this correct (y/n)?");
getline(cin, input);
cin.clear();
bAddressOk = (input == "y" || input == "Y");
+ g_config.iPhysicalAddress = iAddress;
}
PrintToStdOut("=== USB-CEC Adapter Configuration Summary ===\n");
bool bHasAudiosystem = g_parser->IsActiveDevice(CECDEVICE_AUDIOSYSTEM);
- PrintToStdOut("Physical address: %4X", iAddress);
+ PrintToStdOut("Physical address: %4X", g_config.iPhysicalAddress);
g_parser->StandbyDevices();
g_parser->Close();
// stream path changes are sent by the TV
return m_busDevices[CECDEVICE_TV]->GetHandler()->TransmitSetStreamPath(iPhysicalAddress);
}
+
+bool CCECProcessor::GetCurrentConfiguration(libcec_configuration *configuration)
+{
+ configuration->iPhysicalAddress = m_iPhysicalAddress;
+ configuration->iHDMIPort = m_iHDMIPort;
+ configuration->baseDevice = m_iBaseDevice;
+ snprintf(configuration->strDeviceName, 13, m_strDeviceName.c_str());
+ configuration->deviceTypes = m_types;
+ return true;
+}
virtual bool EnablePhysicalAddressDetection(void) { return false; };
void SetStandardLineTimeout(uint8_t iTimeout);
void SetRetryLineTimeout(uint8_t iTimeout);
+ virtual bool GetCurrentConfiguration(libcec_configuration *configuration);
bool SetLineTimeout(uint8_t iTimeout);
{
return m_cec->ToString(version);
}
+
+bool CLibCEC::GetCurrentConfiguration(libcec_configuration *configuration)
+{
+ return m_cec->GetCurrentConfiguration(configuration);
+}
\ No newline at end of file
virtual bool SetStreamPath(cec_logical_address iAddress);
virtual bool SetStreamPath(uint16_t iPhysicalAddress);
virtual cec_logical_addresses GetLogicalAddresses(void);
+ virtual bool GetCurrentConfiguration(libcec_configuration *configuration);
const char *ToString(const cec_menu_state state);
const char *ToString(const cec_version version);
return addr;
}
+int cec_get_current_configuration(libcec_configuration *configuration)
+{
+ return cec_parser ? (cec_parser->GetCurrentConfiguration(configuration) ? 1 : 0) : -1;
+}
+
//@}