Commit | Line | Data |
---|---|---|
abbca718 LOK |
1 | /* |
2 | * This file is part of the libCEC(R) library. | |
3 | * | |
b492c10e | 4 | * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved. |
abbca718 LOK |
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 | ||
2abe74eb | 33 | #include "CECProcessor.h" |
abbca718 | 34 | |
7bb4ed43 | 35 | #include "adapter/USBCECAdapterCommunication.h" |
eafa9d46 | 36 | #include "devices/CECBusDevice.h" |
51b2a094 LOK |
37 | #include "devices/CECAudioSystem.h" |
38 | #include "devices/CECPlaybackDevice.h" | |
39 | #include "devices/CECRecordingDevice.h" | |
40 | #include "devices/CECTuner.h" | |
41 | #include "devices/CECTV.h" | |
62f5527d | 42 | #include "implementations/CECCommandHandler.h" |
2abe74eb | 43 | #include "LibCEC.h" |
ba65909d | 44 | #include "platform/util/timeutils.h" |
abbca718 LOK |
45 | |
46 | using namespace CEC; | |
47 | using namespace std; | |
f00ff009 | 48 | using namespace PLATFORM; |
abbca718 | 49 | |
1113cb7d | 50 | CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, cec_logical_address iLogicalAddress /* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS*/) : |
f8513317 | 51 | m_bStarted(false), |
b64db02e | 52 | m_bInitialised(false), |
16b1e052 | 53 | m_iHDMIPort(CEC_DEFAULT_HDMI_PORT), |
d2f1c157 | 54 | m_iBaseDevice((cec_logical_address)CEC_DEFAULT_BASE_DEVICE), |
2abe74eb | 55 | m_strDeviceName(strDeviceName), |
99666519 | 56 | m_communication(NULL), |
8b7e5ff6 | 57 | m_controller(controller), |
7c63a480 | 58 | m_bMonitor(false), |
dcd240b2 | 59 | m_iStandardLineTimeout(3), |
5f316715 LOK |
60 | m_iRetryLineTimeout(3), |
61 | m_iLastTransmission(0) | |
abbca718 | 62 | { |
ab1469a0 LOK |
63 | m_logicalAddresses.Clear(); |
64 | m_logicalAddresses.Set(iLogicalAddress); | |
20b8870a | 65 | m_types.clear(); |
7871d66e | 66 | for (int iPtr = 0; iPtr <= 16; iPtr++) |
09c10b66 | 67 | m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, iPtr == iLogicalAddress ? iPhysicalAddress : 0); |
abbca718 LOK |
68 | } |
69 | ||
1113cb7d | 70 | CCECProcessor::CCECProcessor(CLibCEC *controller, const char *strDeviceName, const cec_device_type_list &types) : |
f8513317 | 71 | m_bStarted(false), |
b64db02e | 72 | m_bInitialised(false), |
16b1e052 | 73 | m_iHDMIPort(CEC_DEFAULT_HDMI_PORT), |
d2f1c157 | 74 | m_iBaseDevice((cec_logical_address)CEC_DEFAULT_BASE_DEVICE), |
f8513317 LOK |
75 | m_strDeviceName(strDeviceName), |
76 | m_types(types), | |
99666519 | 77 | m_communication(NULL), |
f8513317 | 78 | m_controller(controller), |
dcd240b2 LOK |
79 | m_bMonitor(false), |
80 | m_iStandardLineTimeout(3), | |
5f316715 LOK |
81 | m_iRetryLineTimeout(3), |
82 | m_iLastTransmission(0) | |
f8513317 | 83 | { |
ab1469a0 | 84 | m_logicalAddresses.Clear(); |
f8513317 | 85 | for (int iPtr = 0; iPtr < 16; iPtr++) |
51b2a094 LOK |
86 | { |
87 | switch(iPtr) | |
88 | { | |
89 | case CECDEVICE_AUDIOSYSTEM: | |
5d5a2dc2 | 90 | m_busDevices[iPtr] = new CCECAudioSystem(this, (cec_logical_address) iPtr, 0xFFFF); |
51b2a094 LOK |
91 | break; |
92 | case CECDEVICE_PLAYBACKDEVICE1: | |
93 | case CECDEVICE_PLAYBACKDEVICE2: | |
94 | case CECDEVICE_PLAYBACKDEVICE3: | |
5d5a2dc2 | 95 | m_busDevices[iPtr] = new CCECPlaybackDevice(this, (cec_logical_address) iPtr, 0xFFFF); |
51b2a094 LOK |
96 | break; |
97 | case CECDEVICE_RECORDINGDEVICE1: | |
98 | case CECDEVICE_RECORDINGDEVICE2: | |
99 | case CECDEVICE_RECORDINGDEVICE3: | |
5d5a2dc2 | 100 | m_busDevices[iPtr] = new CCECRecordingDevice(this, (cec_logical_address) iPtr, 0xFFFF); |
51b2a094 LOK |
101 | break; |
102 | case CECDEVICE_TUNER1: | |
103 | case CECDEVICE_TUNER2: | |
104 | case CECDEVICE_TUNER3: | |
105 | case CECDEVICE_TUNER4: | |
5d5a2dc2 | 106 | m_busDevices[iPtr] = new CCECTuner(this, (cec_logical_address) iPtr, 0xFFFF); |
51b2a094 LOK |
107 | break; |
108 | case CECDEVICE_TV: | |
109 | m_busDevices[iPtr] = new CCECTV(this, (cec_logical_address) iPtr, 0); | |
110 | break; | |
111 | default: | |
5d5a2dc2 | 112 | m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, 0xFFFF); |
51b2a094 LOK |
113 | break; |
114 | } | |
115 | } | |
f8513317 LOK |
116 | } |
117 | ||
2abe74eb | 118 | CCECProcessor::~CCECProcessor(void) |
abbca718 | 119 | { |
5f316715 | 120 | m_bStarted = false; |
8b0ee2cc | 121 | m_startCondition.Broadcast(); |
2abe74eb | 122 | StopThread(); |
7c63a480 | 123 | |
1113cb7d | 124 | delete m_communication; |
2abe74eb LOK |
125 | m_communication = NULL; |
126 | m_controller = NULL; | |
d1998c7b LOK |
127 | for (unsigned int iPtr = 0; iPtr < 16; iPtr++) |
128 | delete m_busDevices[iPtr]; | |
abbca718 LOK |
129 | } |
130 | ||
578c3905 | 131 | bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint32_t iTimeoutMs) |
abbca718 | 132 | { |
a674fd68 | 133 | bool bReturn(false); |
578c3905 | 134 | CLockObject lock(m_mutex); |
99666519 | 135 | if (m_communication) |
578c3905 | 136 | { |
99666519 | 137 | CLibCEC::AddLog(CEC_LOG_ERROR, "existing connection handler found"); |
578c3905 LOK |
138 | return bReturn; |
139 | } | |
1113cb7d | 140 | |
7bb4ed43 | 141 | m_communication = new CUSBCECAdapterCommunication(this, strPort, iBaudRate); |
99666519 | 142 | |
578c3905 LOK |
143 | /* check for an already opened connection */ |
144 | if (m_communication->IsOpen()) | |
1113cb7d | 145 | { |
5477a250 | 146 | CLibCEC::AddLog(CEC_LOG_ERROR, "connection already opened"); |
578c3905 LOK |
147 | return bReturn; |
148 | } | |
abbca718 | 149 | |
c520af4f LOK |
150 | uint64_t iNow = GetTimeMs(); |
151 | uint64_t iTarget = iTimeoutMs > 0 ? iNow + iTimeoutMs : iNow + CEC_DEFAULT_TRANSMIT_WAIT; | |
b057edad BL |
152 | unsigned iConnectTry(0), iPingTry(0), iFwVersionTry(0), iControlledTry(0); |
153 | bool bConnected(false), bPinged(false), bControlled(false); | |
c520af4f | 154 | |
578c3905 | 155 | /* open a new connection */ |
99666519 | 156 | while (iNow < iTarget && (bConnected = m_communication->Open(iTimeoutMs)) == false) |
3d78df91 LOK |
157 | { |
158 | CLibCEC::AddLog(CEC_LOG_ERROR, "could not open a connection (try %d)", ++iConnectTry); | |
159 | Sleep(500); | |
160 | iNow = GetTimeMs(); | |
161 | } | |
56035c86 | 162 | |
1fc16cfd | 163 | /* try to ping the adapter */ |
3d78df91 | 164 | while (bConnected && iNow < iTarget && (bPinged = m_communication->PingAdapter()) == false) |
c71891a3 | 165 | { |
3d78df91 LOK |
166 | CLibCEC::AddLog(CEC_LOG_ERROR, "the adapter did not respond correctly to a ping (try %d)", ++iPingTry); |
167 | Sleep(500); | |
168 | iNow = GetTimeMs(); | |
169 | } | |
1fc16cfd | 170 | |
3d78df91 LOK |
171 | /* try to read the firmware version */ |
172 | uint16_t iFirmwareVersion(CEC_FW_VERSION_UNKNOWN); | |
173 | while (bPinged && iNow < iTarget && (iFirmwareVersion = m_communication->GetFirmwareVersion()) == CEC_FW_VERSION_UNKNOWN) | |
174 | { | |
175 | CLibCEC::AddLog(CEC_LOG_ERROR, "the adapter did not respond with a correct firmware version (try %d)", ++iFwVersionTry); | |
176 | Sleep(500); | |
c520af4f | 177 | iNow = GetTimeMs(); |
c3c2d822 | 178 | } |
1fc16cfd | 179 | |
b057edad BL |
180 | if (iFirmwareVersion >= 2) |
181 | { | |
182 | /* try to set controlled mode */ | |
183 | while (bConnected && iNow < iTarget && (bControlled = m_communication->SetControlledMode(true)) == false) | |
184 | { | |
185 | CLibCEC::AddLog(CEC_LOG_ERROR, "the adapter did not respond correctly to setting controlled mode (try %d)", ++iControlledTry); | |
186 | Sleep(500); | |
187 | iNow = GetTimeMs(); | |
188 | } | |
189 | } | |
190 | ||
3d78df91 LOK |
191 | if ((bReturn = iFirmwareVersion != CEC_FW_VERSION_UNKNOWN) == true) |
192 | CLibCEC::AddLog(CEC_LOG_NOTICE, "connected to the CEC adapter. firmware version = %d", iFirmwareVersion); | |
193 | ||
578c3905 LOK |
194 | return bReturn; |
195 | } | |
196 | ||
2db8981f | 197 | void CCECProcessor::SetInitialised(bool bSetTo /* = true */) |
578c3905 | 198 | { |
578c3905 | 199 | CLockObject lock(m_mutex); |
2db8981f LOK |
200 | m_bInitialised = bSetTo; |
201 | } | |
578c3905 | 202 | |
2db8981f LOK |
203 | bool CCECProcessor::Initialise(void) |
204 | { | |
205 | bool bReturn(false); | |
578c3905 | 206 | { |
2db8981f LOK |
207 | CLockObject lock(m_mutex); |
208 | if (!m_logicalAddresses.IsEmpty()) | |
209 | m_logicalAddresses.Clear(); | |
578c3905 | 210 | |
2db8981f LOK |
211 | if (!FindLogicalAddresses()) |
212 | { | |
5477a250 | 213 | CLibCEC::AddLog(CEC_LOG_ERROR, "could not detect our logical addresses"); |
2db8981f LOK |
214 | return bReturn; |
215 | } | |
216 | ||
217 | /* only set our OSD name for the primary device */ | |
218 | m_busDevices[m_logicalAddresses.primary]->m_strDeviceName = m_strDeviceName; | |
219 | } | |
578c3905 LOK |
220 | |
221 | /* get the vendor id from the TV, so we are using the correct handler */ | |
222 | m_busDevices[CECDEVICE_TV]->RequestVendorId(); | |
223 | ReplaceHandlers(); | |
224 | ||
225 | if ((bReturn = SetHDMIPort(m_iBaseDevice, m_iHDMIPort, true)) == false) | |
5477a250 | 226 | CLibCEC::AddLog(CEC_LOG_ERROR, "unable to set HDMI port %d on %s (%x)", m_iHDMIPort, ToString(m_iBaseDevice), (uint8_t)m_iBaseDevice); |
2db8981f LOK |
227 | |
228 | SetInitialised(bReturn); | |
578c3905 LOK |
229 | |
230 | return bReturn; | |
231 | } | |
232 | ||
233 | bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = 38400 */, uint32_t iTimeoutMs /* = 10000 */) | |
234 | { | |
235 | bool bReturn(false); | |
236 | ||
237 | { | |
238 | CLockObject lock(m_mutex); | |
239 | if (!OpenConnection(strPort, iBaudRate, iTimeoutMs)) | |
a674fd68 | 240 | return bReturn; |
994dbaaa | 241 | |
a674fd68 | 242 | /* create the processor thread */ |
f00ff009 | 243 | if (!CreateThread() || !m_startCondition.Wait(m_mutex) || !m_bStarted) |
a674fd68 | 244 | { |
5477a250 | 245 | CLibCEC::AddLog(CEC_LOG_ERROR, "could not create a processor thread"); |
a674fd68 | 246 | return bReturn; |
994dbaaa | 247 | } |
a674fd68 LOK |
248 | } |
249 | ||
578c3905 | 250 | if ((bReturn = Initialise()) == false) |
a674fd68 | 251 | { |
5477a250 | 252 | CLibCEC::AddLog(CEC_LOG_ERROR, "could not create a processor thread"); |
578c3905 | 253 | StopThread(true); |
a674fd68 LOK |
254 | } |
255 | else | |
256 | { | |
5477a250 | 257 | CLibCEC::AddLog(CEC_LOG_DEBUG, "processor thread started"); |
a674fd68 LOK |
258 | } |
259 | ||
260 | return bReturn; | |
abbca718 LOK |
261 | } |
262 | ||
b58d9277 | 263 | bool CCECProcessor::TryLogicalAddress(cec_logical_address address) |
f8513317 | 264 | { |
93fff5c1 | 265 | if (m_busDevices[address]->TryLogicalAddress()) |
f8513317 | 266 | { |
ab1469a0 | 267 | m_logicalAddresses.Set(address); |
f8513317 LOK |
268 | return true; |
269 | } | |
270 | ||
f8513317 LOK |
271 | return false; |
272 | } | |
273 | ||
b58d9277 | 274 | bool CCECProcessor::FindLogicalAddressRecordingDevice(void) |
f8513317 | 275 | { |
5477a250 | 276 | CLibCEC::AddLog(CEC_LOG_DEBUG, "detecting logical address for type 'recording device'"); |
b58d9277 LOK |
277 | return TryLogicalAddress(CECDEVICE_RECORDINGDEVICE1) || |
278 | TryLogicalAddress(CECDEVICE_RECORDINGDEVICE2) || | |
279 | TryLogicalAddress(CECDEVICE_RECORDINGDEVICE3); | |
f8513317 LOK |
280 | } |
281 | ||
b58d9277 | 282 | bool CCECProcessor::FindLogicalAddressTuner(void) |
f8513317 | 283 | { |
5477a250 | 284 | CLibCEC::AddLog(CEC_LOG_DEBUG, "detecting logical address for type 'tuner'"); |
b58d9277 LOK |
285 | return TryLogicalAddress(CECDEVICE_TUNER1) || |
286 | TryLogicalAddress(CECDEVICE_TUNER2) || | |
287 | TryLogicalAddress(CECDEVICE_TUNER3) || | |
288 | TryLogicalAddress(CECDEVICE_TUNER4); | |
f8513317 LOK |
289 | } |
290 | ||
b58d9277 | 291 | bool CCECProcessor::FindLogicalAddressPlaybackDevice(void) |
f8513317 | 292 | { |
5477a250 | 293 | CLibCEC::AddLog(CEC_LOG_DEBUG, "detecting logical address for type 'playback device'"); |
b58d9277 LOK |
294 | return TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE1) || |
295 | TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE2) || | |
296 | TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE3); | |
f8513317 LOK |
297 | } |
298 | ||
b58d9277 | 299 | bool CCECProcessor::FindLogicalAddressAudioSystem(void) |
f8513317 | 300 | { |
5477a250 | 301 | CLibCEC::AddLog(CEC_LOG_DEBUG, "detecting logical address for type 'audio'"); |
b58d9277 | 302 | return TryLogicalAddress(CECDEVICE_AUDIOSYSTEM); |
f8513317 LOK |
303 | } |
304 | ||
3e61b350 LOK |
305 | bool CCECProcessor::ChangeDeviceType(cec_device_type from, cec_device_type to) |
306 | { | |
307 | bool bChanged(false); | |
308 | ||
5477a250 | 309 | CLibCEC::AddLog(CEC_LOG_NOTICE, "changing device type '%s' into '%s'", ToString(from), ToString(to)); |
3e61b350 | 310 | |
f00ff009 | 311 | CLockObject lock(m_mutex); |
3e61b350 LOK |
312 | CCECBusDevice *previousDevice = GetDeviceByType(from); |
313 | m_logicalAddresses.primary = CECDEVICE_UNKNOWN; | |
314 | ||
315 | for (unsigned int iPtr = 0; iPtr < 5; iPtr++) | |
316 | { | |
317 | if (m_types.types[iPtr] == CEC_DEVICE_TYPE_RESERVED) | |
318 | continue; | |
319 | ||
320 | if (m_types.types[iPtr] == from) | |
321 | { | |
322 | bChanged = true; | |
323 | m_types.types[iPtr] = to; | |
324 | } | |
325 | else if (m_types.types[iPtr] == to && bChanged) | |
326 | { | |
327 | m_types.types[iPtr] = CEC_DEVICE_TYPE_RESERVED; | |
328 | } | |
329 | } | |
330 | ||
331 | if (bChanged) | |
332 | { | |
333 | FindLogicalAddresses(); | |
334 | ||
335 | CCECBusDevice *newDevice = GetDeviceByType(to); | |
336 | if (previousDevice && newDevice) | |
337 | { | |
338 | newDevice->SetDeviceStatus(CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC); | |
4478bc79 | 339 | previousDevice->SetDeviceStatus(CEC_DEVICE_STATUS_NOT_PRESENT); |
3e61b350 LOK |
340 | |
341 | newDevice->SetCecVersion(previousDevice->GetCecVersion(false)); | |
342 | previousDevice->SetCecVersion(CEC_VERSION_UNKNOWN); | |
343 | ||
344 | newDevice->SetMenuLanguage(previousDevice->GetMenuLanguage(false)); | |
345 | cec_menu_language lang; | |
346 | lang.device = previousDevice->GetLogicalAddress(); | |
347 | for (unsigned int iPtr = 0; iPtr < 4; iPtr++) | |
348 | lang.language[iPtr] = '?'; | |
349 | lang.language[3] = 0; | |
350 | previousDevice->SetMenuLanguage(lang); | |
351 | ||
352 | newDevice->SetMenuState(previousDevice->GetMenuState()); | |
353 | previousDevice->SetMenuState(CEC_MENU_STATE_DEACTIVATED); | |
354 | ||
355 | newDevice->SetOSDName(previousDevice->GetOSDName(false)); | |
356 | previousDevice->SetOSDName(ToString(previousDevice->GetLogicalAddress())); | |
357 | ||
358 | newDevice->SetPhysicalAddress(previousDevice->GetPhysicalAddress(false)); | |
359 | previousDevice->SetPhysicalAddress(0xFFFF); | |
360 | ||
361 | newDevice->SetPowerStatus(previousDevice->GetPowerStatus(false)); | |
362 | previousDevice->SetPowerStatus(CEC_POWER_STATUS_UNKNOWN); | |
363 | ||
364 | newDevice->SetVendorId(previousDevice->GetVendorId(false)); | |
365 | previousDevice->SetVendorId(CEC_VENDOR_UNKNOWN); | |
366 | ||
367 | if ((from == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || from == CEC_DEVICE_TYPE_RECORDING_DEVICE) && | |
368 | (to == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || to == CEC_DEVICE_TYPE_RECORDING_DEVICE)) | |
369 | { | |
370 | ((CCECPlaybackDevice *) newDevice)->SetDeckControlMode(((CCECPlaybackDevice *) previousDevice)->GetDeckControlMode()); | |
371 | ((CCECPlaybackDevice *) previousDevice)->SetDeckControlMode(CEC_DECK_CONTROL_MODE_STOP); | |
372 | ||
373 | ((CCECPlaybackDevice *) newDevice)->SetDeckStatus(((CCECPlaybackDevice *) previousDevice)->GetDeckStatus()); | |
374 | ((CCECPlaybackDevice *) previousDevice)->SetDeckStatus(CEC_DECK_INFO_STOP); | |
375 | } | |
376 | } | |
377 | } | |
378 | ||
379 | return true; | |
380 | } | |
381 | ||
f8513317 LOK |
382 | bool CCECProcessor::FindLogicalAddresses(void) |
383 | { | |
384 | bool bReturn(true); | |
ab1469a0 | 385 | m_logicalAddresses.Clear(); |
f8513317 LOK |
386 | |
387 | for (unsigned int iPtr = 0; iPtr < 5; iPtr++) | |
388 | { | |
389 | if (m_types.types[iPtr] == CEC_DEVICE_TYPE_RESERVED) | |
390 | continue; | |
391 | ||
5477a250 | 392 | CLibCEC::AddLog(CEC_LOG_DEBUG, "%s - device %d: type %d", __FUNCTION__, iPtr, m_types.types[iPtr]); |
f8513317 LOK |
393 | |
394 | if (m_types.types[iPtr] == CEC_DEVICE_TYPE_RECORDING_DEVICE) | |
b58d9277 | 395 | bReturn &= FindLogicalAddressRecordingDevice(); |
f8513317 | 396 | if (m_types.types[iPtr] == CEC_DEVICE_TYPE_TUNER) |
b58d9277 | 397 | bReturn &= FindLogicalAddressTuner(); |
f8513317 | 398 | if (m_types.types[iPtr] == CEC_DEVICE_TYPE_PLAYBACK_DEVICE) |
b58d9277 | 399 | bReturn &= FindLogicalAddressPlaybackDevice(); |
f8513317 | 400 | if (m_types.types[iPtr] == CEC_DEVICE_TYPE_AUDIO_SYSTEM) |
b58d9277 | 401 | bReturn &= FindLogicalAddressAudioSystem(); |
f8513317 LOK |
402 | } |
403 | ||
a674fd68 LOK |
404 | if (bReturn) |
405 | SetAckMask(m_logicalAddresses.AckMask()); | |
406 | ||
f8513317 LOK |
407 | return bReturn; |
408 | } | |
409 | ||
a3ffc068 LOK |
410 | void CCECProcessor::ReplaceHandlers(void) |
411 | { | |
412 | for (uint8_t iPtr = 0; iPtr <= CECDEVICE_PLAYBACKDEVICE3; iPtr++) | |
591170fd | 413 | m_busDevices[iPtr]->ReplaceHandler(m_bInitialised); |
a3ffc068 LOK |
414 | } |
415 | ||
2abe74eb | 416 | void *CCECProcessor::Process(void) |
f99bc831 | 417 | { |
8747dd4f | 418 | bool bParseFrame(false); |
e0407d3d LOK |
419 | cec_command command; |
420 | CCECAdapterMessage msg; | |
421 | ||
8b0ee2cc | 422 | { |
f00ff009 | 423 | CLockObject lock(m_mutex); |
9fd73dd4 | 424 | m_bStarted = true; |
5477a250 | 425 | CLibCEC::AddLog(CEC_LOG_DEBUG, "processor thread started"); |
9fd73dd4 | 426 | m_startCondition.Signal(); |
8b0ee2cc | 427 | } |
abbca718 | 428 | |
13fd6a66 | 429 | while (!IsStopped()) |
abbca718 | 430 | { |
591170fd | 431 | ReplaceHandlers(); |
ab1469a0 | 432 | command.Clear(); |
76321de4 | 433 | |
60fa4578 | 434 | { |
f00ff009 | 435 | CLockObject lock(m_mutex); |
8747dd4f | 436 | if (m_commandBuffer.Pop(command)) |
8747dd4f | 437 | bParseFrame = true; |
7bb4ed43 LOK |
438 | else if (m_communication->IsOpen() && m_communication->Read(command, 50)) |
439 | bParseFrame = true; | |
60fa4578 LOK |
440 | } |
441 | ||
13fd6a66 | 442 | if (bParseFrame) |
9dee1670 | 443 | ParseCommand(command); |
8747dd4f | 444 | bParseFrame = false; |
abbca718 | 445 | |
b5f34cf9 LOK |
446 | Sleep(5); |
447 | ||
13fd6a66 | 448 | m_controller->CheckKeypressTimeout(); |
abbca718 LOK |
449 | } |
450 | ||
1113cb7d LOK |
451 | if (m_communication) |
452 | m_communication->Close(); | |
453 | ||
60fa4578 | 454 | return NULL; |
abbca718 LOK |
455 | } |
456 | ||
18203d17 | 457 | bool CCECProcessor::SetActiveSource(cec_device_type type /* = CEC_DEVICE_TYPE_RESERVED */) |
abbca718 | 458 | { |
8ac9c610 LOK |
459 | bool bReturn(false); |
460 | ||
60fa4578 | 461 | if (!IsRunning()) |
8ac9c610 | 462 | return bReturn; |
f99bc831 | 463 | |
18203d17 | 464 | cec_logical_address addr = m_logicalAddresses.primary; |
04437dcf | 465 | |
18203d17 LOK |
466 | if (type != CEC_DEVICE_TYPE_RESERVED) |
467 | { | |
90ea9066 | 468 | for (uint8_t iPtr = 0; iPtr <= 11; iPtr++) |
18203d17 LOK |
469 | { |
470 | if (m_logicalAddresses[iPtr] && m_busDevices[iPtr]->m_type == type) | |
471 | { | |
472 | addr = (cec_logical_address) iPtr; | |
473 | break; | |
474 | } | |
475 | } | |
476 | } | |
477 | ||
37b0c572 | 478 | m_busDevices[addr]->SetActiveSource(); |
d383d6d0 | 479 | if (m_busDevices[addr]->GetPhysicalAddress(false) != 0xFFFF) |
e046c7bf LOK |
480 | { |
481 | bReturn = m_busDevices[addr]->TransmitActiveSource(); | |
482 | ||
4478bc79 LOK |
483 | if (bReturn) |
484 | { | |
485 | m_busDevices[addr]->SetMenuState(CEC_MENU_STATE_ACTIVATED); | |
486 | m_busDevices[addr]->TransmitMenuState(CECDEVICE_TV); | |
487 | } | |
488 | ||
e046c7bf LOK |
489 | if (bReturn && (m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE || |
490 | m_busDevices[addr]->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE) && | |
491 | m_busDevices[addr]->GetHandler()->SendDeckStatusUpdateOnActiveSource()) | |
492 | { | |
493 | bReturn = ((CCECPlaybackDevice *)m_busDevices[addr])->TransmitDeckStatus(CECDEVICE_TV); | |
494 | } | |
495 | } | |
8d915412 LOK |
496 | |
497 | return bReturn; | |
18203d17 LOK |
498 | } |
499 | ||
37b0c572 LOK |
500 | bool CCECProcessor::SetActiveSource(uint16_t iStreamPath) |
501 | { | |
502 | bool bReturn(false); | |
503 | ||
504 | CCECBusDevice *device = GetDeviceByPhysicalAddress(iStreamPath); | |
505 | if (device) | |
506 | { | |
507 | device->SetActiveSource(); | |
508 | bReturn = true; | |
509 | } | |
510 | ||
511 | return bReturn; | |
512 | } | |
513 | ||
dcd240b2 LOK |
514 | void CCECProcessor::SetStandardLineTimeout(uint8_t iTimeout) |
515 | { | |
f00ff009 | 516 | CLockObject lock(m_mutex); |
dcd240b2 LOK |
517 | m_iStandardLineTimeout = iTimeout; |
518 | } | |
519 | ||
520 | void CCECProcessor::SetRetryLineTimeout(uint8_t iTimeout) | |
521 | { | |
f00ff009 | 522 | CLockObject lock(m_mutex); |
dcd240b2 LOK |
523 | m_iRetryLineTimeout = iTimeout; |
524 | } | |
525 | ||
18203d17 LOK |
526 | bool CCECProcessor::SetActiveView(void) |
527 | { | |
4a870dc8 | 528 | return SetActiveSource(m_types.IsEmpty() ? CEC_DEVICE_TYPE_RESERVED : m_types[0]); |
8ac9c610 LOK |
529 | } |
530 | ||
28fa6c97 | 531 | bool CCECProcessor::SetDeckControlMode(cec_deck_control_mode mode, bool bSendUpdate /* = true */) |
a9232a79 LOK |
532 | { |
533 | bool bReturn(false); | |
534 | ||
535 | CCECBusDevice *device = GetDeviceByType(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); | |
536 | if (device) | |
537 | { | |
538 | ((CCECPlaybackDevice *) device)->SetDeckControlMode(mode); | |
28fa6c97 LOK |
539 | if (bSendUpdate) |
540 | ((CCECPlaybackDevice *) device)->TransmitDeckStatus(CECDEVICE_TV); | |
a9232a79 LOK |
541 | bReturn = true; |
542 | } | |
543 | ||
544 | return bReturn; | |
545 | } | |
546 | ||
28fa6c97 | 547 | bool CCECProcessor::SetDeckInfo(cec_deck_info info, bool bSendUpdate /* = true */) |
a9232a79 LOK |
548 | { |
549 | bool bReturn(false); | |
550 | ||
551 | CCECBusDevice *device = GetDeviceByType(CEC_DEVICE_TYPE_PLAYBACK_DEVICE); | |
552 | if (device) | |
553 | { | |
554 | ((CCECPlaybackDevice *) device)->SetDeckStatus(info); | |
28fa6c97 LOK |
555 | if (bSendUpdate) |
556 | ((CCECPlaybackDevice *) device)->TransmitDeckStatus(CECDEVICE_TV); | |
a9232a79 LOK |
557 | bReturn = true; |
558 | } | |
559 | ||
560 | return bReturn; | |
561 | } | |
562 | ||
d2f1c157 | 563 | bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice, uint8_t iPort, bool bForce /* = false */) |
16b1e052 LOK |
564 | { |
565 | bool bReturn(false); | |
f00ff009 | 566 | CLockObject lock(m_mutex); |
16b1e052 | 567 | |
89b3c9df LOK |
568 | m_iBaseDevice = iBaseDevice; |
569 | m_iHDMIPort = iPort; | |
570 | if (!m_bStarted && !bForce) | |
571 | return true; | |
16b1e052 | 572 | |
5477a250 | 573 | CLibCEC::AddLog(CEC_LOG_DEBUG, "setting HDMI port to %d on device %s (%d)", iPort, ToString(iBaseDevice), (int)iBaseDevice); |
56035c86 | 574 | |
16b1e052 | 575 | uint16_t iPhysicalAddress(0); |
1e7afacd | 576 | if (iBaseDevice > CECDEVICE_TV) |
5d0c1164 | 577 | { |
f00ff009 | 578 | lock.Unlock(); |
1e7afacd | 579 | iPhysicalAddress = m_busDevices[iBaseDevice]->GetPhysicalAddress(); |
5d0c1164 LOK |
580 | lock.Lock(); |
581 | } | |
1e7afacd | 582 | |
a674fd68 | 583 | if (iPhysicalAddress < 0xffff) |
1e7afacd | 584 | { |
1e7afacd | 585 | if (iPhysicalAddress == 0) |
5d355340 | 586 | iPhysicalAddress += 0x1000 * iPort; |
1e7afacd | 587 | else if (iPhysicalAddress % 0x1000 == 0) |
5d355340 | 588 | iPhysicalAddress += 0x100 * iPort; |
1e7afacd | 589 | else if (iPhysicalAddress % 0x100 == 0) |
5d355340 | 590 | iPhysicalAddress += 0x10 * iPort; |
1e7afacd | 591 | else if (iPhysicalAddress % 0x10 == 0) |
5d355340 | 592 | iPhysicalAddress += iPort; |
1e7afacd | 593 | |
5d355340 | 594 | bReturn = true; |
16b1e052 LOK |
595 | } |
596 | ||
a674fd68 | 597 | if (!bReturn) |
5477a250 | 598 | CLibCEC::AddLog(CEC_LOG_ERROR, "failed to set the physical address"); |
f070564b LOK |
599 | else |
600 | { | |
f00ff009 | 601 | lock.Unlock(); |
f070564b LOK |
602 | SetPhysicalAddress(iPhysicalAddress); |
603 | } | |
a674fd68 | 604 | |
16b1e052 LOK |
605 | return bReturn; |
606 | } | |
607 | ||
45b97de7 | 608 | bool CCECProcessor::PhysicalAddressInUse(uint16_t iPhysicalAddress) |
16b1e052 | 609 | { |
9fd73dd4 | 610 | for (unsigned int iPtr = 0; iPtr < 15; iPtr++) |
16b1e052 LOK |
611 | { |
612 | if (m_busDevices[iPtr]->GetPhysicalAddress(false) == iPhysicalAddress) | |
613 | return true; | |
614 | } | |
615 | return false; | |
616 | } | |
617 | ||
ab27363d | 618 | bool CCECProcessor::TransmitInactiveSource(void) |
abbca718 | 619 | { |
60fa4578 | 620 | if (!IsRunning()) |
f99bc831 LOK |
621 | return false; |
622 | ||
ab1469a0 | 623 | if (!m_logicalAddresses.IsEmpty() && m_busDevices[m_logicalAddresses.primary]) |
ab27363d | 624 | return m_busDevices[m_logicalAddresses.primary]->TransmitInactiveSource(); |
cc60ab1c | 625 | return false; |
abbca718 LOK |
626 | } |
627 | ||
9dee1670 | 628 | void CCECProcessor::LogOutput(const cec_command &data) |
abbca718 | 629 | { |
1d3ca3de | 630 | CStdString strTx; |
57f45e6c LOK |
631 | strTx.Format("<< %02x", ((uint8_t)data.initiator << 4) + (uint8_t)data.destination); |
632 | if (data.opcode_set) | |
633 | strTx.AppendFormat(":%02x", (uint8_t)data.opcode); | |
9dee1670 | 634 | |
06a1f7ce | 635 | for (uint8_t iPtr = 0; iPtr < data.parameters.size; iPtr++) |
1d3ca3de | 636 | strTx.AppendFormat(":%02x", data.parameters[iPtr]); |
5477a250 | 637 | CLibCEC::AddLog(CEC_LOG_TRAFFIC, strTx.c_str()); |
9dee1670 | 638 | } |
2abe74eb | 639 | |
06bfd4d7 | 640 | bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress) |
abbca718 | 641 | { |
f00ff009 | 642 | CLockObject lock(m_mutex); |
f8513317 | 643 | if (m_logicalAddresses.primary != iLogicalAddress) |
06775107 | 644 | { |
5477a250 | 645 | CLibCEC::AddLog(CEC_LOG_NOTICE, "<< setting primary logical address to %1x", iLogicalAddress); |
f8513317 | 646 | m_logicalAddresses.primary = iLogicalAddress; |
ab1469a0 LOK |
647 | m_logicalAddresses.Set(iLogicalAddress); |
648 | return SetAckMask(m_logicalAddresses.AckMask()); | |
06775107 | 649 | } |
2abe74eb | 650 | |
06bfd4d7 | 651 | return true; |
abbca718 | 652 | } |
825ddb96 | 653 | |
28fa6c97 LOK |
654 | bool CCECProcessor::SetMenuState(cec_menu_state state, bool bSendUpdate /* = true */) |
655 | { | |
656 | for (uint8_t iPtr = 0; iPtr < 16; iPtr++) | |
657 | { | |
658 | if (m_logicalAddresses[iPtr]) | |
659 | m_busDevices[iPtr]->SetMenuState(state); | |
660 | } | |
661 | ||
662 | if (bSendUpdate) | |
663 | m_busDevices[m_logicalAddresses.primary]->TransmitMenuState(CECDEVICE_TV); | |
664 | ||
665 | return true; | |
666 | } | |
667 | ||
bebb19dc | 668 | bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress, bool bSendUpdate /* = true */) |
2492216a | 669 | { |
f070564b LOK |
670 | bool bSendActiveView(false); |
671 | bool bReturn(false); | |
4d6f5ac7 | 672 | cec_logical_addresses sendUpdatesTo; |
ff684fef | 673 | |
f070564b | 674 | { |
f00ff009 | 675 | CLockObject lock(m_mutex); |
f070564b LOK |
676 | if (!m_logicalAddresses.IsEmpty()) |
677 | { | |
678 | bool bWasActiveSource(false); | |
679 | for (uint8_t iPtr = 0; iPtr < 15; iPtr++) | |
680 | if (m_logicalAddresses[iPtr]) | |
681 | { | |
682 | bWasActiveSource |= m_busDevices[iPtr]->IsActiveSource(); | |
683 | m_busDevices[iPtr]->SetInactiveSource(); | |
684 | m_busDevices[iPtr]->SetPhysicalAddress(iPhysicalAddress); | |
685 | if (bSendUpdate) | |
4d6f5ac7 | 686 | sendUpdatesTo.Set((cec_logical_address)iPtr); |
f070564b LOK |
687 | } |
688 | ||
689 | bSendActiveView = bWasActiveSource && bSendUpdate; | |
690 | bReturn = true; | |
691 | } | |
cc60ab1c | 692 | } |
f070564b | 693 | |
4d6f5ac7 LOK |
694 | for (uint8_t iPtr = 0; iPtr < 15; iPtr++) |
695 | if (sendUpdatesTo[iPtr]) | |
696 | m_busDevices[iPtr]->TransmitPhysicalAddress(); | |
697 | ||
f070564b LOK |
698 | if (bSendActiveView) |
699 | SetActiveView(); | |
700 | ||
701 | return bReturn; | |
1969b140 LOK |
702 | } |
703 | ||
8b7e5ff6 LOK |
704 | bool CCECProcessor::SwitchMonitoring(bool bEnable) |
705 | { | |
5477a250 | 706 | CLibCEC::AddLog(CEC_LOG_NOTICE, "== %s monitoring mode ==", bEnable ? "enabling" : "disabling"); |
8b7e5ff6 | 707 | |
855a3a98 | 708 | { |
f00ff009 | 709 | CLockObject lock(m_mutex); |
855a3a98 | 710 | m_bMonitor = bEnable; |
855a3a98 LOK |
711 | } |
712 | ||
8b7e5ff6 | 713 | if (bEnable) |
06bfd4d7 | 714 | return SetAckMask(0); |
8b7e5ff6 | 715 | else |
ab1469a0 | 716 | return SetAckMask(m_logicalAddresses.AckMask()); |
8b7e5ff6 LOK |
717 | } |
718 | ||
57f45e6c LOK |
719 | bool CCECProcessor::PollDevice(cec_logical_address iAddress) |
720 | { | |
721 | if (iAddress != CECDEVICE_UNKNOWN && m_busDevices[iAddress]) | |
95a73fa7 LOK |
722 | { |
723 | return m_logicalAddresses.primary == CECDEVICE_UNKNOWN ? | |
724 | m_busDevices[iAddress]->TransmitPoll(iAddress) : | |
725 | m_busDevices[m_logicalAddresses.primary]->TransmitPoll(iAddress); | |
726 | } | |
57f45e6c LOK |
727 | return false; |
728 | } | |
729 | ||
5c73f7f7 | 730 | uint8_t CCECProcessor::VolumeUp(bool bSendRelease /* = true */) |
04e637f9 LOK |
731 | { |
732 | uint8_t status = 0; | |
37b0c572 | 733 | if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM)) |
5c73f7f7 | 734 | status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeUp(bSendRelease); |
04e637f9 LOK |
735 | |
736 | return status; | |
737 | } | |
738 | ||
5c73f7f7 | 739 | uint8_t CCECProcessor::VolumeDown(bool bSendRelease /* = true */) |
04e637f9 LOK |
740 | { |
741 | uint8_t status = 0; | |
37b0c572 | 742 | if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM)) |
5c73f7f7 | 743 | status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->VolumeDown(bSendRelease); |
04e637f9 LOK |
744 | |
745 | return status; | |
746 | } | |
747 | ||
5c73f7f7 | 748 | uint8_t CCECProcessor::MuteAudio(bool bSendRelease /* = true */) |
04e637f9 LOK |
749 | { |
750 | uint8_t status = 0; | |
37b0c572 | 751 | if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM)) |
5c73f7f7 | 752 | status = ((CCECAudioSystem *)m_busDevices[CECDEVICE_AUDIOSYSTEM])->MuteAudio(bSendRelease); |
04e637f9 LOK |
753 | |
754 | return status; | |
755 | } | |
756 | ||
16b1e052 | 757 | CCECBusDevice *CCECProcessor::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress, bool bRefresh /* = false */) const |
8ac9c610 | 758 | { |
16b1e052 | 759 | if (m_busDevices[m_logicalAddresses.primary]->GetPhysicalAddress(false) == iPhysicalAddress) |
b58d9277 | 760 | return m_busDevices[m_logicalAddresses.primary]; |
8ac9c610 | 761 | |
b58d9277 | 762 | CCECBusDevice *device = NULL; |
8ac9c610 LOK |
763 | for (unsigned int iPtr = 0; iPtr < 16; iPtr++) |
764 | { | |
16b1e052 | 765 | if (m_busDevices[iPtr]->GetPhysicalAddress(bRefresh) == iPhysicalAddress) |
8ac9c610 LOK |
766 | { |
767 | device = m_busDevices[iPtr]; | |
768 | break; | |
769 | } | |
770 | } | |
771 | ||
772 | return device; | |
773 | } | |
774 | ||
a9232a79 LOK |
775 | CCECBusDevice *CCECProcessor::GetDeviceByType(cec_device_type type) const |
776 | { | |
777 | CCECBusDevice *device = NULL; | |
778 | ||
7619faad | 779 | for (uint8_t iPtr = 0; iPtr < 16; iPtr++) |
a9232a79 | 780 | { |
b64db02e | 781 | if (m_busDevices[iPtr]->m_type == type && m_logicalAddresses[iPtr]) |
a9232a79 LOK |
782 | { |
783 | device = m_busDevices[iPtr]; | |
784 | break; | |
785 | } | |
786 | } | |
787 | ||
788 | return device; | |
789 | } | |
790 | ||
842262d8 LOK |
791 | CCECBusDevice *CCECProcessor::GetPrimaryDevice(void) const |
792 | { | |
793 | CCECBusDevice *device(NULL); | |
794 | cec_logical_address primary = m_logicalAddresses.primary; | |
795 | if (primary != CECDEVICE_UNKNOWN) | |
796 | device = m_busDevices[primary]; | |
797 | return device; | |
798 | } | |
799 | ||
6a1c0009 LOK |
800 | cec_version CCECProcessor::GetDeviceCecVersion(cec_logical_address iAddress) |
801 | { | |
802 | return m_busDevices[iAddress]->GetCecVersion(); | |
803 | } | |
804 | ||
ed21be2a LOK |
805 | cec_osd_name CCECProcessor::GetDeviceOSDName(cec_logical_address iAddress) |
806 | { | |
807 | CStdString strOSDName = m_busDevices[iAddress]->GetOSDName(); | |
808 | cec_osd_name retVal; | |
809 | ||
810 | snprintf(retVal.name, sizeof(retVal.name), "%s", strOSDName.c_str()); | |
811 | retVal.device = iAddress; | |
812 | ||
813 | return retVal; | |
814 | } | |
815 | ||
a3269a0a LOK |
816 | bool CCECProcessor::GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language) |
817 | { | |
cc60ab1c LOK |
818 | if (m_busDevices[iAddress]) |
819 | { | |
820 | *language = m_busDevices[iAddress]->GetMenuLanguage(); | |
5744fbba | 821 | return (strcmp(language->language, "???") != 0); |
cc60ab1c LOK |
822 | } |
823 | return false; | |
a3269a0a LOK |
824 | } |
825 | ||
44c74256 LOK |
826 | uint64_t CCECProcessor::GetDeviceVendorId(cec_logical_address iAddress) |
827 | { | |
cc60ab1c LOK |
828 | if (m_busDevices[iAddress]) |
829 | return m_busDevices[iAddress]->GetVendorId(); | |
830 | return false; | |
44c74256 LOK |
831 | } |
832 | ||
eab72c40 LOK |
833 | uint16_t CCECProcessor::GetDevicePhysicalAddress(cec_logical_address iAddress) |
834 | { | |
835 | if (m_busDevices[iAddress]) | |
836 | return m_busDevices[iAddress]->GetPhysicalAddress(false); | |
837 | return false; | |
838 | } | |
839 | ||
e55f3f70 LOK |
840 | cec_power_status CCECProcessor::GetDevicePowerStatus(cec_logical_address iAddress) |
841 | { | |
cc60ab1c LOK |
842 | if (m_busDevices[iAddress]) |
843 | return m_busDevices[iAddress]->GetPowerStatus(); | |
844 | return CEC_POWER_STATUS_UNKNOWN; | |
e55f3f70 LOK |
845 | } |
846 | ||
b4b1b49b LOK |
847 | cec_logical_address CCECProcessor::GetActiveSource(void) |
848 | { | |
849 | for (uint8_t iPtr = 0; iPtr <= 11; iPtr++) | |
850 | { | |
851 | if (m_busDevices[iPtr]->IsActiveSource()) | |
852 | return (cec_logical_address)iPtr; | |
853 | } | |
854 | ||
855 | return CECDEVICE_UNKNOWN; | |
856 | } | |
857 | ||
858 | bool CCECProcessor::IsActiveSource(cec_logical_address iAddress) | |
859 | { | |
860 | return m_busDevices[iAddress]->IsActiveSource(); | |
861 | } | |
862 | ||
8d84e2c0 | 863 | bool CCECProcessor::Transmit(const cec_command &data) |
825ddb96 | 864 | { |
7bb4ed43 | 865 | cec_adapter_message_state retVal(ADAPTER_MESSAGE_STATE_UNKNOWN); |
eb35e4ca | 866 | { |
7bb4ed43 LOK |
867 | CLockObject lock(m_mutex); |
868 | LogOutput(data); | |
5f316715 | 869 | m_iLastTransmission = GetTimeMs(); |
7bb4ed43 LOK |
870 | if (!m_communication) |
871 | return false; | |
872 | uint8_t iMaxTries = m_busDevices[data.initiator]->GetHandler()->GetTransmitRetries() + 1; | |
873 | retVal = m_communication->Write(data, iMaxTries, m_iLineTimeout, m_iRetryLineTimeout); | |
2abe74eb LOK |
874 | } |
875 | ||
7bb4ed43 LOK |
876 | /* set to "not present" on failed ack */ |
877 | if (retVal == ADAPTER_MESSAGE_STATE_SENT_NOT_ACKED && | |
878 | data.destination != CECDEVICE_BROADCAST) | |
879 | m_busDevices[data.destination]->SetDeviceStatus(CEC_DEVICE_STATUS_NOT_PRESENT); | |
9902f4e8 | 880 | |
7bb4ed43 | 881 | return retVal == ADAPTER_MESSAGE_STATE_SENT_ACKED; |
825ddb96 | 882 | } |
abbca718 | 883 | |
22b4e74a | 884 | void CCECProcessor::TransmitAbort(cec_logical_address address, cec_opcode opcode, cec_abort_reason reason /* = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE */) |
abbca718 | 885 | { |
5477a250 | 886 | CLibCEC::AddLog(CEC_LOG_DEBUG, "<< transmitting abort message"); |
9dee1670 | 887 | |
06a1f7ce | 888 | cec_command command; |
f8513317 | 889 | // TODO |
ab1469a0 LOK |
890 | cec_command::Format(command, m_logicalAddresses.primary, address, CEC_OPCODE_FEATURE_ABORT); |
891 | command.parameters.PushBack((uint8_t)opcode); | |
892 | command.parameters.PushBack((uint8_t)reason); | |
9dee1670 LOK |
893 | |
894 | Transmit(command); | |
abbca718 LOK |
895 | } |
896 | ||
e9de9629 | 897 | void CCECProcessor::ParseCommand(cec_command &command) |
abbca718 | 898 | { |
e9de9629 | 899 | CStdString dataStr; |
1d3ca3de | 900 | dataStr.Format(">> %1x%1x:%02x", command.initiator, command.destination, command.opcode); |
e9de9629 LOK |
901 | for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++) |
902 | dataStr.AppendFormat(":%02x", (unsigned int)command.parameters[iPtr]); | |
5477a250 | 903 | CLibCEC::AddLog(CEC_LOG_TRAFFIC, dataStr.c_str()); |
dc113aca | 904 | |
7871d66e | 905 | if (!m_bMonitor && command.initiator >= CECDEVICE_TV && command.initiator <= CECDEVICE_BROADCAST) |
e9de9629 | 906 | m_busDevices[(uint8_t)command.initiator]->HandleCommand(command); |
dc113aca LOK |
907 | } |
908 | ||
6d858ba4 LOK |
909 | cec_logical_addresses CCECProcessor::GetActiveDevices(void) |
910 | { | |
911 | cec_logical_addresses addresses; | |
988de7b9 | 912 | addresses.Clear(); |
6d858ba4 LOK |
913 | for (unsigned int iPtr = 0; iPtr < 15; iPtr++) |
914 | { | |
915 | if (m_busDevices[iPtr]->GetStatus() == CEC_DEVICE_STATUS_PRESENT) | |
916 | addresses.Set((cec_logical_address) iPtr); | |
917 | } | |
918 | return addresses; | |
919 | } | |
920 | ||
37b0c572 | 921 | bool CCECProcessor::IsPresentDevice(cec_logical_address address) |
6d858ba4 LOK |
922 | { |
923 | return m_busDevices[address]->GetStatus() == CEC_DEVICE_STATUS_PRESENT; | |
924 | } | |
925 | ||
37b0c572 | 926 | bool CCECProcessor::IsPresentDeviceType(cec_device_type type) |
6d858ba4 | 927 | { |
6d858ba4 | 928 | for (unsigned int iPtr = 0; iPtr < 15; iPtr++) |
2813bd07 LOK |
929 | { |
930 | if (m_busDevices[iPtr]->GetType() == type && m_busDevices[iPtr]->GetStatus() == CEC_DEVICE_STATUS_PRESENT) | |
6d858ba4 | 931 | return true; |
2813bd07 LOK |
932 | } |
933 | ||
6d858ba4 LOK |
934 | return false; |
935 | } | |
936 | ||
0f23c85c LOK |
937 | uint16_t CCECProcessor::GetPhysicalAddress(void) const |
938 | { | |
ab1469a0 | 939 | if (!m_logicalAddresses.IsEmpty() && m_busDevices[m_logicalAddresses.primary]) |
16b1e052 | 940 | return m_busDevices[m_logicalAddresses.primary]->GetPhysicalAddress(false); |
cc60ab1c | 941 | return false; |
0f23c85c LOK |
942 | } |
943 | ||
06bfd4d7 LOK |
944 | bool CCECProcessor::SetAckMask(uint16_t iMask) |
945 | { | |
5dcf9f25 | 946 | return m_communication->SetAckMask(iMask); |
06bfd4d7 | 947 | } |
a33794d8 | 948 | |
4bec9d79 | 949 | bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination, cec_user_control_code key, bool bWait /* = true */) |
a33794d8 | 950 | { |
86869f8f | 951 | return m_busDevices[iDestination]->TransmitKeypress(key, bWait); |
a33794d8 LOK |
952 | } |
953 | ||
4bec9d79 | 954 | bool CCECProcessor::TransmitKeyRelease(cec_logical_address iDestination, bool bWait /* = true */) |
a33794d8 | 955 | { |
86869f8f | 956 | return m_busDevices[iDestination]->TransmitKeyRelease(bWait); |
a33794d8 | 957 | } |
7c63a480 | 958 | |
3e61b350 LOK |
959 | const char *CCECProcessor::ToString(const cec_device_type type) |
960 | { | |
961 | switch (type) | |
962 | { | |
963 | case CEC_DEVICE_TYPE_AUDIO_SYSTEM: | |
964 | return "audio system"; | |
965 | case CEC_DEVICE_TYPE_PLAYBACK_DEVICE: | |
966 | return "playback device"; | |
967 | case CEC_DEVICE_TYPE_RECORDING_DEVICE: | |
968 | return "recording device"; | |
969 | case CEC_DEVICE_TYPE_RESERVED: | |
970 | return "reserved"; | |
971 | case CEC_DEVICE_TYPE_TUNER: | |
972 | return "tuner"; | |
973 | case CEC_DEVICE_TYPE_TV: | |
974 | return "TV"; | |
975 | default: | |
976 | return "unknown"; | |
977 | } | |
978 | } | |
979 | ||
03ae897d LOK |
980 | const char *CCECProcessor::ToString(const cec_menu_state state) |
981 | { | |
982 | switch (state) | |
983 | { | |
984 | case CEC_MENU_STATE_ACTIVATED: | |
985 | return "activated"; | |
986 | case CEC_MENU_STATE_DEACTIVATED: | |
987 | return "deactivated"; | |
988 | default: | |
989 | return "unknown"; | |
990 | } | |
991 | } | |
992 | ||
993 | const char *CCECProcessor::ToString(const cec_version version) | |
994 | { | |
995 | switch (version) | |
996 | { | |
997 | case CEC_VERSION_1_2: | |
998 | return "1.2"; | |
999 | case CEC_VERSION_1_2A: | |
1000 | return "1.2a"; | |
1001 | case CEC_VERSION_1_3: | |
1002 | return "1.3"; | |
1003 | case CEC_VERSION_1_3A: | |
1004 | return "1.3a"; | |
1005 | case CEC_VERSION_1_4: | |
1006 | return "1.4"; | |
1007 | default: | |
1008 | return "unknown"; | |
1009 | } | |
1010 | } | |
1011 | ||
1012 | const char *CCECProcessor::ToString(const cec_power_status status) | |
1013 | { | |
1014 | switch (status) | |
1015 | { | |
1016 | case CEC_POWER_STATUS_ON: | |
1017 | return "on"; | |
1018 | case CEC_POWER_STATUS_STANDBY: | |
1019 | return "standby"; | |
1020 | case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY: | |
1021 | return "in transition from on to standby"; | |
1022 | case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON: | |
1023 | return "in transition from standby to on"; | |
1024 | default: | |
1025 | return "unknown"; | |
1026 | } | |
1027 | } | |
1028 | ||
1029 | const char *CCECProcessor::ToString(const cec_logical_address address) | |
1030 | { | |
1031 | switch(address) | |
1032 | { | |
1033 | case CECDEVICE_AUDIOSYSTEM: | |
1034 | return "Audio"; | |
1035 | case CECDEVICE_BROADCAST: | |
1036 | return "Broadcast"; | |
1037 | case CECDEVICE_FREEUSE: | |
1038 | return "Free use"; | |
1039 | case CECDEVICE_PLAYBACKDEVICE1: | |
1040 | return "Playback 1"; | |
1041 | case CECDEVICE_PLAYBACKDEVICE2: | |
1042 | return "Playback 2"; | |
1043 | case CECDEVICE_PLAYBACKDEVICE3: | |
1044 | return "Playback 3"; | |
1045 | case CECDEVICE_RECORDINGDEVICE1: | |
1046 | return "Recorder 1"; | |
1047 | case CECDEVICE_RECORDINGDEVICE2: | |
1048 | return "Recorder 2"; | |
1049 | case CECDEVICE_RECORDINGDEVICE3: | |
1050 | return "Recorder 3"; | |
1051 | case CECDEVICE_RESERVED1: | |
1052 | return "Reserved 1"; | |
1053 | case CECDEVICE_RESERVED2: | |
1054 | return "Reserved 2"; | |
1055 | case CECDEVICE_TUNER1: | |
1056 | return "Tuner 1"; | |
1057 | case CECDEVICE_TUNER2: | |
1058 | return "Tuner 2"; | |
1059 | case CECDEVICE_TUNER3: | |
1060 | return "Tuner 3"; | |
1061 | case CECDEVICE_TUNER4: | |
1062 | return "Tuner 4"; | |
1063 | case CECDEVICE_TV: | |
1064 | return "TV"; | |
1065 | default: | |
1066 | return "unknown"; | |
1067 | } | |
1068 | } | |
1069 | ||
1070 | const char *CCECProcessor::ToString(const cec_deck_control_mode mode) | |
1071 | { | |
1072 | switch (mode) | |
1073 | { | |
1074 | case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND: | |
1075 | return "skip forward wind"; | |
1076 | case CEC_DECK_CONTROL_MODE_EJECT: | |
1077 | return "eject"; | |
1078 | case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND: | |
1079 | return "reverse rewind"; | |
1080 | case CEC_DECK_CONTROL_MODE_STOP: | |
1081 | return "stop"; | |
1082 | default: | |
1083 | return "unknown"; | |
1084 | } | |
1085 | } | |
1086 | ||
1087 | const char *CCECProcessor::ToString(const cec_deck_info status) | |
1088 | { | |
1089 | switch (status) | |
1090 | { | |
1091 | case CEC_DECK_INFO_PLAY: | |
1092 | return "play"; | |
1093 | case CEC_DECK_INFO_RECORD: | |
1094 | return "record"; | |
1095 | case CEC_DECK_INFO_PLAY_REVERSE: | |
1096 | return "play reverse"; | |
1097 | case CEC_DECK_INFO_STILL: | |
1098 | return "still"; | |
1099 | case CEC_DECK_INFO_SLOW: | |
1100 | return "slow"; | |
1101 | case CEC_DECK_INFO_SLOW_REVERSE: | |
1102 | return "slow reverse"; | |
1103 | case CEC_DECK_INFO_FAST_FORWARD: | |
1104 | return "fast forward"; | |
1105 | case CEC_DECK_INFO_FAST_REVERSE: | |
1106 | return "fast reverse"; | |
1107 | case CEC_DECK_INFO_NO_MEDIA: | |
1108 | return "no media"; | |
1109 | case CEC_DECK_INFO_STOP: | |
1110 | return "stop"; | |
1111 | case CEC_DECK_INFO_SKIP_FORWARD_WIND: | |
1112 | return "info skip forward wind"; | |
1113 | case CEC_DECK_INFO_SKIP_REVERSE_REWIND: | |
1114 | return "info skip reverse rewind"; | |
1115 | case CEC_DECK_INFO_INDEX_SEARCH_FORWARD: | |
1116 | return "info index search forward"; | |
1117 | case CEC_DECK_INFO_INDEX_SEARCH_REVERSE: | |
1118 | return "info index search reverse"; | |
1119 | case CEC_DECK_INFO_OTHER_STATUS: | |
1120 | return "other"; | |
1121 | default: | |
1122 | return "unknown"; | |
1123 | } | |
1124 | } | |
1125 | ||
1126 | const char *CCECProcessor::ToString(const cec_opcode opcode) | |
1127 | { | |
1128 | switch (opcode) | |
1129 | { | |
1130 | case CEC_OPCODE_ACTIVE_SOURCE: | |
1131 | return "active source"; | |
1132 | case CEC_OPCODE_IMAGE_VIEW_ON: | |
1133 | return "image view on"; | |
1134 | case CEC_OPCODE_TEXT_VIEW_ON: | |
1135 | return "text view on"; | |
1136 | case CEC_OPCODE_INACTIVE_SOURCE: | |
1137 | return "inactive source"; | |
1138 | case CEC_OPCODE_REQUEST_ACTIVE_SOURCE: | |
1139 | return "request active source"; | |
1140 | case CEC_OPCODE_ROUTING_CHANGE: | |
1141 | return "routing change"; | |
1142 | case CEC_OPCODE_ROUTING_INFORMATION: | |
1143 | return "routing information"; | |
1144 | case CEC_OPCODE_SET_STREAM_PATH: | |
1145 | return "set stream path"; | |
1146 | case CEC_OPCODE_STANDBY: | |
1147 | return "standby"; | |
1148 | case CEC_OPCODE_RECORD_OFF: | |
1149 | return "record off"; | |
1150 | case CEC_OPCODE_RECORD_ON: | |
1151 | return "record on"; | |
1152 | case CEC_OPCODE_RECORD_STATUS: | |
1153 | return "record status"; | |
1154 | case CEC_OPCODE_RECORD_TV_SCREEN: | |
1155 | return "record tv screen"; | |
1156 | case CEC_OPCODE_CLEAR_ANALOGUE_TIMER: | |
1157 | return "clear analogue timer"; | |
1158 | case CEC_OPCODE_CLEAR_DIGITAL_TIMER: | |
1159 | return "clear digital timer"; | |
1160 | case CEC_OPCODE_CLEAR_EXTERNAL_TIMER: | |
1161 | return "clear external timer"; | |
1162 | case CEC_OPCODE_SET_ANALOGUE_TIMER: | |
1163 | return "set analogue timer"; | |
1164 | case CEC_OPCODE_SET_DIGITAL_TIMER: | |
1165 | return "set digital timer"; | |
1166 | case CEC_OPCODE_SET_EXTERNAL_TIMER: | |
1167 | return "set external timer"; | |
1168 | case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE: | |
1169 | return "set timer program title"; | |
1170 | case CEC_OPCODE_TIMER_CLEARED_STATUS: | |
1171 | return "timer cleared status"; | |
1172 | case CEC_OPCODE_TIMER_STATUS: | |
1173 | return "timer status"; | |
1174 | case CEC_OPCODE_CEC_VERSION: | |
1175 | return "cec version"; | |
1176 | case CEC_OPCODE_GET_CEC_VERSION: | |
1177 | return "get cec version"; | |
1178 | case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS: | |
1179 | return "give physical address"; | |
1180 | case CEC_OPCODE_GET_MENU_LANGUAGE: | |
1181 | return "get menu language"; | |
1182 | case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS: | |
1183 | return "report physical address"; | |
1184 | case CEC_OPCODE_SET_MENU_LANGUAGE: | |
1185 | return "set menu language"; | |
1186 | case CEC_OPCODE_DECK_CONTROL: | |
1187 | return "deck control"; | |
1188 | case CEC_OPCODE_DECK_STATUS: | |
1189 | return "deck status"; | |
1190 | case CEC_OPCODE_GIVE_DECK_STATUS: | |
1191 | return "give deck status"; | |
1192 | case CEC_OPCODE_PLAY: | |
1193 | return "play"; | |
1194 | case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS: | |
1195 | return "give tuner status"; | |
1196 | case CEC_OPCODE_SELECT_ANALOGUE_SERVICE: | |
1197 | return "select analogue service"; | |
1198 | case CEC_OPCODE_SELECT_DIGITAL_SERVICE: | |
1199 | return "set digital service"; | |
1200 | case CEC_OPCODE_TUNER_DEVICE_STATUS: | |
1201 | return "tuner device status"; | |
1202 | case CEC_OPCODE_TUNER_STEP_DECREMENT: | |
1203 | return "tuner step decrement"; | |
1204 | case CEC_OPCODE_TUNER_STEP_INCREMENT: | |
1205 | return "tuner step increment"; | |
1206 | case CEC_OPCODE_DEVICE_VENDOR_ID: | |
1207 | return "device vendor id"; | |
1208 | case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID: | |
1209 | return "give device vendor id"; | |
1210 | case CEC_OPCODE_VENDOR_COMMAND: | |
1211 | return "vendor command"; | |
1212 | case CEC_OPCODE_VENDOR_COMMAND_WITH_ID: | |
1213 | return "vendor command with id"; | |
1214 | case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN: | |
1215 | return "vendor remote button down"; | |
1216 | case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP: | |
1217 | return "vendor remote button up"; | |
1218 | case CEC_OPCODE_SET_OSD_STRING: | |
1219 | return "set osd string"; | |
1220 | case CEC_OPCODE_GIVE_OSD_NAME: | |
1221 | return "give osd name"; | |
1222 | case CEC_OPCODE_SET_OSD_NAME: | |
1223 | return "set osd name"; | |
1224 | case CEC_OPCODE_MENU_REQUEST: | |
1225 | return "menu request"; | |
1226 | case CEC_OPCODE_MENU_STATUS: | |
1227 | return "menu status"; | |
1228 | case CEC_OPCODE_USER_CONTROL_PRESSED: | |
1229 | return "user control pressed"; | |
1230 | case CEC_OPCODE_USER_CONTROL_RELEASE: | |
1231 | return "user control release"; | |
1232 | case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS: | |
1233 | return "give device power status"; | |
1234 | case CEC_OPCODE_REPORT_POWER_STATUS: | |
1235 | return "report power status"; | |
1236 | case CEC_OPCODE_FEATURE_ABORT: | |
1237 | return "feature abort"; | |
1238 | case CEC_OPCODE_ABORT: | |
1239 | return "abort"; | |
1240 | case CEC_OPCODE_GIVE_AUDIO_STATUS: | |
1241 | return "give audio status"; | |
1242 | case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS: | |
1243 | return "give audio mode status"; | |
1244 | case CEC_OPCODE_REPORT_AUDIO_STATUS: | |
1245 | return "report audio status"; | |
1246 | case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE: | |
1247 | return "set system audio mode"; | |
1248 | case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST: | |
1249 | return "system audio mode request"; | |
1250 | case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS: | |
1251 | return "system audio mode status"; | |
1252 | case CEC_OPCODE_SET_AUDIO_RATE: | |
1253 | return "set audio rate"; | |
1254 | default: | |
1255 | return "UNKNOWN"; | |
1256 | } | |
1257 | } | |
1258 | ||
1259 | const char *CCECProcessor::ToString(const cec_system_audio_status mode) | |
1260 | { | |
1261 | switch(mode) | |
1262 | { | |
1263 | case CEC_SYSTEM_AUDIO_STATUS_ON: | |
1264 | return "on"; | |
1265 | case CEC_SYSTEM_AUDIO_STATUS_OFF: | |
1266 | return "off"; | |
1267 | default: | |
1268 | return "unknown"; | |
1269 | } | |
1270 | } | |
1271 | ||
1de6617c | 1272 | const char *CCECProcessor::ToString(const cec_audio_status UNUSED(status)) |
03ae897d LOK |
1273 | { |
1274 | // TODO this is a mask | |
1275 | return "TODO"; | |
1276 | } | |
1277 | ||
1278 | const char *CCECProcessor::ToString(const cec_vendor_id vendor) | |
1279 | { | |
1280 | switch (vendor) | |
1281 | { | |
1282 | case CEC_VENDOR_SAMSUNG: | |
1283 | return "Samsung"; | |
1284 | case CEC_VENDOR_LG: | |
1285 | return "LG"; | |
1286 | case CEC_VENDOR_PANASONIC: | |
1287 | return "Panasonic"; | |
1288 | case CEC_VENDOR_PIONEER: | |
1289 | return "Pioneer"; | |
1290 | case CEC_VENDOR_ONKYO: | |
1291 | return "Onkyo"; | |
1292 | case CEC_VENDOR_YAMAHA: | |
1293 | return "Yamaha"; | |
ec0deac1 LOK |
1294 | case CEC_VENDOR_PHILIPS: |
1295 | return "Philips"; | |
1a87cacc LOK |
1296 | case CEC_VENDOR_SONY: |
1297 | return "Sony"; | |
03ae897d LOK |
1298 | default: |
1299 | return "Unknown"; | |
1300 | } | |
1301 | } | |
1302 | ||
7c63a480 LOK |
1303 | void *CCECBusScan::Process(void) |
1304 | { | |
1305 | CCECBusDevice *device(NULL); | |
fe6f8e37 | 1306 | uint8_t iCounter(0); |
5f316715 | 1307 | |
5e5637c6 | 1308 | while (!IsStopped()) |
7c63a480 | 1309 | { |
bdb0f7f4 | 1310 | if (++iCounter < 10) |
fe6f8e37 LOK |
1311 | { |
1312 | Sleep(1000); | |
1313 | continue; | |
1314 | } | |
5f316715 | 1315 | for (unsigned int iPtr = 0; iPtr <= 11 && !IsStopped(); iPtr++) |
7c63a480 | 1316 | { |
5f316715 LOK |
1317 | device = m_processor->m_busDevices[iPtr]; |
1318 | WaitUntilIdle(); | |
1319 | if (device && device->GetStatus(true) == CEC_DEVICE_STATUS_PRESENT) | |
5e5637c6 | 1320 | { |
5f316715 LOK |
1321 | WaitUntilIdle(); |
1322 | if (!IsStopped()) | |
1323 | device->GetVendorId(); | |
1324 | ||
1325 | WaitUntilIdle(); | |
1326 | if (!IsStopped()) | |
1327 | device->GetPowerStatus(true); | |
5e5637c6 | 1328 | } |
7c63a480 LOK |
1329 | } |
1330 | } | |
5f316715 | 1331 | |
7c63a480 LOK |
1332 | return NULL; |
1333 | } | |
1113cb7d | 1334 | |
5f316715 LOK |
1335 | void CCECBusScan::WaitUntilIdle(void) |
1336 | { | |
1337 | if (IsStopped()) | |
1338 | return; | |
1339 | ||
701f753b | 1340 | int32_t iWaitTime = 3000 - (int32_t)(GetTimeMs() - m_processor->GetLastTransmission()); |
5f316715 LOK |
1341 | while (iWaitTime > 0) |
1342 | { | |
1343 | Sleep(iWaitTime); | |
701f753b | 1344 | iWaitTime = 3000 - (int32_t)(GetTimeMs() - m_processor->GetLastTransmission()); |
5f316715 LOK |
1345 | } |
1346 | } | |
1347 | ||
1113cb7d LOK |
1348 | bool CCECProcessor::StartBootloader(void) |
1349 | { | |
1350 | return m_communication->StartBootloader(); | |
1351 | } | |
1352 | ||
1353 | bool CCECProcessor::PingAdapter(void) | |
1354 | { | |
1355 | return m_communication->PingAdapter(); | |
1356 | } | |
6729ac71 LOK |
1357 | |
1358 | void CCECProcessor::HandlePoll(cec_logical_address initiator, cec_logical_address destination) | |
1359 | { | |
1360 | m_busDevices[initiator]->GetHandler()->HandlePoll(initiator, destination); | |
6729ac71 LOK |
1361 | } |
1362 | ||
7bb4ed43 | 1363 | bool CCECProcessor::HandleReceiveFailed(cec_logical_address initiator) |
6729ac71 | 1364 | { |
7bb4ed43 | 1365 | return !m_busDevices[initiator]->GetHandler()->HandleReceiveFailed(); |
6729ac71 | 1366 | } |