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);
181 m_bInitialised
= true;
182 m_controller
->AddLog(CEC_LOG_DEBUG
, "processor thread started");
186 m_controller
->AddLog(CEC_LOG_ERROR
, "could not create a processor thread");
193 bool CCECProcessor::TryLogicalAddress(cec_logical_address address
)
195 if (m_busDevices
[address
]->TryLogicalAddress())
197 m_logicalAddresses
.Set(address
);
204 bool CCECProcessor::FindLogicalAddressRecordingDevice(void)
206 AddLog(CEC_LOG_DEBUG
, "detecting logical address for type 'recording device'");
207 return TryLogicalAddress(CECDEVICE_RECORDINGDEVICE1
) ||
208 TryLogicalAddress(CECDEVICE_RECORDINGDEVICE2
) ||
209 TryLogicalAddress(CECDEVICE_RECORDINGDEVICE3
);
212 bool CCECProcessor::FindLogicalAddressTuner(void)
214 AddLog(CEC_LOG_DEBUG
, "detecting logical address for type 'tuner'");
215 return TryLogicalAddress(CECDEVICE_TUNER1
) ||
216 TryLogicalAddress(CECDEVICE_TUNER2
) ||
217 TryLogicalAddress(CECDEVICE_TUNER3
) ||
218 TryLogicalAddress(CECDEVICE_TUNER4
);
221 bool CCECProcessor::FindLogicalAddressPlaybackDevice(void)
223 AddLog(CEC_LOG_DEBUG
, "detecting logical address for type 'playback device'");
224 return TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE1
) ||
225 TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE2
) ||
226 TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE3
);
229 bool CCECProcessor::FindLogicalAddressAudioSystem(void)
231 AddLog(CEC_LOG_DEBUG
, "detecting logical address for type 'audio'");
232 return TryLogicalAddress(CECDEVICE_AUDIOSYSTEM
);
235 bool CCECProcessor::ChangeDeviceType(cec_device_type from
, cec_device_type to
)
237 bool bChanged(false);
240 strLog
.Format("changing device type '%s' into '%s'", ToString(from
), ToString(to
));
241 AddLog(CEC_LOG_NOTICE
, strLog
);
243 CLockObject
lock(&m_mutex
);
244 CCECBusDevice
*previousDevice
= GetDeviceByType(from
);
245 m_logicalAddresses
.primary
= CECDEVICE_UNKNOWN
;
247 for (unsigned int iPtr
= 0; iPtr
< 5; iPtr
++)
249 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_RESERVED
)
252 if (m_types
.types
[iPtr
] == from
)
255 m_types
.types
[iPtr
] = to
;
257 else if (m_types
.types
[iPtr
] == to
&& bChanged
)
259 m_types
.types
[iPtr
] = CEC_DEVICE_TYPE_RESERVED
;
265 FindLogicalAddresses();
267 CCECBusDevice
*newDevice
= GetDeviceByType(to
);
268 if (previousDevice
&& newDevice
)
270 newDevice
->SetDeviceStatus(CEC_DEVICE_STATUS_HANDLED_BY_LIBCEC
);
271 previousDevice
->SetDeviceStatus(CEC_DEVICE_STATUS_UNKNOWN
);
273 newDevice
->SetCecVersion(previousDevice
->GetCecVersion(false));
274 previousDevice
->SetCecVersion(CEC_VERSION_UNKNOWN
);
276 newDevice
->SetMenuLanguage(previousDevice
->GetMenuLanguage(false));
277 cec_menu_language lang
;
278 lang
.device
= previousDevice
->GetLogicalAddress();
279 for (unsigned int iPtr
= 0; iPtr
< 4; iPtr
++)
280 lang
.language
[iPtr
] = '?';
281 lang
.language
[3] = 0;
282 previousDevice
->SetMenuLanguage(lang
);
284 newDevice
->SetMenuState(previousDevice
->GetMenuState());
285 previousDevice
->SetMenuState(CEC_MENU_STATE_DEACTIVATED
);
287 newDevice
->SetOSDName(previousDevice
->GetOSDName(false));
288 previousDevice
->SetOSDName(ToString(previousDevice
->GetLogicalAddress()));
290 newDevice
->SetPhysicalAddress(previousDevice
->GetPhysicalAddress(false));
291 previousDevice
->SetPhysicalAddress(0xFFFF);
293 newDevice
->SetPowerStatus(previousDevice
->GetPowerStatus(false));
294 previousDevice
->SetPowerStatus(CEC_POWER_STATUS_UNKNOWN
);
296 newDevice
->SetVendorId(previousDevice
->GetVendorId(false));
297 previousDevice
->SetVendorId(CEC_VENDOR_UNKNOWN
);
299 if ((from
== CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| from
== CEC_DEVICE_TYPE_RECORDING_DEVICE
) &&
300 (to
== CEC_DEVICE_TYPE_PLAYBACK_DEVICE
|| to
== CEC_DEVICE_TYPE_RECORDING_DEVICE
))
302 ((CCECPlaybackDevice
*) newDevice
)->SetDeckControlMode(((CCECPlaybackDevice
*) previousDevice
)->GetDeckControlMode());
303 ((CCECPlaybackDevice
*) previousDevice
)->SetDeckControlMode(CEC_DECK_CONTROL_MODE_STOP
);
305 ((CCECPlaybackDevice
*) newDevice
)->SetDeckStatus(((CCECPlaybackDevice
*) previousDevice
)->GetDeckStatus());
306 ((CCECPlaybackDevice
*) previousDevice
)->SetDeckStatus(CEC_DECK_INFO_STOP
);
314 bool CCECProcessor::FindLogicalAddresses(void)
317 m_logicalAddresses
.Clear();
320 for (unsigned int iPtr
= 0; iPtr
< 5; iPtr
++)
322 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_RESERVED
)
325 strLog
.Format("%s - device %d: type %d", __FUNCTION__
, iPtr
, m_types
.types
[iPtr
]);
326 AddLog(CEC_LOG_DEBUG
, strLog
);
328 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_RECORDING_DEVICE
)
329 bReturn
&= FindLogicalAddressRecordingDevice();
330 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_TUNER
)
331 bReturn
&= FindLogicalAddressTuner();
332 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
)
333 bReturn
&= FindLogicalAddressPlaybackDevice();
334 if (m_types
.types
[iPtr
] == CEC_DEVICE_TYPE_AUDIO_SYSTEM
)
335 bReturn
&= FindLogicalAddressAudioSystem();
339 SetAckMask(m_logicalAddresses
.AckMask());
344 void CCECProcessor::ReplaceHandlers(void)
346 for (uint8_t iPtr
= 0; iPtr
<= CECDEVICE_PLAYBACKDEVICE3
; iPtr
++)
347 m_busDevices
[iPtr
]->ReplaceHandler(m_bInitialised
);
350 void *CCECProcessor::Process(void)
352 bool bParseFrame(false);
354 CCECAdapterMessage msg
;
357 CLockObject
lock(&m_mutex
);
359 m_controller
->AddLog(CEC_LOG_DEBUG
, "processor thread started");
360 m_startCondition
.Signal();
370 CLockObject
lock(&m_mutex
);
371 if (m_commandBuffer
.Pop(command
))
375 else if (m_communication
->IsOpen() && m_communication
->Read(msg
, 50))
377 if ((bParseFrame
= (ParseMessage(msg
) && !IsStopped())) == true)
378 command
= m_currentframe
;
383 ParseCommand(command
);
388 m_controller
->CheckKeypressTimeout();
392 m_communication
->Close();
397 bool CCECProcessor::SetActiveSource(cec_device_type type
/* = CEC_DEVICE_TYPE_RESERVED */)
404 cec_logical_address addr
= m_logicalAddresses
.primary
;
406 if (type
!= CEC_DEVICE_TYPE_RESERVED
)
408 for (uint8_t iPtr
= 0; iPtr
<= 11; iPtr
++)
410 if (m_logicalAddresses
[iPtr
] && m_busDevices
[iPtr
]->m_type
== type
)
412 addr
= (cec_logical_address
) iPtr
;
418 m_busDevices
[addr
]->SetActiveSource();
419 if (m_busDevices
[addr
]->GetPhysicalAddress(false) != 0xFFFF)
421 bReturn
= m_busDevices
[addr
]->TransmitActiveSource();
423 if (bReturn
&& (m_busDevices
[addr
]->GetType() == CEC_DEVICE_TYPE_PLAYBACK_DEVICE
||
424 m_busDevices
[addr
]->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE
) &&
425 m_busDevices
[addr
]->GetHandler()->SendDeckStatusUpdateOnActiveSource())
427 bReturn
= ((CCECPlaybackDevice
*)m_busDevices
[addr
])->TransmitDeckStatus(CECDEVICE_TV
);
434 bool CCECProcessor::SetActiveSource(uint16_t iStreamPath
)
438 CCECBusDevice
*device
= GetDeviceByPhysicalAddress(iStreamPath
);
441 device
->SetActiveSource();
448 void CCECProcessor::SetStandardLineTimeout(uint8_t iTimeout
)
450 CLockObject
lock(&m_mutex
);
451 m_iStandardLineTimeout
= iTimeout
;
454 void CCECProcessor::SetRetryLineTimeout(uint8_t iTimeout
)
456 CLockObject
lock(&m_mutex
);
457 m_iRetryLineTimeout
= iTimeout
;
460 bool CCECProcessor::SetActiveView(void)
462 return SetActiveSource(m_types
.IsEmpty() ? CEC_DEVICE_TYPE_RESERVED
: m_types
[0]);
465 bool CCECProcessor::SetDeckControlMode(cec_deck_control_mode mode
, bool bSendUpdate
/* = true */)
469 CCECBusDevice
*device
= GetDeviceByType(CEC_DEVICE_TYPE_PLAYBACK_DEVICE
);
472 ((CCECPlaybackDevice
*) device
)->SetDeckControlMode(mode
);
474 ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(CECDEVICE_TV
);
481 bool CCECProcessor::SetDeckInfo(cec_deck_info info
, bool bSendUpdate
/* = true */)
485 CCECBusDevice
*device
= GetDeviceByType(CEC_DEVICE_TYPE_PLAYBACK_DEVICE
);
488 ((CCECPlaybackDevice
*) device
)->SetDeckStatus(info
);
490 ((CCECPlaybackDevice
*) device
)->TransmitDeckStatus(CECDEVICE_TV
);
497 bool CCECProcessor::SetHDMIPort(cec_logical_address iBaseDevice
, uint8_t iPort
, bool bForce
/* = false */)
500 CLockObject
lock(&m_mutex
);
502 m_iBaseDevice
= iBaseDevice
;
504 if (!m_bStarted
&& !bForce
)
508 strLog
.Format("setting HDMI port to %d on device %s (%d)", iPort
, ToString(iBaseDevice
), (int)iBaseDevice
);
509 AddLog(CEC_LOG_DEBUG
, strLog
);
511 uint16_t iPhysicalAddress(0);
512 if (iBaseDevice
> CECDEVICE_TV
)
515 iPhysicalAddress
= m_busDevices
[iBaseDevice
]->GetPhysicalAddress();
519 if (iPhysicalAddress
< 0xffff)
521 if (iPhysicalAddress
== 0)
522 iPhysicalAddress
+= 0x1000 * iPort
;
523 else if (iPhysicalAddress
% 0x1000 == 0)
524 iPhysicalAddress
+= 0x100 * iPort
;
525 else if (iPhysicalAddress
% 0x100 == 0)
526 iPhysicalAddress
+= 0x10 * iPort
;
527 else if (iPhysicalAddress
% 0x10 == 0)
528 iPhysicalAddress
+= iPort
;
534 m_controller
->AddLog(CEC_LOG_ERROR
, "failed to set the physical address");
538 SetPhysicalAddress(iPhysicalAddress
);
544 bool CCECProcessor::PhysicalAddressInUse(uint16_t iPhysicalAddress
)
546 for (unsigned int iPtr
= 0; iPtr
< 15; iPtr
++)
548 if (m_busDevices
[iPtr
]->GetPhysicalAddress(false) == iPhysicalAddress
)
554 bool CCECProcessor::TransmitInactiveSource(void)
559 if (!m_logicalAddresses
.IsEmpty() && m_busDevices
[m_logicalAddresses
.primary
])
560 return m_busDevices
[m_logicalAddresses
.primary
]->TransmitInactiveSource();
564 void CCECProcessor::LogOutput(const cec_command
&data
)
567 strTx
.Format("<< %02x", ((uint8_t)data
.initiator
<< 4) + (uint8_t)data
.destination
);
569 strTx
.AppendFormat(":%02x", (uint8_t)data
.opcode
);
571 for (uint8_t iPtr
= 0; iPtr
< data
.parameters
.size
; iPtr
++)
572 strTx
.AppendFormat(":%02x", data
.parameters
[iPtr
]);
573 m_controller
->AddLog(CEC_LOG_TRAFFIC
, strTx
.c_str());
576 bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress
)
578 CLockObject
lock(&m_mutex
);
579 if (m_logicalAddresses
.primary
!= iLogicalAddress
)
582 strLog
.Format("<< setting primary logical address to %1x", iLogicalAddress
);
583 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
584 m_logicalAddresses
.primary
= iLogicalAddress
;
585 m_logicalAddresses
.Set(iLogicalAddress
);
586 return SetAckMask(m_logicalAddresses
.AckMask());
592 bool CCECProcessor::SetMenuState(cec_menu_state state
, bool bSendUpdate
/* = true */)
594 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
596 if (m_logicalAddresses
[iPtr
])
597 m_busDevices
[iPtr
]->SetMenuState(state
);
601 m_busDevices
[m_logicalAddresses
.primary
]->TransmitMenuState(CECDEVICE_TV
);
606 bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress
, bool bSendUpdate
/* = true */)
608 bool bSendActiveView(false);
612 CLockObject
lock(&m_mutex
);
613 if (!m_logicalAddresses
.IsEmpty())
615 bool bWasActiveSource(false);
616 for (uint8_t iPtr
= 0; iPtr
< 15; iPtr
++)
617 if (m_logicalAddresses
[iPtr
])
619 bWasActiveSource
|= m_busDevices
[iPtr
]->IsActiveSource();
620 m_busDevices
[iPtr
]->SetInactiveSource();
621 m_busDevices
[iPtr
]->SetPhysicalAddress(iPhysicalAddress
);
623 m_busDevices
[iPtr
]->TransmitPhysicalAddress();
626 bSendActiveView
= bWasActiveSource
&& bSendUpdate
;
637 bool CCECProcessor::SwitchMonitoring(bool bEnable
)
640 strLog
.Format("== %s monitoring mode ==", bEnable
? "enabling" : "disabling");
641 m_controller
->AddLog(CEC_LOG_NOTICE
, strLog
.c_str());
644 CLockObject
lock(&m_mutex
);
645 m_bMonitor
= bEnable
;
649 return SetAckMask(0);
651 return SetAckMask(m_logicalAddresses
.AckMask());
654 bool CCECProcessor::PollDevice(cec_logical_address iAddress
)
656 if (iAddress
!= CECDEVICE_UNKNOWN
&& m_busDevices
[iAddress
])
658 return m_logicalAddresses
.primary
== CECDEVICE_UNKNOWN
?
659 m_busDevices
[iAddress
]->TransmitPoll(iAddress
) :
660 m_busDevices
[m_logicalAddresses
.primary
]->TransmitPoll(iAddress
);
665 uint8_t CCECProcessor::VolumeUp(bool bSendRelease
/* = true */)
668 if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM
))
669 status
= ((CCECAudioSystem
*)m_busDevices
[CECDEVICE_AUDIOSYSTEM
])->VolumeUp(bSendRelease
);
674 uint8_t CCECProcessor::VolumeDown(bool bSendRelease
/* = true */)
677 if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM
))
678 status
= ((CCECAudioSystem
*)m_busDevices
[CECDEVICE_AUDIOSYSTEM
])->VolumeDown(bSendRelease
);
683 uint8_t CCECProcessor::MuteAudio(bool bSendRelease
/* = true */)
686 if (IsPresentDevice(CECDEVICE_AUDIOSYSTEM
))
687 status
= ((CCECAudioSystem
*)m_busDevices
[CECDEVICE_AUDIOSYSTEM
])->MuteAudio(bSendRelease
);
692 CCECBusDevice
*CCECProcessor::GetDeviceByPhysicalAddress(uint16_t iPhysicalAddress
, bool bRefresh
/* = false */) const
694 if (m_busDevices
[m_logicalAddresses
.primary
]->GetPhysicalAddress(false) == iPhysicalAddress
)
695 return m_busDevices
[m_logicalAddresses
.primary
];
697 CCECBusDevice
*device
= NULL
;
698 for (unsigned int iPtr
= 0; iPtr
< 16; iPtr
++)
700 if (m_busDevices
[iPtr
]->GetPhysicalAddress(bRefresh
) == iPhysicalAddress
)
702 device
= m_busDevices
[iPtr
];
710 CCECBusDevice
*CCECProcessor::GetDeviceByType(cec_device_type type
) const
712 CCECBusDevice
*device
= NULL
;
714 for (uint8_t iPtr
= 0; iPtr
< 16; iPtr
++)
716 if (m_busDevices
[iPtr
]->m_type
== type
&& m_logicalAddresses
[iPtr
])
718 device
= m_busDevices
[iPtr
];
726 CCECBusDevice
*CCECProcessor::GetPrimaryDevice(void) const
728 CCECBusDevice
*device(NULL
);
729 cec_logical_address primary
= m_logicalAddresses
.primary
;
730 if (primary
!= CECDEVICE_UNKNOWN
)
731 device
= m_busDevices
[primary
];
735 cec_version
CCECProcessor::GetDeviceCecVersion(cec_logical_address iAddress
)
737 return m_busDevices
[iAddress
]->GetCecVersion();
740 cec_osd_name
CCECProcessor::GetDeviceOSDName(cec_logical_address iAddress
)
742 CStdString strOSDName
= m_busDevices
[iAddress
]->GetOSDName();
745 snprintf(retVal
.name
, sizeof(retVal
.name
), "%s", strOSDName
.c_str());
746 retVal
.device
= iAddress
;
751 bool CCECProcessor::GetDeviceMenuLanguage(cec_logical_address iAddress
, cec_menu_language
*language
)
753 if (m_busDevices
[iAddress
])
755 *language
= m_busDevices
[iAddress
]->GetMenuLanguage();
756 return (strcmp(language
->language
, "???") != 0);
761 uint64_t CCECProcessor::GetDeviceVendorId(cec_logical_address iAddress
)
763 if (m_busDevices
[iAddress
])
764 return m_busDevices
[iAddress
]->GetVendorId();
768 uint16_t CCECProcessor::GetDevicePhysicalAddress(cec_logical_address iAddress
)
770 if (m_busDevices
[iAddress
])
771 return m_busDevices
[iAddress
]->GetPhysicalAddress(false);
775 cec_power_status
CCECProcessor::GetDevicePowerStatus(cec_logical_address iAddress
)
777 if (m_busDevices
[iAddress
])
778 return m_busDevices
[iAddress
]->GetPowerStatus();
779 return CEC_POWER_STATUS_UNKNOWN
;
782 cec_logical_address
CCECProcessor::GetActiveSource(void)
784 for (uint8_t iPtr
= 0; iPtr
<= 11; iPtr
++)
786 if (m_busDevices
[iPtr
]->IsActiveSource())
787 return (cec_logical_address
)iPtr
;
790 return CECDEVICE_UNKNOWN
;
793 bool CCECProcessor::IsActiveSource(cec_logical_address iAddress
)
795 return m_busDevices
[iAddress
]->IsActiveSource();
798 bool CCECProcessor::Transmit(const cec_command
&data
)
803 CCECAdapterMessage
*output
= new CCECAdapterMessage(data
);
805 /* set the number of retries */
806 if (data
.opcode
== CEC_OPCODE_NONE
)
807 output
->maxTries
= 1;
808 else if (data
.initiator
!= CECDEVICE_BROADCAST
)
809 output
->maxTries
= m_busDevices
[data
.initiator
]->GetHandler()->GetTransmitRetries() + 1;
811 bReturn
= Transmit(output
);
813 /* set to "not present" on failed ack */
814 if (output
->is_error() && output
->reply
== MSGCODE_TRANSMIT_FAILED_ACK
&&
815 output
->destination() != CECDEVICE_BROADCAST
)
816 m_busDevices
[output
->destination()]->SetDeviceStatus(CEC_DEVICE_STATUS_NOT_PRESENT
);
822 bool CCECProcessor::Transmit(CCECAdapterMessage
*output
)
825 CLockObject
lock(&m_mutex
);
827 m_iLastTransmission
= GetTimeMs();
828 m_communication
->SetLineTimeout(m_iStandardLineTimeout
);
833 if (output
->tries
> 0)
834 m_communication
->SetLineTimeout(m_iRetryLineTimeout
);
836 CLockObject
msgLock(&output
->mutex
);
837 if (!m_communication
|| !m_communication
->Write(output
))
841 output
->condition
.Wait(&output
->mutex
);
842 if (output
->state
!= ADAPTER_MESSAGE_STATE_SENT
)
844 m_controller
->AddLog(CEC_LOG_ERROR
, "command was not sent");
849 if (output
->transmit_timeout
> 0)
851 if ((bReturn
= WaitForTransmitSucceeded(output
)) == false)
852 m_controller
->AddLog(CEC_LOG_DEBUG
, "did not receive ack");
856 }while (output
->transmit_timeout
> 0 && output
->needs_retry() && ++output
->tries
< output
->maxTries
);
859 m_communication
->SetLineTimeout(m_iStandardLineTimeout
);
864 void CCECProcessor::TransmitAbort(cec_logical_address address
, cec_opcode opcode
, cec_abort_reason reason
/* = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE */)
866 m_controller
->AddLog(CEC_LOG_DEBUG
, "<< transmitting abort message");
870 cec_command::Format(command
, m_logicalAddresses
.primary
, address
, CEC_OPCODE_FEATURE_ABORT
);
871 command
.parameters
.PushBack((uint8_t)opcode
);
872 command
.parameters
.PushBack((uint8_t)reason
);
877 bool CCECProcessor::WaitForTransmitSucceeded(CCECAdapterMessage
*message
)
880 bool bTransmitSucceeded(false);
881 uint8_t iPacketsLeft(message
->size() / 4);
883 int64_t iNow
= GetTimeMs();
884 int64_t iTargetTime
= iNow
+ message
->transmit_timeout
;
886 while (!bTransmitSucceeded
&& !bError
&& (message
->transmit_timeout
== 0 || iNow
< iTargetTime
))
888 CCECAdapterMessage msg
;
890 if (!m_communication
->Read(msg
, message
->transmit_timeout
> 0 ? (int32_t)(iTargetTime
- iNow
) : 1000))
896 if (msg
.message() == MSGCODE_FRAME_START
&& msg
.ack())
898 m_busDevices
[msg
.initiator()]->GetHandler()->HandlePoll(msg
.initiator(), msg
.destination());
899 m_lastInitiator
= msg
.initiator();
904 bError
= msg
.is_error();
905 if (msg
.message() == MSGCODE_RECEIVE_FAILED
&&
906 m_lastInitiator
!= CECDEVICE_UNKNOWN
&&
907 !m_busDevices
[m_lastInitiator
]->GetHandler()->HandleReceiveFailed())
915 message
->reply
= msg
.message();
916 m_controller
->AddLog(CEC_LOG_DEBUG
, msg
.ToString());
920 switch(msg
.message())
922 case MSGCODE_COMMAND_ACCEPTED
:
923 m_controller
->AddLog(CEC_LOG_DEBUG
, msg
.ToString());
924 if (iPacketsLeft
> 0)
927 case MSGCODE_TRANSMIT_SUCCEEDED
:
928 m_controller
->AddLog(CEC_LOG_DEBUG
, msg
.ToString());
929 bTransmitSucceeded
= (iPacketsLeft
== 0);
930 bError
= !bTransmitSucceeded
;
931 message
->reply
= MSGCODE_TRANSMIT_SUCCEEDED
;
934 // ignore other data while waiting
942 return bTransmitSucceeded
&& !bError
;
945 bool CCECProcessor::ParseMessage(const CCECAdapterMessage
&msg
)
948 bool bIsError(msg
.is_error());
953 switch(msg
.message())
955 case MSGCODE_FRAME_START
:
957 m_currentframe
.Clear();
960 m_currentframe
.initiator
= msg
.initiator();
961 m_currentframe
.destination
= msg
.destination();
962 m_currentframe
.ack
= msg
.ack();
963 m_currentframe
.eom
= msg
.eom();
965 if (m_currentframe
.ack
== 0x1)
967 m_lastInitiator
= m_currentframe
.initiator
;
968 m_busDevices
[m_lastInitiator
]->GetHandler()->HandlePoll(m_currentframe
.initiator
, m_currentframe
.destination
);
972 case MSGCODE_RECEIVE_FAILED
:
974 if (m_lastInitiator
!= CECDEVICE_UNKNOWN
)
975 bIsError
= m_busDevices
[m_lastInitiator
]->GetHandler()->HandleReceiveFailed();
978 case MSGCODE_FRAME_DATA
:
982 m_currentframe
.PushBack(msg
[1]);
983 m_currentframe
.eom
= msg
.eom();
992 m_controller
->AddLog(bIsError
? CEC_LOG_WARNING
: CEC_LOG_DEBUG
, msg
.ToString());
996 void CCECProcessor::ParseCommand(cec_command
&command
)
999 dataStr
.Format(">> %1x%1x:%02x", command
.initiator
, command
.destination
, command
.opcode
);
1000 for (uint8_t iPtr
= 0; iPtr
< command
.parameters
.size
; iPtr
++)
1001 dataStr
.AppendFormat(":%02x", (unsigned int)command
.parameters
[iPtr
]);
1002 m_controller
->AddLog(CEC_LOG_TRAFFIC
, dataStr
.c_str());
1004 if (!m_bMonitor
&& command
.initiator
>= CECDEVICE_TV
&& command
.initiator
<= CECDEVICE_BROADCAST
)
1005 m_busDevices
[(uint8_t)command
.initiator
]->HandleCommand(command
);
1008 cec_logical_addresses
CCECProcessor::GetActiveDevices(void)
1010 cec_logical_addresses addresses
;
1012 for (unsigned int iPtr
= 0; iPtr
< 15; iPtr
++)
1014 if (m_busDevices
[iPtr
]->GetStatus() == CEC_DEVICE_STATUS_PRESENT
)
1015 addresses
.Set((cec_logical_address
) iPtr
);
1020 bool CCECProcessor::IsPresentDevice(cec_logical_address address
)
1022 return m_busDevices
[address
]->GetStatus() == CEC_DEVICE_STATUS_PRESENT
;
1025 bool CCECProcessor::IsPresentDeviceType(cec_device_type type
)
1027 for (unsigned int iPtr
= 0; iPtr
< 15; iPtr
++)
1029 if (m_busDevices
[iPtr
]->GetType() == type
&& m_busDevices
[iPtr
]->GetStatus() == CEC_DEVICE_STATUS_PRESENT
)
1036 uint16_t CCECProcessor::GetPhysicalAddress(void) const
1038 if (!m_logicalAddresses
.IsEmpty() && m_busDevices
[m_logicalAddresses
.primary
])
1039 return m_busDevices
[m_logicalAddresses
.primary
]->GetPhysicalAddress(false);
1043 void CCECProcessor::SetCurrentButton(cec_user_control_code iButtonCode
)
1045 m_controller
->SetCurrentButton(iButtonCode
);
1048 void CCECProcessor::AddCommand(const cec_command
&command
)
1050 m_controller
->AddCommand(command
);
1053 void CCECProcessor::AddKey(cec_keypress
&key
)
1055 m_controller
->AddKey(key
);
1058 void CCECProcessor::AddKey(void)
1060 m_controller
->AddKey();
1063 void CCECProcessor::AddLog(cec_log_level level
, const CStdString
&strMessage
)
1065 m_controller
->AddLog(level
, strMessage
);
1068 bool CCECProcessor::SetAckMask(uint16_t iMask
)
1070 bool bReturn(false);
1072 strLog
.Format("setting ackmask to %2x", iMask
);
1073 m_controller
->AddLog(CEC_LOG_DEBUG
, strLog
.c_str());
1075 CCECAdapterMessage
*output
= new CCECAdapterMessage
;
1077 output
->push_back(MSGSTART
);
1078 output
->push_escaped(MSGCODE_SET_ACK_MASK
);
1079 output
->push_escaped(iMask
>> 8);
1080 output
->push_escaped((uint8_t)iMask
);
1081 output
->push_back(MSGEND
);
1083 if ((bReturn
= Transmit(output
)) == false)
1084 m_controller
->AddLog(CEC_LOG_ERROR
, "could not set the ackmask");
1091 bool CCECProcessor::TransmitKeypress(cec_logical_address iDestination
, cec_user_control_code key
, bool bWait
/* = true */)
1093 return m_busDevices
[iDestination
]->TransmitKeypress(key
, bWait
);
1096 bool CCECProcessor::TransmitKeyRelease(cec_logical_address iDestination
, bool bWait
/* = true */)
1098 return m_busDevices
[iDestination
]->TransmitKeyRelease(bWait
);
1101 const char *CCECProcessor::ToString(const cec_device_type type
)
1105 case CEC_DEVICE_TYPE_AUDIO_SYSTEM
:
1106 return "audio system";
1107 case CEC_DEVICE_TYPE_PLAYBACK_DEVICE
:
1108 return "playback device";
1109 case CEC_DEVICE_TYPE_RECORDING_DEVICE
:
1110 return "recording device";
1111 case CEC_DEVICE_TYPE_RESERVED
:
1113 case CEC_DEVICE_TYPE_TUNER
:
1115 case CEC_DEVICE_TYPE_TV
:
1122 const char *CCECProcessor::ToString(const cec_menu_state state
)
1126 case CEC_MENU_STATE_ACTIVATED
:
1128 case CEC_MENU_STATE_DEACTIVATED
:
1129 return "deactivated";
1135 const char *CCECProcessor::ToString(const cec_version version
)
1139 case CEC_VERSION_1_2
:
1141 case CEC_VERSION_1_2A
:
1143 case CEC_VERSION_1_3
:
1145 case CEC_VERSION_1_3A
:
1147 case CEC_VERSION_1_4
:
1154 const char *CCECProcessor::ToString(const cec_power_status status
)
1158 case CEC_POWER_STATUS_ON
:
1160 case CEC_POWER_STATUS_STANDBY
:
1162 case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY
:
1163 return "in transition from on to standby";
1164 case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON
:
1165 return "in transition from standby to on";
1171 const char *CCECProcessor::ToString(const cec_logical_address address
)
1175 case CECDEVICE_AUDIOSYSTEM
:
1177 case CECDEVICE_BROADCAST
:
1179 case CECDEVICE_FREEUSE
:
1181 case CECDEVICE_PLAYBACKDEVICE1
:
1182 return "Playback 1";
1183 case CECDEVICE_PLAYBACKDEVICE2
:
1184 return "Playback 2";
1185 case CECDEVICE_PLAYBACKDEVICE3
:
1186 return "Playback 3";
1187 case CECDEVICE_RECORDINGDEVICE1
:
1188 return "Recorder 1";
1189 case CECDEVICE_RECORDINGDEVICE2
:
1190 return "Recorder 2";
1191 case CECDEVICE_RECORDINGDEVICE3
:
1192 return "Recorder 3";
1193 case CECDEVICE_RESERVED1
:
1194 return "Reserved 1";
1195 case CECDEVICE_RESERVED2
:
1196 return "Reserved 2";
1197 case CECDEVICE_TUNER1
:
1199 case CECDEVICE_TUNER2
:
1201 case CECDEVICE_TUNER3
:
1203 case CECDEVICE_TUNER4
:
1212 const char *CCECProcessor::ToString(const cec_deck_control_mode mode
)
1216 case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND
:
1217 return "skip forward wind";
1218 case CEC_DECK_CONTROL_MODE_EJECT
:
1220 case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND
:
1221 return "reverse rewind";
1222 case CEC_DECK_CONTROL_MODE_STOP
:
1229 const char *CCECProcessor::ToString(const cec_deck_info status
)
1233 case CEC_DECK_INFO_PLAY
:
1235 case CEC_DECK_INFO_RECORD
:
1237 case CEC_DECK_INFO_PLAY_REVERSE
:
1238 return "play reverse";
1239 case CEC_DECK_INFO_STILL
:
1241 case CEC_DECK_INFO_SLOW
:
1243 case CEC_DECK_INFO_SLOW_REVERSE
:
1244 return "slow reverse";
1245 case CEC_DECK_INFO_FAST_FORWARD
:
1246 return "fast forward";
1247 case CEC_DECK_INFO_FAST_REVERSE
:
1248 return "fast reverse";
1249 case CEC_DECK_INFO_NO_MEDIA
:
1251 case CEC_DECK_INFO_STOP
:
1253 case CEC_DECK_INFO_SKIP_FORWARD_WIND
:
1254 return "info skip forward wind";
1255 case CEC_DECK_INFO_SKIP_REVERSE_REWIND
:
1256 return "info skip reverse rewind";
1257 case CEC_DECK_INFO_INDEX_SEARCH_FORWARD
:
1258 return "info index search forward";
1259 case CEC_DECK_INFO_INDEX_SEARCH_REVERSE
:
1260 return "info index search reverse";
1261 case CEC_DECK_INFO_OTHER_STATUS
:
1268 const char *CCECProcessor::ToString(const cec_opcode opcode
)
1272 case CEC_OPCODE_ACTIVE_SOURCE
:
1273 return "active source";
1274 case CEC_OPCODE_IMAGE_VIEW_ON
:
1275 return "image view on";
1276 case CEC_OPCODE_TEXT_VIEW_ON
:
1277 return "text view on";
1278 case CEC_OPCODE_INACTIVE_SOURCE
:
1279 return "inactive source";
1280 case CEC_OPCODE_REQUEST_ACTIVE_SOURCE
:
1281 return "request active source";
1282 case CEC_OPCODE_ROUTING_CHANGE
:
1283 return "routing change";
1284 case CEC_OPCODE_ROUTING_INFORMATION
:
1285 return "routing information";
1286 case CEC_OPCODE_SET_STREAM_PATH
:
1287 return "set stream path";
1288 case CEC_OPCODE_STANDBY
:
1290 case CEC_OPCODE_RECORD_OFF
:
1291 return "record off";
1292 case CEC_OPCODE_RECORD_ON
:
1294 case CEC_OPCODE_RECORD_STATUS
:
1295 return "record status";
1296 case CEC_OPCODE_RECORD_TV_SCREEN
:
1297 return "record tv screen";
1298 case CEC_OPCODE_CLEAR_ANALOGUE_TIMER
:
1299 return "clear analogue timer";
1300 case CEC_OPCODE_CLEAR_DIGITAL_TIMER
:
1301 return "clear digital timer";
1302 case CEC_OPCODE_CLEAR_EXTERNAL_TIMER
:
1303 return "clear external timer";
1304 case CEC_OPCODE_SET_ANALOGUE_TIMER
:
1305 return "set analogue timer";
1306 case CEC_OPCODE_SET_DIGITAL_TIMER
:
1307 return "set digital timer";
1308 case CEC_OPCODE_SET_EXTERNAL_TIMER
:
1309 return "set external timer";
1310 case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE
:
1311 return "set timer program title";
1312 case CEC_OPCODE_TIMER_CLEARED_STATUS
:
1313 return "timer cleared status";
1314 case CEC_OPCODE_TIMER_STATUS
:
1315 return "timer status";
1316 case CEC_OPCODE_CEC_VERSION
:
1317 return "cec version";
1318 case CEC_OPCODE_GET_CEC_VERSION
:
1319 return "get cec version";
1320 case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS
:
1321 return "give physical address";
1322 case CEC_OPCODE_GET_MENU_LANGUAGE
:
1323 return "get menu language";
1324 case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS
:
1325 return "report physical address";
1326 case CEC_OPCODE_SET_MENU_LANGUAGE
:
1327 return "set menu language";
1328 case CEC_OPCODE_DECK_CONTROL
:
1329 return "deck control";
1330 case CEC_OPCODE_DECK_STATUS
:
1331 return "deck status";
1332 case CEC_OPCODE_GIVE_DECK_STATUS
:
1333 return "give deck status";
1334 case CEC_OPCODE_PLAY
:
1336 case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS
:
1337 return "give tuner status";
1338 case CEC_OPCODE_SELECT_ANALOGUE_SERVICE
:
1339 return "select analogue service";
1340 case CEC_OPCODE_SELECT_DIGITAL_SERVICE
:
1341 return "set digital service";
1342 case CEC_OPCODE_TUNER_DEVICE_STATUS
:
1343 return "tuner device status";
1344 case CEC_OPCODE_TUNER_STEP_DECREMENT
:
1345 return "tuner step decrement";
1346 case CEC_OPCODE_TUNER_STEP_INCREMENT
:
1347 return "tuner step increment";
1348 case CEC_OPCODE_DEVICE_VENDOR_ID
:
1349 return "device vendor id";
1350 case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID
:
1351 return "give device vendor id";
1352 case CEC_OPCODE_VENDOR_COMMAND
:
1353 return "vendor command";
1354 case CEC_OPCODE_VENDOR_COMMAND_WITH_ID
:
1355 return "vendor command with id";
1356 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN
:
1357 return "vendor remote button down";
1358 case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP
:
1359 return "vendor remote button up";
1360 case CEC_OPCODE_SET_OSD_STRING
:
1361 return "set osd string";
1362 case CEC_OPCODE_GIVE_OSD_NAME
:
1363 return "give osd name";
1364 case CEC_OPCODE_SET_OSD_NAME
:
1365 return "set osd name";
1366 case CEC_OPCODE_MENU_REQUEST
:
1367 return "menu request";
1368 case CEC_OPCODE_MENU_STATUS
:
1369 return "menu status";
1370 case CEC_OPCODE_USER_CONTROL_PRESSED
:
1371 return "user control pressed";
1372 case CEC_OPCODE_USER_CONTROL_RELEASE
:
1373 return "user control release";
1374 case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS
:
1375 return "give device power status";
1376 case CEC_OPCODE_REPORT_POWER_STATUS
:
1377 return "report power status";
1378 case CEC_OPCODE_FEATURE_ABORT
:
1379 return "feature abort";
1380 case CEC_OPCODE_ABORT
:
1382 case CEC_OPCODE_GIVE_AUDIO_STATUS
:
1383 return "give audio status";
1384 case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS
:
1385 return "give audio mode status";
1386 case CEC_OPCODE_REPORT_AUDIO_STATUS
:
1387 return "report audio status";
1388 case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE
:
1389 return "set system audio mode";
1390 case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST
:
1391 return "system audio mode request";
1392 case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS
:
1393 return "system audio mode status";
1394 case CEC_OPCODE_SET_AUDIO_RATE
:
1395 return "set audio rate";
1401 const char *CCECProcessor::ToString(const cec_system_audio_status mode
)
1405 case CEC_SYSTEM_AUDIO_STATUS_ON
:
1407 case CEC_SYSTEM_AUDIO_STATUS_OFF
:
1414 const char *CCECProcessor::ToString(const cec_audio_status
UNUSED(status
))
1416 // TODO this is a mask
1420 const char *CCECProcessor::ToString(const cec_vendor_id vendor
)
1424 case CEC_VENDOR_SAMSUNG
:
1428 case CEC_VENDOR_PANASONIC
:
1430 case CEC_VENDOR_PIONEER
:
1432 case CEC_VENDOR_ONKYO
:
1434 case CEC_VENDOR_YAMAHA
:
1436 case CEC_VENDOR_PHILIPS
:
1443 void *CCECBusScan::Process(void)
1445 CCECBusDevice
*device(NULL
);
1446 uint8_t iCounter(0);
1448 while (!IsStopped())
1450 if (++iCounter
< 10)
1455 for (unsigned int iPtr
= 0; iPtr
<= 11 && !IsStopped(); iPtr
++)
1457 device
= m_processor
->m_busDevices
[iPtr
];
1459 if (device
&& device
->GetStatus(true) == CEC_DEVICE_STATUS_PRESENT
)
1463 device
->GetVendorId();
1467 device
->GetPowerStatus(true);
1475 void CCECBusScan::WaitUntilIdle(void)
1480 int32_t iWaitTime
= 3000 - (int32_t)(GetTimeMs() - m_processor
->GetLastTransmission());
1481 while (iWaitTime
> 0)
1484 iWaitTime
= 3000 - (int32_t)(GetTimeMs() - m_processor
->GetLastTransmission());
1488 bool CCECProcessor::StartBootloader(void)
1490 return m_communication
->StartBootloader();
1493 bool CCECProcessor::PingAdapter(void)
1495 return m_communication
->PingAdapter();