iCub-main
icub-main
src
libraries
icubmod
embObjLib
ethReceiver.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 _ETHRECEIVER_H_
24
#define _ETHRECEIVER_H_
25
26
// -- class EthReceiver
27
// -- it is a rate thread created by singleton TheEthManager.
28
// -- it regularly wakes up to see if a packet is in its listening socket and it parses that with 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
37
#ifdef NETWORK_PERFORMANCE_BENCHMARK
38
#include <
./tools/include/PeriodicEventsVerifier.h
>
39
#endif
40
41
42
namespace
eth
{
43
44
class
TheEthManager;
45
46
class
EthReceiver
:
public
yarp::os::PeriodicThread
47
{
48
private
:
49
int
rateofthread;
50
51
ACE_SOCK_Dgram *recv_socket;
52
eth::TheEthManager
*ethManager;
53
double
statPrintInterval;
54
#ifdef NETWORK_PERFORMANCE_BENCHMARK
55
Tools::Emb_PeriodicEventVerifier
m_perEvtVerifier;
56
#endif
57
58
public
:
59
60
enum
{
EthReceiverDefaultRate
= 5,
EthReceiverMaxRate
= 20 };
61
62
EthReceiver
(
int
rxrate);
63
~EthReceiver
();
64
bool
config
(ACE_SOCK_Dgram *pSocket,
eth::TheEthManager
* _ethManager);
65
bool
threadInit
();
66
void
run
();
67
void
onStop
();
68
};
69
70
}
// namespace eth
71
72
73
#endif
// include-guard
74
75
76
// - end-of-file (leave a blank line after)----------------------------------------------------------------------------
77
78
79
80
81
82
83
PeriodicEventsVerifier.h
Tools::Emb_PeriodicEventVerifier
Tools::Emb_PeriodicEventVerifier.
Definition:
PeriodicEventsVerifier.h:45
eth::EthReceiver
Definition:
ethReceiver.h:47
eth::EthReceiver::~EthReceiver
~EthReceiver()
Definition:
ethReceiver.cpp:96
eth::EthReceiver::onStop
void onStop()
Definition:
ethReceiver.cpp:89
eth::EthReceiver::EthReceiverDefaultRate
@ EthReceiverDefaultRate
Definition:
ethReceiver.h:60
eth::EthReceiver::EthReceiverMaxRate
@ EthReceiverMaxRate
Definition:
ethReceiver.h:60
eth::EthReceiver::config
bool config(ACE_SOCK_Dgram *pSocket, eth::TheEthManager *_ethManager)
Definition:
ethReceiver.cpp:101
eth::EthReceiver::threadInit
bool threadInit()
Definition:
ethReceiver.cpp:145
eth::EthReceiver::run
void run()
Definition:
ethReceiver.cpp:171
eth::EthReceiver::EthReceiver
EthReceiver(int rxrate)
Definition:
ethReceiver.cpp:65
eth::TheEthManager
Definition:
ethManager.h:84
eth
Definition:
abstractEthResource.h:38
Generated on Wed Nov 13 2024 21:11:40 for iCub-main by
1.9.1