Silver GPS - Part 1

Ok, here is part 1 of a multi-part installment to cover the Silver GPS application.  I thought we would start by examining the "Big Picture" below.

image

This first segment will focus on the Mobile GPS Tracker client - which includes the ability to capture GPS data and store it locally on the device in a SQL Server Compact database.  Before we begin, here is the software you will need to complete this piece of the application:

The starting point for this application will be the "GPS Sample" application that gets installed with the Windows Mobile 6 SDK at:

C:\Program Files\Windows Mobile 6 SDK\Samples\PocketPC\CS\GPS

You can get a feel for how the "FakeGPS" SDK tool works by  copying the "FakeGPS.CAB" file from the following folder:

C:\Program Files\Windows Mobile 6 SDK\Tools\GPS

to the GPS Sample project.  Then "include" the FakeGPS.CAB file in your project and right-click, mark the "Build Action" property as "Content" - so it gets deployed to the device.

 image

To see this in action - Press F5 to run the application - Select "Windows Mobile Professional Emulator" as the deployment device.

image

The application will then be deployed to the device and you will see the following screen:

image

Click on Start / File  Explorer / MyDevice / Program Files / gpssample to navigate to the installation folder.

Double-click on the "FakeGPS.cab" file - this will install the FakeGPS tool on the emulator device.

image image

Once installed, you will find the FakeGPS application under Start / Programs on the emulator device:

image

After double-clicking, select the listbox item to "Enable" the FakeGPS tool and use the "FakeGPSData.txt file for GPS emulation data points.

 image

At this point, you are ready to "Start" the GPS sample application and you will see  that is starts registering GPS information via the emulator device...

image image

We will use this base GPS application as a starting point for building the Silver GPS mobile application.  In addition to this core GPS functionality, we will add the following items to the solution:

  1. Add a new SQL Compact Database to the solution
  2. Design the layout of the SQL Compact Database
  3. Add a Timer control
  4. Add code to "Save" the data to the SQL Compact database
  5. Add new menu items to start/stop saving GPS data to the SQL Compact database

 

(1) - Add a new SQL Compact Database to the solution:

  • Right-click on the solution, "Add New Item" - > Database File -> Name it GPSTracks.sdf

image

(2) - Design the layout of the SQL Compact Database:

  • Open the Database designer and add these fields:
  • image
  • Note the use of the "Identity" field type for the ID field above.

(3) Add a Timer Control:

  • Add a timer control to the main form and logic to save to the database every 2 minutes (120,000 milliseconds):
  • image

(4) Add code to "Save" the data to the SQL Compact database

  • image
  • image

(5) Add new menu items to start/stop saving GPS data to the SQL Compact database 

  •  image image image

And there you have it - a complete, ready-to-use GPS tracking application that saves your GPS data to a local SQL Compact database.

image

Here is the link to the code: SilverGPS_Part1.zip

and here is a link to a 15 minute overview with a Silverlight 1.0 Pop-Up Player: http://www.dotnettikihut.com/SilverGPS/

(Be sure to float over the top & bottom of the player to activate the controls and markers)

 image

Well see you next time for Part 2 in the SilverGPS series:

"Creating a WCF host Web Service and Mobile NET CF Client"

 

Technorati Tags: SilverGPS, Compact Framework, WCF, Mobile, GPS