CN112748945B - Data storage method and device and electronic equipment - Google Patents
Data storage method and device and electronic equipment Download PDFInfo
- Publication number
- CN112748945B CN112748945B CN201911038424.6A CN201911038424A CN112748945B CN 112748945 B CN112748945 B CN 112748945B CN 201911038424 A CN201911038424 A CN 201911038424A CN 112748945 B CN112748945 B CN 112748945B
- Authority
- CN
- China
- Prior art keywords
- software
- parameter
- storage
- target
- parameters
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 75
- 238000013500 data storage Methods 0.000 title claims abstract description 44
- 238000004891 communication Methods 0.000 claims description 18
- 238000004590 computer program Methods 0.000 claims description 6
- 238000007726 management method Methods 0.000 description 41
- 230000006870 function Effects 0.000 description 19
- 230000008569 process Effects 0.000 description 9
- 238000009434 installation Methods 0.000 description 5
- 230000009471 action Effects 0.000 description 3
- 238000004458 analytical method Methods 0.000 description 3
- 230000008859 change Effects 0.000 description 3
- 238000010586 diagram Methods 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 238000012545 processing Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000000802 evaporation-induced self-assembly Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/71—Version control; Configuration management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0608—Saving storage space on storage systems
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Security & Cryptography (AREA)
- Human Computer Interaction (AREA)
- Stored Programmes (AREA)
Abstract
The embodiment of the invention provides a data storage method and device and electronic equipment. The method comprises the following steps: when the target software is updated, reading a first storage address of each first software parameter from a specified text file in a preset storage area; wherein, the first software parameter is: software parameters included before and after the target software update; reading parameter values of the first software parameters from the storage areas according to the read first storage addresses; storing each first software parameter into a storage area according to the data structure of the software parameters set in the updated target software, and obtaining a second storage address of each first software parameter; and updating the first storage address of each first software parameter in the appointed text file to a corresponding second storage address. Compared with the prior art, the scheme provided by the embodiment of the invention can improve the efficiency of storing and reading the data of each software parameter.
Description
Technical Field
The present invention relates to the field of data storage technologies, and in particular, to a data storage method, a data storage device, and an electronic device.
Background
In the use process of the video camera, various software parameter data, such as exposure value, gain value and other various shooting parameters, often need to be stored in a memory chip (Flash) inside the video camera.
Accordingly, with the continuous upgrading and optimizing of the management software of the camera, the management software adopted in the camera can be continuously updated, so that each stored software parameter data is generally required to meet each different software version, and compatibility of each software parameter data among different software versions is realized.
Based on this, in order to ensure that each stored parameter data can achieve compatibility between different software versions, in consideration of the characteristics that data stored in a text form is easy to parse and easy to be compatible, in the related art, each software parameter data is stored in a Flash in a text form, wherein when each software parameter data is stored in a text form, a text format adopted may be. Xml,. Json, or the like.
However, the storage space occupied by each software parameter data stored in text form is large. In the related art, the data storage and reading efficiency is low because the time consumed for storing and reading each piece of software parameter data is much.
Disclosure of Invention
The embodiment of the invention aims to provide a data storage method, a data storage device and electronic equipment, so as to improve the efficiency of data storage and reading of various software parameters. The specific technical scheme is as follows:
In a first aspect, an embodiment of the present invention provides a data storage method, applied to an electronic device, where the method includes:
When the target software is updated, reading a first storage address of each first software parameter from a specified text file in a preset storage area; wherein the first software parameters are: the method comprises the steps that software parameters are included before and after the target software is updated, the specified text file is used for recording first storage addresses of all the software parameters before the target software is updated, and parameter values in binary forms are recorded in storage spaces indicated by the first storage addresses;
reading parameter values of the first software parameters from the storage area according to the read first storage addresses;
Storing each first software parameter into the storage area according to the updated data structure of the software parameters set in the target software, and obtaining a second storage address of each first software parameter;
and updating the first storage address of each first software parameter in the appointed text file to a corresponding second storage address.
Optionally, in a specific implementation manner, after the step of reading parameter values of the respective first software parameters from the storage area according to the read respective first storage addresses, the method further includes:
determining a parameter value of a second software parameter to be added in the updated target software;
The step of storing the parameter values of the first software parameters in the storage area according to the updated data structure of the software parameters set in the target software, and obtaining the second storage address of each first software parameter includes:
According to the updated data structure of the software parameters set in the target software, storing the parameter values of the first software parameters and the parameter values of the second software parameters into the storage area, and obtaining the second storage address of the first software parameters and the third storage address of the second software parameters;
The method further comprises the steps of:
and correspondingly storing the parameter identification of the second software parameter and a third storage address in the appointed text file.
Optionally, in a specific implementation manner, the step of obtaining the second storage address of each first software parameter includes:
Acquiring a starting storage address of a first software parameter in a data structure of the software parameter before updating the target software;
and determining the parameter address of each first software parameter based on the initial storage address and the maximum length of the parameter value of each first software parameter in the updated data structure of the software parameter set in the target software.
Optionally, in a specific implementation manner, the method further includes:
deleting the first storage address of each third software parameter recorded in the specified text file;
wherein the third software parameters are: the target software before updating comprises software parameters which are not included in the target software after updating.
Optionally, in a specific implementation manner, after the step of updating the first storage address of each first software parameter to the corresponding second storage address in the specified text file, the method further includes:
obtaining a parameter updating instruction, wherein the parameter updating instruction comprises: the parameter value of the appointed parameter to be updated and the target parameter identification;
and updating the parameter value corresponding to the target parameter identifier stored in the storage area into the parameter value of the parameter to be updated.
Optionally, in a specific implementation manner, the specified text file stores an index entry including a parameter identifier and a storage address;
The step of reading the first storage address of each first software parameter from the specified text file in the preset storage area comprises the following steps:
For each first software parameter, searching a target index entry comprising a parameter identifier of the software parameter in the specified text file, and reading a storage address included in the searched target index entry as a first storage address of the software parameter;
The step of updating the first storage address of each first software parameter to the corresponding second storage address in the specified text file includes:
And for each first software parameter, searching the target index entry comprising the parameter identification of the software parameter in the specified text file, and updating the storage address included in the searched target index entry to a corresponding second storage address.
Optionally, in a specific implementation manner, before updating the target software, the method further includes:
when the target software is installed, acquiring parameter values of all software parameters of the target software;
According to the data structure of the software parameters set in the target software, storing the parameter values of the software parameters into the storage area, and obtaining the storage addresses of the software parameters;
and storing the storage addresses of the software parameters of the target software in the specified text file in the storage area.
In a second aspect, an embodiment of the present invention provides a data storage device, applied to an electronic apparatus, where the device includes:
The address reading module is used for reading the first storage address of each first software parameter from a specified text file in a preset storage area when the target software is updated; wherein the first software parameters are: the method comprises the steps that software parameters are included before and after the target software is updated, the specified text file is used for recording first storage addresses of all the software parameters before the target software is updated, and parameter values in binary forms are recorded in storage spaces indicated by the first storage addresses;
The parameter value reading module is used for reading parameter values of all the first software parameters from the storage area according to all the read first storage addresses;
The first parameter value storage module is used for storing each first software parameter into the storage area according to the updated data structure of the software parameters set in the target software and obtaining a second storage address of each first software parameter;
and the address updating module is used for updating the first storage address of each first software parameter in the specified text file into a corresponding second storage address.
Optionally, in a specific implementation manner, the apparatus further includes:
The parameter value determining module is used for determining the updated parameter value of the second software parameter to be added in the target software after the parameter value of each first software parameter is read from the storage area according to each read first storage address;
The first parameter value storage module is specifically configured to store parameter values of each first software parameter and parameter values of the second software parameter into the storage area according to the updated data structure of the software parameter set in the target software, and obtain a second storage address of each first software parameter and a third storage address of the second software parameter;
the apparatus further comprises:
and the address adding module is used for correspondingly storing the parameter identification of the second software parameter and the third storage address in the appointed text file.
Optionally, in a specific implementation manner, the first parameter value storage module includes:
an address obtaining sub-module, configured to obtain a starting storage address of a first software parameter in a data structure of the software parameter before the target software update;
And the address determination submodule is used for determining the parameter address of each first software parameter based on the initial storage address and the maximum length of the parameter value of each first software parameter in the updated data structure of the software parameter set in the target software.
Optionally, in a specific implementation manner, the apparatus further includes:
The address deleting module is used for deleting the first storage address of each third software parameter recorded in the appointed text file;
wherein the third software parameters are: the target software before updating comprises software parameters which are not included in the target software after updating.
Optionally, in a specific implementation manner, the apparatus further includes:
The instruction acquisition module is used for acquiring parameter updating instructions after updating the first storage addresses of the first software parameters into the corresponding second storage addresses in the appointed text file; wherein the parameter updating instruction includes: the parameter value of the appointed parameter to be updated and the target parameter identification;
And the parameter value updating module is used for updating the parameter value corresponding to the target parameter identifier stored in the storage area into the parameter value of the parameter to be updated.
Optionally, in a specific implementation manner, the specified text file stores an index entry including a parameter identifier and a storage address;
The address reading module is specifically configured to, for each first software parameter, search a target index entry including a parameter identifier of the software parameter in the specified text file, and read a storage address included in the searched target index entry as a first storage address of the software parameter;
The address updating module is specifically configured to, for each first software parameter, search the specified text file for the target index entry including the parameter identifier of the software parameter, and update the storage address included in the searched target index entry to a corresponding second storage address.
Optionally, in a specific implementation manner, the apparatus further includes:
The parameter value acquisition module is used for acquiring parameter values of various software parameters of the target software before updating the target software and when the target software is installed;
The second parameter value storage module is used for storing parameter values of all the software parameters into the storage area according to the data structure of the software parameters set in the target software and obtaining storage addresses of all the software parameters;
And the address storage module is used for storing the storage addresses of the software parameters of the target software in the specified text file in the storage area.
In a third aspect, an embodiment of the present invention provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus;
a memory for storing a computer program;
And a processor for implementing any of the steps of the data storage method provided in the first aspect when executing the program stored in the memory.
In a fourth aspect, embodiments of the present invention provide a computer readable storage medium having a computer program stored therein, which when executed by a processor, implements the steps of any of the data storage methods provided in the first aspect above.
In the above, by applying the scheme provided by the embodiment of the invention, the storage addresses of the software parameters in the storage area are stored in the form of text files, and the parameter values of the software parameters are directly stored in the storage area. Therefore, the electronic equipment can read the first storage address of each first software parameter from the text file recorded with the first storage address of each software parameter aiming at different versions of target software because the text file has the characteristics of easy analysis and easy compatibility, and further, the parameter values of each first software parameter are read from the storage area. Because the parameter values of the software parameters of the target software are directly stored in the storage area, compared with the parameter values of the software parameters stored in a text form, the parameter values of the software parameters are directly stored in the storage area, so that the storage space occupied by the parameter values of the software parameters in the storage area can be greatly reduced, the speed of storing and reading the parameter values is improved, and the efficiency of storing and reading the data of the software parameters is improved.
Based on the above, the scheme provided by the embodiment of the invention can combine the advantages of text form storage and direct storage, reduce the occupied storage space and improve the efficiency of storing and reading the data of each software parameter under the condition of ensuring compatibility between different software versions. In addition, when the electronic device is an embedded device, the storage space of the internal Flash of the embedded device is smaller, so that a more remarkable technical effect can be achieved.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flowchart illustrating a first data storage method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a second data storage method according to an embodiment of the present invention;
FIG. 3 is a schematic illustration of storing parameter values for various software parameters in a memory area;
FIG. 4 is a flowchart illustrating a third data storage method according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating a fourth data storage method according to an embodiment of the present invention
FIG. 6 is another schematic illustration of storing parameter values for various software parameters in a memory area;
FIG. 7 is a flowchart illustrating a fifth data storage method according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of a data storage device according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
In order to ensure that the stored parameter data can be compatible between different software versions, in the related art, the stored parameter data of each software is stored in Flash in a text form, considering that the data stored in the text form has the characteristics of easy parsing and easy compatibility. However, in the above-described related art, since the storage space occupied by each software parameter data stored in a text form is large, there is a problem in that the efficiency of storing and reading each software parameter data is low due to the much time consuming for storing and reading each software parameter data. In order to solve the technical problems, the embodiment of the invention provides a data storage method.
Next, a description will be first given of a data storage method provided in an embodiment of the present invention.
Fig. 1 is a flow chart of a data storage method according to an embodiment of the present invention.
The method is applied to any electronic equipment which needs to be subjected to software updating and software parameter compatibility. For example, a camera in a video monitoring system, an industrial camera, etc., and the embodiment of the present invention is not particularly limited.
Further, the method can be particularly applied to a configuration management module in target software of the electronic device. Obviously, when the target software in the electronic device is updated, the configuration management module is updated accordingly.
As shown in fig. 1, a data storage method provided by an embodiment of the present invention may include the following steps:
S103: when the target software is updated, reading a first storage address of each first software parameter from a specified text file in a preset storage area;
wherein, the first software parameter is: the method comprises the steps that software parameters before and after target software updating are included, a text file is designated to record first storage addresses of all the software parameters before the target software updating, and parameter values in binary forms are recorded in storage spaces indicated by the first storage addresses;
s104: reading parameter values of the first software parameters from the storage areas according to the read first storage addresses;
S105: storing each first software parameter into a storage area according to the data structure of the software parameters set in the updated target software, and obtaining a second storage address of each first software parameter;
s106: and updating the first storage address of each first software parameter in the appointed text file to a corresponding second storage address.
In the above, by applying the scheme provided by the embodiment of the invention, the storage addresses of the software parameters in the storage area are stored in the form of text files, and the parameter values of the software parameters are directly stored in the storage area. Therefore, the electronic equipment can read the first storage address of each first software parameter from the text file recorded with the first storage address of each software parameter aiming at different versions of target software because the text file has the characteristics of easy analysis and easy compatibility, and further, the parameter values of each first software parameter are read from the storage area. Because the parameter values of the software parameters of the target software are directly stored in the storage area, compared with the parameter values of the software parameters stored in a text form, the parameter values of the software parameters are directly stored in the storage area, so that the storage space occupied by the parameter values of the software parameters in the storage area can be greatly reduced, the speed of storing and reading the parameter values is improved, and the efficiency of storing and reading the data of the software parameters is improved.
Based on the above, the scheme provided by the embodiment of the invention can combine the advantages of text form storage and direct storage, reduce the occupied storage space and improve the efficiency of storing and reading the data of each software parameter under the condition of ensuring compatibility between different software versions. In addition, when the electronic device is an embedded device, the storage space of the internal Flash of the embedded device is smaller, so that a more remarkable technical effect can be achieved.
Next, each step in the data storage method shown in fig. 1 is described in detail.
It should be noted that, in the embodiment of the present invention, the target software of the electronic device does not refer to a specific target software, but refers to any software installed in the electronic device, where the target software may be management software of the electronic device, for example, management software in an industrial camera, etc., or may be application software installed in the electronic device to provide a certain application function, for example, real-time communication software, etc.
When the target software is management software in the electronic device, the target software can manage all or part of functions provided by the electronic device.
For example, for a camera capable of performing image recognition on a captured image, the functions that the camera can perform include image capture and image recognition, then the camera may include a target software for managing the image capture function and a target software for managing the image recognition function, and the camera may also include a target software for managing the image capture function and the image recognition function, that is, the management of the functions of the camera is performed by one target software. This is reasonable.
Based on the above, when the target software is management software in the electronic device, the software parameters managed by the management configuration module in the target software are the software parameters related to the functions managed by the target software, that is, the software parameters related to the target software.
Also taking a camera capable of image recognition of an acquired image as an example, when a target software for managing an image acquisition function and a target software for managing an image recognition function may be included in the camera, software parameters managed by a management configuration module in the target software for managing the image acquisition function may include software parameters related to image acquisition such as an exposure value, a gain value, etc., and software parameters managed by the management configuration module in the target software for managing the image recognition function may include software parameters related to image recognition such as image characteristics, related parameters of a model for image recognition, etc.
Accordingly, when the camera includes a target software for managing the image capturing function and the image recognition function, that is, when the management of the functions of the camera is implemented by one target software, the software parameters managed by the management configuration module in the target software may include software parameters related to image capturing, such as an exposure value, a gain value, and the like, and software parameters related to image recognition, such as image features, related parameters of a model for image recognition, and the like.
Accordingly, when the target software is application software installed on the electronic device for providing a certain application function, the software parameters managed by the management configuration module in the target software are software parameters related to the application function provided by the target software.
For example, if the target software is the real-time communication software a, the software parameters may be a password and an account number for the user to log in to the real-time communication software a.
It can be appreciated that, before updating the target software, the target software needs to be installed in the electronic device first, and based on this, optionally, in a specific implementation manner, as shown in fig. 2, before updating the target software, a data storage method provided by an embodiment of the present invention further includes the following steps:
S100: when the target software is installed, acquiring parameter values of various software parameters of the target software;
s101: according to the data structure of the software parameters set in the target software, storing the parameter values of the software parameters into a storage area to obtain the storage address of the software parameters;
S102: in the specified text file in the storage area, the storage addresses of the respective software parameters of the target software are stored.
When the installation of the target software is completed, the configuration management module in the target software can acquire the parameter values of the software parameters in the target software from the program code of the target software.
Furthermore, the configuration management module may store parameter values of the respective software parameters into a preset storage area according to a data structure of the software parameters set in the program code of the target software.
The arrangement sequence of the software parameters, the data type and the maximum length of the parameter values of the software parameters are specified in the data structure of the software parameters, so that in order to enable the installed target software to successfully read the parameter values of the software parameters from the storage area according to the data structure in the running process, so as to ensure the normal running of the target software, when the parameter values of the software parameters are stored in the preset storage area, the parameter values of the software parameters are required to be stored into the preset storage area according to the arrangement sequence of the software parameters, the data type and the maximum length of the parameter values of the software parameters, which are specified in the data structure.
For example, the data structure of the software parameters set in the target software is as follows program code 1:
The parameter values of the software parameters a-E in the above-mentioned code stored in the preset memory area are shown in fig. 3.
It should be noted that, as shown in fig. 3, it may be referred to that the parameter values of the software parameters a to E are stored in the storage area in the form of binary files, and that storing the parameter values of the respective software parameters in the form of binary files indicates that the respective parameter values are not stored in the form of binary values, and in this storing process, the respective parameter values may be stored in any of binary, decimal, hexadecimal, or the like.
In addition, the preset storage area is a storage area in hardware for storing data, which is provided in the electronic device itself, and for example, the storage area may be a storage chip Flash installed in the electronic device.
Thus, after the parameter values of the software parameters are stored, the electronic device can obtain the storage addresses of the software parameters in the storage area, and further, the storage addresses of the software parameters of the target software are stored in the specified text file in the storage area.
Wherein the starting address of the stored memory address of the first software parameter may be used as the base address of the memory address of the respective software parameter. Further, when the parameter addresses of the respective software parameters are recorded in the specified text file, the initial storage address of the parameter values of the respective software parameters can be determined by the offset from the base address.
Thus, in the specified text file, the parameter address of each recorded software parameter may be expressed in terms of an offset (offset) and a length (length), where len refers to the maximum length of the parameter value of the software parameter set in the program code of the target software.
For example, for the program code 1 described above, the parameter addresses specifying the respective software parameters recorded in the text file may be as shown in table 1 below:
TABLE 1
Parameter identification | Offset | Len |
A | 0 | 4 |
B | 4 | 4 |
C | 8 | 4 |
D | 12 | 8 |
E | 20 | 4 |
That is, in the electronic device, when the installation of the target software is completed, the parameter values of the respective software parameters in the target software and the storage addresses of the respective software parameters are stored in the preset storage area in binary text form and text form, respectively, instead of being stored together in a single binary text form or text form.
For example, in the industrial camera, when the management software of the industrial camera is installed, the configuration management module in the management software may store the parameter values of the software parameters such as the exposure value and the gain value in the Flash inside the industrial camera in the form of binary text, and further generate a specified text file in which the storage addresses of the software parameters such as the exposure value and the gain value are recorded, and store the specified text file in the Flash inside the industrial camera.
Thus, after the installation of the target software is completed, the function of the target software can be further improved along with the technical development, so that the target software is upgraded; in addition, since in practical applications, the target software with a high version level does not necessarily meet the requirements of practical applications, the installed target software needs to be downgraded. That is, after the installation of the target software is completed, the installed target software may be updated, and the installation manner may include: one of upgrading the target software and downgrading the target software.
After the updating of the target software is completed, in order to ensure that the parameter values of the stored software parameters have compatibility before and after the updating of the target software, so that the updated target software can normally operate, the electronic device needs to store the parameter values of the software parameters in the updated target software according to the data structure of the software parameters set in the updated target software.
Wherein, before and after the updating of the target software, the arrangement sequence of each software parameter in the target software before the updating, and one or more of the data type and the maximum length of the parameter value of each software parameter can be changed. Because the conversion of the same parameter value between different data types is complex, when the data type of the parameter value of a software parameter is changed before and after the updating of the target software, the software parameter can be deleted from the updated program code of the target software, and a new software parameter corresponding to the software parameter can be added. Wherein the physical meaning of the newly added software parameter is the same as the physical meaning of the software parameter, and the two can be characterized by different parameter identifiers.
For example, before the target software is updated, the parameter structure of each software parameter in the target software is shown as the program code 1, and in the updated target software, the data type of the parameter a is changed from int to char, and the maximum length of the data is 8. The parameter structure of each software parameter in the updated target software is as follows in program code 2:
the physical meaning of the software parameter A1 is the same as that of the software parameter A, and the two parameters are characterized by different parameter identifiers.
Correspondingly, the software parameters included in the target software before and after the update are software parameters with unchanged data types of the parameter values before and after the update, and the software parameters with unchanged data types before and after the update can have the same parameter identification in the program codes of the target software before and after the update. When the parameter identification and the storage address of each software parameter are correspondingly recorded in the appointed text file, the parameter identification of the software parameter with unchanged data types before and after updating in the program code of the updated target software is the same as the parameter identification in the appointed text file.
That is, in the program code of the target software before and after the update, the parameter identifiers of the software parameters respectively included may be the same, and the data types representing the parameter values without the software parameters before and after the update are changed; or may be different, a software parameter that characterizes a change in the data type for which there may be a parameter value before and after the update.
Specific: when the program code of the updated target software not only comprises all parameter identifiers in the program code of the target software before updating, but also comprises other parameter identifiers, the updated target software is characterized to be added with new software parameters on the basis of each software parameter of the target software before updating;
When the program code of the updated target software comprises part of parameter identifiers in the program code of the target software before updating and further comprises other parameter identifiers, the data type of the parameter values of one or a plurality of software parameters in the target software before updating can be characterized to be changed in the updated target software; or the updated target software can be characterized in that the software parameters in partial pre-update target software are deleted and new software parameters are added.
Based on this, when the target software update is completed, the updated configuration management module may execute the step S103, and read the first storage addresses of the first software parameters from the specified text file in the preset storage area, that is, read the first storage addresses of the software parameters included before and after the target software update.
The first software parameter is a software parameter included before and after the target software update, specifically, the data type of the parameter value of the first software parameter is unchanged before and after the target software update, and the maximum length of the parameter value of the first software parameter may be changed. That is, the first software parameter is a software parameter whose data type of the parameter value is unchanged before and after the target software update.
Accordingly, when a software parameter changes in the data type of the parameter value before and after the update of the target software, the updated target software will not include the software parameter, but a new software parameter is used to replace the software parameter, and the physical meaning of the software parameter before the update of the target software and the new software parameter after the update are the same. That is, the software parameters whose data types of the parameter values change before and after the update of the target software are not included in the updated target software, and the physical meaning of the software parameters is characterized by another other software parameter that characterizes the same physical meaning as the software parameter.
Obviously, when the parameter identification and the storage address of each software parameter are correspondingly recorded in the specified text file, the first storage address of the first software parameter which is the same as the parameter identification recorded in the specified text file in the program code of the updated target software is read.
Obviously, according to the above description, the specified text file is used for recording the first storage addresses of the respective software parameters before the target software update, and each first storage address indicates a storage space in which a binary-form parameter value of a software parameter is recorded. It is understood that the parameter value stored in each first storage address is the parameter value of each software parameter before the target software is updated.
After the first storage addresses of the first software parameters are read, the configuration management module may further execute the step S104, and reads the parameter values of the first software parameters from the storage area according to the read first storage addresses.
Specifically, for each first software parameter, the configuration management module may first find a storage space indicated by the first storage address of the first software parameter in the storage area, and then may read a binary parameter value recorded in the storage space, so as to read a parameter value of the software parameter.
Based on this, after the parameter values of the respective software parameters are read, the configuration management module may continue to execute the above step S105, store the respective first software parameters into the storage area according to the updated data structure of the software parameters set in the target software, and obtain the second storage address of the respective first software parameters.
The storage address of the first software parameter in the data structure of the software parameter before the update of the target software is read by the management configuration module, and then the starting address of the storage address of the first software parameter is determined.
In this way, when storing the updated parameter values of the first software parameters, the configuration management module may sequentially store the parameter values of the first software parameters in the storage area according to the maximum lengths of the first software parameters specified in the data structure, and obtain the second storage address of each first software parameter, starting from the determined start address according to the arrangement order of the first software specified in the data structure of the software parameters set in the updated target software. Wherein the second memory address may be represented by an offset and len.
Based on this, in an optional implementation manner, the configuration management module obtains the second storage address of each first software parameter may include the following steps:
Step 1: acquiring a starting storage address of a first software parameter in a data structure of the software parameter before updating of the target software;
step 2: and determining the parameter address of each first software parameter based on the initial storage address and the maximum length of the parameter value of each first software parameter in the data structure of the software parameter set in the updated target software.
The initial storage address acquired in step 1 may be determined as the base address. When the parameter values of the first software parameters are read, the arrangement order of the read parameter values can be determined according to the arrangement order of the first software parameters specified in the data structure of the software parameters set in the updated target software, and then, the parameter values are sequentially stored according to the arrangement order from the determined base address, and the length of the storage space occupied by each parameter value is the maximum length of the parameter values of the first software parameters specified in the data structure of the software parameters set in the updated target software.
In this way, when the second storage address is represented by the offset and the len, the offset of the parameter value of the first stored first software parameter is 0, len is the maximum length len1 of the parameter value of the first software parameter, and the offset of the parameter value of the second stored first software parameter is len1, len is the maximum length len2 of the parameter value of the first software parameter; the offset of the stored parameter value of the third first software parameter is len1+len2, len being the maximum length len3 of the parameter value of the first software parameter. By analogy, a second memory address of the parameter value of each of the stored first software parameters may be determined.
In addition, after the parameter value of each software parameter is read, the configuration management module can determine that the parameter value is the current actual parameter value of the software parameter. It should be noted that, for each software parameter, the actual storage space occupied by the parameter value of the software parameter is not the same concept as the storage space indicated by the storage address of the software parameter. Specific:
the actual storage space occupied by the parameter values of the software parameters is as follows: the memory space between the memory location of the first character and the memory location of the last character of the current actual parameter value of the software parameter. The actual memory space occupied by the parameter value of the software parameter is thus the same as the actual length of the current actual parameter value of the software parameter.
Correspondingly, the storage space indicated by the storage address of the software parameter is: the software parameter can occupy the largest memory space, so that the memory space indicated by the memory address of the software parameter has the same size as the maximum length which can be reached by the parameter value of the preset software parameter.
Obviously, when the length of the current actual parameter value of the software parameter is smaller than the maximum length which can be reached by the parameter value of the preset software parameter, the actual storage space occupied by the parameter value of the software parameter is smaller than the storage space indicated by the storage address of the software parameter. In the actual storage application, the storage position, which is not occupied by the current actual parameter value of the software parameter, in the indicated storage space of the storage address of the software parameter can be filled with "0".
For example, the data structure of the software parameters A-E is as shown in program code 1 above, and the memory address of each software parameter recorded in the specified text file may be as shown in Table 1 above.
Accordingly, the actual memory space occupied by the current actual parameter values of the respective software parameters may be as shown in table 2 below:
TABLE 2
Parameter identification | Offset | Len |
A | 0 | 4 |
B | 4 | 4 |
C | 8 | 4 |
D | 12 | 3 |
E | 20 | 4 |
Obviously, in table 2 above, the length of the memory space indicated by the memory address of the software parameter D is 8, and the length of the actual memory space occupied by the parameter value of the software parameter D is 3.
It can be appreciated that, during the use of the electronic device, the parameter values of the respective software parameters may be changed for different use scenarios and different users, and the data lengths of the parameter values of the respective software parameters may be different before and after the change.
In order to avoid confusion in the program operation, the target software may therefore define the maximum value of the data length that can be reached by the parameter values of the respective software parameters during the development process, i.e. limit the range of variation of the data length of the parameter values of the respective software parameters, i.e. define the maximum length of the parameter values of the respective software parameters in the data structure of the software parameters.
Furthermore, when each software parameter in the preset storage area allocates a storage space, in order to meet the storage requirement of the parameter value with the maximum length, the storage space can be allocated according to the maximum value of the data length which can be reached by the parameter value of each preset software parameter.
Thus, after obtaining the second storage address of each first software parameter, the configuration management module may execute the above step S106, and update the first storage address of each first software parameter in the specified text file to the corresponding second storage address.
The above-mentioned process of updating the storage address in step S106 may also be considered as the configuration management module generating the second storage address of each new first software parameter.
The specified text file can record the first storage address of each software parameter before updating the target software in various forms. Furthermore, according to the difference of the modes of recording the first storage addresses in the appointed text file, the configuration management module can read the first storage addresses of the first software with unchanged parameter identifiers from the appointed text file in a plurality of different modes.
Alternatively, in one specific implementation, as shown in table 3, the specified text file stores an index entry including a parameter identifier and a storage address.
TABLE 3 Table 3
Parameter identification | Offset | Len |
A | a1 | a2 |
B | b1 | b2 |
C | c1 | C2 |
Further, in this specific implementation manner, as shown in fig. 4, the step S103 may be to read the first storage address of each first software parameter from the specified text file in the preset storage area, and may include the following steps:
s1031: for each first software parameter, searching a target index entry comprising a parameter identification of the software parameter in a specified text file, and reading a storage address included in the searched target index entry as a first storage address of the software parameter.
In this specific implementation manner, the configuration management module may obtain the parameter identifier of each first software parameter, and further, for each first software parameter, the configuration management module may search, in each index entry included in the specified text file, for a target index entry including the parameter identifier of the software parameter. Obviously, the storage address included in the target index entry is the first storage address of the software parameter, so that the configuration management module can read the storage address included in the searched target index entry and take the storage address as the first storage address of the software parameter.
Accordingly, in this specific implementation manner, the step S106 updates the first storage address of each first software parameter in the specified text file to the corresponding second storage address, and may include the following steps:
S1061: and for each first software parameter, searching a target index entry comprising the parameter identification of the software parameter in the specified text file, and updating the storage address included in the searched second target index entry to a corresponding second storage address.
It will be appreciated that when the first storage address of each first software parameter in the specified text file is not updated, then the index entry included in the specified text file is unchanged. Therefore, in this specific implementation manner, for each first software parameter, the configuration management module may also search for a target index entry including the parameter identifier of the software parameter in each index entry included in the specified text file, so that the storage address included in the searched target index entry may be updated to the corresponding second storage address.
It should be noted that, after the update of the target software is completed, the updated configuration management module may immediately start to execute the data storage method provided in the embodiment of the present invention, so that the updated target software may start to work as soon as possible. Of course, the updated configuration management module may also execute the data storage method provided by the embodiment of the present invention after the target software is updated for a certain period of time. The embodiment of the present invention is not particularly limited in this regard.
It will be appreciated that in the updated target software, new software parameters related to the target software may be added on the basis of the respective software parameters of the target software before the update, and obviously, the new added software parameters also need to be stored in a preset storage area, that is, the new added software parameters may be used as the second software parameters to be added.
In addition, in the updated target software, the new parameter identifier may be used to represent the software parameter whose data type of the parameter value changes before and after the update, and obviously, the new parameter identifier is not included in the program code of the target software before the update and needs to be added, so the new parameter identifier may also be used as the second software parameter to be added. Wherein the parameter value of the second software parameter may be specified by a technician.
Based on this, in an optional implementation manner, as shown in fig. 5, on the basis of the embodiment shown in fig. 1, the data storage method provided in the embodiment of the present invention may further include the following steps:
s107: determining parameter values of second software parameters to be added in the updated target software;
The step S105 may include:
s1051: according to the updated data structure of the software parameters set in the target software, storing the parameter values of the first software parameters and the parameter values of the second software parameters into a storage area, and obtaining the second storage address of the first software parameters and the third storage address of the second software parameters;
wherein the second memory address of each first software parameter and the third memory address of the second software parameter are determined based on the memory address of the first software parameter in the data structure of the software parameter prior to the target software update;
Correspondingly, in this specific implementation manner, the data storage method provided by the embodiment of the present invention may further include the following steps:
s108: and correspondingly storing the parameter identification of the second software parameter and the third storage address in the appointed text file.
In this specific implementation manner, after the parameter values of the first software parameters are read from the storage area according to the read first storage addresses, the configuration management module may further determine the parameter identifier and the parameter value of the second software parameter to be added with the parameters in the updated target software.
The parameter identifier and the parameter value of the second software parameter may be recorded in the program code of the updated target software, or may be recorded in a software configuration file associated with the updated target software.
Furthermore, the configuration management module may store the parameter values of the first software parameters and the parameter values of the second software parameters in the storage area according to the updated data structure of the software parameters set in the target software, and obtain the second storage address of the first software parameters and the third storage address of the second software parameters.
Similar to the above step S105, the arrangement sequence of the first software parameters and the second software parameters, and the data types and the maximum lengths of the first software parameters and the second software parameters are defined in the data structure of the software parameters set in the updated target software, so, in order to ensure that the updated target software can normally operate, the parameter values of the first software parameters and the parameter values of the second software parameters are stored, and also need to be stored according to the data structure of the software parameters set in the updated target software.
The second storage address of each first software parameter and the third storage address of the second software parameter obtained in step S1051 are the same as the manner of obtaining the second storage address of each first software parameter in step S105, and are not described in detail herein.
Thus, after the parameter values of the first software parameters and the parameter values of the second software parameters are completed, the configuration management module can correspondingly store the parameter identification of the second software parameters and the third storage address in the appointed text file. That is, the configuration management module may add new record information in the specified text file, where the record information includes the parameter identification of the second software parameter and the third storage address of the second software parameter.
The configuration management module can correspondingly store the parameter identification and the third storage address of the second software parameter in the appointed text file, and then update the first storage address of each first software parameter in the appointed text file to be the corresponding second storage address; the first storage address of each first software parameter in the appointed text file is updated to be a corresponding second storage address, and then the parameter identification and the third storage address of the second software parameter are correspondingly stored in the appointed text file; and the parameter identification and the third storage address of the second software parameter can be correspondingly stored in the appointed text file at the same time, and the first storage address of each first software parameter in the appointed text file is updated to be the corresponding second storage address. This is reasonable.
For example, if the program code of the target software before the update is as shown in the program code 1 above, the first memory address of the respective software parameters a-E recorded in the specified text file before the update of the target software is as shown in table 1 above, and the parameter values of the respective software parameters a-E stored in binary form are as shown in fig. 3.
The program code for the respective software parameters a-F in the updated target software is shown in program code 3 as follows:
Obviously, after the data storage method shown in fig. 5 is executed, the second storage address of each software parameter a-E and the third storage address of the software parameter F recorded in the specified text file can be obtained, as shown in table 4 below, and the parameter values of each software parameter a-F stored in binary form are shown in fig. 6.
TABLE 4 Table 4
Parameter identification | Offset | Len |
A | 0 | 4 |
B | 4 | 4 |
C | 8 | 4 |
D | 12 | 8 |
F | 20 | 4 |
E | 24 | 4 |
Further, optionally, in a specific implementation manner, when the software parameters included in each software parameter of the target software before updating are not included in each software parameter of the target software after updating, the data storage method provided by the embodiment of the present invention may further include the following steps:
Deleting the first storage address of each third software parameter recorded in the specified text file;
wherein the third software parameters are: the pre-update target software includes software parameters that are not included in the post-update target software.
In addition, it can be understood that, in the use process after the target software updating is completed, the user can modify the parameter values of each software parameter according to the actual application scenario of the electronic device.
Based on this, in an optional implementation manner, as shown in fig. 7, after the step S106 is performed, the data storage method provided in the embodiment of the present invention may further include the following steps:
s109: obtaining a parameter updating instruction, wherein the parameter updating instruction comprises: the parameter value of the appointed parameter to be updated and the target parameter identification;
s110: and updating the parameter value corresponding to the target parameter identifier stored in the storage area into the parameter value of the parameter to be updated.
The configuration management module may detect whether a parameter update instruction is received, where the parameter update instruction may be sent by a user, or may be preset and automatically generated by an electronic device according to a certain period, and the parameter update instruction may include: the parameter value of the designated parameter to be updated and the target parameter identification.
The parameter value of the parameter to be updated and the target parameter identifier may be specified by a user, or may be specified when the electronic device automatically generates the parameter update instruction.
Furthermore, the configuration management module can directly determine the parameter value corresponding to the target parameter identifier from the parameter values of the binary software parameters stored in the preset storage area, and then the configuration management module can update the parameter value corresponding to the target parameter identifier into the acquired parameter value of the parameter to be updated.
When the parameter updating instruction is sent by the user, the user can specify the parameter value of the parameter to be updated and the target parameter identifier to the configuration management module through various modes such as drop-down menu clicking, input in a preset area and the like. The embodiment of the present invention is not particularly limited in this regard.
Further, the configuration management module may execute the above steps S109-S110 when detecting the operation of the user to specify the parameter value of the parameter to be updated and the target parameter identification.
It should be noted that, in the embodiment shown in fig. 5, after the step S108 is performed, the configuration management module may further perform the steps S109-S110.
In addition, for the target software that is installed for the first time and has never been updated, the configuration management module may also modify the parameter values of the respective software parameters of the target software according to the above steps S109-S110, which is reasonable.
Corresponding to the data storage method provided by the embodiment of the invention, the embodiment of the invention also provides a data storage device.
Fig. 8 is a schematic structural diagram of a data storage device according to an embodiment of the present invention. Wherein the data storage device is applied to electronic equipment. As shown in fig. 8, the data storage device may include the following modules:
The address reading module 810 is configured to read, when the target software update is completed, a first storage address of each first software parameter from a specified text file in a preset storage area; wherein the first software parameters are: the method comprises the steps that software parameters are included before and after the target software is updated, the specified text file is used for recording first storage addresses of all the software parameters before the target software is updated, and parameter values in binary forms are recorded in storage spaces indicated by the first storage addresses;
a parameter value reading module 820, configured to read parameter values of the respective first software parameters from the storage area according to the read respective first storage addresses;
A first parameter value storage module 830, configured to store each first software parameter into the storage area according to the updated data structure of the software parameter set in the target software, and obtain a second storage address of each first software parameter;
The address updating module 840 is configured to update the first storage address of each first software parameter in the specified text file to a corresponding second storage address.
In the above, by applying the scheme provided by the embodiment of the invention, the storage addresses of the software parameters in the storage area are stored in the form of text files, and the parameter values of the software parameters are directly stored in the storage area. Therefore, the electronic equipment can read the first storage address of each first software parameter from the text file recorded with the first storage address of each software parameter aiming at different versions of target software because the text file has the characteristics of easy analysis and easy compatibility, and further, the parameter values of each first software parameter are read from the storage area. Because the parameter values of the software parameters of the target software are directly stored in the storage area, compared with the parameter values of the software parameters stored in a text form, the parameter values of the software parameters are directly stored in the storage area, so that the storage space occupied by the parameter values of the software parameters in the storage area can be greatly reduced, the speed of storing and reading the parameter values is improved, and the efficiency of storing and reading the data of the software parameters is improved.
Based on the above, the scheme provided by the embodiment of the invention can combine the advantages of text form storage and direct storage, reduce the occupied storage space and improve the efficiency of storing and reading the data of each software parameter under the condition of ensuring compatibility between different software versions. In addition, when the electronic device is an embedded device, the storage space of the internal Flash of the embedded device is smaller, so that a more remarkable technical effect can be achieved.
Optionally, in a specific implementation manner, the apparatus further includes:
The parameter value determining module is used for determining the updated parameter value of the second software parameter to be added in the target software after the parameter value of each first software parameter is read from the storage area according to each read first storage address;
The first parameter value storage module 830 is specifically configured to store, according to the updated data structure of the software parameters set in the target software, the parameter values of the first software parameters and the parameter values of the second software parameters into the storage area, and obtain a second storage address of the first software parameters and a third storage address of the second software parameters;
the apparatus further comprises:
and the address adding module is used for correspondingly storing the parameter identification of the second software parameter and the third storage address in the appointed text file.
Optionally, in a specific implementation manner, the first parameter value storage module 830 includes:
an address obtaining sub-module, configured to obtain a starting storage address of a first software parameter in a data structure of the software parameter before the target software update;
And the address determination submodule is used for determining the parameter address of each first software parameter based on the initial storage address and the maximum length of the parameter value of each first software parameter in the updated data structure of the software parameter set in the target software.
Optionally, in a specific implementation manner, the apparatus further includes:
The address deleting module is used for deleting the first storage address of each third software parameter recorded in the appointed text file;
wherein the third software parameters are: the target software before updating comprises software parameters which are not included in the target software after updating.
Optionally, in a specific implementation manner, the apparatus further includes:
The instruction acquisition module is used for acquiring parameter updating instructions after updating the first storage addresses of the first software parameters into the corresponding second storage addresses in the appointed text file; wherein the parameter updating instruction includes: the parameter value of the appointed parameter to be updated and the target parameter identification;
And the parameter value updating module is used for updating the parameter value corresponding to the target parameter identifier stored in the storage area into the parameter value of the parameter to be updated.
Optionally, in a specific implementation manner, the specified text file stores an index entry including a parameter identifier and a storage address;
The address reading module 810 is specifically configured to, for each first software parameter, search a target index entry including a parameter identifier of the software parameter in the specified text file, and read a storage address included in the searched target index entry as a first storage address of the software parameter;
The address updating module 840 is specifically configured to, for each first software parameter, search the specified text file for the target index entry including the parameter identifier of the software parameter, and update the storage address included in the searched target index entry to a corresponding second storage address.
Optionally, in a specific implementation manner, the apparatus further includes:
The parameter value acquisition module is used for acquiring parameter values of various software parameters of the target software before updating the target software and when the target software is installed;
The second parameter value storage module is used for storing parameter values of all the software parameters into the storage area according to the data structure of the software parameters set in the target software and obtaining storage addresses of all the software parameters;
And the address storage module is used for storing the storage addresses of the software parameters of the target software in the specified text file in the storage area.
Corresponding to the data storage method provided by the embodiment of the present invention, the embodiment of the present invention further provides an electronic device, as shown in fig. 9, including a processor 901, a communication interface 902, a memory 903, and a communication bus 904, where the processor 901, the communication interface 902, and the memory 903 complete communication with each other through the communication bus 904,
A memory 903 for storing a computer program;
the processor 901 is configured to implement the steps of any one of the data storage methods provided in the embodiments of the present invention when executing the program stored in the memory 903.
The communication bus mentioned above for the electronic device may be a peripheral component interconnect standard (PERIPHERAL COMPONENT INTERCONNECT, PCI) bus or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc. The communication bus may be classified as an address bus, a data bus, a control bus, or the like. For ease of illustration, the figures are shown with only one bold line, but not with only one bus or one type of bus.
The communication interface is used for communication between the electronic device and other devices.
The Memory may include random access Memory (Random Access Memory, RAM) or may include Non-Volatile Memory (NVM), such as at least one disk Memory. Optionally, the memory may also be at least one memory device located remotely from the aforementioned processor.
The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but may also be a digital signal processor (DIGITAL SIGNAL Processing, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components.
Corresponding to the data storage method provided in the above embodiment of the present invention, the embodiment of the present invention further provides a computer readable storage medium, where the computer program when executed by the processor implements the steps of any one of the data storage methods provided in the above embodiment of the present invention.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In this specification, each embodiment is described in a related manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the apparatus embodiments, the electronic device embodiments, the computer-readable storage medium embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the section of the method embodiments for relevance.
The foregoing description is only of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.
Claims (10)
1. A data storage method, for application to an electronic device, the method comprising:
When the target software is updated, reading a first storage address of each first software parameter from a specified text file in a preset storage area; wherein the first software parameters are: the method comprises the steps that software parameters are included before and after the target software is updated, the specified text file is used for recording first storage addresses of all the software parameters before the target software is updated, and parameter values in binary forms are recorded in storage spaces indicated by the first storage addresses;
reading parameter values of the first software parameters from the storage area according to the read first storage addresses;
Storing each first software parameter into the storage area according to the updated data structure of the software parameters set in the target software, and obtaining a second storage address of each first software parameter;
and updating the first storage address of each first software parameter in the appointed text file to a corresponding second storage address.
2. The method of claim 1, wherein after the step of reading parameter values of respective first software parameters from the memory area in accordance with the respective read first memory addresses, the method further comprises:
determining a parameter value of a second software parameter to be added in the updated target software;
The step of storing the parameter values of the first software parameters in the storage area according to the updated data structure of the software parameters set in the target software, and obtaining the second storage address of each first software parameter includes:
According to the updated data structure of the software parameters set in the target software, storing the parameter values of the first software parameters and the parameter values of the second software parameters into the storage area, and obtaining the second storage address of the first software parameters and the third storage address of the second software parameters;
The method further comprises the steps of:
and correspondingly storing the parameter identification of the second software parameter and a third storage address in the appointed text file.
3. A method according to claim 1 or 2, wherein the step of obtaining the second memory address of each first software parameter comprises:
Acquiring a starting storage address of a first software parameter in a data structure of the software parameter before updating the target software;
and determining the parameter address of each first software parameter based on the initial storage address and the maximum length of the parameter value of each first software parameter in the updated data structure of the software parameter set in the target software.
4. The method according to claim 1 or 2, characterized in that the method further comprises:
deleting the first storage address of each third software parameter recorded in the specified text file;
wherein the third software parameters are: the target software before updating comprises software parameters which are not included in the target software after updating.
5. The method according to claim 1 or 2, wherein after the step of updating the first memory address of each first software parameter to the corresponding second memory address in the specified text file, the method further comprises:
obtaining a parameter updating instruction, wherein the parameter updating instruction comprises: the parameter value of the appointed parameter to be updated and the target parameter identification;
and updating the parameter value corresponding to the target parameter identifier stored in the storage area into the parameter value of the parameter to be updated.
6. A method according to claim 1 or 2, wherein the specified text file has stored therein an index entry comprising a parameter identification and a storage address;
The step of reading the first storage address of each first software parameter from the specified text file in the preset storage area comprises the following steps:
For each first software parameter, searching a target index entry comprising a parameter identifier of the software parameter in the specified text file, and reading a storage address included in the searched target index entry as a first storage address of the software parameter;
The step of updating the first storage address of each first software parameter to the corresponding second storage address in the specified text file includes:
And for each first software parameter, searching the target index entry comprising the parameter identification of the software parameter in the specified text file, and updating the storage address included in the searched target index entry to a corresponding second storage address.
7. The method of claim 1, wherein prior to updating the target software, the method further comprises:
when the target software is installed, acquiring parameter values of all software parameters of the target software;
According to the data structure of the software parameters set in the target software, storing the parameter values of the software parameters into the storage area, and obtaining the storage addresses of the software parameters;
and storing the storage addresses of the software parameters of the target software in the specified text file in the storage area.
8. A data storage device for application to an electronic apparatus, the device comprising:
The address reading module is used for reading the first storage address of each first software parameter from a specified text file in a preset storage area when the target software is updated; wherein the first software parameters are: the method comprises the steps that software parameters are included before and after the target software is updated, the specified text file is used for recording first storage addresses of all the software parameters before the target software is updated, and parameter values in binary forms are recorded in storage spaces indicated by the first storage addresses;
The parameter value reading module is used for reading parameter values of all the first software parameters from the storage area according to all the read first storage addresses;
The first parameter value storage module is used for storing each first software parameter into the storage area according to the updated data structure of the software parameters set in the target software and obtaining a second storage address of each first software parameter;
and the address updating module is used for updating the first storage address of each first software parameter in the specified text file into a corresponding second storage address.
9. The electronic equipment is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
a processor for carrying out the method steps of any one of claims 1-7 when executing a program stored on a memory.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored therein a computer program which, when executed by a processor, implements the method steps of any of claims 1-7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911038424.6A CN112748945B (en) | 2019-10-29 | 2019-10-29 | Data storage method and device and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911038424.6A CN112748945B (en) | 2019-10-29 | 2019-10-29 | Data storage method and device and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112748945A CN112748945A (en) | 2021-05-04 |
CN112748945B true CN112748945B (en) | 2024-05-31 |
Family
ID=75640133
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911038424.6A Active CN112748945B (en) | 2019-10-29 | 2019-10-29 | Data storage method and device and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112748945B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103678577A (en) * | 2013-12-10 | 2014-03-26 | 新浪网技术(中国)有限公司 | Method and device for updating data |
CN106066806A (en) * | 2016-06-06 | 2016-11-02 | Tcl移动通信科技(宁波)有限公司 | A kind of mobile terminal software update method and system |
CN108958764A (en) * | 2018-06-08 | 2018-12-07 | 无锡飞翎电子有限公司 | The application program update method, apparatus and household electrical appliance of household electrical appliance |
-
2019
- 2019-10-29 CN CN201911038424.6A patent/CN112748945B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103678577A (en) * | 2013-12-10 | 2014-03-26 | 新浪网技术(中国)有限公司 | Method and device for updating data |
CN106066806A (en) * | 2016-06-06 | 2016-11-02 | Tcl移动通信科技(宁波)有限公司 | A kind of mobile terminal software update method and system |
CN108958764A (en) * | 2018-06-08 | 2018-12-07 | 无锡飞翎电子有限公司 | The application program update method, apparatus and household electrical appliance of household electrical appliance |
Also Published As
Publication number | Publication date |
---|---|
CN112748945A (en) | 2021-05-04 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110399380B (en) | Data processing method, electronic device and storage medium | |
CN106843842B (en) | Method and device for updating application program configuration file | |
CN111124382A (en) | Attribute assignment method and device in Java and server | |
CN110888756A (en) | Diagnostic log generation method and device | |
CN109241515B (en) | Method and device for generating report file | |
CN107844515B (en) | Data compliance checking method and device | |
CN112748945B (en) | Data storage method and device and electronic equipment | |
CN107330031B (en) | Data storage method and device and electronic equipment | |
CN111399849B (en) | Method and system for determining application program installation package | |
CN111666150B (en) | Storage space allocation method and device, terminal and computer readable storage medium | |
CN117708212A (en) | Metadata acquisition method and device and electronic equipment | |
US20090259654A1 (en) | Information processing apparatus, control method thereof, and storage medium | |
CN111736870A (en) | Industrial camera adaptation method and device, electronic equipment and storage medium | |
CN109660602B (en) | Data increment transmission method and device | |
CN111399832B (en) | Page editing method and device | |
CN110119351B (en) | Test case execution method and device | |
CN109359093A (en) | A kind of rule file update method and system | |
CN115004667B (en) | Information pushing method, device, electronic equipment and computer readable medium | |
CN108415814B (en) | Method for automatically recording field change, application server and computer readable storage medium | |
CN112256820B (en) | Document positioning method and device | |
CN112947991A (en) | Method and device for acquiring version difference code file, computer equipment and medium | |
CN108363614B (en) | Application service module management method and device and server | |
CN106681914B (en) | Television picture quality debugging method and device | |
CN104808985B (en) | The management method and device of object in application program | |
CN112395682B (en) | Cell inheritance method and device of grid model, electronic equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information |
Address after: 310051 room 304, B / F, building 2, 399 Danfeng Road, Binjiang District, Hangzhou City, Zhejiang Province Applicant after: Hangzhou Hikvision Robot Co.,Ltd. Address before: 310051 room 304, B / F, building 2, 399 Danfeng Road, Binjiang District, Hangzhou City, Zhejiang Province Applicant before: HANGZHOU HIKROBOT TECHNOLOGY Co.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |