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