Brain-computer interface data processing method and system based on Web Bluetooth and medium
By using Web Bluetooth technology to establish connections with brain-computer interface hardware devices on the web page, obtaining and processing data, and visually displaying it on the web page, the problem that the existing technology cannot realize the direct connection and application of brain-computer interface devices on the web side is solved, and cross-platform compatibility and user experience are improved.
Patent Information
- Application Number
- CN202510155091.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-12
- Publication Date
- 2025-06-13
AI Technical Summary
The existing technology cannot realize that the brain-computer interface device directly establishes connections and applies them through the browser on the web end or H5 page, which limits the application and promotion of brain-computer interface technology.
By establishing a connection with the brain-computer interface hardware device on the web page, using Web Bluetooth technology to enable asynchronous services, obtaining services, features and descriptors supported by the device, obtaining and processing data received by the device, and visually displaying the processed data on the web page.
It realizes cross-platform compatibility, reduces development costs and maintenance difficulties, simplifies user operation steps, improves user experience, and expands the application scope and promotion potential of brain-computer interface technology.
Smart Images

Figure CN120144333A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of brain-computer interfaces, and particularly to a method, system and medium for processing brain-computer interface data based on Web Bluetooth. Background Art
[0002] In terms of data transmission and processing, traditional brain-computer interface devices mainly rely on wired or wireless methods to connect to specific software programs (such as APPs, computer applications, etc.) on mobile devices (such as smartphones, tablets) or personal computers. Although this traditional connection method meets the basic requirements of data transmission, it has certain limitations.
[0003] Firstly, from the perspective of development cost, the traditional connection method requires developing corresponding application programs for different operating systems (such as iOS, Android, Windows, etc.), which undoubtedly increases the development cost and time investment. In addition, with the frequent update of operating system versions, the application programs also need to be continuously adapted and optimized, further increasing the difficulty of development and maintenance.
[0004] Secondly, there are also deficiencies in user experience. Users need to download and install specific application programs to connect to the brain-computer interface device and transmit data, which not only increases the user's operation steps but also may lead to poor user experience due to compatibility issues of the application programs.
[0005] More critically, although Web Bluetooth technology has advantages such as no need to install additional software and good cross-platform compatibility, the existing technology still cannot enable the brain-computer interface device to directly establish a connection and be applied on the Web side or H5 page through a browser. This limits the application and promotion of brain-computer interface technology in a wider range of scenarios. Summary of the Invention
[0006] The main purpose of the present invention is to provide a method, system and medium for processing brain-computer interface data based on Web Bluetooth, aiming to solve the technical problem that the existing technology still cannot enable the brain-computer interface device to directly establish a connection and be applied on the Web side or H5 page through a browser.
[0007] To achieve the above object, the present invention provides a method for processing brain-computer interface data based on Web Bluetooth, which includes the following steps:
[0008] S100. Establish a connection with the brain-computer interface hardware device on the web page, and the brain-computer interface hardware device is built-in with a Bluetooth module;
[0009] S200. Start an asynchronous service based on the connected brain-computer interface hardware device, and obtain the services, features, and descriptors it supports. The features and descriptors define the communication methods and parameter settings between brain-computer interface hardware devices.
[0010] S300. Obtain the data received by the brain-computer interface hardware device and perform data processing.
[0011] S400. Add timestamp information to the processed data according to the data characteristics.
[0012] S500. Visualize the processed data on a web page according to the timestamp information.
[0013] Optionally, in S100, determine the connection method with the brain-computer interface hardware device by judging whether the brain-computer interface hardware device has been paired.
[0014] If it is a paired brain-computer interface hardware device, establish a connection with the brain-computer interface hardware device on the web page based on the Gatt connection of Web Bluetooth; if it is an unpaired brain-computer interface hardware device, connect the device by screening the specified UUID and record the device connection status.
[0015] Optionally, S200 at least includes the following steps:
[0016] S210. Start an asynchronous service based on the connected brain-computer interface hardware device to obtain the list of main services supported by the brain-computer interface hardware device.
[0017] S220. Under the main service list, access the features and related descriptors.
[0018] S230. Read the data under the corresponding feature array according to the features. The data includes the number of electroencephalogram data channels supported by the brain-computer interface hardware device and the enabling status of multi-dimensional sensors.
[0019] S240. Determine the data frequency of each type of sensor data packet according to the enabling status of the multi-dimensional sensors.
[0020] S250. Negotiate and confirm the connection type supported by the brain-computer interface hardware device through control signaling, and determine the data content, format, and security requirements to be transmitted according to the negotiation result between brain-computer interface hardware devices and the user's configuration selection.
[0021] Optionally, S300 at least includes the following steps:
[0022] S310. Obtain the data received by the brain-computer interface hardware device.
[0023] S320. Encrypt the data in S310 according to the required data content, format, and security requirements, and determine the encoding format of the data packet;
[0024] S330. Package the data after encryption and encoding into a data packet with the specified encoding format.
[0025] Optionally, S400 includes at least the following steps:
[0026] S410. Based on a preset negotiation of the sampling rate for different data patterns or using a preset sampling rate, calculate the time increment;
[0027] S420. Determine whether the processed data is the first time it is read; if it is the first time it is read, record the sequence number of the currently read data as the current sequence number, and use the current sequence number as an anchor point to sort the sequence numbers of the subsequently read data, and generate corresponding timestamp values based on these sorted data;
[0028] If it is not the first time it is read, and the sequence number of the currently read data is less than or equal to the current sequence number, calculate the corresponding first timestamp value according to the first preset formula and the time increment;
[0029] If it is not the first time it is read, and the sequence number of the currently read data is greater than the current sequence number, calculate the corresponding second timestamp value according to the second preset formula and the time increment.
[0030] Optionally, the first preset formula is specifically as follows:
[0031] TS 1 = T now -(EID now - eventID)*Δt; where, TS 1 is the first timestamp value, T now is the time point corresponding to the anchor point, EID now is the current sequence number, eventID is the sequence number of the currently read data, and Δt is the time increment;
[0032] The second preset formula is specifically as follows:
[0033] TS 2 = T now +(EID now - eventID)*Δt; where, TS 2 is the second timestamp value.
[0034] Optionally, S500 includes at least the following steps:
[0035] S510. Convert the processed data into an asynchronous data stream;
[0036] S520. Perform sequential processing on the data stream to analyze time-frequency domain data;
[0037] S530. Subscribe to the asynchronous data stream to update the visualization data in real time;
[0038] S540. Sort the processed data according to the timestamp information and perform visual display on the web page.
[0039] Optionally, S520 at least includes the following steps:
[0040] S521. Call the sequential processing function to read data from the asynchronous data stream;
[0041] S522. Perform a map operation on the input data;
[0042] S523. Asynchronously and reactively implement the fast Fourier transform logic to convert the time-domain signal into a frequency-domain signal and calculate the frequency-domain data;
[0043] S524. Map the calculation result of S523 into the power spectral density array to generate power spectral density data and output it asynchronously.
[0044] Corresponding to the above-mentioned Web Bluetooth brain-computer interface data processing method, the present invention provides a Web Bluetooth brain-computer interface data processing system, which includes:
[0045] A connection module, configured to establish a connection with the brain-computer interface hardware device on the web page, and the brain-computer interface hardware device is built-in with a Bluetooth module;
[0046] A data acquisition module, configured to start an asynchronous service based on the connected brain-computer interface hardware device, and acquire the services, characteristics, and descriptors supported by it, where the characteristics and descriptors define the communication method and parameter settings between the brain-computer interface hardware devices;
[0047] A data processing module, configured to acquire the data received by the brain-computer interface hardware device and perform data processing;
[0048] A timestamp adding module, configured to add timestamp information to the processed data according to the data characteristics;
[0049] A visualization module, configured to visually display the processed data on the web page according to the timestamp information.
[0050] In addition, to achieve the above object, the present invention also provides a computer-readable storage medium, on which a Web Bluetooth brain-computer interface data processing program is stored. When the Web Bluetooth brain-computer interface data processing program is executed by a processor, the steps of the Web Bluetooth brain-computer interface data processing method described above are implemented.
[0051] The beneficial effects of the present invention are as follows:
[0052] (1) Compared with the prior art, the present invention avoids the need to develop specific application programs for different operating systems by establishing a direct connection with the brain-computer interface hardware device on the web page, significantly reducing the development cost and maintenance difficulty. In addition, users do not need to download and install additional application programs, simplifying the operation steps and enhancing the user experience. Using the Web Bluetooth technology, this solution achieves cross-platform compatibility, allowing users to directly establish a connection with the brain-computer interface device and perform data processing through a browser on the web side or an H5 page, thus expanding the application scope and promotion potential of the brain-computer interface technology.
[0053] (2) Compared with the prior art, the present invention optimizes the connection establishment process between the web page and the brain-computer interface hardware device by determining whether the device is already paired. For paired devices, the Gatt connection of Web Bluetooth can be directly used, simplifying the connection process. For unpaired devices, the connection is made by screening the specified UUID and recording the device connection status, improving the flexibility and reliability of the connection.
[0054] (3) Compared with the prior art, the present invention obtains the services, characteristics, and descriptors supported by the brain-computer interface hardware device through an asynchronous service, and reads data and determines the data frequency based on this information, improving the accuracy and efficiency of data acquisition and providing a solid foundation for subsequent data processing and visualization.
[0055] (4) Compared with the prior art, the present invention enhances the security and consistency of data transmission through encryption processing and coding processing, encapsulates the data into data packets in a specified coding format, ensuring the integrity and correctness of the data, and providing guarantee for further data processing and analysis.
[0056] (5) Compared with the prior art, the present invention provides a time synchronization function for the data after data processing by adding timestamp information. This not only helps data analysis but also provides an accurate time reference in visual display, enhancing the readability and practicality of the data.
[0057] (6) Compared with the prior art, the present invention realizes the dynamic analysis and display of data by converting the processed data into an asynchronous data stream and performing sequence processing and real-time update; improves the real-time performance of data processing and the interactivity of visualization, and enhances the user experience.
[0058] (7) Compared with the prior art, the present invention realizes in-depth analysis of the data stream by calling sequence processing functions and fast Fourier transform logic, can extract the time-frequency domain characteristics of the data, and provides more possibilities for further analysis and application of the data. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] The drawings described herein are used to provide a further understanding of the present invention, and constitute a part of the present invention. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0060] Figure 1 is a flowchart of an embodiment of the method for processing Web Bluetooth brain-computer interface data according to the present invention;
[0061] Figure 2 is a framework diagram of an embodiment of the system for processing Web Bluetooth brain-computer interface data according to the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0062] To make the objectives, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the protection scope of the present invention.
[0063] As Figure 1 shown, a method for processing Web Bluetooth brain-computer interface data according to the present invention includes the following steps:
[0064] S100. Establish a connection with the brain-computer interface hardware device on the web page. The brain-computer interface hardware device is built-in with a Bluetooth module;
[0065] S200. Based on the connected brain-computer interface hardware device, start an asynchronous service, and obtain the services, characteristics and descriptors supported by it. The characteristics and descriptors define the communication method and parameter settings between the brain-computer interface hardware devices;
[0066] S300. Obtain the data received by the brain-computer interface hardware device and perform data processing;
[0067] S400. Add timestamp information to the processed data according to the data characteristics;
[0068] S500. Visualize the processed data on the web page according to the timestamp information.
[0069] In the present invention, by establishing a direct connection with the brain-computer interface hardware device on the web page, the need to develop specific application programs for different operating systems is avoided, significantly reducing the development cost and maintenance difficulty; in addition, users do not need to download and install additional application programs, simplifying the operation steps and improving the user experience; using Web Bluetooth technology, this solution achieves cross-platform compatibility, allowing users to directly establish a connection with the brain-computer interface device through a browser on the web side or H5 page and perform data processing, thus expanding the application scope and promotion potential of the brain-computer interface technology.
[0070] In this embodiment, in S100, by judging whether the brain-computer interface hardware device has been paired, the connection method with the brain-computer interface hardware device is determined;
[0071] If it is a paired brain-computer interface hardware device, a connection with the brain-computer interface hardware device is established on the web page based on the Gatt connection of Web Bluetooth; if it is an unpaired brain-computer interface hardware device, a connection is made by screening the specified UUID, and the connection status of the brain-computer interface hardware device is recorded.
[0072] Specifically, if it is an unpaired brain-computer interface hardware device, the specified UUID is screened through an option object to notify the corresponding functional element on the page to connect to the specific device.
[0073] In the present invention, by judging whether the device is paired, the process of establishing a connection between the web page and the brain-computer interface hardware device is optimized; for paired devices, the Gatt connection of Web Bluetooth can be directly used, simplifying the connection process; for unpaired devices, a connection is made by screening the specified UUID and the device connection status is recorded, improving the flexibility and reliability of the connection.
[0074] In this embodiment, S200 at least includes the following steps:
[0075] S210. Start an asynchronous service based on the connected brain-computer interface hardware device to obtain the main service list supported by the brain-computer interface hardware device;
[0076] S220. Under the main service, access characteristics and related descriptors;
[0077] S230. Read the data under the corresponding feature array C(i)[j] according to characteristic i, where the data includes the number of EEG data channels supported by the brain-computer interface hardware device and the enabling status of multi-dimensional sensors;
[0078] S240. Determine the data frequency of each type of sensor data packet according to the enabling status of multi-dimensional sensors;
[0079] S250. Negotiate and confirm the connection type supported by the brain-computer interface hardware device through control signaling, and determine the data content, format, and security requirements to be transmitted according to the negotiation result between brain-computer interface hardware devices and the user's configuration selection.
[0080] Preferably, the maximum value of i is 512 bytes, and the data is for j = 1, 2, 3...
[0081] The present invention obtains the services, characteristics, and descriptors supported by the brain-computer interface hardware device through an asynchronous service, reads data and determines the data frequency based on this information, improves the accuracy and efficiency of data acquisition, and provides a solid foundation for subsequent data processing and visualization.
[0082] In this embodiment, S300 includes at least the following steps:
[0083] S310. Obtain the data received by the brain-computer interface hardware device;
[0084] S320. Encrypt the data of S310 according to the data content, format, and security requirements to be transmitted, and determine the encoding format of the data packet;
[0085] S330. Package the data that has undergone encryption processing and encoding processing into data packets of a specified encoding format.
[0086] Preferably, the encrypted data packet can be parsed through the process of public-private key pairing. Available methods include AES encryption and decryption and data integrity verification, such as the HMAC authentication mechanism or the GCM authentication mechanism.
[0087] S320 includes at least the following steps:
[0088] S321. After mapping the features and descriptors of the data packet based on the received data packet and data packet features in S310, obtain the original data and decode and analyze it according to different sensor data features; the sensor features include at least one or more of EEG (electroencephalogram), PPG (photoplethysmogram), Gyro (gyroscope), and accelerometer.
[0089] S322. Traverse the series of data under each sensor feature, and according to the number of channels K i Traverse the series of data under the i-th feature.
[0090] S323. Before the clock deadline, if there is sufficient data, fill the valid data structure for the data of each channel.
[0091] S324. Encrypt the data in S310 and determine the encoding format of the data packet.
[0092] In this embodiment, the specific filling content of S323 is the channel index (used to identify the channel where the data comes from), the event index (used to identify a specific event in the data), the data (data represented by L i Unit: bit), and the timestamp (records the time when the data is generated or captured). The channels include at least one of the EEG electrode channel, the PPG ambient light signal channel, the near-infrared channel, and the red light channel. Among them, the channel index is k i ∈K i , the event index is the first A ki characters in the data, and the data acquisition method is as follows:
[0093] Starting from the (A + 1)-th byte, perform a specific bit shift and merge on the consecutive m-byte data data m to obtain the data of the k i channel of the i-th type of sensor. The specific implementation example of the unique operation is as follows:
[0094] 1) If L i is an integer multiple of 8, taking the sequential 24-bit PPG data as an example, then Perform zero-padding displacement according to the data packet bit system , and the efficiency of the displacement merge operation is the highest;
[0095] 2) If L i is not an integer multiple of 8 and L i < 8, then the data is data 1 >> B, where B is the decoding parameter obtained by presetting or the control surface;
[0096] 3) If L i is not an integer multiple of 8 and L i > 8, Li mod 8 = a, obtaining the remainder a, with L i construct a data array of length m + 1 with length L. For the first m bits, perform data 1 << a + 8(m - 1) | data 2 << a + 8(m - 2) |... data m << a | data m+1 >> 8m and fill with 0 for the shift operation to obtain data, and the data utilization rate can be improved by taking each as a group. Among them, gcd(L i , 8) is the greatest common divisor of L i , 8.
[0097] Before the above data is merged and shifted or after encoding and decoding, it can be decoded according to the configuration obtained from the preset or control plane. The relevant decoding functions may include Huffman coding, RLC (run - length coding), LZW coding, etc.
[0098] Through encryption processing and coding processing, the present invention enhances the security and consistency of data transmission. Encapsulating data into data packets in a specified coding format ensures the integrity and correctness of the data, providing a guarantee for further processing and analysis of the data.
[0099] In this embodiment, S400 at least includes the following steps:
[0100] S410. Based on different preset data patterns, negotiate the sampling rate or use the preset sampling rate to calculate the time increment;
[0101] S420. Determine whether the processed data is the data read for the first time; if it is the data read for the first time, record the sequence number of the currently read data as the current sequence number, and use the current sequence number as an anchor point to sort the sequence numbers of the subsequently read data, and generate corresponding timestamp values based on these sorted data;
[0102] If it is not the data read for the first time, and the sequence number of the currently read data is less than or equal to the current sequence number, calculate the corresponding first timestamp value according to the first preset formula and the time increment;
[0103] If it is not the data read for the first time, and the sequence number of the currently read data is greater than the current sequence number, calculate the corresponding second timestamp value according to the second preset formula and the time increment.
[0104] The present invention provides a time synchronization function for the processed data by adding timestamp information. This not only facilitates data analysis but also provides an accurate time reference in visual display, enhancing the readability and usability of the data.
[0105] In this embodiment, the first preset formula is specifically as follows:
[0106] TS 1 = T mow - (EID now - eventID) * Δt; where TS 1 is the first timestamp value, T now is the time point corresponding to the anchor point, EID now is the current sequence number, eventID is the sequence number of the currently read data, and Δt is the time increment;
[0107] The second preset formula is specifically as follows:
[0108] TS 2 = T now + (EID now - eventID) * Δt; where TS 2 is the second timestamp value.
[0109] Preferably, the calculation formula for the time increment is specifically as follows:
[0110] where frameRate is the frame rate in unit time, preset to 1000, is the amount of data in a single written data packet of the hardware - side sensor of type type.
[0111] In this embodiment, S500 at least includes the following steps:
[0112] S510. Convert the processed data into an asynchronous data stream;
[0113] S520. Perform sequence processing on the data stream to analyze time - frequency domain data;
[0114] S530. Subscribe to the asynchronous data stream to update the visual data in real - time;
[0115] S540. Sort the processed data according to the timestamp information and perform visual display on the web page.
[0116] The present invention realizes the dynamic analysis and display of data by converting the processed data into an asynchronous data stream, performing sequence processing and real - time update; improves the real - time performance of data processing and the interactivity of visualization, and enhances the user experience.
[0117] In this embodiment, S520 at least includes the following steps:
[0118] S521. Call the sequence processing function to read data from the asynchronous data stream;
[0119] S522. Perform a map operation on the input data;
[0120] S523. Asynchronously and reactively implement the fast Fourier transform logic to convert the time-domain signal into a frequency-domain signal and calculate the frequency-domain data;
[0121] S524. Map the calculation result of S523 into the power spectral density array to generate power spectral density data and output it asynchronously.
[0122] Through calling the sequence processing function and the fast Fourier transform logic, the present invention realizes in-depth analysis of the data stream, can extract the time-frequency domain features of the data, and provides more possibilities for further analysis and application of the data.
[0123] As Figure 2 shown, the present invention also correspondingly provides a Web Bluetooth brain-computer interface data processing system, which includes:
[0124] A connection module 10, configured to establish a connection with the brain-computer interface hardware device at the web page end, and the brain-computer interface hardware device is built-in with a Bluetooth module;
[0125] A data acquisition module 20, configured to enable an asynchronous service based on the connected brain-computer interface hardware device, and acquire the services, characteristics, and descriptors supported by it, and the characteristics and descriptors define the communication method and parameter settings between the brain-computer interface hardware devices;
[0126] A data processing module 30, configured to acquire the data received by the brain-computer interface hardware device and perform data processing;
[0127] A timestamp adding module 40, configured to add timestamp information to the processed data according to the data characteristics;
[0128] A visualization module 50, configured to visually display the processed data on the web page according to the timestamp information.
[0129] In this embodiment, the connection module 10 is specifically a wb-based connection module 10; the data processing module 30 is supported by a typescript and javascript module.
[0130] Preferably, the connection includes a preset mode configuration (preset) negotiation function, which allows the user to read the preset name and type of the device through Bluetooth connection and select the preset configuration mode of the device to read and configure the sensor operation mode of the device, such as the sampling rate, whether to enable, etc.
[0131] In this embodiment, an example of implementing the logic of the fast Fourier transform using JavaScript is as follows:
[0132] 1) Define variables and parameters
[0133] this.BufferSize: The buffer size of the FFT, which is used to store a certain number of digital signal time series samples. The buffer size determines the amount of data that can be processed.
[0134] this.SampleRate: The sampling rate of the digital signal time series samples, that is, the number of samples collected per second. The sampling rate is an important parameter in signal processing, and it affects the frequency resolution of the signal.
[0135] this.bandwidth: Calculate the bandwidth width of each FFT band. The bandwidth is calculated based on the sampling rate, buffer size, and Nyquist theorem, that is: Bandwidth = bufferSize / sampleRate; the bandwidth determines the width of each band in the spectrum analysis.
[0136] this.spectrum: A Float64Array array used to store the amplitude (or power) of each band; the amplitude can represent the energy of the signal at a specific frequency.
[0137] this.real and this.imag: Two Float64Array arrays that store the real and imaginary parts of the FFT results respectively. The FFT converts the time-domain signal into a frequency-domain signal, and the result usually contains real and imaginary parts.
[0138] this.peakBand and this.peak: Used to store the band index and the maximum amplitude value where the maximum amplitude (peak) is located; these values are used to identify the most significant frequency components in the signal.
[0139] 2) Calculate the spectrum
[0140] Calculate the center frequency of the FFT band through this.bandwidth * index + this.bandwidth / 2 to determine the center position of each band.
[0141] Through the formula Calculate the amplitude of the current band, which is half of the product of the sum of the squares of the real and imaginary parts and the bandwidth width.
[0142] Store the calculated amplitude into the this.spectrum array.
[0143] If the calculated amplitude is greater than the current peak, update the peak frequency band index (peakBand) and the peak amplitude (peak), and store the calculated amplitude in the spectrum array.
[0144] Embodiments of the present invention also provide a computer-readable storage medium, which may be the computer-readable storage medium included in the memory in the above embodiments; or it may exist alone and be a computer-readable storage medium not assembled into the device. At least one instruction is stored in the computer-readable storage medium, and the instruction is loaded and executed by the processor to implement Figure 1 the Web Bluetooth brain-computer interface data processing method shown. The computer-readable storage medium may be a read-only memory, a disk, an optical disc, etc.
[0145] It should be noted that the embodiments in this specification are all described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same and similar parts among the embodiments, reference can be made to each other. For the system embodiments and the medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiments.
[0146] Moreover, in this article, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed, or further includes elements inherent to such process, method, article or device. Without more limitations, an element defined by the statement "including one..." does not exclude the existence of another identical element in the process, method, article or device including the element.
[0147] The above description shows and describes the preferred embodiments of the present invention. It should be understood that the present invention is not limited to the form disclosed herein, should not be regarded as excluding other embodiments, but can be used in various other combinations, modifications and environments, and can be changed within the scope of the inventive concept herein through the above teachings or the technology or knowledge in related fields. And the changes and variations made by those skilled in the art without departing from the spirit and scope of the present invention should all be within the protection scope of the appended claims of the present invention.
Claims
1. A method for processing brain-computer interface data based on Web Bluetooth, characterized in that: The following steps are involved: S100, establishing a connection with a brain-computer interface hardware device on the web page, where the brain-computer interface hardware device has a built-in Bluetooth module; S200, starting an asynchronous service based on the connected brain-computer interface hardware device, and obtaining the services, characteristics and descriptors supported by the device, wherein the characteristics and descriptors define the communication mode and parameter settings between the brain-computer interface hardware devices; S300, obtaining data received by the brain-computer interface hardware device and performing data processing; S400, adding timestamp information to the processed data according to data characteristics; S500: Visually display the processed data on a web page according to the timestamp information.
2. The method for processing brain-computer interface data based on Web Bluetooth according to claim 1, characterized in that: In S100, it is determined whether the brain-computer interface hardware device has been paired to determine the connection method with the brain-computer interface hardware device; If it is a paired brain-computer interface hardware device, a connection with the brain-computer interface hardware device is established on the web page based on the Gatt connection of Web Bluetooth; if it is not a paired brain-computer interface hardware device, the device connection is performed by filtering the specified UUID and recording the device connection status.
3. The method for processing brain-computer interface data based on Web Bluetooth according to claim 1, characterized in that: S200 at least includes the following steps: S210, starting an asynchronous service based on the connected brain-computer interface hardware device to obtain a list of main services supported by the brain-computer interface hardware device; S220, under the main service list, access characteristics and related descriptors; S230, reading data under the corresponding feature array according to the characteristics, wherein the data includes the number of EEG data channels supported by the brain-computer interface hardware device and the activation status of the multi-dimensional sensor; S240, determining the data frequency of each type of sensor data packet according to the activation status of the multi-dimensional sensor; S250. Confirm the connection type supported by the brain-computer interface hardware device through control signaling negotiation, and determine the content, format and security requirements of the data to be transmitted based on the negotiation results between the brain-computer interface hardware devices and the user's configuration selection.
4. The method for processing brain-computer interface data based on Web Bluetooth according to claim 3, characterized in that: S300 at least includes the following steps: S310, obtaining data received by the brain-computer interface hardware device; S320, encrypting the data in S310 according to the content, format and security requirements of the data to be transmitted, and determining the encoding format of the data packet; S330, encapsulating the encrypted and encoded data into a data packet in a specified encoding format.
5. The method for processing brain-computer interface data based on Web Bluetooth according to claim 1, characterized in that: S400 at least includes the following steps: S410, calculating the time increment by negotiating a sampling rate based on different preset data modes or adopting a preset sampling rate; S420, determining whether the processed data is data read in for the first time; if it is data read in for the first time, recording the sequence number of the currently read data as the current sequence number, and using the current sequence number as an anchor point to sort the sequence numbers of the subsequently read data, and generating corresponding timestamp values based on these sorted data; If it is not the first time to read the data, and the sequence number of the currently read data is less than or equal to the current sequence number, the corresponding first timestamp value is calculated according to the first preset formula and the time increment; If it is not the first time to read the data, and the sequence number of the currently read data is greater than the current sequence number, the corresponding second timestamp value is calculated according to the second preset formula and the time increment.
6. The method for processing brain-computer interface data based on Web Bluetooth according to claim 5, characterized in that: The first preset formula is as follows: TS1=T now -(EID now -eventID)*Δt; where TS1 is the first timestamp value, T now is the time point corresponding to the anchor point, EID now is the current sequence number, eventID is the sequence number of the currently read data, and Δt is the time increment; The second preset formula is as follows: TS2=T now +(EID now -eventID)*Δt; wherein TS2 is the second timestamp value.
7. The method for processing brain-computer interface data based on Web Bluetooth according to claim 1, characterized in that: S500 at least includes the following steps: S510, converting the processed data into an asynchronous data stream; S520, performing sequence processing on the data stream to analyze the time-frequency domain data; S530, subscribing to the asynchronous data stream to update the visualization data in real time; S540: Sort the processed data according to the timestamp information and display them visually on a web page.
8. The method for processing brain-computer interface data based on Web Bluetooth according to claim 7, characterized in that: S520 at least includes the following steps: S521, calling a sequence processing function to read data from an asynchronous data stream; S522, performing a map operation on the input data; S523, asynchronously and responsively implement fast Fourier transform logic, convert the time domain signal into a frequency domain signal, and calculate the frequency domain data; S524, mapping the calculation result of S523 to the power spectrum density array, generating power spectrum density data, and outputting it in an asynchronous manner.
9. A Web Bluetooth-based brain-computer interface data processing system, characterized in that: include: A connection module is used to establish a connection with a brain-computer interface hardware device on the web page. The brain-computer interface hardware device has a built-in Bluetooth module; A data acquisition module is used to start an asynchronous service based on the connected brain-computer interface hardware device and obtain the services, characteristics and descriptors it supports. The characteristics and descriptors define the communication mode and parameter settings between the brain-computer interface hardware devices; A data processing module is used to obtain data received by the brain-computer interface hardware device and perform data processing; A timestamp adding module is used to add timestamp information to the processed data according to the data characteristics; The visualization module is used to visualize the processed data on the web page according to the timestamp information.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a Web Bluetooth-based brain-computer interface data processing program, which, when executed by a processor, implements the steps of the Web Bluetooth-based brain-computer interface data processing method as described in any one of claims 1 to 8.