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 00030 #include <map> 00031 #include <string> 00032 00033 class BatteryMonitorTreeView; 00034 00035 namespace fawkes { 00036 class AvahiThread; 00037 } 00038 00039 class BatteryMonitor 00040 : public Gtk::Window, 00041 fawkes::ServiceBrowseHandler 00042 { 00043 public: 00044 BatteryMonitor(Glib::RefPtr<Gtk::Builder> builder); 00045 ~BatteryMonitor(); 00046 00047 Gtk::Window& get_window() const; 00048 00049 protected: 00050 // service browser handler 00051 void all_for_now(); 00052 void cache_exhausted(); 00053 void browse_failed( const char* name, 00054 const char* type, 00055 const char* domain ); 00056 void service_added( const char* name, 00057 const char* type, 00058 const char* domain, 00059 const char* host_name, 00060 const struct sockaddr* addr, 00061 const socklen_t addr_size, 00062 uint16_t port, 00063 std::list<std::string>& txt, 00064 int flags ); 00065 void service_removed( const char* name, 00066 const char* type, 00067 const char* domain ); 00068 00069 private: 00070 void on_btn_quit_clicked(); 00071 00072 Gtk::Window* m_wnd_main; 00073 BatteryMonitorTreeView* m_trv_battery; 00074 Gtk::Button* m_btn_quit; 00075 00076 std::map< std::string, std::string > m_services; 00077 fawkes::AvahiThread* m_avahi; 00078 }; 00079 00080 #endif /* __TOOLS_BATTERY_MONITOR_BATTERY_MONITOR_H_ */