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!