1 /* 2 * Copyright (C) 2007 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.internal.telephony; 18 19 import android.compat.annotation.UnsupportedAppUsage; 20 import android.os.Build; 21 22 /** 23 * Object returned by the RIL upon successful completion of sendSMS. 24 * Contains message reference and ackPdu. 25 * 26 */ 27 public class SmsResponse { 28 public static final int NO_ERROR_CODE = -1; 29 30 /** Message reference of the just-sent SMS. */ 31 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) 32 int mMessageRef; 33 /** ackPdu for the just-sent SMS. */ 34 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) 35 String mAckPdu; 36 /** 37 * errorCode: See 3GPP 27.005, 3.2.5 for GSM/UMTS, 38 * 3GPP2 N.S0005 (IS-41C) Table 171 for CDMA, -1 if unknown or not applicable. 39 */ 40 @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) 41 public int mErrorCode; 42 43 public long mMessageId; 44 45 @UnsupportedAppUsage SmsResponse(int messageRef, String ackPdu, int errorCode)46 public SmsResponse(int messageRef, String ackPdu, int errorCode) { 47 this(messageRef, ackPdu, errorCode, /* messageId= */ 0L); 48 } 49 SmsResponse(int messageRef, String ackPdu, int errorCode, long messageId)50 public SmsResponse(int messageRef, String ackPdu, int errorCode, long messageId) { 51 mMessageRef = messageRef; 52 mAckPdu = ackPdu; 53 mErrorCode = errorCode; 54 mMessageId = messageId; 55 } 56 57 @Override toString()58 public String toString() { 59 String ret = "{ mMessageRef = " + mMessageRef 60 + ", mErrorCode = " + mErrorCode 61 + ", mAckPdu = " + mAckPdu 62 + ", " + SmsController.formatCrossStackMessageId(mMessageId) + "}"; 63 return ret; 64 } 65 } 66