client->GetPrimaryDevice()->TransmitOSDName(CECDEVICE_TV, false);
// request the power status of the TV
- tv->RequestPowerStatus(sourceAddress, true);
+ tv->RequestPowerStatus(sourceAddress, true, true);
return bReturn;
}
implementations/VLCommandHandler.cpp \
implementations/RLCommandHandler.cpp \
implementations/PHCommandHandler.cpp \
- implementations/RHCommandHandler.cpp
+ implementations/RHCommandHandler.cpp \
+ implementations/AQCommandHandler.cpp
## server sockets, currently unused
##libcec_la_SOURCES += platform/posix/serversocket.cpp
#include "lib/implementations/PHCommandHandler.h"
#include "lib/implementations/RLCommandHandler.h"
#include "lib/implementations/RHCommandHandler.h"
+#include "lib/implementations/AQCommandHandler.h"
#include "lib/LibCEC.h"
#include "lib/CECTypeUtils.h"
#include "lib/platform/util/timeutils.h"
case CEC_VENDOR_ONKYO:
m_handler = new CRHCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending);
break;
+ case CEC_VENDOR_SHARP:
+ m_handler = new CAQCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending);
+ break;
default:
m_handler = new CCECCommandHandler(this, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending);
break;
if (bRequestUpdate)
{
CheckVendorIdRequested(initiator);
- RequestPowerStatus(initiator);
+ RequestPowerStatus(initiator, bUpdate);
}
CLockObject lock(m_mutex);
return m_bImageViewOnSent;
}
-bool CCECBusDevice::RequestPowerStatus(const cec_logical_address initiator, bool bWaitForResponse /* = true */)
+bool CCECBusDevice::RequestPowerStatus(const cec_logical_address initiator, bool bUpdate, bool bWaitForResponse /* = true */)
{
bool bReturn(false);
!IsUnsupportedFeature(CEC_OPCODE_GIVE_DEVICE_POWER_STATUS))
{
MarkBusy();
- bReturn = m_handler->TransmitRequestPowerStatus(initiator, m_iLogicalAddress, bWaitForResponse);
+ bReturn = m_handler->TransmitRequestPowerStatus(initiator, m_iLogicalAddress, bUpdate, bWaitForResponse);
if (!bReturn)
SetPowerStatus(CEC_POWER_STATUS_UNKNOWN);
MarkReady();
virtual void SetPowerStatus(const cec_power_status powerStatus);
virtual void OnImageViewOnSent(bool bSentByLibCEC);
virtual bool ImageViewOnSent(void);
- virtual bool RequestPowerStatus(const cec_logical_address initiator, bool bWaitForResponse = true);
+ virtual bool RequestPowerStatus(const cec_logical_address initiator, bool bUpdate, bool bWaitForResponse = true);
virtual bool TransmitPowerState(const cec_logical_address destination, bool bIsReply);
virtual cec_vendor_id GetCurrentVendorId(void);
--- /dev/null
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing <license@pulse-eight.com>
+ * http://www.pulse-eight.com/
+ * http://www.pulse-eight.net/
+ */
+
+#include "env.h"
+#include "AQCommandHandler.h"
+
+#include "lib/devices/CECBusDevice.h"
+#include "lib/CECProcessor.h"
+#include "lib/LibCEC.h"
+#include "lib/CECClient.h"
+
+using namespace CEC;
+using namespace PLATFORM;
+
+#define LIB_CEC m_busDevice->GetProcessor()->GetLib()
+#define ToString(p) LIB_CEC->ToString(p)
+
+CAQCommandHandler::CAQCommandHandler(CCECBusDevice *busDevice,
+ int32_t iTransmitTimeout /* = CEC_DEFAULT_TRANSMIT_TIMEOUT */,
+ int32_t iTransmitWait /* = CEC_DEFAULT_TRANSMIT_WAIT */,
+ int8_t iTransmitRetries /* = CEC_DEFAULT_TRANSMIT_RETRIES */,
+ int64_t iActiveSourcePending /* = 0 */) :
+ CCECCommandHandler(busDevice, iTransmitTimeout, iTransmitWait, iTransmitRetries, iActiveSourcePending),
+ m_powerOnCheck(NULL)
+{
+ m_vendorId = CEC_VENDOR_SHARP;
+}
+
+CAQCommandHandler::~CAQCommandHandler(void)
+{
+ delete m_powerOnCheck;
+}
+
+bool CAQCommandHandler::PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination)
+{
+ bool bCheck(false);
+ bool bRetval(false);
+ if (m_busDevice->GetCurrentPowerStatus() != CEC_POWER_STATUS_ON && (!m_powerOnCheck || !m_powerOnCheck->IsRunning()))
+ bCheck = true;
+ bRetval = CCECCommandHandler::PowerOn(iInitiator, iDestination);
+
+ if (bRetval && bCheck)
+ {
+ if (!m_powerOnCheck)
+ m_powerOnCheck = new CAQPowerStatusCheck(this, iInitiator, iDestination);
+ if (m_powerOnCheck)
+ m_powerOnCheck->CreateThread();
+ }
+
+ return bRetval;
+}
+
+void* CAQPowerStatusCheck::Process(void)
+{
+ // sleep for 2 seconds and query the power status
+ Sleep(2000);
+ if (m_handler->m_busDevice->GetProcessor()->GetDevice(m_iDestination)->GetPowerStatus(m_iInitiator, true) == CEC_POWER_STATUS_STANDBY)
+ m_handler->m_busDevice->GetProcessor()->GetLib()->AddLog(CEC_LOG_WARNING, "AQUOS LINK 'auto power on' is disabled, which prevents the TV from being powered on. To correct this, press the menu button on your remote, go to 'link operation' -> 'AQUOS LINK setup' -> 'Auto power on' and set it to 'On'");
+ return NULL;
+}
--- /dev/null
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing <license@pulse-eight.com>
+ * http://www.pulse-eight.com/
+ * http://www.pulse-eight.net/
+ */
+
+#include "CECCommandHandler.h"
+#include "platform/threads/threads.h"
+
+namespace CEC
+{
+ class CAQPowerStatusCheck;
+
+ class CAQCommandHandler : public CCECCommandHandler
+ {
+ friend class CAQPowerStatusCheck;
+ public:
+ CAQCommandHandler(CCECBusDevice *busDevice,
+ int32_t iTransmitTimeout = CEC_DEFAULT_TRANSMIT_TIMEOUT,
+ int32_t iTransmitWait = CEC_DEFAULT_TRANSMIT_WAIT,
+ int8_t iTransmitRetries = CEC_DEFAULT_TRANSMIT_RETRIES,
+ int64_t iActiveSourcePending = 0);
+ virtual ~CAQCommandHandler(void);
+
+ protected:
+ virtual bool PowerOn(const cec_logical_address iInitiator, const cec_logical_address iDestination);
+
+ private:
+ CAQPowerStatusCheck* m_powerOnCheck;
+ };
+
+ class CAQPowerStatusCheck : public PLATFORM::CThread
+ {
+ public:
+ CAQPowerStatusCheck(CAQCommandHandler* handler, cec_logical_address iInitiator, cec_logical_address iDestination) :
+ m_handler(handler),
+ m_iInitiator(iInitiator),
+ m_iDestination(iDestination) {}
+ virtual ~CAQPowerStatusCheck(void) {}
+
+ private:
+ void* Process(void);
+ CAQCommandHandler* m_handler;
+ cec_logical_address m_iInitiator;
+ cec_logical_address m_iDestination;
+ };
+};
return Transmit(command, !bWaitForResponse, false);
}
-bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse /* = true */)
+bool CCECCommandHandler::TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bUpdate, bool bWaitForResponse /* = true */)
{
if (iDestination == CECDEVICE_TV)
{
int64_t now(GetTimeMs());
- if (now - m_iPowerStatusRequested < REQUEST_POWER_STATUS_TIMEOUT)
+ if (!bUpdate && now - m_iPowerStatusRequested < REQUEST_POWER_STATUS_TIMEOUT)
return true;
m_iPowerStatusRequested = now;
}
bool bTvPresent = (tv && tv->GetStatus() == CEC_DEVICE_STATUS_PRESENT);
bool bActiveSourceFailed(false);
if (bTvPresent)
- bActiveSourceFailed = !m_busDevice->TransmitImageViewOn();
+ bActiveSourceFailed = !tv->PowerOn(m_busDevice->GetLogicalAddress());
else
LIB_CEC->AddLog(CEC_LOG_DEBUG, "TV not present, not sending 'image view on'");
virtual bool HandleCommand(const cec_command &command);
virtual cec_vendor_id GetVendorId(void) { return m_vendorId; };
virtual void SetVendorId(cec_vendor_id vendorId) { m_vendorId = vendorId; }
- static bool HasSpecificHandler(cec_vendor_id vendorId) { return vendorId == CEC_VENDOR_LG || vendorId == CEC_VENDOR_SAMSUNG || vendorId == CEC_VENDOR_PANASONIC || vendorId == CEC_VENDOR_PHILIPS;}
+ static bool HasSpecificHandler(cec_vendor_id vendorId) { return vendorId == CEC_VENDOR_LG || vendorId == CEC_VENDOR_SAMSUNG || vendorId == CEC_VENDOR_PANASONIC || vendorId == CEC_VENDOR_PHILIPS || vendorId == CEC_VENDOR_SHARP;}
virtual bool InitHandler(void) { return true; }
virtual bool ActivateSource(bool bTransmitDelayedCommandsOnly = false);
virtual bool TransmitRequestOSDName(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestAudioStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitRequestPhysicalAddress(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
- virtual bool TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
+ virtual bool TransmitRequestPowerStatus(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bUpdate, bool bWaitForResponse = true);
virtual bool TransmitRequestVendorId(const cec_logical_address iInitiator, const cec_logical_address iDestination, bool bWaitForResponse = true);
virtual bool TransmitActiveSource(const cec_logical_address iInitiator, uint16_t iPhysicalAddress, bool bIsReply);
virtual bool TransmitCECVersion(const cec_logical_address iInitiator, const cec_logical_address iDestination, cec_version cecVersion, bool bIsReply);
bool CVLCommandHandler::SourceSwitchAllowed(void)
{
if (!PowerUpEventReceived())
- TransmitRequestPowerStatus(m_processor->GetPrimaryDevice()->GetLogicalAddress(), CECDEVICE_TV, false);
+ TransmitRequestPowerStatus(m_processor->GetPrimaryDevice()->GetLogicalAddress(), CECDEVICE_TV, false, false);
return PowerUpEventReceived();
}