java调用短信猫时出现cannot understand SIMPIN response错误

大人物小孩子 2014-07-13 09:36:08
我在用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();
}
...全文
314 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
大人物小孩子 2014-09-08
  • 打赏
  • 举报
回复
引用 1 楼 jsp_style 的回复:
怎么解决的啊?求帮助
开始用U转串的猫总是报这个错,信号问题。后来用串口的短信猫就好了
jsp_style 2014-08-25
  • 打赏
  • 举报
回复
怎么解决的啊?求帮助

50,549

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧