A method, system, terminal, and storage medium for data flow integrity control of wireless wearable sensors.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-08-11
AI Technical Summary
[0006]本发明的主要目的在于提供一种用于无线可穿戴传感器的数据流完整性控制方法、系统、终端及计算机可读存储介质,旨在解决在运动生物力学与可穿戴监测场景的随机网络不稳定条件下,可穿戴传感器全时序数据集的完整性和可靠性难以保证的问题
[0017] In this invention, sensor data is collected from a wireless wearable sensor at a fixed sampling frequency, and a timestamp is added to the sensor data. Based on a downlink hierarchical triggering process and an uplink parallel step-by-step verification process, the wireless network status of the sensor data with the added timestamp is monitored in real time, and the current working mode is determined according to the monitoring results. If the current working mode is real-time transmission mode, the sensor data with the added timestamp is stored in the online transmission buffer of RAM and sent to the server. After receiving the confirmation message returned by the server, the corresponding data is released from the online transmission buffer. If the current working mode is offline storage mode, the sensor data with the added timestamp is stored in the offline cache of non-volatile Flash memory. When the wireless network recovers and the recovery conditions are met, the system switches back from offline storage mode to real-time transmission mode. Historical data from the offline cache is read from the Flash memory in the recording order, and the historical data and timestamp are uploaded to the server. The server reorders the historical data and the newly collected sensor data after the recovery of real-time transmission mode according to the timestamp, generating a complete and continuous time-series dataset. This invention ensures zero-loss transmission and time axis continuity of the full-time-series dataset under the random network instability conditions of sports biomechanics and wearable monitoring scenarios.
Smart Images

Figure CN122554798A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a data flow integrity control method, system, terminal, and computer-readable storage medium for wireless wearable sensors. Background Technology
[0002] The widespread application of wearable sensing technology has propelled leapfrog development in the fields of sports health research and applied sports biomechanics. In its application scenarios, the integrity and strict temporal continuity of wearable sensor data streams are fundamental prerequisites for ensuring reliable analysis results and effective system functionality.
[0003] The wireless transmission links upon which wearable sensors rely typically require a comprehensive trade-off between power consumption, transmission latency, and data integrity. However, current wireless signal transmission methods are inherently vulnerable in dynamic motion environments: factors such as human body obstruction, environmental radio frequency interference, and large-scale movement of the subject can easily trigger random, transient connection interruptions and packet loss.
[0004] Existing dual-layer caching schemes, while seemingly possessing both real-time transmission and offline storage capabilities, suffer from the following coupling defects: frequent mode oscillations, loss of half-acknowledgment messages, timing discrepancies, high Flash consumption, and congestion across multiple nodes. These defects disrupt the necessary temporal continuity of sensor data streams, while simultaneously reducing the reliability of real-time monitoring and the integrity of offline research datasets. These defects have become a key bottleneck restricting the deep application of wearable sensing technology in the fields of sports biomechanics and sports health.
[0005] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0006] The main objective of this invention is to provide a data flow integrity control method, system, terminal, and computer-readable storage medium for wireless wearable sensors, aiming to solve the problem that the integrity and reliability of full-time series datasets of wearable sensors are difficult to guarantee under the unstable conditions of random networks in sports biomechanics and wearable monitoring scenarios.
[0007] To achieve the above objectives, the present invention provides a data flow integrity control method for wireless wearable sensors, the method comprising the following steps: Sensor data is collected from a wireless wearable sensor at a fixed sampling frequency, and a timestamp is appended to the sensor data; Based on the downlink hierarchical triggering process and the uplink parallel step-by-step verification process, the wireless network status of the sensor data with the timestamp attached is monitored in real time, and the current working mode is determined according to the monitoring results. The downlink hierarchical triggering process and the uplink parallel step-by-step verification process both adopt a multi-dimensional, independent and asymmetric hysteresis threshold system. Downlink triggering thresholds and uplink recovery thresholds are set independently for multiple core indicators of the transmission layer. The downlink triggering threshold is greater than the uplink recovery threshold, forming an asymmetric hysteresis interval. If the current working mode is real-time transmission mode, the sensor data with the timestamp attached is stored in the online transmission buffer of RAM and sent to the server. After receiving the confirmation message returned by the server, the corresponding data is released from the online transmission buffer. If the current working mode is offline storage mode, the sensor data with the timestamp attached will be stored in the offline cache of the non-volatile Flash memory. When the wireless network is restored and the restoration conditions are met, the system switches back from the offline storage mode to the real-time transmission mode. Historical data cached offline is read from the Flash memory in the order of recording. The historical data and the timestamp are uploaded to the server. The server then reorders the historical data and the newly collected sensor data after the restoration of the real-time transmission mode according to the timestamp to generate a complete and continuous time-series dataset.
[0008] Optionally, in the data stream integrity control method for wireless wearable sensors, the downlink hierarchical triggering process is used to hierarchically trigger the switch to the offline storage mode based on the monitoring results of normal, mild degradation, continuous congestion or interruption in the real-time transmission mode. The uplink parallel step-by-step verification process is used to monitor multiple core indicators in parallel under the offline storage mode. When all core indicators continuously meet the recovery preset threshold within the preset observation window, the switch from the offline storage mode to the real-time transmission mode is triggered.
[0009] Optionally, the data flow integrity control method for wireless wearable sensors, wherein the downlink hierarchical triggering process specifically includes: When the monitoring result is interrupted, the offline saving mode is triggered, and the newly collected sensor data is transferred to the Flash memory for storage; When the monitoring result is continuous congestion, and the backlog of the transport layer queue buffer exceeds the first preset threshold or the size of the pending response window exceeds the second preset threshold, data stream redirection is triggered, switching the newly acquired sensor data from the RAM transmission path to the Flash memory storage path. When the monitoring result is continuous congestion, and the smooth round-trip delay exceeds the third preset threshold or the number of bytes of pending payload exceeds the fourth preset threshold in multiple consecutive sampling periods, the hysteresis control mechanism is triggered and the system switches to the offline storage mode.
[0010] Optionally, the data flow integrity control method for wireless wearable sensors, wherein the uplink parallel step-by-step verification process specifically includes: Verify that the Wi-Fi connection is valid and the MQTT connection is complete; Verify whether the backlog of the transport layer queue buffer is lower than the fifth preset threshold and whether the size of the pending response window is lower than the sixth preset threshold. Verify whether the smooth round-trip delay is lower than the seventh preset threshold recovery value within multiple consecutive sampling periods and whether the number of bytes of payload to be sent is lower than the eighth preset threshold within multiple consecutive sampling periods; When the Wi-Fi connection is valid and the MQTT connection is complete for a preset duration of a preset threshold, and the backlog of the transport layer queue buffer is lower than a fifth preset threshold and the size of the pending response window is lower than a sixth preset threshold for a preset duration of a preset threshold, and the smooth round-trip delay is lower than a seventh preset threshold recovery value for multiple consecutive sampling periods and the number of pending payload bytes is lower than an eighth preset threshold for multiple consecutive sampling periods, the wireless wearable sensor is determined to meet the recovery conditions, and switches from the offline storage mode back to the real-time transmission mode.
[0011] Optionally, in the data flow integrity control method for wireless wearable sensors, the first preset threshold and the fifth preset threshold constitute a first asymmetric hysteresis interval between downlink triggering and uplink recovery, and the first preset threshold is greater than the fifth preset threshold. The second preset threshold and the sixth preset threshold constitute a second asymmetric hysteresis interval, wherein the second preset threshold is greater than the sixth preset threshold; The fourth preset threshold and the eighth preset threshold constitute a third asymmetric hysteresis interval, and the fourth preset threshold is greater than the eighth preset threshold. The recovery values of the third preset threshold and the seventh preset threshold are equal. In the downlink graded triggering process, the smooth round-trip delay exceeds the third preset threshold in multiple consecutive sampling periods. In the uplink parallel step-by-step verification process, the smooth round-trip delay is lower than the seventh preset threshold in multiple consecutive sampling periods.
[0012] Optionally, the data stream integrity control method for wireless wearable sensors, wherein storing the sensor data with the timestamp appended into an online transmission buffer in RAM and sending it to the server, further includes: When the monitoring result is mild degradation, the online transmission buffer in RAM is used to cache the unsent messages and unacknowledged messages, and the online transmission window driven by ACK is used to maintain retransmission and sequential submission to form a first-level fault tolerance layer.
[0013] Optionally, the data stream integrity control method for wireless wearable sensors, wherein storing the sensor data with the timestamp appended into an offline cache in a non-volatile Flash memory specifically includes: The incomplete data of messages that have been sent in the online transmission buffer but have not received confirmation from the server will be transferred to the non-volatile Flash memory; After the incomplete data transfer is completed, the newly acquired sensor data is stored in the Flash dedicated write buffer. When the Flash dedicated write buffer is full, a one-time batch page write operation is performed on the data accumulated in the Flash dedicated write buffer.
[0014] Furthermore, to achieve the above objectives, the present invention also provides a data flow integrity control system for wireless wearable sensors, wherein the data flow integrity control system for wireless wearable sensors includes: The data acquisition module is used to acquire sensor data from the wireless wearable sensor at a fixed sampling frequency and to add a timestamp to the sensor data; The working mode determination module is used to monitor the wireless network status of sensor data with the timestamp attached in real time based on the downlink hierarchical triggering process and the uplink parallel step-by-step verification process, and determine the current working mode based on the monitoring results. The sending confirmation module is used to store the sensor data with the timestamp attached into the online sending buffer of RAM and send it to the server if the current working mode is real-time transmission mode. After receiving the confirmation message returned by the server, the corresponding data is released from the online sending buffer. The downlink hierarchical triggering process and the uplink parallel step-by-step verification process both adopt a multi-dimensional, independent and asymmetric hysteresis threshold system. Downlink triggering thresholds and uplink recovery thresholds are set independently for multiple core indicators of the transmission layer. The downlink triggering threshold is greater than the uplink recovery threshold, forming an asymmetric hysteresis interval. An offline caching module is used to store the sensor data with the timestamp attached into an offline cache in a non-volatile Flash memory if the current working mode is offline storage mode. The reconstruction output module is used to switch from the offline storage mode back to the real-time transmission mode when the wireless network is restored and the restoration conditions are met. It reads the offline cached historical data from the Flash memory in the order of recording, uploads the historical data and the timestamp to the server, and the server reorders the historical data and the newly collected sensor data after the restoration of the real-time transmission mode according to the timestamp to generate a complete and continuous time series dataset.
[0015] Furthermore, to achieve the above objectives, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a data flow integrity control program for a wireless wearable sensor stored in the memory and executable on the processor, wherein when the data flow integrity control program for a wireless wearable sensor is executed by the processor, it implements the steps of the data flow integrity control method for a wireless wearable sensor as described above.
[0016] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a data flow integrity control program for a wireless wearable sensor, and the data flow integrity control program for a wireless wearable sensor, when executed by a processor, implements the steps of the data flow integrity control method for a wireless wearable sensor as described above.
[0017] In this invention, sensor data is collected from a wireless wearable sensor at a fixed sampling frequency, and a timestamp is added to the sensor data. Based on a downlink hierarchical triggering process and an uplink parallel step-by-step verification process, the wireless network status of the sensor data with the added timestamp is monitored in real time, and the current working mode is determined according to the monitoring results. If the current working mode is real-time transmission mode, the sensor data with the added timestamp is stored in the online transmission buffer of RAM and sent to the server. After receiving the confirmation message returned by the server, the corresponding data is released from the online transmission buffer. If the current working mode is offline storage mode, the sensor data with the added timestamp is stored in the offline cache of non-volatile Flash memory. When the wireless network recovers and the recovery conditions are met, the system switches back from offline storage mode to real-time transmission mode. Historical data from the offline cache is read from the Flash memory in the recording order, and the historical data and timestamp are uploaded to the server. The server reorders the historical data and the newly collected sensor data after the recovery of real-time transmission mode according to the timestamp, generating a complete and continuous time-series dataset. This invention ensures zero-loss transmission and time axis continuity of the full-time-series dataset under the random network instability conditions of sports biomechanics and wearable monitoring scenarios. Attached Figure Description
[0018] Figure 1This is a flowchart of a preferred embodiment of the data flow integrity control method for wireless wearable sensors according to the present invention; Figure 2 This is another flowchart of a preferred embodiment of the data flow integrity control method for wireless wearable sensors of the present invention; Figure 3 This is a schematic diagram of the downlink hierarchical triggering process and the uplink parallel step-by-step verification process of the data flow integrity control method for wireless wearable sensors of the present invention. Figure 4 This is a time distribution feature diagram of link interruption during roaming in the data flow integrity control method for wireless wearable sensors of the present invention; Figure 5 This is another temporal distribution feature of link interruption during roaming in the data flow integrity control method for wireless wearable sensors of the present invention; Figure 6 This is a structural diagram of a preferred embodiment of the data flow integrity control system for wireless wearable sensors of the present invention; Figure 7 This is a structural diagram of a preferred embodiment of the terminal of the present invention. Detailed Implementation
[0019] This application provides a data flow integrity control method, system, and terminal for wireless wearable sensors. To make the objectives, technical solutions, and effects of this application clearer and more explicit, the following detailed description is provided with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only for explaining this application and are not intended to limit this application.
[0020] It will be understood by those skilled in the art that, unless otherwise defined, all terms used herein (including technical and scientific terms) have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains. It should also be understood that terms such as those defined in general dictionaries should be understood to have the same meaning as in the context of the prior art, and should not be interpreted in an idealized or overly formal sense unless specifically defined as herein.
[0021] Furthermore, if the embodiments of this invention involve descriptions such as "first" or "second," these descriptions are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined with "first" or "second" may explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. If the combination of technical solutions is contradictory or impossible to implement, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by this invention.
[0022] The preferred embodiment of the data stream integrity control method for wireless wearable sensors described in this invention, such as... Figure 1 and Figure 2 As shown, the data flow integrity control method for wireless wearable sensors includes the following steps: Step S10: Collect sensor data from the wireless wearable sensor at a fixed sampling frequency and add a timestamp to the sensor data.
[0023] It is understood that the core of the Data Integrity Assurance (DIA) method for wireless wearable sensors is the downlink hierarchical triggering process and the uplink parallel step-by-step verification process. These serve as the bidirectional, closed-loop decision-making core of the DIA algorithm, uniformly driving the system's global adaptive state switching and data flow scheduling. Supported by the downlink hierarchical triggering process and the uplink parallel step-by-step verification process, DIA adopts a dual-layer storage architecture and a hierarchical fault-tolerant caching strategy. Through real-time network health monitoring and multi-indicator bidirectional adaptive judgment, the downlink hierarchical triggering process and the uplink parallel step-by-step verification process dynamically schedule the data flow between the MCU's (embedded microcontroller) Data RAM and large-capacity non-volatile memory (Flash) during network congestion and interruptions, without interfering with the normal operation of the high-frequency real-time sensor acquisition thread. More importantly, the DIA framework incorporates an autonomous timestamp-aligned data recovery protocol. After the acquisition task is completed, the historical data stored in Flash is reintegrated into the original data stream in strict chronological order, ensuring the complete reconstruction of continuous motion and physiological timelines, and guaranteeing the strict chronological continuity and end-to-end integrity of the entire dataset.
[0024] In this embodiment, the DIA algorithm is designed for embedded lightweight use with the ESP32-WROOM-32U (dual-core 32-bit microcontroller complete module) microcontroller and directly deployed on the device-side sampling and transmission link. The algorithm uses the mandatory PUBACK (Publish Acknowledgment) confirmation mechanism of MQTT (Message Queuing Telemetry Transport) QoS1 (at least once) mode as the basis for data integrity assurance. Addressing the typical transmission requirements of random instability in dynamic motion scenarios and high-frequency continuous sampling by a 100Hz IMU (Inertial Measurement Unit), it strives to ensure that the downstream receiver obtains a complete and time-reconstructable sensor dataset on a resource-constrained embedded platform. Specifically, after the initial Wi-Fi and MQTT connection establishment, a sampling timer and data transmission process are initiated. The sampling thread collects sensor data from the wireless wearable sensor at a fixed sampling frequency and adds a timestamp and tag information to each frame of data.
[0025] Step S20: Based on the downlink hierarchical triggering process and the uplink parallel step-by-step verification process, monitor the wireless network status of the sensor data with the timestamp attached in real time, and determine the current working mode based on the monitoring results.
[0026] Specifically, both the downlink hierarchical triggering process and the uplink parallel step-by-step verification process adopt a multi-dimensional, independent and asymmetric hysteresis threshold system. Downlink triggering thresholds and uplink recovery thresholds are set independently for multiple core indicators of the transmission layer. The downlink triggering threshold is greater than the uplink recovery threshold, forming an asymmetric hysteresis interval. The downlink graded triggering process is used to trigger a graded switch to the offline storage mode based on the monitoring results of normal, mild degradation, continuous congestion or interruption in the real-time transmission mode. The uplink parallel step-by-step verification process is used to monitor multiple core indicators in parallel under the offline storage mode. When all core indicators continuously meet the recovery preset threshold within the preset observation window, the switch from the offline storage mode to the real-time transmission mode is triggered.
[0027] like Figure 3 As shown, it can be understood that the downlink hierarchical triggering process and the uplink parallel step-by-step verification process are the core decision-making hubs of the proposed Data Integrity Assurance (DIA) algorithm. It adopts a hierarchical architecture driven by closed-loop feedback and achieves bidirectional seamless adaptive switching between real-time transmission mode and offline storage mode, taking into account the characteristics of dynamic wireless channel changes in sports biomechanical wearable sensing scenarios.
[0028] The algorithm takes the physical layer connection status, transport layer queue status and network link status obtained in real time as feedback input. It uses a two-way judgment logic that combines downlink hierarchical triggering and uplink parallel step-by-step verification to maximize the proportion of real-time data transmission, avoid data loss caused by network fluctuations, and minimize the write frequency of non-volatile Flash memory, thus balancing the low latency requirements of real-time monitoring with the integrity of offline data.
[0029] Specifically, the switch from real-time transmission to offline storage adopts a hierarchical triggering mechanism. The algorithm is designed with a three-level progressive triggering judgment process to deal with different degrees of network degradation, so as to avoid frequent mode jitter caused by a single preset threshold judgment. At the same time, it ensures that sensor data can be preserved without loss when the wireless network link indicators continue to deteriorate.
[0030] Both the downlink tiered triggering process and the uplink parallel step-by-step verification process employ a multi-dimensional independent asymmetric hysteresis threshold system. Independent uplink recovery thresholds and downlink triggering thresholds are set for the three core indicators of the transport layer (queue backlog, waiting response window, and waiting payload), with the downlink triggering threshold being greater than the uplink recovery threshold, thus forming three sets of asymmetric hysteresis intervals.
[0031] The switch from offline storage to real-time transmission adopts a parallel step-by-step recovery verification. When the algorithm runs in offline storage mode, it continuously monitors the network and system status in parallel. Only when all core indicators have been fully restored and the network health has been maintained for a certain period of time will it switch back to real-time transmission mode to avoid frequent mode switching caused by network instability.
[0032] Parallel verification includes physical protocol layer verification, transport layer verification, and link quality verification. Physical or protocol layer verification sequentially checks the validity of the Wi-Fi connection and the integrity of the MQTT connection; only after both connections are stably established does it proceed to subsequent performance indicator verification. In transport layer verification, the algorithm sequentially checks the idle state of the transport layer queue buffer and the idle state of the pending response window to confirm that the transport layer has no backlog and the capacity to carry real-time data transmission. Link quality verification simultaneously monitors and evaluates whether the smoothed round-trip delay has recovered to a normal preset threshold and whether the pending payload is in a low-load range, thereby confirming that the link transmission performance meets the low-latency requirements for real-time monitoring.
[0033] When all the above core indicators meet the preset threshold conditions, the algorithm introduces a preset threshold for duration. When all core indicators remain in a healthy state within the preset observation window, the algorithm completes the step-by-step state confirmation, seamlessly switches back to the real-time transmission mode, and restores the real-time transmission process of sensor data.
[0034] Furthermore, the downlink hierarchical triggering process specifically includes: When the monitoring result is interrupted, the offline saving mode is triggered, and the newly collected sensor data is transferred to the Flash memory for storage; When the monitoring result is continuous congestion, and the backlog of the transport layer queue buffer exceeds the first preset threshold or the size of the pending response window exceeds the second preset threshold, data stream redirection is triggered, switching the newly acquired sensor data from the RAM transmission path to the Flash memory storage path. When the monitoring result is continuous congestion, and the smooth round-trip delay exceeds the third preset threshold or the number of bytes of pending payload exceeds the fourth preset threshold in multiple consecutive sampling periods, the hysteresis control mechanism is triggered and the system switches to the offline storage mode.
[0035] In this embodiment, when extreme network interruption events such as Wi-Fi physical layer disconnection or MQTT protocol layer disconnection are detected, the algorithm directly triggers offline saving, bypasses the RAM transmission queue, and transfers the real-time collected sensor data into the Flash storage process. Provided that the offline storage space is not exhausted and the write task is executed normally, this mechanism can retain the sampled data as completely as possible during a complete network interruption.
[0036] When the wireless transmission link deteriorates severely, leading to excessive queue buffer backlog at the transmission layer, RAM buffer pressure reaching the overload warning line, or the pending response transmission window size exceeding a preset threshold, and real-time transmission can no longer guarantee stable data delivery, the algorithm immediately and automatically triggers data stream redirection. This switches newly acquired sensor data from the RAM transmission path to the Flash non-volatile storage path to reduce data packet overflow caused by RAM buffer saturation. Specifically, queue buffer backlog is determined when the number of backlogged data exceeds a first preset threshold Qmax, and the pending response transmission window size is determined when it exceeds a second preset threshold Wmax.
[0037] When link quality deteriorates and transmission capacity decreases, causing core performance indicators of the wireless transmission link, including persistently high smoothed round-trip delay and persistently exceeding preset thresholds in the number of bytes of pending payload, the algorithm activates a hysteresis control mechanism. By setting a "duration preset threshold," it prioritizes real-time transmission while continuously monitoring and ensuring lossless data preservation even as wireless network link indicators continue to deteriorate. Specifically, the smoothed round-trip delay is determined when its value exceeds the third preset threshold T_t for three consecutive sampling periods, and the pending payload byte count is determined when it exceeds the fourth preset threshold Smax for three consecutive sampling periods.
[0038] Furthermore, the uplink parallel step-by-step verification process specifically includes: Verify that the Wi-Fi connection is valid and the MQTT connection is complete; Verify whether the backlog of the transport layer queue buffer is lower than the fifth preset threshold and whether the size of the pending response window is lower than the sixth preset threshold. Verify whether the smooth round-trip delay is lower than the seventh preset threshold recovery value within multiple consecutive sampling periods and whether the number of bytes of payload to be sent is lower than the eighth preset threshold within multiple consecutive sampling periods; When the Wi-Fi connection is valid and the MQTT connection is complete for a preset duration of a preset threshold, and the backlog of the transport layer queue buffer is lower than a fifth preset threshold and the size of the pending response window is lower than a sixth preset threshold for a preset duration of a preset threshold, and the smooth round-trip delay is lower than a seventh preset threshold recovery value for multiple consecutive sampling periods and the number of pending payload bytes is lower than an eighth preset threshold for multiple consecutive sampling periods, the wireless wearable sensor is determined to meet the recovery conditions, and switches from the offline storage mode back to the real-time transmission mode.
[0039] In this embodiment, the switching from offline storage to real-time transmission adopts a parallel step-by-step recovery verification. When the algorithm runs in offline storage mode, it continuously monitors the network and system status in parallel. Only when all core indicators have fully recovered and the network health has been maintained for a certain period of time will it switch back to real-time transmission mode to avoid frequent mode switching caused by network instability.
[0040] Parallel verification includes physical or protocol layer verification, transport layer verification, and link quality verification. Physical or protocol layer verification will sequentially check the validity of the Wi-Fi connection and the integrity of the MQTT connection. Only after both layers of connection are stably established will subsequent performance indicator verification begin.
[0041] During transport layer verification, the algorithm sequentially checks the idle state of the transport layer queue buffer and the idle state of the pending response transmission window to confirm that the transport layer has no backlog and is capable of carrying real-time data transmission. Specifically, the recovery condition for the transport layer queue buffer is that the backlog amount is lower than the fifth preset threshold Qmin, and the recovery condition for the pending response transmission window is that the size of the pending response transmission window is lower than the sixth preset threshold Wmin.
[0042] Link quality verification simultaneously monitors and evaluates whether the smooth round-trip delay has recovered to the normal preset threshold and whether the pending payload is in a low-load range, thereby confirming that the link transmission performance meets the low-latency requirements for real-time monitoring. Specifically, the recovery condition for the smooth round-trip delay is that the smooth round-trip delay value is lower than the seventh preset threshold T_t recovery value for 10 consecutive sampling periods, and the recovery condition for the number of pending payload bytes is that the number of pending payload bytes is lower than the eighth preset threshold Smin for 10 consecutive sampling periods.
[0043] When all the above core indicators meet the preset threshold conditions, the algorithm introduces a preset threshold for duration. When all core indicators remain in a healthy state within the preset observation window, the algorithm completes the step-by-step state confirmation, seamlessly switches back to the real-time transmission mode, and restores the real-time transmission process of sensor data.
[0044] Furthermore, the first preset threshold and the fifth preset threshold constitute a first asymmetric hysteresis interval between downlink triggering and uplink recovery, wherein the first preset threshold is greater than the fifth preset threshold; The second preset threshold and the sixth preset threshold constitute a second asymmetric hysteresis interval, wherein the second preset threshold is greater than the sixth preset threshold; The fourth preset threshold and the eighth preset threshold constitute a third asymmetric hysteresis interval, and the fourth preset threshold is greater than the eighth preset threshold. The recovery values of the third preset threshold and the seventh preset threshold are equal. In the downlink graded triggering process, the smooth round-trip delay exceeds the third preset threshold in multiple consecutive sampling periods. In the uplink parallel step-by-step verification process, the smooth round-trip delay is lower than the seventh preset threshold in multiple consecutive sampling periods.
[0045] In this embodiment, queue buffer backlog refers to the total number of sensor data packets that have been acquired and encapsulated in the application layer but have not yet been submitted to the underlying network protocol stack for transmission, and are temporarily backed up in a dedicated memory buffer queue. This metric is a leading core indicator characterizing the matching degree between data acquisition rate and link transmission rate. It can identify insufficient carrying capacity of the transmission link earlier than the underlying protocol stack queue congestion, and directly reflects the real-time memory usage pressure and transmission congestion risk of the application layer.
[0046] This invention sets an asymmetric queue buffer backlog preset threshold Q. In real-time transmission mode, when the queue buffer backlog exceeds the first preset threshold Qmax, the system immediately determines that the current wireless link is experiencing continuous congestion and triggers a switch from real-time transmission to offline storage. In offline storage mode, the basic conditions for resuming real-time transmission are only considered met when the queue buffer backlog is lower than the fifth preset threshold Qmin. The first preset threshold Qmax is 192 frames, the fifth preset threshold Qmin is 64 frames, and the first preset threshold Qmax is greater than the fifth preset threshold Qmin, constituting the first asymmetric hysteresis interval between downlink triggering and uplink recovery.
[0047] The pending response window refers to the total number of concurrent data packets sent into the network via the wireless channel within the same time frame under the MQTT QoS1 reliable communication mechanism, but which have not yet received a PUBACK acknowledgment message from the peer. This metric is tracked and counted throughout the entire lifecycle of the PUBACK handshake message in the MQTT protocol standard. This metric is a core transport layer indicator characterizing the effectiveness of bidirectional wireless link transmission, the message processing capacity of the broker, and the degree of network congestion. It can identify substantial degradation in network transmission capacity in advance and directly reflect the real-time resource consumption pressure and transmission reliability risks of the underlying protocol stack.
[0048] This invention sets an asymmetric pre-set threshold W for the pending response transmission window. In real-time transmission mode, when the pending response transmission window size exceeds the second pre-set threshold Wmax, the system immediately determines that the current network transmission capacity is severely limited and triggers a switch from real-time transmission to offline storage. In offline storage mode, the basic conditions for restoring real-time transmission are only considered met when the pending response transmission window size is lower than the sixth pre-set threshold Wmin. The second pre-set threshold Wmax is 48 frames, the sixth pre-set threshold Wmin is 16 frames, and the second pre-set threshold Wmax is greater than the sixth pre-set threshold Wmin, constituting a second asymmetric hysteresis interval between downlink triggering and uplink recovery.
[0049] The number of bytes of pending payload refers to the total number of bytes of data in the underlying communication protocol stack that the application layer has submitted via the standard send interface but has not yet completed physical layer network transmission, or that has entered the transmission process but is still waiting for server confirmation. This metric is a core indicator that directly quantifies the degree of cache backlog within the underlying protocol stack. It can accurately identify protocol stack congestion that application layer indicators cannot cover, directly reflecting the transmission congestion at the underlying communication layer and the risk of system heap memory usage. When the underlying network transmission rate is consistently lower than the data submission rate, submitted data packets will accumulate in the underlying protocol stack's internal cache. If not intervened in time, the continuously increasing pending payload will quickly exhaust the microcontroller's limited available heap memory, eventually triggering a fatal memory overflow failure, leading to the interruption of the sampling thread and irreversible loss of collected data. At the same time, continuous backlog will further exacerbate protocol stack head-of-line congestion, triggering forced packet drop by the protocol stack.
[0050] To address this, the present invention sets an asymmetrical preset threshold S for the number of bytes of payload to be transmitted. In real-time transmission mode, when the number of bytes of payload to be transmitted exceeds the fourth preset threshold Smax for three consecutive sampling periods, the system immediately determines that the underlying network congestion has reached a critical state and triggers a switch from real-time transmission to offline storage. In offline storage mode, the basic conditions for resuming real-time transmission are only determined when the number of bytes of payload to be transmitted is lower than the eighth preset threshold Smin for ten consecutive sampling periods. The fourth preset threshold Smax is 40KB, the eighth preset threshold Smin is 10KB, and the fourth preset threshold Smax is greater than the eighth preset threshold Smin, forming a third asymmetric hysteresis interval between downlink triggering and uplink recovery.
[0051] Smoothed round-trip delay (RTD) refers to the end-to-end round-trip time from when the system sends a sensor data packet via the MQTT QoS1 reliable transmission mechanism to when it receives the corresponding PUBACK acknowledgment message from the server. To filter out occasional network jitter and physical layer retransmission spikes in the Wi-Fi environment, the system uses an exponential moving average algorithm to smooth the original RTD, ultimately obtaining the smoothed RTD metric. This metric is the most direct real-time probe reflecting the bidirectional transmission quality of the wireless link. It can accurately characterize the average throughput efficiency and link health status of the network. It is a core first-level early warning indicator in the algorithm's congestion protection system, identifying the continuous degradation trend of the network link earlier than problems such as queue backlog and increased memory usage, providing a basis for advance decision-making for subsequent congestion control and mode switching.
[0052] This invention sets an asymmetrical preset threshold T for smooth round-trip delay. In real-time transmission mode, when the smooth round-trip delay value exceeds the third preset threshold T_t for three consecutive sampling periods, the system immediately determines that the current network is in a state of continuous high latency degradation, triggers a hysteresis control mechanism, suspends the batch submission of new data packets, reduces the transmission pressure on the protocol stack, and if the latency is not alleviated, triggers a downgrade switch from real-time transmission to offline storage. In offline storage mode, the basic condition for restoring real-time transmission is only determined to be met when the smooth round-trip delay value is lower than the recovery value of the seventh preset threshold T_t' for 10 consecutive sampling periods. The recovery values of the third preset threshold T_t and the seventh preset threshold T_t' are equal, both being 3000ms, as shown in Table 1. Table 1: Criteria for Determining Core Indicators of Downlink Hierarchical Triggering Process and Uplink Parallel Stepped Verification Process
[0053] Furthermore, the "waiting response window" specifically refers to the total number of concurrent data packets sent into the network via the wireless channel within the same time frame under the MQTT QoS 1 (Quality of Service Level 1) reliable communication mechanism, but which have not yet received a PUBACK (publish acknowledgment) control message from the peer. This metric is tracked and counted throughout its entire lifecycle using the PUBACK handshake message of the MQTT protocol standard. This metric is a core transport layer indicator characterizing the effectiveness of bidirectional wireless link transmission, the message processing capability of the broker end, and the degree of network congestion. It can identify substantial degradation of network transmission capacity in advance and directly reflect the real-time resource consumption pressure and transmission reliability risks of the underlying protocol stack.
[0054] When wireless channel conditions deteriorate, human obstruction occurs, or radio frequency interference causes delays in PUBACK acknowledgments, sent messages fail to receive confirmation from the other end, leading to a continuous increase in the number of unacknowledged data packets in transmission. If the size of the transmission window is not limited, a vicious cycle of "congestion-acknowledgment delay-window expansion-increased retransmissions-exacerbated congestion" will occur, ultimately resulting in a retransmission storm and wireless channel collapse. Simultaneously, the LwIP protocol stack of the ESP32 platform needs to allocate independent retransmission timers, state machine resources, and memory buffers for each unacknowledged QoS 1 message. A large number of unacknowledged messages will continuously consume the microcontroller's timers and MCU computing power, crowding out resource quotas for core services such as high-frequency data acquisition, ultimately leading to sampling timing errors, data frame loss, system lag, or even crashes, resulting in irreversible loss of sampled data.
[0055] To address this, the algorithm sets unequal thresholds W for the pending response transmission window. In real-time transmission mode, when the pending response transmission window value exceeds the threshold Wmax, the system immediately determines that the current network transmission capacity is severely limited, triggering a switch from real-time transmission to offline storage. Simultaneously, new online sending requests are blocked, cutting off the triggering conditions for a retransmission storm at its source. Newly acquired sensor data packets are synchronously transferred to the offline storage process. Conversely, in offline storage mode, only when the pending response transmission window value drops below Wmin is the basic condition for restoring real-time transmission deemed met. This ensures that when switching back to real-time transmission mode, the network's bidirectional communication capacity and Broker message processing capacity have been restored to normal, with sufficient window capacity to simultaneously handle both new real-time data and existing retransmitted data. This avoids immediate secondary congestion after recovery, ensuring system stability and transmission link reliability.
[0056] The bidirectional asymmetric threshold for determining the response window is determined based on the hardware resource constraints of the ESP32 embedded platform, the characteristics of the MQTT protocol mechanism, the service characteristics of high-frequency IMU sensing, and the requirements for stable system operation. Considering the continuous transmission of high-frequency IMU data in biomechanical scenarios and the stringent requirements for system real-time performance and transmission stability, in the experimental configuration presented in this paper, the trigger threshold Wmax for offline storage is 48 frames, and the verification threshold Wmin for online recovery is 16 frames. The 48-frame trigger threshold limits the timer, state machine, and cache resources allocated by the underlying protocol stack for QoS1 unacknowledged messages, reducing excessive protocol stack resource consumption that could crowd out the core task resources for high-frequency IMU sampling. Simultaneously, when the flight window reaches 48 frames, it indicates severe network congestion or response delay; timely blocking of new online transmission requests at this point prevents retransmission storms from overwhelming computing power and exacerbating wireless channel congestion. Furthermore, this threshold references common configurations for the upper limit of a single-client concurrent window, avoiding the triggering of flow control and batch packet loss mechanisms. Correspondingly, the verification threshold Wmin is designed as a low recovery threshold of 16 frames, forming an asymmetric hysteresis interval between it and 48 frames, which is used to reduce the probability of frequent mode switching. The 16-frame recovery threshold can reserve a certain concurrency margin for instantaneous channel fluctuations and sudden retransmissions, ensuring that switching back to real-time transmission mode is only allowed when historically accumulated unacknowledged packets have been fully cleared and network transmission capacity has been stably restored.
[0057] Step S30: If the current working mode is real-time transmission mode, the sensor data with the timestamp attached is stored in the online transmission buffer of RAM and sent to the server. After receiving the confirmation message returned by the server, the corresponding data is released from the online transmission buffer.
[0058] Specifically, when the current working mode is determined to be real-time transmission mode, the sensor data with the timestamp attached is stored in the online transmission buffer in RAM and sent to the server. After receiving the confirmation message returned by the server, the corresponding data is released from the online transmission buffer.
[0059] After successfully establishing a Wi-Fi and MQTT connection, the system initiates a sampling timer and data transmission process. The sampling thread collects sensor data at a fixed interval and adds a timestamp and tag information to each frame. Subsequently, the data packets enter the online transmission buffer in RAM and are sent to the server by the MQTT client in QoS1 mode. Only after the server returns a PUBACK acknowledgment message is the corresponding message released from the online transmission buffer, forming a closed-loop transmission link of "send-acknowledgment-commit".
[0060] When a slight degradation occurs in the wireless link, the system first uses the online transmission buffer in RAM to cache undelivered and unacknowledged packets, and maintains regular retransmission and sequential submission through an ACK-driven online transmission window. This stage constitutes the first-level fault tolerance layer of DIA, whose goal is to prioritize the preservation of real-time transmission capabilities and absorb short-term network fluctuations without immediately enabling Flash.
[0061] The process of storing the sensor data with the timestamp appended into the online transmission buffer of RAM and sending it to the server further includes: When the monitoring result is mild degradation, the online transmission buffer in RAM is used to cache the unsent messages and unacknowledged messages, and the online transmission window driven by ACK is used to maintain retransmission and sequential submission to form a first-level fault tolerance layer.
[0062] Understandably, when a slight degradation occurs in the link, the system first uses on-chip RAM to buffer unacknowledged and unsent packets, and maintains regular retransmission and sequential submission through an ACK-driven online transmission window. This stage constitutes the first-level fault tolerance layer of DIA, whose goal is to prioritize preserving real-time transmission capabilities and absorbing short-term network fluctuations without immediately enabling Flash.
[0063] Step S40: If the current working mode is offline storage mode, then the sensor data with the timestamp attached is stored in the offline cache of the non-volatile Flash memory.
[0064] The step of storing the sensor data with the timestamp appended into the offline cache in the non-volatile Flash memory specifically includes: The incomplete data of messages that have been sent in the online transmission buffer but have not received confirmation from the server will be transferred to the non-volatile Flash memory; After the incomplete data transfer is completed, the newly acquired sensor data is stored in the Flash dedicated write buffer. When the Flash dedicated write buffer is full, a one-time batch page write operation is performed on the data accumulated in the Flash dedicated write buffer.
[0065] In this embodiment, the offline cache storage operation first transfers incomplete data that has been sent in the online transmission buffer but has not yet received a server acknowledgment message to the non-volatile Flash memory to prevent the incomplete data from being overwritten or discarded due to the saturation of the online transmission buffer during continuous link degradation. After the incomplete data transfer is completed, the newly acquired sensor data is stored in the Flash dedicated write buffer. After the Flash dedicated write buffer is full, a one-time batch page write operation is performed on the data accumulated in the Flash dedicated write buffer to reduce the frequency of erasing and writing to the non-volatile Flash memory.
[0066] Understandably, the switch from offline storage to real-time transmission employs a parallel, step-by-step recovery verification process. While the algorithm runs in offline storage mode, it continuously monitors the network and system status in parallel. Only after all core indicators have fully recovered and the network remains healthy for a certain period does it switch back to real-time transmission mode, avoiding frequent mode switching due to network instability. Parallel verification includes physical or protocol layer verification, transport layer verification, and link quality verification. Physical or protocol layer verification sequentially checks the validity of the Wi-Fi connection and the integrity of the MQTT connection. Only after both connections are stably established does it proceed to subsequent performance indicator verification.
[0067] During transport layer verification, the algorithm sequentially checks the idle state of the transport layer queue buffer and the idle state of the pending acknowledgment transmission window to confirm that the transport layer has no backlog and is capable of carrying real-time data transmission. Specifically, the recovery condition for the transport layer queue buffer is that the backlog amount is lower than the fifth threshold Qmin, and the recovery condition for the pending acknowledgment transmission window is that the size of the pending acknowledgment transmission window is lower than the sixth threshold Wmin.
[0068] Link quality verification simultaneously monitors and evaluates whether the smoothed round-trip delay has recovered to the normal threshold and whether the pending payload is in a low-load range, thereby confirming that the link transmission performance meets the low-latency requirements for real-time monitoring. Specifically, the recovery condition for the smoothed round-trip delay is that the smoothed round-trip delay value is lower than the seventh threshold T_t recovery value for 10 consecutive sampling periods, and the recovery condition for the number of pending payload bytes is that the number of pending payload bytes is lower than the eighth threshold Smin for 10 consecutive sampling periods. When all the above core indicators meet the threshold conditions, the algorithm introduces a duration threshold. When all core indicators remain in a healthy state within a preset observation window, the algorithm completes a step-by-step state confirmation, seamlessly switches back to real-time transmission mode, and resumes the real-time transmission process of sensor data.
[0069] Step S50: When the wireless network is restored and the restoration conditions are met, switch back from the offline storage mode to the real-time transmission mode, read the offline cached historical data from the Flash memory in the recording order, upload the historical data and the timestamp to the server, and the server reorders the historical data and the newly collected sensor data after restoring the real-time transmission mode according to the timestamp to generate a complete and continuous time series dataset.
[0070] Specifically, historical data cached offline is read from the non-volatile Flash memory in the order of recording, and the historical data is uploaded to the server in the order of the timestamps. The server then sorts the historical data and the newly collected sensor data after restoring the real-time transmission mode according to the timestamps to reconstruct a complete time-series dataset.
[0071] Therefore, even if a prolonged network interruption occurs during the data acquisition process, a relatively complete and temporally continuous sensor data sequence can still be recovered in the subsequent analysis stage, meeting the requirements for high-fidelity offline analysis. The timestamp alignment recovery mechanism sequentially retransmits the offline cached data during the playback stage and uses the built-in timestamps in the data packets to complete the time-series reconstruction at the receiving end, thereby improving the integrity and temporal continuity of the dataset under network interruption and link jitter conditions.
[0072] The effectiveness of the data flow integrity control method for wireless wearable sensors proposed in this invention will be demonstrated through a specific test process: To evaluate the network roaming performance and data transmission stability of the proposed system in dynamic mobile scenarios, this invention designed and conducted field experiments. The experiments focused on analyzing the continuity and reliability of the data link and the effectiveness of the offline compensation mechanism during the movement of wearable sensors between wireless access points (APs) under conditions of concurrent data transmission by multiple wearable sensor nodes.
[0073] The system consists of terminal data acquisition nodes, a wireless access network, and an edge computing / server. All IMU nodes connect to the access points (APs) via Wi-Fi and communicate with the server through a gateway. Experiments were conducted outdoors or in open environments, with two wireless access points, AP_A and AP_B, deployed 20 meters apart. To simulate real-world wearable applications, multiple wearable sensor nodes were placed in the left and right pockets of the tester's trousers to reflect the impact of human occlusion and posture changes on the wireless signal. During the experiment, the tester carried all the node devices and: 1. started from access point AP_A; 2. walked to access point AP_B at approximately a constant speed; 3. immediately returned to AP_A upon arrival; 4. completed one round trip. In a single experiment, the tester performed three round-trip cycles (three times in total) to increase the probability of roaming handover triggering and the amount of data sampled. While maintaining a fixed distance of 20m, three different sets of wearable sensor nodes were set with 3, 6, and 9 nodes respectively.
[0074] like Figure 4 and Figure 5 As shown, the experimental results, after being reordered and integrated from offline uploads and online data, achieved a 100% completeness rate. Under different node numbers, the online rates of each sensor node varied significantly, but the system consistently achieved complete data storage. Overall, the node online rates were relatively close under N=3 and N=6 conditions, with average online rates of 70.7% and 72.3%, respectively. When the number of nodes increased to N=9, the average online rate dropped to 62.3%, indicating that increased node concurrency can impact the stability of the real-time wireless link. Regarding individual node differences, even under the same experimental conditions, the online rates of different IMU nodes fluctuated considerably. For example, under N=6 conditions, the highest online rate reached 86.5%, while the lowest was 58.4%; under N=9 conditions, the highest online rate was 82.9%, while the lowest was only 39.4%.
[0075] The offline periods of the sensors and the number of online nodes in the system are also dynamic. Figure 4 and Figure 5 In the graph, white represents the online period of a node, black represents the offline period, and the broken line below represents the number of online nodes at any given time. This graph more intuitively reflects the temporal distribution characteristics of link interruptions during roaming. It can be observed that node offline events are not randomly and uniformly distributed, but rather exhibit a clear temporal clustering phenomenon. Under the conditions of N=3, N=6, and N=9, offline periods all occur concentratedly within certain time periods, which may correspond to the tester moving in the edge area of AP coverage or during AP roaming handover. Compared to simply counting the number of disconnections, this time series graph can further reveal the duration of disconnections and the synchronicity of disconnections among different nodes.
[0076] It is worth noting that, theoretically, there should have been 6 AP handover opportunities during the three round trips in this experiment. However, according to the graph, only 3 main offline clusters were observed in the online state, suggesting that not every AP handover will lead to an observable data link interruption. This phenomenon may be related to AP coverage overlap, terminal roaming thresholds, human occlusion directionality, and the online state determination timeout mechanism.
[0077] The beneficial effects of this invention are as follows: 1. This invention proposes a RAM-Flash dual-layer storage architecture driven by a downlink hierarchical triggering process and an uplink parallel tiered verification process, designed for resource-constrained wearable sensor nodes. Compared with traditional single-layer caching schemes that rely solely on on-chip RAM, this architecture can extend the system's fault-tolerant caching capability from short-term caching to long-term continuous caching while ensuring real-time transmission capabilities. This alleviates the resource conflict between real-time monitoring and long-term stable data acquisition, and keeps memory overhead within the system's acceptable range.
[0078] 2. This invention proposes a hierarchical fault-tolerant caching strategy that manages downlink hierarchical triggering and uplink parallel step-by-step verification processes. Using smooth PUBACK latency, the size of the pending response window, queue buffer backlog, and the number of bytes of pending payload as core criteria, it achieves multi-level congestion assessment and adaptive data stream switching for dynamic wireless environments. This strategy suppresses false triggering caused by instantaneous fluctuations through asymmetric thresholds and persistent assessments, activating Flash caching only when the link is confirmed to be continuously deteriorating, thus balancing real-time low-latency transmission with long-term data integrity assurance.
[0079] 3. This invention designs a post-acquisition timestamp alignment and recovery mechanism embedded in the DIA framework. This mechanism sequentially resends offline cached data during the playback stage and uses the built-in timestamps of data packets to complete time-series reconstruction at the receiving end. This improves the integrity and timeline continuity of the dataset under network interruption and link jitter conditions, meeting the needs of subsequent high-fidelity offline analysis.
[0080] Furthermore, such as Figure 6 As shown, based on the above-described data flow integrity control method for wireless wearable sensors, the present invention also provides a data flow integrity control system for wireless wearable sensors, wherein the data flow integrity control system for wireless wearable sensors includes: Data acquisition module 51 is used to acquire sensor data from the wireless wearable sensor at a fixed sampling frequency and to add a timestamp to the sensor data; The working mode determination module 52 is used to monitor the wireless network status of sensor data with the timestamp attached in real time based on the downlink hierarchical triggering process and the uplink parallel step-by-step verification process, and determine the current working mode according to the monitoring results; wherein, the downlink hierarchical triggering process and the uplink parallel step-by-step verification process both adopt a multi-dimensional, independent and asymmetric hysteresis threshold system, and independently set downlink triggering threshold and uplink recovery threshold for multiple core indicators of the transmission layer, wherein the downlink triggering threshold is greater than the uplink recovery threshold, forming an asymmetric hysteresis interval; The sending confirmation module 53 is used to store the sensor data with the timestamp attached into the online sending buffer of RAM and send it to the server if the current working mode is real-time transmission mode. After receiving the confirmation message returned by the server, the corresponding data is released from the online sending buffer. The offline cache module 54 is used to store the sensor data with the timestamp attached into the offline cache in the non-volatile Flash memory if the current working mode is the offline storage mode. The reconstruction output module 55 is used to switch from the offline storage mode back to the real-time transmission mode when the wireless network is restored and the restoration conditions are met. It reads the historical data cached offline from the Flash memory in the order of recording, uploads the historical data and the timestamp to the server, and the server reorders the historical data and the newly collected sensor data after the restoration of the real-time transmission mode according to the timestamp to generate a complete and continuous time series dataset.
[0081] Furthermore, such as Figure 7 As shown, based on the above-described data flow integrity control method and system for wireless wearable sensors, the present invention also provides a terminal, which includes a processor 10, a memory 20, and a display 30. Figure 7 Only some of the terminal components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0082] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory. In other embodiments, the memory 20 may be an external storage device of the terminal, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Further, the memory 20 may include both internal and external storage devices. The memory 20 is used to store application software and various types of data installed on the terminal, such as program code installed on the terminal. The memory 20 can also be used to temporarily store data that has been output or will be output. In one embodiment, the memory 20 stores a data flow integrity control program 40 for a wireless wearable sensor, which can be executed by the processor 10 to implement the data flow integrity control method for a wireless wearable sensor described in this application.
[0083] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code stored in the memory 20 or process data, such as executing the data flow integrity control method for wireless wearable sensors.
[0084] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 30 is used to display information on the terminal and to display a visual user interface. The components of the terminal communicate with each other via a system bus.
[0085] In one embodiment, when the processor 10 executes the data flow integrity control program 40 for the wireless wearable sensor in the memory 20, the following steps are performed: Sensor data is collected from a wireless wearable sensor at a fixed sampling frequency, and a timestamp is appended to the sensor data; Based on the downlink hierarchical triggering process and the uplink parallel step-by-step verification process, the wireless network status of the sensor data with the timestamp attached is monitored in real time, and the current working mode is determined according to the monitoring results. The downlink hierarchical triggering process and the uplink parallel step-by-step verification process both adopt a multi-dimensional, independent and asymmetric hysteresis threshold system. Downlink triggering thresholds and uplink recovery thresholds are set independently for multiple core indicators of the transmission layer. The downlink triggering threshold is greater than the uplink recovery threshold, forming an asymmetric hysteresis interval. If the current working mode is real-time transmission mode, the sensor data with the timestamp attached is stored in the online transmission buffer of RAM and sent to the server. After receiving the confirmation message returned by the server, the corresponding data is released from the online transmission buffer. If the current working mode is offline storage mode, the sensor data with the timestamp attached will be stored in the offline cache of the non-volatile Flash memory. When the wireless network is restored and the restoration conditions are met, the system switches back from the offline storage mode to the real-time transmission mode. Historical data cached offline is read from the Flash memory in the order of recording. The historical data and the timestamp are uploaded to the server. The server then reorders the historical data and the newly collected sensor data after the restoration of the real-time transmission mode according to the timestamp to generate a complete and continuous time-series dataset.
[0086] The downlink hierarchical triggering process and the uplink parallel step-by-step verification process both adopt a multi-dimensional, independent and asymmetric hysteresis threshold system. Downlink triggering thresholds and uplink recovery thresholds are set independently for multiple core indicators of the transmission layer. The downlink triggering threshold is greater than the uplink recovery threshold, forming an asymmetric hysteresis interval. The downlink graded triggering process is used to trigger a graded switch to the offline storage mode based on the monitoring results of normal, mild degradation, continuous congestion or interruption in the real-time transmission mode. The uplink parallel step-by-step verification process is used to monitor multiple core indicators in parallel under the offline storage mode. When all core indicators continuously meet the recovery preset threshold within the preset observation window, the switch from the offline storage mode to the real-time transmission mode is triggered.
[0087] The downlink hierarchical triggering process specifically includes: When the monitoring result is interrupted, the offline saving mode is triggered, and the newly collected sensor data is transferred to the Flash memory for storage; When the monitoring result is continuous congestion, and the backlog of the transport layer queue buffer exceeds the first preset threshold or the size of the pending response window exceeds the second preset threshold, data stream redirection is triggered, switching the newly acquired sensor data from the RAM transmission path to the Flash memory storage path. When the monitoring result is continuous congestion, and the smooth round-trip delay exceeds the third preset threshold or the number of bytes of pending payload exceeds the fourth preset threshold in multiple consecutive sampling periods, the hysteresis control mechanism is triggered and the system switches to the offline storage mode.
[0088] The uplink parallel step-by-step verification process specifically includes: Verify that the Wi-Fi connection is valid and the MQTT connection is complete; Verify whether the backlog of the transport layer queue buffer is lower than the fifth preset threshold and whether the size of the pending response window is lower than the sixth preset threshold. Verify whether the smooth round-trip delay is lower than the seventh preset threshold recovery value within multiple consecutive sampling periods and whether the number of bytes of payload to be sent is lower than the eighth preset threshold within multiple consecutive sampling periods; When the Wi-Fi connection is valid and the MQTT connection is complete for a preset duration of a preset threshold, and the backlog of the transport layer queue buffer is lower than a fifth preset threshold and the size of the pending response window is lower than a sixth preset threshold for a preset duration of a preset threshold, and the smooth round-trip delay is lower than a seventh preset threshold recovery value for multiple consecutive sampling periods and the number of pending payload bytes is lower than an eighth preset threshold for multiple consecutive sampling periods, the wireless wearable sensor is determined to meet the recovery conditions, and switches from the offline storage mode back to the real-time transmission mode.
[0089] Wherein, the first preset threshold and the fifth preset threshold constitute the first asymmetric hysteresis interval between downlink triggering and uplink recovery, and the first preset threshold is greater than the fifth preset threshold; The second preset threshold and the sixth preset threshold constitute a second asymmetric hysteresis interval, wherein the second preset threshold is greater than the sixth preset threshold; The fourth preset threshold and the eighth preset threshold constitute a third asymmetric hysteresis interval, and the fourth preset threshold is greater than the eighth preset threshold. The recovery values of the third preset threshold and the seventh preset threshold are equal. In the downlink graded triggering process, the smooth round-trip delay exceeds the third preset threshold in multiple consecutive sampling periods. In the uplink parallel step-by-step verification process, the smooth round-trip delay is lower than the seventh preset threshold in multiple consecutive sampling periods.
[0090] The step of storing the sensor data with the timestamp appended into the online transmission buffer of RAM and sending it to the server further includes: When the monitoring result is mild degradation, the online transmission buffer in RAM is used to cache the unsent messages and unacknowledged messages, and the online transmission window driven by ACK is used to maintain retransmission and sequential submission to form a first-level fault tolerance layer.
[0091] Specifically, storing the sensor data with the timestamp appended into an offline cache in a non-volatile Flash memory includes: The incomplete data of messages that have been sent in the online transmission buffer but have not received confirmation from the server will be transferred to the non-volatile Flash memory; After the incomplete data transfer is completed, the newly acquired sensor data is stored in the Flash dedicated write buffer. When the Flash dedicated write buffer is full, a one-time batch page write operation is performed on the data accumulated in the Flash dedicated write buffer.
[0092] The present invention also provides a computer-readable storage medium storing a data flow integrity control program for a wireless wearable sensor, wherein the data flow integrity control program for a wireless wearable sensor, when executed by a processor, implements the steps of the data flow integrity control method for a wireless wearable sensor as described above.
[0093] In summary, this invention provides a data flow integrity control method, system, terminal, and storage medium for wireless wearable sensors. The method includes: collecting sensor data from the wireless wearable sensor at a fixed sampling frequency and adding timestamps to the sensor data; monitoring the wireless network status of the timestamped sensor data in real time based on a downlink hierarchical triggering process and an uplink parallel step-by-step verification process, and determining the current working mode based on the monitoring results; if the current working mode is a real-time transmission mode, storing the timestamped sensor data in an online transmission buffer in RAM and sending it to a server, and releasing the corresponding data from the online transmission buffer after receiving an acknowledgment message from the server; if the current working mode is an offline storage mode, storing the timestamped sensor data in an offline cache in a non-volatile Flash memory; when the wireless network recovers and the recovery conditions are met, switching back from the offline storage mode to the real-time transmission mode, reading historical data from the Flash memory in the order of recording in the offline cache, uploading the historical data to the server in the order of timestamps for unified sorting, and receiving and outputting the complete time-series dataset returned by the server. This invention achieves zero-loss transmission of full-time-series datasets under random network instability conditions in sports biomechanics and wearable monitoring scenarios.
[0094] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.
[0095] Of course, those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided by this invention can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0096] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A data flow integrity control method for wireless wearable sensors, characterized in that, The data flow integrity control method for wireless wearable sensors includes: Sensor data is collected from a wireless wearable sensor at a fixed sampling frequency, and a timestamp is appended to the sensor data; Based on the downlink hierarchical triggering process and the uplink parallel step-by-step verification process, the wireless network status of the sensor data with the timestamp attached is monitored in real time, and the current working mode is determined according to the monitoring results. The downlink hierarchical triggering process and the uplink parallel step-by-step verification process both adopt a multi-dimensional, independent and asymmetric hysteresis threshold system. Downlink triggering thresholds and uplink recovery thresholds are set independently for multiple core indicators of the transmission layer. The downlink triggering threshold is greater than the uplink recovery threshold, forming an asymmetric hysteresis interval. If the current working mode is real-time transmission mode, the sensor data with the timestamp attached is stored in the online transmission buffer of RAM and sent to the server. After receiving the confirmation message returned by the server, the corresponding data is released from the online transmission buffer. If the current working mode is offline storage mode, the sensor data with the timestamp attached will be stored in the offline cache of the non-volatile Flash memory. When the wireless network is restored and the restoration conditions are met, the system switches back from the offline storage mode to the real-time transmission mode. Historical data cached offline is read from the Flash memory in the order of recording. The historical data and the timestamp are uploaded to the server. The server then reorders the historical data and the newly collected sensor data after the restoration of the real-time transmission mode according to the timestamp to generate a complete and continuous time-series dataset.
2. The data flow integrity control method for wireless wearable sensors according to claim 1, characterized in that, The downlink graded triggering process is used to trigger a graded switch to the offline storage mode based on the monitoring results of normal, mild degradation, continuous congestion or interruption in the real-time transmission mode. The uplink parallel step-by-step verification process is used to monitor multiple core indicators in parallel under the offline storage mode. When all core indicators continuously meet the recovery preset threshold within the preset observation window, the switch from the offline storage mode to the real-time transmission mode is triggered.
3. The data flow integrity control method for wireless wearable sensors according to claim 2, characterized in that, The downlink hierarchical triggering process specifically includes: When the monitoring result is interrupted, the offline saving mode is triggered, and the newly collected sensor data is transferred to the Flash memory for storage; When the monitoring result is continuous congestion, and the backlog of the transport layer queue buffer exceeds the first preset threshold or the size of the pending response window exceeds the second preset threshold, data stream redirection is triggered, switching the newly acquired sensor data from the RAM transmission path to the Flash memory storage path. When the monitoring result is continuous congestion, and the smooth round-trip delay exceeds the third preset threshold or the number of bytes of pending payload exceeds the fourth preset threshold in multiple consecutive sampling periods, the hysteresis control mechanism is triggered and the system switches to the offline storage mode.
4. The data flow integrity control method for wireless wearable sensors according to claim 3, characterized in that, The uplink parallel step-by-step verification process specifically includes: Verify that the Wi-Fi connection is valid and the MQTT connection is complete; Verify whether the backlog of the transport layer queue buffer is lower than the fifth preset threshold and whether the size of the pending response window is lower than the sixth preset threshold. Verify whether the smooth round-trip delay is lower than the seventh preset threshold recovery value within multiple consecutive sampling periods and whether the number of bytes of payload to be sent is lower than the eighth preset threshold within multiple consecutive sampling periods; When the Wi-Fi connection is valid and the MQTT connection is complete for a preset duration of a preset threshold, and the backlog of the transport layer queue buffer is lower than a fifth preset threshold and the size of the pending response window is lower than a sixth preset threshold for a preset duration of a preset threshold, and the smooth round-trip delay is lower than a seventh preset threshold recovery value for multiple consecutive sampling periods and the number of pending payload bytes is lower than an eighth preset threshold for multiple consecutive sampling periods, the wireless wearable sensor is determined to meet the recovery conditions, and switches from the offline storage mode back to the real-time transmission mode.
5. The data flow integrity control method for wireless wearable sensors according to claim 4, characterized in that, The first preset threshold and the fifth preset threshold constitute a first asymmetric hysteresis interval between downlink triggering and uplink recovery, and the first preset threshold is greater than the fifth preset threshold. The second preset threshold and the sixth preset threshold constitute a second asymmetric hysteresis interval, wherein the second preset threshold is greater than the sixth preset threshold; The fourth preset threshold and the eighth preset threshold constitute a third asymmetric hysteresis interval, and the fourth preset threshold is greater than the eighth preset threshold. The recovery values of the third preset threshold and the seventh preset threshold are equal. In the downlink graded triggering process, the smooth round-trip delay exceeds the third preset threshold in multiple consecutive sampling periods. In the uplink parallel step-by-step verification process, the smooth round-trip delay is lower than the seventh preset threshold in multiple consecutive sampling periods.
6. The data flow integrity control method for wireless wearable sensors according to claim 1, characterized in that, The process of storing the sensor data with the timestamp appended into the online transmission buffer of RAM and sending it to the server further includes: When the monitoring result is mild degradation, the online transmission buffer in RAM is used to cache the unsent messages and unacknowledged messages, and the online transmission window driven by ACK is used to maintain retransmission and sequential submission to form a first-level fault tolerance layer.
7. The data flow integrity control method for wireless wearable sensors according to claim 1, characterized in that, The step of storing the sensor data with the timestamp appended into the offline cache in the non-volatile Flash memory specifically includes: The incomplete data of messages that have been sent in the online transmission buffer but have not received confirmation from the server will be transferred to the non-volatile Flash memory; After the incomplete data transfer is completed, the newly acquired sensor data is stored in the Flash dedicated write buffer. When the Flash dedicated write buffer is full, a one-time batch page write operation is performed on the data accumulated in the Flash dedicated write buffer.
8. A data flow integrity control system for wireless wearable sensors, characterized in that, The data flow integrity control system for wireless wearable sensors includes: The data acquisition module is used to acquire sensor data from the wireless wearable sensor at a fixed sampling frequency and to add a timestamp to the sensor data; The working mode determination module is used to monitor the wireless network status of sensor data with the timestamp attached in real time based on the downlink hierarchical triggering process and the uplink parallel step-by-step verification process, and determine the current working mode based on the monitoring results. The downlink hierarchical triggering process and the uplink parallel step-by-step verification process both adopt a multi-dimensional, independent and asymmetric hysteresis threshold system. Downlink triggering thresholds and uplink recovery thresholds are set independently for multiple core indicators of the transmission layer. The downlink triggering threshold is greater than the uplink recovery threshold, forming an asymmetric hysteresis interval. The sending confirmation module is used to store the sensor data with the timestamp attached into the online sending buffer of RAM and send it to the server if the current working mode is real-time transmission mode. After receiving the confirmation message returned by the server, the corresponding data is released from the online sending buffer. An offline caching module is used to store the sensor data with the timestamp attached into an offline cache in a non-volatile Flash memory if the current working mode is offline storage mode. The reconstruction output module is used to switch from the offline storage mode back to the real-time transmission mode when the wireless network is restored and the restoration conditions are met. It reads the offline cached historical data from the Flash memory in the order of recording, uploads the historical data and the timestamp to the server, and the server reorders the historical data and the newly collected sensor data after the restoration of the real-time transmission mode according to the timestamp to generate a complete and continuous time series dataset.
9. A terminal, characterized in that, The terminal includes: a memory, a processor, and a data flow integrity control program for a wireless wearable sensor stored in the memory and executable on the processor. When the data flow integrity control program for a wireless wearable sensor is executed by the processor, it implements the steps of the data flow integrity control method for a wireless wearable sensor as described in any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a data flow integrity control program for a wireless wearable sensor, which, when executed by a processor, implements the steps of the data flow integrity control method for a wireless wearable sensor as described in any one of claims 1-7.