| 360 | } |
| 361 | |
| 362 | GCodeResult Network::EnableInterface(unsigned int interface, int mode, const StringRef& ssid, const StringRef& reply) noexcept |
| 363 | { |
| 364 | #if HAS_NETWORKING |
| 365 | if (interface < GetNumNetworkInterfaces()) |
| 366 | { |
| 367 | NetworkInterface * const iface = interfaces[interface]; |
| 368 | if (mode < 1) // if disabling the interface |
| 369 | { |
| 370 | #if HAS_RESPONDERS |
| 371 | TerminateResponders(iface, AnyProtocol); |
| 372 | |
| 373 | # if SUPPORT_HTTP |
| 374 | HttpResponder::DisableInterface(iface); // remove sessions that use this interface |
| 375 | # endif |
| 376 | # if SUPPORT_FTP |
| 377 | FtpResponder::Disable(); // TODO leave any Telnet session using a different interface alone |
| 378 | # endif |
| 379 | # if SUPPORT_TELNET |
| 380 | TelnetResponder::Disable(); // TODO leave any Telnet session using a different interface alone |
| 381 | # endif |
| 382 | # if SUPPORT_MQTT |
| 383 | MqttClient::Disable(); |
| 384 | # endif |
| 385 | #endif // HAS_RESPONDERS |
| 386 | } |
| 387 | return iface->EnableInterface(mode, ssid, reply); |
| 388 | } |
| 389 | reply.printf("Invalid network interface '%d'\n", interface); |
| 390 | return GCodeResult::error; |
| 391 | #else |
| 392 | reply.copy(notSupportedText); |
| 393 | return GCodeResult::error; |
| 394 | #endif // HAS_NETWORKING |
| 395 | } |
| 396 | |
| 397 | WiFiInterface *_ecv_null Network::FindWiFiInterface() const noexcept |
| 398 | { |
no test coverage detected