00001 00023 #ifndef UDP_BC_BROKER_H_ 00024 #define UDP_BC_BROKER_H_ 00025 00026 #include <iostream> 00027 #include <ros/ros.h> 00028 #include <pluginlib/class_list_macros.h> 00029 00030 #include "micros_swarm/comm_interface.h" 00031 #include "ros_broker/GSDFPacket.h" 00032 00033 #include "micros_swarm/singleton.h" 00034 #include "micros_swarm/runtime_handle.h" 00035 00036 #include "udp_bc_broker/send.h" 00037 #include "udp_bc_broker/recv.h" 00038 00039 namespace udp_bc_broker{ 00040 00041 class UDPBCBroker : public micros_swarm::CommInterface{ 00042 public: 00043 UDPBCBroker(); 00044 void init(std::string name, const micros_swarm::PacketParser& parser); 00045 void broadcast(const std::vector<uint8_t>& msg_data); 00046 void receive(); 00047 private: 00048 void callback(const std::vector<uint8_t>& msg_vec); 00049 std::string name_; 00050 micros_swarm::PacketParser parser_; 00051 boost::shared_ptr<UdpSender> sender_; 00052 boost::shared_ptr<UdpRecver> recver_; 00053 boost::shared_ptr<micros_swarm::RuntimeHandle> rth_; 00054 }; 00055 }; 00056 #endif