def attach(self, port=None, fqbn=None, sketch_path=None, discovery_timeout=None, protocol=None): """ Calls the :code:`board attach` command. :param port: Upload port address, e.g.: COM3 or /dev/ttyACM2 :type port: str or NoneTYpe :param fqbn: Fully Qualified Board Name, e.g.: arduino:avr:uno :type fqbn: str or NoneTYpe :param sketch_path: The path of the sketch to attach to the board :type sketch_path: str or NoneTYpe :param discovery_timeout: Max time to wait for port discovery, e.g.: 30s, 1m (default 5s) :type discovery_timeout: str or NoneTYpe :param protocol: Upload port protocol, e.g: serial :type protocol: str or NoneTYpe :return: The output of the related command :rtype: dict """ args = [commands.ATTACH] if port: args.extend([flags.PORT, CommandBase._strip_arg(port)]) if protocol: args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)]) if fqbn: args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)]) if sketch_path: args.append(CommandBase._strip_arg(sketch_path)) if discovery_timeout: args.extend([flags.DISCOVERY_TIMEOUT, CommandBase._strip_arg(discovery_timeout)]) return self._exec(args)
def __call__(self, daemonize=None, port=None, debug=None, debug_filter=None, ip=None): """ Calls the :code:`daemon` command :param daemonize: Do not terminate daemon process if the parent process dies :type daemonize: bool or NoneType :param port: The TCP port the daemon will listen to :type port: str, integer or NoneType :param debug: Enable debug logging of gRPC calls :type debug: bool or NoneType :param debug_filter: Display only the provided gRPC calls :type debug_filter: str or NoneType :param ip: The IP address the daemon will listen to (default "127.0.0.1") :type ip: str or NoneType :return: The output of the related command :rtype: dict """ args = [] if daemonize is True: args.append(flags.DAEMONIZE) if port: args.extend([flags.PORT, CommandBase._strip_arg(str(port))]) if debug is True: args.append(flags.DEBUG) if debug_filter: args.extend( [flags.DEBUG_FILTER, CommandBase._strip_arg(debug_filter)]) return self._exec(args)
def remove(self, setting_name, values): """ Calls the :code:`config remove` command :param setting_name: The name of the setting from which values will be removed :type setting_name: str :param values: The list of values to remove :type values: list :return: The output of the related command :rtype: dict """ args = [commands.REMOVE, CommandBase._strip_arg(setting_name)] args.extend(CommandBase._strip_args(values)) return self._exec(args)
def set(self, setting_name, values): """ Calls the :code:`config set` command :param setting_name: The name of the setting to set :type setting_name: str :param values: The list of values to set :type values: list :return: The output of the related command :rtype: dict """ args = [commands.SET, CommandBase._strip_arg(setting_name)] args.extend(CommandBase._strip_args(values)) return self._exec(args)
def __call__(self, fqbn=None, input_dir=None, port=None, interpreter=None, info=None, programmer=None, sketch=None, discovery_timeout=None, protocol=None): """ Calls the :code:`debug` command :param fqbn: Fully Qualified Board Name, e.g.: arduino:avr:uno :type fqbn: str or NoneType :param input_dir: Directory containing binaries for debug. :type input_dir: str or NoneType :param port: Debug port, e.g.: COM10 or /dev/ttyACM0 :type port: str or NoneType :param interpreter: Debug interpreter e.g.: console, mi, mi1, mi2, mi3 (default "console") :type interpreter: str or NoneType :param info: Show metadata about the debug session instead of starting the debugger. :type info: str or NoneType :param programmer: Programmer to use for debugging :type programmer: str or NoneType :param sketch: The sketch to debug :type sketch: str or NoneType :param discovery_timeout: Max time to wait for port discovery, e.g.: 30s, 1m (default 5s) :type discovery_timeout: str or NoneType :param protocol: Upload port protocol, e.g: serial :type protocol: str or NoneType :return: The output of the related command :rtype: dict """ args = [] if fqbn: args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)]) if input_dir: args.extend([flags.INPUT_DIR, CommandBase._strip_arg(input_dir)]) if port: args.extend([flags.PORT, CommandBase._strip_arg(port)]) if interpreter: args.extend( [flags.INTERPRETER, CommandBase._strip_arg(interpreter)]) if info is True: args.append(flags.INFO) if programmer: args.extend([flags.PROGRAMMER, CommandBase._strip_arg(programmer)]) if sketch: args.append(CommandBase._strip_arg(sketch)) if discovery_timeout: args.extend([ flags.DISCOVERY_TIMEOUT, CommandBase._strip_arg(discovery_timeout) ]) if protocol: args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)]) return self._exec(args)
def examples(self, library, fqbn=None): """ Calls the :code:`lib examples` command :param library: The name of the library :type library: str :param fqbn: The board FQBN :type fqbn: str or NoneType :return: The output of the related command :rtype: dict """ args = [commands.EXAMPLES, CommandBase._strip_arg(library)] if fqbn is not None: args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)]) return self._exec(args)
def upgrade(self, upgrades=None, run_post_install=None, skip_post_install=None): """ Calls the :code:`core upgrade` command :param upgrades: A list of cores to upgrade, if None, all cores will be upgraded :type upgrades: list or NoneType :param run_post_install: Force run of post-install scripts :type run_post_install: bool or NoneType :param skip_post_install: Force skip of post-install scripts :type skip_post_install: bool or NoneType :return: The output of the related command :rtype: dict """ if not upgrades: upgrades = [] args = [commands.UPGRADE] args.extend(CommandBase._strip_args(upgrades)) if run_post_install is True: args.append(flags.RUN_POST_INSTALL) if skip_post_install is True: args.append(flags.SKIP_POST_INSTALL) return self._exec(args)
def __call__(self, config=None, describe=None, discovery_timeout=None, fqbn=None, port=None, protocol=None, quiet=None): """ Calls the :code:`monitor` command :param config: Configuration of the port. :type config: str or NoneType :param describe: Show all the settings of the communication port. :type describe: bool or NoneType :param discovery_timeout: Max time to wait for port discovery, e.g.: 30s, 1m (default 5s) :type discovery_timeout: str or NoneType :param fqbn: Fully Qualified Board Name, e.g.: arduino:avr:uno :type fqbn: str or NoneType :param port: Upload port address, e.g.: COM3 or /dev/ttyACM2 :type port: str or NoneType :param protocol: Upload port protocol, e.g: serial :type protocol: str or NoneType :param quiet: Run in silent mode, show only monitor input and output. :type quiet: bool or NoneType :return: The output of the related command :rtype: dict """ args = [] if config: args.extend([flags.CONFIG, CommandBase._strip_arg(config)]) if describe is True: args.append(flags.DESCRIBE) if discovery_timeout: args.extend([ flags.DISCOVERY_TIMEOUT, CommandBase._strip_args(discovery_timeout) ]) if fqbn: args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)]) if port: args.extend([flags.PORT, CommandBase._strip_arg(port)]) if protocol: args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)]) if quiet is True: args.append(flags.QUIET) return self._exec(args)
def deps(self, library): """ Calls the :code:`lib deps` command :param library: The name of the library for dependency checking :type library: str :return: The output of the related command :rtype: dict """ return self._exec([commands.DEPS, CommandBase._strip_arg(library)])
def new(self, name): """ Calls the :code:`sketch new` command :param name: The name of the sketch to create :type name: str :return: The output of the related command :rtype: dict """ return self._exec([commands.NEW, CommandBase._strip_arg(name)])
def __call__(self, discovery_timeout=None, fqbn=None, port=None, programmer=None, protocol=None, verify=None): """ Calls the :code:`burn-bootloader` command :param fqbn: The fqbn of the board to burn :type fqbn: str or NoneType :param port: The port to use to burl the bootloader :type port: str or NoneTYpe :param programmer: The programmer to use for the burning process :type programmer: str or NoneTYpe :param verify: Verifies that the bootloader was successfully burnt :type verify: bool or NoneTYpe :param discovery_timeout: Max time to wait for port discovery, e.g.: 30s, 1m (default 5s) :type discovery_timeout: str or NoneType :param protocol: Upload port protocol, e.g: serial :type protocol: str or NoneType :return: The output of the related command :rtype: dict """ args = [] if discovery_timeout: args.extend([ flags.DISCOVERY_TIMEOUT, CommandBase._strip_arg(discovery_timeout) ]) if fqbn: args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)]) if port: args.extend([flags.PORT, CommandBase._strip_arg(port)]) if programmer: args.extend([flags.PROGRAMMER, CommandBase._strip_arg(programmer)]) if protocol: args.extend([flags.PROTOCOL, CommandBase._strip_arg(protocol)]) if verify is True: args.append(flags.VERIFY) return self._exec(args)
def init(self, dest_dir=None, dest_file=None, overwrite=None): """ Calls the :code:`config init` command :param dest_dir: The directory where to save the file :type dest_dir: str or NoneType :param dest_file: A path where the file will be saved :type dest_file: str or NoneType :param overwrite: Overwrites an existing file :type overwrite: bool or NoneType :return: The output of the related command :rtype: dict """ args = [commands.INIT] if dest_dir: args.extend([flags.DEST_DIR, CommandBase._strip_arg(dest_dir)]) if dest_file: args.extend([flags.DEST_FILE, CommandBase._strip_arg(dest_file)]) if overwrite is True: args.append(flags.OVERWRITE) return self._exec(args)
def delete(self, setting_name): """ Calls the :code:`config delete` command :param setting_name: The name of the setting to delete :type setting_name: str :return: The output of the related command :rtype: dict """ return self._exec( [commands.DELETE, CommandBase._strip_arg(setting_name)])
def download(self, downloads): """ Calls the :code:`lib download` command :param downloads: A list of libraries to download :type downloads: list :return: The output of the related command :rtype: dict """ args = [commands.DOWNLOAD] args.extend(CommandBase._strip_args(downloads)) return self._exec(args)
def uninstall(self, uninstalls): """ Calls the :code:`lib uninstall` command :param uninstalls: A list of libraries to uninstall :type uninstalls: list :return: The output of the related command :rtype: dict """ args = [commands.UNINSTALL] args.extend(CommandBase._strip_args(uninstalls)) return self._exec(args)
def archive(self, sketch_path=".", archive_path=None, include_build_dir=None): """ Calls the :code:`sketch archive` command :param sketch_path: The path to the sketch to archive :type sketch_path: str :param archive_path: The path of the output archive :type archive_path: str or NoneType :param include_build_dir: Includes the build directory in the archive :type include_build_dir: bool or NoneType :return: The output of the related command :rtype: dict """ args = [commands.ARCHIVE, CommandBase._strip_arg(sketch_path)] if archive_path is not None: args.append(CommandBase._strip_arg(archive_path)) if include_build_dir is True: args.append(flags.INCLUDE_BUILD_DIR) return self._exec(args)
def upgrade(self, upgrades=None): """ Calls the :code:`lib upgrade` command :param upgrades: A list of libraries to upgrade, if None, all libraries will be upgraded :type upgrades: list or NoneType :return: The output of the related command :rtype: dict """ if not upgrades: upgrades = [] args = [commands.UPGRADE] args.extend(CommandBase._strip_args(upgrades)) return self._exec(args)
def install(self, libraries=None, git_urls=None, zip_paths=None): """ Calls the :code:`lib install` command :param libraries: A list of libraries to install :type libraries: list or NoneType :param git_urls: A list of git repositories containing libraries to install :type git_urls: list or NoneType :param zip_paths: A list of paths to zip files to install :type zip_paths: list or NoneType :return: The output of the related command :rtype: dict """ args = [commands.INSTALL] if libraries: args.extend(CommandBase._strip_args(libraries)) if git_urls: args.append(flags.GIT_URL) args.extend(CommandBase._strip_args(git_urls)) if zip_paths: args.append(flags.ZIP_PATH) args.extend(CommandBase._strip_args(zip_paths)) return self._exec(args)
def __call__(self, shell, no_description=None): """ Calls the :code:`completion` command :param shell: The shell name that will use completition :type shell: str :param no_description: Disable completion description for shells that support it :type no_description: bool or NoneTYpe :return: The output of the related command :rtype: dict """ args = [] if no_description is True: args.append(flags.NO_DESCRIPTION) args.append(CommandBase._strip_arg(shell)) return self._exec(args)
def listall(self, boardname=None, show_hidden=None): """ Calls the :code:`board listall` command. :param boardname: The name of the board, all board will be returned if left unset (or None) :type boardname: str or NoneType :param show_hidden: Show also boards marked as 'hidden' in the platform :type show_hidden: bool or NoneTYpe :return: The output of the related command :rtype: dict """ args = [commands.LISTALL] if boardname: args.append(CommandBase._strip_arg(boardname)) if show_hidden is True: args.append(flags.SHOW_HIDDEN) return self._exec(args)
def list(self, discovery_timeout=None, watch=None): """ Calls the :code:`board list` command. :param discovery_timeout: Max time to wait for port discovery, e.g.: 30s, 1m (default 1s) :type discovery_timeout: str or NoneType :param watch: Command keeps running and prints list of connected boards whenever there is a change. Added to pyduinocli for completion but won't actually return, use a loop instead :type watch: bool or NoneTYpe :return: The output of the related command :rtype: dict """ args = [commands.LIST] if discovery_timeout: args.extend([flags.DISCOVERY_TIMEOUT, CommandBase._strip_arg(discovery_timeout)]) if watch is True: args.append(flags.WATCH) return self._exec(args)
def search(self, boardname=None, show_hidden=None): """ Calls the :code:`board search` command. :param boardname: The name of the board :type boardname: str or NoneType :param show_hidden: Show also boards marked as 'hidden' in the platform :type show_hidden: bool or NoneTYpe :return: The output of the related command :rtype: dict """ args = [commands.SEARCH] if boardname: args.append(CommandBase._strip_arg(boardname)) if show_hidden is True: args.append(flags.SHOW_HIDDEN) return self._exec(args)
def search(self, keywords=None, names=None): """ Calls the :code:`lib search` command :param keywords: A list of keywords to use to search, if None, all libraries will show up :type keywords: list or NoneType :param names: Only shows libraries names :type names: bool or NoneType :return: The output of the related command :rtype: dict """ args = [commands.SEARCH] if names is True: args.append(flags.NAMES) if keywords is None: keywords = [] if keywords: args.extend(CommandBase._strip_args(keywords)) return self._exec(args)
def details(self, fqbn, full=None, list_programmers=None): """ Calls the :code:`board details` command. :param fqbn: The fqbn of the board :type fqbn: str :param full: Show full board details :type full: bool or NoneTYpe :param list_programmers: Show list of available programmers :type list_programmers: bool or NoneTYpe :return: The output of the related command :rtype: dict """ args = [commands.DETAILS, flags.FQBN, CommandBase._strip_arg(fqbn)] if full is True: args.append(flags.FULL) if list_programmers is True: args.append(flags.LIST_PROGRAMMERS) return self._exec(args)
def search(self, keywords=None, all=None): """ Calls the :code:`core search` command :param keywords: A list of keywords to use to search, if None, all cores will show up :type keywords: list or NoneType :param all: Shows all available core versions :type all: bool or NoneType :return: The output of the related command :rtype: dict """ args = [commands.SEARCH] if keywords is None: keywords = [] if keywords: args.extend(CommandBase._strip_args(keywords)) if all is True: args.append(flags.ALL) return self._exec(args)
def install(self, installs, run_post_install=None, skip_post_install=None): """ Calls the :code:`core download` command :param installs: A list of cores to install :type installs: list :param run_post_install: Force run of post-install scripts :type run_post_install: bool or NoneType :param skip_post_install: Force skip of post-install scripts :type skip_post_install: bool or NoneType :return: The output of the related command :rtype: dict """ args = [commands.INSTALL] args.extend(CommandBase._strip_args(installs)) if run_post_install is True: args.append(flags.RUN_POST_INSTALL) if skip_post_install is True: args.append(flags.SKIP_POST_INSTALL) return self._exec(args)
def list(self, all=None, updatable=None, fqbn=None): """ Calls the :code:`lib list` command :param all: Includes built-in libraries :type all: bool or NoneType :param updatable: Only shows libraries that are not up to date :type updatable: bool or NoneType :param fqbn: Shows libraries for the specified board :type fqbn: str or NoneType :return: The output of the related command :rtype: dict """ args = [commands.LIST] if all is True: args.append(flags.ALL) if updatable is True: args.append(flags.UPDATABLE) if fqbn is not None: args.extend([flags.FQBN, CommandBase._strip_arg(fqbn)]) return self._exec(args)
def __init__(self, base_args): CommandBase.__init__(self, base_args) self._base_args.append(commands.CONFIG)
def __init__(self, base_args): CommandBase.__init__(self, base_args) self._base_args.append(commands.UPGRADE)
def __init__(self, base_args): CommandBase.__init__(self, base_args) self._base_args.append(commands.OUTDATED)