cec: bump version to 1.6.3. check the client version, not the server version in libce...
[deb_libcec.git] / src / lib / devices / CECDeviceMap.h
CommitLineData
004b8382
LOK
1#pragma once
2/*
3 * This file is part of the libCEC(R) library.
4 *
5 * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved.
6 * libCEC(R) is an original work, containing original code.
7 *
8 * libCEC(R) is a trademark of Pulse-Eight Limited.
9 *
10 * This program is dual-licensed; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23 *
24 *
25 * Alternatively, you can license this library under a commercial license,
26 * please contact Pulse-Eight Licensing for more information.
27 *
28 * For more information contact:
29 * Pulse-Eight Licensing <license@pulse-eight.com>
30 * http://www.pulse-eight.com/
31 * http://www.pulse-eight.net/
32 */
33
34#include "../../../include/cectypes.h"
35#include <map>
36#include <vector>
37
38namespace CEC
39{
40 class CCECBusDevice;
41
42 typedef std::map<cec_logical_address, CCECBusDevice *> CECDEVICEMAP;
43 typedef std::vector<CCECBusDevice *> CECDEVICEVEC;
44
45 class CCECProcessor;
46
47 class CCECDeviceMap
48 {
49 public:
50 CCECDeviceMap(CCECProcessor *processor);
51 virtual ~CCECDeviceMap(void);
52 CECDEVICEMAP::iterator Begin(void);
53 CECDEVICEMAP::iterator End(void);
54 void ResetDeviceStatus(void);
55 CCECBusDevice * operator[] (cec_logical_address iAddress) const;
56 CCECBusDevice * operator[] (uint8_t iAddress) const;
57 CCECBusDevice * At(cec_logical_address iAddress) const;
58 CCECBusDevice * At(uint8_t iAddress) const;
59 CCECBusDevice * GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bSuppressUpdate = true);
60
61 void Get(CECDEVICEVEC &devices) const;
62 void GetLibCECControlled(CECDEVICEVEC &devices) const;
63 void GetByLogicalAddresses(CECDEVICEVEC &devices, const cec_logical_addresses &addresses);
64 void GetActive(CECDEVICEVEC &devices) const;
65 void GetByType(const cec_device_type type, CECDEVICEVEC &devices) const;
66
67 void GetPowerOffDevices(const libcec_configuration &configuration, CECDEVICEVEC &devices) const;
68 void GetWakeDevices(const libcec_configuration &configuration, CECDEVICEVEC &devices) const;
69
70 CCECBusDevice *GetActiveSource(void) const;
71
72 static void FilterLibCECControlled(CECDEVICEVEC &devices);
73 static void FilterActive(CECDEVICEVEC &devices);
74 static void FilterTypes(const cec_device_type_list &types, CECDEVICEVEC &devices);
75 static void FilterType(const cec_device_type type, CECDEVICEVEC &devices);
76 static cec_logical_addresses ToLogicalAddresses(const CECDEVICEVEC &devices);
77 private:
78 void Clear(void);
79
80 CECDEVICEMAP m_busDevices;
81 CCECProcessor *m_processor;
82 };
83}