Λοιπόν.
Η πλατφόρμα που χρησιμοποιώ πλέον είναι το διάσημο εδώ και λίγο καιρό Raspberry PI
https://www.raspberrypi.org/quick-start-guide
Είναι ένα linux box με ARM cpu που στοιχίζει μόλις 25$
Έχει άπειρες εφαρμογές σαν συσκευή.
Ξαναέγραψα λοιπόν τα πράγματα που κάνει το Raspberry να συνδέεται με bluetooth με το GPS και το OBD.
Επίσης, ξαναέγραψα τον κώδικα για το GPS data acquisition και προς το παρών κάνω log gpstime,latitude,longitude,speed(km/h),fix,satellites,altitude(m)
Εδώ και ο κώδικας για τους πιο περίεργους
Κώδικας:
#include <iostream>
#include <fstream>
#include <string>
#include <boost/regex.hpp>
using namespace std;
int main(int argc, const char *argv[])
{
string line;
ifstream myfile ("/dev/rfcomm0");
// get the logfile from the input
string mylogfile = argv[1];
cout << mylogfile << endl;
ofstream logfile;
logfile.open((mylogfile).c_str());
string gpstime,gpslatitude,gpslongitude,gpsfix,gpssat,gpsaltitude,gpsspeedtext;
int gpsspeed;
// print the header
logfile << "# header information" << endl;
logfile << "# gpstime,latitude,longitude,speed(km/h),fix,satellites,altitude(m)" << endl;
if(myfile.is_open())
{
while(!myfile.eof())
{
getline (myfile,line);
boost::regex gprmc(".+GPRMC,\\d+\\.\\d+,\\w,\\d+\\.\\d+,\\w,\\d+\\.\\d+,\\w,(\\d+\\.\\d+).+");
boost::smatch mgprmc;
if(boost::regex_match(line, mgprmc, gprmc, boost::match_extra))
{
gpsspeedtext=mgprmc[1];
istringstream speedbuf(gpsspeedtext);
speedbuf >> gpsspeed;
// now we need to convert it to kilometers
gpsspeed=1.852*gpsspeed;
} // if
boost::regex gpgga(".+GPGGA,(\\d+\\.\\d+),(\\d+\\.\\d+,\\w),(\\d+\\.\\d+,\\w),(\\d+),(\\d+),\\d+\\.\\d+,(\\d+\\.\\d+).+");
boost::smatch mgpgga;
if(boost::regex_match(line, mgpgga, gpgga, boost::match_extra))
{
gpstime=mgpgga[1];
gpslatitude=mgpgga[2];
gpslongitude=mgpgga[3];
gpsfix=mgpgga[4];
gpssat=mgpgga[5];
gpsaltitude=mgpgga[6];
logfile << gpstime << "," << gpslatitude << "," << gpslongitude << "," << "," << gpsspeed << gpsfix << "," << gpssat << "," << gpsaltitude << endl;
}
} // while
myfile.close();
logfile.close();
} // if
return 0;
}