| 661 | } |
| 662 | |
| 663 | void serial_port::serial_set_rts(bool rts) |
| 664 | { |
| 665 | /*-----------------------------------------------------*\ |
| 666 | | Windows-specific code path for serial set RTS | |
| 667 | \*-----------------------------------------------------*/ |
| 668 | #ifdef _WIN32 |
| 669 | if(rts) |
| 670 | { |
| 671 | EscapeCommFunction(file_descriptor, SETRTS); |
| 672 | } |
| 673 | else |
| 674 | { |
| 675 | EscapeCommFunction(file_descriptor, CLRRTS); |
| 676 | } |
| 677 | #endif |
| 678 | |
| 679 | /*-----------------------------------------------------*\ |
| 680 | | Linux-specific code path for serial set RTS | |
| 681 | \*-----------------------------------------------------*/ |
| 682 | #ifdef __linux__ |
| 683 | const int RTSFLAG = TIOCM_RTS; |
| 684 | if(rts) |
| 685 | { |
| 686 | ioctl(file_descriptor, TIOCMBIS, &RTSFLAG); |
| 687 | } |
| 688 | else |
| 689 | { |
| 690 | ioctl(file_descriptor, TIOCMBIC, &RTSFLAG); |
| 691 | } |
| 692 | #endif |
| 693 | |
| 694 | /*-----------------------------------------------------*\ |
| 695 | | MacOS-specific code path for serial set RTS | |
| 696 | \*-----------------------------------------------------*/ |
| 697 | #ifdef __APPLE__ |
| 698 | const int RTSFLAG = TIOCM_RTS; |
| 699 | if(rts) |
| 700 | { |
| 701 | ioctl(file_descriptor, TIOCMBIS, &RTSFLAG); |
| 702 | } |
| 703 | else |
| 704 | { |
| 705 | ioctl(file_descriptor, TIOCMBIC, &RTSFLAG); |
| 706 | } |
| 707 | #endif |
| 708 | } |