openpilot is an open source driver assistance system. openpilot performs the functions of Automated Lane Centering and Adaptive Cruise Control for over 200 supported car makes and models.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.3 KiB

#pragma once
5 years ago
#include <QString>
#include <QNetworkAccessManager>
#include <QWidget>
#include <QVector>
#include <QMultiMap>
#include <QElapsedTimer>
#include <QReadWriteLock>
#include <bzlib.h>
#include <kj/io.h>
#include <capnp/serialize.h>
#include "cereal/gen/cpp/log.capnp.h"
#include <thread>
#include "channel.hpp"
class FileReader : public QObject {
Q_OBJECT
5 years ago
public:
FileReader(const QString& file_);
void startRequest(const QUrl &url);
~FileReader();
virtual void readyRead();
void httpFinished();
virtual void done() {};
5 years ago
public slots:
void process();
5 years ago
protected:
QNetworkReply *reply;
5 years ago
private:
QNetworkAccessManager *qnam;
QElapsedTimer timer;
QString file;
};
typedef QMultiMap<uint64_t, cereal::Event::Reader> Events;
class LogReader : public FileReader {
Q_OBJECT
public:
LogReader(const QString& file, Events *, QReadWriteLock* events_lock_, QMap<int, QPair<int, int> > *eidx_);
~LogReader();
5 years ago
void readyRead();
void done() { is_done = true; };
bool is_done = false;
5 years ago
private:
bz_stream bStream;
// backing store
QByteArray raw;
std::thread *parser;
int event_offset;
channel<int> cdled;
// global
void mergeEvents(int dled);
Events *events;
QReadWriteLock* events_lock;
QMap<int, QPair<int, int> > *eidx;
};