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