1#!/usr/bin/env python2
2
3# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7"""Python bindings of ModemManager1 DBUS constants."""
8
9from dbus.exceptions import DBusException
10
11# The root object
12OMM = '/org/freedesktop/ModemManager1'
13
14# Interfaces
15OFDOM = 'org.freedesktop.DBus.ObjectManager'
16MODEM_MANAGER_INTERFACE = 'org.freedesktop.ModemManager1'
17MODEM_INTERFACE = MODEM_MANAGER_INTERFACE + '.Modem'
18MODEM_MODEM3GPP_INTERFACE = MODEM_INTERFACE + '.Modem3gpp'
19MODEM_SIMPLE_INTERFACE = MODEM_INTERFACE + '.Simple'
20MODEM_MODEMCDMA_INTERFACE = MODEM_INTERFACE + '.Cdma'
21MODEM_MESSAGING_INTERFACE = MODEM_INTERFACE + '.Messaging'
22SIM_INTERFACE = MODEM_MANAGER_INTERFACE + '.Sim'
23SMS_INTERFACE = MODEM_MANAGER_INTERFACE + '.Sms'
24
25# Modem States from Modemmanager-enums.h
26MM_MODEM_STATE_FAILED = -1
27MM_MODEM_STATE_UNKNOWN = 0
28MM_MODEM_STATE_INITIALIZING = 1
29MM_MODEM_STATE_LOCKED = 2
30MM_MODEM_STATE_DISABLED = 3
31MM_MODEM_STATE_DISABLING = 4
32MM_MODEM_STATE_ENABLING = 5
33MM_MODEM_STATE_ENABLED = 6
34MM_MODEM_STATE_SEARCHING = 7
35MM_MODEM_STATE_REGISTERED = 8
36MM_MODEM_STATE_DISCONNECTING = 9
37MM_MODEM_STATE_CONNECTING = 10
38MM_MODEM_STATE_CONNECTED = 11
39
40# State Change Reasons
41MM_MODEM_STATE_CHANGE_REASON_UNKNOWN = 0
42MM_MODEM_STATE_CHANGE_REASON_USER_REQUESTED = 1
43MM_MODEM_STATE_CHANGE_REASON_SUSPEND = 2
44
45# List of GSM Registration Status
46MM_MODEM_3GPP_REGISTRATION_STATE_IDLE = 0
47MM_MODEM_3GPP_REGISTRATION_STATE_HOME = 1
48MM_MODEM_3GPP_REGISTRATION_STATE_SEARCHING = 2
49MM_MODEM_3GPP_REGISTRATION_STATE_DENIED = 3
50MM_MODEM_3GPP_REGISTRATION_STATE_UNKNOWN = 4
51MM_MODEM_3GPP_REGISTRATION_STATE_ROAMING = 5
52
53# Property Names
54MM_MODEM_PROPERTY_STATE = 'State'
55MM_MODEM3GPP_PROPERTY_REGISTRATION_STATE = 'RegistrationState'
56
57
58class ConnectionUnknownError(DBusException):
59    _dbus_error_name = MODEM_MANAGER_INTERFACE + '.Connection.Unknown'
60    include_traceback = False
61
62
63class ServiceOptionNotSubscribedError(DBusException):
64    _dbus_error_name = (
65        MODEM_MANAGER_INTERFACE +
66        '.MobileEquipment.Connect.Gprs.ServiceOptionNotSubscribed')
67    include_traceback = False
68
69
70class NoNetworkError(DBusException):
71    _dbus_error_name = (
72        MODEM_MANAGER_INTERFACE + '.MobileEquipment.Connect.NoNetwork')
73    include_traceback = False
74
75
76class CoreUnsupportedError(DBusException):
77    _dbus_error_name = MODEM_MANAGER_INTERFACE + '.Core.Unsupported'
78    include_traceback = False
79