Data interaction and performance optimization method and system based on Web NFC
Through Web NFC API and Web Workers technology, the performance deficiencies and integration problems of NFC technology in the Web environment are solved, efficient and safe data interaction is achieved, and user experience and interaction efficiency are improved.
Patent Information
- Application Number
- CN202410801025.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-20
- Publication Date
- 2024-09-24
AI Technical Summary
Existing NFC technology lacks a unified programming interface, insufficient performance, and integration issues with Web technology in the Web environment, resulting in inflexible and inefficient data interaction.
Initialize the NFC reader through the Web NFC API, start the NFC detection mechanism, identify and locate the NFC tag, implement data interaction analysis, signal optimization, Web NFC API interface optimization, data compression and decompression, intelligent data caching strategy and dynamic policy adjustment. Encrypted transmission is used to ensure data security, Web Workers technology is used to implement parallel data processing, and performance parameters are dynamically adjusted to improve interaction efficiency.
It improves the efficiency, stability and security of NFC data exchange, provides a more convenient and flexible NFC data interaction method, meets users' NFC functional needs in a Web environment, and improves user interaction experience.
Smart Images

Figure CN118690764A
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a method and system for data interaction and performance optimization based on Web NFC. Background Art
[0002] With the rapid development of the Internet and mobile technology, people's demand for data interaction is increasing, especially between mobile devices and smart IoT devices. Near field communication (NFC) technology has been widely used in data interaction, mobile payment, access control, etc. due to its simplicity, speed and security. However, the current application of NFC technology in the Web environment still faces some challenges, such as the lack of a unified programming interface, insufficient performance and integration with Web technology. How to effectively integrate NFC technology into Web applications to achieve more flexible and efficient data interaction and meet users' demand for NFC functions in the Web environment is an urgent problem to be solved. Summary of the invention
[0003] The purpose of the present invention is to provide a data interaction and performance optimization method and system based on Web NFC, which is used to solve the problems of lack of unified programming interface, insufficient performance and integration with Web technology in the application of NFC technology in the Web environment in the prior art.
[0004] The present invention solves the above problems through the following technical solutions:
[0005] A data interaction and performance optimization method based on Web NFC, comprising:
[0006] Step S100: Initialize the NFC reader using the Web NFC API;
[0007] Step S200: Start the NFC detection mechanism, identify and locate all nearby NFC tags, establish a data connection with the detected NFC tags, and perform one or more of the following during the data interaction process:
[0008] (1) Data interaction analysis;
[0009] (2) Signal optimization;
[0010] (3) Web NFC API interface optimization;
[0011] (4) Data compression and decompression;
[0012] (5) Intelligent data caching strategy;
[0013] (6) Dynamic strategy adjustment;
[0014] (7) Secure data transmission and data writing to NFC tags;
[0015] Step S300: After the data interaction is completed, the connection with the NFC tag is disconnected.
[0016] Furthermore, the data interaction analysis includes: monitoring and analyzing the data during the NFC interaction process, evaluating the key performance indicators of the signal, analyzing the current interaction status in real time, and identifying bottlenecks; the key performance indicators include signal strength, transmission speed and data delay.
[0017] Furthermore, the signal optimization includes: using digital signal processing technology to enhance and adjust the received NFC signal; and adaptively adjusting the signal modulation scheme according to real-time channel conditions.
[0018] Furthermore, the Web NFC API interface is optimized as follows: in the Web NFC API, data buffer management is used to achieve fast data reading and transmission; a parallel data processing mechanism is introduced, and the Web Workers technology is used to process NFC data in parallel in a background thread.
[0019] Furthermore, the data buffer management includes a least recently used (LRU) strategy and a first-in-first-out (FIFO) strategy.
[0020] Furthermore, the data compression and decompression are as follows: the data sending end uses the data compression algorithm DEFLATE or Brotli to compress the data, and the data receiving end uses the decompression algorithm to restore the original data.
[0021] Furthermore, the intelligent data caching strategy is: caching frequently used data on the client to reduce data requests to the server; through data pre-fetching and pre-loading mechanisms, obtaining and storing data that may be needed in advance to improve data access speed and interactive response.
[0022] Furthermore, the dynamic strategy adjustment is: continuously monitoring the performance indicators of the Web NFC API, and adjusting the data interaction strategy and parameters in real time according to the monitoring results to achieve adaptive optimization.
[0023] Furthermore, the secure data transmission and data writing to the NFC tag include: using encrypted transmission and authentication mechanisms to ensure the security of data during transmission, and after completing data processing, securely writing the processing results to the NFC tag, thereby achieving reliable data storage and exchange.
[0024] A data interaction and performance optimization system based on Web NFC, comprising:
[0025] NFC reader initialization module, used to initialize the NFC reader using the Web NFC API;
[0026] NFC tag detection module, used to start the NFC detection mechanism, identify and locate all nearby NFC tags, and establish data connection with NFC tags;
[0027] Performance monitoring and optimization module, used to record signal strength through the Web NFC API periodic timer and call the function to start periodic recording;
[0028] Data interaction analysis module, used to calculate the average, peak and minimum values of the signal, evaluate the signal strength, transmission speed and data delay of the signal, and identify bottlenecks based on signals below the threshold;
[0029] Signal optimization module, which uses digital signal processing technology to enhance and adjust the received NFC signal; adaptively adjust the signal modulation scheme according to real-time channel conditions;
[0030] API interface optimization module, which is used to use data buffer management in Web NFC API to achieve fast data reading and transmission; introduce parallel data processing mechanism and use Web Workers technology to process NFC data in parallel in background threads;
[0031] The data compression and decompression module is used to compress the data using the data compression algorithm DEFLATE or Brotli before sending the data, and to restore the original data using the decompression algorithm when receiving the data;
[0032] The secure data interaction module is used to encrypt the data in transmission using encryption algorithms, and at the same time adopt an authentication mechanism to allow only authorized users to exchange data, thereby enhancing the security of interaction;
[0033] Intelligent data caching module is used to cache frequently used data to the client, reducing data requests to the server; through data pre-fetching and pre-loading mechanisms, it can obtain and store the data that may be needed in advance, improving data access speed and interactive response;
[0034] The dynamic policy adjustment module is used to continuously monitor the performance indicators of the Web NFC API and adjust the data interaction policies and parameters in real time based on the monitoring results to achieve adaptive optimization.
[0035] Compared with the prior art, the present invention has the following advantages and beneficial effects:
[0036] (1) The present invention proposes data interaction analysis and signal optimization to achieve signal quality improvement and adaptive modulation; introduces parallel data processing mechanism and intelligent data buffer management strategy to achieve fast data reading and transmission and reduce transmission delay; real-time performance monitoring and adaptive optimization ensure real-time adjustment of data interaction strategy to achieve the optimal data interaction effect, improve the efficiency, stability and security of NFC data exchange, and further optimize the user interaction experience.
[0037] (2) The present invention uses Web technology, especially Web NFC API, to provide direct NFC data interaction capabilities for Web platforms. Compared with traditional NFC solutions, such as methods based on Android, iOS and physical NFC devices, Web technology provides users with a more convenient and flexible way to interact with NFC data without relying on specific operating systems or hardware devices.
[0038] (3) The present invention realizes efficient, secure and flexible data interaction between NFC devices and tags in a Web environment by comprehensively applying Web technology, Internet communication and NFC technology.
[0039] (4) The present invention predicts user needs and loads data in advance, and uses advanced encryption technology to ensure data security, thereby improving data exchange efficiency, response speed and security as a whole. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is a schematic diagram of the process of the present invention;
[0041] Figure 2 A schematic diagram of data exchange between devices in the present invention;
[0042] Figure 3 It is a schematic diagram of the data buffering and parallel processing flow in the present invention;
[0043] Figure 4 A comparison diagram of the present invention and traditional NFC;
[0044] Figure 5 Schematic diagram of the system architecture of the present invention. DETAILED DESCRIPTION
[0045] The present invention is further described in detail below in conjunction with examples, but the embodiments of the present invention are not limited thereto.
[0046] Embodiment 1:
[0047] Combined with Figure 1 and Figure 2 As shown, a data interaction and performance optimization method based on Web NFC includes:
[0048] Step S100: Initialize the NFC reader using the Web NFC API;
[0049] Step S200: Start the NFC detection mechanism, identify and locate all nearby NFC tags, and establish a data connection with the detected NFC tags.
[0050] The NFC communication method mainly includes the following steps:
[0051] 1. NFC reader configuration: During initialization, the relevant parameters of the reader are configured through the Web NFC API so that it can detect and read data on NFC tags.
[0052] 2. Detection and identification: Start the NFC detection mechanism and continuously scan the NFC tags near the device through the reader. When the tag enters the sensing range of the reader, the reader captures the tag's signal and identifies the tag's unique identifier (UID).
[0053] 3. Establish data connection: Once the tag is detected and identified, the system will establish a stable and secure data connection with the tag.
[0054] During data interaction, perform one or more of the following:
[0055] (1) Data interaction analysis: Monitor and analyze the data during the NFC interaction process, evaluate the key performance indicators of the signal, analyze the current interaction status in real time, identify bottlenecks, and provide a basis for subsequent optimization; key performance indicators include signal strength, transmission speed, and data latency;
[0056] For example, the signal strength can be recorded through the Web NFC API periodic timer, and the function can be called to start periodic recording, and its average, peak and minimum values can be calculated to evaluate the signal quality. Signal strength below the threshold indicates that there may be bottlenecks such as physical obstacles or long distances.
[0057] (2) Signal optimization: Use digital signal processing technology to enhance and adjust the received NFC signal; adaptively adjust the signal modulation scheme based on real-time channel conditions;
[0058] A predefined set of signal modulation schemes monitors real-time channel conditions, such as signal strength, noise level, and transmission rate, and selects the scheme that best suits the current channel conditions at runtime. This can be achieved by comparing the degree of match between the current channel conditions and each modulation scheme. Once the best modulation scheme is selected, it can be applied to NFC communication to achieve the best data transmission performance.
[0059] (3) Web NFC API interface optimization: In the Web NFC API, data buffer management is used to achieve fast data reading and transmission, effectively reducing transmission delays; a parallel data processing mechanism is introduced, and Web Workers technology is used to process NFC data in parallel in background threads to avoid blocking the main thread, greatly improving data interaction efficiency;
[0060] Data buffering and parallel processing flow such as Figure 3 As shown:
[0061] Start the parallel processing task pool, set the number of parallel tasks and management strategy;
[0062] Check the data buffer for available data and wait or poll until data is available;
[0063] Parallel task allocation, allocating data to idle parallel processing tasks;
[0064] Parallel data processing, using multi-threaded processing technology to improve processing efficiency;
[0065] Monitor the status of parallel tasks and wait for all tasks to complete processing;
[0066] Collect and integrate the results of all processing tasks to form a complete processing result set.
[0067] in:
[0068] 1. Continuously monitor the usage and performance indicators of data cache, such as buffer utilization, data reading latency, etc. According to the monitoring results, timely adjust the data management strategy and buffer size to maintain the best data interaction efficiency.
[0069] When initializing the buffer, the system does not set a fixed-size buffer, but dynamically adjusts the size of the buffer based on current data interaction requirements and system resource conditions.
[0070] LRU (Least Recently Used) strategy: This strategy manages the buffer based on the access frequency of data. The least used data will be cleared first to free up space in the buffer.
[0071] FIFO (First In First Out) strategy: This strategy manages data in the order in which it enters the buffer. When the buffer needs to be cleaned, the data that enters first will be cleaned first.
[0072] By real-time monitoring of data interaction detection, when it is detected that the buffer is about to be full, the capacity of the buffer can be increased; when the buffer is in a low-load state for a long time, the buffer can be appropriately reduced to release resources.
[0073] 2. Use Web Workers technology to implement parallel data processing in background threads. This can avoid blocking caused by data processing in the main thread, thereby improving data interaction efficiency. Assign data processing tasks to multiple background threads and use parallel computing capabilities to speed up the data processing process.
[0074] In order to optimize parallel task processing, an intelligent task allocation strategy is adopted to ensure efficient data interaction and system performance. The intelligent task allocation strategy includes:
[0075] a1. Tasks involving real-time user interaction will be given priority.
[0076] a2. The task of reading data from NFC tags requires high real-time performance.
[0077] a3. Monitor system usage (CPU, memory, bandwidth, etc.) and dynamically adjust task allocation to avoid overload.
[0078] Dynamic task allocation method:
[0079] b1. Dynamically schedule tasks based on their deadlines and priorities to ensure that high-priority and urgent tasks are processed in a timely manner.
[0080] b2. Queue task order, give priority to high priority tasks.
[0081] b3. Split complex tasks into multiple subtasks and assign them to different processing units for parallel processing.
[0082] b4. For small tasks, merge them into a batch task to improve processing efficiency.
[0083] (4) Data compression and decompression: The data sending end uses the data compression algorithm DEFLATE or Brotli to compress the data to reduce the amount of data while ensuring data integrity. The data receiving end uses a decompression algorithm to increase the decompression speed and ensure rapid recovery of the original data.
[0084] (5) Intelligent data caching strategy: Implement local data storage strategy to cache frequently used data on the client, reducing data requests to the server; through data pre-fetching and pre-loading mechanism, the data that may be needed is acquired and stored in advance, and the present invention effectively reduces data transmission delay. This means that when users interact with data, data can be transferred from NFC tags to devices more quickly, improving data access speed and interactive response, thereby significantly improving user experience.
[0085] Data pre-fetching and pre-loading: Choose the appropriate data storage method, such as memory storage (cache), disk storage, database storage, etc. Choose the appropriate data pre-loading strategy according to the size and frequency of data use. Load data when needed, and use data caching, data partitioning, and data replication to accelerate data access.
[0086] (6) Dynamic policy adjustment: Continuously monitor the performance indicators of the Web NFC API, such as response time, transmission rate, loss rate, stability, etc., to understand the status of data interaction in real time, and automatically or manually adjust data interaction policies and parameters in real time to adapt to different environments and conditions, ensuring that data exchange is always maintained in the best state, thereby ensuring the efficiency and stability of NFC data exchange.
[0087] Parameters include: data transmission speed, response time, loss rate, etc.;
[0088] Data exchange strategies include high transmission speed and response time:
[0089] If you prioritize transfer speed, you can choose a higher transfer speed parameter. This is usually suitable for quickly reading or writing large amounts of data with low latency (response time);
[0090] If response time is a priority, you can choose lower transmission speed and stability parameters. In this case, the transmission speed may be slightly slower, but the real-time and reliability of data transmission can be ensured. This is suitable for scenarios with high requirements for real-time data transmission, such as when data needs to be updated in a timely manner or in response to user operations.
[0091] (7) Secure data transmission and data writing to NFC tags: Encrypted transmission, such as AES or RSA, is used to encrypt the transmitted data, which ensures that even if the data is intercepted during the data transmission process, it cannot be interpreted or tampered with. In addition, a strict authentication mechanism is implemented to ensure that only authorized users can exchange data, greatly reducing the risk of illegal access and data tampering. After the data processing is completed, the processing results are securely written to the NFC tag, achieving reliable data storage and exchange;
[0092] Step S300: After the data interaction is completed, the connection with the NFC tag is disconnected.
[0093] The comparison between the present invention and the prior art is as follows: Figure 4 As shown, it can be seen that the present invention can achieve richer functions, more efficient data exchange and higher data security.
[0094] Embodiment 2:
[0095] Combination Figure 5As shown, a data interaction and performance optimization system based on Web NFC includes:
[0096] NFC reader initialization module, used to initialize the NFC reader using the Web NFC API;
[0097] NFC tag detection module, used to start the NFC detection mechanism, identify and locate all nearby NFC tags, and establish data connection with NFC tags;
[0098] Performance monitoring and optimization module, used to record signal strength through the Web NFC API periodic timer and call the function to start periodic recording;
[0099] Data interaction analysis module, used to calculate the average, peak and minimum values of the signal, evaluate the signal strength, transmission speed and data delay of the signal, and identify bottlenecks based on signals below the threshold;
[0100] Signal optimization module, which uses digital signal processing technology to enhance and adjust the received NFC signal; adaptively adjust the signal modulation scheme according to real-time channel conditions;
[0101] API interface optimization module, which is used to use data buffer management in Web NFC API to achieve fast data reading and transmission; introduce parallel data processing mechanism and use Web Workers technology to process NFC data in parallel in background threads;
[0102] The data compression and decompression module is used to compress the data using the data compression algorithm DEFLATE or Brotli before sending the data, and to restore the original data using the decompression algorithm when receiving the data;
[0103] The secure data interaction module is used to encrypt the data in transmission using encryption algorithms, and at the same time adopt an authentication mechanism to allow only authorized users to exchange data, thereby enhancing the security of interaction;
[0104] Intelligent data caching module is used to cache frequently used data to the client, reducing data requests to the server; through data pre-fetching and pre-loading mechanisms, it can obtain and store the data that may be needed in advance, improving data access speed and interactive response;
[0105] The dynamic policy adjustment module is used to continuously monitor the performance indicators of the Web NFC API and adjust the data interaction policies and parameters in real time based on the monitoring results to achieve adaptive optimization.
[0106] Although the present invention is described herein with reference to the illustrative embodiments of the present invention, the above embodiments are only preferred embodiments of the present invention, and the embodiments of the present invention are not limited to the above embodiments. It should be understood that those skilled in the art can design many other modifications and embodiments, which will fall within the scope and spirit of the principles disclosed in this application.
Claims
1. A data interaction and performance optimization method based on Web NFC, It is characterized in that include: Step S100: Initialize the NFC reader using the Web NFC API; Step S200: Start the NFC detection mechanism, identify and locate all nearby NFC tags, establish a data connection with the detected NFC tags, and perform one or more of the following during the data interaction process: (1) Data interaction analysis; (2) Signal optimization; (3) Web NFC API interface optimization; (4) Data compression and decompression; (5) Intelligent data caching strategy; (6) Dynamic strategy adjustment; (7) Secure data transmission and data writing to NFC tags; Step S300: After the data interaction is completed, the connection with the NFC tag is disconnected.
2. The method for data interaction and performance optimization based on Web NFC according to claim 1, It is characterized in that The data interaction analysis is to monitor and analyze the data during the NFC interaction process, evaluate the key performance indicators of the signal, analyze the current interaction status in real time, and identify bottlenecks; the key performance indicators include signal strength, transmission speed and data delay.
3. The method for data interaction and performance optimization based on Web NFC according to claim 1, It is characterized in that The signal optimization includes: using digital signal processing technology to enhance and adjust the received NFC signal; and adaptively adjusting the signal modulation scheme according to real-time channel conditions.
4. The method for data interaction and performance optimization based on Web NFC according to claim 1, It is characterized in that The Web NFC API interface is optimized as follows: in the Web NFC API, data buffer management is used to achieve fast data reading and transmission; a parallel data processing mechanism is introduced, and the Web Workers technology is used to process NFC data in parallel in the background thread.
5. The method for data interaction and performance optimization based on Web NFC according to claim 4, It is characterized in that The data buffer management includes a least recently used (LRU) strategy and a first-in-first-out (FIFO) strategy.
6. The method for data interaction and performance optimization based on Web NFC according to claim 1, It is characterized in that The data compression and decompression are as follows: the data sending end uses the data compression algorithm DEFLATE or Brotli to compress the data, and the data receiving end uses the decompression algorithm to restore the original data.
7. The method for data interaction and performance optimization based on Web NFC according to claim 1, It is characterized in that The intelligent data caching strategy is: caching frequently used data on the client to reduce data requests to the server; obtaining and storing the data that may be needed in advance through the data pre-fetching and pre-loading mechanism to improve data access speed and interactive response.
8. The method for data interaction and performance optimization based on Web NFC according to claim 1, It is characterized in that The dynamic strategy adjustment is: continuously monitoring the performance indicators of the Web NFC API, and adjusting the data interaction strategy and parameters in real time according to the monitoring results to achieve adaptive optimization.
9. The method for data interaction and performance optimization based on Web NFC according to claim 1, It is characterized in that The secure data transmission and data writing into the NFC tag are as follows: using encryption transmission and authentication mechanism to ensure the security of data during transmission, and after completing data processing, securely writing the processing result into the NFC tag, thereby realizing reliable data storage and exchange.
10. A data interaction and performance optimization system based on Web NFC, It is characterized in that include: NFC reader initialization module, used to initialize the NFC reader using the Web NFC API; NFC tag detection module, used to start the NFC detection mechanism, identify and locate all nearby NFC tags, and establish data connection with NFC tags; Performance monitoring and optimization module, used to record signal strength through the Web NFC API periodic timer and call the function to start periodic recording; Data interaction analysis module, used to calculate the average, peak and minimum values of the signal, evaluate the signal strength, transmission speed and data delay of the signal, and identify bottlenecks based on signals below the threshold; Signal optimization module, which uses digital signal processing technology to enhance and adjust the received NFC signal; adaptively adjust the signal modulation scheme according to real-time channel conditions; API interface optimization module, which is used to use data buffer management in Web NFC API to achieve fast data reading and transmission; introduce parallel data processing mechanism and use Web Workers technology to process NFC data in parallel in background threads; The data compression and decompression module is used to compress the data using the data compression algorithm DEFLATE or Brotli before sending the data, and to restore the original data using the decompression algorithm when receiving the data; The secure data interaction module is used to encrypt the data in transmission using encryption algorithms, and at the same time adopt an authentication mechanism to allow only authorized users to exchange data, thereby enhancing the security of interaction; Intelligent data caching module is used to cache frequently used data to the client, reducing data requests to the server; through data pre-fetching and pre-loading mechanisms, it can obtain and store the data that may be needed in advance, improving data access speed and interactive response; The dynamic policy adjustment module is used to continuously monitor the performance indicators of the Web NFC API and adjust the data interaction policies and parameters in real time based on the monitoring results to achieve adaptive optimization.
Citation Information
Cited By
Cross-platform NFC data interaction method, device, electronic equipment and system
CN120980491A
