CdmaSmsAddress.java revision baae313f896d8048f23e4acc76e554c8aa4667bd
1/* 2 * Copyright (C) 2008 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.internal.telephony.cdma.sms; 18 19import com.android.internal.telephony.SmsAddress; 20import com.android.internal.util.HexDump; 21 22public class CdmaSmsAddress extends SmsAddress { 23 24 /** 25 * Digit Mode Indicator is a 1-bit value that indicates whether 26 * the address digits are 4-bit DTMF codes or 8-bit codes. (See 27 * 3GPP2 C.S0015-B, v2, 3.4.3.3) 28 */ 29 static public final int DIGIT_MODE_4BIT_DTMF = 0x00; 30 static public final int DIGIT_MODE_8BIT_CHAR = 0x01; 31 32 public byte digitMode; 33 34 /** 35 * Number Mode Indicator is 1-bit value that indicates whether the 36 * address type is a data network address or not. (See 3GPP2 37 * C.S0015-B, v2, 3.4.3.3) 38 */ 39 static public final int NUMBER_MODE_NOT_DATA_NETWORK = 0x00; 40 static public final int NUMBER_MODE_DATA_NETWORK = 0x01; 41 42 public byte numberMode; 43 44 /** 45 * Number Types for data networks. 46 * (See 3GPP2 C.S0015-B, v2, 3.4.3.3) 47 * NOTE: value is stored in the parent class ton field. 48 */ 49 static public final int TON_UNKNOWN = 0x00; 50 static public final int TON_INTERNATIONAL_OR_IP = 0x01; 51 static public final int TON_NATIONAL_OR_EMAIL = 0x02; 52 static public final int TON_NETWORK = 0x03; 53 static public final int TON_SUBSCRIBER = 0x04; 54 static public final int TON_ALPHANUMERIC = 0x05; 55 static public final int TON_ABBREVIATED = 0x06; 56 static public final int TON_RESERVED = 0x07; 57 58 /** 59 * Maximum lengths for fields as defined in ril_cdma_sms.h. 60 */ 61 static public final int SMS_ADDRESS_MAX = 36; 62 static public final int SMS_SUBADDRESS_MAX = 36; 63 64 /** 65 * This field shall be set to the number of address digits 66 * (See 3GPP2 C.S0015-B, v2, 3.4.3.3) 67 */ 68 public byte numberOfDigits; 69 70 /** 71 * Numbering Plan identification is a 0 or 4-bit value that 72 * indicates which numbering plan identification is set. (See 73 * 3GPP2, C.S0015-B, v2, 3.4.3.3 and C.S005-D, table2.7.1.3.2.4-3) 74 */ 75 static public final int NUMBERING_PLAN_UNKNOWN = 0x0; 76 static public final int NUMBERING_PLAN_ISDN_TELEPHONY = 0x1; 77 //static protected final int NUMBERING_PLAN_DATA = 0x3; 78 //static protected final int NUMBERING_PLAN_TELEX = 0x4; 79 //static protected final int NUMBERING_PLAN_PRIVATE = 0x9; 80 81 public byte numberPlan; 82 83 /** 84 * NOTE: the parsed string address and the raw byte array values 85 * are stored in the parent class address and origBytes fields, 86 * respectively. 87 */ 88 89 public CdmaSmsAddress(){ 90 } 91 92 @Override 93 public String toString() { 94 StringBuilder builder = new StringBuilder(); 95 builder.append("CdmaSmsAddress "); 96 builder.append("{ digitMode=" + digitMode); 97 builder.append(", numberMode=" + numberMode); 98 builder.append(", numberPlan=" + numberPlan); 99 builder.append(", numberOfDigits=" + numberOfDigits); 100 builder.append(", ton=" + ton); 101 builder.append(", address=" + address); 102 builder.append(", origBytes=" + HexDump.toHexString(origBytes)); 103 builder.append(" }"); 104 return builder.toString(); 105 } 106 107} 108