Hi all,
I tried to make a java application using smslib :
public static void main(String args[]) {
try {
SerialModemGateway gateway = new
SerialModemGateway("modem.com5", "COM5", 115200, "SE", "K608i");
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("0000");
Service service = new Service();
service.setOutboundNotification(new
IOutboundMessageNotification() {
public void process(String gatewayId, OutboundMessage
message) {
// Here, just print some text to the console.
// In real world, you might do something else.
System.out.println("Outbound handler called from
Gateway: " + gatewayId);
System.out.println(message);
}
});
service.addGateway(gateway);
service.startService();
OutboundMessage messageObject = new
OutboundMessage("62818772100", "test from smslib");
service.sendMessage(messageObject);
// You can also queue some asynchronous messages.
// service.queueMessage(messageObject);
service.stopService();
} catch (Exception e) {
System.out.println("Error:" + e.getMessage());
}
}
I connect to GSM using a SE K608i on port COM5.
But when I run that code, I got this error :
run:
0 [main] INFO smslib - 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
0 [main] INFO smslib - Version: 3.4.2
0 [main] INFO smslib - JRE Version: 1.6.0_14
0 [main] INFO smslib - JRE Impl Version: 14.0-b16
0 [main] INFO smslib - O/S: Windows XP / x86 / 5.1
16 [Thread-1] INFO smslib - GTW: modem.com5: Starting gateway, using Generic
AT Handler.
16 [Thread-1] INFO smslib - GTW: modem.com5: Opening: COM5 @115200
Error:Comm library exception: java.lang.RuntimeException:
javax.comm.NoSuchPortException
15016 [WatchDog] WARN smslib - Gateway: modem.com5 restarting.
15016 [WatchDog] INFO smslib - GTW: modem.com5: Stopping gateway...
15016 [WatchDog] WARN smslib - Error while shutting down Gateway: modem.com5
java.lang.NullPointerException
at org.smslib.AGateway.stopGateway(AGateway.java:312)
If you have any solution, please help ...
Thank you very much.
regards,
Moz
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SMSLib for Java User Group" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/smslib?hl=en
-~----------~----~----~----~------~----~------~--~---