Merge change 531 into donut
* changes: Teleca 090414 & 090423 patches for CDMA to complete phase1 work.
This commit is contained in:
@@ -234,6 +234,11 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
|
|
||||||
static final int SOCKET_OPEN_RETRY_MILLIS = 4 * 1000;
|
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() {
|
BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
|
||||||
public void onReceive(Context context, Intent intent) {
|
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_QUERY_PREFERRED_VOICE_PRIVACY_MODE: ret = responseInts(p); break;
|
||||||
case RIL_REQUEST_CDMA_FLASH: ret = responseVoid(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_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_CDMA_SMS_ACKNOWLEDGE: ret = responseVoid(p); break;
|
||||||
case RIL_REQUEST_GET_BROADCAST_CONFIG: ret = responseBR_SMS_CNF(p); break;
|
case RIL_REQUEST_GET_BROADCAST_CONFIG: ret = responseBR_SMS_CNF(p); break;
|
||||||
case RIL_REQUEST_SET_BROADCAST_CONFIG: ret = responseVoid(p); break;
|
case RIL_REQUEST_SET_BROADCAST_CONFIG: ret = responseVoid(p); break;
|
||||||
@@ -2738,17 +2743,38 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
|
|
||||||
private Object
|
private Object
|
||||||
responseCDMA_BR_CNF(Parcel p) {
|
responseCDMA_BR_CNF(Parcel p) {
|
||||||
int numInts;
|
int numServiceCategories;
|
||||||
int response[];
|
int response[];
|
||||||
|
|
||||||
numInts = 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];
|
response = new int[numInts];
|
||||||
|
|
||||||
response[0] = 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++) {
|
for (int i = 1 ; i < numInts; i++) {
|
||||||
response[i] = p.readInt();
|
response[i] = p.readInt();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
@@ -3036,10 +3062,13 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
public void setCdmaBroadcastConfig(int[] configValuesArray, Message response) {
|
public void setCdmaBroadcastConfig(int[] configValuesArray, Message response) {
|
||||||
RILRequest rr = RILRequest.obtain(RIL_REQUEST_CDMA_SET_BROADCAST_CONFIG, 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]);
|
rr.mp.writeInt(configValuesArray[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
|
||||||
|
|
||||||
send(rr);
|
send(rr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3049,6 +3078,8 @@ public final class RIL extends BaseCommands implements CommandsInterface {
|
|||||||
rr.mp.writeInt(1);
|
rr.mp.writeInt(1);
|
||||||
rr.mp.writeInt(activate);
|
rr.mp.writeInt(activate);
|
||||||
|
|
||||||
|
if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));
|
||||||
|
|
||||||
send(rr);
|
send(rr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,6 +135,7 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
byte[] data;
|
byte[] data;
|
||||||
byte count;
|
byte count;
|
||||||
int countInt;
|
int countInt;
|
||||||
|
int addressDigitMode;
|
||||||
|
|
||||||
//currently not supported by the modem-lib: env.mMessageType
|
//currently not supported by the modem-lib: env.mMessageType
|
||||||
env.teleService = p.readInt(); //p_cur->uTeleserviceID
|
env.teleService = p.readInt(); //p_cur->uTeleserviceID
|
||||||
@@ -153,7 +154,8 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
env.serviceCategory = p.readInt(); //p_cur->uServicecategory
|
env.serviceCategory = p.readInt(); //p_cur->uServicecategory
|
||||||
|
|
||||||
// address
|
// 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.numberMode = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_mode
|
||||||
addr.ton = p.readInt(); //p_cur->sAddress.number_type
|
addr.ton = p.readInt(); //p_cur->sAddress.number_type
|
||||||
addr.numberPlan = (byte) (0xFF & p.readInt()); //p_cur->sAddress.number_plan
|
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]
|
//p_cur->sAddress.digits[digitCount]
|
||||||
for (int index=0; index < count; index++) {
|
for (int index=0; index < count; index++) {
|
||||||
data[index] = p.readByte();
|
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;
|
addr.origBytes = data;
|
||||||
|
|
||||||
// ignore subaddress
|
// ignore subaddress
|
||||||
@@ -279,6 +287,7 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
SubmitPdu ret = new SubmitPdu();
|
SubmitPdu ret = new SubmitPdu();
|
||||||
UserData uData = new UserData();
|
UserData uData = new UserData();
|
||||||
SmsHeader smsHeader;
|
SmsHeader smsHeader;
|
||||||
|
byte[] data;
|
||||||
|
|
||||||
// Perform null parameter checks.
|
// Perform null parameter checks.
|
||||||
if (message == null || destinationAddress == null) {
|
if (message == null || destinationAddress == null) {
|
||||||
@@ -287,8 +296,7 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
|
|
||||||
// ** Set UserData + SmsHeader **
|
// ** Set UserData + SmsHeader **
|
||||||
try {
|
try {
|
||||||
// First, try encoding it with the GSM alphabet
|
// First, try encoding it as 7-bit ASCII
|
||||||
int septetCount = GsmAlphabet.countGsmSeptets(message, true);
|
|
||||||
// User Data (and length)
|
// User Data (and length)
|
||||||
|
|
||||||
uData.payload = message.getBytes();
|
uData.payload = message.getBytes();
|
||||||
@@ -299,9 +307,7 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// desired TP-Data-Coding-Scheme
|
// desired TP-Data-Coding-Scheme
|
||||||
uData.msgEncoding = UserData.ENCODING_GSM_7BIT_ALPHABET;
|
uData.msgEncoding = UserData.ENCODING_7BIT_ASCII;
|
||||||
|
|
||||||
// paddingBits not needed for UD_ENCODING_GSM_7BIT_ALPHABET
|
|
||||||
|
|
||||||
// sms header
|
// sms header
|
||||||
if(headerData != null) {
|
if(headerData != null) {
|
||||||
@@ -311,7 +317,13 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
// no user data header available!
|
// 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;
|
byte[] textPart;
|
||||||
// Encoding to the 7-bit alphabet failed. Let's see if we can
|
// Encoding to the 7-bit alphabet failed. Let's see if we can
|
||||||
// send it as a UCS-2 encoded message
|
// send it as a UCS-2 encoded message
|
||||||
@@ -340,10 +352,10 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
} else {
|
} else {
|
||||||
// no user data header available!
|
// no user data header available!
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
byte[] data = sms.getEnvelope(destinationAddress, statusReportRequested, uData,
|
data = sms.getEnvelope(destinationAddress, statusReportRequested, uData,
|
||||||
(headerData != null), (null == headerData));
|
(headerData != null), (null == headerData));
|
||||||
|
}
|
||||||
|
|
||||||
if (null == data) return null;
|
if (null == data) return null;
|
||||||
|
|
||||||
@@ -556,6 +568,7 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
ByteArrayInputStream bais = new ByteArrayInputStream(pdu);
|
ByteArrayInputStream bais = new ByteArrayInputStream(pdu);
|
||||||
DataInputStream dis = new DataInputStream(new BufferedInputStream(bais));
|
DataInputStream dis = new DataInputStream(new BufferedInputStream(bais));
|
||||||
byte length;
|
byte length;
|
||||||
|
int bearerDataLength;
|
||||||
SmsEnvelope env = new SmsEnvelope();
|
SmsEnvelope env = new SmsEnvelope();
|
||||||
CdmaSmsAddress addr = new CdmaSmsAddress();
|
CdmaSmsAddress addr = new CdmaSmsAddress();
|
||||||
|
|
||||||
@@ -581,9 +594,9 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
env.causeCode = dis.readByte();
|
env.causeCode = dis.readByte();
|
||||||
|
|
||||||
//encoded BearerData:
|
//encoded BearerData:
|
||||||
length = dis.readByte();
|
bearerDataLength = dis.readInt();
|
||||||
env.bearerData = new byte[length];
|
env.bearerData = new byte[bearerDataLength];
|
||||||
dis.read(env.bearerData, 0, length);
|
dis.read(env.bearerData, 0, bearerDataLength);
|
||||||
dis.close();
|
dis.close();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Log.e(LOG_TAG, "createFromPdu: conversion from byte array to object failed: " + 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) {
|
switch (encodingType) {
|
||||||
case UserData.ENCODING_GSM_7BIT_ALPHABET:
|
case UserData.ENCODING_GSM_7BIT_ALPHABET:
|
||||||
|
case UserData.ENCODING_7BIT_ASCII:
|
||||||
case UserData.ENCODING_UNICODE_16:
|
case UserData.ENCODING_UNICODE_16:
|
||||||
// user data was already decoded by wmsts-library
|
// user data was already decoded by wmsts-library
|
||||||
messageBody = new String(userData);
|
messageBody = new String(userData);
|
||||||
@@ -786,7 +800,7 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
|
|
||||||
// ** SmsEnvelope **
|
// ** SmsEnvelope **
|
||||||
env.messageType = SmsEnvelope.MESSAGE_TYPE_POINT_TO_POINT;
|
env.messageType = SmsEnvelope.MESSAGE_TYPE_POINT_TO_POINT;
|
||||||
env.teleService = SmsEnvelope.TELESERVICE_WEMT;
|
env.teleService = SmsEnvelope.TELESERVICE_WMT;
|
||||||
env.destAddress = mSmsAddress;
|
env.destAddress = mSmsAddress;
|
||||||
env.bearerReply = RETURN_ACK;
|
env.bearerReply = RETURN_ACK;
|
||||||
env.bearerData = encodedBearerData;
|
env.bearerData = encodedBearerData;
|
||||||
@@ -874,7 +888,7 @@ public class SmsMessage extends SmsMessageBase {
|
|||||||
dos.writeByte(env.errorClass);
|
dos.writeByte(env.errorClass);
|
||||||
dos.writeByte(env.causeCode);
|
dos.writeByte(env.causeCode);
|
||||||
//encoded BearerData:
|
//encoded BearerData:
|
||||||
dos.writeByte(env.bearerData.length);
|
dos.writeInt(env.bearerData.length);
|
||||||
dos.write(env.bearerData, 0, env.bearerData.length);
|
dos.write(env.bearerData, 0, env.bearerData.length);
|
||||||
dos.close();
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user