cola_converter.h
Go to the documentation of this file.
1 #include "sick_scan/sick_scan_base.h" /* Base definitions included in all header files, added by add_sick_scan_base_header.py. Do not edit this line. */
2 /*
3  * @brief sim_loc_cola_converter converts between Cola-ASCII and Cola-Binary telegrams.
4  * See Operation-Instruction-v1.1.0.241R.pdf, chapter 5.8 "About CoLa-A telegrams", page 46-48,
5  * Telegram-Listing-v1.1.0.241R.pdf, chapter 2.3.9 "Command: LocRequestTimestamp", page 21, and
6  * Technical_information_Telegram_Listing_NAV_LOC_en_IM0076556.PDF for further details about
7  * Cola telegrams.
8  *
9  * Copyright (C) 2019 Ing.-Buero Dr. Michael Lehning, Hildesheim
10  * Copyright (C) 2019 SICK AG, Waldkirch
11  *
12  * Licensed under the Apache License, Version 2.0 (the "License");
13  * you may not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  * http://www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an "AS IS" BASIS,
20  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  *
24  * All rights reserved.
25  *
26  * Redistribution and use in source and binary forms, with or without
27  * modification, are permitted provided that the following conditions are met:
28  *
29  * * Redistributions of source code must retain the above copyright
30  * notice, this list of conditions and the following disclaimer.
31  * * Redistributions in binary form must reproduce the above copyright
32  * notice, this list of conditions and the following disclaimer in the
33  * documentation and/or other materials provided with the distribution.
34  * * Neither the name of SICK AG nor the names of its
35  * contributors may be used to endorse or promote products derived from
36  * this software without specific prior written permission
37  * * Neither the name of Ing.-Buero Dr. Michael Lehning nor the names of its
38  * contributors may be used to endorse or promote products derived from
39  * this software without specific prior written permission
40  *
41  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
42  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
45  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
46  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
47  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
48  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
49  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
51  * POSSIBILITY OF SUCH DAMAGE.
52  *
53  * Authors:
54  * Michael Lehning <michael.lehning@lehning.de>
55  *
56  * Copyright 2019 SICK AG
57  * Copyright 2019 Ing.-Buero Dr. Michael Lehning
58  *
59  */
60 #ifndef __SIM_LOC_COLA_CONVERTER_H_INCLUDED
61 #define __SIM_LOC_COLA_CONVERTER_H_INCLUDED
62 
63 #include <cstdint>
64 #include <map>
65 #include <string>
66 #include <vector>
67 
68 #include "sick_scan/ros_wrapper.h"
69 
70 namespace sick_scan_xd
71 {
80  {
81  public:
82 
88  static std::string ConvertColaAscii(const std::vector<uint8_t> & cola_telegram);
89 
96  static std::vector<uint8_t> ConvertColaAscii(const std::string & cola_telegram);
97 
108  static std::vector<uint8_t> ColaTelegramToColaBinary(const sick_scan_xd::SickLocColaTelegramMsg & cola_telegram, int parameter_is_ascii = -1);
109 
122  static std::vector<uint8_t> ColaAsciiToColaBinary(const std::vector<uint8_t> & cola_telegram, int parameter_is_ascii = -1);
123 
132  static std::vector<uint8_t> ColaBinaryToColaAscii(const std::vector<uint8_t> & cola_telegram, bool parameter_to_ascii = true);
133 
140  static bool IsColaBinary(const std::vector<uint8_t> & cola_telegram);
141 
147  static uint32_t ColaBinaryTelegramLength(const std::vector<uint8_t> & cola_telegram);
148 
149  protected:
150 
151  /*
152  * member data
153  */
154 
155  static const std::string s_ascii_table[256];
156  static const std::map<std::string, uint8_t> s_ascii_map;
157 
158  }; // class ColaAsciiBinaryConverter
159 
160 } // namespace sick_scan_xd
161 #endif // __SIM_LOC_COLA_CONVERTER_H_INCLUDED
sick_scan_xd::ColaAsciiBinaryConverter::ColaBinaryToColaAscii
static std::vector< uint8_t > ColaBinaryToColaAscii(const std::vector< uint8_t > &cola_telegram, bool parameter_to_ascii=true)
Converts and returns a Cola telegram from Cola-ASCII to Cola-Binary.
Definition: cola_converter.cpp:267
sick_scan_xd::SickLocColaTelegramMsg_
Definition: SickLocColaTelegramMsg.h:24
sick_scan_xd::ColaAsciiBinaryConverter::ColaAsciiToColaBinary
static std::vector< uint8_t > ColaAsciiToColaBinary(const std::vector< uint8_t > &cola_telegram, int parameter_is_ascii=-1)
Converts and returns a Cola telegram from Cola-ASCII to Cola-Binary.
Definition: cola_converter.cpp:162
sick_scan_xd
Definition: abstract_parser.cpp:65
sick_scan_xd::ColaAsciiBinaryConverter::IsColaBinary
static bool IsColaBinary(const std::vector< uint8_t > &cola_telegram)
Returns true for Cola-Binary, if a given telegram is Cola-Binary encoded and starts with 4 Bytes { 0x...
Definition: cola_converter.cpp:342
sick_scan_xd::ColaAsciiBinaryConverter::ColaTelegramToColaBinary
static std::vector< uint8_t > ColaTelegramToColaBinary(const sick_scan_xd::SickLocColaTelegramMsg &cola_telegram, int parameter_is_ascii=-1)
Converts and returns a Cola telegram to Cola-Binary.
Definition: cola_converter.cpp:185
sick_scan_xd::ColaAsciiBinaryConverter::ConvertColaAscii
static std::string ConvertColaAscii(const std::vector< uint8_t > &cola_telegram)
Converts and returns a Cola-ASCII telegram to string.
Definition: cola_converter.cpp:105
sick_scan_base.h
sick_scan_xd::ColaAsciiBinaryConverter::ColaBinaryTelegramLength
static uint32_t ColaBinaryTelegramLength(const std::vector< uint8_t > &cola_telegram)
Decodes the header and returns the length of a Cola-Binary telegram.
Definition: cola_converter.cpp:354
sick_scan_xd::ColaAsciiBinaryConverter::s_ascii_table
static const std::string s_ascii_table[256]
static ascii table to convert binary to ascii, f.e. s_ascii_table[0x02]:="<STX>", s_ascii_table[0x03]...
Definition: cola_converter.h:155
sick_scan_xd::ColaAsciiBinaryConverter
class ColaAsciiBinaryConverter converts between Cola-ASCII and Cola-Binary telegrams....
Definition: cola_converter.h:79
sick_scan_xd::ColaAsciiBinaryConverter::s_ascii_map
static const std::map< std::string, uint8_t > s_ascii_map
static ascii map to convert ascii to binary, f.e. s_ascii_map["<STX>"]:=0x02, s_ascii_map["<ETX>"]:=0...
Definition: cola_converter.h:156
ros_wrapper.h


sick_scan_xd
Author(s): Michael Lehning , Jochen Sprickerhof , Martin Günther
autogenerated on Fri Oct 25 2024 02:47:07