Commit | Line | Data |
---|---|---|
a8f0bd18 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 | ||
828682d3 | 33 | #include "AdapterCommunication.h" |
2abe74eb LOK |
34 | |
35 | #include "LibCEC.h" | |
b9187cc6 | 36 | #include "platform/serialport.h" |
a8f0bd18 | 37 | #include "util/StdString.h" |
50aa01e6 | 38 | #include "platform/timeutils.h" |
a8f0bd18 LOK |
39 | |
40 | using namespace std; | |
41 | using namespace CEC; | |
42 | ||
ad24cbaf LOK |
43 | CCECAdapterMessage::CCECAdapterMessage(const cec_command &command) |
44 | { | |
45 | clear(); | |
46 | ||
47 | //set ack polarity to high when transmitting to the broadcast address | |
48 | //set ack polarity low when transmitting to any other address | |
49 | push_back(MSGSTART); | |
50 | push_escaped(MSGCODE_TRANSMIT_ACK_POLARITY); | |
51 | if (command.destination == CECDEVICE_BROADCAST) | |
52 | push_escaped(CEC_TRUE); | |
53 | else | |
54 | push_escaped(CEC_FALSE); | |
55 | push_back(MSGEND); | |
56 | ||
57 | // add source and destination | |
58 | push_back(MSGSTART); | |
59 | push_escaped(MSGCODE_TRANSMIT); | |
60 | push_back(((uint8_t)command.initiator << 4) + (uint8_t)command.destination); | |
61 | push_back(MSGEND); | |
62 | ||
63 | // add opcode | |
64 | push_back(MSGSTART); | |
65 | push_escaped(command.parameters.empty() ? (uint8_t)MSGCODE_TRANSMIT_EOM : (uint8_t)MSGCODE_TRANSMIT); | |
66 | push_back((uint8_t) command.opcode); | |
67 | push_back(MSGEND); | |
68 | ||
69 | // add parameters | |
70 | for (int8_t iPtr = 0; iPtr < command.parameters.size; iPtr++) | |
71 | { | |
72 | push_back(MSGSTART); | |
73 | ||
74 | if (iPtr == command.parameters.size - 1) | |
75 | push_escaped( MSGCODE_TRANSMIT_EOM); | |
76 | else | |
77 | push_escaped(MSGCODE_TRANSMIT); | |
78 | ||
79 | push_escaped(command.parameters[iPtr]); | |
80 | ||
81 | push_back(MSGEND); | |
82 | } | |
83 | } | |
84 | ||
85 | CCECAdapterMessage &CCECAdapterMessage::operator =(const CCECAdapterMessage &msg) | |
86 | { | |
87 | packet = msg.packet; | |
88c43521 | 88 | state = msg.state; |
ad24cbaf LOK |
89 | return *this; |
90 | } | |
91 | ||
b8c91906 | 92 | CStdString CCECAdapterMessage::MessageCodeAsString(void) const |
e41b06f9 LOK |
93 | { |
94 | CStdString strMsg; | |
95 | switch (message()) | |
96 | { | |
97 | case MSGCODE_NOTHING: | |
98 | strMsg = "NOTHING"; | |
99 | break; | |
100 | case MSGCODE_PING: | |
101 | strMsg = "PING"; | |
102 | break; | |
103 | case MSGCODE_TIMEOUT_ERROR: | |
b8c91906 LOK |
104 | strMsg = "TIMEOUT"; |
105 | break; | |
e41b06f9 | 106 | case MSGCODE_HIGH_ERROR: |
b8c91906 LOK |
107 | strMsg = "HIGH_ERROR"; |
108 | break; | |
e41b06f9 | 109 | case MSGCODE_LOW_ERROR: |
b8c91906 | 110 | strMsg = "LOW_ERROR"; |
e41b06f9 LOK |
111 | break; |
112 | case MSGCODE_FRAME_START: | |
113 | strMsg = "FRAME_START"; | |
e41b06f9 LOK |
114 | break; |
115 | case MSGCODE_FRAME_DATA: | |
116 | strMsg = "FRAME_DATA"; | |
e41b06f9 LOK |
117 | break; |
118 | case MSGCODE_RECEIVE_FAILED: | |
119 | strMsg = "RECEIVE_FAILED"; | |
120 | break; | |
121 | case MSGCODE_COMMAND_ACCEPTED: | |
122 | strMsg = "COMMAND_ACCEPTED"; | |
123 | break; | |
124 | case MSGCODE_COMMAND_REJECTED: | |
125 | strMsg = "COMMAND_REJECTED"; | |
126 | break; | |
127 | case MSGCODE_SET_ACK_MASK: | |
128 | strMsg = "SET_ACK_MASK"; | |
129 | break; | |
130 | case MSGCODE_TRANSMIT: | |
131 | strMsg = "TRANSMIT"; | |
132 | break; | |
133 | case MSGCODE_TRANSMIT_EOM: | |
134 | strMsg = "TRANSMIT_EOM"; | |
135 | break; | |
136 | case MSGCODE_TRANSMIT_IDLETIME: | |
137 | strMsg = "TRANSMIT_IDLETIME"; | |
138 | break; | |
139 | case MSGCODE_TRANSMIT_ACK_POLARITY: | |
140 | strMsg = "TRANSMIT_ACK_POLARITY"; | |
141 | break; | |
142 | case MSGCODE_TRANSMIT_LINE_TIMEOUT: | |
143 | strMsg = "TRANSMIT_LINE_TIMEOUT"; | |
144 | break; | |
145 | case MSGCODE_TRANSMIT_SUCCEEDED: | |
146 | strMsg = "TRANSMIT_SUCCEEDED"; | |
147 | break; | |
148 | case MSGCODE_TRANSMIT_FAILED_LINE: | |
149 | strMsg = "TRANSMIT_FAILED_LINE"; | |
150 | break; | |
151 | case MSGCODE_TRANSMIT_FAILED_ACK: | |
152 | strMsg = "TRANSMIT_FAILED_ACK"; | |
153 | break; | |
154 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA: | |
155 | strMsg = "TRANSMIT_FAILED_TIMEOUT_DATA"; | |
156 | break; | |
157 | case MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE: | |
158 | strMsg = "TRANSMIT_FAILED_TIMEOUT_LINE"; | |
159 | break; | |
160 | case MSGCODE_FIRMWARE_VERSION: | |
161 | strMsg = "FIRMWARE_VERSION"; | |
162 | break; | |
163 | case MSGCODE_START_BOOTLOADER: | |
164 | strMsg = "START_BOOTLOADER"; | |
165 | break; | |
166 | case MSGCODE_FRAME_EOM: | |
167 | strMsg = "FRAME_EOM"; | |
168 | break; | |
169 | case MSGCODE_FRAME_ACK: | |
170 | strMsg = "FRAME_ACK"; | |
171 | break; | |
172 | } | |
173 | ||
174 | return strMsg; | |
175 | } | |
176 | ||
b8c91906 LOK |
177 | CStdString CCECAdapterMessage::ToString(void) const |
178 | { | |
179 | CStdString strMsg; | |
180 | strMsg = MessageCodeAsString(); | |
181 | ||
182 | switch (message()) | |
183 | { | |
184 | case MSGCODE_TIMEOUT_ERROR: | |
185 | case MSGCODE_HIGH_ERROR: | |
186 | case MSGCODE_LOW_ERROR: | |
187 | { | |
188 | int iLine = (size() >= 3) ? (at(1) << 8) | at(2) : 0; | |
189 | uint32_t iTime = (size() >= 7) ? (at(3) << 24) | (at(4) << 16) | (at(5) << 8) | at(6) : 0; | |
190 | strMsg.AppendFormat(" line:%i", iLine); | |
191 | strMsg.AppendFormat(" time:%u", iTime); | |
192 | } | |
193 | break; | |
194 | case MSGCODE_FRAME_START: | |
195 | if (size() >= 2) | |
196 | strMsg.AppendFormat(" initiator:%1x destination:%1x ack:%s %s", initiator(), destination(), ack() ? "high" : "low", eom() ? "eom" : ""); | |
197 | break; | |
198 | case MSGCODE_FRAME_DATA: | |
199 | if (size() >= 2) | |
200 | strMsg.AppendFormat(" %02x %s", at(1), eom() ? "eom" : ""); | |
201 | break; | |
202 | default: | |
203 | break; | |
204 | } | |
205 | ||
206 | return strMsg; | |
207 | } | |
208 | ||
e41b06f9 LOK |
209 | bool CCECAdapterMessage::is_error(void) const |
210 | { | |
211 | cec_adapter_messagecode code = message(); | |
212 | return (code == MSGCODE_TIMEOUT_ERROR || | |
213 | code == MSGCODE_HIGH_ERROR || | |
214 | code == MSGCODE_LOW_ERROR || | |
215 | code == MSGCODE_RECEIVE_FAILED || | |
216 | code == MSGCODE_COMMAND_REJECTED || | |
217 | code == MSGCODE_TRANSMIT_LINE_TIMEOUT || | |
218 | code == MSGCODE_TRANSMIT_FAILED_LINE || | |
219 | code == MSGCODE_TRANSMIT_FAILED_ACK || | |
220 | code == MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA || | |
221 | code == MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE); | |
222 | } | |
223 | ||
ad24cbaf LOK |
224 | void CCECAdapterMessage::push_escaped(int16_t byte) |
225 | { | |
226 | if (byte >= MSGESC && byte != MSGSTART) | |
227 | { | |
228 | push_back(MSGESC); | |
56701628 | 229 | push_back((uint8_t) (byte - ESCOFFSET)); |
ad24cbaf LOK |
230 | } |
231 | else | |
56701628 | 232 | push_back((uint8_t) byte); |
ad24cbaf LOK |
233 | } |
234 | ||
2abe74eb | 235 | CAdapterCommunication::CAdapterCommunication(CLibCEC *controller) : |
12027dbe | 236 | m_port(NULL), |
50aa01e6 | 237 | m_controller(controller) |
a8f0bd18 LOK |
238 | { |
239 | m_port = new CSerialPort; | |
240 | } | |
241 | ||
828682d3 | 242 | CAdapterCommunication::~CAdapterCommunication(void) |
a8f0bd18 | 243 | { |
12027dbe LOK |
244 | Close(); |
245 | ||
246 | if (m_port) | |
247 | { | |
248 | delete m_port; | |
249 | m_port = NULL; | |
250 | } | |
a8f0bd18 LOK |
251 | } |
252 | ||
25701fa6 | 253 | bool CAdapterCommunication::Open(const char *strPort, uint16_t iBaudRate /* = 38400 */, uint32_t iTimeoutMs /* = 10000 */) |
a8f0bd18 | 254 | { |
f077e8ed | 255 | CLockObject lock(&m_mutex); |
13fd6a66 LOK |
256 | if (!m_port) |
257 | { | |
258 | m_controller->AddLog(CEC_LOG_ERROR, "port is NULL"); | |
a8f0bd18 | 259 | return false; |
13fd6a66 LOK |
260 | } |
261 | ||
262 | if (IsOpen()) | |
263 | { | |
264 | m_controller->AddLog(CEC_LOG_ERROR, "port is already open"); | |
265 | } | |
a8f0bd18 LOK |
266 | |
267 | if (!m_port->Open(strPort, iBaudRate)) | |
268 | { | |
269 | CStdString strError; | |
270 | strError.Format("error opening serial port '%s': %s", strPort, m_port->GetError().c_str()); | |
2abe74eb | 271 | m_controller->AddLog(CEC_LOG_ERROR, strError); |
a8f0bd18 LOK |
272 | return false; |
273 | } | |
274 | ||
2abe74eb | 275 | m_controller->AddLog(CEC_LOG_DEBUG, "connection opened"); |
a8f0bd18 LOK |
276 | |
277 | //clear any input bytes | |
278 | uint8_t buff[1024]; | |
59c9774c | 279 | m_port->Read(buff, sizeof(buff), 500); |
a8f0bd18 | 280 | |
828682d3 | 281 | if (CreateThread()) |
a8f0bd18 | 282 | { |
b9eea66d LOK |
283 | m_startCondition.Wait(&m_mutex); |
284 | m_controller->AddLog(CEC_LOG_DEBUG, "communication thread started"); | |
a8f0bd18 LOK |
285 | return true; |
286 | } | |
287 | else | |
288 | { | |
13fd6a66 | 289 | m_controller->AddLog(CEC_LOG_DEBUG, "could not create a communication thread"); |
a8f0bd18 LOK |
290 | } |
291 | ||
292 | return false; | |
293 | } | |
294 | ||
828682d3 | 295 | void CAdapterCommunication::Close(void) |
a8f0bd18 | 296 | { |
f077e8ed | 297 | CLockObject lock(&m_mutex); |
b9eea66d | 298 | m_startCondition.Broadcast(); |
d5bffd3c | 299 | m_rcvCondition.Broadcast(); |
b9eea66d | 300 | StopThread(); |
a8f0bd18 LOK |
301 | } |
302 | ||
828682d3 | 303 | void *CAdapterCommunication::Process(void) |
a8f0bd18 | 304 | { |
b9eea66d LOK |
305 | { |
306 | CLockObject lock(&m_mutex); | |
307 | m_startCondition.Signal(); | |
308 | } | |
12027dbe | 309 | |
13fd6a66 | 310 | while (!IsStopped()) |
a8f0bd18 | 311 | { |
b9abf920 | 312 | ReadFromDevice(500); |
3c53ac93 LOK |
313 | WriteNextCommand(); |
314 | Sleep(5); | |
a8f0bd18 LOK |
315 | } |
316 | ||
a8f0bd18 LOK |
317 | return NULL; |
318 | } | |
319 | ||
25701fa6 | 320 | bool CAdapterCommunication::ReadFromDevice(uint32_t iTimeout) |
a8f0bd18 | 321 | { |
25701fa6 | 322 | int32_t iBytesRead; |
13fd6a66 LOK |
323 | uint8_t buff[1024]; |
324 | if (!m_port) | |
325 | return false; | |
b6c82769 | 326 | |
13fd6a66 LOK |
327 | iBytesRead = m_port->Read(buff, sizeof(buff), iTimeout); |
328 | if (iBytesRead < 0 || iBytesRead > 256) | |
a8f0bd18 | 329 | { |
13fd6a66 LOK |
330 | CStdString strError; |
331 | strError.Format("error reading from serial port: %s", m_port->GetError().c_str()); | |
332 | m_controller->AddLog(CEC_LOG_ERROR, strError); | |
13fd6a66 | 333 | return false; |
a8f0bd18 | 334 | } |
13fd6a66 LOK |
335 | else if (iBytesRead > 0) |
336 | AddData(buff, (uint8_t) iBytesRead); | |
25701fa6 | 337 | |
13fd6a66 | 338 | return iBytesRead > 0; |
a8f0bd18 LOK |
339 | } |
340 | ||
8bca69de | 341 | void CAdapterCommunication::AddData(uint8_t *data, uint8_t iLen) |
a8f0bd18 | 342 | { |
f077e8ed | 343 | CLockObject lock(&m_mutex); |
50aa01e6 LOK |
344 | for (unsigned int iPtr = 0; iPtr < iLen; iPtr++) |
345 | m_inBuffer.Push(data[iPtr]); | |
d5bffd3c LOK |
346 | |
347 | m_rcvCondition.Signal(); | |
a8f0bd18 LOK |
348 | } |
349 | ||
3c53ac93 | 350 | void CAdapterCommunication::WriteNextCommand(void) |
a8f0bd18 | 351 | { |
5a1e87c8 | 352 | CCECAdapterMessagePtr msg; |
3c53ac93 | 353 | if (m_outBuffer.Pop(msg)) |
a8f0bd18 | 354 | { |
eb35e4ca | 355 | CLockObject lock(&msg->mutex); |
0e31a62c | 356 | if (m_port->Write(msg) != (int32_t) msg->size()) |
3c53ac93 LOK |
357 | { |
358 | CStdString strError; | |
359 | strError.Format("error writing to serial port: %s", m_port->GetError().c_str()); | |
360 | m_controller->AddLog(CEC_LOG_ERROR, strError); | |
0e31a62c | 361 | msg->state = ADAPTER_MESSAGE_STATE_ERROR; |
3c53ac93 LOK |
362 | } |
363 | else | |
364 | { | |
365 | m_controller->AddLog(CEC_LOG_DEBUG, "command sent"); | |
0e31a62c LOK |
366 | CCondition::Sleep((uint32_t) msg->size() * (uint32_t)24 /*data*/ + (uint32_t)5 /*start bit (4.5 ms)*/); |
367 | msg->state = ADAPTER_MESSAGE_STATE_SENT; | |
3c53ac93 | 368 | } |
eb35e4ca | 369 | msg->condition.Signal(); |
25701fa6 | 370 | } |
3c53ac93 | 371 | } |
2abe74eb | 372 | |
5a1e87c8 | 373 | bool CAdapterCommunication::Write(CCECAdapterMessagePtr data) |
3c53ac93 | 374 | { |
0e31a62c | 375 | data->state = ADAPTER_MESSAGE_STATE_WAITING; |
3c53ac93 | 376 | m_outBuffer.Push(data); |
a8f0bd18 LOK |
377 | return true; |
378 | } | |
379 | ||
220537f2 | 380 | bool CAdapterCommunication::Read(CCECAdapterMessage &msg, uint32_t iTimeout) |
a8f0bd18 | 381 | { |
f077e8ed | 382 | CLockObject lock(&m_mutex); |
a8f0bd18 | 383 | |
50aa01e6 LOK |
384 | msg.clear(); |
385 | uint64_t iNow = GetTimeMs(); | |
386 | uint64_t iTarget = iNow + iTimeout; | |
387 | bool bGotFullMessage(false); | |
388 | bool bNextIsEscaped(false); | |
389 | bool bGotStart(false); | |
a8f0bd18 | 390 | |
50aa01e6 | 391 | while(!bGotFullMessage && iNow < iTarget) |
a8f0bd18 | 392 | { |
50aa01e6 LOK |
393 | uint8_t buf = 0; |
394 | if (!m_inBuffer.Pop(buf)) | |
a8f0bd18 | 395 | { |
56701628 | 396 | if (!m_rcvCondition.Wait(&m_mutex, (uint32_t) (iTarget - iNow))) |
50aa01e6 | 397 | return false; |
a8f0bd18 | 398 | } |
a8f0bd18 | 399 | |
50aa01e6 | 400 | if (!bGotStart) |
a8f0bd18 | 401 | { |
50aa01e6 LOK |
402 | if (buf == MSGSTART) |
403 | bGotStart = true; | |
404 | continue; | |
a8f0bd18 | 405 | } |
50aa01e6 | 406 | else if (buf == MSGSTART) //we found a msgstart before msgend, this is not right, remove |
a8f0bd18 | 407 | { |
50aa01e6 LOK |
408 | m_controller->AddLog(CEC_LOG_ERROR, "received MSGSTART before MSGEND"); |
409 | msg.clear(); | |
410 | bGotStart = true; | |
a8f0bd18 | 411 | } |
a8f0bd18 | 412 | |
50aa01e6 | 413 | if (buf == MSGEND) |
a8f0bd18 | 414 | { |
50aa01e6 | 415 | bGotFullMessage = true; |
a8f0bd18 | 416 | } |
50aa01e6 LOK |
417 | else if (bNextIsEscaped) |
418 | { | |
419 | msg.push_back(buf + (uint8_t)ESCOFFSET); | |
420 | bNextIsEscaped = false; | |
421 | } | |
422 | else if (buf == MSGESC) | |
423 | bNextIsEscaped = true; | |
424 | else | |
425 | msg.push_back(buf); | |
a8f0bd18 LOK |
426 | } |
427 | ||
0e31a62c LOK |
428 | if (bGotFullMessage) |
429 | msg.state = ADAPTER_MESSAGE_STATE_RECEIVED; | |
430 | ||
50aa01e6 | 431 | return bGotFullMessage; |
a8f0bd18 LOK |
432 | } |
433 | ||
828682d3 | 434 | std::string CAdapterCommunication::GetError(void) const |
a8f0bd18 LOK |
435 | { |
436 | return m_port->GetError(); | |
437 | } | |
2abe74eb LOK |
438 | |
439 | bool CAdapterCommunication::StartBootloader(void) | |
440 | { | |
441 | if (!IsRunning()) | |
442 | return false; | |
443 | ||
444 | m_controller->AddLog(CEC_LOG_DEBUG, "starting the bootloader"); | |
5a1e87c8 | 445 | CCECAdapterMessagePtr output(new CCECAdapterMessage); |
25701fa6 | 446 | |
5a1e87c8 LOK |
447 | output->push_back(MSGSTART); |
448 | output->push_escaped(MSGCODE_START_BOOTLOADER); | |
449 | output->push_back(MSGEND); | |
2abe74eb LOK |
450 | |
451 | if (!Write(output)) | |
452 | { | |
453 | m_controller->AddLog(CEC_LOG_ERROR, "could not start the bootloader"); | |
454 | return false; | |
455 | } | |
456 | m_controller->AddLog(CEC_LOG_DEBUG, "bootloader start command transmitted"); | |
457 | return true; | |
458 | } | |
459 | ||
2abe74eb LOK |
460 | bool CAdapterCommunication::SetAckMask(uint16_t iMask) |
461 | { | |
462 | if (!IsRunning()) | |
463 | return false; | |
464 | ||
465 | CStdString strLog; | |
466 | strLog.Format("setting ackmask to %2x", iMask); | |
467 | m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str()); | |
468 | ||
5a1e87c8 | 469 | CCECAdapterMessagePtr output(new CCECAdapterMessage); |
2abe74eb | 470 | |
5a1e87c8 LOK |
471 | output->push_back(MSGSTART); |
472 | output->push_escaped(MSGCODE_SET_ACK_MASK); | |
473 | output->push_escaped(iMask >> 8); | |
474 | output->push_escaped((uint8_t)iMask); | |
475 | output->push_back(MSGEND); | |
2abe74eb LOK |
476 | |
477 | if (!Write(output)) | |
478 | { | |
479 | m_controller->AddLog(CEC_LOG_ERROR, "could not set the ackmask"); | |
480 | return false; | |
481 | } | |
482 | ||
483 | return true; | |
484 | } | |
485 | ||
486 | bool CAdapterCommunication::PingAdapter(void) | |
487 | { | |
488 | if (!IsRunning()) | |
489 | return false; | |
490 | ||
491 | m_controller->AddLog(CEC_LOG_DEBUG, "sending ping"); | |
5a1e87c8 | 492 | CCECAdapterMessagePtr output(new CCECAdapterMessage); |
25701fa6 | 493 | |
5a1e87c8 LOK |
494 | output->push_back(MSGSTART); |
495 | output->push_escaped(MSGCODE_PING); | |
496 | output->push_back(MSGEND); | |
2abe74eb LOK |
497 | |
498 | if (!Write(output)) | |
499 | { | |
500 | m_controller->AddLog(CEC_LOG_ERROR, "could not send ping command"); | |
501 | return false; | |
502 | } | |
503 | ||
504 | m_controller->AddLog(CEC_LOG_DEBUG, "ping tranmitted"); | |
505 | ||
506 | // TODO check for pong | |
507 | return true; | |
508 | } | |
13fd6a66 LOK |
509 | |
510 | bool CAdapterCommunication::IsOpen(void) const | |
511 | { | |
b9eea66d | 512 | return !IsStopped() && m_port->IsOpen() && IsRunning(); |
13fd6a66 | 513 | } |