TBMidlet.java is a core file from the Transborder Immigrant Tool created by the Electronic Disturbance Theater 2.0.
File: TBMIDlet.java
Programming Language: Java (J2ME)
Developed: 2007-2010
Principal Authors: Brett Stalbaum and Jason Najarro as part of the Electronic Disturbance Theater 2.0.
Platform: Motorola i455 ($40 per at time of project)
Libraries Used: edu.ucsd.calit2.TransBorderTool.international, javax.microedition.midlet, javax.microedition.lcdui, javax.microedition.location, java.io, java.util.*, javax.microedition.media.*, net.walkingtools.javame.util.AudioArrayPlayer;
Source file: The sourceforge repository of the TBT code, released in 2012.
Interoperating files: Dowsingcompass, Dowsingcompasslistener, TBCoordinates, TBgpxParser
TBMIDlet contains many of the core functions that operate the Transborder Immigrant Tool. They handle everything from updating the coordinates to establishing whether or not the traveler is moving.
1-2: Though the rest of this software is free and open source, the Walkingtools are subject to copyright.
4-15: Comments presenting licensing information and programmer comments. This is a GNU Affero Public License. /* indicates comments Although it is part of the standard license, on a piece of software that purports to help save lives, the phrases “WITHOUT ANY WARRANTY” and “without even the implied warranty of...FITNESS FOR A PARTICULAR PURPOSE” stand out and not merely because they are in upper case. This app might be a lifeline, but there are no guarantees.
19-20: First comment from authors to themselves or perhaps future coders. This comment reacts to an aspect of the code already implemented, since line 334 checks if the water cache is more than 1000 meters away.
22-31:Packages and imports, libraries of code also being included with this code. the class being imported include international, midlet, lcdui, location, io, util, media, and AudioArrayPlayer, which will be used to play the poems.
Because of such statements, the visible code does not reveal all. More importantly, these imports point to one of the many ways visible code is always partial. I am reminded here of Roland Barthes’ distinction of the work and text (“From Work to Text”). The work is an individual, discrete object assigned to an author. The text is an unlimited continuum of discourse of which discrete objects (like this file of code and this manuscript) are only ever partial excerpts.
25-28: Although much of the code of the app is imported from other sources, this passage offers authorship credits and a version number, reminding us that authorship (and the author function) still maintains significance even in free and open source software.
29: Sets this file as extension of MIDlet
37-597: From this line everything that follows “extends MIDlet” or extends the class of MIDlet, the app class, by defining what TBMIDlet adds to and modifies in that class.
39-84: Variable Declarations. The SEARCH_DISTANCE, 10K, represents meters.
62: The test app was designed to download coordinates of water caches (which changed frequently).
66-69: Although there are many published poems for this project, this version of the code only loads 6: 1-GAIN_04-02.wav etc..
86-269: Constructor for TransborderMidlet (or TBMIDlet), defines the class TBMIDlet. In this file, the core functionality and design of the app are defined.
98-99: This “commented out” line tests the output by displaying the current time. The // before System means this line of code is not processed by the code. JAD stands for Java Application Descriptor, a file format for java files.
108-117: Checks the display with the app to determine which sized graphics to display.
124-137: These lines use various freshness tests on the data, seeing if it is expired or will expire in 7 days, since the water caches were moved frequently to avoid vandalism. These lines show some of the pressing real-world concerns that appear in the code.
158-167: These lines establish the noNearbyWaypoints object, one of the more alarming states of the software for one trying to survive the desert.
178-183: The code that establishes the basic interface options.
184-202: Comment: An extensive commentary on an error and workaround, including an extensive citation from the documentation of the code. This comment as survival guide to this knotty problem mirrors the structure of the poems that lead the traveler through the desert.
233: Criteria is a Javax Microedition class that helps prioritize a selected location provider.
148-156: Declared startupDisplay, the methods used at startup, including one that displays the title. Notice that the “translate” method is used on all displayed messages to keep the app from being tied to one language. However, the poem audio files would have to be individually translated to other languages before being uploaded.
285: bailOnAudioException: The use of the word “bail” meaning to leave or depart, or in this case “to terminate,” though not a singular usage, has a particularly colloquial ring, as in “gotta bail.” This Alert named by the programmers (in other words, not a reserved word) offers an example of the way a variety of registers of diction enters code.
302-317: Checks to see if the location data is still fresh.
279: Creates the audioplayer that will play the poems.
322-345: CompassListener declares witchingEvent method (water detected).
351-358: NavigatorListener signals when arrived within range of target.
360-375: Code for handling user interface audio.
377-399: navigationReady to "populate nearby waypoint vector"
401-463: NavigationListener checks refresh rate or provides minimal information if GPS is out of range (and location not being dynamically updated). Note that lines 406-409 describe the “minimalist mode” for scenarios of “less capable phones” or “where GPS coverage is poor.” This code caters to and creates the scenario in which a “magnetic compass” may be the only resort. This mode is specified starting on line 446 in the minimalistInfoAlert.
465-471: Auto-generated method to terminate the app and enter the “Destroyed state” (“Class Midlet”).
477-479: Auto-generated method to pause app.
481-494: Method for loading images.
494-552: Code managing the actions.
554-564: motionStatusUpdate
567-596: This next patch of code plays the randomly selected poems and runs several checks for exceptions, or parts of the code that would terminate the program. These include the phone being asleep and some other audio currently playing. Both exceptions are followed by “catch” code that addresses how to respond to these exceptions.