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 136# enum MMModem3gppUssdSessionState 137MM_MODEM_3GPP_USSD_SESSION_STATE_UNKNOWN = 0 138MM_MODEM_3GPP_USSD_SESSION_STATE_IDLE = 1 139MM_MODEM_3GPP_USSD_SESSION_STATE_ACTIVE = 2 140MM_MODEM_3GPP_USSD_SESSION_STATE_USER_RESPONSE = 3 141 142# enum MMModemAccessTechnology 143MM_MODEM_ACCESS_TECHNOLOGY_UNKNOWN = 0 144MM_MODEM_ACCESS_TECHNOLOGY_POTS = 1 << 0 145MM_MODEM_ACCESS_TECHNOLOGY_GSM = 1 << 1 146MM_MODEM_ACCESS_TECHNOLOGY_GSM_COMPACT = 1 << 2 147MM_MODEM_ACCESS_TECHNOLOGY_GPRS = 1 << 3 148MM_MODEM_ACCESS_TECHNOLOGY_EDGE = 1 << 4 149MM_MODEM_ACCESS_TECHNOLOGY_UMTS = 1 << 5 150MM_MODEM_ACCESS_TECHNOLOGY_HSDPA = 1 << 6 151MM_MODEM_ACCESS_TECHNOLOGY_HSUPA = 1 << 7 152MM_MODEM_ACCESS_TECHNOLOGY_HSPA = 1 << 8 153MM_MODEM_ACCESS_TECHNOLOGY_HSPA_PLUS = 1 << 9 154MM_MODEM_ACCESS_TECHNOLOGY_1XRTT = 1 << 10 155MM_MODEM_ACCESS_TECHNOLOGY_EVDO0 = 1 << 11 156MM_MODEM_ACCESS_TECHNOLOGY_EVDOA = 1 << 12 157MM_MODEM_ACCESS_TECHNOLOGY_EVDOB = 1 << 13 158MM_MODEM_ACCESS_TECHNOLOGY_LTE = 1 << 14 159MM_MODEM_ACCESS_TECHNOLOGY_ANY = 0xFFFFFFFF 160 161# enum MMModemBand 162MM_MODEM_BAND_UNKNOWN = 0 163# GSM/UMTS bands 164MM_MODEM_BAND_EGSM = 1 165MM_MODEM_BAND_DCS = 2 166MM_MODEM_BAND_PCS = 3 167MM_MODEM_BAND_G850 = 4 168MM_MODEM_BAND_U2100 = 5 169MM_MODEM_BAND_U1800 = 6 170MM_MODEM_BAND_U17IV = 7 171MM_MODEM_BAND_U800 = 8 172MM_MODEM_BAND_U850 = 9 173MM_MODEM_BAND_U900 = 10 174MM_MODEM_BAND_U17IX = 11 175MM_MODEM_BAND_U1900 = 12 176MM_MODEM_BAND_U2600 = 13 177# LTE bands 178MM_MODEM_BAND_EUTRAN_I = 31 179MM_MODEM_BAND_EUTRAN_II = 32 180MM_MODEM_BAND_EUTRAN_III = 33 181MM_MODEM_BAND_EUTRAN_IV = 34 182MM_MODEM_BAND_EUTRAN_V = 35 183MM_MODEM_BAND_EUTRAN_VI = 36 184MM_MODEM_BAND_EUTRAN_VII = 37 185MM_MODEM_BAND_EUTRAN_VIII = 38 186MM_MODEM_BAND_EUTRAN_IX = 39 187MM_MODEM_BAND_EUTRAN_X = 40 188MM_MODEM_BAND_EUTRAN_XI = 41 189MM_MODEM_BAND_EUTRAN_XII = 42 190MM_MODEM_BAND_EUTRAN_XIII = 43 191MM_MODEM_BAND_EUTRAN_XIV = 44 192MM_MODEM_BAND_EUTRAN_XVII = 47 193MM_MODEM_BAND_EUTRAN_XVIII = 48 194MM_MODEM_BAND_EUTRAN_XIX = 49 195MM_MODEM_BAND_EUTRAN_XX = 50 196MM_MODEM_BAND_EUTRAN_XXI = 51 197MM_MODEM_BAND_EUTRAN_XXII = 52 198MM_MODEM_BAND_EUTRAN_XXIII = 53 199MM_MODEM_BAND_EUTRAN_XXIV = 54 200MM_MODEM_BAND_EUTRAN_XXV = 55 201MM_MODEM_BAND_EUTRAN_XXVI = 56 202MM_MODEM_BAND_EUTRAN_XXXIII = 63 203MM_MODEM_BAND_EUTRAN_XXXIV = 64 204MM_MODEM_BAND_EUTRAN_XXXV = 65 205MM_MODEM_BAND_EUTRAN_XXXVI = 66 206MM_MODEM_BAND_EUTRAN_XXXVII = 67 207MM_MODEM_BAND_EUTRAN_XXXVIII = 68 208MM_MODEM_BAND_EUTRAN_XXXIX = 69 209MM_MODEM_BAND_EUTRAN_XL = 70 210MM_MODEM_BAND_EUTRAN_XLI = 71 211MM_MODEM_BAND_EUTRAN_XLII = 72 212MM_MODEM_BAND_EUTRAN_XLIII = 73 213# CDMA Band Classes (see 3GPP2 C.S0057-C) 214MM_MODEM_BAND_CDMA_BC0_CELLULAR_800 = 128 215MM_MODEM_BAND_CDMA_BC1_PCS_1900 = 129 216MM_MODEM_BAND_CDMA_BC2_TACS = 130 217MM_MODEM_BAND_CDMA_BC3_JTACS = 131 218MM_MODEM_BAND_CDMA_BC4_KOREAN_PCS = 132 219MM_MODEM_BAND_CDMA_BC5_NMT450 = 134 220MM_MODEM_BAND_CDMA_BC6_IMT2000 = 135 221MM_MODEM_BAND_CDMA_BC7_CELLULAR_700 = 136 222MM_MODEM_BAND_CDMA_BC8_1800 = 137 223MM_MODEM_BAND_CDMA_BC9_900 = 138 224MM_MODEM_BAND_CDMA_BC10_SECONDARY_800 = 139 225MM_MODEM_BAND_CDMA_BC11_PAMR_400 = 140 226MM_MODEM_BAND_CDMA_BC12_PAMR_800 = 141 227MM_MODEM_BAND_CDMA_BC13_IMT2000_2500 = 142 228MM_MODEM_BAND_CDMA_BC14_PCS2_1900 = 143 229MM_MODEM_BAND_CDMA_BC15_AWS = 144 230MM_MODEM_BAND_CDMA_BC16_US_2500 = 145 231MM_MODEM_BAND_CDMA_BC17_US_FLO_2500 = 146 232MM_MODEM_BAND_CDMA_BC18_US_PS_700 = 147 233MM_MODEM_BAND_CDMA_BC19_US_LOWER_700 = 148 234# All/Any 235MM_MODEM_BAND_ANY = 256 236 237# enum MMModemCapability 238MM_MODEM_CAPABILITY_NONE = 0 239MM_MODEM_CAPABILITY_POTS = 1 << 0 240MM_MODEM_CAPABILITY_CDMA_EVDO = 1 << 1 241MM_MODEM_CAPABILITY_GSM_UMTS = 1 << 2 242MM_MODEM_CAPABILITY_LTE = 1 << 3 243MM_MODEM_CAPABILITY_LTE_ADVANCED = 1 << 4 244MM_MODEM_CAPABILITY_IRIDIUM = 1 << 5 245 246# enum MMModemCdmaActivationState 247MM_MODEM_CDMA_ACTIVATION_STATE_UNKNOWN = 0 248MM_MODEM_CDMA_ACTIVATION_STATE_NOT_ACTIVATED = 1 249MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATING = 2 250MM_MODEM_CDMA_ACTIVATION_STATE_PARTIALLY_ACTIVATED = 3 251MM_MODEM_CDMA_ACTIVATION_STATE_ACTIVATED = 4 252 253# enum MMModemCdmaRegistrationState 254MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN = 0 255MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED = 1 256MM_MODEM_CDMA_REGISTRATION_STATE_HOME = 2 257MM_MODEM_CDMA_REGISTRATION_STATE_ROAMING = 3 258 259# enum MMModemCdmaRmProtocol 260MM_MODEM_CDMA_RM_PROTOCOL_UNKNOWN = 0 261MM_MODEM_CDMA_RM_PROTOCOL_ASYNC = 1 262MM_MODEM_CDMA_RM_PROTOCOL_PACKET_RELAY = 2 263MM_MODEM_CDMA_RM_PROTOCOL_PACKET_NETWORK_PPP = 3 264MM_MODEM_CDMA_RM_PROTOCOL_PACKET_NETWORK_SLIP = 4 265MM_MODEM_CDMA_RM_PROTOCOL_STU_III = 5 266 267# enum MMModemContactsStorage 268MM_MODEM_CONTACTS_STORAGE_UNKNOWN = 0 269MM_MODEM_CONTACTS_STORAGE_ME = 1 270MM_MODEM_CONTACTS_STORAGE_SM = 2 271MM_MODEM_CONTACTS_STORAGE_MT = 3 272 273# enum MMModemLocationSource 274MM_MODEM_LOCATION_SOURCE_NONE = 0 275MM_MODEM_LOCATION_SOURCE_3GPP_LAC_CI = 1 << 0 276MM_MODEM_LOCATION_SOURCE_GPS_RAW = 1 << 1 277MM_MODEM_LOCATION_SOURCE_GPS_NMEA = 1 << 2 278 279# enum MMModemLock 280MM_MODEM_LOCK_UNKNOWN = 0 281MM_MODEM_LOCK_NONE = 1 282MM_MODEM_LOCK_SIM_PIN = 2 283MM_MODEM_LOCK_SIM_PIN2 = 3 284MM_MODEM_LOCK_SIM_PUK = 4 285MM_MODEM_LOCK_SIM_PUK2 = 5 286MM_MODEM_LOCK_PH_SP_PIN = 6 287MM_MODEM_LOCK_PH_SP_PUK = 7 288MM_MODEM_LOCK_PH_NET_PIN = 8 289MM_MODEM_LOCK_PH_NET_PUK = 9 290MM_MODEM_LOCK_PH_SIM_PIN = 10 291MM_MODEM_LOCK_PH_CORP_PIN = 11 292MM_MODEM_LOCK_PH_CORP_PUK = 12 293MM_MODEM_LOCK_PH_FSIM_PIN = 13 294MM_MODEM_LOCK_PH_FSIM_PUK = 14 295MM_MODEM_LOCK_PH_NETSUB_PIN = 15 296MM_MODEM_LOCK_PH_NETSUB_PUK = 16 297 298# enum MMModemMode 299MM_MODEM_MODE_NONE = 0 300MM_MODEM_MODE_CS = 1 << 0 301MM_MODEM_MODE_2G = 1 << 1 302MM_MODEM_MODE_3G = 1 << 2 303MM_MODEM_MODE_4G = 1 << 3 304MM_MODEM_MODE_ANY = 0xFFFFFFFF 305 306# enum MMModemState 307MM_MODEM_STATE_FAILED = -1 308MM_MODEM_STATE_UNKNOWN = 0 309MM_MODEM_STATE_INITIALIZING = 1 310MM_MODEM_STATE_LOCKED = 2 311MM_MODEM_STATE_DISABLED = 3 312MM_MODEM_STATE_DISABLING = 4 313MM_MODEM_STATE_ENABLING = 5 314MM_MODEM_STATE_ENABLED = 6 315MM_MODEM_STATE_SEARCHING = 7 316MM_MODEM_STATE_REGISTERED = 8 317MM_MODEM_STATE_DISCONNECTING = 9 318MM_MODEM_STATE_CONNECTING = 10 319MM_MODEM_STATE_CONNECTED = 11 320 321def ModemStateToString(state): 322 """ 323 Returns a string for the given state. 324 325 @param state: MMModemState value. 326 327 @return A string that describes the given state. 328 329 """ 330 MODEM_STATE_STRINGS = [ 331 'FAILED', 332 'UNKNOWN', 333 'INITIALIZING', 334 'LOCKED', 335 'DISABLED', 336 'DISABLING', 337 'ENABLING', 338 'ENABLED', 339 'SEARCHING', 340 'REGISTERED', 341 'DISCONNECTING', 342 'CONNECTING', 343 'CONNECTED' 344 ] 345 return MODEM_STATE_STRINGS[state + 1] 346 347# enum MMModemPowerState 348MM_MODEM_POWER_STATE_UNKNOWN = 0 349MM_MODEM_POWER_STATE_OFF = 1 350MM_MODEM_POWER_STATE_LOW = 2 351MM_MODEM_POWER_STATE_ON = 3 352 353# enum MMModemStateChangeReason 354MM_MODEM_STATE_CHANGE_REASON_UNKNOWN = 0 355MM_MODEM_STATE_CHANGE_REASON_USER_REQUESTED = 1 356MM_MODEM_STATE_CHANGE_REASON_SUSPEND = 2 357 358# enum MMSmsState 359MM_SMS_STATE_UNKNOWN = 0 360MM_SMS_STATE_STORED = 1 361MM_SMS_STATE_RECEIVING = 2 362MM_SMS_STATE_RECEIVED = 3 363MM_SMS_STATE_SENDING = 4 364MM_SMS_STATE_SENT = 5 365 366# enum MMSmsStorage 367MM_SMS_STORAGE_UNKNOWN = 0 368MM_SMS_STORAGE_SM = 1 369MM_SMS_STORAGE_ME = 2 370MM_SMS_STORAGE_MT = 3 371MM_SMS_STORAGE_SR = 4 372MM_SMS_STORAGE_BM = 5 373MM_SMS_STORAGE_TA = 6 374 375# enum MMModemPortType 376MM_MODEM_PORT_TYPE_UNKNOWN = 1 377MM_MODEM_PORT_TYPE_NET = 2 378MM_MODEM_PORT_TYPE_AT = 3 379MM_MODEM_PORT_TYPE_QCDM = 4 380MM_MODEM_PORT_TYPE_GPS = 5 381MM_MODEM_PORT_TYPE_QMI = 6 382MM_MODEM_PORT_TYPE_MBIM = 7 383 384# enum MMSmsPduType 385MM_SMS_PDU_TYPE_UNKNOWN = 0 386MM_SMS_PDU_TYPE_DELIVER = 1 387MM_SMS_PDU_TYPE_SUBMIT = 2 388MM_SMS_PDU_TYPE_STATUS_REPORT = 3 389 390# enum MMSmsDeliveryState 391MM_SMS_DELIVERY_STATE_UNKNOWN = 0x100 392 393# enum MMSmsValidityType 394MM_SMS_VALIDITY_TYPE_UNKNOWN = 0 395MM_SMS_VALIDITY_TYPE_RELATIVE = 1 396MM_SMS_VALIDITY_TYPE_ABSOLUTE = 2 397MM_SMS_VALIDITY_TYPE_ENHANCED = 3 398