blob: bc5a5a7451d697ab5bde2ce113e99e9b5645fd41 [file] [log] [blame]
liuyangf01f2772024-10-18 16:33:46 +08001#include "sta_cli.h"
2
3#include <stdio.h>
4#include <stdlib.h>
b.liu9e8584b2024-11-06 19:21:28 +08005#include <string.h>
liuyangf01f2772024-10-18 16:33:46 +08006
b.liu9e8584b2024-11-06 19:21:28 +08007#include "mbtk_utils.h"
liuyangf01f2772024-10-18 16:33:46 +08008#define STA_BUF_SIZE 2048
9
10
11int 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.liu9e8584b2024-11-06 19:21:28 +080075 mbtk_system("udhcpc -i wlan0");
liuyangf01f2772024-10-18 16:33:46 +080076
b.liu9e8584b2024-11-06 19:21:28 +080077
78
liuyangf01f2772024-10-18 16:33:46 +080079 return 0;
80}
81