CN114501406A - Method and system for realizing rapid interconnection of equipment based on NFC - Google Patents
Method and system for realizing rapid interconnection of equipment based on NFC Download PDFInfo
- Publication number
- CN114501406A CN114501406A CN202210032863.1A CN202210032863A CN114501406A CN 114501406 A CN114501406 A CN 114501406A CN 202210032863 A CN202210032863 A CN 202210032863A CN 114501406 A CN114501406 A CN 114501406A
- Authority
- CN
- China
- Prior art keywords
- terminal
- interconnection
- information
- nfc
- aid
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
- H04W76/14—Direct-mode setup
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W8/00—Network data management
- H04W8/005—Discovery of network devices, e.g. terminals
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Databases & Information Systems (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
Description
技术领域technical field
本发明涉及移动通信技术领域,特别涉及一种基于NFC实现设备快速互联的方法与系统。The present invention relates to the technical field of mobile communication, in particular to a method and system for realizing fast interconnection of devices based on NFC.
背景技术Background technique
随着Android系统的不断发展,Android系统用于越来越多的设备,如手机、POS机、收银机等设备。Android提供诸多的设备之间互联的通道,如Wi-Fi-AP、Wi-Fi-P2P、蓝牙、NFC、局域网等等;但是这些传统的互联方式不管是对用户使用的便捷程度,还是开发者开发时的便捷程度上都存在不小的缺陷。With the continuous development of the Android system, the Android system is used in more and more devices, such as mobile phones, POS machines, cash registers and other devices. Android provides many channels for interconnection between devices, such as Wi-Fi-AP, Wi-Fi-P2P, Bluetooth, NFC, local area network, etc.; but these traditional interconnection methods are convenient for users and developers. There are many shortcomings in the convenience of development.
首先,传统的设备发现往往是基于Wi-Fi、蓝牙,用户需要手动去打开Wi-Fi、蓝牙等,进入设置应用,搜索附近设备后,再从一堆发现的设备列表中去选择目标设备。而后连接设备也需要用户进行诸多操作选择和交互操作后才能实现设备间的连接。在如今用户体验和方便性要求越来越高的情况下,如此繁杂的交互流程往往会减少用户的使用欲望。此外,基于Wi-Fi、蓝牙等互联通道存在网络隔离,无法进行互通,开发者需要面向异构网络,需要适配不同的网络协议和标准规范,业务开发成本高,网络可扩展性差。First of all, traditional device discovery is often based on Wi-Fi and Bluetooth. Users need to manually turn on Wi-Fi, Bluetooth, etc., enter the settings application, search for nearby devices, and then select a target device from a list of discovered devices. Then the connection between the devices also requires the user to perform many operation selections and interactive operations before the connection between the devices can be realized. In today's increasingly demanding user experience and convenience, such a complicated interaction process often reduces users' desire to use. In addition, based on Wi-Fi, Bluetooth and other interconnection channels, there is network isolation and cannot communicate with each other. Developers need to face heterogeneous networks and adapt to different network protocols and standards. The cost of business development is high and the network scalability is poor.
发明内容SUMMARY OF THE INVENTION
本发明所要解决的技术问题是:提供一种基于NFC实现设备快速互联的方法与系统,实现设备快速互联的同时,降低业务开发成本并提高网络可扩展性。The technical problem to be solved by the present invention is to provide a method and system for realizing fast interconnection of devices based on NFC, which can reduce service development costs and improve network scalability while realizing fast interconnection of devices.
为了解决上述技术问题,本发明采用的技术方案为:In order to solve the above-mentioned technical problems, the technical scheme adopted in the present invention is:
一种基于NFC实现设备快速互联的方法,包括步骤:A method for realizing fast interconnection of devices based on NFC, comprising the steps of:
S1、第一终端获取自身的终端信息,根据应用请求,调用原生NFC接口,开启NFC读卡功能;S1. The first terminal acquires its own terminal information, and according to the application request, calls the native NFC interface to enable the NFC card reading function;
S2、第二终端调用原生NFC接口,开启NFC模拟卡功能;S2. The second terminal calls the native NFC interface to enable the NFC analog card function;
S3、所述第一终端检测到所述第二终端靠近时,向所述第二终端发送所述终端信息;S3. When the first terminal detects that the second terminal is approaching, the terminal information is sent to the second terminal;
S4、所述第二终端接收所述第一终端的所述终端信息,根据所述终端信息选择互联通道,并向所述第一终端发起互联请求,建立互联。S4. The second terminal receives the terminal information of the first terminal, selects an interconnection channel according to the terminal information, and initiates an interconnection request to the first terminal to establish interconnection.
为了解决上述技术问题,本发明采用的另一种技术方案为:In order to solve the above-mentioned technical problems, another technical scheme adopted by the present invention is:
一种基于NFC实现设备快速互联的系统,包括第一终端和第二终端,所述第一终端包括第一处理器、第一存储器以及存储在所述第一存储器中并可在所述第一处理器上运行的第一计算机程序,所述第二终端包括第二处理器、第二存储器以及存储在所述第二存储器中并可在所述第二处理器上运行的计算机程序,所述第一处理器执行所述第一计算机程序时实现以下步骤:A system for realizing fast interconnection of devices based on NFC includes a first terminal and a second terminal, the first terminal includes a first processor, a first memory, and is stored in the first memory and can be used in the first terminal. a first computer program running on a processor, the second terminal comprising a second processor, a second memory, and a computer program stored in the second memory and executable on the second processor, the The first processor implements the following steps when executing the first computer program:
S1、获取自身的终端信息,根据应用请求,调用原生NFC接口,开启NFC读卡功能;S1. Obtain its own terminal information, call the native NFC interface according to the application request, and enable the NFC card reading function;
S3、检测到所述第二终端靠近时,向所述第二终端发送所述终端信息;S3. When detecting that the second terminal is approaching, send the terminal information to the second terminal;
所述第二处理器执行所述第二计算机程序时实现以下步骤:The second processor implements the following steps when executing the second computer program:
S2、调用原生NFC接口,开启NFC模拟卡功能;S2. Call the native NFC interface and enable the NFC analog card function;
S4、接收所述第一终端的所述终端信息,根据所述终端信息选择互联通道,并向所述第一终端发起互联请求,建立互联。S4. Receive the terminal information of the first terminal, select an interconnection channel according to the terminal information, and initiate an interconnection request to the first terminal to establish interconnection.
本发明的有益效果在于:本发明在业务需要时能够通过NFC实现目标设备的快速发现和选择,不需要用户手动选择目标设备,更加便捷,且根据NFC传输的数据自动选择互联通道,实现设备间快速无感的连接,业务开发者不需要考虑组网方式与物理协议,降低了业务成本,且可扩展性更高。The beneficial effects of the present invention are: the present invention can realize the rapid discovery and selection of the target device through NFC when the business needs it, and does not require the user to manually select the target device, which is more convenient, and automatically selects the interconnection channel according to the data transmitted by the NFC, and realizes the realization of the inter-device connection. Fast and non-inductive connection, business developers do not need to consider networking methods and physical protocols, reducing business costs and higher scalability.
附图说明Description of drawings
图1为本发明实施例的一种基于NFC实现设备快速互联的方法的流程图;FIG. 1 is a flowchart of a method for realizing fast interconnection of devices based on NFC according to an embodiment of the present invention;
图2为本发明实施例的一种基于NFC实现设备快速互联的系统的结构图;2 is a structural diagram of a system for realizing fast interconnection of devices based on NFC according to an embodiment of the present invention;
图3为本发明实施例的一种基于NFC实现设备快速互联的方法的序列图;3 is a sequence diagram of a method for realizing fast interconnection of devices based on NFC according to an embodiment of the present invention;
图4为本发明实施例的一种基于NFC实现设备快速互联的方法的架构图;FIG. 4 is an architectural diagram of a method for realizing fast interconnection of devices based on NFC according to an embodiment of the present invention;
标号说明:Label description:
1、一种基于NFC实现设备快速互联的系统;2、第一终端;3、第二终端;4、第一处理器;5、第一存储器;6、第二处理器;7、第二存储器。1. A system for realizing fast interconnection of devices based on NFC; 2. A first terminal; 3. A second terminal; 4. A first processor; 5. A first memory; 6. A second processor; 7. A second memory .
具体实施方式Detailed ways
为详细说明本发明的技术内容、所实现目的及效果,以下结合实施方式并配合附图予以说明。In order to describe in detail the technical content, achieved objects and effects of the present invention, the following descriptions are given with reference to the embodiments and the accompanying drawings.
请参照图1以及图3,一种基于NFC实现设备快速互联的方法,包括步骤:Please refer to FIG. 1 and FIG. 3 , a method for realizing fast interconnection of devices based on NFC includes the steps:
S1、第一终端获取自身的终端信息,根据应用请求,调用原生NFC接口,开启NFC读卡功能;S1. The first terminal acquires its own terminal information, and according to the application request, calls the native NFC interface to enable the NFC card reading function;
S2、第二终端调用原生NFC接口,开启NFC模拟卡功能;S2. The second terminal calls the native NFC interface to enable the NFC analog card function;
S3、所述第一终端检测到所述第二终端靠近时,向所述第二终端发送所述终端信息;S3. When the first terminal detects that the second terminal is approaching, the terminal information is sent to the second terminal;
S4、所述第二终端接收所述第一终端的所述终端信息,根据所述终端信息选择互联通道,并向所述第一终端发起互联请求,建立互联。S4. The second terminal receives the terminal information of the first terminal, selects an interconnection channel according to the terminal information, and initiates an interconnection request to the first terminal to establish interconnection.
从上述描述可知,本发明的有益效果在于:本发明在业务需要时能够通过NFC实现目标设备的快速发现和选择,不需要用户手动选择目标设备,更加便捷,且根据NFC传输的数据自动选择互联通道,实现设备间快速无感的连接,业务开发者不需要考虑组网方式与物理协议,降低了业务成本,且可扩展性更高。As can be seen from the above description, the beneficial effects of the present invention are: the present invention can realize the rapid discovery and selection of target devices through NFC when the business needs it, and does not require the user to manually select the target device, which is more convenient, and automatically selects the interconnection according to the data transmitted by NFC. The channel realizes fast and non-inductive connection between devices. Service developers do not need to consider networking methods and physical protocols, which reduces service costs and has higher scalability.
进一步地,所述第一终端与所述第二终端上预先配置有AID;Further, an AID is preconfigured on the first terminal and the second terminal;
所述步骤S3具体为:The step S3 is specifically:
所述第一终端检测到所述第二终端靠近时,获取所述第二终端的AID,并与自身的AID进行校对,若一致,则向所述第二终端发送所述终端信息;When the first terminal detects that the second terminal is approaching, it acquires the AID of the second terminal, and checks it with its own AID, and if it is consistent, sends the terminal information to the second terminal;
所述步骤S4具体为:The step S4 is specifically:
所述第二终端检测到所述第一终端发送的终端信息,获取所述第一终端的AID并与自身的AID进行校对,若一致则接收所述第一终端的所述终端信息,根据所述终端信息选择互联通道,并向所述第一终端发起互联请求,建立互联。The second terminal detects the terminal information sent by the first terminal, obtains the AID of the first terminal and collates it with its own AID, and if it is consistent, receives the terminal information of the first terminal. The terminal information selects an interconnection channel, and initiates an interconnection request to the first terminal to establish interconnection.
由上述描述可知,预先对终端进行了AID的配置,从而保证终端互联的安全性且能够保证终端不会误连到他人的设备。It can be seen from the above description that the terminal is pre-configured with AID, so as to ensure the security of terminal interconnection and to ensure that the terminal will not be mistakenly connected to other people's devices.
进一步地,所述终端信息包括终端当前的Wi-Fi信息、蓝牙信息、USB端口信息以及NFC信息;Further, the terminal information includes current Wi-Fi information, Bluetooth information, USB port information and NFC information of the terminal;
所述步骤S4中根据所述终端信息选择互联通道具体为:In the step S4, selecting an interconnection channel according to the terminal information is specifically:
根据所述第一终端当前的Wi-Fi信息、蓝牙信息、USB端口信息以及NFC信息,根据预设的优先级序列在可用的所述互联通道中选择最优的所述互联通道。According to the current Wi-Fi information, Bluetooth information, USB port information and NFC information of the first terminal, the optimal interconnection channel is selected from the available interconnection channels according to a preset priority sequence.
由上述描述可知,终端能够获取到当前设备之间可用的所有互联通道,并选择最优的互联通道进行使用,更好地满足用户的互联通道使用偏向。It can be seen from the above description that the terminal can obtain all the interconnection channels available between the current devices, and select the optimal interconnection channel for use, so as to better satisfy the user's preference for the use of interconnection channels.
进一步地,所述优先级序列为:Further, the priority sequence is:
USB通信>蓝牙组网>Wi-FiP2P组网>Wi-FiAP组网>NFC组网。USB communication>Bluetooth networking>Wi-FiP2P networking>Wi-FiAP networking>NFC networking.
由上述描述可知,通过上述优先级序列,将数据传输更加稳定和更加高效的互联通道作为更高的优先级,提高了互联通道的可用性以及通道的数据传输效率。As can be seen from the above description, through the above priority sequence, the interconnection channel with more stable and efficient data transmission is regarded as a higher priority, which improves the availability of the interconnection channel and the data transmission efficiency of the channel.
进一步地,在步骤S4之后还包括步骤:Further, it also includes steps after step S4:
S5、所述第二终端判断是否成功建立互联,若建立互联失败则重新向所述第一终端获取所所述终端信息,并执行步骤S4。S5. The second terminal determines whether the interconnection is successfully established, and if the establishment of the interconnection fails, obtains the terminal information from the first terminal again, and executes step S4.
由上述描述可知,还需要判断是否互联成功,若互联失败则要重新获取互联目标终端的终端信息,以确认可连接的互联通道是否发生变动,在重新拟定互联通道进行互联,提高设备互联的效率。As can be seen from the above description, it is also necessary to judge whether the interconnection is successful. If the interconnection fails, the terminal information of the interconnection target terminal must be re-acquired to confirm whether the interconnection channel that can be connected has changed, and the interconnection channel is re-established for interconnection to improve the efficiency of device interconnection. .
请参照图2,一种基于NFC实现设备快速互联的系统,包括第一终端和第二终端,所述第一终端包括第一处理器、第一存储器以及存储在所述第一存储器中并可在所述第一处理器上运行的第一计算机程序,所述第二终端包括第二处理器、第二存储器以及存储在所述第二存储器中并可在所述第二处理器上运行的计算机程序,所述第一处理器执行所述第一计算机程序时实现以下步骤:Please refer to FIG. 2 , a system for realizing fast interconnection of devices based on NFC includes a first terminal and a second terminal, the first terminal includes a first processor, a first memory, and is stored in the first memory and can be accessed A first computer program running on the first processor, the second terminal including a second processor, a second memory, and a computer program stored in the second memory and executable on the second processor A computer program, the first processor implements the following steps when executing the first computer program:
S1、获取自身的终端信息,根据应用请求,调用原生NFC接口,开启NFC读卡功能;S1. Obtain its own terminal information, call the native NFC interface according to the application request, and enable the NFC card reading function;
S3、检测到所述第二终端靠近时,向所述第二终端发送所述终端信息;S3. When detecting that the second terminal is approaching, send the terminal information to the second terminal;
所述第二处理器执行所述第二计算机程序时实现以下步骤:The second processor implements the following steps when executing the second computer program:
S2、调用原生NFC接口,开启NFC模拟卡功能;S2. Call the native NFC interface and enable the NFC analog card function;
S4、接收所述第一终端的所述终端信息,根据所述终端信息选择互联通道,并向所述第一终端发起互联请求,建立互联。S4. Receive the terminal information of the first terminal, select an interconnection channel according to the terminal information, and initiate an interconnection request to the first terminal to establish interconnection.
由上述描述可知,从上述描述可知,本发明的有益效果在于:本发明在业务需要时能够通过NFC实现目标设备的快速发现和选择,不需要用户手动选择目标设备,更加便捷,且根据NFC传输的数据自动选择互联通道,实现设备间快速无感的连接,业务开发者不需要考虑组网方式与物理协议,降低了业务成本,且可扩展性更高。It can be seen from the above description that the beneficial effects of the present invention are: the present invention can realize the rapid discovery and selection of target devices through NFC when the business needs it, and does not require the user to manually select the target device, which is more convenient, and transmits according to NFC. The data automatically selects the interconnection channel to realize the fast and non-inductive connection between the devices. The service developer does not need to consider the networking mode and physical protocol, which reduces the service cost and has higher scalability.
进一步地,所述第一终端与所述第二终端上预先配置有AID;Further, an AID is preconfigured on the first terminal and the second terminal;
所述步骤S3具体为:The step S3 is specifically:
检测到所述第二终端靠近时,获取所述第二终端的AID,并与自身的AID进行校对,若一致则向所述第二终端发送所述终端信息;When it is detected that the second terminal is approaching, the AID of the second terminal is obtained, and the AID of the second terminal is checked, and if it is consistent, the terminal information is sent to the second terminal;
所述步骤S4具体为:The step S4 is specifically:
检测到所述第一终端发送的终端信息,获取所述第一终端的AID并与自身的AID进行校对,若一致则接收所述第一终端的所述终端信息,根据所述终端信息选择互联通道,并向所述第一终端发起互联请求,建立互联。Detecting the terminal information sent by the first terminal, obtaining the AID of the first terminal and verifying it with its own AID, receiving the terminal information of the first terminal if it is consistent, and selecting an interconnection according to the terminal information channel, and initiates an interconnection request to the first terminal to establish interconnection.
由上述描述可知,预先对终端进行了AID的配置,从而保证终端互联的安全性且能够保证终端不会误连到他人的设备。It can be seen from the above description that the terminal is pre-configured with AID, so as to ensure the security of terminal interconnection and to ensure that the terminal will not be mistakenly connected to other people's devices.
进一步地,所述终端信息包括终端当前的Wi-Fi信息、蓝牙信息、USB端口信息以及NFC信息;Further, the terminal information includes current Wi-Fi information, Bluetooth information, USB port information and NFC information of the terminal;
所述步骤S4中根据所述终端信息选择互联通道具体为:In the step S4, selecting an interconnection channel according to the terminal information is specifically:
根据所述第一终端当前的Wi-Fi信息、蓝牙信息、USB端口信息以及NFC信息,根据预设的优先级序列在可用的所述互联通道中选择最优的所述互联通道。According to the current Wi-Fi information, Bluetooth information, USB port information and NFC information of the first terminal, the optimal interconnection channel is selected from the available interconnection channels according to a preset priority sequence.
由上述描述可知,终端能够获取到当前设备之间可用的所有互联通道,并选择最优的互联通道进行使用,更好地满足用户的互联通道使用偏向。It can be seen from the above description that the terminal can obtain all the interconnection channels available between the current devices, and select the optimal interconnection channel for use, so as to better satisfy the user's preference for the use of interconnection channels.
进一步地,所述优先级序列为:Further, the priority sequence is:
USB通信>蓝牙组网>Wi-FiP2P组网>Wi-FiAP组网>NFC组网。USB communication>Bluetooth networking>Wi-FiP2P networking>Wi-FiAP networking>NFC networking.
由上述描述可知,通过上述优先级序列,将数据传输更加稳定和更加高效的互联通道作为更高的优先级,提高了互联通道的可用性以及通道的数据传输效率。As can be seen from the above description, through the above priority sequence, the interconnection channel with more stable and efficient data transmission is regarded as a higher priority, which improves the availability of the interconnection channel and the data transmission efficiency of the channel.
进一步地,所述第二处理器执行所述第二计算机程序时在步骤S4之后还包括步骤:Further, when the second processor executes the second computer program, the second processor further includes steps after step S4:
S5、判断是否成功建立互联,若建立互联失败则重新向所述第一终端获取所所述终端信息,并执行步骤S4。S5. Determine whether the interconnection is successfully established, and if the establishment of the interconnection fails, obtain the terminal information from the first terminal again, and execute step S4.
由上述描述可知,还需要判断是否互联成功,若互联失败则要重新获取互联目标终端的终端信息,以确认可连接的互联通道是否发生变动,在重新拟定互联通道进行互联,提高设备互联的效率。As can be seen from the above description, it is also necessary to judge whether the interconnection is successful. If the interconnection fails, the terminal information of the interconnection target terminal must be re-acquired to confirm whether the interconnection channel that can be connected has changed, and the interconnection channel is re-established for interconnection to improve the efficiency of device interconnection. .
本发明的一种基于NFC实现设备快速互联的方法与系统,适用于两个及以上具有NFC功能的终端需要进行互联的场景。The method and system for realizing fast interconnection of devices based on NFC of the present invention are suitable for scenarios where two or more terminals with NFC functions need to be interconnected.
请参照图1、图3和图4,本发明的实施例一为:Please refer to FIG. 1, FIG. 3 and FIG. 4, the first embodiment of the present invention is:
一种基于NFC实现设备快速互联的方法,包括步骤:A method for realizing fast interconnection of devices based on NFC, comprising the steps of:
S1、第一终端获取自身的终端信息,根据应用请求,调用原生NFC接口,开启NFC读卡功能;S1. The first terminal acquires its own terminal information, and according to the application request, calls the native NFC interface to enable the NFC card reading function;
所述终端信息包括终端当前的Wi-Fi信息、蓝牙信息、USB端口信息以及NFC信息。The terminal information includes current Wi-Fi information, Bluetooth information, USB port information and NFC information of the terminal.
本实施例中,请参照图4,将终端中相关的程序资源分为用户应用层、自组网适配层以及系统层。其中,用户应用层是设备发现及互联功能的使用者,根据应用自身业务需求,决定什么时候去调用接口获取设备列表或与目标终端建立设备互联;系统层为设备系统功能的实现模块,在自组网适配层完成连接方式决策后及连接发起后,执行对应的连接请求,本实施例中指Android系统层;自组网适配层则是承上提供发现设备以及建立设备连接等接口,供开发者快速便捷的接入设备互联;并完成终端发现、连接组网和最优连接方式决策等主要功能。本方案的主要内容由自组网适配层,即自组网服务来实现。In this embodiment, referring to FIG. 4 , the related program resources in the terminal are divided into a user application layer, an ad hoc network adaptation layer and a system layer. Among them, the user application layer is the user of the device discovery and interconnection functions. According to the application's own business needs, it decides when to call the interface to obtain the device list or establish device interconnection with the target terminal; the system layer is the realization module of the device system function. After the networking adaptation layer completes the connection mode decision and after the connection is initiated, it executes the corresponding connection request, which in this embodiment refers to the Android system layer; the self-organizing network adaptation layer provides interfaces such as discovering devices and establishing device connections. Developers can quickly and conveniently access device interconnection; and complete main functions such as terminal discovery, connection networking, and optimal connection method decision-making. The main content of this scheme is realized by the ad hoc network adaptation layer, that is, the ad hoc network service.
本实施例中,自组网服务由用户的应用绑定服务的时候启动,或者监听系统开机广播启动。第一终端中,用户应用层的应用根据业务需要,调用由自组网服务提供的设备发现接口,等待目标设备的发现,自组网服务读取第一终端的终端信息,Wi-Fi局域网的IP及端口、蓝牙地址及端口、USB端口信息以及NFC信息等,以备传输给目标终端。同时,自组网服务接收到来自用户应用层的调用请求后,使用Android原生NFC接口,开启NFC读卡功能,并等待目标终端的读卡。In this embodiment, the ad hoc network service is started when the user's application binds the service, or starts by monitoring the system boot broadcast. In the first terminal, the application of the user application layer calls the device discovery interface provided by the ad hoc network service according to the business needs, and waits for the discovery of the target device. The ad hoc network service reads the terminal information of the first terminal, and the Wi-Fi local area network IP and port, Bluetooth address and port, USB port information and NFC information, etc. for transmission to the target terminal. At the same time, after receiving the call request from the user application layer, the ad hoc network service uses the Android native NFC interface to enable the NFC card reading function, and waits for the target terminal to read the card.
S2、第二终端调用原生NFC接口,开启NFC模拟卡功能;S2. The second terminal calls the native NFC interface to enable the NFC analog card function;
本实施例中,第二终端的自组网服务使用Android原生NFC模拟卡功能,将第二终端模拟为NFC卡。In this embodiment, the ad hoc network service of the second terminal uses the Android native NFC emulation card function to emulate the second terminal as an NFC card.
S3、所述第一终端检测到所述第二终端靠近时,向所述第二终端发送所述终端信息;S3. When the first terminal detects that the second terminal is approaching, the terminal information is sent to the second terminal;
所述第一终端与所述第二终端上预先配置有AID;AIDs are preconfigured on the first terminal and the second terminal;
所述步骤S3具体为:The step S3 is specifically:
所述第一终端检测到所述第二终端靠近时,获取所述第二终端的AID,并与自身的AID进行校对,若一致,则向所述第二终端发送所述终端信息。When the first terminal detects that the second terminal is approaching, it acquires the AID of the second terminal, and checks it with its own AID, and if it is consistent, sends the terminal information to the second terminal.
本实施例中,第一终端和第二终端预先指定有AID,本实施例中为在设备启用时即由用户配置有一个AID,在其他等同实施例中,可将设备登录用户的ID作为AID,或将其他用于识别设备所述用户身份的信息作为AID,具体可根据需求而定。在第一终端靠近第二终端时,第一终端读取到模拟为NFC卡的第二终端,当第一终端识别感应到模拟成NFC卡的第二终端且获取第二终端的AID为预先指定的AID,则第一终端将自身的IP及端口信息、蓝牙地址等终端信息通过NFC发送给第二终端。In this embodiment, the first terminal and the second terminal are pre-specified with an AID. In this embodiment, an AID is configured by the user when the device is activated. In other equivalent embodiments, the ID of the user who logs in to the device can be used as the AID. , or use other information used to identify the user identity of the device as the AID, which can be determined according to requirements. When the first terminal is close to the second terminal, the first terminal reads the second terminal that is simulated as an NFC card. When the first terminal recognizes and senses the second terminal that is simulated as an NFC card and acquires the AID of the second terminal, it is pre-specified the AID, the first terminal sends its own IP, port information, Bluetooth address and other terminal information to the second terminal through NFC.
S4、所述第二终端接收所述第一终端的所述终端信息,根据所述终端信息选择互联通道,并向所述第一终端发起互联请求,建立互联;S4. The second terminal receives the terminal information of the first terminal, selects an interconnection channel according to the terminal information, and initiates an interconnection request to the first terminal to establish interconnection;
所述步骤S4具体为:The step S4 is specifically:
所述第二终端检测到所述第一终端发送的终端信息,获取所述第一终端的AID并与自身的AID进行校对,若一致则接收所述第一终端的所述终端信息,根据所述终端信息选择互联通道,并向所述第一终端发起互联请求,建立互联。The second terminal detects the terminal information sent by the first terminal, obtains the AID of the first terminal and collates it with its own AID, and if it is consistent, receives the terminal information of the first terminal. The terminal information selects an interconnection channel, and initiates an interconnection request to the first terminal to establish interconnection.
所述步骤S4中根据所述终端信息选择互联通道具体为:In the step S4, selecting an interconnection channel according to the terminal information is specifically:
根据所述第一终端当前的Wi-Fi信息、蓝牙信息、USB端口信息以及NFC信息,根据预设的优先级序列在可用的所述互联通道中选择最优的所述互联通道;According to the current Wi-Fi information, Bluetooth information, USB port information and NFC information of the first terminal, select the optimal interconnection channel among the available interconnection channels according to a preset priority sequence;
所述优先级序列为:The priority sequence is:
USB通信>蓝牙组网>Wi-FiP2P组网>Wi-FiAP组网>NFC组网。USB communication>Bluetooth networking>Wi-FiP2P networking>Wi-FiAP networking>NFC networking.
本实施例中,第二终端接收到第一终端通过NFC发送的终端信息后,对第一终端的AID进行校验,校验通过则接收第一终端通过NFC发送过来的终端信息。In this embodiment, after receiving the terminal information sent by the first terminal through NFC, the second terminal verifies the AID of the first terminal, and if the verification passes, it receives the terminal information sent by the first terminal through NFC.
本实施例中,第二终端的自组网服务根据第一终端发送的Wi-Fi信息、蓝牙信息、USB端口信息以及NFC信息等,决策最优连接通道;In this embodiment, the ad hoc network service of the second terminal determines the optimal connection channel according to Wi-Fi information, Bluetooth information, USB port information, and NFC information sent by the first terminal;
组网方式根据当前第一终端与第二终端可用的组网方式,优先级为:The networking mode is based on the networking modes currently available for the first terminal and the second terminal, and the priorities are:
USB通信--蓝牙组网--Wi-Fi P2P组网--Wi-Fi AP组网--NFC组网;USB communication--Bluetooth networking--Wi-Fi P2P networking--Wi-Fi AP networking--NFC networking;
其中,NFC作为Android传统的一种连接方式,由于其在传输数据大小及速度上的受限,往往仅用于一些支付、门禁等场景,且多应用使用时会存在抢占问题,对于通用的应用数据传输场景往往难以使用。因此,在建立互联通道上作为最次选择。Among them, NFC, as a traditional connection method of Android, is often only used in some payment, access control and other scenarios due to its limited data transmission size and speed, and there will be preemption problems when using multiple applications. Data transfer scenarios are often difficult to use. Therefore, it is the last choice in establishing interconnection channels.
S5、所述第二终端判断是否成功建立互联,若建立互联失败则重新向所述第一终端获取所所述终端信息,并执行步骤S4。S5. The second terminal determines whether the interconnection is successfully established, and if the establishment of the interconnection fails, obtains the terminal information from the first terminal again, and executes step S4.
本实施例中,在第二终端发现所用组网方式不可达,无法与第一终端建立互联时,将重新获取第一终端的终端信息,重新决策创建最优连接通道。第一终端和第二终端组网成功便建立设备互联通道,后续的应用所需的业务交互数据便可通过所建立的交互通道进行传输。In this embodiment, when the second terminal finds that the networking mode used is unreachable and cannot establish interconnection with the first terminal, it will re-acquire the terminal information of the first terminal, and re-decision to create an optimal connection channel. After the first terminal and the second terminal are successfully networked, a device interconnection channel is established, and service interaction data required by subsequent applications can be transmitted through the established interaction channel.
请参照图2,本发明的实施例二为:Please refer to Fig. 2, the second embodiment of the present invention is:
一种基于NFC实现设备快速互联的系统1,包括第一终端2和第二终端3,所述第一终端2包括第一处理器4、第一存储器5以及存储在所述第一存储器5中并可在所述第一处理器4上运行的第一计算机程序,所述第二终端3包括第二处理器6、第二存储器7以及存储在所述第二存储器7中并可在所述第二处理器6上运行的计算机程序,所述第一处理器4执行所述第一计算机程序时实现以上实施例一中第一终端2所执行的步骤,所述第二处理器6执行所述第二计算机程序时实现以上实施例一中第二终端3所实现的步骤。A
本发明的主要原理在于,利用NFC来确定需要互联的终端信息,从而根据得到的终端信息选择与自身设备的可用互联通道,从而自动选择并连接。The main principle of the present invention is to use NFC to determine the terminal information that needs to be interconnected, so as to select the available interconnection channel with the own device according to the obtained terminal information, so as to automatically select and connect.
综上所述,本发明提供的一种基于NFC实现设备快速互联的方法与系统,在业务需要时能够通过NFC实现目标设备的快速发现和选择,不需要用户手动选择目标设备,更加便捷,且根据NFC传输的数据自动选择互联通道,实现设备间快速无感的连接,业务开发者不需要考虑组网方式与物理协议,降低了业务成本,且可扩展性更高。To sum up, the present invention provides a method and system for realizing rapid interconnection of devices based on NFC, which can realize rapid discovery and selection of target devices through NFC when business needs require, and does not require users to manually select target devices, which is more convenient, and According to the data transmitted by NFC, the interconnection channel is automatically selected to realize fast and non-inductive connection between devices. Business developers do not need to consider networking methods and physical protocols, which reduces business costs and has higher scalability.
以上所述仅为本发明的实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等同变换,或直接或间接运用在相关的技术领域,均同理包括在本发明的专利保护范围内。The above descriptions are only examples of the present invention, and are not intended to limit the scope of the present invention. Any equivalent transformations made by using the contents of the description and drawings of the present invention, or directly or indirectly applied in related technical fields, are similarly included in the within the scope of patent protection of the present invention.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210032863.1A CN114501406A (en) | 2022-01-12 | 2022-01-12 | Method and system for realizing rapid interconnection of equipment based on NFC |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202210032863.1A CN114501406A (en) | 2022-01-12 | 2022-01-12 | Method and system for realizing rapid interconnection of equipment based on NFC |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN114501406A true CN114501406A (en) | 2022-05-13 |
Family
ID=81511104
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202210032863.1A Pending CN114501406A (en) | 2022-01-12 | 2022-01-12 | Method and system for realizing rapid interconnection of equipment based on NFC |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114501406A (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115002699A (en) * | 2022-06-02 | 2022-09-02 | 福州汇思博信息技术有限公司 | A method and terminal for acquiring information of acquiring equipment |
| CN115866595A (en) * | 2022-11-30 | 2023-03-28 | 深圳开鸿数字产业发展有限公司 | Device authorization method, device, device and storage medium |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105848085A (en) * | 2016-01-26 | 2016-08-10 | 乐卡汽车智能科技(北京)有限公司 | Sharing method, sharing apparatus, intelligent terminal, vehicle-mounted multimedia terminal and system |
| CN107836085A (en) * | 2016-05-25 | 2018-03-23 | 华为技术有限公司 | The method for configuring route and device of non-contact application |
| CH714569A2 (en) * | 2018-01-17 | 2019-07-31 | Pbv Kaufmann Systeme Gmbh | Secure bidirectional near-field data transmission between a terminal and a mobile device without bidirectional near-field interface. |
| CN112346751A (en) * | 2020-11-20 | 2021-02-09 | 腾讯科技(深圳)有限公司 | Application program installation method and device, electronic equipment and storage medium |
-
2022
- 2022-01-12 CN CN202210032863.1A patent/CN114501406A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105848085A (en) * | 2016-01-26 | 2016-08-10 | 乐卡汽车智能科技(北京)有限公司 | Sharing method, sharing apparatus, intelligent terminal, vehicle-mounted multimedia terminal and system |
| CN107836085A (en) * | 2016-05-25 | 2018-03-23 | 华为技术有限公司 | The method for configuring route and device of non-contact application |
| CH714569A2 (en) * | 2018-01-17 | 2019-07-31 | Pbv Kaufmann Systeme Gmbh | Secure bidirectional near-field data transmission between a terminal and a mobile device without bidirectional near-field interface. |
| CN112346751A (en) * | 2020-11-20 | 2021-02-09 | 腾讯科技(深圳)有限公司 | Application program installation method and device, electronic equipment and storage medium |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115002699A (en) * | 2022-06-02 | 2022-09-02 | 福州汇思博信息技术有限公司 | A method and terminal for acquiring information of acquiring equipment |
| CN115866595A (en) * | 2022-11-30 | 2023-03-28 | 深圳开鸿数字产业发展有限公司 | Device authorization method, device, device and storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US9872323B2 (en) | Apparatus and method of connecting service, according to user intention | |
| CN112312586B (en) | Method, device, equipment and storage medium for establishing WiFi direct connection | |
| WO2018045561A1 (en) | File transmission method, file reception method and terminal | |
| US9730255B1 (en) | Room-specific pairing via a combined ultrasonic beacon/bluetooth approach | |
| CN109673001A (en) | Data transfer control method and Related product | |
| KR102037256B1 (en) | Apparatus and method for connecting service reflected in user intent | |
| EP2653008A2 (en) | Wireless network interface with infrastructure and direct modes | |
| CN102801800B (en) | Method and system for performing resource sharing processing among plurality of wireless terminals | |
| CN104919436A (en) | Wireless docking service with direct connection to peripherals | |
| US11134435B2 (en) | Electronic device supporting multiple wireless communication protocols and method therefor | |
| CN111050415B (en) | Wireless data transmission method convenient to operate | |
| KR102036686B1 (en) | Apparatus and method for selecting channel in wireless communication system | |
| WO2014110855A1 (en) | Data transmission method and terminals | |
| CN114390491B (en) | A networking method, device and system | |
| CN114501406A (en) | Method and system for realizing rapid interconnection of equipment based on NFC | |
| WO2021042612A1 (en) | Wireless screen projection method and apparatus, device and storage medium | |
| CN114390488A (en) | Method and system for realizing rapid interconnection of equipment | |
| WO2016026144A1 (en) | Method for establishing network connection by means of wps, and mobile wi-fi device | |
| JP2018174453A (en) | Computer program for terminal device and communication device | |
| CN111465123B (en) | Network connection method, terminal and storage medium | |
| CN113595839B (en) | Device binding method, terminal device and storage medium | |
| CN109803454A (en) | Data transmission control method and related products | |
| CN114640974B (en) | Data migration method, device and storage medium | |
| CN116074369A (en) | Information transmission method and device and related equipment | |
| JP2022170325A (en) | Computer program for terminal device, terminal device, and communication device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| CB02 | Change of applicant information |
Address after: Room 201-9, Zone C, No. 18 Guanri Road, Phase II, Software Park, Torch High tech Zone, Xiamen City, Fujian Province, 361000 Applicant after: Fujian Huisibo Digital Technology Co.,Ltd. Address before: No. 89 Software Avenue, Tongpan Road, Gulou District, Fuzhou City, Fujian Province, 350000. 510, Floor 5, 34 #, Zone C, Fuzhou Software Park Applicant before: FUZHOU HUISIBO INFORMATION TECHNOLOGY Co.,Ltd. |
|
| CB02 | Change of applicant information |