hello experts,
im using this library 4 receiving messages, but its not working
properly. Im using this example code of SMSLib:
public void doIt() throws Exception
{
List<InboundMessage> msgList;
InboundNotification inboundNotification = new
InboundNotification();
CallNotification callNotification = new CallNotification();
GatewayStatusNotification statusNotification = new
GatewayStatusNotification();
OrphanedMessageNotification orphanedMessageNotification = new
OrphanedMessageNotification();
try
{
System.out.println("Example: Read messages from a
serial gsm
modem.");
System.out.println(Library.getLibraryDescription());
System.out.println("Version: " +
Library.getLibraryVersion());
this.srv = new Service();
SerialModemGateway gateway = new
SerialModemGateway("modem.com3",
"COM3", 57600, "Teltonika", "TM3 EDGE");
gateway.setProtocol(Protocols.TEXT);
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("0000");
this.srv.setInboundMessageNotification(inboundNotification);
this.srv.setCallNotification(callNotification);
this.srv.setGatewayStatusNotification(statusNotification);
this.srv.setOrphanedMessageNotification(orphanedMessageNotification);
this.srv.addGateway(gateway);
this.srv.startService();
System.out.println("Service Started");
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() +
"%");
System.out.println(" Battery Level: " +
gateway.getBatteryLevel()
+ "%");
msgList = new ArrayList<InboundMessage>();
System.out.println("==========Waiting For
Message==========");
this.srv.readMessages(msgList, MessageClasses.ALL);
for (InboundMessage msg : msgList)
System.out.println(msg);
// Sleep now. Emulate real world situation and give a
chance to the
notifications
// methods to be called in the event of message or
voice call
reception.
System.out.println("Now Sleeping - Hit <enter> to stop
service.");
System.in.read(); System.in.read();
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
this.srv.stopService();
}
}
It does'nt shows or receive any message as im sending 4n another sim.
output is :
Example: Read messages 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.4.5
log4j:WARN No appenders could be found for logger (smslib).
log4j:WARN Please initialize the log4j system properly.
>>> Gateway Status change for modem.com3, OLD: STOPPED -> NEW: STARTING
>>> Gateway Status change for modem.com3, OLD: STARTING -> NEW: STARTED
Service Started
Modem Information:
Manufacturer: Teltonika
Model: TM3 EDGE
Serial No: 352387020018557
SIM IMSI: ** MASKED **
Signal Level: 100%
Battery Level: 0%
==========Waiting For Message==========
Now Sleeping - Hit <enter> to stop service.
>>> Gateway Status change for modem.com3, OLD: STARTED -> NEW: RESTART
>>> Gateway Status change for modem.com3, OLD: RESTART -> NEW: RESTART
>>> Gateway Status change for modem.com3, OLD: RESTART -> NEW: STOPPING
>>> Gateway Status change for modem.com3, OLD: STOPPING -> NEW: STOPPED
>>> Gateway Status change for modem.com3, OLD: STOPPED -> NEW: RESTART
>>> Gateway Status change for modem.com3, OLD: RESTART -> NEW: RESTART
>>> Gateway Status change for modem.com3, OLD: RESTART -> NEW: STOPPING
>>> Gateway Status change for modem.com3, OLD: STOPPING -> NEW: STOPPED
>>> Gateway Status change for modem.com3, OLD: STOPPED -> NEW: RESTART
>>> Gateway Status change for modem.com3, OLD: RESTART -> NEW: RESTART
>>> Gateway Status change for modem.com3, OLD: RESTART -> NEW: STOPPING
>>> Gateway Status change for modem.com3, OLD: STOPPING -> NEW: STOPPED
>>> Gateway Status change for modem.com3, OLD: STOPPED -> NEW: RESTART
.
.
.
.
.
and keep running this . .. .. ..
--
You received this message because you are subscribed to the Google Groups
"SMSLib 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.