cec: store the status of a bus device: present, not present or handled by libcec
[deb_libcec.git] / src / lib / devices / CECBusDevice.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 "CECBusDevice.h"
34 #include "../CECProcessor.h"
35 #include "../implementations/ANCommandHandler.h"
36 #include "../implementations/CECCommandHandler.h"
37 #include "../implementations/SLCommandHandler.h"
38 #include "../implementations/VLCommandHandler.h"
39 #include "../platform/timeutils.h"
40
41 using namespace CEC;
42
43 #define ToString(p) CCECCommandHandler::ToString(p)
44
45 CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress) :
46 m_type(CEC_DEVICE_TYPE_RESERVED),
47 m_iPhysicalAddress(iPhysicalAddress),
48 m_iStreamPath(0),
49 m_iLogicalAddress(iLogicalAddress),
50 m_powerStatus(CEC_POWER_STATUS_UNKNOWN),
51 m_processor(processor),
52 m_vendor(CEC_VENDOR_UNKNOWN),
53 m_menuState(CEC_MENU_STATE_ACTIVATED),
54 m_bActiveSource(false),
55 m_iLastCommandSent(0),
56 m_iLastActive(0),
57 m_cecVersion(CEC_VERSION_UNKNOWN),
58 m_deviceStatus(CEC_DEVICE_STATUS_UNKNOWN)
59 {
60 m_handler = new CCECCommandHandler(this);
61
62 for (unsigned int iPtr = 0; iPtr < 4; iPtr++)
63 m_menuLanguage.language[iPtr] = '?';
64 m_menuLanguage.language[3] = 0;
65 m_menuLanguage.device = iLogicalAddress;
66
67 m_strDeviceName = ToString(m_iLogicalAddress);
68 }
69
70 CCECBusDevice::~CCECBusDevice(void)
71 {
72 m_condition.Broadcast();
73 delete m_handler;
74 }
75
76 void CCECBusDevice::AddLog(cec_log_level level, const CStdString &strMessage)
77 {
78 m_processor->AddLog(level, strMessage);
79 }
80
81 bool CCECBusDevice::HandleCommand(const cec_command &command)
82 {
83 CLockObject lock(&m_transmitMutex);
84 m_iLastActive = GetTimeMs();
85 m_handler->HandleCommand(command);
86 m_condition.Signal();
87 return true;
88 }
89
90 void CCECBusDevice::PollVendorId(void)
91 {
92 CLockObject lock(&m_transmitMutex);
93 if (m_iLastActive > 0 && m_iLogicalAddress != CECDEVICE_BROADCAST &&
94 m_vendor == CEC_VENDOR_UNKNOWN &&
95 GetTimeMs() - m_iLastCommandSent > 5000 &&
96 !m_processor->IsMonitoring())
97 {
98 CStdString strLog;
99 strLog.Format("<< requesting vendor ID of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
100 AddLog(CEC_LOG_NOTICE, strLog);
101 m_iLastCommandSent = GetTimeMs();
102
103 cec_command command;
104 cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
105 if (m_processor->Transmit(command))
106 m_condition.Wait(&m_transmitMutex, 1000);
107 }
108 }
109
110 bool CCECBusDevice::PowerOn(void)
111 {
112 cec_power_status current = GetPowerStatus();
113 if (current != CEC_POWER_STATUS_ON &&
114 current != CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON)
115 {
116 CStdString strLog;
117 strLog.Format("<< powering on '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
118 AddLog(CEC_LOG_DEBUG, strLog.c_str());
119
120 SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
121
122 cec_command command;
123 cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_IMAGE_VIEW_ON);
124
125 return m_processor->Transmit(command);
126 }
127
128 return true;
129 }
130
131 bool CCECBusDevice::Standby(void)
132 {
133 CStdString strLog;
134 strLog.Format("<< putting '%s' (%X) in standby mode", GetLogicalAddressName(), m_iLogicalAddress);
135 AddLog(CEC_LOG_DEBUG, strLog.c_str());
136
137 cec_command command;
138 cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_STANDBY);
139
140 return m_processor->Transmit(command);
141 }
142
143 /** @name Getters */
144 //@{
145 cec_version CCECBusDevice::GetCecVersion(void)
146 {
147 if (!MyLogicalAddressContains(m_iLogicalAddress))
148 {
149 CStdString strLog;
150 strLog.Format("<< requesting CEC version of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
151 AddLog(CEC_LOG_NOTICE, strLog);
152 cec_command command;
153 cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_CEC_VERSION);
154 CLockObject lock(&m_transmitMutex);
155 if (m_processor->Transmit(command))
156 m_condition.Wait(&m_transmitMutex, 1000);
157 }
158
159 CLockObject lock(&m_mutex);
160 return m_cecVersion;
161 }
162
163 const char* CCECBusDevice::GetLogicalAddressName(void) const
164 {
165 return ToString(m_iLogicalAddress);
166 }
167
168 cec_menu_language &CCECBusDevice::GetMenuLanguage(void)
169 {
170 if (!MyLogicalAddressContains(m_iLogicalAddress))
171 {
172 CStdString strLog;
173 strLog.Format("<< requesting menu language of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
174 AddLog(CEC_LOG_NOTICE, strLog);
175 cec_command command;
176 cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GET_MENU_LANGUAGE);
177 CLockObject lock(&m_transmitMutex);
178 if (m_processor->Transmit(command))
179 m_condition.Wait(&m_transmitMutex, 1000);
180 }
181
182 CLockObject lock(&m_mutex);
183 return m_menuLanguage;
184 }
185
186 cec_logical_address CCECBusDevice::GetMyLogicalAddress(void) const
187 {
188 return m_processor->GetLogicalAddress();
189 }
190
191 uint16_t CCECBusDevice::GetMyPhysicalAddress(void) const
192 {
193 return m_processor->GetPhysicalAddress();
194 }
195
196 cec_power_status CCECBusDevice::GetPowerStatus(void)
197 {
198 if (!MyLogicalAddressContains(m_iLogicalAddress))
199 {
200 CStdString strLog;
201 strLog.Format("<< requesting power status of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
202 AddLog(CEC_LOG_NOTICE, strLog);
203 cec_command command;
204 cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_POWER_STATUS);
205 CLockObject lock(&m_transmitMutex);
206 if (m_processor->Transmit(command))
207 m_condition.Wait(&m_transmitMutex, 1000);
208 }
209
210 CLockObject lock(&m_mutex);
211 return m_powerStatus;
212 }
213
214 cec_vendor_id CCECBusDevice::GetVendorId(void)
215 {
216 if (!MyLogicalAddressContains(m_iLogicalAddress))
217 {
218 CStdString strLog;
219 strLog.Format("<< requesting vendor ID of '%s' (%X)", GetLogicalAddressName(), m_iLogicalAddress);
220 AddLog(CEC_LOG_NOTICE, strLog);
221 cec_command command;
222 cec_command::Format(command, GetMyLogicalAddress(), m_iLogicalAddress, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
223 CLockObject lock(&m_transmitMutex);
224
225 if (m_processor->Transmit(command))
226 m_condition.Wait(&m_transmitMutex, 1000);
227 }
228
229 CLockObject lock(&m_mutex);
230 return m_vendor;
231 }
232
233 const char *CCECBusDevice::GetVendorName(void)
234 {
235 CLockObject lock(&m_mutex);
236 return ToString(m_vendor);
237 }
238
239 bool CCECBusDevice::MyLogicalAddressContains(cec_logical_address address) const
240 {
241 return m_processor->HasLogicalAddress(address);
242 }
243
244 cec_bus_device_status CCECBusDevice::GetStatus(void)
245 {
246 CLockObject lock(&m_mutex);
247 if (m_deviceStatus == CEC_DEVICE_STATUS_UNKNOWN)
248 {
249 if (m_processor->PollDevice(m_iLogicalAddress))
250 m_deviceStatus = CEC_DEVICE_STATUS_PRESENT;
251 else
252 m_deviceStatus = CEC_DEVICE_STATUS_NOT_PRESENT;
253 }
254
255 return m_deviceStatus;
256 }
257
258 //@}
259
260 /** @name Setters */
261 //@{
262 void CCECBusDevice::SetCecVersion(const cec_version newVersion)
263 {
264 m_cecVersion = newVersion;
265
266 CStdString strLog;
267 strLog.Format("%s (%X): CEC version %s", GetLogicalAddressName(), m_iLogicalAddress, ToString(newVersion));
268 AddLog(CEC_LOG_DEBUG, strLog);
269 }
270
271 void CCECBusDevice::SetMenuLanguage(const cec_menu_language &language)
272 {
273 CLockObject lock(&m_mutex);
274 if (language.device == m_iLogicalAddress)
275 {
276 CStdString strLog;
277 strLog.Format(">> %s (%X): menu language set to '%s'", GetLogicalAddressName(), m_iLogicalAddress, language.language);
278 m_processor->AddLog(CEC_LOG_DEBUG, strLog);
279 m_menuLanguage = language;
280 }
281 }
282
283 void CCECBusDevice::SetOSDName(CStdString strName)
284 {
285 CLockObject lock(&m_mutex);
286 if (m_strDeviceName != strName)
287 {
288 CStdString strLog;
289 strLog.Format(">> %s (%X): osd name set to '%s'", GetLogicalAddressName(), m_iLogicalAddress, strName);
290 m_processor->AddLog(CEC_LOG_DEBUG, strLog);
291 m_strDeviceName = strName;
292 }
293 }
294
295 void CCECBusDevice::SetMenuState(const cec_menu_state state)
296 {
297 CLockObject lock(&m_mutex);
298 if (m_menuState != state)
299 {
300 CStdString strLog;
301 strLog.Format(">> %s (%X): menu state set to '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_menuState));
302 m_processor->AddLog(CEC_LOG_DEBUG, strLog);
303 m_menuState = state;
304 }
305 }
306
307 void CCECBusDevice::SetInactiveDevice(void)
308 {
309 CLockObject lock(&m_mutex);
310 m_bActiveSource = false;
311 }
312
313 void CCECBusDevice::SetActiveDevice(void)
314 {
315 CLockObject lock(&m_mutex);
316
317 for (int iPtr = 0; iPtr < 16; iPtr++)
318 if (iPtr != m_iLogicalAddress)
319 m_processor->m_busDevices[iPtr]->SetInactiveDevice();
320
321 m_bActiveSource = true;
322 m_powerStatus = CEC_POWER_STATUS_ON;
323 }
324
325 void CCECBusDevice::SetPhysicalAddress(uint16_t iNewAddress)
326 {
327 CLockObject lock(&m_mutex);
328 if (iNewAddress > 0)
329 {
330 CStdString strLog;
331 strLog.Format(">> %s (%X): physical address changed from %04x to %04x", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress, iNewAddress);
332 AddLog(CEC_LOG_DEBUG, strLog.c_str());
333
334 m_iPhysicalAddress = iNewAddress;
335 }
336 }
337
338 void CCECBusDevice::SetStreamPath(uint16_t iNewAddress, uint16_t iOldAddress /* = 0 */)
339 {
340 CLockObject lock(&m_mutex);
341 if (iNewAddress > 0)
342 {
343 CStdString strLog;
344 strLog.Format(">> %s (%X): stream path changed from %04x to %04x", GetLogicalAddressName(), m_iLogicalAddress, iOldAddress, iNewAddress);
345 AddLog(CEC_LOG_DEBUG, strLog.c_str());
346
347 m_iStreamPath = iNewAddress;
348
349 if (iNewAddress > 0)
350 {
351 lock.Leave();
352 SetPowerStatus(CEC_POWER_STATUS_ON);
353 }
354 }
355 }
356
357 void CCECBusDevice::SetPowerStatus(const cec_power_status powerStatus)
358 {
359 CLockObject lock(&m_mutex);
360 if (m_powerStatus != powerStatus)
361 {
362 CStdString strLog;
363 strLog.Format(">> %s (%X): power status changed from '%s' to '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(m_powerStatus), ToString(powerStatus));
364 m_processor->AddLog(CEC_LOG_DEBUG, strLog);
365 m_powerStatus = powerStatus;
366 }
367 }
368
369 void CCECBusDevice::SetVendorId(uint64_t iVendorId)
370 {
371 {
372 CLockObject lock(&m_mutex);
373 m_vendor = (cec_vendor_id)iVendorId;
374
375 switch (iVendorId)
376 {
377 case CEC_VENDOR_SAMSUNG:
378 if (m_handler->GetVendorId() != CEC_VENDOR_SAMSUNG)
379 {
380 delete m_handler;
381 m_handler = new CANCommandHandler(this);
382 }
383 break;
384 case CEC_VENDOR_LG:
385 if (m_handler->GetVendorId() != CEC_VENDOR_LG)
386 {
387 delete m_handler;
388 m_handler = new CSLCommandHandler(this);
389 }
390 break;
391 case CEC_VENDOR_PANASONIC:
392 if (m_handler->GetVendorId() != CEC_VENDOR_PANASONIC)
393 {
394 delete m_handler;
395 m_handler = new CVLCommandHandler(this);
396 }
397 break;
398 default:
399 if (m_handler->GetVendorId() != CEC_VENDOR_UNKNOWN)
400 {
401 delete m_handler;
402 m_handler = new CCECCommandHandler(this);
403 }
404 break;
405 }
406 }
407
408 CStdString strLog;
409 strLog.Format("%s (%X): vendor = %s (%06x)", GetLogicalAddressName(), m_iLogicalAddress, GetVendorName(), m_vendor);
410 m_processor->AddLog(CEC_LOG_DEBUG, strLog.c_str());
411 }
412 //@}
413
414 /** @name Transmit methods */
415 //@{
416 bool CCECBusDevice::TransmitActiveSource(void)
417 {
418 CLockObject lock(&m_mutex);
419 if (m_powerStatus != CEC_POWER_STATUS_ON)
420 {
421 CStdString strLog;
422 strLog.Format("<< %s (%X) is not powered on", GetLogicalAddressName(), m_iLogicalAddress);
423 AddLog(CEC_LOG_DEBUG, strLog);
424 }
425 else if (m_bActiveSource)
426 {
427 CStdString strLog;
428 strLog.Format("<< %s (%X) -> broadcast (F): active source (%4x)", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress);
429 AddLog(CEC_LOG_NOTICE, strLog);
430
431 cec_command command;
432 cec_command::Format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE);
433 command.parameters.PushBack((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF));
434 command.parameters.PushBack((uint8_t) (m_iPhysicalAddress & 0xFF));
435
436 lock.Leave();
437 return m_processor->Transmit(command);
438 }
439 else
440 {
441 CStdString strLog;
442 strLog.Format("<< %s (%X) is not the active source", GetLogicalAddressName(), m_iLogicalAddress);
443 AddLog(CEC_LOG_DEBUG, strLog);
444 }
445
446 return false;
447 }
448
449 bool CCECBusDevice::TransmitCECVersion(cec_logical_address dest)
450 {
451 CLockObject lock(&m_mutex);
452 CStdString strLog;
453 strLog.Format("<< %s (%X) -> %s (%X): cec version %s", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_cecVersion));
454 AddLog(CEC_LOG_NOTICE, strLog);
455
456 cec_command command;
457 cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_CEC_VERSION);
458 command.parameters.PushBack((uint8_t)m_cecVersion);
459
460 lock.Leave();
461 return m_processor->Transmit(command);
462 }
463
464 bool CCECBusDevice::TransmitInactiveView(void)
465 {
466 CStdString strLog;
467 strLog.Format("<< %s (%X) -> broadcast (F): inactive view", GetLogicalAddressName(), m_iLogicalAddress);
468 AddLog(CEC_LOG_NOTICE, strLog);
469
470 cec_command command;
471 cec_command::Format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_INACTIVE_SOURCE);
472 command.parameters.PushBack((m_iPhysicalAddress >> 8) & 0xFF);
473 command.parameters.PushBack(m_iPhysicalAddress & 0xFF);
474
475 return m_processor->Transmit(command);
476 }
477
478 bool CCECBusDevice::TransmitMenuState(cec_logical_address dest)
479 {
480 CStdString strLog;
481 strLog.Format("<< %s (%X) -> %s (%X): menu state '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_menuState));
482 AddLog(CEC_LOG_NOTICE, strLog);
483
484 cec_command command;
485 cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_MENU_STATUS);
486 command.parameters.PushBack((uint8_t)m_menuState);
487
488 return m_processor->Transmit(command);
489 }
490
491 bool CCECBusDevice::TransmitOSDName(cec_logical_address dest)
492 {
493 CLockObject lock(&m_mutex);
494 CStdString strLog;
495 strLog.Format("<< %s (%X) -> %s (%X): OSD name '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, m_strDeviceName.c_str());
496 AddLog(CEC_LOG_NOTICE, strLog.c_str());
497
498 cec_command command;
499 cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_SET_OSD_NAME);
500 for (unsigned int iPtr = 0; iPtr < m_strDeviceName.length(); iPtr++)
501 command.parameters.PushBack(m_strDeviceName.at(iPtr));
502
503 lock.Leave();
504 return m_processor->Transmit(command);
505 }
506
507 bool CCECBusDevice::TransmitOSDString(cec_logical_address dest, cec_display_control duration, const char *strMessage)
508 {
509 CLockObject lock(&m_mutex);
510 CStdString strLog;
511 strLog.Format("<< %s (%X) -> %s (%X): display OSD message '%s'", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, strMessage);
512 AddLog(CEC_LOG_NOTICE, strLog.c_str());
513
514 cec_command command;
515 cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_SET_OSD_STRING);
516 command.parameters.PushBack((uint8_t)duration);
517
518 unsigned int iLen = strlen(strMessage);
519 if (iLen > 13) iLen = 13;
520
521 for (unsigned int iPtr = 0; iPtr < iLen; iPtr++)
522 command.parameters.PushBack(strMessage[iPtr]);
523
524 lock.Leave();
525 return m_processor->Transmit(command);
526 }
527
528 bool CCECBusDevice::TransmitPhysicalAddress(void)
529 {
530 CLockObject lock(&m_mutex);
531 CStdString strLog;
532 strLog.Format("<< %s (%X) -> broadcast (F): physical adddress %4x", GetLogicalAddressName(), m_iLogicalAddress, m_iPhysicalAddress);
533 AddLog(CEC_LOG_NOTICE, strLog.c_str());
534
535 cec_command command;
536 cec_command::Format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS);
537 command.parameters.PushBack((uint8_t) ((m_iPhysicalAddress >> 8) & 0xFF));
538 command.parameters.PushBack((uint8_t) (m_iPhysicalAddress & 0xFF));
539 command.parameters.PushBack((uint8_t) (m_type));
540
541 lock.Leave();
542 return m_processor->Transmit(command);
543 }
544
545 bool CCECBusDevice::TransmitPoll(cec_logical_address dest)
546 {
547 bool bReturn(false);
548 if (dest == CECDEVICE_UNKNOWN)
549 dest = m_iLogicalAddress;
550
551 CStdString strLog;
552 strLog.Format("<< %s (%X) -> %s (%X): POLL", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest);
553 AddLog(CEC_LOG_NOTICE, strLog.c_str());
554
555 cec_command command;
556 cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_NONE);
557 CLockObject lock(&m_transmitMutex);
558
559 bReturn = m_processor->Transmit(command);
560 AddLog(CEC_LOG_DEBUG, bReturn ? ">> POLL sent" : ">> POLL not sent");
561 return bReturn;
562 }
563
564 bool CCECBusDevice::TransmitPowerState(cec_logical_address dest)
565 {
566 CLockObject lock(&m_mutex);
567 CStdString strLog;
568 strLog.Format("<< %s (%X) -> %s (%X): %s", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_powerStatus));
569 AddLog(CEC_LOG_NOTICE, strLog.c_str());
570
571 cec_command command;
572 cec_command::Format(command, m_iLogicalAddress, dest, CEC_OPCODE_REPORT_POWER_STATUS);
573 command.parameters.PushBack((uint8_t) m_powerStatus);
574
575 lock.Leave();
576 return m_processor->Transmit(command);
577 }
578
579 bool CCECBusDevice::TransmitVendorID(cec_logical_address dest)
580 {
581 CLockObject lock(&m_mutex);
582 if (m_vendor == CEC_VENDOR_UNKNOWN)
583 {
584 CStdString strLog;
585 strLog.Format("<< %s (%X) -> %s (%X): vendor id feature abort", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest);
586 AddLog(CEC_LOG_NOTICE, strLog);
587
588 lock.Leave();
589 m_processor->TransmitAbort(dest, CEC_OPCODE_GIVE_DEVICE_VENDOR_ID);
590 return false;
591 }
592 else
593 {
594 CStdString strLog;
595 strLog.Format("<< %s (%X) -> %s (%X): vendor id %s (%x)", GetLogicalAddressName(), m_iLogicalAddress, ToString(dest), dest, ToString(m_vendor), (uint64_t)m_vendor);
596 AddLog(CEC_LOG_NOTICE, strLog);
597
598 cec_command command;
599 cec_command::Format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_DEVICE_VENDOR_ID);
600
601 command.parameters.PushBack((uint8_t) (((uint64_t)m_vendor >> 16) & 0xFF));
602 command.parameters.PushBack((uint8_t) (((uint64_t)m_vendor >> 8) & 0xFF));
603 command.parameters.PushBack((uint8_t) ((uint64_t)m_vendor & 0xFF));
604
605 lock.Leave();
606 return m_processor->Transmit(command);
607 }
608 }
609 //@}