test_server_lidar_msg.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 sick_scan2 test_server_lidar_msg implements the lidar specific messages,
4  * i.e. message receiving and message creation to simulate lidar devices.
5  *
6  * Note: sick_scan2 test_server_lidar_msg does not implement the functions of lidar sensors,
7  * it just implements a simple message handling to test the sick_scan2 ros drivers.
8  *
9  * Copyright (C) 2020 Ing.-Buero Dr. Michael Lehning, Hildesheim
10  * Copyright (C) 2020 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 2020 SICK AG
57  * Copyright 2020 Ing.-Buero Dr. Michael Lehning
58  *
59  */
60 #ifndef __SICK_SCAN_TEST_SERVER_LIDAR_MESSAGE_H_INCLUDED
61 #define __SICK_SCAN_TEST_SERVER_LIDAR_MESSAGE_H_INCLUDED
62 
63 #include <algorithm>
64 #include <memory>
65 #include <string>
66 #include <vector>
71 
72 namespace sick_scan_xd
73 {
74  namespace test
75  {
80  {
81  public:
82 
83  /*
84  * @brief Receives a message if data on a tcp socket are available.
85  * Non-blocking function (i.e. it returns immediately) if no data available.
86  * If data available, this function returns after a complete message has been received, or an error occured.
87  * @param[in] tcp_client_socket socket to read from
88  * @param[out] message message received from client
89  * @param[out] is_binary true for binary messages, false for ascii messages
90  * @return true, if a message has been received, false otherwise
91  */
92  virtual bool receiveMessage(sick_scan_xd::ServerSocket & tcp_client_socket, std::vector<uint8_t> & message, bool & is_binary) = 0;
93 
94  /*
95  * @brief Generate a response to a message received from client.
96  * @param[in] message_received message received from client
97  * @param[in] is_binary true for binary messages, false for ascii messages
98  * @param[out] response response to the client
99  * @return true, if a response has been created, false otherwise (no response required or invalid message received)
100  */
101  virtual bool createResponse(const std::vector<uint8_t> & message_received, bool is_binary, std::vector<uint8_t> & response) = 0;
102 
103  /*
104  * @brief Generate a scan data message.
105  * @param[out] scandata scan data message
106  * @return true, if a a scan data message has been created, false otherwise (f.e. if a sensor does not generate scan data)
107  */
108  virtual bool createScandata(std::vector<uint8_t> & scandata) = 0;
109 
110 
111  }; // class TestServerLidarMsg
112 
113  } // namespace test
114 } // namespace sick_scan_xd
115 #endif // __SICK_SCAN_TEST_SERVER_LIDAR_MESSAGE_H_INCLUDED
response
const std::string response
sick_generic_laser.h
sick_scan_xd::test::TestServerLidarMsg::createScandata
virtual bool createScandata(std::vector< uint8_t > &scandata)=0
sick_scan_xd
Definition: abstract_parser.cpp:65
sick_scan_common.h
test
sick_ros_wrapper.h
message
def message(msg, *args, **kwargs)
server_socket.h
sick_scan_xd::test::TestServerLidarMsg::receiveMessage
virtual bool receiveMessage(sick_scan_xd::ServerSocket &tcp_client_socket, std::vector< uint8_t > &message, bool &is_binary)=0
sick_scan_xd::test::TestServerLidarMsg
Definition: test_server_lidar_msg.h:79
sick_scan_xd::test::TestServerLidarMsg::createResponse
virtual bool createResponse(const std::vector< uint8_t > &message_received, bool is_binary, std::vector< uint8_t > &response)=0
sick_scan_base.h
sick_scan_xd::ServerSocket
Definition: server_socket.h:83


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