zw.wang | 96c5d4e | 2025-07-01 11:35:13 +0800 | [diff] [blame^] | 1 | #include "at_tool.h"
|
| 2 |
|
| 3 | static void at_progess(int argc, char *argv[])
|
| 4 | {
|
| 5 | int ret = -1;
|
| 6 | char send_at_buf[128] = {0};
|
| 7 | char *pstr = malloc(128);
|
| 8 | memset(pstr, 0, 128);
|
| 9 |
|
| 10 | if(argv[1] != NULL && strlen(argv[1]) >= 2 && strncasecmp(argv[1], "at", 2) == 0)
|
| 11 | {
|
| 12 | sprintf(send_at_buf, "%s\r", argv[1]);
|
| 13 | ret = get_modem_info(send_at_buf, "%s", (void**)&pstr);
|
| 14 |
|
| 15 | if(0 == ret)
|
| 16 | {
|
| 17 | printf("%s\n", pstr);
|
| 18 | }
|
| 19 | else
|
| 20 | {
|
| 21 | printf("AT command error\n");
|
| 22 | }
|
| 23 | }
|
| 24 | else
|
| 25 | {
|
| 26 | printf("not a valid AT command: error\n");
|
| 27 | }
|
| 28 |
|
| 29 | free(pstr);
|
| 30 | return;
|
| 31 | }
|
| 32 |
|
| 33 | int main(int argc, char *argv[])
|
| 34 | {
|
| 35 | if(argc > 1)
|
| 36 | {
|
| 37 | at_progess(argc, argv);
|
| 38 | }
|
| 39 |
|
| 40 | return 0;
|
| 41 | }
|