---------------------------------------------------------*\ | serial_read | | Reads bytes from the serial port into | | Returns the number of bytes actually read | | If less than bytes are available, it will read| | all available bytes | \*----------------------------
| 508 | | all available bytes | |
| 509 | \*---------------------------------------------------------*/ |
| 510 | int serial_port::serial_read(char * buffer, int length) |
| 511 | { |
| 512 | /*-----------------------------------------------------*\ |
| 513 | | Windows-specific code path for serial read | |
| 514 | \*-----------------------------------------------------*/ |
| 515 | #ifdef _WIN32 |
| 516 | DWORD bytesread; |
| 517 | ReadFile(file_descriptor, buffer, length, &bytesread, NULL); |
| 518 | return bytesread; |
| 519 | #endif |
| 520 | |
| 521 | /*-----------------------------------------------------*\ |
| 522 | | Linux-specific code path for serial read | |
| 523 | \*-----------------------------------------------------*/ |
| 524 | #ifdef __linux__ |
| 525 | int bytesread; |
| 526 | bytesread = read(file_descriptor, buffer, length); |
| 527 | return bytesread; |
| 528 | #endif |
| 529 | |
| 530 | /*-----------------------------------------------------*\ |
| 531 | | MacOS-specific code path for serial read | |
| 532 | \*-----------------------------------------------------*/ |
| 533 | #ifdef __APPLE__ |
| 534 | int bytesread; |
| 535 | bytesread = read(file_descriptor, buffer, length); |
| 536 | return bytesread; |
| 537 | #endif |
| 538 | |
| 539 | /*-----------------------------------------------------*\ |
| 540 | | Return 0 on unsupported platforms | |
| 541 | \*-----------------------------------------------------*/ |
| 542 | return 0; |
| 543 | } |
| 544 | |
| 545 | /*---------------------------------------------------------*\ |
| 546 | | serial_write | |
no outgoing calls
no test coverage detected