liubin | 281ac46 | 2023-07-19 14:22:54 +0800 | [diff] [blame^] | 1 | #include <stdio.h> |
| 2 | #include <string.h> |
| 3 | #include <sys/types.h> |
| 4 | #include <sys/stat.h> |
| 5 | #include <fcntl.h> |
| 6 | #include <errno.h> |
| 7 | |
| 8 | #define LOG_TAG "mbtk_net" |
| 9 | #include "mbtk_type.h" |
| 10 | #include "mbtk_net_control.h" |
| 11 | #include "mbtk_log.h" |
| 12 | |
| 13 | |
| 14 | int main(int argc, char *argv[]) |
| 15 | { |
| 16 | if(argc != 2) { |
| 17 | LOGE("ARG error."); |
| 18 | return -1; |
| 19 | } |
| 20 | |
| 21 | LOGI("net_control start."); |
| 22 | |
| 23 | if(!strcmp(argv[1], "on")) { |
| 24 | if(mbtk_net_enable(TRUE)) { |
| 25 | printf("Open Net fail.\n"); |
| 26 | } else { |
| 27 | printf("Open Net success.\n"); |
| 28 | } |
| 29 | } else if(!strcmp(argv[1], "off")) { |
| 30 | if(mbtk_net_enable(FALSE)) { |
| 31 | printf("Close Net fail.\n"); |
| 32 | } else { |
| 33 | printf("Close Net success.\n"); |
| 34 | } |
| 35 | } else if(!strcmp(argv[1], "get")) { |
| 36 | mbtk_net_state_t state = mbtk_net_state_get(); |
| 37 | printf("Net State : %d\n", state); |
| 38 | } else { |
| 39 | printf("Unknown arg : %s\n", argv[1]); |
| 40 | } |
| 41 | |
| 42 | |
| 43 | LOGI("net_control exit."); |
| 44 | return 0; |
| 45 | |
| 46 | } |
| 47 | |
| 48 | |