使用Java和AT命令发送SMS
我有一个TC65调制解调器,我无法从任何地方得到帮助。我想问一下如何使用Java执行AT命令。一旦程序被编写,它将被上传到调制解调器,并可以独立运行。我想用Java编写一个代码,使用AT命令发送SMS使用Java和AT命令发送SMS,java,at-command,Java,At Command,我有一个TC65调制解调器,我无法从任何地方得到帮助。我想问一下如何使用Java执行AT命令。一旦程序被编写,它将被上传到调制解调器,并可以独立运行。我想用Java编写一个代码,使用AT命令发送SMS package example.helloworld; import javax.microedition.midlet.*; /** * MIDlet with some simple text output */ public class HelloWorld extends MID
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编写这篇文章:
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();
}
}
编号=+XXXXXXXXX
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();
}
}
AT+CMGS=编号/输入
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();
}
}
(信息)/输入
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();
}
}
我将把这个程序上传到我的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();
}
}
谢谢。试试这样:
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();
}
}
public void startApp() throws MIDletStateChangeException {
System.out.println("startApp");
String MyMessage = "Hello";
ATCommand atc = new ATCommand(false);
atc.send("at+cmgf=1\r");
atc.send("at+cmgs=1234567\r");
atc.send(MyMessage + "\032\r"); // 32 = CTRL-Z
destroyApp(true);
}
注意,这是TC65的东西。不便于携带
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();
}
}
所需进口:
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();
}
}
import com.siemens.icm.io.ATCommand;
定义“用Java编写”,是指
字符串还是流?或者完全是别的什么?另外,向我们展示您已经尝试过的内容。我应该在哪里添加它,以及如何告诉它执行AT命令?任何帮助都将不胜感激。