2 * This file is part of the libCEC(R) library.
4 * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited. All rights reserved.
5 * libCEC(R) is an original work, containing original code.
7 * libCEC(R) is a trademark of Pulse-Eight Limited.
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.
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.
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.
24 * Alternatively, you can license this library under a commercial license,
25 * please contact Pulse-Eight Licensing for more information.
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/
33 #include "CECProcessor.h"
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"
44 #include "util/StdString.h"
45 #include "platform/timeutils.h"
50 CCECProcessor::CCECProcessor(CLibCEC
*controller
, const char *strDeviceName
, cec_logical_address iLogicalAddress
/* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress
/* = CEC_DEFAULT_PHYSICAL_ADDRESS*/) :
52 m_bInitialised(false),
53 m_iHDMIPort(CEC_DEFAULT_HDMI_PORT
),
54 m_iBaseDevice((cec_logical_address
)CEC_DEFAULT_BASE_DEVICE
),
55 m_lastInitiator(CECDEVICE_UNKNOWN
),
56 m_strDeviceName(strDeviceName
),
57 m_controller(controller
),
59 m_iStandardLineTimeout(3),
60 m_iRetryLineTimeout(3),
61 m_iLastTransmission(0)
63 m_communication
= new CAdapterCommunication(this);
64 m_logicalAddresses
.Clear();
65 m_logicalAddresses
.Set(iLogicalAddress
);
67 for (int iPtr
= 0; iPtr
<= 16; iPtr
++)
68 m_busDevices
[iPtr
] = new CCECBusDevice(this, (cec_logical_address
) iPtr
, iPtr
== iLogicalAddress
? iPhysicalAddress
: 0);
71 CCECProcessor::CCECProcessor(CLibCEC
*controller
, const char *strDeviceName
, const cec_device_type_list
&types
) :
73 m_bInitialised(false),
74 m_iHDMIPort(CEC_DEFAULT_HDMI_PORT
),
75 m_iBaseDevice((cec_logical_address
)CEC_DEFAULT_BASE_DEVICE
),
76 m_strDeviceName(strDeviceName
),
78 m_controller(controller
),
80 m_iStandardLineTimeout(3),
81 m_iRetryLineTimeout(3),
82 m_iLastTransmission(0)
84 m_communication
= new CAdapterCommunication(this);
85 m_logicalAddresses
.Clear();
86 for (int iPtr
= 0; iPtr
< 16; iPtr
++)
90 case CECDEVICE_AUDIOSYSTEM
:
91 m_busDevices
[iPtr
] = new CCECAudioSystem(this, (cec_logical_address
) iPtr
, 0xFFFF);
93 case CECDEVICE_PLAYBACKDEVICE1
:
94 case CECDEVICE_PLAYBACKDEVICE2
:
95 case CECDEVICE_PLAYBACKDEVICE3
:
96 m_busDevices
[iPtr
] = new CCECPlaybackDevice(this, (cec_logical_address
) iPtr
, 0xFFFF);
98 case CECDEVICE_RECORDINGDEVICE1
:
99 case CECDEVICE_RECORDINGDEVICE2
:
100 case CECDEVICE_RECORDINGDEVICE3
:
101 m_busDevices
[iPtr
] = new CCECRecordingDevice(this, (cec_logical_address
) iPtr
, 0xFFFF);
103 case CECDEVICE_TUNER1
:
104 case CECDEVICE_TUNER2
:
105 case CECDEVICE_TUNER3
:
106 case CECDEVICE_TUNER4
:
107 m_busDevices
[iPtr
] = new CCECTuner(this, (cec_logical_address
) iPtr
, 0xFFFF);
110 m_busDevices
[iPtr
] = new CCECTV(this, (cec_logical_address
) iPtr
, 0);
113 m_busDevices
[iPtr
] = new CCECBusDevice(this, (cec_logical_address
) iPtr
, 0xFFFF);
119 CCECProcessor::~CCECProcessor(void)
122 m_startCondition
.Broadcast();
125 delete m_communication
;
126 m_communication
= NULL
;
128 for (unsigned int iPtr
= 0; iPtr
< 16; iPtr
++)
129 delete m_busDevices
[iPtr
];
132 bool CCECProcessor::Start(const char *strPort
, uint16_t iBaudRate
/* = 38400 */, uint32_t iTimeoutMs
/* = 10000 */)
137 CLockObject
lock(&m_mutex
);
139 /* check for an already opened connection */
140 if (!m_communication
|| m_communication
->IsOpen())
142 m_controller
->AddLog(CEC_LOG_ERROR
, "connection already opened");
146 /* open a new connection */
147 if (!m_communication
->Open(strPort
, iBaudRate
, iTimeoutMs
))
149 m_controller
->AddLog(CEC_LOG_ERROR
, "could not open a connection");
153 /* create the processor thread */
154 if (!CreateThread() || !m_startCondition
.Wait(&m_mutex
) || !m_bStarted
)
156 m_controller
->AddLog(CEC_LOG_ERROR
, "could not create a processor thread");
161 /* find the logical address for the adapter */
162 bReturn
= m_logicalAddresses
.IsEmpty() ? FindLogicalAddresses() : true;
164 m_controller
->AddLog(CEC_LOG_ERROR
, "could not detect our logical addresses");
166 /* set the physical address for the adapter */
169 /* only set our OSD name for the primary device */
170 m_busDevices
[m_logicalAddresses
.primary
]->m_strDeviceName
= m_strDeviceName
;
172 /* get the vendor id from the TV, so we are using the correct handler */
173 m_busDevices
[CECDEVICE_TV
]->RequestVendorId();
176 bReturn
= SetHDMIPort(m_iBaseDevice
, m_iHDMIPort
, true);
179 /* make the primary device the active source */
182 m_bInitialised
= true;
183 m_busDevices
[m_logicalAddresses
.primary
]->m_bActiveSource
= true;
184 bReturn
= m_busDevices
[CECDEVICE_TV
]->ActivateSource();
189 m_controller
->AddLog(CEC_LOG_DEBUG
, "processor thread started");
193 m_controller
->AddLog(CEC_LOG_ERROR
, "could not create a processor thread");
200 bool CCECProcessor::TryLogicalAddress(cec_logical_address address
)
202 if (m_busDevices
[address
]->TryLogicalAddress())
204 m_logicalAddresses
.Set(address
);
211 bool CCECProcessor::FindLogicalAddressRecordingDevice(void)
213 AddLog(CEC_LOG_DEBUG
, "detecting logical address for type 'recording device'");
214 return TryLogicalAddress(CECDEVICE_RECORDINGDEVICE1
) ||
215 TryLogicalAddress(CECDEVICE_RECORDINGDEVICE2
) ||
216 TryLogicalAddress(CECDEVICE_RECORDINGDEVICE3
);
219 bool CCECProcessor::FindLogicalAddressTuner(void)
221 AddLog(CEC_LOG_DEBUG
, "detecting logical address for type 'tuner'");
222 return TryLogicalAddress(CECDEVICE_TUNER1
) ||
223 TryLogicalAddress(CECDEVICE_TUNER2
) ||
224 TryLogicalAddress(CECDEVICE_TUNER3
) ||
225 TryLogicalAddress(CECDEVICE_TUNER4
);
228 bool CCECProcessor::FindLogicalAddressPlaybackDevice(void)
230 AddLog(CEC_LOG_DEBUG
, "detecting logical address for type 'playback device'");
231 return TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE1
) ||
232 TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE2
) ||
233 TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE3
);
236 bool CCECProcessor::FindLogicalAddressAudioSystem(void)
238 AddLog(CEC_LOG_DEBUG
, "detecting logical address for type 'audio'");
239 return TryLogicalAddress(CECDEVICE_AUDIOSYSTEM
);
242 bool CCECProcessor::ChangeDeviceType(cec_device_type from
, cec_device_type to
)
244 bool bChanged(false);
247 strLog
.Format("changing device type '%s' into '%s'", ToString(from
), ToString(to
));
248 AddLog(CEC_LOG_NOTICE
, strLog
);
250 CLockObject
lock(&m_mutex
);
251 CCECBusDevice
*previousDevice
= GetDeviceByType(from
);
252 m_logicalAddresses
.primary
= CECDEVICE_UNKNOWN
;
254 for (unsigned int iPtr
= 0; iPtr
< 5; iPtr
++)
256 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_RESERVED
)
259 if (m_types
.types
[iPtr
] == from
)
262 m_types
.types
[iPtr
] = to
;
264 else if (m_types
.types
[iPtr
] == to
&& bChanged
)
266 m_types
.types
[iPtr
] = CEC_DEVICE_TYPE_RESERVED
;
272 FindLogicalAddresses();
274 CCECBusDevice
*newDevice
= GetDeviceByType(to
);
275 if (previousDevice
&& newDevice
)
277 newDevice
->SetDeviceStatus(CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC
);
278 previousDevice
->SetDeviceStatus(CEC_DEVICE_STATUS_UNKNOWN
);
280 newDevice
->SetCecVersion(previousDevice
->GetCecVersion(false));
281 previousDevice
->SetCecVersion(CEC_VERSION_UNKNOWN
);
283 newDevice
->SetMenuLanguage(previousDevice
->GetMenuLanguage(false));
284 cec_menu_language lang
;
285 lang
.device
= previousDevice
->GetLogicalAddress();
286 for (unsigned int iPtr
= 0; iPtr
< 4; iPtr
++)
287 lang
.language
[iPtr
] = '?';
288 lang
.language
[3] = 0;
289 previousDevice
->SetMenuLanguage(lang
);
291 newDevice
->SetMenuState(previousDevice
->GetMenuState());
292 previousDevice
->SetMenuState(CEC_MENU_STATE_DEACTIVATED
);
294 newDevice
->SetOSDName(previousDevice
->GetOSDName(false));
295 previousDevice
->SetOSDName(ToString(previousDevice
->GetLogicalAddress()));
297 newDevice
->SetPhysicalAddress(previousDevice
->GetPhysicalAddress(false));
298 previousDevice
->SetPhysicalAddress(0xFFFF);
300 newDevice
->SetPowerStatus(previousDevice
->GetPowerStatus(false));
301 previousDevice
->SetPowerStatus(CEC_POWER_STATUS_UNKNOWN
);
303 newDevice
->SetVendorId(previousDevice
->GetVendorId(false));
304 previousDevice
->SetVendorId(CEC_VENDOR_UNKNOWN
);
306 if ((from
== CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| from
== CEC_DEVICE_TYPE_RECORDING_DEVICE
) &&
307 (to
== CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| to
== CEC_DEVICE_TYPE_RECORDING_DEVICE
))
309 ((CCECPlaybackDevice
*) newDevice
)->SetDeckControlMode(((CCECPlaybackDevice
*) previousDevice
)->GetDeckControlMode());
310 ((CCECPlaybackDevice
*) previousDevice
)->SetDeckControlMode(CEC_DECK_CONTROL_MODE_STOP
);
312 ((CCECPlaybackDevice
*) newDevice
)->SetDeckStatus(((CCECPlaybackDevice
*) previousDevice
)->GetDeckStatus());
313 ((CCECPlaybackDevice
*) previousDevice
)->SetDeckStatus(CEC_DECK_INFO_STOP
);
321 bool CCECProcessor::FindLogicalAddresses(void)
324 m_logicalAddresses
.Clear();
327 for (unsigned int iPtr
= 0; iPtr
< 5; iPtr
++)
329 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_RESERVED
)
332 strLog
.Format("%s - device %d: type %d", __FUNCTION__
, iPtr
, m_types
.types
[iPtr
]);
333 AddLog(CEC_LOG_DEBUG
, strLog
);
335 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_RECORDING_DEVICE
)
336 bReturn
&= FindLogicalAddressRecordingDevice();
337 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_TUNER
)
338 bReturn
&= FindLogicalAddressTuner();
339 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
)
340 bReturn
&= FindLogicalAddressPlaybackDevice();
341 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
342 bReturn
&= FindLogicalAddressAudioSystem();
346 SetAckMask(m_logicalAddresses
.AckMask());
351 void CCECProcessor::ReplaceHandlers(void)
353 for (uint8_t iPtr
= 0; iPtr
<= CECDEVICE_PLAYBACKDEVICE3
; iPtr
++)
354 m_busDevices
[iPtr
]->ReplaceHandler(m_bInitialised
);
357 void *CCECProcessor::Process(void)
359 bool bParseFrame(false);
361 CCECAdapterMessage msg
;
364 CLockObject
lock(&m_mutex
);
366 m_controller
->AddLog(CEC_LOG_DEBUG
, "processor thread started");
367 m_startCondition
.Signal();
377 CLockObject
lock(&m_mutex
);
378 if (m_commandBuffer
.Pop(command
))
382 else if (m_communication
->IsOpen() && m_communication
->Read(msg
, 50))
384 if ((bParseFrame
= (ParseMessage(msg
) && !IsStopped())) == true)
385 command
= m_currentframe
;
390 ParseCommand(command
);
395 m_controller
->CheckKeypressTimeout();
399 m_communication
->Close();
404 bool CCECProcessor::SetActiveSource(cec_device_type type
/* = CEC_DEVICE_TYPE_RESERVED */)
411 cec_logical_address addr
= m_logicalAddresses
.primary
;
413 if (type
!= CEC_DEVICE_TYPE_RESERVED
)
415 for (uint8_t iPtr
= 0; iPtr
<= 11; iPtr
++)
417 if (m_logicalAddresses
[iPtr
] && m_busDevices
[iPtr
]->m_type
== type
)
419 addr
= (cec_logical_address
) iPtr
;
425 m_busDevices
[addr
]->SetActiveSource();
426 if (m_busDevices
[addr
]->GetPhysicalAddress(false) != 0xFFFF)
428 bReturn
= m_busDevices
[addr
]->TransmitActiveSource();
430 if (bReturn
&& (m_busDevices
[addr
]->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
||
431 m_busDevices
[addr
]->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
) &&
432 m_busDevices
[addr
]->GetHandler()->SendDeckStatusUpdateOnActiveSource())
434 bReturn
= ((CCECPlaybackDevice
*)m_busDevices
[addr
])->TransmitDeckStatus(CECDEVICE_TV
);
441 bool CCECProcessor::SetActiveSource(uint16_t iStreamPath
)
445 CCECBusDevice
*device
= GetDeviceByPhysicalAddress(iStreamPath
);
448 device
->SetActiveSource();
455 void CCECProcessor::SetStandardLineTimeout(uint8_t iTimeout
)
457 CLockObject
lock(&m_mutex
);
458 m_iStandardLineTimeout
= iTimeout
;
461 void CCECProcessor::SetRetryLineTimeout(uint8_t iTimeout
)
463 CLockObject
lock(&m_mutex
);
464 m_iRetryLineTimeout
= iTimeout
;
467 bool CCECProcessor::SetActiveView(void)
469 return SetActiveSource(m_types
.IsEmpty() ? CEC_DEVICE_TYPE_RESERVED
: m_types
[0]);
472 bool CCECProcessor::SetDeckControlMode(cec_deck_control_mode mode
, bool bSendUpdate
/* = true */)
476 CCECBusDevice
*device
= GetDeviceByType(CEC_DEVICE_TYPE_PLAYBACK_DEVICE
);
479 ((CCECPlaybackDevice
*) device
)->SetDeckControlMode(mode
);
481 ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(CECDEVICE_TV
);
488 bool CCECProcessor::SetDeckInfo(cec_deck_info info
, bool bSendUpdate
/* = true */)
492 CCECBusDevice
*device
= GetDeviceByType(CEC_DEVICE_TYPE_PLAYBACK_DEVICE
);
495 ((CCECPlaybackDevice
*) device
)->SetDeckStatus(info
);
497 ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(CECDEVICE_TV
);
504 bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice
, uint8_t iPort
, bool bForce
/* = false */)
508 CLockObject
lock(&m_mutex
);
510 m_iBaseDevice
= iBaseDevice
;
512 if (!m_bStarted
&& !bForce
)
517 strLog
.Format("setting HDMI port to %d on device %s (%d)", iPort
, ToString(iBaseDevice
), (int)iBaseDevice
);
518 AddLog(CEC_LOG_DEBUG
, strLog
);
520 uint16_t iPhysicalAddress(0);
521 if (iBaseDevice
> CECDEVICE_TV
)
522 iPhysicalAddress
= m_busDevices
[iBaseDevice
]->GetPhysicalAddress();
524 if (iPhysicalAddress
< 0xffff)
526 if (iPhysicalAddress
== 0)
527 iPhysicalAddress
+= 0x1000 * iPort
;
528 else if (iPhysicalAddress
% 0x1000 == 0)
529 iPhysicalAddress
+= 0x100 * iPort
;
530 else if (iPhysicalAddress
% 0x100 == 0)
531 iPhysicalAddress
+= 0x10 * iPort
;
532 else if (iPhysicalAddress
% 0x10 == 0)
533 iPhysicalAddress
+= iPort
;
535 SetPhysicalAddress(iPhysicalAddress
);
540 m_controller
->AddLog(CEC_LOG_ERROR
, "failed to set the physical address");
545 bool CCECProcessor::PhysicalAddressInUse(uint16_t iPhysicalAddress
)
547 for (unsigned int iPtr
= 0; iPtr
< 15; iPtr
++)
549 if (m_busDevices
[iPtr
]->GetPhysicalAddress(false) == iPhysicalAddress
)
555 bool CCECProcessor::TransmitInactiveSource(void)
560 if (!m_logicalAddresses
.IsEmpty() && m_busDevices
[m_logicalAddresses
.primary
])
561 return m_busDevices
[m_logicalAddresses
.primary
]->TransmitInactiveSource();
565 void CCECProcessor::LogOutput(const cec_command
&data
)
568 strTx
.Format("<< %02x", ((uint8_t)data
.initiator
<< 4) + (uint8_t)data
.destination
);
570 strTx
.AppendFormat(":%02x", (uint8_t)data
.opcode
);
572 for (uint8_t iPtr
= 0; iPtr
< data
.parameters
.size
; iPtr
++)
573 strTx
.AppendFormat(":%02x", data
.parameters
[iPtr
]);
574 m_controller
->AddLog(CEC_LOG_TRAFFIC
, strTx
.c_str());
577 bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress
)
579 CLockObject
lock(&m_mutex
);
580 if (m_logicalAddresses
.primary
!= iLogicalAddress
)
583 strLog
.Format("<< setting primary logical address to %1x", iLogicalAddress
);
584 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
585 m_logicalAddresses
.primary
= iLogicalAddress
;
586 m_logicalAddresses
.Set(iLogicalAddress
);
587 return SetAckMask(m_logicalAddresses
.AckMask());
593 bool CCECProcessor::SetMenuState(cec_menu_state state
, bool bSendUpdate
/* = true */)
595 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
597 if (m_logicalAddresses
[iPtr
])
598 m_busDevices
[iPtr
]->SetMenuState(state
);
602 m_busDevices
[m_logicalAddresses
.primary
]->TransmitMenuState(CECDEVICE_TV
);
607 bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress
)
609 CLockObject
lock(&m_mutex
);
610 if (!m_logicalAddresses
.IsEmpty())
612 for (uint8_t iPtr
= 0; iPtr
< 15; iPtr
++)
613 if (m_logicalAddresses
[iPtr
])
615 m_busDevices
[iPtr
]->SetInactiveSource();
616 m_busDevices
[iPtr
]->SetPhysicalAddress(iPhysicalAddress
);
617 m_busDevices
[iPtr
]->TransmitPhysicalAddress();
619 return SetActiveView();
624 bool CCECProcessor::SwitchMonitoring(bool bEnable
)
627 strLog
.Format("== %s monitoring mode ==", bEnable
? "enabling" : "disabling");
628 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
631 CLockObject
lock(&m_mutex
);
632 m_bMonitor
= bEnable
;
636 return SetAckMask(0);
638 return SetAckMask(m_logicalAddresses
.AckMask());
641 bool CCECProcessor::PollDevice(cec_logical_address iAddress
)
643 if (iAddress
!= CECDEVICE_UNKNOWN
&& m_busDevices
[iAddress
])
645 return m_logicalAddresses
.primary
== CECDEVICE_UNKNOWN
?
646 m_busDevices
[iAddress
]->TransmitPoll(iAddress
) :
647 m_busDevices
[m_logicalAddresses
.primary
]->TransmitPoll(iAddress
);
652 uint8_t CCECProcessor::VolumeUp(bool bSendRelease
/* = true */)
655 if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM
))
656 status
= ((CCECAudioSystem
*)m_busDevices
[CECDEVICE_AUDIOSYSTEM
])->VolumeUp(bSendRelease
);
661 uint8_t CCECProcessor::VolumeDown(bool bSendRelease
/* = true */)
664 if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM
))
665 status
= ((CCECAudioSystem
*)m_busDevices
[CECDEVICE_AUDIOSYSTEM
])->VolumeDown(bSendRelease
);
670 uint8_t CCECProcessor::MuteAudio(bool bSendRelease
/* = true */)
673 if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM
))
674 status
= ((CCECAudioSystem
*)m_busDevices
[CECDEVICE_AUDIOSYSTEM
])->MuteAudio(bSendRelease
);
679 CCECBusDevice
*CCECProcessor::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
, bool bRefresh
/* = false */) const
681 if (m_busDevices
[m_logicalAddresses
.primary
]->GetPhysicalAddress(false) == iPhysicalAddress
)
682 return m_busDevices
[m_logicalAddresses
.primary
];
684 CCECBusDevice
*device
= NULL
;
685 for (unsigned int iPtr
= 0; iPtr
< 16; iPtr
++)
687 if (m_busDevices
[iPtr
]->GetPhysicalAddress(bRefresh
) == iPhysicalAddress
)
689 device
= m_busDevices
[iPtr
];
697 CCECBusDevice
*CCECProcessor::GetDeviceByType(cec_device_type type
) const
699 CCECBusDevice
*device
= NULL
;
701 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
703 if (m_busDevices
[iPtr
]->m_type
== type
&& m_logicalAddresses
[iPtr
])
705 device
= m_busDevices
[iPtr
];
713 CCECBusDevice
*CCECProcessor::GetPrimaryDevice(void) const
715 CCECBusDevice
*device(NULL
);
716 cec_logical_address primary
= m_logicalAddresses
.primary
;
717 if (primary
!= CECDEVICE_UNKNOWN
)
718 device
= m_busDevices
[primary
];
722 cec_version
CCECProcessor::GetDeviceCecVersion(cec_logical_address iAddress
)
724 return m_busDevices
[iAddress
]->GetCecVersion();
727 cec_osd_name
CCECProcessor::GetDeviceOSDName(cec_logical_address iAddress
)
729 CStdString strOSDName
= m_busDevices
[iAddress
]->GetOSDName();
732 snprintf(retVal
.name
, sizeof(retVal
.name
), "%s", strOSDName
.c_str());
733 retVal
.device
= iAddress
;
738 bool CCECProcessor::GetDeviceMenuLanguage(cec_logical_address iAddress
, cec_menu_language
*language
)
740 if (m_busDevices
[iAddress
])
742 *language
= m_busDevices
[iAddress
]->GetMenuLanguage();
743 return (strcmp(language
->language
, "???") != 0);
748 uint64_t CCECProcessor::GetDeviceVendorId(cec_logical_address iAddress
)
750 if (m_busDevices
[iAddress
])
751 return m_busDevices
[iAddress
]->GetVendorId();
755 uint16_t CCECProcessor::GetDevicePhysicalAddress(cec_logical_address iAddress
)
757 if (m_busDevices
[iAddress
])
758 return m_busDevices
[iAddress
]->GetPhysicalAddress(false);
762 cec_power_status
CCECProcessor::GetDevicePowerStatus(cec_logical_address iAddress
)
764 if (m_busDevices
[iAddress
])
765 return m_busDevices
[iAddress
]->GetPowerStatus();
766 return CEC_POWER_STATUS_UNKNOWN
;
769 cec_logical_address
CCECProcessor::GetActiveSource(void)
771 for (uint8_t iPtr
= 0; iPtr
<= 11; iPtr
++)
773 if (m_busDevices
[iPtr
]->IsActiveSource())
774 return (cec_logical_address
)iPtr
;
777 return CECDEVICE_UNKNOWN
;
780 bool CCECProcessor::IsActiveSource(cec_logical_address iAddress
)
782 return m_busDevices
[iAddress
]->IsActiveSource();
785 bool CCECProcessor::Transmit(const cec_command
&data
)
790 CCECAdapterMessage
*output
= new CCECAdapterMessage(data
);
792 /* set the number of retries */
793 if (data
.opcode
== CEC_OPCODE_NONE
)
794 output
->maxTries
= 1;
795 else if (data
.initiator
!= CECDEVICE_BROADCAST
)
796 output
->maxTries
= m_busDevices
[data
.initiator
]->GetHandler()->GetTransmitRetries() + 1;
798 bReturn
= Transmit(output
);
800 /* set to "not present" on failed ack */
801 if (output
->is_error() && output
->reply
== MSGCODE_TRANSMIT_FAILED_ACK
&&
802 output
->destination() != CECDEVICE_BROADCAST
)
803 m_busDevices
[output
->destination()]->SetDeviceStatus(CEC_DEVICE_STATUS_NOT_PRESENT
);
809 bool CCECProcessor::Transmit(CCECAdapterMessage
*output
)
812 CLockObject
lock(&m_mutex
);
814 m_iLastTransmission
= GetTimeMs();
815 m_communication
->SetLineTimeout(m_iStandardLineTimeout
);
820 if (output
->tries
> 0)
821 m_communication
->SetLineTimeout(m_iRetryLineTimeout
);
823 CLockObject
msgLock(&output
->mutex
);
824 if (!m_communication
|| !m_communication
->Write(output
))
828 output
->condition
.Wait(&output
->mutex
);
829 if (output
->state
!= ADAPTER_MESSAGE_STATE_SENT
)
831 m_controller
->AddLog(CEC_LOG_ERROR
, "command was not sent");
836 if (output
->transmit_timeout
> 0)
838 if ((bReturn
= WaitForTransmitSucceeded(output
)) == false)
839 m_controller
->AddLog(CEC_LOG_DEBUG
, "did not receive ack");
843 }while (output
->transmit_timeout
> 0 && output
->needs_retry() && ++output
->tries
< output
->maxTries
);
846 m_communication
->SetLineTimeout(m_iStandardLineTimeout
);
851 void CCECProcessor::TransmitAbort(cec_logical_address address
, cec_opcode opcode
, cec_abort_reason reason
/* = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE */)
853 m_controller
->AddLog(CEC_LOG_DEBUG
, "<< transmitting abort message");
857 cec_command::Format(command
, m_logicalAddresses
.primary
, address
, CEC_OPCODE_FEATURE_ABORT
);
858 command
.parameters
.PushBack((uint8_t)opcode
);
859 command
.parameters
.PushBack((uint8_t)reason
);
864 bool CCECProcessor::WaitForTransmitSucceeded(CCECAdapterMessage
*message
)
867 bool bTransmitSucceeded(false);
868 uint8_t iPacketsLeft(message
->size() / 4);
870 int64_t iNow
= GetTimeMs();
871 int64_t iTargetTime
= iNow
+ message
->transmit_timeout
;
873 while (!bTransmitSucceeded
&& !bError
&& (message
->transmit_timeout
== 0 || iNow
< iTargetTime
))
875 CCECAdapterMessage msg
;
877 if (!m_communication
->Read(msg
, message
->transmit_timeout
> 0 ? (int32_t)(iTargetTime
- iNow
) : 1000))
883 if (msg
.message() == MSGCODE_FRAME_START
&& msg
.ack())
885 m_busDevices
[msg
.initiator()]->GetHandler()->HandlePoll(msg
.initiator(), msg
.destination());
886 m_lastInitiator
= msg
.initiator();
891 bError
= msg
.is_error();
892 if (msg
.message() == MSGCODE_RECEIVE_FAILED
&&
893 m_lastInitiator
!= CECDEVICE_UNKNOWN
&&
894 !m_busDevices
[m_lastInitiator
]->GetHandler()->HandleReceiveFailed())
902 message
->reply
= msg
.message();
903 m_controller
->AddLog(CEC_LOG_DEBUG
, msg
.ToString());
907 switch(msg
.message())
909 case MSGCODE_COMMAND_ACCEPTED
:
910 m_controller
->AddLog(CEC_LOG_DEBUG
, msg
.ToString());
911 if (iPacketsLeft
> 0)
914 case MSGCODE_TRANSMIT_SUCCEEDED
:
915 m_controller
->AddLog(CEC_LOG_DEBUG
, msg
.ToString());
916 bTransmitSucceeded
= (iPacketsLeft
== 0);
917 bError
= !bTransmitSucceeded
;
918 message
->reply
= MSGCODE_TRANSMIT_SUCCEEDED
;
921 // ignore other data while waiting
929 return bTransmitSucceeded
&& !bError
;
932 bool CCECProcessor::ParseMessage(const CCECAdapterMessage
&msg
)
935 bool bIsError(msg
.is_error());
940 switch(msg
.message())
942 case MSGCODE_FRAME_START
:
944 m_currentframe
.Clear();
947 m_currentframe
.initiator
= msg
.initiator();
948 m_currentframe
.destination
= msg
.destination();
949 m_currentframe
.ack
= msg
.ack();
950 m_currentframe
.eom
= msg
.eom();
952 if (m_currentframe
.ack
== 0x1)
954 m_lastInitiator
= m_currentframe
.initiator
;
955 m_busDevices
[m_lastInitiator
]->GetHandler()->HandlePoll(m_currentframe
.initiator
, m_currentframe
.destination
);
959 case MSGCODE_RECEIVE_FAILED
:
961 if (m_lastInitiator
!= CECDEVICE_UNKNOWN
)
962 bIsError
= m_busDevices
[m_lastInitiator
]->GetHandler()->HandleReceiveFailed();
965 case MSGCODE_FRAME_DATA
:
969 m_currentframe
.PushBack(msg
[1]);
970 m_currentframe
.eom
= msg
.eom();
979 m_controller
->AddLog(bIsError
? CEC_LOG_WARNING
: CEC_LOG_DEBUG
, msg
.ToString());
983 void CCECProcessor::ParseCommand(cec_command
&command
)
986 dataStr
.Format(">> %1x%1x:%02x", command
.initiator
, command
.destination
, command
.opcode
);
987 for (uint8_t iPtr
= 0; iPtr
< command
.parameters
.size
; iPtr
++)
988 dataStr
.AppendFormat(":%02x", (unsigned int)command
.parameters
[iPtr
]);
989 m_controller
->AddLog(CEC_LOG_TRAFFIC
, dataStr
.c_str());
991 if (!m_bMonitor
&& command
.initiator
>= CECDEVICE_TV
&& command
.initiator
<= CECDEVICE_BROADCAST
)
992 m_busDevices
[(uint8_t)command
.initiator
]->HandleCommand(command
);
995 cec_logical_addresses
CCECProcessor::GetActiveDevices(void)
997 cec_logical_addresses addresses
;
999 for (unsigned int iPtr
= 0; iPtr
< 15; iPtr
++)
1001 if (m_busDevices
[iPtr
]->GetStatus() == CEC_DEVICE_STATUS_PRESENT
)
1002 addresses
.Set((cec_logical_address
) iPtr
);
1007 bool CCECProcessor::IsPresentDevice(cec_logical_address address
)
1009 return m_busDevices
[address
]->GetStatus() == CEC_DEVICE_STATUS_PRESENT
;
1012 bool CCECProcessor::IsPresentDeviceType(cec_device_type type
)
1014 for (unsigned int iPtr
= 0; iPtr
< 15; iPtr
++)
1016 if (m_busDevices
[iPtr
]->GetType() == type
&& m_busDevices
[iPtr
]->GetStatus() == CEC_DEVICE_STATUS_PRESENT
)
1023 uint16_t CCECProcessor::GetPhysicalAddress(void) const
1025 if (!m_logicalAddresses
.IsEmpty() && m_busDevices
[m_logicalAddresses
.primary
])
1026 return m_busDevices
[m_logicalAddresses
.primary
]->GetPhysicalAddress(false);
1030 void CCECProcessor::SetCurrentButton(cec_user_control_code iButtonCode
)
1032 m_controller
->SetCurrentButton(iButtonCode
);
1035 void CCECProcessor::AddCommand(const cec_command
&command
)
1037 m_controller
->AddCommand(command
);
1040 void CCECProcessor::AddKey(cec_keypress
&key
)
1042 m_controller
->AddKey(key
);
1045 void CCECProcessor::AddKey(void)
1047 m_controller
->AddKey();
1050 void CCECProcessor::AddLog(cec_log_level level
, const CStdString
&strMessage
)
1052 m_controller
->AddLog(level
, strMessage
);
1055 bool CCECProcessor::SetAckMask(uint16_t iMask
)
1057 bool bReturn(false);
1059 strLog
.Format("setting ackmask to %2x", iMask
);
1060 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
1062 CCECAdapterMessage
*output
= new CCECAdapterMessage
;
1064 output
->push_back(MSGSTART
);
1065 output
->push_escaped(MSGCODE_SET_ACK_MASK
);
1066 output
->push_escaped(iMask
>> 8);
1067 output
->push_escaped((uint8_t)iMask
);
1068 output
->push_back(MSGEND
);
1070 if ((bReturn
= Transmit(output
)) == false)
1071 m_controller
->AddLog(CEC_LOG_ERROR
, "could not set the ackmask");
1078 bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination
, cec_user_control_code key
, bool bWait
/* = true */)
1080 return m_busDevices
[iDestination
]->TransmitKeypress(key
, bWait
);
1083 bool CCECProcessor::TransmitKeyRelease(cec_logical_address iDestination
, bool bWait
/* = true */)
1085 return m_busDevices
[iDestination
]->TransmitKeyRelease(bWait
);
1088 const char *CCECProcessor::ToString(const cec_device_type type
)
1092 case CEC_DEVICE_TYPE_AUDIO_SYSTEM
:
1093 return "audio system";
1094 case CEC_DEVICE_TYPE_PLAYBACK_DEVICE
:
1095 return "playback device";
1096 case CEC_DEVICE_TYPE_RECORDING_DEVICE
:
1097 return "recording device";
1098 case CEC_DEVICE_TYPE_RESERVED
:
1100 case CEC_DEVICE_TYPE_TUNER
:
1102 case CEC_DEVICE_TYPE_TV
:
1109 const char *CCECProcessor::ToString(const cec_menu_state state
)
1113 case CEC_MENU_STATE_ACTIVATED
:
1115 case CEC_MENU_STATE_DEACTIVATED
:
1116 return "deactivated";
1122 const char *CCECProcessor::ToString(const cec_version version
)
1126 case CEC_VERSION_1_2
:
1128 case CEC_VERSION_1_2A
:
1130 case CEC_VERSION_1_3
:
1132 case CEC_VERSION_1_3A
:
1134 case CEC_VERSION_1_4
:
1141 const char *CCECProcessor::ToString(const cec_power_status status
)
1145 case CEC_POWER_STATUS_ON
:
1147 case CEC_POWER_STATUS_STANDBY
:
1149 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
1150 return "in transition from on to standby";
1151 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
1152 return "in transition from standby to on";
1158 const char *CCECProcessor::ToString(const cec_logical_address address
)
1162 case CECDEVICE_AUDIOSYSTEM
:
1164 case CECDEVICE_BROADCAST
:
1166 case CECDEVICE_FREEUSE
:
1168 case CECDEVICE_PLAYBACKDEVICE1
:
1169 return "Playback 1";
1170 case CECDEVICE_PLAYBACKDEVICE2
:
1171 return "Playback 2";
1172 case CECDEVICE_PLAYBACKDEVICE3
:
1173 return "Playback 3";
1174 case CECDEVICE_RECORDINGDEVICE1
:
1175 return "Recorder 1";
1176 case CECDEVICE_RECORDINGDEVICE2
:
1177 return "Recorder 2";
1178 case CECDEVICE_RECORDINGDEVICE3
:
1179 return "Recorder 3";
1180 case CECDEVICE_RESERVED1
:
1181 return "Reserved 1";
1182 case CECDEVICE_RESERVED2
:
1183 return "Reserved 2";
1184 case CECDEVICE_TUNER1
:
1186 case CECDEVICE_TUNER2
:
1188 case CECDEVICE_TUNER3
:
1190 case CECDEVICE_TUNER4
:
1199 const char *CCECProcessor::ToString(const cec_deck_control_mode mode
)
1203 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
1204 return "skip forward wind";
1205 case CEC_DECK_CONTROL_MODE_EJECT
:
1207 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
1208 return "reverse rewind";
1209 case CEC_DECK_CONTROL_MODE_STOP
:
1216 const char *CCECProcessor::ToString(const cec_deck_info status
)
1220 case CEC_DECK_INFO_PLAY
:
1222 case CEC_DECK_INFO_RECORD
:
1224 case CEC_DECK_INFO_PLAY_REVERSE
:
1225 return "play reverse";
1226 case CEC_DECK_INFO_STILL
:
1228 case CEC_DECK_INFO_SLOW
:
1230 case CEC_DECK_INFO_SLOW_REVERSE
:
1231 return "slow reverse";
1232 case CEC_DECK_INFO_FAST_FORWARD
:
1233 return "fast forward";
1234 case CEC_DECK_INFO_FAST_REVERSE
:
1235 return "fast reverse";
1236 case CEC_DECK_INFO_NO_MEDIA
:
1238 case CEC_DECK_INFO_STOP
:
1240 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
1241 return "info skip forward wind";
1242 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
1243 return "info skip reverse rewind";
1244 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
1245 return "info index search forward";
1246 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
1247 return "info index search reverse";
1248 case CEC_DECK_INFO_OTHER_STATUS
:
1255 const char *CCECProcessor::ToString(const cec_opcode opcode
)
1259 case CEC_OPCODE_ACTIVE_SOURCE
:
1260 return "active source";
1261 case CEC_OPCODE_IMAGE_VIEW_ON
:
1262 return "image view on";
1263 case CEC_OPCODE_TEXT_VIEW_ON
:
1264 return "text view on";
1265 case CEC_OPCODE_INACTIVE_SOURCE
:
1266 return "inactive source";
1267 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
1268 return "request active source";
1269 case CEC_OPCODE_ROUTING_CHANGE
:
1270 return "routing change";
1271 case CEC_OPCODE_ROUTING_INFORMATION
:
1272 return "routing information";
1273 case CEC_OPCODE_SET_STREAM_PATH
:
1274 return "set stream path";
1275 case CEC_OPCODE_STANDBY
:
1277 case CEC_OPCODE_RECORD_OFF
:
1278 return "record off";
1279 case CEC_OPCODE_RECORD_ON
:
1281 case CEC_OPCODE_RECORD_STATUS
:
1282 return "record status";
1283 case CEC_OPCODE_RECORD_TV_SCREEN
:
1284 return "record tv screen";
1285 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
1286 return "clear analogue timer";
1287 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
1288 return "clear digital timer";
1289 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
1290 return "clear external timer";
1291 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
1292 return "set analogue timer";
1293 case CEC_OPCODE_SET_DIGITAL_TIMER
:
1294 return "set digital timer";
1295 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
1296 return "set external timer";
1297 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
1298 return "set timer program title";
1299 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
1300 return "timer cleared status";
1301 case CEC_OPCODE_TIMER_STATUS
:
1302 return "timer status";
1303 case CEC_OPCODE_CEC_VERSION
:
1304 return "cec version";
1305 case CEC_OPCODE_GET_CEC_VERSION
:
1306 return "get cec version";
1307 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
1308 return "give physical address";
1309 case CEC_OPCODE_GET_MENU_LANGUAGE
:
1310 return "get menu language";
1311 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
1312 return "report physical address";
1313 case CEC_OPCODE_SET_MENU_LANGUAGE
:
1314 return "set menu language";
1315 case CEC_OPCODE_DECK_CONTROL
:
1316 return "deck control";
1317 case CEC_OPCODE_DECK_STATUS
:
1318 return "deck status";
1319 case CEC_OPCODE_GIVE_DECK_STATUS
:
1320 return "give deck status";
1321 case CEC_OPCODE_PLAY
:
1323 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
1324 return "give tuner status";
1325 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
1326 return "select analogue service";
1327 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
1328 return "set digital service";
1329 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
1330 return "tuner device status";
1331 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
1332 return "tuner step decrement";
1333 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
1334 return "tuner step increment";
1335 case CEC_OPCODE_DEVICE_VENDOR_ID
:
1336 return "device vendor id";
1337 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
1338 return "give device vendor id";
1339 case CEC_OPCODE_VENDOR_COMMAND
:
1340 return "vendor command";
1341 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
1342 return "vendor command with id";
1343 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
1344 return "vendor remote button down";
1345 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
1346 return "vendor remote button up";
1347 case CEC_OPCODE_SET_OSD_STRING
:
1348 return "set osd string";
1349 case CEC_OPCODE_GIVE_OSD_NAME
:
1350 return "give osd name";
1351 case CEC_OPCODE_SET_OSD_NAME
:
1352 return "set osd name";
1353 case CEC_OPCODE_MENU_REQUEST
:
1354 return "menu request";
1355 case CEC_OPCODE_MENU_STATUS
:
1356 return "menu status";
1357 case CEC_OPCODE_USER_CONTROL_PRESSED
:
1358 return "user control pressed";
1359 case CEC_OPCODE_USER_CONTROL_RELEASE
:
1360 return "user control release";
1361 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
1362 return "give device power status";
1363 case CEC_OPCODE_REPORT_POWER_STATUS
:
1364 return "report power status";
1365 case CEC_OPCODE_FEATURE_ABORT
:
1366 return "feature abort";
1367 case CEC_OPCODE_ABORT
:
1369 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
1370 return "give audio status";
1371 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
1372 return "give audio mode status";
1373 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
1374 return "report audio status";
1375 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
1376 return "set system audio mode";
1377 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
1378 return "system audio mode request";
1379 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
1380 return "system audio mode status";
1381 case CEC_OPCODE_SET_AUDIO_RATE
:
1382 return "set audio rate";
1388 const char *CCECProcessor::ToString(const cec_system_audio_status mode
)
1392 case CEC_SYSTEM_AUDIO_STATUS_ON
:
1394 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
1401 const char *CCECProcessor::ToString(const cec_audio_status status
)
1403 // TODO this is a mask
1407 const char *CCECProcessor::ToString(const cec_vendor_id vendor
)
1411 case CEC_VENDOR_SAMSUNG
:
1415 case CEC_VENDOR_PANASONIC
:
1417 case CEC_VENDOR_PIONEER
:
1419 case CEC_VENDOR_ONKYO
:
1421 case CEC_VENDOR_YAMAHA
:
1423 case CEC_VENDOR_PHILIPS
:
1430 void *CCECBusScan::Process(void)
1432 CCECBusDevice
*device(NULL
);
1433 uint8_t iCounter(0);
1435 while (!IsStopped())
1437 if (++iCounter
< 10)
1442 for (unsigned int iPtr
= 0; iPtr
<= 11 && !IsStopped(); iPtr
++)
1444 device
= m_processor
->m_busDevices
[iPtr
];
1446 if (device
&& device
->GetStatus(true) == CEC_DEVICE_STATUS_PRESENT
)
1450 device
->GetVendorId();
1454 device
->GetPowerStatus(true);
1462 void CCECBusScan::WaitUntilIdle(void)
1467 int32_t iWaitTime
= 3000 - (int32_t)(GetTimeMs() - m_processor
->GetLastTransmission());
1468 while (iWaitTime
> 0)
1471 iWaitTime
= 3000 - (int32_t)(GetTimeMs() - m_processor
->GetLastTransmission());
1475 bool CCECProcessor::StartBootloader(void)
1477 return m_communication
->StartBootloader();
1480 bool CCECProcessor::PingAdapter(void)
1482 return m_communication
->PingAdapter();