mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-20 16:03:54 +08:00
* include_what_you_use
* remove comments
* include <memory>
---------
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 2d99521e75
53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include <QtSerialBus/QCanBus>
|
|
#include <QtSerialBus/QCanBusDevice>
|
|
#include <QtSerialBus/QCanBusDeviceInfo>
|
|
|
|
#include <QComboBox>
|
|
#include <QFormLayout>
|
|
#include <QVBoxLayout>
|
|
|
|
#include "tools/cabana/streams/livestream.h"
|
|
|
|
struct SocketCanStreamConfig {
|
|
QString device = ""; // TODO: support multiple devices/buses at once
|
|
};
|
|
|
|
class SocketCanStream : public LiveStream {
|
|
Q_OBJECT
|
|
public:
|
|
SocketCanStream(QObject *parent, SocketCanStreamConfig config_ = {});
|
|
static AbstractOpenStreamWidget *widget(AbstractStream **stream);
|
|
|
|
static bool available();
|
|
|
|
inline QString routeName() const override {
|
|
return QString("Live Streaming From Socket CAN %1").arg(config.device);
|
|
}
|
|
|
|
protected:
|
|
void streamThread() override;
|
|
bool connect();
|
|
|
|
SocketCanStreamConfig config = {};
|
|
std::unique_ptr<QCanBusDevice> device;
|
|
};
|
|
|
|
class OpenSocketCanWidget : public AbstractOpenStreamWidget {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
OpenSocketCanWidget(AbstractStream **stream);
|
|
bool open() override;
|
|
QString title() override { return tr("&SocketCAN"); }
|
|
|
|
private:
|
|
void refreshDevices();
|
|
|
|
QComboBox *device_edit;
|
|
SocketCanStreamConfig config = {};
|
|
};
|