|
Arduino DLNA Server
|
Helper class to control/query a MediaServer from a control point. More...
#include <DLNAControlPointMediaServer.h>
Public Types | |
| typedef void(* | XMLCallback) (const char *name, const char *test, const char *attributes) |
| typedef void(* | NotificationCallback) (void *reference, const char *sid, const char *varName, const char *newValue) |
Public Member Functions | |
| DLNAControlPointMediaServer ()=default | |
| Default constructor. | |
| DLNAControlPointMediaServer (DLNAControlPoint &mgr, DLNAHttpRequest &http, IUDPService &udp) | |
| Construct helper with references to control point manager and required transport instances (HTTP for subscribe callbacks and UDP for SSDP discovery) | |
| void | setDLNAControlPoint (DLNAControlPoint &m) |
| Set the control point manager instance (required before using helper) | |
| bool | begin (uint32_t minWaitMs=3000, uint32_t maxWaitMs=60000) |
| Begin discovery and processing (forwards to underlying control point) | |
| void | setHttp (DLNAHttpRequest &http) |
| Setter for the HTTP wrapper used for subscriptions and callbacks. | |
| void | setUdp (IUDPService &udp) |
| Setter for UDP service used for discovery (SSDP) | |
| int | getDeviceCount () |
| Return number of discovered devices known to the control point. | |
| const ActionReply & | getLastReply () const |
| Return the ActionReply from the last synchronous request. | |
| void | setDeviceIndex (int idx) |
| Select a device by index (0-based) for subsequent actions. By default 0 is used. | |
| void | setSubscribeNotificationsActive (bool flag) |
| Activate/deactivate subscription notifications. | |
| void | setDeviceTypeFilter (const char *filter) |
| Restrict this helper to devices of the given device type. | |
| void | setReference (void *ref) |
| Attach an opaque reference pointer passed to callbacks. | |
| bool | browse (int startingIndex, int requestedCount, ContentQueryType queryType, XMLCallback XMLCallback, int &numberReturned, int &totalMatches, int &updateID) |
| Browse the given object_id and invoke callback for each returned xml element. | |
| bool | search (int startingIndex, int requestedCount, XMLCallback XMLCallback, int &numberReturned, int &totalMatches, int &updateID, const char *searchCriteria="", const char *filter="", const char *sortCriteria="") |
| Search the ContentDirectory using SearchCriteria and invoke callback for each returned xml element. | |
| int | getSystemUpdateID () |
| Get current SystemUpdateID for the ContentDirectory. | |
| const char * | getSearchCapabilities () |
| Get the ContentDirectory SearchCapabilities string. | |
| const char * | getSortCapabilities () |
| Get the ContentDirectory SortCapabilities string. | |
| const char * | getProtocolInfo () |
| Query ConnectionManager:GetProtocolInfo. | |
| void | setObjectID (const char *id) |
| Set the object id used for browse operations (default: "0") | |
| const char * | getObjectID () const |
| Return the current object id used for browse. | |
Protected Member Functions | |
| DLNAServiceInfo & | selectService (const char *id) |
| Select service by id. | |
| ActionRequest & | createBrowseAction (DLNAServiceInfo &svc, ContentQueryType queryType, int startingIndex, int requestedCount) |
| Build a Browse ActionRequest. | |
| ActionRequest & | createSearchAction (DLNAServiceInfo &svc, const char *searchCriteria, const char *filter, int startingIndex, int requestedCount, const char *sortCriteria) |
| Build a Search ActionRequest. | |
| void | parseNumericFields (ActionReply &reply, int &numberReturned, int &totalMatches, int &updateID) |
| Parse numeric result fields from an ActionReply. | |
Static Protected Member Functions | |
| static void | processNotification (void *reference, const char *sid, const char *varName, const char *newValue) |
| Notification callback: just log for now. | |
Protected Attributes | |
| DLNAControlPoint * | p_mgr = nullptr |
| const char * | device_type_filter_default |
| const char * | device_type_filter = device_type_filter_default |
| ActionReply | last_reply |
| StringRegistry | strings |
| void * | reference = nullptr |
| const char * | object_id = "0" |
| DLNAHttpRequest * | p_http = nullptr |
| IUDPService * | p_udp = nullptr |
Helper class to control/query a MediaServer from a control point.
Provides convenient wrappers around common ContentDirectory and ConnectionManager actions (Browse, GetSystemUpdateID, GetSearchCapabilities, GetProtocolInfo). Methods are synchronous and return boolean success or populate output parameters.
| typedef void(* tiny_dlna::DLNAControlPointMediaServer::NotificationCallback) (void *reference, const char *sid, const char *varName, const char *newValue) |
| typedef void(* tiny_dlna::DLNAControlPointMediaServer::XMLCallback) (const char *name, const char *test, const char *attributes) |
|
default |
Default constructor.
|
inline |
Construct helper with references to control point manager and required transport instances (HTTP for subscribe callbacks and UDP for SSDP discovery)
| mgr | Reference to DLNAControlPointMgr used to send actions and manage discovery/subscriptions |
| http | Http server wrapper used for subscription callbacks |
| udp | UDP service used for SSDP discovery |
|
inline |
Begin discovery and processing (forwards to underlying control point)
| minWaitMs | Minimum time in milliseconds to wait before returning |
| maxWaitMs | Maximum time in milliseconds to wait for discovery |
|
inline |
Browse the given object_id and invoke callback for each returned xml element.
| startingIndex | Starting index for the browse request |
| requestedCount | Number of items requested |
| XMLCallback | Callback invoked per MediaItem result (may be nullptr) |
| numberReturned | Output: number of items returned by server |
| totalMatches | Output: total matches available on server |
| updateID | Output: server UpdateID |
| browseFlag | Optional BrowseFlag (defaults to BrowseDirectChildren) |
|
inlineprotected |
Build a Browse ActionRequest.
|
inlineprotected |
Build a Search ActionRequest.
|
inline |
Return number of discovered devices known to the control point.
|
inline |
Return the ActionReply from the last synchronous request.
|
inline |
Return the current object id used for browse.
|
inline |
Query ConnectionManager:GetProtocolInfo.
|
inline |
Get the ContentDirectory SearchCapabilities string.
|
inline |
Get the ContentDirectory SortCapabilities string.
|
inline |
Get current SystemUpdateID for the ContentDirectory.
|
inlineprotected |
Parse numeric result fields from an ActionReply.
|
inlinestaticprotected |
Notification callback: just log for now.
|
inline |
Search the ContentDirectory using SearchCriteria and invoke callback for each returned xml element.
| startingIndex | Starting index for the search request |
| requestedCount | Number of items requested |
| XMLCallback | Callback invoked per MediaItem result (may be nullptr) |
| numberReturned | Output: number of items returned by server |
| totalMatches | Output: total matches available on server |
| updateID | Output: server UpdateID |
| searchCriteria | Search criteria string as defined by ContentDirectory |
| filter | Optional Filter argument (defaults to empty string) |
| sortCriteria | Optional SortCriteria (defaults to empty string) |
|
inlineprotected |
Select service by id.
|
inline |
Select a device by index (0-based) for subsequent actions. By default 0 is used.
| idx | Device index |
|
inline |
Restrict this helper to devices of the given device type.
| filter | Device type string (e.g. "urn:schemas-upnp-org:device:MediaServer:1") Pass nullptr to restore the default filter |
|
inline |
Set the control point manager instance (required before using helper)
|
inline |
Setter for the HTTP wrapper used for subscriptions and callbacks.
|
inline |
Set the object id used for browse operations (default: "0")
| id | C-string object id |
|
inline |
Attach an opaque reference pointer passed to callbacks.
| ref | Opaque user pointer |
|
inline |
Activate/deactivate subscription notifications.
|
inline |
Setter for UDP service used for discovery (SSDP)
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |