2026-01-30 14:19:55 +08:00
|
|
|
#ifndef WIDGET_H
|
|
|
|
|
#define WIDGET_H
|
|
|
|
|
|
2026-02-27 15:10:40 +08:00
|
|
|
#include <QCheckBox>
|
2026-01-30 14:19:55 +08:00
|
|
|
#include <QWidget>
|
2026-02-03 14:36:30 +08:00
|
|
|
#include "AES_USB.h"
|
2026-02-27 15:37:25 +08:00
|
|
|
#include "CCJSONObject.h"
|
2026-02-03 14:36:30 +08:00
|
|
|
#include "CCString.h"
|
2026-01-30 14:19:55 +08:00
|
|
|
|
2026-02-27 15:37:25 +08:00
|
|
|
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;
|
|
|
|
|
};
|
|
|
|
|
|
2026-01-30 14:19:55 +08:00
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
namespace Ui { class Widget; }
|
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
|
|
class Widget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2026-02-03 14:36:30 +08:00
|
|
|
AES_USB aes_usb;
|
|
|
|
|
bool loop_running = false;
|
|
|
|
|
std::mutex loop_mutex;
|
2026-01-30 14:19:55 +08:00
|
|
|
public:
|
|
|
|
|
Widget(QWidget *parent = nullptr);
|
2026-02-27 15:10:40 +08:00
|
|
|
~Widget() override;
|
2026-02-03 14:36:30 +08:00
|
|
|
void PrintInfo(const CTL::String& info);
|
|
|
|
|
bool readInit();
|
|
|
|
|
void readClick();
|
|
|
|
|
void LoopRunning();
|
2026-02-27 15:10:40 +08:00
|
|
|
int writeInit();
|
2026-02-03 14:36:30 +08:00
|
|
|
void writeClick();
|
|
|
|
|
static uint16_t hexStringToUint16(const std::string& hexStr);
|
2026-02-26 17:57:38 +08:00
|
|
|
bool readData(uint8_t* data, int length);
|
2026-01-30 14:19:55 +08:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
Ui::Widget *ui;
|
2026-02-27 15:10:40 +08:00
|
|
|
QCheckBox *checkBox_R_PIN = nullptr;
|
|
|
|
|
QCheckBox *checkBox_S_PIN = nullptr;
|
2026-02-27 15:37:25 +08:00
|
|
|
ConfigStruct config;
|
2026-01-30 14:19:55 +08:00
|
|
|
};
|
|
|
|
|
#endif // WIDGET_H
|