@@ -86,28 +86,28 @@ command_result net_close(CommandableIf *t)
86
86
return command_result::OK;
87
87
}
88
88
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
+ // }
111
111
112
112
command_result tcp_close (CommandableIf *t)
113
113
{
@@ -122,21 +122,6 @@ command_result tcp_close(CommandableIf *t)
122
122
return dce_commands::generic_command (t, close_cmd, expected_response, " ERROR" , 5000 );
123
123
}
124
124
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
- }
140
125
141
126
command_result get_ip (CommandableIf *t, std::string &ip)
142
127
{
@@ -183,21 +168,18 @@ void Responder::start_sending(size_t len)
183
168
data_to_send = len;
184
169
send_stat = 0 ;
185
170
// For multiple connections mode, include link ID
186
- const int link_id = 0 ;
187
171
send_cmd (" AT+CIPSEND=" + std::to_string (link_id) + " ," + std::to_string (len) + " \r\n " );
188
172
}
189
173
190
174
void Responder::start_receiving (size_t len)
191
175
{
192
176
// For multiple connections mode, include link ID
193
- const int link_id = 0 ;
194
177
send_cmd (" AT+CIPRECVDATA=" + std::to_string (link_id) + " ," + std::to_string (len) + " \r\n " );
195
178
}
196
179
197
180
bool Responder::start_connecting (std::string host, int port)
198
181
{
199
182
// For multiple connections mode, include link ID
200
- const int link_id = 0 ;
201
183
std::string cmd = " AT+CIPSTART=" + std::to_string (link_id) + " ,\" TCP\" ,\" " + host + " \" ," + std::to_string (port) + " \r\n " ;
202
184
send_cmd (cmd);
203
185
return true ;
0 commit comments