10825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville/* 20825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * Copyright (C) 2010 The Android Open Source Project 30825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * 40825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * Licensed under the Apache License, Version 2.0 (the "License"); 50825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * you may not use this file except in compliance with the License. 60825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * You may obtain a copy of the License at 70825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * 80825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * http://www.apache.org/licenses/LICENSE-2.0 90825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * 100825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * Unless required by applicable law or agreed to in writing, software 110825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * distributed under the License is distributed on an "AS IS" BASIS, 120825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 130825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * See the License for the specific language governing permissions and 140825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * limitations under the License. 150825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville */ 160825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 170825495a331bb44df395a0cdb79fab85e68db5d5Wink Savillepackage com.android.internal.telephony.gsm; 180825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1999c2e1d6749cfad2a8ca94a47857d8c3bfc09454Wink Savilleimport android.telephony.Rlog; 200825495a331bb44df395a0cdb79fab85e68db5d5Wink Savilleimport android.telephony.SmsCbEtwsInfo; 210825495a331bb44df395a0cdb79fab85e68db5d5Wink Savilleimport android.telephony.SmsCbLocation; 220825495a331bb44df395a0cdb79fab85e68db5d5Wink Savilleimport android.telephony.SmsCbMessage; 230825495a331bb44df395a0cdb79fab85e68db5d5Wink Savilleimport android.test.AndroidTestCase; 240825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 25d720945f2be5ea5fe0faf67e67d9ea0e184eba67Alex Yakavenkaimport com.android.internal.telephony.uicc.IccUtils; 260825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 270825495a331bb44df395a0cdb79fab85e68db5d5Wink Savilleimport java.util.Random; 280825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 290825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville/** 300825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville * Test cases for basic SmsCbMessage operations 310825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville */ 320825495a331bb44df395a0cdb79fab85e68db5d5Wink Savillepublic class GsmSmsCbTest extends AndroidTestCase { 330825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 340825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville private static final String TAG = "GsmSmsCbTest"; 350825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 360825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville private static final SmsCbLocation sTestLocation = new SmsCbLocation("94040", 1234, 5678); 370825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 380825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville private static SmsCbMessage createFromPdu(byte[] pdu) { 390825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville try { 400825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbHeader header = new SmsCbHeader(pdu); 410825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[][] pdus = new byte[1][]; 420825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville pdus[0] = pdu; 430825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville return GsmSmsCbMessage.createSmsCbMessage(header, sTestLocation, pdus); 440825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } catch (IllegalArgumentException e) { 450825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville return null; 460825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 470825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 480825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 490825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville private static void doTestGeographicalScopeValue(byte[] pdu, byte b, int expectedGs) { 500825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville pdu[0] = b; 510825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 520825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 530825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected geographical scope decoded", expectedGs, msg 540825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville .getGeographicalScope()); 550825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 560825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 570825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testCreateNullPdu() { 580825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(null); 590825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertNull("createFromPdu(byte[] with null pdu should return null", msg); 600825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 610825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 620825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testCreateTooShortPdu() { 630825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = new byte[4]; 640825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 650825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 660825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertNull("createFromPdu(byte[] with too short pdu should return null", msg); 670825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 680825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 690825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetGeographicalScope() { 700825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 710825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC0, (byte)0x00, (byte)0x00, (byte)0x32, (byte)0x40, (byte)0x11, (byte)0x41, 720825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, (byte)0xCB, (byte)0xE6, 730825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, (byte)0x85, (byte)0xD9, (byte)0x70, 740825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x74, (byte)0x58, (byte)0x5C, (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, 750825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF9, (byte)0x3C, (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, 760825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3A, (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 770825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, (byte)0x75, 780825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, (byte)0xC9, (byte)0x69, 790825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 800825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 810825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 820825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 830825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00 840825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 850825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 860825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville doTestGeographicalScopeValue(pdu, (byte)0x00, 870825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage.GEOGRAPHICAL_SCOPE_CELL_WIDE_IMMEDIATE); 880825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville doTestGeographicalScopeValue(pdu, (byte)0x40, SmsCbMessage.GEOGRAPHICAL_SCOPE_PLMN_WIDE); 890825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville doTestGeographicalScopeValue(pdu, (byte)0x80, SmsCbMessage.GEOGRAPHICAL_SCOPE_LA_WIDE); 900825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville doTestGeographicalScopeValue(pdu, (byte)0xC0, SmsCbMessage.GEOGRAPHICAL_SCOPE_CELL_WIDE); 910825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 920825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 930825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetGeographicalScopeUmts() { 940825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 950825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x00, (byte)0x32, (byte)0xC0, (byte)0x00, (byte)0x40, 960825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 970825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, 980825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 990825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x41, (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, 1000825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xCB, (byte)0xE6, (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, 1010825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x85, (byte)0xD9, (byte)0x70, (byte)0x74, (byte)0x58, (byte)0x5C, 1020825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, (byte)0xF9, (byte)0x3C, 1030825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, (byte)0x3A, 1040825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 1050825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, 1060825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x75, (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, 1070825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC9, (byte)0x69, (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, 1080825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 1090825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 1100825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 1110825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 1120825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00, 1130825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1140825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34 1150825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 1160825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1170825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 1180825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1190825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected geographical scope decoded", 1200825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage.GEOGRAPHICAL_SCOPE_CELL_WIDE, msg.getGeographicalScope()); 1210825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 1220825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1230825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBody7Bit() { 1240825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 1250825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC0, (byte)0x00, (byte)0x00, (byte)0x32, (byte)0x40, (byte)0x11, (byte)0x41, 1260825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, (byte)0xCB, (byte)0xE6, 1270825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, (byte)0x85, (byte)0xD9, (byte)0x70, 1280825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x74, (byte)0x58, (byte)0x5C, (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, 1290825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF9, (byte)0x3C, (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, 1300825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3A, (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 1310825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, (byte)0x75, 1320825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, (byte)0xC9, (byte)0x69, 1330825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 1340825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 1350825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 1360825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 1370825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00 1380825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 1390825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 1400825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1410825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected 7-bit string decoded", 1420825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A GSM default alphabet message with carriage return padding", 1430825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getMessageBody()); 1440825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 1450825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1460825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBody7BitUmts() { 1470825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 1480825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x00, (byte)0x32, (byte)0xC0, (byte)0x00, (byte)0x40, 1490825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1500825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, 1510825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1520825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x41, (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, 1530825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xCB, (byte)0xE6, (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, 1540825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x85, (byte)0xD9, (byte)0x70, (byte)0x74, (byte)0x58, (byte)0x5C, 1550825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, (byte)0xF9, (byte)0x3C, 1560825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, (byte)0x3A, 1570825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 1580825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, 1590825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x75, (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, 1600825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC9, (byte)0x69, (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, 1610825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 1620825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 1630825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 1640825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 1650825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00, 1660825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1670825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34 1680825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 1690825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 1700825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1710825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected 7-bit string decoded", 1720825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A GSM default alphabet message with carriage return padding", 1730825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getMessageBody()); 1740825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 1750825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1760825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBody7BitMultipageUmts() { 1770825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 1780825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x00, (byte)0x01, (byte)0xC0, (byte)0x00, (byte)0x40, 1790825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1800825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x02, 1810825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1820825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC6, (byte)0xB4, (byte)0x7C, (byte)0x4E, (byte)0x07, (byte)0xC1, 1830825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC3, (byte)0xE7, (byte)0xF2, (byte)0xAA, (byte)0xD1, (byte)0x68, 1840825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 1850825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 1860825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 1870825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 1880825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, 1890825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, 1900825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, 1910825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 1920825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 1930825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 1940825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 1950825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00, 1960825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1970825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0A, 1980825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 1990825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD3, (byte)0xF2, (byte)0xF8, (byte)0xED, (byte)0x26, (byte)0x83, 2000825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xE0, (byte)0xE1, (byte)0x73, (byte)0xB9, (byte)0xD1, (byte)0x68, 2010825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 2020825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 2030825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 2040825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 2050825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, 2060825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, 2070825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, 2080825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 2090825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 2100825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 2110825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 2120825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00, 2130825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2140825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0A 2150825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 2160825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 2170825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2180825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected multipage 7-bit string decoded", 2190825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "First page+Second page", 2200825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getMessageBody()); 2210825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 2220825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2230825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBody7BitFull() { 2240825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 2250825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC0, (byte)0x00, (byte)0x00, (byte)0x32, (byte)0x40, (byte)0x11, (byte)0x41, 2260825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, (byte)0xCB, (byte)0xE6, 2270825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, (byte)0x85, (byte)0xD9, (byte)0x70, 2280825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x74, (byte)0x58, (byte)0x5C, (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, 2290825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF9, (byte)0x3C, (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xC4, (byte)0xE5, 2300825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB4, (byte)0xFB, (byte)0x0C, (byte)0x2A, (byte)0xE3, (byte)0xC3, (byte)0x63, 2310825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3A, (byte)0x3B, (byte)0x0F, (byte)0xCA, (byte)0xCD, (byte)0x40, (byte)0x63, 2320825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x74, (byte)0x58, (byte)0x1E, (byte)0x1E, (byte)0xD3, (byte)0xCB, (byte)0xF2, 2330825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x39, (byte)0x88, (byte)0xFD, (byte)0x76, (byte)0x9F, (byte)0x59, (byte)0xA0, 2340825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x76, (byte)0x39, (byte)0xEC, (byte)0x4E, (byte)0xBB, (byte)0xCF, (byte)0x20, 2350825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3A, (byte)0xBA, (byte)0x2C, (byte)0x2F, (byte)0x83, (byte)0xD2, (byte)0x73, 2360825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x90, (byte)0xFB, (byte)0x0D, (byte)0x82, (byte)0x87, (byte)0xC9, (byte)0xE4, 2370825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB4, (byte)0xFB, (byte)0x1C, (byte)0x02 2380825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 2390825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 2400825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2410825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals( 2420825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "Unexpected 7-bit string decoded", 2430825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A GSM default alphabet message being exactly 93 characters long, " + 2440825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "meaning there is no padding!", 2450825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getMessageBody()); 2460825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 2470825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2480825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBody7BitFullUmts() { 2490825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 2500825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x00, (byte)0x32, (byte)0xC0, (byte)0x00, (byte)0x40, 2510825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2520825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, 2530825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2540825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x41, (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, 2550825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xCB, (byte)0xE6, (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, 2560825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x85, (byte)0xD9, (byte)0x70, (byte)0x74, (byte)0x58, (byte)0x5C, 2570825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, (byte)0xF9, (byte)0x3C, 2580825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xC4, (byte)0xE5, (byte)0xB4, 2590825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xFB, (byte)0x0C, (byte)0x2A, (byte)0xE3, (byte)0xC3, (byte)0x63, 2600825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3A, (byte)0x3B, (byte)0x0F, (byte)0xCA, (byte)0xCD, (byte)0x40, 2610825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x63, (byte)0x74, (byte)0x58, (byte)0x1E, (byte)0x1E, (byte)0xD3, 2620825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xCB, (byte)0xF2, (byte)0x39, (byte)0x88, (byte)0xFD, (byte)0x76, 2630825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x9F, (byte)0x59, (byte)0xA0, (byte)0x76, (byte)0x39, (byte)0xEC, 2640825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x4E, (byte)0xBB, (byte)0xCF, (byte)0x20, (byte)0x3A, (byte)0xBA, 2650825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x2C, (byte)0x2F, (byte)0x83, (byte)0xD2, (byte)0x73, (byte)0x90, 2660825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xFB, (byte)0x0D, (byte)0x82, (byte)0x87, (byte)0xC9, (byte)0xE4, 2670825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB4, (byte)0xFB, (byte)0x1C, (byte)0x02, 2680825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2690825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x52 2700825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 2710825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 2720825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2730825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals( 2740825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "Unexpected 7-bit string decoded", 2750825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A GSM default alphabet message being exactly 93 characters long, " + 2760825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "meaning there is no padding!", 2770825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getMessageBody()); 2780825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 2790825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2800825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBody7BitWithLanguage() { 2810825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 2820825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC0, (byte)0x00, (byte)0x00, (byte)0x32, (byte)0x04, (byte)0x11, (byte)0x41, 2830825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, (byte)0xCB, (byte)0xE6, 2840825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, (byte)0x85, (byte)0xD9, (byte)0x70, 2850825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x74, (byte)0x58, (byte)0x5C, (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, 2860825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF9, (byte)0x3C, (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, 2870825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3A, (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 2880825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, (byte)0x75, 2890825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, (byte)0xC9, (byte)0x69, 2900825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 2910825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 2920825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 2930825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 2940825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00 2950825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 2960825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 2970825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 2980825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected 7-bit string decoded", 2990825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A GSM default alphabet message with carriage return padding", 3000825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getMessageBody()); 3010825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3020825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected language indicator decoded", "es", msg.getLanguageCode()); 3030825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 3040825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3050825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBody7BitWithLanguageInBody() { 3060825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 3070825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC0, (byte)0x00, (byte)0x00, (byte)0x32, (byte)0x10, (byte)0x11, (byte)0x73, 3080825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x7B, (byte)0x23, (byte)0x08, (byte)0x3A, (byte)0x4E, (byte)0x9B, (byte)0x20, 3090825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x72, (byte)0xD9, (byte)0x1C, (byte)0xAE, (byte)0xB3, (byte)0xE9, (byte)0xA0, 3100825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x30, (byte)0x1B, (byte)0x8E, (byte)0x0E, (byte)0x8B, (byte)0xCB, (byte)0x74, 3110825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x50, (byte)0xBB, (byte)0x3C, (byte)0x9F, (byte)0x87, (byte)0xCF, (byte)0x65, 3120825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD0, (byte)0x3D, (byte)0x4D, (byte)0x47, (byte)0x83, (byte)0xC6, (byte)0x61, 3130825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB9, (byte)0x3C, (byte)0x1D, (byte)0x3E, (byte)0x97, (byte)0x41, (byte)0xF2, 3140825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x32, (byte)0xBD, (byte)0x2E, (byte)0x77, (byte)0x83, (byte)0xE0, (byte)0x61, 3150825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x32, (byte)0x39, (byte)0xED, (byte)0x3E, (byte)0x37, (byte)0x1A, (byte)0x8D, 3160825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 3170825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 3180825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 3190825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00 3200825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 3210825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 3220825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3230825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected 7-bit string decoded", 3240825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A GSM default alphabet message with carriage return padding", 3250825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getMessageBody()); 3260825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3270825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected language indicator decoded", "sv", msg.getLanguageCode()); 3280825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 3290825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3300825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBody7BitWithLanguageInBodyUmts() { 3310825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 3320825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x00, (byte)0x32, (byte)0xC0, (byte)0x00, (byte)0x10, 3330825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3340825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, 3350825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3360825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x73, (byte)0x7B, (byte)0x23, (byte)0x08, (byte)0x3A, (byte)0x4E, 3370825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x9B, (byte)0x20, (byte)0x72, (byte)0xD9, (byte)0x1C, (byte)0xAE, 3380825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB3, (byte)0xE9, (byte)0xA0, (byte)0x30, (byte)0x1B, (byte)0x8E, 3390825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0E, (byte)0x8B, (byte)0xCB, (byte)0x74, (byte)0x50, (byte)0xBB, 3400825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3C, (byte)0x9F, (byte)0x87, (byte)0xCF, (byte)0x65, (byte)0xD0, 3410825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3D, (byte)0x4D, (byte)0x47, (byte)0x83, (byte)0xC6, (byte)0x61, 3420825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB9, (byte)0x3C, (byte)0x1D, (byte)0x3E, (byte)0x97, (byte)0x41, 3430825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF2, (byte)0x32, (byte)0xBD, (byte)0x2E, (byte)0x77, (byte)0x83, 3440825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xE0, (byte)0x61, (byte)0x32, (byte)0x39, (byte)0xED, (byte)0x3E, 3450825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x37, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 3460825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 3470825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 3480825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 3490825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00, 3500825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3510825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x37 3520825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 3530825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 3540825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3550825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected 7-bit string decoded", 3560825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A GSM default alphabet message with carriage return padding", 3570825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getMessageBody()); 3580825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3590825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected language indicator decoded", "sv", msg.getLanguageCode()); 3600825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 3610825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3620825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBody8Bit() { 3630825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 3640825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC0, (byte)0x00, (byte)0x00, (byte)0x32, (byte)0x44, (byte)0x11, (byte)0x41, 3650825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3660825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3670825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3680825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3690825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3700825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3710825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3720825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3730825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3740825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3750825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45, (byte)0x46, (byte)0x47, (byte)0x41, 3760825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x42, (byte)0x43, (byte)0x44, (byte)0x45 3770825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 3780825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 3790825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3800825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("8-bit message body should be empty", "", msg.getMessageBody()); 3810825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 3820825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 3830825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBodyUcs2() { 3840825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 3850825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC0, (byte)0x00, (byte)0x00, (byte)0x32, (byte)0x48, (byte)0x11, (byte)0x00, 3860825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x41, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x55, (byte)0x00, (byte)0x43, 3870825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x53, (byte)0x00, (byte)0x32, (byte)0x00, (byte)0x20, (byte)0x00, 3880825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x6D, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x73, (byte)0x00, (byte)0x73, 3890825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x67, (byte)0x00, (byte)0x65, (byte)0x00, 3900825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x20, (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x6F, (byte)0x00, (byte)0x6E, 3910825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x69, (byte)0x00, 3920825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x6E, (byte)0x00, (byte)0x69, (byte)0x00, (byte)0x6E, (byte)0x00, (byte)0x67, 3930825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x20, (byte)0x04, 3940825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x68, 3950825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x72, (byte)0x00, (byte)0x61, (byte)0x00, 3960825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x63, (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x72, 3970825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x0D, (byte)0x00, (byte)0x0D 3980825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 3990825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 4000825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4010825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected 7-bit string decoded", 4020825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A UCS2 message containing a \u0434 character", msg.getMessageBody()); 4030825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 4040825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4050825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBodyUcs2Umts() { 4060825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 4070825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x00, (byte)0x32, (byte)0xC0, (byte)0x00, (byte)0x48, 4080825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4090825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, 4100825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4110825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x41, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x55, 4120825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x43, (byte)0x00, (byte)0x53, (byte)0x00, (byte)0x32, 4130825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x6D, (byte)0x00, (byte)0x65, 4140825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x73, (byte)0x00, (byte)0x73, (byte)0x00, (byte)0x61, 4150825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x67, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x20, 4160825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x6F, (byte)0x00, (byte)0x6E, 4170825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x69, 4180825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x6E, (byte)0x00, (byte)0x69, (byte)0x00, (byte)0x6E, 4190825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x67, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x61, 4200825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x20, (byte)0x04, (byte)0x34, (byte)0x00, (byte)0x20, 4210825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x68, (byte)0x00, (byte)0x61, 4220825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x72, (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x63, 4230825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x72, 4240825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x0D, (byte)0x00, (byte)0x0D, 4250825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4260825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x4E 4270825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 4280825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 4290825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4300825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected 7-bit string decoded", 4310825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A UCS2 message containing a \u0434 character", msg.getMessageBody()); 4320825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 4330825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4340825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBodyUcs2MultipageUmts() { 4350825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 4360825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x00, (byte)0x32, (byte)0xC0, (byte)0x00, (byte)0x48, 4370825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4380825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x02, 4390825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4400825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x41, (byte)0x00, (byte)0x41, (byte)0x00, (byte)0x41, 4410825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4420825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4430825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4440825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4450825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4460825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4470825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4480825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4490825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4500825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4510825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4520825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4530825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4540825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4550825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x06, 4560825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4570825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x42, (byte)0x00, (byte)0x42, (byte)0x00, (byte)0x42, 4580825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4590825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4600825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4610825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4620825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4630825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4640825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4650825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4660825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4670825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4680825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4690825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4700825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x0D, (byte)0x0D, (byte)0x0D, (byte)0x0D, 4710825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4720825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x06 4730825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 4740825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 4750825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4760825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected multipage UCS2 string decoded", 4770825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "AAABBB", msg.getMessageBody()); 4780825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 4790825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4800825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBodyUcs2WithLanguageInBody() { 4810825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 4820825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC0, (byte)0x00, (byte)0x00, (byte)0x32, (byte)0x11, (byte)0x11, (byte)0x78, 4830825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3C, (byte)0x00, (byte)0x41, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x55, 4840825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x43, (byte)0x00, (byte)0x53, (byte)0x00, (byte)0x32, (byte)0x00, 4850825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x20, (byte)0x00, (byte)0x6D, (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x73, 4860825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x73, (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x67, (byte)0x00, 4870825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x65, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x6F, 4880825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x6E, (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x61, (byte)0x00, 4890825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x69, (byte)0x00, (byte)0x6E, (byte)0x00, (byte)0x69, (byte)0x00, (byte)0x6E, 4900825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x67, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x61, (byte)0x00, 4910825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x20, (byte)0x04, (byte)0x34, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x63, 4920825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x68, (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x72, (byte)0x00, 4930825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x61, (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x65, 4940825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x72, (byte)0x00, (byte)0x0D 4950825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 4960825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 4970825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 4980825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected 7-bit string decoded", 4990825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A UCS2 message containing a \u0434 character", msg.getMessageBody()); 5000825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5010825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected language indicator decoded", "xx", msg.getLanguageCode()); 5020825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 5030825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5040825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageBodyUcs2WithLanguageInBodyUmts() { 5050825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 5060825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x00, (byte)0x32, (byte)0xC0, (byte)0x00, (byte)0x11, 5070825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5080825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, 5090825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5100825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x78, (byte)0x3C, (byte)0x00, (byte)0x41, (byte)0x00, (byte)0x20, 5110825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x55, (byte)0x00, (byte)0x43, (byte)0x00, (byte)0x53, 5120825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x32, (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x6D, 5130825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x65, (byte)0x00, (byte)0x73, (byte)0x00, (byte)0x73, 5140825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x67, (byte)0x00, (byte)0x65, 5150825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x6F, 5160825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x6E, (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x61, 5170825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x69, (byte)0x00, (byte)0x6E, (byte)0x00, (byte)0x69, 5180825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x6E, (byte)0x00, (byte)0x67, (byte)0x00, (byte)0x20, 5190825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x20, (byte)0x04, (byte)0x34, 5200825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x20, (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x68, 5210825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x61, (byte)0x00, (byte)0x72, (byte)0x00, (byte)0x61, 5220825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x63, (byte)0x00, (byte)0x74, (byte)0x00, (byte)0x65, 5230825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x00, (byte)0x72, (byte)0x00, (byte)0x0D, 5240825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5250825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x50 5260825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 5270825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 5280825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5290825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected 7-bit string decoded", 5300825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "A UCS2 message containing a \u0434 character", msg.getMessageBody()); 5310825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5320825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected language indicator decoded", "xx", msg.getLanguageCode()); 5330825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 5340825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5350825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageIdentifier() { 5360825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 5370825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC0, (byte)0x00, (byte)0x30, (byte)0x39, (byte)0x40, (byte)0x11, (byte)0x41, 5380825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, (byte)0xCB, (byte)0xE6, 5390825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, (byte)0x85, (byte)0xD9, (byte)0x70, 5400825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x74, (byte)0x58, (byte)0x5C, (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, 5410825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF9, (byte)0x3C, (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, 5420825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3A, (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 5430825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, (byte)0x75, 5440825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, (byte)0xC9, (byte)0x69, 5450825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 5460825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 5470825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 5480825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 5490825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00 5500825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 5510825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5520825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 5530825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5540825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected message identifier decoded", 12345, msg.getServiceCategory()); 5550825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 5560825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5570825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageIdentifierUmts() { 5580825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 5590825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x30, (byte)0x39, (byte)0x2A, (byte)0xA5, (byte)0x40, 5600825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5610825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, 5620825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5630825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x41, (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, 5640825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xCB, (byte)0xE6, (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, 5650825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x85, (byte)0xD9, (byte)0x70, (byte)0x74, (byte)0x58, (byte)0x5C, 5660825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, (byte)0xF9, (byte)0x3C, 5670825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, (byte)0x3A, 5680825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 5690825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, 5700825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x75, (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, 5710825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC9, (byte)0x69, (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, 5720825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 5730825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 5740825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 5750825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 5760825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00, 5770825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5780825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34 5790825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 5800825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5810825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 5820825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5830825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected message identifier decoded", 12345, msg.getServiceCategory()); 5840825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 5850825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 5860825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageCode() { 5870825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 5880825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x2A, (byte)0xA5, (byte)0x30, (byte)0x39, (byte)0x40, (byte)0x11, (byte)0x41, 5890825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, (byte)0xCB, (byte)0xE6, 5900825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, (byte)0x85, (byte)0xD9, (byte)0x70, 5910825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x74, (byte)0x58, (byte)0x5C, (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, 5920825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF9, (byte)0x3C, (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, 5930825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3A, (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 5940825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, (byte)0x75, 5950825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, (byte)0xC9, (byte)0x69, 5960825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 5970825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 5980825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 5990825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 6000825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00 6010825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 6020825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6030825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 6040825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville int messageCode = (msg.getSerialNumber() & 0x3ff0) >> 4; 6050825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6060825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected message code decoded", 682, messageCode); 6070825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 6080825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6090825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetMessageCodeUmts() { 6100825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 6110825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x30, (byte)0x39, (byte)0x2A, (byte)0xA5, (byte)0x40, 6120825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6130825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, 6140825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6150825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x41, (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, 6160825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xCB, (byte)0xE6, (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, 6170825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x85, (byte)0xD9, (byte)0x70, (byte)0x74, (byte)0x58, (byte)0x5C, 6180825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, (byte)0xF9, (byte)0x3C, 6190825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, (byte)0x3A, 6200825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 6210825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, 6220825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x75, (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, 6230825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC9, (byte)0x69, (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, 6240825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 6250825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 6260825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 6270825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 6280825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00, 6290825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6300825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34 6310825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 6320825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6330825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 6340825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville int messageCode = (msg.getSerialNumber() & 0x3ff0) >> 4; 6350825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6360825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected message code decoded", 682, messageCode); 6370825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 6380825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6390825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetUpdateNumber() { 6400825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 6410825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x2A, (byte)0xA5, (byte)0x30, (byte)0x39, (byte)0x40, (byte)0x11, (byte)0x41, 6420825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, (byte)0xCB, (byte)0xE6, 6430825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, (byte)0x85, (byte)0xD9, (byte)0x70, 6440825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x74, (byte)0x58, (byte)0x5C, (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, 6450825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF9, (byte)0x3C, (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, 6460825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x3A, (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 6470825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, (byte)0x75, 6480825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, (byte)0xC9, (byte)0x69, 6490825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 6500825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 6510825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 6520825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 6530825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00 6540825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 6550825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6560825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 6570825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville int updateNumber = msg.getSerialNumber() & 0x000f; 6580825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6590825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected update number decoded", 5, updateNumber); 6600825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 6610825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6620825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testGetUpdateNumberUmts() { 6630825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] pdu = { 6640825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, (byte)0x30, (byte)0x39, (byte)0x2A, (byte)0xA5, (byte)0x40, 6650825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6660825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x01, 6670825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6680825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x41, (byte)0xD0, (byte)0x71, (byte)0xDA, (byte)0x04, (byte)0x91, 6690825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xCB, (byte)0xE6, (byte)0x70, (byte)0x9D, (byte)0x4D, (byte)0x07, 6700825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x85, (byte)0xD9, (byte)0x70, (byte)0x74, (byte)0x58, (byte)0x5C, 6710825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA6, (byte)0x83, (byte)0xDA, (byte)0xE5, (byte)0xF9, (byte)0x3C, 6720825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x7C, (byte)0x2E, (byte)0x83, (byte)0xEE, (byte)0x69, (byte)0x3A, 6730825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x1A, (byte)0x34, (byte)0x0E, (byte)0xCB, (byte)0xE5, (byte)0xE9, 6740825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xF0, (byte)0xB9, (byte)0x0C, (byte)0x92, (byte)0x97, (byte)0xE9, 6750825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x75, (byte)0xB9, (byte)0x1B, (byte)0x04, (byte)0x0F, (byte)0x93, 6760825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xC9, (byte)0x69, (byte)0xF7, (byte)0xB9, (byte)0xD1, (byte)0x68, 6770825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, (byte)0xD1, 6780825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, (byte)0xA3, 6790825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, (byte)0x46, 6800825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0xA3, (byte)0xD1, (byte)0x68, (byte)0x34, (byte)0x1A, (byte)0x8D, 6810825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x46, (byte)0xA3, (byte)0xD1, (byte)0x00, 6820825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6830825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville (byte)0x34 6840825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville }; 6850825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6860825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(pdu); 6870825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville int updateNumber = msg.getSerialNumber() & 0x000f; 6880825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6890825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("Unexpected update number decoded", 5, updateNumber); 6900825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 6910825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6920825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville /* ETWS Test message including header */ 6930825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville private static final byte[] etwsMessageNormal = IccUtils.hexStringToBytes("000011001101" + 6940825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "0D0A5BAE57CE770C531790E85C716CBF3044573065B930675730" + 6950825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "9707767A751F30025F37304463FA308C306B5099304830664E0B30553044FF086C178C615E81FF09" + 6960825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "0000000000000000000000000000"); 6970825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 6980825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville private static final byte[] etwsMessageCancel = IccUtils.hexStringToBytes("000011001101" + 6990825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "0D0A5148307B3069002800310030003A0035" + 7000825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "00320029306E7DCA602557309707901F5831309253D66D883057307E3059FF086C178C615E81FF09" + 7010825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "00000000000000000000000000000000000000000000"); 7020825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 7030825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville private static final byte[] etwsMessageTest = IccUtils.hexStringToBytes("000011031101" + 7040825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "0D0A5BAE57CE770C531790E85C716CBF3044" + 7050825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "573065B9306757309707300263FA308C306B5099304830664E0B30553044FF086C178C615E81FF09" + 7060825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville "00000000000000000000000000000000000000000000"); 7070825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 7080825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville // FIXME: add example of ETWS primary notification PDU 7090825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 7100825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testEtwsMessageNormal() { 7110825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(etwsMessageNormal); 71299c2e1d6749cfad2a8ca94a47857d8c3bfc09454Wink Saville Rlog.d(TAG, msg.toString()); 7130825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("GS mismatch", 0, msg.getGeographicalScope()); 7140825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("serial number mismatch", 0, msg.getSerialNumber()); 7150825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("message ID mismatch", 0x1100, msg.getServiceCategory()); 7160825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("warning type mismatch", SmsCbEtwsInfo.ETWS_WARNING_TYPE_EARTHQUAKE, 7170825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getEtwsWarningInfo().getWarningType()); 7180825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 7190825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 7200825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testEtwsMessageCancel() { 7210825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(etwsMessageCancel); 72299c2e1d6749cfad2a8ca94a47857d8c3bfc09454Wink Saville Rlog.d(TAG, msg.toString()); 7230825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("GS mismatch", 0, msg.getGeographicalScope()); 7240825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("serial number mismatch", 0, msg.getSerialNumber()); 7250825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("message ID mismatch", 0x1100, msg.getServiceCategory()); 7260825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("warning type mismatch", SmsCbEtwsInfo.ETWS_WARNING_TYPE_EARTHQUAKE, 7270825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getEtwsWarningInfo().getWarningType()); 7280825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 7290825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 7300825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testEtwsMessageTest() { 7310825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(etwsMessageTest); 73299c2e1d6749cfad2a8ca94a47857d8c3bfc09454Wink Saville Rlog.d(TAG, msg.toString()); 7330825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("GS mismatch", 0, msg.getGeographicalScope()); 7340825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("serial number mismatch", 0, msg.getSerialNumber()); 7350825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("message ID mismatch", 0x1103, msg.getServiceCategory()); 7360825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville assertEquals("warning type mismatch", SmsCbEtwsInfo.ETWS_WARNING_TYPE_TEST_MESSAGE, 7370825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville msg.getEtwsWarningInfo().getWarningType()); 7380825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 7390825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville 7400825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville // Make sure we don't throw an exception if we feed random data to the PDU parser. 7410825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville public void testRandomPdus() { 7420825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville Random r = new Random(94040); 7430825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville for (int run = 0; run < 10000; run++) { 7440825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville int len = r.nextInt(140); 7450825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville byte[] data = new byte[len]; 7460825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville for (int i = 0; i < len; i++) { 7470825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville data[i] = (byte) r.nextInt(256); 7480825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 7490825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville try { 7500825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville // this should return a SmsCbMessage object or null for invalid data 7510825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville SmsCbMessage msg = createFromPdu(data); 7520825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } catch (Exception e) { 75399c2e1d6749cfad2a8ca94a47857d8c3bfc09454Wink Saville Rlog.d(TAG, "exception thrown", e); 7540825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville fail("Exception in decoder at run " + run + " length " + len + ": " + e); 7550825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 7560825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 7570825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville } 7580825495a331bb44df395a0cdb79fab85e68db5d5Wink Saville} 759