mirror of
https://git.mirrors.martin98.com/https://github.com/luc-github/ESP3D.git
synced 2025-08-03 00:50:35 +08:00
Fix ESP181
Add FTP to NetServices
This commit is contained in:
parent
c684e69575
commit
a733ed29e2
@ -49,10 +49,10 @@ bool Commands::ESP181(const char* cmd_params, level_authenticate_type auth_type,
|
||||
return false;
|
||||
}
|
||||
#endif //AUTHENTICATION_FEATURE
|
||||
String s = get_param (cmd_params, "ctrl=");
|
||||
parameter = get_param (cmd_params, "ctrl=");
|
||||
uint ibuf;
|
||||
bool done = false;
|
||||
if (s.length() > 0) {
|
||||
if (parameter.length() > 0) {
|
||||
ibuf = parameter.toInt();
|
||||
if ((ibuf > Settings_ESP3D::get_max_int32_value(ESP_FTP_CTRL_PORT)) || (ibuf < Settings_ESP3D::get_min_int32_value(ESP_FTP_CTRL_PORT))) {
|
||||
output->printERROR ("Incorrect port!");
|
||||
@ -65,8 +65,8 @@ bool Commands::ESP181(const char* cmd_params, level_authenticate_type auth_type,
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
s = get_param (cmd_params, "active=");
|
||||
if (s.length() > 0) {
|
||||
parameter = get_param (cmd_params, "active=");
|
||||
if (parameter.length() > 0) {
|
||||
ibuf = parameter.toInt();
|
||||
if ((ibuf > Settings_ESP3D::get_max_int32_value(ESP_FTP_DATA_ACTIVE_PORT)) || (ibuf < Settings_ESP3D::get_min_int32_value(ESP_FTP_DATA_ACTIVE_PORT))) {
|
||||
output->printERROR ("Incorrect port!");
|
||||
@ -79,8 +79,8 @@ bool Commands::ESP181(const char* cmd_params, level_authenticate_type auth_type,
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
s = get_param (cmd_params, "passive=");
|
||||
if (s.length() > 0) {
|
||||
parameter = get_param (cmd_params, "passive=");
|
||||
if (parameter.length() > 0) {
|
||||
ibuf = parameter.toInt();
|
||||
if ((ibuf > Settings_ESP3D::get_max_int32_value(ESP_FTP_DATA_PASSIVE_PORT)) || (ibuf < Settings_ESP3D::get_min_int32_value(ESP_FTP_DATA_PASSIVE_PORT))) {
|
||||
output->printERROR ("Incorrect port!");
|
||||
@ -95,6 +95,11 @@ bool Commands::ESP181(const char* cmd_params, level_authenticate_type auth_type,
|
||||
}
|
||||
if (response && done) {
|
||||
output->printMSG("ok");
|
||||
} else {
|
||||
if (response && !done) {
|
||||
output->printERROR ("Only ctrl, active and passive settings are supported!");
|
||||
response = false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,6 +49,9 @@
|
||||
#ifdef TELNET_FEATURE
|
||||
#include "../telnet/telnet_server.h"
|
||||
#endif //TELNET_FEATURE
|
||||
#ifdef FTP_FEATURE
|
||||
#include "../ftp/ftp_server.h"
|
||||
#endif //FP_FEATURE
|
||||
#ifdef HTTP_FEATURE
|
||||
#include "../http/http_server.h"
|
||||
#endif //HTTP_FEATURE
|
||||
@ -209,6 +212,17 @@ bool NetServices::begin()
|
||||
}
|
||||
}
|
||||
#endif //TELNET_FEATURE
|
||||
#ifdef FTP_FEATURE
|
||||
if (!ftp_server.begin()) {
|
||||
res= false;
|
||||
output.printERROR("Ftp server failed");
|
||||
} else {
|
||||
if(ftp_server.started()) {
|
||||
String stmp = "Ftp server started ports: " + String(ftp_server.ctrlport()) + ","+ String(ftp_server.dataactiveport()) + ","+ String(ftp_server.datapassiveport());
|
||||
output.printMSG(stmp.c_str());
|
||||
}
|
||||
}
|
||||
#endif //FTP_FEATURE
|
||||
#ifdef WS_DATA_FEATURE
|
||||
if (!websocket_data_server.begin(Settings_ESP3D::read_uint32(ESP_WEBSOCKET_PORT))) {
|
||||
output.printMSG("Failed start Terminal Web Socket");
|
||||
@ -318,7 +332,9 @@ void NetServices::end()
|
||||
#ifdef TELNET_FEATURE
|
||||
telnet_server.end();
|
||||
#endif //TELNET_FEATURE
|
||||
|
||||
#ifdef FTP_FEATURE
|
||||
ftp_server.end();
|
||||
#endif //FTP_FEATURE
|
||||
}
|
||||
|
||||
void NetServices::handle()
|
||||
@ -349,6 +365,9 @@ void NetServices::handle()
|
||||
#ifdef TELNET_FEATURE
|
||||
telnet_server.handle();
|
||||
#endif //TELNET_FEATURE
|
||||
#ifdef FTP_FEATURE
|
||||
ftp_server.handle();
|
||||
#endif //FTP_FEATURE
|
||||
#ifdef NOTIFICATION_FEATURE
|
||||
notificationsservice.handle();
|
||||
#endif //NOTIFICATION_FEATURE
|
||||
|
Loading…
x
Reference in New Issue
Block a user