---
title: Device Management
slug: device-management
docTags: 
createdAt: 2024-11-27T11:47:45.247Z
---

This section covers how to discover, select and inspect the Miura device the SDK transacts with. Two related topics have their own sub-pages:

- [Device Setup & Readiness](docId\:UymEfwQPsSfdqgfPvLAxg): bringing a reader into a Toro-compatible state with the single `ensureDeviceReady()` entry point.
- [TMS Updates](docId\:MGAJMjiRKCK4yk0MZHann): how security parameters and configuration are kept current via the Terminal Management System (TMS).

## Listing available Miura devices

### Bluetooth

This will return a list of `BluetoothDevice` instances, excluding the `selectedBluetoothDevice`. Miura devices which have not been paired in the Android Bluetooth settings will not be returned.

### USB

This will return a list of `UsbDevice` instances that are currently attached to the system, excluding the `selectedUsbDevice`.

## Selecting a device

### Bluetooth

To select the device you want to use, set the `selectedBluetoothDevice` property on the `ToroClient` instance:

To unset the selected device, set the `selectedBluetoothDevice` property to `null`:

### USB

To select the device you want to use, set the `selectedUsbDevice` property on the `ToroClient` instance:

To unset the selected device, set the `selectedUsbDevice` property to `null`:

## Getting device information

You can get information about the selected device using the `getDeviceInfo` method on the `ToroClient` instance:

This returns a `MiuraDeviceInfo` object containing information about the selected device, such as its serial number, system time, hardware identifier, OS and MPI versions, battery status, configuration file versions and P2PE/security status.

### Readiness at a glance: `baselineStatus`

`MiuraDeviceInfo` exposes a `baselineStatus` (`BaselineStatus`) giving a per-condition breakdown of whether the device meets the SDK's baseline requirements to transact:

`baselineStatus.meetsBaseline` is a convenience flag that is `true` only when all four conditions are met.

## Device session state

You can check whether the device is currently in use by the Toro SDK using the `isSessionOpen` property on the `ToroClient` instance:

This will return `true` if the device is currently in use, and `false` otherwise.

### USB device listener

You can also register a `UsbDeviceListener` to receive `UsbDeviceEvent` updates if you are using `ConnectionMode.USB`:

:::CodeblockTabs
```kotlin
val listener = UsbDeviceListener { event ->
        when (event) {
            is UsbDeviceEvent.DeviceAttached -> TODO()
            is UsbDeviceEvent.DeviceDetached -> TODO()
            is UsbDeviceEvent.PermissionDenied -> TODO()
            is UsbDeviceEvent.PermissionGranted -> TODO()
            is UsbDeviceEvent.PermissionPending -> TODO()
        }
}

// Register the listener with the ToroClient instance
toro.setUsbDeviceListener(listener)
```

```java
UsbDeviceListener listener = new UsbDeviceListener() {
    @Override
    public void onUsbDeviceEvent(@NonNull UsbDeviceEvent event) {
        if (event instanceof UsbDeviceEvent.DeviceAttached) {
            // Handle device attached
        } else if (event instanceof UsbDeviceEvent.DeviceDetached) {
            // Handle device detached
        } else if (event instanceof UsbDeviceEvent.PermissionDenied) {
            // Handle permission denied
        } else if (event instanceof UsbDeviceEvent.PermissionGranted) {
            // Handle permission granted
        } else if (event instanceof UsbDeviceEvent.PermissionPending) {
            // Handle permission pending
        }
    }
};

// Register the listener with the ToroClient instance
toro.setUsbDeviceListener(listener);
```
:::

