00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ROSCPP_TRANSPORT_PUBLISHER_LINK_H
00029 #define ROSCPP_TRANSPORT_PUBLISHER_LINK_H
00030
00031 #include "publisher_link.h"
00032 #include "connection.h"
00033
00034 namespace ros
00035 {
00036 class Header;
00037 class Message;
00038 class Subscription;
00039 typedef boost::shared_ptr<Subscription> SubscriptionPtr;
00040 typedef boost::weak_ptr<Subscription> SubscriptionWPtr;
00041 class Connection;
00042 typedef boost::shared_ptr<Connection> ConnectionPtr;
00043
00044 class WallTimerEvent;
00045
00050 class TransportPublisherLink : public PublisherLink
00051 {
00052 public:
00053 TransportPublisherLink(const SubscriptionPtr& parent, const std::string& xmlrpc_uri, const TransportHints& transport_hints);
00054 virtual ~TransportPublisherLink();
00055
00056
00057 bool initialize(const ConnectionPtr& connection);
00058
00059 const ConnectionPtr& getConnection() { return connection_; }
00060
00061 virtual std::string getTransportType();
00062 virtual void drop();
00063
00064 private:
00065 void onConnectionDropped(const ConnectionPtr& conn, Connection::DropReason reason);
00066 bool onHeaderReceived(const ConnectionPtr& conn, const Header& header);
00067
00071 virtual void handleMessage(const SerializedMessage& m, bool ser, bool nocopy);
00072
00073 void onHeaderWritten(const ConnectionPtr& conn);
00074 void onMessageLength(const ConnectionPtr& conn, const boost::shared_array<uint8_t>& buffer, uint32_t size, bool success);
00075 void onMessage(const ConnectionPtr& conn, const boost::shared_array<uint8_t>& buffer, uint32_t size, bool success);
00076
00077 void onRetryTimer(const ros::WallTimerEvent&);
00078
00079 ConnectionPtr connection_;
00080
00081 int32_t retry_timer_handle_;
00082 bool needs_retry_;
00083 WallDuration retry_period_;
00084 WallTime next_retry_;
00085 bool dropping_;
00086 };
00087 typedef boost::shared_ptr<TransportPublisherLink> TransportPublisherLinkPtr;
00088
00089 }
00090
00091 #endif // ROSCPP_TRANSPORT_PUBLISHER_LINK_H
00092
00093
00094