基于Android的NFC芯片读写以及模拟场景应用设计与实现毕业论文
2021-03-13 23:22:31
摘 要
随着近代通讯技术的不断进步以及硬件制造业的不断发展,智能手机功能越来越强大,价格逐渐降低,普及率不断提升,为人们的生活带来巨大的便利。其中近场通讯(Near-field communication,NFC)技术是最近兴起的一项近距离无线通信技术,其无线、快捷、可靠的特性为人们带来了广阔的应用想象空间。
NFC技术与传统的无线通信技术相比,一个最大的特点是作用范围小,通常只能在10cm之内,超过这个范围将导致其感应失败,而正是其作用范围小的特性使得此技术拥有可靠的安全性、更短的反应时间以及无需供电的特性。这些优点使得NFC技术被广泛地应用于支付领域、智能公交领域等。而随着NFC技术普及率不断增加,各大手机厂商也在新的手机产品中加入了NFC功能,并且将其作为主打功能之一大力推广。可见 ,在未来,NFC技术扔将不断推进。
本文基于Android手机与NFC标签之间的信息传递,模拟了一种使用NFC标签取代工厂中传统铭牌的实际场景,设计了一款基于Android的NFC铭牌助手应用,用该应用来读写铭牌信息。本文实现了NFC标签信息的读写,以及在实际情形中的应用,当前基于NFC标签读写的研究和应用不多,尤其是将NFC这种新型技术和传统的工厂生产实际情形结合,因此本文具有一定创新意义,对实际生产生活有一定指导意义。
本文主要完成以下几方面工作:首先分析了NFC技术的应用优点、NFC设备间传输的标准数据格式NDEF,以及NDEF格式数据的解析方法。然后罗列了Android开发过程中与NFC相关的API,以及介绍了本软件的开发环境与IDE。最后完成了本软件的设计、开发与测试工作,实现拟定功能,并对本课题研究进行总结,分析不足之处,以及进一步展望。
关键词:NFC,近场通讯,铭牌,Android,NFC标签
ABSTRACT
With the continuous progress of modern communication technology and the continuous development of hardware manufacturing, smart phone becomes more and more powerful, and the price of smart phone gradually reduces, which increases the popularity of smart phone and brings great convenience to people’s lives. The Near Field Communication (NFC) technology is a recently developed short-range wireless communication technology, its wireless, fast and reliable features for people to bring a broad application of imagination.
NFC technology compared with the traditional wireless communication technology, one of the biggest features is the scope of the role is small, usually only within 10 cm, beyond this range will lead to its induction failure, and it is its small range of features make this technology reliable safety, shorter response times and no power supply. These advantages make NFC technology widely used in the field of payment, intelligent bus and so on. With the NFC technology penetration continues to increase, the major mobile phone manufacturers are also new mobile phone products to join the NFC function, and as one of the main features to promote. Can be seen in the future, NFC technology will continue to push forward.
Based on the information transfer between Android and NFC tags, this paper simulates a real situation, designs an Android-based NFC nameplate assistant application, tries to use NFC tags instead of traditional nameplates in the plant, and uses the application to read and write the nameplate information. This paper realizes the reading and writing of NFC tag information and its application in the actual situation. It is not only the research and application of NFC tag reading and writing, but also the combination of NFC new technology and traditional factory production. So this paper has a certain innovative significance, and has a certain guiding significance to the actual production and life.
This paper mainly focuses on the following aspects: First, the application of NFC technology advantages, NFC equipment transmission between the standard data format NDEF, and NDEF format data analysis method and then lists the development process of Android and NFC-related API, and the introduction The development environment of the software and IDE. Finally, the design, development and testing of the software are completed, the functions are tested, and summarizing the topic of this research, analtsising the shortcomings and looking into the future prospect.
Keywords:NFC,Near-field communication,nameplate,Android,NFC tag
目录
摘 要 3
ABSTRACT 4
第1章 绪论 8
1.1 研究背景及意义 8
1.2 国内外现状研究 9
1.3 本文主要工作 10
1.4本文章节安排 10
1.5 本章小结 11
第2章 NFC技术概要 12
2.1 NFC简介 12
2.2 与蓝牙技术的比较 12
2.3 NFC论坛标签类型 13
2.4 NDEF协议 13
2.4.1 NDEF信息 14
2.4.2 NDEF记录 14
2.4.3 RTD协议 16
2.5 本章小结 17
第3章 NFC开发中的Android基础 18
3.1 Android介绍 18
3.2 Android系统架构 18
3.3 Android中与NFC相关的API 20
3.3.1 android.nfc包 20
3.3.2 android.nfc.tech包 20
3.4 NFC标签调度系统 21
3.5 本章小结 22
第4章 软件总体设计 23
4.1 软件需求分析 23
4.2 软件结构 23
4.3 软件界面设计 23
4.3.1 主界面设计 23
4.3.2 分界面设计 24
4.4 NFC标签读写功能实现 25
4.4.1 NFC标签选取 25
4.4.2 标签读写操作的实现 25
4.5 本章小结 26
第5章 软件分模块具体实现 27
5.1 主界面模块 27
5.1.1 加载布局文件 27
5.1.2 初始化UI界面 27
5.1.3 检测NFC功能 28
5.2 读模块 29
5.2.1 获取NDEF信息 30
5.2.2 解析NDEF信息 31
5.3 写模块 33
5.3.1 界面初始化 33
5.3.2 NDEF格式数据封装 33
5.3.3 数据写入 34
5.4 数据库模块 35
5.5 本章小结 37
第6章 软件功能测试 38
6.1 引导功能测试 38
6.2 写入标签功能测试 38
6.3 读出标签功能测试 40
6.4 查看记录功能测试 40
第7章 环境影响及经济性分析 42
7.1 环境影响分析 42
7.2 经济性分析 43
第8章 总结与展望 44
参考文献 45
致 谢 47
第1章 绪论
1.1 研究背景及意义
自iPhone4发布后,智能手机这个名词变得越来越为人们熟知。而今,智能手机已经进入人们生活的方方面面,移动互联网时代正式到来,传统的出行、社交、支付、购物等领域都经历了翻天覆地的变化。截至2016年,智能手机在中国的普及率已达到58%[1]。