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