#define CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN 1
#define CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER 1
#define CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY 1
+#define CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE 1
#define CEC_DEFAULT_TRANSMIT_RETRY_WAIT 500
#define CEC_DEFAULT_TRANSMIT_TIMEOUT 1000
typedef enum cec_client_version
{
CEC_CLIENT_VERSION_PRE_1_5 = 0,
- CEC_CLIENT_VERSION_1_5_0 = 0x1500
+ CEC_CLIENT_VERSION_1_5_0 = 0x1500,
+ CEC_CLIENT_VERSION_1_5_1 = 0x1501
} 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_1_5_0 = 0x1500,
+ CEC_SERVER_VERSION_1_5_1 = 0x1501
} cec_server_version;
typedef struct libcec_configuration
uint8_t bActivateSource; /*!< make libCEC the active source on the bus when starting the player application */
uint8_t bPowerOffScreensaver; /*!< put devices in standby mode when activating the screensaver */
uint8_t bPowerOffOnStandby; /*!< put this PC in standby mode when the TV is switched off */
+ uint8_t bSendInactiveSource; /*!< send an 'inactive source' message when stopping the player. added in 1.5.1 */
void * callbackParam; /*!< the object to pass along with a call of the callback methods. NULL to ignore */
ICECCallbacks * callbacks; /*!< the callback methods to use. set this to NULL when not using callbacks */
#if CEC_DEFAULT_SETTING_POWER_OFF_SHUTDOWN == 1
powerOffDevices.Set(CECDEVICE_BROADCAST);
#endif
- #if CEC_DEFAULT_SETTING_ACTIVATE_SOURCE == 1
- wakeDevices.Set(CECDEVICE_TV);
- #endif
+ #if CEC_DEFAULT_SETTING_ACTIVATE_SOURCE == 1
+ wakeDevices.Set(CECDEVICE_TV);
+ #endif
bPowerOffScreensaver = CEC_DEFAULT_SETTING_POWER_OFF_SCREENSAVER;
bPowerOffOnStandby = CEC_DEFAULT_SETTING_POWER_OFF_ON_STANDBY;
+ bSendInactiveSource = CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE;
callbackParam = NULL;
callbacks = NULL;
string input;
getline(cin, input);
cin.clear();
- g_config.bPowerOffOnStandby = (input == "y" || input == "Y");
+ g_config.bPowerOffOnStandby = (input == "y" || input == "Y") ? 1 : 0;
+ }
+
+ {
+ PrintToStdOut("Do you want to send an inactive source message when stopping the application (y/n)?");
+ string input;
+ getline(cin, input);
+ cin.clear();
+ g_config.bSendInactiveSource = (input == "y" || input == "Y") ? 1 : 0;
}
PrintToStdOut("\n\n=== USB-CEC Adapter Configuration Summary ===");
PrintToStdOut("Make the adapter the active source when starting XBMC: %s", g_config.bActivateSource ? "yes" : "no");
PrintToStdOut("Power off devices when stopping XBMC: %s", g_config.powerOffDevices.IsSet(CECDEVICE_BROADCAST) ? "yes" : "no");
PrintToStdOut("Put devices in standby mode when activating screensaver: %s", g_config.bPowerOffScreensaver ? "yes" : "no");
- PrintToStdOut("Put this PC in standby mode when the TV is switched off: %s\n\n", g_config.bPowerOffOnStandby ? "yes" : "no");
+ PrintToStdOut("Put this PC in standby mode when the TV is switched off: %s", g_config.bPowerOffOnStandby ? "yes" : "no");
+ PrintToStdOut("Seend an inactive source message when stopping XBMC: %s\n\n", g_config.bSendInactiveSource ? "yes" : "no");
if (g_parser->CanPersistConfiguration())
{
configOutput.open("usb_2548_1001.xml");
if (configOutput.is_open())
{
+ CStdString strWakeDevices;
+ for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
+ if (g_config.wakeDevices[iPtr])
+ strWakeDevices.AppendFormat(" %d" + iPtr);
+ CStdString strStandbyDevices;
+ for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
+ if (g_config.powerOffDevices[iPtr])
+ strStandbyDevices.AppendFormat(" %d" + iPtr);
+
configOutput <<
"<settings>\n" <<
- "\t<setting id=\"cec_hdmi_port\" value=\"" << g_config.iHDMIPort << "\" />\n" <<
- "\t<setting id=\"connected_device\" value=\"" << (int)g_config.baseDevice << "\" />\n" <<
- "\t<setting id=\"physical_address\" value=\"" << hex << g_config.iPhysicalAddress << "\" />\n" <<
- "\t<setting id=\"use_tv_menu_language\" value=\"" << (int)g_config.bUseTVMenuLanguage << "\" />\n" <<
- "\t<setting id=\"cec_power_on_startup\" value=\"" << (int)g_config.bActivateSource << "\" />\n" <<
- "\t<setting id=\"cec_power_off_shutdown\" value=\"" << (int)(g_config.powerOffDevices.IsSet(CECDEVICE_BROADCAST) ? 1 : 0) << "\" />\n" <<
+ "\t<setting id=\"enabled\" value=\"1\" />\n" <<
+ "\t<setting id=\"activate_source\" value=\"" << (int)g_config.bActivateSource << "\" />\n" <<
+ "\t<setting id=\"wake_devices\" value=\"" << strWakeDevices.Trim().c_str() << "\" />\n" <<
+ "\t<setting id=\"standby_devices\" value=\"" << strStandbyDevices.Trim().c_str() << "\" />\n" <<
"\t<setting id=\"cec_standby_screensaver\" value=\"" << (int)g_config.bPowerOffScreensaver << "\" />\n" <<
"\t<setting id=\"standby_pc_on_tv_standby\" value=\"" << (int)g_config.bPowerOffOnStandby << "\" />\n" <<
- "\t<setting id=\"enabled\" value=\"1\" />\n" <<
+ "\t<setting id=\"use_tv_menu_language\" value=\"" << (int)g_config.bUseTVMenuLanguage << "\" />\n" <<
+ "\t<setting id=\"physical_address\" value=\"" << hex << g_config.iPhysicalAddress << "\" />\n" <<
+ "\t<setting id=\"cec_hdmi_port\" value=\"" << g_config.iHDMIPort << "\" />\n" <<
+ "\t<setting id=\"connected_device\" value=\"" << (int)g_config.baseDevice << "\" />\n" <<
"\t<setting id=\"port\" value=\"\" />\n" <<
+ "\t<setting id=\"send_inactive_source\" value=\"" << (int)g_config.bSendInactiveSource << "\" />\n" <<
"</settings>";
configOutput.close();
m_logicalAddresses.Clear();
CreateBusDevices();
m_configuration.Clear();
- m_configuration.serverVersion = CEC_SERVER_VERSION_1_5_0;
+ m_configuration.serverVersion = configuration->serverVersion;
SetConfiguration(configuration);
if (m_configuration.tvVendor != CEC_VENDOR_UNKNOWN)
m_iLastTransmission(0)
{
m_configuration.Clear();
- m_configuration.serverVersion = CEC_SERVER_VERSION_1_5_0;
+ m_configuration.serverVersion = CEC_SERVER_VERSION_1_5_1;
// client version < 1.5.0
m_configuration.clientVersion = (uint32_t)CEC_CLIENT_VERSION_PRE_1_5;
return "pre-1.5";
case CEC_CLIENT_VERSION_1_5_0:
return "1.5.0";
+ case CEC_CLIENT_VERSION_1_5_1:
+ return "1.5.1";
default:
return "Unknown";
}
return "pre-1.5";
case CEC_SERVER_VERSION_1_5_0:
return "1.5.0";
+ case CEC_SERVER_VERSION_1_5_1:
+ return "1.5.1";
default:
return "Unknown";
}
m_configuration.bPowerOffScreensaver = configuration->bPowerOffScreensaver;
m_configuration.bPowerOffOnStandby = configuration->bPowerOffOnStandby;
+ // client version 1.5.1
+ if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_5_1)
+ m_configuration.bSendInactiveSource = configuration->bSendInactiveSource;
+
// ensure that there is at least 1 device type set
if (m_configuration.deviceTypes.IsEmpty())
m_configuration.deviceTypes.Add(CEC_DEVICE_TYPE_RECORDING_DEVICE);
configuration->bPowerOffScreensaver = m_configuration.bPowerOffScreensaver;
configuration->bPowerOffOnStandby = m_configuration.bPowerOffOnStandby;
+ // client version 1.5.1
+ if (configuration->clientVersion >= CEC_CLIENT_VERSION_1_5_1)
+ configuration->bSendInactiveSource = m_configuration.bSendInactiveSource;
+
return true;
}
m_callbacks(configuration->callbacks),
m_cbParam(configuration->callbackParam)
{
+ configuration->serverVersion = CEC_SERVER_VERSION_1_5_1;
m_cec = new CCECProcessor(this, configuration);
- configuration->serverVersion = CEC_SERVER_VERSION_1_5_0;
}
CLibCEC::~CLibCEC(void)