1 /*
2  * Copyright (C) 2012 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.internal.telephony;
17 
18 import com.android.internal.util.Protocol;
19 
20 /**
21  * @hide
22  */
23 public class DctConstants {
24     /**
25      * IDLE: ready to start data connection setup, default state
26      * CONNECTING: state of issued startPppd() but not finish yet
27      * RETRYING: data connection fails with one apn but other apns are available
28      *           ready to start data connection on other apns (before INITING)
29      * CONNECTED: IP connection is setup
30      * DISCONNECTING: Connection.disconnect() has been called, but PDP
31      *                context is not yet deactivated
32      * FAILED: data connection fail for all apns settings
33      * RETRYING: data connection failed but we're going to retry.
34      *
35      * getDataConnectionState() maps State to DataState
36      *      FAILED or IDLE : DISCONNECTED
37      *      RETRYING or CONNECTING: CONNECTING
38      *      CONNECTED : CONNECTED or DISCONNECTING
39      */
40     public enum State {
41         IDLE,
42         CONNECTING,
43         RETRYING,
44         CONNECTED,
45         DISCONNECTING,
46         FAILED,
47     }
48 
49     public enum Activity {
50         NONE,
51         DATAIN,
52         DATAOUT,
53         DATAINANDOUT,
54         DORMANT
55     }
56 
57     /***** Event Codes *****/
58     public static final int BASE = Protocol.BASE_DATA_CONNECTION_TRACKER;
59     public static final int EVENT_DATA_SETUP_COMPLETE = BASE + 0;
60     public static final int EVENT_RADIO_AVAILABLE = BASE + 1;
61     public static final int EVENT_RECORDS_LOADED = BASE + 2;
62     public static final int EVENT_TRY_SETUP_DATA = BASE + 3;
63     public static final int EVENT_RADIO_OFF_OR_NOT_AVAILABLE = BASE + 6;
64     public static final int EVENT_VOICE_CALL_STARTED = BASE + 7;
65     public static final int EVENT_VOICE_CALL_ENDED = BASE + 8;
66     public static final int EVENT_DATA_CONNECTION_DETACHED = BASE + 9;
67     public static final int EVENT_ROAMING_ON = BASE + 11;
68     public static final int EVENT_ROAMING_OFF = BASE + 12;
69     public static final int EVENT_ENABLE_APN = BASE + 13;
70     public static final int EVENT_DISABLE_APN = BASE + 14;
71     public static final int EVENT_DISCONNECT_DONE = BASE + 15;
72     public static final int EVENT_DATA_CONNECTION_ATTACHED = BASE + 16;
73     public static final int EVENT_DATA_STALL_ALARM = BASE + 17;
74     public static final int EVENT_DO_RECOVERY = BASE + 18;
75     public static final int EVENT_APN_CHANGED = BASE + 19;
76     public static final int EVENT_PS_RESTRICT_ENABLED = BASE + 22;
77     public static final int EVENT_PS_RESTRICT_DISABLED = BASE + 23;
78     public static final int EVENT_CLEAN_UP_CONNECTION = BASE + 24;
79     public static final int EVENT_RESTART_RADIO = BASE + 26;
80     public static final int EVENT_CLEAN_UP_ALL_CONNECTIONS = BASE + 29;
81     public static final int EVENT_ICC_CHANGED = BASE + 33;
82     public static final int EVENT_DATA_SETUP_COMPLETE_ERROR = BASE + 35;
83     public static final int CMD_SET_ENABLE_FAIL_FAST_MOBILE_DATA = BASE + 36;
84     public static final int CMD_ENABLE_MOBILE_PROVISIONING = BASE + 37;
85     public static final int CMD_IS_PROVISIONING_APN = BASE + 38;
86     public static final int EVENT_PROVISIONING_APN_ALARM = BASE + 39;
87     public static final int CMD_NET_STAT_POLL = BASE + 40;
88     public static final int EVENT_DATA_RAT_CHANGED = BASE + 41;
89     public static final int CMD_CLEAR_PROVISIONING_SPINNER = BASE + 42;
90     public static final int EVENT_NETWORK_STATUS_CHANGED = BASE + 44;
91     public static final int EVENT_PCO_DATA_RECEIVED = BASE + 45;
92     public static final int EVENT_DATA_ENABLED_CHANGED = BASE + 46;
93     public static final int EVENT_DATA_RECONNECT = BASE + 47;
94     public static final int EVENT_ROAMING_SETTING_CHANGE = BASE + 48;
95     public static final int EVENT_DATA_SERVICE_BINDING_CHANGED = BASE + 49;
96     public static final int EVENT_DEVICE_PROVISIONED_CHANGE = BASE + 50;
97     public static final int EVENT_DATA_ENABLED_OVERRIDE_RULES_CHANGED = BASE + 51;
98 
99     /***** Constants *****/
100 
101     public static final int INVALID = -1;
102     public static final int DISABLED = 0;
103     public static final int ENABLED = 1;
104 
105     public static final String APN_TYPE_KEY = "apnType";
106     public static final String PROVISIONING_URL_KEY = "provisioningUrl";
107 }
108