/*!
* @brief Sends a volume up keypress to an audiosystem if it's present.
+ * @param bWait Wait for the response of the audiosystem when true.
* @return The new audio status.
*/
- virtual uint8_t VolumeUp(void) = 0;
+ virtual uint8_t VolumeUp(bool bWait = true) = 0;
/*!
* @brief Sends a volume down keypress to an audiosystem if it's present.
+ * @param bWait Wait for the response of the audiosystem when true.
* @return The new audio status.
*/
- virtual uint8_t VolumeDown(void) = 0;
+ virtual uint8_t VolumeDown(bool bWait = true) = 0;
/*!
* @brief Sends a mute keypress to an audiosystem if it's present.
+ * @param bWait Wait for the response of the audiosystem when true.
* @return The new audio status.
*/
- virtual uint8_t MuteAudio(void) = 0;
+ virtual uint8_t MuteAudio(bool bWait = true) = 0;
};
};
extern DECLSPEC int cec_set_hdmi_port(uint8_t iPort);
-extern DECLSPEC int cec_volume_up(void);
+extern DECLSPEC int cec_volume_up(int bWait = 1);
-extern DECLSPEC int cec_volume_down(void);
+extern DECLSPEC int cec_volume_down(int bWait = 1);
-extern DECLSPEC int cec_mute_audio(void);
+extern DECLSPEC int cec_mute_audio(int bWait = 1);
#ifdef __cplusplus
};
return false;
}
-uint8_t CCECProcessor::VolumeUp(void)
+uint8_t CCECProcessor::VolumeUp(bool bWait /* = true */)
{
uint8_t status = 0;
if (IsActiveDevice(CECDEVICE_AUDIOSYSTEM))
- status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeUp();
+ status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeUp(bWait);
return status;
}
-uint8_t CCECProcessor::VolumeDown(void)
+uint8_t CCECProcessor::VolumeDown(bool bWait /* = true */)
{
uint8_t status = 0;
if (IsActiveDevice(CECDEVICE_AUDIOSYSTEM))
- status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeDown();
+ status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeDown(bWait);
return status;
}
-uint8_t CCECProcessor::MuteAudio(void)
+uint8_t CCECProcessor::MuteAudio(bool bWait /* = true */)
{
uint8_t status = 0;
if (IsActiveDevice(CECDEVICE_AUDIOSYSTEM))
- status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->MuteAudio();
+ status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->MuteAudio(bWait);
return status;
}
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 uint8_t VolumeUp(bool bWait = true);
+ virtual uint8_t VolumeDown(bool bWait = true);
+ virtual uint8_t MuteAudio(bool bWait = true);
virtual bool Transmit(const cec_command &data);
virtual bool Transmit(CCECAdapterMessage *output);
return false;
}
-uint8_t CLibCEC::VolumeUp(void)
+uint8_t CLibCEC::VolumeUp(bool bWait /* = true */)
{
if (m_cec)
- return m_cec->VolumeUp();
+ return m_cec->VolumeUp(bWait);
return 0;
}
-uint8_t CLibCEC::VolumeDown(void)
+uint8_t CLibCEC::VolumeDown(bool bWait /* = true */)
{
if (m_cec)
- return m_cec->VolumeDown();
+ return m_cec->VolumeDown(bWait);
return 0;
}
-uint8_t CLibCEC::MuteAudio(void)
+uint8_t CLibCEC::MuteAudio(bool bWait /* = true */)
{
if (m_cec)
- return m_cec->MuteAudio();
+ return m_cec->MuteAudio(bWait);
return 0;
}
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 uint8_t VolumeUp(bool bWait = true);
+ virtual uint8_t VolumeDown(bool bWait = true);
+ virtual uint8_t MuteAudio(bool bWait = true);
//@}
virtual void AddLog(cec_log_level level, const std::string &strMessage);
return -1;
}
-int cec_volume_up(void)
+int cec_volume_up(int bWait /* = 1 */)
{
if (cec_parser)
- return cec_parser->VolumeUp();
+ return cec_parser->VolumeUp(bWait == 1);
return -1;
}
-int cec_volume_down(void)
+int cec_volume_down(int bWait /* = 1 */)
{
if (cec_parser)
- return cec_parser->VolumeDown();
+ return cec_parser->VolumeDown(bWait == 1);
return -1;
}
-int cec_mute_audio(void)
+int cec_mute_audio(int bWait /* = 1 */)
{
if (cec_parser)
- return cec_parser->MuteAudio();
+ return cec_parser->MuteAudio(bWait == 1);
return -1;
}
return m_processor->Transmit(command);
}
-uint8_t CCECAudioSystem::VolumeUp(void)
+uint8_t CCECAudioSystem::VolumeUp(bool bWait /* = true */)
{
- return SendKey(CEC_USER_CONTROL_CODE_VOLUME_UP);
+ return SendKey(CEC_USER_CONTROL_CODE_VOLUME_UP, bWait);
}
-uint8_t CCECAudioSystem::VolumeDown(void)
+uint8_t CCECAudioSystem::VolumeDown(bool bWait /* = true */)
{
- return SendKey(CEC_USER_CONTROL_CODE_VOLUME_DOWN);
+ return SendKey(CEC_USER_CONTROL_CODE_VOLUME_DOWN, bWait);
}
-uint8_t CCECAudioSystem::MuteAudio(void)
+uint8_t CCECAudioSystem::MuteAudio(bool bWait /* = true */)
{
- return SendKey(CEC_USER_CONTROL_CODE_MUTE);
+ return SendKey(CEC_USER_CONTROL_CODE_MUTE, bWait);
}
-uint8_t CCECAudioSystem::SendKey(cec_user_control_code key)
+uint8_t CCECAudioSystem::SendKey(cec_user_control_code key, bool bWait /* = true */)
{
{
CLockObject lock(&m_transmitMutex);
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);
+ if (bWait)
+ {
+ if (m_processor->Transmit(command))
+ m_condition.Wait(&m_transmitMutex, 1000);
+ }
+ else
+ {
+ m_processor->Transmit(command);
+ }
}
CLockObject lock(&m_mutex);
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 uint8_t VolumeUp(bool bWait = true);
+ virtual uint8_t VolumeDown(bool bWait = true);
+ virtual uint8_t MuteAudio(bool bWait = true);
+ virtual uint8_t SendKey(cec_user_control_code key, bool bWait = true);
virtual bool TransmitActiveSource(void) { return false; }
break;
}
- if (command.destination == CECDEVICE_BROADCAST || m_busDevice->MyLogicalAddressContains(command.destination))
- m_busDevice->GetProcessor()->AddCommand(command);
-
+ m_busDevice->GetProcessor()->AddCommand(command);
return bHandled;
}
}
else if (command == "volup")
{
- parser->VolumeUp();
+ CStdString strLog;
+ strLog.Format("volume up: %2X", parser->VolumeUp());
+ cout << strLog.c_str() << endl;
}
else if (command == "voldown")
{
- parser->VolumeDown();
+ CStdString strLog;
+ strLog.Format("volume up: %2X", parser->VolumeDown());
+ cout << strLog.c_str() << endl;
}
else if (command == "mute")
{
- parser->MuteAudio();
+ CStdString strLog;
+ strLog.Format("mute: %2X", parser->MuteAudio());
+ cout << strLog.c_str() << endl;
}
else if (command == "mon")
{