Ejemplo n.º 1
0
    def parse(self, client, message):
        if "set_program" in message['command']:
            #print("Program of GAHF set to {}".format(message['value']))

            strips_tester.data['program'] = message['value']
            gui_web.save_variable_to_db("program", message['value'])

            gui_web.send(message)  # Broadcast new program

            params = [s for s in strips_tester.data['program'].split("_")]
            gui_web.send({"command": "title", "value": "GADF ({})".format(params[0])})  # Broadcast new title

        # Enumerate all hex files accessible
        if "get_program_list" in message['command']:
            files = glob.glob(strips_tester.settings.test_dir + "/bin/*.hex")

            # Show only filenames without path
            for file in range(len(files)):
                files[file] = os.path.basename(files[file])
                files[file] = os.path.splitext(files[file])[0]
            gui_web.sendTo(client, {"command": "program_list", "value": files})

            try:
                gui_web.sendTo(client, {"command": "set_program", "value": strips_tester.data['program']})
            except KeyError:  # Program is not defined yet
                gui_web.sendTo(client, {"command": "status", "value": "Za začetek testiranja nastavi programsko opremo."})
                for nest in range(2):
                    gui_web.sendTo(client, {"command": "semafor", "nest": nest, "value": (0, 0, 0), "blink": (0, 1, 0)})
Ejemplo n.º 2
0
    def parse(self, client, message):
        if "set_program" in message['command']:
            #print("Program of GAHF set to {}".format(message['value']))


            strips_tester.data['program_flash'] = message['flash']
            strips_tester.data['program_eeprom'] = message['eeprom']
            gui_web.save_variable_to_db("program_flash", message['flash'])
            gui_web.save_variable_to_db("program_eeprom", message['eeprom'])

            gui_web.send(message)  # Broadcast new program
        # Enumerate all hex files accessible
        if "get_program_list" in message['command']:
            files_flash = glob.glob(strips_tester.settings.test_dir + "/bin/*.hex")
            files_eeprom = glob.glob(strips_tester.settings.test_dir + "/bin/*.eep")

            # Show only filenames without path
            for file in range(len(files_flash)):
                files_flash[file] = os.path.basename(files_flash[file])
                files_flash[file] = os.path.splitext(files_flash[file])[0]

            # Show only filenames without path
            for file in range(len(files_eeprom)):
                files_eeprom[file] = os.path.basename(files_eeprom[file])
                files_eeprom[file] = os.path.splitext(files_eeprom[file])[0]

            gui_web.sendTo(client, {"command": "program_list", "flash": files_flash, "eeprom": files_eeprom})

            try:
                gui_web.sendTo(client, {"command": "set_program", "flash": strips_tester.data['program_flash'], "eeprom": strips_tester.data['program_eeprom']})
            except KeyError:  # Program is not defined yet
                gui_web.sendTo(client, {"command": "status", "value": "Za začetek testiranja nastavi programsko opremo."})

                gui_web.sendTo(client, {"command": "semafor", "value": (0, 0, 0), "blink": (0, 1, 0)})
Ejemplo n.º 3
0
    def parse(self, client, message):
        if "set_program" in message['command']:
            #print("Program of ASP set to {}".format(message['value']))

            strips_tester.data['program'] = message['value']
            gui_web.save_variable_to_db("program", message['value'])

            gui_web.send(message)  # Broadcast new program
            gui_web.send({
                "command":
                "title",
                "value":
                "LIEB ({})".format(strips_tester.data['program'][0])
            })  # Broadcast new title

        if "get_program_list" in message['command']:
            with open(strips_tester.settings.test_dir +
                      "/bin/meje.csv") as file:
                csv_reader = list(csv.reader(file))

                gui_web.sendTo(client, {
                    "command": "program_list",
                    "value": csv_reader
                })

            try:
                gui_web.sendTo(
                    client, {
                        "command": "set_program",
                        "value": strips_tester.data['program']
                    })
            except KeyError:  # Program is not defined yet
                gui_web.sendTo(
                    client, {
                        "command":
                        "status",
                        "value":
                        "Za začetek testiranja nastavi parametre merjenca."
                    })
                gui_web.sendTo(
                    client, {
                        "command": "semafor",
                        "nest": 0,
                        "value": (0, 0, 0),
                        "blink": (0, 1, 0)
                    })
                pass