Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * battery_monitor.h - Fawkes Battery Monitor 00004 * 00005 * Created: Mon Apr 06 17:09:40 2009 00006 * Copyright 2009 Daniel Beck 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU Library General Public License for more details. 00019 * 00020 * Read the full text in the LICENSE.GPL file in the doc directory. 00021 */ 00022 00023 #ifndef __TOOLS_BATTERY_MONITOR_BATTERY_MONITOR_H_ 00024 #define __TOOLS_BATTERY_MONITOR_BATTERY_MONITOR_H_ 00025 00026 #include <netcomm/service_discovery/browse_handler.h> 00027 00028 #include <gtkmm.h> 00029 #include <libglademm/xml.h> 00030 00031 #include <map> 00032 #include <string> 00033 00034 class BatteryMonitorTreeView; 00035 00036 namespace fawkes { 00037 class AvahiThread; 00038 } 00039 00040 class BatteryMonitor 00041 : public Gtk::Window, 00042 fawkes::ServiceBrowseHandler 00043 { 00044 public: 00045 BatteryMonitor( Glib::RefPtr< Gnome::Glade::Xml > ref_xml ); 00046 ~BatteryMonitor(); 00047 00048 Gtk::Window& get_window() const; 00049 00050 protected: 00051 // service browser handler 00052 void all_for_now(); 00053 void cache_exhausted(); 00054 void browse_failed( const char* name, 00055 const char* type, 00056 const char* domain ); 00057 void service_added( const char* name, 00058 const char* type, 00059 const char* domain, 00060 const char* host_name, 00061 const struct sockaddr* addr, 00062 const socklen_t addr_size, 00063 uint16_t port, 00064 std::list<std::string>& txt, 00065 int flags ); 00066 void service_removed( const char* name, 00067 const char* type, 00068 const char* domain ); 00069 00070 private: 00071 void on_btn_quit_clicked(); 00072 00073 Gtk::Window* m_wnd_main; 00074 BatteryMonitorTreeView* m_trv_battery; 00075 Gtk::Button* m_btn_quit; 00076 00077 std::map< std::string, std::string > m_services; 00078 fawkes::AvahiThread* m_avahi; 00079 }; 00080 00081 #endif /* __TOOLS_BATTERY_MONITOR_BATTERY_MONITOR_H_ */