mirror of
https://github.com/EyeTrackVR/OpenIris.git
synced 2025-11-04 15:39:42 +08:00
update
- setup default mDNS hostname to be user configurable
This commit is contained in:
parent
5ca84d2316
commit
061e3cb8d3
@ -1,6 +1,9 @@
|
|||||||
#include "project_config.hpp"
|
#include "project_config.hpp"
|
||||||
|
|
||||||
ProjectConfig::ProjectConfig(const std::string &name) : _name(std::move(name)), _already_loaded(false) {}
|
ProjectConfig::ProjectConfig(const std::string &name,
|
||||||
|
const std::string &mdnsName) : _name(std::move(name)),
|
||||||
|
_mdnsName(std::move(mdnsName)),
|
||||||
|
_already_loaded(false) {}
|
||||||
|
|
||||||
ProjectConfig::~ProjectConfig() {}
|
ProjectConfig::~ProjectConfig() {}
|
||||||
|
|
||||||
@ -32,11 +35,18 @@ void ProjectConfig::initConfig()
|
|||||||
3232,
|
3232,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (_mdnsName.empty())
|
||||||
|
{
|
||||||
|
log_e("MDNS name is null\n Autoassigning name to 'easynetwork'");
|
||||||
|
_mdnsName = "openiristracker";
|
||||||
|
}
|
||||||
this->config.mdns = {
|
this->config.mdns = {
|
||||||
"openiristracker",
|
_mdnsName,
|
||||||
"",
|
"",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
log_i("MDNS name: %s", _mdnsName.c_str());
|
||||||
|
|
||||||
this->config.ap_network = {
|
this->config.ap_network = {
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
@ -152,11 +162,8 @@ void ProjectConfig::load()
|
|||||||
this->config.device.OTAPort = getInt("OTAPort", 3232);
|
this->config.device.OTAPort = getInt("OTAPort", 3232);
|
||||||
|
|
||||||
/* MDNS Config */
|
/* MDNS Config */
|
||||||
const std::string default_hostname = this->config.mdns.hostname;
|
this->config.mdns.hostname = getString("hostname", _mdnsName.c_str()).c_str();
|
||||||
std::string default_service = "_";
|
this->config.mdns.service = getString("service").c_str();
|
||||||
default_service.append(this->config.mdns.service);
|
|
||||||
this->config.mdns.hostname = getString("hostname", default_hostname.c_str()).c_str();
|
|
||||||
this->config.mdns.service = getString("service", default_service.c_str()).c_str();
|
|
||||||
|
|
||||||
/* Wifi TX Power Config */
|
/* Wifi TX Power Config */
|
||||||
this->config.txpower.power = getUInt("power", 52);
|
this->config.txpower.power = getUInt("power", 52);
|
||||||
|
|||||||
@ -12,7 +12,8 @@
|
|||||||
class ProjectConfig : public Preferences, public ISubject
|
class ProjectConfig : public Preferences, public ISubject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ProjectConfig(const std::string &name = std::string());
|
ProjectConfig(const std::string &name = std::string(),
|
||||||
|
const std::string &mdnsName = std::string());
|
||||||
virtual ~ProjectConfig();
|
virtual ~ProjectConfig();
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
@ -114,8 +115,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TrackerConfig_t config;
|
TrackerConfig_t config;
|
||||||
bool _already_loaded;
|
|
||||||
std::string _name;
|
std::string _name;
|
||||||
|
std::string _mdnsName;
|
||||||
|
bool _already_loaded;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // PROJECT_CONFIG_HPP
|
#endif // PROJECT_CONFIG_HPP
|
||||||
@ -16,6 +16,7 @@ default_envs = esp32Cam ; do not change this value
|
|||||||
[wifi]
|
[wifi]
|
||||||
ssid="" ; your wifi network name goes here
|
ssid="" ; your wifi network name goes here
|
||||||
password="" ; your wifi network password goes here
|
password="" ; your wifi network password goes here
|
||||||
|
mDNSName="openiristracker" ; the name of the tracker as it will appear on your network
|
||||||
channel=1 ; wifi channel
|
channel=1 ; wifi channel
|
||||||
ap_ssid="EyeTrackVR" ; your AP wifi network name goes here
|
ap_ssid="EyeTrackVR" ; your AP wifi network name goes here
|
||||||
ap_password="test" ; Place your AP Wifi password here
|
ap_password="test" ; Place your AP Wifi password here
|
||||||
@ -88,6 +89,7 @@ build_flags =
|
|||||||
-DADHOC_CHANNEL=${wifi.adhocChannel} ;
|
-DADHOC_CHANNEL=${wifi.adhocChannel} ;
|
||||||
-DWIFI_CHANNEL=${wifi.channel} ;
|
-DWIFI_CHANNEL=${wifi.channel} ;
|
||||||
-DENABLE_OTA=${wifi.enableOTA} ;
|
-DENABLE_OTA=${wifi.enableOTA} ;
|
||||||
|
'-DMDNS_HOSTNAME=${wifi.mDNSName}' ; Set the OTA password
|
||||||
'-DOTA_PASSWORD=${wifi.OTAPassword}' ; Set the OTA password
|
'-DOTA_PASSWORD=${wifi.OTAPassword}' ; Set the OTA password
|
||||||
'-DWIFI_SSID=${wifi.ssid}' ; Set the users wifi network name
|
'-DWIFI_SSID=${wifi.ssid}' ; Set the users wifi network name
|
||||||
'-DWIFI_PASSWORD=${wifi.password}' ; Set the users wifi network password
|
'-DWIFI_PASSWORD=${wifi.password}' ; Set the users wifi network password
|
||||||
|
|||||||
@ -19,7 +19,13 @@
|
|||||||
int STREAM_SERVER_PORT = 80;
|
int STREAM_SERVER_PORT = 80;
|
||||||
int CONTROL_SERVER_PORT = 81;
|
int CONTROL_SERVER_PORT = 81;
|
||||||
|
|
||||||
ProjectConfig deviceConfig;
|
/**
|
||||||
|
* @brief ProjectConfig object
|
||||||
|
* @brief This is the main configuration object for the project
|
||||||
|
* @param name The name of the project config partition
|
||||||
|
* @param mdnsName The mDNS hostname to use
|
||||||
|
*/
|
||||||
|
ProjectConfig deviceConfig("openiris", MDNS_HOSTNAME);
|
||||||
#if ENABLE_OTA
|
#if ENABLE_OTA
|
||||||
OTA ota(&deviceConfig);
|
OTA ota(&deviceConfig);
|
||||||
#endif // ENABLE_OTA
|
#endif // ENABLE_OTA
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
484
|
500
|
||||||
Loading…
Reference in New Issue
Block a user