我编写了一个代码来使用 SMSLib 通过 GSM 调制解调器发送/接收短信。在我的 64 位机器上,我按照一些链接中给出的解决方案设置了 32 位 JDK。
以下是我遇到异常的代码
OutboundNotification outboundNotification = new OutboundNotification();
System.out.println("Please wait...");
gateway = new SerialModemGateway("s3.com3", comPort, 115200, "SAMSUNG", "S3");
gateway.setInbound(true);
gateway.setOutbound(true);
System.out.println("gateway - "+gateway.getSmscNumber());
Service.getInstance().setOutboundMessageNotification(outboundNotification);
Service.getInstance().addGateway(gateway);
Service.getInstance().startService();
现在,我在尝试使用与我的机器端口连接的不同设备时遇到以下异常。对于设备 1(三星 S3),我收到以下异常:
org.smslib.TimeoutException: No response from device.
at org.smslib.modem.AModemDriver$CharQueue.get(AModemDriver.java:535)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:338)
at org.smslib.modem.AModemDriver.getResponse(AModemDriver.java:313)
at org.smslib.modem.athandler.ATHandler.getSimStatus(ATHandler.java:145)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:132)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:277)
对于设备 2(三星 Galaxy Note 2),我收到以下异常:
org.smslib.GatewayException: GSM: Invalid CREG response.
at org.smslib.modem.AModemDriver.waitForNetworkRegistration(AModemDriver.java:463)
at org.smslib.modem.AModemDriver.connect(AModemDriver.java:168)
at org.smslib.modem.ModemGateway.startGateway(ModemGateway.java:189)
at org.smslib.Service$1Starter.run(Service.java:277)
请给我一些答案。
抱歉,如果我在发布此问题时犯了任何错误。