00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __TOOLS_BATTERY_MONITOR_BATTERY_MONITOR_TREE_VIEW_H_
00025 #define __TOOLS_BATTERY_MONITOR_BATTERY_MONITOR_TREE_VIEW_H_
00026
00027 #include <gtkmm.h>
00028 #include <libglademm/xml.h>
00029
00030 #include <map>
00031 #include <string>
00032
00033 namespace fawkes {
00034 class BlackBoard;
00035 class Interface;
00036 class BatteryInterface;
00037 class InterfaceDispatcher;
00038 }
00039
00040 class BatteryMonitorTreeView : public Gtk::TreeView
00041 {
00042 public:
00043 BatteryMonitorTreeView( BaseObjectType* cobject,
00044 const Glib::RefPtr< Gnome::Glade::Xml >& ref_xml );
00045 virtual ~BatteryMonitorTreeView();
00046
00047 void add_host( const char* host );
00048 void rem_host( const char* host );
00049
00050 protected:
00051 class BatteryRecord : public Gtk::TreeModelColumnRecord
00052 {
00053 public:
00054 BatteryRecord()
00055 {
00056 add( fqdn );
00057 add( short_name );
00058 add( absolute_soc );
00059 add( relative_soc );
00060 add( current );
00061 add( voltage );
00062 }
00063
00064 Gtk::TreeModelColumn< Glib::ustring > fqdn;
00065 Gtk::TreeModelColumn< Glib::ustring > short_name;
00066 Gtk::TreeModelColumn< float > absolute_soc;
00067 Gtk::TreeModelColumn< float > relative_soc;
00068 Gtk::TreeModelColumn< float > current;
00069 Gtk::TreeModelColumn< float > voltage;
00070 };
00071
00072 BatteryRecord m_battery_record;
00073 Glib::RefPtr< Gtk::ListStore > m_battery_list;
00074
00075 std::map< std::string, fawkes::BlackBoard* > m_remote_bbs;
00076 std::map< std::string, fawkes::BatteryInterface* > m_battery_interfaces;
00077 std::map< std::string, fawkes::InterfaceDispatcher* > m_interface_dispatcher;
00078
00079 private:
00080 void on_data_changed( fawkes::Interface* interface );
00081 void on_writer_added( fawkes::Interface* interface );
00082 void on_writer_removed( fawkes::Interface* interface );
00083
00084 void update();
00085
00086 Gtk::MessageDialog* m_dlg_warning;
00087
00088 Glib::Dispatcher m_trigger_update;
00089 float m_relative_soc_threshold;
00090 std::map< std::string, unsigned int > m_below_threshold_counter;
00091 };
00092
00093 #endif