Connecting to AT1000 devices
This section describes how to find and connect to AT1000 devices on the network.
Under the hood, all interactions with AT1000 hardware happen over TCP/IP transactions. In stand-alone mode a project script runs in an isolated OCI container on the device itself; in remote mode the same script runs on a PC on the LAN.
The SDK papers over the difference: AT1000.isStandalone() tells you which mode you are in, and AT1000.findLocalDevice() resolves the device's own address directly (without mDNS) when running on-device. The same code is portable between stand-alone and remote operation:
- NodeJS
- Python
- Rust
import { AT1000 } from '@ikalogic/at1000';
let host;
if (AT1000.isStandalone()) {
host = await AT1000.findLocalDevice(); // on-device: resolve own address, no mDNS
} else {
const devices = await AT1000.findDevices();
host = devices[0]; // remote: first device found on the LAN
}
from ikalogic_at1000 import AT1000
if AT1000.is_standalone():
host = AT1000.find_local_device() # on-device: resolve own address, no mDNS
else:
devices = AT1000.find_devices() # remote: discover devices on the LAN
host = devices[0]
use ikalogic_at1000::{At1000, At1000Device};
use std::time::Duration;
let device: Option<At1000Device> = if At1000::is_standalone() {
At1000::find_local_device() // on-device: resolve own address, no mDNS
} else {
At1000::find_devices(Duration::from_millis(500))?.into_iter().next() // remote: first device found on the LAN
};
Discovering AT1000 Devices​
Before a test sequence can be launched (controlling outputs and measuring inputs), a device needs to be found on the network.
Discovery returns a list of host strings - not connected devices, one per device. A host string is normally the IP:port address the device answered on (e.g. 192.168.1.23:8080; IPv6 addresses are bracketed). findLocalDevice() / find_local_device() returns a name without a port instead: <device-name>.local (e.g. AT1032S-000022.local) or host.containers.internal. In Rust, discovery returns At1000Device values, which At1000::open accepts directly: host is the address string described above, fullname is the mDNS instance name, and hostname() returns the device name (e.g. AT1032S-000022).
Inside a standalone project, the device running the project is always the first entry of the list, so devices[0] is the local device in both modes.
Enumerating the network never takes control of anything. The following code lists every device found and prints its host:
- NodeJS
- Python
- Rust
import { AT1000 } from '@ikalogic/at1000';
let hosts = await AT1000.findDevices(500); // timeout in milliseconds → host strings
if (hosts.length === 0) {
console.log("No devices found");
process.exit(1);
}
// Loop through discovered devices and print their host strings
hosts.forEach((host, index) => {
console.log(`Device ${index + 1}: ${host}`); // e.g. "Device 1: 192.168.1.23:8080"
});
from ikalogic_at1000 import AT1000
hosts = AT1000.find_devices(0.5) # timeout in seconds → host strings
if len(hosts) == 0:
print("No devices found")
exit(1)
# Loop through discovered devices and print their host strings
for index, host in enumerate(hosts):
print(f"Device {index + 1}: {host}") # e.g. "Device 1: 192.168.1.23:8080"
use ikalogic_at1000::At1000;
use std::time::Duration;
let devices = At1000::find_devices(Duration::from_millis(500))?; // discovery timeout
if devices.is_empty() {
println!("No devices found");
return Ok(());
}
// Loop through discovered devices and print their host and name
for (index, device) in devices.iter().enumerate() {
println!("Device {}: {} ({})", index + 1, device.host, device.hostname()); // e.g. "Device 1: 192.168.1.23:8080 (AT1032S-000022)"
}
Opening a device​
To control a device, open it with AT1000.open(host). Opening takes exclusive access of the device (last-open-wins - see Device access control) and returns a tester object. The example below picks the first discovered device, opens it, resets it to a known state, and reads its identity from tester.info:
- NodeJS
- Python
- Rust
import { AT1000 } from '@ikalogic/at1000';
let hosts = await AT1000.findDevices();
let tester = await AT1000.open(hosts[0]); // Open the first device (takes exclusive access)
await tester.reset(); // Reset the device to its default state
console.log(`Connected to ${tester.info.model} (Serial: ${tester.info.serial_number})`);
from ikalogic_at1000 import AT1000
hosts = AT1000.find_devices()
tester = AT1000.open(hosts[0]) # Open the first device (takes exclusive access)
tester.reset() # Reset the device to its default state
print(f"Connected to {tester.info.model} (Serial: {tester.info.serial_number})")
# tester.close() # release the HTTP client and event stream when done
use ikalogic_at1000::At1000;
use std::time::Duration;
let devices = At1000::find_devices(Duration::from_millis(500))?;
let tester = At1000::open(&devices[0], None)?; // Open the first device (takes exclusive access)
tester.reset()?; // Reset the device to its default state
println!("Connected to {} (Serial: {})", tester.info().model, tester.info().serial_number);
Rust has no close() equivalent. Dropping an At1000 handle does not close the session or send any request; a session ends only when another client opens the device or the front panel reclaims it.
Exclusive access & read-only mode​
A normal open() takes exclusive control of the device: any client that opened it earlier is revoked. When you only need to monitor a device - read pin states, watch power telemetry, subscribe to events - open it read-only. A read-only client mints no session, sends no session header, and never takes control away from whoever is driving the device:
- NodeJS
- Python
- Rust
const monitor = await AT1000.open(hosts[0], { readonly: true });
monitor = AT1000.open(hosts[0], readonly=True)
use ikalogic_at1000::{At1000, OpenOptions};
use std::time::Duration;
let devices = At1000::find_devices(Duration::from_millis(500))?;
let monitor = At1000::open(&devices[0], OpenOptions { readonly: true, ..Default::default() })?;
See Device access control for the full model.
Naming the controller​
An exclusive open() registers a label that names the controller holding the device. Other clients see it in session.state() (see Checking who holds the device), AT1000-Interface shows it in its sidebar, and the client you take the device from receives it in its ACCESS_REVOKED message (e.g. Access was taken over by remote bench-3.). The label defaults to the project id inside a standalone project, and to the computer's hostname otherwise. Pass label to choose it:
- NodeJS
- Python
- Rust
const tester = await AT1000.open(hosts[0], { label: 'bench-3' });
tester = AT1000.open(hosts[0], label="bench-3")
use ikalogic_at1000::{At1000, OpenOptions};
let tester = At1000::open(&devices[0], OpenOptions { label: Some("bench-3".into()), ..Default::default() })?;
A read-only open registers no label.
Python async client​
Besides the synchronous client used throughout this documentation, the Python SDK has an asyncio client in ikalogic_at1000.aio. It has the same resources, models and error types, but its methods are coroutines: await AT1000.find_devices(), AT1000.find_local_device(), AT1000.open() and every resource call, and release the client with await tester.aclose() instead of close().
import asyncio
from ikalogic_at1000.aio import AT1000
async def main():
hosts = await AT1000.find_devices()
tester = await AT1000.open(hosts[0])
await tester.reset()
await tester.aclose()
asyncio.run(main())
Timeouts and connection errors​
SDK requests have deadlines. In JavaScript and Python, opening a device first checks it is reachable with a 1 second request, then allows up to 30 seconds for the session to open, because a remote open() first stops any running standalone project (see Device access control). In Rust, open() uses the deadlines described below.
| SDK | Default request deadline | Transport errors |
|---|---|---|
| JavaScript | 5 s | TimeoutError when the device did not answer in time, ConnectionError when the request never reached it (no route, refused connection, unresolved name). Both are exported by @ikalogic/at1000 and carry the host, method and path of the failed request, with the original error as cause. |
| Python | 1 s | The httpx exceptions, unwrapped: httpx.TimeoutException and httpx.ConnectError, both subclasses of httpx.TransportError. |
| Rust | 30 s, plus 5 s to resolve and connect | At1000Error::Http, wrapping the ureq::Error. Change the deadlines with OpenOptions { timeouts: TimeoutOptions { setup, request, upload }, .. }: setup (default 5 s) bounds name resolution and connection, request (default 30 s, None for no limit) bounds each ordinary request, and upload (default no limit) bounds file transfers. |
In JavaScript and Python, calls that wait on the device, such as a PWM capture or a command sequence, extend their own deadline to cover the timeout you pass them. Errors returned by the device itself are not transport errors: they are ApiErrors (At1000Error variants in Rust) carrying the device's error code.
Connecting over USB on Linux​
On Linux, an AT1000 connected only by USB may not be found: AT1000-Interface shows no device, and the SDKs find nothing. This happens when the AT1000 is not also connected to a network by Ethernet. Linux does not set up the USB connection to the device on its own, so the computer cannot reach it.
If you installed AT1000-Interface from the .deb or .rpm package (version 0.10.0 or later), this is already fixed. Otherwise, for example with the AppImage or when you only use the SDKs, run these commands once:
sudo mkdir -p /etc/NetworkManager/conf.d
sudo tee /etc/NetworkManager/conf.d/90-at1000-usb.conf > /dev/null <<'EOF'
[connection-at1000-usb]
match-device=driver:cdc_ether
ipv4.link-local=4
ipv4.dhcp-timeout=2147483647
EOF
sudo nmcli general reload conf
Then unplug and plug back the AT1000 USB cable.
These commands need NetworkManager 1.52 or later (check with NetworkManager --version). With an older version, open your network settings, select the wired connection that appears when the AT1000 is plugged in, set its IPv4 method to Link-Local Only, then unplug and plug back the cable. Do this once for each AT1000.
To check the link, open AT1000-Interface: after a few seconds, the AT1000 appears in the device selector at the top of the sidebar. If it does not, AT1000-Interface shows what to check.
Some code examples in the next sections of this documentation assume that a tester variable representing an opened AT1000 device already exists (created with AT1000.open(...) as shown above). The discovery-and-open preamble may not be repeated in every example for simplicity and readability.