Method and system for inquiring fault code based on handheld diagnosis equipment and electronic equipment
By converting fault codes from handheld diagnostic devices to ASCII values and establishing an index table, fast and accurate fault code lookup was achieved, solving the problem of low query efficiency of handheld devices and improving customer experience.
Patent Information
- Application Number
- CN202511421397.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-30
- Publication Date
- 2026-01-06
AI Technical Summary
Existing handheld diagnostic devices are inefficient at querying fault codes, which affects customer experience, especially when the fault code database is large, resulting in long query times.
By converting fault codes to ASCII values, establishing an index table, and performing preset number format conversion, the index table and a pre-stored database are used for rapid matching to obtain the description information of the fault codes.
It improves the accuracy and efficiency of fault code lookup, meets the needs of rapid diagnosis of modern electronic equipment, and solves the problems of low efficiency and insufficient accuracy of traditional lookup methods.
Smart Images

Figure CN121277960A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of automotive fault diagnosis technology, and in particular to a method, system and electronic device for querying fault codes based on a handheld diagnostic device. Background Technology
[0002] With rapid economic development, the number of cars on the market has increased dramatically. Consequently, the variety of automotive diagnostic equipment has also grown. Many companies, in an effort to reduce costs, are abandoning Android and iOS-based devices in favor of cheaper handheld devices built with microcontrollers. However, handheld devices are significantly slower at querying fault code data compared to Android and iOS systems, impacting the customer experience. For example, Mercedes-Benz and Nissan have vast fault code databases, containing tens of thousands of lines of data, making queries time-consuming.
[0003] Therefore, how to design a method suitable for low-cost handheld diagnostic devices to improve the efficiency of fault code lookup is a technical problem that urgently needs to be solved. Summary of the Invention
[0004] The purpose of this application is to overcome the above-mentioned technical problems and provide a method, system and electronic device for querying fault codes based on a handheld diagnostic device, which can improve the efficiency of handheld diagnostic devices in querying fault codes and thus improve the customer experience.
[0005] Firstly, one embodiment of this application discloses a method for querying fault codes based on a handheld diagnostic device, employing the following scheme: A method for querying fault codes based on a handheld diagnostic device includes: obtaining a first original fault code; converting the first original fault code to its ASCII value to obtain a first target fault code; querying and matching the first target fault code in an index table to obtain target data information; the target data information includes a second target fault code and an original index ID, wherein the first target fault code corresponds to the second target fault code; extracting the original index ID from the target data information and converting it to a preset base format to obtain a first target index ID; and querying and matching the target index ID in a pre-stored database to obtain descriptive information corresponding to the first original fault code.
[0006] By adopting the above technical solution, in the context of handheld diagnostic devices querying fault codes, the acquisition of the first original fault code provides basic data for subsequent fault code processing and querying; the first original fault code is converted into an ASCII value to obtain the first target fault code, which facilitates accurate querying and matching in the subsequent index table; querying and matching the first target fault code in the index table to obtain target data information can quickly locate the second target fault code and the original index ID related to the first original fault code; the original index ID is extracted from the target data information and converted to a preset base format to obtain the first target index ID, so that the data format meets the query requirements of the pre-stored database; querying and matching the target index ID in the pre-stored database to obtain the descriptive information of the corresponding first original fault code, ultimately realizing the function of accurately querying and describing the fault codes obtained by the handheld diagnostic device, improving the efficiency and accuracy of fault diagnosis.
[0007] Optionally, before obtaining the first original fault code, the method further includes: sorting multiple fault code data in sequence, converting each fault code data to ASCII value, and adding a distinguishing character after conversion to obtain the second target fault code corresponding to the fault code, wherein each fault code data includes a second target index id, a second original fault code, and corresponding description information; converting the second target index id based on the preset base format to obtain the original index id; and establishing an index table of multiple fault code data based on the original index id and the second target fault code.
[0008] By adopting the above technical solution, multiple fault code data are sequentially sorted, facilitating rapid location and retrieval of fault codes and improving query efficiency. Converting each fault code data to its ASCII value and adding distinguishing characters to obtain a second target fault code provides clearer identification and differentiation, facilitating accurate recognition and processing. Converting the second target index ID based on a preset base format to obtain the original index ID unifies the data format, facilitating subsequent data processing and storage. Establishing an index table for multiple fault code data based on the original index ID and the second target fault code provides an efficient data structure for subsequent query matching, helping to quickly obtain relevant information about the corresponding fault code.
[0009] Optionally, it further includes: obtaining a target ECU value; when querying and matching the first target fault code in the index table, if multiple target data information are obtained, then the target ECU value is compared to obtain the final target data information; wherein, each fault code data in the index table contains a corresponding ECU value.
[0010] By adopting the above technical solution, the target ECU value can be obtained, which can provide benchmark data for subsequent comparison. When multiple target data information are obtained by querying and matching the first target fault code in the index table, the target ECU value can be compared. The final target data information can be filtered out from the multiple target data information. Since each fault code data in the index table contains the corresponding ECU value, the filtering process has a clear basis and can obtain the final target data information that matches the actual situation more accurately.
[0011] Optionally, it further includes: determining whether the character length of the first original fault code meets the preset character length; if not, obtaining the length difference, and supplementing the first original fault code with a certain number of target characters based on the length difference to update the first original fault code.
[0012] By adopting the above technical solution, it is possible to determine whether the character length of the first original fault code meets the preset character length, and to identify fault codes that do not meet the length requirements. If the character length of the first original fault code does not meet the preset character length, the length difference is obtained and a certain number of target characters are added to the first original fault code based on the difference to update the first original fault code. This can make the character length of the fault code meet the preset requirements and improve the accuracy and efficiency of subsequent query matching.
[0013] Optionally, extracting the original index ID from the target data information includes: segmenting the target data information based on the length of the second target fault code to extract the original index ID.
[0014] By adopting the above technical solution, in the process of obtaining the description information of the corresponding first original fault code, the target data information is segmented based on the length of the second target fault code, which can accurately extract the original index ID from the target data information, providing a basis for subsequent preset base format conversion and query matching in the pre-stored database to obtain the description information.
[0015] Optionally, the distinguishing character is 0x01, which is added to the beginning of the character after ASCII value conversion of each fault code data to obtain the second target fault code.
[0016] By adopting the above technical solution, after sorting multiple fault code data in sequence and converting their ASCII values, the distinguishing character 0x01 is added to the beginning of the character to obtain the second target fault code. This can effectively distinguish different fault code data, which facilitates the subsequent establishment of an index table based on the second target fault code and the query and matching of fault codes, thereby improving the accuracy and efficiency of fault code query.
[0017] Optionally, the multiple fault code data are sorted in ascending order; the preset base format is hexadecimal format.
[0018] By adopting the above technical solution, sorting multiple fault code data in ascending order can make the data more orderly, which is convenient for subsequent query and matching operations; using hexadecimal format for preset base conversion conforms to common computer data processing habits, which can improve the efficiency of data processing and query, and realize accurate query of the description information of the corresponding first original fault code based on handheld diagnostic devices.
[0019] Secondly, one embodiment of this application discloses a device for querying fault codes based on a handheld diagnostic device, which adopts the following scheme: A system for querying fault codes based on a handheld diagnostic device, used to execute any of the methods described above, includes: an acquisition module for acquiring a first original fault code; a first conversion module for converting the first original fault code into an ASCII value to obtain a first target fault code; a first query matching module for querying and matching the first target fault code in an index table to obtain target data information; the target data information includes a second target fault code and an original index ID, wherein the first target fault code and the second target fault code correspond to the same value; an extraction module for extracting the original index ID from the target data information and converting it to a preset base format to obtain a first target index ID; and a second query matching module for querying and matching the target index ID in a pre-stored database to obtain descriptive information corresponding to the first original fault code.
[0020] By adopting the above technical solution, the acquisition module obtains the first original fault code, and the first conversion module converts it into an ASCII value to obtain the first target fault code, which facilitates subsequent query matching. The first query matching module queries and matches the first target fault code in the index table to obtain target data information containing the second target fault code and the original index ID, thereby achieving preliminary positioning. The extraction module extracts the original index ID from the target data information and converts it into a preset base format to obtain the first target index ID, so that the index ID meets the requirements of subsequent queries. The second query matching module queries and matches the target index ID in the pre-stored database to obtain the description information corresponding to the first original fault code, thus completing the fault code query process.
[0021] Optionally, it further includes: a second conversion module, used to sort multiple fault code data in sequence, convert each fault code data to ASCII value, and add a distinguishing character after conversion to obtain the second target fault code corresponding to the fault code, wherein each fault code data includes a second target index id, a second original fault code, and corresponding descriptive information; a third conversion module, used to convert the second target index id based on the preset base format to obtain the original index id; and an index table establishment module, used to establish the index table of multiple fault code data based on the original index id and the second target fault code.
[0022] By adopting the above technical solution, multiple fault code data are sorted sequentially, ASCII values are converted, and distinguishing characters are added to obtain a second target fault code. The second target index id is converted to a preset base format to obtain the original index id. In this way, an index table of multiple fault code data is established, which can make the fault code data orderly and standardized, and facilitate subsequent querying and matching of the description information corresponding to the first original fault code.
[0023] Thirdly, one embodiment of this application discloses an electronic device that adopts the following solution: An electronic device includes: a memory and a processor, the memory being used to store a computer program; the processor being used to execute the computer program to implement the steps of the method as described in any of the preceding claims.
[0024] In summary, this application includes at least one of the following beneficial technical effects: 1. By converting fault codes to ASCII values and establishing an index table, the accuracy and efficiency of fault code query and matching are improved, solving the problems of easy errors and low efficiency in traditional manual manual consultation and the lack of an effective indexing mechanism for simple database queries; 2. By converting the original index ID to a preset base format, the description information of the corresponding fault code can be obtained more accurately from the pre-stored database, meeting the needs of rapid diagnosis of modern electronic equipment; 3. When multiple target data information are matched in the query, the final target data information is obtained by comparing the target ECU value, which further improves the accuracy of the query. Attached Figure Description
[0025] Figure 1 This is a flowchart illustrating a method for querying fault codes based on a handheld diagnostic device, as disclosed in an embodiment of this application. Figure 2 This is another flowchart illustrating a method for querying fault codes based on a handheld diagnostic device, as disclosed in an embodiment of this application. Figure 3This is a schematic diagram of the module flow of a system for querying fault codes based on a handheld diagnostic device, as disclosed in another embodiment of this application. Figure 4 This is a schematic diagram of the structure of an electronic device disclosed in another embodiment of this application. Detailed Implementation
[0026] The present application will be further described in detail below with reference to the accompanying drawings.
[0027] Embodiments of this application will now be described in more detail with reference to the accompanying drawings. While embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to make this application more thorough and complete, and to fully convey the scope of this application to those skilled in the art.
[0028] The terminology used in this application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. The singular forms “a” and “the” as used in this application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.
[0029] It should be understood that although the terms "first," "second," etc., may be used in this application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0030] The technical solutions of the embodiments of this application are described in detail below with reference to the accompanying drawings.
[0031] [First Embodiment] See Figure 1 The first embodiment of this application discloses a method for querying fault codes based on a handheld diagnostic device. This method, applied to a handheld diagnostic device, includes steps such as obtaining the original fault code, fault code conversion, index table lookup, index ID conversion, and database query, as detailed below: S10. Obtain the first original fault code; The step of obtaining the first original fault code is the starting point of the entire query process. This can be done by the user directly inputting it into a handheld diagnostic device, or by communicating with an electronic device, such as via a wired or wireless connection. This handheld diagnostic device can be a diagnostic instrument with a data interface, or a smart device with wireless communication capabilities such as Bluetooth or Wi-Fi. Once the first original fault code is obtained, the process proceeds to convert its ASCII value.
[0032] For example, the fault code obtained is p0018.
[0033] S20. Convert the first original fault code into its ASCII value to obtain the first target fault code; The ASCII value conversion process can be implemented using specialized conversion algorithms or software tools. On the hardware side, a microcontroller (MCU) with data processing capabilities is used, and the conversion is performed by writing corresponding program code. On the software side, a conversion function can be written using a programming language such as Python. The principle of the conversion is to convert the characters in the fault code into their corresponding ASCII values, thereby facilitating subsequent lookup and matching operations.
[0034] Based on the above example, the obtained fault code p0018 can be converted into the following first target fault codes by taking its ASCII value: 0x01, 0x50, 0x30, 0x30, 0x31, 0x38.
[0035] S30. Query and match the first target fault code in the index table to obtain target data information; The index table is created in advance and stores processed fault code data. The query and matching process can employ efficient search algorithms such as binary search. At the hardware level, a cache is used to store a portion of the index table data to improve query speed. Once the target data information corresponding to the first target fault code is found in the index table, this target data information includes the second target fault code and the original index ID, and the first and second target fault codes correspond to the same value.
[0036] Based on the above example, the index table contains the following data: 0x01, 0x50, 0x30, 0x30, 0x30, 0x35 "0X000000"; 0x01, 0x50, 0x30, 0x30, 0x31, 0x30 "0X000001"; 0x01, 0x50, 0x30, 0x30, 0x31, 0x31 "0X000002"; 0x01, 0x50, 0x30, 0x30, 0x31, 0x32 "0X000003"; 0x01, 0x50, 0x30, 0x30, 0x31, 0x34 "0X000004"; 0x01, 0x50, 0x30, 0x30, 0x31, 0x35 "0X000005"; 0x01, 0x50, 0x30, 0x30, 0x31, 0x36 "0X000006"; 0x01, 0x50, 0x30, 0x30, 0x31, 0x37 "0X000007"; 0x01, 0x50, 0x30, 0x30, 0x31, 0x38 "0X000008"; Based on the first target fault code, the index table is searched and matched sequentially from top to bottom. After the ninth match, the second target fault code in the target data information (0x01, 0x50, 0x30, 0x30, 0x31, 0x38"0X000008") is found to be consistent with the first target fault code (0x01, 0x50, 0x30, 0x30, 0x31, 0x38).
[0037] S40. Extract the original index ID from the target data information and perform a preset base format conversion to obtain the first target index ID; When extracting the original index ID from the target data, the target data can be segmented based on the length of the second target fault code to extract the original index ID. The segmentation process can use string splitting functions, such as the `split` function in Python.
[0038] Based on the example above, the index file contains 0x01, 0x50, 0x30, 0x30, 0x31, 0x38"0X000008". The string 0X000008 is extracted and converted to the integer 0X000008 using the function strtoul(0X000008, 0, 16). Then, 0X000008 is converted to a preset base format, such as hexadecimal, to obtain the index IDs: 0x00, 0x00, 0x00, 0x00, 0x00, 0x08.
[0039] S50. Query and match the target index ID from the pre-stored database to obtain the description information of the corresponding first original fault code; The pre-stored database can be a relational database, such as MySQL, or a non-relational database, such as MongoDB. The query matching process can use database query statements, such as SQL statements. Once the corresponding target index ID is found, the corresponding fault code description information can be obtained.
[0040] Based on the above example, after converting 0X000008 into the index ID: 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, this index ID is used to find 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 "P0018, Crankshaft Position (B2) Sensor A" in the database of pre-stored fault code data, and then the data "P0018, Crankshaft Position (B2) Sensor A" is returned.
[0041] Of course, there are also cases where no match is found in the pre-stored database. In such cases, it is assumed that the fault code library file (pre-stored database) does not contain the fault code "P0018", and an empty value is returned.
[0042] It's worth mentioning that converting a fault code like P0018 into an index ID and finding a value like 0X000008 takes 1 millisecond. Then, converting 0X000008 back into an index ID and finding the data takes 1 millisecond. Thus, querying one fault code only takes 2 milliseconds, and querying 10 fault code numbers takes only 20 milliseconds. This significantly improves query efficiency.
[0043] See Figure 2 Before step S10, that is, before obtaining the first original fault code, a series of preparatory work needs to be carried out, such as establishing a lookup table, as follows: S01. Sort multiple fault code data in order, convert the ASCII value of each fault code data, and add a distinguishing character after conversion to obtain the second target fault code of the corresponding fault code. The sorting can be done by ordering the fault codes from smallest to largest. Adding a distinguishing character is to differentiate between different fault code data; this distinguishing character could be, for example, 0x01, and is added to the beginning of the character set after ASCII value conversion for each fault code data.
[0044] S02. Convert the second target index id based on a preset base format to obtain the original index id; This conversion process follows the same principle as the previous index ID conversion, both aimed at facilitating subsequent query operations.
[0045] S03. Based on the original index ID and the second target fault code, establish an index table for multiple fault code data; One method for creating an index table is to use the database's indexing function, using the original index ID and the second target fault code as index fields, so that the corresponding data can be quickly located during a query.
[0046] Furthermore, if multiple fault code numbers appear in the fault code database file (pre-stored database), it's because the vehicle's ECU is different. Since vehicle ECUs are represented by numbers, the ECU value can be added to the beginning when converting the fault code "P0018" into an index ID. For example: 0x00, 0x00, 0x00, 0x00, 0x00, 0x00"1000, P0005, Fuel shut-off valve A"; 0x00, 0x00, 0x00, 0x01, 0x45, 0x08"1290, P0005, Fuel shut-off valve A"; Where 1000 and 1290 are the values of the ECU, converting 1000 and 1290 to hexadecimal numbers respectively, the converted values are... 0x03, 0xE8, 0x50, 0x30, 0x30, 0x30, 0x35 "0X000000"; 0x05, 0x0A, 0x50, 0x30, 0x30, 0x30, 0x35 "0X014508".
[0047] Correspondingly, the method also includes: S04. Obtain the target ECU value; This step can be performed together with step S10.
[0048] S05. When querying and matching the first target fault code in the index table, if multiple target data information are obtained, then the target ECU value is compared to obtain the final target data information. Each fault code in the index table contains a corresponding ECU value. By comparing the ECU values, the query results can be further refined.
[0049] Furthermore, this method also includes: S11. Determine whether the character length of the first original fault code meets the preset character length; S12. If not satisfied, obtain the length difference, and supplement the first original fault code with a certain number of target characters based on the length difference to update the first original fault code. This judgment process can be implemented using a string length function in a programming language, and the supplementary characters can be added using string concatenation.
[0050] For example, some fault code databases (pre-stored databases) do not use a uniform format for fault codes, such as five characters, but rather other formats, such as: 0x10, 0x00, 0x28, 0x6b "U043181, CAN signal 1 length error of BCM1"; 0x2d, 0x08, 0x00, 0x04"0033, Intake manifold absolute pressure (MAP) sensor voltage too high"; This allows the longest fault code number to be used as the length of the index ID. "U043181" is converted to 0x55, 0x30, 0x34, 0x33, 0x31, 0x38, 0x31. If the fault code is not long enough, 0xFF is placed at the beginning as a supplement.
[0051] If the length of "0033" is less than 7, add three 0xFF characters at the beginning. The converted system ID value is: 0xFF, 0xFF, 0xFF, 0x30, 0x30, 0x33, 0x33.
[0052] The implementation principle of this embodiment is as follows: This method overcomes the inefficiency and inaccuracy of traditional fault code query methods through a series of fault code conversion, index table establishment, and query matching operations. By converting ASCII values and using preset base format conversion, the fault code data becomes more standardized and easier to process. The establishment of the index table provides an efficient indexing mechanism for queries, enabling rapid location of target data. Simultaneously, steps such as ECU value comparison and fault code length judgment further improve the accuracy of the query, meeting the needs of rapid diagnosis of modern electronic equipment.
[0053] [Second Embodiment] See Figure 3 The second embodiment of this application discloses a system for querying fault codes based on a handheld diagnostic device, including: an acquisition module 210, a first conversion module 220, a first query matching module 230, an extraction module 240, and a second query matching module 250.
[0054] The acquisition module 210 is used to acquire a first original fault code; the first conversion module 220 converts the first original fault code into an ASCII value to obtain a first target fault code; the first query matching module 230 is used to query and match the first target fault code in an index table to acquire target data information; the target data information includes a second target fault code and an original index ID, and the first target fault code corresponds to the second target fault code; the extraction module 240 is used to extract the original index ID from the target data information and perform a preset base format conversion to obtain a first target index ID; the second query matching module 250 is used to query and match the target index ID in a pre-stored database to obtain description information corresponding to the first original fault code.
[0055] Furthermore, the system also includes: a second conversion module 110, a third conversion module 120, and an index table creation module 130.
[0056] The second conversion module 110 is used to sort multiple fault code data in sequence, convert the ASCII value of each fault code data, and add a distinguishing character after conversion to obtain the second target fault code corresponding to the fault code. Each fault code data includes a second target index id, a second original fault code, and corresponding description information. The third conversion module 120 is used to convert the second target index id based on the preset base format to obtain the original index id. The index table establishment module 130 is used to establish the index table of multiple fault code data based on the original index id and the second target fault code.
[0057] It should be noted that the system for querying fault codes based on a handheld diagnostic device disclosed in the second embodiment of this application is used to execute the method for querying fault codes based on a handheld diagnostic device disclosed in the first embodiment, and therefore will not be described in detail here. Optionally, the various modules and other operations or functions in this embodiment are respectively for implementing the methods in the foregoing embodiments.
[0058] [Third Embodiment] See Figure 4 In the second embodiment of this application, an electronic device 300 is disclosed, which includes a memory 310 and a processor 320. The memory 310 is used to store a computer program; the processor 320 is used to execute the computer program to implement the steps of the method for querying fault codes based on a handheld diagnostic device as described in the second embodiment above. For details, please refer to the above description and will not be described in detail here.
[0059] The technical effect of the electronic device provided in this embodiment in practical application is the same as that of the method for querying fault codes based on a handheld diagnostic device in the first embodiment.
[0060] [Fourth Embodiment] A computer-readable storage medium is disclosed in the fourth embodiment of this application. The computer-readable storage medium is, for example, a non-volatile memory, such as magnetic media (e.g., hard disks, floppy disks, and magnetic tapes), optical media (e.g., CD-ROMs and DVDs), magneto-optical media (e.g., optical discs), and hardware devices specifically configured to store and execute computer-executable instructions (e.g., read-only memory (ROM), random access memory (RAM), flash memory, etc.). A computer program is stored on the computer-readable storage medium. The computer-readable storage medium can be executed by one or more processors or processing devices to implement the method for querying fault codes based on a handheld diagnostic device as described in the foregoing embodiments.
[0061] Furthermore, it is understood that the foregoing embodiments are merely illustrative examples of the present invention. Provided that the technical features do not conflict, the structure is not contradictory, and the purpose of the invention is not violated, the technical solutions of the various embodiments can be arbitrarily combined and used.
[0062] In the embodiments provided by this invention, it should be understood that the disclosed methods, systems, and measuring devices can be implemented in other ways. For example, the modules included in the systems described above are merely illustrative, and the division of modules is only a logical functional division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0063] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0064] Furthermore, in the various embodiments of the present invention, the functional units / modules can be integrated into one processing unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated into one unit / module. The integrated unit / module described above can be implemented in hardware or in the form of hardware plus software functional units / modules.
[0065] The integrated units / modules implemented as software functional units / modules described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause one or more processors of a computer measurement device (which may be a personal computer, server, or network measurement device, etc.) to execute some steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0066] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for querying a fault code based on a handheld diagnostic device, characterized by, The method comprises the following steps: obtaining a first original fault code; converting the first original fault code into an ASCII value to obtain a first target fault code; querying and matching the first target fault code in an index table to obtain target data information; the target data information comprises a second target fault code and an original index id, and the first target fault code corresponds to the second target fault code; extracting the original index id from the target data information and converting the original index id into a preset format to obtain a first target index id; querying and matching the target index id in a pre-stored database to obtain description information corresponding to the first original fault code.
2. The method of claim 1, wherein, Before the step of obtaining the first original fault code, the method further comprises the following steps: sequentially sorting a plurality of fault code data, converting each fault code data into an ASCII value, and adding a distinguishing character after the conversion to obtain a second target fault code corresponding to the fault code, wherein each fault code data comprises a second target index id, a second original fault code, and corresponding description information; converting the second target index id into the preset format to obtain the original index id; based on the original index id and the second target fault code, establishing the index table of the plurality of fault code data.
3. The method of claim 2, wherein, The method further comprises the following steps: obtaining a target ECU value; when the querying and matching of the first target fault code in the index table obtains a plurality of target data information, comparing the target ECU value to obtain final target data information; wherein each fault code data in the index table comprises an ECU value.
4. The method of claim 2, wherein, The method further comprises the following steps: determining whether the character length of the first original fault code meets a preset character length; if not, obtaining a length difference value, supplementing a certain number of target characters to the first original fault code based on the length difference value to update the first original fault code.
5. The method of claim 1, wherein, The step of extracting the original index id from the target data information comprises the following step: based on the length of the second target fault code, segmenting the target data information to extract the original index id.
6. The method of claim 2, wherein, The distinguishing character is 0x01, which is added to the front end of each character after the ASCII value conversion of the fault code data to obtain the second target fault code.
7. The method of claim 1, wherein, sequentially sorting the plurality of fault code data from small to large; the preset format is a hexadecimal format.
8. A system for querying trouble codes based on a handheld diagnostic device, the system comprising: The method comprises the following steps: an obtaining module for obtaining a first original fault code; a first conversion module for converting the first original fault code into an ASCII value to obtain a first target fault code; a first querying and matching module for querying and matching the first target fault code in an index table to obtain target data information; the target data information comprises a second target fault code and an original index id, and the first target fault code corresponds to the second target fault code; an extracting module for extracting the original index id from the target data information and converting the original index id into a preset format to obtain a first target index id; and an obtaining module for obtaining a target ECU value; when the querying and matching of the first target fault code in the index table obtains a plurality of target data information, comparing the target ECU value to obtain final target data information; wherein each fault code data in the index table comprises an ECU value. The second query matching module is configured to perform query matching of the target index id from a pre-stored database to obtain description information corresponding to the first original fault code.
9. The system of claim 8, wherein, Further comprising: The second conversion module is configured to sequentially sort a plurality of fault code data, convert each fault code data into an ASCII value, and add a distinguishing character after the conversion to obtain the second target fault code corresponding to the fault code, wherein each fault code data comprises a second target index id, a second original fault code, and corresponding description information. The third conversion module is configured to convert the second target index id based on the pre-set base format to obtain the original index id. The index table establishing module is configured to establish the index table of a plurality of fault code data based on the original index id and the second target fault code.
10. An electronic device, comprising: Comprising: A memory and a processor, the memory is configured to store a computer program; the processor is configured to execute the computer program to implement the steps of the method according to any one of claims 1 to 7.