This library provides the functionality to implement a UPnP/DLNA device and a control point for Arduino.
The Digital Living Network Alliance (DLNA) aims to establish interoperability among PCs, consumer appliances, and mobile devices across wired and wireless networks. The goal is to provide a common solution for sharing digital media and content services.
Reference documentation can be hard to find. Therefore I am providing some useful links:
- UPnP and UDA Tutorial
- UPnP Device Architecture Tutorial
- UPnP Device Architecture 1.1
- UPnP Device Architecture 2.0
I struggled to choose the right approach to implement this on Arduino. On the desktop, similar functionality can be provided with the following projects:
- pupnp A Portable SDK for UPnP* Devices
- gmrender-resurrect: A headless UPnP/DLNA media renderer based on pupnp
- usahre A UPnP/DLNA media server
This library provides memory-efficient classes to implement DLNA devices and clients (control points).
In addition to the core functionality, this project includes some easy-to-use classes:
- Devices
- MediaRenderer
- MediaServer
- Control Points
- ControlPointMediaRenderer
- ControlPointMediaServer
A DLNA device uses UDP, HTTP, XML and SOAP to discover and manage services, which adds complexity.
I implemented the functionality from scratch using the basic Arduino network API and avoided external dependencies where possible.
The DLNAControlPointMgr sets up a control point and lets you execute actions. The DLNADevice class provides the setup for a basic DLNA device service. Devices are represented by the DLNADeviceInfo class. A device registers itself on the network and answers UDP DLNA queries and requests:
- UDP communication is handled via a Scheduler and a Request Parser.
- HTTP requests are handled with the bundled TinyHttp Server.
- XML service descriptions can be stored as char arrays in progmem or generated dynamically using the XMLPrinter class.
Developing and debugging on a microcontroller is tedious; therefore this project can also be compiled and run on a Linux desktop.