QtHPConnect/hpdata.h

130 lines
2.6 KiB
C
Raw Normal View History

2019-02-10 14:32:15 +01:00
#ifndef HPDATA_H
#define HPDATA_H
#include <QObject>
2019-02-10 14:43:00 +01:00
#include <QString>
2019-02-25 08:36:58 +01:00
#include <QList>
2019-02-10 14:43:00 +01:00
#include "hpusb.h"
2019-02-25 08:36:58 +01:00
#include "abstractdata.h"
2019-02-10 14:32:15 +01:00
2019-02-25 08:36:58 +01:00
class AbstractData;
2019-02-10 14:43:00 +01:00
struct hp_Information {
QString name="---";
QString serialnum="---";
QString appver="-";
QString osver="-";
};
2019-02-12 21:48:35 +01:00
struct hp_Settings {
int angle_measure=0;
int number_format=0;
int precision=5;
int digit_grouping=0;
int entry=2;
int integers=3;
int bits=32;
bool signed_int=false;
int complex=0;
int language =1;
int font_size=2;
int theme=1;
bool textbook=true;
bool menu=false;
};
2019-04-02 21:14:31 +02:00
struct hp_DataStruct {
QString filename;
hp_DataType type;
2019-02-10 14:43:00 +01:00
};
2019-02-17 17:24:52 +01:00
class hpCalcData;
struct hp_ScreenShot {
QPixmap * image;
hp_screenshot_format format;
hpCalcData * calc;
};
2019-02-10 14:43:00 +01:00
struct hp_Change {
2019-02-25 08:36:58 +01:00
hp_DataType dataChange=HP_MAIN;
2019-02-17 17:24:52 +01:00
hpCalcData * calc;
2019-02-10 14:43:00 +01:00
};
2019-02-21 19:51:56 +01:00
struct hp_Prog {
QString filename;
QString prog;
2019-03-02 20:20:23 +01:00
QByteArray data;
2019-02-21 19:51:56 +01:00
};
2019-02-26 20:56:39 +01:00
struct hp_Note {
QString filename;
QString text;
2019-03-02 20:20:23 +01:00
QByteArray data;
2019-02-26 20:56:39 +01:00
};
2019-02-25 08:36:58 +01:00
struct hp_Data {
QString name;
hp_DataType type;
QByteArray data;
};
2019-02-10 14:43:00 +01:00
class hpCalcData: public QObject
2019-02-10 14:32:15 +01:00
{
2019-02-10 14:43:00 +01:00
Q_OBJECT
private:
const static QString func_list[][2];
2019-02-25 08:36:58 +01:00
const static hp_DataType func_type[];
2019-02-17 17:24:52 +01:00
QPixmap * screenShot=nullptr;
2019-02-25 08:36:58 +01:00
hp_DataType type;
2019-02-10 14:43:00 +01:00
hpusb * hp_api;
hp_Handle hp_handle;
hp_Information hp_info;
2019-02-12 21:48:35 +01:00
hp_Settings hp_homesettings;
2019-02-25 08:36:58 +01:00
QList<AbstractData *> lData;
2019-02-10 14:43:00 +01:00
2019-02-10 14:32:15 +01:00
public:
2019-02-10 14:43:00 +01:00
hpCalcData(hpusb * hpapi);
~hpCalcData();
hp_Handle * getHandle();
hpusb * getAPI();
void setInfo(hp_Information);
void readInfo();
2019-02-12 21:48:35 +01:00
void readSettings();
2019-02-17 17:24:52 +01:00
void readScreen();
2019-02-20 23:08:14 +01:00
void recvScreen(hp_ScreenShot);
2019-03-09 15:39:38 +01:00
void recvSettings(hp_Data);
2019-02-20 23:08:14 +01:00
void recvInfo(hp_Information);
2019-02-25 08:36:58 +01:00
void recvData(hp_Data);
2019-02-21 19:51:56 +01:00
void recvProg(hp_Prog);
2019-02-26 20:56:39 +01:00
void recvNote(hp_Note);
2019-03-09 15:39:38 +01:00
void refresh();
2019-02-25 08:36:58 +01:00
void addData(AbstractData *);
void deleteData(AbstractData *);
int findData(QString name, hp_DataType dataType);
2019-02-26 20:56:39 +01:00
AbstractData * getData(QString name, hp_DataType dataType);
2019-02-25 08:36:58 +01:00
AbstractData * dataAt(int i);
int dataCount();
2019-02-17 17:24:52 +01:00
hp_ScreenShot getScreenShot();
2019-02-10 14:43:00 +01:00
hp_Information getInfo();
QString getName();
2019-02-12 21:48:35 +01:00
hp_Settings getSettings();
int setSettings(hp_Settings set);
2019-02-10 14:43:00 +01:00
void vpkt_send_experiments(int );
2019-02-25 08:36:58 +01:00
void emitChange(hp_DataType type);
2019-02-10 14:43:00 +01:00
2019-03-09 15:39:38 +01:00
2019-02-10 14:43:00 +01:00
//public slots:
signals:
void dataChanged(hp_Change datachange);
2019-03-09 15:39:38 +01:00
void hotplugDetected();
2019-02-10 14:32:15 +01:00
};
2019-02-10 14:43:00 +01:00
#endif // HPDATA_H