diff options
author | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-24 17:14:50 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2009-04-24 17:14:50 -0700 |
commit | f73eaf92e561eb0a010d05cc6357e172e8c9eaf7 (patch) | |
tree | af26de6da440119564cd940255b3d66bbd2ffc8c /telephony/java/com | |
parent | 9e8ca9a19c8625b22f37c2f8c0ac841d1f10d25a (diff) | |
parent | e66b5c43cb2d0aece7f4a636a2368a9c66c46cf5 (diff) | |
download | frameworks_base-f73eaf92e561eb0a010d05cc6357e172e8c9eaf7.zip frameworks_base-f73eaf92e561eb0a010d05cc6357e172e8c9eaf7.tar.gz frameworks_base-f73eaf92e561eb0a010d05cc6357e172e8c9eaf7.tar.bz2 |
Merge change 531 into donut
* changes:
Teleca 090414 & 090423 patches for CDMA to complete phase1 work.
Diffstat (limited to 'telephony/java/com')
-rw-r--r-- | telephony/java/com/android/internal/telephony/RIL.java | 51 | ||||
-rw-r--r-- | telephony/java/com/android/internal/telephony/cdma/SmsMessage.java | 75 |
2 files changed, 102 insertions, 24 deletions
diff --git a/telephony/java/com/android/internal/telephony/RIL.java b/telephony/java/com/android/internal/telephony/RIL.java index 289be6e..cebbe5c 100644 --- a/telephony/java/com/android/internal/telephony/RIL.java +++ b/telephony/java/com/android/internal/telephony/RIL.java @@ -234,6 +234,11 @@ public final class RIL extends BaseCommands implements CommandsInterface { static final int SOCKET_OPEN_RETRY_MILLIS = 4 * 1000; + // The number of the required config values for broadcast SMS stored in the C struct + // RIL_CDMA_BroadcastServiceInfo + private static final int CDMA_BSI_NO_OF_INTS_STRUCT = 3; + + private static final int CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES = 31; BroadcastReceiver mIntentReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { @@ -2017,7 +2022,7 @@ public final class RIL extends BaseCommands implements CommandsInterface { case RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret = responseInts(p); break; case RIL_REQUEST_CDMA_FLASH: ret = responseVoid(p); break; case RIL_REQUEST_CDMA_BURST_DTMF: ret = responseVoid(p); break; - case RIL_REQUEST_CDMA_SEND_SMS: ret = responseVoid(p); break; + case RIL_REQUEST_CDMA_SEND_SMS: ret = responseSMS(p); break; case RIL_REQUEST_CDMA_SMS_ACKNOWLEDGE: ret = responseVoid(p); break; case RIL_REQUEST_GET_BROADCAST_CONFIG: ret = responseBR_SMS_CNF(p); break; case RIL_REQUEST_SET_BROADCAST_CONFIG: ret = responseVoid(p); break; @@ -2738,16 +2743,37 @@ public final class RIL extends BaseCommands implements CommandsInterface { private Object responseCDMA_BR_CNF(Parcel p) { - int numInts; + int numServiceCategories; int response[]; - numInts = p.readInt(); - - response = new int[numInts]; - - response[0] = numInts; - for (int i = 1 ; i < numInts; i++) { - response[i] = p.readInt(); + numServiceCategories = p.readInt(); + + if (numServiceCategories == 0) { + int numInts; + numInts = CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES * CDMA_BSI_NO_OF_INTS_STRUCT + 1; + response = new int[numInts]; + + // indicate that a zero length table was received + response[0] = 0; + //for all supported service categories set 'english' as default language + //and selection status to false + for (int i = 1, j = 1 + ; i <= (CDMA_BROADCAST_SMS_NO_OF_SERVICE_CATEGORIES + * CDMA_BSI_NO_OF_INTS_STRUCT) + ; i += CDMA_BSI_NO_OF_INTS_STRUCT, j++ ) { + response[i] = j; + response[i+1] = 1; + response[i+2] = 0; + } + } else { + int numInts; + numInts = numServiceCategories * CDMA_BSI_NO_OF_INTS_STRUCT + 1; + response = new int[numInts]; + + response[0] = numServiceCategories; + for (int i = 1 ; i < numInts; i++) { + response[i] = p.readInt(); + } } return response; @@ -3036,10 +3062,13 @@ public final class RIL extends BaseCommands implements CommandsInterface { public void setCdmaBroadcastConfig(int[] configValuesArray, Message response) { RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG, response); - for(int i = 0; i < configValuesArray.length; i++) { + rr.mp.writeInt(configValuesArray[0]); + for(int i = 1; i <= (configValuesArray[0] * 3); i++) { rr.mp.writeInt(configValuesArray[i]); } + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + send(rr); } @@ -3049,6 +3078,8 @@ public final class RIL extends BaseCommands implements CommandsInterface { rr.mp.writeInt(1); rr.mp.writeInt(activate); + if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest)); + send(rr); } } diff --git a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java index 2f26bdc..6428e90 100644 --- a/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java +++ b/telephony/java/com/android/internal/telephony/cdma/SmsMessage.java @@ -135,6 +135,7 @@ public class SmsMessage extends SmsMessageBase { byte[] data; byte count; int countInt; + int addressDigitMode; //currently not supported by the modem-lib: env.mMessageType env.teleService = p.readInt(); //p_cur->uTeleserviceID @@ -153,7 +154,8 @@ public class SmsMessage extends SmsMessageBase { env.serviceCategory = p.readInt(); //p_cur->uServicecategory // address - addr.digitMode = (byte) (0xFF & p.readInt()); //p_cur->sAddress.digit_mode + addressDigitMode = p.readInt(); + addr.digitMode = (byte) (0xFF & addressDigitMode); //p_cur->sAddress.digit_mode addr.numberMode = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_mode addr.ton = p.readInt(); //p_cur->sAddress.number_type addr.numberPlan = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_plan @@ -163,7 +165,13 @@ public class SmsMessage extends SmsMessageBase { //p_cur->sAddress.digits[digitCount] for (int index=0; index < count; index++) { data[index] = p.readByte(); + + // convert the value if it is 4-bit DTMF to 8 bit + if (addressDigitMode == CdmaSmsAddress.DIGIT_MODE_4BIT_DTMF) { + data[index] = msg.convertDtmfToAscii(data[index]); + } } + addr.origBytes = data; // ignore subaddress @@ -279,6 +287,7 @@ public class SmsMessage extends SmsMessageBase { SubmitPdu ret = new SubmitPdu(); UserData uData = new UserData(); SmsHeader smsHeader; + byte[] data; // Perform null parameter checks. if (message == null || destinationAddress == null) { @@ -287,8 +296,7 @@ public class SmsMessage extends SmsMessageBase { // ** Set UserData + SmsHeader ** try { - // First, try encoding it with the GSM alphabet - int septetCount = GsmAlphabet.countGsmSeptets(message, true); + // First, try encoding it as 7-bit ASCII // User Data (and length) uData.payload = message.getBytes(); @@ -299,9 +307,7 @@ public class SmsMessage extends SmsMessageBase { } // desired TP-Data-Coding-Scheme - uData.msgEncoding = UserData.ENCODING_GSM_7BIT_ALPHABET; - - // paddingBits not needed for UD_ENCODING_GSM_7BIT_ALPHABET + uData.msgEncoding = UserData.ENCODING_7BIT_ASCII; // sms header if(headerData != null) { @@ -311,7 +317,13 @@ public class SmsMessage extends SmsMessageBase { // no user data header available! } - } catch (EncodeException ex) { + data = sms.getEnvelope(destinationAddress, statusReportRequested, uData, + (headerData != null), (null == headerData)); + + } catch (Exception ex) { + Log.e(LOG_TAG, "getSubmitPdu: 7 bit ASCII encoding in cdma.SMSMesage failed: " + + ex.getMessage()); + Log.w(LOG_TAG, "getSubmitPdu: The message will be sent as UCS-2 encoded message."); byte[] textPart; // Encoding to the 7-bit alphabet failed. Let's see if we can // send it as a UCS-2 encoded message @@ -340,10 +352,10 @@ public class SmsMessage extends SmsMessageBase { } else { // no user data header available! } - } - byte[] data = sms.getEnvelope(destinationAddress, statusReportRequested, uData, + data = sms.getEnvelope(destinationAddress, statusReportRequested, uData, (headerData != null), (null == headerData)); + } if (null == data) return null; @@ -556,6 +568,7 @@ public class SmsMessage extends SmsMessageBase { ByteArrayInputStream bais = new ByteArrayInputStream(pdu); DataInputStream dis = new DataInputStream(new BufferedInputStream(bais)); byte length; + int bearerDataLength; SmsEnvelope env = new SmsEnvelope(); CdmaSmsAddress addr = new CdmaSmsAddress(); @@ -581,9 +594,9 @@ public class SmsMessage extends SmsMessageBase { env.causeCode = dis.readByte(); //encoded BearerData: - length = dis.readByte(); - env.bearerData = new byte[length]; - dis.read(env.bearerData, 0, length); + bearerDataLength = dis.readInt(); + env.bearerData = new byte[bearerDataLength]; + dis.read(env.bearerData, 0, bearerDataLength); dis.close(); } catch (Exception ex) { Log.e(LOG_TAG, "createFromPdu: conversion from byte array to object failed: " + ex); @@ -690,6 +703,7 @@ public class SmsMessage extends SmsMessageBase { switch (encodingType) { case UserData.ENCODING_GSM_7BIT_ALPHABET: + case UserData.ENCODING_7BIT_ASCII: case UserData.ENCODING_UNICODE_16: // user data was already decoded by wmsts-library messageBody = new String(userData); @@ -786,7 +800,7 @@ public class SmsMessage extends SmsMessageBase { // ** SmsEnvelope ** env.messageType = SmsEnvelope.MESSAGE_TYPE_POINT_TO_POINT; - env.teleService = SmsEnvelope.TELESERVICE_WEMT; + env.teleService = SmsEnvelope.TELESERVICE_WMT; env.destAddress = mSmsAddress; env.bearerReply = RETURN_ACK; env.bearerData = encodedBearerData; @@ -874,7 +888,7 @@ public class SmsMessage extends SmsMessageBase { dos.writeByte(env.errorClass); dos.writeByte(env.causeCode); //encoded BearerData: - dos.writeByte(env.bearerData.length); + dos.writeInt(env.bearerData.length); dos.write(env.bearerData, 0, env.bearerData.length); dos.close(); @@ -884,4 +898,37 @@ public class SmsMessage extends SmsMessageBase { } } + /** + * Converts a 4-Bit DTMF encoded symbol from the calling address number to ASCII character + */ + private byte convertDtmfToAscii(byte dtmfDigit) { + byte asciiDigit; + + switch (dtmfDigit) { + case 0: asciiDigit = 68; break; // 'D' + case 1: asciiDigit = 49; break; // '1' + case 2: asciiDigit = 50; break; // '2' + case 3: asciiDigit = 51; break; // '3' + case 4: asciiDigit = 52; break; // '4' + case 5: asciiDigit = 53; break; // '5' + case 6: asciiDigit = 54; break; // '6' + case 7: asciiDigit = 55; break; // '7' + case 8: asciiDigit = 56; break; // '8' + case 9: asciiDigit = 57; break; // '9' + case 10: asciiDigit = 48; break; // '0' + case 11: asciiDigit = 42; break; // '*' + case 12: asciiDigit = 35; break; // '#' + case 13: asciiDigit = 65; break; // 'A' + case 14: asciiDigit = 66; break; // 'B' + case 15: asciiDigit = 67; break; // 'C' + default: + asciiDigit = 32; // Invalid DTMF code + break; + } + + return asciiDigit; + } + + + } |