Campaignr

From CSL Wiki

Jump to: navigation, search

Campaignr allows for people who are familiar with only XML to create and run data collecting campaigns. Using a simple XML file to describe which sensors to use, where to upload the collected data, and how often to collect the data, one can run many different types of collection campaigns. Campaignr is written in Symbian C++ to take advantage of many features not available to other mobile programming languages such as J2ME or python.

Contents

Installation

To install the application download the .sisx file to your computer and transfer it to the phone via bluetooth or if you use windows via usb using the sync software that came with your phone. Alternatively navigate to this page with your mobile phone and clicking on the download link should start the installation process automatically. It can be installed on either external or internal memory.


Overview

Campaigns need to go into Data\Campaignr on either internal (C:) or external (E:) memory. Both are read by the application. Campaignr starts with displaying the list of campaigns it has found. It displays the name of the XML file along with the name of the campaign for easy discernment of campaigns. The campaign is started by either clicking the OK button (the center of the directional pad), or by selecting Open from the Options menu. Startview Startmenu Mainview Mainmenu Cameraview Mainmenu2 Once a campaign is chosen and initialized, a mostly blank screen with the name of the campaign as its title is shown. From here the user can select Start Campaign from the Options menu to start the data collection process. The Settings option shows a placeholder view for options that could be changed. It will be implemented in a later version. Upon starting the campaign the upload manager will automatically start. If there was any previous data it will automatically connect to the internet to upload a chunk of data and every 10 minutes thereafter it will check again. If the collection interval is a number then the collection process will begin immediately. If it is instead, triggered, then, when the user presses the OK button the collection process will go through one repetition. If the viewfinder option is specified to the camera then when the it's the camera's turn to collect data it will display a viewfinder so that the user can frame the shot. The picture is captured by pressing the OK button. The picture is then saved and stored and the viewfinder is closed. To stop running a campaign the user selects the Stop Campaign option from the menu and the campaign will stop collecting data and will stop uploading data. To start collecting data again, the user just has to select Start Campaign once again.


SensorBase Schema

SensorBase requires sensorbase username authentication to be able to slog data. So Campaignr uses the username campaignr@cens.ucla.edu and it needs to be added to the user permissions for a sensorbase table or project. And projects follow the schema described here.


XML Description

The phone comes with a built in campaign similar to the example at the end of this page that it will write to the phone's file system by selecting the 'Create Test File' menu option. You can then select that campaign to run or modify the XML as you would any text file on the phone.

The XML syntax is (hopefully) simple. You start with specifying the name of the campaign, in this case Example:

 <campaign name="Example">
 </campaign>

There are a choice of two high level tags that contain which sensors should be collected manually (by the user pushing a button) or automatically (with a specified interval) and where each set of sensors should be slogged to. There can be either one or both of the options specified in the file:

 <automatic>
 </automatic>
 <manual>
 </manual>

Then you continue with specifying which sensors you would like to use and what options the sensors should use. You can also give the sensors names in case you want to add more than one of the same time of sensor. The choices for sensors at the moment are:

Bluetooth Stumbler

Returns a JSON string that contains an array of MAC addresses, (url encoded) names, and other device info of found bluetooth devices (e.g.

  "{"bluetooth_devices":[{"mac":"0123456789AB", "name":"NOKIA%20N80", "major_service_class":640, "major_device_class":2,    
  "minor_device_class":3}, {"mac":"00112233445566", "name":"n95", "major_service_class":640, "major_device_class":2,   
  "minor_device_class":3}]}"). 

The names can be left out to speed up the query by specifying the option <address_only/>:

     <sensor type="bt_stumble" name="bt">
       <address_only/>
     </sensor>


Camera

The options are: size (1280:960, 800:600, 640:480), format (Color 4K, Color 64K, Color 16M) and viewfinder. The defaults are 800:600 and Color 16M:

  <sensor type="image" name="cam">
    <viewfinder/>
      <size>640:480</size>
       <format>Color 4K
       </format>
  <sensor>

Cell Tower ID

Returns the Country Code, Network Id, Location Area Code, and Cell Id in a 4-tuple. Returns "0 0 0 0" if no cell tower information is available:

     <sensor type="cellid" name="cell" />

Device Info

Returns a JSON string of the manufacturer, model, and IMEI, and the battery percent charge and battery/external power status. (e.g.

   {"device_info":{"phone_id":{"manufacturer":"NOKIA","model":"N95","imei":"123456789101112"}},{"battery_info":
   {"status":"Battery","charge_level":28}}}):
   
   <sensor type="device_info" name="info" />

IMEI

Returns the IMEI number as a string:

     <sensor type="imei" name="imei" />

Location

Uses generic location services to get a position, which includes GPS. Returns a JSON string with many fields including latitude and longitude:

     <sensor type="location" name="gps" />

Microphone

Returns an audio binary string in AMR format. The options are: duration (in milliseconds), beep, and vibrate. The default is 2000:

     <sensor type="audio" name="mic">
       <beep/>
        <vibrate/>
          <duration>5000</duration>
     </sensor>

Tag

Returns either an string modified by the user, or a choice of one or more non-modifiable strings. The prompt can also be specified. The default editable text is "" and the default prompt is Enter a Tag::

     <sensor type="tag" name="metadata">
       <prompt>
         Enter a tag:
       </prompt>
       <text>
         Severe
       </text>
       <list>
         <item>
           Mild
         </item>
         <item>
           Moderate
         </item>
         <item>
           Severe
         </item>
       </list>
     </sensor>

Text

Always returns the string specified in the xml. The default is " ":

     <sensor type="text" name="user">
       <text>
         user
       </text>
     </sensor>

Timestamp

Returns a time and date string in a format that sql can parse:

     <sensor type="timestamp" name="ts" />
Personal tools