liuyang | f01f277 | 2024-10-18 16:33:46 +0800 | [diff] [blame] | 1 | #include "sta_cli.h" |
| 2 | |
| 3 | #include <stdio.h> |
| 4 | #include <stdlib.h> |
b.liu | 9e8584b | 2024-11-06 19:21:28 +0800 | [diff] [blame^] | 5 | #include <string.h> |
liuyang | f01f277 | 2024-10-18 16:33:46 +0800 | [diff] [blame] | 6 | |
b.liu | 9e8584b | 2024-11-06 19:21:28 +0800 | [diff] [blame^] | 7 | #include "mbtk_utils.h" |
liuyang | f01f277 | 2024-10-18 16:33:46 +0800 | [diff] [blame] | 8 | #define STA_BUF_SIZE 2048 |
| 9 | |
| 10 | |
| 11 | int main(int argc, char *argv[]) |
| 12 | { |
| 13 | static char sta_cli_buf[STA_BUF_SIZE] = "OPEN"; |
| 14 | char reply[STA_BUF_SIZE]; |
| 15 | |
| 16 | |
| 17 | if(sta_cli_cmd_parse(sta_cli_buf, reply, STA_BUF_SIZE)){ |
| 18 | if(strlen(reply) > 0) |
| 19 | { |
| 20 | printf("reply data(%s).\n",reply); |
| 21 | }else{ |
| 22 | printf("No reply data(%s).\n",sta_cli_buf); |
| 23 | } |
| 24 | }else{ |
| 25 | printf("Parse cmd fail.\n"); |
| 26 | } |
| 27 | |
| 28 | |
| 29 | if(sta_cli_cmd_parse("ADD_NETWORK", reply, STA_BUF_SIZE)) |
| 30 | { |
| 31 | if(strlen(reply) > 0) |
| 32 | { |
| 33 | printf("reply data(%s).\n",reply); |
| 34 | }else |
| 35 | { |
| 36 | printf("No reply data\n"); |
| 37 | } |
| 38 | } |
| 39 | else |
| 40 | { |
| 41 | printf("Parse cmd fail.\n"); |
| 42 | } |
| 43 | |
| 44 | |
| 45 | if(sta_cli_cmd_parse("SELECT_NETWORK", reply, STA_BUF_SIZE)) |
| 46 | { |
| 47 | if(strlen(reply) > 0) |
| 48 | { |
| 49 | printf("reply data(%s).\n",reply); |
| 50 | }else |
| 51 | { |
| 52 | printf("No reply data\n"); |
| 53 | } |
| 54 | } |
| 55 | else |
| 56 | { |
| 57 | printf("Parse cmd fail.\n"); |
| 58 | } |
| 59 | |
| 60 | if(sta_cli_cmd_parse("ENABLE_NETWORK", reply, STA_BUF_SIZE)) |
| 61 | { |
| 62 | if(strlen(reply) > 0) |
| 63 | { |
| 64 | printf("reply data(%s).\n",reply); |
| 65 | }else |
| 66 | { |
| 67 | printf("No reply data\n"); |
| 68 | } |
| 69 | } |
| 70 | else |
| 71 | { |
| 72 | printf("Parse cmd fail.\n"); |
| 73 | } |
| 74 | |
b.liu | 9e8584b | 2024-11-06 19:21:28 +0800 | [diff] [blame^] | 75 | mbtk_system("udhcpc -i wlan0"); |
liuyang | f01f277 | 2024-10-18 16:33:46 +0800 | [diff] [blame] | 76 | |
b.liu | 9e8584b | 2024-11-06 19:21:28 +0800 | [diff] [blame^] | 77 | |
| 78 | |
liuyang | f01f277 | 2024-10-18 16:33:46 +0800 | [diff] [blame] | 79 | return 0; |
| 80 | } |
| 81 | |