Home | History | Annotate | Download | only in ims
      1 /*
      2  * Copyright (c) 2013 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.ims;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 
     22 /**
     23  * Provides the call forward information for the supplementary service configuration.
     24  *
     25  * @hide
     26  */
     27 public class ImsCallForwardInfo implements Parcelable {
     28     // Refer to ImsUtInterface#CDIV_CF_XXX
     29     public int mCondition;
     30     // 0: disabled, 1: enabled
     31     public int mStatus;
     32     // 0x91: International, 0x81: Unknown
     33     public int mToA;
     34     // Service class
     35     public int mServiceClass;
     36     // Number (it will not include the "sip" or "tel" URI scheme)
     37     public String mNumber;
     38     // No reply timer for CF
     39     public int mTimeSeconds;
     40 
     41     public ImsCallForwardInfo() {
     42     }
     43 
     44     public ImsCallForwardInfo(Parcel in) {
     45         readFromParcel(in);
     46     }
     47 
     48     @Override
     49     public int describeContents() {
     50         return 0;
     51     }
     52 
     53     @Override
     54     public void writeToParcel(Parcel out, int flags) {
     55         out.writeInt(mCondition);
     56         out.writeInt(mStatus);
     57         out.writeInt(mToA);
     58         out.writeString(mNumber);
     59         out.writeInt(mTimeSeconds);
     60         out.writeInt(mServiceClass);
     61     }
     62 
     63     @Override
     64     public String toString() {
     65         return super.toString() + ", Condition: " + mCondition
     66             + ", Status: " + ((mStatus == 0) ? "disabled" : "enabled")
     67             + ", ToA: " + mToA
     68             + ", Service Class: " + mServiceClass
     69             + ", Number=" + mNumber
     70             + ", Time (seconds): " + mTimeSeconds;
     71     }
     72 
     73     private void readFromParcel(Parcel in) {
     74         mCondition = in.readInt();
     75         mStatus = in.readInt();
     76         mToA = in.readInt();
     77         mNumber = in.readString();
     78         mTimeSeconds = in.readInt();
     79         mServiceClass = in.readInt();
     80     }
     81 
     82     public static final Creator<ImsCallForwardInfo> CREATOR =
     83             new Creator<ImsCallForwardInfo>() {
     84         @Override
     85         public ImsCallForwardInfo createFromParcel(Parcel in) {
     86             return new ImsCallForwardInfo(in);
     87         }
     88 
     89         @Override
     90         public ImsCallForwardInfo[] newArray(int size) {
     91             return new ImsCallForwardInfo[size];
     92         }
     93     };
     94 }
     95