iCub-main
ethSender.h
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 /*
4  * Copyright (C) 2017 iCub Facility - Istituto Italiano di Tecnologia
5  * Author: Alberto Cardellino, Marco Accame
6  * email: alberto.cardellino@iit.it, marco.accame@iit.it
7  * website: www.robotcub.org
8  * Permission is granted to copy, distribute, and/or modify this program
9  * under the terms of the GNU General Public License, version 2 or any
10  * later version published by the Free Software Foundation.
11  *
12  * A copy of the license can be found at
13  * http://www.robotcub.org/icub/license/gpl.txt
14  *
15  * This program is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
18  * Public License for more details
19 */
20 
21 // - include guard ----------------------------------------------------------------------------------------------------
22 
23 #ifndef _ETHSENDER_H_
24 #define _ETHSENDER_H_
25 
26 // -- class EthSender
27 // -- it is a rate thread created by singleton TheEthManager. it regularly transmits packets (if any available) to the eth boards.
28 // -- it uses methods made available by TheEthManager.
29 
30 //#include <ethManager.h>
31 
32 #include <ace/SOCK_Dgram.h>
33 
34 #include <yarp/os/PeriodicThread.h>
35 
36 #ifdef NETWORK_PERFORMANCE_BENCHMARK
38 #endif
39 
40 
41 namespace eth {
42 
43  class TheEthManager;
44 
45  class EthSender : public yarp::os::PeriodicThread
46  {
47  private:
48  int rateofthread;
49 
50  uint8_t *p_sendData;
51  TheEthManager *ethManager;
52  ACE_SOCK_Dgram *send_socket;
53 
54 #ifdef NETWORK_PERFORMANCE_BENCHMARK
55  Tools::Emb_PeriodicEventVerifier m_perEvtVerifier;
56 #endif
57  void run();
58 
59 
60  public:
61 
63 
64  EthSender(int txrate);
65  ~EthSender();
66  bool config(ACE_SOCK_Dgram *pSocket, TheEthManager* _ethManager);
67  bool threadInit();
68 
69  };
70 
71 } // namespace eth
72 
73 
74 #endif // include-guard
75 
76 
77 // - end-of-file (leave a blank line after)----------------------------------------------------------------------------
78 
79 
80 
81 
82 
83 
84 
Tools::Emb_PeriodicEventVerifier.
EthSender(int txrate)
Definition: ethSender.cpp:62
bool config(ACE_SOCK_Dgram *pSocket, TheEthManager *_ethManager)
Definition: ethSender.cpp:83
bool threadInit()
Definition: ethSender.cpp:92
@ EthSenderDefaultRate
Definition: ethSender.h:62