pcapng_json_parser.h
Go to the documentation of this file.
1 /*
2  * @brief pcapng_json_parser parses jsonfiles converted from pcapng-files by pcap_json_converter.
3  *
4  * Copyright (C) 2021 Ing.-Buero Dr. Michael Lehning, Hildesheim
5  * Copyright (C) 2021 SICK AG, Waldkirch
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  * All rights reserved.
20  *
21  * Redistribution and use in source and binary forms, with or without
22  * modification, are permitted provided that the following conditions are met:
23  *
24  * * Redistributions of source code must retain the above copyright
25  * notice, this list of conditions and the following disclaimer.
26  * * Redistributions in binary form must reproduce the above copyright
27  * notice, this list of conditions and the following disclaimer in the
28  * documentation and/or other materials provided with the distribution.
29  * * Neither the name of SICK AG nor the names of its
30  * contributors may be used to endorse or promote products derived from
31  * this software without specific prior written permission
32  * * Neither the name of Ing.-Buero Dr. Michael Lehning nor the names of its
33  * contributors may be used to endorse or promote products derived from
34  * this software without specific prior written permission
35  *
36  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
37  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
38  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
39  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
40  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
41  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
42  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
43  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
44  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
46  * POSSIBILITY OF SUCH DAMAGE.
47  *
48  * Authors:
49  * Michael Lehning <michael.lehning@lehning.de>
50  *
51  * Copyright 2021 SICK AG
52  * Copyright 2021 Ing.-Buero Dr. Michael Lehning
53  *
54  */
55 #ifndef __PCAPNG_JSON_PARSER_H_INCLUDED
56 #define __PCAPNG_JSON_PARSER_H_INCLUDED
57 
58 #include <cstdint>
59 #include <map>
60 #include <string>
61 #include <vector>
62 
63 #include "sick_scan/ros_wrapper.h"
64 
65 namespace sick_scan
66 {
71  {
72  public:
73 
74  JsonScanData(double _timestamp = 0, const std::vector<uint8_t>& _data = std::vector<uint8_t>()) : timestamp(_timestamp), data(_data) {}
75  double timestamp; // relative timestamp in seconds
76  std::vector<uint8_t> data; // binary cola data 0x02020202....
77  };
78 
83  {
84  public:
85 
94  static bool parseJsonfile(const std::string & json_filename, const std::vector<std::string> & scandatatypes, double start_time, std::vector<sick_scan::JsonScanData> & scandata);
95 
101  static std::vector<std::string> split(const std::string & s, char delimiter);
102 
103  protected:
104 
105  }; // class PcapngJsonParser
106 
107 } // namespace sick_scan
108 #endif // __PCAPNG_JSON_PARSER_H_INCLUDED
sick_scan::PcapngJsonParser::split
static std::vector< std::string > split(const std::string &s, char delimiter)
Splits a comma separated string into its parts.
Definition: pcapng_json_parser.cpp:69
pcap_json_converter.json_filename
string json_filename
Definition: pcap_json_converter.py:124
sick_scan::PcapngJsonParser::parseJsonfile
static bool parseJsonfile(const std::string &json_filename, const std::vector< std::string > &scandatatypes, double start_time, std::vector< sick_scan::JsonScanData > &scandata)
Parses a jsonfile and returns a list of binary scandata messages of given type.
Definition: pcapng_json_parser.cpp:87
sick_scan::PcapngJsonParser
class PcapngJsonParser parses jsonfiles converted from pcapng-files by pcap_json_converter.
Definition: pcapng_json_parser.h:82
sick_scan
Definition: abstract_parser.cpp:50
sick_scan::JsonScanData::timestamp
double timestamp
Definition: pcapng_json_parser.h:75
sick_scan::JsonScanData::JsonScanData
JsonScanData(double _timestamp=0, const std::vector< uint8_t > &_data=std::vector< uint8_t >())
Definition: pcapng_json_parser.h:74
sick_scan::JsonScanData::data
std::vector< uint8_t > data
Definition: pcapng_json_parser.h:76
sick_scan::JsonScanData
class JsonScanData: utility container for binary scandata incl. timestamp
Definition: pcapng_json_parser.h:70
s
static sick_scan::SickScanCommonTcp * s
Definition: sick_generic_laser.cpp:92
ros_wrapper.h


sick_scan
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Thu Sep 8 2022 02:30:19