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
17package com.android.ims.internal.uce.presence;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/** @hide  */
23public class PresSipResponse implements Parcelable {
24
25    private PresCmdId mCmdId = new PresCmdId();
26    private int mRequestId = 0;
27    private int mSipResponseCode = 0;
28    private int mRetryAfter = 0;
29    private String mReasonPhrase = "";
30
31    /**
32     * Gets the Presence command ID.
33     * @hide
34     */
35    public PresCmdId getCmdId() {
36        return mCmdId;
37    }
38
39    /**
40     * Sets the Presence command ID.
41     * @hide
42     */
43    public void setCmdId(PresCmdId cmdId) {
44        this.mCmdId = cmdId;
45    }
46
47    /**
48     * Gets the request ID.
49     * @hide
50     */
51    public int getRequestId() {
52        return mRequestId;
53    }
54
55    /**
56     * Sets the request ID.
57     * @hide
58     */
59    public void setRequestId(int requestId) {
60        this.mRequestId = requestId;
61    }
62
63    /**
64     * Gets the SIP response code.
65     * @hide
66     */
67    public int getSipResponseCode() {
68        return mSipResponseCode;
69    }
70
71    /**
72     * Sets the SIP response code.
73     * @hide
74     */
75    public void setSipResponseCode(int sipResponseCode) {
76        this.mSipResponseCode = sipResponseCode;
77    }
78
79
80    /**
81     * Gets the reason phrase associated with the SIP responce
82     * code.
83     * @hide
84     */
85    public String getReasonPhrase() {
86        return mReasonPhrase;
87    }
88
89    /**
90     * Sets the SIP response code reason phrase.
91     * @hide
92     */
93    public void setReasonPhrase(String reasonPhrase) {
94        this.mReasonPhrase = reasonPhrase;
95    }
96
97    /**
98     * Gets the SIP retryAfter sec value.
99     * @hide
100     */
101    public int getRetryAfter() {
102        return mRetryAfter;
103    }
104
105    /**
106     * Sets the SIP retryAfter sec value
107     * @hide
108     */
109    public void setRetryAfter(int retryAfter) {
110        this.mRetryAfter = retryAfter;
111    }
112
113    /**
114     * Constructor for the PresSipResponse class.
115     * @hide
116     */
117    public PresSipResponse(){};
118
119    /** @hide */
120    public int describeContents() {
121        return 0;
122    }
123
124    /** @hide */
125    public void writeToParcel(Parcel dest, int flags) {
126        dest.writeInt(mRequestId);
127        dest.writeInt(mSipResponseCode);
128        dest.writeString(mReasonPhrase);
129        dest.writeParcelable(mCmdId, flags);
130        dest.writeInt(mRetryAfter);
131    }
132
133    /** @hide */
134    public static final Parcelable.Creator<PresSipResponse> CREATOR =
135                            new Parcelable.Creator<PresSipResponse>() {
136
137        public PresSipResponse createFromParcel(Parcel source) {
138            return new PresSipResponse(source);
139        }
140
141        public PresSipResponse[] newArray(int size) {
142            return new PresSipResponse[size];
143        }
144    };
145
146    /** @hide */
147    private PresSipResponse(Parcel source) {
148        readFromParcel(source);
149    }
150
151    /** @hide */
152    public void readFromParcel(Parcel source) {
153        mRequestId = source.readInt();
154        mSipResponseCode = source.readInt();
155        mReasonPhrase = source.readString();
156        mCmdId = source.readParcelable(PresCmdId.class.getClassLoader());
157        mRetryAfter = source.readInt();
158    }
159}