Documentation ¶
Overview ¶
Package dial implements a basic DIAL (DIscovery And Launch) client. See http://www.dial-multiscreen.org/
Index ¶
Constants ¶
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AppInfo ¶
type AppInfo struct { Name string `xml:"name"` // State valid values are: // - running: the application is installed and either starting or running; // - stopped: the application is installed and not running; // - installable=<URL>: the application is not installed but is // available for installation by sending an HTTP GET request to the // provided URL; // - hidden: the application is running but is not visible to the user; // // any other value is invalid and should be ignored. State string `xml:"state"` Options struct { // AllowStop true indicates that the application can be stopped // (if running) sending an HTTP DELETE request to Link.Href. AllowStop bool `xml:"allowStop,attr"` } `xml:"options"` // Link is included when the application is running and can be stopped // using a DELETE request. Link struct { // Rel is always "run". Rel string `xml:"rel,attr"` // Href contains instance URL of the running application. Href string `xml:"href,attr"` } `xml:"link"` Additional struct { // Additional.Data contains zero or more (dynamic) XML elements // specific to the application. Data string `xml:",innerxml"` } `xml:"additionalData"` }
AppInfo contains information about an application on a specific Device.
type Device ¶
type Device struct { UniqueServiceName string // UniqueServiceName from the ssdpService. Location string // Location from the ssdpService. ApplicationUrl string // base DIAL REST service url. FriendlyName string // UPnP friendlyName field of the device description. Wakeup Wakeup // WAKEUP header values from the ssdpService (if available). // contains filtered or unexported fields }
Device is a DIAL server device discovered on the network.
func (*Device) GetAppInfo ¶
GetAppInfo returns information about an application on the Device. appName should be an application name registered in the DIAL Registry. origin (if present) will be passed as Origin HTTP header.
func (*Device) Hostname ¶ added in v0.2.0
Hostname returns the Device's hostname extracted from ApplicationUrl.
func (*Device) Launch ¶
Launch launches (starts) an application on the Device and returns its instance url (if available). appName should be an application name registered in the DIAL Registry. origin (if present) will be passed as Origin HTTP header. payload (if present) will be passed as HTTP message body with Content-Type: text/plain; charset=utf-8 header.
func (*Device) SetLocalAddr ¶ added in v1.4.0
SetLocalAddr sets the local address the Device instance must use for network operations.
func (*Device) TryWakeup ¶
TryWakeup tries to Wake-On-Lan the Device sending magic packets to its MAC address and waiting for it to become available. It eventually updates Location and ApplicationUrl (re-Discover) because the Device may have changed ip address and/or service ports. Returns nil if it successfully wakes up the Device.
type Wakeup ¶
type Wakeup struct { Mac string // MAC address of the device's wired or wireless network interface. Timeout time.Duration // estimated upper bound of the duration needed to wake the device and start its DIAL server. }
Wakeup contains values of WAKEUP header from the ssdpService that can be used to WoL or WoWLAN the device.