@@ -86,28 +86,28 @@ command_result net_close(CommandableIf *t)
8686 return command_result::OK;
8787}
8888
89- command_result tcp_open (CommandableIf *t, const std::string &host, int port, int timeout)
90- {
91- ESP_LOGV (TAG, " %s" , __func__);
92-
93- // Use link ID 0 for now (can be extended to support multiple concurrent connections)
94- const int link_id = 0 ;
95-
96- // Establish TCP connection with link ID for multiple connections mode
97- std::string tcp_cmd = " AT+CIPSTART=" + std::to_string (link_id) + " ,\" TCP\" ,\" " + host + " \" ," + std::to_string (port) + " \r\n " ;
98-
99- // In multiple connections mode, response format is: <link ID>,CONNECT
100- std::string expected_response = std::to_string (link_id) + " ,CONNECT" ;
101-
102- auto ret = dce_commands::generic_command (t, tcp_cmd, expected_response, " ERROR" , timeout);
103- if (ret != command_result::OK) {
104- ESP_LOGE (TAG, " Failed to establish TCP connection to %s:%d on link %d" , host.c_str (), port, link_id);
105- return ret;
106- }
107-
108- ESP_LOGI (TAG, " TCP connection established to %s:%d on link %d" , host.c_str (), port, link_id);
109- return command_result::OK;
110- }
89+ // command_result tcp_open(CommandableIf *t, const std::string &host, int port, int timeout)
90+ // {
91+ // ESP_LOGV(TAG, "%s", __func__);
92+ //
93+ // // Use link ID 0 for now (can be extended to support multiple concurrent connections)
94+ // const int link_id = 0;
95+ //
96+ // // Establish TCP connection with link ID for multiple connections mode
97+ // std::string tcp_cmd = "AT+CIPSTART=" + std::to_string(link_id) + ",\"TCP\",\"" + host + "\"," + std::to_string(port) + "\r\n";
98+ //
99+ // // In multiple connections mode, response format is: <link ID>,CONNECT
100+ // std::string expected_response = std::to_string(link_id) + ",CONNECT";
101+ //
102+ // auto ret = dce_commands::generic_command(t, tcp_cmd, expected_response, "ERROR", timeout);
103+ // if (ret != command_result::OK) {
104+ // ESP_LOGE(TAG, "Failed to establish TCP connection to %s:%d on link %d", host.c_str(), port, link_id);
105+ // return ret;
106+ // }
107+ //
108+ // ESP_LOGI(TAG, "TCP connection established to %s:%d on link %d", host.c_str(), port, link_id);
109+ // return command_result::OK;
110+ // }
111111
112112command_result tcp_close (CommandableIf *t)
113113{
@@ -122,21 +122,6 @@ command_result tcp_close(CommandableIf *t)
122122 return dce_commands::generic_command (t, close_cmd, expected_response, " ERROR" , 5000 );
123123}
124124
125- command_result tcp_send (CommandableIf *t, uint8_t *data, size_t len)
126- {
127- ESP_LOGV (TAG, " %s" , __func__);
128- // This function is not used in the current implementation
129- // Data sending is handled by the DCE responder
130- return command_result::FAIL;
131- }
132-
133- command_result tcp_recv (CommandableIf *t, uint8_t *data, size_t len, size_t &out_len)
134- {
135- ESP_LOGV (TAG, " %s" , __func__);
136- // This function is not used in the current implementation
137- // Data receiving is handled by the DCE responder
138- return command_result::FAIL;
139- }
140125
141126command_result get_ip (CommandableIf *t, std::string &ip)
142127{
@@ -183,21 +168,18 @@ void Responder::start_sending(size_t len)
183168 data_to_send = len;
184169 send_stat = 0 ;
185170 // For multiple connections mode, include link ID
186- const int link_id = 0 ;
187171 send_cmd (" AT+CIPSEND=" + std::to_string (link_id) + " ," + std::to_string (len) + " \r\n " );
188172}
189173
190174void Responder::start_receiving (size_t len)
191175{
192176 // For multiple connections mode, include link ID
193- const int link_id = 0 ;
194177 send_cmd (" AT+CIPRECVDATA=" + std::to_string (link_id) + " ," + std::to_string (len) + " \r\n " );
195178}
196179
197180bool Responder::start_connecting (std::string host, int port)
198181{
199182 // For multiple connections mode, include link ID
200- const int link_id = 0 ;
201183 std::string cmd = " AT+CIPSTART=" + std::to_string (link_id) + " ,\" TCP\" ,\" " + host + " \" ," + std::to_string (port) + " \r\n " ;
202184 send_cmd (cmd);
203185 return true ;
0 commit comments