cec: mark the active source as active and other devices as inactive. removed duplicat...
[deb_libcec.git] / src / lib / devices / CECPlaybackDevice.cpp
CommitLineData
51b2a094
LOK
1/*
2 * This file is part of the libCEC(R) library.
3 *
4 * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
5 * libCEC(R) is an original work, containing original code.
6 *
7 * libCEC(R) is a trademark of Pulse-Eight Limited.
8 *
9 * This program is dual-licensed; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 *
23 *
24 * Alternatively, you can license this library under a commercial license,
25 * please contact Pulse-Eight Licensing for more information.
26 *
27 * For more information contact:
28 * Pulse-Eight Licensing <license@pulse-eight.com>
29 * http://www.pulse-eight.com/
30 * http://www.pulse-eight.net/
31 */
32
33#include "CECPlaybackDevice.h"
28089abc
LOK
34#include "../implementations/CECCommandHandler.h"
35#include "../CECProcessor.h"
51b2a094
LOK
36
37using namespace CEC;
38
39CCECPlaybackDevice::CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = 0 */) :
8ac9c610
LOK
40 CCECBusDevice(processor, address, iPhysicalAddress),
41 m_deckStatus(CEC_DECK_INFO_NO_MEDIA)
51b2a094 42{
28089abc
LOK
43 m_type = CEC_DEVICE_TYPE_PLAYBACK_DEVICE;
44}
45
8ac9c610
LOK
46void CCECPlaybackDevice::SetDeckStatus(cec_deck_info deckStatus)
47{
48 if (m_deckStatus != deckStatus)
49 {
50 CStdString strLog;
51 strLog.Format(">> %s (%X): deck status changed from '%s' to '%s'", GetLogicalAddressName(), m_iLogicalAddress, CCECCommandHandler::ToString(m_deckStatus), CCECCommandHandler::ToString(deckStatus));
52 AddLog(CEC_LOG_DEBUG, strLog.c_str());
53
54 m_deckStatus = deckStatus;
55 }
56}
57
28089abc
LOK
58bool CCECPlaybackDevice::TransmitDeckStatus(cec_logical_address dest)
59{
60 // need to support opcodes play and deck control before doing anything with this
61 CStdString strLog;
62 strLog.Format("<< %s (%X) -> %s (%X): deck status feature abort", GetLogicalAddressName(), m_iLogicalAddress, CCECCommandHandler::ToString(dest), dest);
63 AddLog(CEC_LOG_NOTICE, strLog);
64
65 m_processor->TransmitAbort(dest, CEC_OPCODE_GIVE_DECK_STATUS);
66 return false;
51b2a094 67}