CapInfo.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.common;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21import android.util.Log;
22
23/** Class for capability discovery information.
24 *  @hide */
25public class CapInfo implements Parcelable {
26
27    /** IM session support. */
28    private boolean mImSupported = false;
29    /** File transfer support. */
30    private boolean mFtSupported = false;
31    /** File transfer Thumbnail support. */
32    private boolean mFtThumbSupported = false;
33    /** File transfer Store and forward support. */
34    private boolean mFtSnFSupported = false;
35    /** File transfer HTTP support. */
36    private boolean mFtHttpSupported = false;
37    /** Image sharing support. */
38    private boolean mIsSupported = false;
39    /** Video sharing during a CS call support -- IR-74. */
40    private boolean mVsDuringCSSupported = false;
41    /** Video sharing outside of voice call support -- IR-84. */
42    private boolean mVsSupported = false;
43    /** Social presence support. */
44    private boolean mSpSupported = false;
45    /** Presence discovery support. */
46    private boolean mCdViaPresenceSupported = false;
47    /** IP voice call support (IR-92/IR-58). */
48    private boolean mIpVoiceSupported = false;
49    /** IP video call support (IR-92/IR-58). */
50    private boolean mIpVideoSupported = false;
51    /** IP Geo location Pull using File Transfer support. */
52    private boolean mGeoPullFtSupported = false;
53    /** IP Geo location Pull support. */
54    private boolean mGeoPullSupported = false;
55    /** IP Geo location Push support. */
56    private boolean mGeoPushSupported = false;
57    /** Standalone messaging support. */
58    private boolean mSmSupported = false;
59    /** Full Store and Forward Group Chat information. */
60    private boolean mFullSnFGroupChatSupported = false;
61    /** RCS IP Voice call support .  */
62    private boolean mRcsIpVoiceCallSupported = false;
63    /** RCS IP Video call support .  */
64    private boolean mRcsIpVideoCallSupported = false;
65    /** RCS IP Video call support .  */
66    private boolean mRcsIpVideoOnlyCallSupported = false;
67    /** List of supported extensions. */
68    private String[] mExts = new String[10];
69    /** Time used to compute when to query again. */
70    private long mCapTimestamp = 0;
71
72
73    /**
74     * Constructor for the CapInfo class.
75     */
76    public CapInfo() {
77    };
78
79
80    /**
81     * Checks whether IM is supported.
82     */
83    public boolean isImSupported() {
84        return mImSupported;
85    }
86
87    /**
88     * Sets IM as supported or not supported.
89     */
90    public void setImSupported(boolean imSupported) {
91        this.mImSupported = imSupported;
92    }
93
94    /**
95     * Checks whether FT Thumbnail is supported.
96     */
97    public boolean isFtThumbSupported() {
98        return mFtThumbSupported;
99    }
100
101    /**
102     * Sets FT thumbnail as supported or not supported.
103     */
104    public void setFtThumbSupported(boolean ftThumbSupported) {
105        this.mFtThumbSupported = ftThumbSupported;
106    }
107
108
109
110    /**
111     * Checks whether FT Store and Forward is supported
112     */
113    public boolean isFtSnFSupported() {
114        return  mFtSnFSupported;
115    }
116
117    /**
118     * Sets FT Store and Forward as supported or not supported.
119     */
120    public void setFtSnFSupported(boolean  ftSnFSupported) {
121        this.mFtSnFSupported =  ftSnFSupported;
122    }
123
124   /**
125    * Checks whether File transfer HTTP is supported.
126    */
127   public boolean isFtHttpSupported() {
128       return  mFtHttpSupported;
129   }
130
131   /**
132    * Sets File transfer HTTP as supported or not supported.
133    */
134   public void setFtHttpSupported(boolean  ftHttpSupported) {
135       this.mFtHttpSupported =  ftHttpSupported;
136   }
137
138    /**
139     * Checks whether FT is supported.
140     */
141    public boolean isFtSupported() {
142        return mFtSupported;
143    }
144
145    /**
146     * Sets FT as supported or not supported.
147     */
148    public void setFtSupported(boolean ftSupported) {
149        this.mFtSupported = ftSupported;
150    }
151
152    /**
153     * Checks whether IS is supported.
154     */
155    public boolean isIsSupported() {
156        return mIsSupported;
157    }
158
159    /**
160     * Sets IS as supported or not supported.
161     */
162    public void setIsSupported(boolean isSupported) {
163        this.mIsSupported = isSupported;
164    }
165
166    /**
167     * Checks whether video sharing is supported during a CS call.
168     */
169    public boolean isVsDuringCSSupported() {
170        return mVsDuringCSSupported;
171    }
172
173    /**
174     *  Sets video sharing as supported or not supported during a CS
175     *  call.
176     */
177    public void setVsDuringCSSupported(boolean vsDuringCSSupported) {
178        this.mVsDuringCSSupported = vsDuringCSSupported;
179    }
180
181    /**
182     *  Checks whether video sharing outside a voice call is
183     *   supported.
184     */
185    public boolean isVsSupported() {
186        return mVsSupported;
187    }
188
189    /**
190     * Sets video sharing as supported or not supported.
191     */
192    public void setVsSupported(boolean vsSupported) {
193        this.mVsSupported = vsSupported;
194    }
195
196    /**
197     * Checks whether social presence is supported.
198     */
199    public boolean isSpSupported() {
200        return mSpSupported;
201    }
202
203    /**
204     * Sets social presence as supported or not supported.
205     */
206    public void setSpSupported(boolean spSupported) {
207        this.mSpSupported = spSupported;
208    }
209
210    /**
211     * Checks whether capability discovery via presence is
212     * supported.
213     */
214    public boolean isCdViaPresenceSupported() {
215        return mCdViaPresenceSupported;
216    }
217
218    /**
219     * Sets capability discovery via presence as supported or not
220     * supported.
221     */
222    public void setCdViaPresenceSupported(boolean cdViaPresenceSupported) {
223        this.mCdViaPresenceSupported = cdViaPresenceSupported;
224    }
225
226    /**
227     * Checks whether IP voice call is supported.
228     */
229    public boolean isIpVoiceSupported() {
230        return mIpVoiceSupported;
231    }
232
233    /**
234     * Sets IP voice call as supported or not supported.
235     */
236    public void setIpVoiceSupported(boolean ipVoiceSupported) {
237        this.mIpVoiceSupported = ipVoiceSupported;
238    }
239
240    /**
241     * Checks whether IP video call is supported.
242     */
243    public boolean isIpVideoSupported() {
244        return mIpVideoSupported;
245    }
246
247    /**
248     * Sets IP video call as supported or not supported.
249     */
250    public void setIpVideoSupported(boolean ipVideoSupported) {
251        this.mIpVideoSupported = ipVideoSupported;
252    }
253
254   /**
255    * Checks whether Geo location Pull using File Transfer is
256    * supported.
257    */
258   public boolean isGeoPullFtSupported() {
259       return mGeoPullFtSupported;
260   }
261
262   /**
263    * Sets Geo location Pull using File Transfer as supported or
264    * not supported.
265    */
266   public void setGeoPullFtSupported(boolean geoPullFtSupported) {
267       this.mGeoPullFtSupported = geoPullFtSupported;
268   }
269
270    /**
271     * Checks whether Geo Pull is supported.
272     */
273    public boolean isGeoPullSupported() {
274        return mGeoPullSupported;
275    }
276
277    /**
278     * Sets Geo Pull as supported or not supported.
279     */
280    public void setGeoPullSupported(boolean geoPullSupported) {
281        this.mGeoPullSupported = geoPullSupported;
282    }
283
284    /**
285     * Checks whether Geo Push is supported.
286     */
287    public boolean isGeoPushSupported() {
288        return mGeoPushSupported;
289    }
290
291    /**
292     * Sets Geo Push as supported or not supported.
293     */
294    public void setGeoPushSupported(boolean geoPushSupported) {
295        this.mGeoPushSupported = geoPushSupported;
296    }
297
298    /**
299     * Checks whether short messaging is supported.
300     */
301    public boolean isSmSupported() {
302        return mSmSupported;
303    }
304
305    /**
306     * Sets short messaging as supported or not supported.
307     */
308    public void setSmSupported(boolean smSupported) {
309        this.mSmSupported = smSupported;
310    }
311
312    /**
313     * Checks whether store/forward and group chat are supported.
314     */
315    public boolean isFullSnFGroupChatSupported() {
316        return mFullSnFGroupChatSupported;
317    }
318
319    public boolean isRcsIpVoiceCallSupported() {
320        return mRcsIpVoiceCallSupported;
321    }
322
323    public boolean isRcsIpVideoCallSupported() {
324        return mRcsIpVideoCallSupported;
325    }
326
327    public boolean isRcsIpVideoOnlyCallSupported() {
328        return mRcsIpVideoOnlyCallSupported;
329    }
330
331    /**
332     * Sets store/forward and group chat supported or not supported.
333     */
334    public void setFullSnFGroupChatSupported(boolean fullSnFGroupChatSupported) {
335        this.mFullSnFGroupChatSupported = fullSnFGroupChatSupported;
336    }
337
338    public void setRcsIpVoiceCallSupported(boolean rcsIpVoiceCallSupported) {
339        this.mRcsIpVoiceCallSupported = rcsIpVoiceCallSupported;
340    }
341    public void setRcsIpVideoCallSupported(boolean rcsIpVideoCallSupported) {
342        this.mRcsIpVideoCallSupported = rcsIpVideoCallSupported;
343    }
344    public void setRcsIpVideoOnlyCallSupported(boolean rcsIpVideoOnlyCallSupported) {
345        this.mRcsIpVideoOnlyCallSupported = rcsIpVideoOnlyCallSupported;
346    }
347
348    /** Gets the list of supported extensions. */
349    public String[] getExts() {
350        return mExts;
351    }
352
353    /** Sets the list of supported extensions. */
354    public void setExts(String[] exts) {
355        this.mExts = exts;
356    }
357
358
359    /** Gets the time stamp for when to query again. */
360    public long getCapTimestamp() {
361        return mCapTimestamp;
362    }
363
364    /** Sets the time stamp for when to query again. */
365    public void setCapTimestamp(long capTimestamp) {
366        this.mCapTimestamp = capTimestamp;
367    }
368
369    public int describeContents() {
370        // TODO Auto-generated method stub
371        return 0;
372    }
373
374    public void writeToParcel(Parcel dest, int flags) {
375
376        dest.writeInt(mImSupported ? 1 : 0);
377        dest.writeInt(mFtSupported ? 1 : 0);
378        dest.writeInt(mFtThumbSupported ? 1 : 0);
379        dest.writeInt(mFtSnFSupported ? 1 : 0);
380        dest.writeInt(mFtHttpSupported ? 1 : 0);
381        dest.writeInt(mIsSupported ? 1 : 0);
382        dest.writeInt(mVsDuringCSSupported ? 1 : 0);
383        dest.writeInt(mVsSupported ? 1 : 0);
384        dest.writeInt(mSpSupported ? 1 : 0);
385        dest.writeInt(mCdViaPresenceSupported ? 1 : 0);
386        dest.writeInt(mIpVoiceSupported ? 1 : 0);
387        dest.writeInt(mIpVideoSupported ? 1 : 0);
388        dest.writeInt(mGeoPullFtSupported ? 1 : 0);
389        dest.writeInt(mGeoPullSupported ? 1 : 0);
390        dest.writeInt(mGeoPushSupported ? 1 : 0);
391        dest.writeInt(mSmSupported ? 1 : 0);
392        dest.writeInt(mFullSnFGroupChatSupported ? 1 : 0);
393
394        dest.writeInt(mRcsIpVoiceCallSupported ? 1 : 0);
395        dest.writeInt(mRcsIpVideoCallSupported ? 1 : 0);
396        dest.writeInt(mRcsIpVideoOnlyCallSupported ? 1 : 0);
397        dest.writeStringArray(mExts);
398        dest.writeLong(mCapTimestamp);
399    }
400
401    public static final Parcelable.Creator<CapInfo> CREATOR = new Parcelable.Creator<CapInfo>() {
402
403        public CapInfo createFromParcel(Parcel source) {
404            return new CapInfo(source);
405        }
406
407        public CapInfo[] newArray(int size) {
408            return new CapInfo[size];
409        }
410    };
411
412    private CapInfo(Parcel source) {
413        readFromParcel(source);
414    }
415
416    public void readFromParcel(Parcel source) {
417
418        mImSupported = (source.readInt() == 0) ? false : true;
419        mFtSupported = (source.readInt() == 0) ? false : true;
420        mFtThumbSupported = (source.readInt() == 0) ? false : true;
421        mFtSnFSupported = (source.readInt() == 0) ? false : true;
422        mFtHttpSupported = (source.readInt() == 0) ? false : true;
423        mIsSupported = (source.readInt() == 0) ? false : true;
424        mVsDuringCSSupported = (source.readInt() == 0) ? false : true;
425        mVsSupported = (source.readInt() == 0) ? false : true;
426        mSpSupported = (source.readInt() == 0) ? false : true;
427        mCdViaPresenceSupported = (source.readInt() == 0) ? false : true;
428        mIpVoiceSupported = (source.readInt() == 0) ? false : true;
429        mIpVideoSupported = (source.readInt() == 0) ? false : true;
430        mGeoPullFtSupported = (source.readInt() == 0) ? false : true;
431        mGeoPullSupported = (source.readInt() == 0) ? false : true;
432        mGeoPushSupported = (source.readInt() == 0) ? false : true;
433        mSmSupported = (source.readInt() == 0) ? false : true;
434        mFullSnFGroupChatSupported = (source.readInt() == 0) ? false : true;
435
436        mRcsIpVoiceCallSupported = (source.readInt() == 0) ? false : true;
437        mRcsIpVideoCallSupported = (source.readInt() == 0) ? false : true;
438        mRcsIpVideoOnlyCallSupported = (source.readInt() == 0) ? false : true;
439
440        mExts = source.createStringArray();
441        mCapTimestamp = source.readLong();
442    }
443}
444