Commit | Line | Data |
---|---|---|
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 | |
41 | using namespace CEC; | |
42 | using namespace std; | |
43 | ||
2b4d8297 | 44 | CCECProcessor::CCECProcessor(CLibCEC *controller, CAdapterCommunication *serComm, const char *strDeviceName, cec_logical_address iLogicalAddress /* = CECDEVICE_PLAYBACKDEVICE1 */, uint16_t iPhysicalAddress /* = CEC_DEFAULT_PHYSICAL_ADDRESS*/) : |
b9eea66d | 45 | m_iLogicalAddress(CECDEVICE_UNKNOWN), |
2abe74eb LOK |
46 | m_strDeviceName(strDeviceName), |
47 | m_communication(serComm), | |
8b7e5ff6 LOK |
48 | m_controller(controller), |
49 | m_bMonitor(false) | |
abbca718 | 50 | { |
7ea0d558 | 51 | for (int iPtr = 0; iPtr < 16; iPtr++) |
09c10b66 | 52 | m_busDevices[iPtr] = new CCECBusDevice(this, (cec_logical_address) iPtr, iPtr == iLogicalAddress ? iPhysicalAddress : 0); |
abbca718 LOK |
53 | } |
54 | ||
2abe74eb | 55 | CCECProcessor::~CCECProcessor(void) |
abbca718 | 56 | { |
2abe74eb LOK |
57 | StopThread(); |
58 | m_communication = NULL; | |
59 | m_controller = NULL; | |
d1998c7b LOK |
60 | for (unsigned int iPtr = 0; iPtr < 16; iPtr++) |
61 | delete m_busDevices[iPtr]; | |
abbca718 LOK |
62 | } |
63 | ||
2abe74eb | 64 | bool CCECProcessor::Start(void) |
abbca718 | 65 | { |
2abe74eb | 66 | if (!m_communication || !m_communication->IsOpen()) |
13fd6a66 LOK |
67 | { |
68 | m_controller->AddLog(CEC_LOG_ERROR, "connection is closed"); | |
a8f0bd18 | 69 | return false; |
13fd6a66 | 70 | } |
abbca718 | 71 | |
a8f0bd18 | 72 | if (!SetLogicalAddress(m_iLogicalAddress)) |
abbca718 | 73 | { |
2abe74eb | 74 | m_controller->AddLog(CEC_LOG_ERROR, "could not set the logical address"); |
a8f0bd18 | 75 | return false; |
abbca718 LOK |
76 | } |
77 | ||
60fa4578 | 78 | if (CreateThread()) |
a8f0bd18 | 79 | return true; |
a8f0bd18 | 80 | else |
2abe74eb | 81 | m_controller->AddLog(CEC_LOG_ERROR, "could not create a processor thread"); |
abbca718 | 82 | |
a8f0bd18 | 83 | return false; |
abbca718 LOK |
84 | } |
85 | ||
2abe74eb | 86 | void *CCECProcessor::Process(void) |
f99bc831 | 87 | { |
2abe74eb | 88 | m_controller->AddLog(CEC_LOG_DEBUG, "processor thread started"); |
abbca718 | 89 | |
271e7778 LOK |
90 | cec_command command; |
91 | CCECAdapterMessage msg; | |
92 | CCECAdapterMessagePtr msgPtr; | |
9dee1670 | 93 | |
b9eea66d LOK |
94 | m_communication->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress); |
95 | ||
13fd6a66 | 96 | while (!IsStopped()) |
abbca718 | 97 | { |
60fa4578 | 98 | bool bParseFrame(false); |
9dee1670 | 99 | command.clear(); |
76321de4 LOK |
100 | msg.clear(); |
101 | ||
60fa4578 LOK |
102 | { |
103 | CLockObject lock(&m_mutex); | |
271e7778 LOK |
104 | if (m_frameBuffer.Pop(msgPtr)) |
105 | bParseFrame = ParseMessage(msgPtr); | |
106 | else if (m_communication->IsOpen() && m_communication->Read(msg, 50)) | |
107 | { | |
108 | msgPtr = CCECAdapterMessagePtr(new CCECAdapterMessage(msg)); | |
109 | bParseFrame = ParseMessage(msgPtr); | |
110 | } | |
76321de4 | 111 | |
78e8010a | 112 | bParseFrame &= !IsStopped(); |
76321de4 | 113 | if (bParseFrame) |
9dee1670 | 114 | command = m_currentframe; |
60fa4578 LOK |
115 | } |
116 | ||
13fd6a66 | 117 | if (bParseFrame) |
9dee1670 | 118 | ParseCommand(command); |
abbca718 | 119 | |
13fd6a66 LOK |
120 | m_controller->CheckKeypressTimeout(); |
121 | ||
0ab58650 LOK |
122 | for (unsigned int iDevicePtr = 0; iDevicePtr < 16; iDevicePtr++) |
123 | m_busDevices[iDevicePtr]->PollVendorId(); | |
124 | ||
13fd6a66 | 125 | if (!IsStopped()) |
d5bffd3c | 126 | Sleep(5); |
abbca718 LOK |
127 | } |
128 | ||
60fa4578 | 129 | return NULL; |
abbca718 LOK |
130 | } |
131 | ||
2abe74eb | 132 | bool CCECProcessor::SetActiveView(void) |
abbca718 | 133 | { |
60fa4578 | 134 | if (!IsRunning()) |
f99bc831 LOK |
135 | return false; |
136 | ||
0f23c85c | 137 | return m_busDevices[m_iLogicalAddress]->BroadcastActiveView(); |
abbca718 LOK |
138 | } |
139 | ||
2abe74eb | 140 | bool CCECProcessor::SetInactiveView(void) |
abbca718 | 141 | { |
60fa4578 | 142 | if (!IsRunning()) |
f99bc831 LOK |
143 | return false; |
144 | ||
0f23c85c | 145 | return m_busDevices[m_iLogicalAddress]->BroadcastInactiveView(); |
abbca718 LOK |
146 | } |
147 | ||
9dee1670 | 148 | void CCECProcessor::LogOutput(const cec_command &data) |
abbca718 | 149 | { |
1d3ca3de LOK |
150 | CStdString strTx; |
151 | strTx.Format("<< %02x:%02x", ((uint8_t)data.initiator << 4) + (uint8_t)data.destination, (uint8_t)data.opcode); | |
9dee1670 | 152 | |
06a1f7ce | 153 | for (uint8_t iPtr = 0; iPtr < data.parameters.size; iPtr++) |
1d3ca3de LOK |
154 | strTx.AppendFormat(":%02x", data.parameters[iPtr]); |
155 | m_controller->AddLog(CEC_LOG_TRAFFIC, strTx.c_str()); | |
9dee1670 | 156 | } |
2abe74eb | 157 | |
2abe74eb | 158 | bool CCECProcessor::SetLogicalAddress(cec_logical_address iLogicalAddress) |
abbca718 | 159 | { |
06775107 LOK |
160 | if (m_iLogicalAddress != iLogicalAddress) |
161 | { | |
162 | CStdString strLog; | |
163 | strLog.Format("<< setting logical address to %1x", iLogicalAddress); | |
164 | m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str()); | |
165 | ||
166 | m_iLogicalAddress = iLogicalAddress; | |
167 | return m_communication && m_communication->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress); | |
168 | } | |
2abe74eb | 169 | |
06775107 | 170 | return true; |
abbca718 | 171 | } |
825ddb96 | 172 | |
2492216a LOK |
173 | bool CCECProcessor::SetPhysicalAddress(uint16_t iPhysicalAddress) |
174 | { | |
0f23c85c LOK |
175 | m_busDevices[m_iLogicalAddress]->SetPhysicalAddress(iPhysicalAddress); |
176 | return m_busDevices[m_iLogicalAddress]->BroadcastActiveView(); | |
1969b140 LOK |
177 | } |
178 | ||
8b7e5ff6 LOK |
179 | bool CCECProcessor::SwitchMonitoring(bool bEnable) |
180 | { | |
181 | CStdString strLog; | |
182 | strLog.Format("== %s monitoring mode ==", bEnable ? "enabling" : "disabling"); | |
183 | m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str()); | |
184 | ||
185 | m_bMonitor = bEnable; | |
186 | if (bEnable) | |
187 | return m_communication && m_communication->SetAckMask(0); | |
188 | else | |
189 | return m_communication && m_communication->SetAckMask(0x1 << (uint8_t)m_iLogicalAddress); | |
190 | } | |
191 | ||
8d84e2c0 | 192 | bool CCECProcessor::Transmit(const cec_command &data) |
825ddb96 | 193 | { |
7ea0d558 | 194 | bool bReturn(false); |
13929cff LOK |
195 | LogOutput(data); |
196 | ||
5a1e87c8 | 197 | CCECAdapterMessagePtr output(new CCECAdapterMessage(data)); |
13929cff | 198 | |
2abe74eb | 199 | CLockObject lock(&m_mutex); |
eb35e4ca LOK |
200 | { |
201 | CLockObject msgLock(&output->mutex); | |
202 | if (!m_communication || !m_communication->Write(output)) | |
203 | return bReturn; | |
204 | else | |
0e31a62c | 205 | { |
eb35e4ca | 206 | output->condition.Wait(&output->mutex); |
0e31a62c LOK |
207 | if (output->state != ADAPTER_MESSAGE_STATE_SENT) |
208 | { | |
209 | m_controller->AddLog(CEC_LOG_ERROR, "command was not sent"); | |
210 | return bReturn; | |
211 | } | |
212 | } | |
eb35e4ca | 213 | } |
2abe74eb | 214 | |
8d84e2c0 | 215 | if (data.ack_timeout > 0) |
2abe74eb | 216 | { |
050df0f9 | 217 | bool bError(false); |
8d84e2c0 | 218 | if ((bReturn = WaitForAck(&bError, output->size(), data.ack_timeout)) == false) |
7ea0d558 LOK |
219 | m_controller->AddLog(CEC_LOG_ERROR, "did not receive ack"); |
220 | } | |
221 | else | |
222 | { | |
223 | bReturn = true; | |
2abe74eb LOK |
224 | } |
225 | ||
7ea0d558 | 226 | return bReturn; |
825ddb96 | 227 | } |
abbca718 | 228 | |
2abe74eb | 229 | void CCECProcessor::TransmitAbort(cec_logical_address address, cec_opcode opcode, ECecAbortReason reason /* = CEC_ABORT_REASON_UNRECOGNIZED_OPCODE */) |
abbca718 | 230 | { |
9dee1670 LOK |
231 | m_controller->AddLog(CEC_LOG_DEBUG, "<< transmitting abort message"); |
232 | ||
06a1f7ce LOK |
233 | cec_command command; |
234 | cec_command::format(command, m_iLogicalAddress, address, CEC_OPCODE_FEATURE_ABORT); | |
9dee1670 LOK |
235 | command.parameters.push_back((uint8_t)opcode); |
236 | command.parameters.push_back((uint8_t)reason); | |
237 | ||
238 | Transmit(command); | |
abbca718 LOK |
239 | } |
240 | ||
7ea0d558 | 241 | bool CCECProcessor::WaitForAck(bool *bError, uint8_t iLength, uint32_t iTimeout /* = 1000 */) |
abbca718 | 242 | { |
7ea0d558 LOK |
243 | bool bTransmitSucceeded = false; |
244 | uint8_t iPacketsLeft(iLength / 4); | |
050df0f9 | 245 | *bError = false; |
abbca718 LOK |
246 | |
247 | int64_t iNow = GetTimeMs(); | |
25701fa6 | 248 | int64_t iTargetTime = iNow + (uint64_t) iTimeout; |
abbca718 | 249 | |
78e8010a | 250 | while (!bTransmitSucceeded && !*bError && (iTimeout == 0 || iNow < iTargetTime)) |
abbca718 | 251 | { |
220537f2 | 252 | CCECAdapterMessage msg; |
25701fa6 | 253 | |
06a1f7ce | 254 | if (!m_communication->Read(msg, iTimeout > 0 ? (int32_t)(iTargetTime - iNow) : 1000)) |
abbca718 | 255 | { |
abbca718 | 256 | iNow = GetTimeMs(); |
5d38b0b6 LOK |
257 | continue; |
258 | } | |
259 | ||
7ea0d558 LOK |
260 | switch(msg.message()) |
261 | { | |
262 | case MSGCODE_TIMEOUT_ERROR: | |
263 | case MSGCODE_HIGH_ERROR: | |
264 | case MSGCODE_LOW_ERROR: | |
265 | { | |
266 | CStdString logStr; | |
267 | if (msg.message() == MSGCODE_TIMEOUT_ERROR) | |
268 | logStr = "MSGCODE_TIMEOUT"; | |
269 | else if (msg.message() == MSGCODE_HIGH_ERROR) | |
270 | logStr = "MSGCODE_HIGH_ERROR"; | |
271 | else | |
272 | logStr = "MSGCODE_LOW_ERROR"; | |
273 | ||
274 | int iLine = (msg.size() >= 3) ? (msg[1] << 8) | (msg[2]) : 0; | |
275 | uint32_t iTime = (msg.size() >= 7) ? (msg[3] << 24) | (msg[4] << 16) | (msg[5] << 8) | (msg[6]) : 0; | |
276 | logStr.AppendFormat(" line:%i", iLine); | |
277 | logStr.AppendFormat(" time:%u", iTime); | |
278 | m_controller->AddLog(CEC_LOG_WARNING, logStr.c_str()); | |
279 | *bError = true; | |
280 | } | |
281 | break; | |
282 | case MSGCODE_COMMAND_ACCEPTED: | |
283 | m_controller->AddLog(CEC_LOG_DEBUG, "MSGCODE_COMMAND_ACCEPTED"); | |
284 | iPacketsLeft--; | |
285 | break; | |
286 | case MSGCODE_TRANSMIT_SUCCEEDED: | |
287 | m_controller->AddLog(CEC_LOG_DEBUG, "MSGCODE_TRANSMIT_SUCCEEDED"); | |
288 | bTransmitSucceeded = (iPacketsLeft == 0); | |
289 | *bError = !bTransmitSucceeded; | |
290 | break; | |
291 | case MSGCODE_RECEIVE_FAILED: | |
292 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_RECEIVE_FAILED"); | |
293 | *bError = true; | |
294 | break; | |
295 | case MSGCODE_COMMAND_REJECTED: | |
296 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_COMMAND_REJECTED"); | |
297 | *bError = true; | |
298 | break; | |
299 | case MSGCODE_TRANSMIT_FAILED_LINE: | |
300 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_TRANSMIT_FAILED_LINE"); | |
301 | *bError = true; | |
302 | break; | |
303 | case MSGCODE_TRANSMIT_FAILED_ACK: | |
304 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_TRANSMIT_FAILED_ACK"); | |
305 | *bError = true; | |
306 | break; | |
307 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: | |
308 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA"); | |
309 | *bError = true; | |
310 | break; | |
311 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: | |
312 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE"); | |
313 | *bError = true; | |
314 | break; | |
315 | default: | |
271e7778 LOK |
316 | CCECAdapterMessagePtr msgPtr = CCECAdapterMessagePtr(new CCECAdapterMessage(msg)); |
317 | m_frameBuffer.Push(msgPtr); | |
7ea0d558 LOK |
318 | break; |
319 | } | |
320 | ||
5d38b0b6 | 321 | iNow = GetTimeMs(); |
abbca718 LOK |
322 | } |
323 | ||
78e8010a | 324 | return bTransmitSucceeded && !*bError; |
abbca718 LOK |
325 | } |
326 | ||
271e7778 | 327 | bool CCECProcessor::ParseMessage(CCECAdapterMessagePtr msg) |
abbca718 | 328 | { |
7ea0d558 | 329 | bool bEom = false; |
60fa4578 | 330 | |
271e7778 | 331 | if (msg->empty()) |
7ea0d558 | 332 | return bEom; |
abbca718 LOK |
333 | |
334 | CStdString logStr; | |
abbca718 | 335 | |
271e7778 | 336 | switch(msg->message()) |
abbca718 LOK |
337 | { |
338 | case MSGCODE_NOTHING: | |
2abe74eb | 339 | m_controller->AddLog(CEC_LOG_DEBUG, "MSGCODE_NOTHING"); |
abbca718 LOK |
340 | break; |
341 | case MSGCODE_TIMEOUT_ERROR: | |
342 | case MSGCODE_HIGH_ERROR: | |
343 | case MSGCODE_LOW_ERROR: | |
344 | { | |
271e7778 | 345 | if (msg->message() == MSGCODE_TIMEOUT_ERROR) |
abbca718 | 346 | logStr = "MSGCODE_TIMEOUT"; |
271e7778 | 347 | else if (msg->message() == MSGCODE_HIGH_ERROR) |
abbca718 LOK |
348 | logStr = "MSGCODE_HIGH_ERROR"; |
349 | else | |
350 | logStr = "MSGCODE_LOW_ERROR"; | |
351 | ||
271e7778 LOK |
352 | int iLine = (msg->size() >= 3) ? (msg->at(1) << 8) | (msg->at(2)) : 0; |
353 | uint32_t iTime = (msg->size() >= 7) ? (msg->at(3) << 24) | (msg->at(4) << 16) | (msg->at(5) << 8) | (msg->at(6)) : 0; | |
abbca718 LOK |
354 | logStr.AppendFormat(" line:%i", iLine); |
355 | logStr.AppendFormat(" time:%u", iTime); | |
2abe74eb | 356 | m_controller->AddLog(CEC_LOG_WARNING, logStr.c_str()); |
abbca718 LOK |
357 | } |
358 | break; | |
359 | case MSGCODE_FRAME_START: | |
360 | { | |
7ea0d558 LOK |
361 | logStr = "MSGCODE_FRAME_START"; |
362 | m_currentframe.clear(); | |
271e7778 | 363 | if (msg->size() >= 2) |
abbca718 | 364 | { |
271e7778 LOK |
365 | logStr.AppendFormat(" initiator:%u destination:%u ack:%s %s", msg->initiator(), msg->destination(), msg->ack() ? "high" : "low", msg->eom() ? "eom" : ""); |
366 | m_currentframe.initiator = msg->initiator(); | |
367 | m_currentframe.destination = msg->destination(); | |
368 | m_currentframe.ack = msg->ack(); | |
369 | m_currentframe.eom = msg->eom(); | |
abbca718 | 370 | } |
7ea0d558 | 371 | m_controller->AddLog(CEC_LOG_DEBUG, logStr.c_str()); |
abbca718 LOK |
372 | } |
373 | break; | |
374 | case MSGCODE_FRAME_DATA: | |
375 | { | |
7ea0d558 | 376 | logStr = "MSGCODE_FRAME_DATA"; |
271e7778 | 377 | if (msg->size() >= 2) |
78e8010a | 378 | { |
271e7778 | 379 | uint8_t iData = msg->at(1); |
7ea0d558 LOK |
380 | logStr.AppendFormat(" %02x", iData); |
381 | m_currentframe.push_back(iData); | |
271e7778 | 382 | m_currentframe.eom = msg->eom(); |
abbca718 | 383 | } |
7ea0d558 | 384 | m_controller->AddLog(CEC_LOG_DEBUG, logStr.c_str()); |
78e8010a | 385 | |
271e7778 | 386 | bEom = msg->eom(); |
abbca718 | 387 | } |
78e8010a LOK |
388 | break; |
389 | case MSGCODE_COMMAND_ACCEPTED: | |
390 | m_controller->AddLog(CEC_LOG_DEBUG, "MSGCODE_COMMAND_ACCEPTED"); | |
391 | break; | |
392 | case MSGCODE_TRANSMIT_SUCCEEDED: | |
393 | m_controller->AddLog(CEC_LOG_DEBUG, "MSGCODE_TRANSMIT_SUCCEEDED"); | |
78e8010a LOK |
394 | break; |
395 | case MSGCODE_RECEIVE_FAILED: | |
396 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_RECEIVE_FAILED"); | |
78e8010a LOK |
397 | break; |
398 | case MSGCODE_COMMAND_REJECTED: | |
399 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_COMMAND_REJECTED"); | |
78e8010a LOK |
400 | break; |
401 | case MSGCODE_TRANSMIT_FAILED_LINE: | |
402 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_TRANSMIT_FAILED_LINE"); | |
78e8010a LOK |
403 | break; |
404 | case MSGCODE_TRANSMIT_FAILED_ACK: | |
405 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_TRANSMIT_FAILED_ACK"); | |
78e8010a LOK |
406 | break; |
407 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: | |
408 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA"); | |
78e8010a LOK |
409 | break; |
410 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: | |
411 | m_controller->AddLog(CEC_LOG_WARNING, "MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE"); | |
abbca718 LOK |
412 | break; |
413 | default: | |
414 | break; | |
415 | } | |
7ea0d558 LOK |
416 | |
417 | return bEom; | |
abbca718 LOK |
418 | } |
419 | ||
e9de9629 | 420 | void CCECProcessor::ParseCommand(cec_command &command) |
abbca718 | 421 | { |
e9de9629 | 422 | CStdString dataStr; |
1d3ca3de | 423 | dataStr.Format(">> %1x%1x:%02x", command.initiator, command.destination, command.opcode); |
e9de9629 LOK |
424 | for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++) |
425 | dataStr.AppendFormat(":%02x", (unsigned int)command.parameters[iPtr]); | |
1d3ca3de | 426 | m_controller->AddLog(CEC_LOG_TRAFFIC, dataStr.c_str()); |
dc113aca | 427 | |
e9de9629 LOK |
428 | if (!m_bMonitor) |
429 | m_busDevices[(uint8_t)command.initiator]->HandleCommand(command); | |
dc113aca LOK |
430 | } |
431 | ||
0f23c85c LOK |
432 | uint16_t CCECProcessor::GetPhysicalAddress(void) const |
433 | { | |
434 | return m_busDevices[m_iLogicalAddress]->GetPhysicalAddress(); | |
435 | } | |
436 | ||
e9de9629 | 437 | void CCECProcessor::SetCurrentButton(cec_user_control_code iButtonCode) |
dc113aca | 438 | { |
e9de9629 | 439 | m_controller->SetCurrentButton(iButtonCode); |
dc113aca LOK |
440 | } |
441 | ||
e9de9629 | 442 | void CCECProcessor::AddCommand(const cec_command &command) |
dc113aca | 443 | { |
e9de9629 | 444 | m_controller->AddCommand(command); |
dc113aca LOK |
445 | } |
446 | ||
e9de9629 | 447 | void CCECProcessor::AddKey(void) |
dc113aca | 448 | { |
e9de9629 | 449 | m_controller->AddKey(); |
abbca718 | 450 | } |
acec5f48 | 451 | |
e9de9629 | 452 | void CCECProcessor::AddLog(cec_log_level level, const CStdString &strMessage) |
acec5f48 | 453 | { |
e9de9629 | 454 | m_controller->AddLog(level, strMessage); |
acec5f48 | 455 | } |