qtmobility/src/location/qlocationutils.cpp
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 11 06b8e2af4411
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    68         *hasFix = parts[6].toInt() > 0;
    68         *hasFix = parts[6].toInt() > 0;
    69 
    69 
    70     if (parts.count() > 1 && parts[1].count() > 0) {
    70     if (parts.count() > 1 && parts[1].count() > 0) {
    71         QTime time;
    71         QTime time;
    72         if (QLocationUtils::getNmeaTime(parts[1], &time))
    72         if (QLocationUtils::getNmeaTime(parts[1], &time))
    73             info->setDateTime(QDateTime(QDate(), time, Qt::UTC));
    73             info->setTimestamp(QDateTime(QDate(), time, Qt::UTC));
    74     }
    74     }
    75 
    75 
    76     if (parts.count() > 5 && parts[3].count() == 1 && parts[5].count() == 1) {
    76     if (parts.count() > 5 && parts[3].count() == 1 && parts[5].count() == 1) {
    77         double lat;
    77         double lat;
    78         double lng;
    78         double lng;
   103         *hasFix = (parts[6][0] == 'A');
   103         *hasFix = (parts[6][0] == 'A');
   104 
   104 
   105     if (parts.count() > 5 && parts[5].count() > 0) {
   105     if (parts.count() > 5 && parts[5].count() > 0) {
   106         QTime time;
   106         QTime time;
   107         if (QLocationUtils::getNmeaTime(parts[5], &time))
   107         if (QLocationUtils::getNmeaTime(parts[5], &time))
   108             info->setDateTime(QDateTime(QDate(), time, Qt::UTC));
   108             info->setTimestamp(QDateTime(QDate(), time, Qt::UTC));
   109     }
   109     }
   110 
   110 
   111     if (parts.count() > 4 && parts[2].count() == 1 && parts[4].count() == 1) {
   111     if (parts.count() > 4 && parts[2].count() == 1 && parts[4].count() == 1) {
   112         double lat;
   112         double lat;
   113         double lng;
   113         double lng;
   175     }
   175     }
   176 
   176 
   177     if (coord.type() != QGeoCoordinate::InvalidCoordinate)
   177     if (coord.type() != QGeoCoordinate::InvalidCoordinate)
   178         info->setCoordinate(coord);
   178         info->setCoordinate(coord);
   179 
   179 
   180     info->setDateTime(QDateTime(date, time, Qt::UTC));
   180     info->setTimestamp(QDateTime(date, time, Qt::UTC));
   181 }
   181 }
   182 
   182 
   183 static void qlocationutils_readVtg(const char *data, int size, QGeoPositionInfo *info, bool *hasFix)
   183 static void qlocationutils_readVtg(const char *data, int size, QGeoPositionInfo *info, bool *hasFix)
   184 {
   184 {
   185     if (hasFix)
   185     if (hasFix)
   222         int year = parts[4].toUInt();
   222         int year = parts[4].toUInt();
   223         if (day > 0 && month > 0 && year > 0)
   223         if (day > 0 && month > 0 && year > 0)
   224             date.setDate(year, month, day);
   224             date.setDate(year, month, day);
   225     }
   225     }
   226 
   226 
   227     info->setDateTime(QDateTime(date, time, Qt::UTC));
   227     info->setTimestamp(QDateTime(date, time, Qt::UTC));
   228 }
   228 }
   229 
   229 
   230 bool QLocationUtils::getPosInfoFromNmea(const char *data, int size, QGeoPositionInfo *info, bool *hasFix)
   230 bool QLocationUtils::getPosInfoFromNmea(const char *data, int size, QGeoPositionInfo *info, bool *hasFix)
   231 {
   231 {
   232     if (!info)
   232     if (!info)