GPS Event [1] – Sensor

gpsI was inspired by RuleCore Marco’s recent posts and have decided to put together a simple EP/CEP example, just for fun of doing it. The idea is to use a GPS, write an adapter to capture the GPS data, transfer it to a CEP server, tinker with events, and blog along the way.

I have a handheld Magellan GPS with an option to output data in several formats. By selecting the V2.1 option in the NMEA setup, the GPS constantly transmits data over the RS232 port—this can be simply monitored using HyperTerminal in Windows. Here is an example:

$GPGGA,172021.20,4338.8243,N,07923.9149,W,2,05, 9.9,00119,M,,,,*12

Looks a bit confusing, but each row is a NMEA sentence.

The data set contains lots of information, some of it redundant—for basics only one sentence is needed:

Basic data


Field Description
$ Start of NMEA sentence
GP Talker Id; GP = GPS
RMC Message type; RMC = Recommended minimum data
172021.20 Time-stamp; 17:20:21.20 UTC
A Status; A=active, V=Void
4338.8243 Latitude 43deg 38.8243′
N North
07923.9149 Longitude 79deg 23.9149′
W West
00.0 Speed over the ground in knots
000.0 Course made good
291208 Date; 2008-12-29
11 Magnetic variation
W West
*48 Checksum


So now the objective is to:

  1. Capture this data using an application written in something (VB,VBA, C++, Python).
  2. Parse the data and create an event object.
  3. Serialize the object, probably to XML or JSON.
  4. Transfer the event-object to a CEP application—thinking Coral8—running on a different machine to simulate real-world GPS usage.
  5. Use the CEP application to generate notifications when something happens—not quite sure what at this time.


First things first, let’s define the event object using XML.

		<latitude>43 38.8243 N</latitude>
		<longitude>079 23.9149 W</longitude>


OK, this is what I would like to get—all the data is from the above example. In addition to the GPS data we have:

Field Description
id Unique event Id, always different.
entity Unique id of the device generating the event.
type Type of the event (GPS).


To be continued.