jdk1.7,32位java环境下,调试smslib3.5.4+rxtx2.2(32位调试视频) 视频清晰度有限,源地址:http://v.youku.com/v_show/id_XMjgxNDMwNDY0OA |
hayden 发表于 2019-12-26 09:35 不好意思,现在少维护这个网站没看到帖子,长时间没回帖是可以客户咨询下。现在主要为主这个网站www.tenghengkeji.com 下面回到你问题 打包后还是在同一台电脑上跑程序吗?如果是应该来说没问题的,不是那就注意看串口号是否变了,你的程序写死了串口号不够灵活呢?同一台电脑的时候出现那就另外一个可能串口包的文件没有放置到正确的jre目录里面了,但一般不是报你上面这个错误,还是串口号问题吧。 另外一个可能你的串口被占用了,同一个线程没结束前提下多次重复去启动服务导致。 |
短信模块开发中一切正常,打包后出现端口无法获取 java.lang.RuntimeException: CommPortIdentifier class not found 求问这个该怎么解决 |
zhaoliang0723 发表于 2017-12-14 08:34 确定清楚你的设备波特率,你的设备波特率可能没在这些范围内吧,你的是3G/4G设备吗?咨询你的卖家设备波特率是多少,自己添加进去就能找到了 |
确定清楚你的设备波特率,你的设备波特率可能没在这些范围内吧,你的是3G/4G设备吗?咨询你的卖家 |
楼主您好,我的开发环境时win10 64位+jdk64位,利用USB转串口线连接好短信猫之后,在超级终端中测试能发送短信,但是在代码中总是报No device,然后网上百度了测试串口连接设备的代码,结果如下: Searching for devices... Found port: COM3 Trying at 9600... no device found Trying at 14400... no device found Trying at 19200... no device found Trying at 28800... no device found Trying at 33600... no device found Trying at 38400... no device found Trying at 56000... no device found Trying at 57600... no device found Trying at 115200... no device found Test complete 超级终端明明测试通过了,代码中怎么检测不到这个设备呢?请教 |
yijianxiaoao 发表于 2017-1-12 06:39 2017-01-12 14:31:07 [日志信息] Running... 2017-01-12 14:31:07 [日志信息] GTW: modem.com3: SEND :AT+CPIN?(cr) 2017-01-12 14:31:22 [日志信息] Running... 2017-01-12 14:31:22 [日志信息] ** disabled ** 2017-01-12 14:31:22 [日志信息] GTW: modem.com3: Buffer contents on timeout: ??? AT+CPIN?你问题就是这个指令过不去,用最新版,在开源里面去掉这个指令的执行就可以了,因为这个指令,你的卡获取的太慢导致程序返回串口写入超时,导致无法进行下去 你也可以直接换卡也行 |
我的代码: package com.controller; import org.smslib.AGateway; import org.smslib.IOutboundMessageNotification; import org.smslib.Library; import org.smslib.OutboundMessage; import org.smslib.Service; import org.smslib.modem.SerialModemGateway; public class SendMessage { public void doIt() throws Exception { 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()); SerialModemGateway gateway = new SerialModemGateway("modem.com3", "COM3", 9600, "Wavecom", ""); gateway.setInbound(true); gateway.setOutbound(true); gateway.setSimPin("0000"); // Explicit SMSC address set is required for some modems. // Below is for VODAFONE GREECE - be sure to set your own! gateway.setSmscNumber("+8613008197212"); Service.getInstance().setOutboundMessageNotification(outboundNotification); Service.getInstance().addGateway(gateway); Service.getInstance().startService(); System.out.println(); 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() + " dBm"); System.out.println(" Battery Level: " + gateway.getBatteryLevel() + "%"); System.out.println(); OutboundMessage msg = new OutboundMessage("136888041107", "Hello from SMSLib!"); Service.getInstance().sendMessage(msg); System.out.println(msg); System.out.println("Now Sleeping - Hit <enter> to terminate."); System.in.read(); Service.getInstance().stopService(); } public class OutboundNotification implements IOutboundMessageNotification { public void process(AGateway gateway, OutboundMessage msg) { System.out.println("Outbound handler called from Gateway: " + gateway.getGatewayId()); System.out.println(msg); } } public static void main(String args[]) { SendMessage app = new SendMessage(); try { app.doIt(); } catch (Exception e) { e.printStackTrace(); } } } |
请问一下这是什么原因 |