Data adaptive parsing method based on data structure type
By creating a collection of data items of data structure types and a data frame constructor, C language data is adaptively parsed into Python data, solving the test program errors and communication bandwidth problems caused by changes in data structure in automated testing software, and achieving efficient and accurate data mapping and testing.
Patent Information
- Application Number
- CN202211063106.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-01
- Publication Date
- 2026-07-10
- Estimated Expiration
- 2042-09-01
AI Technical Summary
In existing automated testing software, the data parsing process for C language derived data types requires manual editing of files to add test data types. Furthermore, changes to the data structure can easily trigger errors in the test program, and frequent bit operations increase communication bandwidth and error risks.
By creating a set of data items of a data structure type, a data frame builder is formed. By utilizing the data length relationship of the data item set within the data frame builder, data is adaptively parsed and mapped to Python type data, reducing bit operations and improving parsing accuracy and flexibility.
It enables automatic adaptive parsing when the data structure changes, reduces bit manipulation, improves the accuracy and flexibility of test data, reduces communication bandwidth requirements, and enhances the stability and robustness of the test software.
Smart Images

Figure CN115470123B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the technical field of bit data conversion, and more specifically to a data adaptive parsing method based on data structure type. Background Technology
[0002] After automated testing software obtains data of C language derived data types (structures, arrays, sets, queues, etc.) from the robot vacuum cleaner through certain media, it needs to parse the data of the derived data types and convert it into Python type data for use by the host computer for testing. In this conversion process, the status bit data often needs to be calculated and processed separately. Each basic data type in C language corresponds to a function, and the testing requirements for different functions are different. It is often necessary to add new test data types temporarily by manually editing the file. Then, whenever the data structure changes, each bit needs to be adjusted. For example, frequent shifting of binary data can easily cause test program errors. Summary of the Invention
[0003] To address the aforementioned problems, this invention maps byte data through a construction model of relevant data structure types, reducing the number of single-bit operations required during data parsing, ensuring the accuracy of data parsing, and obtaining more accurate test data. The specific technical solution of this invention is as follows:
[0004] The adaptive data parsing method based on data structure type includes: creating a set of data items of the corresponding data structure type, and assembling all the created data item sets into a data frame constructor; collecting test data from the internal and external parts of the machine device, and then obtaining the alignment byte length by comparing the data length occupied by the test data with the sum of the data lengths occupied by all data item sets in the data frame constructor; and parsing the test data according to the alignment byte length based on the data structure type of each data item set in the data frame constructor to obtain the mapping information of the corresponding byte data of the test data for use by the test software.
[0005] Furthermore, the method for obtaining the alignment byte length by comparing the data length occupied by the test data with the sum of the data lengths occupied by all data item sets within the data frame constructor includes: when the data length occupied by the test data is less than or equal to the sum of the data lengths occupied by all data item sets within the data frame constructor, setting the data length occupied by one data item set within the data frame constructor as the alignment byte length; when the data length occupied by the test data is greater than the sum of the data lengths occupied by all data item sets within the data frame constructor, setting the sum of the data lengths occupied by all data item sets within the data frame constructor as the alignment byte length; wherein, the data length occupied by each data item set within the data frame constructor is obtained by counting in bytes; the data length occupied by each data item set is associated with its corresponding data structure type.
[0006] Further, the method of parsing the test data according to the alignment byte length, based on the data structure type of each data item set within the data frame constructor, includes: when the data length occupied by the test data is greater than the sum of the data lengths occupied by all data item sets within the data frame constructor, extracting a data segment to be mapped or sequentially extracting multiple data segments to be mapped from the test data according to the corresponding alignment byte length; wherein, the data length occupied by a data segment to be mapped is equal to the sum of the data lengths occupied by all data item sets within the data frame constructor; for a data segment to be mapped, configuring a corresponding storage order for the corresponding byte data in the data segment to be mapped, based on the data structure type of each data item set within the data frame constructor, setting the function name associated with each data item set as the function tag information of the corresponding byte data in the data segment to be mapped, and determining that the parsing of the test data is complete, and then the test software reads the data segment to be mapped according to the storage order for testing; wherein, the mapping information of the corresponding byte data of the test data includes function tag information and / or storage order.
[0007] Furthermore, the method of configuring the corresponding storage order for the corresponding byte data in the data segment to be mapped by combining the data structure type of each data item set in the data frame constructor includes: configuring the creation order of each data item set in a data frame constructor as the storage order of the corresponding byte data in the data segment to be mapped, so that each data item set in the data frame constructor is mapped to the corresponding byte data in the data segment to be mapped; when the data item set belongs to a C language data structure, configuring the storage order of each bit data in the data item set as the storage order of data with the same bit order in the corresponding byte data of the data segment to be mapped, so that each byte data of the data segment to be mapped is split into 8 bits according to the data order from the lowest bit to the highest bit in the corresponding data item set, and setting the function name corresponding to each bit in the data item set as the function name of the corresponding bit data in the data segment to be mapped. The information is recorded in a set of data items belonging to a C language data structure. One bit in the set of data items corresponds to one data item, and one data item is used to record a function name. The data item set occupies a data length of 1 byte. When the data item set belongs to a standard Python language data structure, the storage order of each byte of data in the data item set is configured to match the storage order of the byte data mapped to the data segment to be mapped. This ensures that multiple bytes of data in the data segment to be mapped are mapped to the memory address of the corresponding byte data in the same data item set. This allows the testing software to directly read the data segment to be mapped according to the function name corresponding to the data item set, and sets the function name of one data item in the data item set as the function tag information of the corresponding byte data in the data segment to be mapped. Here, a set of data items belonging to a standard Python language data structure records a function name, and the data item set occupies a data length greater than or equal to 1 byte.
[0008] Furthermore, the method of parsing the test data according to the aligned byte length, based on the data structure type of each data item set within the data frame constructor, includes: when the data length occupied by the test data is less than or equal to the sum of the data lengths occupied by all data item sets within the data frame constructor, within the data frame constructor, starting from the first created data item set, controlling the corresponding data item set to traverse each byte of the test data according to the corresponding aligned byte length, until the sum of the data lengths occupied by each data item set participating in the traversal equals the data length occupied by the test data; then, based on the data structure type of each data item set participating in the traversal, using the traversal order of each data item set participating in the traversal, configuring the corresponding storage order for each byte of the test data, setting the function name associated with each data item set as the function tag information of the corresponding byte data in the test data, and determining that the parsing of the test data is complete, and then the test software reads the test data according to the storage order for testing; wherein, the mapping information of the corresponding byte data of the test data includes function tag information and / or storage order.
[0009] Furthermore, within the data frame constructor, starting from the first created set of data items, during the process of sequentially traversing each byte of the data to be tested according to the corresponding aligned byte length, the following occurs: after traversing the current group of bytes in the data to be tested using a set of data items in the current creation order, the next set of data items in the subsequent creation order is controlled to traverse the next group of bytes in the data to be tested. Then, the next set of data items in the subsequent creation order is updated to the set of data items in the current creation order, and the next group of bytes in the data to be tested is updated to the current group of bytes in the data to be tested. This process is repeated until some or all of the data item sets within the data frame constructor have traversed the data to be tested, and it is determined that the data length occupied by the data item sets participating in the traversal is equal to the data length occupied by the data to be tested. Wherein, when the set of data items in the current creation order belongs to a C language data structure, the data length occupied by the current group of bytes in the data to be tested is one byte; wherein, when the set of data items in the current creation order belongs to a standard Python language data structure, the data length occupied by the current group of bytes in the data to be tested is at least one byte.
[0010] Furthermore, the method of configuring the corresponding storage order for each byte of the data to be tested by combining the data structure type of each set of data items participating in the traversal and the traversal order of each set of data items participating in the traversal includes: configuring the creation order of a portion or all of the data item sets within a data frame constructor as the storage order of each byte of the data to be tested, so that each byte of the data to be tested is mapped to the corresponding data item set within the data frame constructor; when the data item set belongs to a C language data structure, configuring the storage order of each bit within the data item set as the storage order of data with the same bit order within a byte of data traversed in the data to be tested, so that each byte of data is split into 8 bits according to the data order from the lowest bit to the highest bit within the data item set, and setting the function name corresponding to each bit within the data item set. The data item set is configured with functional marker information for the corresponding bit data in the byte data. In a data item set belonging to a C language data structure, one bit corresponds to one data item, and one data item records a functional name. The data item set occupies a data length of 1 byte. When the data item set belongs to a standard Python language data structure, the storage order of each byte data in the data item set is configured to match the storage order of the bytes data traversed by the data item set in the test data. This ensures that one or more bytes of the test data are mapped to the memory address of the corresponding byte data in the same data item set. The functional name of the data item set is set as the functional marker information for the corresponding byte data traversed by the data item set. In a data item set belonging to a standard Python language data structure, one data item set records a functional name, and the data item set occupies a data length greater than or equal to 1 byte.
[0011] Furthermore, the process of parsing the test data according to the aligned byte length includes: starting from a pre-allocated memory address, traversing the corresponding bytes of the test data in sequence with the corresponding aligned byte length as the step size to achieve the division of the test data; the creation order of the data item set within a data frame constructor is the arrangement order of the data item set in the memory space to which the data frame constructor belongs; the mapped byte data in the test data is configured with corresponding functional tag information and storage order, and the mapped byte data in the test data is cached in a specific memory address according to the storage order so that the test software can read it according to the test requirements.
[0012] Furthermore, the data frame constructor includes multiple C language data structures and / or standard Python language data structures; within the data frame constructor, the creation order of each data item set is different, and each data item set is a structure created at a pre-specified memory address to record the function names of one or more functions that the machine device needs to test. The first data item set created is a structure created at the starting address of the memory space to which the data frame constructor belongs, and this starting address is the pre-allocated memory address.
[0013] Further, the method of traversing the corresponding bytes of the test data sequentially from a pre-allocated memory address, with the corresponding alignment byte length as the step size, includes: when the data length occupied by the test data is less than or equal to the sum of the data lengths occupied by all data item sets in the data frame constructor, setting the data length occupied by any data item set in the data frame constructor to the corresponding alignment byte length, and then, according to the creation order of the data item sets, starting from a pre-allocated memory address, controlling each byte of the test data to be sequentially aligned with the corresponding data item set, wherein the storage address of the lowest or highest bit in the corresponding data item set is divisible by the data length occupied by that data item set, and allowing the test data to be aligned with the corresponding data item set. Each byte of the test data falls into the memory address of the corresponding data item set. When the data length occupied by the test data is greater than the sum of the data lengths occupied by all data item sets in the data frame constructor, the sum of the data lengths occupied by all data item sets in the data frame constructor is set to the alignment byte length. Then, according to the creation order of the data item sets, starting from a pre-allocated memory address, the data items in each data item set are aligned sequentially with the byte data of the corresponding storage order of the test data. The storage address of the least significant bit or the most significant bit in each data item set is divided by the data length occupied by that data item set, and part of the test data fills the memory addresses of all data item sets in the data frame constructor.
[0014] The technical effects of this invention include:
[0015] This invention discloses a data frame constructor consisting of multiple sets of data items. The data frame constructor includes a set of data items (a data structure belonging to the C language) with bits as the unit of marking data items, and a set of data items supporting standard data types (a data structure belonging to the standard Python language), forming a data structure composed of multiple sets of data items of different data structure types. Combinations of multiple data structure types are allowed within the same data frame constructor.
[0016] Each data item within a data item set of each data structure type corresponds to a function, and each function corresponds to a test requirement of the robot. Therefore, the same data item set provided by this invention is equivalent to a sub-data constructor. When specifically applied to C language data structures, this sub-data constructor is equivalent to a bit data constructor (equivalent to a constructor function involving member variables in units of bits). When specifically applied to predefined standard programming languages, this sub-data constructor is equivalent to a data constructor for standard data structure types (equivalent to a constructor function involving a member variable in units of multiple bytes). This forms a mapping relationship model between Python data structures and C data structures. Thus, it can cover multiple functions (capable of being marked with 8 bits as storage units) or only one function (capable of being marked with appropriate bytes as storage units), adapting to the functional parameter types of various sensor devices and cleaning components required for robot testing. The created data item set can automatically match the robot's associated test function types to accurately construct test data for each byte. Byte-by-byte data construction is more flexible, improving the accuracy, flexibility, and versatility of parsing the test data.
[0017] After creating the data item set of the aforementioned data structure types, by comparing the data length occupied by the externally input test data with the sum of the data lengths occupied by all data item sets in the data frame builder, the system adaptively selects either all data item sets or a single data item set in the data frame builder as the byte alignment mapping unit and automatically generates an appropriate alignment byte length. Then, the test data can be parsed according to the alignment byte length, realizing the mapping and conversion of a frame of data on a byte-by-byte basis, obtaining the functional tag information and / or storage order corresponding to each byte of the test data for use by the test software.
[0018] Specifically, when the length of the data to be tested exceeds the sum of the lengths of all data item sets within the data frame constructor, a data segment to be mapped is extracted from the data to be tested. Then, based on the data structure type of each data item set within the data frame constructor, the corresponding storage order is configured for the corresponding bytes in the data segment to be mapped. The extracted portion of the data to be tested is then ordered to fall into (mapped to) the memory address of each data item set in units of aligned byte length to complete the adaptive parsing process of a frame of data to be tested. Thus, in stages where the length of the data to be tested is large, the data segment to be mapped that needs to be parsed can be specified only once, resulting in greater flexibility and versatility.
[0019] On the other hand, when the length of the data to be tested is less than or equal to the sum of the lengths of all data item sets within the data frame constructor, starting from the first created data item set, the corresponding data item sets are sequentially controlled to traverse the corresponding bytes of the data to be tested according to the corresponding aligned byte lengths, until the entire data to be tested has been traversed. Then, combining the data structure types of each data item set involved in the traversal, and utilizing the traversal order of each data item set involved in the traversal, the corresponding storage order is configured for each byte of the data to be tested. This allows the data to be tested to fall into (mapped to) the memory address of the matching data item set in an orderly manner, with aligned byte lengths as units, thus completing the adaptive parsing process of a frame of test data. This automatically ensures compatibility with the functions corresponding to parameters in different data structure types, comprehensively and accurately addressing the testing needs of various robot functions, and improving the accuracy of data parsing.
[0020] During the parsing of test data, starting from a pre-allocated memory address, each byte of the test data is sequentially aligned with its corresponding set of data items. After byte alignment, each data item can be retrieved at once when it is in the aligned position within its set of data items. This reduces the number of times the CPU accesses memory, thereby improving the reading efficiency of the test software (host computer). Attached Figure Description
[0021] Figure 1 The flowchart of a data adaptive parsing method based on data structure type is disclosed in an embodiment of the present invention. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this application clearer, the application is described and illustrated below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application. All other embodiments obtained by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0023] After automated testing software acquires one or more frames of data from a machine through certain communication interfaces, it needs to convert the acquired data into a standard programming language format. For example, it needs to convert C language data structures into standard Python language data structures for use by the host computer. To meet this conversion requirement, existing technologies often require the construction of various types of data structures to carry different types of data. The corresponding data types or constructed data structures can be used to represent: environmental feature data of a robot vacuum cleaner in a ground movement scenario, the robot vacuum cleaner's own pose information, and the parameter status of the robot vacuum cleaner's own working equipment. Specifically, the robot vacuum cleaner collects its own motion state data through installed motion sensors. The motion sensors installed on the robot vacuum cleaner include, but are not limited to, LiDAR, cameras, inertial measurement units, or odometers. The robot vacuum cleaner can also measure electrical parameters through current sensors, measure equipment temperature through temperature sensors, and measure ambient humidity through humidity sensors. Each sensor can correspond to a data type or a data structure type. However, whenever the data structure corresponding to the test data acquired by the automated testing software changes, it is necessary to calculate and adjust each bit of data in the corresponding data structure. For example, frequent shifting operations on binary data can easily cause test program errors, including crashes, data loss, and abnormal interruptions. Moreover, bit-by-bit operations can easily increase the communication bandwidth of the device.
[0024] To address the aforementioned problems, this invention discloses a data adaptive parsing method based on data structure type. The execution entity of this data adaptive parsing method is a computer, a host computer for software testing, a terminal device for the function to be tested, or other related machine equipment for the function to be tested; such as... Figure 1 As shown, the adaptive data parsing method includes:
[0025] Step S1: Create a set of data items of different data structure types to record the function names associated with the functions to be tested by the robot. Combine all created data item sets into a data frame constructor, and then execute step S2. The data length of each data item set is associated with its data structure type. A data frame constructor can include data item sets of multiple data structure types, thus marking the names of various functions to be tested by the robot. A data item set of one data structure type can include data items of at least one data type, and the name of a function to be tested corresponds to at least one data item of one data type. Preferably, sensor data with different data identifiers (belonging to identifier variables) are mounted in matching cache addresses within the same structure or object created by the same constructor. Each data identifier is matched one-to-one with a corresponding sensor data type (mainly basic data types in C language).
[0026] Step S2: Collect test data from the inside and outside of the robot device. The sources of the test data include, but are not limited to, ground detection sensors, gyroscopes, optical flow sensors, laser sensors, cameras, TOF modules, ultrasonic sensors, and WiFi modules mounted on the robot's casing. When the robot is a vacuum cleaner, the sources of the test data include, but are not limited to, side brushes, roller brushes, mops, water tanks, and cleaning components associated with indoor cleaning mounted on the robot's casing. The functional identifiers of the test data can be divided into whether it is available, whether it has been calibrated, whether it is installed, whether it has been detected, whether it has been initialized, whether a collision has occurred, whether it is planning to walk, whether it is charging, whether the drive wheels are suspended, intensity, distance, speed, etc. The functional identifiers of the test data vary depending on the function corresponding to the test data. Then, by comparing the data length occupied by the test data with the sum of the data lengths occupied by all data items in the data frame constructor, the alignment byte length is obtained, and then step S3 is executed; preferably, step S2 can control the overall comparison between the test data and all data items in the data frame constructor in terms of data type, structure or object, and take the smaller data length as the alignment byte length to form a reasonable alignment value for parsing the test data in bytes, so as to save CPU read and write bandwidth.
[0027] Step S3: Combining the data structure types of each data item set in the data frame constructor, the test data is parsed according to the aligned byte length to obtain the mapping information of the corresponding byte data of the test data for use by the test software. Preferably, all mapped data key-value pairs (mapping information) are placed in a dictionary container for use by the host computer. This will generate data type mapping, including converting basic C language data types to standard data types, such as converting size_t to integer, char[] to byte string, and _Bool to bool, so that the test software can directly call the test. As one implementation, in step S3, the test data (equivalent to the original data of the execution body of the data adaptive parsing method) is unpacked, and the functional tag information and / or storage order corresponding to each byte of the test data are mapped according to the initialization order of each data item set or the corresponding mapped address is directly assigned. The mapping information includes functional tag information and / or storage order. Preferably, the type tag set of the function to be tested is used to set a tag for each byte of data and to set a type tag for each byte of data as a whole. Of course, in some embodiments, steps S1 to S3 can also be considered as part of the test operation of the test software, that is, the data mapping steps involved in the test process of the test software for the test data, including type mapping and / or address space mapping.
[0028] In summary, after creating a set of data items of the relevant data structure type in step S1, the system adaptively selects either the set of all data items or a single data item set within the data frame constructor as the byte-aligned mapping unit by comparing the data length occupied by the externally input test data with the sum of the data lengths occupied by all data item sets within the data frame constructor. It also automatically generates an appropriate alignment byte length. The test data can then be parsed according to this alignment byte length, achieving byte-based mapping and conversion of a frame of data. This yields the functional marker information and / or storage order corresponding to each byte of the test data, which is then used by the test software. No separate calculation is required for the status bit data. Whenever the data structure changes, the present invention calculates and adjusts the test data in byte-based units to complete the parsing. Therefore, during the testing process of the parsed data, the number of bit shift calculations for each bit of a single frame data packet is reduced, enhancing the robustness and stability of the test software program.
[0029] As one embodiment, when the data length occupied by the data to be tested is less than or equal to the sum of the data lengths occupied by all data item sets within the data frame constructor, the data length occupied by one data item set within the data frame constructor is set to the alignment byte length. The data item set currently set to the alignment byte length is the data item set currently traversed in the data to be tested (corresponding to at least one byte length). Therefore, when the data structure types of the various data item sets within the data frame constructor are not completely identical, an alignment byte length is set for each at least one byte length data segment of the data to be tested, and the alignment byte lengths set sequentially are different from each other. When the data length occupied by the data to be tested is greater than the sum of the data lengths occupied by all data item sets within the data frame constructor, the sum of the data lengths occupied by all data item sets within the data frame constructor is set to the alignment byte length. In this embodiment, all data item sets within the data frame constructor are used as the unit of byte alignment, i.e., as the parsing unit of the data to be tested. The data length occupied by each data item set within the data frame constructor is obtained by counting in bytes, so the alignment byte length includes multiple byte lengths. Therefore, this embodiment uses data type, structure, or object as the unit of measurement to control the comparison of the data length between the data to be tested and the set of all data items in the data frame constructor. The smaller data length is taken as the alignment byte length, forming a reasonable alignment value for parsing the data to be tested in bytes. This saves the read and write bandwidth of the test software and efficiently and stably controls the mapping of the data to be tested to the set of data items with the same byte length in the data frame constructor, or determines the mapping relationship between the data to be tested and the set of data items with the same byte length in the data frame constructor.
[0030] As one embodiment, the data frame constructor includes multiple C language data structures and / or standard Python language data structures. The data frame constructor is configured to include multiple C language data structures and / or standard Python language data structures for traversing a frame of test data. A C language data structure may include an array, a structure, or other data structure capable of enumerating at least one data type to fill each byte of data in a frame of test data. A standard Python language data structure can only enumerate one data type. Within the data frame constructor, the creation order of each data item set is different, and each data item set is ordered and has a corresponding memory creation time. Therefore, the initialization time of the variables for the data items and their associated function names of the functions to be tested by the robot within each data item set is different. In this embodiment, each data item set is a structure created at a pre-specified memory address to record the function names and meanings of one or more functions to be tested by the robot. The first set of data items created is a structure created at the starting address of the memory space belonging to the data frame constructor. This starting address is a pre-allocated memory address, which can specifically correspond to the address parameter contained in a constructor stored in the programming language library. This constructor can also initialize the set of data items at the pre-specified memory address. Thus, the data to be tested is grouped according to its structure type, resulting in multiple data groups. The data structure corresponding to each data group is divided according to the function to be tested by the robot (identified by the dimension of function name), resulting in multiple data categories. If the data corresponding to each data category is stored in the same column or row in memory, a data storage format identifier corresponding to the data to be tested can be generated, facilitating reading and use by the testing software.
[0031] Preferably, when a data item set belongs to a C language data structure, the data item set consists of 8 data items, excluding necessary identifier characters (which are not data items and are not included in the data length calculation). These data items correspond sequentially to the first bit (bit0) to the eighth bit (bit7) in the C language data structure, and occupy a data length of 1 byte. Here, data length refers to the size of the data in bytes. This data item set is equivalent to a bit data constructor. The data items in the bit data constructor store various binary numbers. Each bit data constructor can represent 8 binary numbers, with the aim of reducing the size of the transmitted data and saving bandwidth.
[0032] Preferably, a data item set can also consist of a single data item that corresponds to only one data type in the standard Python language. Its unit of measurement is bytes, and the data item set occupies at least one byte. It also has a corresponding storage format identifier character to facilitate counting and traversing its data length.
[0033] It's important to note that each set of data items belongs to a specific data structure. A frame of test data is received, and then the data item sets of various data structure types are categorized and packaged to achieve functional labeling. For example, in an indoor cleaning scenario, various sub-functions (such as cleaning carpets, mopping, planned sweeping, stopping vacuuming, etc.) are labeled, meaning each data item is assigned a data item name and its corresponding memory address. This is done by adding a label definition to the corresponding memory address, suitable for grouping and parsing the same frame of test data. The testing software then sequentially obtains the data type required for each sub-function and associates it with the test data used for the actual function. A mapping relationship can then be formed between data item sets of different data structure types, and a mapping relationship can also be formed between a single data item set and the test data.
[0034] In an embodiment used for sensor testing, when the communication interface acquires sensor data collected by the robot's sensors and establishes a communication connection, it transmits the sensor data to the associated communication bus control device. It should be noted that each type of sensor collects sensor data of a specific data type, and different types of sensors collect different data types. The data type serves as a digital identifier for the sensor data or a model identifier for the sensor device. Enumeration of various sensor devices can be accomplished using a data item set or a data frame constructor. In this embodiment, based on the data type of the sensors actually assembled on the robot, a corresponding data item set and its internal data items (including data item names and their meanings, as well as identification characters) are predefined to form a data constructor for traversing and parsing the data to be tested. Furthermore, this embodiment selects to traverse the data to be tested on a constructor-by-constructor basis to match byte lengths and sets the data item name to the required identification field for parsing.
[0035] In conjunction with the foregoing embodiments, the present invention discloses a data frame constructor consisting of multiple sets of data items. The data frame constructor includes a set of data items marked by bits (a data structure belonging to the C language) and a set of data items supporting standard data types (a data structure belonging to the standard Python language), forming a data structure composed of multiple sets of data items of different data structure types. Combinations of multiple data structure types are allowed within the same data frame constructor. In the foregoing embodiments, each data item in the data item set of each data structure type corresponds to a function, and each function corresponds to a test requirement of the robot. Therefore, the same data item set provided by this invention is equivalent to a sub-data constructor. When specifically applied to C language data structures, this sub-data constructor is equivalent to a bit data constructor (equivalent to a constructor function involving member variables in units of bits). When specifically applied to a predefined standard programming language, this sub-data constructor is equivalent to a data constructor of a standard data structure type (equivalent to a constructor function involving a member variable in units of multiple bytes), corresponding to the mapping relationship model between Python data structures and C data structures. Thus, it can cover multiple functions (capable of being marked with 8 bits as storage units) or only one function (capable of being marked with appropriate bytes as storage units) to adapt to the functional parameter types of various sensor devices and cleaning components required for robot testing. The created data item set can automatically match the robot's associated test function type to accurately construct test data for each byte. Byte-by-byte data construction is more flexible and can improve the accuracy, flexibility, and versatility of parsing the test data.
[0036] As one embodiment, the method of parsing the test data according to the aligned byte length, based on the data structure type of each data item set within the data frame constructor, includes: when the data length occupied by the test data is greater than the sum of the data lengths occupied by all data item sets within the data frame constructor, A data segment to be mapped is extracted from the test data according to the corresponding alignment byte length, or multiple data segments to be mapped are extracted sequentially. The corresponding alignment byte length is the sum of the data lengths occupied by all data items in the data frame constructor. Preferably, a data segment to be mapped extracted from the test data according to the corresponding alignment byte length is a data segment whose byte length (data length) is equal to the data length occupied by all data items in the data frame constructor, starting from the first address of the data frame constructor. The data length occupied by a data segment to be mapped is equal to the sum of the data lengths occupied by all data items in the data frame constructor. Preferably, multiple data segments to be mapped are extracted sequentially from the test data according to the corresponding alignment byte length. This can be done by traversing the test data to divide the entire test data into multiple data segments to be mapped (including padding fields), or by dividing the valid part of the test data into multiple data segments to be mapped. In this embodiment, for a data segment to be mapped, the storage order of the corresponding byte data in the data segment is configured based on the data structure type of each data item set in the data frame constructor. The function name associated with each data item set is set as the function tag information of the corresponding byte data in the data segment to be mapped. The parsing of the data to be tested is completed, which can also be regarded as the mapping of the data to be tested. The mapped data to be tested is stored sequentially in the memory address of the corresponding data item set. The test software then reads the data segment to be mapped according to the storage order for testing. The data segment to be mapped is tested in the test software according to the function tag of all data item sets.
[0037] Preferably, the data structure type of each data item set in the data frame constructor can be a C language data structure or a standard Python language data structure. The mapping information of the corresponding byte data of the test data in the foregoing embodiment includes functional marking information and / or storage order. One or more bytes of data correspond to a functional marking information. The specific byte length is determined by the data type applicable to the data items included in the data item set. For example, a data item in the standard Python language data structure used to mark the detection distance of the depth camera corresponds to an integer type, which occupies 4 bytes. Then, 4 bytes of memory space are used to mark a functional marking information.
[0038] In this embodiment, the method of configuring the corresponding storage order for the corresponding byte data in the data segment to be mapped by combining the data structure type of each data item set in the data frame constructor includes: configuring the creation order of each data item set in a data frame constructor as the storage order of the corresponding byte data of the data segment to be mapped, so that each data item set in the data frame constructor is mapped to the corresponding byte data of the data segment to be mapped, thereby causing some or all of the byte data of the data segment to be mapped to fall into the memory address of each data item set in the data frame constructor in sequence.
[0039] Specifically, when the data item set is a data structure belonging to the C language, the data item set can be regarded as a structure, equivalent to a bit constructor. The structure includes multiple member variables, each member variable marking the name of a function to be tested. In this embodiment, one bit in a data item set belonging to the C language data structure corresponds to one data item, that is, one member variable occupies one bit of data length, which is reflected in memory space, making it convenient for address calculation and bit traversal counting. One data item is used to record a function name, and the data length occupied by the data item set is 1 byte. In this embodiment, when the data item set is a data structure belonging to the C language, the storage order of each bit data in the data item set is configured such that data with the same bit order are stored in the corresponding byte data of the data segment to be mapped, which is the initialization order of each bit data in the data item set. After the data segment to be mapped is transmitted from the outside to the execution body of the data adaptive parsing method or the memory space where the data item set is located, each bit in the corresponding byte data of the data segment to be mapped is configured to be aligned one-to-one with the corresponding bit data in the data item set, forming byte alignment at the address. This makes each byte data of the data segment to be mapped split into 8 bits according to the data order from the lowest bit to the highest bit in the corresponding data item set, so that the test software can read each byte data of the data segment to be mapped in an orderly manner. The function name corresponding to each bit in the data item set is set as the function mark information of the corresponding bit data in the data segment to be mapped. Then the test software reads the data segment to be mapped (single byte data) according to the data order from the lowest bit to the highest bit in the data item set. Preferably, a set of data items can be filled with 8 bits of data to align the data segment to be mapped, but it is not necessary to traverse all the data to be tested. The mapping operation of the data segment to be mapped can be completed by the structure of the bit constructor; the parsing of the data segment to be mapped is completed, and the byte-by-byte mapping of the data segment to be mapped is also completed.
[0040] On the other hand, when the data item set belongs to a standard Python language data structure, the data item set is a data structure that includes one data item to mark a function. Here, a data item set belonging to a standard Python language data structure corresponds to recording a function name. The data length occupied by the data item set is greater than or equal to 1 byte. The specific data length is determined by the data type of the data item included in the data item set. It can refer to the basic data types of the C language. For example, the data of a long integer occupies 4 bytes, and the data of a double floating-point number occupies 8 bytes. The data length occupied by each standard Python language data structure included in the data frame constructor may not be the same, but the data length occupied by each C language data structure included in the data frame constructor is fixed to be equal to 1 byte. In this embodiment, the storage order of each byte of data within the data item set is configured to match the storage order of the mapped byte data of the data segment to be mapped. This ensures that multiple bytes of data in the data segment to be mapped are mapped to the memory addresses of corresponding bytes within the same data item set. For example, if a data item set occupies a 4-byte data length, then the 4 bytes of data in the data segment to be mapped are sequentially aligned with the 4 bytes of data in one data item of the data item set. Therefore, the storage order of each byte of data within the data item set in the same memory space is configured to match the relative alignment (understood as a form of address mapping or data mapping) of the byte data in the data segment to be mapped, thereby... The four bytes of data in the data segment to be mapped are mapped to the same data item set and sequentially mapped to four memory addresses within the same data item set. Each byte of data is assigned a memory address, so that the test software can directly read the data segment to be mapped according to the function name corresponding to the data item set. The function name of one data item in the data item set is set as the function tag information of the corresponding byte of data in the data segment to be mapped, thus completing the mapping. This allows the standard Python language data structure to directly assign values to the data segment to be mapped byte by byte, without splitting the data bit by bit. After mapping, the standard Python language data type is obtained, which is convenient for the test software to call.
[0041] In summary, after creating the data item set of the aforementioned data structure types, by comparing the data length occupied by the externally input test data with the sum of the data lengths occupied by all data item sets in the data frame builder, the system adaptively selects either all data item sets or a single data item set in the data frame builder as the byte alignment mapping unit and automatically generates an appropriate alignment byte length. Then, the test data can be parsed according to the alignment byte length, realizing the mapping and conversion of a frame of data on a byte-by-byte basis, obtaining the functional tag information and / or storage order corresponding to each byte of the test data for use by the test software. Specifically, when the length of the data to be tested exceeds the sum of the lengths of all data item sets within the data frame constructor, a data segment to be mapped is extracted from the data to be tested. Then, based on the data structure type of each data item set within the data frame constructor, the corresponding storage order is configured for the corresponding bytes in the data segment to be mapped. The extracted portion of the data to be tested is then ordered to fall into (mapped to) the memory address of each data item set in units of aligned byte length to complete the adaptive parsing process of a frame of data to be tested. Thus, in stages where the length of the data to be tested is large, the data segment to be mapped that needs to be parsed can be specified only once, resulting in greater flexibility and versatility.
[0042] As one embodiment, the method of parsing the test data according to the alignment byte length, based on the data structure type of each data item set within the data frame constructor, includes: when the data length occupied by the test data is less than or equal to the sum of the data lengths occupied by all data item sets within the data frame constructor, within the data frame constructor, starting from the first created data item set (specifically, the first storage address of the data item in the data frame constructor), controlling the corresponding data item set to traverse each byte of the test data according to the corresponding alignment byte length, until the sum of the data lengths occupied by each data item set participating in the traversal equals the data length occupied by the test data. That is, within the data frame constructor, from the first data item set to the Nth data item set, the first byte to the Mth byte of the test data are sequentially aligned, where the data length occupied by the test data is M bytes, but the data frame constructor... The number of data item sets created within the data frame constructor is greater than or equal to N. Regardless of the data structure type of the data item set within the data frame constructor, the data frame constructor can provide M bytes of mapping units aligned with the data to be tested. When the data item set belongs to a C language data structure, the number of data item sets created within the data frame constructor is greater than or equal to M. When the data item set belongs to a standard Python language data structure, since the data length occupied by this data structure type is not fixed and is at least greater than or equal to one byte, the number of data item sets created within the data frame constructor is greater than or equal to M. Then, combining the data structure types of each set of data items participating in the traversal, and utilizing the traversal order of each set of data items (equivalent to the address sorting of each set of data items in the same memory space), the corresponding storage order is configured for each byte of the data to be tested. The function name associated with each set of data items is set as the function tag information of the corresponding byte of data in the data to be tested, and the parsing of the data to be tested is completed. This can also be regarded as completing a complete mapping of the data to be tested. The mapped data to be tested is stored sequentially in the memory address of the corresponding set of data items. The testing software then reads the data to be tested according to this storage order for testing. Specifically, the testing software performs tests sequentially according to the function tag corresponding to the set of data items participating in the traversal.Based on this embodiment, when the length of the data to be tested is less than or equal to the sum of the lengths of all data item sets within the data frame constructor, starting from the first created data item set, the corresponding data item sets are sequentially controlled to traverse the corresponding bytes of the data to be tested according to the corresponding aligned byte lengths, until the entire data to be tested has been traversed. Then, combining the data structure types of each data item set involved in the traversal, and utilizing the traversal order of each data item set involved in the traversal, the corresponding storage order is configured for each byte of the data to be tested. This orderly allows the data to be tested to fall into (mapped to) the memory address of the matching data item set in units of aligned byte lengths, thus completing the adaptive parsing process of a frame of test data. This automatically ensures compatibility with the functions corresponding to parameters in different data structure types, comprehensively and accurately addressing the testing needs of various robot functions, and improving the accuracy of data parsing.
[0043] In this embodiment, within the data frame constructor, starting from the first created data item set, during the process of sequentially traversing each byte of the data to be tested according to the corresponding aligned byte length, the following occurs: after traversing the current group of bytes in the data to be tested using a data item set with the current creation order, the next group of bytes in the data to be tested is controlled by a data item set with a later creation order. Then, the data item set with a later creation order is updated to the data item set with the current creation order, and the next group of bytes in the data to be tested is updated to the current group of bytes in the data to be tested. This achieves the effect of using a data item set with a later creation order to traverse the next group of bytes in the data to be tested. This process is repeated until some or all of the data item sets within the data frame constructor have traversed the data to be tested, and it is determined that the data length occupied by the data item sets participating in the traversal is equal to the data length occupied by the data to be tested. The parsing of the data to be tested (traversing and mapping one by one) is completed using data item sets of equal byte length. In this embodiment, when the data item set in the current creation order belongs to a C language data structure, the current group of bytes in the test data occupies a data length of one byte; when the data item set in the current creation order belongs to a standard Python language data structure, the current group of bytes in the test data occupies a data length of at least one byte. This allows the use of one or more bytes of memory space to represent the function name corresponding to a data type with equal data length, or to represent multiple function names corresponding to a data structure with equal data length. The current creation order is always one less than the order of the next data item set created later, and the group of the current group of bytes in the test data is always one less than the group of the next group of bytes in the test data. The data length occupied by each group of bytes is not necessarily equal, and varies depending on the data type of each group of bytes. This allows for adaptive parsing of the test data using data item sets of equal byte length (traversing and mapping according to the byte length (data length) occupied by each data type) by combining the data structure types of each data item set in the data frame constructor.
[0044] Specifically, the method of configuring the corresponding storage order for each byte of the data to be tested by combining the data structure type of each set of data items participating in the traversal and the traversal order of each set of data items participating in the traversal includes: configuring the creation order of a partial set of data items or all sets of data items within a data frame constructor as the storage order of each byte of the data to be tested, so that each byte of the data to be tested is mapped to the corresponding set of data items within the data frame constructor. Specifically, when the data length occupied by the data to be tested is less than the sum of the data lengths occupied by all sets of data items within the data frame constructor, the creation order of a partial set of data items within a data frame constructor is sequentially configured as the storage order of each byte of the data to be tested; when the data length occupied by the data to be tested is equal to the sum of the data lengths occupied by all sets of data items within the data frame constructor, the creation order of all sets of data items within a data frame constructor is sequentially configured as the storage order of each byte of the data to be tested.
[0045] When the data item set is a data structure belonging to the C language, the data item set can be regarded as a structure, equivalent to a bit constructor. The structure includes multiple member variables, each member variable marking the name of a function to be tested. In this embodiment, one bit in a data item set belonging to the C language data structure corresponds to one data item, that is, one member variable occupies one bit of data length, which is reflected in memory space, making it convenient for address calculation and bit traversal counting. One data item is used to record a function name, and the data item set occupies a data length of 1 byte. Then, in this embodiment, the storage order of each bit in the data item set is configured such that the storage order of data with the same bit order in the test data is the initialization order of each bit in the data item set. After the traversed byte data is transmitted from the outside to the execution body of the data adaptive parsing method or the memory space where the data item set is located, each bit in the byte data that is mapped to the byte data segment is configured to be aligned one-to-one with the corresponding bit data in the data item set, forming byte alignment at the address. This makes the byte data split into 8 bits according to the data order from the lowest bit to the highest bit in the data item set. Then, the test software reads each byte data in the test data according to the data order from the lowest bit to the highest bit in the data item set. Preferably, a data item set can be filled with 8 bits of data to align all bytes of the data to be tested, so that the test software can read the byte data in an orderly manner and set the function name corresponding to each bit in the data item set as the function tag information of the corresponding bit data in the byte data, thereby completing the parsing of the data segment to be mapped on a byte-by-byte basis and completing the byte-by-byte mapping of the data segment to be mapped.
[0046] On the other hand, when the data item set belongs to a standard Python language data structure, it is a data structure that includes one data item to mark a function. Each data item set belonging to a standard Python language data structure corresponds to a function name. The data length occupied by this data item set is greater than or equal to one byte, and the specific data length is determined by the data type of the data items included in the data item set. In this embodiment, the storage order of each byte of data within the data item set is configured to match the storage order of the bytes of data traversed by the data item set in the test data. This ensures that one or more bytes of data in the test data are mapped to the memory address of the corresponding byte of data within the same data item set. For example, if a data item set occupies two bytes of data, then among the bytes of data traversed by the data item set in the test data, two bytes are aligned sequentially with two bytes of data from one data item in the data item set. Therefore, the storage order of each byte of data within the data item set in the same memory space is configured to be aligned with the bytes of data traversed by the data item set in the test data (understood as address mapping or data mapping). The storage order of data (in various forms) is sequentially used to align the memory addresses of corresponding bytes, so that the test software can read the bytes of data traversed by the data item set in the test data in an orderly manner. The function name of the data item set is set as the function tag information of the corresponding byte data traversed by the data item set, and the parsing of the test data is completed. This can also be regarded as completing a complete adaptive mapping of the test data (traversing and mapping according to the byte length (data length) occupied by each data type). This enables the standard Python language data structure to directly assign values to the data segment to be mapped in bytes, without splitting the data bit by bit. After mapping, the standard Python language data type is obtained, which is convenient for the test software to call.
[0047] Based on the aforementioned embodiments, the process of parsing the test data according to the aligned byte length includes: starting from a pre-allocated memory address (as the starting address), traversing the corresponding bytes of the test data sequentially with the corresponding aligned byte length as the step size to achieve the division of the test data. The data frame constructor and its internal data item set are both memory spaces of a predetermined size allocated starting from the pre-allocated memory address. The creation order of the data item set within a data frame constructor is the arrangement order of the data item set within the memory space to which the data frame constructor belongs, and the sorting is based on the creation order in time. The mapped byte data (or a bit data within that byte data) in the test data is configured with corresponding functional marker information and storage order. Furthermore, the mapped byte data (or a bit data within that byte data) in the test data is cached in a specific memory address according to this storage order, so that the test software can read the corresponding functional marker information according to the test requirements.
[0048] As one embodiment, the method of traversing the corresponding bytes of the test data sequentially from a pre-allocated memory address, with the corresponding alignment byte length as the step size, includes: when the data length occupied by the test data is less than or equal to the sum of the data lengths occupied by all data item sets in the data frame constructor, the data length occupied by any data item set in the data frame constructor is set to the corresponding alignment byte length. Then, according to the creation order of the data item sets, starting from a pre-allocated memory address, that is, starting from the first address set in the data frame constructor, each byte of the test data is sequentially aligned with the corresponding data item set. At this time, each byte of the test data is parsed and processed by the corresponding data item set (equivalent to being mapped to the data item in the corresponding data item set). The storage address of the lowest or highest bit in the corresponding data item set is divided by the data length occupied by the data item set, and each byte of the test data falls into the memory address of the corresponding data item set.
[0049] When the length of the data to be tested is greater than the length of all data item sets in the data frame constructor, the length of all data item sets in the data frame constructor is set to the alignment byte length. Then, according to the creation order of the data item sets, starting from a pre-allocated memory address (i.e., the starting address set in the data frame constructor), the data items in each data item set are sequentially aligned with the corresponding byte data of the data to be tested in the storage order. At this time, all data item sets in the data frame constructor are used to parse the data to be tested. Specifically, this can be done by parsing the data segment to be mapped. The storage address of the lowest bit or the storage address of the highest bit in each data item set is divided by the length of the data item set, and part of the data to be tested fills the memory addresses of all data item sets in the data frame constructor.
[0050] Therefore, during the parsing of test data, starting from a pre-allocated memory address, each byte of the test data is sequentially aligned with its corresponding set of data items. After byte alignment (where byte alignment refers to the arrangement of data bytes in memory space according to certain rules), each data item can be retrieved at once when it is in the aligned position within its set of data items. This reduces the number of times the CPU accesses memory, thereby improving the reading efficiency of the test software (host computer).
[0051] Preferably, if a data item set contains a standard double-type data item occupying 8 bytes, then the starting address in the data frame constructor (the first address of the first created data item set) can be located on the 8-byte boundary, meaning the starting address is divisible by 8. Under 32-bit CPU read / write operations, assuming an integer variable's address is 0x00000008 (a multiple of 8), it is aligned; however, if its address is 0x00000002 (not a multiple of 8), it is unaligned. When the 8 bytes of the test data fall within the aligned data item set, they can be retrieved in one go, improving read efficiency.
[0052] A data item set belonging to a C language data structure type typically consists of an 8-bit binary number, occupying 8 bytes in length. In some embodiments, this data item set may only contain a 7-bit binary number, where the highest bit lacks corresponding functional flag information. In such cases, the system default value needs to be used to fill the gap, which can be achieved by adding an extra byte after the last member to reach a full byte length and align the structure members. The storage address of the highest bit in this data item set is then divisible by the length of the data item set, making it a multiple of 8. This guides the alignment of the data to be tested with the physical partition length of the memory during the mapping process. Subsequently, the data to be tested can be written to the hardware device according to the storage order. Compared to this bit shifting operation, this speeds up CPU access to memory data, significantly saving processing time and program space, and improving testing efficiency.
[0053] In the embodiments provided by the present invention, it should be understood that the disclosed systems and methods can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of the units is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
[0054] Finally, it should be noted that the above embodiments are merely some embodiments of the present invention, not all embodiments. The technical solutions of the various embodiments can be combined with each other, and the specific steps disclosed in the embodiments can be adjusted in order according to actual needs to achieve the same technical effect. Those skilled in the art should understand that various changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention, and all such changes should be included within the protection scope of the present invention.
Claims
1. A data adaptive parsing method based on data structure type, characterized in that, Adaptive data parsing methods include: Create a collection of data items of the corresponding data structure type, and combine all the created data item collections into a data frame constructor; The test data is collected from the inside and outside of the machine equipment. The alignment byte length is obtained by comparing the data length occupied by the test data with the sum of the data lengths occupied by all data items in the data frame constructor. Based on the data structure type of each data item set in the data frame constructor, the test data is parsed according to the aligned byte length to obtain the mapping information of the corresponding byte data of the test data for use by the test software; The method for parsing the test data according to the aligned byte length, based on the data structure type of each data item set within the data frame constructor, includes: When the length of the data to be tested is less than or equal to the sum of the lengths of all data item sets within the data frame constructor, the data frame constructor, starting from the first created data item set, controls the corresponding data item set to traverse each byte of the data to be tested according to the corresponding aligned byte length, until the sum of the lengths of the data item sets participating in the traversal equals the length of the data to be tested. Then, combining the data structure type of each data item set participating in the traversal, and using the traversal order of each data item set, the corresponding storage order is configured for each byte of the data to be tested. The function name associated with each data item set is set as the function tag information of the corresponding byte of the data to be tested, and the parsing of the data to be tested is confirmed to be complete. The test software then reads the data to be tested according to this storage order for testing. The mapping information of the corresponding byte of the data to be tested includes function tag information and / or storage order. Within the data frame constructor, during the process of sequentially traversing each byte of the data to be tested according to the corresponding aligned byte length, starting from the first created set of data items, the following exists: After traversing the current set of bytes in the data to be tested using a set of data items created in the current order, control the set of data items created later to traverse the next set of bytes in the data to be tested, then update the set of data items created later to the set of data items created in the current order, and update the next set of bytes in the data to be tested to the current set of bytes in the data to be tested. Where, when a set of data items in the current creation order belongs to a C language data structure, the data length occupied by the current group of bytes in the data to be tested is one byte; Where a set of data items in the current creation order belongs to a standard Python language data structure, the data length occupied by the current set of bytes in the test data is at least one byte.
2. The data adaptive parsing method according to claim 1, characterized in that, The method for obtaining the alignment byte length by comparing the data length occupied by the test data with the sum of the data lengths occupied by all data items in the data frame constructor includes: When the data length occupied by the data to be tested is less than or equal to the sum of the data lengths occupied by all data item sets in the data frame constructor, the data length occupied by one data item set in the data frame constructor is set to the alignment byte length. When the length of the data to be tested is greater than the sum of the lengths of all data items in the data frame constructor, the sum of the lengths of all data items in the data frame constructor is set to the alignment byte length. The data length occupied by each data item set in the data frame constructor is obtained by counting in bytes; the data length occupied by each data item set is associated with its data structure type.
3. The data adaptive parsing method according to claim 2, characterized in that, The method for parsing the test data according to the aligned byte length, based on the data structure type of each data item set within the data frame constructor, includes: When the length of the data to be tested is greater than the sum of the lengths of all data items in the data frame builder, a data segment to be mapped or multiple data segments to be mapped are extracted from the data to be tested according to the corresponding alignment byte length; wherein, the length of a data segment to be mapped is equal to the sum of the lengths of all data items in the data frame builder. For a data segment to be mapped, the corresponding storage order is configured for the corresponding byte data in the data segment, based on the data structure type of each data item set in the data frame constructor. The function name associated with each data item set is set as the function tag information of the corresponding byte data in the data segment to be mapped. The parsing of the data to be tested is completed, and then the test software reads the data segment to be mapped according to the storage order for testing. The mapping information of the corresponding byte data of the data to be tested includes function tag information and / or storage order.
4. The data adaptive parsing method according to claim 3, characterized in that, The method of configuring the corresponding storage order for the corresponding byte data in the data segment to be mapped by combining the data structure types of each set of data items in the data frame constructor includes: The creation order of each set of data items within a data frame builder is configured to be the storage order of the corresponding bytes of the data segment to be mapped, so that each set of data items within the data frame builder is mapped to the corresponding bytes of the data segment to be mapped. When the data item set is a data structure belonging to the C language, the storage order of each bit data in the data item set is configured to be the storage order of data with the same bit sorting in the corresponding byte data of the data segment to be mapped. This makes each byte data of the data segment to be mapped split into 8 bits according to the data sorting from the lowest bit to the highest bit in the corresponding data item set. The function name corresponding to each bit in the data item set is set as the function tag information of the corresponding bit data in the data segment to be mapped. Here, one bit in a data item set belonging to the C language data structure corresponds to one data item, and one data item is used to record one function name. The data length occupied by the data item set is 1 byte. When the data item set is a data structure belonging to the standard Python language, the storage order of each byte of data in the data item set is configured to match the storage order of the byte data mapped to the data segment to be mapped. This ensures that multiple bytes of data in the data segment to be mapped are mapped to the memory address of the corresponding byte data in the same data item set. This allows the testing software to directly read the data segment to be mapped according to the function name corresponding to the data item set, and sets the function name of one data item in the data item set as the function tag information of the corresponding byte data in the data segment to be mapped. Here, a data item set belonging to the standard Python language data structure records one function name, and the data length occupied by the data item set is greater than or equal to 1 byte.
5. The data adaptive parsing method according to claim 2, characterized in that, The method of configuring the corresponding storage order for each byte of the data to be tested by combining the data structure type of each set of data items participating in the traversal and the traversal order of each set of data items participating in the traversal includes: Configure the creation order of a partial or complete set of data items within a data frame builder to the storage order of each byte of the data to be tested, so that each byte of the data to be tested is mapped to the corresponding set of data items within the data frame builder; When the data item set is a data structure belonging to the C language, the storage order of each bit in the data item set is configured to be the storage order of data with the same bit order in the byte data traversed in the test data. This makes the byte data split into 8 bits according to the data order from the lowest bit to the highest bit in the data item set. The function name corresponding to each bit in the data item set is set as the function tag information of the corresponding bit data in the byte data. Here, one bit in a data item set belonging to the C language data structure corresponds to one data item, and one data item is used to record one function name. The data length occupied by the data item set is 1 byte. When the data item set is a data structure belonging to the standard Python language, the storage order of each byte of data in the data item set is configured to be the storage order of the byte data in the test data that is traversed by the data item set, so that one or more bytes of data in the test data are mapped to the memory address of the corresponding byte data in the same data item set, and the function name of the data item set is set as the function tag information of the corresponding byte data traversed by the data item set. Here, a data item set belonging to the standard Python language data structure corresponds to a function name, and the data length occupied by the data item set is greater than or equal to 1 byte.
6. The data adaptive parsing method according to claim 4 or 5, characterized in that, The process of parsing the test data according to the aligned byte length includes: Starting from a pre-allocated memory address, the corresponding bytes of the test data are traversed sequentially with the corresponding alignment byte length as the step size to achieve the partitioning of the test data; The order in which data items are created within a data frame constructor is the order in which the data items are arranged in the memory space to which the data frame constructor belongs; The mapped byte data in the test data is configured with corresponding functional tag information and storage order, and the mapped byte data in the test data is cached in a specific memory address according to the storage order so that the test software can read it according to the test requirements.
7. The data adaptive parsing method according to claim 6, characterized in that, The data frame constructor includes multiple C language data structures and / or standard Python language data structures; Within the data frame constructor, the creation order of each data item set is different. Each data item set is a structure created at a pre-specified memory address to record the function name of one or more functions that the machine device needs to test. The first data item set created is a structure created at the starting address of the memory space to which the data frame constructor belongs, and this starting address is the pre-allocated memory address.
8. The data adaptive parsing method according to claim 7, characterized in that, The method of traversing the corresponding bytes of the test data sequentially, starting from a pre-allocated memory address and using the corresponding aligned byte length as the step size, includes: When the length of the data to be tested is less than or equal to the sum of the lengths of all data item sets in the data frame constructor, the length of any data item set in the data frame constructor is set to the corresponding alignment byte length. Then, according to the creation order of the data item sets, starting from a pre-allocated memory address, each byte of the data to be tested is aligned sequentially with the corresponding data item set. The storage address of the lowest or highest bit in the corresponding data item set is divided by the length of the data item set, and each byte of the data to be tested falls into the memory address of the corresponding data item set. When the length of the data to be tested is greater than the sum of the lengths of all data item sets in the data frame constructor, the sum of the lengths of all data item sets in the data frame constructor is set to the alignment byte length. Then, according to the creation order of the data item sets, starting from a pre-allocated memory address, the data items in each data item set are aligned sequentially with the corresponding byte data of the data to be tested in the storage order. The storage address of the least significant bit or the most significant bit in each data item set is divided by the length of the data item set. Part of the data to be tested is then used to fill the memory addresses of all data item sets in the data frame constructor.
Citation Information
Patent Citations
A method for dynamically analyze locomotive event data
CN109491660A
General data analysis platform and method for communication data stream
CN109981599A