summaryrefslogtreecommitdiffstats
path: root/telephony/java/android/telephony/cdma/CdmaSmsCbProgramResults.java
blob: 68bfa3ce9016d46a8dc39262120f482c56bda192 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/*
 * Copyright (C) 2012 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.telephony.cdma;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * CDMA Service Category Program Results from SCPT teleservice SMS.
 *
 * {@hide}
 */
public class CdmaSmsCbProgramResults implements Parcelable {

    /** Program result: success. */
    public static final int RESULT_SUCCESS                  = 0;

    /** Program result: memory limit exceeded. */
    public static final int RESULT_MEMORY_LIMIT_EXCEEDED    = 1;

    /** Program result: limit exceeded. */
    public static final int RESULT_CATEGORY_LIMIT_EXCEEDED  = 2;

    /** Program result: category already opted in. */
    public static final int RESULT_CATEGORY_ALREADY_ADDED   = 3;

    /** Program result: category already opted in. */
    public static final int RESULT_CATEGORY_ALREADY_DELETED = 4;

    /** Program result: invalid MAX_MESSAGES. */
    public static final int RESULT_INVALID_MAX_MESSAGES     = 5;

    /** Program result: invalid ALERT_OPTION. */
    public static final int RESULT_INVALID_ALERT_OPTION     = 6;

    /** Program result: invalid service category name. */
    public static final int RESULT_INVALID_CATEGORY_NAME    = 7;

    /** Program result: unspecified programming failure. */
    public static final int RESULT_UNSPECIFIED_FAILURE      = 8;

    /** Service category to modify. */
    private final int mCategory;

    /** Language used for service category name (defined in BearerData.LANGUAGE_*). */
    private final int mLanguage;

    /** Result of service category programming for this category. */
    private final int mCategoryResult;

    /** Create a new CdmaSmsCbProgramResults object with the specified values. */
    public CdmaSmsCbProgramResults(int category, int language, int categoryResult) {
        mCategory = category;
        mLanguage = language;
        mCategoryResult = categoryResult;
    }

    /** Create a new CdmaSmsCbProgramResults object from a Parcel. */
    CdmaSmsCbProgramResults(Parcel in) {
        mCategory = in.readInt();
        mLanguage = in.readInt();
        mCategoryResult = in.readInt();
    }

    /**
     * Flatten this object into a Parcel.
     *
     * @param dest  The Parcel in which the object should be written.
     * @param flags Additional flags about how the object should be written (ignored).
     */
    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(mCategory);
        dest.writeInt(mLanguage);
        dest.writeInt(mCategoryResult);
    }

    /**
     * Returns the CDMA service category to modify.
     * @return a 16-bit CDMA service category value
     */
    public int getCategory() {
        return mCategory;
    }

    /**
     * Returns the CDMA language code for this service category.
     * @return one of the language values defined in BearerData.LANGUAGE_*
     */
    public int getLanguage() {
        return mLanguage;
    }

    /**
     * Returns the result of service programming for this category
     * @return the result of service programming for this category
     */
    public int getCategoryResult() {
        return mCategoryResult;
    }

    @Override
    public String toString() {
        return "CdmaSmsCbProgramResults{category=" + mCategory
                + ", language=" + mLanguage + ", result=" + mCategoryResult + '}';
    }

    /**
     * Describe the kinds of special objects contained in the marshalled representation.
     * @return a bitmask indicating this Parcelable contains no special objects
     */
    @Override
    public int describeContents() {
        return 0;
    }

    /** Creator for unparcelling objects. */
    public static final Parcelable.Creator<CdmaSmsCbProgramResults>
            CREATOR = new Parcelable.Creator<CdmaSmsCbProgramResults>() {
        @Override
        public CdmaSmsCbProgramResults createFromParcel(Parcel in) {
            return new CdmaSmsCbProgramResults(in);
        }

        @Override
        public CdmaSmsCbProgramResults[] newArray(int size) {
            return new CdmaSmsCbProgramResults[size];
        }
    };
}