示例#1
0
 def run(self):
     self.__is_running = True
     while self.__is_running:
         self.__print_menu()
         option = int(input(" >> "))
         if option == 0:
             self.__map.load_from_binary_file("../assets/test1.map")
         if option == 1:
             self.__map.load_from_binary_file("../assets/test1.map")
             self.__controller = Controller(self.__map)
             self.__controller.run()
         elif option == 2:
             self.do_before_running_gui()
             fittest_individual = self.__controller.fittest_individual
             gene_index = 0
             self.__is_running_gui = True
             time.sleep(1)
             while self.__is_running_gui:
                 if gene_index < INDIVIDUAL_SIZE:
                     self.__is_running_gui = self.__gui.render(
                         gene_index, fittest_individual)
                     gene_index += 1
                 time.sleep(0.5)
             self.__gui.quit()
         elif option == 3:
             pass
         elif option == 4:
             self.visualize_map()
示例#2
0
def _atualiza_aluno(argumentos):
    aluno_id = "--aluno-id"
    situacao = "--situacao"
    nome = "--nome"
    materia = "--materia"
    nota = "--nota"
    aluno = Aluno()
    try:
        if aluno_id in argumentos:
            id_ = _pega_valor(argumentos, aluno_id)
            Controller(aluno, bd).atualiza(id_)
        if nome in argumentos:
            nome_ = _pega_valor(argumentos, nome)
            aluno.define_nome(nome_)
            Controller(aluno, bd).atualiza(id_)
        if situacao in argumentos:
            situacao_ = _pega_valor(argumentos, situacao)
            aluno.define_situacao(situacao_)
            Controller(aluno, bd).atualiza(id_)
        if materia in argumentos and nota in argumentos:
            materia_ = _pega_valor(argumentos, materia)
            nota_ = _pega_valor(argumentos, nota)
            materias = {materia_: nota_}
            aluno.atualiza_materias_cursadas(materias)
            Controller(aluno, bd).atualiza(id_)

        print(f"Aluno com identificador {id_} atualizado com sucesso.")
    except Exception:
        raise
 def run(self):
     self.__is_running = True
     while self.__is_running:
         self.__print_menu()
         option = int(input(" >> "))
         if option == 0:
             self.__map.load_from_binary_file("../assets/test1.map")
         if option == 1:
             self.__controller = Controller(self.__map)
             self.best_solution = self.__controller.run()
             print("--------------- BEST SOLUTION -------------------- \n")
             print("--- Best Solution fitness: ", self.best_solution[0])
             print("--- Best Solution path: ", end=" ")
             for s in self.best_solution[1]:
                 print("(", s.x, ", ", s.y, ") ", end=" ")
         elif option == 2:
             self.do_before_running_gui()
             self.__is_running_gui = True
             time.sleep(1)
             index = 0
             while self.__is_running_gui:
                 self.__is_running_gui = self.__gui.render(
                     self.best_solution, index)
                 index += 1
                 time.sleep(0.2)
             self.__gui.quit()
         elif option == 3:
             pass
         elif option == 4:
             self.visualize_map()
示例#4
0
    def setup(self):
        """
        setup the attributes of this gameengine\n
        :return:
        """

        Controller.setup(self)

        self.__create_memento()

        n_cpus = resource.get_value("n_cpus")
        packet_val_min = resource.get_value("packet_val_min")
        packet_val_max = resource.get_value("packet_val_max")

        self.__trash = Trash()
        trash_dimen = resource.get_dimen("trash")
        self.__trash.set_pos(trash_dimen.x, trash_dimen.y)

        # generates cpus with unique values
        vals = tools.unique_vals(n_cpus, packet_val_min, packet_val_max)
        for val in vals:
            self.__cpus.append(CPU(val))

        for i in range(0, resource.get_value("buffer_size_start")):
            self.add_packet()

        player_dimen = resource.get_dimen("player")
        self.__player.set_pos(player_dimen.x, player_dimen.y)
示例#5
0
    def make_copy(self):
        for x in self.winfo_children():
            if (x.winfo_ismapped()):
                self._copie.append(x)

        self.stop_display(
        )  #In order to display the elements again, we refresh the frame
        Controller.display_played_cards(self, True)  #Display the cards played
示例#6
0
 def test_aluno_pode_atualizar_situacao(self, cria_curso_materias_real):
     aluno, curso, _ = cria_curso_materias_real
     expected = "trancado"
     Controller(InscricaoAlunoCurso(aluno, curso), self.bd).salva()
     self._atualiza_aluno_por_cli(aluno.pega_id(), situacao=expected)
     aluno = Controller(Aluno(), self.bd).pega_registro_por_id(aluno.pega_id())
     actual = aluno.pega_situacao()
     assert actual == expected
示例#7
0
 def test_curso_criado_banco_dados(self, cria_banco):
     curso_id = 1
     expected = Curso(curso_nome_1).pega_nome()
     controller = Controller(Curso(curso_nome_1), cria_banco)
     controller.salva()
     curso = controller.pega_registro_por_id(curso_id)
     actual = curso.pega_nome()
     assert actual == expected
示例#8
0
 def test_cria_materia_por_cli(self, cria_banco_real):
     nome = materia_nome_1
     expected = nome
     parametros = ["cria-materia", "--nome", nome]
     executa_comando(parametros)
     materia = Materia(nome)
     registro = Controller(materia, cria_banco_real).pega_registros()[0]
     actual = registro.pega_nome()
     assert actual == expected
示例#9
0
def cria_massa_dados(cria_banco_real):
    bd = cria_banco_real
    bd.deleta_tabela(cursos)
    bd.deleta_tabela(alunos)
    aluno_id = Controller(Aluno(aluno_nome_1), bd).salva()
    curso_id = Controller(Curso(curso_nome_1), bd).salva()
    yield aluno_id, curso_id
    bd.deleta_tabela(cursos)
    bd.deleta_tabela(alunos)
示例#10
0
 def test_aluno_pode_atualizar_nome(self, cria_massa_dados):
     cria_massa_dados
     aluno_id = "1"
     nome = aluno_nome_2
     expected = nome
     self._atualiza_aluno_por_cli(aluno_id, nome)
     aluno = Controller(Aluno(), self.bd).pega_registro_por_id(aluno_id)
     actual = aluno.pega_nome()
     assert actual == expected
示例#11
0
 def retour(self):
     self.stop_display()  #Updates
     if (self._copie[0] is
             self._prince_frames[0]):  #Search which info were displayed
         Controller.display_prince_choice(
             self._copie[0].winfo_children()[0]['text'],
             self._copie[1].winfo_children()[0]['text'])
     else:
         Controller.display_guard_choice()
     self._copie = []  #Clear the buffer
示例#12
0
def _cria_curso(argumentos):
    nome_parametro = "--nome"
    materias_parametro = "--materias"
    numero_argumentos = 8
    if nome_parametro in argumentos and materias_parametro in argumentos \
            and len(argumentos) == numero_argumentos:
        try:
            nome = _pega_valor(argumentos, nome_parametro)
            materia_1 = _pega_valor(argumentos, materias_parametro)
            materia_2 = _pega_valor(argumentos, materias_parametro, 2)
            materia_3 = _pega_valor(argumentos, materias_parametro, 3)

            curso = Curso(nome)
            controller_curso = Controller(curso, bd)
            controller_curso.salva()
            registro = controller_curso.pega_registro_por_nome(nome)
            curso_id = registro.pega_id()

            controller = Controller(Materia(None), bd)
            for materia in [materia_1, materia_2, materia_3]:
                registro = controller.pega_registro_por_nome(materia)
                materia_id = registro.pega_id()
                curso.atualiza_materias(Materia(materia))

                Controller(AssociaCursoMateria(curso_id, materia_id),
                           bd).salva()
            print(f"Curso de {curso.pega_nome()} criado.")
        except Exception:
            raise
    else:
        raise ListaParametrosInvalida(LISTA_PARAMETROS_INVALIDA)
示例#13
0
def _cria_aluno(argumentos):
    nome_parametro = "--nome"
    numero_parametros = 4
    if nome_parametro in argumentos and len(argumentos) == numero_parametros:
        nome = _pega_valor(argumentos, nome_parametro)
        aluno = Aluno(nome)
        controller = Controller(aluno, bd)
        controller.salva()
        print(f"Aluno {nome} criado com sucesso.")
    else:
        raise ListaParametrosInvalida(LISTA_PARAMETROS_INVALIDA)
示例#14
0
 def test_aluno_inscrito_curso_salvo_banco_dados(self, cria_banco_real):
     Controller(Aluno(aluno_nome_1), cria_banco_real).salva()
     Controller(Curso(curso_nome_1), cria_banco_real).salva()
     expected = [tuple((1, self.aluno_id, self.curso_id))]
     parametros = [
         "inscreve-aluno-curso", "--aluno-id", self.aluno_id, "--curso-id",
         self.curso_id
     ]
     executa_comando(parametros)
     inscricao = InscricaoAlunoCurso(self.aluno_id, self.curso_id)
     actual = Controller(inscricao, cria_banco_real).pega_registros()
     assert actual == expected
示例#15
0
class EnviarPacote():
    def __init__(self, dispositivo):
        self.__controller = Controller()
        self.__dispositivo = dispositivo

    def enviar(self, pacote):
        try:
            self.__dispositivo.escreverPorta(pacote)
            self.__controller.visualizar().enviado()

        except Exception:
            self.__controller.visualizar().erro()
示例#16
0
 def test_curso_criado_banco_dados(self):
     self._cria_materias()
     expected = Curso(curso_nome_1).pega_nome()
     parametros = [
         self._cria_curso, "--nome", curso_nome_1, "--materias",
         materia_nome_1, materia_nome_2, materia_nome_3
     ]
     executa_comando(parametros)
     curso = Controller(Curso(curso_nome_1),
                        self._bd).pega_registros()[self.first]
     actual = curso.pega_nome()
     assert actual == expected
示例#17
0
    def __init__(self):
        """
        initialize gameengine\n
        defines screen and init pygame
        """
        Controller.__init__(self)

        self.__player 	= Player()
        self.__buffer 		= Buffer(resource.get_value("buffer_capacity"))
        self.__cpus 	= []
        self.__pending_packet 	= []
        self.__endstate = EndState()
示例#18
0
 def test_situaca_aluno_muda_para__em_curso__apos_inscricao(
         self, cria_banco_real):
     Controller(Aluno(aluno_nome_1), cria_banco_real).salva()
     Controller(Curso(curso_nome_1), cria_banco_real).salva()
     expected = "em curso"
     parametros = [
         "inscreve-aluno-curso", "--aluno-id", self.aluno_id, "--curso-id",
         self.curso_id
     ]
     executa_comando(parametros)
     InscricaoAlunoCurso(self.aluno_id, self.curso_id)
     aluno = Controller(Aluno().define_id(self.aluno_id),
                        cria_banco_real).pega_registro_por_id(self.aluno_id)
     actual = aluno.pega_situacao()
     assert actual == expected
示例#19
0
class Dispositivo():
    def __init__(self):
        self.controller = Controller()
        self.porta = self.escolhaPorta()

    def escolhaPorta(self):
        MAX_PORTAS = 10  # numero maximo de portas
        k = 1

        #configuracao da porta
        baudrate = 9600
        bytesize = 8
        parity = 'N'
        stopbits = 1
        timeout = 0
        #controle de fluxo
        xonxoff = False
        rtscts = False

        dict = {}
        for p in ['COM%s' % (i + 1) for i in range(MAX_PORTAS)]:
            try:
                s = Serial(p)
                dict[k] = s.portstr
                k += 1
                s.close()
            except (OSError, SerialException):
                pass
        for i in dict:
            print i, " - ", dict[i]

        p = 15
        if len(dict) == 0:
            self.controller.visualizar().semPorta()
            sys.exit(0)
        else:
            while (p not in dict):
                p = int(input("\nEscolha a porta serial: "))
                if p <= len(dict) and p != 0:
                    try:
                        self.porta = Serial(dict[p], baudrate, bytesize,
                                            parity, stopbits, timeout, xonxoff,
                                            rtscts)
                        self.controller.visualizar().portaEscolhida(
                            self.porta.portstr)
                        return self.porta
                    except SerialException:
                        self.controller.visualizar().erro()
                        sys.exit(0)
                else:
                    self.controller.visualizar().portaSemExistencia()

    def ouvirPorta(self):
        return self.porta.read(256)

    def escreverPorta(self, pacote):
        return self.porta.write(pacote)
示例#20
0
def main():
    environment_repository = EnvironmentRepository()
    image_repository = ImageRepository()

    controller = Controller(environment_repository, image_repository)

    gui = GUI(controller)
    gui.start()
示例#21
0
def main():
    view = View()
    ctrl = Controller(view)
    view.inject_controller(ctrl)

    if len(sys.argv) > 1:
        view.onecmd(' '.join(sys.argv[1:]))
    view.cmdloop()
示例#22
0
 def test_retorna_excecao_quando_curso_id_nao_existe(self, cria_banco_real):
     expected = "Curso não encontrado."
     Controller(Aluno(None), cria_banco_real).salva()
     parametros = [
         "inscreve-aluno-curso", "--aluno-id", self.aluno_id, "--curso-id",
         self.curso_id
     ]
     actual = executa_comando(parametros)
     assert expected in actual
示例#23
0
class Dispositivo():
    def __init__(self):
        self.controller = Controller()
        self.porta = self.escolhaPorta()

    def escolhaPorta(self):
        MAX_PORTAS = 10 # numero maximo de portas
        k = 1

        #configuracao da porta
        baudrate = 9600
        bytesize = 8
        parity = 'N'
        stopbits = 1
        timeout = 0
        #controle de fluxo
        xonxoff = False
        rtscts = False

        dict = {}
        for p in ['COM%s' % (i + 1) for i in range(MAX_PORTAS)]:
            try:
                s = Serial(p)
                dict[k] = s.portstr
                k+=1
                s.close()
            except (OSError, SerialException):
                pass
        for i in dict:
            print i, " - ", dict[i]

        p = 15
        if len(dict) == 0:
            self.controller.visualizar().semPorta()
            sys.exit(0)
        else:
            while(p not in dict):
                p = int(input("\nEscolha a porta serial: "))
                if p <= len(dict) and p!=0:
                    try:
                        self.porta = Serial(dict[p], baudrate, bytesize, parity, stopbits, timeout, xonxoff, rtscts)
                        self.controller.visualizar().portaEscolhida(self.porta.portstr)
                        return self.porta
                    except SerialException:
                        self.controller.visualizar().erro()
                        sys.exit(0)
                else:
                    self.controller.visualizar().portaSemExistencia()

    def ouvirPorta(self):
        return self.porta.read(256)

    def escreverPorta(self, pacote):
        return self.porta.write(pacote)
示例#24
0
def _cria_materia(argumentos):
    nome = "--nome"
    numero_argumentos = 4
    if nome in argumentos and len(argumentos) == numero_argumentos:
        nome = _pega_valor(argumentos, nome)
        materia = Materia(nome)
        Controller(materia, bd).salva()
        print(f"Matéria de {materia.pega_nome()} criada.")
    else:
        raise ListaParametrosInvalida(LISTA_PARAMETROS_INVALIDA)
示例#25
0
class Console(object):
    def __init__(self):
        self.__is_running = False
        self.__is_running_gui = False
        self.__map = Map()
        self.__gui: Gui = Gui(self.__map)
        self.__controller: Controller = None

    def do_before_running_gui(self):
        self.__gui.initialize()

    def visualize_map(self):
        self.do_before_running_gui()
        self.__is_running_gui = True
        while self.__is_running_gui:
            self.__is_running_gui = self.__gui.render()
        self.__gui.quit()

    def run(self):
        self.__is_running = True
        while self.__is_running:
            self.__print_menu()
            option = int(input(" >> "))
            if option == 0:
                self.__map.load_from_binary_file("../assets/test1.map")
            if option == 1:
                self.__controller = Controller(self.__map)
                self.best_solution = self.__controller.run()
                print("--------------- BEST SOLUTION -------------------- \n")
                print("--- Best Solution fitness: ", self.best_solution[0])
                print("--- Best Solution path: ", end=" ")
                for s in self.best_solution[1]:
                    print("(", s.x, ", ", s.y, ") ", end=" ")
            elif option == 2:
                self.do_before_running_gui()
                self.__is_running_gui = True
                time.sleep(1)
                index = 0
                while self.__is_running_gui:
                    self.__is_running_gui = self.__gui.render(
                        self.best_solution, index)
                    index += 1
                    time.sleep(0.2)
                self.__gui.quit()
            elif option == 3:
                pass
            elif option == 4:
                self.visualize_map()

    @staticmethod
    def __print_menu():
        print("0. load map\n"
              "1. run EA\n"
              "2. visualize solution\n", "3. view statistics\n"
              "4. view map\n")
示例#26
0
def cria_massa_dados_em_memoria(cria_banco):
    Controller(Aluno(aluno_nome_1), cria_banco).salva()
    Controller(Curso(curso_nome_1), cria_banco).salva()
    Controller(Materia(materia_nome_1), cria_banco).salva()
    Controller(Materia(materia_nome_2), cria_banco).salva()
    Controller(Materia(materia_nome_3), cria_banco).salva()
    Controller(AssociaCursoMateria(curso_id=1, materia_id=1),
               cria_banco).salva()
    Controller(AssociaCursoMateria(curso_id=2, materia_id=1),
               cria_banco).salva()
    Controller(AssociaCursoMateria(curso_id=3, materia_id=1),
               cria_banco).salva()
    Controller(InscricaoAlunoCurso(aluno_id=1, curso_id=1), cria_banco)
    yield
    cria_banco.deleta_tabela(cursos)
    cria_banco.deleta_tabela(alunos)
示例#27
0
 def test_aluno_pode_ser_inscrito_curso(self, cria_banco_real,
                                        cria_curso_banco_real):
     expected = (f"Aluno identificado por {self.aluno_id} inscrito no curso"
                 f" identificado por {self.curso_id}.")
     Controller(Aluno(None), cria_banco_real).salva()
     cria_curso_banco_real
     parametros = [
         "inscreve-aluno-curso", "--aluno-id", self.aluno_id, "--curso-id",
         self.curso_id
     ]
     actual = executa_comando(parametros)
     assert actual == expected
示例#28
0
    def testProgram(self):
        try:
            rv = Controller.playGame('Player', 'Scissor', 'Scissor')
            assert ('It is a draw!', 'Scissor',
                    'Scissor') == rv, "Scissor and Scissor is a draw!"

            rv = Controller.playGame('Player', 'Scissor', 'Rock')
            assert ('Player lost!', 'Scissor',
                    'Rock') == rv, "Rock breaks the scissor!"

            rv = Controller.playGame('Player', 'Scissor', 'Paper')
            assert ('Player won!', 'Scissor',
                    'Paper') == rv, "Scissor cuts the paper!"

            rv = Controller.playGame('Player 2', 'Paper', 'Rock')
            assert ('Player 2 won!', 'Paper',
                    'Rock') == rv, "Paper wraps the rock!"

            rv = Controller.playGame('Player')
            assert (
                mock.ANY, mock.ANY, mock.ANY
            ) == rv, "Random moves should be generated for both Player and Computer 1!"

            rv = Controller.playGame('Player', 'Rock')
            assert (
                mock.ANY, mock.ANY, mock.ANY
            ) == rv, "A random move should be generated for Computer 1!"

            return "Passes all checks!"

        except AssertionError as e:
            return str(e.args)
示例#29
0
class RecebedorPacote():
    def __init__(self, dispositivo):
        self.__dispositivo = dispositivo
        self.__controller = Controller()
        self.__lista = []
        self.__ok = True

    def iniciarThread(self):
        self.__controller.visualizar().aguardandoPacote()
        try:
            t1 = Thread(target=self.receberPacote)
            t1.start()
        except Exception as e:
            print e

    def terminarThread(self):
        self.__controller.visualizar().pararGerador()
        self.__ok = False

    def getLista(self):
        temp = self.__lista
        self.__lista = []
        return temp

    def receberPacote(self):
        while self.__ok:
            try:
                data = self.__dispositivo.ouvirPorta()
                if len(data) > 0:
                    self.__lista.append(data)
            except Exception:
                self.__controller.visualizar().erro()
示例#30
0
class RecebedorPacote():
    def __init__(self, dispositivo):
        self.__dispositivo = dispositivo
        self.__controller = Controller()
        self.__lista = []
        self.__ok = True

    def iniciarThread(self):
        self.__controller.visualizar().aguardandoPacote()
        try:
            t1 = Thread(target=self.receberPacote)
            t1.start()
        except Exception as e:
            print e

    def terminarThread(self):
        self.__controller.visualizar().pararGerador()
        self.__ok = False

    def getLista(self):
        temp = self.__lista
        self.__lista = []
        return temp

    def receberPacote(self):
        while self.__ok:
            try:
                data = self.__dispositivo.ouvirPorta()
                if len(data) > 0:
                    self.__lista.append(data)
            except Exception:
                self.__controller.visualizar().erro()
示例#31
0
    def init_playersUI(self, theme1):
        #Buttons coresponding to the displaying of the hand of the AI (purely visual)
        self._ia_labels = (tk.Label(self,
                                    image=self._images["Cache"],
                                    borderwidth=0,
                                    highlightthickness=0),
                           tk.Label(self,
                                    image="",
                                    borderwidth=0,
                                    highlightthickness=0,
                                    bg=theme1),
                           tk.Label(self,
                                    image="",
                                    borderwidth=0,
                                    highlightthickness=0,
                                    bg=theme1))
        self._ia_labels[0].place(rely=0,
                                 relx=0.5,
                                 x=-self._ia_labels[0].winfo_reqwidth())

        #Buttons of the user, used to chose the card to play
        self._player_buttons = (
            tk.Button(self,
                      command=lambda: Controller.card_played(self, 0),
                      borderwidth=0,
                      highlightthickness=0),
            tk.Button(self,
                      command=lambda: Controller.card_played(self, 1),
                      borderwidth=0,
                      highlightthickness=0),
            tk.Button(self,
                      command=lambda: Controller.card_played(self, 2),
                      borderwidth=0,
                      highlightthickness=0))
        #The 3d button is here to handle the counselor case

        self._player_buttons[0].place(rely=1,
                                      relx=0.5,
                                      x=-self._ia_labels[0].winfo_reqwidth(),
                                      y=-self._ia_labels[0].winfo_reqheight())
示例#32
0
def index():
    # execute this when the client first joins the game through the 'GET' method
    if request.method == 'GET':
        session.clear()
        session['opponent'] = "Computer 1"
        session['round'] = 1
        session['p1Win'] = 0
        session['p2Win'] = 0

        # show the main menu
        return render_template('main.html')

    # subsequent requests would be done through the 'POST' method
    else:
        response = request.form['option']

        # navigate to the page that show the available moves
        if response == 'Player' or response == 'Computer 2':
            session[
                'player'] = response  # store player name (i.e. Player / Computer 2)
            return render_template('battle.html', player=response)

        # navigate to the page to show the winner
        elif response in moveType:
            result, _, opponentMove = Controller.playGame(
                session['player'], response)
            return render_template('result.html',
                                   result=result,
                                   playerMove=response,
                                   opponentMove=opponentMove)

        # random (comp vs. comp)
        else:
            result, playerMove, opponentMove = Controller.playGame(
                session['player'])
            return render_template('result.html',
                                   result=result,
                                   playerMove=playerMove,
                                   opponentMove=opponentMove)
示例#33
0
 def __init__(self, dispositivo):
     self.__dispositivo = dispositivo
     self.__controller = Controller()
     self.__lista = []
     self.__ok = True
示例#34
0
 def __init__(self):
     self.controller = Controller()
     self.porta = self.escolhaPorta()
示例#35
0
 def __init__(self, dispositivo):
     self.__dispositivo = dispositivo
     self.__enviarPacote = EnviarPacote(self.__dispositivo)
     self.__pacotesGerados = PacotesGerados()
     self.__geradorPacote = GeradorPacote(self.__pacotesGerados)
     self.__controller = Controller()
示例#36
0
class ExperimentoElisa(object):

    def __init__(self, dispositivo):
        self.__dispositivo = dispositivo
        self.__enviarPacote = EnviarPacote(self.__dispositivo)
        self.__pacotesGerados = PacotesGerados()
        self.__geradorPacote = GeradorPacote(self.__pacotesGerados)
        self.__controller = Controller()

    def transformador(self, pacote):
        f = ''
        for i in pacote:
            f += i
        respostaOBC = [ord(b) for b in f]
        if len(respostaOBC) > 1:
            print respostaOBC
            self.pacotesRecebidos(respostaOBC)

    def pacotesRecebidos(self, respostaOBC):

        if respostaOBC[2] == 11:
            self.__controller.visualizar().turnOn()
            self.__enviarPacote.enviar(self.__geradorPacote.acknowledge())
            self.__geradorPacote.iniciarThread()
            self.__controller.visualizar().geradorIniciando()

        elif respostaOBC[2] == 1:
            self.__controller.visualizar().dataRequest()
            a = self.__pacotesGerados.getListaPacotes()
            self.__enviarPacote.enviar(a)
            print a

        elif respostaOBC[2] == 2:
            self.__controller.visualizar().dataSend()

            self.__enviarPacote.enviar(self.__geradorPacote.acknowledge())
            if respostaOBC[4] == 0:
                self.__controller.visualizar().tempoZero()
                self.__geradorPacote.mudarTempo(0x0)
            else:
                self.__controller.visualizar().tempoUm()
                self.__geradorPacote.mudarTempo(0x1)

        elif respostaOBC[2] == 7:
            self.__controller.visualizar().reset()
            self.__enviarPacote.enviar(self.__geradorPacote.acknowledge())
            self.__geradorPacote.varredura = 0x0
            self.__geradorPacote.mudarTempo(0x0)
            self.__pacotesGerados.listaPacotes = []

        elif respostaOBC[2] == 9:
            self.__controller.visualizar().turnOff()
            self.__enviarPacote.enviar(self.__geradorPacote.acknowledge())
            self.__geradorPacote.terminarThread()
            RecebedorPacote(self.__dispositivo).terminarThread()

        else:
            self.__controller.visualizar().erro()