Home | History | Annotate | Download | only in stk
      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.gsm.stk;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 
     22 abstract class ValueObject {
     23     abstract ComprehensionTlvTag getTag();
     24 }
     25 
     26 /**
     27  * Class for Command Detailes 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     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 
     79 class DeviceIdentities extends ValueObject {
     80     public int sourceId;
     81     public int destinationId;
     82 
     83     ComprehensionTlvTag getTag() {
     84         return ComprehensionTlvTag.DEVICE_IDENTITIES;
     85     }
     86 }
     87 
     88 // Container class to hold icon identifier value.
     89 class IconId extends ValueObject {
     90     int recordNumber;
     91     boolean selfExplanatory;
     92 
     93     ComprehensionTlvTag getTag() {
     94         return ComprehensionTlvTag.ICON_ID;
     95     }
     96 }
     97 
     98 // Container class to hold item icon identifier list value.
     99 class ItemsIconId extends ValueObject {
    100     int [] recordNumbers;
    101     boolean selfExplanatory;
    102 
    103     ComprehensionTlvTag getTag() {
    104         return ComprehensionTlvTag.ITEM_ICON_ID_LIST;
    105     }
    106 }