SMS cat Java Secondary Development Kit smslib, org. smslib. timeoutexception: no response from device Solution

Source: Internet
Author: User

Recently, I used the open-source smslib component in Linux to develop the SMS cat application. I often encountered this error and found many friends on the Internet have encountered this problem, now I will share my solutions to this problem with you.


Development Environment:

Linux readhat5.4 64-bit, kernel: 2.6.33.20, jdk1.6, SMSServer-3.5.2.jar


Exception information:

Figure 1-1


Solution:

When this exception occurs, check the following two aspects:

1. Enable or notRound Robin Mode?

Method 1)In JVM, add the-dsmslib. Serial. Polling startup Parameter

Method 2)In Java codeStartservicePreviously, the show enable the round robin Mode

Service. getinstance (). S. serial_polling = true; // enable the round robin Mode

2. Whether the correct SMS device is set when the serial port gateway object is createdManufacturer?

Serialmodemgateway gateway = new serialmodemgateway ("MODEM. COM1", "/dev/ttyusb1", 9600, "Wavecom", "model ");

Parameter description:

Modem. COM1: Gateway ID (that is, the port ID of the SMS cat. When there are multiple SMS cats, it is used to identify which port sends the SMS)
/Dev/ttyusb1: Serial Port name (USB to serial port, all ports in the SMS cat are automatically mapped to the/dev/directory by the operating system, and files starting with ttyusb, the premise is that the system is pre-installed with a USB-to-serial driver). Note: Linux 2.6.32 and later kernels are pre-installed with a USB serial device driver. If the earlier kernel version is not detected, you need to install the driver or upgrade the kernel yourself.

9600:Baud Rate: detects the baud rate supported by your device based on the commtest. Java test program in the secondary development kit.

Wavecom:The name of the manufacturer, which must be set correctly. Otherwise, the error "no response from device" is reported when smslib is the initial device because smslib is a different manufacturer and has the corresponding at Interface implementation, see:

Figure 1-2

In "Figure 1-1", the error 1-3 is reported because the serial port gateway object is created and the vendor name is "Huawei:

Figure 1-3

Model: You do not need to specify a model. If the model is specified, smslib will find the AT command implementation class of the specific model when initializing the device. If the model is not found, an exception may occur during device initialization, however, according to my test, if the AT command implementation of the specified model is not found by the specified manufacturer, the generic implementation interface of the specified manufacturer is used.

The above exception is based on the SMSServer-3.5.2 in the Linux environment development encountered some problems, and everyone to share, Windows will also have similar problems, can refer to the above solution to find a solution, in addition, another vendor of the SMS cat Secondary Development Kit has encapsulated the underlying at command, for example, the jindistmms (jindi) Development Kit, And I encountered similar problems when using it, the solution is similar to the preceding one, but the parameters may be different. We will not describe it in detail here. If you have a friend with the same problem, please discuss it!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.