wwan: add nm_modem_manager_get_modems() to iterate over modems
Currently, we cannot ask which modems exist. NMDeviceBt may claim it via nm_device_factory_emit_component_added(), and NMWWanFactory may take it by listening to NM_MODEM_MANAGER_MODEM_ADDED. But that's it. We will drop nm_device_factory_emit_component_added() because it's only used for passing modems to NMDeviceBt. Instead, NMDeviceBt can directly subscribe to NM_MODEM_MANAGER_MODEM_ADDED. It already has a reference to NMModemManager. Anyway, the NM_MODEM_MANAGER_MODEM_ADDED signal is no enough, because sometimes when the mode appears, NMDeviceBt might not yet know whether it should take it (because the DUN connect call is not yet complete). Currently that never happens because dun_connect() blocks waiting for the device. That must be fixed, by not waiting. But this opens up a race, and NMDeviceBt might after NM_MODEM_MANAGER_MODEM_ADDED need to search for the suitable modem: by iterating the list of all modems.
Showing with 18 additions and 0 deletions