public class MessageEvent
extends java.util.EventObject
implements java.lang.Cloneable
In order to receive MessageEvents, you have to register yourself as
MessageEventListener
with the SmsService.
If the MessageEvent is of type
STATUS_REPORT, the Message attached to this event (see getMessage()
)
can safely be cast to a StatusReportMessage
in
order to get additional status information.
Modifier and Type | Field and Description |
---|---|
static int |
DEVICE_NOT_READY
Event type: connection to the device has been closed (disconnected)
|
static int |
DEVICE_NOT_RESPONDING
Event Type: Device not responding.
|
static int |
DEVICE_READY
Event type: device is ready to use (connected)
|
static int |
INCOMING_CALL
Event Type: Incoming call.
|
static int |
MESSAGE_NOT_SENT
Event Type: Message Not Sent
|
static int |
MESSAGE_RECEIVED
Event Type: Message Received
|
static int |
MESSAGE_SENT
Event Type: Message Sent
|
static int |
MULTIPART_FAILURE
Event Type: not all parts of a MultipartMessage received within a certain time
|
static int |
NETWORK_DISCONNECTED
Event Type: Network registration not ready.
|
static int |
RECEIVING_STARTED
Event Type: Receiving started
|
static int |
RECEIVING_STOPPED
Event Type: Receiving stopped
|
static int |
STATUS_RECEIVED
Event type: status report received
|
Constructor and Description |
---|
MessageEvent(int type,
Message msg,
java.lang.Object source)
Constructs a MessageEvent with the specified event type and message.
|
MessageEvent(int type,
Message msg,
java.lang.Object source,
java.lang.Exception exception)
Constructs a MessageEvent with the specified event type and message.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Create a "deep" copy of this MessageEvent.
|
java.lang.Exception |
getException()
Return the Exception that triggered this event.
|
Message |
getMessage()
Get the message associated to this event.
|
int |
getType()
Returns the type of event (e.g.
|
void |
throwException()
Throw exception eventually associated with this event.
|
java.lang.String |
toString()
Returns a "human" readable description of the message event type.
|
public static final int MESSAGE_RECEIVED
public static final int MESSAGE_SENT
public static final int DEVICE_READY
public static final int DEVICE_NOT_READY
public static final int STATUS_RECEIVED
public static final int MESSAGE_NOT_SENT
public static final int RECEIVING_STARTED
public static final int RECEIVING_STOPPED
public static final int NETWORK_DISCONNECTED
GsmSmsService
public static final int DEVICE_NOT_RESPONDING
keep-alive feature
is enabled and keep-alive
detects that the communication with the SMSC/GSM device is
broken.public static final int INCOMING_CALL
GsmSmsService
when the modem indicates
a "RING".public static final int MULTIPART_FAILURE
public MessageEvent(int type, Message msg, java.lang.Object source)
type
- of this eventmsg
- the messagesource
- the object on wich the event occurredpublic MessageEvent(int type, Message msg, java.lang.Object source, java.lang.Exception exception)
type
- of this eventmsg
- the messagesource
- the object on wich the event occurredexception
- the exception that caused this MessageEventpublic int getType()
DEVICE_READY
).public Message getMessage()
StatusReportMessage
.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.String toString()
toString
in class java.util.EventObject
public java.lang.Exception getException()
public void throwException() throws java.lang.Exception
Exception ex = getException(); if( ex != null ) throw ex;
java.lang.Exception
object XP, Inc. © 2000-2013. All rights reserved object XP