From Notes

Jump to: navigation, search


What POSIT Does

The main purpose of POSIT is to assist a user in identifying and recording Finds, where a Find is any object of interest. When a Find is found, its GPS coordinates are saved as well as the time of its discovery. The user can input brief identifying and descriptive information about the Find and can associate pictures with it. Finds are saved to POSIT's SQLite database, from which they can be later retrieved and displayed either in an interactive list or on a Google map.

As long as there is network connectivity, Finds can be synchronized with a POSIT server. Finds can be shared among individual users who are subscribed to the same Project on the server.

POSIT can track its own movements, storing these tracks as Expeditions both on the phone and (when there is network connectivity) on the server. On the server, tracks can be merged into a single view and can be collected and viewed in real time -- i.e., as they are being generated.

POSIT also contains an ad-hoc networking capability, through which it can communicate peer-to-peer in the absence of network infrastructure with other POSIT devices. Communication among peers is done through each device's WiFi hardware using a random walk gossip protocol.

Functional Architecture

Figure 1 provides a summary of POSIT's functional architecture. POSIT employs a client-server architecture, in which Android-based mobile devices are the clients that communicate with a central server.

On the client side, POSIT employs a layered design. The two main divisions are between the application layer and the service layer. The application layer consists of the major user-interface components. In Android functional components that interact with the user are represented as Activities. Figure 1 shows three such components: Add Finds, List Finds, and Map Finds.

POSIT's activities are supported by a number of services. Some, such as the communication manager, settings manager, and database manager, are designed specifically for POSIT's functionality and are therefore coded at the application layer. Together with POSIT's user interface components, these services make use of underlying Android system services, such as the wireless services and location manager. As shown in Figure 1, RWG is designed as a system service, although it is not an Android system service.

The POSIT server consists of two basic services, a communication service, through which it communicates with registered clients, and a database service, which is used to store data received from the clients.

POSIT's Main Activities

The POSIT application is organized into several main Activities:

  • PositMain -- Main activity and home view with menu support for all of POSIT's main activities -- i.e., registering the phone, adding and listing of finds, starting and stopping the tracker, adjusting the apps preferences and settings, and starting and stopping RWG.
  • FindActivity -- Supports the adding of new Finds and editing of existing Finds, with menus
  • ListFindsActivity -- Supports the listing of Finds that are stored in the phone's database, with menus for syncing and mapping Finds.
  • MapFindsActivity -- Displays existing finds on an interactive Google map.
  • NewProjectActivity -- Enables the user to create a Project. All Finds are stored under a project and the project's name and id are synchronized with the server.
  • RegisterActiity -- Registers the user and the device with the POSIT server.
  • SyncActivity -- Synchronizes the phone's Finds with the server.
  • TrackerActivity -- Tracks the phones movements and syncs them with the sever.

POSIT Main Services

  • RWG Ad-hoc networking -- POSIT's ad-hoc networking supports the sharing of Find data among phones in the absence of network infrastructure.
  • PositDbHelper -- Manages all interactions with Finds data stored in a SQLite database.
  • Communicator -- Manages all communication functions with POSIT server.

POSIT's Internal Database

POSIT's data are stored as an Android SQLite database, which is created and managed by the PositDbHelper class. The database is stored on the phone at /data/data/org.hfoss.posit.android/databases/posit and can retrieved from the phone by using the Android Debug Bridge tool kit (when the phone is attached to a computer via a USB cable.

Programmers can manipulate the database directly using the sqlite3 database tool provided by the Android SDK. The tool allows you to browse table contents, run SQL commands, and perform other useful functions on SQLite databases.

The POSIT database and consists of the following tables.

  • finds -- Stores the Find's id, globally-unique-id (guid), name, description, project-id, creation-time, modification-time, location, is-synced, is-adhoc, is-deleted.
  • expeditions -- Stores the tracks recorded by the phone, including id, project-id, number-of-points, number-of-synced-points, is-registered.
  • points -- Stores the points associated with a given track, including expedition-id, latitude, longitude, altitude, creation-time, swath-width, is-synced.
  • photos -- Stores the photos associated with a given Find, including find-id, guid, project-id, image-uri, thumbnail-uri, and timestamp.
  • find history -- Records all changes to the Finds table, including the guid, timestamp and action.
  • sync history -- Records all synchronization activities with the server, including timestamp, and server-id.

The POSIT Server

The POSIT server is written in PHP. It uses a MySQL database. It employs a model-view-controller (MVC) architecture and uses the Smarty templating engine, which allows for a clean separation between the look and feel and layout of the server's web pages and the programming logic that controls its functionality. The database consists of the following main components:

  • model
    • dao.php -- The data access object handles all interactions with the database.
  • controller
    • api.php -- Handles all interactions with POSIT-mobile clients -- parses the incoming HTTP requests, invokes the appropriate server-side functions, and returns results to the client. Results are returned using the JSON (Javascript Object Notation) data interchange format.
    • web.php -- Handles the interaction between the controller logic and the templates, binding data retrieved from the database to the various views that make up the server's user interface.
    • ajax.php -- Handles the server's the AJAX (Asynchonous Javascript and XML) functionality. AJAX works on the client-side to allow clients to retrieve data from the server asynchronously without interfering with the display and functionality of the current web page.
  • view
    • template directory -- A directory of the template files used to define the web pages that make up the server's user interface.
  • setup
    • positweb.sql -- An export of positweb's MySQL database (without data).
Personal tools
NSF K-12