| #include "sta_cli.h" |
| |
| #include <stdio.h> |
| #include <stdlib.h> |
| #include <string.h> |
| |
| #include "mbtk_utils.h" |
| #define STA_BUF_SIZE 2048 |
| |
| |
| int main(int argc, char *argv[]) |
| { |
| static char sta_cli_buf[STA_BUF_SIZE] = "OPEN"; |
| char reply[STA_BUF_SIZE]; |
| |
| |
| if(sta_cli_cmd_parse(sta_cli_buf, reply, STA_BUF_SIZE)){ |
| if(strlen(reply) > 0) |
| { |
| printf("reply data(%s).\n",reply); |
| }else{ |
| printf("No reply data(%s).\n",sta_cli_buf); |
| } |
| }else{ |
| printf("Parse cmd fail.\n"); |
| } |
| |
| |
| if(sta_cli_cmd_parse("ADD_NETWORK", reply, STA_BUF_SIZE)) |
| { |
| if(strlen(reply) > 0) |
| { |
| printf("reply data(%s).\n",reply); |
| }else |
| { |
| printf("No reply data\n"); |
| } |
| } |
| else |
| { |
| printf("Parse cmd fail.\n"); |
| } |
| |
| |
| if(sta_cli_cmd_parse("SELECT_NETWORK", reply, STA_BUF_SIZE)) |
| { |
| if(strlen(reply) > 0) |
| { |
| printf("reply data(%s).\n",reply); |
| }else |
| { |
| printf("No reply data\n"); |
| } |
| } |
| else |
| { |
| printf("Parse cmd fail.\n"); |
| } |
| |
| if(sta_cli_cmd_parse("ENABLE_NETWORK", reply, STA_BUF_SIZE)) |
| { |
| if(strlen(reply) > 0) |
| { |
| printf("reply data(%s).\n",reply); |
| }else |
| { |
| printf("No reply data\n"); |
| } |
| } |
| else |
| { |
| printf("Parse cmd fail.\n"); |
| } |
| |
| mbtk_system("udhcpc -i wlan0"); |
| |
| |
| |
| return 0; |
| } |
| |