A device code production optimization method, device, equipment and storage medium
By automatically acquiring device codes and performing type judgment and data processing, the problem of low device code generation efficiency in existing technologies has been solved, enabling mass production and optimization of device codes and reducing management and maintenance costs.
Patent Information
- Application Number
- CN202310305359.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-24
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2043-03-24
AI Technical Summary
In existing technologies, manually obtaining the MAC address of the gateway device to generate the device code is inefficient, cannot be mass-produced, and results in excessively high costs for unified management and subsequent maintenance.
By automatically acquiring device codes, determining their type, and performing data processing or standard verification, unique identification code data is generated, enabling the mass production and optimization of device codes.
It enables automated generation of device codes, improves production efficiency, reduces labor costs, and simplifies management and maintenance processes.
Smart Images

Figure CN116346770B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of device code production optimization, and in particular to a device code production optimization method and device, equipment and a storage medium. BACKGROUND
[0002] In order to ensure the uniqueness of the gateway device, a unique device code is usually needed to identify the identity of the gateway device. The device code generally includes the hardware information, version information, manufacturer information, etc. of the product. Based on the device code, the device server side can analyze the corresponding characteristics of the device code, obtain the device information, and make some pre-settings according to the analysis result, or can accurately trace back to the device according to the device code.
[0003] The MAC address of the interface of the existing gateway device is unique, and the MAC address of the first interface is usually used as the basis to calculate a unique string, and then a unique device code is calculated based on the string and the hardware information, version information, manufacturer information, etc. of the product.
[0004] In the existing implementation method, the MAC address of the first interface is obtained by manual method, the device code is generated in the production website based on the MAC address, and the device code of each device needs to be manually produced and imported for use in the device. Therefore, the operator is required to have certain network knowledge and deep understanding of the product to ensure that the correct MAC address is obtained. Moreover, the method has low efficiency, cannot be mass-produced, and has high cost for unified management and subsequent maintenance.
[0005] That is, in the prior art, the MAC address of the first interface is obtained by manual method, the device code of each device needs to be manually produced and imported for use in the device, which has low efficiency, cannot be mass-produced, and has high cost for unified management and subsequent maintenance. SUMMARY
[0006] To at least partially overcome the problems in the related art that the MAC address of the first interface is obtained by manual method, the device code of each device needs to be manually produced and imported for use in the device, which has low efficiency, cannot be mass-produced, and has high cost for unified management and subsequent maintenance, the present application provides a device code production optimization method, device, equipment and storage medium.
[0007] The scheme of the present application is as follows:
[0008] In a first aspect, the present application provides a device code production optimization method, which comprises:
[0009] automatically obtaining the device code of the device to be tested;
[0010] determining a type of the equipment code;
[0011] if the type of the equipment code is a general type, performing data processing on the equipment code to obtain unique identification code data;
[0012] if the type of the equipment code is unique, performing standard verification on the equipment,
[0013] if the standard verification rule is met, obtaining a production optimization result of the equipment code;
[0014] otherwise, performing corresponding operation processing based on the prompted related information.
[0015] Further, the determination of the type of the equipment code comprises:
[0016] reading characters at a specified position of the equipment code;
[0017] converting the characters at the specified position into a variable and determining based on the variable corresponding explanation;
[0018] if the obtained variable value is 1, the type of the equipment code is a trial type;
[0019] if the obtained variable value is 2, the type of the equipment code is a unique type;
[0020] if the obtained variable value is 3, the type of the equipment code is a general type.
[0021] Further, the automatic acquisition of the equipment code of the equipment to be tested comprises:
[0022] powering on a gateway type equipment;
[0023] when the gateway type equipment is started, obtaining a predefined test file from a specified path under a storage medium;
[0024] obtaining the equipment code of the equipment to be tested from the test file;
[0025] wherein the storage medium comprises a CF card and a hard disk.
[0026] Further, if the type of the equipment code is a general type, performing data processing on the equipment code to obtain unique identification code data, comprises:
[0027] performing data conversion processing and data cutting processing on the equipment code to obtain first cutting data and second cutting data;
[0028] replacing the first cutting data and the second cutting data at the specified positions of the equipment code respectively to obtain first processing data;
[0029] With the result of the replacement, the type of the device code is changed to uniqueness, obtaining second processing data;
[0030] With the result of the change, the second processing data is written back to the predefined test file, that is, the test code in the predefined test file is replaced with the second processing data, obtaining unique identification code data.
[0031] Further, after the data processing of the device code to obtain the unique identification code data, if the type of the device code is general, the method further comprises:
[0032] The unique identification code data is verified by using a feedback verification algorithm.
[0033] Further, the data conversion processing and the data cutting processing of the device code to obtain the first cutting data and the second cutting data comprise:
[0034] The hardware type of the device code is obtained;
[0035] The hardware type is converted into decimal;
[0036] With the result of the conversion, the corresponding MAC address is matched;
[0037] The MAC address is read, the MAC address within the first preset rule is intercepted, and the intercepted result is converted into a character set of a specified number of bits;
[0038] With the character set of the specified number of bits, the first cutting data and the second cutting data are obtained based on a preset rule.
[0039] Further, if the type of the device code is unique, the device is subjected to standard verification, and if the preset standard verification rule is met, a production optimization result of the device code is obtained;
[0040] The hardware type of the device code is obtained;
[0041] The hardware type is converted into decimal;
[0042] With the result of the conversion, the corresponding MAC address is matched;
[0043] The MAC address is read, the MAC address within the first preset rule is intercepted, and the intercepted result is converted into a character set of a specified number of bits;
[0044] With the character set of the specified number of bits, the first cutting data and the second cutting data are obtained based on a preset rule.
[0045] In a second aspect, the application provides a device code production optimization device, which comprises:
[0046] an acquisition module configured to automatically acquire a device code of a device to be tested;
[0047] a judgment module configured to judge a type of the device code;
[0048] a data processing module configured to, if the type of the device code is a general type, perform data processing on the device code to obtain unique identification code data;
[0049] a verification module configured to, if the type of the device code is unique, perform standard verification on the device,
[0050] if the standard verification rule is met, obtain a production optimization result of the device code;
[0051] otherwise, perform corresponding operation processing based on related information prompted.
[0052] 9. A device code production optimization device, comprising:
[0053] a memory having an executable program stored thereon;
[0054] a processor configured to execute the executable program in the memory to implement the steps of the method of any one of the above summaries.
[0055] 10. A computer readable storage medium, characterized in that the computer readable storage medium stores computer instructions for causing a computer to execute the steps of the method of any one of the above summaries.
[0056] The technical solution provided by the application can have the following beneficial effects:
[0057] The application automatically acquires a device code of a device to be tested, judges a type of the device code, performs data processing on the device code to obtain unique identification code data if the type of the device code is a general type, performs standard verification on the device if the type of the device code is unique, obtains a production optimization result of the device code if the standard verification rule is met, and otherwise performs corresponding operation processing based on related information prompted. The application automatically acquires a device code of a device to be tested, performs data processing and standard verification on the device code, and helps solve the problem that in the prior art, a MAC address of a first interface is acquired by a manual method, a device code of each device needs to be manually produced and then imported, and the imported device code is used in the device, which is low in efficiency, cannot be mass-produced, and is high in unified management and subsequent maintenance cost.
[0058] It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application, as claimed. BRIEF DESCRIPTION OF DRAWINGS
[0059] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and serve to explain the principles of the application, in which, like reference numerals designate corresponding parts throughout the several views.
[0060] Figure 1 is a flow chart of a device code production optimization method according to an embodiment of the application;
[0061] Figure 2 is a schematic diagram of a device code production optimization apparatus according to another embodiment of the application;
[0062] Figure 3 is a device code character group structure diagram according to an embodiment of the application;
[0063] Figure 4 is a device code example structure diagram according to an embodiment of the application;
[0064] Figure 5 is a schematic diagram of a device code production optimization apparatus according to yet another embodiment of the application. DETAILED DESCRIPTION
[0065] The exemplary embodiments will be described in detail herein below with reference to the drawings. The following description is merely exemplary and explanatory in nature and is not intended to limit the application, as claimed. In the description, same numbers refer to same or similar elements throughout several views.
[0066] A gateway device usually needs a unique device code to identify its identity in order to ensure its uniqueness. The device code generally contains the product's hardware information, version information, manufacturer information, etc. Based on the device code, the device server side can analyze the corresponding characteristics of the device code, obtain the device information, and make some pre-settings according to the analysis results, or can accurately trace back to the device according to the device code.
[0067] The MAC address of the interface of the existing gateway device is unique. Generally, the MAC address of the first interface is used as the basis to calculate a unique string, and then a unique device code is calculated based on the string and the product's hardware information, version information, manufacturer information, etc.
[0068] In the prior implementation method, the MAC address of the first interface is obtained by manual mode, the device code is generated based on the MAC address in the production website, and then is imported into the device for use. In this way, the operator is required to have certain network basic knowledge and deep understanding of the product to ensure that the correct MAC address is obtained. Moreover, the efficiency is low, batch production is impossible, and the unified management and subsequent maintenance cost is too high.
[0069] To solve the above problems, the present application provides a device code production optimization method, device, equipment and storage medium. The device code of a to-be-tested device is automatically obtained. The type of the device code is judged. If the type of the device code is general, data processing is performed on the device code to obtain unique identification code data. If the type of the device code is unique, standard checking is performed on the device. If the standard checking rule meets the preset standard checking rule, the production optimization result of the device code is obtained. Otherwise, corresponding operation processing is performed based on the prompt information. The device code of the to-be-tested device is automatically obtained, and data processing and standard checking are performed on the device code. The problems in the prior art that the MAC address of the first interface is obtained by manual mode, the device code of each device is manually produced and then imported, and the imported device code is used in the device, which is low in efficiency, impossible for batch production, and high in unified management and subsequent maintenance cost, are solved. The MAC address of the first physical interface is automatically obtained, the unique device code of the device is obtained by a fixed calculation method, and is saved to the device, which uniquely identifies the device and can also be used for other functions of the device. The production of the unique device code of the device is realized, batch production is also realized, the production mode is simplified, and the efficiency of device production is improved.
[0070] Embodiment one
[0071] Please refer to Figure 1 , Figure 1 is a device code production optimization method flowchart provided by an embodiment of the present application. The method comprises the following steps.
[0072] S1. Automatically obtaining the device code of a to-be-tested device;
[0073] S2. Judging the type of the device code;
[0074] S3. If the type of the device code is general, performing data processing on the device code to obtain unique identification code data;
[0075] S4. If the type of the device code is unique, performing standard checking on the device,
[0076] S5. If the standard checking rule meets the preset standard checking rule, obtaining the production optimization result of the device code;
[0077] S6. Otherwise, corresponding operation processing is performed based on the related information of the prompt.
[0078] In one embodiment, as described in step S1, the automatic acquisition of the device code of the device to be tested includes:
[0079] The gateway-type device is powered on and started;
[0080] When the gateway-type device is started, a predefined test file is acquired from a specified path under a storage medium;
[0081] The device code of the device to be tested is acquired from the test file;
[0082] The storage medium includes a CF card and a hard disk.
[0083] In a specific implementation, the gateway-type device is powered on and started.
[0084] When the device is started, a predefined file is found from a storage medium (generally a CF card, a hard disk, etc.), and the device code of the device is acquired from the file. The device code is composed of a number of characters, such as Figure 3 As shown, the device code includes information bits and check bits, wherein the information bits include manufacturer information, product model, hardware model, production date, etc.
[0085] In one embodiment, as described in step S2, the judgment of the type of the device code includes:
[0086] The characters in the specified position of the device code are read;
[0087] The characters in the specified position are converted into a variable, and judgment is made based on the corresponding explanation of the variable;
[0088] If the acquired variable value is 1, the type of the device code is trial type;
[0089] If the acquired variable value is 2, the type of the device code is unique type;
[0090] If the acquired variable value is 3, the type of the device code is general type.
[0091] In a specific implementation, the 13th bit of the device code identifies the type of the device code (1: trial type; 2: unique type, 3: general type). The 12th character (counting from 0) in the string of characters is acquired, the character is converted into a variable, and the type of the device code of the current device is acquired, as shown in Figure 4 As shown, the identification character is the variable corresponding to the type of the device code, i.e., general type.
[0092] If the type of the device code is general, the device code is processed to obtain unique identification code data, as described in step S3, including:
[0093] The device code is processed by data conversion and data cutting to obtain first cutting data and second cutting data.
[0094] The first cutting data and the second cutting data are replaced in the specified position of the device code to obtain first processing data.
[0095] The type of the device code is changed to unique by the replacement result to obtain second processing data.
[0096] The second processing data is written back to the predefined test file by the change result, that is, the test code in the predefined test file is replaced by the second processing data to obtain unique identification code data.
[0097] Further, if the type of the device code is general, after the device code is processed to obtain unique identification code data, the method further includes:
[0098] The unique identification code data is verified by using a feedback check algorithm.
[0099] Further, the device code is processed by data conversion and data cutting to obtain first cutting data and second cutting data, including:
[0100] The hardware type of the device code is obtained.
[0101] The hardware type is converted to decimal.
[0102] The conversion result is matched to the corresponding MAC address.
[0103] The MAC address is read, the MAC address within the first preset rule is intercepted, and the intercepted result is converted to a character set of a specified number of bits.
[0104] The character set of the specified number of bits is cut based on a preset rule to obtain first cutting data and second cutting data.
[0105] In specific implementation, as Figure 4For example, taking the device code 102OT-BG894-3000D-SN39I-YRPUN as an example, the 12th bit is 3, which indicates that the device code type is general type. The server obtains the hardware type of the device (here, "BG" in base 36) from the 6th and 7th bits of the device code, which is converted to base 10 as 412. Then the MAC address of the first physical port of the 412 type device is found. For example, the MAC address of the first interface of my current device is 00:12:41:a5:12:46.
[0106] Specifically, the MAC address is read, the MAC address in the first preset rule is intercepted, and the intercepted result is converted into a character set of a specified number of bits, including: according to the MAC address of the interface obtained above, the MAC address is intercepted by a specified position, and a string of 8 characters 41E51246 is calculated using the intercepted result.
[0107] Specifically, the first four bits of the cut data and the last four bits of the cut data are then used to replace the data in the 18th-21st and 24th-27th bits of the obtained general device code, respectively, and then the 12th bit identifier is changed to 2 (unique type). Then the modified device code is calculated using a feedback type checking algorithm to obtain a unique device code. For example, the device code in 4 is modified to 102OT-BG894-20009-41E5C-1246F after calculation.
[0108] In specific implementation, the calculated device code is written back to the pre-defined file to replace the original device code in the file.
[0109] In specific implementation, after the entire device code calculation is completed, a unique device code that is bound to the current device and does not change other characteristics is obtained. Then the device is automatically restarted. When the device starts, it will obtain a unique device code from the file.
[0110] In specific implementation, when the device checks that the device code is unique, the interface MAC address is obtained according to steps 4 and 5 and calculated using the same algorithm. The calculated value is compared with the value in the device code. If they are inconsistent, the device is restarted. This can ensure the uniqueness of the device code and ensure that the device cannot use the device code of other devices.
[0111] Through this production method, if a large number of devices are to be produced, the same general device code can be used to mass-produce CF cards. After the CF card is installed on the device, the hardware itself calculates a unique device code when starting. Manual production of device codes for each device is not required. This can save a lot of manual labor costs and avoid errors caused by manual operation.
[0112] In one embodiment, if the type of the device code is unique, as described in steps S3-S6, the device is subjected to standard verification, and if it meets the preset standard verification rule, the production optimization result of the device code is obtained.
[0113] Obtaining the hardware type of the device code;
[0114] Converting the hardware type into decimal;
[0115] Using the converted result to match the corresponding MAC address;
[0116] Reading the MAC address, intercepting the MAC address within the first preset rule, and using the intercepted result to convert into a character set of a specified number of bits;
[0117] Using the character set of the specified number of bits to compare with the specified segment set of the device code, and if they are consistent, the production optimization result of the device code is obtained.
[0118] In specific implementation, when the device checks that the device code is unique, the interface MAC address is obtained by the above steps and calculated by the same algorithm. The calculated value is compared with the numerical value in the device code. If they are inconsistent, the device is restarted. The uniqueness of the device code can be ensured, and it is ensured that the device cannot use the device code of other devices.
[0119] By this production method, if a large number of devices are to be produced, the same general device code can be used to mass-produce CF cards. After the CF card is installed on the device, the unique device code is calculated by the hardware at startup. Manual production of each device code for import is not required. A large amount of manual cost can be saved, and errors caused by manual operation can be avoided.
[0120] Embodiment Two
[0121] Please refer to Figure 2 , Figure 2 is a device code production optimization device provided by another embodiment of the present application, which comprises:
[0122] The obtaining module 101 is configured to automatically obtain the device code of the device to be tested.
[0123] The judging module 102 is configured to judge the type of the device code.
[0124] The data processing module 103 is configured to, if the type of the device code is general, perform data processing on the device code to obtain unique identification code data.
[0125] The verification module 104 is configured to, if the type of the device code is unique, perform standard verification on the device.
[0126] If the preset standard verification rule is met, a production optimization result of the device code is obtained.
[0127] Otherwise, corresponding operation processing is performed based on the prompted related information.
[0128] Embodiment three
[0129] Please refer to Figure 5 , Figure 5 is a device code production optimization device composition schematic diagram provided by another embodiment of the present application, and the device comprises:
[0130] The memory 31 has an executable program stored thereon;
[0131] The processor 32 is configured to execute the executable program in the memory 31 to implement the steps of the method in any one of the above embodiments.
[0132] In addition, the present application provides a computer readable storage medium, which stores computer instructions for making a computer execute the steps of the method in any one of the above embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD), etc. The storage medium can also include a combination of the above types of memories.
[0133] It can be understood that the same or similar parts in the above embodiments can be mutually referred to, and the content not described in detail in some embodiments can refer to the same or similar content in other embodiments.
[0134] It should be noted that, in the description of the present application, the terms "first", "second", etc. are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise specified, the meaning of "a plurality of" is at least two.
[0135] Any procedural or methodological descriptions in flow charts or otherwise described herein can be understood to represent modules, segments, or portions of code that include executable instructions for performing specific logical functions or steps in the processes, and the scope of preferred embodiments of the present application includes additional implementations that can not perform the steps or functions in the order shown or discussed within the scope of the appended claims.
[0136] It should be understood that portions of the present application can be realized with hardware, software, firmware or a combination thereof. In the above embodiments, a number of steps or methods can be realized as software or firmware to be executed by a suitable instruction-executing device as stored in a storage medium. For example, if realized with hardware, and as in another embodiment, any one or a combination of the following technologies known in the art can be used: discrete logic circuitry having logic gates for implementing logic functions on data signals, application specific integrated circuits having appropriate combinational logic gates, programmable gate arrays (PGA), field programmable gate arrays (FPGA), etc.
[0137] Those skilled in the art can understand that all or part of the steps carried out by the above-mentioned embodiments can be completed by programs instructing relevant hardware, and the programs can be stored in a computer readable storage medium, and when executed, include one or a combination of steps of the method embodiments.
[0138] In addition, each functional unit in each embodiment of the present application can be integrated in one processing module, or each unit can be physically present separately, or two or more units can be integrated in one module. The above-mentioned integrated module can be realized in the form of hardware or in the form of a software functional module. When the integrated module is realized in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer readable storage medium.
[0139] The storage medium mentioned above can be a read-only memory, a magnetic disk or an optical disk, etc.
[0140] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example", or "some examples" and the like means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0141] Although the embodiments of the present application have been shown and described above, it is understood that the above-described embodiments are exemplary and are not to be construed as limiting the present application, and that those skilled in the art can make changes, modifications, substitutions and variations to the above-described embodiments within the scope of the present application.
Claims
1. A method for optimizing the production of equipment codes, characterized in that, The method includes: Automatically obtain the device code of the device under test; Determine the type of the device code; If the device code is of a general type, then the device code is processed to obtain a unique identifier code. If the device code type is unique, then the device is subjected to standard verification. If the preset standard verification rules are met, the production optimization result of the device code is obtained; Otherwise, perform the corresponding operation based on the information provided in the prompt; If the device code is of a general type, then the device code is processed to obtain unique identifier data, including: The device code is subjected to data conversion and data segmentation processing to obtain first segmented data and second segmented data; The first cutting data and the second cutting data are respectively replaced at the specified positions of the device code to obtain the first processed data; Using the result of the replacement, the type of the device code is changed to be unique, and second processed data is obtained; Using the result of the change, the second processed data is written back to the predefined test file, that is, the test code in the predefined test file is replaced with the second processed data to obtain the unique identifier data; The process of performing data conversion and data segmentation on the device code to obtain first segmented data and second segmented data includes: Obtain the hardware type of the device code; Convert the hardware type to decimal; Using the result of the conversion, the corresponding MAC address is matched; Read the MAC address, extract the MAC address within the first preset rule, and use the extracted result to convert it into a character set of a specified length; Using the specified number of characters, the data is cut according to a preset rule to obtain the first cut data and the second cut data; If the device code type is unique, then the device is subjected to standard verification. If it meets the preset standard verification rules, the production optimization result of the device code is obtained. Obtain the hardware type of the device code; Convert the hardware type to decimal; Using the result of the conversion, the corresponding MAC address is matched; Read the MAC address, extract the MAC address within the first preset rule, and use the extracted result to convert it into a character set of a specified length; The specified character set of a specified number of digits is compared with the specified fragment set of the device code. If they match, the production optimization result of the device code is obtained.
2. The method according to claim 1, characterized in that, The determination of the type of the device code includes: Read the character at a specified position in the device code; Convert the character at the specified position into a variable, and make a judgment based on the description corresponding to the variable; If the obtained variable value is 1, then the device code is of trial type; If the obtained variable value is 2, then the device code is of a unique type; If the obtained variable value is 3, then the device code type is general.
3. The method according to claim 1, characterized in that, The automatic acquisition of the device code of the device under test includes: Gateway devices start upon power-on; When the gateway device starts up, it retrieves a predefined test file from a specified path under the storage medium; Obtain the device code of the device under test from the test file; The storage media include: CF cards and hard disks.
4. The method according to claim 1, characterized in that, If the device code is of a general type, then after processing the device code to obtain unique identifier data, the process further includes: The unique identifier data is verified using a feedback verification algorithm.
5. A device for optimizing the production of equipment codes, applied to the method for optimizing the production of equipment codes according to any one of claims 1-4, characterized in that, The device includes: The acquisition module is used to automatically acquire the device code of the device under test. The determination module is used to determine the type of the device code; The data processing module is used to process the device code to obtain unique identifier data if the device code is of a general type. The verification module is used to perform standard verification on the device if the device code type is unique. If the preset standard verification rules are met, the production optimization result of the device code is obtained; Otherwise, perform the corresponding operation based on the information provided in the prompt.
6. A production optimization device for equipment codes, characterized in that, include: Memory, on which executable programs are stored; A processor for executing the executable program in the memory to implement the steps of the method according to any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the steps of the method according to any one of claims 1-4.
Citation Information
Patent Citations
Information processing method and device
CN110321738A
Method and system for generating unique equipment identification code and electronic equipment
CN112995355A