Fawkes API  Fawkes Development Version
battery_monitor.h
1 
2 /***************************************************************************
3  * battery_monitor.h - Fawkes Battery Monitor
4  *
5  * Created: Mon Apr 06 17:09:40 2009
6  * Copyright 2009 Daniel Beck
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _TOOLS_BATTERY_MONITOR_BATTERY_MONITOR_H_
24 #define _TOOLS_BATTERY_MONITOR_BATTERY_MONITOR_H_
25 
26 #include <netcomm/service_discovery/browse_handler.h>
27 
28 #include <gtkmm.h>
29 #include <map>
30 #include <string>
31 
33 
34 namespace fawkes {
35 class AvahiThread;
36 }
37 
38 class BatteryMonitor : public Gtk::Window, fawkes::ServiceBrowseHandler
39 {
40 public:
41  BatteryMonitor(Glib::RefPtr<Gtk::Builder> builder);
43 
44  Gtk::Window &get_window() const;
45 
46 protected:
47  // service browser handler
48  void all_for_now();
49  void cache_exhausted();
50  void browse_failed(const char *name, const char *type, const char *domain);
51  void service_added(const char * name,
52  const char * type,
53  const char * domain,
54  const char * host_name,
55  const char * interface,
56  const struct sockaddr * addr,
57  const socklen_t addr_size,
58  uint16_t port,
59  std::list<std::string> &txt,
60  int flags);
61  void service_removed(const char *name, const char *type, const char *domain);
62 
63 private:
64  void on_btn_quit_clicked();
65 
66  Gtk::Window * m_wnd_main;
67  BatteryMonitorTreeView *m_trv_battery;
68  Gtk::Button * m_btn_quit;
69 
70  std::map<std::string, std::string> m_services;
71  fawkes::AvahiThread * m_avahi;
72 };
73 
74 #endif /* TOOLS_BATTERY_MONITOR_BATTERY_MONITOR_H__ */
A treeview that retrieves battery data from the robots over remote blackboard connections and display...
A battery monitor.
void cache_exhausted()
Cache exhausted.
void browse_failed(const char *name, const char *type, const char *domain)
Failed to browse for a given service.
void all_for_now()
All results have been retrieved.
void service_removed(const char *name, const char *type, const char *domain)
A service has been removed from the network.
void service_added(const char *name, const char *type, const char *domain, const char *host_name, const char *interface, const struct sockaddr *addr, const socklen_t addr_size, uint16_t port, std::list< std::string > &txt, int flags)
A service has been announced on the network.
Gtk::Window & get_window() const
Obtain the main window.
BatteryMonitor(Glib::RefPtr< Gtk::Builder > builder)
Constructor.
~BatteryMonitor()
Destructor.
Avahi main thread.
Definition: avahi_thread.h:55
Interface for class that process browse results.
Fawkes library namespace.