二维码zxing源码分析(四)wifi部分
String networkTypeString = theWifiResult.getNetworkEncryption();
NetworkType networkType;
try {
networkType = NetworkType.forIntentValue(networkTypeString);
} catch (IllegalArgumentException ignored) {
Log.w(TAG, "Bad network type; see NetworkType values: " + networkTypeString);
return null;
}
if (networkType == NetworkType.NO_PASSWORD) {
changeNetworkUnEncrypted(wifiManager, theWifiResult);
} else {
String password = theWifiResult.getPassword();
if (password != null && !password.isEmpty()) {
if (networkType == NetworkType.WEP) {
changeNetworkWEP(wifiManager, theWifiResult);
} else if (networkType == NetworkType.WPA) {
changeNetworkWPA(wifiManager, theWifiResult);
}
}
}
theWifiResult.getNetworkEncryption(); 就是得到wifi的类型的,这个方法的获取是通过核心包Core中WifiResultParser的parser解析后返回WifiParsedResult类中包含的
public WifiParsedResult parse(Result result) {
String rawText = getMassagedText(result);
if (!rawText.startsWith("WIFI:")) {
return null;
}
String ssid = matchSinglePrefixedField("S:", rawText, ';', false);
if (ssid == null || ssid.isEmpty()) {
return null;
}
String pass = matchSinglePrefixedField("P:", rawText, ';', false);
String type = matchSinglePrefixedField("T:", rawText, ';', false);
if (type == null) {
type = "nopass";
}
boolean hidden = Boolean.parseBoolean(matchSinglePrefixedField("H:", rawText, ';', false));
return new WifiParsedResult(type, ssid, pass, hidden);
}

二维码zxing源码分析(四)wifi部分的更多相关文章
- 二维码zxing源码分析(五)精简代码
由于工作的需要,我并不是需要二维码扫描的所有的功能,我只是需要扫一扫,并显示出来图片和url就行,于是我们就要精简代码了,源码已经分析完了,精简起来就方便多了,源码分析请看 二维码zxing源码分析( ...
- 二维码zxing源码分析(二)decode部分
在上一篇博客中分析了zxing怎么打开摄像头,并且扫描结果,那么扫描之后的数据呢,是不是就要解析了呢,那我们看一下zxing怎么解析这个数据的. 上一篇博客地址ZXING源码 ...
- 二维码zxing源码分析(一)camera部分
首先,我们先把zxing的源代码给下载下来,这个网上有很多,我下载的是2.3的,不得不说这个谷歌提供的包包含的功能还是很全面的. 我把下载的包解压后,找到android文件夹,导入到ecpli ...
- 二维码扫描 zxing源码分析(三)result、history部分
前两个部分的地址是:ZXING源码分析(一)CAMERA部分 . zxing源码分析(二)decode部分 下面我们来看第三部分 result包下面有很多的类,其中的核心类是 com.google. ...
- zxing源码分析——QR码部分
Android应用横竖屏切换 zxing源码分析——DataMatrix码部分 zxing源码分析——QR码部分 2013-07-10 17:16:03| 分类: 默认分类 | 标签: |字号大中 ...
- 一步步实现windows版ijkplayer系列文章之二——Ijkplayer播放器源码分析之音视频输出——视频篇
一步步实现windows版ijkplayer系列文章之一--Windows10平台编译ffmpeg 4.0.2,生成ffplay 一步步实现windows版ijkplayer系列文章之二--Ijkpl ...
- Alink漫谈(二十) :卡方检验源码解析
Alink漫谈(二十) :卡方检验源码解析 目录 Alink漫谈(二十) :卡方检验源码解析 0x00 摘要 0x01 背景概念 1.1 假设检验 1.2 H0和H1是什么? 1.3 P值 (P-va ...
- 方维 o2o app源码出售
方维 o2o app源码出售 方维o2oapp源码出售 1.本人官方5万购买,现把方维o2o app 源码低价出售: 2.包括网站源码本地搭建包成功提供指导 3.包括网站说明文档,不包含app说明文档 ...
- Ubuntu12.04下zxing源码编译
1.下载zxing源码 git clone https://github.com/15903016222/zxing-cpp.git 2.安装依赖工具cmake sudo apt-get instal ...
随机推荐
- socat : Some useful commands
http://technostuff.blogspot.com/2008/10/some-useful-socat-commands.html MONDAY, OCTOBER 6, 2008 Some ...
- 从客户端(&)中检测到有潜在危险的 Request.Path 值解决方案
出这个问题基本上是在转址字符串中有非法字符“<”,'&'之类的. 方案1: 如果仅仅只是转换页面,传参时出现的问题,可对数据加密: 绑定数据传值时加密 <%#Server.UrlE ...
- linux C(hello world) 解方程
- 使用TypeDescriptor给类动态添加Attribute
给类动态添加Attribute一直是我想要解决的问题,从msdn里找了很久,到Stack Overflow看了不少文章,算是最终有了答案. 先是有这样的一段解释 Attributes are stat ...
- svn cleanup failed–previous operation has not finished 解决方法
今天svn遇到一个头疼的问题,最开始更新的时候失败了,因为有文件被锁住了.按照以往的操作,我对父目录进行clean up操作,但是clean up 操作也失败了! svn cleanup failed ...
- iOS开发——语法OC篇&BOOL / bool / Boolean / NSCFBoolean
Name Typedef Header True Value False Value BOOL signed char objc.h YES NO bool _Bool (int) stdbool.h ...
- pthread_mutex_t
在Linux中使用线程 http://blog.csdn.net/jiajun2001/article/details/12624923 :LINUX就是这个范围作者 原创作品,允许转载,转载时 ...
- Shell中的函数
一.在脚本中定义函数 与变量一样,在使用函数之前应该对函数进行定义.与其他编程类语言相比,由于没有数据类型的概念,因此也不必定义函数的类型. (1)在脚本中可以使用以下方式定义函数: function ...
- Java_Shell多线程
#!/bin/bash source ~/.bashrc fun(){ echo "fun is begin.timeNum:$timeNum" local timeNum=$ s ...
- [Buzz.Today]2013.07.26
# OpenFab 3D printing hardware is rapidly scaling up to output continuous mixtures of multiple mater ...