Serial port protocol testing method, device and processing equipment
By introducing the hexadecimal protocol for encoding and decoding, the problem that existing test tools cannot normally encode and decode private binary protocols is solved, and the normal progress of hardware device testing and efficient automated testing effects are achieved.
Patent Information
- Application Number
- CN202210633911.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-06
- Publication Date
- 2025-09-30
- Estimated Expiration
- 2042-06-06
AI Technical Summary
Existing testing tools cannot properly encode and decode private binary protocols, causing the testing tools to fail to work properly.
The hexadecimal protocol is introduced for encoding and decoding operations, and the decoded reporting information of the device is received and processed through the serial communication link. The response processing is performed according to the preset response strategy, including CRC check and feedback mechanism.
The normal testing of hardware equipment is achieved, the difficulty of binary protocol encoding and decoding operations in the prior art is avoided, and the versatility and efficiency of the test are improved.
Smart Images

Figure CN114816889B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of testing, and in particular to a serial port protocol testing method, apparatus, and processing equipment. Background Art
[0002] Currently, there are many testing tools developed for specific products, and there are also tools that can implement protocol testing, but they still have limitations.
[0003] The inventors have discovered that the protocols that can be tested by existing testing tools are all proprietary binary protocols, which easily causes the testing tools to be unable to normally encode and decode the protocols. Summary of the Invention
[0004] The present application provides a serial port protocol testing method, apparatus, and processing device for introducing a hexadecimal protocol at the test tool end, thereby ensuring normal operation of encoding and decoding the protocol.
[0005] In a first aspect, the present application provides a serial port protocol testing method, the method comprising:
[0006] The processing device receives the reported information from the hardware device serving as the lower computer based on the serial port communication link between itself and the hardware device;
[0007] The processing device decodes the reported information and obtains the reported content in hexadecimal protocol;
[0008] The processing device performs response processing corresponding to the report content decoded from the report information according to a preset response strategy.
[0009] In conjunction with the first aspect of the present application, in a first possible implementation manner of the first aspect of the present application, before the processing device performs response processing corresponding to the report content decoded from the report information according to a preset response strategy, the method further includes:
[0010] The processing device verifies whether the cyclic redundancy check (CRC) value of the reported content complies with the protocol specification;
[0011] If so, the processing device determines that the reported content is correct.
[0012] In combination with the first aspect of the present application, in a second possible implementation manner of the first aspect of the present application, the method further includes:
[0013] The processing device feeds back first preset feedback information corresponding to the reported information to the hardware device according to the hexadecimal protocol, so that the hardware device determines that the hexadecimal protocol is correct if it receives the first preset feedback information;
[0014] Alternatively, the processing device determines whether the second preset feedback information fed back by the hardware device can be received after determining the information sent to the hardware device. If so, it is determined that the hexadecimal protocol is correct.
[0015] In combination with the first aspect of the present application, in the third possible implementation method of the first aspect of the present application, the hardware device is specifically a device simulated by the processing device in a virtual environment, and the processing device changes the device environment of the hardware device in different test rounds by adjusting different software and hardware conditions in the virtual environment.
[0016] In combination with the first aspect of the present application, in the fourth possible implementation method of the first aspect of the present application, the reported information is specifically vehicle status information and positioning information. The vehicle information includes status information of the vehicle hardware and status information of the vehicle software level. The vehicle status information includes simulated abnormal status information.
[0017] In combination with the fourth possible implementation of the first aspect of the present application, in a fifth possible implementation of the first aspect of the present application, the response processing includes the following:
[0018] The processing device analyzes the corresponding vehicle status based on the vehicle status information;
[0019] Alternatively, the processing device analyzes the corresponding driving test results based on the vehicle status information.
[0020] In combination with the first aspect of the present application, in a sixth possible implementation manner of the first aspect of the present application, the method further includes:
[0021] The processing device obtains the bin file for the Over-the-Air Technology (OTA) upgrade process;
[0022] After the bin file is verified to be correct, the processing device upgrades the hardware device.
[0023] In a second aspect, the present application provides a serial port protocol testing device, the device comprising:
[0024] The receiving unit is used to receive reported information from the hardware device serving as the lower computer based on the serial port communication link between the receiving unit and the hardware device;
[0025] A decoding unit, used to decode the reported information to obtain the reported content in hexadecimal protocol;
[0026] The response unit is used to perform response processing corresponding to the report content decoded from the report information according to a preset response strategy.
[0027] In conjunction with the second aspect of the present application, in a first possible implementation of the second aspect of the present application, the apparatus further includes a verification unit configured to:
[0028] Verify whether the CRC value of the reported content complies with the protocol specification;
[0029] If so, confirm that the reported content is correct.
[0030] In conjunction with the second aspect of the present application, in a second possible implementation of the second aspect of the present application, the apparatus further includes a verification unit configured to:
[0031] Feedback, according to the hexadecimal protocol, first preset feedback information corresponding to the reported information to the hardware device, so that the hardware device determines that the hexadecimal protocol is correct upon receiving the first preset feedback information;
[0032] Alternatively, after determining the information sent to the hardware device, it is determined whether second preset feedback information fed back by the hardware device can be received. If so, it is determined that the hexadecimal protocol is correct.
[0033] In combination with the second aspect of the present application, in the third possible implementation method of the second aspect of the present application, the hardware device is specifically a device simulated by the processing device in a virtual environment, and the processing device changes the device environment of the hardware device in different test rounds by adjusting different software and hardware conditions in the virtual environment.
[0034] In combination with the second aspect of the present application, in the fourth possible implementation method of the second aspect of the present application, the reported information is specifically vehicle status information and positioning information. The vehicle information includes status information of the vehicle hardware and status information of the vehicle software level. The vehicle status information includes simulated abnormal status information.
[0035] In combination with the fourth possible implementation of the second aspect of the present application, in a fifth possible implementation of the second aspect of the present application, the response processing includes the following:
[0036] Analyze the corresponding vehicle status according to the vehicle status information;
[0037] Alternatively, the corresponding driving test results are analyzed based on the vehicle status information.
[0038] In conjunction with the second aspect of the present application, in a sixth possible implementation of the second aspect of the present application, the apparatus further includes an upgrading unit configured to:
[0039] Get the bin file for OTA upgrade processing;
[0040] After the bin file is verified to be correct, upgrade the hardware device.
[0041] In a third aspect, the present application provides a processing device comprising a processor and a memory, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the method provided in the first aspect of the present application or any possible implementation of the first aspect of the present application is executed.
[0042] In a fourth aspect, the present application provides a computer-readable storage medium, which stores multiple instructions, and the instructions are suitable for a processor to load to execute the method provided in the first aspect of the present application or any possible implementation of the first aspect of the present application.
[0043] From the above content, it can be concluded that this application has the following beneficial effects:
[0044] When testing a hardware device serving as a lower machine, the present application introduces a hexadecimal protocol in the test tool, i.e., the processing device. When reporting information is received from the hardware device through the serial communication link, the processing device decodes it to obtain the reporting content of the hexadecimal protocol, and then executes the response processing corresponding to the reporting content according to the preset response strategy. During this test process, since the hexadecimal protocol is used for encoding and decoding operations, it has more outstanding versatility than the binary protocol used in the prior art, and can avoid the problem of abnormal encoding and decoding that may be caused by the binary information sent by the hardware device or the encoding and decoding operations based on the binary protocol in the prior art, thereby ensuring the normal progress of the testing work of the hardware device. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0046] Figure 1 A flow chart of the serial port protocol testing method of this application;
[0047] Figure 2 This is a schematic diagram of an interface of the test tool for this application;
[0048] Figure 3 This is a structural diagram of the serial port protocol testing device of the present application;
[0049] Figure 4 This is a structural diagram of the processing equipment for this application. DETAILED DESCRIPTION
[0050] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making creative efforts are within the scope of protection of this application.
[0051] The terms "first", "second", etc. in the specification and claims of this application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate so that the embodiments described herein can be implemented in a sequence other than that illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or modules is not necessarily limited to those steps or modules clearly listed, but may include other steps or modules that are not clearly listed or that are inherent to these processes, methods, products or devices. The naming or numbering of steps in this application does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The process steps that have been named or numbered can be changed in the execution order according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.
[0052] The division of modules in this application is a logical division. In actual application, there may be other division methods. For example, multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection between modules can be electrical or other similar forms, which are not limited in this application. Moreover, the modules or submodules described as separate components may or may not be physically separated, may or may not be physical modules, or may be distributed into multiple circuit modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this application.
[0053] Before introducing the serial port protocol testing method provided by this application, the background content involved in this application is first introduced.
[0054] The serial port protocol testing method, device, and computer-readable storage medium provided in this application can be applied to a processing device to introduce a hexadecimal protocol on the test tool side, thereby ensuring the normal operation of encoding and decoding the protocol.
[0055] The serial port protocol test method mentioned in this application can be executed by a serial port protocol test device, or a server, physical host, or user equipment (UE) of different types of processing devices that integrate the serial port protocol test device. The serial port protocol test device can be implemented in hardware or software, and the UE can be a terminal device such as a smartphone, tablet computer, laptop computer, desktop computer, or personal digital assistant (PDA). The processing device can be set up in a device cluster.
[0056] Next, we will introduce the serial port protocol testing method provided by this application.
[0057] First, see Figure 1 , Figure 1 A flow chart of the serial port protocol testing method of the present application is shown. The serial port protocol testing method provided by the present application may specifically include the following steps S101 to S103:
[0058] Step S101: The processing device receives reporting information from a hardware device serving as a slave computer based on a serial communication link between the processing device and the hardware device.
[0059] It can be understood that the test scenario involved in this application specifically refers to the test scenario executed by the processing device as the upper computer to the hardware device as the lower computer.
[0060] The hardware device can be any type of device.
[0061] Between the processing device and the hardware device, the present application specifically configures a connection via a serial communication link, or in other words, a serial port connection.
[0062] It can be understood that the test of the hardware device is initiated during a large amount of communication between the processing device and the hardware device. During this test process, the hardware device can report relevant reporting information to the processing device through active or passive reporting. The information is transmitted through the serial port connection between the two to the processing device for the processing device to perform the next processing work.
[0063] Step S102: The processing device decodes the reported information to obtain the reported content in hexadecimal format.
[0064] It is understandable that when information is transmitted between two devices, the information that is actually intended to be transmitted will be packaged or processed accordingly according to the information transmission conditions, and this application focuses on the encoding and decoding processing involved.
[0065] When the hardware device reports relevant information to the processing device, it will perform corresponding encoding operations. After receiving the information, the processing device will perform decoding operations to restore the real information, which is referred to as the reported content here.
[0066] In this link, the present application has noticed that the private binary protocol is commonly used in the existing technology, which easily leads to the problem of being unable to perform encoding and decoding operations normally. In this regard, the present application introduces a hexadecimal protocol. When performing decoding operations locally, the information is decoded into hexadecimal information. When sending information to the outside, the hexadecimal information is encoded into corresponding binary information.
[0067] In this way, compared with the binary protocol, the amount of data will become very large, which is not conducive to data observation and makes the encoding and decoding operations more complicated. After the introduction of the hexadecimal protocol in this application, since the minimum information is stored as 1-bit hexadecimal information, it is convenient to decode and encode the information. In this case, the relevant information of the device can also be directly converted from hexadecimal numbers to character data for information output. Therefore, it can have more outstanding versatility and can ensure the normal implementation of encoding and decoding operations.
[0068] In addition, it should be noted that the normal execution of the encoding and decoding operations guaranteed by this application is for the purpose of testing hardware equipment. It can be understood that in actual testing scenarios, technical teams are generally divided into software teams and hardware teams. When testing hardware equipment, it is obvious that the software team tests the hardware products developed by the hardware team. In this process, due to the limitations of the equipment conditions of the hardware equipment in actual applications, it is difficult to adjust or change them as little as possible. The information that the hardware equipment can send to the outside or to the processing equipment uses a fixed protocol. Therefore, if it uses a private binary protocol, there is an inherent problem that can easily lead to abnormal decoding at the receiving end, which obviously affects the progress of testing or actual applications.
[0069] After the above-mentioned settings of this application are implemented, problems such as inconsistent development progress and development content between the software team and the hardware team, which are difficult to communicate clearly and difficult to synchronize, can be avoided. A good testing environment can be provided for the testing tools, and the embarrassing situation of abnormal encoding and decoding operations during information transmission will not occur, thereby promoting more convenient and efficient automated testing results.
[0070] Step S103: The processing device performs response processing corresponding to the report content decoded from the report information according to a preset response strategy.
[0071] After decoding and parsing the report content that the hardware device really wants to pass on, the corresponding response processing can be determined and executed based on the business process, test process or related process processing, combined with the response strategy, to serve the testing work of the hardware device.
[0072] from Figure 1 It can be seen from the illustrated embodiment that, when testing a hardware device serving as a lower machine, the present application introduces a hexadecimal protocol in the test tool, i.e., the processing device. When reporting information is received from the hardware device through the serial communication link, the processing device decodes it to obtain the reporting content of the hexadecimal protocol, and then executes the response processing corresponding to the reporting content according to the preset response strategy. During this test process, since the hexadecimal protocol is used for encoding and decoding operations, it has more outstanding versatility than the binary protocol used in the prior art, and can avoid the problem of abnormal encoding and decoding caused by the binary information sent by the hardware device or the encoding and decoding operations based on the binary protocol in the prior art, thereby ensuring the normal progress of the testing work of the hardware device.
[0073] Continue to the above Figure 1 Each step of the illustrated embodiment and its possible implementation in practical applications are described in detail.
[0074] It is understandable that the present application also notes that the reporting information sent by the hardware device to the processing device may be subject to interference or errors and other abnormal conditions during the transmission process, thereby causing the reporting information received by the processing device itself to be abnormal. This obviously affects the progress of the test work before the decoding operation is performed. Therefore, if it can be detected before the decoding operation or before the response processing is performed based on the report content obtained by decoding, it will also help with information screening, elimination and proofreading of the communication link.
[0075] As a practical implementation, before the processing device performs the response processing corresponding to the report content decoded from the report information according to the preset response strategy, the method of the present application may further include the following:
[0076] The processing device verifies whether the CRC value of the reported content complies with the protocol specification;
[0077] If so, the processing device determines that the reported content is correct.
[0078] It can be understood that the CRC value is calculated based on the format of the decoded reported content and has nothing to do with the actual content to be transmitted. The content of the CRC value can be briefly understood as follows:
[0079] The hardware device uses a pre-agreed formula to calculate a value for the information contained in the reported content and appends this value to the reported content. The processing device also uses the same formula to perform the same calculation on the same data, so both sides should get the same calculation result. If the calculation results of the two CRC values are inconsistent, it means that an error occurred during the transmission process. Therefore, the processing device can request the hardware device to resend the reported information.
[0080] It can be seen that the proofreading of the CRC value is based on the decoded reported content. The CRC value that should be calculated for the reported content is used to determine whether there is any abnormality in the transmission process of the reported content, thereby ensuring the accurate transmission of the reported content between the hardware device and the processing device, thereby promoting the normal progress of this test service.
[0081] Of course, it is easy to understand that for the data sent by the processing device to the hardware device, the hardware device side can also use the verification rules of the CRC value to ensure the accurate transmission of relevant information between the hardware device and the processing device, thereby promoting the normal progress of this test service.
[0082] In addition, as another practical implementation, after receiving the reporting information reported by the hardware device, the method of the present application may further include the following:
[0083] The processing device feeds back first preset feedback information corresponding to the reported information to the hardware device according to the hexadecimal protocol, so that the hardware device determines that the hexadecimal protocol is correct if it receives the first preset feedback information;
[0084] Alternatively, the processing device determines whether the second preset feedback information fed back by the hardware device can be received after determining the information sent to the hardware device. If so, it is determined that the hexadecimal protocol is correct.
[0085] It can be understood that the setting of the preset feedback information here can be understood as a prior agreement between the hardware device and the processing device. After either party receives the information sent by the other party, it will feedback the preset feedback information according to the pre-configured hexadecimal protocol, so as to inform the other party that it has received the information, thereby achieving the effect of communicating and receiving the information normally.
[0086] In addition, the preset feedback information can also be fed back after it is determined that the content of the information after decoding is correct, thereby achieving a deeper effect of confirming that the information is transmitted correctly.
[0087] Furthermore, in another practical implementation method, the hardware device involved in the test scenario of the present application can specifically be a device simulated by a processing device in a virtual environment. That is, the hardware device is a device simulated by a program running in the virtual environment of the processing device. In this way, the processing device can change the device environment of the hardware device in different test rounds by adjusting different software and hardware conditions in the virtual environment, simulate various abnormal conditions of the hardware device, and test the software's response to various abnormal conditions.
[0088] It can be understood that under this setting, it is possible to break away from the hardware limitations brought by real devices and promote the simplicity of the testing services involved in this application in a more flexible and diverse manner. Not only can various equipment conditions be quickly adjusted and tested, but data under various extreme conditions can also be measured with significantly improved safety, meeting various testing requirements of the host computer, which was difficult to achieve with real devices.
[0089] To facilitate understanding of this setting, you can also combine Figure 2 The interface diagram of the test tool of this application is shown to understand the Figure 2 In the working interface shown in the figure, the upper right corner is used to display the working mode selection result, that is, testing the main control (hardware device) working mode or testing the APP (processing device) working mode. The difference in mode is whether the test focuses on the lower computer or the upper computer. When testing the main control working mode (lower computer), the focus is on testing the issuance and feedback of protocol instructions; when testing the APP working mode (upper computer), the focus is on simulating abnormalities that are not easy to occur in the protocol content or hardware layer, and paying attention to the signal reception and analysis of the APP (upper computer);
[0090] The middle area is used to display the sending and receiving status of all messages, such as whether the CRC check passes, whether it complies with the protocol specifications, whether the command requiring feedback has timed out, etc.
[0091] The bottom area is used for quick sending of commands.
[0092] At the same time, as another practical implementation method, the reported information reported by the hardware equipment can be specifically vehicle status information and positioning information (such as positioning information measured by Beidou positioning module, GPS positioning module and other positioning modules) in actual applications. Among them, vehicle information can specifically include vehicle hardware status information and vehicle software level status information. In addition to basic status information, vehicle status information can also include simulated abnormal status information (including simulated vehicle abnormal status information and positioning abnormal information).
[0093] It can be seen that the embodiment here specifically defines the hardware equipment involved in the test service of this application as vehicle equipment, that is, the vehicle. In this way, the test service performed by this application can be a test service for the vehicle.
[0094] Specifically, the vehicles involved in the testing service of this application can also be driving test vehicles in specific applications. In this way, when conducting vehicle basic tests, driving test equipment tests (driving test equipment is configured on or around the vehicle) or driving test business tests on driving test vehicles for driving test scenarios, this application can be used to further ensure the normal progress of its testing services.
[0095] As another practical implementation, it can be seen from the above that after obtaining the vehicle status information, the corresponding response processing may specifically include the following:
[0096] The processing device analyzes the corresponding vehicle status based on the vehicle status information;
[0097] Alternatively, the processing device analyzes the corresponding driving test results based on the vehicle status information.
[0098] It can be understood that the vehicle status corresponds to the above-mentioned vehicle basic test and driving test equipment test, and the driving test result corresponds to the above-mentioned driving test business test.
[0099] In addition, the present application may also involve upgrade processing. Specifically, the upgrade involved in the present application may be an OTA upgrade in the form of an offline upgrade. In this regard, the method of the present application may also include the following:
[0100] Processing device obtains bin file for OTA upgrade processing;
[0101] After the bin file is verified to be correct, the processing device upgrades the hardware device.
[0102] It can be understood that the upgrade processing mentioned here can be specifically a part of the test service, or it can be specifically the processing after the test service is completed. The specific details can be determined according to the actual situation and are not specifically limited here.
[0103] The above is an introduction to the serial port protocol testing method provided by this application. In order to facilitate better implementation of the serial port protocol testing method provided by this application, this application also provides a serial port protocol testing device from the perspective of functional modules.
[0104] See Figure 3 , Figure 3 This is a structural diagram of a serial port protocol test device of the present application. In the present application, the serial port protocol test device 300 may specifically include the following structure:
[0105] The receiving unit 301 is configured to receive reported information from a hardware device serving as a slave computer based on a serial communication link between the receiving unit and the hardware device;
[0106] The decoding unit 302 is used to decode the reported information to obtain the reported content in hexadecimal protocol;
[0107] The response unit 303 is configured to execute response processing corresponding to the report content decoded from the report information according to a preset response strategy.
[0108] In another exemplary implementation, the apparatus further includes a verification unit 304 configured to:
[0109] Verify whether the CRC value of the reported content complies with the protocol specification;
[0110] If so, confirm that the reported content is correct.
[0111] In another exemplary implementation, the apparatus further includes a verification unit 304 configured to:
[0112] Feedback, according to the hexadecimal protocol, first preset feedback information corresponding to the reported information to the hardware device, so that the hardware device determines that the hexadecimal protocol is correct upon receiving the first preset feedback information;
[0113] Alternatively, after determining the information sent to the hardware device, it is determined whether second preset feedback information fed back by the hardware device can be received. If so, it is determined that the hexadecimal protocol is correct.
[0114] In another exemplary implementation, the hardware device is specifically a device simulated by the processing device in a virtual environment, and the processing device changes the device environment of the hardware device in different test rounds by adjusting different software and hardware conditions in the virtual environment.
[0115] In another exemplary implementation, the reported information is specifically vehicle status information and positioning information. The vehicle information includes status information at the vehicle hardware level and status information at the vehicle software level. The vehicle status information includes simulated abnormal status information.
[0116] In another exemplary implementation, the response processing includes the following:
[0117] Analyze the corresponding vehicle status according to the vehicle status information;
[0118] Alternatively, the corresponding driving test results are analyzed based on the vehicle status information.
[0119] In another exemplary implementation, the apparatus further includes an upgrading unit 305, configured to:
[0120] Get the bin file for OTA upgrade processing;
[0121] After the bin file is verified to be correct, upgrade the hardware device.
[0122] This application also provides a processing device from the perspective of hardware structure, see Figure 4 , Figure 4 The schematic diagram of the structure of the processing device of the present application is shown. Specifically, the processing device of the present application may include a processor 401, a memory 402 and an input / output device 403. The processor 401 is used to execute the computer program stored in the memory 402 to implement the following Figure 1 Each step of the serial port protocol testing method in the corresponding embodiment; or, the processor 401 is used to implement the following when executing the computer program stored in the memory 402 Figure 3 The memory 402 is used to store the functions of each unit in the embodiment, and the processor 401 executes the above Figure 1 The computer program required by the serial port protocol testing method in the corresponding embodiment.
[0123] For example, the computer program may be divided into one or more modules / units, one or more of which are stored in memory 402 and executed by processor 401 to implement the present application. One or more modules / units may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used to describe the execution process of the computer program in a computer device.
[0124] The processing device may include, but is not limited to, a processor 401, a memory 402, and an input / output device 403. Those skilled in the art will appreciate that the illustrations are merely examples of processing devices and do not limit the processing device. The processing device may include more or fewer components than shown, or a combination of certain components, or different components. For example, the processing device may also include a network access device, a bus, etc., and the processor 401, the memory 402, the input / output device 403, etc. are connected via the bus.
[0125] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor. The processor is the control center of the processing device and connects various parts of the entire device using various interfaces and lines.
[0126] Memory 402 can be used to store computer programs and / or modules. Processor 401 implements various functions of the computer device by running or executing computer programs and / or modules stored in memory 402 and accessing data stored in memory 402. Memory 402 may primarily include a program storage area and a data storage area. The program storage area may store an operating system, at least one application required for a function, and the like; the data storage area may store data created based on the use of the processing device. Furthermore, memory may include high-speed random access memory and non-volatile memory, such as a hard disk, internal memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card, at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0127] When the processor 401 is used to execute the computer program stored in the memory 402, it can specifically implement the following functions:
[0128] From the hardware device serving as the lower computer, the reported information is received based on the serial port communication link between the hardware device and the hardware device;
[0129] Decode the reported information to obtain the reported content in hexadecimal protocol;
[0130] According to the preset response strategy, the response processing corresponding to the report content decoded from the report information is executed.
[0131] Those skilled in the art will clearly understand that for the convenience and brevity of description, the specific working process of the serial protocol test device, processing equipment and corresponding units described above can refer to the following. Figure 1 The description of the serial port protocol testing method in the corresponding embodiment will not be repeated here.
[0132] Those skilled in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be accomplished by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.
[0133] To this end, the present application provides a computer-readable storage medium, which stores a plurality of instructions, which can be loaded by a processor to execute the present application as follows: Figure 1 For the steps of the serial port protocol testing method in the corresponding embodiment, the specific operations can be referred to as follows Figure 1 The description of the serial port protocol testing method in the corresponding embodiment will not be repeated here.
[0134] The computer-readable storage medium may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0135] Due to the instructions stored in the computer readable storage medium, the present application can be executed as follows: Figure 1 Corresponding to the steps of the serial port protocol testing method in the embodiment, therefore, the present application can be implemented as follows Figure 1 The beneficial effects that can be achieved by the serial port protocol testing method in the corresponding embodiment are detailed in the previous description and will not be repeated here.
[0136] The serial port protocol testing method, apparatus, processing equipment, and computer-readable storage medium provided by the present application are introduced in detail above. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there may be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.
Claims
1. A serial port protocol testing method, characterized in that: The method comprises: The processing device receives reported information from a hardware device serving as a lower computer based on a serial communication link between the processing device and the hardware device, wherein the reported information adopts a binary protocol; The processing device decodes the reported information to obtain the reported content in hexadecimal protocol; The processing device performs response processing corresponding to the reported content decoded from the reported information according to a preset response strategy; The hardware device is specifically a device simulated by the processing device in a virtual environment, and the processing device changes the device environment of the hardware device in different test rounds by adjusting different software and hardware conditions in the virtual environment; The reported information specifically includes vehicle status information and positioning information. The vehicle status information includes vehicle hardware status information and vehicle software status information. The vehicle status information includes simulated abnormal status information. The response processing includes the following: The processing device analyzes the corresponding vehicle state according to the vehicle state information; Alternatively, the processing device analyzes the corresponding driving test result based on the vehicle status information; The method further comprises: The processing device feeds back first preset feedback information corresponding to the reported information to the hardware device according to the hexadecimal protocol, so that the hardware device determines that the hexadecimal protocol is correct upon receiving the first preset feedback information; Alternatively, the processing device determines whether second preset feedback information fed back by the hardware device can be received after sending the first preset feedback information to the hardware device, and if so, determines that the hexadecimal protocol is correct.
2. The method according to claim 1, characterized in that Before the processing device performs response processing corresponding to the reported content decoded from the reported information according to a preset response strategy, the method further includes: The processing device verifies whether a cyclic redundancy check (CRC) value of the reported content complies with the protocol specification; If so, the processing device determines that the reported content is correct.
3. The method according to claim 1, characterized in that The method further comprises: The processing device obtains a bin file for OTA upgrade processing using the over-the-air download technology; After the bin file is verified to be correct, the processing device upgrades the hardware device.
4. A serial port protocol testing device, characterized in that: The device comprises: A receiving unit, configured to receive reported information from a hardware device serving as a slave computer based on a serial communication link between the receiving unit and the hardware device, wherein the reported information adopts a binary protocol; A decoding unit, configured to decode the reported information to obtain the reported content in hexadecimal protocol; A response unit, configured to execute a response process corresponding to the reported content decoded from the reported information according to a preset response strategy; The hardware device is specifically a device simulated by the processing device in a virtual environment, and the processing device changes the device environment of the hardware device in different test rounds by adjusting different software and hardware conditions in the virtual environment; The reported information specifically includes vehicle status information and positioning information. The vehicle status information includes vehicle hardware status information and vehicle software status information. The vehicle status information includes simulated abnormal status information. The response processing includes the following: The processing device analyzes the corresponding vehicle state according to the vehicle state information; Alternatively, the processing device analyzes the corresponding driving test result based on the vehicle status information; The device further includes a verification unit, configured to: Feedback, according to the hexadecimal protocol, first preset feedback information corresponding to the reported information to the hardware device, so that the hardware device determines that the hexadecimal protocol is correct upon receiving the first preset feedback information; Alternatively, it is determined whether second preset feedback information fed back by the hardware device can be received after the first preset feedback information is sent to the hardware device. If so, it is determined that the hexadecimal protocol is correct.
5. A processing device, characterized in that: The method comprises a processor and a memory, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the method according to any one of claims 1 to 3 is executed.
6. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to execute the method according to any one of claims 1 to 3.
Citation Information
Patent Citations
Railway secure communication protocol conformance testing method
CN108683558A
Vehicle ECU software upgrading method and system, and microcontroller and SOC end of vehicle-mounted TBOX
CN111930407A
Protocol processing system and protocol data processing method
CN112882989A
Method and device for protocol docking debugging and storage medium
CN114205427A