rocon_gateway :: gateway :: Gateway :: Class Gateway
[frames] | no frames]

Class Gateway

source code

object --+
         |
        Gateway

Used to synchronise with hubs.

Instance Methods
 
__init__(self, hub_manager, param, unique_name, publish_gateway_info_callback)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
spin(self) source code
 
shutdown(self) source code
 
is_connected(self)
We often check if we're connected to any hubs often just to ensure we don't waste time processing if there is no-one listening.
source code
 
disengage_hub(self, hub)
Disengage from the specified hub.
source code
 
update_flipped_interface(self, local_connection_index, remote_gateway_hub_index)
Process the list of local connections and check against the current flip rules and patterns for changes.
source code
 
update_pulled_interface(self, unused_connections, remote_gateway_hub_index)
Process the list of local connections and check against the current pull rules and patterns for changes.
source code
 
update_public_interface(self, local_connection_index)
Process the list of local connections and check against the current rules and patterns for changes.
source code
 
process_remote_gateway_flip_request(self, registration)
Used as a callback for incoming requests on redis pubsub channels.
source code
 
process_remote_gateway_unflip_request(self, rule, remote_gateway) source code
 
ros_service_advertise(self, request)
Puts/Removes a number of rules on the public interface watchlist.
source code
 
ros_service_advertise_all(self, request)
Toggles the advertise all mode.
source code
 
ros_service_flip(self, request)
Puts flip rules on a watchlist which (un)flips them when they become (un)available.
source code
 
ros_service_flip_all(self, request)
Flips everything except a specified blacklist to a particular gateway, or if the cancel flag is set, clears all flips to that gateway.
source code
 
ros_service_pull(self, request)
Puts a single rule on a watchlist and pulls it from a particular gateway when it becomes (un)available.
source code
 
ros_service_pull_all(self, request)
Pull everything except a specified blacklist from a particular gateway, or if the cancel flag is set, clears all pulls from that gateway.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

__init__(self, hub_manager, param, unique_name, publish_gateway_info_callback)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Parameters:
  • hub_manager - container for all the hubs this gateway connects to @type hub_api.HubManmager
  • param - parameters set by ros_parameters.py @type : dictionary of parameter key-value pairs
  • unique_name - gateway name (param['name']) with unique uuid hash appended
  • publish_gateway_info_callback - callback for publishing gateway info
Overrides: object.__init__

is_connected(self)

source code 

We often check if we're connected to any hubs often just to ensure we don't waste time processing if there is no-one listening.

@return True if at least one hub is connected, False otherwise @rtype Bool

disengage_hub(self, hub)

source code 

Disengage from the specified hub. Don't actually need to clean up connections here like we do in shutdown - that can be handled from the watcher thread itself.

Parameters:
  • hub - the hub that will be deleted.

update_flipped_interface(self, local_connection_index, remote_gateway_hub_index)

source code 

Process the list of local connections and check against the current flip rules and patterns for changes. If a rule has become (un)available take appropriate action.

Parameters:
  • local_connection_index - list of current local connections parsed from the master @type : dictionary of ConnectionType.xxx keyed lists of utils.Connections
  • gateways - list of remote gateway string id's @type string

update_pulled_interface(self, unused_connections, remote_gateway_hub_index)

source code 

Process the list of local connections and check against the current pull rules and patterns for changes. If a rule has become (un)available take appropriate action.

This is called by the watcher thread. The remote_gateway_hub_index is always a full dictionary of all remote gateway and hub key-value pairs - it is only included as an argument here to save processing doubly in the watcher thread.

Parameters:
  • connections - list of current local connections parsed from the master @type : dictionary of ConnectionType.xxx keyed lists of utils.Connections
  • remote_gateway_hub_index - key-value remote gateway name-hub list pairs @type dictionary of remote_gateway_name-list of hub_api.Hub objects key-value pairs

update_public_interface(self, local_connection_index)

source code 

Process the list of local connections and check against the current rules and patterns for changes. If a rule has become (un)available take appropriate action.

Parameters:
  • local_connection_index - list of current local connections parsed from the master @type : dictionary of ConnectionType.xxx keyed lists of utils.Connections

process_remote_gateway_flip_request(self, registration)

source code 

Used as a callback for incoming requests on redis pubsub channels. It gets assigned to RedisManager.callback.

Parameters:
  • registration - fully detailed registration to be processed @type utils.Registration

ros_service_advertise(self, request)

source code 

Puts/Removes a number of rules on the public interface watchlist. As local rules matching these rules become available/go away, the public interface is modified accordingly. A manual update is done at the end of the advertise call to quickly capture existing rules

@param request @type gateway_srvs.AdvertiseRequest @return service response @rtgateway_srvs.srv.AdvertiseReponse

ros_service_advertise_all(self, request)

source code 

Toggles the advertise all mode. If advertising all, an additional blacklist parameter can be supplied which includes all the topics that will not be advertised/watched for. This blacklist is added to the default blacklist of the public interface

@param request @type gateway_srvs.AdvertiseAllRequest @return service response @rtype gateway_srvs.AdvertiseAllReponse

ros_service_flip(self, request)

source code 

Puts flip rules on a watchlist which (un)flips them when they become (un)available.

@param request @type gateway_srvs.RemoteRequest @return service response @rtype gateway_srvs.RemoteResponse

ros_service_flip_all(self, request)

source code 

Flips everything except a specified blacklist to a particular gateway, or if the cancel flag is set, clears all flips to that gateway.

@param request @type gateway_srvs.RemoteAllRequest @return service response @rtype gateway_srvs.RemoteAllResponse

ros_service_pull(self, request)

source code 

Puts a single rule on a watchlist and pulls it from a particular gateway when it becomes (un)available.

@param request @type gateway_srvs.RemoteRequest @return service response @rtype gateway_srvs.RemoteResponse

ros_service_pull_all(self, request)

source code 

Pull everything except a specified blacklist from a particular gateway, or if the cancel flag is set, clears all pulls from that gateway.

@param request @type gateway_srvs.RemoteAllRequest @return service response @rtype gateway_srvs.RemoteAllResponse