Fawkes API  Fawkes Development Version
gex_receiver_thread.h
1 
2 /***************************************************************************
3  * gex_receiver_thread.h - Gossip Example Plugin - Receiver
4  *
5  * Created: Thu Mar 06 10:39:53 2014
6  * Copyright 2006-2014 Tim Niemueller [www.niemueller.de]
7  ****************************************************************************/
8 
9 /* This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU Library General Public License for more details.
18  *
19  * Read the full text in the LICENSE.GPL file in the doc directory.
20  */
21 
22 #ifndef __PLUGINS_GOSSIP_EXAMPLE_GEX_RECEIVER_THREAD_H_
23 #define __PLUGINS_GOSSIP_EXAMPLE_GEX_RECEIVER_THREAD_H_
24 
25 #include <plugins/gossip/aspect/gossip.h>
26 #include <plugins/gossip/gossip/gossip_group.h>
27 
28 #include <core/threading/thread.h>
29 #include <aspect/clock.h>
30 #include <aspect/logging.h>
31 #include <aspect/blocked_timing.h>
32 
34 : public fawkes::Thread,
35  public fawkes::ClockAspect,
36  public fawkes::LoggingAspect,
39 {
40  public:
43 
44  virtual void init();
45  virtual void loop();
46  virtual void finalize();
47 
48  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
49  protected: virtual void run() { Thread::run(); }
50 
51  private:
52  void handle_peer_msg(boost::asio::ip::udp::endpoint &endpoint,
53  uint16_t component_id, uint16_t msg_type,
54  std::shared_ptr<google::protobuf::Message> msg);
55  void handle_peer_recv_error(boost::asio::ip::udp::endpoint &endpoint, std::string msg);
56  void handle_peer_send_error(std::string msg);
57 
58  private:
59  boost::signals2::connection sig_rcvd_conn_;
60  boost::signals2::connection sig_recv_error_conn_;
61  boost::signals2::connection sig_send_error_conn_;
62 };
63 
64 #endif
Thread aspect that allows to obtain the current time from the clock.
Definition: clock.h:36
virtual void loop()
Code to execute in the thread.
Thread class encapsulation of pthreads.
Definition: thread.h:42
Thread aspect to communicate with a group of robots.
Definition: gossip.h:39
virtual void init()
Initialize the thread.
virtual ~GossipExampleReceiverThread()
Destructor.
Thread aspect to use blocked timing.
Thread aspect to log output.
Definition: logging.h:35
Gossip Example Plugin Thread - Receiver.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual void finalize()
Finalize the thread.