zyneo.sms
Class Sms

java.lang.Object
  |
  +--zyneo.sms.Sms
All Implemented Interfaces:
java.io.Serializable

public class Sms
extends java.lang.Object
implements java.io.Serializable

Represents an Sms message. All GSM-numbers must be in valid international format, for example +46702051108.

Version:
SmsBase-1-0-0
Author:
Niklas Andersson
See Also:
Serialized Form

Field Summary
protected  java.lang.String m_from
          GSM-number which this message orginated from (might be null if MT orginated message).
protected  java.lang.String m_message
          The actual message.
protected  boolean m_notify
          True if notifications are wanted
protected  java.util.Date m_time
          Message time, the time the message was sent/received
protected  java.lang.String m_to
          GSM-number do send this message to (might be null if MT designated message.)
protected  java.util.Date m_valid_until
          Valid time, the validity time for this message, if null then provider/SMSC specific default value will be used.
 
Constructor Summary
Sms()
          Default constructor.
Sms(java.lang.String to, java.lang.String message)
          Constructor for MT designated messages.
Sms(java.lang.String from, java.lang.String message, java.util.Date time)
          Constructor for MT designated messages.
 
Method Summary
 java.util.Date getExpire()
          Retrives the current validity limit.
 java.lang.String getFrom()
          Retrives from-number.
 java.lang.String getMessage()
          Retrives the message-text
 boolean getNotify()
          Retrives the "notification requested" flag.
 java.util.Date getTime()
          Retrives the time when message was arrived if MT designated message, otherwise null.
 java.lang.String getTo()
          Retrives current to number.
 void setExpire(java.util.Date expire)
          Sets the valid-time.
 void setFrom(java.lang.String from)
          Sets from number.
 void setMessage(java.lang.String text)
          Sets the message-text.
 void setNotify(boolean b)
          Sets the "notifications requested" flag.
 void setTo(java.lang.String to)
          Sets the to number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_to

protected java.lang.String m_to
GSM-number do send this message to (might be null if MT designated message.)


m_from

protected java.lang.String m_from
GSM-number which this message orginated from (might be null if MT orginated message).


m_message

protected java.lang.String m_message
The actual message.


m_valid_until

protected java.util.Date m_valid_until
Valid time, the validity time for this message, if null then provider/SMSC specific default value will be used.


m_notify

protected boolean m_notify
True if notifications are wanted


m_time

protected java.util.Date m_time
Message time, the time the message was sent/received

Constructor Detail

Sms

public Sms()
Default constructor. Creates an empty Sms, all properties will be set to null.


Sms

public Sms(java.lang.String to,
           java.lang.String message)
Constructor for MT designated messages. Creates a SMS-message setting to number and message to supplied values, other properties will be set to null.

Parameters:
to - International GSM number to send to
message - the text message (max 160 chars)
Since:
SmsBase-1-0-0

Sms

public Sms(java.lang.String from,
           java.lang.String message,
           java.util.Date time)
Constructor for MT designated messages. Creates a message setting supplied properties and leaving all others set to null.

Parameters:
from - from number.
message - the message
time - the time the message was received.
Since:
SmsBase-1-0-0
Method Detail

setTo

public void setTo(java.lang.String to)
Sets the to number. Sets the to-number for this message.

Parameters:
to - valid international GSM number
Since:
SmsBase-1-0-0

getTo

public java.lang.String getTo()
Retrives current to number. Retrives the current to number.

Returns:
The current to number or null if not set.
Since:
SmsBase-1-0-0

setFrom

public void setFrom(java.lang.String from)
Sets from number.

Parameters:
from - from number
Since:
SmsBase-1-0-0

getFrom

public java.lang.String getFrom()
Retrives from-number.

Returns:
from number or null if not set
Since:
SmsBase-1-0-0

setMessage

public void setMessage(java.lang.String text)
Sets the message-text. The message can only be 160 characters, if it is longer then it will be truncated to 160 characters.

Parameters:
text - the message text.
Since:
SmsBase-1-0-0

getMessage

public java.lang.String getMessage()
Retrives the message-text

Returns:
the message text or null if an empty message or not set.
Since:
SmsBase-1-0-0

setExpire

public void setExpire(java.util.Date expire)
Sets the valid-time. Sets the validity time for the message, if null then the default value for the provider / SMSC will be used.

Parameters:
expire - The time this message expires.
Since:
SmsBase-1-0-0

getExpire

public java.util.Date getExpire()
Retrives the current validity limit.

Returns:
the current validity period or null, null means "use provider / SMSC default"
Since:
SmsBase-1-0-0

setNotify

public void setNotify(boolean b)
Sets the "notifications requested" flag. If notifications is not supported by the provider, then this flag will be ignored. Also, a iNotifier interface must have been provided to provider in order for notifications to work.

Parameters:
b - if true notifications is requested
Since:
SmsBase-1-0-0
See Also:
zyneo.sms.provider.iNotify

getNotify

public boolean getNotify()
Retrives the "notification requested" flag.

Returns:
true if notifications are requested otherwise false.
Since:
SmsBase-1-0-0

getTime

public java.util.Date getTime()
Retrives the time when message was arrived if MT designated message, otherwise null.

Returns:
time when message arrived or null
Since:
SmsBase-1-0-0


Copyright © 2002 Zyneo. All Rights Reserved.