upload tizen1.0 source 13/13/1 2.0alpha master
authorSungho Park <chywoo.park@samsung.com>
Mon, 30 Apr 2012 09:06:13 +0000 (18:06 +0900)
committerSungho Park <chywoo.park@samsung.com>
Mon, 30 Apr 2012 09:06:13 +0000 (18:06 +0900)
Change-Id: Ie730d70bd0401c40150c75c48165319a17487a89

org.tizen.telephony.call/META-INF/MANIFEST.MF
org.tizen.telephony.call/src/org/tizen/telephony/call/page/MOMTCall.java
org.tizen.telephony.call/src/org/tizen/telephony/call/resource/ErrorCode.java
org.tizen.telephony.feature/feature.xml
org.tizen.telephony.sms/META-INF/MANIFEST.MF
org.tizen.telephony.sms/src/org/tizen/telephony/sms/encription/DecodeMsg.java
org.tizen.telephony.sms/src/org/tizen/telephony/sms/encription/EncodeMsg.java
org.tizen.telephony.sms/src/org/tizen/telephony/sms/encription/SMS_USERDATA.java [new file with mode: 0644]
org.tizen.telephony.sms/src/org/tizen/telephony/sms/encription/TPDU_SMS_DELIVER.java
org.tizen.telephony.sms/src/org/tizen/telephony/sms/page/SMS.java
package/pkginfo.manifest

index 2367ac8..42b9d10 100644 (file)
@@ -2,8 +2,8 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Tizen Event Injector Telephony Call
 Bundle-SymbolicName: org.tizen.telephony.call;singleton:=true
-Bundle-Version: 1.3.20.qualifier
-Bundle-Vendor: Tizen
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Samsung
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.eclipse.ui.forms;bundle-version="3.3.103",
index 1e71397..fabc985 100644 (file)
@@ -59,6 +59,7 @@ import org.tizen.injector.provider.AbstractInjectorItem;
 import org.tizen.injector.provider.AbstractInjectorPage;
 import org.tizen.injector.receiver.AbstractInjectorReceiver;
 import org.tizen.injector.socket.TelephonySocket;
+import org.tizen.injector.view.InjectorView;
 import org.tizen.telephony.call.TelephonyCall;
 import org.tizen.telephony.call.model.CallListVO;
 import org.tizen.telephony.call.protocol.G01A07;
@@ -122,7 +123,7 @@ ISelectionListener{
        }
        
        protected void createContents() {
-               ConnectionPlugin.getDefault().addSelectionListener(this);
+               InjectorView.getDefault().addSelectionListener(this);
                currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
                createMTCallSection();
                createCallListInformationSection();
index 138dccd..00c9acf 100644 (file)
@@ -39,7 +39,7 @@ public class ErrorCode {
                
 //             add(30,"no network service");
 //             add(0,"Phone failure");
-               add(1,"CALL Not Available");
+//             add(1,"CALL Not Available");
 //             add(2,"Phone-adapter link reserved");
 //             add(3,"Operation not allowed");
 //             add(4,"Operation not supported");
index 14a5c22..3b3f0ab 100644 (file)
@@ -2,8 +2,8 @@
 <feature
       id="org.tizen.telephony.feature"
       label="Tizen Telephony"
-      version="1.1.0.qualifier"
-      provider-name="Tizen">
+      version="1.0.0.qualifier"
+      provider-name="Samsung">
 
    <description>
       %description
index 6763fca..cb85cf7 100644 (file)
@@ -2,8 +2,8 @@ Manifest-Version: 1.0
 Bundle-ManifestVersion: 2
 Bundle-Name: Tizen Event Injector Telephony Sms
 Bundle-SymbolicName: org.tizen.telephony.sms;singleton:=true
-Bundle-Version: 1.3.20.qualifier
-Bundle-Vendor: Tizen
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Samsung
 Require-Bundle: org.eclipse.ui,
  org.eclipse.core.runtime,
  org.tizen.common,
index 340b73a..dd27af9 100644 (file)
@@ -150,7 +150,7 @@ public class DecodeMsg {
                }
                
                /* TP UDL */
-               tpdu_submit.udl = pPDU[position];
+               tpdu_submit.udl = pPDU[position] & 0x00FF;
                
                if(tpdu_submit.udl > EnumConstants.TAPI_NETTEXT_SMDATA_SIZE_MAX)
                        tpdu_submit.udl = EnumConstants.TAPI_NETTEXT_SMDATA_SIZE_MAX;
@@ -161,7 +161,9 @@ public class DecodeMsg {
                if(tpdu_submit.udhi)
                {
                        udhl = pPDU[position];
-                       position+=udhl;
+                       int fillbits = 7 - ((pPDU[position] * 8) % 7);
+                       position += udhl;
+                       udhl += fillbits;
                        
                        if(pPDU[position] == 1)
                        {
@@ -185,31 +187,37 @@ public class DecodeMsg {
                        }
                }
                
+               int i = 0;
                tpdu_submit.userData = new char[EnumConstants.TAPI_NETTEXT_SMDATA_SIZE_MAX+1];
                //System.out.println("Position : " + position);
                if(tpdu_submit.dcs.alphabetType == EnumConstants.TAPI_NETTEXT_ALPHABET_DEFAULT) {
                        char[] inData = new char[EnumConstants.TAPI_NETTEXT_SMDATA_SIZE_MAX+1];
-                       for(int i = 0; i < tpdu_submit.udl; i++) {
-                               if(tpdu_submit.udl == 255)
-                               {       
-                                       // relayed sms
-                                       if(tpdu_submit.udhi == true && i > 152 && (char)(pPDU[position + i]) == '@')
+                       for(i = 0; i < tpdu_submit.udl; i++) {
+                               inData[i] = (char)(pPDU[position + i] & 0xff);
+                               if(relay_cnt == 1)      // last or single sms
+                               {
+                                       if(i == tpdu_submit.udl - udhl)
                                                break;
                                }
                                else
                                {
-                                       // relayed sms
-                                       if(tpdu_submit.udhi == true && i > tpdu_submit.udl && (char)(pPDU[position + i]) == '@')
-                                               break;
+                                       if(tpdu_submit.udhi == true)
+                                       {
+                                               if(i == tpdu_submit.udl - udhl)
+                                                       break;
+                                       }
+                                       else
+                                       {
+                                               if(i == tpdu_submit.udl)
+                                                       break;
+                                       }
                                }
-                               
-                               inData[i] = (char)(pPDU[position + i] & 0xff);
-                               if(inData[i] == '@' && i == tpdu_submit.udl - (udhl + 2))       // last dregs data
-                                       inData[i] = '\0';
                        }
                        
-                       for(int i = 0; i < tpdu_submit.udl; i++) {
-                               tpdu_submit.userData[i] = inData[i];    
+                       inData[i] = '\0';
+                       
+                       for(int j = 0; j < i; j++) {
+                               tpdu_submit.userData[j] = inData[j];    
                        }
                        
                        if(relayedsms)
@@ -224,37 +232,37 @@ public class DecodeMsg {
                else if(tpdu_submit.dcs.alphabetType == EnumConstants.TAPI_NETTEXT_ALPHABET_UCS2)
                {
                        byte[] inData = new byte[EnumConstants.TAPI_NETTEXT_SMDATA_SIZE_MAX+1];
-                       for(int i = 0; i < tpdu_submit.udl; i++) {
-                               if(tpdu_submit.udl == 255)
-                               {       
-                                       // relayed sms
-                                       if(tpdu_submit.udhi == true && i > 152 && (char)(pPDU[position + i]) == '@')
+                       for(i = 0; i < tpdu_submit.udl; i++) {
+                               inData[i] = (byte)(pPDU[position + i] & 0xff);
+                               if(relay_cnt == 1)      // last or single sms
+                               {
+                                       if(i == tpdu_submit.udl - udhl + 1)
                                                break;
                                }
                                else
                                {
-                                       // relayed sms
-                                       if(tpdu_submit.udhi == true && i > tpdu_submit.udl && (char)(pPDU[position + i]) == '@')
-                                               break;
+                                       if(tpdu_submit.udhi == true)
+                                       {
+                                               if(i == tpdu_submit.udl - udhl)
+                                                       break;
+                                       }
+                                       else
+                                       {
+                                               if(i == tpdu_submit.udl)
+                                                       break;
+                                       }
                                }
-                               
-                               inData[i] = (byte)(pPDU[position + i] & 0xff);
                        }
                        
                        try {
-                               tpdu_submit.userData = ucs2ToUTF8(inData);
+                               inData[i] = '\0';
+                               tpdu_submit.userData = ucs2ToUTF16(inData, i/2);        
                        } catch (UnsupportedEncodingException e) {
                                // TODO Auto-generated catch block
                                e.printStackTrace();
                        }
                }
-               
-       /*      System.out.println("Msg Type: TPDU_SUBMIT");
-               if(tpdu_submit.rd)
-                       System.out.println("RD: Reject Duplicate");
-               else
-                       System.out.println("RD: Accept Duplicate");
-       */      
+       
                if(tpdu_submit.srr)
                {
                //      System.out.println("SRR: A status report is requested");
@@ -265,28 +273,6 @@ public class DecodeMsg {
                //      System.out.println("SRR: A status report is not requested");
                        deliveryReport = false;
                }
-       /*      
-               if(tpdu_submit.udhi)
-                       System.out.println("UDHI: Contains a Header in addition to the short message.");
-               else
-                       System.out.println("UDHI: Only Short Message");
-       
-               if(tpdu_submit.rp)
-                       System.out.println("RP: Set Reply Path");
-               else
-                       System.out.println("RP: Not set Reply Path");
-               
-               System.out.print("SCA Addr: ");
-               System.out.println(scaAddr);
-               System.out.print("To : ");
-               System.out.println(destAddr);
-               System.out.println(tpdu_submit.destAddr.diallingNum);
-               System.out.println("Message : ");
-               if(relayedsms)
-                       System.out.println(smsbuffer);
-               else
-                       System.out.println(tpdu_submit.userData);
-       */
        }
 
        private char[] getCharArray(char[] org, int start) {
@@ -633,12 +619,12 @@ public class DecodeMsg {
                }
        }
        
-       public char[] ucs2ToUTF8(byte[] ucs2Bytes) throws UnsupportedEncodingException{    
+       public char[] ucs2ToUTF16(byte[] ucs2Bytes, int length) throws UnsupportedEncodingException{    
                String unicode = new String(ucs2Bytes, "UTF-16");
                char[] str = unicode.toCharArray();
-                
+               
                String tmp1 = new String(smsbuffer);
-               String tmp2 = new String(str);
+               String tmp2 = unicode.substring(0, length);
                String tmp3 = tmp1.trim() + tmp2.trim();
                smsbuffer = tmp3.toCharArray();
 
index 21e7d70..f4d3822 100644 (file)
@@ -112,25 +112,47 @@ public class EncodeMsg {
                switch(tpdu_deliver.dcs.alphabetType) {
                        case EnumConstants.TAPI_NETTEXT_ALPHABET_DEFAULT:
                                /* UDL */
-                               packet[index++] = (char) tpdu_deliver.userData.length;
-                               SmsUtilPackGSMCode(packet, tpdu_deliver.userData,
-                                               tpdu_deliver.userData.length);
+                               packet[index++] = (char) tpdu_deliver.userData.data.length;
+                               SmsUtilPackGSMCode(packet, new String(tpdu_deliver.userData.data).toCharArray(),
+                                               tpdu_deliver.userData.data.length);
                                break;
                        case EnumConstants.TAPI_NETTEXT_ALPHABET_8BIT:
-                               packet[index++] = (char) tpdu_deliver.userData.length;
-                               SmsUtilPackGSM8Code(packet, tpdu_deliver.userData,
-                                               tpdu_deliver.userData.length);
+                               packet[index++] = (char) tpdu_deliver.userData.data.length;
+                               SmsUtilPackGSM8Code(packet, new String(tpdu_deliver.userData.data).toCharArray(),
+                                               tpdu_deliver.userData.data.length);
                                break;
                        case EnumConstants.TAPI_NETTEXT_ALPHABET_UCS2:
-                               try {
-                                       String str = new String(tpdu_deliver.userData);
-                                       byte[] byte_buf = str.getBytes("ISO-10646-UCS-2");
-                                       packet[index++] = (char)byte_buf.length;
-                                       for(int ind = 0; ind < byte_buf.length; ind++)
-                                               packet[index++] = (char)byte_buf[ind];
-                               } catch (UnsupportedEncodingException e) {
-                                       // TODO Auto-generated catch block
-                                       e.printStackTrace();
+                               int udhl                = 0;
+                               int fillBits    = 0;
+                               int tempIndex   = index;
+
+                               if (tpdu_deliver.userData.headerCnt > 0)
+                                       index = index + 2;
+                               else
+                                       index = index + 1;
+
+                               // setting HEADER
+                               int headerLen   = 6;
+                               for (i = 0; i < tpdu_deliver.userData.headerCnt; i++)
+                               {
+                                       packet[index++] = 0x08; // SMS_UDH_CONCAT_16BIT;
+                                       packet[index++] = 0x04; // offset
+                                       packet[index++] = (char)(tpdu_deliver.userData.smsUDH.msgRef >> 8);
+                                       packet[index++] = (char)(tpdu_deliver.userData.smsUDH.msgRef & 0x00FF);
+                                       packet[index++] = tpdu_deliver.userData.smsUDH.totalSeg;
+                                       packet[index++] = tpdu_deliver.userData.smsUDH.seqNum;
+                                       udhl += headerLen;
+                               }
+
+                               if (udhl > 0) {
+                                       packet[tempIndex]        = (char)((udhl+1) + fillBits + tpdu_deliver.userData.length);
+                                       packet[tempIndex+ 1] = (char)udhl;
+                               } else {
+                                       packet[tempIndex]       = (char)(tpdu_deliver.userData.length);
+                               }
+
+                               for(int ind = 0; ind < tpdu_deliver.userData.length; ind++) {
+                                       packet[index++] = (char)tpdu_deliver.userData.data[ind];
                                }
                                break;
                        //      throw new NullPointerException(Messages.EncodeMsg_0);
diff --git a/org.tizen.telephony.sms/src/org/tizen/telephony/sms/encription/SMS_USERDATA.java b/org.tizen.telephony.sms/src/org/tizen/telephony/sms/encription/SMS_USERDATA.java
new file mode 100644 (file)
index 0000000..121d263
--- /dev/null
@@ -0,0 +1,24 @@
+package org.tizen.telephony.sms.encription;
+
+public class SMS_USERDATA {
+       public SMS_USERDATA() {
+               smsUDH = new SMS_UDH();
+       }
+       public void setSMSUDH(char type, short ref, char seg, char num)
+       {
+               smsUDH.udhType = type;
+               smsUDH.msgRef = ref;
+               smsUDH.totalSeg = seg;
+               smsUDH.seqNum = num;
+       }
+       public int headerCnt;
+       public SMS_UDH smsUDH;
+       public int length;
+       public byte[] data;
+}
+class SMS_UDH {
+       public char udhType;
+       public short msgRef;
+       public char totalSeg;
+       public char seqNum;
+}
\ No newline at end of file
index 58629f5..5b61af9 100644 (file)
@@ -39,8 +39,8 @@ public class TPDU_SMS_DELIVER {
        public TmDateTime scts;
        public TapiNetTextCodingScheme dcs;
        public int udl;    // UINT
-       public char[] userData; // byte *
-       
+       //public char[] userData; // byte *
+       public SMS_USERDATA userData;
        public TPDU_SMS_DELIVER() {
                orgAddr = new SmsAddressInfo();
                scts = new TmDateTime();
index 07646b8..d59c40f 100644 (file)
@@ -27,7 +27,9 @@
 
 package org.tizen.telephony.sms.page;
 
+import java.io.UnsupportedEncodingException;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Date;
 
 import org.eclipse.swt.SWT;
@@ -44,9 +46,11 @@ import org.tizen.injector.protocol.StructureGA;
 import org.tizen.injector.provider.AbstractInjectorItem;
 import org.tizen.injector.provider.AbstractInjectorPage;
 import org.tizen.injector.receiver.AbstractInjectorReceiver;
+import org.tizen.injector.view.InjectorView;
 import org.tizen.telephony.sms.encription.DecodeMsg;
 import org.tizen.telephony.sms.encription.EncodeMsg;
 import org.tizen.telephony.sms.encription.EnumConstants;
+import org.tizen.telephony.sms.encription.SMS_USERDATA;
 import org.tizen.telephony.sms.encription.SmsAddressInfo;
 import org.tizen.telephony.sms.encription.TPDU_SMS_DELIVER;
 import org.tizen.telephony.sms.encription.TPDU_SMS_SUBMIT;
@@ -93,7 +97,7 @@ ISelectionListener{
        private IDevice currentDevice;
        
        protected void createContents() {
-               ConnectionPlugin.getDefault().addSelectionListener(this);
+               InjectorView.getDefault().addSelectionListener(this);
                currentDevice = ConnectionPlugin.getDefault().getCurrentDevice();
                createSentStatusSection();
                createMobileTerminateSection();
@@ -337,30 +341,66 @@ ISelectionListener{
                tpdu_deliver.scts = tm;
                tpdu_deliver.dcs = scheme;
                tpdu_deliver.udl = 0;
-//             tpdu_deliver.userData = String.format(
-//                             txtMobileTerminateMessageText.getText()).toCharArray();
-               tpdu_deliver.userData = txtMobileTerminateMessageText.getText().toCharArray();
-
-               int packet_len = encode.EncodeSmsDeliverTpdu(SCA, tpdu_deliver, packet,
-                               pid, dcs);
-               final byte[] data = convertToByte(packet, packet_len);
-
-               G04A01 ga = new G04A01() {
-                       protected void makeBody() {
-                               StructureGA ga = getBody();
-                               ga.addByteArrayItem("DATA", data.length); //$NON-NLS-1$
+
+               ArrayList<SMS_USERDATA> dataArray = getUserData(txtMobileTerminateMessageText.getText());
+               if (dataArray.size() > 1) {
+                       tpdu_deliver.udhi = true;
+               }
+
+               for (SMS_USERDATA userData : dataArray) {
+                       tpdu_deliver.userData = userData;
+                       int packet_len = encode.EncodeSmsDeliverTpdu(SCA, tpdu_deliver, packet,
+                                       pid, dcs);
+                       final byte[] data = convertToByte(packet, packet_len);
+
+                       G04A01 ga = new G04A01() {
+                               protected void makeBody() {
+                                       StructureGA ga = getBody();
+                                       ga.addByteArrayItem("DATA", data.length); //$NON-NLS-1$
+                               }
+                       };
+                       ga.intialize();
+
+                       StructureGA sga = ga.getBody();
+                       sga.setByteArray("DATA", data); //$NON-NLS-1$
+
+                       try {
+                               injectorSocket.send(ga);
+                       } catch (Exception e) {
+                               e.printStackTrace();
                        }
-               };
-               ga.intialize();
 
-               StructureGA sga = ga.getBody();
-               sga.setByteArray("DATA", data); //$NON-NLS-1$
+               }
+       }
 
-               try {
-                       injectorSocket.send(ga);
-               } catch (Exception e) {
-                       e.printStackTrace();
+       private ArrayList<SMS_USERDATA> getUserData(String message) {
+               ArrayList<SMS_USERDATA> list = new ArrayList<SMS_USERDATA>();
+               int length = 60; //temp length
+               int count = message.length() / length; 
+               count = count + 1;
+               int index = 0;
+               SMS_USERDATA userData;
+
+               for (int i = 0; i < count; i++) {
+                       userData = new SMS_USERDATA();
+                       try {
+                               int len = index+length > (message.length() - index) ? (message.length() - index)
+                                                 : index + length;
+                               userData.data = message.substring(index, index + len).getBytes("ISO-10646-UCS-2");
+                               userData.length = userData.data.length;
+                               userData.headerCnt = 1;
+                               userData.setSMSUDH((char)0x00, (short)0x0000, (char)count, (char)(i+1));
+                       } catch (UnsupportedEncodingException e) {
+                               e.printStackTrace();
+                               continue;
+                       }
+                       if (count == 1) {
+                               userData.headerCnt = 0;
+                       }
+                       list.add(userData);
+                       index = index + length;
                }
+               return list;
        }
 
        private byte[] convertToByte(char[] buf, int length) {
@@ -449,8 +489,17 @@ ISelectionListener{
                        tpdu_deliver.dcs = scheme;
                        tpdu_deliver.udl = 0;
                        String msg = "Message delivered.";
-                       tpdu_deliver.userData = msg.toCharArray();
-
+                       SMS_USERDATA userData1 = new SMS_USERDATA();
+                       try {
+                               userData1.data = msg.getBytes("ISO-10646-UCS-2");
+                               userData1.length = userData1.data.length;
+                               userData1.headerCnt = 0;
+                               userData1.setSMSUDH((char)0x00, (short)0x0000, (char)2, (char)1);
+                               tpdu_deliver.userData = userData1;
+                       } catch (UnsupportedEncodingException e1) {
+                               // TODO Auto-generated catch block
+                               e1.printStackTrace();
+                       }
                        int packet_len = encode.EncodeSmsDeliverTpdu(SCA, tpdu_deliver, packet,
                                        pid, dcs);
                        final byte[] data = convertToByte(packet, packet_len);
index a675791..08ae985 100644 (file)
@@ -1,19 +1,19 @@
 Package:telephony-eplugin
-Version:0.2.4
+Version:0.2.10
 OS:linux
 Build-host-os:linux
 Maintainer:yeongkyoon Lee <yeongkyoon.lee@samsung.com>, sungmin Ha <sungmin82.ha@samsung.com>
 Description:Telephony for EventInjector
 Build-dependency:indigo-pde[linux], common-eplugin[linux], eventinjector-eplugin[linux]
-Install-dependency:base-ide-product[linux]
+Install-dependency:common-eplugin[linux], base-ide-product[linux]
 Source:telephony-eplugin
 
 Package:telephony-eplugin
-Version:0.2.4
+Version:0.2.10
 OS:windows
 Build-host-os:linux
 Maintainer:yeongkyoon Lee <yeongkyoon.lee@samsung.com>, sungmin Ha <sungmin82.ha@samsung.com>
 Description:Telephony for EventInjector
 Build-dependency:indigo-winpde[windows], common-eplugin[linux], eventinjector-eplugin[linux]
-Install-dependency:base-ide-product[windows]
+Install-dependency:common-eplugin[windows], base-ide-product[windows]
 Source:telephony-eplugin