Multi-sensor data transmission method in embedded device

By using a global data channel and lightweight process design, the problems of high resource consumption, low efficiency and insufficient reliability of multi-sensor data transmission in embedded devices are solved, achieving efficient and reliable data transmission and meeting the usage requirements of embedded devices in complex application scenarios.

CN121386572AActive Publication Date: 2026-01-23RESIDE (SHANGHAI) INFORMATION TECHNOLOGY CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202511934960.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-22
Publication Date
2026-01-23
Estimated Expiration
2045-12-22

AI Technical Summary

Technical Problem

Existing multi-sensor data transmission solutions in embedded devices suffer from high hardware resource consumption, low transmission efficiency, poor real-time performance, and insufficient data reliability, especially in high-frequency acquisition scenarios where they fail to meet the stability requirements of embedded devices.

Method used

By adopting a global data channel instead of an independent physical channel, combined with a lightweight process design, and through non-blocking transmission mode, unified data format, checksum verification and buffer overflow protection, the orderly transmission and efficient verification of multi-sensor data are achieved.

Benefits of technology

It reduces hardware resource consumption, improves transmission efficiency and real-time performance, enhances the reliability and stability of data transmission, and adapts to the resource-constrained characteristics of embedded devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121386572A_ABST
    Figure CN121386572A_ABST
Patent Text Reader

Abstract

The invention provides a multi-sensor data transmission method in embedded equipment, which comprises the following steps: when a system layer of the embedded equipment is initialized, creating a global data channel and a lightweight process corresponding to each sensor, and constructing a channel basic information structural body, a lightweight process binding structural body and a data transmission control structural body; filling the lightweight process binding structural body with a channel unique identifier and a process identifier, and establishing one-way association with the channel basic information structural body; each sensor collects data according to a preset period, the data is packaged into a data block in a uniform format by a corresponding lightweight process, and a check code is calculated and updated to the data transmission control structure body; the lightweight process transmits the data blocks to a buffer area bound with the data transmission control structure body through a global data channel according to a non-blocking mode, the master control lightweight process reads the data blocks from the buffer area, if the data blocks pass verification, the data blocks are classified, if the data blocks fail to be verified, retransmission is triggered, and if the data blocks fail to be verified, the data blocks are sent to the data transmission control structure body. The technical problems of high resource occupation and the like are solved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of embedded devices, in particular to a multi-sensor data transmission method in an embedded device. BACKGROUND

[0002] Embedded devices are widely used in industrial automation, intelligent monitoring, Internet of Things terminals and other fields. Such devices usually need to integrate multiple sensors such as temperature, humidity, pressure, and position to collect environmental parameters or device operating state data in real time. The efficient transmission and reliable reception of data directly affect the control decision accuracy and operation stability of embedded devices. With the increasing demand for data collection frequency and the number of sensors in application scenarios, resource occupancy, real-time performance, and integrity of multi-sensor data transmission have become key technical requirements.

[0003] In existing multi-sensor data transmission schemes, a typical implementation is to assign each sensor an independent physical transmission channel, use a blocking transmission mechanism, and send the collected data directly to the processing unit in raw format. During transmission, the next frame of data cannot be transmitted until the previous frame of data is completely received, and there is no unified data verification and format specification.

[0004] In this existing scheme, the configuration of independent physical channels results in high system hardware resource occupancy, and channel competition conflicts may occur when multiple sensors transmit data simultaneously. The blocking transmission mode makes the data transmission inefficient, resulting in significant transmission delay in high-frequency collection scenarios, which cannot meet the real-time requirements. The lack of unified data format and verification mechanism makes different sensor data formats incompatible, and data errors or losses caused by interference during transmission cannot be identified, reducing the reliability of data transmission and making it difficult to adapt to application scenarios with limited resources and high transmission stability requirements in embedded devices. SUMMARY

[0005] To solve the above technical problems, the present application provides a multi-sensor data transmission method in an embedded device to at least alleviate the above technical problems.

[0006] The technical scheme provided by the embodiments of the present application is as follows: A multi-sensor data transmission method in an embedded device, comprising: Step 1, when the system layer of the embedded device is initialized, create a global data channel and a lightweight process corresponding to each sensor, and construct a channel basic information structure body, a lightweight process binding structure body, and a data transmission control structure body; Step 2, fill in the channel unique identifier and process identifier in the lightweight process binding structure body and establish a one-way association with the channel basic information structure body; Step 3, each sensor collects data at a preset period, and the corresponding lightweight process encapsulates the data block into a unified format, calculates the check code, and updates to the data transmission control structure; Step 4, the lightweight process transmits the data block to the buffer bound with the data transmission control structure through the global data channel in a non-blocking mode, the master lightweight process reads the data block from the buffer, and if the data block passes the check, it is classified and processed, otherwise, retransmission is triggered.

[0007] Optionally, step 1 includes: Step 11, create a global data channel, allocate a unique channel identifier through the created channel basic information structure, set the channel type as a data channel, and set the initial running state as idle, the unique channel identifier is used for the associated binding of the lightweight process; Step 12, create a lightweight process for each sensor and allocate a unique process identifier, initialize the created lightweight process binding structure, and associate the unique process identifier with the unique channel identifier; Step 13, create a data transmission control structure and bind the global data channel, configure the buffer address and the preset buffer size, initialize the transmission progress marker as not started and the check code as 0, and the global data channel bound with the data transmission control structure will synchronize the transmission state.

[0008] Optionally, step 13 includes: Step 131, query the embedded device storage resource, allocate a dedicated buffer and record the starting address and storage capacity, and the dedicated buffer is used as the buffer bound with the created data transmission control structure; Step 132, write the buffer address and the preset buffer size into the corresponding fields of the data transmission control structure; Step 133, initialize the transmission progress marker as not started, assign the check code field as 0, and establish a bidirectional association between the data transmission control structure and the channel basic information structure for transmission state synchronization feedback.

[0009] Optionally, step 2 includes: Step 21, fill in the associated channel identifier in the channel basic information structure and the unique process identifier of the corresponding lightweight process in each lightweight process binding structure, and set the read-write permission marker as write-only; Step 22, the system layer checks the uniqueness of the associated information in each lightweight process binding structure to avoid channel conflicts, and the uniqueness check allows data directional transmission; Step 23, establish a one-way association between the lightweight process binding structure and the channel basic information structure, update the number of associated lightweight processes in the channel basic information structure to the total number of sensors, and change the running state to occupied, the occupied state of the channel basic information structure will allow data to be written.

[0010] Optionally, step 22 comprises: Step 221, the system layer traverses all lightweight process binding structures to extract the combination information of the associated channel identifier and the process identifier; Step 222, the combination information is subjected to uniqueness verification to avoid channel association conflicts, and if there is a repetition, a binding failure alarm is triggered; Step 223, after the verification, the association relationship mapping table of each lightweight process binding structure is recorded, which will be used for transmission state query and verification.

[0011] Optionally, step 3 comprises: Step 31, each sensor collects environmental or state data at a preset period to form raw data, and transmits the raw data to the corresponding lightweight process; Step 32, the lightweight process calls a data encapsulation interface to integrate the raw data, the sensor number, and the collection timestamp, and encapsulates them into a data block in a unified format according to the data transmission control structure field requirements; Step 33, the checksum of the data block is calculated, and the checksum and the data length are updated to the corresponding fields of the data transmission control structure.

[0012] Optionally, step 32 comprises: Step 321, the sensor number is associated with the unique process identifier of the corresponding lightweight process for unique traceability of the data block; Step 322, a system time is obtained to generate a collection timestamp, and the raw data is sorted and combined in a preset format; Step 323, the raw data after sorting and combining is added with a data block header identifier and a tail verification field placeholder to form a data block in a unified format.

[0013] Optionally, step 4 comprises: Step 41, each lightweight process initiates a transmission request to the global data channel based on the association relationship between the lightweight process binding structure and the global data channel; Step 42, in response to the transmission request, the channel basic information structure body feeds back the real-time state of the buffer through the bidirectional association with the data transmission control structure, and if the buffer is not full, the lightweight process writes the data block in a non-blocking mode, updates the transmission progress marker to transmission in progress, and marks it as transmission complete after the transmission is completed. The transmission progress marker will be synchronized to the channel basic information structure body; Step 43, the master lightweight process reads the data block from the buffer after detecting the transmission completion mark, verifies the integrity through the check code in the data transmission control structure, and if the verification is passed, classifies and processes according to the sensor type, and if the verification fails, triggers the corresponding lightweight process to retransmit, and the system layer monitors the buffer occupancy rate and the transmission state.

[0014] Optionally, step 43 comprises: Step 431, after the master lightweight process reads the data block, the check code is calculated and compared with the check code recorded in the data transmission control structure; Step 432, if the check is consistent, the original data, sensor number and timestamp are extracted from the data block, and classified and arranged according to the sensor type; Step 433, the system layer queries the buffer occupancy rate in real time, and when the preset threshold is reached, it notifies each lightweight process to suspend transmission, and if the verification fails, it marks the data block as abnormal and triggers an interruption, and notifies the corresponding lightweight process to retransmit, and the suspension of transmission and retransmission will respectively avoid buffer overflow and data loss.

[0015] The technical scheme provided by the application has the following technical advantages: In the system initialization phase, a global data channel is created to replace the traditional independent physical channel, combined with the corresponding lightweight process of each sensor, the occupancy of channel resources is reduced, and the channel basic information structure, lightweight process binding structure and data transmission control structure are constructed, providing a standardized management framework for data transmission. The channel basic information structure realizes the precise association of the lightweight process and the global data channel by allocating a unique channel identifier; the lightweight process binding structure establishes an exclusive association between each sensor process and the channel, avoiding channel conflicts during multi-sensor transmission; and the data transmission control structure binds the global data channel and configures buffer parameters, providing a unified interface for data storage and transmission state monitoring. Compared with the decentralized management of the traditional scheme, this structured design improves the utilization efficiency of system resources.

[0016] By filling in the channel unique identifier and process identifier in the lightweight process binding structure and establishing a one-way association, the directional binding relationship between the process and the channel is further strengthened. The uniqueness verification of the association information by the system layer ensures that each lightweight process can only write data through the global data channel, avoiding channel competition conflicts caused by simultaneous transmission of multiple processes, so that data can be transmitted in a predetermined path, improving the orderliness of transmission. The record of the association relationship mapping table provides a basis for subsequent transmission state query and verification, facilitating quick positioning of the process and channel of transmission exception, reducing the difficulty of troubleshooting.

[0017] The raw data collected by each sensor is packaged into a data block in a unified format by the corresponding lightweight process, integrating the raw data, sensor number and collection timestamp, solving the problem of incompatible data formats of different sensors in traditional solutions, enabling the host process to quickly classify and process the data. The calculation and update of the check code to the data transmission control structure provide a basis for data integrity verification. By comparing the check code, data errors or losses caused by interference during transmission can be effectively identified, improving the reliability of data transmission compared to traditional transmission without verification. The association between the sensor number and the process identifier ensures the unique traceability of the data block, making it easy to trace the source of the data for subsequent analysis of data anomalies.

[0018] The adopted non-blocking transmission mode is different from the traditional blocking transmission. The lightweight process does not need to wait for the completion of the previous data transmission to initiate a new transmission request. The channel basic information structure body feeds back the buffer state through the bidirectional association with the data transmission control structure. When the buffer is not full, the data block can be written, significantly reducing the transmission delay and improving the real-time performance in high-frequency collection scenarios. The host lightweight process verifies and classifies the data block, ensuring that only complete and valid data can enter the subsequent processing flow. When the verification fails, retransmission is triggered to avoid data loss. The system layer monitors the buffer occupancy rate and notifies the process to pause transmission when the preset threshold is reached, effectively avoiding data loss caused by buffer overflow. Compared to the traditional design that lacks overflow protection, the transmission stability is further improved.

[0019] Optionally, in step 13, the allocation of the dedicated buffer and the establishment of the bidirectional association enable real-time synchronization of the transmission state, improving the accuracy of state monitoring. The uniqueness verification and alarm mechanism in step 22 can timely discover and handle association conflicts, ensuring the stable startup of the transmission system. The design of the data block header identifier and tail verification field placeholder in step 32 further standardizes the data format, facilitating fast parsing by the host process. The check code comparison and abnormality marking in step 43 enable accurate positioning of data errors and trigger retransmission, while the pause transmission mechanism avoids buffer overflow, providing multiple safeguards to improve the integrity and reliability of data transmission. BRIEF DESCRIPTION OF DRAWINGS

[0020] Figure 1 The present application provides a multi-sensor data transmission method in an embedded device.

[0021] Figure 2 The present application provides a multi-sensor data transmission device in an embedded device.

[0022] Figure 3 The present application provides an electronic device. DETAILED DESCRIPTION

[0023] As Figure 1 shown, the embodiment of the present application provides a multi-sensor data transmission method in an embedded device, comprising: Step 1, when the embedded device system layer is initialized, a global data channel and a lightweight process corresponding to each sensor are created, and a channel basic information structure body, a lightweight process binding structure body and a data transmission control structure body are constructed; Step 2, fill in the channel unique identifier and process identifier in the lightweight process binding structure body and establish a one-way association with the channel basic information structure body; Step 3, each sensor collects data at a preset period, encapsulates the data into a uniform format data block by the corresponding lightweight process, calculates a check code and updates it to the data transmission control structure body; Step 4, the lightweight process transmits the data block to the buffer area bound with the data transmission control structure body through the global data channel in a non-blocking mode, the master lightweight process reads the data block from the buffer area, if the data block passes the check, it is classified and processed, if it fails, it triggers retransmission.

[0024] Compared with the traditional multi-sensor data transmission scheme, the technical advantages of the present application are reflected in three core aspects: in terms of resource occupation, the global data channel replaces the independent physical channel, combined with the lightweight process design, the hardware resource occupation rate is reduced, which is suitable for the characteristics of limited resources of embedded devices; in terms of transmission efficiency, the non-blocking transmission mode and the real-time feedback of the buffer area state reduce the transmission delay and improve the real-time performance in high-frequency acquisition scenarios; in terms of data reliability, the unified data format, check code verification, retransmission mechanism and buffer overflow protection reduce the probability of data errors and loss in all aspects, and the transmission stability is higher than that of the traditional scheme. Overall, the technical scheme of the present application realizes efficient, reliable and orderly multi-sensor data transmission through structured design and standardized process, and can better meet the use requirements of embedded devices in complex application scenarios.

[0025] In the embodiments of the present application, the lightweight process refers to a process that relies on the embedded device system kernel or main process scheduling, has extremely small resource occupation (such as occupying only tens of KB of memory and low CPU usage) and has a single focused function, for example, a dedicated process corresponding to a certain temperature sensor, which is only responsible for receiving sensor raw data at a preset period, performing simple format packaging and basic verification, and does not undertake complex calculation or overall task, which meets the core characteristics of "lightweight". The main control lightweight process is an "overall management process" in the lightweight process, which also has lightweight attributes (no redundant function, low resource consumption), but focuses on global coordination, for example, is responsible for listening to the buffer state, reading the data block transmitted by each sensor lightweight process, performing integrity verification, classifying and arranging data according to the sensor type, and triggering the lightweight process of the corresponding sensor to retransmit when the verification fails. It is a "management-execution" cooperative relationship with other lightweight processes - both belong to the category of lightweight processes, the former focuses on overall scheduling and core processing, and the latter focuses on single sensor data acquisition, packaging and transmission execution, and together completes the whole process of multi-sensor data transmission.

[0026] Optionally, step 1 comprises: Step 11, creating a global data channel, assigning a unique channel identifier through the created channel basic information structure, setting the channel type as a data channel, and setting the initial running state as idle, the unique channel identifier being used for the association binding of the lightweight process; Step 12, creating a lightweight process for each sensor and assigning a unique process identifier, initializing the created lightweight process binding structure, and associating the unique process identifier with the unique channel identifier; Step 13, creating a data transmission control structure and binding the global data channel, configuring the buffer address and the preset buffer size, initializing the transmission progress marker as not started and the verification code as 0, and synchronizing the transmission state of the global data channel bound by the data transmission control structure.

[0027] In the present application, step 1 realizes the dynamic adaptive creation of the global data channel and the on-demand accurate initialization of the lightweight process, which is different from the traditional fixed parameter channel and process design. By configuring the core parameters of the global data channel that can be dynamically adjusted, designing the structured identifier generation rule, and matching the initialization configuration of the sensor characteristics for the lightweight process, efficient utilization of channel resources and lightweight operation of the process are realized, which lays a foundation for subsequent orderly transmission of multi-sensor data. This design not only adapts to the characteristics of limited resources of embedded devices, but also guarantees the accuracy and reliability of the process and channel binding through the standardized identification system and association mechanism.

[0028] Preferably, the specific implementation process of step 11 is as follows: taking the system resource information of the embedded device, the total number of sensors and the preset channel configuration rule as the processing object, performing three core operations of global data channel creation, channel basic information structure construction and unique channel identification allocation. The system layer first queries the resource state of the embedded device, such as the remaining memory, bus bandwidth, etc., determines the basic configuration parameters of the global data channel in combination with the total number of sensors, sets the channel bandwidth according to the sum of the average data transmission rate of the sensors multiplied by the redundancy coefficient, and dynamically adjusts the redundancy coefficient according to the device resource margin (set to 1.5 when the resource margin is greater than or equal to 50%, and set to 1.2 when the resource margin is between 30% and 50%), to ensure that the channel transmission capacity meets the multi-sensor concurrent transmission demand; create a channel basic information structure, which contains fields such as channel identification, channel type, running state, associated process number, dynamic bandwidth, resource occupation threshold, etc., and each field is initialized according to a fixed data type (such as channel identification for 32-bit integer and running state for enumeration type); the unique channel identification is generated using a hierarchical coding rule, the coding is composed of three parts: device inherent ID (first 16 bits), channel type code (middle 8 bits, data channel is fixed as 0x01), and sequence number (last 8 bits), the sequence number is assigned from 0x00 incrementally, and after generation, it is written to the channel identification field of the channel basic information structure; set the channel type to data channel, the initial running state is idle, the associated process number is initialized to 0, and the resource occupation threshold is set to 80% of the channel bandwidth, when the actual occupation rate of the channel exceeds the threshold, the resource adjustment mechanism is triggered, and all fields of the channel basic information structure will be used as the core basis for subsequent process binding and transmission state monitoring.

[0029] Preferably, in the specific technical implementation of step 12, the type of sensor, data acquisition frequency, single-frame data volume, and unique channel identifier in the channel basic information structure are processed to perform lightweight process creation, unique process identifier assignment, and lightweight process binding structure initialization operations. Lightweight processes are created one by one according to the sensors, and the stack size of the process is dynamically set according to the single-frame data volume of the corresponding sensor. When the single-frame data volume is ≤ 256 bytes, the stack size is set to 512 bytes; when the single-frame data volume is between 256-1024 bytes, the stack size is set to 1024 bytes, to avoid resource waste caused by excessively large stacks or data overflow caused by excessively small stacks. A unique process identifier is assigned to each lightweight process, and the identifier generation rule is associated with the channel identifier. The combination encoding method of "channel identifier-sensor serial number" (the first 32 bits are the channel identifier, and the last 8 bits are the sensor serial number, which starts from 1 and increases in the order of access) is used to ensure the association and uniqueness of the process identifier and the channel identifier. The lightweight process binding structure is initialized, which includes process identifier, associated channel identifier, sensor number, read-write permission, binding state, and other fields. The assigned unique process identifier is written to the corresponding field, the associated channel identifier is temporarily filled with the unique channel identifier in the channel basic information structure (to be verified in the subsequent step), the binding state is initialized as "unbound", the read-write permission is set as "to be configured" by default, the sensor number corresponds to the sensor serial number in the process identifier one by one to ensure the exclusive association between each process and the sensor, and the initialization state of the lightweight process binding structure provides a standardized interface for the association operation in subsequent step 2.

[0030] Optionally, step 13 includes: Step 131, query the embedded device storage resource, allocate a dedicated buffer and record the starting address and storage capacity, and the dedicated buffer is used as the buffer bound to the created data transmission control structure; Step 132, write the buffer address and preset buffer size into the corresponding fields of the data transmission control structure; Step 133, initialize the transmission progress marker as not started, assign the check code field as 0, and establish a bidirectional association between the data transmission control structure and the channel basic information structure to synchronize the feedback of the transmission state.

[0031] In the present application, based on the dynamic adaptation of the buffer allocation of the embedded device resources, the standardized structure field configuration and the bidirectional association mechanism through step 13, the problems of resource waste or overflow, transmission state synchronization lag caused by traditional fixed buffer are solved. The dynamic allocation of exclusive buffer ensures efficient use of storage resources, the precise writing of structure field provides standardized basis for transmission parameters, and the bidirectional association design realizes the real-time intercommunication of the state of channel and control module. The three-layer progressive design lays a solid foundation for subsequent non-blocking transmission, data verification and state monitoring, and adapts to the characteristics of limited embedded device resources and high transmission stability requirements.

[0032] Preferably, the specific implementation process of step 131 is as follows: taking the storage resource list of the embedded device (including the start address of the free memory block, available capacity, address continuity identifier, read-write speed level), the total number of sensors, the maximum single-frame data volume of each sensor and the preset acquisition period as the processing object, the storage resource query, buffer capacity dynamic calculation and exclusive buffer allocation operations are performed. The system layer calls the storage resource query interface, iterates through all free memory blocks of the device, filters out memory blocks with address continuity and read-write speed not lower than the preset threshold (set according to the highest acquisition frequency of the sensor, such as 5 megabytes per second when the acquisition frequency is ≥100 hertz), and records the start address and available capacity of each memory block that meets the conditions; the required capacity of the buffer is dynamically calculated according to the rule of "single-frame total data volume × maximum concurrent transmission frame number × redundancy factor", the single-frame total data volume is the sum of the maximum single-frame data volumes of all sensors (such as 256 bytes, 512 bytes and 1024 bytes for three sensors, the total is 1792 bytes), the maximum concurrent transmission frame number is determined according to the least common multiple of the sensor acquisition periods (such as 10 milliseconds, 20 milliseconds and 30 milliseconds, the least common multiple is 60 milliseconds, and the maximum concurrent frame number is 6), and the redundancy factor is dynamically adjusted according to the free memory margin (1.3 when the margin is ≥30%, and 1.1 when the margin is between 10% and 30%); the smallest continuous memory block with a capacity not less than the calculated value is allocated from the filtered free memory blocks as the exclusive buffer, ensuring address continuity to improve read-write efficiency and avoid transmission delay caused by address fragmentation, and the start physical address (such as 0x20000000) and the actual storage capacity (such as 15 kilobytes) of the exclusive buffer are recorded, and the allocation result will be directly used for subsequent structure field configuration and data storage.

[0033] Preferably, in the specific technical implementation of step 132, the start physical address, the actual storage capacity and the field definition (including field data type, address offset, legality check rule) of the data transfer control structure body of the exclusive buffer are taken as the processing object, and the field writing and validity check operation are performed. The buffer address field of the data transfer control structure body adopts a 32-bit physical address format, the recorded start physical address of the exclusive buffer is written into the field in big-endian order, ensuring the uniqueness and hardware recognizability of the address identification; the buffer size field adopts a 16-bit unsigned integer format, the unit is byte, the actual storage capacity is converted into the corresponding value (such as 15 kilobytes converted into 15360) and written, and the theoretical value of the buffer calculated in step 131 is recorded in the "theoretically required capacity" field reserved in the structure body, which is used for subsequent capacity adaptability check; after the writing is completed, the system layer verifies the written value according to the field legality check rule, the address field needs to be within the effective memory address range of the device (such as 0x20000000-0x200FFFFF), the size field needs to be not less than the theoretically required capacity and not more than the maximum allocation limit value of the single block memory of the device (such as 64 kilobytes), the check passes, the field writing is marked as valid, and the check fails, triggering the buffer reallocation process, ensuring the accuracy of the field value of the data transfer control structure body, and providing reliable parameter basis for subsequent data writing and reading.

[0034] Preferably, the specific implementation of step 133 is to define the state field of the data transmission control structure, the identification information of the channel base information structure, and the state synchronization rule as the processing object, and to perform initialization operation and bidirectional association construction. Set the transmission progress mark field in the data transmission control structure to "not started" (enumeration type value is 0x00), which will be updated in real time according to the state transition rule of "not started-transmission in progress-transmission completed-transmission exception" in the future; the check code field is assigned a value of 0 (32-bit unsigned integer), which will be updated in real time by a lightweight process in the data packaging stage as a reference for data integrity check; the bidirectional association between the data transmission control structure and the channel base information structure is established, and the unique channel identifier and memory address pointer of the channel base information structure are written in the data transmission control structure, and a "associated control structure identifier" field is added in the channel base information structure, and the unique identifier (using the same coding rule as the channel identifier) and memory address pointer of the data transmission control structure are written in the "associated control structure identifier" field, forming mutual indexing; define the update mechanism of the associated field according to the state synchronization rule, the states of the data transmission control structure that need to be synchronized to the channel base information structure include buffer occupancy, current transmission progress, and check exception mark, and the states of the channel base information structure that need to be synchronized to the data transmission control structure include channel running state (idle / occupied / exception), and the number of associated processes, the synchronization period is set to 1 / 10 of the minimum acquisition period of the sensor (for example, if the minimum acquisition period is 10 milliseconds, the synchronization period is 1 millisecond), which ensures the real-time intercommunication of the transmission state and provides timely information support for the buffer state feedback and transmission adjustment in step 4.

[0035] Optionally, step 2 includes: Step 21, fill in the associated channel identifier in the channel base information structure and the unique process identifier of the corresponding lightweight process in each lightweight process binding structure, and set the read-write permission flag to write-only; Step 22, the system layer checks the uniqueness of the associated information in each lightweight process binding structure to avoid channel conflict, and the uniqueness check directs data transmission; Step 23, establish a one-way association between the lightweight process binding structure and the channel base information structure, update the number of associated lightweight processes in the channel base information structure to the total number of sensors, and change the running state to occupied. The occupied state of the channel base information structure will allow data to be written.

[0036] In the present application, based on steps 21 and 23, through the design of identification validity verification, refined permission control, structured one-way association and state sequential flow, the problems of identification matching confusion, extensive permission control, ambiguous association relationship and channel state update lag in the traditional binding process are solved. Step 21 ensures the accuracy of the identification and the security of the permission in the binding structure, and step 23 constructs a clear one-way association link and synchronously updates the channel state, both of which cooperatively realize the ordered binding of the multi-sensor process and the global data channel, provide protection for subsequent data targeting and conflict-free transmission, and adapt to the refined management needs of multi-process cooperation of embedded devices.

[0037] Preferably, the specific implementation process of step 21 is as follows, taking the field definition of the lightweight process binding structure, the unique channel identifier in the channel basic information structure, the unique process identifier of the lightweight process, the association mapping relationship between the sensor number and the process identifier, and the permission control rules as the processing objects, and performing identification extraction, validity verification, field filling and permission configuration operations. The system layer extracts the unique channel identifier from the channel basic information structure, verifies the format legality (needs to comply with the hierarchical coding rule defined in step 11, the first 16 bits are the device inherent ID, and the middle 8 bits are the 0x01 data channel code) and validity (needs to exist in the device created channel identifier list) of the identifier, to avoid filling invalid channel identifier; extracts the unique process identifier from the corresponding lightweight process control block, verifies the association relationship between the identifier and the sensor number (the last 8 bits of the process identifier sensor serial number need to be consistent with the corresponding sensor number, such as sensor number 3, the last 8 bits of the process identifier need to be 0x03), to ensure the exclusive correspondence between the process and the sensor; fill the associated channel identifier and the unique process identifier in the corresponding fields of the lightweight process binding structure according to the field data type (32-bit integer), and mark the identifier field state as "verified and valid" after filling; set the read-write permission flag to "write only" according to the permission control rule, and write the verification code (generated by the channel identifier and the process identifier according to the preset algorithm, such as the exclusive or operation result) in the permission verification bit reserved in the structure, which needs to be verified during subsequent data transmission to prevent permission tampering, ensure that the lightweight process can only write data to the global data channel, cannot read other process data or channel control information, and guarantee the security and targeting of data transmission.

[0038] Preferably, in the specific technical implementation of step 23, the memory address of the lightweight process binding structure, the associated process management field of the channel basic information structure, the total number of sensors, and the channel state transition rule are taken as the processing objects, and the one-way association construction, process number updating, and channel state changing operations are performed. The one-way association between the lightweight process binding structure and the channel basic information structure is established, the associated process structure pointer array is created in the channel basic information structure, the memory address of each lightweight process binding structure is stored in the array in the order of sensor serial number, the array length is consistent with the total number of sensors, forming a one-way index link of "channel-process", which facilitates subsequent quick query of the binding structure corresponding to a certain sensor without the need to traverse all structures; the number of valid addresses in the associated process structure pointer array (i.e., the number of lightweight process binding structures that have completed identification filling and verification) is counted, and the number is updated to the associated lightweight process number field of the channel basic information structure, and the number is verified to be consistent with the total number of sensors, if not consistent, an associated number mismatch alarm is triggered, prompting the existence of a process that has not completed binding; the channel running state is changed according to the channel state transition rule (idle→associated→occupied), when the associated lightweight process number and the total number of sensors are consistent and the identification field state of all binding structures is "verified valid", the running state is changed from "idle" to "occupied", and the state change timestamp (accurate to millisecond level, such as 20240520143000123) is recorded; the "occupied" state of the channel basic information structure will trigger the data write permission mechanism, only when the state is "occupied" and the permission verification bit is verified, the write request of the lightweight process will be responded by the global data channel, avoiding data write failure when the channel is not ready, ensuring the orderliness and reliability of data transmission.

[0039] Optionally, step 22 comprises: Step 221, the system layer traverses all lightweight process binding structures to extract the combined information of associated channel identification and process identification; Step 222, the combined information is subjected to a uniqueness verification to avoid channel association conflict, and if there is a repetition, a binding failure alarm is triggered; Step 223, after the verification, the association relationship mapping table of each lightweight process binding structure is recorded, which will be used for transmission state query and verification.

[0040] In this application, based on this step 22, through structured extraction, hierarchical verification mechanism and fine mapping table design, the problems of low efficiency, conflict positioning difficulty and state query complexity of traditional verification method are solved. Step 221 ensures that the extracted combination information is effective and has no omission, step 222 accurately identifies conflicts and classifies alarms through hierarchical verification, and step 223 constructs a structured mapping table to provide an efficient interface for subsequent transmission state query and abnormal positioning. The three work together to realize the accuracy and reliability of multi-process and channel association, adapt to the fine management needs of multi-sensor collaborative transmission of embedded devices, and significantly improve the verification efficiency and conflict processing capacity compared with traditional single verification method.

[0041] Preferably, the specific implementation process of step 221 is as follows: taking the identification field state of the lightweight process binding structure, the sensor serial number sorting rule and the temporary storage list structure as the processing object, performing traversal screening, combination encoding generation and ordered storage operation. The system layer traverses all lightweight process binding structures in ascending order of sensor serial number (from 1 to N, N is the total number of sensors, such as 8), and traverses the structure body first. Check if the identification field state is marked as "verified valid" in step 21. If not marked or marked as invalid, record the sensor number corresponding to the structure body and skip to avoid invalid data participating in subsequent verification; for the structure body with valid identification field, extract the associated channel identification and unique process identification, combine them in the fixed order of "channel identification first, process identification second", generate a 64-bit combination code (the first 32 bits are 32-bit integer channel identification, the last 32 bits are 32-bit integer process identification, such as channel identification 0x0001A2B3, process identification 0x0004C5D6, combination code 0x0001A2B30004C5D6); associate the generated combination code with the corresponding sensor number and the memory address of the lightweight process binding structure, and store it in the preset temporary list. The temporary list uses a linked list storage structure, each node contains three fields of combination code, sensor number and structure address, and is sorted in ascending order of combination code value when stored, providing an ordered comparison basis for subsequent uniqueness verification, while the number of valid nodes in the temporary list is counted, which is used to compare with the total number of sensors to ensure that there is no omission of valid structure bodies.

[0042] Preferably, in the specific technical implementation of step 222, the ordered node data of the temporary list, the unique channel identifier of the global data channel, and the alarm grading rule are processed, and the layered uniqueness verification and conflict alarm operation is performed. Using the layered verification mechanism, first, verify whether the first 32-bit channel identifier part of all combined encodings in the temporary list is consistent with the unique channel identifier of the global data channel. If there is an inconsistent combined encoding, it is determined that the channel association is incorrect, the corresponding sensor number and combined encoding are recorded, a channel association error alarm (alarm code set to 0x01) is triggered, and a lightweight process with binding error is prompted; under the premise that the channel identifier is consistent, perform combined encoding uniqueness verification by traversing the ordered temporary list and comparing the combined encoding values of the current node and the previous node. If the values are the same, it is determined that there is an association conflict, the combined encoding of the conflict node, the sensor numbers corresponding to the two conflict nodes, and the structure memory address are recorded, and conflict detail data is formed; according to the number of conflict nodes, perform hierarchical alarm, a single conflict node triggers a first-level alarm (alarm code 0x02), only records the conflict information for subsequent troubleshooting, and does not interrupt the binding process; two or more conflict nodes trigger a second-level alarm (alarm code 0x03), suspend the binding process and notify the system layer, and at the same time mark the conflict lightweight process binding structure as "conflict state", prohibit it from participating in subsequent data transmission, avoid transmission abnormalities caused by multiple processes competing for channel resources, and the hierarchical alarm mechanism not only ensures the fault tolerance of slight conflicts, but also can timely block the risks caused by serious conflicts.

[0043] Preferably, the specific implementation of step 223 takes the valid node data of the temporary list, the mapping table structure definition, and the quick search rule as the processing object, and performs the operations of creating, structuring filling, and index building of the association mapping table. The association mapping table is created, which is an array type structure with an array length consistent with the total number of sensors, and the array elements are self-defined mapping structures. The mapping structure includes six fields: channel identifier, process identifier, sensor number, binding structure address, binding state, and check code. Each field is defined according to a fixed data type (e.g., the binding state is an enumeration type with values of "bound", "unbound", and "conflict"). The valid nodes of the temporary list are iterated, and the combined code is split and combined into a 32-bit channel identifier and a 32-bit process identifier, which are filled into the corresponding fields of the mapping structure. At the same time, the sensor number and the memory address of the lightweight process binding structure are filled in, the binding state is set to "bound", and the cyclic redundancy check value (CRC-32) of the combined code is calculated as the check code and filled into the corresponding field to ensure the integrity of the mapping table data. To improve query efficiency, a quick search index is built based on the sensor number field of the mapping structure. The index table is a one-dimensional array with the same index as the sensor number. The index table element stores the array index of the corresponding mapping structure in the association mapping table. For example, if the sensor number is 3, the value stored in the index table subscript 3 is the position of the mapping structure corresponding to sensor number 3 in the mapping table. When querying, the mapping structure can be directly located by the sensor number, and the query time complexity is reduced to O(1). The starting memory address and array length of the association mapping table are written into the "association mapping table information" field of the channel basic information structure, realizing the association of the mapping table and the channel. Subsequent transmission state queries (such as the process binding state of a certain sensor) and verification exception positioning (such as the binding structure of a certain data block) can be quickly realized through this mapping table, which greatly reduces the resource occupation and time delay of state query compared with the traditional traversal query method.

[0044] Optionally, step 3 includes: Step 31, each sensor collects environmental or state data at a predetermined period to form raw data, and transmits the raw data to the corresponding lightweight process; Step 32, the lightweight process calls the data encapsulation interface, integrates the raw data, sensor number, and collection timestamp, and encapsulates them into a unified format data block according to the data transmission control structure field requirements; Step 33, calculate the check code of the data block, and update the check code and data length to the corresponding fields of the data transmission control structure.

[0045] In the present application, based on steps 31 and 33, through dynamic acquisition cycle, data preprocessing mechanism, hierarchical check code design and atomic update operation, the technical problems of resource waste caused by fixed acquisition cycle in traditional scheme, influence of original data containing noise on transmission efficiency, single check code easy to miss error, and out-of-sync state update are solved. Step 31 realizes precise adaptation of sensor acquisition and lightweight process, ensuring the effectiveness and directional transmission of original data; step 33 improves the data integrity verification capability through hierarchical check, and guarantees the consistency of control structure state by atomic update, both of which provide high-quality and high-reliable data basis for subsequent data packaging and non-blocking transmission, adapting to the needs of multi-sensor heterogeneous acquisition and high-reliable transmission of embedded devices.

[0046] Preferably, the specific implementation process of step 31 is as follows, taking the type parameters of the sensor (acquisition accuracy, signal type, maximum sampling rate), the real-time load of the embedded device (CPU occupancy rate, memory usage rate), the preset acquisition cycle range and the unique process identifier of the lightweight process as the processing object, and performing dynamic acquisition cycle configuration, data acquisition and preprocessing, identifier verification and directional transmission operation. The system layer determines the basic acquisition cycle range according to the sensor type parameters (e.g. 10-100 milliseconds for temperature sensor and 1-20 milliseconds for acceleration sensor), and dynamically adjusts the actual acquisition cycle combined with the device real-time load: when the CPU occupancy rate is ≤30% and the memory usage rate is ≤40%, the lower limit value of the basic cycle range is used to improve the timeliness of the data; when the CPU occupancy rate is between 30%-60% or the memory usage rate is between 40%-70%, the middle value of the basic cycle is used; when any resource occupancy rate exceeds the threshold, the upper limit value of the basic cycle is used to avoid the acquisition process occupying too many resources affecting the system operation; the sensor starts acquisition according to the dynamically adjusted cycle, and during the acquisition process, hardware filtering (low-pass filter cutoff frequency is set to 1 / 5 of the sampling rate, e.g. 20 Hz cutoff frequency when the sampling rate is 100 Hz) is performed for analog signal sensors (e.g. voltage sensor), data format standardization (converted to 32-bit integer type uniformly) is performed for digital signal sensors (e.g. infrared sensor), and abnormal values (data exceeding ±5% of the sensor range are marked as invalid and discarded) are filtered; after the acquisition is completed, the original data is formed, the sensor extracts its own number through the built-in process identifier matching module and compares it with the unique identifier of the associated lightweight process, establishes a temporary data transmission link after verification, transmits the original data to the corresponding lightweight process in an interrupt-triggered manner, releases the link after transmission is completed, and records the transmission timestamp and data length in the local cache area of the sensor for subsequent transmission anomaly tracing, and the identifier verification mechanism ensures that the original data will not be transmitted to the wrong process, improving the accuracy of transmission.

[0047] Preferably, in the specific technical implementation of step 33, the data block in a unified format (containing a header identifier, a sensor number, a timestamp, raw data, and a tail placeholder), field definition of a data transmission control structure, verification algorithm configuration rules, and atomic operation mechanism are processing objects, and layered verification code calculation, data length statistics, and control structure atomic update operations are performed. Using a layered verification mechanism, the cyclic redundancy check value (CRC-16) of the core data area (raw data + sensor number + timestamp) of the data block is first calculated as a primary verification code for quickly verifying the integrity of the core data; then the message digest value (using a hash algorithm, outputting a 16-byte digest) of the entire data block (containing the header identifier and the tail placeholder) is calculated as a secondary verification code for deeply verifying that the data block as a whole has not been tampered with. The layered design not only guarantees verification efficiency but also improves error detection rate; the actual byte number (containing all fields) of the data block is counted as the data length, and the data length is stored in an unsigned 16-bit integer format to ensure that it does not exceed the field range of the data processing of the embedded device; the atomic operation mechanism is used to update the data transmission control structure: first, lock the memory area corresponding to the structure (through a hardware mutex or a system layer critical section protection) to prevent data competition caused by simultaneous updates of multiple processes, then write the primary verification code and the secondary verification code into the corresponding fields of the structure (the verification code field is designed to be 48 bits, the first 16 bits store the CRC-16 value, and the last 32 bits store the high 32 bits of the hash digest), then write the data length, and finally update the verification update flag of the structure to “updated” and unlock the memory; if the verification code calculation fails (such as data block length exception), the data block is marked as “verification invalid”, triggering a lightweight process to re-collect data, and at the same time, the number of failures is recorded; when the number of consecutive failures reaches a preset threshold (3-5 times, configured according to the importance of the sensor), a sensor fault alarm is triggered to notify the system layer to troubleshoot the fault; the atomic update mechanism ensures the consistency of the verification code, data length, and update flag, avoiding the reading of incomplete control information by the host process.

[0048] Optionally, step 32 includes: Step 321, associate and bind the sensor number with the unique process identifier of the corresponding lightweight process to make the data block traceable and unique; Step 322, obtain the system time to generate a collection timestamp, and sort and combine the raw data according to a preset format; Step 323, add a data block header identifier and a tail verification field placeholder to the sorted and combined raw data to form a data block in a unified format.

[0049] In this application, based on the structured bidirectional binding mechanism, timestamp precision compensation design and dynamic adaptation of the format packaging scheme in step 32, the problems of single traceability identification, easy drift of timestamp, fixed format and incompatibility in traditional packaging are solved. Step 321 constructs a "sensor-process" bidirectional verification traceability system, step 322 realizes the ordered combination of high-precision timestamp and data, and step 323 designs a standardized format containing device and data characteristics. The three layers are progressive, ensuring the traceability, timing accuracy and parsing compatibility of the data block in the whole process of transmission, verification and processing, adapting to the unified management needs of multi-sensor heterogeneous data of embedded devices, and compared with the traditional simple splicing packaging, the traceability reliability and format adaptability are significantly improved.

[0050] Preferably, the specific implementation process of step 321 is as follows: taking the unique process identification of the lightweight process, the sensor number, the association relationship mapping table, the sensor type code and the binding verification rule as the processing object, performing identification extraction, bidirectional verification, binding code generation and field embedding operation. The lightweight process extracts the last 8-bit sensor serial number of its unique process identification through the process identification analysis interface, and performs consistency verification with the sensor number attached when receiving the original data. If they are not consistent, an identification mismatch alarm is triggered, and packaging is refused and retransmission is requested; the sensor type code corresponding to the current process identification is queried from the association relationship mapping table (such as temperature sensor 0x01, humidity sensor 0x02, and acceleration sensor 0x03), and the sensor number, process identification and type code are combined in the order of "number-identification-code" to generate a 64-bit binding base code; the binding base code is calculated by using the cyclic redundancy check algorithm (CRC-32) to obtain a 32-bit binding check code, which together with the binding base code forms a "traceability identification group" to ensure that the identification information has not been tampered with; the traceability identification group is embedded in the reserved field of data packaging, which is located at the front end of the original data and stored in big-endian, of which the first 64 bits are the binding base code and the last 32 bits are the binding check code. The subsequent host process can quickly trace the sensor and corresponding process of data source by analyzing this field. The bidirectional verification mechanism and combined traceability identification group ensure the uniqueness and reliability of data block traceability, avoiding traceability failure caused by single identification error.

[0051] Preferably, in the specific technical implementation of step 322, the system clock module of the embedded device, the hardware timer, the field type of the raw data (integer, floating point, character), the preset time format and the sorting rule are taken as the processing objects, and high-precision timestamp generation, data type adaptation and ordered combination operations are performed. The lightweight process simultaneously calls the system clock module and the hardware timer to obtain time information: the system clock module provides second-level time (such as 20240520153000), and the hardware timer provides microsecond-level compensation value (such as 123456 microseconds), and the two are combined to generate a high-precision acquisition timestamp of the "second-microsecond" level (format: YYYYMMDDHHMMSSssssss, such as 20240520153000123456), avoiding the problem of insufficient millisecond-level precision caused by the traditional single system clock; for different types of raw data, format standardization processing is performed: integer data retains the original byte length (16 bits or 32 bits), floating point data is uniformly converted to 32-bit single precision format, and character data is stored according to ASCII code, ensuring the consistency of the data type; combination is performed according to the preset sorting rule of "timestamp-source identification group-raw data", wherein the timestamp field is fixed as 20 bytes (string format), the source identification group is fixed as 12 bytes (64-bit base code+32-bit check code), the length of the raw data field is dynamically adjusted according to the actual data amount, and 1 byte separator (0x00) is inserted between the fields during combination, so as to facilitate quick field splitting during subsequent parsing, avoid field confusion caused by the non-fixed data length, provide an accurate basis for the time sequence analysis of the data by the high-precision timestamp, and ensure the regularity of the encapsulation structure by the ordered combination rule.

[0052] Preferably, the specific implementation of step 323 takes the combination data of "timestamp-trace identification group-original data", the buffer size in the data transmission control structure, the preset header identification rule and the tail placeholder dynamic adjustment mechanism as the processing object, and performs the header identification addition, tail placeholder filling and format integrity verification operation. According to the preset header identification rule, a 16-byte fixed header is generated, which contains three parts of information: the first 4 bytes are the device inherent identification (such as 0x1234ABCD), the middle 4 bytes are the data block type identification (uniform data block fixed as 0x00000001), and the last 8 bytes are the data block format version number (such as V1.0 corresponding to 0x0001000000000000). The header identification is used for quickly identifying the source device, type and parsing rule of the data block, and is suitable for data differentiation in the multi-device interconnection scene; the actual length of the combined data is calculated, and the length of the tail placeholder is determined in combination with the maximum storage capacity of the buffer single block in the data transmission control structure: placeholder length = buffer single block minimum allocation unit - (header length + combined data length), the buffer single block minimum allocation unit is set according to the device storage management rule (such as 512 bytes or 1024 bytes), which ensures that the total length of the data block is an integer multiple of the minimum allocation unit, and improves the buffer read-write efficiency; the tail placeholder uses a fixed fill value (0xFF), and the length check value (CRC-16 value calculated according to the number of combined data bytes) of the combined data is embedded in the last 4 bytes of the placeholder, which is used to verify whether the data block is missing in the transmission process; after adding the header identification and the tail placeholder, a complete uniform format data block is formed, the total length of the data block = header length (16 bytes) + combined data length + placeholder length, and finally the format of the entire data block is verified to verify the legality of the header identification, the integrity of the field separator and the compliance of the total length, and the verification passes. If the verification fails, the packaging process is re-executed, and the dynamically adjusted tail placeholder not only ensures the format uniformity, but also avoids the resource waste caused by the fixed placeholder, and the multi-dimensional information design of the header identification improves the identifiability and compatibility of the data block.

[0053] Optionally, step 4 comprises: Step 41, each lightweight process initiates a transmission request to the global data channel based on the association relationship between the lightweight process binding structure and the global data channel; Step 42, in response to the transmission request, the channel basic information structure feeds back the buffer real-time state through the bidirectional association with the data transmission control structure. If the buffer is not full, the lightweight process writes the data block in the non-blocking mode, updates the transmission progress mark to transmission in progress, and marks it as transmission completed after the transmission is completed. The transmission progress mark will be synchronized to the channel basic information structure. Step 43, the master lightweight process reads the data block from the buffer after detecting the transmission completion mark, verifies the integrity through the check code in the data transmission control structure, classifies and processes according to the sensor type if the verification is passed, and triggers the corresponding lightweight process to retransmit if the verification fails, while the system layer monitors the buffer occupancy rate and the transmission state.

[0054] In this application, based on steps 41 and 42, through request packet structured verification, dynamic priority scheduling, predictive buffer state feedback, block non-blocking writing and atomic state synchronization design, the technical problems of traditional scheme such as transmission request disorder, buffer state feedback lag, non-blocking writing conflict, and inconsistent state synchronization are solved. Step 41 realizes the legality verification, priority adaptation and intelligent retry of transmission request, ensuring the accuracy and resource friendliness of request initiation; Step 42 realizes the request legality secondary verification, real-time buffer state feedback, block conflict avoidance writing and state atomic synchronization, ensuring the orderliness, reliability and efficiency of data transmission. The two cooperate to adapt to the core characteristics of embedded device multi-sensor concurrent transmission and resource limitation, compared with the traditional simple request-response mode, the transmission efficiency and data reliability are significantly improved.

[0055] Preferably, the specific implementation process of step 41 is as follows: the association information of the lightweight process binding structure, the association relationship mapping table, the sensor type code, the length information of the uniform format data block, the preset request priority mapping rule and the retry strategy are taken as the processing objects, and the request pre-checking, structured request packet construction, priority dynamic allocation, transmission request initiation and intelligent retry operation are performed. Before the lightweight process initiates the transmission request, the association relationship mapping table is used to check the binding state of the process: the process identifier and the channel identifier in the binding structure are extracted, the mapping table is queried to confirm that the binding state is "bound", and the check code of the read-write permission mark (compared with the permission check code written in step 21) is checked at the same time, so as to avoid invalid requests initiated by processes without permission or with invalid binding; a structured transmission request packet is constructed, which includes six fields: 32-bit process identifier, 32-bit channel identifier, 16-bit data block length, 8-bit request priority, 64-bit request timestamp, and 32-bit request check code, wherein the request check code is generated by the process identifier, the channel identifier and the data block length according to the CRC-32 algorithm, to ensure that the request packet is not tampered with; the request priority is dynamically allocated according to the preset priority mapping rule: the type code of the corresponding sensor (such as 0x01 temperature sensor and 0x03 acceleration sensor) is extracted from the association relationship mapping table, which is mapped to three levels of priority (type code 0x00-0x1F corresponds to priority 1, 0x20-0x7F corresponds to priority 2, and 0x80-0xFF corresponds to priority 3, priority 3 being the highest), to adapt to the transmission needs of sensors of different importance and improve the timeliness of critical data transmission; the lightweight process initiates a transmission request through the request interface of the global data channel, and transmits the structured request packet to the channel control module in big-endian sequence, and starts a request response timer (the timeout threshold is dynamically set according to the priority, priority 3 is 1 millisecond, priority 2 is 2 milliseconds, and priority 1 is 5 milliseconds); if no channel feedback is received within the timeout, the retry is performed according to the exponential backoff strategy (the initial retry interval is 1 millisecond, and the retry interval is doubled each time, with a maximum of 5 retries), and if the number of retries reaches the threshold, the transmission request is marked as abnormal, triggering a system-level lightweight alarm, to avoid unlimited retries occupying system resources, and the structured request packet and dynamic priority design ensure that the channel can quickly identify the request source and importance, improving the request processing efficiency.

[0056] Preferably, in the specific technical implementation of step 42, the request processing module of the global data channel, the structured transmission request packet, the association mapping table, the data transmission control structure body, the channel basic information structure body, the preset buffer segmentation rule and the conflict detection mechanism are taken as processing objects, and the request legality verification, the buffer state real-time feedback, the non-blocking segmented writing, the transmission progress atomic update and the state synchronization operation are performed.After receiving the transmission request packet, the channel control module first performs a second legality check: parses the process identifier and channel identifier in the request packet, compares them with the records in the association relationship mapping table, verifies whether the process is the associated process of the channel, and checks the validity of the request verification code. If the verification fails, return a "request illegal" response and refuse subsequent operations; obtain the current buffer state through the buffer occupancy rate field (real-time updated used bytes / total capacity) of the data transmission control structure, combine the data block length being written (statistical through the record marked as "transmitting"), calculate the predicted remaining space (predicted remaining space = total capacity - used bytes - length of data being written), and avoid misjudgment caused by only based on the current occupancy rate (such as the current occupancy rate is 80%, but the data being written occupies 10%, the actual remaining is only 10%); feedback the buffer state according to the predicted remaining space: if the predicted remaining space ≥ data block length, feedback "writable"; if the predicted remaining space < data block length but ≥ 1 / 3 of the data block length, feedback "block writable"; if the predicted remaining space < 1 / 3 of the data block length, feedback "queued waiting", and add the request to the priority waiting queue (arranged in descending order of request priority, and arranged in ascending order of request timestamp for the same priority); after receiving the "writable" or "block writable" response, the lightweight process starts non-blocking writing: if it is "block writable", the data block is split into N equal sub-blocks according to the preset block splitting rule (N is the smallest integer greater than or equal to the data block length / predicted remaining space, and the sub-block size is adjusted according to the minimum allocation unit of the buffer, such as 512 bytes); lock the target write area of the buffer through the memory mutex mechanism (to avoid data overlap caused by multiple processes writing at the same time), and perform the write operation in the order of the sub-blocks. After completing the write of each sub-block, update the transmission progress mark in the data transmission control structure (in the state flow of "transmitting - sub-block 1 completed - sub-block 2 completed - … - transmission completed"), and the update operation uses atomic instructions (such as CAS instructions supported by hardware) to ensure the consistency of state update; after all the sub-blocks are written, update the transmission progress mark to "transmission completed" finally, and synchronize it to the corresponding field of the channel basic information structure through the bidirectional association mechanism (the "current transmission state" array of the channel basic information structure is updated according to the process identifier index); if a conflict is detected during writing (such as failure to lock the area), give up the current sub-block writing, release the resources, and wait for a while according to the backoff strategy and then try to write again to avoid occupying the channel indefinitely. The block writing and conflict detection mechanism ensures the reliability of non-blocking transmission, and the predictive buffer state feedback and priority waiting queue improve the utilization efficiency of channel resources.

[0057] Optionally, step 43 comprises: Step 431, after reading the data block, the master lightweight process calculates the check code and compares it with the check code recorded in the data transmission control structure; Step 432, if the verification is consistent, extract the original data, sensor number and timestamp from the data block, and classify and arrange according to the sensor type; Step 433, the system layer queries the buffer occupancy rate in real time, and notifies each lightweight process to suspend transmission when reaching the preset threshold. If the verification fails, mark the data block as abnormal and trigger an interruption, and notify the corresponding lightweight process to retransmit. Suspension and retransmission will avoid buffer overflow and data loss, respectively.

[0058] In this application, based on step 43, through triple verification mechanism, multi-level classification system, dynamic threshold scheduling and intelligent retransmission strategy, the technical problems of single verification easy to miss detection, rough classification efficiency, fixed buffer threshold easy to overflow and unordered retransmission occupying resources in traditional scheme are solved. Step 431 realizes the double protection of data integrity and legal traceability and hierarchical fault tolerance; Step 432 realizes the accurate grouping, time sequence sorting and quality marking of sensor data, and improves the subsequent processing efficiency; Step 433 realizes the predictive control of buffer and the repair of abnormality, which are progressively adapted to the characteristics of multi-sensor data heterogeneity, resource limitation and high transmission reliability requirement of embedded devices, compared with the traditional simple verification-classification-retransmission mode, the data reliability and system resource utilization rate are significantly improved.

[0059] Preferably, the specific implementation process of step 431 is as follows: to unify the hierarchical check codes (primary CRC-16, secondary hash digest) recorded in the data block, data transmission control structure, association mapping table, traceable identification group check rule and check failure grading strategy as the processing object, perform triple check, result determination and grading fault tolerance operation. After the main control lightweight process reads the data block, first, parse the last 4-byte length check value of the tail placeholder, compare it with the CRC-16 value calculated by the actual length of the data block, and verify that the data block has no field missing; second, extract the primary check code (core data area CRC-16) and secondary check code (overall data block hash digest) recorded in the data transmission control structure, compare them with the recalculated data block core data area CRC-16 and overall hash digest respectively, and realize double check of data integrity; finally, parse the traceable identification group (binding base code + binding check code) in the data block, query the corresponding process identification and sensor number through the association mapping table, verify the consistency of the binding base code and the validity of the binding check code, and ensure the legality of data traceability; according to the check result, the grading processing is as follows: triple check passes, mark "check valid"; length check fails or primary check code does not match, determine "data damage"; secondary check code does not match, determine "data tampering"; traceable identification check fails, determine "traceability failure"; trigger retransmission request of different priority for "data damage" and "data tampering", record abnormal log for "traceability failure" and store the data block separately, avoid invalid data mixed into normal processing flow, triple check mechanism greatly improves error detection rate, grading processing ensures the accuracy of fault tolerance.

[0060] Preferably, in the specific technical implementation of step 432, the valid data block, sensor type code mapping table, preset classification storage rule, timestamp sorting algorithm and data quality marking rule are processed to perform field extraction, multi-level classification, time sequence sorting and quality marking operations. The main control process extracts the sensor number, type code, acquisition timestamp and standardized raw data from the data block, converts the type code to the specific sensor type (such as 0x01→temperature sensor, 0x03→acceleration sensor) through the type code mapping table; according to the multi-level classification rule of “type grouping-time sorting-quality marking”, first, create an independent classification buffer area according to the sensor type (each buffer area uses a linked list storage structure and supports dynamic expansion), and write the corresponding data block into the type buffer area; secondly, in each type buffer area, sort the acquisition timestamp in descending order (use the insertion sorting algorithm and optimize the sorting efficiency by using the continuity of the timestamp, such as directly inserting into the tail if the difference between adjacent data timestamps is less than the acquisition period); finally, perform quality marking on the raw data: judge whether the data is in the normal interval according to the sensor range, mark the normal data as “quality level A”, mark the data within ±3% of the range as “quality level B”, mark the data within ±3%-±5% as “quality level C”, and mark the data beyond ±5% as “quality level D”, the quality marking field is stored in association with the data block; after classification, record the current data quantity, the latest timestamp, the oldest timestamp and the data proportion of each quality level in the head of each type buffer area, which facilitates subsequent application layer quick retrieval and batch reading, and the multi-level classification and quality marking improve the refinement of data management, and the time sequence sorting guarantees the time sequence availability of the data.

[0061] Preferably, the specific implementation of step 433 takes the buffer occupancy field of the data transmission control structure, the preset dynamic threshold rule, the lightweight process communication interface, the exception marking mechanism and the retransmission backoff strategy as the processing object, and performs buffer state monitoring, dynamic threshold judgment, transmission control and exception repair operation. The system layer queries the buffer occupancy (used byte number / total capacity) at a fixed period (1 / 2 of the minimum acquisition period of the sensor, for example, 5 milliseconds if the minimum acquisition period is 10 milliseconds) and calculates the predicted occupancy (predicted occupancy = current occupancy + total amount of data to be written / total capacity) in combination with the total amount of data currently being written. The control strategy is adjusted according to the preset dynamic threshold rule: the buffer threshold corresponding to the sensor type priority 3 (critical sensor) is 85%, the priority 2 is 80%, and the priority 1 is 75%. When the predicted occupancy reaches the corresponding threshold, a "suspend transmission" instruction is sent to all incomplete transmission lightweight processes through the lightweight process communication interface, and the buffer state at the suspension time is recorded. When the predicted occupancy drops below 20% of the threshold, a "resume transmission" instruction is sent. The dynamic threshold adapts to the transmission needs of data of different importance, avoiding the discarding of critical data due to buffer overflow. If the verification fails (the "data damage" and "data tampering" determined in step 431), the corresponding lightweight process is located through the association relationship mapping table, the exception type (damage / tampering) of the data block is marked, and an interrupt signal is triggered to notify the corresponding process to initiate retransmission. The retransmission adopts an exponential backoff strategy: the initial retransmission interval is 1 times the acquisition period (for example, 10 milliseconds if the acquisition period is 10 milliseconds), and the interval is doubled each time, with a maximum of 4 times. If the retransmission is successful, the exception mark is cleared. If the retransmission fails, a "permanent exception" is marked and a secondary alarm (alarm code 0x04) is triggered, and the abnormal data block is moved to a separate exception cache area for retention. The suspension transmission mechanism avoids buffer overflow, and the intelligent retransmission strategy balances the data repair success rate and system resource occupation, forming an exception handling mechanism.

[0062] As shown in Figure 2 , it is a multi-sensor data transmission device in an embedded device according to an embodiment of the application, comprising: An initialization module for creating a global data channel and a lightweight process corresponding to each sensor and constructing a channel basic information structure, a lightweight process binding structure and a data transmission control structure when the system layer of the embedded device is initialized; A binding association module for filling the channel unique identifier and the process identifier in the lightweight process binding structure and establishing a one-way association with the channel basic information structure; A data acquisition and encapsulation module for controlling each sensor to acquire environmental or state data to form raw data at a preset period, encapsulating the raw data into a data block in a unified format by the corresponding lightweight process, calculating the check code of the data block and updating it to the data transmission control structure; The data transmission processing module is configured to control the lightweight process to transmit the data block to the buffer area bound to the data transmission control structure through the global data channel in a non-blocking mode, control the master lightweight process to read the data block from the buffer area, and perform classification processing on the data block if the data block passes the verification, or trigger the corresponding lightweight process to retransmit if the data block fails the verification.

[0063] The embodiment of the present application further provides a computer readable storage medium, wherein at least one instruction or at least one program is stored in the storage medium, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the multi-sensor data transmission method in the embedded device.

[0064] As shown in Figure 3 The embodiment of the present application further provides an electronic device, which comprises a processor and a memory, wherein at least one instruction or at least one program is stored in the memory, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the multi-sensor data transmission method in the embedded device.

[0065] The embodiment of the present application further provides a computer program product or a computer program, which comprises computer instructions, and the computer instructions are executed by a processor to implement the multi-sensor data transmission method in the embedded device.

[0066] The exemplary explanation of the above-mentioned device, medium, electronic device, computer program product or computer program can refer to the description of the above-mentioned Figure 1 , which will not be described herein again.

Claims

1. A method for multi-sensor data transmission in embedded devices, characterized in that, The application relates to an embedded device system layer initialization method and system. Step 1 includes the following steps: step 11, creating a global data channel, assigning a unique channel identifier through the created channel basic information structure, setting the channel type as a data channel, and setting the initial running state as idle; the unique channel identifier is used for the associated binding of the lightweight process; step 12, creating a lightweight process for each sensor and assigning a unique process identifier; the created lightweight process binding structure is initialized; the unique process identifier will be associated with the unique channel identifier; step 13, creating a data transmission control structure and binding the global data channel; the buffer address, preset buffer size, transmission progress marker and check code are configured; the data transmission control structure binds the global data channel to synchronize the transmission state.

2. The method of claim 1, wherein, Step 13 includes the following steps: step 131, querying the storage resources of the embedded device, allocating a dedicated buffer and recording the starting address and storage capacity; the dedicated buffer is used as the buffer bound with the created data transmission control structure; step 132, writing the buffer address and preset buffer size into the corresponding fields of the data transmission control structure; step 133, initializing the transmission progress marker as not started, setting the check code field as 0, and establishing the bidirectional association between the data transmission control structure and the channel basic information structure to realize the synchronous feedback of the transmission state.

3. The method of claim 2, wherein, Step 2 includes the following steps: step 21, filling the associated channel identifier in the channel basic information structure and the unique process identifier of the corresponding lightweight process into the lightweight process binding structure, and setting the read-write permission marker as write-only; step 22, the system layer verifies the uniqueness of the associated information in the lightweight process binding structure to avoid channel conflicts; the uniqueness verification realizes the directional data transmission; step 23, establishing the one-way association between the lightweight process binding structure and the channel basic information structure, updating the number of associated lightweight processes in the channel basic information structure as the total number of sensors, and changing the running state as occupied; the occupied state of the channel basic information structure will allow data to be written.

4. The method of claim 1, wherein, ​ 5. The method of claim 4, wherein, Step 22 includes: step 221, the system layer traverses all lightweight process binding structures to extract the combination information of the associated channel identifier and the process identifier; step 222, the combination information is subjected to uniqueness verification to avoid channel association conflicts, and if there is a repetition, a binding failure alarm is triggered; step 223, after the verification, the association relationship mapping table of each lightweight process binding structure is recorded, which will be used for transmission state query and verification.

6. The method of claim 1, wherein, Step 3 includes: step 31, each sensor collects environmental or state data at a preset period to form raw data, and transmits the raw data to the corresponding lightweight process; step 32, the lightweight process calls the data encapsulation interface to integrate the raw data, sensor number, and collection timestamp, and encapsulates it into a unified format data block according to the data transmission control structure field requirements; step 33, the check code of the data block is calculated, and the check code and data length are updated to the corresponding fields of the data transmission control structure.

7. The method of claim 6, wherein, Step 32 includes: step 321, the sensor number is associated and bound with the unique process identifier of the corresponding lightweight process to make the data block traceable and unique; step 322, the system time is obtained to generate a collection timestamp, which is combined with the raw data in a preset format; step 323, the raw data after sorting and combination is added with a data block header identifier and a tail check field placeholder to form a unified format data block.

8. The method of claim 1, wherein, Step 4 includes: step 41, each lightweight process initiates a transmission request to the global data channel based on the association relationship between the lightweight process binding structure and the global data channel; step 42, in response to the transmission request, the channel basic information structure feeds back the buffer real-time state through the bidirectional association with the data transmission control structure, if the buffer is not full, the lightweight process writes the data block in a non-blocking mode, updates the transmission progress marker to transmission in progress, and marks it as transmission complete after transmission is completed, the transmission progress marker will be synchronized to the channel basic information structure; step 43, the master lightweight process reads the data block from the buffer after detecting the transmission complete marker, verifies the integrity through the check code in the data transmission control structure, and if the verification is passed, classifies and processes it according to the sensor type, if the verification fails, triggers the corresponding lightweight process to retransmit, and the system layer monitors the buffer occupancy rate and transmission state.

9. The method of claim 8, wherein, Step 43 includes: step 431, after the master lightweight process reads the data block, the check code is calculated and compared with the check code recorded in the data transmission control structure; step 432, if the check is consistent, the raw data, sensor number and timestamp are extracted from the data block, and are classified and arranged according to the sensor type; step 433, the system layer queries the buffer occupancy rate in real time, and notifies each lightweight process to suspend transmission when the preset threshold is reached, and marks the data block as abnormal and triggers an interruption if the verification fails, and notifies the corresponding lightweight process to retransmit, and the suspension of transmission and retransmission will respectively avoid buffer overflow and data loss.

Citation Information

Patent Citations

  • State collection system and method for all-fiber current transformer

    CN110112832A

  • Shared multi-channel process communication memory structure and method

    CN110532109A

  • Real-time data distribution method and device based on shared memory

    CN112463400A

  • Data transmission method and device, electronic equipment, storage medium and program product

    CN118381796A

  • Data acquisition method and system, Internet of Things platform and storage medium

    CN118646613A