Add modem control and configuration interfaces#16
Conversation
Katze719
commented
Mar 14, 2026
- Introduced new headers for modem line control, including functions for setting DTR, RTS, and querying CTS, DSR, DCD, and RI states.
- Added extended configuration options with functions for flow control, sending break conditions, updating baud rate, and retrieving port configuration.
- Implemented error handling codes for new functionalities in status_codes.h and updated the corresponding message retrieval in status_codes.hpp.
- Enhanced strong_types.hpp with a new FlowControl enum for better type safety in flow control settings.
- Updated serial.h to include new interface headers for improved modularity and organization.
- Introduced new headers for modem line control, including functions for setting DTR, RTS, and querying CTS, DSR, DCD, and RI states. - Added extended configuration options with functions for flow control, sending break conditions, updating baud rate, and retrieving port configuration. - Implemented error handling codes for new functionalities in status_codes.h and updated the corresponding message retrieval in status_codes.hpp. - Enhanced strong_types.hpp with a new FlowControl enum for better type safety in flow control settings. - Updated serial.h to include new interface headers for improved modularity and organization.
There was a problem hiding this comment.
Pull request overview
This PR adds modem line control, extended configuration, and port discovery interfaces to a serial communication library. The new FlowControl enum and associated error codes support these additions.
Changes:
- Added 11 new C interface headers for modem control (DTR, RTS, CTS, DSR, DCD, RI), extended configuration (flow control, break, baud rate update, config query), and port monitoring.
- Added 8 new error codes in
status_codes.hwith corresponding string representations instatus_codes.hpp. - Added
FlowControlenum tostrong_types.hppfor type-safe flow control settings.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
include/cpp_core/strong_types.hpp |
Added FlowControl enum (None, RTS/CTS, XON/XOFF) |
include/cpp_core/status_codes.h |
Added 8 new negative error codes for new functionalities |
include/cpp_core/status_codes.hpp |
Added string representations for the 8 new error codes |
include/cpp_core/serial.h |
Includes for all 11 new interface headers |
include/cpp_core/interface/serial_set_dtr.h |
DTR modem line control interface |
include/cpp_core/interface/serial_set_rts.h |
RTS modem line control interface |
include/cpp_core/interface/serial_get_cts.h |
CTS line state query interface |
include/cpp_core/interface/serial_get_dsr.h |
DSR line state query interface |
include/cpp_core/interface/serial_get_dcd.h |
DCD line state query interface |
include/cpp_core/interface/serial_get_ri.h |
RI line state query interface |
include/cpp_core/interface/serial_set_flow_control.h |
Flow control configuration interface |
include/cpp_core/interface/serial_send_break.h |
Break condition sending interface |
include/cpp_core/interface/serial_update_baudrate.h |
Runtime baud rate update interface |
include/cpp_core/interface/serial_get_config.h |
Port configuration query interface |
include/cpp_core/interface/serial_monitor_ports.h |
Hot-plug port monitoring interface |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Introduced new headers for getting and setting baud rate, data bits, parity, stop bits, and flow control in the serial interface. - Removed deprecated configuration retrieval header to streamline the API. - Updated status codes to reflect new error handling for setting line parameters. - Enhanced documentation for new functions to improve clarity and usability.
There was a problem hiding this comment.
Pull request overview
This PR adds modem control and configuration interfaces to a C/C++ serial port library. It introduces new header files for controlling modem lines (DTR, RTS) and querying their states (CTS, DSR, DCD, RI), as well as getters/setters for line settings (baud rate, data bits, parity, stop bits, flow control), a break condition sender, and a port hot-plug monitor.
Changes:
- Added 17 new interface header files for modem line control, line-setting getters/setters, break sending, and port monitoring, all following the existing
extern "C"API pattern. - Extended
StatusCodesenum with 10 new error codes and corresponding message strings instatus_codes.hpp. - Added a
FlowControlenum tostrong_types.hppfor type-safe flow control mode representation.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
include/cpp_core/status_codes.h |
Added 10 new error codes for the new interfaces |
include/cpp_core/status_codes.hpp |
Added string representations for the new error codes |
include/cpp_core/strong_types.hpp |
Added FlowControl enum (None, RtsCts, XonXoff) |
include/cpp_core/serial.h |
Added #include directives for all new interface headers |
include/cpp_core/interface/serial_set_dtr.h |
DTR control interface |
include/cpp_core/interface/serial_set_rts.h |
RTS control interface |
include/cpp_core/interface/serial_get_cts.h |
CTS query interface |
include/cpp_core/interface/serial_get_dsr.h |
DSR query interface |
include/cpp_core/interface/serial_get_dcd.h |
DCD query interface |
include/cpp_core/interface/serial_get_ri.h |
RI query interface |
include/cpp_core/interface/serial_get_baudrate.h |
Baud rate getter |
include/cpp_core/interface/serial_get_data_bits.h |
Data bits getter |
include/cpp_core/interface/serial_get_parity.h |
Parity getter |
include/cpp_core/interface/serial_get_stop_bits.h |
Stop bits getter |
include/cpp_core/interface/serial_get_flow_control.h |
Flow control getter |
include/cpp_core/interface/serial_set_baudrate.h |
Baud rate setter |
include/cpp_core/interface/serial_set_data_bits.h |
Data bits setter |
include/cpp_core/interface/serial_set_parity.h |
Parity setter |
include/cpp_core/interface/serial_set_stop_bits.h |
Stop bits setter |
include/cpp_core/interface/serial_set_flow_control.h |
Flow control setter |
include/cpp_core/interface/serial_send_break.h |
Break condition sender |
include/cpp_core/interface/serial_monitor_ports.h |
Port hot-plug monitor |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…itorError and maintain consistency in error handling definitions.
Moved to a dedicated feature/serial-monitor-ports branch for a separate PR.