java调用短信猫时出现cannot understand SIMPIN response错误
我在用smslib调用wavecom短信猫时,控制台总是弹出如下提示:cannot understand SIMPIN response ERROR
,will wait for a while... 短信也发不过来
调试很久了,一直没弄好。第一次发帖,请大神们解答下。发送短信代码如下:
Service srv;
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());
srv = new Service();
SerialModemGateway gateway = new SerialModemGateway("modem.com4",
"COM4", 9600, "wavecom", "17254");// 115200是波特率,一般为9600。可以通过超级终端测试出来
gateway.setInbound(true);
gateway.setOutbound(true);
gateway.setSimPin("0000");
// gateway.setOutboundNotification(outboundNotification);
srv.setOutboundMessageNotification(outboundNotification);
try {
srv.addGateway(gateway);
srv.startService();
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();
// Send a message synchronously.
msg = new OutboundMessage("13682025441", "123456");
msg.setEncoding(MessageEncodings.ENCUCS2);// 这句话是发中文短信必须的
//srv.queueMessage();
srv.sendMessage(msg);
System.out.println(msg);
System.out.println("send message success!stopService.");
// System.in.read();
srv.stopService();
//gateway.stopGateway();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}