1/*
2 * Copyright (C) 2008 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
17package android.telephony;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/**
23 * CellIdentity is to represent a unique LTE cell
24 *
25 * @hide pending API review
26 */
27public final class LteCellIdentity extends CellIdentity implements Parcelable {
28
29    // 3-digit Mobile Country Code, 0..999
30    private final int mMcc;
31    // 2 or 3-digit Mobile Network Code, 0..999
32    private final int mMnc;
33    // 28-bit cell identity
34    private final int mCi;
35    // physical cell id 0..503
36    private final int mPci;
37    // 16-bit tracking area code
38    private final int mTac;
39
40    /**
41     *
42     * @param mcc 3-digit Mobile Country Code, 0..999
43     * @param mnc 2 or 3-digit Mobile Network Code, 0..999
44     * @param ci 28-bit Cell Identity
45     * @param pci Physical Cell Id 0..503
46     * @param tac 16-bit Tracking Area Code
47     * @param attr is comma separated âkey=valueâ attribute pairs.
48     */
49    public LteCellIdentity (int mcc, int mnc,
50            int ci, int pci, int tac, String attr) {
51        super(CELLID_TYPE_CDMA, attr);
52        mMcc = mcc;
53        mMnc = mnc;
54        mCi = ci;
55        mPci = pci;
56        mTac = tac;
57    }
58
59    private LteCellIdentity(Parcel in) {
60        super(in);
61        mMcc = in.readInt();
62        mMnc = in.readInt();
63        mCi = in.readInt();
64        mPci = in.readInt();
65        mTac = in.readInt();
66    }
67
68    LteCellIdentity(LteCellIdentity cid) {
69        super(cid);
70        mMcc = cid.mMcc;
71        mMnc = cid.mMnc;
72        mCi = cid.mCi;
73        mPci = cid.mPci;
74        mTac = cid.mTac;
75    }
76
77    /**
78     * @return 3-digit Mobile Country Code, 0..999
79     */
80    public int getMcc() {
81        return mMcc;
82    }
83
84    /**
85     * @return 2 or 3-digit Mobile Network Code, 0..999
86     */
87    public int getMnc() {
88        return mMnc;
89    }
90
91    /**
92     * @return 28-bit Cell Identity
93     */
94    public int getCi() {
95        return mCi;
96    }
97
98    /**
99     * @return Physical Cell Id 0..503
100     */
101    public int getPci() {
102        return mPci;
103    }
104
105    /**
106     * @return 16-bit Tracking Area Code
107     */
108    public int getTac() {
109        return mTac;
110    }
111
112    /** Implement the Parcelable interface {@hide} */
113    @Override
114    public int describeContents() {
115        return 0;
116    }
117
118    /** Implement the Parcelable interface {@hide} */
119    @Override
120    public void writeToParcel(Parcel dest, int flags) {
121        super.writeToParcel(dest, flags);
122        dest.writeInt(mMcc);
123        dest.writeInt(mMnc);
124        dest.writeInt(mCi);
125        dest.writeInt(mPci);
126        dest.writeInt(mTac);
127    }
128
129    /** Implement the Parcelable interface {@hide} */
130    public static final Creator<LteCellIdentity> CREATOR =
131            new Creator<LteCellIdentity>() {
132        @Override
133        public LteCellIdentity createFromParcel(Parcel in) {
134            return new LteCellIdentity(in);
135        }
136
137        @Override
138        public LteCellIdentity[] newArray(int size) {
139            return new LteCellIdentity[size];
140        }
141    };
142}
143