50 lines
1.1 KiB
C++
50 lines
1.1 KiB
C++
#ifndef WIDGET_H
|
|
#define WIDGET_H
|
|
|
|
#include <QCheckBox>
|
|
#include <QWidget>
|
|
#include "AES_USB.h"
|
|
#include "CCJSONObject.h"
|
|
#include "CCString.h"
|
|
|
|
struct ConfigStruct {
|
|
JSON_TYPE_INTRUSIVE(ConfigStruct,PIN,PID,VID,Data,PIDBool,DataBool,PINBool)
|
|
CTL::String PIN;
|
|
CTL::String PID;
|
|
CTL::String VID;
|
|
CTL::String Data;
|
|
bool PIDBool = false;
|
|
bool DataBool = false;
|
|
bool PINBool = false;
|
|
};
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
namespace Ui { class Widget; }
|
|
QT_END_NAMESPACE
|
|
|
|
class Widget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
AES_USB aes_usb;
|
|
bool loop_running = false;
|
|
std::mutex loop_mutex;
|
|
public:
|
|
Widget(QWidget *parent = nullptr);
|
|
~Widget() override;
|
|
void PrintInfo(const CTL::String& info);
|
|
bool readInit();
|
|
void readClick();
|
|
void LoopRunning();
|
|
int writeInit();
|
|
void writeClick();
|
|
static uint16_t hexStringToUint16(const std::string& hexStr);
|
|
bool readData(uint8_t* data, int length);
|
|
|
|
private:
|
|
Ui::Widget *ui;
|
|
QCheckBox *checkBox_R_PIN = nullptr;
|
|
QCheckBox *checkBox_S_PIN = nullptr;
|
|
ConfigStruct config;
|
|
};
|
|
#endif // WIDGET_H
|