1818class ModemClass {
1919
2020public:
21+ /* *
22+ * Initializes an instance of the `ModemClass` class with
23+ * specific transmit (tx) and receive (rx) pins for communication.
24+ */
2125 ModemClass (int tx, int rx);
2226 ModemClass (UART * _serial);
2327 ~ModemClass ();
2428
29+ /* *
30+ * Initializes the modem communication with a specified baud rate. By default,
31+ * the baud rate is set to 115200. Call function after creating an instance of the
32+ * `ModemClass` to set up the communication parameters before sending or receiving data.
33+ */
2534 void begin (int badurate = 115200 );
35+
36+ /* *
37+ * Shutts down the modem communication and releases any resources that were allocated during the
38+ * communication process.
39+ */
2640 void end ();
41+
42+ /* *
43+ * Sends a command to the modem and waits for a response.
44+ * It takes a command string `cmd`, a string `str` where the response will be stored
45+ * and a format string `fmt` along with additional arguments.
46+ */
2747 bool write (const std::string &cmd, std::string &str, const char * fmt, ...);
48+
49+ /* *
50+ * Used to send a command to the modem without waiting for a response.
51+ * It takes a command string `cmd`, a string `str` where the response will be stored,
52+ * and a format string `fmt` along with additional arguments.
53+ */
2854 void write_nowait (const std::string &cmd, std::string &str, const char * fmt, ...);
2955
56+ /* *
57+ * Sends binary data directly to the modem without any processing or interpretation.
58+ * It takes a pointer to the binary `data` and the `size` of the data as arguments.
59+ * Used for sending raw binary commands or data to the modem for operations that
60+ * require direct communication without any additional formatting or parsing.
61+ */
3062 bool passthrough (const uint8_t *data, size_t size);
63+
3164 void avoid_trim_results () {
3265 /* one shot - it works only 1 time the it is necessary to call again this
3366 funtion */
3467 trim_results = false ;
3568 }
3669
70+
71+ /* *
72+ * When this function is called, it enables a specific mode of reading
73+ * where the size of the data to be read is considered for processing.
74+ */
3775 void read_using_size () {
3876 read_by_size = true ;
3977 }
4078 bool beginned;
4179
42- /* calling this function with no argument will enable debug message to be printed
80+ /* Calling this function with no argument will enable debug message to be printed
4381 on Serial
4482 use first parameter UART *u to redirect debug output to a different serial
4583
@@ -54,15 +92,23 @@ class ModemClass {
5492 _debug_level = level;
5593 }
5694
95+ /* *
96+ * Used to disable debugging output for the modem communication.
97+ */
5798 void noDebug () {
5899 _serial_debug = nullptr ;
59100 }
60101
102+ /* NOT SURE*/
61103 #ifdef SELECTABLE_MODEM_DEBUG
62104 bool enable_dbg = false ;
63105 void debug (bool e) {enable_dbg = e;}
64106 #endif
65107
108+ /* *
109+ * Sets the timeout value for communication operations.
110+ * Can be called with a specified timeout value in milliseconds.
111+ */
66112 void timeout (size_t timeout_ms) {_timeout = timeout_ms;}
67113
68114private:
0 commit comments