天嵌二次封装库使用手册  V1.0
tq_wifi.h
浏览该文件的文档.
1 #ifndef TQ_WIFI_H
2 #define TQ_WIFI_H
3 
18 #include "wpa_ctrl.h"
19 #include <net/if.h>
20 #include <sys/ioctl.h>
21 #include <netinet/in.h>
22 
23 const int IP_SIZE = 16;
24 
25 #ifdef __cplusplus
26 extern "C"
27 {
28 #endif
29 
32  struct WIFI
33  {
34  /* data */
35  char *ssid;
36  char *bssid;
37  int frequency;
39  char *flag;
40  };
47  struct WIFI *init_wifi();
52  void release_wifi(struct WIFI *wifi);
63  int Extract_information(char *src, char *dest, char *key, int dest_size);
73  int send_command(struct wpa_ctrl *ctrl, char *cmd);
81  int scan(struct wpa_ctrl *ctrl);
91  int scan_result(struct wpa_ctrl *ctrl, struct WIFI *wifi, int index);
102  int connect_wifi(struct wpa_ctrl *ctrl, char *ssid, char *passwork);
113  int get_wifi_status_value(struct wpa_ctrl *ctrl, char *key, char *dest, int dest_size);
119  int get_wifi_rssi(struct wpa_ctrl *ctrl);
127  int disconnect_wifi(struct wpa_ctrl *ctrl);
135  int reconnect_wifi(struct wpa_ctrl *ctrl);
136 #ifdef __cplusplus
137 }
138 #endif
139 #endif //TQ_WIFI_H
int get_wifi_status_value(struct wpa_ctrl *ctrl, char *key, char *dest, int dest_size)
通过"STATUS"指令,获取所需参数。
char * ssid
wifi名称
Definition: tq_wifi.h:35
void release_wifi(struct WIFI *wifi)
释放WIFI指针
int connect_wifi(struct wpa_ctrl *ctrl, char *ssid, char *passwork)
连接wifi
用来存放一个WIFI的基本参数
Definition: tq_wifi.h:32
int scan(struct wpa_ctrl *ctrl)
扫描WIFI列表
int frequency
频率
Definition: tq_wifi.h:37
int scan_result(struct wpa_ctrl *ctrl, struct WIFI *wifi, int index)
获取WIFI扫描结果
char * flag
标志位
Definition: tq_wifi.h:39
const int IP_SIZE
IP地址长度
Definition: tq_wifi.h:23
char * bssid
MAC地址
Definition: tq_wifi.h:36
int send_command(struct wpa_ctrl *ctrl, char *cmd)
用于发送只返回OK,FAIL的指令
int reconnect_wifi(struct wpa_ctrl *ctrl)
开启WIFI使能
控制接口库的内部结构
Definition: wpa_ctrl.h:38
int Extract_information(char *src, char *dest, char *key, int dest_size)
提取特定类型的字符串
struct WIFI * init_wifi()
初始化WIFI结构体
int disconnect_wifi(struct wpa_ctrl *ctrl)
关闭WIFI使能
int signalLevel
信号强度
Definition: tq_wifi.h:38
int get_wifi_rssi(struct wpa_ctrl *ctrl)
获取已连接的wifi的信号强度