Я искал эту проблему; Я читал о rxtx, javacom, smslib и т. Д. Я нашел несколько статей, но я не могу понять их, потому что я новичок.
На самом деле я нашел хорошую статью, в которой можно отправить SMS здесь, здесь но проблема в том, что я хочу прочитать входящие смс, а затем удалить их.
Я обнаружил, что могу сделать это, используя AT + CMGR, AT + CMGL из здесь
Какой синтаксис в Java мне нужен, чтобы попробовать AT + CMGR и AT + CMGL, чтобы прочитать смс и хотя бы распечатать его?
Мне уже удалось проверить, какой порт готов, используя этот код:
package anothersms;
import gnu.io.*;
import java.util.Enumeration;
public class CommPortTest {
public static void main(String[] args) {
System.out.println("Program Started!!!");
CommPortIdentifier serialPortId;
Enumeration enumComm;
enumComm = CommPortIdentifier.getPortIdentifiers();
while(enumComm.hasMoreElements())
{
serialPortId = (CommPortIdentifier)enumComm.nextElement();
if(serialPortId.getPortType() == CommPortIdentifier.PORT_SERIAL)
{
System.out.println(serialPortId.getName());
}
}
System.out.println("Program Finished Sucessfully");
}
}
После долгого пути к настройке DLL и т. Д. Я обнаружил, что это работает, но все же я этого почти не понимаю.