iCub-main
Loading...
Searching...
No Matches
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 reset();
63 }
64 void reset() {
65 name = "none"; txconfig.cycletime = 1000; txconfig.txratedivider = 1;
66 txconfig.maxtimeRX = 400; txconfig.maxtimeDO = 300; txconfig.maxtimeTX = 300;
67 }
68 };
69
84
96
97
98 struct pc104Data
99 {
101 eOipv4addressing_t localaddressing;
102 std::uint16_t txrate;
103 std::uint16_t rxrate;
104 std::string addressingstring;
105 void reset() {
106 embBoardsConnected = true;
107 localaddressing.addr = eo_common_ipv4addr(10, 0, 1, 104); localaddressing.port = 12345;
108 txrate = 1; rxrate = 5;
109 addressingstring = "10.0.1.104:12345";
110 }
111 void setdefault() {
112 embBoardsConnected = true;
113 localaddressing.addr = eo_common_ipv4addr(10, 0, 1, 104); localaddressing.port = 12345;
114 txrate = 1; rxrate = 5;
115 addressingstring = "10.0.1.104:12345";
116 }
117 };
118
119 bool read(yarp::os::Searchable &cfgtotal, pc104Data &pc104data);
120 bool read(yarp::os::Searchable &cfgtotal, boardData &boarddata);
121
122 bool print(const pc104Data &pc104data);
123 bool print(const boardData &boarddata);
124
125
126}} // namespace eth { namespace parser {
127
128
129
130#endif // include-guard
131
132
133// - end-of-file (leave a blank line after)----------------------------------------------------------------------------
134
135
136
137
138
139
140
141
142
143
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:74
boardActions actions
Definition ethParser.h:89
boardProperties properties
Definition ethParser.h:87
boardSettings settings
Definition ethParser.h:88
std::uint16_t maxSizeRXpacket
Definition ethParser.h:41
eOipv4addressing_t ipv4addressing
Definition ethParser.h:39
std::string ipv4addressingstring
Definition ethParser.h:43
eOmn_appl_config_t txconfig
Definition ethParser.h:59
eOipv4addressing_t localaddressing
Definition ethParser.h:101
std::string addressingstring
Definition ethParser.h:104
std::uint16_t rxrate
Definition ethParser.h:103
std::uint16_t txrate
Definition ethParser.h:102