|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.marre.SmsSender
High level API to the smsj library. If you only need to send some basic SMS messages than you only have to use this API. Ex:
try { // Send SMS with clickatell SmsSender smsSender = SmsSender.getClickatellSender("username", "password", "apiid"); String msg = "A sample SMS."; // International number to reciever without leading "+" String reciever = "464545425463"; // Number of sender (not supported on all transports) String sender = "46534534535"; // Connect smsSender.connect(); // Send message smsSender.send("A sample SMS.", reciever, sender); // Disconnect smsSender.disconnect(); } catch (IOException ex) { ex.printStackTrace(); } catch (SmsException ex) { ex.printStackTrace(); }
Field Summary | |
protected SmsTransport |
transport_
The sms transport that is used to send the messages. |
Constructor Summary | |
SmsSender(java.lang.String transport,
java.util.Properties props)
Creates a SmsSender object by using the given transport and properties. |
Method Summary | |
void |
connect()
Connect to the server. |
void |
disconnect()
Call this when you are done with the SmsSender object. |
protected void |
finalize()
Probably never called, but good to have if the caller forget to disconnect(). |
static SmsSender |
getClickatellSender(java.lang.String propsFilename)
Convenience method to create a SmsSender object that knows how to send messages with the Clickatell service. |
static SmsSender |
getClickatellSender(java.lang.String username,
java.lang.String password,
java.lang.String apiid)
Convenience method to create a SmsSender object that knows how to send messages with the Clickatell service. |
static SmsSender |
getGsmSender(java.lang.String portName)
Convenience method to create a SmsSender object that knows how to send messages with a GSM phone attached to the serial port on your computer. |
static SmsSender |
getPsWinCommXmlSender(java.lang.String propsFilename)
Convenience method to create a SmsSender object that knows how to send messages via PSWinComm |
static SmsSender |
getPsWinCommXmlSender(java.lang.String username,
java.lang.String password)
Convenience method to create a SmsSender object that knows how to send messages via PSWinComm |
static SmsSender |
getUcpSender(java.lang.String propsFilename)
Convenience method to create a SmsSender object that knows how to send messages with a UCP SMSC. |
static SmsSender |
getUcpSender(java.lang.String address,
int port)
Convenience method to create a SmsSender object that knows how to send messages with a UCP SMSC. |
static SmsSender |
getUcpSender(java.lang.String address,
int port,
java.lang.String ucp60Uid,
java.lang.String ucp60Pwd)
Convenience method to create a SmsSender object that knows how to send messages with a UCP SMSC. |
java.lang.String |
sendMmsNotification(java.lang.String contentLocation,
long size,
java.lang.String subject,
java.lang.String dest)
Sends a simple MMS Notification. |
java.lang.String |
sendMsgWaitingEmail(int count,
java.lang.String dest)
Sends a email message waiting message indication. |
java.lang.String |
sendMsgWaitingFax(int count,
java.lang.String dest)
Sends a fax message waiting message indication. |
java.lang.String |
sendMsgWaitingVoice(int count,
java.lang.String dest)
Sends a voice message waiting message indication. |
java.lang.String |
sendNokiaBookmark(java.lang.String title,
java.lang.String url,
java.lang.String dest)
Sends an OTA Bookmark (Nokia specification) to the given recipient |
java.lang.String |
sendSms(SmsMessage msg,
java.lang.String dest,
java.lang.String sender)
Sends a SmsMessage. |
java.lang.String |
sendTextSms(java.lang.String text,
java.lang.String dest)
Sends an ordinary SMS to the given recipient. |
java.lang.String |
sendTextSms(java.lang.String text,
java.lang.String dest,
java.lang.String sender)
Sends an ordinary SMS to the given recipient. |
java.lang.String |
sendUnicodeTextSms(java.lang.String text,
java.lang.String dest)
Sends an ordinary SMS to the given recipient. |
java.lang.String |
sendUnicodeTextSms(java.lang.String text,
java.lang.String dest,
java.lang.String sender)
Sends an ordinary SMS to the given recipient. |
java.lang.String |
sendWapSiPushMsg(java.lang.String url,
java.lang.String text,
java.lang.String dest)
Sends a Wap Push SI containing to the given recipient. |
java.lang.String |
sendWapSlPushMsg(java.lang.String url,
java.lang.String dest)
Sends a Wap Push SL containing to the given recipient. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected SmsTransport transport_
Constructor Detail |
public SmsSender(java.lang.String transport, java.util.Properties props) throws SmsException
You can also use getClickatellSender(...) to create a SmsSender object
transport
- Classname of the SmsTransport classprops
- Properties to initialize the transport with
SmsException
Method Detail |
public static SmsSender getClickatellSender(java.lang.String username, java.lang.String password, java.lang.String apiid) throws SmsException
username
- Clickatell usernamepassword
- Clickatell passwordapiid
- Clickatell api-id
SmsException
public static SmsSender getClickatellSender(java.lang.String propsFilename) throws SmsException, java.io.IOException
propsFilename
- Filename of a properties file containing properties for the
clickatell transport.
SmsException
java.io.IOException
public static SmsSender getGsmSender(java.lang.String portName) throws SmsException
portName
- Serial port where your phone is located. Ex "COM1:"
SmsException
public static SmsSender getUcpSender(java.lang.String address, int port) throws SmsException
address
- A string with the ip address or host name of the SMSCport
- An integer with the ip port on which the SMSC listens
SmsException
public static SmsSender getUcpSender(java.lang.String address, int port, java.lang.String ucp60Uid, java.lang.String ucp60Pwd) throws SmsException
address
- A string with the ip address or host name of the SMSCport
- An integer with the ip port on which the SMSC listensucp60Uid
- A string containing the UCP60 useriducp60Pwd
- A string containing the UCP60 password
SmsException
public static SmsSender getUcpSender(java.lang.String propsFilename) throws SmsException, java.io.IOException
propsFilename
- A string containt a filename with the serialized Properties
object for the transport
SmsException
java.io.IOException
public static SmsSender getPsWinCommXmlSender(java.lang.String username, java.lang.String password) throws SmsException
username
- PsWinComm usernamepassword
- PsWinComm password
SmsException
public static SmsSender getPsWinCommXmlSender(java.lang.String propsFilename) throws SmsException, java.io.IOException
propsFilename
- Filename of a properties file containing properties for the
pswincomm transport.
SmsException
java.io.IOException
public java.lang.String sendTextSms(java.lang.String text, java.lang.String dest, java.lang.String sender) throws SmsException, java.io.IOException
text
- Message to senddest
- Destination number (international format without leading +).sender
- Sender number (international format without leading +). Can also be an alphanumerical string like
"SMSJ". This is property is not supported by all transports.
SmsException
java.io.IOException
public java.lang.String sendTextSms(java.lang.String text, java.lang.String dest) throws SmsException, java.io.IOException
text
- Message to senddest
- Destination number (international format without leading +).
SmsException
java.io.IOException
public java.lang.String sendUnicodeTextSms(java.lang.String text, java.lang.String dest, java.lang.String sender) throws SmsException, java.io.IOException
text
- Message to senddest
- Destination number (international format without leading +).sender
- Sender number (international format without leading +). Can also be an alphanumerical string like
"SMSJ". This is property is not supported by all transports.
SmsException
java.io.IOException
public java.lang.String sendUnicodeTextSms(java.lang.String text, java.lang.String dest) throws SmsException, java.io.IOException
text
- Message to senddest
- Destination number (international format without leading +).
SmsException
java.io.IOException
public java.lang.String sendNokiaBookmark(java.lang.String title, java.lang.String url, java.lang.String dest) throws SmsException, java.io.IOException
title
- String with the title of the bookmarkurl
- String with the url referenced by the bookmarkdest
- Destination number (international format without leading +).
SmsException
java.io.IOException
public java.lang.String sendWapSiPushMsg(java.lang.String url, java.lang.String text, java.lang.String dest) throws SmsException, java.io.IOException
text
- String with the description of the serviceurl
- String with the url referenced by the SIdest
- Destination number (international format without leading +).
SmsException
java.io.IOException
public java.lang.String sendWapSlPushMsg(java.lang.String url, java.lang.String dest) throws SmsException, java.io.IOException
url
- String with the url referenced by the SLdest
- Destination number in international format
SmsException
java.io.IOException
public java.lang.String sendMmsNotification(java.lang.String contentLocation, long size, java.lang.String subject, java.lang.String dest) throws SmsException, java.io.IOException
contentLocation
- Where the mms pdu can be downloaded from.size
- The size of the message.subject
- The subject of the message.dest
- Destination number (international format without leading +).
SmsException
java.io.IOException
public java.lang.String sendMsgWaitingVoice(int count, java.lang.String dest) throws SmsException, java.io.IOException
count
- Number of messages waiting. Set to 0 to clear the message waiting flag in the phone.dest
- Destination number (international format without leading +).
SmsException
java.io.IOException
public java.lang.String sendMsgWaitingFax(int count, java.lang.String dest) throws SmsException, java.io.IOException
count
- Number of messages waiting. Set to 0 to clear the message waiting flag in the phone.dest
- Destination number (international format without leading +).
SmsException
java.io.IOException
public java.lang.String sendMsgWaitingEmail(int count, java.lang.String dest) throws SmsException, java.io.IOException
count
- Number of messages waiting. Set to 0 to clear the message waiting flag in the phone.dest
- Destination number (international format without leading +).
SmsException
java.io.IOException
public java.lang.String sendSms(SmsMessage msg, java.lang.String dest, java.lang.String sender) throws SmsException, java.io.IOException
msg
- The message to send.dest
- Destination number (international format without leading +)
Ex. 44546754235sender
- Destination number (international format without leading +).
Can also be an alphanumerical string. Ex "SMSJ". (not
supported by all transports).
SmsException
java.io.IOException
public void connect() throws SmsException, java.io.IOException
SmsException
java.io.IOException
public void disconnect() throws SmsException, java.io.IOException
SmsException
java.io.IOException
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
Object.finalize()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |