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.compat.annotation.UnsupportedAppUsage;
20 import android.os.Parcel;
21 import android.os.Parcelable;
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      /** Service cannot support Invalid Feature Tag   */
67     public static final int UCE_INVALID_FEATURE_TAG = 15;
68     /** Service is Available   */
69     public static final int UCE_SERVICE_AVAILABLE = 16;
70 
71 
72     private int mStatusCode = UCE_SUCCESS;
73 
74     /**
75      * Constructor for the StatusCode class.
76      * @hide
77      */
78     @UnsupportedAppUsage
StatusCode()79     public StatusCode() {}
80 
81     /**
82      *  Gets the status code.
83      *  @hide
84      */
85     @UnsupportedAppUsage
getStatusCode()86     public int getStatusCode() {
87         return mStatusCode;
88     }
89 
90     /**
91      *  Sets the status code.
92      *  @hide
93      */
94     @UnsupportedAppUsage
setStatusCode(int nStatusCode)95     public void setStatusCode(int nStatusCode) {
96         this.mStatusCode = nStatusCode;
97     }
98 
99     /** @hide */
describeContents()100     public int describeContents() {
101         // TODO Auto-generated method stub
102         return 0;
103     }
104 
105     /** @hide */
writeToParcel(Parcel dest, int flags)106     public void writeToParcel(Parcel dest, int flags) {
107         dest.writeInt(mStatusCode);
108     }
109 
110     /** @hide */
111     public static final Parcelable.Creator<StatusCode> CREATOR =
112                                       new Parcelable.Creator<StatusCode>() {
113 
114         public StatusCode createFromParcel(Parcel source) {
115             // TODO Auto-generated method stub
116             return new StatusCode(source);
117         }
118 
119         public StatusCode[] newArray(int size) {
120             // TODO Auto-generated method stub
121             return new StatusCode[size];
122         }
123     };
124 
125     /** @hide */
StatusCode(Parcel source)126     private StatusCode(Parcel source) {
127         readFromParcel(source);
128     }
129 
130     /** @hide */
readFromParcel(Parcel source)131     public void readFromParcel(Parcel source) {
132         mStatusCode = source.readInt();
133     }
134 }
135