Manager

Manager is the main class for interacting with the Logic 2 software.

Creating a new instance of the Manager class will attempt to connect to a running instance of the Logic 2 software.

Please review the getting started guide for instructions on preparing the Logic 2 software for API connections.

Attributes

NameTypeDescription
logic2_process
channel
stubsaleae_pb2_grpc.ManagerStub:meta private:

Methods

__init__(*, port: int, address: str = _DEFAULT_GRPC_ADDRESS, connect_timeout_seconds: Optional[float] = None, grpc_channel_arguments: Optional[List[Tuple[str, Any]]] = None, logic2_process: Optional[subprocess.Popen] = None)

It is recommended that you use Manager.launch() or Manager.connect() instead of using __init__ directly.

Create an instance of the Manager class, and connect to the Logic 2 software.

This library currently assumes the Logic 2 software is running on the same machine, and will attempt to connect to 127.0.0.1. In the future, we'll add support for supplying an IP address, as well as functions to help launch local copies of the application.

port
Port number. By default, Logic 2 uses port 10430.
address
Address to connect to.
connect_timeout_seconds
Number of seconds to attempt to connect to gRPC server, after which an exception will be thrown.
grpc_channel_arguments
A set of arguments to pass through to gRPC.
logic2_process
Process object for Logic2 if launched from Python. The process will be shutdown automatically when

Manager.close() is called.

classmethod launch(application_path: Optional[Union[Path, str]] = None, connect_timeout_seconds: Optional[float] = None, grpc_channel_arguments: Optional[List[Tuple[str, Any]]] = None, port: Optional[int] = None) -> Manager

Launch the Logic2 application and shut it down when the returned Manager is closed.

application_path
The path to the Logic2 binary to run. If not specified,

a locally installed copy of Logic2 will be searched for.

connect_timeout_seconds
See __init__
grpc_channel_arguments
See __init__
port
Port to use for the gRPC server. If not specified, 10430 will be used.
classmethod connect(*, address: str = _DEFAULT_GRPC_ADDRESS, port: int = _DEFAULT_GRPC_PORT, connect_timeout_seconds: Optional[float] = None, grpc_channel_arguments: Optional[List[Tuple[str, Any]]] = None) -> Manager

Connect to an existing instance of Logic 2.

port
Port number. By default, Logic 2 uses port 10430.
address
Address to connect to.
connect_timeout_seconds
See __init__
grpc_channel_arguments
See __init__
get_app_info() -> AppInfo

Get information about the connected Logic 2 instance.

Returns
AppInfo object for the connected Logic 2 instance.
close()

Close connection to Saleae backend, and shut it down if it was created by Manager.

get_devices(*, include_simulation_devices: bool = False) -> List[DeviceDesc]

Returns a list of connected devices. Use this to find the device id of the attached devices.

include_simulation_devices
If True, the return value will also include simulation devices. This can be useful for testing without a physical device.
start_capture(*, device_configuration: DeviceConfiguration, device_id: Optional[str] = None, capture_configuration: Optional[CaptureConfiguration] = None) -> Capture

Start a new capture

All capture settings need to be provided. The existing software settings, like selected device or added analyzers, are ignored.

Be sure to catch DeviceError exceptions raised by this function, and handle them accordingly. See the error section of the library documentation.

device_configuration
An instance of LogicDeviceConfiguration, complete with enabled channels, sample rates, and more.
device_id
The id of device to record with.
capture_configuration
The capture configuration, which selects the capture mode: timer, digital trigger, or manual., defaults to None, indicating manual mode.
Returns
Capture instance class. Be sure to call either wait() or stop() before trying to save, export, or close the capture.
load_capture(filepath: str) -> Capture

Load a capture.

The returned Capture object will be fully loaded (`wait_until_done` not required).

Raises: InvalidFileError

Returns
Capture instance class.
AI/LLM users: see llms-automation.txt for machine-readable documentation.