Personal fork
Fork of rosserial_mbed_lib by
Diff: ros/publisher.h
- Revision:
- 3:1cf99502f396
- Parent:
- 1:ff0ec969dad1
- Child:
- 4:684f39d0c346
--- a/ros/publisher.h Sun Oct 16 09:35:11 2011 +0000 +++ b/ros/publisher.h Sat Nov 12 23:54:45 2011 +0000 @@ -32,10 +32,11 @@ * POSSIBILITY OF SUCH DAMAGE. */ -#ifndef PUBLISHER_H_ -#define PUBLISHER_H_ +#ifndef _ROS_PUBLISHER_H_ +#define _ROS_PUBLISHER_H_ -#include "node_output.h" +#include "rosserial_msgs/TopicInfo.h" +#include "node_handle.h" namespace ros{ @@ -43,17 +44,23 @@ class Publisher { public: - Publisher( const char * topic_name, Msg * msg ): topic_(topic_name), msg_(msg){}; - int publish( Msg * msg ){ - return no_->publish(id_, msg_); - }; + Publisher( const char * topic_name, Msg * msg, int endpoint=rosserial_msgs::TopicInfo::ID_PUBLISHER) : + topic_(topic_name), + msg_(msg), + endpoint_(endpoint) {}; + + int publish( const Msg * msg ) { return nh_->publish(id_, msg); }; + int getEndpointType(){ return endpoint_; } const char * topic_; Msg *msg_; - short id_; - NodeOutput_* no_; + // id_ and no_ are set by NodeHandle when we advertise + int16_t id_; + NodeHandleBase_* nh_; + private: + int endpoint_; }; }