iCub-main
ethParser.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: Marco Accame
6  * email: 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 _ETHPARSER_H_
24 #define _ETHPARSER_H_
25 
26 #include <string>
27 
28 #include "EoProtocol.h"
29 #include <yarp/os/Searchable.h>
30 
31 
32 namespace eth { namespace parser {
33 
34  // -- library eth parser
35 
37  {
38  eOipv4addressing_t ipv4addressing;
39  eObrd_ethtype_t type;
40  std::uint16_t maxSizeRXpacket;
41  std::uint16_t maxSizeROP;
45 
47  reset();
48  }
49  void reset() {
50  type = eobrd_ethtype_none; ipv4addressing.addr = 0; ipv4addressing.port = 0;
52  }
53  };
54 
56  {
58  eOmn_appl_config_t txconfig;
59 
61  reset();
62  }
63  void reset() {
64  name = "none"; txconfig.cycletime = 1000; txconfig.txratedivider = 1;
65  txconfig.maxtimeRX = 400; txconfig.maxtimeDO = 300; txconfig.maxtimeTX = 300;
66  }
67  };
68 
69  struct boardActions
70  {
74 
76  reset();
77  }
78  void reset() {
81  }
82  };
83 
84  struct boardData
85  {
89  void reset() {
90  properties.reset();
91  settings.reset();
92  actions.reset();
93  }
94  };
95 
96 
97  struct pc104Data
98  {
100  eOipv4addressing_t localaddressing;
101  std::uint16_t txrate;
102  std::uint16_t rxrate;
104  void reset() {
105  embBoardsConnected = true;
106  localaddressing.addr = eo_common_ipv4addr(10, 0, 1, 104); localaddressing.port = 12345;
107  txrate = 1; rxrate = 5;
108  addressingstring = "10.0.1.104:12345";
109  }
110  void setdefault() {
111  embBoardsConnected = true;
112  localaddressing.addr = eo_common_ipv4addr(10, 0, 1, 104); localaddressing.port = 12345;
113  txrate = 1; rxrate = 5;
114  addressingstring = "10.0.1.104:12345";
115  }
116  };
117 
118  bool read(yarp::os::Searchable &cfgtotal, pc104Data &pc104data);
119  bool read(yarp::os::Searchable &cfgtotal, boardData &boarddata);
120 
121  bool print(const pc104Data &pc104data);
122  bool print(const boardData &boarddata);
123 
124 
125 }} // namespace eth { namespace parser {
126 
127 
128 
129 #endif // include-guard
130 
131 
132 // - end-of-file (leave a blank line after)----------------------------------------------------------------------------
133 
134 
135 
136 
137 
138 
139 
140 
141 
142 
eth::parser::boardActions::monitorpresence_timeout
double monitorpresence_timeout
Definition: ethParser.h:72
eth::parser::boardProperties::ipv4addressing
eOipv4addressing_t ipv4addressing
Definition: ethParser.h:38
eth::parser::boardData::properties
boardProperties properties
Definition: ethParser.h:86
eth::parser::boardActions::monitorpresence_enabled
bool monitorpresence_enabled
Definition: ethParser.h:71
eth::parser::boardData::settings
boardSettings settings
Definition: ethParser.h:87
eth::parser::boardSettings::txconfig
eOmn_appl_config_t txconfig
Definition: ethParser.h:58
eth::parser::boardProperties::typestring
std::string typestring
Definition: ethParser.h:44
eth::parser::pc104Data::addressingstring
std::string addressingstring
Definition: ethParser.h:103
eth::parser::pc104Data::embBoardsConnected
bool embBoardsConnected
Definition: ethParser.h:99
eth::parser::boardActions::boardActions
boardActions()
Definition: ethParser.h:75
eth::parser::boardProperties::maxSizeRXpacket
std::uint16_t maxSizeRXpacket
Definition: ethParser.h:40
eth::parser::boardActions::reset
void reset()
Definition: ethParser.h:78
eth::parser::boardSettings::boardSettings
boardSettings()
Definition: ethParser.h:60
eth::parser::boardSettings::name
std::string name
Definition: ethParser.h:57
eth::parser::boardData::reset
void reset()
Definition: ethParser.h:89
eth::parser::pc104Data::setdefault
void setdefault()
Definition: ethParser.h:110
eth::parser::pc104Data
Definition: ethParser.h:97
eth::parser::boardProperties
Definition: ethParser.h:36
eth::parser::pc104Data::localaddressing
eOipv4addressing_t localaddressing
Definition: ethParser.h:100
eth::parser::boardProperties::reset
void reset()
Definition: ethParser.h:49
eth::parser::boardProperties::maxSizeROP
std::uint16_t maxSizeROP
Definition: ethParser.h:41
eth
Definition: abstractEthResource.h:38
eth::parser::boardProperties::boardProperties
boardProperties()
Definition: ethParser.h:46
eth::parser::print
bool print(const pc104Data &pc104data)
Definition: ethParser.cpp:57
string
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}") include_directories($
Definition: CMakeLists.txt:9
eth::parser::pc104Data::txrate
std::uint16_t txrate
Definition: ethParser.h:101
eth::parser::boardProperties::type
eObrd_ethtype_t type
Definition: ethParser.h:39
eth::parser::pc104Data::rxrate
std::uint16_t rxrate
Definition: ethParser.h:102
eth::parser::boardData::actions
boardActions actions
Definition: ethParser.h:88
eth::parser::boardSettings
Definition: ethParser.h:55
eth::parser::boardActions
Definition: ethParser.h:69
eth::parser::boardProperties::ipv4string
std::string ipv4string
Definition: ethParser.h:43
eth::parser::boardSettings::reset
void reset()
Definition: ethParser.h:63
eth::parser::pc104Data::reset
void reset()
Definition: ethParser.h:104
eth::parser::read
bool read(yarp::os::Searchable &cfgtotal, pc104Data &pc104data)
Definition: ethParser.cpp:92
eth::parser::boardProperties::ipv4addressingstring
std::string ipv4addressingstring
Definition: ethParser.h:42
eth::parser::boardData
Definition: ethParser.h:84
eth::parser::boardActions::monitorpresence_periodofmissingreport
double monitorpresence_periodofmissingreport
Definition: ethParser.h:73