virtual bool StartBootloader(void) = 0;
//@}
- /*!
- * @return Get the minimal version of libcec that this version of libcec can interface with.
- */
- virtual int8_t GetMinLibVersion(void) const = 0;
-
- /*!
- * @return Get the major version of libcec.
- */
- virtual int8_t GetLibVersionMajor(void) const = 0;
-
- /*!
- * @return Get the minor version of libcec.
- */
- virtual int8_t GetLibVersionMinor(void) const = 0;
-
- /*!
- * @brief Get the next log message in the queue, if there is one.
- * @param message The next message.
- * @return True if a message was passed, false otherwise.
- */
- virtual bool GetNextLogMessage(cec_log_message *message) = 0;
-
- /*!
- * @brief Get the next keypress in the queue, if there is one.
- * @param key The next keypress.
- * @return True if a key was passed, false otherwise.
- */
- virtual bool GetNextKeypress(cec_keypress *key) = 0;
-
- /*!
- * @brief Get the next CEC command that was received by the adapter.
- * @param action The next command.
- * @return True when a command was passed, false otherwise.
- */
- virtual bool GetNextCommand(cec_command *command) = 0;
-
/*!
* @brief Transmit a command over the CEC line.
* @param data The command to send.
*/
virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress = CEC_DEFAULT_PHYSICAL_ADDRESS) = 0;
- /*!
- * @deprecated Use libcec_configuration instead.
- * @brief Enable physical address detection (if the connected adapter supports this).
- * @return True when physical address detection was enabled, false otherwise.
- */
- virtual bool EnablePhysicalAddressDetection(void) = 0;
-
/*!
* @brief Changes the active HDMI port.
* @param iBaseDevice The device to which this libcec is connected.
*/
virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED) = 0;
- /*!
- * @deprecated Use SetActiveSource() instead
- */
- virtual bool SetActiveView(void) = 0;
-
/*!
* @brief Change the deck control mode, if this adapter is registered as playback device.
* @param mode The new control mode.
*/
virtual cec_logical_addresses GetActiveDevices(void) = 0;
+ /*!
+ * @brief Tell libCEC to poll for active devices on the bus.
+ */
+ virtual void RescanActiveDevices(void) = 0;
+
/*!
* @brief Check whether a device is active on the bus.
* @param iAddress The address to check.
virtual const char *ToString(const cec_audio_status status) = 0;
virtual const char *ToString(const cec_vendor_id vendor) = 0;
virtual const char *ToString(const cec_client_version version) = 0;
+ virtual const char *ToString(const cec_server_version version) = 0;
+
+ ////// deprecated methods, may be removed in a future version //////
+
+ /*!
+ * @deprecated Use libcec_configuration instead.
+ * @brief Enable physical address detection (if the connected adapter supports this).
+ * @return True when physical address detection was enabled, false otherwise.
+ */
+ virtual bool EnablePhysicalAddressDetection(void) = 0;
+
+ /*!
+ * @deprecated Use SetActiveSource() instead
+ */
+ virtual bool SetActiveView(void) = 0;
+
+ /*!
+ * @deprecated Use libcec_configuration instead
+ * @return Get the minimal version of libcec that this version of libcec can interface with.
+ */
+ virtual int8_t GetMinLibVersion(void) const = 0;
+
+ /*!
+ * @deprecated Use libcec_configuration instead
+ * @return Get the major version of libcec.
+ */
+ virtual int8_t GetLibVersionMajor(void) const = 0;
+
+ /*!
+ * @deprecated Use libcec_configuration instead
+ * @return Get the minor version of libcec.
+ */
+ virtual int8_t GetLibVersionMinor(void) const = 0;
+
+ /*!
+ * @deprecated Use callback methods instead
+ * @brief Get the next log message in the queue, if there is one.
+ * @param message The next message.
+ * @return True if a message was passed, false otherwise.
+ */
+ virtual bool GetNextLogMessage(cec_log_message *message) = 0;
+
+ /*!
+ * @deprecated Use callback methods instead
+ * @brief Get the next keypress in the queue, if there is one.
+ * @param key The next keypress.
+ * @return True if a key was passed, false otherwise.
+ */
+ virtual bool GetNextKeypress(cec_keypress *key) = 0;
+
+ /*!
+ * @deprecated Use callback methods instead
+ * @brief Get the next CEC command that was received by the adapter.
+ * @param action The next command.
+ * @return True when a command was passed, false otherwise.
+ */
+ virtual bool GetNextCommand(cec_command *command) = 0;
+
};
};
* @param configuration The configuration to pass to libCEC
* @return An instance of ICECAdapter or NULL on error.
*/
-extern "C" DECLSPEC void * CECInitialise(const CEC::libcec_configuration *configuration);
+extern "C" DECLSPEC void * CECInitialise(CEC::libcec_configuration *configuration);
/*!
* @brief Unload the CEC adapter library.
#endif
#ifdef __cplusplus
-extern DECLSPEC int cec_initialise(const CEC::libcec_configuration *configuration);
+extern DECLSPEC int cec_initialise(CEC::libcec_configuration *configuration);
#else
-extern DECLSPEC int cec_initialise(const libcec_configuration *configuration);
+extern DECLSPEC int cec_initialise(libcec_configuration *configuration);
#endif
#ifdef __cplusplus
extern DECLSPEC int cec_start_bootloader(void);
-extern DECLSPEC int8_t cec_get_min_lib_version(void);
-
-extern DECLSPEC int8_t cec_get_lib_version_major(void);
-
-extern DECLSPEC int8_t cec_get_lib_version_minor(void);
-
#ifdef __cplusplus
extern DECLSPEC int cec_power_on_devices(CEC::cec_logical_address address);
#else
extern DECLSPEC int cec_standby_devices(cec_logical_address address);
#endif
-extern DECLSPEC int cec_set_active_view(void);
-
#ifdef __cplusplus
extern DECLSPEC int cec_set_active_source(CEC::cec_device_type type);
#else
extern DECLSPEC int cec_set_menu_state(cec_menu_state state, int bSendUpdate);
#endif
-#ifdef __cplusplus
-extern DECLSPEC int cec_get_next_log_message(CEC::cec_log_message *message);
-#else
-extern DECLSPEC int cec_get_next_log_message(cec_log_message *message);
-#endif
-
-#ifdef __cplusplus
-extern DECLSPEC int cec_get_next_keypress(CEC::cec_keypress *key);
-#else
-extern DECLSPEC int cec_get_next_keypress(cec_keypress *key);
-#endif
-
-#ifdef __cplusplus
-extern DECLSPEC int cec_get_next_command(CEC::cec_command *command);
-#else
-extern DECLSPEC int cec_get_next_command(cec_command *command);
-#endif
-
#ifdef __cplusplus
extern DECLSPEC int cec_transmit(const CEC::cec_command *data);
#else
extern DECLSPEC cec_osd_name cec_get_device_osd_name(cec_logical_address iAddress);
#endif
-extern DECLSPEC int cec_enable_physical_address_detection(void);
-
#ifdef __cplusplus
extern DECLSPEC int cec_set_stream_path_logical(CEC::cec_logical_address iAddress);
#else
extern DECLSPEC int cec_set_configuration(const libcec_configuration *configuration);
#endif
+extern DECLSPEC void cec_rescan_devices(void);
+
+////// deprecated methods, may be removed in a future version //////
+
+extern DECLSPEC int cec_enable_physical_address_detection(void);
+
+extern DECLSPEC int cec_set_active_view(void);
+
+extern DECLSPEC int8_t cec_get_min_lib_version(void);
+
+extern DECLSPEC int8_t cec_get_lib_version_major(void);
+
+extern DECLSPEC int8_t cec_get_lib_version_minor(void);
+
+#ifdef __cplusplus
+extern DECLSPEC int cec_get_next_log_message(CEC::cec_log_message *message);
+#else
+extern DECLSPEC int cec_get_next_log_message(cec_log_message *message);
+#endif
+
+#ifdef __cplusplus
+extern DECLSPEC int cec_get_next_keypress(CEC::cec_keypress *key);
+#else
+extern DECLSPEC int cec_get_next_keypress(cec_keypress *key);
+#endif
+
+#ifdef __cplusplus
+extern DECLSPEC int cec_get_next_command(CEC::cec_command *command);
+#else
+extern DECLSPEC int cec_get_next_command(cec_command *command);
+#endif
+
#ifdef __cplusplus
};
#endif
* @param strLib The name of and/or path to libCEC
* @return An instance of ICECAdapter or NULL on error.
*/
-CEC::ICECAdapter *LibCecInitialise(const CEC::libcec_configuration *configuration, const char *strLib = NULL)
+CEC::ICECAdapter *LibCecInitialise(CEC::libcec_configuration *configuration, const char *strLib = NULL)
{
if (!g_libCEC)
#if defined(_WIN64)
if (!g_libCEC)
return NULL;
- typedef void* (__cdecl*_LibCecInitialise)(const CEC::libcec_configuration *);
+ typedef void* (__cdecl*_LibCecInitialise)(CEC::libcec_configuration *);
_LibCecInitialise LibCecInitialise;
LibCecInitialise = (_LibCecInitialise) (GetProcAddress(g_libCEC, "CECInitialise"));
if (!LibCecInitialise)
* @param strLib The name of and/or path to libCEC
* @return An instance of ICECAdapter or NULL on error.
*/
-CEC::ICECAdapter *LibCecInitialise(const CEC::libcec_configuration *configuration, const char *strLib = NULL)
+CEC::ICECAdapter *LibCecInitialise(CEC::libcec_configuration *configuration, const char *strLib = NULL)
{
if (!g_libCEC)
{
}
}
- typedef void* _LibCecInitialise(const CEC::libcec_configuration *);
+ typedef void* _LibCecInitialise(CEC::libcec_configuration *);
_LibCecInitialise* LibCecInitialise = (_LibCecInitialise*) dlsym(g_libCEC, "CECInitialise");
if (!LibCecInitialise)
{
#define CEC_MIN_LIB_VERSION 1
#define CEC_LIB_VERSION_MAJOR 1
-#define CEC_LIB_VERSION_MINOR 4
+#define CEC_LIB_VERSION_MINOR 5
typedef enum cec_abort_reason
{
CEC_CLIENT_VERSION_1_5_0 = 0x1500
} cec_client_version;
+typedef enum cec_server_version
+{
+ CEC_SERVER_VERSION_PRE_1_5 = 0,
+ CEC_SERVER_VERSION_1_5_0 = 0x1500
+} cec_server_version;
+
typedef struct libcec_configuration
{
- cec_client_version clientVersion; /*!< the version of the client that is connecting */
+ uint32_t clientVersion; /*!< the version of the client that is connecting */
char strDeviceName[13]; /*!< how to name the device on the CEC bus */
cec_device_type_list deviceTypes; /*!< the CEC device types to emulate */
uint8_t bAutodetectAddress; /*!< try to autodetect the physical address when 1 */
uint16_t iPhysicalAddress; /*!< the physical address of the CEC adapter. only used when bAutodetectAddress = 0 or when the adapter doesn't support autodetection */
cec_logical_address baseDevice; /*!< the logical address of the device to which the adapter is connected. only used when iPhysicalAddress = 0 and bAutodetectAddress = 0 or when the adapter doesn't support autodetection */
uint8_t iHDMIPort; /*!< the HDMI port to which the adapter is connected. only used when iPhysicalAddress = 0 and bAutodetectAddress = 0 or when the adapter doesn't support autodetection */
- cec_vendor_id tvVendor; /*!< override the vendor ID of the TV. leave this untouched to autodetect */
+ uint64_t tvVendor; /*!< override the vendor ID of the TV. leave this untouched to autodetect */
cec_logical_addresses wakeDevices; /*!< wake these CEC devices when initialising libCEC or when calling PowerOnDevices() without any parameter */
cec_logical_addresses powerOffDevices; /*!< power off these devices when calling StandbyDevices() without any parameter */
+ uint32_t serverVersion; /*!< the version number of the server. read-only */
+
// player specific settings
uint8_t bGetSettingsFromROM; /*!< true to get the settings from the ROM (if set, and a v2 ROM is present), false to use these settings. */
uint8_t bUseTVMenuLanguage; /*!< use the menu language of the TV in the player application */
iPhysicalAddress = 0;
baseDevice = (cec_logical_address)CEC_DEFAULT_BASE_DEVICE;
iHDMIPort = CEC_DEFAULT_HDMI_PORT;
- tvVendor = CEC_VENDOR_UNKNOWN;
- clientVersion = CEC_CLIENT_VERSION_PRE_1_5;
+ tvVendor = (uint64_t)CEC_VENDOR_UNKNOWN;
+ clientVersion = (uint32_t)CEC_CLIENT_VERSION_PRE_1_5;
+ serverVersion = (uint32_t)CEC_SERVER_VERSION_PRE_1_5;
wakeDevices.Clear();
powerOffDevices.Clear();
Lib = new LibCecSharp(Config);
- Console.WriteLine("CEC Parser created - libcec version " + Lib.GetLibVersionMajor() + "." + Lib.GetLibVersionMinor());
+ Console.WriteLine("CEC Parser created - libcec version " + Lib.ToString(Config.ServerVersion));
}
public override int ReceiveCommand(CecCommand command)
public void MainLoop()
{
- Lib.PowerOnDevices(CecLogicalAddress.Tv);
- Lib.SetActiveSource(CecDeviceType.PlaybackDevice);
-
bool bContinue = true;
string command;
while (bContinue)
Version1_5_0 = 0x1500
};
+ public enum class CecServerVersion
+ {
+ VersionPre1_5 = 0,
+ Version1_5_0 = 0x1500
+ };
+
public ref class CecAdapter
{
public:
BaseDevice = (CecLogicalAddress)CEC_DEFAULT_BASE_DEVICE;
HDMIPort = CEC_DEFAULT_HDMI_PORT;
ClientVersion = CecClientVersion::VersionPre1_5;
+ ServerVersion = CecServerVersion::VersionPre1_5;
TvVendor = CecVendorId::Unknown;
GetSettingsFromROM = false;
Callbacks = callbacks;
}
+ void Update(const CEC::libcec_configuration &config)
+ {
+ DeviceName = gcnew System::String(config.strDeviceName);
+
+ for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
+ DeviceTypes->Types[iPtr] = (CecDeviceType)config.deviceTypes.types[iPtr];
+
+ AutodetectAddress = config.bAutodetectAddress == 1;
+ PhysicalAddress = config.iPhysicalAddress;
+ BaseDevice = (CecLogicalAddress)config.baseDevice;
+ HDMIPort = config.iHDMIPort;
+ ClientVersion = (CecClientVersion)config.clientVersion;
+ ServerVersion = (CecServerVersion)config.serverVersion;
+ TvVendor = (CecVendorId)config.tvVendor;
+
+ // player specific settings
+ GetSettingsFromROM = config.bGetSettingsFromROM == 1;
+ UseTVMenuLanguage = config.bUseTVMenuLanguage == 1;
+ ActivateSource = config.bActivateSource == 1;
+
+ WakeDevices->Clear();
+ for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
+ if (config.wakeDevices[iPtr])
+ WakeDevices->Set((CecLogicalAddress)iPtr);
+
+ PowerOffDevices->Clear();
+ for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
+ if (config.powerOffDevices[iPtr])
+ PowerOffDevices->Set((CecLogicalAddress)iPtr);
+
+ PowerOffScreensaver = config.bPowerOffScreensaver == 1;
+ PowerOffOnStandby = config.bPowerOffOnStandby == 1;
+ }
+
property System::String ^ DeviceName;
property CecDeviceTypeList ^ DeviceTypes;
property bool AutodetectAddress;
property CecLogicalAddress BaseDevice;
property uint8_t HDMIPort;
property CecClientVersion ClientVersion;
+ property CecServerVersion ServerVersion;
property CecVendorId TvVendor;
// player specific settings
if (m_bHasCallbacks)
{
LibCECConfiguration ^netConfig = gcnew LibCECConfiguration();
- netConfig->DeviceName = gcnew System::String(config.strDeviceName);
- for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
- netConfig->DeviceTypes->Types[iPtr] = (CecDeviceType)config.deviceTypes.types[iPtr];
-
- netConfig->PhysicalAddress = config.iPhysicalAddress;
- netConfig->BaseDevice = (CecLogicalAddress)config.baseDevice;
- netConfig->HDMIPort = config.iHDMIPort;
- netConfig->ClientVersion = (CecClientVersion)config.clientVersion;
- netConfig->GetSettingsFromROM = config.bGetSettingsFromROM == 1;
- netConfig->ActivateSource = config.bActivateSource == 1;
-
- netConfig->WakeDevices->Clear();
- for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
- if (config.wakeDevices[iPtr])
- netConfig->WakeDevices->Set((CecLogicalAddress)iPtr);
-
- netConfig->PowerOffDevices->Clear();
- for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
- if (config.powerOffDevices[iPtr])
- netConfig->PowerOffDevices->Set((CecLogicalAddress)iPtr);
-
- netConfig->PowerOffScreensaver = config.bPowerOffScreensaver == 1;
- netConfig->PowerOffOnStandby = config.bPowerOffOnStandby == 1;
-
+ netConfig->Update(config);
iReturn = m_callbacks->ConfigurationChanged(netConfig);
}
return iReturn;
ConvertConfiguration(context, config, libCecConfig);
m_libCec = (ICECAdapter *) CECInitialise(&libCecConfig);
+ config->Update(libCecConfig);
+
delete context;
return m_libCec != NULL;
return (CecPowerStatus) m_libCec->GetDevicePowerStatus((cec_logical_address) logicalAddress);
}
+ void RescanActiveDevices(void)
+ {
+ m_libCec->RescanActiveDevices();
+ }
+
CecLogicalAddresses ^ GetActiveDevices(void)
{
CecLogicalAddresses ^ retVal = gcnew CecLogicalAddresses();
if (m_libCec->GetCurrentConfiguration(&config))
{
- configuration->AutodetectAddress = config.bAutodetectAddress == 1;
- configuration->BaseDevice = (CecLogicalAddress)config.baseDevice;
- configuration->DeviceName = gcnew String(config.strDeviceName);
- configuration->HDMIPort = config.iHDMIPort;
- configuration->PhysicalAddress = config.iPhysicalAddress;
- configuration->PowerOffOnStandby = config.bPowerOffOnStandby == 1;
- configuration->PowerOffScreensaver = config.bPowerOffScreensaver == 1;
- configuration->ActivateSource = config.bActivateSource == 1;
- configuration->TvVendor = (CecVendorId)config.tvVendor;
-
- configuration->WakeDevices->Clear();
- for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
- if (config.wakeDevices[iPtr])
- configuration->WakeDevices->Set((CecLogicalAddress)iPtr);
-
- configuration->PowerOffDevices->Clear();
- for (uint8_t iPtr = 0; iPtr <= 16; iPtr++)
- if (config.powerOffDevices[iPtr])
- configuration->PowerOffDevices->Set((CecLogicalAddress)iPtr);
-
- configuration->UseTVMenuLanguage = config.bUseTVMenuLanguage == 1;
- for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
- configuration->DeviceTypes->Types[iPtr] = (CecDeviceType)config.deviceTypes.types[iPtr];
+ configuration->Update(config);
return true;
}
return false;
return gcnew String(retVal);
}
+ String ^ ToString(CecClientVersion version)
+ {
+ const char *retVal = m_libCec->ToString((cec_client_version)version);
+ return gcnew String(retVal);
+ }
+
+ String ^ ToString(CecServerVersion version)
+ {
+ const char *retVal = m_libCec->ToString((cec_server_version)version);
+ return gcnew String(retVal);
+ }
+
private:
ICECAdapter * m_libCec;
};
if (!SuppressUpdates && ActiveProcess == null)
{
SetControlsEnabled(false);
- ActiveProcess = new RescanDevices();
+ ActiveProcess = new RescanDevices(ref Lib);
ActiveProcess.EventHandler += new EventHandler<UpdateEvent>(ProcessEventHandler);
(new Thread(new ThreadStart(ActiveProcess.Run))).Start();
}
SetCheckboxItemChecked(cbWakeDevices, iPtr, Config.WakeDevices.IsSet((CecLogicalAddress)iPtr));
for (int iPtr = 0; iPtr < 15; iPtr++)
SetCheckboxItemChecked(cbPowerOffDevices, iPtr, Config.PowerOffDevices.IsSet((CecLogicalAddress)iPtr));
+
+ SetControlText(this, "Pulse-Eight USB-CEC Adapter - libCEC " + Lib.ToString(Config.ServerVersion));
return 1;
}
{
class RescanDevices : UpdateProcess
{
+ public RescanDevices(ref LibCecSharp lib)
+ {
+ Lib = lib;
+ }
+
public override void Process()
{
SendEvent(UpdateEventType.ProgressBar, 10);
SendEvent(UpdateEventType.StatusText, "Polling active devices");
+ Lib.RescanActiveDevices();
+
+ SendEvent(UpdateEventType.ProgressBar, 80);
+ SendEvent(UpdateEventType.StatusText, "Refreshing device list");
SendEvent(UpdateEventType.PollDevices);
SendEvent(UpdateEventType.ProgressBar, 100);
SendEvent(UpdateEventType.StatusText, "Ready.");
}
+
+ private LibCecSharp Lib;
}
}
g_config.Clear();
snprintf(g_config.strDeviceName, 13, "CEC-config");
g_config.callbackParam = NULL;
- g_config.clientVersion = CEC_CLIENT_VERSION_1_5_0;
+ g_config.clientVersion = (uint32_t)CEC_CLIENT_VERSION_1_5_0;
g_callbacks.CBCecLogMessage = &CecLogMessage;
g_callbacks.CBCecKeyPress = &CecKeyPress;
g_callbacks.CBCecCommand = &CecCommand;
using namespace std;
using namespace PLATFORM;
-CCECProcessor::CCECProcessor(CLibCEC *controller, const libcec_configuration *configuration) :
+CCECProcessor::CCECProcessor(CLibCEC *controller, libcec_configuration *configuration) :
m_bInitialised(false),
m_communication(NULL),
m_controller(controller),
m_logicalAddresses.Clear();
CreateBusDevices();
m_configuration.Clear();
-
+ m_configuration.serverVersion = CEC_SERVER_VERSION_1_5_0;
SetConfiguration(configuration);
if (m_configuration.tvVendor != CEC_VENDOR_UNKNOWN)
m_busDevices[CECDEVICE_TV]->ReplaceHandler(false);
+
+ GetCurrentConfiguration(configuration);
}
CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, const cec_device_type_list &types, uint16_t iPhysicalAddress) :
m_iLastTransmission(0)
{
m_configuration.Clear();
+ m_configuration.serverVersion = CEC_SERVER_VERSION_1_5_0;
// client version < 1.5.0
- m_configuration.clientVersion = CEC_CLIENT_VERSION_PRE_1_5;
+ m_configuration.clientVersion = (uint32_t)CEC_CLIENT_VERSION_PRE_1_5;
snprintf(m_configuration.strDeviceName, 13, "%s", strDeviceName);
m_configuration.deviceTypes = types;
m_configuration.iPhysicalAddress = iPhysicalAddress;
}
if (bReturn)
- CLibCEC::AddLog(CEC_LOG_NOTICE, "connected to the CEC adapter. firmware version = %d, client version = %s", m_communication->GetFirmwareVersion(), ToString(m_configuration.clientVersion));
+ CLibCEC::AddLog(CEC_LOG_NOTICE, "connected to the CEC adapter. firmware version = %d, client version = %s", m_communication->GetFirmwareVersion(), ToString((cec_client_version)m_configuration.clientVersion));
return bReturn;
}
}
}
+const char *CCECProcessor::ToString(const cec_server_version version)
+{
+ switch (version)
+ {
+ case CEC_SERVER_VERSION_PRE_1_5:
+ return "pre-1.5";
+ case CEC_SERVER_VERSION_1_5_0:
+ return "1.5.0";
+ default:
+ return "Unknown";
+ }
+}
+
void *CCECBusScan::Process(void)
{
CCECBusDevice *device(NULL);
}
// just copy these
+ m_configuration.clientVersion = configuration->clientVersion;
+ m_configuration.bActivateSource = configuration->bActivateSource;
m_configuration.bGetSettingsFromROM = configuration->bGetSettingsFromROM;
m_configuration.powerOffDevices = configuration->powerOffDevices;
m_configuration.bPowerOffScreensaver = configuration->bPowerOffScreensaver;
bool CCECProcessor::GetCurrentConfiguration(libcec_configuration *configuration)
{
// client version 1.5.0
- configuration->clientVersion = m_configuration.clientVersion;
snprintf(configuration->strDeviceName, 13, "%s", m_configuration.strDeviceName);
configuration->deviceTypes = m_configuration.deviceTypes;
configuration->bAutodetectAddress = m_configuration.bAutodetectAddress;
configuration->iPhysicalAddress = m_configuration.iPhysicalAddress;
configuration->baseDevice = m_configuration.baseDevice;
configuration->iHDMIPort = m_configuration.iHDMIPort;
+ configuration->clientVersion = m_configuration.clientVersion;
+ configuration->serverVersion = m_configuration.serverVersion;
configuration->tvVendor = m_configuration.tvVendor;
- configuration->wakeDevices = m_configuration.wakeDevices;
+
configuration->bGetSettingsFromROM = m_configuration.bGetSettingsFromROM;
+ configuration->bUseTVMenuLanguage = m_configuration.bUseTVMenuLanguage;
+ configuration->bActivateSource = m_configuration.bActivateSource;
+ configuration->wakeDevices = m_configuration.wakeDevices;
configuration->powerOffDevices = m_configuration.powerOffDevices;
configuration->bPowerOffScreensaver = m_configuration.bPowerOffScreensaver;
configuration->bPowerOffOnStandby = m_configuration.bPowerOffOnStandby;
{
return m_communication->PersistConfiguration(configuration);
}
+
+void CCECProcessor::RescanActiveDevices(void)
+{
+ for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
+ m_busDevices[iPtr]->GetStatus(true);
+}
{
public:
CCECProcessor(CLibCEC *controller, const char *strDeviceName, const cec_device_type_list &types, uint16_t iPhysicalAddress);
- CCECProcessor(CLibCEC *controller, const libcec_configuration *configuration);
+ CCECProcessor(CLibCEC *controller, libcec_configuration *configuration);
virtual ~CCECProcessor(void);
virtual bool Start(const char *strPort, uint16_t iBaudRate = 38400, uint32_t iTimeoutMs = 10000);
virtual bool IsActiveSource(cec_logical_address iAddress);
virtual bool IsInitialised(void);
virtual bool SetStreamPath(uint16_t iPhysicalAddress);
- virtual cec_client_version GetClientVersion(void) const { return m_configuration.clientVersion; };
+ virtual cec_client_version GetClientVersion(void) const { return (cec_client_version)m_configuration.clientVersion; };
virtual bool StandbyDevices(cec_logical_address address = CECDEVICE_BROADCAST);
virtual bool PowerOnDevices(cec_logical_address address = CECDEVICE_BROADCAST);
virtual bool SetConfiguration(const libcec_configuration *configuration);
virtual bool CanPersistConfiguration(void);
virtual bool PersistConfiguration(libcec_configuration *configuration);
+ virtual void RescanActiveDevices(void);
bool SetLineTimeout(uint8_t iTimeout);
const char *ToString(const cec_audio_status status);
const char *ToString(const cec_vendor_id vendor);
const char *ToString(const cec_client_version version);
+ const char *ToString(const cec_server_version version);
virtual bool Transmit(const cec_command &data);
virtual void TransmitAbort(cec_logical_address address, cec_opcode opcode, cec_abort_reason reason = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE);
void CreateBusDevices(void);
void ReplaceHandlers(void);
- void ScanCECBus(void);
bool PhysicalAddressInUse(uint16_t iPhysicalAddress);
bool TryLogicalAddress(cec_logical_address address);
bool FindLogicalAddressRecordingDevice(void);
m_cec = new CCECProcessor(this, strDeviceName, types, iPhysicalAddress);
}
-CLibCEC::CLibCEC(const libcec_configuration *configuration) :
+CLibCEC::CLibCEC(libcec_configuration *configuration) :
m_iStartTime(GetTimeMs()),
m_iCurrentButton(CEC_USER_CONTROL_CODE_UNKNOWN),
m_buttontime(0),
return static_cast< void* > (lib);
}
-void * CECInitialise(const libcec_configuration *configuration)
+void * CECInitialise(libcec_configuration *configuration)
{
CLibCEC *lib = new CLibCEC(configuration);
CLibCEC::SetInstance(lib);
return m_cec->ToString(version);
}
+const char *CLibCEC::ToString(const cec_server_version version)
+{
+ return m_cec->ToString(version);
+}
+
bool CLibCEC::GetCurrentConfiguration(libcec_configuration *configuration)
{
return m_cec->GetCurrentConfiguration(configuration);
{
return m_cec->PersistConfiguration(configuration);
}
+
+void CLibCEC::RescanActiveDevices(void)
+{
+ return m_cec->RescanActiveDevices();
+}
*/
//@{
CLibCEC(const char *strDeviceName, cec_device_type_list types, uint16_t iPhysicalAddress = 0);
- CLibCEC(const libcec_configuration *configuration);
+ CLibCEC(libcec_configuration *configuration);
virtual ~CLibCEC(void);
virtual bool Open(const char *strPort, uint32_t iTimeout = 10000);
virtual bool PingAdapter(void);
virtual bool StartBootloader(void);
- virtual int8_t GetMinLibVersion(void) const{ return CEC_MIN_LIB_VERSION; };
+ virtual int8_t GetMinLibVersion(void) const { return CEC_MIN_LIB_VERSION; };
virtual int8_t GetLibVersionMajor(void) const { return CEC_LIB_VERSION_MAJOR; };
virtual int8_t GetLibVersionMinor(void) const { return CEC_LIB_VERSION_MINOR; };
virtual bool SetConfiguration(const libcec_configuration *configuration);
virtual bool CanPersistConfiguration(void);
virtual bool PersistConfiguration(libcec_configuration *configuration);
+ virtual void RescanActiveDevices(void);
const char *ToString(const cec_menu_state state);
const char *ToString(const cec_version version);
const char *ToString(const cec_audio_status status);
const char *ToString(const cec_vendor_id vendor);
const char *ToString(const cec_client_version version);
+ const char *ToString(const cec_server_version version);
//@}
static void AddLog(const cec_log_level level, const char *strFormat, ...);
//@{
ICECAdapter *cec_parser;
-int cec_initialise(const libcec_configuration *configuration)
+int cec_initialise(libcec_configuration *configuration)
{
cec_parser = (ICECAdapter *) CECInitialise(configuration);
return (cec_parser != NULL) ? 1 : 0;
return cec_parser ? (cec_parser->SetConfiguration(configuration) ? 1 : 0) : -1;
}
+void cec_rescan_devices(void)
+{
+ if (cec_parser)
+ cec_parser->RescanActiveDevices();
+}
+
//@}
if (!g_bSingleCommand)
{
CStdString strLog;
- strLog.Format("CEC Parser created - libcec version %d.%d", parser->GetLibVersionMajor(), parser->GetLibVersionMinor());
+ strLog.Format("CEC Parser created - libCEC version %s", parser->ToString((cec_server_version)g_config.serverVersion));
cout << strLog.c_str() << endl;
//make stdin non-blocking