Skip to content

probe-web / @probe-web/ui / ProbeDevicePicker

Class: ProbeDevicePicker ​

Defined in: packages/ui/src/device-picker.ts:33

<probe-device-picker>: lists the probes the connected Client can see and, on the WebUSB transport, lets the user grant access to a new device. When exactly one probe is visible it is selected automatically.

Fires ​

  • probe-selected: A probe was chosen (by a click, or automatically when it is the only one). detail is the Wire.DebugProbeEntry; pass it to client.attach().
  • device-authorized: The user granted a new WebUSB device through the browser's chooser. detail is its ProbeDescription from @probe-web/devices.

Example ​

html
<probe-device-picker id="picker"></probe-device-picker>
ts
const client = await Client.connect({ kind: 'webusb', worker });
const picker = document.querySelector('probe-device-picker')!;
picker.client = client;
picker.addEventListener('probe-selected', async (e) => {
  const probe = (e as CustomEvent<Wire.DebugProbeEntry>).detail;
  const session = await client.attach({ probe, chip: 'nRF52840_xxAA' });
});

Extends ​

  • LitElement

Constructors ​

Constructor ​

ts
new ProbeDevicePicker(): ProbeDevicePicker;

Defined in: node_modules/@lit/reactive-element/development/reactive-element.d.ts:527

Returns ​

ProbeDevicePicker

Inherited from ​

ts
LitElement.constructor

Properties ​

PropertyTypeDefault valueDescriptionDefined in
clientClient | nullnullThe connection whose probes are listed; null shows "Not connected."packages/ui/src/device-picker.ts:58

Methods ​

refresh() ​

ts
refresh(): Promise<void>;

Defined in: packages/ui/src/device-picker.ts:79

Re-read the granted WebUSB devices and the client's probe list.

Returns ​

Promise<void>


authorize() ​

ts
authorize(): Promise<void>;

Defined in: packages/ui/src/device-picker.ts:94

Open the browser's WebUSB chooser to grant a new probe, then refresh the list. Must run from a user gesture (the Authorize device… button does this).

Returns ​

Promise<void>


select() ​

ts
select(p): void;

Defined in: packages/ui/src/device-picker.ts:107

Mark p as selected and fire probe-selected.

Parameters ​

ParameterType
pDebugProbeEntry

Returns ​

void