Beispiel #1
0
 def screens(self, nodename):
     '''
     :return: dictionary of screen name and corresponding ROS node name
     :rtype: {str: str}
     '''
     request = smsg.Screen(name='', node=nodename)
     response = self.sm_stub.GetScreens(request, timeout=settings.GRPC_TIMEOUT)
     return {screen.name: screen.node for screen in response.screens}
 def GetAllScreens(self, request, context):
     screens = screen.get_active_screens()
     reply = smsg.Screens()
     screen_objs = []
     for session_name, node_name in screens.items():
         screen_objs.append(smsg.Screen(name=session_name, node=node_name))
     reply.screens.extend(screen_objs)
     return reply
 def GetMultipleScreens(self, request, context):
     screens = screen.get_active_screens()
     reply = smsg.Screens()
     screen_objs = []
     node_names = []
     added_node_names = []
     for session_name, node_name in screens.items():
         if node_name not in node_names:
             node_names.append(node_name)
         elif node_name not in added_node_names:
             screen_objs.append(
                 smsg.Screen(name=session_name, node=node_name))
             added_node_names.append(node_name)
     # TODO currently we add only one session name. Add all!
     reply.screens.extend(screen_objs)
     return reply