hub_api.py
Go to the documentation of this file.
1 #!/usr/bin/env pythonupdate
2 #
3 # License: BSD
4 # https://raw.github.com/robotics-in-concert/rocon_multimaster/master/rocon_hub_client/LICENSE
5 #
6 ###############################################################################
7 # Imports
8 ###############################################################################
9 
10 import re
11 
12 ###############################################################################
13 # Utility Functions
14 ###############################################################################
15 
16 
18  '''
19  Root the specified redis key name in our pseudo redis database.
20  '''
21  if re.match('rocon:', key): # checks if leading rocon: is foundupdate
22  return key
23  else:
24  return 'rocon:' + key
25 
26 
28  '''
29  Root the specified redis key name in our pseudo redis database under
30  the hub namespace
31  '''
32  if re.match('rocon:hub:', key): # checks if leading rocon: is foundupdate
33  return key
34  else:
35  return 'rocon:hub:' + key
36 
37 
38 def create_rocon_gateway_key(unique_gateway_name, key):
39  '''
40  Root the specified redis key name in our pseudo redis database under
41  the gateway namespace.
42 
43  @note : currently does no checking of the incoming keys
44  '''
45  return 'rocon:' + unique_gateway_name + ":" + key
46 
47 
49  '''
50  Extract the specified redis key name from our pseudo redis database.
51  '''
52  if re.match('rocon:', key): # checks if leading rocon: is found
53  return re.sub(r'rocon:', '', key)
54  else:
55  return key
56 
57 
58 def key_base_name(key):
59  '''
60  Extract the base name (i.e. last value) from the key.
61  e.g. rocon:key:pirate24 -> pirate24
62  '''
63  return key.split(':')[-1]
def key_base_name(key)
Definition: hub_api.py:58
def create_rocon_key(key)
Utility Functions.
Definition: hub_api.py:17
def create_rocon_gateway_key(unique_gateway_name, key)
Definition: hub_api.py:38
def extract_rocon_key(key)
Definition: hub_api.py:48
def create_rocon_hub_key(key)
Definition: hub_api.py:27


rocon_hub_client
Author(s): Daniel Stonier , Jihoon Lee
autogenerated on Mon Jun 10 2019 14:40:08