1# Lint as: python2, python3 2# Copyright (c) 2014 The Chromium OS Authors. All rights reserved. 3# Use of this source code is governed by a BSD-style license that can be 4# found in the LICENSE file. 5 6""" 7This module provides bindings for ModemManager1 DBus constants, such as 8interface names, enumerations, and errors. 9 10""" 11 12# The ModemManager1 Object 13MM1 = '/org/freedesktop/ModemManager1' 14 15# The Root Object Path 16ROOT_PATH = '/' 17 18# Errors 19# TODO: Rename these to DBUS_ERROR_XXXX and put them in a common DBUS related 20# package (crbug.com/343753). 21DBUS_SERVICE_UNKNOWN = 'org.freedesktop.DBus.Error.ServiceUnknown' 22DBUS_UNKNOWN_INTERFACE = 'org.freedesktop.DBus.Error.UnknownInterface' 23DBUS_UNKNOWN_METHOD = 'org.freedesktop.DBus.Error.UnknownMethod' 24DBUS_UNKNOWN_OBJECT = 'org.freedesktop.DBus.Error.UnknownObject' 25 26# Interfaces 27# Standard Interfaces 28I_PROPERTIES = 'org.freedesktop.DBus.Properties' 29I_INTROSPECTABLE = 'org.freedesktop.DBus.Introspectable' 30I_OBJECT_MANAGER = 'org.freedesktop.DBus.ObjectManager' 31 32# ModemManager1 33I_MODEM_MANAGER = 'org.freedesktop.ModemManager1' 34 35# ModemManager1 DBus error prefix 36MM1_ERROR_PREFIX = I_MODEM_MANAGER + '.Error' 37 38# Modems 39I_MODEM = I_MODEM_MANAGER + '.Modem' 40I_MODEM_SIMPLE = I_MODEM + '.Simple' 41I_MODEM_3GPP = I_MODEM + '.Modem3gpp' 42I_MODEM_3GPP_USSD = I_MODEM_3GPP + '.Ussd' 43I_MODEM_CDMA = I_MODEM + '.ModemCdma' 44I_MODEM_MESSAGING = I_MODEM + '.Messaging' 45I_MODEM_LOCATION = I_MODEM + '.Location' 46I_MODEM_TIME = I_MODEM + '.Time' 47I_MODEM_FIRMWARE = I_MODEM + '.Firmware' 48I_MODEM_CONTACTS = I_MODEM + '.Contacts' 49 50# Bearers 51I_BEARER = I_MODEM_MANAGER + '.Bearer' 52 53# SIMs 54I_SIM = I_MODEM_MANAGER + '.Sim' 55 56# SMSs 57SMS_PATH = MM1 + '/SMS' 58I_SMS = I_MODEM_MANAGER + '.Sms' 59 60# Frequently accessed propeties 61MM_MODEM_PROPERTY_NAME_MODEL = 'Model' 62MM_MODEM_PROPERTY_NAME_PLUGIN = 'Plugin' 63MM_MODEM_PROPERTY_NAME_STATE = 'State' 64 65 66# Common Types 67# Flags and Enumerations 68 69# enum MMBearerIpFamily 70MM_BEARER_IP_FAMILY_NONE = 0 71MM_BEARER_IP_FAMILY_IPV4 = 1 << 0 72MM_BEARER_IP_FAMILY_IPV6 = 1 << 1 73MM_BEARER_IP_FAMILY_IPV4V6 = 1 << 2 74MM_BEARER_IP_FAMILY_ANY = 0xFFFFFFFF 75 76MM_BEARER_IP_FAMILY_UNKNOWN = 0 77MM_BEARER_IP_FAMILY_IPV4 = 4 78MM_BEARER_IP_FAMILY_IPV6 = 6 79MM_BEARER_IP_FAMILY_IPV4V6 = 10 80 81# enum MMBearerIpMethod 82MM_BEARER_IP_METHOD_UNKNOWN = 0 83MM_BEARER_IP_METHOD_PPP = 1 84MM_BEARER_IP_METHOD_STATIC = 2 85MM_BEARER_IP_METHOD_DHCP = 3 86 87# enum MMModem3gppFacility 88MM_MODEM_3GPP_FACILITY_NONE = 0 89MM_MODEM_3GPP_FACILITY_SIM = 1 << 0 90MM_MODEM_3GPP_FACILITY_FIXED_DIALING = 1 << 1 91MM_MODEM_3GPP_FACILITY_PH_SIM = 1 << 2 92MM_MODEM_3GPP_FACILITY_PH_FSIM = 1 << 3 93MM_MODEM_3GPP_FACILITY_NET_PERS = 1 << 4 94MM_MODEM_3GPP_FACILITY_NET_SUB_PERS = 1 << 5 95MM_MODEM_3GPP_FACILITY_PROVIDER_PERS = 1 << 6 96MM_MODEM_3GPP_FACILITY_CORP_PERS = 1 << 7 97 98# enum MMModem3gppNetworkAvailability 99MM_MODEM_3GPP_NETWORK_AVAILABILITY_UNKNOWN = 0 100MM_MODEM_3GPP_NETWORK_AVAILABILITY_AVAILABLE = 1 101MM_MODEM_3GPP_NETWORK_AVAILABILITY_CURRENT = 2 102MM_MODEM_3GPP_NETWORK_AVAILABILITY_FORBIDDEN = 3 103 104# enum MMModem3gppRegistrationState 105MM_MODEM_3GPP_REGISTRATION_STATE_IDLE = 0 106MM_MODEM_3GPP_REGISTRATION_STATE_HOME = 1 107MM_MODEM_3GPP_REGISTRATION_STATE_SEARCHING = 2 108MM_MODEM_3GPP_REGISTRATION_STATE_DENIED = 3 109MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN = 4 110MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING = 5 111 112def RegistrationStateToString(state): 113 """ 114 Returns a string for the given state. 115 116 @param state: MMModem3gppRegistrationState value. 117 118 @return A string that describes the given state. 119 120 """ 121 REGISTRATION_STATE_STRINGS = [ 122 'IDLE', 123 'HOME', 124 'SEARCHING', 125 'DENIED', 126 'UNKNOWN', 127 'ROAMING' 128 ] 129 return REGISTRATION_STATE_STRINGS[state] 130 131# enum MMModem3gppSubscriptionState 132MM_MODEM_3GPP_SUBSCRIPTION_STATE_UNKNOWN = 0 133MM_MODEM_3GPP_SUBSCRIPTION_STATE_UNPROVISIONED = 1 134MM_MODEM_3GPP_SUBSCRIPTION_STATE_PROVISIONED = 2 135MM_MODEM_3GPP_SUBSCRIPTION_STATE_OUT_OF_DATA = 3 136 137# enum MMModem3gppUssdSessionState 138MM_MODEM_3GPP_USSD_SESSION_STATE_UNKNOWN = 0 139MM_MODEM_3GPP_USSD_SESSION_STATE_IDLE = 1 140MM_MODEM_3GPP_USSD_SESSION_STATE_ACTIVE = 2 141MM_MODEM_3GPP_USSD_SESSION_STATE_USER_RESPONSE = 3 142 143# enum MMModemAccessTechnology 144MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN = 0 145MM_MODEM_ACCESS_TECHNOLOGY_POTS = 1 << 0 146MM_MODEM_ACCESS_TECHNOLOGY_GSM = 1 << 1 147MM_MODEM_ACCESS_TECHNOLOGY_GSM_COMPACT = 1 << 2 148MM_MODEM_ACCESS_TECHNOLOGY_GPRS = 1 << 3 149MM_MODEM_ACCESS_TECHNOLOGY_EDGE = 1 << 4 150MM_MODEM_ACCESS_TECHNOLOGY_UMTS = 1 << 5 151MM_MODEM_ACCESS_TECHNOLOGY_HSDPA = 1 << 6 152MM_MODEM_ACCESS_TECHNOLOGY_HSUPA = 1 << 7 153MM_MODEM_ACCESS_TECHNOLOGY_HSPA = 1 << 8 154MM_MODEM_ACCESS_TECHNOLOGY_HSPA_PLUS = 1 << 9 155MM_MODEM_ACCESS_TECHNOLOGY_1XRTT = 1 << 10 156MM_MODEM_ACCESS_TECHNOLOGY_EVDO0 = 1 << 11 157MM_MODEM_ACCESS_TECHNOLOGY_EVDOA = 1 << 12 158MM_MODEM_ACCESS_TECHNOLOGY_EVDOB = 1 << 13 159MM_MODEM_ACCESS_TECHNOLOGY_LTE = 1 << 14 160MM_MODEM_ACCESS_TECHNOLOGY_ANY = 0xFFFFFFFF 161 162# enum MMModemBand 163MM_MODEM_BAND_UNKNOWN = 0 164# GSM/UMTS bands 165MM_MODEM_BAND_EGSM = 1 166MM_MODEM_BAND_DCS = 2 167MM_MODEM_BAND_PCS = 3 168MM_MODEM_BAND_G850 = 4 169MM_MODEM_BAND_U2100 = 5 170MM_MODEM_BAND_U1800 = 6 171MM_MODEM_BAND_U17IV = 7 172MM_MODEM_BAND_U800 = 8 173MM_MODEM_BAND_U850 = 9 174MM_MODEM_BAND_U900 = 10 175MM_MODEM_BAND_U17IX = 11 176MM_MODEM_BAND_U1900 = 12 177MM_MODEM_BAND_U2600 = 13 178# LTE bands 179MM_MODEM_BAND_EUTRAN_I = 31 180MM_MODEM_BAND_EUTRAN_II = 32 181MM_MODEM_BAND_EUTRAN_III = 33 182MM_MODEM_BAND_EUTRAN_IV = 34 183MM_MODEM_BAND_EUTRAN_V = 35 184MM_MODEM_BAND_EUTRAN_VI = 36 185MM_MODEM_BAND_EUTRAN_VII = 37 186MM_MODEM_BAND_EUTRAN_VIII = 38 187MM_MODEM_BAND_EUTRAN_IX = 39 188MM_MODEM_BAND_EUTRAN_X = 40 189MM_MODEM_BAND_EUTRAN_XI = 41 190MM_MODEM_BAND_EUTRAN_XII = 42 191MM_MODEM_BAND_EUTRAN_XIII = 43 192MM_MODEM_BAND_EUTRAN_XIV = 44 193MM_MODEM_BAND_EUTRAN_XVII = 47 194MM_MODEM_BAND_EUTRAN_XVIII = 48 195MM_MODEM_BAND_EUTRAN_XIX = 49 196MM_MODEM_BAND_EUTRAN_XX = 50 197MM_MODEM_BAND_EUTRAN_XXI = 51 198MM_MODEM_BAND_EUTRAN_XXII = 52 199MM_MODEM_BAND_EUTRAN_XXIII = 53 200MM_MODEM_BAND_EUTRAN_XXIV = 54 201MM_MODEM_BAND_EUTRAN_XXV = 55 202MM_MODEM_BAND_EUTRAN_XXVI = 56 203MM_MODEM_BAND_EUTRAN_XXXIII = 63 204MM_MODEM_BAND_EUTRAN_XXXIV = 64 205MM_MODEM_BAND_EUTRAN_XXXV = 65 206MM_MODEM_BAND_EUTRAN_XXXVI = 66 207MM_MODEM_BAND_EUTRAN_XXXVII = 67 208MM_MODEM_BAND_EUTRAN_XXXVIII = 68 209MM_MODEM_BAND_EUTRAN_XXXIX = 69 210MM_MODEM_BAND_EUTRAN_XL = 70 211MM_MODEM_BAND_EUTRAN_XLI = 71 212MM_MODEM_BAND_EUTRAN_XLII = 72 213MM_MODEM_BAND_EUTRAN_XLIII = 73 214# CDMA Band Classes (see 3GPP2 C.S0057-C) 215MM_MODEM_BAND_CDMA_BC0_CELLULAR_800 = 128 216MM_MODEM_BAND_CDMA_BC1_PCS_1900 = 129 217MM_MODEM_BAND_CDMA_BC2_TACS = 130 218MM_MODEM_BAND_CDMA_BC3_JTACS = 131 219MM_MODEM_BAND_CDMA_BC4_KOREAN_PCS = 132 220MM_MODEM_BAND_CDMA_BC5_NMT450 = 134 221MM_MODEM_BAND_CDMA_BC6_IMT2000 = 135 222MM_MODEM_BAND_CDMA_BC7_CELLULAR_700 = 136 223MM_MODEM_BAND_CDMA_BC8_1800 = 137 224MM_MODEM_BAND_CDMA_BC9_900 = 138 225MM_MODEM_BAND_CDMA_BC10_SECONDARY_800 = 139 226MM_MODEM_BAND_CDMA_BC11_PAMR_400 = 140 227MM_MODEM_BAND_CDMA_BC12_PAMR_800 = 141 228MM_MODEM_BAND_CDMA_BC13_IMT2000_2500 = 142 229MM_MODEM_BAND_CDMA_BC14_PCS2_1900 = 143 230MM_MODEM_BAND_CDMA_BC15_AWS = 144 231MM_MODEM_BAND_CDMA_BC16_US_2500 = 145 232MM_MODEM_BAND_CDMA_BC17_US_FLO_2500 = 146 233MM_MODEM_BAND_CDMA_BC18_US_PS_700 = 147 234MM_MODEM_BAND_CDMA_BC19_US_LOWER_700 = 148 235# All/Any 236MM_MODEM_BAND_ANY = 256 237 238# enum MMModemCapability 239MM_MODEM_CAPABILITY_NONE = 0 240MM_MODEM_CAPABILITY_POTS = 1 << 0 241MM_MODEM_CAPABILITY_CDMA_EVDO = 1 << 1 242MM_MODEM_CAPABILITY_GSM_UMTS = 1 << 2 243MM_MODEM_CAPABILITY_LTE = 1 << 3 244MM_MODEM_CAPABILITY_LTE_ADVANCED = 1 << 4 245MM_MODEM_CAPABILITY_IRIDIUM = 1 << 5 246 247# enum MMModemCdmaActivationState 248MM_MODEM_CDMA_ACTIVATION_STATE_UNKNOWN = 0 249MM_MODEM_CDMA_ACTIVATION_STATE_NOT_ACTIVATED = 1 250MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATING = 2 251MM_MODEM_CDMA_ACTIVATION_STATE_PARTIALLY_ACTIVATED = 3 252MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATED = 4 253 254# enum MMModemCdmaRegistrationState 255MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN = 0 256MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED = 1 257MM_MODEM_CDMA_REGISTRATION_STATE_HOME = 2 258MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING = 3 259 260# enum MMModemCdmaRmProtocol 261MM_MODEM_CDMA_RM_PROTOCOL_UNKNOWN = 0 262MM_MODEM_CDMA_RM_PROTOCOL_ASYNC = 1 263MM_MODEM_CDMA_RM_PROTOCOL_PACKET_RELAY = 2 264MM_MODEM_CDMA_RM_PROTOCOL_PACKET_NETWORK_PPP = 3 265MM_MODEM_CDMA_RM_PROTOCOL_PACKET_NETWORK_SLIP = 4 266MM_MODEM_CDMA_RM_PROTOCOL_STU_III = 5 267 268# enum MMModemContactsStorage 269MM_MODEM_CONTACTS_STORAGE_UNKNOWN = 0 270MM_MODEM_CONTACTS_STORAGE_ME = 1 271MM_MODEM_CONTACTS_STORAGE_SM = 2 272MM_MODEM_CONTACTS_STORAGE_MT = 3 273 274# enum MMModemLocationSource 275MM_MODEM_LOCATION_SOURCE_NONE = 0 276MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI = 1 << 0 277MM_MODEM_LOCATION_SOURCE_GPS_RAW = 1 << 1 278MM_MODEM_LOCATION_SOURCE_GPS_NMEA = 1 << 2 279 280# enum MMModemLock 281MM_MODEM_LOCK_UNKNOWN = 0 282MM_MODEM_LOCK_NONE = 1 283MM_MODEM_LOCK_SIM_PIN = 2 284MM_MODEM_LOCK_SIM_PIN2 = 3 285MM_MODEM_LOCK_SIM_PUK = 4 286MM_MODEM_LOCK_SIM_PUK2 = 5 287MM_MODEM_LOCK_PH_SP_PIN = 6 288MM_MODEM_LOCK_PH_SP_PUK = 7 289MM_MODEM_LOCK_PH_NET_PIN = 8 290MM_MODEM_LOCK_PH_NET_PUK = 9 291MM_MODEM_LOCK_PH_SIM_PIN = 10 292MM_MODEM_LOCK_PH_CORP_PIN = 11 293MM_MODEM_LOCK_PH_CORP_PUK = 12 294MM_MODEM_LOCK_PH_FSIM_PIN = 13 295MM_MODEM_LOCK_PH_FSIM_PUK = 14 296MM_MODEM_LOCK_PH_NETSUB_PIN = 15 297MM_MODEM_LOCK_PH_NETSUB_PUK = 16 298 299# enum MMModemMode 300MM_MODEM_MODE_NONE = 0 301MM_MODEM_MODE_CS = 1 << 0 302MM_MODEM_MODE_2G = 1 << 1 303MM_MODEM_MODE_3G = 1 << 2 304MM_MODEM_MODE_4G = 1 << 3 305MM_MODEM_MODE_ANY = 0xFFFFFFFF 306 307# enum MMModemState 308MM_MODEM_STATE_FAILED = -1 309MM_MODEM_STATE_UNKNOWN = 0 310MM_MODEM_STATE_INITIALIZING = 1 311MM_MODEM_STATE_LOCKED = 2 312MM_MODEM_STATE_DISABLED = 3 313MM_MODEM_STATE_DISABLING = 4 314MM_MODEM_STATE_ENABLING = 5 315MM_MODEM_STATE_ENABLED = 6 316MM_MODEM_STATE_SEARCHING = 7 317MM_MODEM_STATE_REGISTERED = 8 318MM_MODEM_STATE_DISCONNECTING = 9 319MM_MODEM_STATE_CONNECTING = 10 320MM_MODEM_STATE_CONNECTED = 11 321 322def ModemStateToString(state): 323 """ 324 Returns a string for the given state. 325 326 @param state: MMModemState value. 327 328 @return A string that describes the given state. 329 330 """ 331 MODEM_STATE_STRINGS = [ 332 'FAILED', 333 'UNKNOWN', 334 'INITIALIZING', 335 'LOCKED', 336 'DISABLED', 337 'DISABLING', 338 'ENABLING', 339 'ENABLED', 340 'SEARCHING', 341 'REGISTERED', 342 'DISCONNECTING', 343 'CONNECTING', 344 'CONNECTED' 345 ] 346 return MODEM_STATE_STRINGS[state + 1] 347 348# enum MMModemPowerState 349MM_MODEM_POWER_STATE_UNKNOWN = 0 350MM_MODEM_POWER_STATE_OFF = 1 351MM_MODEM_POWER_STATE_LOW = 2 352MM_MODEM_POWER_STATE_ON = 3 353 354# enum MMModemStateChangeReason 355MM_MODEM_STATE_CHANGE_REASON_UNKNOWN = 0 356MM_MODEM_STATE_CHANGE_REASON_USER_REQUESTED = 1 357MM_MODEM_STATE_CHANGE_REASON_SUSPEND = 2 358 359# enum MMSmsState 360MM_SMS_STATE_UNKNOWN = 0 361MM_SMS_STATE_STORED = 1 362MM_SMS_STATE_RECEIVING = 2 363MM_SMS_STATE_RECEIVED = 3 364MM_SMS_STATE_SENDING = 4 365MM_SMS_STATE_SENT = 5 366 367# enum MMSmsStorage 368MM_SMS_STORAGE_UNKNOWN = 0 369MM_SMS_STORAGE_SM = 1 370MM_SMS_STORAGE_ME = 2 371MM_SMS_STORAGE_MT = 3 372MM_SMS_STORAGE_SR = 4 373MM_SMS_STORAGE_BM = 5 374MM_SMS_STORAGE_TA = 6 375 376# enum MMModemPortType 377MM_MODEM_PORT_TYPE_UNKNOWN = 1 378MM_MODEM_PORT_TYPE_NET = 2 379MM_MODEM_PORT_TYPE_AT = 3 380MM_MODEM_PORT_TYPE_QCDM = 4 381MM_MODEM_PORT_TYPE_GPS = 5 382MM_MODEM_PORT_TYPE_QMI = 6 383MM_MODEM_PORT_TYPE_MBIM = 7 384 385# enum MMSmsPduType 386MM_SMS_PDU_TYPE_UNKNOWN = 0 387MM_SMS_PDU_TYPE_DELIVER = 1 388MM_SMS_PDU_TYPE_SUBMIT = 2 389MM_SMS_PDU_TYPE_STATUS_REPORT = 3 390 391# enum MMSmsDeliveryState 392MM_SMS_DELIVERY_STATE_UNKNOWN = 0x100 393 394# enum MMSmsValidityType 395MM_SMS_VALIDITY_TYPE_UNKNOWN = 0 396MM_SMS_VALIDITY_TYPE_RELATIVE = 1 397MM_SMS_VALIDITY_TYPE_ABSOLUTE = 2 398MM_SMS_VALIDITY_TYPE_ENHANCED = 3 399 400# enum MMSimEsimStatus 401MM_SIM_ESIM_STATUS_UNKNOWN = 0 402MM_SIM_ESIM_STATUS_NO_PROFILES = 1 403MM_SIM_ESIM_STATUS_WITH_PROFILES = 2 404 405MM_INHIBIT_PROCESSING_TIME = 30 406MM_REPROBE_PROCESSING_TIME = 90 407MM_UNINHIBIT_PROCESSING_TIME = MM_INHIBIT_PROCESSING_TIME 408 409# D-Bus path for empty sim slots 410MM_EMPTY_SLOT_PATH = '/' 411 412# Wait times for modem at Modemmanager operations 413MM_MODEM_POLL_TIME = 60 414