An OTA upgrading method, device, system and embedded device
By optimizing the OTA upgrade process in embedded devices and confirming upgrade actions based on query intervals and time periods, the problem of excessive server load during OTA upgrades of embedded devices was solved, thereby improving the upgrade success rate and server utilization.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN GONGJIN ELECTRONICS CO LTD
- Filing Date
- 2023-12-12
- Publication Date
- 2026-07-21
AI Technical Summary
In existing technologies, when embedded devices undergo OTA upgrades, excessive server load leads to low upgrade success rates and low server utilization.
By setting a query interval in the embedded device, the query interval is determined by dividing the distance to the upgrade time by the set span time. On the N+1th query to the OTA server, the current system time and the upgrade time period are combined to confirm whether to perform the upgrade action, thus optimizing the upgrade process.
It improved the utilization rate and upgrade success rate of OTA servers, reduced server load pressure, and improved upgrade efficiency.
Smart Images

Figure CN117707573B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of embedded software technology, and in particular to an OTA upgrade method, apparatus, system and embedded device. Background Technology
[0002] With the increasingly widespread application of embedded devices, their maintenance in live networks is becoming increasingly important. To simplify subsequent maintenance, OTA (Over-The-Air) upgrade functionality is typically included. This allows for direct resolution of serious issues arising in live network use via OTA upgrades, avoiding manual upgrades or returns to the factory for upgrades, which are extremely inefficient, time-consuming, and costly. However, current technologies often suffer from a large number of devices simultaneously requesting OTA server updates, causing excessive server load, abnormal embedded device upgrades, and resulting in low OTA upgrade success rates and low OTA server utilization. Summary of the Invention
[0003] In view of this, embodiments of this application provide an OTA upgrade method, apparatus, system, and embedded device, which can effectively solve the problems of low OTA upgrade success rate and low OTA server utilization in existing OTA upgrade technologies.
[0004] In a first aspect, embodiments of this application provide an OTA upgrade method, including:
[0005] If an upgrade information packet is received from the OTA server based on the Nth request information, a request message is sent to the OTA server for the N+1th time according to the query interval to confirm whether the upgrade information packet has been updated, where N≥1; wherein, the upgrade information packet includes the set upgrade time period, the query interval, and the upgrade confirmation result; the query interval is determined by the OTA server based on the distance from the upgrade time and the set span time.
[0006] During the N+1th query of the OTA server, a decision is made on whether to perform the upgrade action based on the current system time, the upgrade confirmation result, and the upgrade time period.
[0007] In some embodiments, the query interval is determined by the OTA server based on the distance to the upgrade and a set span duration, including:
[0008] The query interval is determined by the OTA server based on the result of dividing the distance upgrade time by the set span time.
[0009] In some embodiments, the query interval includes a modified query interval and a regular query interval;
[0010] The query interval is determined by the OTA server based on the result of dividing the distance to the upgrade by a set span duration, including:
[0011] If the distance upgrade time is divided by the span time and a remainder is obtained, the remainder is used as the corrected query interval and the span time is used as the regular query interval; otherwise, both the corrected query interval and the regular query interval are the span time.
[0012] The step of sending a request to the OTA server for the N+1th time according to the query interval to confirm whether the upgrade information package has been updated includes:
[0013] If N=1, a request message is sent to the OTA server for the N+1th time according to the modified query interval;
[0014] If N > 1, a request message is sent to the OTA server for the (N+1)th time according to the regular query interval.
[0015] In some embodiments, the upgrade confirmation result includes: the processing status of the OTA server;
[0016] Before obtaining the upgrade information packet returned by the OTA server, the process also includes:
[0017] Send a request message to the OTA server to determine whether the interaction with the OTA server was successful;
[0018] If the interaction fails, wait for a first set time period and then resend the request information to the OTA server, and update the time point for the next request information to be sent to t; t = t0 + Tl, where t0 represents the time point for resending the request information, T represents the regular query interval, and l represents the first set time period.
[0019] If the interaction is successful, and the OTA server is confirmed to be busy based on its processing status, then the request information is resent to the OTA server after waiting for k times the second set time, where k is the number of consecutive confirmations that the OTA server is busy, M≥k≥1, and M is the set maximum number of reconnections.
[0020] In some embodiments, the upgrade confirmation result includes information on whether or not to upgrade;
[0021] When querying the OTA server for the (N+1)th time, the process of determining whether to execute the upgrade action based on the current system time, the upgrade confirmation result, and the upgrade time period includes:
[0022] If the upgrade confirmation information indicates an upgrade, and the current system time is not within the upgrade time period, then prompt the user to perform the upgrade action.
[0023] If the upgrade confirmation information indicates an upgrade, and the current system time point is within the upgrade time period, then the upgrade action will be forcibly executed.
[0024] In some embodiments, when the upgrade confirmation information indicates an upgrade, the upgrade confirmation result further includes: the upgrade package download address;
[0025] The execution of the upgrade action includes:
[0026] Download the upgrade file according to the upgrade package download address returned by the OTA server;
[0027] Perform an MD5 check on the file to be upgraded. If the check is successful, confirm the call to the upgrade interface to perform the upgrade.
[0028] In some embodiments, the upgrade time period includes an upgrade start time and an upgrade end time; the upgrade distance duration is the time interval between the time when the first request is sent to the OTA server after connecting to the network and the upgrade start time; the span duration is determined according to the processing cycle of a single upgrade action.
[0029] Secondly, embodiments of this application provide an OTA upgrade device, comprising:
[0030] The request sending module is used to send a request to the OTA server for the N+1th time according to the query interval when it receives the upgrade information packet returned by the OTA server based on the Nth request information, in order to confirm whether the upgrade information packet has been updated, where N≥1; wherein, the upgrade information packet includes a set upgrade time period, a query interval, and an upgrade confirmation result; the query interval is determined based on the distance from the upgrade time and the set span time.
[0031] The upgrade information acquisition module is used to acquire the upgrade information packet returned by the OTA server;
[0032] The upgrade confirmation module is used to confirm whether to perform the upgrade action when querying the OTA server for the N+1th time, based on the current system time, the upgrade confirmation result, and the upgrade time period.
[0033] Thirdly, embodiments of this application provide an OTA upgrade system, including:
[0034] OTA server and at least one embedded device;
[0035] The OTA server stores the files to be upgraded;
[0036] The embedded device is used to implement an OTA upgrade method provided in the first aspect of this application.
[0037] Fourthly, embodiments of this application provide an embedded device, the embedded device including a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement an OTA upgrade method provided in the first aspect of this application.
[0038] Fifthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed on a processor, implements an OTA upgrade method provided in the first aspect of this application.
[0039] The embodiments of this application have the following beneficial effects:
[0040] This application obtains the upgrade information packet returned by the OTA server, wherein the upgrade information packet includes a set upgrade time period, a query interval, and an upgrade confirmation result; the query interval is determined by the OTA server based on the result of dividing the time remaining before the upgrade by a set span duration; during the (N+1)th query to the OTA server, it is determined whether to execute the upgrade action based on the current system time, the upgrade confirmation result, and the upgrade time period. In this application, because the initial request to the OTA server occurs at different times, and the query interval is determined by dividing the time remaining before the upgrade by the set span duration, the times when different embedded devices request the OTA server are staggered, greatly improving the utilization rate of the OTA server and also increasing the success rate of OTA upgrades. Attached Figure Description
[0041] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0042] Figure 1 A flowchart of an OTA upgrade method according to an embodiment of this application is shown;
[0043] Figure 2 Another flowchart of the OTA upgrade method according to an embodiment of this application is shown;
[0044] Figure 3 A schematic diagram of an OTA upgrade system according to an embodiment of this application is shown;
[0045] Figure 4A schematic diagram of an OTA upgrade device according to an embodiment of this application is shown.
[0046] Explanation of key component symbols:
[0047] 100 - OTA server; 200 - Embedded device; 210 - Request sending module; 220 - Upgrade information acquisition module; 230 - Upgrade confirmation module. Detailed Implementation
[0048] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments.
[0049] The components of the embodiments of this application described and illustrated in the accompanying drawings can be arranged and designed in a variety of different configurations. Therefore, the following detailed description of the embodiments of this application provided in the drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.
[0050] In the following text, the terms "comprising," "having," and their cognates, which may be used in various embodiments of this application, are intended only to indicate a particular feature, number, step, operation, element, component, or combination thereof, and should not be construed as primarily excluding the presence of one or more other features, numbers, steps, operations, elements, components, or combinations thereof, or adding the possibility of one or more combinations thereof. Furthermore, the terms "first," "second," "third," etc., are used only for distinguishing descriptions and should not be construed as indicating or implying relative importance.
[0051] Unless otherwise specified, all terms used herein (including technical and scientific terms) shall have the same meaning as commonly understood by one of ordinary skill in the art to which the various embodiments of this application pertain. Terms (such as those defined in commonly used dictionaries) shall be interpreted as having the same meaning as in their contextual meaning in the relevant technical field and shall not be construed as having an idealized or overly formal meaning, unless clearly defined in the various embodiments of this application.
[0052] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0053] When upgrading existing embedded devices, a large number of embedded devices may request OTA (Over-The-Air) updates simultaneously, causing excessive server load and abnormal upgrades. This results in low OTA upgrade success rates and low OTA server utilization. Therefore, this application proposes an OTA upgrade method, apparatus, system, and embedded device that can effectively solve the problems of low OTA upgrade success rates and low OTA server utilization in existing OTA upgrade technologies.
[0054] The OTA upgrade method will be explained below with reference to some specific examples.
[0055] Figure 1 A flowchart of an OTA upgrade method according to an embodiment of this application is shown. Exemplarily, the method is applicable to an embedded device that uses an OTA server 100 for upgrades. The OTA upgrade method includes the following steps:
[0056] S10, send a request message to OTA server 100.
[0057] After the embedded device 200 powers on and successfully connects to the network, it sends a request to the OTA server 100 for the first time. The request includes version query information, its own product model, and current version information. Specifically, the request information is assembled into an HTTP GET request and sent to the OTA server 100.
[0058] If the embedded device 200 successfully interacts with the OTA server 100, the OTA server 100 should return an upgrade information packet, and the OTA server 100 needs to record the time point when it was first requested by the embedded device 200.
[0059] S20, if the upgrade information packet returned by the OTA server 100 according to the Nth request information is obtained, then a request information is sent to the OTA server 100 for the (N+1)th time according to the query interval to confirm whether the upgrade information packet has been updated, where N≥1. That is, after the first request, a request information is sent to the OTA server 100 according to the query interval. Specifically, a request information is sent to the OTA server 100 once for each interval corresponding to the query interval. The Nth request information is also sent by the embedded device itself.
[0060] The upgrade information package includes a set upgrade time period, a query interval, and an upgrade confirmation result. That is, the upgrade time period and the query interval are both set by the OTA server 100, and the upgrade confirmation result is also returned by the OTA server 100 based on conditions. Specifically, the upgrade time period includes an upgrade start time and an upgrade end time, and the query interval is determined by the OTA server 100 by dividing the distance to the upgrade duration by a set span duration. The distance to the upgrade duration is the time interval between the time when the first request is sent to the OTA server 100 after network connection and the upgrade start time. The span duration is determined based on the processing cycle of a single upgrade action. The processing cycle of a single upgrade action is the total time taken for the entire process from the start to the end of the upgrade for a certain processing priority.
[0061] Step S20, which involves confirming whether the upgrade information package has been updated, includes: if the set upgrade time period is updated and the query interval is updated, then the upgrade information package is confirmed to be updated; otherwise, the upgrade information package is confirmed to be not updated.
[0062] In one implementation, the query interval includes a modified query interval and a regular query interval.
[0063] The aforementioned query interval is determined by the OTA server 100 based on the result of dividing the distance to the upgrade by a set span duration, including:
[0064] The distance upgrade duration is divided by the span duration. If a remainder is obtained, the remainder is used as the corrected query interval, and the span duration is used as the regular query interval. Otherwise, both the corrected query interval and the regular query interval are the span duration. Furthermore, the span duration is twice the processing cycle of a single upgrade action.
[0065] For example, if the upgrade period is set from 2 PM to 5 PM, and each upgrade of a single embedded device takes 10 minutes, then the span duration is set to 20 minutes. This 20-minute span is because from the start of the upgrade process to its completion, the last upgrade within the initial 10 minutes will take another 10 minutes to complete. Therefore, the time interval for the next query is calculated by subtracting the first request reporting time from 2 PM, dividing by 20, and taking the remainder. This adjusts the query interval to ensure that the next request time falls between 2 PM and 2:10 PM. Subsequent requests will then begin between 2:20 PM and 2:40 PM, and so on until 5 PM. For example, embedded device 200 is powered on and first queries at 18:47. OTA server 100 wants embedded device 200 to upgrade at 2:05, with a fixed interval of 20 minutes. The calculated next interval is 13min + 7*60min + 5min = 438min / 20min = 21 remainder 18. Therefore, the next interval is 18:47 + 18, which is 19:05. Subsequent requests will be executed at 20-minute intervals. Furthermore, if the division is exact with no remainder, the same 20-minute interval will still be used.
[0066] Step S20, which involves sending a request to the OTA server 100 for the N+1th time according to the query interval to confirm whether the upgrade information packet has been updated, includes:
[0067] If N=1, a request message is sent to the OTA server 100 for the N+1th time according to the modified query interval; that is, after the first request message is sent and the query interval information is obtained, the request message is sent a second time after the modified query interval.
[0068] If N > 1, a request is sent to the OTA server 100 for the (N+1)th time according to the regular query interval. That is, after the second request is sent, a request is sent once every regular query interval.
[0069] S30, when querying the OTA server 100 for the N+1th time, determine whether to perform the upgrade action based on the current system time, the upgrade confirmation result, and the upgrade time period.
[0070] In one implementation, the upgrade confirmation result includes the processing status of the OTA server 100.
[0071] Before obtaining the upgrade information packet returned by the OTA server 100, the following steps are also included:
[0072] (1) Send a request message to the OTA server to determine whether the interaction with the OTA server 100 is successful.
[0073] (2) If the interaction fails, wait for the first set time and then resend the request information to the OTA server 100, and update the time point of the next request information to be t; t = t0 + Tl, where t0 represents the time point of resending the request information, T represents the regular query interval, l represents the first set time, for example l is 5 minutes, T is 20 minutes, t0 is 2:20, then t is 2:35.
[0074] Interaction failure includes at least one of the following factors:
[0075] When assembling the requested information, obtaining its own model failed;
[0076] The request information was resent more than the maximum number of reconnections M;
[0077] SSL socket creation failed;
[0078] Connect write / read connection to OTA server 100 failed;
[0079] The interaction with the OTA server 100 was successful, but the upgrade confirmation result included information indicating that the file to be upgraded did not exist. If the OTA server 100 does not have the file to be upgraded, it returns an error_notexist to indicate that the file to be upgraded does not exist.
[0080] (3) If the interaction is successful and the OTA server 100 is confirmed to be busy according to the processing status of the OTA server 100, then wait k times the second set time before resending the request information to the OTA server 100. k is the number of times the OTA server 100 is confirmed to be busy, M≥k≥1, and M is the set maximum number of reconnections.
[0081] In one implementation, the upgrade confirmation result includes information confirming whether or not an upgrade has been performed.
[0082] Step S30, which involves confirming whether to execute an upgrade action during the (N+1)th query of the OTA server 100, based on the current system time, the upgrade confirmation result, and the upgrade time period, includes:
[0083] If the upgrade confirmation information indicates an upgrade, and the current system time is not within the upgrade time period, then a prompt will be made to perform the upgrade action; for example, a pop-up dialog box will appear, allowing the user to choose whether to upgrade.
[0084] If the upgrade confirmation information indicates an upgrade, and the current system time point is within the upgrade time period, then the upgrade action will be forcibly executed.
[0085] Furthermore, when the upgrade confirmation information indicates an upgrade, the upgrade confirmation result also includes: the upgrade package download address.
[0086] The execution of the upgrade action includes:
[0087] Download the upgrade file according to the upgrade package download address returned by the OTA server 100;
[0088] The file to be upgraded is subjected to MD5 verification. If the verification is successful, the upgrade interface is called to perform the upgrade. In one embodiment, in addition to performing MD5 verification on the file to be upgraded, the size of the file to be upgraded also needs to be obtained. The size of the current file in the embedded device 200 is compared with that of the file to be upgraded. If the two sizes are the same, the comparison is considered successful.
[0089] The request information also includes current version information; the current version information is used by the OTA server 100 to determine the upgrade confirmation information based on the latest version information and the current version information.
[0090] The OTA upgrade method of this application is illustrated below with a specific example, such as... Figure 2 As shown:
[0091] After the S110 embedded device 200 starts its process, it assembles an HTTP GET request and sends it to the OTA server 100.
[0092] An HTTP GET request is essentially a request for information, which includes version query information, the product model, and the current version information. The current version information is used by the OTA server 100 to determine whether or not to proceed with the upgrade based on the latest version information and the current version information.
[0093] S120, determine whether the interaction with the OTA server 100 was successful.
[0094] If the interaction with the OTA server 100 is successful, the OTA server 100 will send an upgrade information packet back to the embedded device 200 based on its processing status. The processing status of the OTA server 100 includes a busy state (load exceeds a set threshold) and a normal working state (load does not exceed a set threshold). The upgrade information packet includes the set upgrade time period, query interval, and upgrade confirmation result.
[0095] When the OTA server 100 is in a busy state, the upgrade confirmation result includes the processing status of the OTA server 100; the processing status includes busy state and normal working state.
[0096] When the OTA server 100 is in normal working condition, the upgrade confirmation result includes upgrade confirmation information, which includes upgrade and no upgrade.
[0097] When the OTA server 100 is in normal working condition and needs to be upgraded, the upgrade confirmation result includes the upgrade and the upgrade package download address.
[0098] S130, if the interaction with the OTA server 100 fails, the request information is sent to the OTA server 100 again after a first set time, for example, after 300 seconds.
[0099] S140, if the interaction with the OTA server 100 is successful and the OTA server 100 is in a busy state, then wait k times the second set time before resending the request information to the OTA server 100. k is the number of consecutive confirmations that the OTA server 100 is busy, M ≥ k ≥ 1, and M is the set maximum number of reconnections. For example, if M = 3, after the first attempt waits 60 seconds and resends the request information, the OTA server 100 is still busy; after the second attempt waits 120 seconds and resends the request information, the OTA server 100 is still busy; after the third attempt waits 180 seconds and resends the request information, the OTA server 100 is still busy.
[0100] S150: If the interaction with the OTA server 100 is successful and the processing status of the OTA server 100 is normal, then the OTA server 100 is periodically queried according to the query interval to check whether the upgrade time period and query interval have changed. If they have changed, the query interval and upgrade time period in the embedded device 200 are updated in a timely manner.
[0101] S160, if an upgrade is confirmed based on the upgrade confirmation result, and the current system time is not within the upgrade time period, an upgrade action is prompted; if the current system time is within the upgrade time period, the upgrade action is forcibly executed. Executing the upgrade action specifically includes downloading the file to be upgraded from the upgrade package download address returned by the OTA server 100; performing an MD5 checksum on the file to be upgraded and comparing its size; if the checksum is successful, confirming the invocation of the upgrade interface for upgrade.
[0102] Compared to the common timed query method, this application uses the OTA server 100 to determine the next query time based on the time remaining until the upgrade and the set time span. This can effectively reduce the pressure distribution of queries and improve server utilization.
[0103] Figure 3A schematic diagram of an OTA upgrade system according to an embodiment of this application is shown. Exemplarily, the system includes: an OTA server 100 and at least one embedded device 200.
[0104] The OTA server 100 stores files to be upgraded.
[0105] The embedded device 200 is used to implement the OTA upgrade method of this embodiment.
[0106] It is understood that the device in this embodiment corresponds to the OTA upgrade method in the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described again here.
[0107] Figure 4 A schematic diagram of an OTA upgrade device according to an embodiment of this application is shown. Exemplarily, the OTA upgrade device includes: a request sending module 210, an upgrade information acquisition module 220, and an upgrade confirmation module 230.
[0108] The request sending module 210 is used to send a request message to the OTA server 100 for the N+1th time according to the query interval when it receives the upgrade information packet returned by the OTA server 100 according to the Nth request information, in order to confirm whether the upgrade information packet has been updated, where N≥1; wherein, the upgrade information packet includes a set upgrade time period, a query interval and an upgrade confirmation result; the query interval is determined according to the distance from the upgrade time and the set span time.
[0109] The upgrade information acquisition module 220 is used to acquire the upgrade information packet returned by the OTA server 100.
[0110] The upgrade confirmation module 230 is used to confirm whether to perform the upgrade action when querying the OTA server 100 for the N+1th time, based on the current system time, the upgrade confirmation result, and the upgrade time period.
[0111] It is understood that the device in this embodiment corresponds to the OTA upgrade method in the above embodiment, and the options in the above embodiment are also applicable to this embodiment, so they will not be described again here.
[0112] This application also provides an embedded device 200, which, exemplary, includes a processor and a memory, wherein the memory stores a computer program, and the processor executes the computer program to enable the embedded device 200 to perform the functions of the various modules in the above-described OTA upgrade method or the above-described OTA upgrade device.
[0113] The processor can be an integrated circuit chip with signal processing capabilities. The processor can be a general-purpose processor, including at least one of a Central Processing Unit (CPU), Graphics Processing Unit (GPU), Network Processor (NP), Digital Signal Processor (DSP), Application-Specific Integrated Circuit (ASIC), Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. The general-purpose processor can be a microprocessor or any conventional processor, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this application.
[0114] The memory can be, but is not limited to, Random Access Memory (RAM), Read Only Memory (ROM), Programmable Read-Only Memory (PROM), Erasable Programmable Read-Only Memory (EPROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), etc. The memory is used to store computer programs, and the processor can execute the computer programs accordingly after receiving execution instructions.
[0115] This application also provides a readable storage medium for storing the computer program used in the embedded device 200 described above.
[0116] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the flowcharts and block diagrams in the accompanying drawings show the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that, in alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0117] In addition, the functional modules or units in the various embodiments of this application can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0118] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a smartphone, personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0119] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. An OTA upgrade method, characterized in that, include: If an upgrade information packet is received from the OTA server based on the Nth request, a request is sent to the OTA server for the (N+1)th time according to the query interval to confirm whether the upgrade information packet has been updated, where N≥1; wherein, the upgrade information packet includes a set upgrade time period, the query interval, and the upgrade confirmation result; the query interval is determined by the OTA server based on the result of dividing the distance to the upgrade duration by a set span duration; the distance to the upgrade duration is the time interval between the time point when the first request is sent to the OTA server after network connection and the upgrade start time point; the span duration is determined based on the processing cycle of a single upgrade action; When querying the OTA server for the N+1th time, determine whether to perform the upgrade action based on the current system time, the upgrade confirmation result, and the upgrade time period; The query interval includes a modified query interval and a regular query interval; the determination of the query interval includes: dividing the distance upgrade duration by the span duration, and if a remainder is obtained, the remainder is used as the modified query interval and the span duration is used as the regular query interval; otherwise, both the modified query interval and the regular query interval are the span duration. The step of sending a request message to the OTA server for the N+1th time according to the query interval to confirm whether the upgrade information package has been updated includes: if N=1, sending a request message to the OTA server for the N+1th time according to the modified query interval; if N>1, sending a request message to the OTA server for the N+1th time according to the regular query interval.
2. The OTA upgrade method according to claim 1, characterized in that, The upgrade confirmation result includes: the processing status of the OTA server; Before obtaining the upgrade information packet returned by the OTA server, the process also includes: Send a request message to the OTA server to determine whether the interaction with the OTA server was successful; If the interaction fails, wait for the first set time period and then resend the request information to the OTA server, and update the time point of the next request information to be t. t = t 0+ T - l Where t0 represents the time point when the request information is resent, and T represents the regular query interval. l Indicates the first set duration; If the interaction is successful, and the OTA server is confirmed to be busy based on its processing status, then the request information is resent to the OTA server after waiting for k times the second set time, where k is the number of consecutive confirmations that the OTA server is busy, M≥k≥1, and M is the set maximum number of reconnections.
3. The OTA upgrade method according to claim 1, characterized in that, The upgrade confirmation result includes information on whether or not the upgrade has been performed; When querying the OTA server for the (N+1)th time, the process of determining whether to execute the upgrade action based on the current system time, the upgrade confirmation result, and the upgrade time period includes: If the upgrade confirmation information indicates an upgrade, and the current system time is not within the upgrade time period, then prompt the user to perform the upgrade action. If the upgrade confirmation information indicates an upgrade, and the current system time point is within the upgrade time period, then the upgrade action will be forcibly executed.
4. The OTA upgrade method according to claim 3, characterized in that, When the upgrade confirmation information indicates an upgrade, the upgrade confirmation result also includes: the upgrade package download address; The execution of the upgrade action includes: Download the upgrade file according to the upgrade package download address returned by the OTA server; Perform an MD5 check on the file to be upgraded. If the check is successful, confirm the call to the upgrade interface to perform the upgrade.
5. The OTA upgrade method according to any one of claims 1 to 4, characterized in that, The upgrade time period includes the upgrade start time and the upgrade end time.
6. An OTA upgrade device, characterized in that, include: The request sending module is used to send a request message to the OTA server for the N+1th time according to the query interval when it receives the upgrade information packet returned by the OTA server based on the Nth request information, to confirm whether the upgrade information packet has been updated, where N≥1; wherein, the upgrade information packet includes a set upgrade time period, a query interval, and an upgrade confirmation result; the query interval is determined by dividing the distance to the upgrade time by a set span time; the distance to the upgrade time is the time interval between the time point when the first request is sent to the OTA server after network connection and the upgrade start time; the span time is determined according to the processing cycle of a single upgrade action; The upgrade information acquisition module is used to acquire the upgrade information packet returned by the OTA server; The upgrade confirmation module is used to confirm whether to perform the upgrade action when querying the OTA server for the N+1th time, based on the current system time, the upgrade confirmation result, and the upgrade time period. The query interval includes a modified query interval and a regular query interval; the determination of the query interval includes: dividing the distance upgrade duration by the span duration, and if a remainder is obtained, the remainder is used as the modified query interval and the span duration is used as the regular query interval; otherwise, both the modified query interval and the regular query interval are the span duration. The step of sending a request message to the OTA server for the N+1th time according to the query interval to confirm whether the upgrade information package has been updated includes: if N=1, sending a request message to the OTA server for the N+1th time according to the modified query interval; if N>1, sending a request message to the OTA server for the N+1th time according to the regular query interval.
7. An OTA upgrade system, characterized in that, include: OTA server and at least one embedded device; The OTA server stores the files to be upgraded; The embedded device is used to implement the OTA upgrade method according to any one of claims 1-5.
8. An embedded device, characterized in that, The embedded device includes a processor and a memory, the memory storing a computer program, and the processor executing the computer program to implement the OTA upgrade method according to any one of claims 1-5.