DIscovery And Launch (DIAL)

Introduction

DIAL—for DIscovery And Launch—is a simple protocol that second-screen devices can use to discover and launch apps on first-screen devices. For example, your can stream a video from your embedded device on your connected TV.

Using

  1. Add COMPONENT_DEPENDS += DIAL to your application componenent.mk file.

  2. Add these lines to your application:

    #include <Dial/Client.h>
    
    static UPnP::ControlPoint controlPoint;
    static Dial::Client* myClient;
    
    // Call when IP address has been obtained
    void onIp(IpAddress ip, IpAddress mask, IpAddress gateway)
    {
       // ...
    
       /* Use UPnP to auto-discover all DIAL-enabled servers */
       Dial::discover(controlPoint, [](Dial::Client& client) {
          // Are we looking for a specific device? Can match on friendlyName, UDN, etc.
          if(client.friendlyName() == F("FriendlyNameToFind")) {
             // Take a reference to the device
             myClient = &client;
    
             // Get an app and do something...
             auto& app = myClient->getApp("YouTube");
    
             // Keep this device
             return true;
          }
    
          // Don't want this device, destroy it
          return false;
       });
    
       // ...
    }
    

See the Control your DIAL-enabled smart monitor/TV using Sming sample application.

API Documentation

namespace Dial

Functions

bool discover(UPnP::ControlPoint &controlPoint, Client::Discovered callback)
class App
#include <App.h>
class Client : public UPnP::DeviceControl
#include <Client.h>

Public Functions

App &getApp(const String &applicationId)

Get application object by name.

Parameters

applicationId – the unique application. A list of registered ids can be found here: http://www.dial-multiscreen.org/dial-registry/namespace-database#TOC-Registered-Names

Returns

App& – Application object reference

virtual void onConnected(HttpConnection &connection) override

Inherited classes may override this to pull out any additional information from received response headers, etc. Invoked after description has been processed.

References

Used by

SoC support

  • esp32

  • esp32c3

  • esp32s2

  • esp32s3

  • esp8266

  • host

  • rp2040