@Override(ConcurrentExperiment.ConcurrentExperiment)
    @logged()
    def do_send_command_to_device(self, lab_session_id, command):

        if DEBUG: dbg("[DBG] Lab Session Id: %s" % lab_session_id)

        data = ""

        # This command is currently not used.
        if command == "GIVE_ME_CIRCUIT_LIST":
            circuit_list = self.get_circuits().keys()
            circuit_list_string = ""
            for c in circuit_list:
                circuit_list_string += c
                circuit_list_string += ','
            return circuit_list_string

        elif command.startswith("GIVE_ME_CIRCUIT_DATA"):
            print "[DBG] GOT GIVE_ME_CIRCUIT_DATA_REQUEST"
            circuit_name = command.split(' ', 1)[1]
            circuit_data = self.get_circuits()[circuit_name]
            return circuit_data
        elif command == 'GIVE_ME_LIBRARY':
            if DEBUG: dbg("[DBG] GOT GIVE_ME_LIBRARY")
            return self.library_xml

        elif command == "login":
            if DEBUG: dbg("[DBG] LOGIN")
            data = self.forward_request(lab_session_id, "<protocol version=\"1.3\"><login keepalive=\"1\"/></protocol>")
            session_key = self.extract_sessionkey(data)
            user = self._session_manager.get_session_locking(lab_session_id)
            try:
                # Store the session for the user
                user['sessionkey'] = session_key
                if DEBUG: dbg("[DBG] Extracted sessionkey: " + user['sessionkey'])
            finally:
                self._session_manager.modify_session_unlocking(lab_session_id, user)

            data = json.dumps({"teacher": self.teacher, "sessionkey": session_key})
        elif command.startswith("load"):
            if DEBUG: dbg("Circuit loaded: " + command[5:])
            
            try:
                circuit = xml.parseString(command[5:])
            except:
                traceback.print_exc()

        elif command.startswith("save"):
            if DEBUG: dbg("Circuit saved: " + command[5:])
    
            try:
                circuit = xml.parseString(command[5:])
            except:
                traceback.print_exc()
        else:
            if DEBUG:
                dbg("[DBG] REQUEST TYPE: " + self.parse_request_type(command))
                dbg("[DBG] SESSION ID: %s" % lab_session_id)

            data = self.forward_request(lab_session_id, command)

            dom = xml.parseString(data)
            multimeter = dom.getElementsByTagName('multimeter')
            for i in range(0, len(multimeter)):
                multimeter[i].setAttribute("id", str(i+1))

            data = dom.toxml().replace("<?xml version=\"1.0\" ?>", "")

            if DEBUG_MESSAGES:
                dbg("[DBG] DATA: "+data)

        return data
Callback run when the client sends a command to the experiment
dataset/ETHPy150Open weblabdeusto/weblabdeusto/server/src/experiments/visir_html5.py/VisirExperiment.do_send_command_to_device