示例#1
0
 def config_modem(self, port, speed):
     """
     Configure serial modem
     
     @param port serial port
     @param serial baudrate
     """
     try:
         # Open network configuration
         config = XmlSerial(self.main_settings.serial_file)
         # Change parameters
         config.port = port
         config.speed = int(speed)
         # Save config file
         config.save()
     except:
         raise LagartoException("Unable to save modem serial settings")
示例#2
0
 def config_modem(self, port, speed):
     """
     Configure serial modem
     
     @param port serial port
     @param serial baudrate
     """
     try:
         # Open network configuration
         config = XmlSerial(self.main_settings.serial_file)
         # Change parameters
         config.port = port
         config.speed = int(speed)
         # Save config file
         config.save()
     except:
         raise LagartoException("Unable to save modem serial settings")
示例#3
0
    opts = parser.parse_args()

    direc = os.path.join(os.path.dirname(sys.argv[0]), "config")
    settings = os.path.join(direc, "settings.xml")

    # General settings
    general_cfg = XmlSettings(settings)
    # Serial settings
    serial_cfg = XmlSerial(general_cfg.serial_file)
    # Network settings
    network_cfg = XmlNetwork(general_cfg.network_file)

    save_file = False
    # Save serial parameters
    if opts.port is not None:
        serial_cfg.port = opts.port
        save_file = True
    if opts.speed is not None:
        serial_cfg.speed = SwapManager.str_to_int(opts.speed)
        save_file = True

    if save_file:
        serial_cfg.save()

    save_file = False
    # Save network parameters
    if opts.channel is not None:
        channel = SwapManager.str_to_int(opts.channel)
        if channel is not None:
            SwapManager.str_to_int = channel
            save_file = True
示例#4
0
    opts = parser.parse_args()

    direc = os.path.join(os.path.dirname(sys.argv[0]), "config")
    settings = os.path.join(direc, "settings.xml")
    
    # General settings
    general_cfg = XmlSettings(settings)
    # Serial settings
    serial_cfg = XmlSerial(general_cfg.serial_file)
    # Network settings
    network_cfg = XmlNetwork(general_cfg.network_file)

    save_file = False
    # Save serial parameters
    if opts.port is not None:
        serial_cfg.port = opts.port
        save_file = True
    if opts.speed is not None:
        serial_cfg.speed = SwapManager.str_to_int(opts.speed)
        save_file = True

    if save_file:
        serial_cfg.save()

    save_file = False
    # Save network parameters
    if opts.channel is not None:
        channel = SwapManager.str_to_int(opts.channel)
        if channel is not None:
            SwapManager.str_to_int = channel
            save_file = True