This commit is contained in:
andreas 2021-10-22 16:15:49 +02:00
parent 6e449ca4dc
commit 149ffb7a5f
2 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,5 @@
#include "GwSocketServer.h" #include "GwSocketServer.h"
#include <ESPmDNS.h>
GwSocketServer::GwSocketServer(const GwConfigHandler *config,GwLog *logger){ GwSocketServer::GwSocketServer(const GwConfigHandler *config,GwLog *logger){
this->config=config; this->config=config;
@ -9,6 +10,7 @@ void GwSocketServer::begin(){
server->begin(); server->begin();
logger->logString("Socket server created, port=%d", logger->logString("Socket server created, port=%d",
config->getInt(config->serverPort)); config->getInt(config->serverPort));
MDNS.addService("_nmea-0183","_tcp",config->getInt(config->serverPort));
} }
void GwSocketServer::loop() void GwSocketServer::loop()

View File

@ -25,6 +25,7 @@
#include <WebServer.h> #include <WebServer.h>
#include <Preferences.h> #include <Preferences.h>
#include <ArduinoJson.h> #include <ArduinoJson.h>
#include <ESPmDNS.h>
#include "N2kDataToNMEA0183.h" #include "N2kDataToNMEA0183.h"
@ -191,7 +192,7 @@ void setup() {
sendTCP=config.getConfigItem(config.sendTCP,true); sendTCP=config.getConfigItem(config.sendTCP,true);
sendSeasmart=config.getConfigItem(config.sendSeasmart,true); sendSeasmart=config.getConfigItem(config.sendSeasmart,true);
systemName=config.getConfigItem(config.systemName,true); systemName=config.getConfigItem(config.systemName,true);
MDNS.begin(config.getConfigItem(config.systemName)->asCString());
gwWifi.setup(); gwWifi.setup();
// Start TCP server // Start TCP server
@ -209,6 +210,8 @@ void setup() {
webserver.begin(); webserver.begin();
Serial.println("HTTP server started"); Serial.println("HTTP server started");
MDNS.addService("_http","_tcp",80);
// Reserve enough buffer for sending all messages. This does not work on small memory devices like Uno or Mega // Reserve enough buffer for sending all messages. This does not work on small memory devices like Uno or Mega
NMEA2000.SetN2kCANMsgBufSize(8); NMEA2000.SetN2kCANMsgBufSize(8);