WifiCommand流程 wpa_supplicant启动流程 Wifiservice启动流程(转)
来源:互联网 发布:淘宝taobao.com 编辑:程序博客网 时间:2024/05/17 09:47
1. 信号强度算法
WifiManager.java
- /** Anything worse than or equal to this will show 0 bars. */
- private static final int MIN_RSSI = -100;
- /** Anything better than or equal to this will show the max bars. */
- private static final int MAX_RSSI = -55;
- /**
- * Calculates the level of the signal. This should be used any time a signal
- * is being shown.
- *
- * @param rssi The power of the signal measured in RSSI.
- * @param numLevels The number of levels to consider in the calculated
- * level.
- * @return A level of the signal, given in the range of 0 to numLevels-1
- * (both inclusive).
- */
- public static int calculateSignalLevel(int rssi, int numLevels) {
- /* in general, numLevels is 4 */
- if (rssi <= MIN_RSSI) {
- return 0;
- } else if (rssi >= MAX_RSSI) {
- return numLevels - 1;
- } else {
- float inputRange = (MAX_RSSI - MIN_RSSI);
- float outputRange = (numLevels - 1);
- return (int)((float)(rssi - MIN_RSSI) * outputRange / inputRange);
- }
- }
/** Anything worse than or equal to this will show 0 bars. */ private static final int MIN_RSSI = -100; /** Anything better than or equal to this will show the max bars. */ private static final int MAX_RSSI = -55; /** * Calculates the level of the signal. This should be used any time a signal * is being shown. * * @param rssi The power of the signal measured in RSSI. * @param numLevels The number of levels to consider in the calculated * level. * @return A level of the signal, given in the range of 0 to numLevels-1 * (both inclusive). */ public static int calculateSignalLevel(int rssi, int numLevels) { /* in general, numLevels is 4 */ if (rssi <= MIN_RSSI) { return 0; } else if (rssi >= MAX_RSSI) { return numLevels - 1; } else { float inputRange = (MAX_RSSI - MIN_RSSI); float outputRange = (numLevels - 1); return (int)((float)(rssi - MIN_RSSI) * outputRange / inputRange); } }
2. WiFi Command流程
3. wpa_supplicant启动流程
4. WifiService启动流程
5. SIGNAL_POLL调用流程
- eloop_run->..
- wpa_supplicant_ctrl_iface_receive-> //接收并处理来自framework的command
- wpa_supplicant_ctrl_iface_process-> (SIGNAL_POLL)
- wpa_supplicant_signal_poll->
- wpa_drv_signal_poll (struct wpa_supplicant *wpa_s,struct wpa_signal_info *si)->
- wpa_driver_signal_poll (void *priv, struct wpa_signal_info *si)->
- wpa_driver_wext_driver_cmd(priv, RSSI_CMD, buf, sizeof(buf))或 //driver_cmd_wext.c
- wpa_driver_wext_driver_cmd(priv, LINKSPEED_CMD, buf, sizeof(buf))->
- struct iwreq iwr;
- iwr.u.data.pointer = buf;
- iwr.u.data.length = buf_len;
- ioctl(drv->ioctl_sock, SIOCSIWPRIV, &iwr);
- 在Kernel中对应函数:
- cfg80211_wext_setpriv (wext-compat.c)
- RSSI_CMD:
- cfg80211_wireless_stats (获取当前已连接AP的信号强度等信息)
- 对于上面的LINKSPEED_CMD,如果ioctl不成功,则调用ioctl(drv->ioctl_sock, SIOCGIWRATE, &wrq)
- 在Kernel中对应函数:
- cfg80211_wext_giwrate (获取当前已连接AP的发送速度)
- //每个AP对应的信息
- struct station_info {
- u32 filled;
- u32 connected_time;
- u32 inactive_time;
- u32 rx_bytes;
- u32 tx_bytes;
- u16 llid;
- u16 plid;
- u8 plink_state;
- s8 signal; //信号强度
- s8 signal_avg;
- struct rate_info txrate; //发送速度
- struct rate_info rxrate;
- u32 rx_packets;
- u32 tx_packets;
- u32 tx_retries;
- u32 tx_failed;
- u32 rx_dropped_misc;
- struct sta_bss_parameters bss_param;
- int generation;
- };
eloop_run->..wpa_supplicant_ctrl_iface_receive-> //接收并处理来自framework的commandwpa_supplicant_ctrl_iface_process-> (SIGNAL_POLL)wpa_supplicant_signal_poll->wpa_drv_signal_poll (struct wpa_supplicant *wpa_s,struct wpa_signal_info *si)->wpa_driver_signal_poll (void *priv, struct wpa_signal_info *si)-> wpa_driver_wext_driver_cmd(priv, RSSI_CMD, buf, sizeof(buf))或 //driver_cmd_wext.c wpa_driver_wext_driver_cmd(priv, LINKSPEED_CMD, buf, sizeof(buf))-> struct iwreq iwr; iwr.u.data.pointer = buf; iwr.u.data.length = buf_len; ioctl(drv->ioctl_sock, SIOCSIWPRIV, &iwr); 在Kernel中对应函数: cfg80211_wext_setpriv (wext-compat.c) RSSI_CMD: cfg80211_wireless_stats (获取当前已连接AP的信号强度等信息) 对于上面的LINKSPEED_CMD,如果ioctl不成功,则调用ioctl(drv->ioctl_sock, SIOCGIWRATE, &wrq) 在Kernel中对应函数: cfg80211_wext_giwrate (获取当前已连接AP的发送速度) //每个AP对应的信息 struct station_info {u32 filled;u32 connected_time;u32 inactive_time;u32 rx_bytes;u32 tx_bytes;u16 llid;u16 plid;u8 plink_state;s8 signal; //信号强度s8 signal_avg;struct rate_info txrate; //发送速度struct rate_info rxrate;u32 rx_packets;u32 tx_packets;u32 tx_retries;u32 tx_failed;u32 rx_dropped_misc;struct sta_bss_parameters bss_param;int generation; };
- WifiCommand流程 wpa_supplicant启动流程 Wifiservice启动流程(转)
- WifiService和wpa_supplicant的启动流程跟踪
- Android WifiService的启动流程分析
- Android WifiService的启动流程分析
- Android WifiService的启动流程分析
- android wifiservice enable流程
- 启动流程
- 启动流程
- 转 android 启动流程
- 转--linux启动流程
- 流程启动(Jbpm)
- Uboot启动流程和Kernel启动流程
- linux启动流程分析(转)
- Linux 的启动流程--转
- 【转】Android kernel启动流程
- Linux 的启动流程(转)
- pmon 启动流程(1)
- Linux启动流程(1)
- 了开始东方没了深刻的麻烦离开倒霉死了看
- Java 处理 XML 的三种主流技术及介绍
- 发生繁荣富强反倒是发顺丰深v按时分为非蜂窝范德萨范德萨发生我燃放时大法师的
- 实现图片的水印
- PID控制算法通俗理解
- WifiCommand流程 wpa_supplicant启动流程 Wifiservice启动流程(转)
- hdu1501-poj2192详细解题报告
- Java日期计算(Calendar类)
- java怎么学习?学习的技巧是什么?为什么要学习java?
- 西米利
- (android 功能代码) android Activity 常用功能设置(全屏、横竖屏等)
- Android system_server进程启动
- dp和px,那些不得不吐槽的故事——Android平台图片文字元素单位浅析
- 首先使人眼界放平