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