Closed GoogleCodeExporter closed 9 years ago
i am receiving first message but when i try second time with same UI i am
getting this exception... when i restart the server the messages get
delivered...
Original comment by ntn.deve...@gmail.com
on 24 Oct 2012 at 11:55
Issue 514 has been merged into this issue.
Original comment by admin@smslib.org
on 11 Nov 2012 at 5:19
Issue 517 has been merged into this issue.
Original comment by admin@smslib.org
on 11 Nov 2012 at 5:19
Original comment by admin@smslib.org
on 1 Jan 2014 at 9:25
Original comment by admin@smslib.org
on 5 Jan 2014 at 4:08
close the gateway. u can use Service.getInstance().removeGateway(gateway);
public static void doIt(String number, String text) {
try {
OutboundMessage msg;
OutboundNotification outboundNotification = new OutboundNotification();
SerialModemGateway gateway = new SerialModemGateway(id, port, bitRate, modemName, "E17u-1");
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin(modemPin);
Service.getInstance().setOutboundMessageNotification(outboundNotification);
Service.getInstance().addGateway(gateway);
Service.getInstance().startService();
msg = new OutboundMessage(number, text);
Service.getInstance().sendMessage(msg);
System.out.println(msg);
Service.getInstance().stopService();
Service.getInstance().removeGateway(gateway);
} catch (Exception ex) {
if (ex.getStackTrace()[2].getLineNumber() == 189) {
JOptionPane.showMessageDialog(null,
"Port currently owned by usb Modem's application. \n Please close it & run the programm again.",
"Port Exception",
JOptionPane.ERROR_MESSAGE);
ex.printStackTrace();
} else {
JOptionPane.showMessageDialog(null,
ex.getMessage(),
"Sending faile",
JOptionPane.ERROR_MESSAGE);
ex.printStackTrace();
}
}
}
public static 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) throws Exception {
modemName = "Huwawi";
port = "COM7";
bitRate = 115200;
modemPin = "0000";
SMSC = "+94785000005";
String text="hai";
String[] numbers = {"+94710433605","+94710433605"};
for (String number : numbers) {
SendSms app = new SendSms();
app.doIt(number, text);
//Service.getInstance().stopService();
}
}
Original comment by ishanbud...@gmail.com
on 5 Apr 2015 at 11:16
Original issue reported on code.google.com by
ntn.deve...@gmail.com
on 24 Oct 2012 at 11:54