41 UdpSocket::Response &)
43 ROS_INFO(
"Creating a UDP Socket for port: %i", request.port);
46 ROS_ERROR(
"Socket with port: %i already exists.. ", request.port);
47 if (
udp_sockets_[request.port]->getIp() == request.srcAddress)
54 "Sockets with the same port but different source IP Addresses are " 55 "currently not supported. ");
61 "p" + std::to_string(request.port), 1000);
65 std::make_shared<UdpCom>(request.srcAddress, request.destAddress,
66 request.port, request.isMulticast, temp_pub);
69 catch (std::exception e)
80 UdpSend::Response &response)
87 ->send(request.data, request.address, request.dstPort);
89 catch (std::out_of_range e)
91 ROS_ERROR(
"Socket Requested was not found.");
92 response.socketCreated =
false;
96 response.socketCreated =
true;
Implements the udp_com create_socket and send services.
PLUGINLIB_EXPORT_CLASS(udp_com::UdpComNodelet, nodelet::Nodelet)
bool send(UdpSend::Request &request, UdpSend::Response &)
ros::ServiceServer send_service_
ROS send service.
ServiceServer advertiseService(const std::string &service, bool(T::*srv_func)(MReq &, MRes &), T *obj)
ros::NodeHandle & getPrivateNodeHandle() const
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
ros::NodeHandle node_handler_
ROS node handle.
ros::ServiceServer create_socket_service_
ROS socket creation service.
Implements the create_socket and send ROS services.
bool createSocket(UdpSocket::Request &request, UdpSocket::Response &response)
std::map< uint16_t, std::shared_ptr< UdpCom > > udp_sockets_
Map of all the created UDP Sockets.