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;
42  std::string ipv4addressingstring;
43  std::string ipv4string;
44  std::string typestring;
45 
47  reset();
48  }
49  void reset() {
50  type = eobrd_ethtype_none; ipv4addressing.addr = 0; ipv4addressing.port = 0;
52  }
53  };
54 
56  {
57  std::string name;
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;
103  std::string addressingstring;
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 
bool read(yarp::os::Searchable &cfgtotal, pc104Data &pc104data)
Definition: ethParser.cpp:92
bool print(const pc104Data &pc104data)
Definition: ethParser.cpp:57
double monitorpresence_periodofmissingreport
Definition: ethParser.h:73
boardActions actions
Definition: ethParser.h:88
boardProperties properties
Definition: ethParser.h:86
boardSettings settings
Definition: ethParser.h:87
std::uint16_t maxSizeRXpacket
Definition: ethParser.h:40
eObrd_ethtype_t type
Definition: ethParser.h:39
eOipv4addressing_t ipv4addressing
Definition: ethParser.h:38
std::uint16_t maxSizeROP
Definition: ethParser.h:41
std::string ipv4addressingstring
Definition: ethParser.h:42
eOmn_appl_config_t txconfig
Definition: ethParser.h:58
eOipv4addressing_t localaddressing
Definition: ethParser.h:100
std::string addressingstring
Definition: ethParser.h:103
std::uint16_t rxrate
Definition: ethParser.h:102
std::uint16_t txrate
Definition: ethParser.h:101