tourguide
Class ServiceLogic

java.lang.Object
  extended bytourguide.ServiceLogic

public class ServiceLogic
extends java.lang.Object

Implements the main logic flow of the service. Uses Ericsson NRG SDK (Parlay/OSA) objects to interact with a Parlay gateway.


Constructor Summary
ServiceLogic()
          Creates PointsOfInterest object.
 
Method Summary
 void locationReceived(java.lang.String user, float latitude, float longitude)
          Creates and sends MMS with the location map.
 void setGui(AdminGui ag)
          Registers a GUI reference for future status updates.
 void showStatus()
          Used to update a status field on the screen.
 void smsReceived(java.lang.String user, java.lang.String receiver, java.lang.String SMSContent)
          Requests the location of the SMS sender.
 void start(int n)
          Activates the service by requesting SMS notifications from the Parlay gateway.
 boolean startEnabled()
          Validates that the service can be started.
 void stop()
          Deactivates the service by stopping the SMS notifications.
 boolean stopEnabled()
          Validates that the service can be stopped.
 void terminate()
          Terminates the TourGuide service.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServiceLogic

public ServiceLogic()
Creates PointsOfInterest object. Does not access NRG yet.

Method Detail

locationReceived

public void locationReceived(java.lang.String user,
                             float latitude,
                             float longitude)
Creates and sends MMS with the location map. Invoked from LocationProcessor.

Parameters:
user - the SMS sender number (the MMS destination)
latitude - the location latitude
longitude - the location longitude
See Also:
LocationProcessor.extendedLocationReportRes(int, com.ericsson.hosasdk.api.mm.TpUserLocationExtended[]), PointsOfInterest.createMimeContent(double, double, int, int), MMSProcessor.sendMMS(java.lang.String, java.lang.String, byte[], java.lang.String)

setGui

public void setGui(AdminGui ag)
Registers a GUI reference for future status updates. Invoked from the TourGuide constructor.

Parameters:
ag - AdminGui object reference.

showStatus

public void showStatus()
Used to update a status field on the screen. Invoked during NRG callbacks.


smsReceived

public void smsReceived(java.lang.String user,
                        java.lang.String receiver,
                        java.lang.String SMSContent)
Requests the location of the SMS sender. Invoked from SMSProcessor.

Parameters:
user - the SMS sender number (the origination address)
receiver - this service number (the destination address, ignored)
SMSContent - the SMS content (ignored)
See Also:
SMSProcessor.reportNotification(com.ericsson.hosasdk.api.ui.TpUIIdentifier, com.ericsson.hosasdk.api.ui.TpUIEventInfo, int)

start

public void start(int n)
Activates the service by requesting SMS notifications from the Parlay gateway. Initializes NRG (Parlay) access on the first call.

Parameters:
n - the service SMS number.

startEnabled

public boolean startEnabled()
Validates that the service can be started. Invoked from AdminGui to obtain the correct state for the Start button.

Returns:
true when the start operation is valid

stop

public void stop()
Deactivates the service by stopping the SMS notifications.


stopEnabled

public boolean stopEnabled()
Validates that the service can be stopped. Invoked from AdminGui to obtain the correct state for the Stop button.

Returns:
true when the stop operation is valid

terminate

public void terminate()
Terminates the TourGuide service. Invoked from AdminGui.