Afternoon folks, I’m supposed to be studying but dont have the heart to, so I’m documenting a recent project from Uni.
The remit was to be able to parse RS232 data coming in from a GPS unit and reformat it for a LCD display. I dont have the part numbers handy but I was programming on a 18F series PIC that supported C.
Most of the ancillary code is more platform dependant, such as working with the PIC interrupts etc, so for the purposes of this code snippit, assumme that a NMEA sentence (I used RMC and some RMB, but never really finished that bit) stored as a character buffer, and a structure, as defined, to store relevent data in.
PLEASE read up about NMEA sentence structure before continuing
typedef struct message
{
//date
int day, month, year;
//Time
int hour, min, sec;
//lat
int lat_deg;
float lat_min;
char lat_ref;
//lng
int lng_deg;
float lng_min;
char lng_ref;
}message;
Since NMEA sentences are comma separated values, I kinda cheated and iterated thru the string, replacing the commas with terminating characters and recording the next positions as character pointers.
for(i=0;i<BUFFERSIZE;i++){
if(end)buffer[i]=0; //wipe the rest of the sentence
if(buffer[i]==42&&check==1){ //asterix
check=0;
if(checksum==chr2hex(&buffer[i+1])) valid=1;
else valid=0;
i+=2; //get to the end of the checksum
end=1; //this is the end of the current sentence
}
if(check)checksum^=buffer[i];
if(buffer[i]==36){ //dollarsign
buffer[i]=0;
check=1;
AddToList(&(buffer[i+1])); //ignore first character
}
if(buffer[i]==44){
buffer[i]=0; //replace all commas with nulls
AddToList(&(buffer[i+1])); //add next position to list of words
}
}
The first character(dollar sign) is ignored because it is never needed beyond this point.
The NMEA sentence structure includes a asterix delimited checksum, i.e everything after the dollarsign and before the asterix is progressivly XOR’d and the hex value representation of this result is concatenated on the end of the sentence before transmission.
the chr2 hex function simply converts two ASCII characters to their Hex value equivalent.
AddToList, strangly enough, adds the pointer passed to it to a wordlist, which is an array of character pointers.
Now we have a list of pointers, because i used a character pointer array, and ended all the strings with nulls, we essentially now have individual strings for each part of the NMEA sentence, that can be addressed directly. eg:
{ //GPRMC
getTime(words[1],&incoming);
getDate(words[9],&incoming);
getLat(words[3],&incoming,*words[3+1]);
getLng(words[5],&incoming,*words[5+1]);
}
In this instance, the get functions all take two arguments, what to read from, and where to put it.
For anyone whos interested the full code is here
I guess i better do some work then.
24
May 08
EEEpc note
Ok, got the 900, sorry this blog is very very late
Pros:
AMAZINGLY small, you wont believe how small it is until you use one
The keyboard is just managable
the Webcam is amazing quality when it works
More responsive than i imagined
The Extra 16GB SSD really helps
Wonderfully fast bootups (If you never plug it in to any accessories (other than charger) set the Boot Booster enabled under the BIOS, trims a second or two)
Cons:
Battery life less than expected
Wireless strength depends on the driver you use
Webcam and Webcam-mic not fully functional (currently) under Ubuntu 8.04
What I’ve done:
Managed to get a dual boot system between the Xandros OS and Ubuntu 8.04 by resizing my home partition on the 16GB SSD and installing in there (dont bother with a swap drive)
Grub works wonderfully and straight out of the install i still have both the standard and recovery boot options thru xandros.
As for install, use this
And for tweaking use this BUT to fix the sound you have to go back in and re fix alsa (the 700 tweak doesnt work for the 900)
sudo alsactl restore
I think that was all i had to do for basic operations.
Also got Kismet and the Aircrack-ng suites working with a bit of giggery pokery with an aim of stealing my dads old GPS and getting gpsmap to work properly, My personal recommendation is to install both from source, in the case of aircrack, you need to go into the folder that was built and make sure that all of the generated binary files are copied to /usr/bin or /usr/sbin depending on how paranoid you are (I’m not) because the install script doesnt install airmon, aireply, ivstools, packetforge, and a few other things i cant remember off the top of my head
As for the kismet source, i use source=madwifi_ag,atho,atheros and instead of relying on kismet to open the card as monitor, i use airmon and wlanconfig to kill the other interfaces first, eg
sudo wlanconfig ath0 destroy
sudo airmon-ng start wifi0
kismet (i did the suidinstall of kismet so there is no need for sudo. for a single user system the suidinstall is probably easiest)
I cant really talk about the performance of aircrack because truth be told i wouldnt have the patience for a 900MHz to get thru that kinda work, i collect as many packets as i can and get my dual core 3GHz 64bit system to do the dirty work (also usually do this over ssh if i can get an alternate connection, am working on a system where the ivs file can be emailed and an email reply will be sent back, with either the key, or “MEGAFAIL”)
Anyway
Battery life. thats a joke. Its less that the 701 my dad has. yeah, yeah, i know, its more powerful, bigger screen, that wud be fine if it wasnt just the UK getting the kneecapped batteries:
List of countries getting 5200mAh battery:TW,HK,USA,CAN,IT
4400mAh:UK
If anyone is reading this please go to http://forum.eeeuser.com/viewtopic.php?id=27140 and make your voice heard, cus i want the battery that was handed out to reviewers! (the forum explains it better than me)