Files
Rennbahn/hardwaresetup.h

56 lines
1.2 KiB
C++

#ifndef HARDWARESETUP_H
#define HARDWARESETUP_H
#include <QtCore>
#include <boost/asio/serial_port.hpp>
#include <memory>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#ifdef ATMEGA
#include <libusb.h>
#endif
#include "database.h"
#include "datatypes.h"
#include "serial_port.h"
class HardwareSetup : public QThread {
Q_OBJECT
protected:
void run();
private:
bool shellBefore;
bool deaBefore;
#ifdef ATMEGA
libusb_device_handle * handle;
libusb_context * usbContext;
int usbGetDescriptorString(libusb_device_handle * dev, int index,
int langid, char * buf, int buflen);
libusb_device_handle * usbOpenDevice(int vendor, int product);
#endif
int fd;
bool stop;
boost::asio::io_context context;
// boost::asio::serial_port serialPort{};
void connectSTM32();
void connectSTM32Boost();
bool getShell();
bool getDea();
int * findBit(int * array, int zahl);
std::unique_ptr<serial_port> sport;
DataBase * db;
std::string PORT_PATH;
public:
void setStop();
~HardwareSetup();
HardwareSetup(DataBase * db);
signals:
void Shell(int, int);
void Dea(int, int);
};
#endif // HARDWARESETUP_H