trip north July 29, 2005
Posted by vinnyt in : General, motorcycle , add a comment So I recently purchased a new motorbike.
I’ve been riding my dad’s motorcycles since I was about 7 years old, and 21 years later I finally decided it was time I went ahead and did something of my own. Like most things I buy I bought this bike at a price, and to boot it only had 8192 miles on it so it was a great find. In any case I’m currently packing my bags for a trip to bike week. Me, my uncle and my cousin are going to throw our bikes on a trailer and head north early next week. This has been a yearly tradition for them going on 4 years now and I’m just now being invited to join in. Hopefully, I’ll be able to make it for several years now. The Cool thing is I get to test out my GPS project. Unfortunately, I don’t have my wireless card so I’m going to be stuck getting internet access at Pilot truck stops that I encounter on my trip up north. So if you’re watching Where’s Vinnyt© it might not be in real time. I’m taking my camera so expect a plethora of images which will document my adventures on this voyage I’m taking. Should be very cool.
GPS update July 27, 2005
Posted by vinnyt in : Programming , add a commentI’ve completed the GPS project for the win32 fat client. The program was designed as previously stated, 2 threads one reader and one writer and a non-locking queue shared between the 2 threads. So far all is well…
Opening and talking NMEA under Win32 July 22, 2005
Posted by vinnyt in : General , add a comment okay, so I’ve started creating my GPS application. I’m going to start with a win32 program written in C++, I’m not going to use MFC, because frankly I don’t like it, and I feel that I can have a finer grain level of control using straight win32 API. Win32API C++ will allow me to work out the kinks build some functions I need and then get down to the nitty gritty of what I want to do. Then later when I translate this to a PDA or a phone whatever ultimately becomes my platform of choice I will have worked through the kinks. The application design is going to be as follows: It’s going to be a multi-threaded application there will end up being 3 threads when all is said and done. The first thread is the main execution thread that windows creates for you this thread handles user interaction with the GUI of the applications clicks and so forth, very standard in Win32. The second thread is going to handle talking to the GPS device, this thread is responsible for opening the COM port setting up parameters for that port and finally reading and parsing the NMEA sentences that come from the device. Finally the 3rd thread will be responsible for sending message to the webserver when a data connection is available. There are some things I must consider. First, I want to store every single point that I cross, and because I’m using a cellular data network the connection will not always be available to me so there needs to be a queue between the GPS thread and the network thread to store events while they are waiting to be sent. I’m going to make a simplifying assumption here and use a non-locking queue, the way you do this is always leave at least 1 item in the queue. You then don’t have to worry about locking the queue and you can cut out some of the overhead that would be created if I was going to add critical section code. I just have to make sure that when I turn off the application I check that queue to make sure all items have been sent.
So I’m going to start simple and create my connection to the device. Here’s the code I use to do that.
unsigned __stdcall GPSReader( LPVOID lpThreadParameter ){
HANDLE hSerial;
DCB dcbSerialParams = {0};
// my device lives on COM4, and will probably for the duration of this program never move
hSerial = CreateFile( “COM4″, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 );
if ( hSerial == INVALID_HANDLE_VALUE )
{
if ( GetLastError() == ERROR_FILE_NOT_FOUND )
{
MessageBox(
NULL, “Could not open COM4″, “FAILED”, MB_OK );
return FALSE;
}
}
dcbSerialParams.DCBlength = sizeof( dcbSerialParams );
if ( !GetCommState( hSerial, &dcbSerialParams ) )
{
MessageBox( NULL, “problem getting state”, “FAILED”, MB_OK );
return FALSE;
}
// The NMEA standard dictates the device must communicate
// at 4800,8,N,1
dcbSerialParams.BaudRate = CBR_4800;
dcbSerialParams.ByteSize = 8;
dcbSerialParams.StopBits = ONESTOPBIT;
dcbSerialParams.Parity = NOPARITY;
if ( !SetCommState( hSerial, &dcbSerialParams ) )
{
MessageBox( NULL, “problem setting state”, “FAILED”, MB_OK );
return FALSE;
}
for ( ;; )
{
HRESULT hres;
char szBuff[1024 + 1] = {0};
DWORD dwBytesRead = 0;
if( !ReadFile( hSerial, szBuff, 1024, &dwBytesRead, NULL ) ) {
return 1;
}
else
MessageBox( NULL, szBuff, “message”, MB_OK );
}
return 1;
}
At present this code simply opens the port reads data from it and displays this data. So next I’ll have to parse this data and slam it in my queue….. Stay tuned.
Starting on my GPS project July 20, 2005
Posted by vinnyt in : General, Programming , add a comment So,
I’ve had this idea now for a couple of years. I have been trying to build a real time tracking system for myself similar to Tracker watches. Early on I built a version that used Microsoft Roads & Trips, but this required a fairly heft connection to the Internet, as it generated a picture on the computer I was carrying with me and then uploaded that to my website. Frankly the feature set that I was able to create using this technology was less than desirable. So with that attempt working. I knew that what I wanted to create was possible, and it would just require me to dig a little deeper. A couple of years passed, and I bought a GPS and really began exploring the technology. I can now identify pretty much every NMEA sentence, and can almost convert the numbers in my head. Up until google maps came out I had been exploring how to use mapquest and the like. They have a simple interface, but every attempt I made at trying to figure out how their maps worked ended up in failure. So then Google maps was released, and within a couple of months I along with so many others figured out a way to lojack my way onto the map. The early incarnations of this software worked great, excerpt for the fact that every time Google improved their maps I ended up having to hack my code to get it working again. So luckly for all of us out there Google did us mappers a tremendous favor and produced an API so we wouldn’t have to fight every time they made a change. So my hat is off to Google for that. In creating this I now have all the tools I need to build my application. As it stands now you can play back journey’s I have been on by clicking on the “Where’s Vinny” link. What I have done thus far is simply carry my lap top and my garmin with me and using Hyper Term recorded the NMEA sentences, and then uploaded those to a data base when I had internet connectivity. Over they next couple of weeks I’m going to start spending more time with this application so that I can finally realize my goal of real-time tracking.
The woes continue July 19, 2005
Posted by vinnyt in : General , add a commentThe sun burn continues to be a source of pain in my life. I managed to spike it on the corner of a door last night, and I actually dropped to one knee from the pain. I think I’ll have to take some more aspirin to fix it.
I went and saw “Charlie and the Chocolate factory” I felt it was an excellent movie. However, it seemed almost abrupt in some places. Overall, I’d give it the 2 thumbs up.
Any way, I’m currently supposed to be in a meeting but I’m skipping it to write this.
weekend life July 18, 2005
Posted by vinnyt in : General , add a commentSo I spent the weekend with my family. It was actually quite a refreshing break from the regular weekend routine. On Saturday my baseball team was given 2 more wins putting us firmly in second place for the season. We had a pretty rough start but now we’ve collectively removed our heads, and we’re putting it together like we should. In any event my time this weekend was spent at the lake, and as a result of my mother’s dirty joke. I’m now so sun burned that blisters are forming on my shoulders. You can see the route I took back home. It was a good weekend I’m refreshed and ready to make a splash this weekend and make it large.
First post of a new generation July 6, 2005
Posted by vinnyt in : Computer Science Theory, Programming , add a commentYou can now track in near real-time my location. Where’s Vinnyt
