Configuration-based embedded software external simulation equipment construction method
By building an external simulation device for embedded software and using software interface protocols and interaction model document specifications, the problem of embedded software test environment construction and test adequacy is solved, and efficient and automated embedded software testing is achieved.
Patent Information
- Application Number
- CN202410347061.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-26
- Publication Date
- 2024-08-23
AI Technical Summary
Existing technology makes it difficult to build a complete configuration item or system test environment in embedded software testing, making it difficult to ensure the adequacy of testing, and cannot provide extreme or abnormal test cases, which can easily cause hardware damage, and resource constraints lead to limited testing time.
By defining software interface protocols and interaction model document specifications, we build request data frame parsers, command frame responders, response data frame encoders and command frame recorders to implement embedded software external simulation devices and support test data collection, storage and analysis. , providing model elements such as conditional response fields and response sequences to achieve automated testing and data separation.
It improves the effectiveness and adequacy of embedded software testing, reduces the complexity of interactive timing simulation, improves testing efficiency and data management efficiency, and supports uninterrupted automated testing and data maintenance flexibility.
Smart Images

Figure CN118535206A
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of embedded software simulation testing, and in particular relates to a configuration-based embedded software external simulation device construction method. Background Art
[0002] Embedded systems are special computer systems that are designed to perform various control, computing, monitoring and communication tasks by building embedded hardware platforms and developing corresponding embedded software for specific application requirements and working environments. Embedded systems have been widely used in aviation, aerospace, industrial process control, civil electronics and many other fields.
[0003] Embedded software runs on embedded hardware platforms and communicates and interacts with external cross-linking devices through external interfaces or buses. Embedded software has the characteristics of operating platform specificity and external device specificity. Operating platform specificity means that embedded software cannot run normally before the embedded hardware platform is developed; external device specificity means that embedded software needs to interact with external devices or systems that are cross-linked with it to achieve the expected functions. The operating platform specificity and external device specificity of embedded software bring great difficulties and challenges to embedded software testing. Due to the lack of external cross-linking devices or systems, it is impossible to build a complete embedded software configuration item or system test environment, and software testing cannot cover the timing and interface of embedded software, which makes it difficult to ensure the adequacy of embedded software testing. When embedded software is put into the actual installation environment for configuration item or system testing, it is usually impossible to provide the execution conditions of extreme or abnormal test cases, such as simulating over-limit actions or over-boundary range inputs, and the execution of such extreme or abnormal test cases can easily cause damage to the embedded system hardware equipment; in addition, due to various resource limitations, the effective time that the actual installation environment can provide for software testing is also very limited. Summary of the invention
[0004] 1. Technical issues to be resolved
[0005] The technical problem to be solved by the present invention is: how to realize external cross-linking device or system simulation of embedded software based on configuration, provide stimulus or response input data for embedded software operation, receive embedded software output data at the same time, and make real-time automatic response according to the output data, so as to provide technical support for the rapid construction of embedded software configuration items and system-level simulation test environment.
[0006] (II) Technical solution
[0007] In order to solve the above technical problems, the present invention provides a configuration-based embedded software external simulation device construction method. The method defines the software interface protocol and interaction model document specifications, configures the software interface protocol document and the software interaction model document, and constructs a request data frame parser, a command frame responder, a response data frame encoder and a command frame recorder to form an embedded software external simulation device, which is used to realize interface-based embedded software external device input, output and interaction behavior simulation, and supports test data collection, storage and analysis.
[0008] (III) Beneficial effects
[0009] (1) By providing simple type fields such as bit, byte, short integer, integer, long integer, single-precision floating point, double-precision floating point, hexadecimal number, checksum, and other simple type fields, as well as composite type fields such as fixed-length array, variable-length array, field set, bit set, and communication command, it supports fixed-length, variable-length, and nested structure interface protocol descriptions, basically covering the embedded software interface protocol configuration requirements, and has good versatility and applicability.
[0010] (2) By providing model elements such as conditional response fields, response commands, response mappings, response selectors, and response sequences, it not only supports simple and fixed test data feedback response processing methods, but also supports conditional matching test data feedback response processing methods, thus meeting the requirements of closed-loop testing of embedded software and improving the effectiveness and adequacy of embedded software testing.
[0011] (3) By providing the request interface protocol document specification, it supports the construction of embedded software request data frame encoding model and parsing model, realizes the automatic parsing and recognition of embedded software test output data configuration, provides technical support for uninterrupted and automated testing of embedded software, and improves the efficiency of embedded software testing.
[0012] (4) By providing a software interaction model document configuration method and building a software command frame responder, the software status synchronization update and feedback functions are realized, the complexity of software interaction timing simulation is reduced, and technical support is provided for carrying out embedded software testing according to business processes, further improving the effectiveness and adequacy of embedded software testing.
[0013] (5) By providing the response interface protocol document specification, constructing the embedded software response data frame encoding model and response data frame encoder, the separation of embedded software test data and test driver is achieved, the flexibility of embedded software test data maintenance is improved, and the complexity and workload of embedded software test data construction are reduced.
[0014] (6) By constructing a command frame recorder, the input and output data of interfaces with diverse types and complex structures in the embedded software testing process can be stored in a centralized and unified manner without any mode, which provides technical support for the data management and analysis of the embedded software testing process and improves the efficiency of embedded software testing and analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a working principle diagram of the embedded software external simulation device of the present invention;
[0016] Figure 2 It is a diagram of the constituent elements and logical relationships of the embedded software interface protocol model of the present invention;
[0017] Figure 3 It is a diagram of the constituent elements and logical relationships of the embedded software interaction model of the present invention;
[0018] Figure 4 It is a logical structure diagram of the embedded software interaction model of the present invention;
[0019] Figure 5 This is a schematic diagram of the command frame recorder of the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.
[0021] The present invention provides a configuration-based embedded software external simulation device construction method. The method defines software interface protocol and interaction model document specifications, configures software interface protocol documents and software interaction model documents, constructs a request data frame parser, a command frame responder, a response data frame encoder and a command frame recorder, realizes interface-based embedded software external device input, output and interaction behavior simulation, and supports test data collection, storage and analysis.
[0022] The working principle diagram of the external simulation device of embedded software is as follows Figure 1 As shown. The external simulation device of embedded software can replace the external real cross-linking device or system of embedded software. It can not only provide stimulus or response data for the operation of embedded software, but also receive the output data of embedded software and make real-time automatic responses according to the output data, thereby ensuring the uninterrupted operation of embedded software and supporting the embedded software to carry out function and interface testing according to business processes. The following details the specific construction steps of the external simulation device of embedded software.
[0023] Step 1: Define the software interface protocol configuration specification
[0024] The software interface protocol configuration specification is used to describe the embedded software interface protocol. Both the input data and the output data of the embedded software comply with a specific interface protocol. The embedded software interface protocol is generally composed of a set of specific data type fields, mainly including bits, bytes, short integers, integers, long integers, single-precision floating point types, double-precision floating point types, arrays and other data type fields. In order to meet the needs of automatic generation of stimulus or response data and automatic parsing of test output data during embedded software interface testing, it is necessary to define a set of embedded software interface protocol configuration elements to achieve a formal description of the interface protocol. The embedded software interface protocol configuration elements include two types: simple fields and compound fields. Simple fields include 9 types such as bit fields, byte fields, short integer fields, integer fields, long integer fields, single-precision floating point fields, double-precision floating point fields, hexadecimal fields, and check fields; compound fields include 5 types such as fixed-length arrays, variable-length arrays, field sets, bit sets, and communication commands. The interface protocol configuration elements and their logical relationships are as follows: Figure 2 shown.
[0025] The software interface protocol configuration specification defines the composition and relationship of the embedded software interface protocol configuration elements and attributes, including element or attribute definition, hierarchical relationship, affiliation, value type, value range, uniqueness, etc., to ensure the standardization, consistency and effectiveness of the software interface protocol configuration. The software interface protocol configuration specification includes the definition and constraints of 14 types of field element structures and attributes, including bit fields, byte fields, short integer fields, integer fields, long integer fields, single-precision floating point fields, double-precision floating point fields, hexadecimal fields, check fields, fixed-length arrays, variable-length arrays, field sets, bit sets, and communication commands. The software interface protocol configuration specification is defined in XML schema language (XSD). The definition specifications of various field element structures and attributes are described in detail below.
[0026] 1. Bit field
[0027] The bit field is used to describe the bit data field in the interface protocol, including the integer bit field <intbititem>and string bit fields <stringbititem>There are two types. The bit field belongs to the simple field type and cannot contain any type of subfield. The bit field attribute configuration specification is as follows:
[0028] (1) Field ID (id): string type, required attribute, used to identify the uniqueness of the field;
[0029] (2) Field name (name): string type, optional attribute;
[0030] (3) Field length: a positive integer, a required attribute, indicating how many bits a bit field occupies;
[0031] (4) Field default value (defaultValue): non-negative integer (integer bit field <intbititem>) or "01" string type (string bit field <stringbititem>), required attribute;
[0032] (5) Field description (description): string type, optional attribute.
[0033] 2. Byte field
[0034] The byte field is used to describe the byte data in the interface protocol, indicating a character or integer with a length of 1 byte, including a signed byte field. <byteitem>and unsigned byte fields <ubyteitem>Two types. The Byte field is a simple field type and cannot contain any type subfields.
[0035] The byte field attribute configuration specifications are as follows:
[0036] (1) Field ID (id): string type, required attribute, used to identify the uniqueness of the field;
[0037] (2) Field name (name): string type, optional attribute;
[0038] (3) Field length (length): positive integer, required attribute, the field value is fixed to "1", indicating that the byte field occupies 1 byte;
[0039] (4) Whether the identification field is set (identified): Boolean type, the default value is "false". By setting the identification field, the command frame can be parsed and identified during the request command parsing process;
[0040] (5) Field default value (defaultValue): byte type (signed byte <byteitem>) or unsigned byte type (unsigned byte field <ubyteitem>), required attribute;
[0041] (6) Field description: string type, optional attribute.
[0042] 3. Short integer field
[0043] The short integer field is used to describe the short integer data in the interface protocol, indicating an integer of 2 bytes in length, including a signed short integer field. <shortitem>and unsigned short integer fields <ushortitem>There are two types. The short integer field is a simple field type and cannot contain any type of subfield. The short integer field attribute configuration specifications are as follows:
[0044] (1) Field ID (id): string type, required attribute, used to identify the uniqueness of the field;
[0045] (2) Field name (name): string type, optional attribute;
[0046] (3) Field length (length): positive integer, the field value is fixed to "2", indicating that the short integer field occupies 2 bytes;
[0047] (4) Whether the identification field is set (identified): Boolean type, the default value is "false". By setting the identification field, the command frame can be parsed and identified during the request command parsing process;
[0048] (5) Field default value (defaultValue): short integer (signed short integer field <shortitem>) or unsigned short integer (unsigned short integer field <ushortitem>), required attribute;
[0049] (6) Field description: string type, optional attribute.
[0050] 4. Integer fields
[0051] The integer field is used to describe the integer data in the interface protocol, indicating an integer of 4 bytes in length, including a signed integer field. <intitem>and unsigned integer fields <uintitem>Two types. Integer fields are simple field types and cannot contain subfields of any type. The configuration specifications for integer field properties are as follows:
[0052] (1) Field ID (id): string type, required attribute, used to identify the uniqueness of the field;
[0053] (2) Field name (name): string type, optional attribute;
[0054] (3) Field length: positive integer, the field value is fixed to "4", indicating that the integer field occupies 4 bytes;
[0055] (4) Whether the identification field is set (identified): Boolean type, the default value is "false". By setting the identification field, the command frame can be parsed and identified during the request command parsing process;
[0056] (5) Field default value (defaultValue): integer (signed integer field <intitem>) or unsigned integer (unsigned integer field <uintitem>), required attribute;
[0057] (6) Field description: string type, optional attribute.
[0058] 5. Long integer field
[0059] The long integer field is used to describe the long integer data in the interface protocol, indicating an integer of 8 bytes in length, including a signed long integer field. <longitem>and unsigned long integer fields <ulongitem>There are two types. Long integer fields are simple field types and cannot contain subfields of any type. The long integer field attribute configuration specifications are as follows:
[0060] (1) Field ID (id): string type, required attribute, used to identify the uniqueness of the field;
[0061] (2) Field name (name): string type, optional attribute;
[0062] (3) Field length (length): positive integer, the field value is fixed to "8", indicating that the long integer field occupies 4 bytes;
[0063] (4) Whether the identification field is set (identified): Boolean type, the default value is "false". By setting the identification field, the command frame can be parsed and identified during the request command parsing process;
[0064] (5) Field default value (defaultValue): long integer (signed long integer field <longitem>) or unsigned long (unsigned long field <ulongitem>), required attribute;
[0065] (6) Field description: string type, optional attribute.
[0066] 6. Single-precision floating point fields
[0067] Single-precision floating point fields <floatitem>Used to describe single-precision floating-point numbers in the interface protocol, indicating a floating-point number with a length of 4 bytes. Single-precision floating-point field <floatitem>It belongs to the simple field type and cannot contain any type of subfield. The single-precision floating point field attribute configuration specifications are as follows:
[0068] (1) Field ID (id): string type, required attribute, used to identify the uniqueness of the field;
[0069] (2) Field name (name): string type, optional attribute;
[0070] (3) Field length: positive integer, the field value is fixed to "4", indicating that a single-precision floating-point field occupies 4 bytes;
[0071] (4) Field default value (defaultValue): single-precision floating point type, required attribute;
[0072] (5) Field description (description): string type, optional attribute.
[0073] 7. Double-precision floating point fields
[0074] Double precision floating point field <doubleitem>Used to describe double-precision floating-point numbers in the interface protocol, indicating a floating-point number with a length of 8 bytes. Double-precision floating-point field <doubleitem>It belongs to the simple field type and cannot contain any type of subfield. The double-precision floating point field attribute configuration specifications are as follows:
[0075] (1) Field ID (id): string type, required attribute, used to identify the uniqueness of the field;
[0076] (2) Field name (name): string type, optional attribute;
[0077] (3) Field length: positive integer, the field value is fixed to "8", indicating that a double-precision floating-point field occupies 8 bytes;
[0078] (4) Field default value (defaultValue): double-precision floating point type, required attribute;
[0079] (5) Field description (description): string type, optional attribute.
[0080] 8. Hexadecimal fields
[0081] Hexadecimal Field <hexitem>Used to describe hexadecimal data in the interface protocol, mainly for the convenience of data representation. Hexadecimal field <hexitem>It belongs to the simple field type and cannot contain any type of subfield. The hexadecimal field attribute configuration specification is as follows:
[0082] (1) Field ID (id): string type, required attribute, used to identify the uniqueness of the field;
[0083] (2) Field name (name): string type, optional attribute;
[0084] (3) Field length (length): positive integer, required attribute;
[0085] (4) Whether the identification field is set (identified): Boolean type, the default value is "false". By setting the identification field, the command frame can be parsed and identified during the request command parsing process;
[0086] (5) Field default value (defaultValue): hexadecimal string, required attribute;
[0087] (6) Field description: string type, optional attribute.
[0088] 9. Check Field
[0089] Check Field <crcitem>Used to describe the checksum data in the interface protocol. By defining the checksum field, the checksum of the data frame can be automatically calculated. <crcitem>It belongs to the simple field type and cannot contain any type of subfield. The configuration specifications of the validation field attributes are as follows:
[0090] (1) Field ID (id): string type, required attribute, used to identify the uniqueness of the field;
[0091] (2) Field name (name): string type, optional attribute;
[0092] (3) Field length (length): positive integer, required attribute;
[0093] (4) Verification algorithm name (algorithm): string type, required attribute, describes the verification algorithm used to calculate the verification code of the verification field;
[0094] (5) Checksum start byte (start): non-negative integer, required attribute, describes the start byte involved in the checksum calculation;
[0095] (6) Checksum end byte (end): non-negative integer, required attribute, describes the end byte involved in the checksum calculation;
[0096] (7) Field default value (defaultValue): integer, default value "0";
[0097] (8) Field description: string type, optional attribute.
[0098] 10. Fixed-length array
[0099] Fixed-length array <itemarray>Used to describe array data in the interface protocol. The dimension of the array is specified by the attribute field length (length). <itemarray>It is a composite field and can only contain byte fields (including signed byte fields <byteitem>and unsigned byte fields <ubyteitem>), short integer fields (including signed short integer fields <shortitem>and unsigned short integer fields <ushortitem>), integer fields (including signed integer fields <intitem>and unsigned integer fields <uintitem>), long integer fields (including signed long integer fields <longitem>and unsigned long integer fields <ulongitem>), single-precision floating point field <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>There are 11 simple type subfields; a fixed-length array can and must contain only one simple type subfield. The fixed-length array attribute configuration specifications are as follows:
[0100] (1) Fixed-length array identifier (id): string type, required attribute, used to identify the uniqueness of a fixed-length array;
[0101] (2) Fixed-length array name (name): string type, optional attribute;
[0102] (3) Fixed-length array dimension (length): positive integer, required attribute, which describes the fixed-length array <itemarray>The dimension of
[0103] (4) Field description (description): string type, optional attribute.
[0104] 11. Variable-length arrays
[0105] Variable-length arrays <itemdimarray>Used to describe variable-length array data in the interface protocol. The dimension of the array is determined by other simple fields in the interface protocol (set by the attribute "itemRef"). <itemdimarray>It is a composite field and can only contain byte fields (including signed byte fields <byteitem>and unsigned byte fields <ubyteitem>), short integer fields (including signed short integer fields <shortitem>and unsigned short integer fields <ushortitem>), integer fields (including signed integer fields <intitem>and unsigned integer fields <uintitem>), long integer fields (including signed long integer fields <longitem>and unsigned long integer fields <ulongitem>), single-precision floating point field <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>There are 11 simple type subfields; a variable length array can only and must contain one simple type subfield. The configuration specifications of variable length array attributes are as follows:
[0106] (1) Variable-length array identifier (id): string type, required attribute, used to identify the uniqueness of the variable-length array;
[0107] (2) Variable-length array name (name): string type, optional attribute;
[0108] (3) Related field (itemRef): string type, required attribute, this attribute describes a variable-length array <itemdimarray>The number of dimensions is determined by the field value pointed to by the associated field (itemRef) attribute;
[0109] (4) Variable-length array description (description): string type, optional attribute.
[0110] 12. Field Collection
[0111] Field Collection <itemcollection>Used to classify fields in interface protocols, multiple adjacent fields can be grouped into a field set. Field Set <itemcollection>It is a composite field that can contain byte fields (including signed byte fields). <byteitem>and unsigned byte fields <ubyteitem>), short integer fields (including signed short integer fields <shortitem>and unsigned short integer fields <ushortitem>), integer fields (including signed integer fields <intitem>and unsigned integer fields <uintitem>), long integer fields (including signed long integer fields <longitem>and unsigned long integer fields <ulongitem>), single-precision floating point field <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>, Check field <crcitem>12 simple subfields and fixed-length arrays <itemarray>, variable length array <itemdimarray>, Field Collection <itemcollection>, bit set <bitcollection>4 types of composite subfields; a field collection <itemcollection>Contains at least one simple type or composite type subfield, and the subfield order is not restricted. The field collection property configuration specifications are as follows:
[0112] (1) Field set identifier (id): string type, required attribute, used to identify the uniqueness of the field set;
[0113] (2) Field collection name (name): string type, optional attribute;
[0114] (3) Field set description (description): string type, optional attribute.
[0115] 13. Bit Set
[0116] Bit Set <bitcollection>Used to maintain the bit data in the interface protocol to ensure that multiple bit field data form a complete byte data. <bitcollection>It is a composite field and can only contain integer bit fields. <intbititem>and string bit fields <stringbititem>Two types of subfields; one bit set <bitcollection>Contains at least one integer bit subfield <intbititem>or string bit subfield <stringbititem>, there is no restriction on the order of subfields. The bit set attribute configuration specification is as follows:
[0117] (1) Bit set identifier (id): string type, required attribute, used to identify the uniqueness of the bit set;
[0118] (2) Bit set name (name): string type, optional attribute;
[0119] (3) Bit set description (description): string type, optional attribute.
[0120] 14. Communication commands
[0121] Communication commands are used to describe how a set of simple fields or compound fields form a complete communication command, including request commands. <requestcommand>and response commands <responsecommand>There are two types, describing the request and response communication interface protocols respectively. Communication commands belong to the composite field type and can contain byte fields (including signed byte fields). <byteitem>and unsigned byte fields <ubyteitem>), short integer fields (including signed short integer fields <shortitem>and unsigned short integer fields <ushortitem>), integer fields (including signed integer fields <intitem>and unsigned integer fields <uintitem>), long integer fields (including signed long integer fields <longitem>and unsigned long integer fields <ulongitem>), single-precision floating point field <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>, Check field <crcitem>12 simple subfields and fixed-length arrays <itemarray>, variable length array <itemdimarray>, Field Collection <itemcollection>, bit set <bitcollection>A communication command contains at least one simple type or composite type subfield, and the order of subfields is not restricted. The communication command attribute configuration specifications are as follows:
[0122] (1) Communication command identifier (id): string type, required attribute, used to identify the uniqueness of the communication command;
[0123] (2) Communication command name (name): string type, optional attribute;
[0124] (3) Namespace: string type, required attribute. Namespaces are used to isolate request commands and response commands in different interfaces. That is, request commands and response commands in different namespaces can use the same identifier or name.
[0125] (4) Byte Order: enumeration type (including "little-endian" and "big-endian"). The default value is "little-endian", which means that the little-endian byte order is used by default.
[0126] (5) Communication command description (description): string type, optional attribute.
[0127] Step 2: Define the software interaction model specifications
[0128] The software interaction model specification is used to describe the interactive behavior of embedded software. Embedded software interactive behavior refers to the response method and response data (response command) of the embedded software request command. In order to meet the real-time feedback response processing requirements of test data, it is necessary to define a set of embedded software interaction model elements to achieve a formal description of software interactive behavior. Embedded software interaction model elements include two types: simple fields and composite fields. Simple fields include conditional response fields and response commands; composite fields include response mapping, response selector, response sequence and other three types. The software interaction model constituent elements and logical relationship diagram are shown in the figure. Figure 3 shown.
[0129] The software interaction model specification defines the composition and relationship of the elements and attributes of the embedded software interaction model, including element or attribute definition, hierarchical relationship, affiliation, value type, value range, uniqueness, etc., so as to ensure the standardization, consistency and effectiveness of the embedded software interaction model. The software interaction model specification includes the definition and constraints of five model element structures and attributes, such as conditional response fields, response commands, response mappings, response selectors, and response sequences. The software interaction model specification is defined in XML schema language (XSD). The following describes in detail the configuration specifications of various model element structures and attributes.
[0130] 1. Conditional response field
[0131] The conditional response field is used to describe the conditions for the software response, that is, to describe which response sequence is used to respond to the interface test data when the conditional response field meets the response conditions, including the unconditional response field. <replync>, less than the response field <replylt>, less than or equal to the response field <replylte>, equal to the answer field <replyeq>, not equal to the response field <replyneq>, greater than the response field <replygt>and greater than or equal to the response field <replygte>There are 7 types. Among them, the unconditional response field indicates that the specified request command has been received, that is, the corresponding response sequence is used to respond without any conditional judgment; the less than response field, less than or equal to response field, equal to response field, not equal to response field, greater than response field, greater than or equal to response field and other fields indicate that when the specified request command is received, if the value of the specific field in the request command is less than, less than or equal to, equal to, not equal to, greater than, and greater than or equal to the comparison target value, respectively, the corresponding response sequence is used to respond. The conditional response field is a simple field and cannot contain any type of subfield. The conditional response field attribute configuration specifications are as follows:
[0132] (1) Field ID: string type, optional attribute, used to identify the uniqueness of the field;
[0133] (2) Field name (name): string type, optional attribute;
[0134] (3) Field description (description): string type, optional attribute;
[0135] (4) Related fields (itemRef): string type, required attribute, describes the fields involved in the conditional judgment, that is, compares the value of the field specified by the attribute itemRef with the value specified by the targetValue attribute to determine whether the conditional response field meets the response condition. The field specified by the attribute itemRef is generally a field in the request command after parsing; unconditional response field <replync>There is no associated field (itemRef) attribute;
[0136] (5) Comparison target value (targetValue): string type, required attribute, describes the target value involved in the conditional judgment, that is, the value specified by the attribute targetValue will be compared with the value of the field specified by the attribute itemRef to determine whether the conditional response field meets the response condition; unconditional response field <replync>There is no targetValue attribute for comparison;
[0137] (6) Associated response sequence (sequenceRef): string type, required attribute, describes that when the conditional response field meets the response condition, the response sequence specified by the attribute sequenceRef is used to respond to the data.
[0138] 2. Response command
[0139] Response command <replycommand>It is used to describe which response command is used for response, that is, to describe which response command that meets the requirements of embedded reception is used for test data response. <replycommand>It belongs to the simple field type and cannot contain any type of subfield. The configuration specifications of the response command attribute are as follows:
[0140] (1) Response command identifier (id): string type, optional attribute, used to identify the uniqueness of the response command;
[0141] (2) Response command name (name): string type, optional attribute;
[0142] (3) Response command description (description): string type, optional attribute;
[0143] (4) Associated response command (responseRef): string type, required attribute, describes the response. When responding, the attribute responseRef is used to specify the response command to respond. The response command provides response data that meets the requirements of the embedded reception.
[0144] 3. Response selector
[0145] Response Selector <replyselector>It is used to describe and maintain the conditional response field and implement the conditional response of the embedded software request command. A response selector contains at least one conditional response subfield. Response selector description: When receiving the embedded software request command, the conditional response field conditions are determined in sequence according to the conditional response subfield order. As long as the condition of the conditional response field is satisfied, the response sequence set by the conditional response field is used for response, and the conditional response field condition is no longer determined.
[0146] Response Selector <replyselector>It belongs to the composite field type and can only contain unconditional response fields. <replync>, less than the response field <replylt>, less than or equal to the response field <replylte>, equal to the answer field <replyeq>, not equal to the response field <replyneq>, greater than the response field <replygt>and greater than or equal to the response field <replygte>7 conditional response subfields; one response selector <replyselector>Contains at least one conditional response subfield. The order of the subfields is not restricted. <replyselector>The property configuration specifications are as follows:
[0147] (1) Response selector identifier (id): string type, optional attribute, used to identify the uniqueness of the response selector;
[0148] (2) Response selector name (name): string type, optional attribute;
[0149] (3)Response selector description (description): string type, optional attribute.
[0150] 4. Response sequence
[0151] Response sequence <replysequence>It is used to describe a complete interface test data response process. A response sequence consists of several response commands, that is, it describes that when an embedded software request command is received, the test data response is performed according to the response command sequence in the response sequence. <replysequence>It is a composite field type and can only contain response commands. <replycommand>One type subfield; one response sequence <replysequence>Contains at least one reply command subfield <replycommand>, the subfield order follows the response order of the reply command. <replyselector>The property configuration specifications are as follows:
[0152] (1) Response sequence identifier (id): string type, optional attribute, used to identify the uniqueness of the response sequence;
[0153] (2) Response sequence name (name): string type, optional attribute;
[0154] (3)Response sequence description (description): string type, optional attribute.
[0155] 5. Response Mapping
[0156] Response Mapping <replymapper>It is used to describe the real-time feedback response processing method of the request command, that is, to describe which response sequence should be used to respond to the test data when the embedded software request command is received. Response Mapping <replymapper>It is a composite field and can only contain answer selectors. <replyselector>and response sequence <replysequence>Two type subfields; one answer mapping <replymapper>Contains at most one response selector <replyselector>Subfield and several response sequences <replysequence>subfield, and the response selector <replyselector>Subfield appears in all response sequences <replysequence>Before the subfield. Answer Mapping <replymapper>The property configuration specifications are as follows:
[0157] (1) Response mapping identifier (id): string type, optional attribute, used to identify the uniqueness of the response mapping;
[0158] (2) Response mapping name (name): string type, optional attribute;
[0159] (3)Response mapping description (description): string type, optional attribute;
[0160] (4) Response mapping namespace: string type, required attribute. Communication command response mappings in different interfaces are isolated through namespaces. That is, communication command response mappings in different namespaces can use the same identifier or name.
[0161] (5) Associated request command (requestRef): string type, required attribute, describing that the communication command response mapping is the response mapping for the request command specified by the attribute requestRef, that is, the real-time feedback response processing method for the specific request command is specified by the attribute requestRef.
[0162] Step 3: Build a request data frame parser
[0163] Based on the step "Step 1, define the software interface protocol configuration specification", by defining the request interface protocol document specification, configuring the request interface protocol document, building the request data frame encoding model and the request data frame parsing model, and then building the request data frame parser. The specific construction process of the request data frame parser is described in detail below:
[0164] 31. Define the request interface protocol document specification
[0165] First, define the request interface protocol document specification, which is used to describe the composition and structure of the embedded software request interface protocol document, as well as the hierarchical relationship and affiliation of the constituent elements, to standardize and constrain the request interface protocol document, and provide construction rules and verification basis for the request interface protocol document. The specific definition process of the request interface protocol document specification (request-config.xsd) is as follows:
[0166] (1) Create a new request interface protocol document specification file (request-config.xsd). The request interface protocol document specification file (request-config.xsd) is an XML file and needs to comply with XML document compilation standards, such as specifying the XML version and encoding in the document header.
[0167] (2) Through the root element <schema>Specifies the namespace for elements and data types in the document specification ("http: / / www.w3.org / 2001 / XMLSchema"), the namespace to which newly defined elements belong (such as "http: / / namespace / schema / request-config"), and the default namespace (such as "http: / / namespace / schema / request-config").
[0168] (3) In the document specification root element <schema>In the definition of the request interface protocol document root element <requestconfig>and configuration specifications, root element <requestconfig>No attributes, only a few request commands <requestcommand>Child elements.
[0169] (4) In the document specification root element <schema>Add the 19 configuration element specifications defined in "Step 1, Define Interface Protocol Configuration Specifications", including integer bit fields <intbititem>, string bit field <stringbititem>, signed byte field <byteitem>, unsigned byte field <ubyteitem>, signed short integer field <shortitem>, unsigned short integer field <ushortitem>, signed integer field <intitem>, unsigned integer field <uintitem>, signed long integer field <longitem>, unsigned long integer field <ulongitem>, single-precision floating-point field <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>, Check field <crcitem>14 simple type field configuration specifications, as well as fixed-length arrays <itemarray>, variable length array <itemdimarray>, Field Collection <itemcollection>, bit set <bitcollection>, request command <requestcommand>5 types of composite type field configuration specifications are included to form a complete request interface protocol document specification.
[0170] 32. Configuration request interface protocol document
[0171] Next, based on the request interface protocol document specification defined in "31. Define the request interface protocol document specification", according to the embedded software interface protocol document (i.e. ICD document), configure the request interface protocol document as the basis and basis for the embedded software interface output request command parsing. The specific configuration process of the request interface protocol document is as follows:
[0172] (1) Create a new request interface protocol document (request-config.xml) and specify the XML version and encoding in the document header.
[0173] (2) Through the root element <requestconfig>Specify the namespace of elements and data types in the document specification (such as "http: / / namespace / schema / request-config", which should be consistent with the namespace defined in the request interface protocol document specification), set the request interface protocol document specification (request-config.xsd), and thus implement the standardization and validity verification of the request interface protocol document.
[0174] (3) In the root element <requestconfig>In the definition of request command <requestcommand>Sub-element, each request command <requestcommand>The element describes an embedded software output command frame (an embedded software output command frame is an input command frame relative to a peripheral cross-linking device). Request Command <requestcommand>The configuration process is to select the corresponding interface protocol configuration element according to the data field sequence and type of the embedded software output command frame, and configure the request command data field.
[0175] 33. Build a request data frame encoding model
[0176] Next, based on the request interface protocol document (request-config.xml) configured in step "32. Configure the request interface protocol document", build the request data frame encoding model. The request data frame encoding model is the basis and prerequisite for building the request data frame parsing model. The specific construction process of the request data frame encoding model is as follows:
[0177] (1) According to the request interface protocol document specification (request-config.xsd), the request interface protocol document (request-config.xml) is verified to be valid. Only the request interface protocol document that is verified to be valid can construct the embedded software request data frame encoding model.
[0178] (2) After verifying the validity of the request interface protocol document, read and parse the request interface protocol document (request-config.xml), create corresponding objects for each XML element (such as request command RequestCommand object, integer field IntItem object, etc.), and create the hierarchy and affiliation between the request command, field collection, fixed-length array, byte field, integer field and other field elements according to the element hierarchy in the request interface protocol document. <requestcommand>The element describes a request command, and a series of elements are defined in the request interface protocol document (request-config.xml) <requestcommand>Therefore, the request data frame coding model is a set of request commands, that is, the request data frame coding model Set(Req) = {Req0, Req1, ..., Req n },(Req k is the request command, 0≤k≤n), Req k ={I0,I1,…,I m }(I0,I1,…,I m is a simple field or a collection field).
[0179] 34. Build a request data frame parsing model
[0180] Next, based on the request data frame encoding model constructed in step "33. Constructing the request data frame encoding model", the request data frame encoding model Set(Req) is reduced to a unified request data frame parsing model M = (L, S), where the field list L = {I0, I1, ..., I p }(I0,I1,…,I p is a simple field or a collection field), the sub-analysis model set S = {M0,M1,…,M q },M k is a sub-analysis model (0≤k≤q). The request data frame parsing model is the basis and basis for parsing the request command output by the embedded software interface. The specific construction process of the request data frame parsing model is as follows:
[0181] (1) Initialize the data frame parsing model M, assuming i=0, k=0;
[0182] (2) If 0≤i≤n, take a request command Req from the request data frame coding model Set(Req) i ∈Set(Rep), jump to step (3) to continue processing; otherwise, the construction of the data frame parsing model is completed and the process ends normally;
[0183] (3) Set a temporary model T, set T = M, and reset model T (that is, the field matching position of model T is set to the starting position 0).
[0184] (4) If 0≤k≤size(Req i ), size(Req i ) is the request command Req i The number of fields in Req i Extract field I k , execute the next step; otherwise, add 1 to i and jump to step (2) to continue processing;
[0185] (5) Get the next field I from model T match , used for field matching, if I match If it is empty, jump to step (6) for processing; otherwise jump to step (8) for processing;
[0186] (6) The request command Req i Field I k Add to the end of the field list L in model T;
[0187] (7) If field I k If it is a simple field and an identification field (attribute identified = true), a new specification field I is created. d (Convention Field I d The attribute ref value is set to field I k The id attribute value of the specification field, that is, the associated field of the specification field) and the sub-analysis model The protocol field I d Add to the end of the field list L in model T, and sub-parse model M k Add to the sub-analysis model set S of model M, in the specification field I d A new rule condition is added in the field I k To the sub-analysis model M k The association mapping (that is, when the field I k When the value is equal to the defaultValue attribute value, the sub-analysis model M is used k Proceed to the next step of analysis), set T = M k , reset the model T,k++, and jump to step (4) to continue processing;
[0188] If field I k If it is a composite field or a non-identification field (attribute identified = false), K++, jump to step (4) to continue processing;
[0189] (8) If field I k and Field I match If they are the same (if they are simple fields, the field type, including the attribute values of id, length, identified, etc., must be consistent; if they are composite fields, the types and attributes of the fields they contain must be consistent), then jump to step (9) to continue processing; otherwise, the protocol fails and the process exits abnormally.
[0190] (9) If field I k If it is a composite field or a non-identification field (attribute identified = false), then k++, jump to step (4) to continue processing; otherwise, jump to step (10) to continue processing.
[0191] (10) Get the next field I from model T next , if I next Does not exist or I next If it is not a specification field, the specification fails and the process directly exits abnormally; otherwise, the process jumps to step (11) to continue processing;
[0192] (11) In field I next (Convention field) using field I k 's defaultValue attribute value, find the associated sub-analysis model M k , if the sub-analysis model M k If it exists, set T = M k , reset the model T, k++, jump to step (4) to continue processing; otherwise jump to step (12) to continue processing;
[0193] (12) Create a new sub-analysis model Sub-analysis model M k Add to the sub-analysis model collection S of model M, in field I next A new rule condition is added in (rule field), namely field I k To the sub-analysis model M k The association mapping (that is, when the field I k When the value is equal to the defaultValue attribute value, the sub-analysis model M is used k Proceed to the next step of analysis), set T = M k , reset the model T,k++, and jump to step (4) to continue processing.
[0194] It should be noted that the specification field is dedicated to building a data frame parsing model and requesting data frame parsing, and is mainly used to maintain data frame parsing specification rules. It includes two attributes: attribute ref (setting specification associated fields) and specification condition set (maintaining specification conditions).
[0195] 35. Build a request data frame parser
[0196] Next, based on the request data frame parsing model constructed in step "34, constructing a request data frame parsing model", a request data frame parser is constructed to implement parsing and recognition of embedded software output request commands.
[0197] The request data frame parser converts the embedded software output data frame F(Req)=B0B1B2…B according to the request data frame parsing model M=(L,S). n (B i The single-byte data (0≤i≤n) is parsed into a request command (including identifying the command name and parsing the values of each component field), thereby providing input for the command frame responder to perform real-time response processing. The specific decoding process of the request data frame parser is described as follows:
[0198] (1) Initialize the queue Output data analysis result R out =(Req ref ,ValSet ref ), where Req ref Initialized to the request command corresponding to the parsing model M, the field parsing value set ValSet ref Initialize to
[0199] (2) Add all the fields in the field list L of the data frame parsing model M = (L, S) into the queue Q in index order;
[0200] (3) If the queue Q is not empty, jump to step (4) to continue processing; otherwise, the data frame parsing is completed and the process ends normally;
[0201] (4) Pop a field I from queue Q next If field I next If it is a convention field, jump to step (5) to continue processing; otherwise, follow field I next The byte length (determined by the attribute length) of the data frame F(Req) is used to intercept the corresponding byte data, and then the intercepted byte data is converted into a data value of the corresponding data type (such as a 2-byte integer, a 4-byte floating point, etc.); field I next The analytical result of Val(I next )=(key next ,value next ) is appended to the field parsed value set ValSet ref , where key next For field I next Attribute id; jump to step (3) to continue processing;
[0202] (5) Through the specification field I next Attribute ref, get specification field I next The associated field I ref ; By associating field I ref Parse the value set ValSet from the field ref Get the associated field I ref The analytical result of Val(I ref ); By associating field I ref The analytical result of Val(I ref ), based on the specification field I next The specification conditions in the data frame parsing model M = (L, S) are used to obtain the sub-parsing model M ref , if the sub-analysis model M ref If it does not exist, the data frame parsing fails and the program exits abnormally; otherwise, it jumps to step (6) to continue processing.
[0203] (6) Output data analysis result R out MediumReq ref Set as sub-analysis model M ref The corresponding request command frame and the sub-analysis model M ref List L ref All the fields in the queue are added to the queue Q in the order of index, and the process goes to step (3) to continue.
[0204] Step 4: Build a command frame responder
[0205] Next, based on the step "Step 2, define the software interaction model specification", by defining the software interaction model document specification, configuring the software interaction model document, and building the software interaction model and command frame responder. The specific construction process of the software command frame responder is described in detail below:
[0206] 41. Define the software interaction model documentation specifications
[0207] First, define the software interaction model document specification, which is used to describe the composition and structure of the embedded software interaction model document, as well as the hierarchical relationship and affiliation of the constituent elements, to standardize and constrain the document, and provide configuration rules and verification basis for the software interaction model document. The specific definition process of the software interaction model document specification (response-config.xsd) is as follows:
[0208] (1) Create a new software interaction model document specification file (reply-config.xsd). The software interaction model document specification (reply-config.xsd) is an XML file and needs to comply with XML document compilation standards, such as specifying the XML version and encoding in the document header.
[0209] (2) Through the root element <schema>Specify the namespace of elements and data types in the model document specification ("http: / / www.w3.org / 2001 / XMLSchema"), the namespace to which the newly defined element belongs (such as "http: / / namespace / schema / reply-config"), and the default namespace (such as "http: / / namespace / schema / reply-config").
[0210] (3) In the model document specification root element <schema>In the document, define the root element of the software interaction model <replyconfig>and configuration specifications, root element <replyconfig>No attributes, can only contain several response mappings <replymapper>Child elements.
[0211] (4) In the model document specification root element <schema>Add the 11 model element configuration specifications defined in "Step 2, Define Software Interaction Model Specifications", including the unconditional response field <replync>, less than the response field <replylt>, less than or equal to the response field <replylte>, equal to the answer field <replyeq>, not equal to the response field <replyneq>, greater than the response field <replygt>and greater than or equal to the response field <replygte>7 types of conditional response field configuration specifications and response commands <replycommand>, Response Selector <replycommand>, Response sequence <replysequence>, Response Mapping <replymapper>Four types of field configuration specifications are included to form a complete software interaction model document specification.
[0212] 42. Configure software interaction model documentation
[0213] Next, based on the software interaction model document specification defined in step "41. Define software interaction model document specification", according to the timing relationship of interaction between embedded software and external system or device, configure the software interaction model document as the basis and basis for the real-time feedback response processing of embedded software request command. The specific configuration process of the software interaction model document is as follows:
[0214] (1) Create a new software interaction model document (reply-config.xml) and specify the XML version and encoding in the document header.
[0215] (2) Through the root element <replyconfig>Specify the namespace of elements and data types in the model document specification (such as "http: / / namespace / schema / reply-config", which should be consistent with the namespace defined in the software interaction model document specification), and set the software interaction model document specification (reply-config.xsd) to verify the standardization and validity of the software interaction model document.
[0216] (3) In the root element <replyconfig>In the definition of the answer mapping <replymapper>Sub-element, each response mapping <replymapper>Describes the response mode of an embedded software request command (embedded software output command frame), that is, when a request command of the embedded software is received, the corresponding conditions (response selector) are met. <replyselector>Which response command (embedded software input command frame) sequence is used to respond under the conditional response field definition in the response.
[0217] (4) In the response mapping <replymapper>Element, define a response selector <replyselector>Sub-elements and several response sequences <replysequence>Child element, response selector <replyselector>Sub-element in all response sequences <replysequence>Child elements defined previously. Response selector <replyselector>The sub-elements define the response conditions and response sequence of the embedded software request command. <replysequence>The child elements define the response command sequence of the embedded software request command.
[0218] 43. Build a software interaction model
[0219] Next, based on the software interaction model document (reply-config.xml) configured in step 42, configure the software interaction model document, build the embedded software interaction model. The software interaction model is the basis for the embedded software command frame responder to implement real-time feedback response processing of request commands.
[0220] Figure 4 This is the logical structure diagram of the embedded software interaction model. A software interaction model consists of several "response mappings"; a "response mapping" consists of at most one "response selector" and several "response sequences", which describe the request command response processing method; a "response selector" consists of several "conditional response fields", which are used to implement the conditional response of the embedded software request command, and the response condition is judged according to the order of the conditional response fields; a "response sequence" consists of several "response commands", which provide response data (response commands) that meet the embedded software receiving requirements for the request command response. The specific construction process of the software interaction model is as follows:
[0221] (1) According to the software interaction model configuration specification (reply-config.xsd), the software interaction model document (reply-config.xml) is verified to be valid. Only the software interaction model document that is verified to be valid can be used to build the software interaction model.
[0222] (2) After verifying the validity of the software interaction model document, read and parse the software interaction model document (reply-config.xml), create corresponding objects for each XML element (such as reply mapping ReplyMapper object, reply command ReplyCommand object), and create the hierarchy and affiliation between the reply mapping, reply selector, reply sequence, conditional reply field, reply command and other field elements according to the element hierarchy in the software interaction model document. <replymapper>The element describes a request command response mapping rule. The software interaction model document reply-config.xml defines a series of <replymapper>elements, so the software interaction model is a collection of response mappings, that is, the software interaction model M(Reply) = {Map0,Map1,…,Map n }, (Map k is the response mapping, 0≤k≤n), the response mapping Among them, Sel k Map for the response k The response selector, Map for the response k The response sequence.
[0223] 44. Build a command frame responder
[0224] Next, based on the software interaction model constructed in step "43. Construct software interaction model", a command frame responder is constructed to complete the real-time automatic response processing of the embedded software output request command.
[0225] The command frame responder outputs the data analysis result R to the embedded software based on the software interaction model M (Reply). out =(Req ref ,ValSet ref ), perform real-time automatic response processing of command frames, R out MediumReq ref Indicates the output request command of the parsed embedded software, that is, the target object of the command frame response; ValSet ref Req ref The corresponding request command field parsing value set is the target data of the software command frame response. The specific response processing flow of the command frame responder is described as follows:
[0226] (1) Initialize the software state table T' = {State0, State1, ..., State n }, where State i State is the software state. i =(key i ,value i )(0≤i≤n), key i It is the unique identifier of the software status. i is the software status value, variable j=0;
[0227] (2) According to the target data ValSet ref Update software status table T', software status State i Unique identifier key i and target data ValSet ref The state with the same field attribute id will be updated, so as to synchronize the state in the software state table with the corresponding state of the embedded software; jump to step (3) to continue processing;
[0228] (3) According to the target object Req ref Find the reply map from the software interaction model M (Reply) k If the answer is Map k If it exists, jump to step (4) to continue processing; otherwise, it indicates that the request command Req ref No response required, ends normally;
[0229] (4) Based on target data ValSet ref , traverse the response selector Sel in order k Conditional response field item in k , by comparing the target data ValSet ref Field item ref (by the conditional response field item k The value of the attribute itemRef and the conditional response field item k Target value (i.e., tar getValue attribute value), find the first response sequence Seq that meets the response condition k (by the conditional response field item k , j++, jump to step (5) to continue processing; if no response sequence Seq that meets the response condition is found k , then the request command Req ref No response required, ends normally;
[0230] (5) If 0≤j≤m, select the response sequence in order. Get a reply command from Jump to step (6) to continue processing; otherwise, the command frame response is completed and the process ends normally;
[0231] (6) Through the response command The responseRef attribute looks up the response command If a response command is found Then jump to step (7) to continue processing; otherwise, no response command is found and the process ends abnormally;
[0232] (7) Update the response command according to the software status table T' Corresponding field value, response command The field attributes id and software state State i Unique identifier key i The consistent field value will be updated, so that the corresponding status of the embedded software can be returned; the command will be responded to Encode, and then send the generated response data (i.e., embedded software input data) to the embedded software, thereby completing the command frame response processing; the variable j is increased by 1, and jumps to step (5) to continue processing.
[0233] Step 5: Build the response data frame encoder
[0234] Based on the step "Step 1, define the software interface protocol configuration specification", by defining the response interface protocol document specification, configuring the response interface protocol document, and building the response data frame encoding model and response data frame encoder. The following describes in detail the specific construction process of the response data frame encoder:
[0235] 51. Define the response interface protocol document specification
[0236] First, define the response interface protocol document specification, which is used to describe the composition and structure of the embedded software response interface protocol document, as well as the hierarchical relationship and affiliation of the constituent elements, to standardize and constrain the response interface protocol document, and provide construction rules and verification basis for the response interface protocol document. The specific definition process of the response interface protocol document specification (response-config.xsd) is as follows:
[0237] (1) Create a new response interface protocol document specification file (response-config.xsd). The response interface protocol document specification file (response-config.xsd) is an XML file and needs to comply with XML document compilation standards, such as specifying the XML version and encoding in the document header.
[0238] (2) Through the root element <schema>Specify the namespace of elements and data types in the document specification ("http: / / www.w3.org / 2001 / XMLSchema"), the namespace to which the newly defined element belongs (such as "http: / / namespace / schema / response-config"), and the default namespace (such as "http: / / namespace / schema / response-config").
[0239] (3) In the document specification root element <schema>In the definition of the root element of the response interface protocol document <responseconfig>and configuration specifications, root element <responseconfig>No attributes, can only contain several response commands <responsecommand>Child elements.
[0240] (4) In the document specification root element <schema>Add the 19 configuration element specifications defined in "Step 1, Define Interface Protocol Configuration Specifications", including integer bit fields <intbititem>, string bit field <stringbititem>, signed byte field <byteitem>, unsigned byte field <ubyteitem>, signed short integer field <shortitem>, unsigned short integer field <ushortitem>, signed integer field <intitem>, unsigned integer field <uintitem>, signed long integer field <longitem>, unsigned long integer field <ulongitem>, single-precision floating-point field <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>, Check field <crcitem>14 simple type field configuration specifications, as well as fixed-length arrays <itemarray>, variable length array <itemdimarray>, Field Collection <itemcollection>, bit set <bitcollection>, Response command <responsecommand>5 types of composite type field configuration specifications are included to form a complete response interface protocol document specification.
[0241] 52. Configure the response interface protocol document
[0242] Next, based on the response interface protocol document specification defined in step "51. Define the response interface protocol document specification", according to the embedded software interface protocol document (i.e., ICD document), configure the response interface protocol document as the basis and basis for generating embedded software interface stimulus and response data. The specific configuration process of the response interface protocol document is as follows:
[0243] (1) Create a new response interface protocol document (response-config.xml) and specify the XML version and encoding in the document header.
[0244] (2) Through the root element <responseconfig>Specify the namespace of elements and data types in the document specification (such as "http: / / namespace / schema / response-config", which should be consistent with the namespace defined in the response interface protocol document specification), set the response interface protocol document specification (response-config.xsd), and thus implement the standardization and validity verification of the response interface protocol document.
[0245] (3) In the root element <responseconfig>In the definition of response command <responsecommand>Sub-elements, each responding to a command <responsecommand>The element describes an embedded software input command frame (an embedded software input command frame is an output command frame relative to the peripheral cross-linking device). Response command <responsecommand>The configuration process is to select the corresponding interface protocol configuration element according to the order and type of data fields composed of the command frame input by the embedded software, and then configure the response command data field.
[0246] 53. Construct response data frame encoding model
[0247] Next, based on the response interface protocol document (response-config.xml) configured in step "52. Configure the response interface protocol document", build the response data frame encoding model. The response data frame encoding model is the basis for the embedded software response data frame encoder to implement the construction of stimulus and response data, and is used to produce stimulus and response data that meet the receiving requirements of the embedded software. The specific construction process of the response data frame encoding model is as follows:
[0248] (1) According to the response interface protocol document specification (response-config.xsd), the response interface protocol document (response-config.xml) is verified to be valid. Only the response interface protocol document that is verified to be valid can the embedded software response data frame encoding model be constructed.
[0249] (2) After verifying the validity of the response interface protocol document, read and parse the response interface protocol document (response-config.xml), create corresponding objects for each XML element (such as response command ResponseCommand object, integer field IntItem object, etc.), and create the hierarchy and affiliation between field elements such as response command, field collection, fixed-length array, byte field, integer field, etc. according to the element hierarchy in the response interface protocol document. <responsecommand>The element describes a response command. A series of elements are defined in the response interface protocol document (response-config.xml). <responsecommand>Therefore, the response data frame encoding model is a set of response commands, that is, the response data frame encoding model Set(Rep) = {Rep0, Rep1, ..., Rep n },(Rep k To respond to the command, 0≤k≤n), Rep k ={I0,I1,…,I m }(I0,I1,…,I m is a simple field or a collection field).
[0250] 54. Build a response data frame encoder
[0251] Next, based on the response data frame encoding model constructed in step "53, constructing a response data frame encoding model", a response data frame encoder is constructed to implement the construction of embedded software stimulus and response data frames.
[0252] The response data frame encoder is used to encode the response command and encode the response command into an input data frame that meets the reception requirements of the embedded software (i.e., the output data frame of the external simulation device). The response data frame encoder constructs the stimulus and response data frame F(Rep)=B0B1B2…B that meets the reception requirements of the embedded software according to the response data frame encoding model Set(Rep). n (B i is single-byte data, 0≤i≤n). The response data frame encoder responds to the response command frame Rep k (0≤k≤n) The specific process of constructing the response data frame is described as follows:
[0253] (1) Initialization, set up the stack Data Frame
[0254] (2) Traversal response command Rep k ={I0,I1,…,I p } field, will respond to the command Rep k Composition Field I i Push them into stack S in reverse order, that is, field I p Push to the bottom of the stack, and field I0 remains at the top of the stack;
[0255] (3) Pop a field I from the stack S next If field I next If it is not empty, jump to step (4) to continue processing; otherwise, the data frame encoding is completed and the process ends normally;
[0256] (4) If field I next is a composite field, then field I next The constituent fields are pushed into stack S in reverse order, and the process jumps to step (3) to continue. If field I next If it is a simple field, jump to step (5) to continue processing;
[0257] (5) According to field I next The data type, byte length, and response command Rep k The byteOrder property of the field I next The value of (that is, the value of the attribute defaultVaue) is converted into a byte array bytes (the dimension is determined by the field attribute length), and the byte array bytes is appended to the end of the data frame F(Rep) in order, and then jump to step (3) to continue processing.
[0258] Step 6: Build a command frame recorder
[0259] Finally, a command frame recorder is built to store the request command data and response command data during the operation of the embedded software, thereby supporting the embedded software test analysis.
[0260] The command frame recorder implementation schematic is as follows Figure 5 As shown. The command frame recorder is implemented as follows: the request data frame parser constructed in the third step and the response data frame encoder constructed in the fifth step send the received request command data and response command data to the message middleware (such as ActiveMQ or RabbitMQ, etc.) in an asynchronous manner respectively; the command frame recorder processing module monitors the message queue of the message middleware, converts the messages in the message queue (i.e., request command data and response command data) into Bson format data, and stores them in the MongoDB document database; the test analyst can filter and analyze the request command or response command data collected during the test by querying the MongoDB document database.
[0261] MongoDB is a database based on distributed file storage. It adopts modeless structure storage and supports rich query operations. Therefore, MongoDB is very suitable for storing heterogeneous and complex interface data in the embedded software testing process. At the same time, it can realize data screening and analysis in the embedded software testing process, such as data screening according to simulation device name, request command or response command name, data reception or sending time, etc., so as to improve the efficiency of test data analysis.
[0262] The command frame responder, request data frame parser, response data frame encoder and command frame recorder constructed by the above steps constitute an embedded software external simulation device.
[0263] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.< / responsecommand> < / responsecommand> < / responsecommand> < / responsecommand> < / responsecommand> < / responseconfig> < / responseconfig> < / responsecommand> < / bitcollection> < / itemcollection> < / itemdimarray> < / itemarray> < / crcitem> < / hexitem> < / doubleitem> < / floatitem> < / ulongitem> < / longitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / stringbititem> < / intbititem> < / schema> < / responsecommand> < / responseconfig> < / responseconfig> < / schema> < / schema> < / replymapper> < / replymapper> < / replysequence> < / replyselector> < / replysequence> < / replyselector> < / replysequence> < / replyselector> < / replymapper> < / replyselector> < / replymapper> < / replymapper> < / replyconfig> < / replyconfig> < / replymapper> < / replysequence> < / replycommand> < / replycommand> < / replygte> < / replygt> < / replyneq> < / replyeq> < / replylte> < / replylt> < / replync> < / schema> < / replymapper> < / replyconfig> < / replyconfig> < / schema> < / schema> < / requestcommand> < / requestcommand> < / requestcommand> < / requestcommand> < / requestcommand> < / requestconfig> < / requestconfig> < / requestcommand> < / bitcollection> < / itemcollection> < / itemdimarray> < / itemarray> < / crcitem> < / hexitem> < / doubleitem> < / floatitem> < / ulongitem> < / longitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / stringbititem> < / intbititem> < / schema> < / requestcommand> < / requestconfig> < / requestconfig> < / schema> < / schema> < / replymapper> < / replysequence> < / replyselector> < / replysequence> < / replyselector> < / replymapper> < / replysequence> < / replyselector> < / replymapper> < / replymapper> < / replyselector> < / replycommand> < / replysequence> < / replycommand> < / replysequence> < / replysequence> < / replyselector> < / replyselector> < / replygte> < / replygt> < / replyneq> < / replyeq> < / replylte> < / replylt> < / replync> < / replyselector> < / replyselector> < / replycommand> < / replycommand> < / replync> < / replync> < / replygte> < / replygt> < / replyneq> < / replyeq> < / replylte> < / replylt> < / replync> < / bitcollection> < / itemcollection> < / itemdimarray> < / itemarray> < / crcitem> < / hexitem> < / doubleitem> < / floatitem> < / ulongitem> < / longitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / responsecommand> < / requestcommand> < / stringbititem> < / intbititem> < / bitcollection> < / stringbititem> < / intbititem> < / bitcollection> < / bitcollection> < / itemcollection> < / bitcollection> < / itemcollection> < / itemdimarray> < / itemarray> < / crcitem> < / hexitem> < / doubleitem> < / floatitem> < / ulongitem> < / longitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / itemcollection> < / itemcollection> < / itemdimarray> < / hexitem> < / doubleitem> < / floatitem> < / ulongitem> < / longitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / itemdimarray> < / itemdimarray> < / itemarray> < / hexitem> < / doubleitem> < / floatitem> < / ulongitem> < / longitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / itemarray> < / itemarray> < / crcitem> < / crcitem> < / hexitem> < / hexitem> < / doubleitem> < / doubleitem> < / floatitem> < / floatitem> < / ulongitem> < / longitem> < / ulongitem> < / longitem> < / uintitem> < / intitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / ubyteitem> < / byteitem> < / stringbititem> < / intbititem> < / stringbititem> < / intbititem>
Claims
1. A configuration-based embedded software external simulation device construction method, It is characterized in that The method defines the software interface protocol and interaction model document specifications, configures the software interface protocol document and the software interaction model document, constructs a request data frame parser, a command frame responder, a response data frame encoder and a command frame recorder to form an embedded software external simulation device, which is used to realize the input, output and interaction behavior simulation of the embedded software external device based on the interface, and supports test data collection, storage and analysis.
2. The method according to claim 1, It is characterized in that The embedded software external simulation device can replace the real cross-linking device or system outside the embedded software. It can not only provide stimulus or response data for the operation of the embedded software, but also receive the output data of the embedded software and make real-time automatic responses according to the output data, thereby ensuring the uninterrupted operation of the embedded software and supporting the embedded software to carry out function and interface testing according to the business process.
3. The method according to claim 1, It is characterized in that The method comprises the following steps: Step 1: Define the software interface protocol configuration specification The software interface protocol configuration specification is used to describe the embedded software interface protocol; define a set of embedded software interface protocol configuration elements to achieve formal description of the interface protocol; embedded software interface protocol configuration elements include two types: simple fields and composite fields. Simple fields include 9 types: bit field, byte field, short integer field, integer field, long integer field, single-precision floating point field, double-precision floating point field, hexadecimal field, and check field; composite fields include 5 types: fixed-length array, variable-length array, field set, bit set, and communication command; The software interface protocol configuration specification defines the composition and relationship of the embedded software interface protocol configuration elements and attributes, including element or attribute definition, hierarchical relationship, affiliation, value type, value range, and uniqueness; the software interface protocol configuration specification includes the definition and constraints of 14 field element structures and attributes, including bit fields, byte fields, short integer fields, integer fields, long integer fields, single-precision floating-point fields, double-precision floating-point fields, hexadecimal fields, check fields, fixed-length arrays, variable-length arrays, field sets, bit sets, and communication commands; the software interface protocol configuration specification is defined in the XML schema language XSD. The definition specifications of various field element structures and attributes are described in detail below:
1. Bit field The bit field is used to describe the bit data field in the interface protocol, including the integer bit field <intbititem>and string bit fields <stringbititem> There are two types; the bit field belongs to the simple field type and cannot contain any type of subfield; the bit field attribute configuration specification is as follows:< / stringbititem> < / intbititem> (1) Field ID: string type, required attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field length: positive integer, required attribute, indicating how many bits the bit field occupies; (4) Field default value defaultValue: non-negative integer bit field <intbititem>or "01" string type string bit field <stringbititem> , required attribute;< / stringbititem> < / intbititem> (5) Field description description: string type, optional attribute; 2. Byte field The byte field is used to describe the byte data in the interface protocol, indicating a character or integer with a length of 1 byte, including a signed byte field. <byteitem>and unsigned byte fields <ubyteitem> Two types; Byte field belongs to simple field type and cannot contain any type of subfield;< / ubyteitem> < / byteitem> The byte field attribute configuration specifications are as follows: (1) Field ID: string type, required attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field length: positive integer, required attribute, the field value is fixed to "1", indicating that the byte field occupies 1 byte; (4) Whether the identified field is set: Boolean type, the default value is "false". By setting the identified field, command frame parsing and identification can be performed during the request command parsing process; (5) Field default value defaultValue: byte type or unsigned byte type, required attribute; (6) Field description description: string type, optional attribute; 3. Short integer field The short integer field is used to describe the short integer data in the interface protocol, indicating an integer of 2 bytes in length, including a signed short integer field. <shortitem>and unsigned short integer fields <ushortitem> There are two types; the short integer field is a simple field type and cannot contain any type of subfields; the short integer field attribute configuration specifications are as follows:< / ushortitem> < / shortitem> (1) Field ID: string type, required attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field length: positive integer, the field value is fixed to "2", indicating that the short integer field occupies 2 bytes; (4) Whether the identified field is set: Boolean type, the default value is "false". By setting the identified field, command frame parsing and identification can be performed during the request command parsing process; (5) Field default value defaultValue: short integer or unsigned short integer, required attribute; (6) Field description description: string type, optional attribute; 4. Integer fields The integer field is used to describe the integer data in the interface protocol, indicating an integer of 4 bytes in length, including a signed integer field. <intitem>and unsigned integer fields <uintitem> There are two types; integer fields are simple field types and cannot contain subfields of any type; integer field attribute configuration specifications are as follows:< / uintitem> < / intitem> (1) Field ID: string type, required attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field length: positive integer, the field value is fixed to "4", indicating that the integer field occupies 4 bytes; (4) Whether the identified field is set: Boolean type, the default value is "false". By setting the identified field, command frame parsing and identification can be performed during the request command parsing process; (5) Field default value defaultValue: integer or unsigned integer, required attribute; (6) Field description description: string type, optional attribute; 5. Long integer field The long integer field is used to describe the long integer data in the interface protocol, indicating an integer of 8 bytes in length, including a signed long integer field. <longitem>and unsigned long integer fields <ulongitem> There are two types; the long integer field is a simple field type and cannot contain any type of subfields; the long integer field attribute configuration specifications are as follows:< / ulongitem> < / longitem> (1) Field ID: string type, required attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field length: positive integer, the field value is fixed to "8", indicating that the long integer field occupies 4 bytes; (4) Whether the identified field is set: Boolean type, the default value is "false". By setting the identified field, command frame parsing and identification can be performed during the request command parsing process; (5) Field default value defaultValue: long integer or unsigned long integer, required attribute; (6) Field description description: string type, optional attribute; 6. Single-precision floating point fields Single-precision floating point fields <floatitem>Used to describe single-precision floating-point numbers in the interface protocol, indicating a floating-point number with a length of 4 bytes; single-precision floating-point field <floatitem> It belongs to the simple field type and cannot contain any type of subfields; the single-precision floating-point field attribute configuration specifications are as follows:< / floatitem> < / floatitem> (1) Field ID: string type, required attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field length: positive integer, the field value is fixed to "4", indicating that a single-precision floating-point field occupies 4 bytes; (4) Field default value defaultValue: single-precision floating point type, required attribute; (5) Field description description: string type, optional attribute; 7. Double-precision floating point fields Double precision floating point field <doubleitem>Used to describe double-precision floating-point numbers in the interface protocol, indicating floating-point numbers with a length of 8 bytes; double-precision floating-point field <doubleitem> It belongs to the simple field type and cannot contain any type of subfields; the double-precision floating point field attribute configuration specifications are as follows:< / doubleitem> < / doubleitem> (1) Field ID: string type, required attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field length: positive integer, the field value is fixed to "8", indicating that the double-precision floating point field occupies 8 bytes; (4) Field default value defaultValue: double-precision floating point type, required attribute; (5) Field description description: string type, optional attribute; 8. Hexadecimal fields Hexadecimal Field <hexitem>Used to describe hexadecimal data in the interface protocol, hexadecimal field <hexitem> It belongs to the simple field type and cannot contain any type of subfields; the hexadecimal field attribute configuration specifications are as follows:< / hexitem> < / hexitem> (1) Field ID: string type, required attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field length: positive integer, required attribute; (4) Whether the identified field is set: Boolean type, the default value is "false". By setting the identified field, command frame parsing and identification can be performed during the request command parsing process; (5) Field default value defaultValue: hexadecimal string, required attribute; (6) Field description description: string type, optional attribute; 9. Check Field Check Field <crcitem>Used to describe the checksum data in the interface protocol. By defining the checksum field, the checksum of the data frame can be automatically calculated; the checksum field <crcitem> It belongs to the simple field type and cannot contain any type of subfields; the configuration specifications of the validation field attributes are as follows:< / crcitem> < / crcitem> (1) Field ID: string type, required attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field length: positive integer, required attribute; (4) Verification algorithm name algorithm: string type, required attribute, describes the verification algorithm used to calculate the verification code of the verification field; (5) Checksum start byte start: non-negative integer, required attribute, describes the start byte involved in the checksum calculation; (6) Checksum end byte end: non-negative integer, required attribute, describes the end byte involved in the checksum calculation; (7) Field default value defaultValue: integer, default value "0"; (8) Field description description: string type, optional attribute; 10. Fixed-length array Fixed-length array <itemarray>Used to describe array data in the interface protocol. The dimension of the array is specified by the length of the attribute field; fixed-length array <itemarray>It is a composite field and can only contain byte fields, short integer fields, integer fields (including signed integer fields). <intitem>and unsigned integer fields <uintitem>), long integer field, single-precision floating point field <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>These 11 simple type subfields; a fixed-length array can and must contain only one simple type subfield; byte fields include signed byte fields <byteitem>and unsigned byte fields <ubyteitem>, short integer fields include signed short integer fields <shortitem>and unsigned short integer fields <ushortitem>, integer fields include signed integer fields <intitem>and unsigned integer fields <uintitem>, long integer fields include signed long integer fields <longitem>and unsigned long integer fields <ulongitem> ; The fixed-length array attribute configuration specifications are as follows:< / ulongitem> < / longitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / hexitem> < / doubleitem> < / floatitem> < / uintitem> < / intitem> < / itemarray> < / itemarray> (1) Fixed-length array identifier id: string type, required attribute, used to identify the uniqueness of a fixed-length array; (2) Fixed-length array name: string type, optional attribute; (3) Fixed-length array dimension length: positive integer, required attribute, which describes the fixed-length array <itemarray> The dimension of< / itemarray> (4) Field description description: string type, optional attribute; 11. Variable-length arrays Variable-length arrays <itemdimarray>Used to describe variable-length array data in the interface protocol. The dimension of the array is determined by other simple fields in the interface protocol; variable-length array <itemdimarray>It is a composite field and can only contain byte fields, short integer fields, integer fields, long integer fields, and single-precision floating point fields. <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem> These are the 11 simple type subfields; a variable-length array can and must contain only one simple type subfield; the variable-length array attribute configuration specifications are as follows:< / hexitem> < / doubleitem> < / floatitem> < / itemdimarray> < / itemdimarray> (1) Variable-length array identifier id: string type, required attribute, used to identify the uniqueness of the variable-length array; (2) Variable-length array name: string type, optional attribute; (3) Associated field itemRef: string type, required attribute, this attribute describes a variable-length array <itemdimarray> The number of dimensions is determined by the field value pointed to by the associated field itemRef attribute;< / itemdimarray> (4) Variable-length array description: string type, optional attribute; 12. Field Collection Field Collection <itemcollection>Used to classify fields in interface protocols. Multiple adjacent fields can be grouped into a field set. <itemcollection>It is a composite field and can contain byte fields, short integer fields, integer fields, long integer fields, and single-precision floating point fields. <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>, Check field <crcitem>These 12 simple type subfields and fixed-length arrays <itemarray>, variable length array <itemdimarray>, Field Collection <itemcollection>, bit set <bitcollection>These 4 composite type subfields; a field collection <itemcollection> Contains at least one simple type or composite type subfield, and the order of subfields is not restricted; the field collection property configuration specifications are as follows:< / itemcollection> < / bitcollection> < / itemcollection> < / itemdimarray> < / itemarray> < / crcitem> < / hexitem> < / doubleitem> < / floatitem> < / itemcollection> < / itemcollection> (1) Field set identifier id: string type, required attribute, used to identify the uniqueness of the field set; (2) Field set name: string type, optional attribute; (3) Field set description: string type, optional attribute; 13. Bit Set Bit Set <bitcollection>Used to maintain the bit data in the interface protocol to ensure that multiple bit field data form a complete byte data; bit set <bitcollection>It is a composite field and can only contain integer bit fields. <intbititem>and string bit fields <stringbititem>Two types of subfields; one bit set <bitcollection>Contains at least one integer bit subfield <intbititem>or string bit subfield <stringbititem> , there is no restriction on the order of subfields; the bit set attribute configuration specification is as follows:< / stringbititem> < / intbititem> < / bitcollection> < / stringbititem> < / intbititem> < / bitcollection> < / bitcollection> (1) Bit set identifier id: string type, required attribute, used to identify the uniqueness of the bit set; (2) Bit set name: string type, optional attribute; (3) Bit set description description: string type, optional attribute; 14. Communication commands Communication commands are used to describe how a set of simple fields or compound fields form a complete communication command, including request commands. <requestcommand>and response commands <responsecommand>Two types, describing the request and response communication interface protocols respectively; communication commands belong to the composite field type, including byte fields, short integer fields, integer fields, long integer fields, and single-precision floating point fields <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>, Check field <crcitem>These 12 simple type subfields and fixed-length arrays <itemarray>, variable length array <itemdimarray>, Field Collection <itemcollection>, bit set <bitcollection> These four types of composite type subfields; a communication command contains at least one simple type or composite type subfield, and the order of the subfields is not restricted; the communication command attribute configuration specifications are as follows:< / bitcollection> < / itemcollection> < / itemdimarray> < / itemarray> < / crcitem> < / hexitem> < / doubleitem> < / floatitem> < / responsecommand> < / requestcommand> (1) Communication command ID: string type, required attribute, used to identify the uniqueness of the communication command; (2) Communication command name: string type, optional attribute; (3) Namespace: string type, required attribute. Namespaces are used to isolate request commands and response commands in different interfaces. That is, request commands and response commands in different namespaces can use the same identifier or name. (4) Byte Order: enumeration type, including "little-endian" and "big-endian". The default value is "little-endian", which means that the little-endian byte order is used by default. (5) Communication command description: string type, optional attribute; Step 2: Define the software interaction model specifications The software interaction model specification is used to describe the interaction behavior of embedded software; the interaction behavior of embedded software refers to the response method and response data of the embedded software request command, and the response data is the response command; define a set of embedded software interaction model elements to achieve the formal description of software interaction behavior; embedded software interaction model elements include two types: simple fields and composite fields. Simple fields include conditional response fields and response commands; composite fields include response mapping, response selector, and response sequence. The software interaction model specification defines the composition and relationship of the elements and attributes of the embedded software interaction model, including element or attribute definition, hierarchical relationship, affiliation, value type, value range, and uniqueness; the software interaction model specification includes the definition and constraints of the five model element structures and attributes: conditional response field, response command, response mapping, response selector, and response sequence; the software interaction model specification is defined in XML schema language XSD. The following describes in detail the configuration specifications of various model element structures and attributes; 1. Conditional response field The conditional response field is used to describe the conditions for the software response, that is, to describe which response sequence is used to respond to the interface test data when the conditional response field meets the response conditions, including the unconditional response field. <replync>, less than the response field <replylt>, less than or equal to the response field <replylte>, equal to the answer field <replyeq>, not equal to the response field <replyneq>, greater than the response field <replygt>and greater than or equal to the response field <replygte> There are 7 types; among them, the unconditional response field indicates that the specified request command is received, that is, the corresponding response sequence is used to respond without any conditional judgment; the less than response field, less than or equal to response field, equal to response field, not equal to response field, greater than response field, and greater than or equal to response field indicate that when the specified request command is received, if the value of the specific field in the request command is less than, less than or equal to, equal to, not equal to, greater than, and greater than or equal to the comparison target value, the corresponding response sequence is used to respond; the conditional response field is a simple field and cannot contain any type of subfield; the conditional response field attribute configuration specification is as follows:< / replygte> < / replygt> < / replyneq> < / replyeq> < / replylte> < / replylt> < / replync> (1) Field ID: string type, optional attribute, used to identify the uniqueness of the field; (2) Field name: string type, optional attribute; (3) Field description description: string type, optional attribute; (4) Related field itemRef: string type, required attribute, describes the field involved in the conditional judgment, that is, compares the value of the field specified by the attribute itemRef with the value specified by the attribute targetValue, so as to determine whether the conditional response field meets the response condition. The field specified by the attribute itemRef is generally a field in the request command after parsing; unconditional response field <replync> There is no associated field itemRef attribute;< / replync> (5) Comparison target value targetValue: string type, required attribute, describes the target value involved in the conditional judgment, that is, the value specified by the attribute targetValue will be compared with the value of the field specified by the attribute itemRef to determine whether the conditional response field meets the response condition; unconditional response field <replync> There is no comparison targetValue attribute;< / replync> (6) Associated response sequence sequenceRef: string type, required attribute, describing that when the conditional response field meets the response condition, the response sequence specified by the attribute sequenceRef is used to respond to the data; 2. Response command Response command <replycommand>It is used to describe which response command is used for response, that is, to describe which response command that meets the requirements of embedded reception is used for test data response; response command <replycommand> It belongs to the simple field type and cannot contain any type of subfields; the response command attribute configuration specifications are as follows:< / replycommand> < / replycommand> (1) Response command ID: string type, optional attribute, used to identify the uniqueness of the response command; (2) Response command name: string type, optional attribute; (3) Response command description: string type, optional attribute; (4) Associated response command responseRef: string type, required attribute, describes the response command specified by the attribute responseRef for response, and the response command provides response data that meets the requirements of embedded reception; 3. Response selector Response Selector <replyselector> It is used to describe and maintain the conditional response field, and realize the conditional response of the embedded software request command. A response selector contains at least one conditional response subfield. The response selector describes: when receiving the embedded software request command, the condition of the conditional response field is determined in turn according to the order of the conditional response subfields. As long as the condition of the conditional response field is satisfied, the response sequence set by the conditional response field is used for response, and the condition of the conditional response field is no longer determined.< / replyselector> Response Selector <replyselector>It belongs to the composite field type and can only contain unconditional response fields. <replync>, less than the response field <replylt>, less than or equal to the response field <replylte>, equal to the answer field <replyeq>, not equal to the response field <replyneq>, greater than the response field <replygt>and greater than or equal to the response field <replygte>7 conditional response subfields; one response selector <replyselector>Contains at least one conditional response subfield. The order of the subfields is not restricted. Response selector <replyselector> The property configuration specifications are as follows:< / replyselector> < / replyselector> < / replygte> < / replygt> < / replyneq> < / replyeq> < / replylte> < / replylt> < / replync> < / replyselector> (1) Response selector identifier id: string type, optional attribute, used to identify the uniqueness of the response selector; (2) Response selector name: string type, optional attribute; (3) Response selector description: string type, optional attribute; 4. Response sequence Response sequence <replysequence>It is used to describe a complete interface test data response process. A response sequence consists of several response commands, that is, it describes that when receiving the embedded software request command, the test data response is performed according to the response command sequence in the response sequence; the response sequence <replysequence>It is a composite field type and can only contain response commands. <replycommand>One type subfield; one response sequence <replysequence>Contains at least one reply command subfield <replycommand>, the subfield order follows the response order of the reply command; the reply selector <replyselector> The property configuration specifications are as follows:< / replyselector> < / replycommand> < / replysequence> < / replycommand> < / replysequence> < / replysequence> (1) Response sequence identifier id: string type, optional attribute, used to identify the uniqueness of the response sequence; (2) Response sequence name: string type, optional attribute; (3)Response sequence description: string type, optional attribute; 5. Response Mapping Response Mapping <replymapper>It is used to describe the real-time feedback response processing method of the request command, that is, to describe which response sequence should be used to respond to the test data when the embedded software request command is received; response mapping <replymapper>It is a composite field and can only contain answer selectors. <replyselector>and response sequence <replysequence>Two type subfields; one answer mapping <replymapper>Contains at most one response selector <replyselector>Subfield and several response sequences <replysequence>subfield, and the response selector <replyselector>Subfield appears in all response sequences <replysequence>Before subfield; answer mapping <replymapper> The property configuration specifications are as follows:< / replymapper> < / replysequence> < / replyselector> < / replysequence> < / replyselector> < / replymapper> < / replysequence> < / replyselector> < / replymapper> < / replymapper> (1) Response mapping identifier id: string type, optional attribute, used to identify the uniqueness of the response mapping; (2) Response mapping name: string type, optional attribute; (3)Response mapping description: string type, optional attribute; (4) Response mapping namespace: string type, required attribute. Communication command response mappings in different interfaces are isolated through namespaces. That is, communication command response mappings in different namespaces can use the same identifier or name. (5) Associated request command requestRef: string type, required attribute, describing that the communication command response mapping is the response mapping for the request command specified by the attribute requestRef, that is, the real-time feedback response processing method of the specific request command is specified by the attribute requestRef; Step 3: Build a request data frame parser On the basis of the first step, by defining the request interface protocol document specification, configuring the request interface protocol document, building the request data frame encoding model and the request data frame parsing model, and then building the request data frame parser; the construction process of the request data frame parser is described in detail below:
31. Define the request interface protocol document specification First, define the request interface protocol document specification, which is used to describe the composition and structure of the embedded software request interface protocol document, as well as the hierarchical relationship and affiliation of the constituent elements to standardize and constrain it, and provide construction rules and verification basis for the request interface protocol document; the specific definition process of the request interface protocol document specification request-config.xsd is as follows: (1) Create a new request interface protocol document specification file request-config.xsd; the request interface protocol document specification file request-config.xsd is an XML file that complies with the XML document compilation specification and specifies the XML version and encoding in the document header; (2) Through the root element <schema> Specify the namespaces for elements and data types in the document specification, the namespaces to which newly defined elements belong, and the default namespace;< / schema> (3) In the document specification root element <schema>In the definition of the request interface protocol document root element <requestconfig>and configuration specifications, root element <requestconfig>No attributes, only a few request commands <requestcommand> Child elements;< / requestcommand> < / requestconfig> < / requestconfig> < / schema> (4) In the document specification root element <schema>In the configuration element specification, add the 19 configuration element specifications defined in the first step, including integer bit fields <intbititem>, string bit field <stringbititem>, signed byte field <byteitem>, unsigned byte field <ubyteitem>, signed short integer field <shortitem>, unsigned short integer field <ushortitem>, signed integer field <intitem>, unsigned integer field <uintitem>, signed long integer field <longitem>, unsigned long integer field <ulongitem>, single-precision floating-point field <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>, Check field <crcitem>14 simple type field configuration specifications, as well as fixed-length arrays <itemarray>, variable length array <itemdimarray>, Field Collection <itemcollection>, bit set <bitcollection>, request command <requestcommand> 5 types of composite type field configuration specifications form a complete request interface protocol document specification;< / requestcommand> < / bitcollection> < / itemcollection> < / itemdimarray> < / itemarray> < / crcitem> < / hexitem> < / doubleitem> < / floatitem> < / ulongitem> < / longitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / stringbititem> < / intbititem> < / schema> 32. Configuration request interface protocol document Next, based on the request interface protocol document specification defined in step 31, according to the embedded software interface protocol document, that is, the ICD document, the request interface protocol document is configured as the basis and basis for the embedded software interface output request command parsing; the specific configuration process of the request interface protocol document is as follows: (1) Create a new request interface protocol document, request-config.xml, and specify the XML version and encoding in the document header; (2) Through the root element <requestconfig> Specify the namespace of elements and data types in the document specification, set the request interface protocol document specification request-config.xsd, and thus implement the standardization and validity verification of the request interface protocol document;< / requestconfig> (3) In the root element <requestconfig>In the definition of request command <requestcommand>Sub-element, each request command <requestcommand>The element describes an embedded software output command frame; request command <requestcommand> The configuration process is to select the corresponding interface protocol configuration element and configure the request command data field according to the data field sequence and type of the embedded software output command frame;< / requestcommand> < / requestcommand> < / requestcommand> < / requestconfig> 33. Build a request data frame encoding model Next, based on the request interface protocol document configured in step 32, a request data frame encoding model is constructed; the request data frame encoding model is the basis and premise for constructing a request data frame parsing model; the specific construction process of the request data frame encoding model is as follows: (1) According to the request interface protocol document specification request-config.xsd, the request interface protocol document request-config.xml is verified to be valid. Only the request interface protocol document that is verified to be valid can construct the embedded software request data frame encoding model; (2) After verifying the validity of the request interface protocol document, read and parse the request interface protocol document request-config.xml, create a corresponding object for each XML element, and create the hierarchy and affiliation between the request command, field set, fixed-length array, byte field, and integer field elements according to the element hierarchy in the request interface protocol document; a <requestcommand>The element describes a request command, and a series of elements are defined in the request interface protocol document request-config.xml <requestcommand>Therefore, the request data frame coding model is a set of request commands, that is, the request data frame coding model Set(Req) = {Req 0 ,Req 1 ,…,Req n },Req k is the request command, 0≤k≤n, Req k = {I 0 ,I 1 ,…,I m }, I 0 ,I 1 ,…,I m is a simple field or a collection field;< / requestcommand> < / requestcommand> 34. Build a request data frame parsing model Next, based on the request data frame encoding model constructed in step 33, the request data frame encoding model Set(Req) is reduced to a unified request data frame parsing model M=(L,S), where the field list L={I 0 ,I 1 ,…,I p }I 0 ,I 1 ,…,I p For a simple field or a collection field, the sub-analysis model set S = {M 0 ,M 1 ,…,M q },M k is a sub-analysis model (0≤k≤q); the request data frame analysis model is the basis and basis for analyzing the output request command of the embedded software interface; 35. Build a request data frame parser Next, based on the request data frame parsing model constructed in step 34, a request data frame parser is constructed to implement parsing and identification of the embedded software output request command; The request data frame parser converts the embedded software output data frame F(Req)=B according to the request data frame parsing model M=(L,S). 0 B 1 B 2 …B n B i It is single-byte data, 0≤i≤n, parsed into a request command, including identifying the command name and parsing the values of each component field, thereby providing input for the command frame responder to perform real-time response processing; Step 4: Build a command frame responder Next, based on the second step, by defining the software interaction model document specification, configuring the software interaction model document, building the software interaction model and command frame responder; the specific construction process of the software command frame responder is described in detail below:
41. Define the software interaction model documentation specifications First, define the software interaction model document specification, which is used to describe the composition and structure of the embedded software interaction model document, as well as the hierarchical relationship and affiliation of the constituent elements, to standardize and constrain the software interaction model document, and provide configuration rules and verification basis for the software interaction model document; the specific definition process of the software interaction model document specification response-config.xsd is as follows: (1) Create a new software interaction model document specification file reply-config.xsd; the software interaction model document specification request-config.xsd is an XML file that complies with the XML document compilation specification and specifies the XML version and encoding in the document header; (2) Through the root element <schema> Specify the namespaces for elements and data types in the model document specification, the namespaces to which newly defined elements belong, and the default namespace;< / schema> (3) In the model document specification root element <schema>In the document, define the root element of the software interaction model <replyconfig>and configuration specifications, root element <replyconfig>No attributes, can only contain several response mappings <replymapper> Child elements;< / replymapper> < / replyconfig> < / replyconfig> < / schema> (4) In the model document specification root element <schema>In the , add the 11 model element configuration specifications defined in step 2, including the unconditional response field <replync>, less than the response field <replylt>, less than or equal to the response field <replylte>, equal to the answer field <replyeq>, not equal to the response field <replyneq>, greater than the response field <replygt>and greater than or equal to the response field <replygte>7 types of conditional response field configuration specifications and response commands <replycommand>, Response Selector <replycommand>, Response sequence <replysequence>, Response Mapping <replymapper> 4 types of field configuration specifications form a complete software interaction model document specification;< / replymapper> < / replysequence> < / replycommand> < / replycommand> < / replygte> < / replygt> < / replyneq> < / replyeq> < / replylte> < / replylt> < / replync> < / schema> 42. Configure software interaction model documentation Next, based on the software interaction model document specification defined in step 41, according to the timing relationship of the interaction between the embedded software and the external system or device, the software interaction model document is configured as the basis and basis for the real-time feedback response processing of the embedded software request command; the specific configuration process of the software interaction model document is as follows: (1) Create a new software interaction model document reply-config.xml and specify the XML version and encoding in the document header; (2) Through the root element <replyconfig> Specify the namespace of elements and data types in the model document specification, and set the software interaction model document specification reply-config.xsd, so as to verify the standardization and validity of the software interaction model document;< / replyconfig> (3) In the root element <replyconfig>In the definition of the answer mapping <replymapper>Sub-element, each response mapping <replymapper>Describes the response mode of an embedded software request command, that is, when a request command of the embedded software is received, if the response selector is satisfied <replyselector> Which response command sequence to use to respond under the conditions defined by the conditional response field;< / replyselector> < / replymapper> < / replymapper> < / replyconfig> (4) In the response mapping <replymapper>Element, define a response selector <replyselector>Sub-elements and several response sequences <replysequence>Child element, response selector <replyselector>Sub-element in all response sequences <replysequence>Sub-element defined before; response selector <replyselector>The sub-elements define the response conditions and response sequence of the embedded software request command. <replysequence> The sub-element defines the response command sequence of the embedded software request command;< / replysequence> < / replyselector> < / replysequence> < / replyselector> < / replysequence> < / replyselector> < / replymapper> 43. Build a software interaction model Next, based on the software interaction model document reply-config.xml configured in step 42, an embedded software interaction model is constructed; A software interaction model consists of several "response mappings"; a "response mapping" consists of at most one "response selector" and several "response sequences", which describes the request command response processing method; a "response selector" consists of several "conditional response fields", which is used to implement the conditional response of the embedded software request command, and the response condition is judged according to the order of the conditional response fields; a "response sequence" consists of several "response commands", which provides response data that meets the reception requirements of the embedded software for the request command response; the specific construction process of the software interaction model is as follows: (1) According to the software interaction model configuration specification reply-config.xsd, the validity of the software interaction model document reply-config.xml is verified. Only when the software interaction model document is verified to be valid can the software interaction model be constructed; (2) After verifying the validity of the software interaction model document, read and parse the software interaction model document reply-config.xml, create a corresponding object for each XML element, and create the hierarchy and affiliation between the elements of the response mapping, response selector, response sequence, conditional response field, and response command according to the element hierarchy in the software interaction model document; <replymapper>The element describes a request command response mapping rule. The software interaction model document reply-config.xml defines a series of <replymapper>Elements, so the software interaction model is a collection of response mappings, that is, the software interaction model M (Reply) = {Map 0 ,Map 1 ,…,Map n }, Map k is the response mapping, 0≤k≤n, the response mapping Among them, Sel k Map for the response k The response selector, Map for the response k The response sequence of< / replymapper> < / replymapper> 44. Build a command frame responder Next, based on the software interaction model constructed in step 43, a command frame responder is constructed to complete the real-time automatic response processing of the embedded software output request command; The command frame responder outputs the data analysis result R to the embedded software based on the software interaction model M (Reply). out =(Req ref ,ValSet ref ), perform real-time automatic response processing of command frames, R out MediumReq ref Indicates the output request command of the parsed embedded software, that is, the target object of the command frame response; ValSet ref Req ref The corresponding request command field parsing value set, that is, the target data of the software command frame response; Step 5: Build the response data frame encoder On the basis of the first step, by defining the response interface protocol document specification, configuring the response interface protocol document, building the response data frame encoding model and the response data frame encoder; the specific construction process of the response data frame encoder is described in detail below:
51. Define the response interface protocol document specification First, define the response interface protocol document specification, which is used to describe the composition and structure of the embedded software response interface protocol document, as well as the hierarchical relationship and affiliation of the constituent elements to standardize and constrain the response interface protocol document, and provide construction rules and verification basis for the response interface protocol document; the specific definition process of the response interface protocol document specification response-config.xsd is as follows: (1) Create a new response interface protocol document specification file response-config.xsd; the response interface protocol document specification file response-config.xsd is an XML file that complies with the XML document compilation specification and specifies the XML version and encoding in the document header; (2) Through the root element <schema> Specify the namespaces for elements and data types in the document specification, the namespaces to which newly defined elements belong, and the default namespace;< / schema> (3) In the document specification root element <schema>In the definition of the root element of the response interface protocol document <responseconfig>and configuration specifications, root element <responseconfig>No attributes, can only contain several response commands <responsecommand> Child elements;< / responsecommand> < / responseconfig> < / responseconfig> < / schema> (4) In the document specification root element <schema>In the configuration element specification, add the 19 configuration element specifications defined in the first step, including integer bit fields <intbititem>, string bit field <stringbititem>, signed byte field <byteitem>, unsigned byte field <ubyteitem>, signed short integer field <shortitem>, unsigned short integer field <ushortitem>, signed integer field <intitem>, unsigned integer field <uintitem>, signed long integer field <longitem>, unsigned long integer field <ulongitem>, single-precision floating-point field <floatitem>, double-precision floating point fields <doubleitem>, Hexadecimal field <hexitem>, Check field <crcitem>14 simple type field configuration specifications, as well as fixed-length arrays <itemarray>, variable length array <itemdimarray>, Field Collection <itemcollection>, bit set <bitcollection>, Response command <responsecommand> 5 types of composite type field configuration specifications form a complete response interface protocol document specification;< / responsecommand> < / bitcollection> < / itemcollection> < / itemdimarray> < / itemarray> < / crcitem> < / hexitem> < / doubleitem> < / floatitem> < / ulongitem> < / longitem> < / uintitem> < / intitem> < / ushortitem> < / shortitem> < / ubyteitem> < / byteitem> < / stringbititem> < / intbititem> < / schema> 52. Configure the response interface protocol document Next, based on the response interface protocol document specification defined in step 51 and in accordance with the embedded software interface protocol document, the response interface protocol document is configured as the basis and basis for generating the embedded software interface stimulus and response data; the specific configuration process of the response interface protocol document is as follows: (1) Create a new response interface protocol document response-config.xml and specify the XML version and encoding in the document header; (2) Through the root element <responseconfig> Specify the namespace of elements and data types in the document specification, and set the response interface protocol document specification response-config.xsd;< / responseconfig> (3) In the root element <responseconfig>In the definition of response command <responsecommand>Sub-elements, each responding to a command <responsecommand>The element describes an embedded software input command frame; the response command <responsecommand> The configuration process is to select the corresponding interface protocol configuration element according to the order and type of data fields composed of the command frame input by the embedded software, and configure the response command data field;< / responsecommand> < / responsecommand> < / responsecommand> < / responseconfig> 53. Construct response data frame encoding model Next, based on the response interface protocol document response-config.xml configured in step 52, a response data frame encoding model is constructed; the response data frame encoding model is the basis for the embedded software response data frame encoder to realize the construction of stimulus and response data, and is used to produce stimulus and response data that meet the receiving requirements of the embedded software; the construction process of the response data frame encoding model is as follows: (1) According to the response interface protocol document specification response-config.xsd, the validity of the response interface protocol document response-config.xml is verified. Only the response interface protocol document that is verified to be valid can the embedded software response data frame encoding model be constructed; (2) After verifying the validity of the response interface protocol document, read and parse the response interface protocol document response-config.xml, create a corresponding object for each XML element, and create the hierarchy and affiliation between the response command, field set, fixed-length array, byte field, and integer field elements according to the element hierarchy in the response interface protocol document; a <responsecommand>The element describes a response command. The response interface protocol document response-config.xml defines a series of elements. <responsecommand>Therefore, the response data frame encoding model is a set of response commands, that is, the response data frame encoding model Set(Rep) = {Rep 0 ,Rep 1 ,…,Rep n }, Rep k To respond to the command, 0≤k≤n), Rep k = {I 0 ,I 1 ,…,I m }, I 0 ,I 1 ,…,I m is a simple field or a collection field;< / responsecommand> < / responsecommand> 54. Build a response data frame encoder Next, based on the response data frame encoding model constructed in step 53, a response data frame encoder is constructed to implement the construction of the embedded software stimulus and response data frame; The response data frame encoder is used to encode the response command, encode the response command into an input data frame that meets the receiving requirements of the embedded software, and the response data frame encoder constructs the stimulus and response data frame F(Rep)=B that meets the receiving requirements of the embedded software according to the response data frame encoding model Set(Rep) 0 B 1 B 2 …B n , B i It is single-byte data, 0≤i≤n; Step 6: Build a command frame recorder Finally, a command frame recorder is built to store the request command data and response command data during the operation of the embedded software, thereby supporting the embedded software test analysis; The command frame recorder includes a message middleware, a command frame recorder processing module and a MongoDB document database; the request data frame parser and the response data frame encoder send the received request command data and response command data to the message middleware in an asynchronous manner respectively, the command frame recorder processing module monitors the message queue in the message middleware, converts the messages in the message queue, i.e., the request command data and the response command data, into Bson format data, and stores them in the MongoDB document database; by querying the MongoDB document database, the request command or response command data collected during the test can be screened and analyzed.
4. The method according to claim 3, It is characterized in that The specific construction process of the request data frame parsing model is as follows: (1) Initialize the data frame parsing model M, assuming i=0, k=0; (2) If 0≤i≤n, take a request command Req from the request data frame coding model Set(Req) i ∈Set(Rep), jump to step (3) to continue processing; otherwise, the construction of the data frame parsing model is completed and the process ends normally; (3) Set a temporary model T, set T = M, reset model T, that is, the field matching position of model T is set to the starting position 0; (4) If 0≤k≤size(Req i ), size(Req i ) is the request command Req i The number of fields in Req i Extract field I k , execute the next step; otherwise, add 1 to i and jump to step (2) to continue processing; (5) Get the next field I from model T match , used for field matching, if I match If it is empty, jump to step (6) for processing; Otherwise, jump to step (8); (6) The request command Req i Field I k Add to the end of the field list L in model T; (7) If field I k If it is a simple field and an identification field, and the attribute identified = true, a new specification field I is created. d and sub-analysis model Specification Field I d The attribute ref value is set to field I k The id attribute value of the specification field is set, that is, the associated field of the specification field is set. d Add to the end of the field list L in model T, and sub-parse model M k Add to the sub-analysis model set S of model M, in the specification field I d A new rule condition is added in the field I k To the sub-analysis model M k The association mapping is set to T = M k , reset model T, add 1 to k, and jump to step (4) to continue processing; If field I k If it is a composite field or a non-identification field, the attribute identified = false, add 1 to k, and jump to step (4) to continue processing; (8) If field I k and Field I match If they are the same, jump to step (9) to continue processing; otherwise, the protocol fails and the program exits abnormally. (9) If field I k If it is a composite field or a non-identification field, and the attribute identified = false, then k is incremented by 1 and the process goes to step (4) to continue; otherwise, the process goes to step (10) to continue; (10) Get the next field I from model T next , if I next Does not exist or I next If it is not a specification field, the specification fails and the program exits abnormally. Otherwise, jump to step (11) to continue processing; (11) In field I next Use field I k 's defaultValue attribute value, find the associated sub-analysis model M k , if the sub-analysis model M k If it exists, set T = M k , reset model T, add 1 to k, and jump to step (4) to continue processing; otherwise, jump to step (12) to continue processing; (12) Create a new sub-analysis model Sub-analysis model M k Add to the sub-analysis model collection S of model M, in field I next A new rule condition is added in the field I k To the sub-analysis model M k The association mapping is set to T = M k , reset the model T,k++, and jump to step (4) to continue processing.
5. The method according to claim 4, It is characterized in that In step (8) of step 34, determine field I k and Field I match The same method is as follows: if it is a simple field, the field type, including the id, length, and identified attribute values, must all be consistent. If it is a composite field, the types and attributes of the fields it contains must all be consistent.
6. The method according to claim 4, It is characterized in that The specific decoding process of requesting the data frame parser in step 35 is as follows: (1) Initialize the queue Output data analysis result R out =(Req ref ,ValSet ref ), where Req ref Initialized to the request command corresponding to the parsing model M, the field parsing value set ValSet ref Initialize to (2) Add all the fields in the field list L of the data frame parsing model M = (L, S) into the queue Q in index order; (3) If the queue Q is not empty, jump to step (4) to continue processing; otherwise, the data frame parsing is completed and the process ends normally; (4) Pop a field I from queue Q next If field I next If it is a convention field, jump to step (5) to continue processing; otherwise, follow field I next The byte length of the data frame F(Req) is intercepted, and then the intercepted byte data is converted into the data value of the corresponding data type; field I next The analytical result of Val(I next )=(key next ,value next ) is appended to the field parsed value set ValSet ref , where key next For field I next Attribute id; Jump to step (3) to continue processing; (5) Through the specification field I next Attribute ref, get specification field I next The associated field I ref ; By associating field I ref Parse the value set ValSet from the field ref Get the associated field I ref The analytical result of Val(I ref ); By associating field I ref The analytical result of Val(I ref ), based on the specification field I next The specification conditions in the data frame parsing model M = (L, S) are used to obtain the sub-parsing model M ref , if the sub-analysis model M ref If it does not exist, the data frame parsing fails and the program exits abnormally; otherwise, it jumps to step (6) to continue processing. (6) Output data analysis result R out MediumReq ref Set as sub-analysis model M ref The corresponding request command frame and the sub-analysis model M ref List L ref All the fields in the queue are added to the queue Q in the order of index, and the process goes to step (3) to continue.
7. The method according to claim 6, It is characterized in that The specific response processing flow of the command frame responder in step 44 is as follows: (1) Initialize the software state table T' = {State 0 ,State 1 ,…,State n }, where State i State is the software state. i =(key i ,value i )(0≤i≤n), key i It is the unique identifier of the software status, value i is the software status value, variable j=0; (2) According to the target data ValSet ref Update software state table T', software state State i Unique identifier key i and target data ValSet ref The status with the same field attribute id will be updated, so as to synchronize the status in the software status table with the corresponding status of the embedded software; Jump to step (3) to continue processing; (3) According to the target object Req ref Find the reply map from the software interaction model M (Reply) k If the answer is Map k If it exists, jump to step (4) to continue processing; otherwise, it indicates that the request command Req ref No response required, ends normally; (4) Based on target data ValSet ref , traverse the response selector Sel in order k Conditional response field item in k , by comparing the target data ValSet ref The value of the field and the conditional response field item k Target value, find the first response sequence Seq that meets the response conditions k , add 1 to j and jump to step (5) to continue processing; if no response sequence Seq that meets the response condition is found k , then the request command Req ref No response required, ends normally; (5) If 0≤j≤m, select the response sequence in order. Get a reply command from Jump to step (6) to continue processing; Otherwise, the command frame response is completed and the process ends normally; (6) Through the response command The responseRef attribute looks up the response command If a response command is found Then jump to step (7) to continue processing; otherwise, no response command is found and the process ends abnormally; (7) Update the response command according to the software status table T' Corresponding field value, response command The field attributes id and software state State i Unique identifier key i The consistent field value will be updated, so that the corresponding status of the embedded software can be returned; the command will be responded to Encode and then send the generated response data to the embedded software, thereby completing the command frame response processing; the variable j is increased by 1, and jumps to step (5) to continue processing.
8. The method according to claim 7, It is characterized in that In step 54, the response data frame encoder responds to the response command frame Rep k The specific process of constructing a response data frame is as follows: (1) Initialization, set up the stack Data Frame (2) Traversal response command Rep k = {I 0 ,I 1 ,…,I p } field, will respond to the command Rep k Composition Field I i Push them into stack S in reverse order, that is, field I p Pushed to the bottom of the stack, field I 0 Stay on top of the stack; (3) Pop a field I from the stack S next If field I next If it is not empty, jump to step (4) to continue processing; Otherwise, the data frame encoding is completed and ends normally; (4) If field I next is a composite field, then field I next The constituent fields are pushed into the stack S in reverse order, and the process jumps to step (3) to continue. If field I next If it is a simple field, jump to step (5) to continue processing; (5) According to field I next The data type, byte length, and response command Rep k The byteOrder property of the field I next The value of is converted into a byte array bytes, and the byte array bytes is appended to the end of the data frame F(Rep) in sequence, and then the process goes to step (3) to continue.
9. The method according to claim 4, It is characterized in that The specification field is dedicated to building a data frame parsing model and requesting data frame parsing, and to maintaining data frame parsing specification rules, including setting specification-related fields and maintaining specification conditions.
10. A system for implementing the method according to any one of claims 1 to 9.
Citation Information
Cited By
DLT698 protocol analysis method, system, device and medium
CN118945245A
