예제 #1
0
    def handle_cameras(self,req): 
        """ 
        Hanldes requests to start and stop the cameras found by the inspector
        nodes.  
        """
        response = True
        message = ''
        cmd = req.command
        cmd = cmd.lower()
        if cmd == 'start':
            if not self.camera_running:
                self.launch_camera_nodes()
                self.camera_running = True
            else:
                response = False
                message = 'cameras already running'
        elif cmd == 'stop':
            if self.camera_running:
                self.camera_nodes_clean_up()
                self.camera_running = False
            else:
                response = False
                message = 'cameras not running'
        else:
            response = False
            message = 'unknow command'.format(cmd)

        return CommandStringResponse(response,message)
예제 #2
0
    def handle_camera_srv(self, request):
        """
        Handes requests for camera services. Starts and stops the camera nodes.
        """
        command = request.command
        command = command.lower()
        response = True
        message = ''

        if command == 'start':
            if self.camera_popen is None:
                self.launch_camera_nodes()
            else:
                repsonse = False
                message = 'camera nodes already started'

        elif command == 'stop':
            if self.camera_popen is not None:
                print('stop')
                self.kill_camera_nodes()
            else:
                response = False
                message = 'camera nodes not running'
        else:
            response = False
            message = 'uknown request: {0}'.format(request)
        return CommandStringResponse(response, message)
예제 #3
0
    def handle_mjpeg_servers_srv(self, req):
        """
        Handles request for starting and stoping the mjpeg servers. Creates a dictionary
        of mjpeg server information.
        """
        cmd = req.command
        cmd = cmd.lower()
        response = True
        message = ''
        if cmd == 'start':
            # Start mjpeg servers if they haven't already been started
            if not self.server_running:
                self.launch_mjpeg_servers()
            else:
                response = False
                message = 'mjpeg servers already running'

        elif cmd == 'stop':
            # Stop mjpeg servers if they are running
            if self.server_running:
                self.kill_mjpeg_servers()
                self.delete_server_launch_file()
            else:
                repsonse = False
                message = 'mjpeg servers not running'
        else:
            response = False
            message = 'unknown command {0}'.format(cmd)
        return CommandStringResponse(response, message)
예제 #4
0
 def handle_unlock_srv(self, req):
     """
     Try to release access lock
     """
     node_name = req.command
     flag = True
     message = ''
     with self.lock:
         if self.access_lock_owner is not None:
             if node_name == self.access_lock_owner:
                 self.access_lock_owner = None
             else:
                 flag = False
                 message = 'cannot unlock - not lock owner'
     return CommandStringResponse(flag, message)
예제 #5
0
 def handle_lock_srv(self, req):
     """
     Try to acquire access lock
     """
     node_name = req.command
     flag = True
     message = ''
     with self.lock:
         if (self.access_lock_owner is None) or (self.access_lock_owner
                                                 == node_name):
             self.access_lock_owner = node_name
         else:
             flag = False
             message = 'cannot lock - lock already owned'
     return CommandStringResponse(flag, message)
예제 #6
0
 def handle_corrector_srv(self, req):
     """
     Handles requests to launch/kill the frame drop corrector nodes.
     """
     command = req.command.lower()
     response = True
     message = ''
     if command == 'start':
         if self.corrector_popen is None:
             self.launch_correctors()
         else:
             response = False
             message = 'frame drop correctors already running'
     elif command == 'stop':
         if self.corrector_popen is not None:
             self.kill_correctors()
         else:
             response = False
             message = 'frame drop correctors not running'
     return CommandStringResponse(response, message)
예제 #7
0
 def handle_labeler_srv(self, req):
     """
     Handles requests to launch/kill the stitched image labeler nodes
     """
     command = req.command.lower()
     response = True
     message = ''
     if command == 'start':
         if self.labeler_popen is None:
             self.launch_labelers()
         else:
             response = False
             message = 'stitched image labelers already running'
     elif command == 'stop':
         if self.labeler_popen is not None:
             self.kill_labelers()
         else:
             response = False
             message = 'stitched image labelers not running'
     return CommandStringResponse(response, message)
예제 #8
0
 def handle_zoom_tool_srv(self,req):
     """
     Handles requests to launch/kill the zoom tool nodes.
     """
     command = req.command.lower()
     response = True
     message = ''
     if command == 'start':
         if self.zoom_tool_popen is None:
             self.launch_zoom_tools()
         else:
             response = False
             message = 'zoom tools already running'
     elif command == 'stop':
         if self.zoom_tool_popen is not None:
             self.kill_zoom_tools()
         else:
             response = False
             message = 'zoom tools not running'
     return CommandStringResponse(response,message)
예제 #9
0
    def handle_image_proc_srv(self,req):
        """
        Handles requests to lauch/kill the image proc nodes.
        """
        command = req.command.lower()
        response = True
        message = ''
        if command == 'start':
            if self.image_proc_popen is None:
                self.launch_image_proc_nodes()
            else:
                response = False
                message = 'image proc nodes already running'

        elif command == 'stop':
            if self.image_proc_popen is not None:
                self.kill_image_proc_nodes()
            else:
                response = False
                message = 'image proc nodes not running'
        else:
            response = False
            message = 'uknown command: {0}'.format(command)
        return CommandStringResponse(response,message)