Good Day,
We are experiencing an issue with smslib.
Scenario
1. Computer dials up on 3G Modem and is connected to internet
2. SMSLIB is initialised
3. 3G connection gets lost
Details
Qualcom Driver 2.0.7.3 Works
Qualcom Driver 2.0.6.9 Works
HP Driver 5.20.2.0 (Disconnects)
Qualcom Driver 2.0.7.2 (Disconnects)
Any ideas as to what could cause this?
Sample Code
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package modem;
import gnu.io.CommPortIdentifier;
import java.util.Enumeration;
import org.smslib.Service;
import org.smslib.modem.SerialModemGateway;
import za.co.axon.mdas.Constants;
import za.co.axon.mdas.webcam.utils.Native;
public class Modem {
private Service srv = null;
private SerialModemGateway gateway = null;
private String[] comPorts;
private String port;
public static int SMS_MODEM_BAUD = 115200;
private void run() {
try {
System.out.println("=========Step 1=========");
getPorts();
System.out.println("=========Step 2=========");
getModem();
System.out.println("=========Step 3=========");
getDetails();
System.out.println("Keep gateway / service open for 10
seconds");
System.out.println("Please check internet connection and
ensure modem is still connected...");
Thread.sleep(10000);
System.out.println("=========Step 4=========");
close();
} catch (Exception e) {
System.out.println("Exception caught [" + e.getMessage()+
"]");
}
}
private void getPorts() throws Exception {
Enumeration myports = CommPortIdentifier.getPortIdentifiers();
String sports[] = new String[20];
int p = 0;
while (myports.hasMoreElements()) {
CommPortIdentifier portId = (CommPortIdentifier)
myports.nextElement();
if (portId.getPortType() ==
CommPortIdentifier.PORT_SERIAL) {
sports[p] = portId.getName();
System.out.println("COM port " + sports[p] + "
appeared");
p++;
}
}
if (p == 0) {
throw new Exception("Found no available ports. Exiting");
}
System.out.println("Found " + p + " serial port(s) on this
system.");
System.out.println("=========Step 1 completed.=========");
comPorts = new String[p];
System.arraycopy(sports, 0, comPorts, 0, p);
}
private void getModem() throws Exception {
srv = Service.getInstance();
boolean foundGateway = false;
for (int i = 0; i < comPorts.length; i++) {
gateway = getGateway(comPorts[i], SMS_MODEM_BAUD);
if (gateway != null) {
port = comPorts[i];
System.out.println("Found suitable modem connection to
port [" + port + "]");
System.out.println("=========Step 2
completed.=========");
foundGateway = true;
break;
}
}//End for
if (!foundGateway) {
throw new Exception("Unable to bind gateway on available
ports. Exiting");
}
}
private SerialModemGateway getGateway(String port, int baud) {
SerialModemGateway gw = null;
try {
System.out.println("Probing modem on port [" + port + "]
at [" + baud + "] baud.");
gw = new SerialModemGateway("modem.usb", port, baud,
"onecell", "i modem");
gw.setInbound(false);
gw.setOutbound(true);
//gw.setProtocol(AGateway.Protocols.TEXT);
gw.setSimPin("0000");
// if modem is not GSM, we will get an exception here
System.out.println("Starting gateway service on " + port);
srv.addGateway(gw);
srv.startService();
// if modem is GSM we simply return the gateway
return gw;
} catch (Exception e) {
System.out.println("Error starting selected gateway
service on port " + port + ": " + e.getMessage());
try {
srv.removeGateway(gw);
} catch (Exception gwe) {
}
System.out.println("Modem on port " + port + " does not
appear to be a GSM capable device.");
return null;
}
}
private void getDetails() throws Exception {
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() + "%");
System.out.println("Messaging gateway started.");
System.out.println("=========Step 3 completed.=========");
}
private void close() throws Exception {
try {
gateway.stopGateway();
} catch (Exception e) {
throw new Exception("Exception occurred while stopping
gateway [" + e.getMessage() + "]");
}
try {
srv.stopService();
} catch (Exception e) {
throw new Exception("Exception occurred while stopping
service [" + e.getMessage() + "]");
}
System.out.println("=========Step 4 completed.=========");
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
try {
Constants.LIB_SERIAL =
Native.unpackLibrary(Constants.LIB_SERIAL);
Constants.LIB_CAMERA =
Native.unpackLibrary(Constants.LIB_CAMERA);
Constants.LIB_WSQ =
Native.unpackLibrary(Constants.LIB_WSQ);
Constants.LIB_FTR =
Native.unpackLibrary(Constants.LIB_FTR);
Modem m = new Modem();
m.run();
} catch (Exception e) {
System.out.println("Unable to load libraries");
System.out.println(e.getMessage());
}
}
}
--
You received this message because you are subscribed to the Google Groups
"SMSLib Discussion 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.