Electronic equipment and user data memory upgrading method based on binary file

By generating middleware data header information and judging and comparing database version consistency, the problem of discontinuous modification of user data during TV OTA upgrades is solved, user data memory function is realized, and user experience is improved.

CN118916342APending Publication Date: 2024-11-08HISENSE VISUAL TECH CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202410482345.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-22
Publication Date
2024-11-08

AI Technical Summary

Technical Problem

During the TV OTA upgrade process, user data is modified discontinuously in the binary file, resulting in time-consuming reading. Furthermore, user settings are restored to default values ​​after the upgrade, affecting the user experience.

Method used

By generating the header information corresponding to the current version number of the middleware, it is determined whether a binary file exists in memory. The database version is compared for consistency. If they are inconsistent, the default data is read from the database and written to the binary file according to the index information, thus realizing the user data memory function.

Benefits of technology

In TV OTA upgrade scenarios, user data settings are retained, faster data read and write functions are provided, and the user experience is optimized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118916342A_ABST
    Figure CN118916342A_ABST
Patent Text Reader

Abstract

The invention relates to electronic equipment and a user data memory upgrading method based on binary files. The electronic equipment comprises a controller which is configured to start middleware and generate a first data header letter corresponding to a current version number of the middleware; the first data head information comprises a database version of at least one sub-module and at least one piece of index information; judging whether a binary file exists in a memory or not; when the binary file exists and the binary file is valid, reading second data header information of the binary file; comparing whether the database versions of the sub-modules in the first data head information and the second data head information are consistent or not; and the memory is configured to read default data from the database and write the default data into the memory if database versions of at least one submodule are inconsistent, read user data from the binary file and write the user data into the memory according to at least one piece of index information in the second data head information, and then write the default data and the user data into the binary file.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of data processing, and in particular to an electronic device and a user data memory upgrade method based on binary files. Background Art

[0002] For TV, since the database is used to save user data, it takes a long time to start the AC and DC and the user to modify the saved data, resulting in a poor user experience. Therefore, using binary files to save user data instead of databases can improve the speed of data reading and saving. However, since the data in the binary file is saved based on the order of the data structure, and some data structures are defined according to functions, when modifying the specified member variables, the affected data is discontinuous in the binary file. In this case, reading data from the original user binary file is very time-consuming.

[0003] In the related technology, when the TV is upgraded via OTA (Over-The-Air), the user binary file will be deleted and the data will be read from the database again. When using the TV, the user will modify the image, sound, HDMI (High Definition Multimedia Interface) and other interface options to a certain extent. The values ​​modified during the OTA upgrade are restored to the default values, resulting in an unfriendly user experience. Therefore, how to implement the user data memory function in the TV OTA upgrade scenario is an urgent problem to be solved. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present disclosure provides an electronic device and a user data memory upgrade method based on a binary file, which can realize the user data memory function in a TV OTA upgrade scenario.

[0005] In a first aspect, the present disclosure provides an electronic device, including:

[0006] The controller is configured as:

[0007] Starting the middleware and generating first data header information corresponding to the current version number of the middleware; the first data header information includes: a database version of at least one submodule and at least one index information;

[0008] Determine whether there is a binary file in memory;

[0009] When the binary file exists and the binary file is valid, reading the second data header information of the binary file;

[0010] Compare whether the database versions of each submodule in the first data header information and the second data header information are consistent;

[0011] Memory, configured as:

[0012] If the database version of at least one sub-module is inconsistent, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file.

[0013] As an optional implementation of the embodiment of the present disclosure, the memory is further configured as:

[0014] The determining whether there is a binary file in the memory also includes:

[0015] When the binary file does not exist, the default data is read from the database and written into the memory;

[0016] A target binary file is generated according to the first data header information; the target binary file includes the default data and at least one index information of the first data header information.

[0017] As an optional implementation of the embodiment of the present disclosure, the memory is further configured as:

[0018] The determining whether there is a binary file in the memory also includes:

[0019] When the binary file exists, verifying the binary file;

[0020] When the binary file verification fails, the binary file is deleted, and default data is read from the database and written into the memory;

[0021] A target binary file is generated according to the first data header information; the target binary file includes the default data and at least one index information of the first data header information.

[0022] As an optional implementation of the embodiment of the present disclosure, the controller is further configured as follows:

[0023] After reading the user data from the binary file and writing it into the memory according to at least one index information in the second data header information, the method further includes:

[0024] Determine whether there is a preset default value modification table in the target database; the target database is an upgraded database; the preset default value modification table is used to store modification information of target parameters corresponding to different database versions of each submodule;

[0025] If the preset default value modification table exists in the target database, determining whether the preset default value modification table stores modification information of the target parameters corresponding to the database version of each submodule in the binary file;

[0026] If the preset default value modification table stores modification information of the target parameters corresponding to the database versions of the submodules in the binary file, the target parameters are modified according to the modification information of the target parameters.

[0027] As an optional implementation of the embodiment of the present disclosure, the memory is further specifically configured as:

[0028] The comparing whether the database versions of each submodule in the first data header information and the second data header information are consistent also includes:

[0029] If the database versions of the submodules in the first data header information and the second data header information are consistent, the user data is read from the binary file and written into the memory according to at least one index information in the second data header information.

[0030] As an optional implementation of the embodiment of the present disclosure, the memory is specifically configured as follows:

[0031] If the database version of at least one submodule is inconsistent, the default data is read from the database and written into the memory, and user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and the user data are written into the binary file, including:

[0032] If the database version of the target submodule in the first data header information is greater than the database version of the target submodule in the second data header information, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file to complete the database upgrade.

[0033] As an optional implementation of the embodiment of the present disclosure, the index information includes: the starting position stored in each data table, the number of data stored in each data table, and the length of data stored in each data table;

[0034] The memory is further specifically configured as:

[0035] If the database version of at least one submodule is inconsistent, the default data is read from the database and written into the memory, and user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and the user data are written into the binary file, further comprising:

[0036] If the database version of the target submodule in the first data header information is smaller than the database version of the target submodule in the second data header information, the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and the default data and the user data are written into the binary file according to the number of data and the data length contained in the index information of the first data header information to complete the database downgrade.

[0037] In a second aspect, a method for updating user data memory based on a binary file is provided, the method comprising:

[0038] Starting the middleware and generating first data header information corresponding to the current version number of the middleware; the first data header information includes: a database version of at least one submodule and at least one index information;

[0039] Determine whether there is a binary file in memory;

[0040] When the binary file exists and the binary file is valid, reading the second data header information of the binary file;

[0041] Compare whether the database versions of each submodule in the first data header information and the second data header information are consistent;

[0042] If the database version of at least one sub-module is inconsistent, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file.

[0043] As an optional implementation of the embodiment of the present disclosure, the determining whether there is a binary file in the memory further includes:

[0044] When the binary file does not exist, the default data is read from the database and written into the memory;

[0045] A target binary file is generated according to the first data header information; the target binary file includes the default data and at least one index information of the first data header information.

[0046] As an optional implementation of the embodiment of the present disclosure, the determining whether there is a binary file in the memory further includes:

[0047] When the binary file exists, verifying the binary file;

[0048] When the binary file verification fails, the binary file is deleted, and default data is read from the database and written into the memory;

[0049] A target binary file is generated according to the first data header information; the target binary file includes the default data and at least one index information of the first data header information.

[0050] As an optional implementation of the embodiment of the present disclosure, after reading the user data from the binary file and writing it into the memory according to at least one index information in the second data header information, the method further includes:

[0051] Determine whether there is a preset default value modification table in the target database; the target database is an upgraded database; the preset default value modification table is used to store modification information of target parameters corresponding to different database versions of each submodule;

[0052] If the preset default value modification table exists in the target database, determining whether the preset default value modification table stores modification information of the target parameters corresponding to the database version of each submodule in the binary file;

[0053] If the preset default value modification table stores modification information of the target parameters corresponding to the database versions of the submodules in the binary file, the target parameters are modified according to the modification information of the target parameters.

[0054] As an optional implementation of the embodiment of the present disclosure, the comparing whether the database versions of each submodule in the first data header information and the second data header information are consistent further includes:

[0055] If the database versions of the submodules in the first data header information and the second data header information are consistent, the user data is read from the binary file and written into the memory according to at least one index information in the second data header information.

[0056] As an optional implementation of the embodiment of the present disclosure, if there is an inconsistency in the database version of at least one submodule, reading default data from the database and writing it into the memory, and reading user data from the binary file and writing it into the memory according to at least one index information in the second data header information, and then writing the default data and the user data into the binary file, including:

[0057] If the database version of the target submodule in the first data header information is greater than the database version of the target submodule in the second data header information, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file to complete the database upgrade.

[0058] As an optional implementation of the embodiment of the present disclosure, the index information includes: the starting position stored in each data table, the number of data stored in each data table, and the length of data stored in each data table;

[0059] The memory is further specifically configured as:

[0060] If the database version of at least one submodule is inconsistent, the default data is read from the database and written into the memory, and user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and the user data are written into the binary file, further comprising:

[0061] If the database version of the target submodule in the first data header information is smaller than the database version of the target submodule in the second data header information, the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and the default data and the user data are written into the binary file according to the number of data and the data length contained in the index information of the first data header information to complete the database downgrade.

[0062] In a third aspect, a computer-readable storage medium is provided, comprising: a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the user data memory upgrade method based on the binary file as shown in the first aspect is implemented.

[0063] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has the following advantages:

[0064] Start the middleware, generate the first data header information corresponding to the current version number of the middleware, the first data header information includes: the database version of at least one submodule and at least one index information; determine whether there is a binary file in the memory, when the binary file exists and the binary file is valid, read the second data header information of the binary file, compare whether the database versions of each submodule in the first data header information and the second data header information are consistent, if there is at least one submodule whose database version is inconsistent, read the default data from the database and write it into the memory, and read the user data from the binary file and write it into the memory according to at least one index information in the second data header information, and then write the default data and the user data into the binary file. By reconstructing the data structure stored in the binary file, comparing the database versions of each submodule in the first data header information generated by the running code and the second data header information stored in the binary file, when the database is upgraded or downgraded, read the default data from the database and write it into the memory, read the user data from the binary file and write it into the memory according to at least one index information in the second data header information, and then write the default data and the user data back to the binary file, so that the original data previously set by the user is retained, and new default data items are added when the database is upgraded, thereby realizing the user data memory function in the TV OTA upgrade scenario. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0066] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0067] Figure 1A This is one of the application scenario schematic diagrams of the method for upgrading user data memory based on binary files in one or more embodiments of the present disclosure;

[0068] Figure 1B This is a second schematic diagram of an application scenario of the method for updating user data memory based on binary files according to one or more embodiments of the present disclosure;

[0069] Figure 1C A schematic diagram of the functional module structure of an electronic device according to one or more embodiments of the present disclosure;

[0070] Figure 2A A hardware configuration block diagram of an electronic device according to one or more embodiments of the present disclosure;

[0071] Figure 2B A software configuration block diagram of an electronic device according to one or more embodiments of the present disclosure;

[0072] Figure 2C A schematic diagram showing an icon control interface of an application included in a smart device according to one or more embodiments of the present disclosure;

[0073] Figure 3A One of the flowcharts of a method for updating user data memory based on binary files provided in an embodiment of the present disclosure;

[0074] Figure 3B A schematic diagram of a data structure of a binary file provided in an embodiment of the present disclosure;

[0075] Figure 3C A schematic diagram of a binary file data upgrade process provided by an embodiment of the present disclosure;

[0076] Figure 3D A schematic diagram of a binary file data degradation process provided by an embodiment of the present disclosure;

[0077] Figure 4 A second flowchart of a method for updating user data memory based on a binary file provided in an embodiment of the present disclosure;

[0078] Figure 5 A third flowchart of a method for updating user data memory based on a binary file provided in an embodiment of the present disclosure;

[0079] Figure 6 The fourth flowchart of a method for upgrading user data memory based on binary files provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0080] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0081] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0082] The terms "first", "second", "third", etc. in the specification and claims of the present disclosure and the above drawings are used to distinguish similar or similar objects or entities, and are not necessarily meant to limit a specific order or sequence, unless otherwise noted. It should be understood that the terms used in this way can be interchangeable under appropriate circumstances.

[0083] The terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to all the components expressly listed but may include other components not expressly listed or inherent to such product or device.

[0084] Middleware, also known as Middleware in English, is a basic software used in distributed systems. From a vertical level, middleware is located between various applications / services and operating systems / database systems and other system software. It mainly solves problems such as data transmission, data access, application scheduling, system construction and system inheritance, and process management in a distributed environment. It is a platform that supports application development, operation, and integration in a distributed environment. It can achieve interconnection between systems and help users develop application software efficiently. Middleware can be understood as software that provides intermediary services between the operating system kernel and the application program. For example, middleware can be MySQL database, MongoDB, etc.

[0085] When users use the TV, they will modify the image, sound, HDMI and other interface options, and the corresponding modified data is saved in the middleware. At present, some companies' middleware will read the default value data from the database when it is turned on for the first time, and then write it to the local file in the format of binary data, and then read and save it in the binary file, which can improve the reading and writing speed. However, binary data is saved in a data structure and does not support upgrades and extensions. During OTA upgrades, user data will be deleted and the default values ​​will be read from the database again, resulting in a poor user experience. In other words, the binary file storage method currently used does not support user data memory in database upgrade scenarios, affecting the user experience of users who pursue personalized settings such as images and sounds.

[0086] In response to the shortcomings of the above method, an embodiment of the present invention starts the middleware and generates first data header information corresponding to the current version number of the middleware, the first data header information including: a database version of at least one sub-module and at least one index information; determines whether there is a binary file in the memory, and when the binary file exists and the binary file is valid, reads the second data header information of the binary file, compares whether the database versions of each sub-module in the first data header information and the second data header information are consistent, and if the database versions of at least one sub-module are inconsistent, reads default data from the database and writes it into the memory, and reads user data from the binary file and writes it into the memory based on at least one index information in the second data header information, and then writes the default data and the user data into the binary file. By reconstructing the data structure stored in the binary file, comparing the database versions of each sub-module in the first data header information generated by the running code and the second data header information stored in the binary file, when the database is upgraded or downgraded, the default data is read from the database and written into the memory, and the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and user data are written back to the binary file. This not only retains the original data previously set by the user, but also adds new default data items when the database is upgraded, thereby realizing the user data memory function in the database upgrade scenario, providing faster data reading and writing functions, and optimizing the user experience.

[0087] For example, Figure 1A As shown, Figure 1A The following is a schematic diagram of an application scenario of a method for upgrading user data memory based on a binary file provided by an embodiment of the present disclosure. Taking a smart TV as an example, the following is a schematic diagram of an application scenario of a method for upgrading user data memory based on a binary file. After the user starts the TV 200 through the control device 100 or the mobile terminal 300, the user enters the setting page and modifies the interface options such as sound, image, and HDMI. For example, Figure 1B As shown in the figure, the default input source for power-on is modified. Assuming that the original default input source is HDMI1, the user changes the default input source to HDMI2 according to the actual usage. Or when the original default input source is HDMI3, change the original default input source HDMI3 to HDMI1. The corresponding modified data is saved in the middleware. When the middleware is powered on for the first time, it will read the default value data from the database, and then write it to the local file in the format of binary data. After that, it will read and save it in the binary file, which can improve the reading and writing speed. However, binary data is saved in a data structure and does not support upgrade and expansion. During OTA upgrade, user data will be deleted and the default value will be read from the database again, resulting in a poor user experience.

[0088] The method for updating user data memory based on binary files provided in the embodiments of the present disclosure can be implemented based on an electronic device, or a functional module or functional entity in the electronic device. Figure 1C As shown, Figure 1C The functional modules included in an electronic device provided in an embodiment of the present disclosure include, for example, a starting module 110 , a judging module 120 , a reading module 130 , a comparing module 140 , and a writing module 150 .

[0089] Among them, the electronic device can be a smart TV, a projector, a smart screen, a personal computer (PC), a server, a mobile phone, a tablet computer, a laptop computer, a mainframe computer, etc., and the embodiments of the present disclosure do not specifically limit this.

[0090] For example, Figure 2A FIG. 1 is a hardware configuration block diagram of an electronic device according to one or more embodiments of the present disclosure. Figure 2A As shown, the electronic device includes: a tuner 210, a communicator 220, a detector 230, an external device interface 240, a controller 250, a display 260, an audio output interface 270, a memory, a power supply, and at least one of a user interface 280. Among them, the controller 250 includes a central processing unit, a video processor, an audio processor, a graphics processor, RAM, ROM, and a first interface to an nth interface for input / output. The display 260 can be at least one of a liquid crystal display, an OLED display, a touch display, and a projection display, and can also be a projection device and a projection screen. The tuner 210 receives broadcast television signals through wired or wireless reception, and demodulates audio and video signals from multiple wireless or wired broadcast television signals, such as EPG audio and video data signals. The communicator 220 is a component for communicating with an external device or server according to various communication protocol types. For example: the communicator can include other network communication protocol chips or near field communication protocol chips such as Wifi modules, Bluetooth modules, wired Ethernet modules, and at least one of infrared receivers. The electronic device can establish the transmission and reception of control signals and data signals with the server or local control device through the communicator 220. The detector 230 is used to collect signals of the external environment or the external interaction. The controller 250 and the tuner-demodulator 210 can be located in different split devices, that is, the tuner-demodulator 210 can also be in an external device of the main device where the controller 250 is located, such as an external set-top box.

[0091] In some embodiments, the controller 250 controls the operation of the electronic device and responds to the user's operation through various software control programs stored in the memory. The controller 250 controls the overall operation of the electronic device. The user can input a user command in a graphical user interface (GUI) displayed on the display 260, and the user input interface receives the user input command through the graphical user interface (GUI). Alternatively, the user can input a user command by inputting a specific sound or gesture, and the user input interface recognizes the sound or gesture through a sensor to receive the user input command.

[0092] Figure 2B FIG. 1 is a schematic diagram of software configuration of an electronic device according to one or more embodiments of the present disclosure, such as Figure 2B As shown in the figure, the system is divided into four layers, from top to bottom, namely the application layer (Applications) layer (referred to as "application layer"), the application framework layer (Application Framework) layer (referred to as "framework layer"), the Android runtime (Android runtime) and system library layer (referred to as "system runtime library layer"), and the kernel layer.

[0093] Figure 2C The schematic diagram of the icon control interface display of the application program included in the electronic device according to one or more embodiments of the present disclosure is as follows: Figure 2C As shown in , the application layer includes at least one application that can display a corresponding icon control in the display, such as: a live TV application icon control, a video on demand VOD application icon control, a media center application icon control, an application center icon control, a game application icon control, etc. The live TV application can provide live TV through different signal sources. The video on demand VOD application can provide videos from different storage sources. Unlike the live TV application, the video on demand provides video display from certain storage sources. The media center application can provide applications for playing various multimedia content. The application center can provide storage for various applications.

[0094] In order to explain this scheme in more detail, the following will be combined in an exemplary manner Figure 3A , Figure 4 , Figure 5 , Figure 6 To explain, it can be understood that although 3A, Figure 4 , Figure 5 , Figure 6 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 3A, Figure 4 , Figure 5 , Figure 6 At least part of the steps in the above steps may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps. The method for upgrading user data memory based on binary files provided in the embodiments of the present disclosure shall prevail.

[0095] like Figure 3A As shown, the method specifically comprises the following steps:

[0096] S31, start the middleware and generate first data header information corresponding to the current version number of the middleware.

[0097] The first data header information includes: a database version of at least one submodule and at least one index information. In addition, the first data header information also includes: a device identifier, a checksum, and a data length. It should be noted that the database version of the submodule corresponds to the index information one by one. The device identifier is used to distinguish devices from different manufacturers. For example, the device identifier can be a fixed string used to represent devices from different manufacturers.

[0098] Specifically, when the electronic device is turned on, the middleware starts, calls the Build function to initialize the database, generates index information of the current middleware version, and then determines whether a binary file exists. The index information includes: the starting position of each data table storage, the number of data stored in each data table, and the length of data stored in each data table.

[0099] S32. Determine whether there is a binary file in the memory.

[0100] The binary file includes second data header information and at least one structure array.

[0101] For example, refer to Figure 3B As shown, the second data header information includes: device identifier, check code, data header length, video (image) version, audio version, HDMI version, and stored index information corresponding to the database version of each submodule. Figure 3BThe data header information in the HS_MW_USER_SETTING_HEAD_INFO structure is used to save the database version and the index information corresponding to this version. The index information is represented by the HS_MW_ITEM_INFO array. Each HS_MW_ITEM_INFO variable corresponds to the data of a table in the database. The structure array represents the data set of the corresponding table, and its data structure definition corresponds to the columns of the database table one by one. Figure 3B As shown, the structure array can be but is not limited to: structure array A, structure array B, structure array C,..., structure array N.

[0102] Exemplarily, the database versions of the submodules include but are not limited to: image submodule database version (which can be represented by HS_DB_VIDEO_VERSION), sound submodule database version (which can be represented by HS_DB_AUDIO_VERSION), and HDMI submodule database version (which can be represented by HS_DB_HDMI_VERSION).

[0103] S33: When the binary file exists and is valid, read the second data header information of the binary file.

[0104] Specifically, when a binary file exists and the binary file is valid, the second data header information of the binary file is read to facilitate comparison of the first data header information generated after compiling the code macro definition with the database versions of each sub-module respectively stored in the second data header information stored in the binary file, thereby determining whether a database upgrade occurs.

[0105] For example, database upgrades follow different specifications in different scenarios:

[0106] a) Database table column expansion requires modifying the data structure of the table and adding new member variables to the end of the data structure;

[0107] b) When the database table data increases, the new data is appended at the end of the database and the corresponding data quantity definition is modified;

[0108] c) Add a new table to the database, add the data structure definition of this table, the corresponding ItemInfo information, and append the new data to the end of the original bin file;

[0109] d) To modify the default value of user data, you need to add data at the end of the specified default value modification table in the specified format. It should be noted that some specific parameters have a greater impact on user usage, and this type of parameter needs to be forcibly replaced, that is, the original default value is replaced with the new default value. Regardless of whether the user has modified the default value of this type of parameter before, as the database is upgraded, the old value of this type of parameter must be overwritten with the new default value.

[0110] e) After the above modification, the corresponding submodule version needs to be increased by 1.

[0111] S34: Compare whether the database versions of each submodule in the first data header information and the second data header information are consistent.

[0112] Specifically, the first data header information generated after compiling the code macro definition is compared with the database versions of each sub-module respectively stored in the second data header information stored in the binary file. If the database version of at least one sub-module is inconsistent, it means that the database has been upgraded, and step S35 is further executed.

[0113] S35. If the database version of at least one sub-module is inconsistent, the default data is read from the database and written into the memory, and the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and the user data are written into the binary file.

[0114] Specifically, if the database version of at least one sub-module is inconsistent, it means that the database has been upgraded or downgraded. First, it is necessary to read the default data from the database and write it into the memory, and according to at least one index information in the second data header information, read the user data from the binary file and write it into the memory, and then write the default data and the user data into the binary file.

[0115] In some embodiments, if the database version of the target submodule in the first data header information is greater than the database version of the target submodule in the second data header information, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file to complete the database upgrade.

[0116] For example, if the submodule version in the binary file bin is smaller than the macro definition, the user data is read from the bin file into the memory according to the index information of the bin file, and memcpy is used to transfer the data to the class member variable according to the number and length of the data in the bin file index information, and the newly added data will not be overwritten. Figure 3C, the data upgrade process is as follows Figure 3C As shown. A, B, C, and D included in the first row (DB) are the default values ​​of the original data in the database, and E is the default value of the newly added data. A, B, C, and D included in the second row (Bin) are the user data stored in the binary file. After upgrading in the above manner, the updated binary file includes the user data stored in the original binary file and the default value of the newly added data.

[0117] In some embodiments, if the database version of the target submodule in the first data header information is smaller than the database version of the target submodule in the second data header information, the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and the default data and the user data are written into the binary file according to the number of data and the data length contained in the index information of the first data header information to complete the database downgrade.

[0118] For example, if the submodule version in bin is greater than the macro definition, the user data is read from the bin file into the memory according to the index information of the bin file, and memcpy is used to store the data in the class member variable according to the number and length of the index information in the code. The newly added data in the bin file will not be saved in the global variable. Figure 3D , the data upgrade process is as follows Figure 3D As shown. A, B, C, and D included in the first row (DB) are the original data default values ​​of the database, and A, B, C, D, and E included in the second row (Bin) are the user data stored in the binary file. After downgrading in the above manner, the updated binary file includes the user data stored in the original binary file.

[0119] In addition, in the above two embodiments, A, B, C, D, and E may refer to column data, table row data, entire table data, and the like.

[0120] In some embodiments, if the database versions of each submodule in the first data header information and the second data header information are consistent, user data is read from the binary file and written into the memory according to at least one index information in the second data header information.

[0121] Specifically, if the database versions of each submodule in the first data header information and the second data header information are consistent, it means that the database upgrade has not occurred at this time, so the user data is directly read from the binary file and written into the memory.

[0122] By adding index information and reconstructing the data structure stored in the binary file, universal user data reading and OTA upgrade are achieved.

[0123] In an embodiment of the present disclosure, the middleware is started and first data header information corresponding to the current version number of the middleware is generated, the first data header information including: a database version of at least one sub-module and at least one index information; it is determined whether there is a binary file in the memory, and when the binary file exists and the binary file is valid, the second data header information of the binary file is read, and the database versions of the sub-modules in the first data header information and the second data header information are compared to see whether they are consistent; if the database versions of at least one sub-module are inconsistent, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file. By reconstructing the data structure stored in the binary file, comparing the database versions of each sub-module in the first data header information generated by the running code and the second data header information stored in the binary file, when the database is upgraded or downgraded, the default data is read from the database and written into the memory, and the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and user data are written back to the binary file. This not only retains the original data previously set by the user, but also adds new default data items when the database is upgraded, thereby realizing the user data memory function in the database upgrade scenario, providing faster data reading and writing functions, and optimizing the user experience.

[0124] Figure 4 FIG. 3 is a flowchart of another method for updating user data memory based on binary files provided by an embodiment of the present disclosure. This embodiment is further expanded and optimized on the basis of FIG. 3. Optionally, the above step S32 (determining whether there is a binary file in the memory) may also perform the following steps S46-S47:

[0125] S41, starting the middleware and generating first data header information corresponding to the current version number of the middleware.

[0126] The first data header information includes: a database version of at least one submodule and at least one index information. In addition, the first data header information also includes: a device identifier, a check value, and a data length.

[0127] S42: Determine whether there is a binary file in the memory.

[0128] S43: When the binary file exists and is valid, read the second data header information of the binary file.

[0129] S44: Compare whether the database versions of each submodule in the first data header information and the second data header information are consistent.

[0130] S45. If the database version of at least one sub-module is inconsistent, the default data is read from the database and written into the memory, and the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and the user data are written into the binary file.

[0131] It should be noted that the specific implementation of steps S41-S45 is the same as that of steps S31-S35, and will not be repeated here.

[0132] S46: When the binary file does not exist, the default data is read from the database and written into the memory.

[0133] S47. Generate a target binary file according to the first data header information.

[0134] The target binary file includes at least one index information of the default data and the first data header information.

[0135] Specifically, when there is no binary file, it means that the electronic device is turned on for the first time, there is no previous binary file, and there is no corresponding historical user data. At this time, the default data is read from the database and written into the memory, and the target binary file is generated according to the at least one index information included in the first data header information and the default data read from the database.

[0136] In an embodiment of the present disclosure, the middleware is started and first data header information corresponding to the current version number of the middleware is generated, the first data header information including: a database version of at least one sub-module and at least one index information; it is determined whether there is a binary file in the memory, and when the binary file exists and the binary file is valid, the second data header information of the binary file is read, and the database versions of the sub-modules in the first data header information and the second data header information are compared to see whether they are consistent; if the database versions of at least one sub-module are inconsistent, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file. By reconstructing the data structure stored in the binary file, comparing the database versions of each sub-module in the first data header information generated by the running code and the second data header information stored in the binary file, when the database is upgraded or downgraded, the default data is read from the database and written into the memory, and the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and user data are written back to the binary file. This not only retains the original data previously set by the user, but also adds new default data items when the database is upgraded, thereby realizing the user data memory function in the database upgrade scenario, providing faster data reading and writing functions, and optimizing the user experience.

[0137] Figure 5 FIG3 is a flowchart of another method for upgrading user data memory based on binary files provided by an embodiment of the present disclosure. This embodiment is further expanded and optimized on the basis of FIG3. Optionally, this embodiment mainly further describes the process of step S32 (determining whether there is a binary file in the memory), specifically including steps S52-S54.

[0138] S51: Start the middleware and generate first data header information corresponding to the current version number of the middleware.

[0139] The first data header information includes: a database version of at least one submodule and at least one index information. In addition, the first data header information also includes: a device identifier, a check value, and a data length.

[0140] S52: Determine whether there is a binary file in the memory.

[0141] It should be noted that the specific implementation of steps S51-S52 is the same as that of steps S31-S32, and will not be repeated here.

[0142] S53: If the binary file exists, verify the binary file.

[0143] S54: When the binary file verification fails, the binary file is deleted, default data is read from the database and written into the memory, and a target binary file is generated according to the first data header information.

[0144] Specifically, when a binary file exists, the binary file is verified according to the device identification and the check value. If the device identification and the check value of the binary file are consistent with the device identification and the check value in the first data header information generated after the code macro definition is compiled, it means that the verification is successful, otherwise, the verification fails. When the binary file verification fails, the binary file is deleted, the default data is read from the database and written into the memory, and the target binary file is generated according to the first data header information.

[0145] S55. When the binary file verification succeeds, read the second data header information of the binary file.

[0146] S56: Compare whether the database versions of each submodule in the first data header information and the second data header information are consistent.

[0147] S57. If the database version of at least one sub-module is inconsistent, the default data is read from the database and written into the memory, and the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and the user data are written into the binary file.

[0148] It should be noted that the specific implementation of steps S55-S57 is the same as that of steps S33-S35, and will not be repeated here.

[0149] In an embodiment of the present disclosure, the middleware is started and the first data header information corresponding to the current version number of the middleware is generated, the first data header information including: a database version of at least one sub-module and at least one index information; it is determined whether there is a binary file in the memory, and when the binary file exists and the binary file is valid, the second data header information of the binary file is read, and the database versions of the sub-modules in the first data header information and the second data header information are compared to see whether they are consistent; if the database versions of at least one sub-module are inconsistent, the default data is read from the database and written into the memory, and based on the at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file. By reconstructing the data structure stored in the binary file, comparing the database versions of each sub-module in the first data header information generated by the running code and the second data header information stored in the binary file, when the database is upgraded or downgraded, the default data is read from the database and written into the memory, and the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and user data are written back to the binary file. This not only retains the original data previously set by the user, but also adds new default data items when the database is upgraded, thereby realizing the user data memory function in the database upgrade scenario, providing faster data reading and writing functions, and optimizing the user experience.

[0150] Figure 6 FIG3 is a flowchart of another method for upgrading user data memory based on binary files provided by an embodiment of the present disclosure. This embodiment is further expanded and optimized on the basis of FIG3. Optionally, after executing the step (reading user data from the binary file and writing it into the memory according to at least one index information in the second data header information), the following steps S61-S63 may also be executed.

[0151] S61. Determine whether there is a preset default value modification table in the target database.

[0152] Among them, the target database is an upgraded database; the preset default value modification table is used to store modification information of target parameters corresponding to different database versions of each sub-module.

[0153] S62: If the preset default value modification table exists in the target database, determine whether the preset default value modification table stores modification information of the target parameters corresponding to the database version of each submodule in the binary file.

[0154] S63: If the preset default value modification table stores modification information of the target parameters corresponding to the database versions of the submodules in the binary file, modify the target parameters according to the modification information of the target parameters.

[0155] Specifically, if the database is upgraded and the default value modification table is preset, that is, the table ChangedDefData contains data information that matches the current upgrade process version, and the data information is modified according to the default value, and the specified default value is modified. Finally, the data in the memory is written back to the bin file to complete the database upgrade or downgrade.

[0156] In an embodiment of the present disclosure, the middleware is started and first data header information corresponding to the current version number of the middleware is generated, the first data header information including: a database version of at least one sub-module and at least one index information; it is determined whether there is a binary file in the memory, and when the binary file exists and the binary file is valid, the second data header information of the binary file is read, and the database versions of the sub-modules in the first data header information and the second data header information are compared to see whether they are consistent; if the database versions of at least one sub-module are inconsistent, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file. By reconstructing the data structure stored in the binary file, comparing the database versions of each sub-module in the first data header information generated by the running code and the second data header information stored in the binary file, when the database is upgraded or downgraded, the default data is read from the database and written into the memory, and the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and user data are written back to the binary file. This not only retains the original data previously set by the user, but also adds new default data items when the database is upgraded, thereby realizing the user data memory function in the database upgrade scenario, providing faster data reading and writing functions, and optimizing the user experience.

[0157] The embodiments of the present disclosure also provide a storage medium containing computer executable instructions, which, when executed by a computer processor, implement the various processes of the method provided in any of the above embodiments and can achieve the same technical effect. To avoid repetition, they are not described here.

[0158] The computer-readable storage medium may be a read-only memory device (ROM), a random access memory device (RAM), a magnetic disk or an optical disk, etc.

[0159] For the convenience of explanation, the above description has been made in conjunction with specific embodiments. However, the above discussion in some embodiments is not intended to be exhaustive or limit the embodiments to the specific forms disclosed above. According to the above teachings, various modifications and variations can be obtained. The selection and description of the above embodiments are to better explain the principles and practical applications, so that those skilled in the art can better use the embodiments and various different variations of the embodiments suitable for specific use considerations.

Claims

1. An electronic device, characterized in that: include: The controller is configured as: Starting the middleware and generating first data header information corresponding to the current version number of the middleware; The first data header information includes: a database version of at least one submodule and at least one index information; Determine whether there is a binary file in memory; When the binary file exists and the binary file is valid, reading the second data header information of the binary file; Compare whether the database versions of each submodule in the first data header information and the second data header information are consistent; Memory, configured as: If the database version of at least one sub-module is inconsistent, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file.

2. The electronic device according to claim 1, characterized in that: The memory is further configured as: The determining whether there is a binary file in the memory also includes: When the binary file does not exist, the default data is read from the database and written into the memory; A target binary file is generated according to the first data header information; the target binary file includes the default data and at least one index information of the first data header information.

3. The electronic device according to claim 2, characterized in that: The memory is further configured as: The determining whether there is a binary file in the memory also includes: When the binary file exists, verifying the binary file; When the binary file verification fails, the binary file is deleted, and default data is read from the database and written into the memory; A target binary file is generated according to the first data header information; the target binary file includes the default data and at least one index information of the first data header information.

4. The electronic device according to claim 1, characterized in that: The controller is further configured to: After reading the user data from the binary file and writing it into the memory according to at least one index information in the second data header information, the method further includes: Determine whether there is a preset default value modification table in the target database; the target database is an upgraded database; the preset default value modification table is used to store modification information of target parameters corresponding to different database versions of each submodule; If the preset default value modification table exists in the target database, determining whether the preset default value modification table stores modification information of the target parameters corresponding to the database version of each submodule in the binary file; If the preset default value modification table stores modification information of the target parameters corresponding to the database version of each submodule in the binary file, the target parameters are modified according to the modification information of the target parameters.

5. The electronic device according to claim 1, characterized in that: The memory is further specifically configured as: The comparing whether the database versions of each submodule in the first data header information and the second data header information are consistent also includes: If the database versions of the submodules in the first data header information and the second data header information are consistent, the user data is read from the binary file and written into the memory according to at least one index information in the second data header information.

6. The electronic device according to claim 1, characterized in that: The memory is specifically configured as: If the database version of at least one submodule is inconsistent, the default data is read from the database and written into the memory, and user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and the user data are written into the binary file, including: If the database version of the target submodule in the first data header information is greater than the database version of the target submodule in the second data header information, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file to complete the database upgrade.

7. The electronic device according to claim 1, characterized in that: The index information includes: the starting position of each data table storage, the number of data stored in each data table and the length of data stored in each data table; The memory is further specifically configured as: If the database version of at least one submodule is inconsistent, the default data is read from the database and written into the memory, and user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and then the default data and the user data are written into the binary file, further comprising: If the database version of the target submodule in the first data header information is smaller than the database version of the target submodule in the second data header information, the user data is read from the binary file and written into the memory according to at least one index information in the second data header information, and the default data and the user data are written into the binary file according to the number of data and the data length contained in the index information of the first data header information to complete the database downgrade.

8. A method for upgrading user data memory based on binary files, characterized in that: The method comprises: Starting the middleware and generating first data header information corresponding to the current version number of the middleware; the first data header information includes: a database version of at least one submodule and at least one index information; Determine whether there is a binary file in memory; When the binary file exists and the binary file is valid, reading the second data header information of the binary file; Compare whether the database versions of each submodule in the first data header information and the second data header information are consistent; If the database version of at least one sub-module is inconsistent, the default data is read from the database and written into the memory, and based on at least one index information in the second data header information, the user data is read from the binary file and written into the memory, and then the default data and the user data are written into the binary file.

9. The method according to claim 8, characterized in that The determining whether there is a binary file in the memory also includes: When the binary file does not exist, the default data is read from the database and written into the memory; A target binary file is generated according to the first data header information; the target binary file includes the default data and at least one index information of the first data header information.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the user data memory upgrade method based on a binary file as described in any one of claims 8 to 9 is implemented.

Citation Information

Patent Citations

  • Method and apparatus for making differential upgrade package, and method and apparatus for differential upgrade of system

    CN105700926A

  • Updating method and updating device for data blocks of nonvolatile memory

    CN113377793A

  • Preserving trust data during operating system updates of a secure element of an electronic device

    US20180089434A1

  • Annotation mapping

    US9275368B1