Always Announce MDNS meshtastic service (#5503)
Some checks failed
CI / setup (check) (push) Has been cancelled
CI / setup (esp32) (push) Has been cancelled
CI / setup (esp32c3) (push) Has been cancelled
CI / setup (esp32c6) (push) Has been cancelled
CI / setup (esp32s3) (push) Has been cancelled
CI / setup (nrf52840) (push) Has been cancelled
CI / setup (rp2040) (push) Has been cancelled
CI / setup (stm32) (push) Has been cancelled
CI / package-raspbian (push) Has been cancelled
CI / package-raspbian-armv7l (push) Has been cancelled
CI / package-native (push) Has been cancelled
Flawfinder Scan / Flawfinder (push) Has been cancelled
CI / check (push) Has been cancelled
CI / build-esp32 (push) Has been cancelled
CI / build-esp32-s3 (push) Has been cancelled
CI / build-esp32-c3 (push) Has been cancelled
CI / build-esp32-c6 (push) Has been cancelled
CI / build-nrf52 (push) Has been cancelled
CI / build-rpi2040 (push) Has been cancelled
CI / build-stm32 (push) Has been cancelled
CI / after-checks (push) Has been cancelled
CI / gather-artifacts (esp32) (push) Has been cancelled
CI / gather-artifacts (esp32c3) (push) Has been cancelled
CI / gather-artifacts (esp32c6) (push) Has been cancelled
CI / gather-artifacts (esp32s3) (push) Has been cancelled
CI / gather-artifacts (nrf52840) (push) Has been cancelled
CI / gather-artifacts (rp2040) (push) Has been cancelled
CI / gather-artifacts (stm32) (push) Has been cancelled
CI / release-artifacts (push) Has been cancelled
CI / release-firmware (esp32) (push) Has been cancelled
CI / release-firmware (esp32c3) (push) Has been cancelled
CI / release-firmware (esp32c6) (push) Has been cancelled
CI / release-firmware (esp32s3) (push) Has been cancelled
CI / release-firmware (nrf52840) (push) Has been cancelled
CI / release-firmware (rp2040) (push) Has been cancelled
CI / release-firmware (stm32) (push) Has been cancelled
Nightly / Trunk Check Upload (push) Has been cancelled
Semgrep Full Scan / semgrep-full (push) Has been cancelled

* refactor server api port into define

* always announce MDNS meshtastic service
This commit is contained in:
broglep 2024-12-05 13:02:10 +01:00 committed by GitHub
parent c3d60342f4
commit de774188c9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 9 additions and 6 deletions

View File

@ -2,6 +2,8 @@
#include "StreamAPI.h"
#define SERVER_API_DEFAULT_PORT 4403
/**
* Provides both debug printing and, if the client starts sending protobufs to us, switches to send/receive protobufs
* (and starts dropping debug printing - FIXME, eventually those prints should be encapsulated in protobufs).

View File

@ -22,5 +22,5 @@ class WiFiServerPort : public APIServerPort<WiFiServerAPI, WiFiServer>
explicit WiFiServerPort(int port);
};
void initApiServer(int port = 4403);
void initApiServer(int port = SERVER_API_DEFAULT_PORT);
void deInitApiServer();

View File

@ -22,4 +22,4 @@ class ethServerPort : public APIServerPort<ethServerAPI, EthernetServer>
explicit ethServerPort(int port);
};
void initApiServer(int port = 4403);
void initApiServer(int port = SERVER_API_DEFAULT_PORT);

View File

@ -66,13 +66,13 @@ static void onNetworkConnected()
LOG_ERROR("Error setting up MDNS responder!");
} else {
LOG_INFO("mDNS Host: Meshtastic.local");
MDNS.addService("meshtastic", "tcp", SERVER_API_DEFAULT_PORT);
#ifdef ARCH_ESP32
MDNS.addService("http", "tcp", 80);
MDNS.addService("https", "tcp", 443);
// ESP32 prints obtained IP address in WiFiEvent
#elif defined(ARCH_RP2040)
// ARCH_RP2040 does not support HTTPS, create a "meshtastic" service
MDNS.addService("meshtastic", "tcp", 4403);
// ESP32 handles this in WiFiEvent
// ARCH_RP2040 does not support HTTPS
LOG_INFO("Obtained IP address: %s", WiFi.localIP().toString().c_str());
#endif
}

View File

@ -9,6 +9,7 @@
#include <assert.h>
#include "PortduinoGlue.h"
#include "api/ServerAPI.h"
#include "linux/gpio/LinuxGPIOPin.h"
#include "yaml-cpp/yaml.h"
#include <filesystem>
@ -34,7 +35,7 @@ void cpuDeepSleep(uint32_t msecs)
void updateBatteryLevel(uint8_t level) NOT_IMPLEMENTED("updateBatteryLevel");
int TCPPort = 4403;
int TCPPort = SERVER_API_DEFAULT_PORT;
static error_t parse_opt(int key, char *arg, struct argp_state *state)
{