# Devices

> A Vigil device is a company-owned Android handset that runs the guard app. Link it to your organization to see who is signed in, where it is and how it is doing.

Source: https://vigilsecure.net/docs/concepts/devices/

A device is a Vigil handset: a rugged Android phone your company owns, locked to the
[guard app](https://vigilsecure.net/docs/concepts/guard-app.md). Guards share devices. A device stays at a site or
with a vehicle, and whoever is on shift signs in on it.

You find them under **Infrastructure → Devices** in the console.

## How a device reaches you

Vigil prepares each device before you get it. The guard app is installed, the device is
locked down so it cannot be used for anything else, and it is registered with Vigil under
its serial number. What is left for you is to _link_ it to your organization.

## Link a device

You need the **Link devices** permission. The operator, manager, admin and owner roles have
it.

1. Switch the device on and connect it to the internet. It shows **This device isn't linked
   to a company yet**. Choose **Let's onboard**. The device shows a QR code with its serial
   number and device ID beneath it.
2. Scan the QR code with your own phone's camera and sign in to Vigil. If you belong to
   several organizations, choose the one the device should join. Then choose **Link
   device**.

   Or, in the console, choose **Infrastructure → Devices → Link a device** and scan the
   code with your computer's camera, or paste the **Device ID**.

3. Under **Handset linked**, give the device a **Name** your team will recognise, such as
   `Gate 3` or `Rosebank patrol`. Without a name it is shown by its serial number.

The device moves on by itself within a few seconds and shows your organization's name and
**Sign in to start shift**.

If linking fails:

| Message                                                 | What to do                                                                      |
| ------------------------------------------------------- | ------------------------------------------------------------------------------- |
| This handset has not checked in for a couple of minutes | Keep the device on its QR screen and connected to the internet, then try again. |
| This handset is linked to another organization          | It has to be unlinked there first.                                              |
| No handset has this ID                                  | Check the ID against the device's screen, or scan the QR code instead.          |

## The device list

The list shows each device with its name, serial number, when it was last seen and its
state. Search by serial number, and choose a row's menu to **Copy serial number** or
**Unlink**.

## The device page

Open a device to see its **Profile** and **Events** tabs, and a **State log** tab if your
role includes **See device locations**.

### Profile

The **Status** panel shows how the device is doing right now:

- **Signed in**: the user on shift and since when, or **Nobody**.
- **Last report**: when the device last reported. A device that is overdue shows **Silent
  for** and how long.
- **Battery** and **Signal**: the charge, the network type and the signal strength.
- **Location**: the last position, how accurate it is and when it was fixed.
- **App version**: the guard app version it runs.

Below that you can rename the device and see its serial number and when it was registered
and linked.

Seeing status and location needs the **See device locations** permission. By default the
admin and owner roles have it.

### Events

A log of what happened on the device, newest first:

- A user **signed in** or **signed out**.
- The device was **linked** or **unlinked**, or the **app version changed**.
- It **started walking**, **running**, **cycling** or **moving in a vehicle**, or **stopped
  moving**.
- A **charger** was connected or disconnected, with the battery level at the time.
- **Wi-Fi** was connected or disconnected.

### State log

Charts of the **battery** and **signal level** over the past 24 hours or 7 days, and a
**device track**: the device's position fixes drawn on a map. The table beneath lists each
sample with the signed-in user, battery, signal and position.

Devices report their state every ten minutes, and their position more often while they are
moving. The logs belong to the device, so its history stays with it.

## Device commands

A command is a one-off instruction sent to a device.

| Command             | What the device does                                                                                                         |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| **Request sign-in** | Sounds an alarm and shows **Sign In Requested** until somebody acknowledges it. A device with somebody signed in ignores it. |
| **Sign out**        | Signs a named user out and returns to the sign-in screen. It does nothing if somebody else has since signed in.              |
| **Set volume**      | Sets the device's volume.                                                                                                    |
| **Reboot**          | Restarts the device. It refuses during a call.                                                                               |

You send a command by asking an [agent](https://vigilsecure.net/docs/concepts/agents.md). Ask the Operations agent,
for example "Request a sign-in on Gate 3" or "Sign Sipho out of the Rosebank device", or
let an agent do it on a schedule. Sending commands needs the **Send device commands**
permission, which the admin and owner roles have. Developers can also send commands through
the [API](https://vigilsecure.net/docs/developers/api.md).

A command travels to the device over the internet and is held for five minutes, so a
device that is off or out of signal for longer than that does not receive it.

## Unlink a device

In the device list, open the device's menu and choose **Unlink**. This needs the **Unlink
devices** permission, which the admin and owner roles have. The device leaves your
organization straight away and loses the
name you gave it. The device stays registered with Vigil, so it can be linked again, to
your organization or another one.

## Related

- [Device fleet monitoring](https://vigilsecure.net/docs/examples/device-fleet-monitoring.md)
- [Guard check-ins](https://vigilsecure.net/docs/examples/guard-check-ins.md)
- [Frequently asked questions](https://vigilsecure.net/docs/faq.md#devices-and-the-guard-app)
