PresResInstanceInfo.java revision 7ed3044ed1c4777650d38775a5f26cb3396fab09
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; 21import java.util.Arrays; 22 23/** @hide */ 24public class PresResInstanceInfo implements Parcelable{ 25 26 /** 27 * UCE resource instance state definitions. 28 * @hide 29 */ 30 31 /** Active state. */ 32 public static final int UCE_PRES_RES_INSTANCE_STATE_ACTIVE = 0; 33 /** Pending state. */ 34 public static final int UCE_PRES_RES_INSTANCE_STATE_PENDING = 1; 35 /** Terminated state. */ 36 public static final int UCE_PRES_RES_INSTANCE_STATE_TERMINATED = 2; 37 /** Unknown state. */ 38 public static final int UCE_PRES_RES_INSTANCE_STATE_UNKNOWN = 3; 39 /** Unknown instance. */ 40 public static final int UCE_PRES_RES_INSTANCE_UNKNOWN = 4; 41 42 43 private int mResInstanceState; 44 private String mId = ""; 45 private String mReason = ""; 46 private String mPresentityUri = ""; 47 private PresTupleInfo mTupleInfoArray[]; 48 49 50 /** 51 * Gets the resource instance state. 52 * @hide 53 */ 54 public int getResInstanceState() { 55 return mResInstanceState; 56 } 57 58 /** 59 * Sets the resource instance state. 60 * @hide 61 */ 62 public void setResInstanceState(int nResInstanceState) { 63 this.mResInstanceState = nResInstanceState; 64 } 65 66 /** 67 * Gets the resource ID. 68 * @hide 69 */ 70 public String getResId() { 71 return mId; 72 } 73 74 /** 75 * Sets the resource ID. 76 * @hide 77 */ 78 public void setResId(String resourceId) { 79 this.mId = resourceId; 80 } 81 82 /** 83 * Gets the reason phrase associated with the SIP response 84 * code. 85 * @hide 86 */ 87 public String getReason() { 88 return mReason; 89 } 90 91 /** 92 * Sets the reason phrase associated with the SIP response 93 * code. 94 * @hide 95 */ 96 public void setReason(String reason) { 97 this.mReason = reason; 98 } 99 100 /** 101 * Gets the entity URI. 102 * @hide 103 */ 104 public String getPresentityUri() { 105 return mPresentityUri; 106 } 107 108 /** 109 * Sets the entity URI. 110 * @hide 111 */ 112 public void setPresentityUri(String presentityUri) { 113 this.mPresentityUri = presentityUri; 114 } 115 116 /** 117 * Gets the tuple information. 118 * @hide 119 */ 120 public PresTupleInfo[] getTupleInfo() { 121 return mTupleInfoArray; 122 } 123 124 /** 125 * Sets the tuple information. 126 * @hide 127 */ 128 public void setTupleInfo(PresTupleInfo[] tupleInfo) { 129 this.mTupleInfoArray = new PresTupleInfo[tupleInfo.length]; 130 this.mTupleInfoArray = tupleInfo; 131 } 132 133 134 /** 135 * Constructor for the PresResInstanceInfo class. 136 * @hide 137 */ 138 public PresResInstanceInfo(){ 139 140 }; 141 142 /** @hide */ 143 public int describeContents() { 144 145 return 0; 146 } 147 148 /** @hide */ 149 public void writeToParcel(Parcel dest, int flags) { 150 dest.writeString(mId); 151 dest.writeString(mReason); 152 dest.writeInt(mResInstanceState); 153 dest.writeString(mPresentityUri); 154 dest.writeParcelableArray(mTupleInfoArray, flags); 155 } 156 157 /** @hide */ 158 public static final Parcelable.Creator<PresResInstanceInfo> CREATOR = 159 new Parcelable.Creator<PresResInstanceInfo>() { 160 161 public PresResInstanceInfo createFromParcel(Parcel source) { 162 163 return new PresResInstanceInfo(source); 164 } 165 166 public PresResInstanceInfo[] newArray(int size) { 167 168 return new PresResInstanceInfo[size]; 169 } 170 }; 171 172 /** @hide */ 173 private PresResInstanceInfo(Parcel source) { 174 readFromParcel(source); 175 } 176 177 /** @hide */ 178 public void readFromParcel(Parcel source) { 179 mId = source.readString(); 180 mReason = source.readString(); 181 mResInstanceState = source.readInt(); 182 mPresentityUri = source.readString(); 183 Parcelable[] tempParcelableArray = source.readParcelableArray( 184 PresTupleInfo.class.getClassLoader()); 185 mTupleInfoArray = new PresTupleInfo[] {}; 186 if(tempParcelableArray != null) { 187 mTupleInfoArray = Arrays.copyOf(tempParcelableArray, tempParcelableArray.length, 188 PresTupleInfo[].class); 189 } 190 191 } 192}