udp_poster.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 udp_poster implements udp posts to start and stop multiScan136.
4  *
5  * Copyright (C) 2020 Ing.-Buero Dr. Michael Lehning, Hildesheim
6  * Copyright (C) 2020 SICK AG, Waldkirch
7  *
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  *
20  * All rights reserved.
21  *
22  * Redistribution and use in source and binary forms, with or without
23  * modification, are permitted provided that the following conditions are met:
24  *
25  * * Redistributions of source code must retain the above copyright
26  * notice, this list of conditions and the following disclaimer.
27  * * Redistributions in binary form must reproduce the above copyright
28  * notice, this list of conditions and the following disclaimer in the
29  * documentation and/or other materials provided with the distribution.
30  * * Neither the name of SICK AG nor the names of its
31  * contributors may be used to endorse or promote products derived from
32  * this software without specific prior written permission
33  * * Neither the name of Ing.-Buero Dr. Michael Lehning nor the names of its
34  * contributors may be used to endorse or promote products derived from
35  * this software without specific prior written permission
36  *
37  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
38  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
39  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
40  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
41  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
42  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
43  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
44  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
45  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
47  * POSSIBILITY OF SUCH DAMAGE.
48  *
49  * Authors:
50  * Michael Lehning <michael.lehning@lehning.de>
51  *
52  * Copyright 2020 SICK AG
53  * Copyright 2020 Ing.-Buero Dr. Michael Lehning
54  *
55  */
56 #ifndef __SICK_SCANSEGMENT_XD_UDP_POSTER_H
57 #define __SICK_SCANSEGMENT_XD_UDP_POSTER_H
58 
61 
62 namespace sick_scansegment_xd
63 {
64  /*
65  * @brief forward declaration of an udp sender socket implementation.
66  * Used internally in the UdpPoster.
67  */
68  class UdpSenderSocketImpl;
69 
70  /*
71  * @brief forward declaration of an udp receiver socket implementation.
72  * Used internally in the UdpPoster.
73  */
74  class UdpReceiverSocketImpl;
75 
76  /*
77  * @brief class UdpReceiver receives msgpack raw data by udp.
78  * It implements a udp client, connects to multiScan136 (or any other udp-) sender,
79  * receives and buffers msgpack raw data.
80  */
81  class UdpPoster
82  {
83  public:
84 
85  /*
86  * @brief Default constructor.
87  * @param[in] ip ip address of a multiScan136, f.e. "127.0.0.1" (localhost, loopback) for an emulator or "192.168.0.1" for multiScan136
88  * @param[in] udp_port ip port, f.e. 2115 (default port for multiScan136 emulator)
89  */
90  UdpPoster(const std::string& ip = "192.168.0.1", int udp_port = 2115);
91 
92  /*
93  * @brief Default destructor.
94  */
95  ~UdpPoster();
96 
97  /*
98  * @brief Returns the ip address to send udp messages.
99  */
100  const std::string& IP(void) const;
101 
102  /*
103  * @brief Returns the port to send udp messages.
104  */
105  const int& Port(void) const;
106 
107  /*
108  * @brief Posts a request message.
109  * @param[in] request message to send
110  * @param[in] response message received
111  * @return true on success, otherwise false
112  */
113  bool Post(const std::string& request, std::string& response);
114 
115  private:
116 
117  /*
118  * Member data to run a udp receiver
119  */
120  std::string m_ip; // ip address of a multiScan136 to to send upd messages.
121  int m_port; // udp port to send and receive
122  UdpSenderSocketImpl* m_sender_impl; // implementation of the udp sender socket
123  UdpReceiverSocketImpl* m_receiver_impl; // implementation of the udp receiver socket
124 
125  }; // class UdpPoster
126 
127 } // namespace sick_scansegment_xd
128 #endif // __SICK_SCANSEGMENT_XD_UDP_RECEIVER_H
common.h
response
const std::string response
sick_scansegment_xd::UdpPoster::m_sender_impl
UdpSenderSocketImpl * m_sender_impl
Definition: udp_poster.h:122
sick_scansegment_xd::UdpPoster::m_receiver_impl
UdpReceiverSocketImpl * m_receiver_impl
Definition: udp_poster.h:123
sick_scansegment_xd::UdpPoster::m_ip
std::string m_ip
Definition: udp_poster.h:120
sick_scansegment_xd
Definition: include/sick_scansegment_xd/common.h:138
sick_scansegment_xd::UdpPoster::UdpPoster
UdpPoster(const std::string &ip="192.168.0.1", int udp_port=2115)
Definition: udp_poster.cpp:63
sick_ros_wrapper.h
sick_scansegment_xd::UdpPoster::IP
const std::string & IP(void) const
Definition: udp_poster.cpp:102
multiscan_pcap_player.udp_port
int udp_port
Definition: multiscan_pcap_player.py:137
sick_scansegment_xd::UdpPoster::~UdpPoster
~UdpPoster()
Definition: udp_poster.cpp:85
sick_scansegment_xd::UdpPoster::Port
const int & Port(void) const
Definition: udp_poster.cpp:110
sick_scan_base.h
sick_scansegment_xd::UdpPoster::Post
bool Post(const std::string &request, std::string &response)
Definition: udp_poster.cpp:121
sick_scansegment_xd::UdpPoster
Definition: udp_poster.h:81
sick_scansegment_xd::UdpPoster::m_port
int m_port
Definition: udp_poster.h:121
sick_scansegment_xd::UdpSenderSocketImpl
class UdpSenderSocketImpl implements the udp socket for sending udp packages
Definition: udp_sockets.h:272
sick_scansegment_xd::UdpReceiverSocketImpl
Definition: udp_sockets.h:106


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