sms with at commands

N

navigator87

Hi,
does someone know some example that handle me to send an sms with a
java applet that use at commands?
thanks...
 
V

vj

Hi ,


I worked on a project for sending & receiving sms messages from a
java application. You need Sun Comm API for this purpose and you GPRS
compatible device sould be attached to a physical/virtual comm port.
Since you havent mentioned the os you are working on i assume it to be
Windows. Unfortunatly last time i went to sun web site the support from
Comm API for windows was dropped. So you will have to hunt around the
web for getting the necessary API package.

Once you have installed the package you simply have to open the
necessary comm port in your code and pass it the necessary AT+CMGS
command in ascii codes to send your SMS.

Regards,

VJ
 
V

vj

Hi ,

I worked on a project for sending & receiving sms messages from a java
application some time back. You need Sun Comm API for this purpose and
you GPRS compatible device sould be attached to a physical/virtual comm
port. Since you havent mentioned the os you are working on i assume it
to be Windows. Unfortunatly last time i went to sun web site the
support from Comm API for windows was dropped. So you will have to hunt
around the web for getting the necessary API package.

Once you have installed the package you simply have to open the
necessary comm port in your code and pass it the necessary AT+CMGS
command in ascii codes to send your SMS.

Regards,

VJ
 
V

vj

Hi ,

I worked on a project for sending & receiving sms messages from a java
application some time back. You need Sun Comm API for this purpose and
you GPRS compatible device sould be attached to a physical/virtual comm
port. Since you havent mentioned the os you are working on i assume it
to be Windows. Unfortunatly last time i went to sun web site the
support from Comm API for windows was dropped. So you will have to hunt
around the web for getting the necessary API package.

Once you have installed the package you simply have to open the
necessary comm port in your code and pass it the necessary AT+CMGS
command in ascii codes to send your SMS.

Regards,

VJ
 
N

navigator87

tahks for your help.. i found comm api, but te problem is to detect the
function that i have to use...
 
V

vj

Here is a code that can be used to send SMS's from your GPRS device.
This code was modified from 'SimpleWrite.java' example taken from
Samples of API Documentation. Beware that this code has'nt been tested.
So use it at your own risk.


import java.io.*;
import java.util.*;
import javax.comm.*;

public class SimpleWrite {
static Enumeration portList;
static CommPortIdentifier portId;
static String commands[] =
{"AT+CMGS=1","AT+CMGS=\"9292912345\","Hello there"};
static byte[] newline[]={(byte)13,(byte)10}
static SerialPort serialPort;
static OutputStream outputStream;

public static void main(String[] args) {
portList = CommPortIdentifier.getPortIdentifiers();

while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL)

{
if (portId.getName().equals("COM1")) //your comm port
{
try {
serialPort = (SerialPort)
portId.open("SimpleWriteApp", 2000);
} catch (PortInUseException e) {}

try {
//get the output stream
outputStream = serialPort.getOutputStream();
//write the commands string to the output stream
for(int i=0;i<commands.length;i++)
{ outputstream.write(commands); // write command
outputstream.write(newline); //write new line
}
outputStream.write(messageString.getBytes());
} catch (IOException e) {}
}
}
}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SMPP sending chinese message to smsc 1
deadlock and thread 1
send SMS in Java/Linux 10
sms port 2
SMS 0
Sending SMS 4
Create a Java application which sends an sms to a mobile number. 1
Free SMS Website 0

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top