cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leszek Gawron <lgaw...@mobilebox.pl>
Subject Re: Cocoon & Short Message Service
Date Wed, 02 Aug 2006 12:17:03 GMT
Simone Gianni wrote:
> Ciao Omar,
> I used this a few yars ago, to prototype an SMS application, and then
> moved to a commercial HTTP based interface :
> http://javasmslib.sourceforge.net/ . Otherwise, a few years ago, there
> was kannel that interfaced HTTP to an SMS modem/cellphone.
There is also:

http://smsj.sourceforge.net/


example:

> public class SmsSenderImpl implements SmsSender {
> 	private final static Log	logger	= LogFactory.getLog( SmsSenderImpl.class );
> 	private Properties			props;
> 	private SmsTransport		transport;
> 	private String				originator;
> 
> 	public Properties getProps() {
> 		return props;
> 	}
> 
> 	public void setProps( Properties props ) {
> 		this.props = props;
> 	}
> 
> 	public void init() {
> 		try {
> 			this.originator = this.props.getProperty(	"originator",
> 														"123456789" );
> 			this.transport = SmsTransportManager.getTransport(	"org.marre.sms.transport.gsm.GsmTransport",
> 																props );
> 		} catch ( SmsException e ) {
> 			throw new RuntimeException( e );
> 		}
> 	}
> 
> 	public synchronized void send( String recipient, String content ) {
> 		try {
> 			SmsTextMessage textMessage = new SmsTextMessage( content );
> 			transport.connect();
> 			transport.send( textMessage,
> 							new SmsAddress( recipient ),
> 							new SmsAddress( this.originator ) );
> 
> 		} catch ( Exception e ) {
> 			throw new RuntimeException( e );
> 		} finally {
> 			try {
> 				transport.disconnect();
> 			} catch ( Exception e ) {
> 				logger.error( e );
> 			}
> 		}
> 	}
> }

The only thing you have to do is plug your GSM terminal to a COM port 
and enable serial communication in java.

-- 
Leszek Gawron                                      lgawron@mobilebox.pl
IT Manager                                         MobileBox sp. z o.o.
+48 (61) 855 06 67                              http://www.mobilebox.pl
mobile: +48 (501) 720 812                       fax: +48 (61) 853 29 65

Mime
View raw message