beralt / atinout Goto Github PK
View Code? Open in Web Editor NEWAtinout is a program that reads a list of AT commands.
Atinout is a program that reads a list of AT commands.
Atinout is a program that will execute AT commands in sequence and capture the response from the modem. Minimum example: $echo AT | atinout - /dev/ttyS0 - AT OK $ See the manual for more details on operation. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you have not yet read the ITU V.250 specification about AT commands, by all means go to http://www.itu.int/rec/T-REC-V.250-200307-I/en and do so right away. This is a must have document when processing AT commands. The absolute authoritative source of information about how AT commands behave for a given phone is the manufacturers documentation. That will cover standardized commands (with potential divergence) as well as proprietary commands. The second most authoritative source of information about how AT commands behave for a give phone is the official standard documents, e.g. V.250, 27.005, 27.007 etc. No matter how nice random guide you have found on the web, never threat such as an authoritative source on AT commands. Get hold of the authoritative sources as described above and use those to check for syntax and behavior. Resources ========= ITU V.250 http://www.itu.int/rec/T-REC-V.250-200307-I/en 3GPP 27.005 http://www.3gpp.org/ftp/Specs/html-info/27005.htm 3GPP 27.007 http://www.3gpp.org/ftp/Specs/html-info/27007.htm SonyEricsson http://developer.sonyericsson.com/wportal/devworld/downloads/download/dw-65054-dgat2006--09r13a?cc=gb&lc=en (http://dl-www.sonyericsson.com/cws/download/1/707/466/1277362028/DW-65054-dg_at_2006--10_r17a.pdf)
I've written a C file for executing AT commands sequentially as soon as I hit "AT+CMGS=XXXXXXXXX" command the program gets stuck and waits for a user interrupt then when I press Ctrl+C it executes the next command.
strcpy(command, "echo 'AT' | atinout - /dev/ttyUSB0 -");
system(command);
strcpy(command, "echo 'AT+CMGF=1' | atinout - /dev/ttyUSB0 -");
system(command);
strcpy(command, "echo -e 'AT+CMGS=\"1234567890\"' | atinout - /dev/ttyUSB0 -");
system(command);
strcpy(command, "echo -e 'test messaget!!!!\x1A' | atinout - /dev/ttyUSB0 -");
system(command);
Why does it get stuck?
How can I execute the above commands sequentially without the need of an interrupt?
Is the problem with system command?
Regards.
Use case:
AT+CMGF=1
OK
AT+CMGS=+31628870634
> This is the text message.โ
+CMGS: 45
OK
Line of code where it gets stuck:
do {
line = fgets(buf, (int)sizeof(buf), modem);
if (line == NULL) {
fprintf(stderr, "EOF from modem\n");
return EXIT_FAILURE;
}
strcpy(buf2, line);
strip_cr(buf2);
res = fputs(buf2, output);
if (res < 0) {
fprintf(stderr, "failed to write '%s' to output file (res = %d)\n", buf2, res);
return EXIT_FAILURE;
}
} while (! is_final_result(line));
DISCLAIMER: I am far from being a sw developer, just wanted to write my linux sms utility using this nice piece of code.
If the device expects to be written again then it will never provide the "end of transmission" hence the fgets keeps listening.
Using a serial terminal emulators you can see that (look at the usecase I have reported) and you (user) keep writing giving the expected terminator at the end (ascii 26 in my case).
Hi,
i having issues while running spesific command, it is for starting GPS track to my Sierra Modem, here is the output:
root@raspberrypi:/home/pi# echo -e 'AT!GPSTRACK=1,255,50,1000,1'|atinout - /dev/ttyUSB0 -
AT!GPSTRACK=1,255,50,1000,1Tracking initiated
OK
ATAaated
NO CARRIER
ATAaated
NO CARRIER
AATAaated
NO CARRIER
AAATAaated
NO CARRIER
AAAATAaated
NO CARRIER
AAAAATAaated
NO CARRIER
AAAAAATAaated
NO CARRIER
AAAAAAATAaated
NO CARRIER
AAAAAAAATAaated
NO CARRIER
AAAAAAAAATAaated
NO CARRIER
AAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAAAAATAaated
NO CARRIER
AAAAAAAAAAAAAAAAATAaated
NO CARRIER
any help?
Hi, could anyone provide proper Makefile to compile a package for OpenWrt?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.