我想将AT命令发送到Android手机.
我知道SDK不支持这个.
但有两种解决方案:
更改内核代码并发布新的Android(看起来真是太难了!)
LoopBack on USB.(我认为蓝牙是一样的)
关于第二种解决方案,当您使用USB电缆将手机连接到PC时,您将GSM在设备管理器上看到一个调制解调器,可帮助您将AT命令发送到GSM调制解调器.
如果我们找到一个循环回移动电话的解决方案,我们可以将AT命令发送到GSM调制解调器.
问题是:如何循环回来,内核上的tty文件对我们有什么帮助?
我想在我的应用程序中使用AT命令为GSM调制解调器设置一些命令.
我搜索谷歌但我找不到任何好的答案!
你有什么解决方案吗?
我可以使用ADB向Android发送AT命令吗?
我想在我的 PC 和一些控制器板之间进行通信。
期望 PC 将在 RS-485 上发送板的标识符,然后它应该收到来自板的答复。
当我尝试接收响应时,我收到了错误的数据。
这是我的代码:
public void set()
{
SerialPort sp = new SerialPort("COM1");
sp.Open();
if (sp.IsOpen)
{
byte[] id = new byte[]{0,0,0,0,0,0,0,0,0,0};
byte[] rec = new byte[540];
while (!end)
{
sp.Write(id,0,id.Length);
sp.Read(rec,0,rec.Length);
//do some with rec
//WORKING
//do soem with rec
}
}
sp.Close();
}
Run Code Online (Sandbox Code Playgroud)
如果我使用 RS-232,它会起作用,但当我使用 RS-485 时则不起作用。
更新 :
它是 RS-485 2 线。( http://en.wikipedia.org/wiki/RS-485 )
我想在Android中更改UI.
我的主类创建第二个类然后第二个类调用主类的主类class.method的方法应该更新UI但程序在运行时崩溃.
我该怎么办?
我的主要课程:
public class FileObserverActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView) findViewById(R.id.textView1);
tv.setText("new world");
MyFileObserver myFileObserver = new MyFileObserver("/sdcard/", this);
myFileObserver.startWatching();
}
String mySTR = "";
TextView tv ;
public void event(String absolutePath,String path,int event)
{
mySTR = absolutePath+path+"\t"+event;
tv.setText(mySTR); // program crash here!
}
}
Run Code Online (Sandbox Code Playgroud)
和我的第二堂课:
public class MyFileObserver extends FileObserver
{
public String absolutePath;
FileObserverActivity fileobserveractivity;
public MyFileObserver(String path,FileObserverActivity …Run Code Online (Sandbox Code Playgroud)