Ejemplo n.º 1
0
 def restart_server(self):
     try:
         self.restart = False
         FSSystem.run_command("/etc/init.d/fabscanpi-server restart",
                              blocking=True)
     except Exception as e:
         self._logger.error(e)
Ejemplo n.º 2
0
 def avr_flash(self, fname):
     FSSystem.run_command("wc -l {0}".format(fname))
     status = FSSystem.run_command(
         "sudo avrdude-autoreset -D -V -U flash:w:{0}:i -b {1} -carduino -pm328p -P{2}"
         .format(fname, self.flash_baudrate, self._port))
     if status != 0:
         self._logger.error("Failed to flash firmware")
     return status == 0
Ejemplo n.º 3
0
def do_upgrade():
    try:
        rc_update = FSSystem.run_command("sudo apt-get update")
        rc_upgrade = FSSystem.run_command("sudo apt-get install -y -o Dpkg::Options::='--force-confnew' fabscanpi-server")
        return (rc_update == 0 and rc_upgrade == 0)

    except Exception, e:
        logging.error(e)
        return 1
Ejemplo n.º 4
0
 def avr_flash(self, fname):
     FSSystem.run_command("wc -l " + str(fname))
     status = FSSystem.run_command(
         "sudo avrdude-autoreset -D -V -U flash:w:" + str(fname) +
         ":i -b " + str(self.flash_baudrate) + " -carduino -pm328p -P" +
         str(self._port))
     if status != 0:
         self._logger.error("Failed to flash firmware")
     return status == 0
Ejemplo n.º 5
0
    def run(self):
        self._logger.info("Process started...")

        data = {"message": "MESHING_STARTED", "level": "info"}
        self.eventManager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE,
                                                   data)

        basedir = os.path.dirname(os.path.dirname(__file__))
        mlx_script_path = basedir + "/mlx/" + self.filter

        input = self.config.file.folders.scans + str(self.scan_id) + "/" + str(
            self.file)
        output = self.config.file.folders.scans + str(
            self.scan_id) + "/mesh_" + str(self.file[:-3]) + "_" + str(
                self.filter).split(".")[0] + "." + self.format
        self._logger.info(output)

        pointcloud_size = self.get_poitcloud_value_by_line(
            pointcloud_file=input, lookup="element vertex")
        self.prepare_down_sampling(str(mlx_script_path), pointcloud_size)

        return_code = FSSystem.run_command("xvfb-run meshlabserver -i " +
                                           input + " -o " + output + " -s " +
                                           str(mlx_script_path) + " -om vc vn")
        self._logger.debug("Process return code: " + str(return_code))

        if return_code is 0:

            message = {
                "message": "MESHING_DONE",
                "scan_id": self.scan_id,
                "level": "success"
            }

        else:
            message = {
                "message": "MESHING_FAILED",
                "scan_id": self.scan_id,
                "level": "error"
            }

        self.eventManager.broadcast_client_message(FSEvents.ON_INFO_MESSAGE,
                                                   message)
        self._logger.info("Process finished.")
Ejemplo n.º 6
0
 def avr_device_is_available(self):
     status = FSSystem.run_command("sudo avrdude-autoreset -p m328p -b "+str(self.flash_baudrate)+" -carduino -P"+str(self._port))
     return status == 0
Ejemplo n.º 7
0
 def avr_device_is_available(self):
     status = FSSystem.run_command(
         "sudo avrdude-autoreset -p m328p -b {0} -carduino -P{1}".format(
             self.flash_baudrate, self._port))
     return status == 0