Search

CN-121386572-B - Multi-sensor data transmission method in embedded equipment

CN121386572BCN 121386572 BCN121386572 BCN 121386572BCN-121386572-B

Abstract

The application provides a multi-sensor data transmission method in embedded equipment, which comprises the steps of creating a global data channel and a lightweight process corresponding to each sensor when a system layer of the embedded equipment is initialized, constructing a channel basic information structure body, a lightweight process binding structure body and a data transmission control structure body, filling a channel unique identifier and a process identifier in the lightweight process binding structure body, establishing unidirectional association with the channel basic information structure body, acquiring data according to a preset period by each sensor, packaging the data into a data block in a unified format by the corresponding lightweight process, calculating check codes and updating the check codes to the data transmission control structure body, transmitting the data block to a buffer area bound with the data transmission control structure body by the lightweight process through the global data channel according to a non-blocking mode, reading the data block from the buffer area by a main control lightweight process, classifying the data block if the data block passes verification, triggering retransmission if the data block fails, and solving the technical problems of high resource occupation and the like.

Inventors

  • LI BORAN
  • Tian Oujia
  • HUANG TIANXIANG
  • HE YUANZE

Assignees

  • 睿赛德(上海)信息科技有限公司

Dates

Publication Date
20260512
Application Date
20251222

Claims (8)

  1. 1. The multi-sensor data transmission method in the embedded equipment is characterized by comprising the following steps of 1, creating a lightweight process corresponding to each sensor of a global data channel when the system layer of the embedded equipment is initialized, and constructing a channel basic information structure body, a lightweight process binding structure body and a data transmission control structure body; step 2, filling a channel unique identifier and a process identifier in a lightweight process binding structure body, establishing unidirectional association with a channel basic information structure body, step 3, collecting data by each sensor according to a preset period, packaging the data blocks into a uniform format by the corresponding lightweight process, calculating check codes and updating the check codes to a data transmission control structure body, step 4, transmitting 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, reading the data blocks from the buffer area by a main control lightweight process, classifying the data blocks if the data blocks pass verification, triggering retransmission if the data blocks fail, wherein step 4 comprises the steps of initiating a transmission request to the global data channel by each lightweight process based on the association relation between the lightweight process binding structure body and the global data channel, responding to the transmission request, feeding back the real-time state of the buffer area by the channel basic information structure body through the bidirectional association with the data transmission control structure body, writing the data blocks into the data blocks by the lightweight process according to the non-blocking mode, updating the transmission progress mark into the transmission state, marking the transmission progress is completed after the transmission is completed, marking the transmission is completed, and the main control structure body is read to the synchronous progress information from the main control structure body to the main control structure body after the step 43, and verifying the integrity through a check code in the data transmission control structure body, classifying the data according to the sensor type if the data transmission control structure body passes the check, triggering the retransmission of the corresponding lightweight process if the data transmission control structure body fails the check, and monitoring the occupancy rate and the transmission state of the buffer zone by the system layer.
  2. 2. The method for transmitting multi-sensor data in embedded equipment according to claim 1, wherein the method is characterized in that the method comprises the steps of 11, creating a global data channel, distributing unique channel identifiers through a created channel basic information structure, setting channel types as data channels, enabling an initial running state to be idle, enabling unique channel identifiers to be used for association binding of lightweight processes, 12, creating a lightweight process for each sensor and distributing unique process identifiers, initializing the created lightweight process binding structure, enabling the unique process identifiers to be associated with the unique channel identifiers, 13, creating a data transmission control structure and binding the global data channel, configuring a buffer address and a preset buffer size, enabling an initialization transmission progress mark to be not started, enabling a check code to be 0, and enabling the global data channel bound by the data transmission control structure to be synchronous in transmission state.
  3. 3. The method for transmitting multi-sensor data in an embedded device according to claim 2, wherein step 13 includes the steps of searching for storage resources of the embedded device, allocating a dedicated buffer as a buffer bound with the created data transmission control structure, recording a start address and a storage capacity, writing the buffer address and a preset buffer size into a corresponding field of the data transmission control structure, and setting up a bidirectional association of the data transmission control structure and a channel basic information structure for synchronous feedback of transmission states, wherein step 133, initializing a transmission progress mark to be not started, and setting up a check code field to be 0.
  4. 4. The multi-sensor data transmission method in embedded equipment according to claim 1, wherein step 2 comprises the steps of filling the relevant channel identifier in the channel basic information structure body and the unique process identifier of the corresponding lightweight process in each lightweight process binding structure body, setting the read-write permission mark as write-only, checking the uniqueness of relevant information in each lightweight process binding structure body by a system layer, avoiding channel conflict, checking the uniqueness to enable data to be transmitted in a directed mode, establishing unidirectional association of the lightweight process binding structure bodies and the channel basic information structure bodies, updating the number of relevant lightweight processes in the channel basic information structure bodies to be the total number of sensors, changing the running state to be occupied, and enabling the occupied state of the channel basic information structure bodies to allow data to be written.
  5. 5. The method for transmitting multi-sensor data in embedded equipment according to claim 4, wherein step 22 includes traversing all lightweight process binding structures by a system layer, extracting combined information of an associated channel identifier and a process identifier, performing unique verification for the combined information to avoid channel association conflict, triggering a binding failure alarm if repetition exists, and recording association relation mapping tables of the lightweight process binding structures after verification passes, wherein the association relation mapping tables are used for transmitting state query and verification.
  6. 6. The method for transmitting multi-sensor data in embedded equipment according to claim 1, wherein step 3 comprises the steps of collecting environment or state data according to a preset period to form original data by each sensor, transmitting the original data to a corresponding lightweight process, calling a data packaging interface by the lightweight process, integrating the original data, the sensor numbers and the collection time stamps, packaging the data into a data block with a uniform format according to the field requirements of a data transmission control structure, and calculating check codes of the data block, and updating the check codes and the data length to the corresponding field of the data transmission control structure in step 33.
  7. 7. The method for transmitting multi-sensor data in embedded equipment according to claim 6, wherein step 32 includes the steps of extracting a unique process identifier of a corresponding lightweight process from a sensor number to perform association binding so as to enable a data block to be traceable and unique, obtaining system time to generate an acquisition time stamp, and sorting and combining the acquisition time stamp and original data according to a preset format, and adding a head identifier and a tail check field placeholder of the data block to the sorted and combined original data to form a data block with a uniform format.
  8. 8. The method for transmitting multi-sensor data in embedded equipment according to claim 1, wherein step 43 comprises the steps of calculating check codes and comparing the check codes with check codes recorded in a data transmission control structure after a main control lightweight process reads a data block, step 432 of extracting original data, a sensor number and a time stamp from the data block if the check codes are consistent, sorting according to sensor types, step 433 of inquiring buffer occupancy rate in real time by a system layer, notifying each lightweight process to suspend transmission when a preset threshold is reached, marking the data block abnormal and triggering interruption when the check fails, notifying the corresponding lightweight process to retransmit, and suspending transmission and retransmission respectively avoid buffer overflow and data loss.

Description

Multi-sensor data transmission method in embedded equipment Technical Field The application relates to the technical field of embedded equipment, in particular to a multi-sensor data transmission method in the embedded equipment. Background The embedded equipment is widely applied in the fields of industrial automation, intelligent monitoring, internet of things terminals and the like, the equipment generally needs to integrate a plurality of sensors such as temperature, humidity, pressure, position and the like, environmental parameters or equipment operation state data are collected in real time, and the control decision precision and operation stability of the embedded equipment are directly affected by high-efficiency transmission and reliable reception of the data. Along with the continuous improvement of the requirements of application scenes on data acquisition frequency and sensor quantity, the resource occupancy rate, instantaneity and integrity of multi-sensor data transmission become key technical requirements. In the existing multi-sensor data transmission scheme, an independent physical transmission channel is allocated to each sensor, a blocking type transmission mechanism is adopted, the data collected by the sensor is directly transmitted to a processing unit in an original format, the next frame of data transmission can be started after the previous frame of data is completely received in the transmission process, and unified data verification and format specification are not set. In the existing scheme, the configuration mode of an independent physical channel causes higher system hardware resource occupancy rate, channel competition conflict is easy to occur when a plurality of sensors transmit data simultaneously, the blocking type transmission mode causes lower data transmission efficiency, obvious transmission delay can be generated under a high-frequency acquisition scene, real-time requirements cannot be met, unified data formats and checking mechanisms are lacking, different sensor data formats are incompatible, data errors or losses caused by interference in the transmission process cannot be identified, the reliability of data transmission is reduced, and the method is difficult to adapt to application scenes with limited resources and higher requirements on transmission stability of embedded equipment. Disclosure of Invention In order to solve the above technical problems, the present application provides a multi-sensor data transmission method in an embedded device, so as to at least alleviate the above technical problems. The technical scheme provided by the embodiment of the application is as follows: a multi-sensor data transmission method in an embedded device, comprising: Step 1, when an embedded equipment 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 built; step 2, filling a unique channel identifier and a process identifier in the lightweight process binding structure body, and establishing unidirectional association with a channel basic information structure body; Step 3, each sensor collects data according to a preset period, the data are packaged into data blocks with uniform formats by corresponding lightweight processes, and check codes are calculated and updated to a data transmission control structure; And 4, transmitting the data block to a buffer area bound with the data transmission control structure body through the global data channel by the lightweight process according to a non-blocking mode, reading the data block from the buffer area by the main control lightweight process, classifying the data block if the data block passes verification, and triggering retransmission if the data block fails verification. Optionally, step 1 includes: step 11, creating a global data channel, distributing a unique channel identifier through a created channel basic information structure body, setting a channel type as a data channel, and enabling an initial running state to be idle, wherein the unique channel identifier is used for association binding of a lightweight process; Step 12, creating a lightweight process for each sensor, distributing a unique process identifier, initializing the created lightweight process binding structure, and establishing association between the unique process identifier and the unique channel identifier; And 13, creating a data transmission control structure body, binding a global data channel, configuring a buffer address, presetting the buffer size, initializing a transmission progress mark to be not started, and setting a check code to be 0, wherein the global data channel bound by the data transmission control structure body is in a synchronous transmission state. Optionally, step 13 includes: step 131, inquiring storage resou