detailed design - uc santa barbara

47
TEAM CYBORG Detailed Design CallWave Android Project Thor Johannesson Shane Zamora Siwei Zhu Alan Baker Albert Winberg 1

Upload: others

Post on 25-Feb-2022

2 views

Category:

Documents


0 download

TRANSCRIPT

TEAM CYBORG

Detailed DesignCallWave Android Project

Thor JohannessonShane Zamora

Siwei ZhuAlan Baker

Albert Winberg

1

Table of Contents

 Table of Contents..........................................................................................................................2

1. Overview                                                                                                                                           .....................................................................................................................................   6  1.1. UI Module                                                                                                                                             .......................................................................................................................................   6  1.2. SyncNotify Module                                                                                                                               .........................................................................................................................   6  1.3. Database Module                                                                                                                                  ............................................................................................................................   7  1.4. Network Module                                                                                                                                   .............................................................................................................................   7  

2. Dependencies                                                                                                                                    ..............................................................................................................................   8  

3. Detailed Class Descriptions                                                                                                             .......................................................................................................   9  3.1. UI                                                                                                                                                           .....................................................................................................................................................   9  

3.1.1. UI State Diagram                                                                                                                             .......................................................................................................................   9  3.1.2. Class Overview                                                                                                                               .........................................................................................................................   9  3.1.3. VoicemailInboxList                                                                                                                       .................................................................................................................   10   

3.1.3.1. Description                                                                                                                                               .........................................................................................................................................   10   3.1.3.2. Methods                                                                                                                                                   .............................................................................................................................................   11   

3.1.3.2.1.  onCreate( Bundle icicle )                                                                                                                ..........................................................................................................   11   3.1.3.2.2. OnCreateOptionsMenu( Menu menu )                                                                                            ......................................................................................   11   3.1.3.2.3. onListItemClick( ListView lv, View v, int Position, long id )                                                        ..................................................   11   3.1.3.2.4. onOptionsItemSelected( Item I )                                                                                                      ................................................................................................   12   3.1.3.2.5. onActivityResult( int requestCode, int resultCode, String data, Bundle extras )                            ......................   12   3.1.3.2.6. onItemSelected( AdapterView parent, View v, int position, long id )                                            ......................................   12   3.1.3.2.7. onNothingSelected( AdapterView parent )                                                                                      ................................................................................   12   3.1.3.2.8. onKeyUp( int keyCode, KeyEvent event )                                                                                      ................................................................................   12   3.1.3.2.9. onClick( View v )                                                                                                                             .......................................................................................................................   12   3.1.3.2.10. InitializeData()                                                                                                                               .........................................................................................................................   12   3.1.3.2.11. RefreshList()                                                                                                                                  ............................................................................................................................   12   3.1.3.2.12. SyncWithServer()                                                                                                                          ....................................................................................................................   13   3.1.3.2.13. DeleteSelected()                                                                                                                             .......................................................................................................................   13   3.1.3.2.14. Reply()                                                                                                                                           .....................................................................................................................................   13   3.1.3.2.15. Options()                                                                                                                                        ..................................................................................................................................   13   3.1.3.2.16. CallSelected()                                                                                                                                 ...........................................................................................................................   13   3.1.3.2.17. ShowDetail( MessageInfoRow r )                                                                                                 ...........................................................................................   13   3.1.3.2.18. SetProblemState( boolean b )                                                                                                        ..................................................................................................   13   

3.1.3.3. XML Layout Dependencies                                                                                                                     ...............................................................................................................   14   3.1.3.3.1.  vlist_dark.xml                                                                                                                                 ...........................................................................................................................   14   3.1.3.3.2. ventry_dark.xml                                                                                                                               .........................................................................................................................   14   

3.1.4. MessageDetailView                                                                                                                      ................................................................................................................   15   3.1.4.1.  Description                                                                                                                                              ........................................................................................................................................   15   3.1.4.2. Methods                                                                                                                                                   .............................................................................................................................................   15   

3.1.4.2.1. onCreate( Bundle icicle )                                                                                                                 ...........................................................................................................   15   

2

3.1.4.2.2. onKeyUp( int keyCode, KeyEvent event )                                                                                      ................................................................................   15   3.1.4.2.3. onClick( View v )                                                                                                                             .......................................................................................................................   16   3.1.4.2.4. Reply()                                                                                                                                             .......................................................................................................................................   16   3.1.4.2.5. NextMessage()                                                                                                                                 ...........................................................................................................................   16   3.1.4.2.6. PrevMessage()                                                                                                                                  ............................................................................................................................   16   3.1.4.2.7. Return()                                                                                                                                            ......................................................................................................................................   16   3.1.4.2.8.  PlaybackBeginning()                                                                                                                       .................................................................................................................   16   3.1.4.2.9. PlayPause()                                                                                                                                      ................................................................................................................................   16   

3.1.5. OptionsView                                                                                                                                 ...........................................................................................................................   17   3.1.5.1.  Description                                                                                                                                              ........................................................................................................................................   17   3.1.5.2.  Methods                                                                                                                                                  ............................................................................................................................................   18   

3.1.5.2.1. InitializeFields()                                                                                                                               .........................................................................................................................   18   3.1.5.2.2. DeleteAll()                                                                                                                                       .................................................................................................................................   18   3.1.5.2.3. GotoMembersPage()                                                                                                                        ..................................................................................................................   18   3.1.5.2.4. ImportContacts()                                                                                                                              ........................................................................................................................   18   3.1.5.2.5. ExportContacts()                                                                                                                              .......................................................................................................................   18   3.1.5.2.6. Cancel()                                                                                                                                            ......................................................................................................................................   18   3.1.5.2.7. Apply()                                                                                                                                             .......................................................................................................................................   18   

3.1.6. ReplyView                                                                                                                                    ..............................................................................................................................   19   3.1.6.1. Description                                                                                                                                               .........................................................................................................................................   19   3.1.6.2. Methods                                                                                                                                                   .............................................................................................................................................   19   

3.1.6.2.1. Constructor( Context c , Long cid )                                                                                                 ...........................................................................................   19   3.1.6.2.2. SetButtonText( Button b, int type )                                                                                                 ...........................................................................................   20   3.1.6.2.3. assignActionText()                                                                                                                           .....................................................................................................................   20   3.1.6.2.4. onClick( View v )                                                                                                                             .......................................................................................................................   20   3.1.6.2.5. dispatchKeyEvent( KeyEvent e )                                                                                                     ...............................................................................................   20   3.1.6.2.6. performAction( int type )                                                                                                                 ...........................................................................................................   20   3.1.6.2.7. CallBack()                                                                                                                                        ..................................................................................................................................   20   3.1.6.2.8. SMSBack()                                                                                                                                       .................................................................................................................................   20   3.1.6.2.9. EmailBack()                                                                                                                                     ...............................................................................................................................   20   3.1.6.2.10. Delete()                                                                                                                                          ....................................................................................................................................   21   3.1.6.2.11. Cancel()                                                                                                                                          ....................................................................................................................................   21   

3.1.7. LoginView                                                                                                                                    ..............................................................................................................................   22   3.1.7.1. Description                                                                                                                                               .........................................................................................................................................   22   3.1.7.2. Methods                                                                                                                                                   .............................................................................................................................................   22   

3.1.7.2.1. onCreate( Bundle icicle )                                                                                                                 ...........................................................................................................   22   3.1.7.2.2. onClick( View v )                                                                                                                             .......................................................................................................................   22   3.1.7.2.3. Login()                                                                                                                                             .......................................................................................................................................   22   3.1.7.2.4. NewAccount()                                                                                                                                  ............................................................................................................................   22   3.1.7.2.5. AccountPage()                                                                                                                                  ............................................................................................................................   23   

3.1.8. NotifyView                                                                                                                                    ..............................................................................................................................   23   3.1.8.1. Description                                                                                                                                               .........................................................................................................................................   23   3.1.8.2. Methods                                                                                                                                                   .............................................................................................................................................   23   

3.1.8.2.1. onCreate( Bundle icicle )                                                                                                                 ...........................................................................................................   23   3.1.8.2.2. onClick( View v )                                                                                                                             .......................................................................................................................   23   3.1.8.2.3. Open()                                                                                                                                              ........................................................................................................................................   23   

3

3.1.8.2.4. Close()                                                                                                                                              ........................................................................................................................................   24   3.2. SyncNotify                                                                                                                                           .....................................................................................................................................   25   

3.2.1.  Sync                                                                                                                                             .......................................................................................................................................   25   3.2.1.1. Description                                                                                                                                               .........................................................................................................................................   25   3.2.1.2. Methods                                                                                                                                                   .............................................................................................................................................   25   

3.2.1.2.1. preConCheck                                                                                                                                    ..............................................................................................................................   25   3.2.1.2.2. postConCheck                                                                                                                                  ............................................................................................................................   25   

3.2.2.  Notify                                                                                                                                           .....................................................................................................................................   26   3.2.2.1. Description                                                                                                                                               .........................................................................................................................................   26   3.2.2.2. Methods                                                                                                                                                   .............................................................................................................................................   26   

3.2.2.2.1. showFailPopup                                                                                                                                 ...........................................................................................................................   26   3.2.2.2.2. showMsgPopup                                                                                                                                ..........................................................................................................................   26   

3.2.3.  AutoPoller                                                                                                                                    ..............................................................................................................................   26   3.2.3.1. Description                                                                                                                                               .........................................................................................................................................   26   3.2.3.2. Method                                                                                                                                                     ...............................................................................................................................................   27   

3.2.3.2.1. Synchronize                                                                                                                                      ................................................................................................................................   27   3.3. Database                                                                                                                                              ........................................................................................................................................   28   

3.3.1. MessageDBAccess                                                                                                                        ..................................................................................................................   28   3.3.1.1. Description                                                                                                                                               .........................................................................................................................................   28   3.3.1.2. Methods                                                                                                                                                   .............................................................................................................................................   29   

3.3.1.2.1. MessageDBAccess(Context)                                                                                                           .....................................................................................................   29   3.3.1.2.2. close()                                                                                                                                               .........................................................................................................................................   29   3.3.1.2.3. createVMRow(…)                                                                                                                           .....................................................................................................................   29   3.3.1.2.4. deleteRows(List<Long>cId)                                                                                                            ......................................................................................................   29   3.3.1.2.5. deleteAllRows()                                                                                                                               .........................................................................................................................   30   3.3.1.2.6. fetchAllDelCid()                                                                                                                              ........................................................................................................................   30   3.3.1.2.7. fetchAllMsgInfoRows()                                                                                                                   .............................................................................................................   30   3.3.1.2.8. markForDelete(Long)                                                                                                                      ................................................................................................................   30   3.3.1.2.9. updateRow(long, String, String)                                                                                                      ................................................................................................   30   

3.3.2. MessageInfoRow                                                                                                                           .....................................................................................................................   31   3.3.2.1. Description                                                                                                                                               .........................................................................................................................................   31   3.3.2.2. Methods                                                                                                                                                   .............................................................................................................................................   31   

3.3.2.2.1. compareTo(Object)                                                                                                                          ....................................................................................................................   31   3.3.3. OptionsDBAccess                                                                                                                         ...................................................................................................................   32   

3.3.3.1. Description                                                                                                                                               .........................................................................................................................................   32   3.3.3.2. Methods                                                                                                                                                   .............................................................................................................................................   32   

3.3.3.2.1. SetReplyButtons(int[])                                                                                                                     ...............................................................................................................   32   3.3.3.2.2. SetReplyAction(int)                                                                                                                         ...................................................................................................................   32   3.3.3.2.3. SetPollingRate(long)                                                                                                                        ..................................................................................................................   32   3.3.3.2.4. SetLoginPolicy(Boolean)                                                                                                                 ...........................................................................................................   32   3.3.3.2.5. SetNotification(Boolean)                                                                                                                 ...........................................................................................................   32   3.3.3.2.6. GetReplyButtons()                                                                                                                           .....................................................................................................................   32   3.3.3.2.7. GetReplyAction()                                                                                                                             .......................................................................................................................   33   3.3.3.2.8. GetPollingRate()                                                                                                                              ........................................................................................................................   33   3.3.3.2.9. GetLoginPolicy()                                                                                                                             .......................................................................................................................   33   

4

3.3.3.2.10. GetNotification()                                                                                                                            ......................................................................................................................   33   3.3.4. AndroidDBAccess                                                                                                                         ...................................................................................................................   33   

3.3.4.1. Description                                                                                                                                               .........................................................................................................................................   33   3.3.4.2. Methods                                                                                                                                                   .............................................................................................................................................   33   

3.3.4.2.1. fetchName(String phoneNumber)                                                                                                    ..............................................................................................   33   3.3.4.2.2. fetchEmail(String contactName, String phoneNumber)                                                                  ............................................................   33   

3.4. Network                                                                                                                                               .........................................................................................................................................   34     CallWaveConnect                                                                                                                                 ...........................................................................................................................   35   

3.4.1.1.  Description                                                                                                                                              ........................................................................................................................................   35   3.4.1.2.  Methods                                                                                                                                                  ............................................................................................................................................   35   

3.4.1.2.1.  syncNet                                                                                                                                           .....................................................................................................................................   35   3.4.1.3. authNet                                                                                                                                                     ...............................................................................................................................................   37   

3.4.2. CWXMLParser                                                                                                                             .......................................................................................................................   38   3.4.2.1.  Description                                                                                                                                              ........................................................................................................................................   38   3.4.2.2. Methods                                                                                                                                                   .............................................................................................................................................   38   

3.4.2.2.1. parse                                                                                                                                                 ...........................................................................................................................................   38   3.4.3. Handlers                                                                                                                                        ..................................................................................................................................   42   

3.4.3.1. Description                                                                                                                                               .........................................................................................................................................   42   3.4.3.2.  Methods                                                                                                                                                  ............................................................................................................................................   42   

3.4.3.2.1. startElement                                                                                                                                     ...............................................................................................................................   42   3.4.3.2.2. characters                                                                                                                                         ...................................................................................................................................   42   3.4.3.2.3. returnAuthData                                                                                                                                ..........................................................................................................................   42   3.4.3.2.4. returnParsedCalls                                                                                                                             .......................................................................................................................   42   

3.4.4. ParsedData                                                                                                                                    ..............................................................................................................................   43   3.4.4.1. Description                                                                                                                                               .........................................................................................................................................   43   3.4.4.2. Methods                                                                                                                                                   .............................................................................................................................................   43   

3.4.4.2.1.  setDataAndTime                                                                                                                             .......................................................................................................................   43   3.4.4.2.2. createCID                                                                                                                                         ...................................................................................................................................   43   

4. Sequence Diagrams                                                                                                                        ..................................................................................................................   44   4.1. User Initiated Sync                                                                                                                             .......................................................................................................................   44   4.2. User Login Sequence                                                                                                                          ....................................................................................................................   46   4.3. User Reply Option                                                                                                                              ........................................................................................................................   47   

5

1.Overview

1.1.UI Module

The UI module contains all the different Activity classes that provide the interface to the user of the program. It controls the look and feel of the program and interacts with all the different input and output devices supported by the mobile device. The Activities provided by the UI module allow the user to view voice mail messages they have received, with a detailed or summarized text version of the message's contents. The user has the ability to view detailed information, reply in a number of ways, manage the contents of their local list of messages, or choose different program options. Each UI element will call methods of SyncNotify, alter the database, or call applications provided by Android in order to implement it's described functionality.

The UI also handles the logging in of the user, and will display error messages when an attempt to log into an account or retrieving new messages manually fails. The UI is also responsible for providing a pop­up dialog box that will be viewed by the user of the mobile device when a new message is received.

1.2.SyncNotify Module

The SyncNotify modules primary purpose is to house the service to be registered with the Android device, that will run in the background of the device and periodically poll for updates. 

6

During a polling command, the service called AutoPoller will acquire any new messages from the CallWave servers, and attempt to delete messages that have been marked for deletion by the UI. If there is any problem with the updating method, AutoPoller will notify the UI of an error, setting a flag with VoicemailInboxList to display error handing controls.

The AutoPoller, upon completion of this task, will sleep for a given period of time, specified by a setting set in the Options database. The service also allows itself to be woken by the UI, if there is a need by the use for an immediate update.

1.3.Database Module

The Database module manages all the information relevant to the storing of voice mail messages. Using Android's provided SQLite database system, a message database keeps a local record of voice mail message entries. This local list is kept in sync with CallWave's voice mail database by SyncNotify, which will occasionally acquire new messages and delete messages globally that are flagged to be deleted by the user through CVVA.

The database module is also responsible for using the Android device's local contact information database, in order to provide names and email addresses of individuals tied to incoming voice mail messages, treating this information as priority over CallWave's information for that individual, or for having no information on record on CallWave's end about the sender of the message. The database module will also store in an SQLite database the different application options pertaining to the functionality of CVVA.

1.4.Network Module

The network module's functionality is to be a helper class for SyncNotify ­ it will encapsulate away all the communication details in retrieving and sending messages to CallWave servers. The network module will make use of https and XML as a transmission protocol and data organization format. The network module will separate the job into the code that sends an arbitrary XML message, and the Parser that takes a desired command and translates it into the needed XML message string. The Parser is also responsible for decoding responses and extracting the data that is relevant to the system.

7

2.Dependencies

8

3.Detailed Class Descriptions

3.1.UI3.1.1.UI State Diagram

3.1.2.Class Overview

9

3.1.3.VoicemailInboxList

3.1.3.1.Description

The VoicemailInboxList is the main Activity and entry point to CVVA. It mainly serves to display a list of summarized entires for many voice mail messages, and is a subclass of Android's ListActivity class so that it can make use of Android's ListView class that allows the displaying of entries in a scrollable list.

It's second purpose is as a hub for different activities to be launched from – VoicemailInboxList can open the detailed view, reply view, options view and login view. It can also directly call the mobile device's phone calling functionality for directly calling back a selected message.

VoicemailInboxList is responsible for a range of functionality. It must poll the database and display the list of messages, noting which have been read and displaying their count at the top of the page. It provides an interface by which to be refreshed by SyncNotify's AutoPoller service through the InitializeData function. It must also tie into, through listeners, the different input methods such as touch, D­Pad and the green button. VoicemailInboxList should also provide different menu options through the mobile device's menu button.

10

In order to facilitate usage of the different listener classes, VoicemailInboxList implements OnItemSelectedListener, OnKeyListener and OnClickListener.

3.1.3.2.Methods

3.1.3.2.1. onCreate( Bundle icicle )

onCreate is Android's constructor method for Activities. This method will initialize the VoicemailInboxList, load the GUI, poll the database, and fill in the list view with entries. It will register itself with the various listener setting classes on itself – since it's superclass Methods that take listeners take the Interfaces that VoicemailInboxList implements, it's just a matter of setting those listeners to 'this'. This method will also check to see if any login data is stored in the options database. If there is no data, VoicemailInboxList will immediately call the LoginView Activity through an Intent.

If, with the Intent launching this Activity, there is a cid, then this application was started by a NotifyView. VoicemailInboxList will then immediately launch a DetailedView for this message ( given that the cid is valid. )

3.1.3.2.2.OnCreateOptionsMenu( Menu menu )

This method is called when Android wants to know what elements to put into the menu tied with the device's dedicated menu button. It's usage is generally to be overridden by subclasses, which will fill the given Menu object with strings for the different menu commands to be displayed. This method will pass into the Menu object strings for the options and manual refresh commands.

3.1.3.2.3.onListItemClick( ListView lv, View v, int Position, long id )

If an item in the list has been clicked or selected, this method will appropriately call through an Intent for the DetailView to be displayed for that selected voice mail message. Since this method is called whenever the selected item changes due to the up and down buttons being hit on the list, the method will keep track of what the previous item was – if it was a middle click selected this item as opposed to a up and down button.

Since this is also called when the screen is touched by the user to selected an item in the list, that will be a shortcut into calling the DetailView, and not require any previously selected item checking.

11

3.1.3.2.4.onOptionsItemSelected( Item I )

This method will get the name of the command given by the menu, and will launch the appropriate activity. Since the command and the string supplied to the user are one and the same, this method will need to use the Context.getString() method in order to get the string value from strings.xml to compare to the menu options. Activity is a subclass of Context, so this is a simple task.

3.1.3.2.5.onActivityResult( int requestCode, int resultCode, String data, Bundle extras )

This method handles the 'return value' of sort from a Activity pushed onto the stack through an Intent by this VoicemailInboxList object. This method will need to analyze the return value from the LoginView activity – if the use does not choose to log in, then this Activity will need to close immediately.

3.1.3.2.6.onItemSelected( AdapterView parent, View v, int position, long id )

This will just set the given item as the previously selected item.

3.1.3.2.7.onNothingSelected( AdapterView parent )

This will clear the previously selected list item to be null.

3.1.3.2.8.onKeyUp( int keyCode, KeyEvent event )

This button will listen for the right button on the D­Pad, green call button, and soft left and right commands. If the right button is hit, the selected item's DetailView is launched. If the soft left and right buttons are hit, the corresponding buttons at the bottom of the VoicemailInboxList display are triggered. If the green call button is hit, then the selected item's corresponding phone number is sent to Android to be called. Checks will need to be made if items are currently selected – it's possible for nothing to be selected.

3.1.3.2.9.onClick( View v )

This method is bound to the buttons at the bottom of the screen, the reply and delete buttons. This will route these messages to the Delete and Reply Methods.

3.1.3.2.10.InitializeData()

This method is the main method used to refresh the list view with the most recent version of the list of messages. It will call the database to get the messages, and then call RefreshList which makes use of the gathered list of items.

3.1.3.2.11.RefreshList()

This method will use an overridden ArrayAdapter class to inflate the different message entry 

12

views and place them into the VoicemailInboxList's ListView. The ArrayAdapter's getView method needs to be overridden, as this class is passed to the ListView which will call this method for each element of data that you need to insert into the List, and expects a corresponding View to be created for each.

This method will also format the date of the message, and color each depending on it's status as being new or old.

3.1.3.2.12.SyncWithServer()

This method will manually call SyncNotify to immediately poll for new data. This method only does this – it returns immediately and relies on the service of SyncNotify to call InitializeData when the operation is complete.

3.1.3.2.13.DeleteSelected()

This method calls the database to mark the selected message for deletion. It should first make sure that an item is indeed selected.

3.1.3.2.14.Reply()

This method creates a ReplyView and passes is the currently selected voice mail message's cid. It should first make sure there is an item selected.

3.1.3.2.15.Options()

This method creates and delivers to Android an Intent that will launch the OptionsView.

3.1.3.2.16.CallSelected()

This method will call on Android to directly call the selected message's phone number. It will be called when the green call button is pushed. It should be made sure that there is a row selected.

3.1.3.2.17.ShowDetail( MessageInfoRow r )

This method will launch the DetailView given the given row's cid information within the MessageInfoRow.

3.1.3.2.18.SetProblemState( boolean b )

If there is a problem with connectivity, relating to return results from CallWave, then this flag, set by SyncNotify, will be used to present this to the user. If there is a problem, a warning icon will be displayed in the title bar on the top right of the screen, and another option will be added to the options menu ­ “View Problem.” This will allow the user to see what the problem is with their account, and advise them to take action. This design allows the user to not be intruded on regarding the connectivity problem, but still be aware of it's existance.

13

3.1.3.3.XML Layout Dependencies

3.1.3.3.1. vlist_dark.xml

This stylesheet describes the layout of the main list. It is expected to have a ListView, and two Buttons on the bottom with the ID values 'replyButton' and 'deleteButton'.

3.1.3.3.2.ventry_dark.xml

This stylesheet describes the layout of each entry in the list. It contains several TextViews put together by a RelativeLayout layout scheme. The TextViews are expected to have the ID values 'entryName', 'entryTime' and 'entryGist'.

14

3.1.4.MessageDetailView

3.1.4.1. Description

The MessageDetailView will display for the user the detailed information about a particular voice mail message. It has buttons that allow you to return to the list of messages, reply to the message, play/pause the audio of the message and return to the beginning of the playback of the message. There is also a progress bar for the playback of the message. It will display the message text, name of the sender, and the date/time the message was received. 

This class will implement OnClickListener in order to tie into the buttons on the screen.

3.1.4.2.Methods

3.1.4.2.1.onCreate( Bundle icicle )

The Android constructor Sets up the page layout, and fills out the text components of the view. Also registers itself with the Buttons as an OnClickListener

3.1.4.2.2.onKeyUp( int keyCode, KeyEvent event )

Listens for the different key events of the D­Pad. If the up button is pressed, the detail view will change to display the previous message in the list. If the down button is pressed, the detail view will change to display the next message in the list. If the right button is pressesed, the ReplyView 

15

will be launched. If the left button is pressed, the Activity will close and it will return to the message list.

3.1.4.2.3.onClick( View v )

This will trigger the reply and 'back to voice mail list' functionality, after being instigated by Button callbacks.

3.1.4.2.4.Reply()

This will create a ReplyView dialog box and shows it.

3.1.4.2.5.NextMessage()

This will call on the database to get the information for the next message in the list, and fills in the various text elements of this view with that data.

3.1.4.2.6.PrevMessage()

This will call on the database to get the information for the previous message in the list, and fills in the various text elements of this view with that data.

3.1.4.2.7.Return()

This will close this activity and return the user to the message list.

3.1.4.2.8. PlaybackBeginning()

This button will return the playback of the audio back to the beginning. It will also pause the playback when it does this.

3.1.4.2.9.PlayPause()

This button will begin the download and playback of the audio version of the voice mail message. Subsequent hits of this button will pause and play the playback.

16

3.1.5.OptionsView

3.1.5.1. Description

OptionsView will set the various options that are relevant to CVVA. Various buttons and checkboxes and spinners and editable text fields will have their contents changed or have action taken upon being pushed. Although the various button such as deleting all messages, exporting/importing contacts, viewing your online account page or logging out of the system happen immediately, all other options do not take place until Apply has been set. The cancel button on the UI will discard any changes.

17

3.1.5.2. Methods

3.1.5.2.1.InitializeFields()

This method will poll the database for the current values of all the different options, and will initialize the different GUI elements to reflect the current state of the options.

3.1.5.2.2.DeleteAll()

This method will mark all messages in the local database for deletion.

3.1.5.2.3.GotoMembersPage()

This method will start a web browser, through an Intent provided to Android, which will goto the CallWave members page, allowing the user to access their detailed and comprehensive account settings.

3.1.5.2.4.ImportContacts()

This method will call SyncNotify to import the contact information from CallWave. It will block and then return, displaying the volume of contract information imported

3.1.5.2.5.ExportContacts() 

This method will call SyncNotify to export the local contacts to CallWave. It will block and then return, displaying the volume of contact information exported.

3.1.5.2.6.Cancel()

This method will discard and changes to the settings and will simply finish the Activity.

3.1.5.2.7.Apply()

This method will read in all the changed values of the GUI elements, and commit these settings to the options database. It will then close the Activity.

18

3.1.6.ReplyView

3.1.6.1.Description

ReplyView is a view that will allow the user to choose from different methods of replying to the user. It is not implemented as an Activity like the other UI elements, but as a Dialog box. It's functionality is similar to Swing Dialog boxes, in that they have show() and dismiss() Methods that are analogous to setVisible( true ) and setVisible( false ) on the Swing counterpart.

The five buttons on the ReplyView are tied to the five buttons of the directional pad on the mobile device – the four directions and center button. Pressing any of these on the d­pad will trigger the corresponding action. Each button's method is programmable through the options menu, and can be bound to either reply through phone, SMS, email, delete the message, cancel the replying, or disable the button.

3.1.6.2.Methods

3.1.6.2.1.Constructor( Context c , Long cid )

Because this class is not an Activity, but a Dialog, there is no onCreate method here. This 

19

method will set the layout, bind the buttons to listener functionality, and bind each button to a reply functionality.

If the message that goes with this cid does not have a return phone number or email address, then these buttons of functionality should be disabled.

3.1.6.2.2.SetButtonText( Button b, int type )

This method, for the given functionality type, will set the text displayed by the given button accordingly.

3.1.6.2.3.assignActionText()

This is a convenience method for the constructor, and will initialize all of the buttons's text through SetButtonText to their assigned values.

3.1.6.2.4.onClick( View v )

Upon a buttons touch by the user through the touch screen interface, this will route a functionality to be taken to performAction.

3.1.6.2.5.dispatchKeyEvent( KeyEvent e )

Upon a directional pad button being hit, this method will route a functionality to be taken upon to performAction.

3.1.6.2.6.performAction( int type )

Based on the parameter, CallBack, SMSBack, EmailBack, Delete or Cancel will be called.

3.1.6.2.7.CallBack()

This method will use an Intent through Android to launch the phone application to call the phone number attributed to the given cid.

3.1.6.2.8.SMSBack()

This function will use an Intent through Android to launch the SMS application to text the number attributed to the given cid.

3.1.6.2.9.EmailBack()

This method will use an Intent through Android to launch the default email application to email back the number attributed to the given cid.

20

3.1.6.2.10.Delete()

This method will choose to mark the given cid for deletion.

3.1.6.2.11.Cancel()

This method will cancel the reply functionality and dismiss the dialog.

21

3.1.7.LoginView

3.1.7.1.Description

This login page is called by the VoicemailInboxList Activity if there is no login data available from the options database. The basic functionality is to take the pin number from the user, in conjunction with the phone number of the device, and proceed to log into CallWave with this information. Once logged in, the LoginView will return to the VoicemailInboxList with a affirmative return value. If the return value is negative, the user has decided to quit the program instead of logging it – VoicemailInboxList will then quit as well.

3.1.7.2.Methods

3.1.7.2.1.onCreate( Bundle icicle )

This is the constructor of sorts for the Activity. It will initialize the layout of the program and register listener callbacks.

3.1.7.2.2.onClick( View v )

If any of the buttons are clicked by the user, this method will rout that functionality to the Login, NewAccount, or AccountPage Methods.

3.1.7.2.3.Login()

This method will attempt to login into the system. It will call CallWave method that will return a success or failure result. If the result is a success, then the LoginView will return to the VoicemailInboxList, which will then be populated with messages. If the result is a failure, then the user will be notified.

3.1.7.2.4.NewAccount()

This method will start a web browser, through an Intent provided to Android, which will goto the new account page on the CallWave website.

22

3.1.7.2.5.AccountPage()

This method will start a web browser, through an Intent provided to Android, which will goto the CallWave members page, allowing the user to access their account details before logging in, if necessary – to check their account details if there is some error, for instance.

3.1.8.NotifyView

3.1.8.1.Description

NotifyView is an Activity controlled by SyncNotify that will be displayed to the user in order to notify the user that a new voice mail is available. In addition to making use of the mobile device's vibration method, this Activity will appear as a popup on the top of the Activity stack, allowing the user to view the message's gist at a glance ( or see that there are multiple messages if there are. ) Buttons on the dialog will allow the user to view the detailed message ( or view the list if there are multiple new messages ) or dismiss the dialog and not take any action on the new messages. The detailed view will be launched through the VoicemailInboxList, which will launch the message with a given parameter in the launching Intent.

3.1.8.2.Methods

3.1.8.2.1.onCreate( Bundle icicle )

This is the constructor of sorts for this Activity. It will load the layout and populate it's values depending on the amount of new messages that have arrived.

3.1.8.2.2.onClick( View v )

If the open or close buttons have been clicked, this method will handle them and rout the message to the Open and Close Methods.

3.1.8.2.3.Open()

This method will launch VoicemailInboxList, with a cid parameter if there is only one new voice mail message.

23

3.1.8.2.4.Close()

This method will simply close the dialog box, as the user does wish to take any action on the information presented in the dialog.

24

3.2.SyncNotify

3.2.1. Sync

3.2.1.1.Description

The Sync class performs validation before and after a network connection to CallWave is made. Sync will process the local and/or network status to determine what action to perform.

3.2.1.2.Methods

3.2.1.2.1.preConCheck

This is the method that does status checking before making a connection. It is called from AutoPoller. The statuses to check in this procedure are, for example, if there is an Internet connection, whether the user is inside the application, and whether the polling rate is disabled. 

3.2.1.2.2.postConCheck

This method is called when CallWaveConnect finishes parsing the XML response, which always includes a status code indicating if fatal error has occurred. The code is processed and if it is a non­zero value, the status message will be passed to the showFailPopup method in Notify; otherwise the method will interpret the status message as the number of new calls; if the user is outside of the App, showMsgPopup will be called.

25

3.2.2. Notify

3.2.2.1.Description

Notify class takes data passed form Sync and triggers the UI to create a popup window containing the data from Sync. These windows will be to indicate a new voice mail preview, and error messages that may be relevant to the user.

3.2.2.2.Methods

3.2.2.2.1.showFailPopup

This method will be called from Sync with the status message to be displayed. It evokes the NotifyView from the UI and fills the view with the status message. 

3.2.2.2.2.showMsgPopup

This method accesses the message database and extracts the last inserted entry, and then evokes the NotifyView to display the caller ID, date and time, and the Gist of the message.

3.2.3. AutoPoller

3.2.3.1.Description

AutoPoller is an Android service that runs in the background. It has a sleep timer which is set by the user in the OptionView. When the timer expires or a user Refresh command is issued, AutoPoller is woken up and execute the synchronize method. After complete execution, the service goes back to sleep.

26

3.2.3.2.Method

3.2.3.2.1.Synchronize

Synchronize method is the starting point of the entire synchronize process. When called, It will first call preConStatus, then creates a CallWaveConnect object and execute its gcalNet method. After getting a return from gcalNet, synchronize finishes its execution.

27

3.3.Database

3.3.1.MessageDBAccess

3.3.1.1.Description

MessageDBAccess class acts as an interface with the SQLite Database.  It is responsible for the maintenance of the CVVA voice mail message database. Among its responsibilities is the task of 

28

adding new messages to the table, retrieving a list of messages to be displayed, and marking entries for deletion on the CallWave servers. Additionally MessageDBAccess creates the database, called VirtualVM, for the entire CVVA application and creates and maintains access control to the Voicemail table, which is a part of VirtualVM relational database.

3.3.1.2.Methods

3.3.1.2.1.MessageDBAccess(Context)

This is the constructor for the class. Taking in a context, it opens the voice mail database. In the event that the database does not yet exist, the constructor creates the relational database named VirtualVM and the particular table of that relational database named Voicemail.

VoiceMail table has the following column of elements:VoiceMail

cid{PK} callIdNumber vmDate vmDuration vtxt Vtxtn vmURL vmNew toBeDeleted

3.3.1.2.2.close()

This method closes the voice mail database.

3.3.1.2.3.createVMRow(…)

createVMRow(long cid, String calIDNumber , String vmDate, int vmDuration, String vtxt, String vtxtn, String vmURL, int vmNew)

This is the method called once new voice mail information from CallWave is available. The method takes in all relevant information for a particular voice mail, and then stores it in a new row in the voice mail database.createVMRow database access method is intended to be used primarily by the network package to add new voicemail entries into the database.  It creates one entry or row at a time.

3.3.1.2.4.deleteRows(List<Long>cId)

This is a method to delete specific list of entries from the voice mail database.  Taking in a list of primary keys, all rows specified are referenced and individually deleted from the table.

This method is intended to be used by the network package.Expected precondition: 

29

1. Particular message has been flagged for deletion by the UI using the method markForDelete(Long).

2. Successful deletion of same message on Callwave’s database.

Returns type int greater then 0 if successful.

3.3.1.2.5.deleteAllRows()

Similar to the deleteRows method, deleteAllRows is a method to clear the voice mail database of all entries.Should only be used by the network package for debugging.

3.3.1.2.6.fetchAllDelCid()

This fetch method finds all the entries in the VoiceMail database, which have been flagged for deletion by the UI.  This method is intended to be used primarily by the network package, to determine what VoiceMail messages need to be deleted in the CallWave database.

fetchAllDelCid returns a list of all the VoiceMail cId’s marked for deletion, as a reference to a List<Long> data structure.

3.3.1.2.7.fetchAllMsgInfoRows()

The purpose of this method is to query the database for all messages that have not been marked for deletion and return a list of MessageInfoRows to be displayed by the UI. 

This method returns an instance of MessageInfoRow class.

3.3.1.2.8.markForDelete(Long)

This method takes in the cId of a message to be marked for deletion, does an update for that message, and changes its toBeDeleted value to 1.

3.3.1.2.9.updateRow(long, String, String)

This method takes in the Cid of a message, and the short and long versions of the message text. The updateRow method then locates the entry in the database, and replaces the stored message text with that of the parameters.

30

3.3.2.MessageInfoRow

3.3.2.1.Description

This class is a wrapper class for all the information required by the UI to display a single message.

3.3.2.2.Methods

3.3.2.2.1.compareTo(Object)

This method looks at the Cid of the MessageInfoRow, and compares it to that of another MessageInfoRow, passed in as its parameter. The return value is 0 if they are the same.

31

3.3.3.OptionsDBAccess

3.3.3.1.Description

The OptionsDBAccess class is a set of accessors and mutators for the options that can be set by the user.

3.3.3.2.Methods

3.3.3.2.1.SetReplyButtons(int[])

This method sets the actions for each of the directional buttons and the center button in the reply menu.

3.3.3.2.2.SetReplyAction(int)

The default reply action is set by this method.

3.3.3.2.3.SetPollingRate(long)

The polling rate of the sync service is set by this method. 

3.3.3.2.4.SetLoginPolicy(Boolean)

This method specifies if the login information for the user's CallWave account should be stored for automatic login in future use.

3.3.3.2.5.SetNotification(Boolean)

This method specifies if pop­up notifications for new messages should be disabled or not.

3.3.3.2.6.GetReplyButtons()

This method gets the reply actions set for each of the directional buttons.

32

3.3.3.2.7.GetReplyAction()

This method gets the default reply action.

3.3.3.2.8.GetPollingRate()

This method gets the value for the polling interval.

3.3.3.2.9.GetLoginPolicy()

This method gets the login storage policy.

3.3.3.2.10.GetNotification()

This method gets the setting for notification windows.

3.3.4.AndroidDBAccess

3.3.4.1.Description

This class is designed to access the mobile device's local database. The motivation behind this is to retrieve contextual information relevant to the user, such as familiar names to associate with phone numbers, and other forms of contact.

3.3.4.2.Methods

3.3.4.2.1.fetchName(String phoneNumber)

This method takes in the parameter of a phone number as a string. AndroidDBAccess then performs a query on one of Android's content providers using the given phone number.

This returns with a list of the contact names matching the phone number. In the event that no matches are found, an empty list is returned.

3.3.4.2.2.fetchEmail(String contactName, String phoneNumber)

This method also takes in two strings containing a contact's name and phone number. Performing a request on a different content provider, this method will return a list of contact's email addresses. In the event that no matches are found, an empty list is returned.

33

3.4.Network

34

 CallWaveConnect

3.4.1.1. Description

CallWaveConnect is the class that makes the connection with the CallWave servers, It sends the XML formatted requests and then passes the XML formatted response to the parser. It then takes the parsed data and inserts it into the database.

3.4.1.2. Methods

3.4.1.2.1. syncNet

Makes the request to CallWave for GCAL requests. These requests are formatted as specified by CallWave's WX api. An example:

<?xml version=\1.0\ encoding=\ISO­8859­1\?>

<request>

<type>GCAL</type>

<src>PW</src>

<ver>2.0</ver>

<os>WinXP</os>

<account>Account#</account>     

<uString>uString</uString>+

<syncLevel>synclvl</syncLevel>   

<maxCalls>0</maxCalls>

<syncMode>F</syncMode>

</request>

35

Tag Explanation

type The type of request being made.

src* Two letter code indicating which client application is requesting.

ver* The version of that client

os* Which operating system the client is running on.

account The users account number

uString A unique authentication string

syncLevel The local syncLevel, if there are new voice mail, should be a smaller number than the server.

maxCalls The number of calls to receive, 0 gets all. 

syncMode The synchronization mode F returns the calls sorted by date.*Currently there is no specific value for these tags in our application, so these values are for one of the desktop clients.

This same request is also used to delete entries from CallWaves server as well; it does this by taking a list of CID's (The unique key for an entry in the local database). Then it adds the following to the GCAL request:

<callUpdates>

<callUpdate>

<cid>

<time>ctime</time>

<inst>cinst</inst>

</cid>

<revStatus>X</revStatus>

</callUpdate>

...

...

</callUpdates>

36

Server side the CID is two values inst and time, these are both generated into by the CallWave Server and the local CID is a combination of these two values. So there is conversion logic used to split it back into time and inst which will be explained in 4.3.4. revStatus is the review status of the message, the value X corresponds to deleting the entry. 

It sends this request via HTTP to the CallWave servers the server will delete the entries list if there are any and return what is left. Then it passes on the response to the parser (see 4.3.2 for details on the format of the response). The parser will return a CallData object, its status will be checked if its zero, the data will be added to the database and it will return a success case to Sync. If status is anything other than zero, syncNet will pass the statusMsg back to Sync and will not add anything to the database.

3.4.1.3.authNet

Makes authentication requests to CallWave, sends the users phone number and pin and receive the users account number and uString which are required to make any other types of requests.

An example of what the AUTH request looks like:

<?xml version="1.0" encoding="ISO­8859­1"?><request>  <type>AUTH</type>  <src>VV</src>  <ver>2.0</ver>  <os>WinXP</os>  <phone>Phone#</phone>  <pin>pin#</pin></request> 

37

3.4.2.CWXMLParser

3.4.2.1. Description

CWXMLParser is responsible for taking the XML response from CallWave and putting the need data into a ParsedData object.

3.4.2.2.Methods

3.4.2.2.1.parse

Parse uses the SAXParser that is built into Java to parse the XML. It takes two parameters the XML and which Method its parsing for this determines which Handler it needs to use to parse.

An Example of the XML to be parsed for GCAL is:<?xml version="1.0" encoding="UTF­8" ?>

<response>

<type>GCAL</type>

<status>0</status>

<tz>PT</tz>

   <successCase>1</successCase>

   <newSyncLevel>11</newSyncLevel>

    <newContactSyncLevel>5</newContactSyncLevel>

   <numNewCalls>0</numNewCalls>

    <calls>

     <call>

        <cid>

          <time>1201386346</time>

          <inst>59703314</inst>

38

       </cid>

        <fmtDate>1/26/08</fmtDate>

       <fmtTime>2:25 pm</fmtTime>

       <fmtDT>1/26/08 2:25 pm</fmtDT>

       <revStatus>S</revStatus>

       <outcome>18 sec</outcome>

       <fmtCallerId>510­399­9347</fmtCallerId>

       <name></name>

       <phoneType>C</phoneType>

       <msgPri>Primary Message URL</msgPri>

        <msgSec>Secondary message URL</msgSec>

       <loc>Fremont, CA</loc>

       <vtxt> Gist</vtxt>

        <vtxtN>Full MEssage</vtxtN>

       <ctid>

         <lid>0</lid>

         <pid>3</pid>

       </ctid>

       <mediaFmt>M</mediaFmt>

       <durSecs>20</durSecs>

       <dir>I</dir>

</call>

</calls>

</response> 

39

Tag Explanation

status If there are no problems should be 0

statusMsg Will only appear if status != 0. Details of the problem if one occurs

successCase If the request was successful should be a 1

time Value created by the server to identify the voice mail

inst Value created by the server to identify the voice mail

numNewCalls Number of new Calls

fmtDT The data and time together as one string

fmtCallerID The phone number of the Caller

name Name of the Caller if they are in the users contacts on CallWave

phoneType The type of phone used in this case C for cellphone

location The location of the Callers Phone

msgPri The URL of the actual audio message

vtxt The GIST or short version of the transcribed voice mail.

vtxtN The full version of the transcribed voice mail.

Note: tags not listed are not parsed for, as they are not needed for this application.

A response from a delete will be similar but will not contain the list of calls. While and AUTH response to be parsed is much simpler as it is just:

?xml version="1.0" encoding="UTF­8" ?><response>  <type>AUTH</type>  <status>0</status>  <statusMsg>Authentication succeeded.</statusMsg>

40

  <account>10022328</account>  <uString>0f5bfd0d538b86cb3c049fb4b0e3581d1133d54c2d10ba2ee398ed</uString></response> 

Using the handlers the parser will return either a CallData object or an AuthData object both of which are subclasses of ParsedData (See 4.3.4). How the Handlers work is explained in the next section.

41

3.4.3.Handlers

3.4.3.1.Description

The handlers provide the rules required to parse an XML document. These rules include what to look for and what to do with the data parsed. CVVA has two different handlers one for GCAL and delete requests and another for Authentication requests and they are both extensions of the DefaultHandler class which is built into Java and is a required parameter for the SAX Parser used in CWXMLParser. The startElement and characters Methods do differ in AuthHAndler and CWHandler in what they are looking for and which subclass of ParsedData they insert into but the basics of how they work is identical.

3.4.3.2. Methods

3.4.3.2.1.startElement

This Methods watches for the starting tags we want to parse, for example <vtxt>. When a wanted tag is seen it triggers a boolean flag, which is used by the method characters.

3.4.3.2.2.characters

This Methods reads in a string of data that comes after the starting tag and before the ending tag and inserts into the ParsedData object. This uses the boolean flag triggered in start element to know where in ParsedData to assign its values.

3.4.3.2.3.returnAuthData

This method is specifically for the AuthData subclass, it is used just to return the AuthData object that was generated in the handler.

3.4.3.2.4.returnParsedCalls

This method is used for GCAL's and Deletes, it returns the CallData that was generated in the handler.

42

3.4.4.ParsedData

3.4.4.1.Description

These are objects created to store the values parsed out. ParsedData has two subclasses AuthData and CallData by having them as subclasses of ParsedData this allows one parser to parse and return all the types of data that is need.ParsedData just stores the status and status message as all types of request will return this data and it is used by the Methods of CallWaveConnect for error checking.AuthData stores the account number ad uString parsed off an AUTH request.CallData stores the information for GCAL and delete requests, the syncLevel, number of new calls, number of total calls, and a list of CallEntry's which are the associated data parsed off for each individual call.

3.4.4.2.Methods

3.4.4.2.1. setDataAndTime

Some manipulation on the date and time parsed to a format accepted by the database.

3.4.4.2.2.createCID

Creates the CID (unique key) for the entry in the local database. It is a combination of ctime and cinst, where ctime is shifted 32 bits to the left anfdcinst is added to it. This gives us unique identifiers for each call as there is a possibility that just one or the other by itself could not be unique.

43

4.Sequence Diagrams4.1.User Initiated Sync

44

The above diagram shows a user initiated sync. The syncing process both deletes entries marked for deletion from the CallWave Server as well as gets all new voice mails. The AutoPoller is a service that periodically will perform the sync operation; in the case of a manual sync the user causes AutoPoller to perform that sync immediately. The AutoPoller has a preconditions check that makes sure it can sync, for example this will fail should the phone not have connection to the Internet. If the preconditions are met it uses CallWaveConnect to perform its connection, parsing process, and add items to the database if everything was successful. It sends its status to sync, and should it the status not be 0 then sync will determine if the user needs to be notified and call Notify to perform this. Finally when the other Methods return, AutoPoller tells the UI to refresh. 

45

4.2.User Login SequenceThis diagram is a modified sequence diagram with two recurrence events. The “loop back” arrow means the sequence will return to its original state.

46

The above diagram shows the user login sequence. The user will be presented with the LoginView if no account information is found in the Option Database. After the user inputs his/her phone number and pin, Sync will call authNet in the CallWaveConnect class. The XML message is constructed in authNet and sent to CallWave. After the response is parsed, the statusCode and statusMsg is checked by Sync. If the check goes through, authNet will store the account number and uString inside Option Database. Then the user will be taken to the VoicemailList page and an automatic sync will take place (described in the previous sequence diagram).

If the check failed, then a Notify message will be created and displayed with the statusMsg that has been passed to Sync. And the UI will remain in LoginPage.

4.3.User Reply Option

While in the VoicemailList view, as well as the detailed view, the user can press the Reply button. This will bring up the Reply popup menu. The user can then use the D­Pad or touch to choose a reply option. Then the ReplyView will launch the appropriate Android application.

47