Package rocon_gateway :: Module public_interface :: Class PublicInterface
[frames] | no frames]

Class PublicInterface

source code

object --+
         |
        PublicInterface


The public interface is the set of rules
(pubs/subs/services/actions) that are exposed and made available for
freely sharing with a multimaster system.

It consists of:
 * list of currently available rules to be shared
 * list of rules and filters that will be watched
   and shared if they become available

Instance Methods
 
__init__(self, default_rule_blacklist, default_rules)
Initialises the public interface
source code
 
add_rule(self, rule)
Watch for a new public rule, as described for by the incoming message.
source code
 
remove_rule(self, rule)
Attempt to remove a watchlist rule from the public interface.
source code
 
advertise_all(self, blacklist)
Allow all rules apart from the ones in the provided blacklist + default blacklist
source code
 
unadvertise_all(self)
Disallow the allow all mode, if enabled.
source code
 
getInterface(self) source code
 
getWatchlist(self) source code
 
getBlacklist(self) source code
Connection[], Connection[]
update(self, connections)
Checks a list of rules and determines which ones should be added/removed to the public interface.
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, default_rule_blacklist, default_rules)
(Constructor)

source code 

Initialises the public interface

Parameters:
  • default_rule_blacklist - connection type keyed dictionary of rules @type str keyed dictionary of gateway_msgs.msg.Rule[]
  • default_rules - connection type keyed dictionary of rules @type str keyed dictionary of gateway_msgs.msg.Rule[]
Overrides: object.__init__

add_rule(self, rule)

source code 

Watch for a new public rule, as described for by the incoming message.

Parameters:
  • rule - a rule msg from the advertise call @type Rule

    @return the rule if added, or None if the rule exists already @rtype Rule || None

remove_rule(self, rule)

source code 

Attempt to remove a watchlist rule from the public interface. Be a bit careful looking for a rule to remove, depending on the node name, which can be set (exact rule/node name match) or None in which case all nodes of that kind of advertisement will match.

Parameters:
  • rule - a rule to unadvertise @type Rule

    @return the list of rules removed @rtype Rule[]

advertise_all(self, blacklist)

source code 

Allow all rules apart from the ones in the provided blacklist + default blacklist

Parameters:
  • blacklist - list of Rule objects
  • list (list of Rule objects

    @return failure if already advertising all, success otherwise @rtype bool

    )

unadvertise_all(self)

source code 

Disallow the allow all mode, if enabled. If allow all mode is not enabled, remove everything from the public interface

update(self, connections)

source code 

Checks a list of rules and determines which ones should be added/removed to the public interface. Modifies the public interface accordingly, and returns the list of rules to the gateway for hub operations

Parameters:
  • rules - the list of rules available locally @type dict of lists of Rule objects
Returns: Connection[], Connection[]
new public connections, as well as connections to be removed