Loading [MathJax]/jax/output/HTML-CSS/config.js
iCub-main
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 <cstdint>
27#include <string>
28
29#include "EoProtocol.h"
30#include <yarp/os/Searchable.h>
31
32
33namespace eth { namespace parser {
34
35 // -- library eth parser
36
38 {
39 eOipv4addressing_t ipv4addressing;
40 eObrd_ethtype_t type;
41 std::uint16_t maxSizeRXpacket;
42 std::uint16_t maxSizeROP;
44 std::string ipv4string;
45 std::string typestring;
46
48 reset();
49 }
50 void reset() {
51 type = eobrd_ethtype_none; ipv4addressing.addr = 0; ipv4addressing.port = 0;
53 }
54 };
55
57 {
58 std::string name;
59 eOmn_appl_config_t txconfig;
60
62 {
63 reset();
64 }
65 void reset()
66 {
67 name = "none";
68 txconfig.runnermode = eomn_appl_runnermode_synchronized;
69 txconfig.safetygap = 0; txconfig.cycletime = 1000; txconfig.txratedivider = 1;
70 txconfig.maxtimeRX = 400; txconfig.maxtimeDO = 300; txconfig.maxtimeTX = 300;
71 txconfig.logging.period10ms = 0; txconfig.logging.flags = 0;
72 }
73
74 enum class ENTITY { name, runningmode, logging };
75 std::string to_string(ENTITY e) const
76 {
77 switch(e)
78 {
79 case ENTITY::name:
80 {
81 return name;
82 } break;
84 {
85 return std::string(" runnermode = ") + ((txconfig.runnermode == eomn_appl_runnermode_besteffort) ? "besteffort" : "synchronized") +
86 " safetygap = " + std::to_string(txconfig.safetygap) +
87 " cycletime = " + std::to_string(txconfig.cycletime) +
88 " maxtimeRX = " + std::to_string(txconfig.maxtimeRX) +
89 " maxtimeDO = " + std::to_string(txconfig.maxtimeDO) +
90 " txratedivider = " + std::to_string(txconfig.txratedivider)
91 ;
92 } break;
93 case ENTITY::logging:
94 {
95 return std::string(" logging.period = ") + std::to_string(txconfig.logging.period10ms / 100.0) + " flags = TBD";
96 } break;
97 default:
98 {
99 } break;
100 }
101 return "";
102
103 }
104
105 };
106
121
133
134
136 {
138 eOipv4addressing_t localaddressing;
139 std::uint16_t txrate;
140 std::uint16_t rxrate;
141 std::string addressingstring;
142 void reset() {
143 embBoardsConnected = true;
144 localaddressing.addr = eo_common_ipv4addr(10, 0, 1, 104); localaddressing.port = 12345;
145 txrate = 1; rxrate = 5;
146 addressingstring = "10.0.1.104:12345";
147 }
148 void setdefault() {
149 embBoardsConnected = true;
150 localaddressing.addr = eo_common_ipv4addr(10, 0, 1, 104); localaddressing.port = 12345;
151 txrate = 1; rxrate = 5;
152 addressingstring = "10.0.1.104:12345";
153 }
154 };
155
156 bool read(yarp::os::Searchable &cfgtotal, pc104Data &pc104data);
157 bool read(yarp::os::Searchable &cfgtotal, boardData &boarddata);
158
159 bool print(const pc104Data &pc104data);
160 bool print(const boardData &boarddata);
161
162
163}} // namespace eth { namespace parser {
164
165
166
167#endif // include-guard
168
169
170// - end-of-file (leave a blank line after)----------------------------------------------------------------------------
171
172
173
174
175
176
177
178
179
180
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:111
boardActions actions
Definition ethParser.h:126
boardProperties properties
Definition ethParser.h:124
boardSettings settings
Definition ethParser.h:125
std::uint16_t maxSizeRXpacket
Definition ethParser.h:41
eOipv4addressing_t ipv4addressing
Definition ethParser.h:39
std::string ipv4addressingstring
Definition ethParser.h:43
std::string to_string(ENTITY e) const
Definition ethParser.h:75
eOmn_appl_config_t txconfig
Definition ethParser.h:59
eOipv4addressing_t localaddressing
Definition ethParser.h:138
std::string addressingstring
Definition ethParser.h:141
std::uint16_t rxrate
Definition ethParser.h:140
std::uint16_t txrate
Definition ethParser.h:139