com.java4less.sms.ucp
Class SmsSender

java.lang.Object
  |
  +--com.java4less.sms.ucp.SmsSender

public class SmsSender
extends java.lang.Object

This is a high level class for sending SMSs. Example of use:

  // create object
 TcpIpAdapter tcp=new TcpIpAdapter();
 tcp.connect(ServerAddress,port);

  // send the sms now using the tcp/ip adapter
  SmsSender sender=new SmsSender(tcp);
  sender.createSMS51("123","456","Hello");
  if (!sender.sendMessage()) {
    System.out.println("Error is "+  ((ResponseMessage) sender.getCurrentResponse()).errorDescription);
  }
  else  System.out.println("SMS was sent successfully");

  tcp.disconnect();
 


Constructor Summary
SmsSender(Adapter adapter)
           
 
Method Summary
 void createSMS01(java.lang.String from, java.lang.String destination, java.lang.String message)
          create submit message using operation 01
 void createSMS30(java.lang.String from, java.lang.String destination, java.lang.String message)
          create submit message using operation 30
 void createSMS51(java.lang.String from, java.lang.String destination, java.lang.String message)
          create submit message using operation 51
 void createSMS60(java.lang.String from, java.lang.String password)
          create open session message
 UcpMessage getCurrentMessage()
          get message we have created
 UcpMessage getCurrentResponse()
          get response message we have received
 boolean sendMessage()
          send created message, returns true if it was successfull and false if there was a negative response from the server.
 boolean sendMessage(UcpMessage currentMessage)
          send message, returns true if it was successfull and false if there was a negative response from the server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SmsSender

public SmsSender(Adapter adapter)
Method Detail

getCurrentMessage

public UcpMessage getCurrentMessage()
get message we have created


getCurrentResponse

public UcpMessage getCurrentResponse()
get response message we have received


createSMS30

public void createSMS30(java.lang.String from,
                        java.lang.String destination,
                        java.lang.String message)
                 throws SmsException
create submit message using operation 30

SmsException

createSMS01

public void createSMS01(java.lang.String from,
                        java.lang.String destination,
                        java.lang.String message)
                 throws SmsException
create submit message using operation 01

SmsException

createSMS51

public void createSMS51(java.lang.String from,
                        java.lang.String destination,
                        java.lang.String message)
                 throws SmsException
create submit message using operation 51

SmsException

createSMS60

public void createSMS60(java.lang.String from,
                        java.lang.String password)
                 throws SmsException
create open session message

SmsException

sendMessage

public boolean sendMessage()
                    throws java.lang.Exception
send created message, returns true if it was successfull and false if there was a negative response from the server.

java.lang.Exception

sendMessage

public boolean sendMessage(UcpMessage currentMessage)
                    throws java.lang.Exception
send message, returns true if it was successfull and false if there was a negative response from the server.

java.lang.Exception