## Modem state machine

Once all ports of a given modem have been probed and grabbed by a newly created Modem object, ModemManager will start the global state machine for the modem, as defined in the picture below.

Figure 1. ModemManager states

The state machine of a modem can be summarized in 5 main sequences: initialization, enabling, connection, disconnection and disabling.

## Initialization

The modem initialization sequence starts only when all ports have been probed and grabbed by a given plugin. This is done so that the proper AT port (that suggested to be Primary) is used as control port.

The global initialization sequence is itself splitted into N per-interface initialization steps (being N the number of interfaces implemented by the modem object). The following list provides the steps required in the initialization sequence of a Broadband modem object.

- Modem interface initialization

  The Modem interface provides common actions and information available in the majority of the modems (including Broadband-specific items which won't be implemented by POTS modems).

  One of the key things done during the initialization of this interface is the checking of supported capabilities. Broadband modem objects are able to handle 3GPP-only, CDMA-only and mixed 3GPP+CDMA modems, but in order to properly handle the distinctions required in these, ModemManager first needs to know exactly which is the current set of capabilities.

  The other key step in this sequence involves checking the lock status of the modem and/or SIM . If the modem/SIM is found to be locked, the whole initialization sequence is halted and the modem is left in a locked state until unlocked by the user. Note, therefore, that modems that are locked will not expose additional feature-specific DBus interfaces until they get unlocked.

  It may be the case that some of the steps in the initialization of the Modem interface require the modem itself to be unlocked. If the modem is found locked during the first initialization attempt, as soon as it gets unlocked the initialization sequence will be re-executed.

- 3GPP interface initialization

  The 3GPP interface provides common actions and setup for modems which provide 3GPP capabilities. Therefore, this interface initialization sequence will only be run in 3GPP-enabled modems.

- CDMA interface initialization

  The CDMA interface provides common actions and setup for modems which provide CDMA capabilities. Therefore, this interface initialization sequence will only be run in CDMA-enabled modems.

- Additional feature-specific interface initializations

  Modems with additional features will export feature-specific interfaces, such as the Location or the Messaging ones.

  These interfaces also have their own initialization sequences, where the first step in the sequence is always the check of whether the given modem supports the given feature. In other words, modems will only end up exporting the interfaces for the features they support.