Source Code
This document is intended to be a brief overview of the organization of the source code. This document will be expanded as required.
The application is written in C++. The Pocket PC version uses eMbedded Visual C++ 4.0, which is available as a free download from Microsoft. You also need the Software Development Kit for Windows Mobile 2003-based Pocket PCs. The Windows XP editition uses the free Visual C++ Express 2005 with the Windows Platform SDK. The setup packages are created with PocketSetupCreator on CE; NSIS on XP. I sometimes also use this CE Debugger.
The source code is available via Subversion from SourceForge, and is covered under the GNU General Public License (GPL.)The Pocket PC and Windows XP versions both compile from essentially the same source code. It has not been necessary to create a separate branch for each operating system. Almost everything that can be done on CE can be done on XP as well (although the converse is not true; for example, while CE has basic STL classes like string and map, it does not have strstreams.)
Projects
- HerecastLib - The main body of the source code.
- Subscribe - A tiny application that handles the herecast:// subscription protocol.
- Scanner (CE) - Standalone version of the WiFi scanner.
- TodayItem (CE) - The today item version of the application.
- TodayItemTester (CE) - A today screen emulator that allows you to run the today item in a debugger.
- HerecastXP (XP) - Windows XP version of Herecast.
HerecastLib
The Herecast library contains most of the code for the applications; the Scanner and Today Item projects are basically just front-ends to the same thing. The library includes the dialog box resources, icons, etc. It has several modules, which are described in th e following sections.
Utils
Contains utility functions for creating windows, accessing the Windows registry, and so on.
WiFi
Functions for interfacing with the 802.11 network card, and working with the information that is retrieved.
- WiFi - an object that handles talking to the 802.11 card. It uses NDIS, a standard interface that should be common between all wireless network cards. My research would seem to indicate that NDIS 802.11 was introduced in Pocket PC 2003, and also exists on Windows XP. Although I'm not familar with how Palm OS lets you access an 802.11 card, I imagine this object could be ported to Palm by providing an adapter class to emulate the NDIS data structures.
- AccessPoint - an object that represents a currently-visible access point. Provides convenient storage for metadata about the access point, including the average RSSI.
- AccessPointList - maintains a list of AccessPoint objects. Lets you find out which one has the best signal strength.
APDB
Data structures for using the Herecast access point database. This large module is further divided into several types of objects.
- Items - Basic objects such as Country, City, Ap, Service, etc. The virtual class GenericItem contains an interface shared by all of these. The Ap (access point) class inherits directly from GenericItem. Most other objects inherit from HItem (hierarchy item), which shares the base interface of GenericItem, but adds additional fields for the item name and references to the parent item. (For example, a City object's parent is a Province.)
- Lists - Each Item class has a corresponding List class, which represents a set of those items. GenericList the superclass; ApList and ItemList are inherited from it. All other lists (CountryList, ServiceList, etc) are inherited from ItemList. The factory pattern is used extensively, so most List objects contain no real code. Each of the List objects has an associated file on disk (for example, countries.txt), which serves as a local cache. There is also an in-memory cache for recently used items.
- WebAgents - UploadAgent and DownloadAgent deal with sending information to and retrieving it from the online database. SubscriptionAgent manages the subscription list, scanning it and sending updates to subscribed services. All three make use of WebAgent, which handles a queue of pending requests, reporting back with the progress of the request. WebAgent uses WebRequest objects to take care of the details. WebRequest uses WinInet, which should port well to Windows XP, but will require a bit more work for Palm.
- Dialogs - The user interface. Should port reasonably well to Windows XP, with the exception that references to CE-specific things such as the soft input panel will have to be disabled in that build.