android - How to save response from AT Command -
i work on android's application. saving responses @ command. example when execute command:
runtime r = runtime.getruntime(); process process = r.exec(new string[] {"su", "-c", "echo -e 'at\r' > /dev/smd0"});
i save response
at ok
i can show response executing command adb interface:
# cat /dev/smd0
i found on forums should make code:
runtime r = runtime.getruntime(); process process = r.exec(new string[] {command execute }); bufferedreader in = new bufferedreader( new inputstreamreader(process.getinputstream())); string line = null; while ((line = in.readline()) != null) { system.out.println(line); } } catch (ioexception e) { e.printstacktrace(); }
when replace command execute "ls" example, work fine. when replace "cat /dev/smd0" show me on logcat invalide id: cat /dev/smd0
good news, think have tool looking for: atinout. read list of @ commands , provide responses modem stdout (or file). example:
$ echo @ | atinout - /dev/ttyacm0 - @ ok $
or even
$ atinout - /dev/ttyacm0 - <<eof > at+cscs="utf-8" > at+cpbs="me" > at+cpbw=,"0123456789",129,"b. endian" > at+cpbw=,"8967452301",129,"l. endian" > eof ok ok ok ok $
the input @ commands should normal text lines terminated '\n', atinout take care of terminating command '\r' when sending modem.
Comments
Post a Comment