Pavel Zhamaitsiak | cfedd20 | 2016-03-18 16:09:50 -0700 | [diff] [blame] | 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 | |
Mathew Inwood | 45321de | 2018-08-01 14:07:13 +0100 | [diff] [blame] | 19 | import android.annotation.UnsupportedAppUsage; |
Pavel Zhamaitsiak | cfedd20 | 2016-03-18 16:09:50 -0700 | [diff] [blame] | 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; |
Gnaneshwar Gatla | cd816ab | 2019-01-04 15:35:04 -0800 | [diff] [blame] | 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; |
Pavel Zhamaitsiak | cfedd20 | 2016-03-18 16:09:50 -0700 | [diff] [blame] | 71 | |
| 72 | |
| 73 | private int mStatusCode = UCE_SUCCESS; |
| 74 | |
| 75 | /** |
| 76 | * Constructor for the StatusCode class. |
| 77 | * @hide |
| 78 | */ |
Mathew Inwood | 45321de | 2018-08-01 14:07:13 +0100 | [diff] [blame] | 79 | @UnsupportedAppUsage |
Pavel Zhamaitsiak | cfedd20 | 2016-03-18 16:09:50 -0700 | [diff] [blame] | 80 | public StatusCode() {} |
| 81 | |
| 82 | /** |
| 83 | * Gets the status code. |
| 84 | * @hide |
| 85 | */ |
Mathew Inwood | 45321de | 2018-08-01 14:07:13 +0100 | [diff] [blame] | 86 | @UnsupportedAppUsage |
Pavel Zhamaitsiak | cfedd20 | 2016-03-18 16:09:50 -0700 | [diff] [blame] | 87 | public int getStatusCode() { |
| 88 | return mStatusCode; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * Sets the status code. |
| 93 | * @hide |
| 94 | */ |
Mathew Inwood | 45321de | 2018-08-01 14:07:13 +0100 | [diff] [blame] | 95 | @UnsupportedAppUsage |
Pavel Zhamaitsiak | cfedd20 | 2016-03-18 16:09:50 -0700 | [diff] [blame] | 96 | public void setStatusCode(int nStatusCode) { |
| 97 | this.mStatusCode = nStatusCode; |
| 98 | } |
| 99 | |
| 100 | /** @hide */ |
| 101 | public int describeContents() { |
| 102 | // TODO Auto-generated method stub |
| 103 | return 0; |
| 104 | } |
| 105 | |
| 106 | /** @hide */ |
| 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 */ |
| 127 | private StatusCode(Parcel source) { |
| 128 | readFromParcel(source); |
| 129 | } |
| 130 | |
| 131 | /** @hide */ |
| 132 | public void readFromParcel(Parcel source) { |
| 133 | mStatusCode = source.readInt(); |
| 134 | } |
| 135 | } |