1 /* 2 * Copyright (c) 2015, Motorola Mobility LLC 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are met: 7 * - Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * - Redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution. 12 * - Neither the name of Motorola Mobility nor the 13 * names of its contributors may be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MOTOROLA MOBILITY LLC BE LIABLE 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 26 * DAMAGE. 27 */ 28 29 package com.android.ims; 30 31 /** 32 * RcsPresenceListener is used by requestCapability and requestAvailability to return the 33 * status. The reqId which returned by requestCapability and requestAvailability can be 34 * used to match the result with request when share the implementation of IRcsPresenceListener. 35 * 36 * There are following normal cases: 37 * 1> The presence service got terminated notify after submitted the SUBSCRIBE request. 38 * onSuccess() ---> onFinish() 39 * 2> The presence service submitted the request to network and got "200 OK" for SIP response. 40 * but it didn't get "terminated notify" in expries + T1 timer. 41 * onSuccess() ---> onTimeout() 42 * 3> The presence service got error from SIP response for SUBSCRIBE request. 43 * onError() 44 * 45 * @hide 46 */ 47 interface IRcsPresenceListener { 48 /** 49 * It is called when it gets "200 OK" from network for SIP request or 50 * it gets "404 xxxx" for SIP request of single contact number (means not capable). 51 * 52 * @param reqId the request ID which returned by requestCapability or 53 * requestAvailability 54 * 55 * @see RcsPresence#requestCapability 56 * @see RcsPresence#requestAvailability 57 */ onSuccess(in int reqId)58 void onSuccess(in int reqId); 59 60 /** 61 * It is called when it gets local error or gets SIP error from network. 62 * 63 * @param reqId the request ID which returned by requestCapability or 64 * requestAvailability 65 * @param resultCode the result code which defined in RcsManager.ResultCode. 66 * 67 * @see RcsPresence#requestCapability 68 * @see RcsPresence#requestAvailability 69 * @see RcsManager.ResultCode 70 */ onError(in int reqId, in int resultCode)71 void onError(in int reqId, in int resultCode); 72 73 /** 74 * It is called when it gets the "terminated notify" from network. 75 * The presence service will not receive notify for the request any more after it got 76 * "terminated notify" from network. So onFinish means the requestCapability or 77 * requestAvailability had been finished completely. 78 * 79 * @param reqId the request ID which returned by requestCapability or 80 * requestAvailability 81 * 82 * @see RcsPresence#requestCapability 83 * @see RcsPresence#requestAvailability 84 */ onFinish(in int reqId)85 void onFinish(in int reqId); 86 87 /** 88 * It is called when it is timeout to wait for the "terminated notify" from network. 89 * 90 * @param reqId the request ID which returned by requestCapability or 91 * requestAvailability 92 * 93 * @see RcsPresence#requestCapability 94 * @see RcsPresence#requestAvailability 95 */ onTimeout(in int reqId)96 void onTimeout(in int reqId); 97 } 98