repositories
/
deb_libcec.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c409848
)
cec: added SetMenuState()
author
Lars Op den Kamp
<lars@opdenkamp.eu>
Fri, 11 Nov 2011 12:51:09 +0000
(13:51 +0100)
committer
Lars Op den Kamp
<lars@opdenkamp.eu>
Fri, 11 Nov 2011 12:51:09 +0000
(13:51 +0100)
include/cec.h
patch
|
blob
|
blame
|
history
src/lib/CECProcessor.cpp
patch
|
blob
|
blame
|
history
src/lib/CECProcessor.h
patch
|
blob
|
blame
|
history
src/lib/LibCEC.cpp
patch
|
blob
|
blame
|
history
src/lib/LibCEC.h
patch
|
blob
|
blame
|
history
src/lib/devices/CECBusDevice.cpp
patch
|
blob
|
blame
|
history
src/lib/devices/CECBusDevice.h
patch
|
blob
|
blame
|
history
src/lib/devices/CECPlaybackDevice.cpp
patch
|
blob
|
blame
|
history
src/lib/implementations/CECCommandHandler.cpp
patch
|
blob
|
blame
|
history
src/lib/implementations/CECCommandHandler.h
patch
|
blob
|
blame
|
history
diff --git
a/include/cec.h
b/include/cec.h
index 6a8996d4ceb06ee060aebeb424aa80781680335f..7a306dddc82f37d4d26e8c68132af1c638f61e9a 100644
(file)
--- a/
include/cec.h
+++ b/
include/cec.h
@@
-166,16
+166,17
@@
namespace CEC
/*!
* @brief Change the deck control mode, if this adapter is registered as playback device.
* @param mode The new control mode.
/*!
* @brief Change the deck control mode, if this adapter is registered as playback device.
* @param mode The new control mode.
+ * @param bSendUpdate True to send the status over the CEC line.
* @return True if set, false otherwise.
*/
* @return True if set, false otherwise.
*/
- virtual bool SetDeckControlMode(cec_deck_control_mode mode) = 0;
+ virtual bool SetDeckControlMode(cec_deck_control_mode mode
, bool bSendUpdate = true
) = 0;
/*!
* @brief Change the deck info, if this adapter is a playback device.
* @param info The new deck info.
* @return True if set, false otherwise.
*/
/*!
* @brief Change the deck info, if this adapter is a playback device.
* @param info The new deck info.
* @return True if set, false otherwise.
*/
- virtual bool SetDeckInfo(cec_deck_info info) = 0;
+ virtual bool SetDeckInfo(cec_deck_info info
, bool bSendUpdate = true
) = 0;
/*!
* @brief Broadcast a message that notifies connected CEC capable devices that this device is no longer the active source.
/*!
* @brief Broadcast a message that notifies connected CEC capable devices that this device is no longer the active source.
@@
-183,6
+184,14
@@
namespace CEC
*/
virtual bool SetInactiveView(void) = 0;
*/
virtual bool SetInactiveView(void) = 0;
+ /*!
+ * @brief Change the menu state.
+ * @param state The new true.
+ * @param bSendUpdate True to send the status over the CEC line.
+ * @return True if set, false otherwise.
+ */
+ virtual bool SetMenuState(cec_menu_state state, bool bSendUpdate = true) = 0;
+
/*!
* @brief Display a message on the device with the given logical address.
* @param iLogicalAddres The device to display the message on.
/*!
* @brief Display a message on the device with the given logical address.
* @param iLogicalAddres The device to display the message on.
diff --git
a/src/lib/CECProcessor.cpp
b/src/lib/CECProcessor.cpp
index cf3ea3f39631b9b71daf41697658fd843acfae78..f2eafaac5022bf095a7a6b678c61fd16151105ba 100644
(file)
--- a/
src/lib/CECProcessor.cpp
+++ b/
src/lib/CECProcessor.cpp
@@
-320,7
+320,7
@@
bool CCECProcessor::SetActiveView(void)
return SetActiveSource();
}
return SetActiveSource();
}
-bool CCECProcessor::SetDeckControlMode(cec_deck_control_mode mode)
+bool CCECProcessor::SetDeckControlMode(cec_deck_control_mode mode
, bool bSendUpdate /* = true */
)
{
bool bReturn(false);
{
bool bReturn(false);
@@
-328,13
+328,15
@@
bool CCECProcessor::SetDeckControlMode(cec_deck_control_mode mode)
if (device)
{
((CCECPlaybackDevice *) device)->SetDeckControlMode(mode);
if (device)
{
((CCECPlaybackDevice *) device)->SetDeckControlMode(mode);
+ if (bSendUpdate)
+ ((CCECPlaybackDevice *) device)->TransmitDeckStatus(CECDEVICE_TV);
bReturn = true;
}
return bReturn;
}
bReturn = true;
}
return bReturn;
}
-bool CCECProcessor::SetDeckInfo(cec_deck_info info)
+bool CCECProcessor::SetDeckInfo(cec_deck_info info
, bool bSendUpdate /* = true */
)
{
bool bReturn(false);
{
bool bReturn(false);
@@
-342,6
+344,8
@@
bool CCECProcessor::SetDeckInfo(cec_deck_info info)
if (device)
{
((CCECPlaybackDevice *) device)->SetDeckStatus(info);
if (device)
{
((CCECPlaybackDevice *) device)->SetDeckStatus(info);
+ if (bSendUpdate)
+ ((CCECPlaybackDevice *) device)->TransmitDeckStatus(CECDEVICE_TV);
bReturn = true;
}
bReturn = true;
}
@@
-407,6
+411,20
@@
bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress)
return true;
}
return true;
}
+bool CCECProcessor::SetMenuState(cec_menu_state state, bool bSendUpdate /* = true */)
+{
+ for (uint8_t iPtr = 0; iPtr < 16; iPtr++)
+ {
+ if (m_logicalAddresses[iPtr])
+ m_busDevices[iPtr]->SetMenuState(state);
+ }
+
+ if (bSendUpdate)
+ m_busDevices[m_logicalAddresses.primary]->TransmitMenuState(CECDEVICE_TV);
+
+ return true;
+}
+
bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress)
{
if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary])
bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress)
{
if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary])
diff --git
a/src/lib/CECProcessor.h
b/src/lib/CECProcessor.h
index a0192f24d451c9b39c03d5ad4fd76a3ad91ccf9b..8f8e892ddba795623a89bb88dd78b4744ed397b9 100644
(file)
--- a/
src/lib/CECProcessor.h
+++ b/
src/lib/CECProcessor.h
@@
-71,10
+71,11
@@
namespace CEC
virtual bool SetActiveView(void);
virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED);
virtual bool SetActiveView(void);
virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED);
- virtual bool SetDeckControlMode(cec_deck_control_mode mode);
- virtual bool SetDeckInfo(cec_deck_info info);
+ virtual bool SetDeckControlMode(cec_deck_control_mode mode
, bool bSendUpdate = true
);
+ virtual bool SetDeckInfo(cec_deck_info info
, bool bSendUpdate = true
);
virtual bool SetInactiveView(void);
virtual bool SetLogicalAddress(cec_logical_address iLogicalAddress);
virtual bool SetInactiveView(void);
virtual bool SetLogicalAddress(cec_logical_address iLogicalAddress);
+ virtual bool SetMenuState(cec_menu_state state, bool bSendUpdate = true);
virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress);
virtual bool SetStreamPath(uint16_t iStreamPath);
virtual bool SwitchMonitoring(bool bEnable);
virtual bool SetPhysicalAddress(uint16_t iPhysicalAddress);
virtual bool SetStreamPath(uint16_t iStreamPath);
virtual bool SwitchMonitoring(bool bEnable);
diff --git
a/src/lib/LibCEC.cpp
b/src/lib/LibCEC.cpp
index a226d41e1ddf8263feac02dc9c406dba9a601cbb..c0675622e32db807817195d61f9270b02d66cf2f 100644
(file)
--- a/
src/lib/LibCEC.cpp
+++ b/
src/lib/LibCEC.cpp
@@
-186,14
+186,14
@@
bool CLibCEC::SetActiveView(void)
return m_cec ? m_cec->SetActiveView() : false;
}
return m_cec ? m_cec->SetActiveView() : false;
}
-bool CLibCEC::SetDeckControlMode(cec_deck_control_mode mode)
+bool CLibCEC::SetDeckControlMode(cec_deck_control_mode mode
, bool bSendUpdate /* = true */
)
{
{
- return m_cec ? m_cec->SetDeckControlMode(mode) : false;
+ return m_cec ? m_cec->SetDeckControlMode(mode
, bSendUpdate
) : false;
}
}
-bool CLibCEC::SetDeckInfo(cec_deck_info info)
+bool CLibCEC::SetDeckInfo(cec_deck_info info
, bool bSendUpdate /* = true */
)
{
{
- return m_cec ? m_cec->SetDeckInfo(info) : false;
+ return m_cec ? m_cec->SetDeckInfo(info
, bSendUpdate
) : false;
}
bool CLibCEC::SetInactiveView(void)
}
bool CLibCEC::SetInactiveView(void)
@@
-201,6
+201,11
@@
bool CLibCEC::SetInactiveView(void)
return m_cec ? m_cec->SetInactiveView() : false;
}
return m_cec ? m_cec->SetInactiveView() : false;
}
+bool CLibCEC::SetMenuState(cec_menu_state state, bool bSendUpdate /* = true */)
+{
+ return m_cec ? m_cec->SetMenuState(state, bSendUpdate) : false;
+}
+
bool CLibCEC::SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage)
{
return m_cec && iLogicalAddress >= CECDEVICE_TV && iLogicalAddress <= CECDEVICE_BROADCAST ?
bool CLibCEC::SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage)
{
return m_cec && iLogicalAddress >= CECDEVICE_TV && iLogicalAddress <= CECDEVICE_BROADCAST ?
diff --git
a/src/lib/LibCEC.h
b/src/lib/LibCEC.h
index 3982420f9d92f9213930acf232aedc5a1ee912e1..7a69c96b66da525e9cdc90673effacc3da03337c 100644
(file)
--- a/
src/lib/LibCEC.h
+++ b/
src/lib/LibCEC.h
@@
-73,9
+73,10
@@
namespace CEC
virtual bool StandbyDevices(cec_logical_address address = CECDEVICE_BROADCAST);
virtual bool SetActiveView(void);
virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED);
virtual bool StandbyDevices(cec_logical_address address = CECDEVICE_BROADCAST);
virtual bool SetActiveView(void);
virtual bool SetActiveSource(cec_device_type type = CEC_DEVICE_TYPE_RESERVED);
- virtual bool SetDeckControlMode(cec_deck_control_mode mode);
- virtual bool SetDeckInfo(cec_deck_info info);
+ virtual bool SetDeckControlMode(cec_deck_control_mode mode
, bool bSendUpdate = true
);
+ virtual bool SetDeckInfo(cec_deck_info info
, bool bSendUpdate = true
);
virtual bool SetInactiveView(void);
virtual bool SetInactiveView(void);
+ virtual bool SetMenuState(cec_menu_state state, bool bSendUpdate = true);
virtual bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
virtual bool SwitchMonitoring(bool bEnable);
virtual cec_version GetDeviceCecVersion(cec_logical_address iAddress);
virtual bool SetOSDString(cec_logical_address iLogicalAddress, cec_display_control duration, const char *strMessage);
virtual bool SwitchMonitoring(bool bEnable);
virtual cec_version GetDeviceCecVersion(cec_logical_address iAddress);
diff --git
a/src/lib/devices/CECBusDevice.cpp
b/src/lib/devices/CECBusDevice.cpp
index 3eeb295af5a34ba2c3ab5b6ec8f754a0c0fc6305..26b964b9c7cc74ee8c7d7863e8839f39cc292df8 100644
(file)
--- a/
src/lib/devices/CECBusDevice.cpp
+++ b/
src/lib/devices/CECBusDevice.cpp
@@
-50,7
+50,7
@@
CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogi
m_powerStatus(CEC_POWER_STATUS_UNKNOWN),
m_processor(processor),
m_vendor(CEC_VENDOR_UNKNOWN),
m_powerStatus(CEC_POWER_STATUS_UNKNOWN),
m_processor(processor),
m_vendor(CEC_VENDOR_UNKNOWN),
- m_
bMenuActive(true
),
+ m_
menuState(CEC_MENU_STATE_DEACTIVATED
),
m_bActiveSource(false),
m_iLastCommandSent(0),
m_iLastActive(0),
m_bActiveSource(false),
m_iLastCommandSent(0),
m_iLastActive(0),
@@
-272,6
+272,17
@@
void CCECBusDevice::SetMenuLanguage(const cec_menu_language &language)
}
}
}
}
+void CCECBusDevice::SetMenuState(const cec_menu_state state)
+{
+ if (m_menuState != state)
+ {
+ CStdString strLog;
+ strLog.Format(">> %s (%X): menu state set to '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_menuState));
+ m_processor->AddLog(CEC_LOG_DEBUG, strLog);
+ m_menuState = state;
+ }
+}
+
void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress)
{
if (iNewAddress > 0)
void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress)
{
if (iNewAddress > 0)
@@
-415,16
+426,12
@@
bool CCECBusDevice::TransmitInactiveView(void)
bool CCECBusDevice::TransmitMenuState(cec_logical_address dest)
{
CStdString strLog;
bool CCECBusDevice::TransmitMenuState(cec_logical_address dest)
{
CStdString strLog;
- strLog.Format("<< %s (%X) -> %s (%X): ", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest);
- if (m_bMenuActive)
- strLog.append("menu active");
- else
- strLog.append("menu inactive");
+ strLog.Format("<< %s (%X) -> %s (%X): menu state '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_menuState));
AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_MENU_STATUS);
AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_MENU_STATUS);
- command.parameters.push_back(
m_bMenuActive ? (uint8_t) CEC_MENU_STATE_ACTIVATED : (uint8_t) CEC_MENU_STATE_DEACTIVATED
);
+ command.parameters.push_back(
(uint8_t)m_menuState
);
return m_processor->Transmit(command);
}
return m_processor->Transmit(command);
}
diff --git
a/src/lib/devices/CECBusDevice.h
b/src/lib/devices/CECBusDevice.h
index cad65911008a87a62ece20ce28612c04cf74bbec..245f829405ece5fa8cdca9c24caa3309b5b72726 100644
(file)
--- a/
src/lib/devices/CECBusDevice.h
+++ b/
src/lib/devices/CECBusDevice.h
@@
-75,6
+75,7
@@
namespace CEC
virtual void SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress = 0);
virtual void SetCecVersion(const cec_version newVersion);
virtual void SetMenuLanguage(const cec_menu_language &menuLanguage);
virtual void SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress = 0);
virtual void SetCecVersion(const cec_version newVersion);
virtual void SetMenuLanguage(const cec_menu_language &menuLanguage);
+ virtual void SetMenuState(const cec_menu_state state);
virtual void SetVendorId(uint64_t iVendorId);
virtual void SetPowerStatus(const cec_power_status powerStatus);
virtual void SetVendorId(uint64_t iVendorId);
virtual void SetPowerStatus(const cec_power_status powerStatus);
@@
-100,7
+101,7
@@
namespace CEC
CCECProcessor *m_processor;
CCECCommandHandler *m_handler;
cec_vendor_id m_vendor;
CCECProcessor *m_processor;
CCECCommandHandler *m_handler;
cec_vendor_id m_vendor;
-
bool m_bMenuActiv
e;
+
cec_menu_state m_menuStat
e;
bool m_bActiveSource;
uint64_t m_iLastCommandSent;
uint64_t m_iLastActive;
bool m_bActiveSource;
uint64_t m_iLastCommandSent;
uint64_t m_iLastActive;
diff --git
a/src/lib/devices/CECPlaybackDevice.cpp
b/src/lib/devices/CECPlaybackDevice.cpp
index cee7c492e72f4c4f5c6b976ae7c508f1989d2767..02b9d43bbac89a7661e69da4be0f9eab3dbe14f1 100644
(file)
--- a/
src/lib/devices/CECPlaybackDevice.cpp
+++ b/
src/lib/devices/CECPlaybackDevice.cpp
@@
-75,7
+75,7
@@
bool CCECPlaybackDevice::TransmitDeckStatus(cec_logical_address dest)
AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
AddLog(CEC_LOG_NOTICE, strLog);
cec_command command;
- cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_
GIVE_
DECK_STATUS);
+ cec_command::format(command, m_iLogicalAddress, dest, CEC_OPCODE_DECK_STATUS);
command.push_back((uint8_t)m_deckStatus);
return m_processor->Transmit(command);
command.push_back((uint8_t)m_deckStatus);
return m_processor->Transmit(command);
diff --git
a/src/lib/implementations/CECCommandHandler.cpp
b/src/lib/implementations/CECCommandHandler.cpp
index 1c0f8d95ed81ce53184a1efd0f717996cf79fd86..a6b5d10302bab4c7baf77997620d25b8b9f88922 100644
(file)
--- a/
src/lib/implementations/CECCommandHandler.cpp
+++ b/
src/lib/implementations/CECCommandHandler.cpp
@@
-487,6
+487,19
@@
void CCECCommandHandler::SetVendorId(const cec_command &command)
device->SetVendorId(iVendorId);
}
device->SetVendorId(iVendorId);
}
+const char *CCECCommandHandler::ToString(const cec_menu_state state)
+{
+ switch (state)
+ {
+ case CEC_MENU_STATE_ACTIVATED:
+ return "activated";
+ case CEC_MENU_STATE_DEACTIVATED:
+ return "deactivated";
+ default:
+ return "unknown";
+ }
+}
+
const char *CCECCommandHandler::ToString(const cec_version version)
{
switch (version)
const char *CCECCommandHandler::ToString(const cec_version version)
{
switch (version)
diff --git
a/src/lib/implementations/CECCommandHandler.h
b/src/lib/implementations/CECCommandHandler.h
index aed84fdfd816f69552c3e1d6369e64bf5f2dff4e..9bf98982da7949f847d26a07f12dbf9dfe0f1582 100644
(file)
--- a/
src/lib/implementations/CECCommandHandler.h
+++ b/
src/lib/implementations/CECCommandHandler.h
@@
-47,6
+47,7
@@
namespace CEC
virtual bool HandleCommand(const cec_command &command);
virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_UNKNOWN; };
virtual bool HandleCommand(const cec_command &command);
virtual cec_vendor_id GetVendorId(void) { return CEC_VENDOR_UNKNOWN; };
+ static const char *ToString(const cec_menu_state state);
static const char *ToString(const cec_deck_control_mode mode);
static const char *ToString(const cec_version version);
static const char *ToString(const cec_power_status status);
static const char *ToString(const cec_deck_control_mode mode);
static const char *ToString(const cec_version version);
static const char *ToString(const cec_power_status status);