net.java.sip.communicator.plugin.scphone
Class SCPhone

java.lang.Object
  extended by net.java.sip.communicator.plugin.scphone.SCPhone
Direct Known Subclasses:
WinSCPhone

public abstract class SCPhone
extends java.lang.Object

Bring usb phone support to sc.


Field Summary
private  java.util.concurrent.ExecutorService executor
          Thread pooled executor
private static SCPhone scPhone
          Singleton instance of this class
private  javax.swing.event.EventListenerList scPhoneListeners
          Collection of event listeners for the phone.
private  int scPhoneStatus
          Status of the phone
static int STATUS_OFF
          phone device unavailable
static int STATUS_ON
          a phone device is connected and available
 
Constructor Summary
protected SCPhone()
          Don't instantiate, Use SCPhone.getPhone() method instead.
 
Method Summary
 void addSCPhoneListener(SCPhoneListener listener)
          Add a listener to be informed of SCPhone events.
protected  void firePhoneCommandReceived(java.lang.String message)
          Event trigger called when a command is received from the phone.
protected  void firePhoneCommandSent(java.lang.String message)
          Event trigger called when a command is sent and has been received by the phone.
protected  void fireStatusChanged(int newStatus)
          Fire a status change event.
static SCPhone getPhone()
          Initialize the unique singleton of the SCPhone.
 int getStatus()
          Return the status .
 void removeSCPhoneListener(SCPhoneListener listener)
          Remove a listener from the collection of listeners.
protected abstract  void sendCommand(java.lang.String command)
          Send a command message to the phone.
protected  void setStatus(int newValue)
          Set the status.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STATUS_ON

public static final int STATUS_ON
a phone device is connected and available

See Also:
Constant Field Values

STATUS_OFF

public static final int STATUS_OFF
phone device unavailable

See Also:
Constant Field Values

scPhone

private static SCPhone scPhone
Singleton instance of this class


scPhoneStatus

private int scPhoneStatus
Status of the phone


scPhoneListeners

private javax.swing.event.EventListenerList scPhoneListeners
Collection of event listeners for the phone.


executor

private java.util.concurrent.ExecutorService executor
Thread pooled executor

Constructor Detail

SCPhone

protected SCPhone()
Don't instantiate, Use SCPhone.getPhone() method instead.

Method Detail

getPhone

public static SCPhone getPhone()
Initialize the unique singleton of the SCPhone. If this method is called when the phone is already initialized, return the current singleton without any modification.

Returns:
SCPhone The SCPhone singleton used to communicate with the phone device.

setStatus

protected final void setStatus(int newValue)
Set the status.

Parameters:
newValue - The new status.

getStatus

public final int getStatus()
Return the status .

Returns:
status.

sendCommand

protected abstract void sendCommand(java.lang.String command)
Send a command message to the phone.

Parameters:
command - the command message to send.

addSCPhoneListener

public final void addSCPhoneListener(SCPhoneListener listener)
Add a listener to be informed of SCPhone events.

Parameters:
listener - the listener to add.

removeSCPhoneListener

public final void removeSCPhoneListener(SCPhoneListener listener)
Remove a listener from the collection of listeners. The listener will no longer be triggered when a event happens.

Parameters:
listener - The listener to remove.

firePhoneCommandReceived

protected final void firePhoneCommandReceived(java.lang.String message)
Event trigger called when a command is received from the phone.

Parameters:
message - the message that triggered the event.

firePhoneCommandSent

protected void firePhoneCommandSent(java.lang.String message)
Event trigger called when a command is sent and has been received by the phone.

Parameters:
message - the message that has been sent.

fireStatusChanged

protected final void fireStatusChanged(int newStatus)
Fire a status change event.

Parameters:
newStatus - the new status that triggered this event.