org.apache.felix.upnp.sample.tv
Class TvDevice

java.lang.Object
  extended by org.apache.felix.upnp.sample.tv.TvDevice
All Implemented Interfaces:
EventListener, ServiceListener, UPnPDevice, UPnPEventListener

public class TvDevice
extends Object
implements UPnPDevice, UPnPEventListener, ServiceListener


Field Summary
 
Fields inherited from interface org.osgi.service.upnp.UPnPDevice
CHILDREN_UDN, DEVICE_CATEGORY, FRIENDLY_NAME, ID, MANUFACTURER, MANUFACTURER_URL, MATCH_GENERIC, MATCH_MANUFACTURER_MODEL, MATCH_MANUFACTURER_MODEL_REVISION, MATCH_MANUFACTURER_MODEL_REVISION_SERIAL, MATCH_TYPE, MODEL_DESCRIPTION, MODEL_NAME, MODEL_NUMBER, MODEL_URL, PARENT_UDN, PRESENTATION_URL, SERIAL_NUMBER, TYPE, UDN, UPC, UPNP_EXPORT
 
Fields inherited from interface org.osgi.service.upnp.UPnPEventListener
UPNP_FILTER
 
Constructor Summary
TvDevice()
           
 
Method Summary
 void doSubscribe()
           
 String getAirconTempture()
           
 String getClockTime()
           
 Component getComponent()
           
 Dictionary getDescriptions(String locale)
          Get a set of localized UPnP properties.
 UPnPIcon[] getIcons(String locale)
          Lists all icons for this device in a given locale.
 String getMessage()
           
 UPnPService getService(String serviceId)
          Locates a specific service by its service id.
 UPnPService[] getServices()
          Lists all services provided by this device.
 boolean isOn()
           
 void notifyUPnPEvent(String deviceId, String serviceId, Dictionary events)
          Callback method that is invoked for received events.
 void off()
           
 void on()
           
 void serviceChanged(ServiceEvent event)
          Receives notification that a service has had a lifecycle change.
 void setComponent(Component comp)
           
 void setMessage(String msg)
           
 void start()
           
 void stop()
           
 void undoSubscribe()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TvDevice

public TvDevice()
Method Detail

getService

public UPnPService getService(String serviceId)
Description copied from interface: UPnPDevice
Locates a specific service by its service id.

Specified by:
getService in interface UPnPDevice
Parameters:
serviceId - The service id
Returns:
The requested service or null if not found.

getServices

public UPnPService[] getServices()
Description copied from interface: UPnPDevice
Lists all services provided by this device.

Specified by:
getServices in interface UPnPDevice
Returns:
Array of services or null if no services are available.

getIcons

public UPnPIcon[] getIcons(String locale)
Description copied from interface: UPnPDevice
Lists all icons for this device in a given locale. The UPnP specification allows a device to present different icons based on the client's locale.

Specified by:
getIcons in interface UPnPDevice
Parameters:
locale - A language tag as defined by RFC 1766 and maintained by ISO 639. Examples include "de", "en" or " en-US". The default locale of the device is specified by passing a null argument.
Returns:
Array of icons or null if no icons are available.

getDescriptions

public Dictionary getDescriptions(String locale)
Description copied from interface: UPnPDevice
Get a set of localized UPnP properties. The UPnP specification allows a device to present different device properties based on the client's locale. The properties used to register the UPnPDevice service in the OSGi registry are based on the device's default locale. To obtain a localized set of the properties, an application can use this method.

Not all properties might be available in all locales. This method does not substitute missing properties with their default locale versions.

Specified by:
getDescriptions in interface UPnPDevice
Parameters:
locale - A language tag as defined by RFC 1766 and maintained by ISO 639. Examples include "de", "en" or " en-US". The default locale of the device is specified by passing a null argument.
Returns:
Dictionary mapping property name Strings to property value Strings

setComponent

public void setComponent(Component comp)

getComponent

public Component getComponent()

on

public void on()

isOn

public boolean isOn()

off

public void off()

getClockTime

public String getClockTime()

getAirconTempture

public String getAirconTempture()

setMessage

public void setMessage(String msg)

getMessage

public String getMessage()

doSubscribe

public void doSubscribe()

undoSubscribe

public void undoSubscribe()

notifyUPnPEvent

public void notifyUPnPEvent(String deviceId,
                            String serviceId,
                            Dictionary events)
Description copied from interface: UPnPEventListener
Callback method that is invoked for received events. The events are collected in a Dictionary object. Each entry has a String key representing the event name (= state variable name) and the new value of the state variable. The class of the value object must match the class specified by the UPnP State Variable associated with the event. This method must be called asynchronously

Specified by:
notifyUPnPEvent in interface UPnPEventListener
Parameters:
deviceId - ID of the device sending the events
serviceId - ID of the service sending the events
events - Dictionary object containing the new values for the state variables that have changed.

start

public void start()

stop

public void stop()

serviceChanged

public void serviceChanged(ServiceEvent event)
Description copied from interface: ServiceListener
Receives notification that a service has had a lifecycle change.

Specified by:
serviceChanged in interface ServiceListener
Parameters:
event - The ServiceEvent object.


Copyright © 2011 Apache Software Foundation. All Rights Reserved.