Robot Raconteur Core C++ Library
Loading...
Searching...
No Matches
RobotRaconteur::ServiceInfo2Subscription Class Reference

Subscription for information about detected services. More...

#include <Subscription.h>

Public Member Functions

std::map< ServiceSubscriptionClientID, ServiceInfo2GetDetectedServiceInfo2 ()
 Returns a map of detected services.
event_connection AddServiceDetectedListener (boost::function< void(const boost::shared_ptr< ServiceInfo2Subscription > &, const ServiceSubscriptionClientID &, const ServiceInfo2 &)> handler)
 Add a listener callback that is invoked when a service is detected.
event_connection AddServiceLostListener (boost::function< void(const boost::shared_ptr< ServiceInfo2Subscription > &, const ServiceSubscriptionClientID &, const ServiceInfo2 &)> handler)
 Add a listener callback that is invoked when a service is lost.
RR_OVIRTUAL void Close () RR_OVERRIDE
 Close the subscription.

Detailed Description

Subscription for information about detected services.

Created using RobotRaconteurNode::SubscribeServiceInfo2()

The ServiceInfo2Subscription class is used to track services with a specific service type as they are detected on the local network and when they are lost. The currently detected services can also be retrieved. The service information is returned using the ServiceInfo2 structure.

Member Function Documentation

◆ AddServiceDetectedListener()

event_connection RobotRaconteur::ServiceInfo2Subscription::AddServiceDetectedListener ( boost::function< void(const boost::shared_ptr< ServiceInfo2Subscription > &, const ServiceSubscriptionClientID &, const ServiceInfo2 &)> handler)

Add a listener callback that is invoked when a service is detected.

The callback should have the signature:

void cb(ServiceInfo2SubscriptionPtr subscription, const ServiceSubscriptionClientID& client_id, const ServiceInfo2& service_info)

The returned event_connection can be used to modify or close the Boost.Signals2 connection.

Parameters
handlerThe callback function
Returns
event_connection The Boost.Signals2 connection

◆ AddServiceLostListener()

event_connection RobotRaconteur::ServiceInfo2Subscription::AddServiceLostListener ( boost::function< void(const boost::shared_ptr< ServiceInfo2Subscription > &, const ServiceSubscriptionClientID &, const ServiceInfo2 &)> handler)

Add a listener callback that is invoked when a service is lost.

The callback should have the signature:

void cb(ServiceInfo2SubscriptionPtr subscription, const ServiceSubscriptionClientID& client_id, const ServiceInfo2& service_info)

The returned event_connection can be used to modify or close the Boost.Signals2 connection.

Parameters
handlerThe callback function
Returns
event_connection The Boost.Signals2 connection

◆ Close()

RR_OVIRTUAL void RobotRaconteur::ServiceInfo2Subscription::Close ( )

Close the subscription.

Closes the subscription. Subscriptions are automatically closed when the node is shut down.

◆ GetDetectedServiceInfo2()

std::map< ServiceSubscriptionClientID, ServiceInfo2 > RobotRaconteur::ServiceInfo2Subscription::GetDetectedServiceInfo2 ( )

Returns a map of detected services.

The returned map contains the detected nodes as ServiceInfo2. The map is keyed with ServiceSubscriptionClientID.

This function does not block.

Returns
std::map<ServiceSubscriptionClientID, ServiceInfo2 > The detected services.

The documentation for this class was generated from the following file: