25 #include <boost/shared_array.hpp>
26 #include <boost/asio/windows/stream_handle.hpp>
30 namespace RobotRaconteur
32 class ROBOTRACONTEUR_CORE_API LocalTransportConnection;
53 friend class HardwareTransportConnection;
59 RR_UNORDERED_MAP<uint32_t, RR_SHARED_PTR<ITransportConnection> > TransportConnections;
60 boost::mutex TransportConnections_lock;
79 RR_OVIRTUAL
bool IsServer() const RR_OVERRIDE;
81 RR_OVIRTUAL
bool IsClient() const RR_OVERRIDE;
83 RR_OVIRTUAL std::
string GetUrlSchemeString() const RR_OVERRIDE;
85 RR_OVIRTUAL std::vector<std::
string> GetServerListenUrls() RR_OVERRIDE;
87 RR_OVIRTUAL
void SendMessage(const RR_INTRUSIVE_PTR<Message>& m) RR_OVERRIDE;
89 RR_OVIRTUAL
void AsyncSendMessage(
90 const RR_INTRUSIVE_PTR<Message>& m,
93 RR_OVIRTUAL
void AsyncCreateTransportConnection(
94 boost::string_ref url, const RR_SHARED_PTR<Endpoint>& e,
95 boost::function<
void(const RR_SHARED_PTR<ITransportConnection>&,
98 RR_OVIRTUAL RR_SHARED_PTR<ITransportConnection> CreateTransportConnection(
99 boost::string_ref url, const RR_SHARED_PTR<Endpoint>& e) RR_OVERRIDE;
101 RR_OVIRTUAL
void CloseTransportConnection(const RR_SHARED_PTR<Endpoint>& e) RR_OVERRIDE;
104 virtual
void AsyncCreateTransportConnection2(
105 const std::
string& noden, const RR_SHARED_PTR<ITransportConnection>& transport,
107 boost::function<
void(const RR_SHARED_PTR<ITransportConnection>&,
110 virtual
void CloseTransportConnection_timed(const boost::system::error_code& err, const RR_SHARED_PTR<Endpoint>& e,
111 const RR_SHARED_PTR<
void>& timer);
114 RR_OVIRTUAL
bool CanConnectService(boost::string_ref url) RR_OVERRIDE;
116 RR_OVIRTUAL
void Close() RR_OVERRIDE;
118 RR_OVIRTUAL
void CheckConnection(uint32_t endpoint) RR_OVERRIDE;
120 RR_OVIRTUAL
void PeriodicCleanupTask() RR_OVERRIDE;
122 RR_OVIRTUAL uint32_t TransportCapability(boost::string_ref name) RR_OVERRIDE;
124 RR_OVIRTUAL
void MessageReceived(const RR_INTRUSIVE_PTR<Message>& m) RR_OVERRIDE;
126 RR_OVIRTUAL
void AsyncGetDetectedNodes(
127 const std::vector<std::
string>& schemes,
128 const boost::function<
void(const RR_SHARED_PTR<std::vector<
NodeDiscoveryInfo> >&)>& handler,
132 virtual int32_t GetMaxMessageSize();
134 virtual
void SetMaxMessageSize(int32_t size);
137 virtual
bool GetDisableMessage4();
139 virtual
void SetDisableMessage4(
bool d);
142 virtual
bool GetDisableStringTable();
144 virtual
void SetDisableStringTable(
bool d);
147 virtual
bool GetDisableAsyncMessageIO();
149 virtual
void SetDisableAsyncMessageIO(
bool d);
158 virtual
void AddUsbDevice(uint16_t vid, uint16_t pid, uint8_t interface_);
167 virtual
void RemoveUsbDevice(uint16_t vid, uint16_t pid, uint8_t interface_);
178 virtual
bool IsValidUsbDevice(uint16_t vid, uint16_t pid, uint8_t interface_);
180 virtual
void register_transport(const RR_SHARED_PTR<ITransportConnection>& connection);
181 virtual
void erase_transport(const RR_SHARED_PTR<ITransportConnection>& connection);
183 template <typename T, typename F>
184 boost::signals2::connection AddCloseListener(const RR_SHARED_PTR<T>& t, const F& f)
186 boost::mutex::scoped_lock lock(closed_lock);
191 return boost::signals2::connection();
194 return close_signal.connect(boost::signals2::signal<
void()>::slot_type(boost::bind(f, t.get())).track(t));
198 boost::mutex parameter_lock;
199 int32_t max_message_size;
200 bool disable_message4;
201 bool disable_string_table;
202 bool disable_async_message_io;
204 boost::mutex discovery_lock;
206 RR_SHARED_PTR<void> internal1;
207 RR_SHARED_PTR<void> internal2;
208 RR_SHARED_PTR<void> internal3;
209 RR_SHARED_PTR<void> internal4;
211 std::list<boost::tuple<uint16_t, uint16_t, uint8_t> > usb_devices;
214 boost::mutex closed_lock;
215 boost::signals2::signal<void()> close_signal;
217 #ifndef ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
218 using HardwareTransportPtr = RR_SHARED_PTR<HardwareTransport>;
#define RR_TIMEOUT_INFINITE
Disable timeout for asynchronous operations.
Definition: RobotRaconteurConstants.h:566
Transport for USB, Bluetooth, and PCIe hardware devices.
Definition: HardwareTransport.h:52
HardwareTransport(const boost::shared_ptr< RobotRaconteurNode > &node=RobotRaconteurNode::sp())
Construct a new HardwareTransport.
Raw information used to announce and detect nodes.
Definition: Discovery.h:137
Base class for Robot Raconteur exceptions.
Definition: Error.h:50
static boost::shared_ptr< RobotRaconteurNode > sp()
Singleton shared_ptr accessor.
Base class for transports.
Definition: Transport.h:120