Commit | Line | Data |
---|---|---|
004b8382 LOK |
1 | #pragma once |
2 | /* | |
3 | * This file is part of the libCEC(R) library. | |
4 | * | |
16f47961 | 5 | * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved. |
004b8382 LOK |
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 | ||
004b8382 LOK |
34 | #include <map> |
35 | #include <vector> | |
36 | ||
37 | namespace CEC | |
38 | { | |
39 | class CCECBusDevice; | |
40 | ||
41 | typedef std::map<cec_logical_address, CCECBusDevice *> CECDEVICEMAP; | |
42 | typedef std::vector<CCECBusDevice *> CECDEVICEVEC; | |
43 | ||
44 | class CCECProcessor; | |
45 | ||
46 | class CCECDeviceMap | |
47 | { | |
48 | public: | |
49 | CCECDeviceMap(CCECProcessor *processor); | |
50 | virtual ~CCECDeviceMap(void); | |
51 | CECDEVICEMAP::iterator Begin(void); | |
52 | CECDEVICEMAP::iterator End(void); | |
53 | void ResetDeviceStatus(void); | |
54 | CCECBusDevice * operator[] (cec_logical_address iAddress) const; | |
55 | CCECBusDevice * operator[] (uint8_t iAddress) const; | |
56 | CCECBusDevice * At(cec_logical_address iAddress) const; | |
57 | CCECBusDevice * At(uint8_t iAddress) const; | |
58 | CCECBusDevice * GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bSuppressUpdate = true); | |
59 | ||
60 | void Get(CECDEVICEVEC &devices) const; | |
61 | void GetLibCECControlled(CECDEVICEVEC &devices) const; | |
62 | void GetByLogicalAddresses(CECDEVICEVEC &devices, const cec_logical_addresses &addresses); | |
63 | void GetActive(CECDEVICEVEC &devices) const; | |
64 | void GetByType(const cec_device_type type, CECDEVICEVEC &devices) const; | |
1a1e2e6c | 65 | void GetChildrenOf(CECDEVICEVEC& devices, CCECBusDevice* device) const; |
d3caa81b | 66 | void SignalAll(cec_opcode opcode); |
004b8382 LOK |
67 | |
68 | void GetPowerOffDevices(const libcec_configuration &configuration, CECDEVICEVEC &devices) const; | |
69 | void GetWakeDevices(const libcec_configuration &configuration, CECDEVICEVEC &devices) const; | |
70 | ||
71 | CCECBusDevice *GetActiveSource(void) const; | |
72 | ||
73 | static void FilterLibCECControlled(CECDEVICEVEC &devices); | |
74 | static void FilterActive(CECDEVICEVEC &devices); | |
75 | static void FilterTypes(const cec_device_type_list &types, CECDEVICEVEC &devices); | |
76 | static void FilterType(const cec_device_type type, CECDEVICEVEC &devices); | |
77 | static cec_logical_addresses ToLogicalAddresses(const CECDEVICEVEC &devices); | |
78 | private: | |
79 | void Clear(void); | |
80 | ||
81 | CECDEVICEMAP m_busDevices; | |
82 | CCECProcessor *m_processor; | |
83 | }; | |
84 | } |