#pragma once
#include <QDialog>
#include <QPushButton>
#include "ui_plcsetup.h"
#include "plc_item.h"
#include <iostream>
#include <vector>
#include <QTimer>
#include "modbus.h"

class QTimer;

class PlcSetup : public QDialog {
	Q_OBJECT

public:
	PlcSetup(QWidget * parent = Q_NULLPTR);
	~PlcSetup();

	QTimer *m_pTimer;

	void read_plc_items();
	void save_plc_items();
private slots:
	void click_read();
	void click_write();
	void click_save();
	
	void on_toolButton_batch_read_released();
	void on_toolButton_keyboard_released();
	void on_toolButton_close_released();

	void handleTimeout();  //窗口加载时执行一次，批处理读取所有地址

private:
	Ui::PlcSetup ui;

	std::vector<PlcItem> m_plc_items;
};
