【发布时间】:2012-03-10 17:24:16
【问题描述】:
我有一个 TC65 调制解调器,但无法从任何地方获得帮助。我想问一下如何使用Java执行AT命令。程序编写完成后,将上传到调制解调器,并可以独立运行。我想用 Java 编写一个使用 AT 命令发送 SMS 的代码。
谁能帮帮我?我将如何用 Java 编写这个:
数字 = +xxxxxxxxxx
AT+CMGS=数字/回车
(消息)/输入
我将把这个程序上传到我的 GSM 调制解调器,以便它在开机时发送短信。
package example.helloworld;
import javax.microedition.midlet.*;
/**
* MIDlet with some simple text output
*/
public class HelloWorld extends MIDlet {
/**
* Default constructor
*/
public HelloWorld() {
System.out.println("Welcome");
}
/**
* This is the main application entry point. Here we simply give some
* text output and close the application immediately again.
*/
public void startApp() throws MIDletStateChangeException {
System.out.println("startApp");
System.out.println("\nHello World\n");
destroyApp(true);
}
/**
* Called when the application has to be temporary paused.
*/
public void pauseApp() {
System.out.println("pauseApp()");
}
/**
* Called when the application is destroyed. Here we must clean
* up everything not handled by the garbage collector.
* In this case there is nothing to clean.
*/
public void destroyApp(boolean cond) {
System.out.println("destroyApp(" + cond + ")");
notifyDestroyed();
}
}
谢谢。
【问题讨论】:
-
定义“用Java编写”,你是指
String还是流?还是完全不同的东西?另外,请向我们展示您已经尝试过的内容。 -
我在哪里添加它以及如何告诉它执行 AT 命令?任何帮助将不胜感激。
标签: java at-command