|
UniWidgets
1.0.0
|
00001 #ifndef _SENSORPROP_H 00002 #define _SENSORPROP_H 00003 // ------------------------------------------------------------------------- 00004 #include <gtkmm.h> 00005 #include <UniSetTypes.h> 00006 #include <MessageType.h> 00007 #include <uniwidgets/Connector.h> 00008 #include <uniwidgets/USignals.h> 00009 // ------------------------------------------------------------------------- 00010 class GuiPM; 00011 // ------------------------------------------------------------------------- 00026 class SensorProp 00027 { 00028 protected: 00029 float current_value; 00030 Gtk::Widget* owner; 00031 00032 public: 00033 // SensorProp(Gtk::Widget* targ, Glib::ustring name, GuiPM** guipm_ptr, std::string uniset_name = "DefaultSensor") : 00034 SensorProp(Gtk::Widget* targ, Glib::ustring name, ConnectorRef connector_ref, std::string uniset_name = "DefaultSensor") : 00035 owner(targ) 00036 ,sens_name(*targ, name+"-sensor-name", uniset_name) 00037 ,node_name(*targ, name+"-node-name", "LocalhostNode") 00038 ,sens_id(*targ, name+"-sensor-id", UniSetTypes::DefaultObjectId) 00039 ,node_id(*targ, name+"-node-id", UniSetTypes::DefaultObjectId) 00040 ,stype(*targ,name+"-stype","DI") 00041 // ,guipm_ptr_(guipm_ptr) 00042 ,connector_ref_(connector_ref) 00043 {} 00044 00045 ~SensorProp(){} 00046 00047 void set_connector(ConnectorRef connector_ref); 00048 void set_sens_name(std::string txt); 00049 std::string get_sens_name(); 00051 void set_node_name(std::string txt); 00052 std::string get_node_name(); 00054 void set_sens_id(UniSetTypes::ObjectId id); 00055 void set_sens_id( std::string id) { set_sens_id(UniSetTypes::uni_atoi(id)); } 00056 UniSetTypes::ObjectId get_sens_id(); 00058 void set_node_id(UniSetTypes::ObjectId id); 00059 void set_node_id( std::string id) { set_node_id(UniSetTypes::uni_atoi(id)); } 00060 UniSetTypes::ObjectId get_node_id(); 00062 void set_stype(std::string t); 00063 std::string get_stype(); 00065 void ask(UniversalIO::UIOCommand cmd); 00066 void autoAsk(UniversalIO::UIOCommand cmd); 00068 float get_current_value() {return current_value;} 00069 void sensorInfo(UniSetTypes::SensorMessage* sm); 00070 sigc::signal<void, float> value_changed; 00072 bool get_state(); 00073 long get_value(); 00074 void save_value(long value); 00075 void process_sensor(UniSetTypes::ObjectId id, UniSetTypes::ObjectId node, long value); 00076 inline IOController_i::CalibrateInfo get_calibrate(){return calibrate;}; 00078 Glib::Property<std::string> sens_name; 00079 Glib::Property<std::string> node_name; 00080 Glib::Property<UniSetTypes::ObjectId> sens_id; 00081 Glib::Property<UniSetTypes::ObjectId> node_id; 00082 Glib::Property<std::string> stype; 00083 00084 00085 private: 00086 SensorProp(); 00087 // bool guipm_check_ready(Glib::ustring operation); 00088 bool check_connector(Glib::ustring operation); 00089 void set_sensor_handler(); 00090 // GuiPM** guipm_ptr_; 00091 ConnectorRef connector_ref_; 00092 USignals::Connection connection; 00093 IOController_i::CalibrateInfo calibrate; 00094 }; 00095 00096 #endif
1.7.6.1