public class SystemActivityNotificationsServiceImpl extends java.lang.Object implements SystemActivityNotifications.NotificationsDelegate, SystemActivityNotificationsService, java.lang.Runnable
Constructor and Description |
---|
SystemActivityNotificationsServiceImpl() |
Modifier and Type | Method and Description |
---|---|
void |
addIdleSystemChangeListener(long idleTime,
SystemActivityChangeListener listener)
Registers a listener that would be notified for idle of the system
for idleTime.
|
void |
addSystemActivityChangeListener(SystemActivityChangeListener listener)
Registers a listener that would be notified of changes that have occurred
in the underlying system.
|
protected void |
fireSystemActivityEvent(SystemActivityEvent evt)
Delivers the specified event to all registered listeners.
|
protected void |
fireSystemIdleEndEvent(SystemActivityChangeListener listener)
Delivers the specified event to listener.
|
protected void |
fireSystemIdleEvent(SystemActivityChangeListener listener)
Delivers the specified event to all registered listeners.
|
long |
getTimeSinceLastInput()
The time since last user input.
|
boolean |
isSupported(int eventID)
Can check whether an event id is supported on
current operation system.
|
void |
notify(int type)
Callback method when receiving notifications.
|
void |
notifyNetworkChange(int family,
long luidIndex,
java.lang.String name,
long type,
boolean connected)
Callback method when receiving special network notifications.
|
void |
removeIdleSystemChangeListener(SystemActivityChangeListener listener)
Remove the specified listener so that it won't receive further
notifications for idle system.
|
void |
removeSystemActivityChangeListener(SystemActivityChangeListener listener)
Remove the specified listener so that it won't receive further
notifications of changes that occur in the underlying system
|
void |
run()
The thread run method that handles idle notifies.
|
void |
start()
Init and start notifications.
|
void |
stop()
Stop notifications.
|
public SystemActivityNotificationsServiceImpl()
public void start()
public void stop()
public void addSystemActivityChangeListener(SystemActivityChangeListener listener)
addSystemActivityChangeListener
in interface SystemActivityNotificationsService
listener
- the listener that we'd like to register for changes in
the underlying system.public void removeSystemActivityChangeListener(SystemActivityChangeListener listener)
removeSystemActivityChangeListener
in interface SystemActivityNotificationsService
listener
- the listener to remove.public void addIdleSystemChangeListener(long idleTime, SystemActivityChangeListener listener)
addIdleSystemChangeListener
in interface SystemActivityNotificationsService
idleTime
- the time in milliseconds after which we will consider
system to be idle. This doesn't count when system seems idle as
monitor is off or screensaver is on, or desktop is locked.listener
- the listener that we'd like to register for changes in
the underlying system.public void removeIdleSystemChangeListener(SystemActivityChangeListener listener)
removeIdleSystemChangeListener
in interface SystemActivityNotificationsService
listener
- the listener to remove.public long getTimeSinceLastInput()
getTimeSinceLastInput
in interface SystemActivityNotificationsService
public void notify(int type)
notify
in interface SystemActivityNotifications.NotificationsDelegate
type
- type of the notification.public void notifyNetworkChange(int family, long luidIndex, java.lang.String name, long type, boolean connected)
notifyNetworkChange
in interface SystemActivityNotifications.NotificationsDelegate
family
- family of network change (ipv6, ipv4)
AF_UNSPEC = 0 (The address family is unspecified.)
AF_INET = 2 (The Internet Protocol version 4 (IPv4) address family)
AF_INET6 = 23 (The Internet Protocol version 6 (IPv6) address family)luidIndex
- unique index of interfacename
- name of the interfacetype
- of the interface
Possible values for the interface type are listed in the Ipifcons.h file.
common values:
IF_TYPE_OTHER = 1 (Some other type of network interface.)
IF_TYPE_ETHERNET_CSMACD = 6 (An Ethernet network interface.)
IF_TYPE_ISO88025_TOKENRING = 9 (A token ring network interface.)
IF_TYPE_PPP = 23 (A PPP network interface.)
IF_TYPE_SOFTWARE_LOOPBACK = 24 (A software loopback network interface.)
IF_TYPE_IEEE80211 = 71 (An IEEE 802.11 wireless network interface.)
IF_TYPE_TUNNEL = 131 (A tunnel type encapsulation network interface.)
IF_TYPE_IEEE1394 = 144 (An IEEE 1394 (Firewire) high performance
serial bus network interface.)connected
- whether interface is connected or not.public void run()
run
in interface java.lang.Runnable
Thread.run()
protected void fireSystemActivityEvent(SystemActivityEvent evt)
evt
- the SystemActivityEvent that we'd like delivered to
all registered message listeners.protected void fireSystemIdleEvent(SystemActivityChangeListener listener)
listener
- listener to informprotected void fireSystemIdleEndEvent(SystemActivityChangeListener listener)
listener
- listener to informpublic boolean isSupported(int eventID)
isSupported
in interface SystemActivityNotificationsService
eventID
- the event to check.
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.