initListViewStartTabAccelerationCategories();
myLogin = new LoginWindow(this);
- categorylist = new CategoryList();
+ myCategorylist = new CategoryList();
myHttpClient = new HttpClient(this);
myRegistration = new Registration(this);
connect(myRegistration,SIGNAL(sendregistration()),this,SLOT(regUserToServer()));
connect(myLogin,SIGNAL(userNameChanged()),this,SLOT(userLogin()));
+ connect(myHttpClient->myXmlreader, SIGNAL(receivedCategoryList()), this, SLOT(setCategoryCompoBox()));
+ connect(myHttpClient->myXmlreader, SIGNAL(receivedTop10List()), this, SLOT(showTop10()));
myRoute = new RouteDialog( this);
//GPS
ui = NULL;
//delete result;
//delete measure;
- delete categorylist;
- categorylist = NULL;
+ delete myCategorylist;
+ myCategorylist = NULL;
delete welcomeDialog;
welcomeDialog = NULL;
delete myRoute;
*/
void CarMainWindow::setCategoryCompoBox()
{
- ui->comboBoxTopCategory->addItems(categorylist->getCategoryList());
+ qDebug() << "_setCategoryCompoBox";
+ ui->comboBoxTopCategory->addItems(myHttpClient->myXmlreader->myCategoryList->getCategoryList());
+}
+
+/**
+ *This function prcesses UI updating after a new top10List has been received.
+ *@todo Check where limitNr is taken, fixed or user input, see on_comboBoxTopCategory_currentIndexChanged.
+ */
+void CarMainWindow::showTop10()
+{
+ int limitNr = 5;
+ setListViewTopList(recentCategory, limitNr);
}
/**
*This function is used to set items to labelTopList. Top-tab view.
- *@param QString category
+ *@param Category
+ *@param Size, number of results.
*/
void CarMainWindow::setListViewTopList(QString category, int size)
{
+ qDebug() << "_setListViewTopList";
QString topList;
- topList.append( categorylist->getTopList(category, size));
+ topList.append(myHttpClient->myXmlreader->myCategoryList->getTopList(category, size));
ui->labelTopList->setText(topList);
}
void CarMainWindow::on_buttonTopRefresh_clicked()
{
myHttpClient->requestCategories();
- setCategoryCompoBox();
}
/**
*This slot function is called when ever category combobox current index changed. Top-tab view.
- *@param QString category
- *@todo Check where limitNr is taken.
+ *@param QString category.
+ *@todo Check where limitNr is taken, fixed or user input, see showTop10.
*/
void CarMainWindow::on_comboBoxTopCategory_currentIndexChanged(QString category)
{
- int limitNr = 5; //replace with real value?
+ qDebug() << "_on_comboBoxTopCategory_currentIndexChanged: " << category;
+ recentCategory = category; //for showTop10()
+ int limitNr = 5;
QString limit = QString::number(limitNr);
- category = "acceleration-0-100"; //replace with real value from category list/top window
myHttpClient->requestTopList(category, limit);
- setListViewTopList(category,10);
-}
-
-/**
- *This slot function is called when ever category combobox activated. Top-tab view.
- *@param QString category
- */
-void CarMainWindow::on_comboBoxTopCategory_activated(QString category)
-{
- setListViewTopList(category,10);
}
/**
//this->close();
}
+/**
+ *This slot function is called when pushButtonSendResult is clicked.
+ *@todo Use real category value.
+ */
void CarMainWindow::on_pushButtonSendResult_clicked()
{
- myHttpClient->sendResultXml();
+ myHttpClient->sendResultXml("acceleration-0-100");
ui->pushButtonSendResult->setEnabled(false);
}
if (newUserName.length())
{
ui->setUserPushButton->setText( "Change User");
- this->setWindowTitle("Speed freak - " + newUserName);
+ this->setWindowTitle("Speed Freak - " + newUserName);
}
else
{
ui->setUserPushButton->setText( "Set User");
- this->setWindowTitle("Speed freak");
+ this->setWindowTitle("Speed Freak");
}
}
CarMainWindow(QWidget *parent = 0);
~CarMainWindow();
Registration *myRegistration; //Check if this should be public or private
-
+ LoginWindow *myLogin;
void setComboBoxStartTabUnits(QStringList units); //Start-tab view
void setListViewStartTabAccelerationCategories(QStringList numbers); //Start-tab view
- void setListViewTopList(QString category, int size); //Top-tab view
- void setCategoryCompoBox(); //Top-tab
protected:
void changeEvent(QEvent *e);
ResultDialog *result;
//MeasureDialog *measure;
WelcomeDialog *welcomeDialog;
- CategoryList *categorylist;
+ CategoryList *myCategorylist;
HttpClient *myHttpClient;
- LoginWindow *myLogin;
RouteDialog *myRoute;
GPSData *gpsData;
Maemo5Location *location;
void initComboBoxStartTabUnits(); //Start-tab view
void initListViewStartTabAccelerationCategories(); //Start-tab view
void initializeMeasures();
+ void setListViewTopList(QString category, int size); //Top-tab view
void resetAccelerometerMeasurements();
void calibrateAccelerometer();
void setTimeAxisGapAndShowResult(double pTime);
private:
QStringList accelerationCategoriesStartTab; //Start-tab view
QStringList units; //Start-tab view
- QStringList categories; //Top-tab view
+ QString recentCategory;
QTimer *timer;
Accelerometer *accelerometer;
void on_manualStartButton_clicked();
void on_setUserPushButton_clicked();
void on_registratePushButton_clicked();
- void on_comboBoxTopCategory_activated(QString );
- //void on_pushButton_clicked();
void on_comboBoxTopCategory_currentIndexChanged(QString category); //Top-tab view
void on_listViewStartTabAccelerationCategories_clicked(QModelIndex index); //Start-tab view
void updateComboBoxStartTabUnits(QString unit); //Start-tab view
void userLogin();
void readAccelerometerData();
void handleCheckPoint(double totalTime, double currentSpeed);
+ void setCategoryCompoBox(); //Top-tab
+ void showTop10();
+
};
#endif // CARMAINWINDOW_H
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
+#include <QDebug>
#include "categorylist.h"
/**
*/
CategoryList::CategoryList()
{
- categoryList << "Speed" << "acceleration-0-40" << "acceleration-0-100" << "G-force"; // OLPU
- //top10AccelerationList << "acc-tulos1\nacc-tulos2\nacc-tulos3\nacc-tulos4\nacc-tulos5\nacc-tulos6\nacc-tulos7\nacc-tulos8\nacc-tulos9\nacc-tulos10";
+
}
/**
/**
*This is return function.
- *@todo Read real top 10 category list
*@return QStringList categoryList
*/
QStringList CategoryList::getCategoryList()
{
+ qDebug() << "_getCategoryList" ;
return categoryList;
}
/**
+ *Append an item in the end of the categorylist.
+ */
+void CategoryList::appendCategoryList(QString item)
+{
+ categoryList.append(item);
+}
+
+/**
+ *Input an item into the categorylist.
+ */
+void CategoryList::fillCategoryList(int index, QString item)
+{
+ categoryList.insert(index, item);
+}
+
+/**
+ *Show an item of the categorylist.
+ */
+QString CategoryList::itemOfCategoryList(int index)
+{
+ return categoryList.at(index);
+}
+
+/**
+ *Clear categorylist.
+ */
+void CategoryList::clearCategoryList()
+{
+ categoryList.clear();
+ qDebug() << "_clearCategoryList" ;
+}
+
+/**
+ *Read size of categorylist.
+ */
+int CategoryList::sizeOfCategoryList()
+{
+ return categoryList.size();
+}
+
+/**
*This function is used to get items to top list of current category.
*@param QString category
*@param int size
*/
QString CategoryList::getTopList( QString category, int size)
{
- if (category == "acceleration-0-100")
- {
- //topList.append(xmlreader->getTop10AccelerationList());
- //return top10AccelerationList;
- return "acc-tulos1\nacc-tulos2\nacc-tulos3\nacc-tulos4\nacc-tulos5\nacc-tulos6\nacc-tulos7\nacc-tulos8\nacc-tulos9\nacc-tulos10";
-
- }
- else if (category == "acceleration-0-40")
- {
- //topList.append(xmlreader->getTop10AccelerationList());
- //return top10AccelerationList;
- return "acc-40-tulos1\nacc-40-tulos2\nacc-40-tulos3\nacc-40-tulos4\nacc-40-tulos5\nacc-40-tulos6\nacc-40-tulos7\nacc-40-tulos8\nacc-40-tulos9\nacc-40-tulos10";
+ qDebug() << "_getTopList";
- }
- else if (category == "Speed")
+ if(!(top10List.isEmpty()))
{
- //topList.append(xmlreader->getTop10SpeedList());
- //return top10SpeedList;
- return "speed-tulos1\nspeed-tulos2\nspeed-tulos3\nspeed-tulos4\nspeed-tulos5\nspeed-tulos6\nspeed-tulos7\nspeed-tulos8\nspeed-tulos9\nspeed-tulos10";
+ return top10List;
}
- else if (category == "G-force")
+ else
{
- //topList.append(xmlreader->getTop10GforceList());
- //return top10GforceList;
- return "g-tulos1\ng-tulos2\ng-tulos3\ng-tulos4\ng-tulos5\ng-tulos6\ng-tulos7\ng-tulos8\ng-tulos9\ng-tulos10";
-
+ QString emptyStr("");
+ qDebug() << "_getTopList: Category not found";
+ return emptyStr;
}
}
public:
CategoryList();
~CategoryList();
+ QString top10List;
+
QStringList getCategoryList();
+ void fillCategoryList(int index, QString item);
+ void appendCategoryList(QString item);
+ QString itemOfCategoryList(int index);
QString getTopList( QString category, int size);
+ void clearCategoryList();
+ int sizeOfCategoryList();
private:
QStringList categoryList;
- QString top10AccelerationList;
- QString top10SpeedList;
- QString top10GforceList;
+
};
#endif // CATEGORYLIST_H
#include "httpclient.h"
#include "carmainwindow.h"
+
/**
*@brief Constructor, connects object to GUI
*@param Pointer to carmainwindow, which is temporarily used during development
*Send authentication information in the header.
*@todo Read category elsewhere.
*/
-void HttpClient::sendResultXml()
+void HttpClient::sendResultXml(QString category)
{
qDebug() << "_sendResultXml";
QBuffer *xmlbuffer = new QBuffer();
- QString category_name = "acceleration-0-100"; //replace with real value from category list
- QUrl qurl("http://api.speedfreak-app.com/api/update/" + category_name);
+ QUrl qurl("http://api.speedfreak-app.com/api/update/" + category);
qDebug() << qurl.toString();
QNetworkRequest request(qurl);
QNetworkReply *currentDownload;
myXmlwriter->writeResult(xmlbuffer);
qDebug() << "carmainwindow: xmlbuffer->data(): " << xmlbuffer->data();
- QString credentials = myMainw->myRegistration->getUserName() + ":" + myMainw->myRegistration->getPassword();
+ QString credentials = myMainw->myLogin->getUserName() + ":" + myMainw->myLogin->getPassword();
credentials = "Basic " + credentials.toAscii().toBase64();
request.setRawHeader(QByteArray("Authorization"),credentials.toAscii());
QNetworkRequest request(qurl);
QNetworkReply *currentDownload;
- QString credentials = myMainw->myRegistration->getUserName() + ":" + myMainw->myRegistration->getPassword();
+ QString credentials = myMainw->myLogin->getUserName() + ":" + myMainw->myLogin->getPassword();
credentials = "Basic " + credentials.toAscii().toBase64();
request.setRawHeader(QByteArray("Authorization"),credentials.toAscii());
QNetworkRequest request(qurl);
QNetworkReply *currentDownload;
- QString credentials = myMainw->myRegistration->getUserName() + ":" + myMainw->myRegistration->getPassword();
+ QString credentials = myMainw->myLogin->getUserName() + ":" + myMainw->myLogin->getPassword();
credentials = "Basic " + credentials.toAscii().toBase64();
request.setRawHeader(QByteArray("Authorization"),credentials.toAscii());
QNetworkRequest request(qurl);
QNetworkReply *currentDownload;
- QString credentials = myMainw->myRegistration->getUserName() + ":" + myMainw->myRegistration->getPassword();
+ QString credentials = myMainw->myLogin->getUserName() + ":" + myMainw->myLogin->getPassword();
credentials = "Basic " + credentials.toAscii().toBase64();
request.setRawHeader(QByteArray("Authorization"),credentials.toAscii());
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- qDebug() << reply->readAll();
+ QMessageBox::about(myMainw, "Server reply to result sending", "Result received " + reply->readAll());
}
}
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- qDebug() << reply->readAll();
+ QMessageBox::about(myMainw, "Server reply to requesting categories ", "OK");
}
}
qDebug() << "_ackOffLogin";
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
- myXmlreader->xmlReadTop10Results(reply);
QNetworkReply::NetworkError errorcode;
errorcode = reply->error();
}
else {
qDebug() << "errorcode:" << errorcode << reply->errorString();
- qDebug() << reply->readAll();
+ QMessageBox::about(myMainw, "Server reply to requesting top 10 list", "OK " + reply->readAll());
}
}
-class HttpClient : public QObject
-{
+class HttpClient : public QObject {
Q_OBJECT
public:
HttpClient(CarMainWindow *myCarw);
private:
CarMainWindow *myMainw;
QNetworkAccessManager *netManager;
- //XmlWriter *myXmlwriter;
- //XmlReader *myXmlreader;
public slots:
void requestRegistration();
void checkLogin();
- void sendResultXml();
+ void sendResultXml(QString category);
void requestTopList(QString category, QString limit);
void requestCategories();
void ackOfResult();
*/
XmlReader::XmlReader()
{
- xmlShow();
+ myCategoryList = new CategoryList();
}
/**
{
category = "";
unit = "";
- description = "";
position = "";
user = "";
value = "";
+ delete myCategoryList;
}
/**
- *This function is used to parsing xml file.
+ *This function is used to parse top 10 results of a certain category.
*/
void XmlReader::xmlReadTop10Results(QNetworkReply *device)
{
qDebug() << "_xmlReadTop10Results";
- xmlreader.addData(device->readAll());
+ int i = 0;
+ int receivedFlag = 0;
+
+ xmlreader.clear();
+ QByteArray array = device->readAll();
+ qDebug() << "array: " << array;
+ xmlreader.addData(array);
+ //xmlreader.addData(device->readAll());
+
+ if(!(myCategoryList->top10List.isEmpty())) {
+ myCategoryList->top10List.clear();
+ }
//Go trough the xml document
while(!xmlreader.atEnd())
if(xmlreader.name() == "results")
{
qDebug() << xmlreader.name();
- attr = xmlreader.attributes();
-
- category = attr.value("category").toString();
- unit = attr.value("unit").toString();
- description = attr.value("description").toString();
-
- top10List << category;
- qDebug() << top10List << unit << description;
}
-
if(xmlreader.name() == "result")
{
qDebug() << "result";
attr = xmlreader.attributes();
+ user = attr.value("username").toString();
position = attr.value("position").toString();
- user = attr.value("user").toString();
+ date = attr.value("date").toString();
+ unit = attr.value("unit").toString();
value = attr.value("value").toString();
- if (category == "acceleration-0-100")
- {
- top10AccelerationList.append(position + "\t" +
+ myCategoryList->top10List.append(position + "\t" +
user + "\t" +
- value +
+ value + " " +
unit + "\t" +
- description + "\n");
- }
-
- if(category == "top10speed")
- {
- top10SpeedList.append(position + "\t" +
- user + "\t" +
- value +
- unit + "\t" +
- description + "\n");
- }
-
- if(category == "top10gforce")
- {
- top10GforceList.append(position + "\t" +
- user + "\t" +
- value +
- unit + "\t" +
- description + "\n");
- }
- qDebug() << position << user << value << unit;
+ date + "\n");
+
+ qDebug() << position << user << value << unit << date;
+ i++;
+ receivedFlag = 1;
}
}
}
+ //Only change labelTopList if a new top10List has been received
+ if(receivedFlag)
+ {
+ qDebug() << "receivedTop10List() emitted";
+ emit receivedTop10List();
+ }
}
void XmlReader::xmlReadCategories(QNetworkReply *device)
qDebug() << "_xmlReadCategories";
int i = 0;
+ int receivedFlag = 0;
+ xmlreader.clear();
QByteArray array = device->readAll();
- qDebug() << array;
+ qDebug() << "array: " << array;
xmlreader.addData(array);
+ //xmlreader.addData(device->readAll());
+
+ if(myCategoryList->sizeOfCategoryList() != 0) {
+ myCategoryList->clearCategoryList();
+ }
+ //qDebug() << "sizeOfCategoryList(): " << myCategoryList->sizeOfCategoryList();
//Go trough the xml document
while(!xmlreader.atEnd())
if(xmlreader.name() == "category")
{
qDebug() << xmlreader.name();
- categoryList.insert(i, xmlreader.readElementText());
- qDebug() << "i=" << i << categoryList.at(i);
+ myCategoryList->appendCategoryList(xmlreader.readElementText());
+ qDebug() << "i=" << i << myCategoryList->itemOfCategoryList(i);
i++;
+ receivedFlag = 1;
}
}
}
+ //Only change comboBoxTopCategory if a new list has been received
+ if(receivedFlag)
+ {
+ qDebug() << "receivedCategoryList() emitted";
+ emit receivedCategoryList();
+ }
}
/**
#include <QXmlStreamReader>
#include <QStringList>
#include <QNetworkReply>
+#include "categorylist.h"
-class XmlReader : public QObject
-{
+class XmlReader : public QObject {
+ Q_OBJECT
public:
XmlReader();
~XmlReader();
+ CategoryList *myCategoryList;
private:
QXmlStreamReader xmlreader;
- QStringList top10List; // Next 4 to be removed. Categorylist now in own class.
- QStringList categoryList;
- QString top10AccelerationList;
- QString top10SpeedList;
- QString top10GforceList;
QXmlStreamAttributes attr;
QString category;
QString unit;
- QString description;
+ QString date;
QString position;
QString user;
QString value;
+signals:
+ void receivedCategoryList();
+ void receivedTop10List();
+
public slots:
void xmlReadTop10Results(QNetworkReply *device);
void xmlReadCategories(QNetworkReply *device);
*/
XmlWriter::XmlWriter()
{
- tmpvalue = 10;
+ tmpvalue = 110;
+ trackInd = 0;
}
/**
tmpvalue++;
qDebug() << tmpvalue;
xmlwriter.writeAttribute("value", QString::number(tmpvalue));
- xmlwriter.writeAttribute("unit", "seconds");
- xmlwriter.writeAttribute("date", QDateTime::currentDateTime().toString());
xmlwriter.writeEndElement();
xmlwriter.writeEndDocument();
}
/**
+ *@brief Write track to server.
+ *@param Starting index of gps results table.
+ *@param Ending index of gps results table.
+ *@todo Connect to real values.
+ *@todo Decide suitable parameters.
+ */
+void XmlWriter::writeGpsTrack(int startInd, int stopInd)
+{
+ qDebug() << "_writeGpsTrack";
+ analyzeGpsData();
+
+ int i = 0;
+
+ xmlwriter.writeStartElement("gpx");
+ xmlwriter.writeAttribute("someattribute", "abc");
+ xmlwriter.writeAttribute("otherattribute", "cde");
+
+ xmlwriter.writeStartElement("metadata");
+ xmlwriter.writeStartElement("link");
+ xmlwriter.writeAttribute("href", "http://api.speedfreak-app.com/api/track");
+ xmlwriter.writeCharacters("Speed Freak");
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("time");
+ xmlwriter.writeCharacters(QDateTime::currentDateTime().toString());
+ xmlwriter.writeEndElement();
+ xmlwriter.writeEndElement(); //metadata
+
+ xmlwriter.writeStartElement("trk");
+ xmlwriter.writeStartElement("name");
+ xmlwriter.writeCharacters("Example Track");
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("trkseg");
+ for(i = startInd; i < (stopInd - startInd); i++) {
+ xmlwriter.writeStartElement("trkpt");
+ xmlwriter.writeAttribute("lat", QString::number(trackTable[i].latitude));
+ xmlwriter.writeAttribute("lon", QString::number(trackTable[i].longitude));
+ xmlwriter.writeStartElement("ele");
+ xmlwriter.writeCharacters(QString::number(trackTable[i].altitude));
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("time");
+ xmlwriter.writeCharacters(QString::number(trackTable[i].time));
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("speed");
+ xmlwriter.writeCharacters(QString::number(trackTable[i].speed));
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("track");
+ xmlwriter.writeCharacters(QString::number(trackTable[i].track));
+ xmlwriter.writeEndElement();
+ xmlwriter.writeEndElement(); //trkpt
+ }
+ xmlwriter.writeEndElement(); //trkseg
+ xmlwriter.writeEndElement(); //trk
+ xmlwriter.writeEndElement(); //gpx
+}
+
+
+/**
*@brief Opens and closes a file, when xml information is written into a file,
*and passes file to writeXmlFile()
*@param usr for user name.
{
xmlwriter.setDevice(device);
xmlwriter.writeStartDocument();
- writeItems();
+ //writeItems();
//serverWritesXml();
+ writeGpsTrack(0, 16);
xmlwriter.writeEndDocument();
return true;
xmlwriter.writeEndElement();
xmlwriter.writeStartElement("category");
- xmlwriter.writeCharacters("acceleration-0-60");
+ xmlwriter.writeCharacters("acceleration-0-40");
xmlwriter.writeEndElement();
xmlwriter.writeStartElement("category");
xmlwriter.writeEndElement();
}
+
+
+/**
+ *@brief A temp function during development, used to create data for drawing route and for server.
+ */
+void XmlWriter::analyzeGpsData()
+{
+ qDebug() << "_analyzeGpsData";
+
+ double startTime;
+ int tableSize = 0;
+
+ qDebug() << "sizeof(analyzeTable)" << sizeof(analyzeTable);
+ tableSize = 16;
+
+ for(int i = 1; i < tableSize; i++)
+ {
+ //example of one feature whose consequent values are compared and saved if they differentiate too much
+ if(analyzeTable[i].speed < (analyzeTable[i-1].speed - 1) ||
+ analyzeTable[i].speed > (analyzeTable[i-1].speed + 1) )
+ {
+ trackTable[trackInd] = analyzeTable[i];
+ trackInd++;
+ qDebug() << "trackTable[trackInd].speed" << trackTable[trackInd].speed;
+ }
+ }
+}
+
+void XmlWriter::initPointTable(gpsPoint *table, int count, double add1, int add2, int add3)
+{
+ qDebug() << "_initPointTable";
+
+ int i = 1;
+ int j = 0;
+
+ table[0].latitude = 67.00;
+ table[0].longitude = 27.50;
+ table[0].altitude = 7.00;
+ table[0].speed = 0;
+ table[0].time = 0;
+
+ for(j = 0; j < count; j++)
+ {
+ table[i].latitude = table[i-1].latitude + add1;
+ //table[i].longitude = table[i-1].longitude + add1;
+ table[i].altitude = table[i-1].altitude + add1;
+ table[i].speed = table[i-1].speed + add2;
+ table[i].track = table[i-1].track + 1;
+ table[i].time = table[i-1].time + add3;
+ i++;
+ }
+ for(j = 0; j < count; j++)
+ {
+ //table[i].latitude = table[i-1].latitude + add1;
+ table[i].longitude = table[i-1].longitude + add1;
+ table[i].altitude = table[i-1].altitude -add1;
+ table[i].speed = table[i-1].speed + add2;
+ table[i].track = table[i-1].track + 1;
+ table[i].time = table[i-1].time + add3;
+ i++;
+ }
+ for(j = 0; j < count; j++)
+ {
+ table[i].latitude = table[i-1].latitude - add1;
+ //table[i].longitude = table[i-1].longitude + add1;
+ table[i].altitude = table[i-1].altitude + add1;
+ table[i].speed = table[i-1].speed - add2;
+ table[i].track = table[i-1].track - 1;
+ table[i].time = table[i-1].time + add3;
+ i++;
+ }
+ for(j = 0; j < count; j++)
+ {
+ //table[i].latitude = table[i-1].latitude + add1;
+ table[i].longitude = table[i-1].longitude - add1;
+ table[i].altitude = table[i-1].altitude - add1;
+ table[i].speed = table[i-1].speed - add2;
+ table[i].track = table[i-1].track - 1;
+ table[i].time = table[i-1].time + add3;
+ i++;
+ }
+}
+
+
#include <QApplication>
-class XmlWriter : public QObject
-{
+class XmlWriter : public QObject {
+ Q_OBJECT
public:
XmlWriter();
~XmlWriter();
int tmpvalue;
+ typedef struct {
+ double time;
+ double latitude;
+ double longitude;
+ double altitude;
+ double speed;
+ double track;
+ } gpsPoint;
+ gpsPoint trackTable[100];
+ gpsPoint analyzeTable[100];
+ int trackInd;
private:
QXmlStreamWriter xmlwriter;
void writeXml();
void writeItems();
void serverWritesXml();
-
+ void writeGpsTrack(int startInd, int stopInd);
+ void initPointTable(gpsPoint *table, int count, double add1, int add2, int add3);
+ void analyzeGpsData();
};
#endif // XMLWRITER_H
+