Home

Awesome

VintageNetQMI

Hex version API docs CircleCI

This library provides a VintageNet technology for cellular modems that support the Qualcomm MSM Interface. This includes most USB cellular modems. See VintageNetMobile if you have a modem that only supports an AT command interface.

To use this library, first add it to your project's dependency list:

def deps do
  [
    {:vintage_net_qmi, "~> 0.3.2"}
  ]
end

You will then need to configure VintageNet. The easiest way to configure a modem at runtime is by calling VintageNetQMI.quick_configure("the_apn"). For example:

iex> VintageNetQMI.quick_configure("the_apn")
:ok
# wait...
iex> VintageNet.info
Interface wwan0
  Type: VintageNetQMI
  Power: On (watchdog timeout in 51628 ms)
  Present: true
  State: :configured (0:41:09)
  Connection: :internet (0:40:28)
  Addresses: 100.79.205.206/30, fe80::723c:bdc9:10e4:d092/64
  Configuration:
    %{
      type: VintageNetQMI,
      vintage_net_qmi: %{service_providers: [%{apn: "the_apn"}]}
    }

You can't always call quick_configure/1 convenience function so here's the regular configuration. If you are moving code from vintage_net_mobile, you'll notice that this format is very similar except that Mobile is now QMI.

VintageNet.configure("wwan0", %{
      type: VintageNetQMI,
      vintage_net_qmi: %{
        service_providers: [%{apn: "the_apn"}]
      }
    })

The :service_providers key should be set to information provided by each of your service providers. It is common that this is a list of one item. Currently only one service provider is supported, so replace "fill_in" with the APN that they gave you.

Service provider APN selection via ICCID

If you're deploying SIMs from multiple service providers, you'll need to set the APN based on what SIM was installed in the device. One way is to set a configuration manually when you install the SIM. An easier way is to have VintageNetQMI pick the APN based on the SIM's ICCID.

This featured is enabled by using the :only_iccid_prefixes option and listing multiple service providers. VintageNetQMI looks at the :service_providers list in order until one matches. Leave off the:only_iccid_prefixes option on the final service provider to provide a catch-all APN.

Here's an example:

VintageNet.configure("wwan0", %{
      type: VintageNetQMI,
      vintage_net_qmi: %{
        service_providers: [
          %{apn: "special_service_provider", only_iccid_prefixes: ["8973611", "8973612"]},
          %{apn: "default_apn"}
        ]
      }
    })

Configure radio technologies

In some cases you might want to set to the radio access technology (RAT) to only use a subset of what the modem is capable of using. To specify which RATs to use you can set the optional configuration field :only_radio_technologies.

VintageNet.configure("wwan0", %{
      type: VintageNetQMI,
      vintage_net_qmi: %{
        only_radio_technologies: [:lte, :umts],
        service_providers: [
          %{apn: "apn_name"}
        ]
      }
    })

The example above will limit the possible RATs used to :lte (4G) and :umts (3G). For more information which radio technologies are available please see the :qmi documentation.

If this configuration is provided, the modem will use the default configuration that provided by the manufacturer.

Configure roaming

Support for allowing roaming is set on a per-service provider basis using the :roaming_allowed? key. In QMI, this field is optional and if unset here, VintageNetQMI will not send any preference to the modem. The following example shows a configuration where roaming is allowed:

VintageNet.configure("wwan0", %{
      type: VintageNetQMI,
      vintage_net_qmi: %{
        only_radio_technologies: [:lte, :umts],
        service_providers: [
          %{apn: "apn_name", roaming_allowed?: true}
        ]
      }
    })

VintageNet Properties

In addition to the common vintage_net properties for all interface types, this technology the following:

PropertyValuesDescription
signal_asu0-31,99Reported Arbitrary Strength Unit (ASU)
signal_4bars0-4The signal level in "bars"
signal_dbm-144 - -44The signal level in dBm. Interpretation depends on the connection technology.
mcc0-999nil
mnc0-999nil
iccidstringThe Integrated Circuit Card Identifier (ICCID)
esnstringThe Electronic Serial Number (ESN)
imeistringInternational Mobile Equipment Identity (IMEI)
meidstringThe Mobile Equipment Identifier (MEID)
imeisv_svnstringIMEI software version number
providerstringnil
lac0-65533The Location Area Code (lac) for the current cell
cid0-268435455The Cell ID (cid) for the current cell
network_datetimeNaiveDateTime.t()The reported datetime from the network
utc_offsetCalendar.utc_offset()The UTC offset in seconds
roamingboolean()If the network is roaming or not
std_offsetCalendar.std_offset()The standard offset in seconds
statisticsmapTransmit and receive statistics (see below for details)
access_technologyatomThe technology currently in use to connect to the network
bandstringThe frequency band in use
channelintegerAn integer that indicates the channel that's in use
manufacturerstringThe name of the manufacturer of the modem
modelstringThe name of the model of the modem
apnstringThe APN that VintageNetQMI configured the modem to use
sim_rej_infoatomThe reason (if any) a SIM was rejected

The following properties are TBD:

PropertyValuesDescription
imsistringThe International Mobile Subscriber Identity (IMSI)

Transmit and receive statistics

The statistics value is a map with the fields:

Types of radio access technologies

If you migrating from VintageNetMobile you will need to update any code that uses this property to handle the above list of atoms.

System requirements

These requirements are believed to be the minimum needed to be added to the official Nerves systems.

Linux kernel

Enable QMI and drivers for your modem:

CONFIG_USB_USBNET=m
CONFIG_USB_NET_CDC_NCM=m
CONFIG_USB_NET_QMI_WWAN=m
CONFIG_USB_SERIAL_OPTION=m

If you're using a Huawei modem, you might also want:

CONFIG_USB_NET_HUAWEI_CDC_NCM=m