org.ocap.hn
Class DeviceEvent

java.lang.Object
  extended by java.util.EventObject
      extended by org.ocap.hn.DeviceEvent
All Implemented Interfaces:
Serializable

public class DeviceEvent
extends EventObject

Represents a Device Event. There are two types of Device events: one that is generated by the NetManager when a Device is added or removed from the home network. Application may register as a listener to NetManager to receive such events. The other DeviceEvent is generated by the Device itself when its internal state changes. Application should register as a listener with a particular Device for such events. In both scenarios, the Device that was the source of the event is returned.

See Also:
Serialized Form

Field Summary
static int DEVICE_ADDED
          A constant indicating new device is registered to home network.
static int DEVICE_REMOVED
          A constant indicating a device is removed from home network.
static int DEVICE_UPDATED
          A constant indicating a device is updated from home network.
static int STATE_CHANGE
          A constant indicating a device's internal state has changed.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
DeviceEvent(int type, Object source)
          Constructs a DeviceEvent by specifying type and source.
 
Method Summary
 Object getSource()
          Returns device event source, which is always a Device.
 int getType()
          Returns device event type, as defined in DeviceEvent.
 
Methods inherited from class java.util.EventObject
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEVICE_ADDED

public static final int DEVICE_ADDED
A constant indicating new device is registered to home network.

See Also:
Constant Field Values

DEVICE_REMOVED

public static final int DEVICE_REMOVED
A constant indicating a device is removed from home network.

See Also:
Constant Field Values

DEVICE_UPDATED

public static final int DEVICE_UPDATED
A constant indicating a device is updated from home network.

See Also:
Constant Field Values

STATE_CHANGE

public static final int STATE_CHANGE
A constant indicating a device's internal state has changed.

See Also:
Constant Field Values
Constructor Detail

DeviceEvent

public DeviceEvent(int type,
                   Object source)
Constructs a DeviceEvent by specifying type and source.

Parameters:
type - Device change type, allowed type are defined in DeviceEvent
source - Device where the change happens.
Method Detail

getType

public int getType()
Returns device event type, as defined in DeviceEvent.

Returns:
device event type

getSource

public Object getSource()
Returns device event source, which is always a Device.

Overrides:
getSource in class EventObject
Returns:
device event source


Copyright © 2011. All Rights Reserved.