mDNS Component
Installation
The component requires ESP-IDF 5.3 and higher and is installed using IDF Component Manager.
Add this to the idf_component.yml
in the project main
directory or in the component directory:
dependencies:
plasmapper/pl_mdns: "^1.1.0"
Add this to the source code:
#include "pl_mdns.h"
Add extern "C"
to the app_main
function:
extern "C" void app_main(void) {...}
Add this to the sdkconfig.defaults
in the project directory or configure the values using Project Configuration:
CONFIG_COMPILER_CXX_RTTI=y
CONFIG_LWIP_SO_RCVBUF=y
Features
PL::MdnsClient
- an mDNS client class.PL::MdnsClient::DnsSdQuery()
discovers services using a DNS-SD query.PL::MdnsServer
- an mDNS server class.PL::MdnsServer::AddService()
adds aPL::NetworkServer
to the mDNS server as a service.
Thread safety
Class method thread safety is implemented by having the PL::Lockable
as a base class and creating the class object lock guard at the beginning of the methods.
Examples
API reference
- Types
- PL::MdnsClient class
- PL::MdnsServer class
MdnsServer
MdnsServer::MdnsServer()
MdnsServer::Lock()
MdnsServer::Unlock()
MdnsServer::Enable()
MdnsServer::Disable()
MdnsServer::AddService()
MdnsServer::IsEnabled()
MdnsServer::GetPort()
MdnsServer::SetPort()
MdnsServer::GetMaxNumberOfClients()
MdnsServer::SetMaxNumberOfClients()
MdnsServer::GetHostname()
MdnsServer::SetHostname()
MdnsServer::GetName()
MdnsServer::SetName()
MdnsServer::HandleEvent()
MdnsServer::enabledEvent
MdnsServer::disabledEvent
MdnsServer::defaultName
MdnsServer::defaultPort
MdnsServer::defaultMaxNumberOfClients