Navigation Menu

Skip to content

Commit

Permalink
[cec] simplify settings - use an enum instead of logical addresses fo…
Browse files Browse the repository at this point in the history
…r the 'connected_device' setting
  • Loading branch information
opdenkamp committed Oct 9, 2012
1 parent b45b9a4 commit 0549eb2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
12 changes: 11 additions & 1 deletion language/English/strings.po
Expand Up @@ -10876,7 +10876,7 @@ msgid "Product ID"
msgstr ""

#empty strings from id 35505 to 35999

#: xbmc/peripherals/devices/PeripheralCecAdapter.cpp
msgctxt "#36000"
msgid "Pulse-Eight CEC adapter"
msgstr ""
Expand Down Expand Up @@ -11023,3 +11023,13 @@ msgstr ""
msgctxt "#36036"
msgid "On start/stop"
msgstr ""

#: xbmc/peripherals/devices/PeripheralCecAdapter.cpp
msgctxt "#36037"
msgid "TV"
msgstr ""

msgctxt "#36038"
msgid "Amplifier / AVR device"
msgstr ""

4 changes: 2 additions & 2 deletions system/peripherals.xml
Expand Up @@ -40,9 +40,9 @@
<setting key="send_inactive_source" type="bool" value="1" label="36025" order="8" />
<setting key="use_tv_menu_language" type="bool" value="1" label="36018" order="9" />
<setting key="pause_playback_on_deactivate" type="bool" value="1" label="36033" order="10" />
<setting key="physical_address" type="string" label="36021" value="0" order="11" />
<setting key="connected_device" type="enum" label="36019" value="36037" lvalues="36037|36038" order="11" />
<setting key="cec_hdmi_port" type="int" value="1" min="1" max="15" label="36015" order="12" />
<setting key="connected_device" type="int" label="36019" value="0" min="0" max="15" step="1" order="13" />
<setting key="physical_address" type="string" label="36021" value="0" order="13" />
<setting key="port" type="string" value="" label="36022" order="14" />

<setting key="tv_vendor" type="int" value="0" configurable="0" />
Expand Down
12 changes: 8 additions & 4 deletions xbmc/peripherals/devices/PeripheralCecAdapter.cpp
Expand Up @@ -51,6 +51,9 @@ using namespace std;
#define VOLUME_CHANGE_TIMEOUT 250
#define VOLUME_REFRESH_TIMEOUT 100

#define LOCALISED_ID_TV 36037
#define LOCALISED_ID_AVR 36038

class DllLibCECInterface
{
public:
Expand Down Expand Up @@ -1226,7 +1229,7 @@ void CPeripheralCecAdapter::SetConfigurationFromLibCEC(const CEC::libcec_configu

// set the connected device
m_configuration.baseDevice = config.baseDevice;
bChanged |= SetSetting("connected_device", (int)config.baseDevice);
bChanged |= SetSetting("connected_device", config.baseDevice == CECDEVICE_AUDIOSYSTEM ? LOCALISED_ID_AVR : LOCALISED_ID_TV);

// set the HDMI port number
m_configuration.iHDMIPort = config.iHDMIPort;
Expand Down Expand Up @@ -1328,9 +1331,10 @@ void CPeripheralCecAdapter::SetConfigurationFromSettings(void)

// set the connected device
int iConnectedDevice = GetSettingInt("connected_device");
if (iConnectedDevice == CECDEVICE_TV ||
iConnectedDevice == CECDEVICE_AUDIOSYSTEM)
m_configuration.baseDevice = (cec_logical_address)iConnectedDevice;
if (iConnectedDevice == LOCALISED_ID_AVR)
m_configuration.baseDevice = CECDEVICE_AUDIOSYSTEM;
else if (iConnectedDevice == LOCALISED_ID_TV)
m_configuration.baseDevice = CECDEVICE_TV;

// set the HDMI port number
int iHDMIPort = GetSettingInt("cec_hdmi_port");
Expand Down

0 comments on commit 0549eb2

Please sign in to comment.