|
Arduino DLNA Server
|
Minimal Digital Media Server implementation. More...
#include <MediaServer.h>


Public Types | |
| typedef void(* | PrepareDataCallback) (const char *objectID, const char *browseFlag, const char *filter, int startingIndex, int requestedCount, const char *sortCriteria, int &numberReturned, int &totalMatches, int &updateID, void *reference) |
| typedef bool(* | GetDataCallback) (int index, MediaItem &item, void *reference) |
Public Member Functions | |
| MediaServer () | |
| ~MediaServer () | |
| void | end () |
| void | setupServices (HttpServer &server, IUDPService &udp) |
| to be implemented by subclasses | |
| void | setPrepareDataCallback (PrepareDataCallback cb) |
| Sets the PrepareData callback. | |
| void | setGetDataCallback (GetDataCallback cb) |
| Sets the GetData callback. | |
| void | setReference (void *ref) |
| Sets a user reference pointer, available in callbacks. | |
| HttpServer * | getHttpServer () |
| Provides access to the http server. | |
Public Member Functions inherited from tiny_dlna::DLNADeviceInfo | |
| DLNADeviceInfo (bool ok=true) | |
| ~DLNADeviceInfo () | |
| virtual bool | begin () |
| Override to initialize the device. | |
| void | print (Print &out) |
| renderes the device xml | |
| void | setDeviceType (const char *st) |
| const char * | getDeviceType () |
| void | setUDN (const char *id) |
| Define the udn uuid. | |
| const char * | getUDN () |
| Provide the udn uuid. | |
| void | setBaseURL (const char *url) |
| Defines the base url. | |
| void | setBaseURL (IPAddress ip, int port, const char *path="") |
| Defines the base URL. | |
| const char * | getBaseURL () |
| Provides the base url. | |
| Url & | getDeviceURL () |
| This method returns base url/device.xml. | |
| void | setIPAddress (IPAddress address) |
| Defines the local IP address. | |
| IPAddress | getIPAddress () |
| Provides the local IP address. | |
| const char * | getIPStr () |
| Provides the local address as string. | |
| void | setNS (const char *ns) |
| const char * | getNS () |
| void | setFriendlyName (const char *name) |
| const char * | getFriendlyName () |
| void | setManufacturer (const char *man) |
| const char * | getManufacturer () |
| void | setManufacturerURL (const char *url) |
| const char * | getManufacturerURL () |
| void | setModelDescription (const char *descr) |
| const char * | getModelDescription () |
| void | setModelName (const char *name) |
| const char * | getModelName () |
| void | setModelNumber (const char *number) |
| const char * | getModelNumber () |
| void | setSerialNumber (const char *sn) |
| const char * | getSerialNumber () |
| void | setUniveralProductCode (const char *upc) |
| const char * | getUniveralProductCode () |
| void | addService (DLNAServiceInfo s) |
| Adds a service defintion. | |
| DLNAServiceInfo & | getService (const char *id) |
| Finds a service definition by name. | |
| Vector< DLNAServiceInfo > & | getServices () |
| void | clear () |
| void | clearIcons () |
| Overwrite the default icon. | |
| void | addIcon (Icon icon) |
| Icon | getIcon (int idx=0) |
| operator bool () | |
| void | updateTimestamp () |
| Update the timestamp. | |
| uint32_t | getTimestamp () |
| Returns the time when this object has been updated. | |
| void | setActive (bool flag) |
| virtual void | loop () |
Protected Member Functions | |
| void | setupServicesImpl (HttpServer *server) |
Protected Member Functions inherited from tiny_dlna::DLNADeviceInfo | |
| virtual void | setupServices (HttpServer &server, IUDPService &udp) |
| to be implemented by subclasses | |
| size_t | printRoot () |
| size_t | printDevice () |
| size_t | printSpecVersion () |
| size_t | printServiceList () |
| size_t | printService (void *srv) |
| size_t | printIconList () |
| size_t | printIconDlnaInfo (Icon &icon) |
Static Protected Member Functions | |
| static const char * | replyTemplate () |
| static void | contentDirectoryControlCB (HttpServer *server, const char *requestPath, HttpRequestHandlerLine *hl) |
| static void | writeEscapedText (Print &out, const char *s) |
| static void | streamReplyCallback (Print &out) |
| static void | buildEscapedDIDL (Print &out, GetDataCallback get_data_cb, int count) |
| static void | connmgrControlCB (HttpServer *server, const char *requestPath, HttpRequestHandlerLine *hl) |
Protected Attributes | |
| const char * | st = "urn:schemas-upnp-org:device:MediaServer:1" |
| const char * | usn = "uuid:media-server-0000-0000-0000-000000000001" |
| PrepareDataCallback | prepare_data_cb = nullptr |
| GetDataCallback | get_data_cb = nullptr |
| HttpServer * | p_server = nullptr |
| void * | reference_ = nullptr |
Protected Attributes inherited from tiny_dlna::DLNADeviceInfo | |
| uint64_t | timestamp = 0 |
| bool | is_active = true |
| XMLPrinter | xml |
| Url | device_url |
| IPAddress | localhost |
| int | version_major = 1 |
| int | version_minor = 0 |
| const char * | base_url = "http://localhost:9876/dlna" |
| const char * | udn = "uuid:09349455-2941-4cf7-9847-0dd5ab210e97" |
| const char * | ns = "xmlns=\"urn:schemas-upnp-org:device-1-0\"" |
| const char * | device_type = nullptr |
| const char * | friendly_name = nullptr |
| const char * | manufacturer = nullptr |
| const char * | manufacturer_url = nullptr |
| const char * | model_description = nullptr |
| const char * | model_name = nullptr |
| const char * | model_url = nullptr |
| const char * | model_number = nullptr |
| const char * | serial_number = nullptr |
| const char * | universal_product_code = nullptr |
| Icon | icon |
| Vector< DLNAServiceInfo > | services |
| Vector< Icon > | icons |
| Str | url_str |
Static Protected Attributes | |
| static GetDataCallback | g_stream_get_data_cb = nullptr |
| static int | g_stream_numberReturned = 0 |
| static int | g_stream_totalMatches = 0 |
| static int | g_stream_updateID = 0 |
| static void * | g_stream_reference = nullptr |
Minimal Digital Media Server implementation.
This class implements a lightweight DLNA MediaServer device with a ContentDirectory service (Browse) and a ConnectionManager service.
The API is designed for embedding custom content lists and streaming logic. Instead of a single browse callback, the API now uses two callbacks:
A user reference pointer can be set with setReference(void*), and is passed to both callbacks for custom context or data.
Example usage:
The implementation is intentionally compact and suitable as a starting point for embedded or test DLNA servers.
| typedef bool(* tiny_dlna::MediaServer::GetDataCallback) (int index, MediaItem &item, void *reference) |
| typedef void(* tiny_dlna::MediaServer::PrepareDataCallback) (const char *objectID, const char *browseFlag, const char *filter, int startingIndex, int requestedCount, const char *sortCriteria, int &numberReturned, int &totalMatches, int &updateID, void *reference) |
|
inline |
|
inline |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inline |
|
inline |
Provides access to the http server.
|
inlinestaticprotected |
generic SOAP reply template with placeholders: %1 = ActionResponse, %2 = ServiceName, %3 = inner payload
|
inline |
Sets the GetData callback.
|
inline |
Sets the PrepareData callback.
|
inline |
Sets a user reference pointer, available in callbacks.
|
inlinevirtual |
to be implemented by subclasses
Reimplemented from tiny_dlna::DLNADeviceInfo.
|
inlineprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
inlinestaticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |