hello everyone;
I'm facing a poroblem with sending an sms with SMSlib
here is the code
package sms;
import java.util.Enumeration;
import javax.comm.CommPortIdentifier;
import org.smslib.AGateway;
import org.smslib.IOutboundMessageNotification;
import org.smslib.Library;
import org.smslib.OutboundMessage;
import org.smslib.Service;
import org.smslib.modem.SerialModemGateway;
public class Test
{
public void doIt() throws Exception
{
OutboundMessage msg;
OutboundNotification outboundNotification = new
OutboundNotification();
System.out.println("Example: Send message from a serial gsm
modem.");
System.out.println(Library.getLibraryDescription());
System.out.println("Version: " +
Library.getLibraryVersion());
SerialModemGateway gateway = new
SerialModemGateway("modemDialog", "COM9", 115200, "ZTE", "MF100");
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("0000");
Service.getInstance().setOutboundMessageNotification(outboundNotification);
Service.getInstance().addGateway(gateway);
Service.getInstance().startService();
System.out.println();
System.out.println("Modem Information:");
System.out.println(" Manufacturer: " +
gateway.getManufacturer());
System.out.println(" Model: " + gateway.getModel());
System.out.println(" Serial No: " + gateway.getSerialNo());
System.out.println(" SIM IMSI: " + gateway.getImsi());
System.out.println(" Signal Level: " +
gateway.getSignalLevel() + " dBm");
System.out.println(" Battery Level: " +
gateway.getBatteryLevel() + "%");
System.out.println("Now Sleeping - Hit <enter> to
terminate.");
System.in.read();
Service.getInstance().stopService();
}
public class OutboundNotification implements
IOutboundMessageNotification
{
public void process(AGateway gateway, OutboundMessage msg)
{
System.out.println("Outbound handler called from
Gateway: " + gateway.getGatewayId());
System.out.println(msg);
}
}
public static void main(String args[])
{
Test app = new Test();
try
{
app.doIt();
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
when I'm trying to run this code it show me
Example: Send message from a serial gsm modem.
SMSLib: A Java API library for sending and receiving SMS via a GSM modem or
other supported gateways.
This software is distributed under the terms of the Apache v2.0 License.
Web Site: http://smslib.org
Version: 3.5.3
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
more info.
org.smslib.GatewayException: Comm library exception:
java.lang.RuntimeException: javax.comm.NoSuchPortException
at
org.smslib.modem.SerialModemDriver.connectPort(SerialModemDriver.java:102)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:114)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:277)
I don't know where is the problem please help me to resolve it I need to
send an sms to build an application in my training period
--
You received this message because you are subscribed to the Google Groups
"SMSLib Discussion Group" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/smslib/ac383daf-e889-4098-8976-e64a7d5d0b49%40googlegroups.com.