Home | History | Annotate | Download | only in common
      1 /*
      2  * Copyright (c) 2016 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.internal.uce.common;
     18 
     19 import android.os.Parcel;
     20 import android.os.Parcelable;
     21 import android.util.Log;
     22 
     23 
     24 /** Class for UCE status codes.
     25  *  @hide */
     26 public class StatusCode implements Parcelable {
     27 
     28     /**
     29      *  UCE status code definitions.
     30      *  @hide
     31      */
     32 
     33     /**  Request was processed successfully. */
     34     public static final int UCE_SUCCESS = 0;
     35     /**  Request was processed unsuccessfully. */
     36     public static final int UCE_FAILURE = 1;
     37     /**  Asynchronous request was handled successfully; the final
     38      *  result will be updated through
     39      *  callback.
     40      */
     41     public static final int UCE_SUCCESS_ASYC_UPDATE = 2;
     42     /**  Provided service handle is not valid. */
     43     public static final int UCE_INVALID_SERVICE_HANDLE = 3;
     44     /**  Provided listener handler is not valid. */
     45     public static final int UCE_INVALID_LISTENER_HANDLE = 4;
     46     /**  Invalid parameter(s). */
     47     public static final int UCE_INVALID_PARAM = 5;
     48     /**  Fetch error. */
     49     public static final int UCE_FETCH_ERROR = 6;
     50     /**  Request timed out. */
     51     public static final int UCE_REQUEST_TIMEOUT = 7;
     52     /**  Failure due to insufficient memory available. */
     53     public static final int UCE_INSUFFICIENT_MEMORY = 8;
     54     /**  Network connection is lost. */
     55     public static final int UCE_LOST_NET = 9;
     56     /**  Requested feature/resource is not supported. */
     57     public static final int UCE_NOT_SUPPORTED = 10;
     58     /**  Contact or resource is not found. */
     59     public static final int UCE_NOT_FOUND = 11;
     60     /**  Service is not available. */
     61     public static final int UCE_SERVICE_UNAVAILABLE = 12;
     62     /**  No Change in Capabilities */
     63     public static final int UCE_NO_CHANGE_IN_CAP = 13;
     64     /**  Service is unknown. */
     65     public static final int UCE_SERVICE_UNKNOWN = 14;
     66 
     67 
     68     private int mStatusCode = UCE_SUCCESS;
     69 
     70     /**
     71      * Constructor for the StatusCode class.
     72      * @hide
     73      */
     74     public StatusCode() {}
     75 
     76     /**
     77      *  Gets the status code.
     78      *  @hide
     79      */
     80     public int getStatusCode() {
     81         return mStatusCode;
     82     }
     83 
     84     /**
     85      *  Sets the status code.
     86      *  @hide
     87      */
     88     public void setStatusCode(int nStatusCode) {
     89         this.mStatusCode = nStatusCode;
     90     }
     91 
     92     /** @hide */
     93     public int describeContents() {
     94         // TODO Auto-generated method stub
     95         return 0;
     96     }
     97 
     98     /** @hide */
     99     public void writeToParcel(Parcel dest, int flags) {
    100         dest.writeInt(mStatusCode);
    101     }
    102 
    103     /** @hide */
    104     public static final Parcelable.Creator<StatusCode> CREATOR =
    105                                       new Parcelable.Creator<StatusCode>() {
    106 
    107         public StatusCode createFromParcel(Parcel source) {
    108             // TODO Auto-generated method stub
    109             return new StatusCode(source);
    110         }
    111 
    112         public StatusCode[] newArray(int size) {
    113             // TODO Auto-generated method stub
    114             return new StatusCode[size];
    115         }
    116     };
    117 
    118     /** @hide */
    119     private StatusCode(Parcel source) {
    120         readFromParcel(source);
    121     }
    122 
    123     /** @hide */
    124     public void readFromParcel(Parcel source) {
    125         mStatusCode = source.readInt();
    126     }
    127 }
    128