break break break
[deb_libcec.git] / src / lib / CECProcessor.cpp
CommitLineData
abbca718
LOK
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
2abe74eb 33#include "CECProcessor.h"
abbca718 34
2abe74eb 35#include "AdapterCommunication.h"
eafa9d46 36#include "devices/CECBusDevice.h"
2abe74eb 37#include "LibCEC.h"
abbca718 38#include "util/StdString.h"
b9187cc6 39#include "platform/timeutils.h"
abbca718
LOK
40
41using namespace CEC;
42using namespace std;
43
2b4d8297 44CCECProcessor::CCECProcessor(CLibCEC *controller, CAdapterCommunication *serComm, const char *strDeviceName, cec_logical_address iLogicalAddress /* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS*/) :
f8513317 45 m_bStarted(false),
2abe74eb
LOK
46 m_strDeviceName(strDeviceName),
47 m_communication(serComm),
8b7e5ff6 48 m_controller(controller),
06bfd4d7 49 m_bMonitor(false)
abbca718 50{
f8513317
LOK
51 m_logicalAddresses.clear();
52 m_logicalAddresses.set(iLogicalAddress);
53 m_types.clear();
7ea0d558 54 for (int iPtr = 0; iPtr < 16; iPtr++)
09c10b66 55 m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, iPtr == iLogicalAddress ? iPhysicalAddress : 0);
abbca718
LOK
56}
57
f8513317
LOK
58CCECProcessor::CCECProcessor(CLibCEC *controller, CAdapterCommunication *serComm, const char *strDeviceName, const cec_device_type_list &types) :
59 m_bStarted(false),
60 m_strDeviceName(strDeviceName),
61 m_types(types),
62 m_communication(serComm),
63 m_controller(controller),
64 m_bMonitor(false)
65{
66 m_logicalAddresses.clear();
67 for (int iPtr = 0; iPtr < 16; iPtr++)
68 m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, 0);
69}
70
2abe74eb 71CCECProcessor::~CCECProcessor(void)
abbca718 72{
8b0ee2cc 73 m_startCondition.Broadcast();
2abe74eb
LOK
74 StopThread();
75 m_communication = NULL;
76 m_controller = NULL;
d1998c7b
LOK
77 for (unsigned int iPtr = 0; iPtr < 16; iPtr++)
78 delete m_busDevices[iPtr];
abbca718
LOK
79}
80
2abe74eb 81bool CCECProcessor::Start(void)
abbca718 82{
8b0ee2cc 83 CLockObject lock(&m_mutex);
2abe74eb 84 if (!m_communication || !m_communication->IsOpen())
13fd6a66
LOK
85 {
86 m_controller->AddLog(CEC_LOG_ERROR, "connection is closed");
a8f0bd18 87 return false;
13fd6a66 88 }
abbca718 89
60fa4578 90 if (CreateThread())
8b0ee2cc 91 {
f8513317 92 if (!m_startCondition.Wait(&m_mutex) || !m_bStarted)
8b0ee2cc
LOK
93 {
94 m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread");
95 return false;
96 }
a8f0bd18 97 return true;
8b0ee2cc 98 }
a8f0bd18 99 else
2abe74eb 100 m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread");
abbca718 101
a8f0bd18 102 return false;
abbca718
LOK
103}
104
f8513317
LOK
105bool CCECProcessor::TryLogicalAddress(cec_logical_address address, const char *strLabel)
106{
107 CStdString strLog;
108 strLog.Format("trying logical address '%s'", strLabel);
109 AddLog(CEC_LOG_DEBUG, strLog);
110
111 SetAckMask(0x1 << address);
112 if (!m_busDevices[address]->PollDevice(address))
113 {
f8513317
LOK
114 strLog.Format("using logical address '%s'", strLabel);
115 AddLog(CEC_LOG_NOTICE, strLog);
787a3cb8
LOK
116
117 /* only set our OSD name for the primary device */
118 if (m_logicalAddresses.empty())
119 m_busDevices[address]->m_strDeviceName = m_strDeviceName;
f8513317
LOK
120 m_logicalAddresses.set(address);
121
122 // TODO
123 m_busDevices[address]->SetPhysicalAddress(CEC_DEFAULT_PHYSICAL_ADDRESS);
124
125 return true;
126 }
127
128 strLog.Format("logical address '%s' already taken", strLabel);
129 AddLog(CEC_LOG_DEBUG, strLog);
130 return false;
131}
132
133bool CCECProcessor::FindLogicalAddressRecordingDevice(void)
134{
135 AddLog(CEC_LOG_DEBUG, "detecting logical address for type 'recording device'");
136 return TryLogicalAddress(CECDEVICE_RECORDINGDEVICE1, "recording 1") ||
137 TryLogicalAddress(CECDEVICE_RECORDINGDEVICE2, "recording 2") ||
138 TryLogicalAddress(CECDEVICE_RECORDINGDEVICE3, "recording 3");
139}
140
141bool CCECProcessor::FindLogicalAddressTuner(void)
142{
143 AddLog(CEC_LOG_DEBUG, "detecting logical address for type 'tuner'");
144 return TryLogicalAddress(CECDEVICE_TUNER1, "tuner 1") ||
145 TryLogicalAddress(CECDEVICE_TUNER2, "tuner 2") ||
146 TryLogicalAddress(CECDEVICE_TUNER3, "tuner 3") ||
147 TryLogicalAddress(CECDEVICE_TUNER4, "tuner 4");
148}
149
150bool CCECProcessor::FindLogicalAddressPlaybackDevice(void)
151{
152 AddLog(CEC_LOG_DEBUG, "detecting logical address for type 'playback device'");
153 return TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE1, "playback 1") ||
154 TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE2, "playback 2") ||
155 TryLogicalAddress(CECDEVICE_PLAYBACKDEVICE3, "playback 3");
156}
157
158bool CCECProcessor::FindLogicalAddressAudioSystem(void)
159{
160 AddLog(CEC_LOG_DEBUG, "detecting logical address for type 'audio'");
161 return TryLogicalAddress(CECDEVICE_AUDIOSYSTEM, "audio");
162}
163
164bool CCECProcessor::FindLogicalAddresses(void)
165{
166 bool bReturn(true);
167 m_logicalAddresses.clear();
168 CStdString strLog;
169
170 for (unsigned int iPtr = 0; iPtr < 5; iPtr++)
171 {
172 if (m_types.types[iPtr] == CEC_DEVICE_TYPE_RESERVED)
173 continue;
174
175 strLog.Format("%s - device %d: type %d", __FUNCTION__, iPtr, m_types.types[iPtr]);
176 AddLog(CEC_LOG_DEBUG, strLog);
177
178 if (m_types.types[iPtr] == CEC_DEVICE_TYPE_RECORDING_DEVICE)
179 bReturn &= FindLogicalAddressRecordingDevice();
180 if (m_types.types[iPtr] == CEC_DEVICE_TYPE_TUNER)
181 bReturn &= FindLogicalAddressTuner();
182 if (m_types.types[iPtr] == CEC_DEVICE_TYPE_PLAYBACK_DEVICE)
183 bReturn &= FindLogicalAddressPlaybackDevice();
184 if (m_types.types[iPtr] == CEC_DEVICE_TYPE_AUDIO_SYSTEM)
185 bReturn &= FindLogicalAddressAudioSystem();
186 }
187
188 return bReturn;
189}
190
2abe74eb 191void *CCECProcessor::Process(void)
f99bc831 192{
e0407d3d
LOK
193 cec_command command;
194 CCECAdapterMessage msg;
195
8b0ee2cc 196 {
f8513317
LOK
197 if (m_logicalAddresses.empty() && !FindLogicalAddresses())
198 {
199 CLockObject lock(&m_mutex);
200 m_controller->AddLog(CEC_LOG_ERROR, "could not detect our logical addressed");
201 m_startCondition.Signal();
202 return NULL;
203 }
204
205 SetAckMask(m_logicalAddresses.ackmask());
206
207 {
208 CLockObject lock(&m_mutex);
209 m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started");
210 m_bStarted = true;
211 m_startCondition.Signal();
212 }
8b0ee2cc 213 }
abbca718 214
13fd6a66 215 while (!IsStopped())
abbca718 216 {
60fa4578 217 bool bParseFrame(false);
9dee1670 218 command.clear();
76321de4
LOK
219 msg.clear();
220
60fa4578
LOK
221 {
222 CLockObject lock(&m_mutex);
88c43521 223 if (m_communication->IsOpen() && m_communication->Read(msg, 50))
b5f34cf9
LOK
224 {
225 m_controller->AddLog(msg.is_error() ? CEC_LOG_WARNING : CEC_LOG_DEBUG, msg.ToString());
88c43521 226 bParseFrame = ParseMessage(msg) && !IsStopped();
b5f34cf9 227 }
76321de4
LOK
228
229 if (bParseFrame)
9dee1670 230 command = m_currentframe;
60fa4578
LOK
231 }
232
13fd6a66 233 if (bParseFrame)
9dee1670 234 ParseCommand(command);
abbca718 235
b5f34cf9
LOK
236 Sleep(5);
237
13fd6a66
LOK
238 m_controller->CheckKeypressTimeout();
239
0ab58650
LOK
240 for (unsigned int iDevicePtr = 0; iDevicePtr < 16; iDevicePtr++)
241 m_busDevices[iDevicePtr]->PollVendorId();
242
b5f34cf9 243 Sleep(5);
abbca718
LOK
244 }
245
60fa4578 246 return NULL;
abbca718
LOK
247}
248
2abe74eb 249bool CCECProcessor::SetActiveView(void)
abbca718 250{
60fa4578 251 if (!IsRunning())
f99bc831
LOK
252 return false;
253
f8513317
LOK
254 if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary])
255 return m_busDevices[m_logicalAddresses.primary]->BroadcastActiveView();
cc60ab1c 256 return false;
abbca718
LOK
257}
258
2abe74eb 259bool CCECProcessor::SetInactiveView(void)
abbca718 260{
60fa4578 261 if (!IsRunning())
f99bc831
LOK
262 return false;
263
f8513317
LOK
264 if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary])
265 return m_busDevices[m_logicalAddresses.primary]->BroadcastInactiveView();
cc60ab1c 266 return false;
abbca718
LOK
267}
268
9dee1670 269void CCECProcessor::LogOutput(const cec_command &data)
abbca718 270{
1d3ca3de 271 CStdString strTx;
57f45e6c
LOK
272 strTx.Format("<< %02x", ((uint8_t)data.initiator << 4) + (uint8_t)data.destination);
273 if (data.opcode_set)
274 strTx.AppendFormat(":%02x", (uint8_t)data.opcode);
9dee1670 275
06a1f7ce 276 for (uint8_t iPtr = 0; iPtr < data.parameters.size; iPtr++)
1d3ca3de
LOK
277 strTx.AppendFormat(":%02x", data.parameters[iPtr]);
278 m_controller->AddLog(CEC_LOG_TRAFFIC, strTx.c_str());
9dee1670 279}
2abe74eb 280
06bfd4d7 281bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress)
abbca718 282{
f8513317 283 if (m_logicalAddresses.primary != iLogicalAddress)
06775107
LOK
284 {
285 CStdString strLog;
f8513317 286 strLog.Format("<< setting primary logical address to %1x", iLogicalAddress);
06775107 287 m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str());
f8513317
LOK
288 m_logicalAddresses.primary = iLogicalAddress;
289 m_logicalAddresses.set(iLogicalAddress);
290 return SetAckMask(m_logicalAddresses.ackmask());
06775107 291 }
2abe74eb 292
06bfd4d7 293 return true;
abbca718 294}
825ddb96 295
2492216a
LOK
296bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress)
297{
f8513317 298 if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary])
cc60ab1c 299 {
f8513317
LOK
300 m_busDevices[m_logicalAddresses.primary]->SetPhysicalAddress(iPhysicalAddress);
301 return m_busDevices[m_logicalAddresses.primary]->BroadcastActiveView();
cc60ab1c
LOK
302 }
303 return false;
1969b140
LOK
304}
305
8b7e5ff6
LOK
306bool CCECProcessor::SwitchMonitoring(bool bEnable)
307{
308 CStdString strLog;
309 strLog.Format("== %s monitoring mode ==", bEnable ? "enabling" : "disabling");
310 m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str());
311
312 m_bMonitor = bEnable;
313 if (bEnable)
06bfd4d7 314 return SetAckMask(0);
8b7e5ff6 315 else
f8513317 316 return SetAckMask(m_logicalAddresses.ackmask());
8b7e5ff6
LOK
317}
318
57f45e6c
LOK
319bool CCECProcessor::PollDevice(cec_logical_address iAddress)
320{
321 if (iAddress != CECDEVICE_UNKNOWN && m_busDevices[iAddress])
322 return m_busDevices[iAddress]->PollDevice();
323 return false;
324}
325
6a1c0009
LOK
326cec_version CCECProcessor::GetDeviceCecVersion(cec_logical_address iAddress)
327{
328 return m_busDevices[iAddress]->GetCecVersion();
329}
330
a3269a0a
LOK
331bool CCECProcessor::GetDeviceMenuLanguage(cec_logical_address iAddress, cec_menu_language *language)
332{
cc60ab1c
LOK
333 if (m_busDevices[iAddress])
334 {
335 *language = m_busDevices[iAddress]->GetMenuLanguage();
5744fbba 336 return (strcmp(language->language, "???") != 0);
cc60ab1c
LOK
337 }
338 return false;
a3269a0a
LOK
339}
340
44c74256
LOK
341uint64_t CCECProcessor::GetDeviceVendorId(cec_logical_address iAddress)
342{
cc60ab1c
LOK
343 if (m_busDevices[iAddress])
344 return m_busDevices[iAddress]->GetVendorId();
345 return false;
44c74256
LOK
346}
347
e55f3f70
LOK
348cec_power_status CCECProcessor::GetDevicePowerStatus(cec_logical_address iAddress)
349{
cc60ab1c
LOK
350 if (m_busDevices[iAddress])
351 return m_busDevices[iAddress]->GetPowerStatus();
352 return CEC_POWER_STATUS_UNKNOWN;
e55f3f70
LOK
353}
354
8d84e2c0 355bool CCECProcessor::Transmit(const cec_command &data)
825ddb96 356{
28352a04 357 bool bReturn(false);
13929cff
LOK
358 LogOutput(data);
359
28352a04
LOK
360 CCECAdapterMessage *output = new CCECAdapterMessage(data);
361 bReturn = Transmit(output);
362 delete output;
363
364 return bReturn;
06bfd4d7 365}
13929cff 366
28352a04 367bool CCECProcessor::Transmit(CCECAdapterMessage *output)
06bfd4d7
LOK
368{
369 bool bReturn(false);
2abe74eb 370 CLockObject lock(&m_mutex);
eb35e4ca
LOK
371 {
372 CLockObject msgLock(&output->mutex);
373 if (!m_communication || !m_communication->Write(output))
374 return bReturn;
375 else
0e31a62c 376 {
3a0ca6e1 377 output->condition.Wait(&output->mutex);
0e31a62c
LOK
378 if (output->state != ADAPTER_MESSAGE_STATE_SENT)
379 {
380 m_controller->AddLog(CEC_LOG_ERROR, "command was not sent");
381 return bReturn;
382 }
383 }
2abe74eb 384
06bfd4d7 385 if (output->transmit_timeout > 0)
cd505625 386 {
06bfd4d7 387 if ((bReturn = WaitForTransmitSucceeded(output->size(), output->transmit_timeout)) == false)
cd505625
LOK
388 m_controller->AddLog(CEC_LOG_ERROR, "did not receive ack");
389 }
390 else
cd505625 391 bReturn = true;
2abe74eb
LOK
392 }
393
7ea0d558 394 return bReturn;
825ddb96 395}
abbca718 396
2abe74eb 397void CCECProcessor::TransmitAbort(cec_logical_address address, cec_opcode opcode, ECecAbortReason reason /* = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE */)
abbca718 398{
9dee1670
LOK
399 m_controller->AddLog(CEC_LOG_DEBUG, "<< transmitting abort message");
400
06a1f7ce 401 cec_command command;
f8513317
LOK
402 // TODO
403 cec_command::format(command, m_logicalAddresses.primary, address, CEC_OPCODE_FEATURE_ABORT);
9dee1670
LOK
404 command.parameters.push_back((uint8_t)opcode);
405 command.parameters.push_back((uint8_t)reason);
406
407 Transmit(command);
abbca718
LOK
408}
409
1f0e9e0f 410bool CCECProcessor::WaitForTransmitSucceeded(uint8_t iLength, uint32_t iTimeout /* = 1000 */)
abbca718 411{
1f0e9e0f
LOK
412 bool bError(false);
413 bool bTransmitSucceeded(false);
7ea0d558 414 uint8_t iPacketsLeft(iLength / 4);
abbca718
LOK
415
416 int64_t iNow = GetTimeMs();
25701fa6 417 int64_t iTargetTime = iNow + (uint64_t) iTimeout;
abbca718 418
1f0e9e0f 419 while (!bTransmitSucceeded && !bError && (iTimeout == 0 || iNow < iTargetTime))
abbca718 420 {
220537f2 421 CCECAdapterMessage msg;
25701fa6 422
06a1f7ce 423 if (!m_communication->Read(msg, iTimeout > 0 ? (int32_t)(iTargetTime - iNow) : 1000))
abbca718 424 {
abbca718 425 iNow = GetTimeMs();
5d38b0b6
LOK
426 continue;
427 }
428
edab6137 429 if ((bError = msg.is_error()) == false)
7ea0d558 430 {
0544ff56
LOK
431 m_controller->AddLog(bError ? CEC_LOG_WARNING : CEC_LOG_DEBUG, msg.ToString());
432
edab6137
LOK
433 switch(msg.message())
434 {
435 case MSGCODE_COMMAND_ACCEPTED:
436 if (iPacketsLeft > 0)
437 iPacketsLeft--;
438 break;
439 case MSGCODE_TRANSMIT_SUCCEEDED:
440 bTransmitSucceeded = (iPacketsLeft == 0);
441 bError = !bTransmitSucceeded;
442 break;
443 default:
444 ParseMessage(msg);
445 }
7ea0d558 446
edab6137
LOK
447 iNow = GetTimeMs();
448 }
abbca718
LOK
449 }
450
1f0e9e0f 451 return bTransmitSucceeded && !bError;
abbca718
LOK
452}
453
0e7b6c54 454bool CCECProcessor::ParseMessage(const CCECAdapterMessage &msg)
abbca718 455{
7ea0d558 456 bool bEom = false;
60fa4578 457
0e7b6c54 458 if (msg.empty())
7ea0d558 459 return bEom;
abbca718 460
0e7b6c54 461 switch(msg.message())
abbca718 462 {
abbca718
LOK
463 case MSGCODE_FRAME_START:
464 {
7ea0d558 465 m_currentframe.clear();
0e7b6c54 466 if (msg.size() >= 2)
abbca718 467 {
0e7b6c54
LOK
468 m_currentframe.initiator = msg.initiator();
469 m_currentframe.destination = msg.destination();
470 m_currentframe.ack = msg.ack();
471 m_currentframe.eom = msg.eom();
abbca718 472 }
abbca718
LOK
473 }
474 break;
475 case MSGCODE_FRAME_DATA:
476 {
0e7b6c54 477 if (msg.size() >= 2)
78e8010a 478 {
e41b06f9 479 m_currentframe.push_back(msg[1]);
0e7b6c54 480 m_currentframe.eom = msg.eom();
abbca718 481 }
0e7b6c54 482 bEom = msg.eom();
abbca718 483 }
78e8010a 484 break;
abbca718
LOK
485 default:
486 break;
487 }
7ea0d558
LOK
488
489 return bEom;
abbca718
LOK
490}
491
e9de9629 492void CCECProcessor::ParseCommand(cec_command &command)
abbca718 493{
e9de9629 494 CStdString dataStr;
1d3ca3de 495 dataStr.Format(">> %1x%1x:%02x", command.initiator, command.destination, command.opcode);
e9de9629
LOK
496 for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++)
497 dataStr.AppendFormat(":%02x", (unsigned int)command.parameters[iPtr]);
1d3ca3de 498 m_controller->AddLog(CEC_LOG_TRAFFIC, dataStr.c_str());
dc113aca 499
e9de9629
LOK
500 if (!m_bMonitor)
501 m_busDevices[(uint8_t)command.initiator]->HandleCommand(command);
dc113aca
LOK
502}
503
0f23c85c
LOK
504uint16_t CCECProcessor::GetPhysicalAddress(void) const
505{
f8513317
LOK
506 if (!m_logicalAddresses.empty() && m_busDevices[m_logicalAddresses.primary])
507 return m_busDevices[m_logicalAddresses.primary]->GetPhysicalAddress();
cc60ab1c 508 return false;
0f23c85c
LOK
509}
510
e9de9629 511void CCECProcessor::SetCurrentButton(cec_user_control_code iButtonCode)
dc113aca 512{
e9de9629 513 m_controller->SetCurrentButton(iButtonCode);
dc113aca
LOK
514}
515
e9de9629 516void CCECProcessor::AddCommand(const cec_command &command)
dc113aca 517{
0544ff56 518 m_controller->AddCommand(command);
dc113aca
LOK
519}
520
95ba7a09
LOK
521void CCECProcessor::AddKey(cec_keypress &key)
522{
523 m_controller->AddKey(key);
524}
525
e9de9629 526void CCECProcessor::AddKey(void)
dc113aca 527{
e9de9629 528 m_controller->AddKey();
abbca718 529}
acec5f48 530
e9de9629 531void CCECProcessor::AddLog(cec_log_level level, const CStdString &strMessage)
acec5f48 532{
e9de9629 533 m_controller->AddLog(level, strMessage);
acec5f48 534}
06bfd4d7
LOK
535
536bool CCECProcessor::SetAckMask(uint16_t iMask)
537{
28352a04 538 bool bReturn(false);
06bfd4d7
LOK
539 CStdString strLog;
540 strLog.Format("setting ackmask to %2x", iMask);
541 m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str());
542
28352a04 543 CCECAdapterMessage *output = new CCECAdapterMessage;
06bfd4d7
LOK
544
545 output->push_back(MSGSTART);
546 output->push_escaped(MSGCODE_SET_ACK_MASK);
547 output->push_escaped(iMask >> 8);
548 output->push_escaped((uint8_t)iMask);
549 output->push_back(MSGEND);
550
28352a04 551 if ((bReturn = Transmit(output)) == false)
06bfd4d7 552 m_controller->AddLog(CEC_LOG_ERROR, "could not set the ackmask");
06bfd4d7 553
28352a04
LOK
554 delete output;
555
556 return bReturn;
06bfd4d7 557}