Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments.
In practical application, because an internal algorithm and a related control strategy of the electricity meter are relatively complex, register parameters required to be configured in the electricity meter are quite large, the types of the parameters are also relatively large, and various factors of a specific scene of the electricity meter are combined, so that a verification object for verifying the data of the electricity meter has the characteristic of discontinuous distribution.
Taking the configuration data in the electricity meter as an example, the configuration data in the electricity meter includes calibration data, battery life cycle logging data, algorithm configuration data, security policy configuration data, anomaly logging data, and the like. These data have a wide variety of categories, and their data address distribution is also discontinuous. In addition, in addition to the discontinuous distribution of data verification objects caused by the discontinuous distribution of data addresses, even for some continuously distributed data, due to different battery types applied by the fuel gauge, objects for data verification correspondingly differ, and specifically, some calibration data and record data may exist in the data during data verification, which do not need to be compared. Therefore, based on the above various scenario factors, in the electricity meter data verification scenario, the data address of the verification object, that is, the data to be verified, is usually not continuous.
However, many existing data verification methods are only suitable for whole pieces of data with continuously distributed data addresses, and if a conventional data verification method is adopted, only the whole pieces of data can be verified, and then verification results of partial data needing to be verified are obtained. It will be appreciated that this results in a significant amount of unnecessary processing and resource consumption. Therefore, the conventional data verification scheme cannot be well suitable for the data verification scene of the electricity meter.
In view of the above requirement, fig. 1 is a schematic flow chart of a data verification method according to an embodiment of the present application; referring to fig. 1, the present embodiment provides a data verification method for quickly and accurately verifying electricity meter data. Specifically, the data verification method includes:
101. determining a block to be checked, wherein the block to be checked comprises a plurality of data addresses of data, and the data addresses of the data are continuous;
102, processing according to the verification rule according to the first verification file of the block to be verified so as to complete verification.
The first check file refers to a check file of a block to be checked. In this embodiment, the check file of the block to be checked includes a first character string, bytes of the first character string correspond to data addresses of the block to be checked one by one, the content of a first byte in the first character string is preset standard information, and the data address corresponding to the first byte is a data address of first data that does not need to be checked in the plurality of data. Specifically, the verification rule includes: for each byte of the first character string, if the content of the byte is the standard information, the byte is skipped, otherwise, the data of the data address corresponding to the byte (the data corresponding to the byte mentioned in the later-mentioned embodiment is the data of the data address corresponding to the byte) is checked.
In practical applications, the main body of the data verification method may be a data verification device. In practical applications, the data verification apparatus may be implemented by software codes or software applications, or may be implemented by a medium storing related executable codes, such as a usb disk, an optical disk, and the like; alternatively, the data checking device may be implemented by a physical device, such as a chip, a smart phone, a computer, or the like, into which the relevant executable code is integrated or installed.
Examples are made in connection with actual scenarios: in practical applications, there may be various scenarios involving electricity meter data verification. For example, in the usage scenario of the drone, it is necessary to monitor whether the battery fuel gauge parameters are accurate at any time, so as to use the parameters as reference data for considering whether the battery of the drone can be safely used. For another example, in a production scenario of the electricity meter, it is necessary to check whether the electricity meter parameters can be written correctly through electricity meter data verification.
By combining the scheme, when the data of the electricity meter needs to be checked, each block can be divided in advance, so that which parameters, namely data, need to be checked at present can be determined, the block to be checked where the data address is located is determined according to the data needing to be checked, or the data needing to be checked can be not considered at first, the block to be checked is determined at first, and then the data address of the data needing to be checked is determined from the block to be checked. For example, the to-be-verified block may include data addresses 0x44C0 to 0x44CF, for example, the size of the to-be-verified block is 16 data addresses, in practical applications, the size of the to-be-verified block may be determined according to practical situations, and is not limited herein. In addition, the obtaining manner of the block to be verified is not limited, for example, a continuous data address may be selected from all data addresses to randomly obtain the block to be verified, all data addresses may also be uniformly divided according to a preset division policy to obtain a plurality of blocks to be verified, or all the entire data addresses may also be regarded as the block to be verified here.
And after the block to be checked is determined, obtaining a check file of the block to be checked. Optionally, there are various ways to obtain the check file of the block to be checked, for example, the check file of the block to be checked may be generated in advance, or may also be generated in real time after the module to be checked is determined. When a verification object (namely, data to be verified) of the electricity meter data verification is relatively fixed, a verification file of a block to be verified can be generated in advance, and byte content of a character string in the verification file of the block to be verified is set. When the check object of the electricity meter data check needs to be updated frequently, only the check file of the block to be checked can be generated in advance, but the byte content in the check file is not set. It can be understood that the number of bytes of the character string in the check file of a certain block to be checked depends on (for example, is not smaller than) the size of the block to be checked, so that the check file including the character string can be generated without setting the byte content of the check file, and when data check needs to be performed on the block to be checked, the byte content of the character string in the check file of the block to be checked is set according to the object of the data check. In addition, after the block to be checked is determined, a check file of the block to be checked is generated in real time, and byte content of the character string in the check file is set.
In the scheme, the byte content of the character string in the check file of the block to be checked is set, so that the content of the first byte of the character string in the check file of the block to be checked is standard information. The standard information is used for representing that verification is not needed, that is, in the data verification, data of the data address corresponding to the byte of the standard information, the content of which is not the standard information, is not needed to be verified, so that the byte can be skipped directly, and on the contrary, data of the data address corresponding to the byte of the standard information, the content of which is not the standard information, is needed to be verified. In practical applications, the standard information may be information outside a data range that can be set by the data verification object, that is, the standard information can be distinguished from data to be verified, for example, if the data types of the configuration parameters of the electricity meter are all numerical values, the standard information may be set as a symbol "+".
After the block to be checked is determined and the check file of the block to be checked is obtained, data check can be performed according to the check rule. Specifically, for each byte of a character string in a check file of a block to be checked, whether the content of the byte is standard information is detected, if so, it indicates that the data corresponding to the byte does not need to be checked, and correspondingly, the byte can be skipped directly, otherwise, it indicates that the data corresponding to the byte needs to be checked, and correspondingly, the data corresponding to the byte is checked. Based on the scheme of the application, the corresponding relation between the bytes of the character strings in the verification file and the data addresses of the data is established, the data verification of the electricity meter can be realized in a flexible, controllable and concise mode, and the byte content of the character strings in the verification file is set, so that the data to be verified can be accurately and exhaustively verified.
Optionally, there may be multiple methods for checking the data corresponding to the byte. As an example, the verification may be performed by performing a data alignment. Specifically, on the basis of any embodiment, the content of a second byte in the first character string is a standard value of second data to be verified in the plurality of data, and the data address corresponding to the second byte is a data address of the second data; correspondingly, the verifying the data of the data address corresponding to the byte in the verification rule includes:
comparing the content of the byte with an actual value, wherein the actual value is a data value stored in a data address corresponding to the byte in data read out from the electricity meter;
if the comparison is consistent, the check of the bytes is passed, otherwise, the data address corresponding to the bytes is recorded as an abnormal address.
The description is made by combining the actual scene: the process of checking according to the check file of the block to be checked generally includes detecting whether the content of each byte of the character string in the check file is standard information, if so, directly skipping the byte without processing, otherwise, checking the data corresponding to the byte.
The specific checking method comprises the following steps: when setting the content for each byte of the character string, the byte content corresponding to the data address of the data to be verified is set as the standard value of the data. In this embodiment, the content of a byte refers to data information of the byte itself, and for example, it is assumed that a hexadecimal character string is "00 FC29 × 00", and it is known that the character string has 5 bytes, and the content of these 5 bytes is "00", "FC", "29", "×", "00" in this order. In practical applications, when data verification is required to be performed on a certain electricity meter parameter, a standard value required to be configured to the parameter may be set as the content of the byte corresponding to the parameter, and in combination with the foregoing example, it is assumed that the data address of the first parameter corresponds to the first byte of the character string, and the value of the first parameter required to be configured is 00, and if the data required to be currently verified includes the first parameter, the content of the first byte of the character string may be set as 00.
After the byte content in the check file of the block to be checked is set, aiming at the byte (namely the byte corresponding to the data address of the data to be checked) the content of which is not the standard information, comparing the content of the byte with the corresponding data in the read actual data, and judging whether the data corresponding to the byte is abnormal or not according to the comparison result. Specifically, the data comparison refers to comparing a standard value to be allocated to a certain data with an actual value of the data. Wherein an actual value of a certain data can be obtained from the actually read electricity meter data, and a standard value of the data is based on the content of the byte corresponding to the data address of the data which has been set by the previous scheme. It can be understood that if the standard value is consistent with the actual value, the data configuration or writing is successful, the data check is passed, and if the comparison is inconsistent, the data configuration or writing is abnormal. Optionally, the data exception may be prompted, and an exception data address may be returned, so that the user may perform data configuration repair and troubleshooting.
According to the embodiment, when the electricity meter data is verified, the standard value which needs to be configured to the data needing to be verified is set as the content of the byte corresponding to the data, and subsequently, when verification is performed based on the verification file, the content of the byte is compared with the actual value of the corresponding data aiming at the byte corresponding to the data needing to be verified, so that the data needing to be verified can be conveniently and quickly verified. Because the comparison data can be directly obtained based on byte content, the efficiency of data verification can be further improved.
Optionally, in order to further improve the efficiency of data verification, the verification rule may be set to perform processing in order according to the byte order. Specifically, on the basis of any embodiment, the skipping, if the content of the byte is the standard information, of each byte of the first character string, and otherwise, checking the data of the data address corresponding to the byte includes:
taking the first byte in the first character string as a current byte to be processed;
detecting whether the content of the bytes to be processed is the standard information;
when the content of the byte to be processed is the standard information, updating the next byte of the byte to be processed to be the current byte to be processed, and executing the step of detecting whether the content of the byte to be processed is the standard information again until all bytes are detected;
when the content of the byte to be processed is not the standard information, checking the data of the data address corresponding to the byte to be processed, updating the next byte of the byte to be processed to the current byte to be processed, and executing the step of detecting whether the content of the byte to be processed is the standard information again until all bytes are detected.
Specifically, in this embodiment, according to the byte sequence of the character string, the first byte in the character string is processed first, that is, whether the content of the first byte is standard information is detected, if the content of the first byte is standard information, the next byte is directly skipped to be processed, otherwise, the next byte is processed after data corresponding to the first byte is checked, and the process is repeated until all bytes of the character string are processed.
According to the embodiment, each byte of the character string is traversed according to the byte sequence of the character string according to the character string in the check file of the block to be checked, the corresponding processing mode is adopted according to the byte content of the character string, and the electricity meter data check can be automatically and quickly completed without applying a redundant scheduling scheme.
In the data verification method provided by this embodiment, when the electricity meter parameter needs to be verified, a block to be verified with continuously distributed data addresses is used as a processing object, a verification file is generated in advance for the block to be verified, bytes of a character string in the verification file correspond to data addresses of the block to be verified one to one, byte contents of the character string are set according to the data to be verified in the block to be verified, byte contents corresponding to the data addresses of the data to be verified are set as predetermined standard information for the data not to be verified in the block to be verified, the character string in the verification file is traversed subsequently, bytes with standard information when the content is met are skipped directly, and bytes with standard information when the content is not met are verified. According to the scheme, the corresponding relation between the bytes and the data addresses of the data is established, whether the corresponding data needs to be checked or not is marked by setting the content of the bytes, and the data which does not need to be checked can be quickly skipped by browsing the bytes of the character strings subsequently, so that the method is well suitable for the scene of the data check of the electricity meter, and the data check of the electricity meter can be quickly and accurately completed.
In practical applications, the data volume of the fuel gauge is generally large, and therefore, the efficiency of checking the fuel gauge data is further improved. Fig. 2A is a schematic flowchart of a data verification method according to a second embodiment of the present application; referring to fig. 2A, in the present embodiment, a data verification method is provided, which is used for further improving the efficiency of data verification on the basis of quickly and accurately implementing the data verification of the electricity meter. Specifically, on the basis of the first embodiment, before 101, the method may further include:
201. dividing data addresses of all data to obtain blocks, wherein each block comprises a plurality of continuous data addresses;
correspondingly, 101 may specifically include:
1011. and determining the first block where the third data to be verified is located as the block to be verified.
Examples are made in connection with actual scenarios: in the present embodiment, the data addresses of all the data of the electricity meter are divided into a plurality of blocks. The strategy of block division can be determined according to actual conditions. Optionally, the data may be divided according to a distribution rule of data that may need to be checked and a frequency of data checking, for example, for some data that is distributed centrally and often needs to be checked, block division may be performed according to a smaller granularity, so that an amount of data that does not need to be checked in a block to be checked is reduced, and checking efficiency is further improved. Preferably, in combination with a special scene of the electricity meter data, considering the characteristics that the data distribution is discontinuous and a data verification object is uncertain, in order to ensure the accuracy of the data verification, average division can be performed according to a preset granularity to obtain a plurality of equal-sized blocks. Where granularity refers to the size of a single block, i.e., the number of data addresses it contains.
With reference to this embodiment, when the electricity meter data needs to be verified, the blocks where the data that needs to be verified (i.e., the third data in the embodiment) is located are determined, and these blocks are used as the blocks to be verified to perform data verification in combination with the data verification method. Specifically, the third data may be determined as needed, after the block to be verified is determined according to the third data, the data address in each block to be verified may be divided into two types according to the previously determined third data, one type is the data address that needs to be verified in the block to be verified, the data of the data address is the second data in the embodiment, and the other type is the data address that does not need to be verified in the block to be verified, and the data of the data address is the first data in the embodiment. Correspondingly, the bytes of the character string in the check file of each block to be checked can be divided into two types: one is a byte corresponding to the data address of the second data, i.e., the second byte in the embodiment, and the content of the second byte is not standard information but a standard value of the data corresponding to the second byte, and the other is a byte corresponding to the data address of the first data, i.e., the first byte in the embodiment, and the content of the first byte is preset standard information. It can be understood that, in the embodiment, the blocks are divided in advance, and when data verification is required, the block to be verified is determined according to the block where the data required to be verified is located, that is, if there is no data required to be verified in a certain block, the block does not need to be processed, so that the amount of processed data is reduced, and the efficiency of verifying the data of the fuel gauge is improved.
In addition, in this embodiment, the check file of each block may also be generated in advance, and when data check is subsequently required, the check file of the block to be checked is found from the check file of each block, or the check file of the block to be checked may also be generated in real time after the block to be checked is determined. Correspondingly, as shown in fig. 2B, in an implementation manner, on the basis of any implementation manner in the second embodiment, the data verification method in the present application may further include:
202. and generating the check file of each block, wherein the check file of each block comprises the first data address and the character string of the block, and the bytes of the character string in the check file of each block are sequentially in one-to-one correspondence with the data addresses of the blocks.
Specifically, in the present embodiment, the data address area of the fuel gauge data is divided into a plurality of blocks, and accordingly, the plurality of blocks correspond to respective check files. In order to indicate the corresponding relationship between the blocks and the check file, in this embodiment, the check file of each block includes the first data address and the character string of the block, the start data address of the block corresponding to the check file can be determined according to the data address in the check file, and the size of the corresponding block can be determined according to the number of bytes of the character string, so as to determine the block corresponding to the check file. In addition, in the embodiment, there is a sequential one-to-one correspondence relationship between the bytes of the character string in the check file and the data addresses of the blocks corresponding to the check file, specifically, the bit number of a certain byte in the character string is the same as the bit number of the data address corresponding to the byte in the block. For example, assuming that the block a includes 5 consecutive data addresses "0 x44C0 to 0x44C 4", the check file of the block a includes a first data address "0 x44C 0" (where 0x is used to indicate that the data address is in hexadecimal form, in practical applications, only an actual data address, "44C 0" may be recorded in the check file), and a character string including 5 bytes, based on the sequential one-to-one correspondence relationship between bytes and data addresses, a first byte of the character string corresponds to the data address "0 x44C 0", a second byte corresponds to the data address "0 x44C 1", a third byte corresponds to the data address "0 x44C 2", and so on, a last byte of the character string corresponds to a last data address "0 x44C 4" of the block a.
In order to implement data verification, on the basis of the embodiment shown in fig. 2B, it is further required to set byte contents of a character string in a verification file of a block to be verified, and accordingly, the data verification method further includes:
203. and setting the byte content of the character string in the check file of the first block according to the data address of the third data and the standard value of the third data and a set rule.
Wherein the setting rule comprises: and setting the content of the byte corresponding to the data address of the third data as a standard value of the third data, and setting the content of other bytes as the standard information.
Still referring to the foregoing example, it is assumed that data corresponding to data addresses other than the data address "0 x44C 3" in the block a needs to be verified currently, and the standard values allocated to the data addresses to be verified are "00", "FC", "29", and "00" sequentially. Accordingly, according to this embodiment, after setting the byte content of the character string in the check file of the block a, the character string is "00 FC29 × 00".
According to the embodiment, based on the setting rule, the byte content of the character string is set based on the one-to-one sequential correspondence relationship between the bytes of the character string and the data addresses of the corresponding blocks in the check file, so that the correspondence between the bytes and the data addresses is naturally established, the correspondence relationship between the bytes and the data addresses does not need to be specially maintained, and when data check is subsequently performed, the data check on the data to be checked in the corresponding blocks can be completed according to the sequence of the data addresses only by sequentially traversing the bytes of the character string, so that the convenience of the data check is improved.
In practical applications, since the data to be verified may be distributed and dispersed, there may be a plurality of blocks in which the data is located. For the situation that the block where the data to be checked is located has a plurality of blocks, the data check of each block can be realized through a plurality of processing scheduling schemes.
As an implementable manner, on the basis of any one of the second embodiment, the number of the first blocks is plural; correspondingly, 101 may specifically include:
determining any first block as a current block to be checked;
correspondingly, after 102, the method further comprises:
and determining any unprocessed block in the first blocks as a current block to be checked, and executing 102 again until all blocks where the third data are located are processed.
As another practical implementation manner, on the basis of any one of the second embodiment, the number of the first blocks is multiple; correspondingly, 101 may specifically include:
according to the address sequence of the data addresses, taking the most front block in the first blocks as the current block to be checked;
correspondingly, after 102, the method further comprises:
and according to the address sequence of the data addresses, determining the next block after the block to be checked in the first block as the current block to be checked, and executing 102 again until all blocks where the third data are located are processed.
Specifically, the first embodiment processes a plurality of blocks where data to be verified are located in a random processing manner, and the second embodiment processes a plurality of blocks where data to be verified are located in sequence according to the sequence of block positions. Through the two implementation modes, the data needing to be verified can be processed, so that the completeness of data verification is guaranteed.
According to the data verification method provided by the embodiment, the data address of the electricity meter data is divided into a plurality of blocks in advance, and data verification is performed according to the block where the data address of the data to be verified is located, so that the data processing amount can be effectively reduced, the efficiency of the electricity meter data verification is improved, and resources consumed by the data verification are reduced.
For better understanding of the solution of the present application, a fuel gauge chip of model number BQ40Z50-R1 is exemplified. As shown in table 1, objects for data verification of the fuel gauge have a discontinuous distribution characteristic, and specifically, a shaded portion in the table is a parameter to be subjected to data verification.
TABLE 1
As shown in table 2, the parameters to be checked in the continuously distributed data addresses may be only a partial area in the continuously distributed data addresses, such as a shaded area in the table.
TABLE 2
The Class is a data Type, the Subclass is a data sub-Type, the Address is a data Address, the Type is a data Type, the Name is a parameter Name of the data, the Min and the Max are respectively a minimum value and a maximum value of a data range, the data value configured by the Default, and the Uint is a data unit.
With reference to table 1 and table 2, based on the scheme provided in this application, the data address of the electricity meter may be divided into several equal-sized blocks, for example, the size of each block may be defined as 32 data addresses, and accordingly, a check file with a string having a byte number of 32 bytes is generated for each block, as shown below:
44C0=0000FC2900********00********************************************
47A0=************000032**********************************************
47C0=**************1C0520**0000**************************************
as shown above, an exemplary diagram of the character strings in the check file of each block is shown. The byte number of the character string in the check file of each block is 32 bytes, the head end is the first data address of the block, in this example, the data address is represented in hexadecimal (for example, 44C0 represents 0x44C0), the 32 bytes after the equal sign sequentially correspond to the data address from the head data address of the block to the last data address of the block one by one, after the content of the bytes is set by combining the scheme, the character string shows the part needing data check with the standard value, and the part needing no check is shown with the symbol of "+". Alternatively, each byte may be represented hexadecimally as well.
And then according to the data to be verified, by setting byte content of the character string in the verification file, shielding the data not needing to be verified in the data verification process, and quickly and conveniently completing the data verification.
In addition, fig. 3 is a schematic flow chart of a data verification method provided in the third embodiment of the present application, and in an example, the data verification method provided in the present application may include the following flows:
401. entering a data verification state (e.g., detecting a user initiated data verification request);
402. reading configuration data of the fuel gauge;
403. determining a first block to be checked;
404. taking the first byte in the check file of the block to be checked as a byte to be processed;
405, detecting whether the content of the byte to be processed is "+", if so, executing 406, otherwise, executing 408;
406. detecting whether all the bytes are traversed or not, if so, executing 411, otherwise, executing 407;
407. taking the next byte as a byte to be processed, and returning to execute 405;
408. comparing the content of the byte to be processed with the actual value of the corresponding data address, and executing 409;
409. detecting whether the comparison results are consistent, if so, executing 406, otherwise, executing 410;
410. returning the data address and the corresponding standard value and actual value;
411. detecting whether all the blocks to be checked are processed, if so, executing 412, otherwise, executing 413;
412. finishing data verification;
413. for the next to-be-verified block, return toexecution 404.
In the above process, the block to be verified is determined in advance according to the data address of the data to be verified, then the byte content corresponding to the data address of the data to be verified is set in the verification file of the block to be verified, and the byte content corresponding to the data address of the data not to be verified is filled with the standard information. And the blocks which do not relate to data verification do not need to be processed by referring to the verification files thereof, so that the data verification efficiency can be improved.
The scheme of the application fully considers the characteristics of the electricity meter, utilizes a more convenient and reliable mode to achieve the purpose of detecting whether the parameter configuration of the electricity meter is normal or not, reduces the complexity of data verification and improves the efficiency of the data verification. The invention can be used for accurately and seamlessly verifying the data to be verified.
Fig. 4 is a schematic structural diagram of a data verification apparatus according to a fourth embodiment of the present application; referring to fig. 4, the data verification apparatus includes:
aninitial module 51, configured to determine a block to be verified, where the block to be verified includes data addresses of a plurality of data, and the data addresses of the plurality of data are consecutive;
theverification module 52 is configured to process according to a first verification file of a block to be verified and a verification rule to complete verification, where the first verification file includes a first character string, bytes of the first character string correspond to data addresses of the block to be verified one to one, a content of a first byte in the first character string is preset standard information, and a data address corresponding to the first byte is a data address of first data that does not need to be verified in the plurality of data.
Wherein the verification rule comprises: and for each byte of the first character string, if the content of the byte is the standard information, skipping the byte, otherwise, checking the data of the data address corresponding to the byte.
In practical applications, the data verification apparatus may be implemented by software codes or software applications, or may be implemented by a medium storing related executable codes, such as a usb disk, an optical disk, and the like; alternatively, the data checking device may be implemented by a physical device, such as a chip, a smart phone, a computer, or the like, into which the relevant executable code is integrated or installed.
In practical applications, the size of the block to be verified may be determined according to practical situations. In addition, theinitial module 51 determines that the to-be-verified block is not limited, for example, a continuous data address may be selected from all data addresses to randomly obtain the to-be-verified block, all data addresses may be uniformly divided according to a preset division policy to obtain a plurality of to-be-verified blocks, or all the entire data addresses may be regarded as the to-be-verified blocks here.
Optionally, the method for checking the data corresponding to the byte by the checkingmodule 52 may be various. As an example, the verification may be performed by performing a data alignment. Specifically, on the basis of any embodiment, the content of a second byte in the first character string is a standard value of second data to be verified in the plurality of data, and the data address corresponding to the second byte is a data address of the second data; correspondingly, the checkingmodule 52 is specifically configured to compare the content of the byte with an actual value, where the actual value is a data value stored in a data address corresponding to the byte in the data read from the electricity meter; thechecking module 52 is further specifically configured to, if the comparison result is consistent, pass the checking of the byte, and otherwise, record the data address corresponding to the byte as an abnormal address. Optionally, thecheck module 52 may be further configured to prompt for a data exception and return an address of the data exception.
Optionally, in order to further improve the efficiency of data verification, the verification rule may be set to perform processing in order according to the byte order. Specifically, on the basis of any embodiment, theverification module 52 includes:
a starting unit, configured to use a first byte in the first character string as a current byte to be processed;
the detection unit is used for detecting whether the content of the bytes to be processed is the standard information;
the processing unit is used for updating the next byte of the byte to be processed into the current byte to be processed when the content of the byte to be processed is the standard information, and instructing the detection unit to execute the step of detecting whether the content of the byte to be processed is the standard information again until the bytes are detected;
the processing unit is further configured to, when the content of the byte to be processed is not the standard information, check data of a data address corresponding to the byte to be processed, update a next byte of the byte to be processed to a current byte to be processed, and instruct the detection unit to perform the step of detecting whether the content of the byte to be processed is the standard information again until all the bytes are detected.
According to the embodiment, each byte of the character string is traversed according to the byte sequence of the character string according to the character string in the check file of the block to be checked, the corresponding processing mode is adopted according to the byte content of the character string, and the electricity meter data check can be automatically and quickly completed without applying a redundant scheduling scheme.
The data verification device provided by this embodiment establishes a corresponding relationship between bytes and data addresses of data, and marks whether the corresponding data needs to be verified by setting the content of the bytes, and then the data that does not need to be verified can be quickly skipped by browsing the bytes of the character string, so that the data verification device is well applicable to a scene of the data verification of the fuel gauge, and the data verification of the fuel gauge can be quickly and accurately completed.
Fig. 5A is a schematic structural diagram of a data verification apparatus according to a fifth embodiment of the present application; referring to fig. 5A, on the basis of the fourth embodiment, the apparatus further includes:
adividing module 61, configured to divide data addresses of all data to obtain blocks, where each block includes multiple consecutive data addresses;
theinitial module 51 is specifically configured to determine a first block where third data to be verified is located as a block to be verified.
The strategy for dividing the block by the dividingmodule 61 may be determined according to actual situations. Preferably, in order to ensure the accuracy of data verification, the dividingmodule 61 may perform average division according to a preset granularity to obtain a plurality of equal-sized blocks.
As shown in fig. 5B, in any one of the sixth embodiment, the apparatus further includes: a generatingmodule 62, configured to generate the check file of each block, where the check file of each block includes a first data address and a character string of the block, and bytes of the character string in the check file of each block sequentially correspond to the data addresses of the blocks one to one.
In order to implement data verification, on the basis of the embodiment shown in fig. 5B, it is further required to set the byte content of the character string in the verification file of the block to be verified, and accordingly, the data verification apparatus further includes: and asetting module 63, configured to set, according to a set rule, the content of the byte of the character string in the check file of the first block according to the data address of the third data and the standard value of the third data. Wherein the setting rule comprises: and setting the content of the byte corresponding to the data address of the third data as a standard value of the third data, and setting the content of other bytes as the standard information. The implementation mode can improve the convenience of data verification.
As an implementable manner, on the basis of any one of the sixth embodiment, the number of the first blocks is plural; aninitial module 51, specifically configured to determine any first block as a current block to be verified; the device further comprises: the first updating module is configured to determine any unprocessed block in the first block as a current block to be checked after the checking module performs processing according to the checking rule according to the first check file of the block to be checked, and instruct thechecking module 52 to perform the step of performing processing according to the checking rule again according to the first check file of the block to be checked until all blocks where the third data is located are processed.
As another practical implementation manner, on the basis of any one of the sixth embodiment, the number of the first blocks is multiple; aninitial module 51, configured to use the most front block in the first blocks as a current block to be checked according to an address sequence of the data addresses; the device further comprises: and a second updating module, configured to, after the checking module performs processing according to the checking rule and the first checking file of the block to be checked, determine, according to the address sequence of the data address, a next block, located after the block to be checked, in the first block as a current block to be checked, and instruct thechecking module 52 to perform the step of performing processing according to the checking rule and the first checking file of the block to be checked again until all blocks where the third data is located are processed.
Through the two implementation modes, the data needing to be verified can be processed, so that the completeness of data verification is guaranteed.
The data verification device provided by the embodiment can effectively reduce the data processing amount, thereby improving the data verification efficiency of the electricity meter and reducing the resources consumed by data verification.
Fig. 6 is a schematic structural diagram of a data verification apparatus according to a sixth embodiment of the present application, and as shown in fig. 6, thedata verification apparatus 700 includes at least oneprocessor 701, amemory 702, and acommunication interface 703 that are all connected by a bus 704; thememory 702 stores computer-executable instructions; the at least oneprocessor 701 executes computer-executable instructions stored by thememory 702 to cause the data verification apparatus to perform the method of any of the preceding embodiments by interacting with an external server via thecommunication interface 703.
Theprocessors 701 in thedata verification apparatus 700 may include processors of different types, or include processors of the same type; the processor may be any of the following: a Central Processing Unit (CPU), an ARM processor, a Field Programmable Gate Array (FPGA), a special processor, and other devices with computing and Processing capabilities. In an alternative embodiment, at least one of the processors may also be integrated as a many-core processor.
Thememory 702 in thedata verification device 700 described above may be any one or any combination of the following: random Access Memory (RAM), Read Only Memory (ROM), non-volatile Memory (NVM), Solid State Drive (SSD), mechanical hard disk, magnetic disk, and magnetic disk array.
Thecommunication interface 703 is used for data interaction between thedata verification apparatus 700 and other devices. The communication interface may be any one or any combination of the following: a network interface (e.g., an ethernet interface), a wireless network card, etc. having a network access function.
The buses may include an address bus, a data bus, a control bus, etc., which is represented by a thick line for ease of illustration. The bus may be any one or any combination of the following: an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (Extended Industry standard Architecture) bus, and other wired data transmission devices.
The present application also provides a computer-readable storage medium storing a computer program which, when executed, performs the method in the above-described embodiments.
The application also provides a data checking device, which comprises at least one processor and a memory; the memory stores a computer program; the at least one processor executes the computer program stored by the memory to implement the method in the above-described embodiments.
It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working process of the above-described apparatus may refer to the corresponding process in the foregoing method embodiment, and is not described herein again. The embodiments in the present application may be implemented individually or in combination without conflict.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.