45 uint32_t minWaitMs = 3000, uint32_t maxWaitMs = 60000) {
47 "ControlPointMediaServer::begin device_type_filter='%s'",
59 const char* dt = d.getDeviceType();
74 const char* newValue);
156 if (!svc)
return false;
171 if (!svc)
return false;
186 if (volumePercent < 0) volumePercent = 0;
187 if (volumePercent > 100) volumePercent = 100;
195 snprintf(volBuf,
sizeof(volBuf),
"%d", volumePercent);
213 if (!svc)
return false;
285 if (!svc)
return nullptr;
300 if (!svc)
return nullptr;
409 "urn:schemas-upnp-org:device:MediaRenderer:1";
424 const char* varName,
const char* newValue) {
427 "processNotification sid='%s' var='%s' value='%s'",
428 sid ? sid :
"(null)", varName ? varName :
"(null)",
429 newValue ? newValue :
"(null)");
435 if (
StrView(varName) ==
"TransportState") {
436 if (
StrView(newValue) ==
"PLAYING") {
448 if (a.name !=
nullptr) {
450 if (nm == name)
return a.value.c_str();
458 if (t ==
nullptr)
return 0;
459 int h = 0, m = 0, s = 0;
465 if (*p ==
':') colonCount++;
468 if (colonCount == 2) {
469 parts = sscanf(t,
"%d:%d:%d", &h, &m, &s);
470 }
else if (colonCount == 1) {
471 parts = sscanf(t,
"%d:%d", &m, &s);
475 parts = sscanf(t,
"%d", &s);
477 if (parts <= 0)
return 0;
478 unsigned long total =
479 (
unsigned long)h * 3600UL + (
unsigned long)m * 60UL + (
unsigned long)s;
480 return total * 1000UL;
487 for (
auto& d : all) {
488 const char* dt = d.getDeviceType();
Represents the result of invoking a DLNA service Action.
Definition: Action.h:42
Vector< Argument > arguments
Definition: Action.h:45
Represents a request to invoke a remote DLNA service action.
Definition: Action.h:79
void addArgument(Argument arg)
Definition: Action.h:88
Lightweight DLNA control point manager.
Definition: DLNAControlPoint.h:58
DLNADeviceInfo & getDevice(int deviceIdx=0)
Provides the device information by index.
Definition: DLNAControlPoint.h:313
ActionRequest & addAction(ActionRequest act)
Registers a method that will be called.
Definition: DLNAControlPoint.h:161
Vector< DLNADeviceInfo > & getDevices()
Definition: DLNAControlPoint.h:343
bool subscribeNotifications(DLNADeviceInfo &device, int timeoutSeconds=60)
Subscribe to changes for all device services.
Definition: DLNAControlPoint.h:184
bool begin(DLNAHttpRequest &http, IUDPService &udp, const char *searchTarget="ssdp:all", uint32_t minWaitMs=3000, uint32_t maxWaitMs=60000)
Start discovery by sending M-SEARCH requests and process replies.
Definition: DLNAControlPoint.h:89
ActionReply & executeActions()
Executes all registered methods.
Definition: DLNAControlPoint.h:168
DLNAServiceInfo & getService(const char *id)
Provide addess to the service information.
Definition: DLNAControlPoint.h:302
void setReference(void *ref)
Attach an opaque reference pointer (optional, for caller context)
Definition: DLNAControlPoint.h:250
void onNotification(std::function< void(void *reference, const char *sid, const char *varName, const char *newValue)> cb)
Register a callback that will be invoked for incoming event notification.
Definition: DLNAControlPoint.h:242
Attributes needed for the DLNA Service Definition.
Definition: DLNAServiceInfo.h:16
Simple API to process get, put, post, del http requests I tried to use Arduino HttpClient,...
Definition: HttpRequest.h:21
Abstract Interface for UDP API.
Definition: IUDPService.h:34
void log(DlnaLogLevel current_level, const char *fmt...)
Print log message.
Definition: Logger.h:40
A simple wrapper to provide string functions on char*. If the underlying char* is a const we do not a...
Definition: StrView.h:19
Vector implementation which provides the most important methods as defined by std::vector....
Definition: Vector.h:21
Definition: Allocator.h:6
LoggerClass DlnaLogger
Definition: Logger.cpp:5