1/*
2 * Copyright (C) 2007 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 com.android.internal.telephony.cat;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22abstract class ValueObject {
23    abstract ComprehensionTlvTag getTag();
24}
25
26/**
27 * Class for Command Detailes object of proactive commands from SIM.
28 * {@hide}
29 */
30class CommandDetails extends ValueObject implements Parcelable {
31    public boolean compRequired;
32    public int commandNumber;
33    public int typeOfCommand;
34    public int commandQualifier;
35
36    public ComprehensionTlvTag getTag() {
37        return ComprehensionTlvTag.COMMAND_DETAILS;
38    }
39
40    CommandDetails() {
41    }
42
43    public boolean compareTo(CommandDetails other) {
44        return (this.compRequired == other.compRequired &&
45                this.commandNumber == other.commandNumber &&
46                this.commandQualifier == other.commandQualifier &&
47                this.typeOfCommand == other.typeOfCommand);
48    }
49
50    public CommandDetails(Parcel in) {
51        compRequired = true;
52        commandNumber = in.readInt();
53        typeOfCommand = in.readInt();
54        commandQualifier = in.readInt();
55    }
56
57    public void writeToParcel(Parcel dest, int flags) {
58        dest.writeInt(commandNumber);
59        dest.writeInt(typeOfCommand);
60        dest.writeInt(commandQualifier);
61    }
62
63    public static final Parcelable.Creator<CommandDetails> CREATOR =
64                                new Parcelable.Creator<CommandDetails>() {
65        public CommandDetails createFromParcel(Parcel in) {
66            return new CommandDetails(in);
67        }
68
69        public CommandDetails[] newArray(int size) {
70            return new CommandDetails[size];
71        }
72    };
73
74    public int describeContents() {
75        return 0;
76    }
77
78    @Override
79    public String toString() {
80        return "CmdDetails: compRequired=" + compRequired +
81                " commandNumber=" + commandNumber +
82                " typeOfCommand=" + typeOfCommand +
83                " commandQualifier=" + commandQualifier;
84    }
85}
86
87class DeviceIdentities extends ValueObject {
88    public int sourceId;
89    public int destinationId;
90
91    ComprehensionTlvTag getTag() {
92        return ComprehensionTlvTag.DEVICE_IDENTITIES;
93    }
94}
95
96// Container class to hold icon identifier value.
97class IconId extends ValueObject {
98    int recordNumber;
99    boolean selfExplanatory;
100
101    ComprehensionTlvTag getTag() {
102        return ComprehensionTlvTag.ICON_ID;
103    }
104}
105
106// Container class to hold item icon identifier list value.
107class ItemsIconId extends ValueObject {
108    int [] recordNumbers;
109    boolean selfExplanatory;
110
111    ComprehensionTlvTag getTag() {
112        return ComprehensionTlvTag.ITEM_ICON_ID_LIST;
113    }
114}