static int writeGPSChannels(SampleRecord *sampleRecord, size_t currentTicks, GPSConfig *config){ int rate = SAMPLE_DISABLED; { size_t sr = config->dateCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->GPS_DateSample.intValue = getDate(); } } } { size_t sr = config->timeCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->GPS_TimeSample.floatValue = getUTCTime(); } } } { //latitude sample rate is a stand-in for position sample rate size_t sr = config->latitudeCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->GPS_LatitueSample.floatValue = getLatitude(); sampleRecord->GPS_LongitudeSample.floatValue = getLongitude(); } } } { size_t sr = config->satellitesCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->GPS_SatellitesSample.intValue = getSatellitesUsedForPosition(); } } } { size_t sr = config->speedCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->GPS_SpeedSample.floatValue = getGPSSpeed() * 0.621371192; //convert to MPH } } } return rate; }
static int writeTrackChannels(SampleRecord *sampleRecord, size_t currentTicks, TrackConfig *config){ int rate = SAMPLE_DISABLED; { size_t sr = config->lapCountCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->Track_LapCountSample.intValue = getLapCount(); } } } { size_t sr = config->splitTimeCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->Track_SplitTimeSample.floatValue = getLastSectorTime(); // getLastSplitTime()->getLastSectorTime() ?-jrwiebe } } } { size_t sr = config->lapTimeCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->Track_LapTimeSample.floatValue = getLastLapTime(); } } } { size_t sr = config->distanceCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->Track_DistanceSample.floatValue = getGpsDistance() * 0.621371192; //convert to miles } } } { size_t sr = config->predTimeCfg.sampleRate; if (sr != SAMPLE_DISABLED){ if ((currentTicks % sr) == 0){ rate = HIGHER_SAMPLE_RATE(sr, rate); sampleRecord->Track_PredTimeSample.floatValue = get_predicted_time(getGPSSpeed()); } } } return rate; }
float getGpsSpeedInMph() { return getGPSSpeed() * 0.621371192; //convert to MPH }
/* Function to populate TSK Blackboard exif related attributes */ void extractExifData(ExifData * exifData, TskFile * pFile) { std::map<ExifTag, TSK_ATTRIBUTE_TYPE>::iterator it; std::vector<TskBlackboardAttribute> attrs; std::string datetime = ""; int timezone = 0; for (it = tagMap.begin(); it != tagMap.end(); ++it) { ExifEntry * exifEntry = exif_data_get_entry(exifData, it->first); char tag_data[256]; if (exifEntry == NULL) continue; if (it->first == EXIF_TAG_GPS_LATITUDE || it->first == EXIF_TAG_GPS_LONGITUDE) { // Check for the EXIF_IFD_GPS image file directory to avoid interoperability value ExifIfd ifd = exif_entry_get_ifd(exifEntry); if (ifd != EXIF_IFD_GPS) continue; exif_entry_get_value(exifEntry, tag_data, 256); float decDegrees = getDecimalDegrees(tag_data); char refValue[2]; if (it->first == EXIF_TAG_GPS_LATITUDE) { // Get the latitude reference value; used to determine if positive or negative decimal value ExifEntry * latitudeRef = exif_data_get_entry(exifData, it->first); exif_entry_get_value(latitudeRef, refValue,2); if (strcmp(refValue, "S") == 0) decDegrees *= -1; } else { // Get the longitude reference value; used to determine if positive or negative decimal value ExifEntry * longitudeRef = exif_data_get_entry(exifData, it->first); exif_entry_get_value(longitudeRef, refValue,2); if (strcmp(refValue, "W") == 0) decDegrees *= -1; } TskBlackboardAttribute attr(it->second, name(), "", decDegrees); attrs.push_back(attr); } else if (it->first == EXIF_TAG_GPS_SPEED) { // Check for the EXIF_IFD_GPS image file directory to avoid interoperability value ExifIfd ifd = exif_entry_get_ifd(exifEntry); if (ifd != EXIF_IFD_GPS) continue; //Get the GPS speed value exif_entry_get_value(exifEntry, tag_data, 256); float speed = getGPSSpeed(tag_data); char refValue[2]; //Get the GPS speed reference value ExifEntry * speedRef = exif_data_get_entry(exifData, it->first); exif_entry_get_value(speedRef, refValue,2); //Convert Kilometers per hour to meters per second if (strcmp(refValue, "K") == 0) { speed *= 0.277778; } //Convert Miles per hour to meters per second if (strcmp(refValue, "M") == 0) { speed *= 0.44704; } //Convert Knots to meters per second if (strcmp(refValue, "N") == 0) { speed *= 0.514444; } TskBlackboardAttribute attr(it->second, name(), "", speed); attrs.push_back(attr); } else if (it->first == EXIF_TAG_DATE_TIME_ORIGINAL) { exif_entry_get_value(exifEntry, tag_data, 256); datetime = std::string(tag_data); } else if(it->first == EXIF_TAG_TIME_ZONE_OFFSET){ exif_entry_get_value(exifEntry, tag_data, 256); timezone = atoi(tag_data); } else { // Get the tag's data exif_entry_get_value(exifEntry, tag_data, 256); // Add tag data to blackboard TskBlackboardAttribute attr(it->second, name(), "", tag_data); attrs.push_back(attr); } } if(!datetime.empty()){ Poco::DateTime parsedDT; int tzd; Poco::DateTimeParser::tryParse(datetime, parsedDT, tzd); if(timezone) parsedDT.makeUTC(timezone); else parsedDT.makeUTC(tzd); TskBlackboardAttribute attr(TSK_DATETIME, name(), "", (uint64_t)parsedDT.utcTime()); attrs.push_back(attr); } if(attrs.size() > 0){ TskBlackboardArtifact art = pFile->createArtifact(TSK_METADATA_EXIF); for(size_t i = 0; i < attrs.size(); i++){ art.addAttribute(attrs[i]); } } }