net.sf.bt747.loc
Class LocationSender

java.lang.Object
  extended by net.sf.bt747.loc.LocationSender
All Implemented Interfaces:
ModelListener
Direct Known Subclasses:
HttpLocationSender

public abstract class LocationSender
extends java.lang.Object
implements ModelListener


Constructor Summary
LocationSender(Model m)
          Create and answer a new instance of LocationSender.
 
Method Summary
 java.lang.String getBluetoothAdress()
           
 java.lang.String getLastError()
          Chekc for the las occured error due to communication problems.
 int getUpdatePeriod()
           
 boolean isDisabled()
          Check whether this instance is disabled due to fatal errors.
 void modelEvent(ModelEvent e)
           
 void notifyConnectionFailure(java.lang.String reason)
          Callback method to be used by a BT747HttpSender (or other similar service class) which is asynchronously doing its work.
 void notifyFatalFailure(java.lang.String reason)
          Callback method to be used by a BT747HttpSender (or other similar service class) which is asynchronously doing its work.
 void notifySuccess()
          Callback method to be used by a BT747HttpSender (or other similar service class) which is asynchronously doing its work.
 void setBluetoothAdress(java.lang.String addr)
           
 void setDisabled(boolean disabled)
          Set or reset the disabled flag of this instance.
 void setUpdatePeriod(int updatePeriod)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocationSender

public LocationSender(Model m)
Create and answer a new instance of LocationSender.

Parameters:
m - Model The Model that this instance will belong to
Method Detail

modelEvent

public void modelEvent(ModelEvent e)
Specified by:
modelEvent in interface ModelListener

getUpdatePeriod

public int getUpdatePeriod()

setUpdatePeriod

public void setUpdatePeriod(int updatePeriod)

getBluetoothAdress

public java.lang.String getBluetoothAdress()

setBluetoothAdress

public void setBluetoothAdress(java.lang.String addr)

isDisabled

public boolean isDisabled()
Check whether this instance is disabled due to fatal errors.

Returns:
true if the instance is disabled.

setDisabled

public void setDisabled(boolean disabled)
Set or reset the disabled flag of this instance.

Parameters:
disabled - boolean If true the the instance will be disabled, if false the instance is not disabled.

getLastError

public java.lang.String getLastError()
Chekc for the las occured error due to communication problems.

Returns:
String The last reported error.

notifyFatalFailure

public void notifyFatalFailure(java.lang.String reason)
Callback method to be used by a BT747HttpSender (or other similar service class) which is asynchronously doing its work.
This method is called when the BT747HttpSender or other similar service class reports a fatal failure which requires stopping the sending completely like when an URL cannot be prepared from the parameters. The instance will the set itself as being disabled.

Parameters:
reason - String An error message

notifyConnectionFailure

public void notifyConnectionFailure(java.lang.String reason)
Callback method to be used by a BT747HttpSender (or other similar service class) which is asynchronously doing its work.
This method is called when the BT747HttpSender or similar service class reports a failure accessing the target server which does not require stopping the sending process. A reason may be that the target server is not availabale. Repeated failures should stop the sending process also to save network bandwidth. This is not done however in this class but may be implemented externally.

Parameters:
reason - String An error message

notifySuccess

public void notifySuccess()
Callback method to be used by a BT747HttpSender (or other similar service class) which is asynchronously doing its work.
This method is called when the BT747HttpSender or similar service class reports a successful communication to the target server. Success is for example getting a positive http response code from the targt server after sending the data.
This information may be used to provide visual feedback of the communication to the user.