137409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt/*
237409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * Copyright (C) 2016 The Android Open Source Project
337409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt *
437409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * Licensed under the Apache License, Version 2.0 (the "License");
537409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * you may not use this file except in compliance with the License.
637409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * You may obtain a copy of the License at
737409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt *
837409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt *      http://www.apache.org/licenses/LICENSE-2.0
937409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt *
1037409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * Unless required by applicable law or agreed to in writing, software
1137409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * distributed under the License is distributed on an "AS IS" BASIS,
1237409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1337409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * See the License for the specific language governing permissions and
1437409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * limitations under the License.
1537409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt */
1637409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
1737409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwaltpackage android.telephony;
1837409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
1937409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwaltimport android.os.Parcel;
2037409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwaltimport android.os.Parcelable;
2137409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
2237409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt/**
2337409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * Contains Carrier-specific (and opaque) Protocol configuration Option
2437409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * Data.  In general this is only passed on to carrier-specific applications
2537409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * for interpretation.
2637409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt *
2737409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt * @hide
2837409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt */
2937409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwaltpublic class PcoData implements Parcelable {
3037409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
3137409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public final int cid;
3237409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public final String bearerProto;
3337409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public final int pcoId;
3437409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public final byte[] contents;
3537409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
3637409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public PcoData(int cid, String bearerProto, int pcoId, byte[]contents) {
3737409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        this.cid = cid;
3837409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        this.bearerProto = bearerProto;
3937409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        this.pcoId = pcoId;
4037409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        this.contents = contents;
4137409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    }
4237409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
4337409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public PcoData(Parcel in) {
4437409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        cid = in.readInt();
4537409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        bearerProto = in.readString();
4637409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        pcoId = in.readInt();
4737409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        contents = in.createByteArray();
4837409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    }
4937409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
5037409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    /**
5137409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt     * {@link Parcelable#writeToParcel}
5237409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt     */
5337409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public void writeToParcel(Parcel out, int flags) {
5437409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        out.writeInt(cid);
5537409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        out.writeString(bearerProto);
5637409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        out.writeInt(pcoId);
5737409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        out.writeByteArray(contents);
5837409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    }
5937409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
6037409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    /**
6137409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt     * {@link Parcelable#describeContents}
6237409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt     */
6337409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public int describeContents() {
6437409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        return 0;
6537409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    }
6637409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
6737409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    /**
6837409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt     * {@link Parcelable.Creator}
6937409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt     *
7037409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt     * @hide
7137409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt     */
7237409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public static final Parcelable.Creator<PcoData> CREATOR = new Parcelable.Creator() {
7337409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        public PcoData createFromParcel(Parcel in) {
7437409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt            return new PcoData(in);
7537409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        }
7637409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
7737409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        public PcoData[] newArray(int size) {
7837409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt            return new PcoData[size];
7937409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        }
8037409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    };
8137409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt
8237409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    @Override
8337409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    public String toString() {
8437409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt        return "PcoData(" + cid + ", " + bearerProto + ", " + pcoId + ", contents[" +
8537409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt                contents.length + "])";
8637409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt    }
8737409c574782d7cc0b877c386c1d45ba83a14925Robert Greenwalt}
88