* @return True when changed, false otherwise.
*/
virtual bool SetHDMIPort(uint8_t iPort) = 0;
+
+ /*!
+ * @brief Sends a volume up keypress to an audiosystem if it's present.
+ * @return The new audio status.
+ */
+ virtual uint8_t VolumeUp(void) = 0;
+
+ /*!
+ * @brief Sends a volume down keypress to an audiosystem if it's present.
+ * @return The new audio status.
+ */
+ virtual uint8_t VolumeDown(void) = 0;
+
+ /*!
+ * @brief Sends a mute keypress to an audiosystem if it's present.
+ * @return The new audio status.
+ */
+ virtual uint8_t MuteAudio(void) = 0;
};
};
extern DECLSPEC int cec_set_hdmi_port(uint8_t iPort);
+extern DECLSPEC int cec_volume_up(void);
+
+extern DECLSPEC int cec_volume_down(void);
+
+extern DECLSPEC int cec_mute_audio(void);
+
#ifdef __cplusplus
};
#endif
return false;
}
+uint8_t CCECProcessor::VolumeUp(void)
+{
+ uint8_t status = 0;
+ if (IsActiveDevice(CECDEVICE_AUDIOSYSTEM))
+ status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeUp();
+
+ return status;
+}
+
+uint8_t CCECProcessor::VolumeDown(void)
+{
+ uint8_t status = 0;
+ if (IsActiveDevice(CECDEVICE_AUDIOSYSTEM))
+ status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeDown();
+
+ return status;
+}
+
+uint8_t CCECProcessor::MuteAudio(void)
+{
+ uint8_t status = 0;
+ if (IsActiveDevice(CECDEVICE_AUDIOSYSTEM))
+ status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->MuteAudio();
+
+ return status;
+}
+
CCECBusDevice *CCECProcessor::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bRefresh /* = false */) const
{
if (m_busDevices[m_logicalAddresses.primary]->GetPhysicalAddress(false) == iPhysicalAddress)
virtual bool SetStreamPath(uint16_t iStreamPath);
virtual bool SwitchMonitoring(bool bEnable);
virtual bool PollDevice(cec_logical_address iAddress);
+ virtual uint8_t VolumeUp(void);
+ virtual uint8_t VolumeDown(void);
+ virtual uint8_t MuteAudio(void);
virtual bool Transmit(const cec_command &data);
virtual bool Transmit(CCECAdapterMessage *output);
return false;
}
+uint8_t CLibCEC::VolumeUp(void)
+{
+ if (m_cec)
+ return m_cec->VolumeUp();
+ return 0;
+}
+
+uint8_t CLibCEC::VolumeDown(void)
+{
+ if (m_cec)
+ return m_cec->VolumeDown();
+ return 0;
+}
+
+
+uint8_t CLibCEC::MuteAudio(void)
+{
+ if (m_cec)
+ return m_cec->MuteAudio();
+ return 0;
+}
+
void CLibCEC::AddLog(cec_log_level level, const string &strMessage)
{
if (m_cec)
virtual bool IsActiveDevice(cec_logical_address iAddress);
virtual bool IsActiveDeviceType(cec_device_type type);
virtual bool SetHDMIPort(uint8_t iPort = CEC_DEFAULT_HDMI_PORT);
+ virtual uint8_t VolumeUp(void);
+ virtual uint8_t VolumeDown(void);
+ virtual uint8_t MuteAudio(void);
//@}
virtual void AddLog(cec_log_level level, const std::string &strMessage);
return -1;
}
+int cec_volume_up(void)
+{
+ if (cec_parser)
+ return cec_parser->VolumeUp();
+ return -1;
+}
+
+int cec_volume_down(void)
+{
+ if (cec_parser)
+ return cec_parser->VolumeDown();
+ return -1;
+}
+
+int cec_mute_audio(void)
+{
+ if (cec_parser)
+ return cec_parser->MuteAudio();
+ return -1;
+}
+
//@}
return m_processor->Transmit(command);
}
+
+uint8_t CCECAudioSystem::VolumeUp(void)
+{
+ return SendKey(CEC_USER_CONTROL_CODE_VOLUME_UP);
+}
+
+uint8_t CCECAudioSystem::VolumeDown(void)
+{
+ return SendKey(CEC_USER_CONTROL_CODE_VOLUME_DOWN);
+}
+
+uint8_t CCECAudioSystem::MuteAudio(void)
+{
+ return SendKey(CEC_USER_CONTROL_CODE_MUTE);
+}
+
+uint8_t CCECAudioSystem::SendKey(cec_user_control_code key)
+{
+ {
+ CLockObject lock(&m_transmitMutex);
+ cec_command command;
+ cec_command::Format(command, m_processor->GetLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_USER_CONTROL_PRESSED);
+ command.parameters.PushBack(key);
+ m_processor->Transmit(command);
+
+ cec_command::Format(command, m_processor->GetLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_USER_CONTROL_RELEASE);
+ if (m_processor->Transmit(command))
+ m_condition.Wait(&m_transmitMutex, 1000);
+ }
+
+ CLockObject lock(&m_mutex);
+ return m_audioStatus;
+}
virtual bool TransmitAudioStatus(cec_logical_address dest);
virtual bool TransmitSystemAudioModeStatus(cec_logical_address dest);
+ virtual uint8_t VolumeUp(void);
+ virtual uint8_t VolumeDown(void);
+ virtual uint8_t MuteAudio(void);
+ virtual uint8_t SendKey(cec_user_control_code key);
+
virtual bool TransmitActiveSource(void) { return false; }
protected:
{
parser->PingAdapter();
}
+ else if (command == "volup")
+ {
+ parser->VolumeUp();
+ }
+ else if (command == "voldown")
+ {
+ parser->VolumeDown();
+ }
+ else if (command == "mute")
+ {
+ parser->MuteAudio();
+ }
else if (command == "mon")
{
CStdString strEnable;