View Javadoc

1   /* ***** BEGIN LICENSE BLOCK *****
2    * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3    *
4    * The contents of this file are subject to the Mozilla Public License Version
5    * 1.1 (the "License"); you may not use this file except in compliance with
6    * the License. You may obtain a copy of the License at
7    * http://www.mozilla.org/MPL/
8    *
9    * Software distributed under the License is distributed on an "AS IS" basis,
10   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11   * for the specific language governing rights and limitations under the
12   * License.
13   *
14   * The Original Code is "SMS Library for the Java platform".
15   *
16   * The Initial Developer of the Original Code is Markus Eriksson.
17   * Portions created by the Initial Developer are Copyright (C) 2002
18   * the Initial Developer. All Rights Reserved.
19   *
20   * Contributor(s):
21   *
22   * Alternatively, the contents of this file may be used under the terms of
23   * either the GNU General Public License Version 2 or later (the "GPL"), or
24   * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
25   * in which case the provisions of the GPL or the LGPL are applicable instead
26   * of those above. If you wish to allow use of your version of this file only
27   * under the terms of either the GPL or the LGPL, and not to allow others to
28   * use your version of this file under the terms of the MPL, indicate your
29   * decision by deleting the provisions above and replace them with the notice
30   * and other provisions required by the GPL or the LGPL. If you do not delete
31   * the provisions above, a recipient may use your version of this file under
32   * the terms of any one of the MPL, the GPL or the LGPL.
33   *
34   * ***** END LICENSE BLOCK ***** */
35  package org.marre.sms.transport.ucp;
36  
37  import org.marre.util.StringUtil;
38  
39  /***
40   * 
41   * @author Markus Eriksson
42   * @version $Id: UcpSeries50.java,v 1.10 2005/11/26 16:37:14 c95men Exp $
43   */
44  public class UcpSeries50 extends UcpMsg
45  {
46      public static final byte OP_SUBMIT_SHORT_MESSAGE = 51;
47      public static final byte OP_DELIVER_SHORT_MESSAGE = 52;
48      public static final byte OP_DELIVER_NOTIFICATION = 53;
49      public static final byte OP_MODIFY_MESSAGE = 54;
50      public static final byte OP_INQUIRY_MESSAGE = 55;
51      public static final byte OP_DELETE_MESSAGE = 56;
52      public static final byte OP_RESPONSE_INQUIRY_MESSAGE = 57;
53      public static final byte OP_RESPONSE_DELETE_MESSAGE = 58;
54  
55      public static final byte XSER_TYPE_UDH = 1;
56      public static final byte XSER_TYPE_DCS = 2;
57  
58      protected static final int FIELD_ADC = 0;
59      protected static final int FIELD_OADC = 1;
60      protected static final int FIELD_AC = 2;
61      protected static final int FIELD_NRQ = 3;
62      protected static final int FIELD_NADC = 4;
63      protected static final int FIELD_NT = 5;
64      protected static final int FIELD_NPID = 6;
65      protected static final int FIELD_LRQ = 7;
66      protected static final int FIELD_LRAD = 8;
67      protected static final int FIELD_LPID = 9;
68      protected static final int FIELD_DD = 10;
69      protected static final int FIELD_DDT = 11;
70      protected static final int FIELD_VP = 12;
71      protected static final int FIELD_RPID = 13;
72      protected static final int FIELD_SCTS = 14;
73      protected static final int FIELD_DST = 15;
74      protected static final int FIELD_RSN = 16;
75      protected static final int FIELD_DSCTS = 17;
76      protected static final int FIELD_MT = 18;
77      protected static final int FIELD_NB = 19;
78      protected static final int FIELD_MSG = 20; // NMsg, AMsg or TMsg (MT)
79      protected static final int FIELD_MMS = 21;
80      protected static final int FIELD_PR = 22;
81      protected static final int FIELD_DCS = 23;
82      protected static final int FIELD_MCLS = 24;
83      protected static final int FIELD_RPI = 25;
84      protected static final int FIELD_CPG = 26;
85      protected static final int FIELD_RPLY = 27;
86      protected static final int FIELD_OTOA = 28;
87      protected static final int FIELD_HPLMN = 29;
88      protected static final int FIELD_XSER = 30;
89      protected static final int FIELD_RES4 = 31;
90      protected static final int FIELD_RES5 = 32;
91  
92      public UcpSeries50(byte operation)
93      {
94          super(33);
95          setOR('O');
96          setOT(operation);
97      }
98  
99      public void clearXSer()
100     {
101         ucpFields_[FIELD_XSER] = null;
102     }
103 
104     public void addXSer(byte type, byte data)
105     {
106         StringBuffer xSerBuff = new StringBuffer();
107 
108         xSerBuff.append(StringUtil.byteToHexString(type));
109         xSerBuff.append("01");
110         xSerBuff.append(StringUtil.byteToHexString(data));
111 
112         ucpFields_[FIELD_XSER] = (ucpFields_[FIELD_XSER] == null) ? (xSerBuff.toString())
113                 : (ucpFields_[FIELD_XSER] + xSerBuff.toString());
114     }
115 
116     public void addXSer(byte type, byte[] data)
117     {
118         StringBuffer xSerBuff = new StringBuffer();
119 
120         xSerBuff.append(StringUtil.byteToHexString(type));
121         xSerBuff.append(StringUtil.byteToHexString((byte) (data.length + 1 & 0xff)));
122         xSerBuff.append(StringUtil.byteToHexString((byte) (data.length & 0xff)));
123         xSerBuff.append(StringUtil.bytesToHexString(data));
124 
125         ucpFields_[FIELD_XSER] = (ucpFields_[FIELD_XSER] == null) ? (xSerBuff.toString())
126                 : (ucpFields_[FIELD_XSER] + xSerBuff.toString());
127     }
128 }