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.
 
 
 
 
 
 

53 lines
1.1 KiB

#pragma once
#include <QCryptographicHash>
#include <QJsonValue>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QPair>
#include <QString>
#include <QVector>
#include <QWidget>
#include <atomic>
#include <openssl/bio.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
class CommaApi : public QObject {
Q_OBJECT
public:
static QByteArray rsa_sign(QByteArray data);
static QString create_jwt(QVector<QPair<QString, QJsonValue>> payloads = {}, int expiry=3600);
private:
QNetworkAccessManager* networkAccessManager;
};
/**
* Makes a request to the request endpoint.
*/
class HttpRequest : public QObject {
Q_OBJECT
public:
explicit HttpRequest(QObject* parent, QString requestURL, const QString &cache_key = "");
QNetworkReply *reply;
void sendRequest(QString requestURL);
private:
QNetworkAccessManager *networkAccessManager;
QTimer *networkTimer;
QString cache_key;
private slots:
void requestTimeout();
void requestFinished();
signals:
void receivedResponse(QString response);
void failedResponse(QString errorString);
void timeoutResponse(QString errorString);
};