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