Rebased network changes (#751)

* add initial mdns responder for rtp-midi aka applemidi

* do not reinitialized network

* continue publishing mdns after network connection reestablishes
pull/757/head
Ömer Şiar Baysal 2 weeks ago committed by GitHub
parent 29b5d05bd4
commit b822a9742f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 21
      src/minidexed.cpp
  2. 1
      src/minidexed.h

@ -32,6 +32,7 @@ const char WLANFirmwarePath[] = "SD:firmware/";
const char WLANConfigFile[] = "SD:wpa_supplicant.conf";
#define FTPUSERNAME "admin"
#define FTPPASSWORD "admin"
#define MDNSSERVICENAME "MiniDexed"
LOGMODULE ("minidexed");
@ -62,6 +63,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
m_WPASupplicant(WLANConfigFile),
m_bNetworkReady(false),
m_UDPMIDI (this, pConfig, &m_UI),
m_pmDNSPublisher (),
m_bSavePerformance (false),
m_bSavePerformanceNewFile (false),
m_bSetNewPerformance (false),
@ -2188,10 +2190,14 @@ void CMiniDexed::UpdateNetwork()
if (!m_pNet)
return;
//add wired network check as well
bool bNetIsRunning = m_pNet->IsRunning();
if ((strcmp(m_pConfig->GetNetworkType(), "ethernet") == 0))
bNetIsRunning &= m_pNetDevice->IsLinkUp();
else if ((strcmp(m_pConfig->GetNetworkType(), "wifi") == 0))
bNetIsRunning &= m_WPASupplicant.IsConnected();
if (!m_bNetworkReady && bNetIsRunning)
if (!m_bNetworkReady && (m_pNet->IsRunning()))
{
m_bNetworkReady = true;
CString IPString;
@ -2199,7 +2205,6 @@ void CMiniDexed::UpdateNetwork()
//LOGNOTE("Network up and running at: %s", static_cast<const char *>(IPString));
m_UDPMIDI.Initialize();
m_pFTPDaemon = new CFTPDaemon(FTPUSERNAME, FTPPASSWORD);
@ -2236,8 +2241,18 @@ void CMiniDexed::UpdateNetwork()
}
else if (m_bNetworkReady && !bNetIsRunning)
{
m_bNetworkReady = false;
//m_bNetworkReady = false;
m_pmDNSPublisher->UnpublishService (MDNSSERVICENAME);
LOGNOTE("Network disconnected.");
}
else if (m_bNetworkReady && bNetIsRunning)
{
if (!m_pmDNSPublisher->PublishService (MDNSSERVICENAME, CmDNSPublisher::ServiceTypeAppleMIDI,
5004))
{
LOGPANIC ("Cannot publish mdns service");
}
LOGNOTE("Network connection reestablished.");
}
}

@ -340,6 +340,7 @@ private:
bool m_bNetworkReady;
CUDPMIDIDevice m_UDPMIDI;
CFTPDaemon* m_pFTPDaemon;
CmDNSPublisher *m_pmDNSPublisher;
bool m_bSavePerformance;
bool m_bSavePerformanceNewFile;

Loading…
Cancel
Save