|
UniWidgets
1.0.0
|
00001 #ifndef _MTRSETUP_H 00002 #define _MTRSETUP_H 00003 // ------------------------------------------------------------------------- 00009 // ------------------------------------------------------------------------- 00010 #include <fstream> 00011 #include <gtkmm.h> 00012 #include <libglademm.h> 00013 #include <modbus/ModbusRTUMaster.h> 00014 #include <modbus/ModbusHelpers.h> 00015 #include <extensions/MTR.h> 00016 // ------------------------------------------------------------------------- 00022 class MRMReCreator 00023 { 00024 public: 00025 MRMReCreator(); 00027 void check(); 00028 00029 ModbusRTUMaster* getMRM() 00030 { return mb_; } 00032 bool plugged() 00033 { return plugged_; } 00035 bool MRMCreated() const 00036 { return mb_ != NULL; } 00038 void changeDev(const Glib::ustring dev); 00040 void setSpeed(const Glib::ustring speed) 00041 { speed_ = speed; } 00043 void setTimeout(int timeout) 00044 { timeout_ = timeout; } 00045 00046 private: 00047 Glib::ustring dev_; 00048 Glib::ustring speed_; 00049 int timeout_; 00050 00051 bool plugged_; 00052 ModbusRTUMaster *mb_; 00053 00054 bool checkPlugged(); 00055 void reCreate(); 00056 }; 00062 class MTRSetup { 00063 00064 private: 00065 Gtk::Dialog *MTR_Setup, *dialog; 00066 Gtk::Frame *frame_settings, *frame_autodetect, *frame_prog; 00067 Gtk::VButtonBox *box_actions; 00068 Gtk::ComboBoxEntry *combo_dev, *combo_speed, *combo_fn; 00069 Gtk::SpinButton *spin_addr, *spin_timeout, *spin_beg, *spin_end, *spin_reg; 00070 Gtk::ProgressBar *autodetect_progress; 00071 Gtk::Button *mtr_abort, *toggle_settings, *start_autodetect; 00072 Gtk::Label *label_state, *label_beg, *label_end, *ok_mess, *fail_mess; 00073 Gtk::CheckButton *radio_speed, *radio_guessspeed; 00074 Gtk::Dialog *detection_failed; 00075 00076 Glib::ustring current_device, path; 00077 00078 void hide(); 00079 bool check(bool unknown_state); 00080 void start_check(); 00081 void stop_check(); 00082 void toggle_settings_cb(); 00083 // void speed_toggled(); 00084 // void guessspeed_toggled(); 00085 void begin_changed(); 00086 void dev_changed(); 00087 void speed_changed(); 00088 void timeout_changed(); 00089 void autodetect_start(); 00090 void prog_clicked(Glib::ustring filename); 00091 void abortation(); 00092 void set_normal_state(bool state); 00093 // bool update_p_cb(unsigned int addr, unsigned int beg_addr, unsigned int end_addr, unsigned int reg, ModbusRTU::SlaveFunctionCode fn, bool guessspeed, bool speed); 00094 00095 MRMReCreator mrmc; 00096 // ModbusRTUMaster *mb; 00097 sigc::connection update_progress, check_dev; 00098 00099 std::list<std::string> speedlist; 00100 bool stop_button_pressed; 00101 bool port_ok; 00102 bool settings_visible; 00103 bool detected; 00104 // unsigned int iii, ad; 00105 00106 public: 00112 MTRSetup(Glib::RefPtr<Gnome::Glade::Xml> gxml, Gtk::Dialog *d, Glib::ustring mtr_prog_path); 00113 ~MTRSetup(){}; 00114 00115 void show(); 00116 }; 00117 00118 #endif /* _MTRSETUP_H */
1.7.6.1