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 = in.readInt() != 0; 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(compRequired ? 1 : 0); 59 dest.writeInt(commandNumber); 60 dest.writeInt(typeOfCommand); 61 dest.writeInt(commandQualifier); 62 } 63 64 public static final Parcelable.Creator<CommandDetails> CREATOR = 65 new Parcelable.Creator<CommandDetails>() { 66 public CommandDetails createFromParcel(Parcel in) { 67 return new CommandDetails(in); 68 } 69 70 public CommandDetails[] newArray(int size) { 71 return new CommandDetails[size]; 72 } 73 }; 74 75 public int describeContents() { 76 return 0; 77 } 78 79 @Override 80 public String toString() { 81 return "CmdDetails: compRequired=" + compRequired + 82 " commandNumber=" + commandNumber + 83 " typeOfCommand=" + typeOfCommand + 84 " commandQualifier=" + commandQualifier; 85 } 86} 87 88class DeviceIdentities extends ValueObject { 89 public int sourceId; 90 public int destinationId; 91 92 ComprehensionTlvTag getTag() { 93 return ComprehensionTlvTag.DEVICE_IDENTITIES; 94 } 95} 96 97// Container class to hold icon identifier value. 98class IconId extends ValueObject { 99 int recordNumber; 100 boolean selfExplanatory; 101 102 ComprehensionTlvTag getTag() { 103 return ComprehensionTlvTag.ICON_ID; 104 } 105} 106 107// Container class to hold item icon identifier list value. 108class ItemsIconId extends ValueObject { 109 int [] recordNumbers; 110 boolean selfExplanatory; 111 112 ComprehensionTlvTag getTag() { 113 return ComprehensionTlvTag.ITEM_ICON_ID_LIST; 114 } 115} 116