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;
36  
37  /***
38   * A port addressed message that delegates the text part to SmsTextMessage.
39   *   
40   * @author Markus
41   * @version $Id: SmsPortAddressedTextMessage.java,v 1.1 2005/11/26 14:50:12 c95men Exp $
42   */
43  public class SmsPortAddressedTextMessage extends SmsPortAddressedMessage
44  {
45      /*** The text message part. */ 
46      protected SmsTextMessage smsTextMessage_;
47      
48      /***
49       * Creates a new SmsPortAddressedTextMessage with default 6Bit GSM Alphabet.
50       *
51       * @param destPort
52       * @param origPort
53       * @param msg
54       */
55      public SmsPortAddressedTextMessage(int destPort, int origPort, String msg)
56      {
57          super(destPort, origPort);
58          smsTextMessage_ = new SmsTextMessage(msg);
59      }
60      
61      /***
62       * Creates a new SmsPortAddressedTextMessage with the given alphabet and message class.
63       * <p>
64       * alphabet can be any of:<br>
65       * - SmsConstants.ALPHABET_GSM<br>
66       * - SmsConstants.ALPHABET_8BIT<br>
67       * - SmsConstants.ALPHABET_UCS2<br>
68       * <p>
69       * messageClass can be any of:<br>
70       * - SmsConstants.MSG_CLASS_0 (Often called a FLASH message)<br>
71       * - SmsConstants.MSG_CLASS_1<br>
72       * - SmsConstants.MSG_CLASS_2<br>
73       * - SmsConstants.MSG_CLASS_3<br>
74       * 
75       * @param destPort
76       * @param origPort
77       * @param theMsg
78       * @param alphabet
79       * @param messageClass
80       */
81      public SmsPortAddressedTextMessage(int destPort, int origPort, String theMsg, int alphabet, byte messageClass)
82      {
83          super(destPort, origPort);
84          smsTextMessage_ = new SmsTextMessage(theMsg, alphabet, messageClass);
85      }
86      
87      /***
88       * Creates a SmsPortAddressedTextMessage with the given dcs.
89       * 
90       * @param destPort
91       * @param origPort
92       * @param msg
93       * @param dcs
94       */
95      public SmsPortAddressedTextMessage(int destPort, int origPort, String msg, SmsDcs dcs)
96      {
97          super(destPort, origPort);
98          smsTextMessage_ = new SmsTextMessage(msg, dcs);
99      }
100 
101     public SmsUserData getUserData()
102     {
103         return smsTextMessage_.getUserData();
104     }
105     
106     /***
107      * Returns the text message. 
108      */
109     public String getText()
110     {
111         return smsTextMessage_.getText();
112     }
113     
114     /***
115      * Sets the text.
116      * 
117      * @param text
118      */
119     public void setText(String text)
120     {
121         smsTextMessage_.setText(text);
122     }
123 
124     /***
125      * Sets the text.
126      * 
127      * @param text
128      */
129     public void setText(String text, SmsDcs dcs)
130     {
131         smsTextMessage_.setText(text, dcs);
132     }
133     
134     /***
135      * Returns the dcs.
136      */
137     public SmsDcs getDcs()
138     {
139         return smsTextMessage_.getDcs();
140     }
141 }