Message processing method, system and device, medium and program product
By initializing and accumulating historical serial number information in the baseband chip to assign serial numbers to messages, and combining timers and threshold management, the problem of serial number rollback is solved, thus achieving storage continuity and extending the lifespan of Flash memory.
Patent Information
- Application Number
- CN202511324876.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-16
- Publication Date
- 2025-12-12
AI Technical Summary
Because the Flash storage space of the baseband chip is limited and frequent read and write operations will shorten its lifespan, the existing technology is prone to the problem of serial number rollback when the terminal device is abnormally restarted.
By obtaining historical serial number information from the target storage unit, the current serial number information in the initial storage unit is initialized based on it, and the target serial number is assigned to the message information in a sequentially accumulated manner. The message information is stored sequentially using the historical serial number information as the starting point, and the allocation and storage of serial numbers are managed in combination with timers and thresholds.
It effectively solves the serial number rollback problem, improves storage continuity, reduces instantaneous peak traffic, prevents serial number wrap-around errors, and extends the lifespan of Flash memory.
Smart Images

Figure CN121125665A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing, and in particular to a message processing method, system, device, medium, and program product. Background Technology
[0002] Given the limited Flash storage space integrated in baseband chips and cost considerations, terminal devices typically do not have external Flash memory. Therefore, directly storing generated data packets in Flash is impractical. Furthermore, frequent read / write operations on Flash not only accelerate wear and tear but also shorten its lifespan. To address this challenge, a timed saving strategy is commonly used. However, if the packet sequence number reported to the server is not saved to Flash in a timely manner when the device experiences an abnormal restart, the server may receive duplicate packet sequence numbers, resulting in sequence number rollback. Summary of the Invention
[0003] The technical problem to be solved by this disclosure is to overcome the defects of serial number rollback in the prior art and to provide a message processing method, system, device, medium and program product.
[0004] This disclosure solves the above-mentioned technical problems through the following technical solution:
[0005] According to a first aspect of this disclosure, a message processing method is provided, the message processing method comprising:
[0006] Obtain historical serial number information from the target storage unit, and initialize the current serial number information in the initial storage unit based on the historical serial number information;
[0007] Based on the current serial number information, target serial number information is assigned to different message information in a sequentially accumulated manner; wherein, the target serial number information assigned to the last message information is used as the current serial number information;
[0008] Starting with the historical serial number information, the corresponding current serial number information is obtained sequentially, and the corresponding message information is stored in the target storage unit sequentially; wherein, the target serial number information corresponding to the last message information stored in the target storage unit is used as the historical serial number information.
[0009] Optionally, the message processing method further includes:
[0010] If the message information is present in the initial storage unit within a preset time interval, the step of obtaining the historical serial number information in the target storage unit is executed.
[0011] Optionally, the preset time interval can be set based on a timer.
[0012] Optionally, the message processing method further includes:
[0013] Obtain the quantity information corresponding to the message information in the initial storage unit;
[0014] In response to the quantity information being greater than a first threshold, the message information and the corresponding current serial number information stored in the initial storage unit are stored in the target storage unit in a first-in-first-out manner.
[0015] Optionally, after the step of obtaining the current serial number information in the initial storage unit, the message processing method further includes:
[0016] In response to the current serial number information being greater than a target threshold, the current serial number information is reset. According to a second aspect of this disclosure, a message processing system is provided, the processing system comprising:
[0017] The acquisition module is used to acquire historical serial number information in the target storage unit and initialize the current serial number information in the initial storage unit based on the historical serial number information;
[0018] The allocation module is used to allocate corresponding target serial number information to different message information in a sequentially accumulated manner based on the current serial number information; wherein, the target serial number information allocated to the last message information is used as the current serial number information;
[0019] The storage module is used to sequentially obtain the corresponding current serial number information, starting with the historical serial number information, and sequentially store the corresponding message information into the target storage unit; wherein, the target serial number information corresponding to the last message information stored in the target storage unit is used as the historical serial number information.
[0020] Optionally, the acquisition module is further configured to perform the step of acquiring the historical serial number information in the target storage unit in response to the initial storage unit containing the message information within the preset time interval.
[0021] Optionally, the preset time interval can be set based on a timer.
[0022] Optionally, the acquisition module is further configured to:
[0023] Obtain the quantity information corresponding to the message information in the initial storage unit;
[0024] In response to the quantity information being greater than a first threshold, the message information and the corresponding current serial number information stored in the initial storage unit are stored in the target storage unit in a first-in-first-out manner.
[0025] Optionally, the message processing system further includes a reset module, which is used to reset the current serial number information in response to the current serial number information being greater than a target threshold after the current serial number information in the initial storage unit is obtained.
[0026] According to a third aspect of this disclosure, a baseband chip is provided, the baseband chip including the message processing system described in the second aspect of this disclosure.
[0027] According to a fourth aspect of this disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and for running on the processor, wherein the processor executes the computer program to implement the message processing method described in the first aspect of this disclosure.
[0028] According to a fifth aspect of this disclosure, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the message processing method described in the first aspect of this disclosure.
[0029] According to a sixth aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the message processing method described in the first aspect of this disclosure.
[0030] Based on common knowledge in the field, the above-mentioned preferred conditions can be combined arbitrarily to obtain various preferred embodiments of this disclosure.
[0031] The positive and progressive effects of this disclosure are as follows:
[0032] By obtaining the historical serial number information stored in the target storage unit, it is possible to store the data sequentially starting from the historical serial number information, effectively solving the problem of serial number rollback. Attached Figure Description
[0033] Figure 1 This is a flowchart illustrating the message processing method provided in Embodiment 1 of this disclosure;
[0034] Figure 2 This is a flowchart illustrating the application provided in Embodiment 1 of this disclosure;
[0035] Figure 3 This is a schematic diagram of the message processing system provided in Embodiment 2 of this disclosure;
[0036] Figure 4This is a schematic diagram of the structure of the electronic device provided in Embodiment 4 of this disclosure. Detailed Implementation
[0037] The present disclosure is further illustrated below by way of embodiments, but the present disclosure is not limited to the scope of the embodiments described herein.
[0038] The prefixes such as "first" and "second" used in this disclosure are merely for distinguishing different descriptive objects and do not limit the position, order, priority, quantity, or content of the described objects. The use of ordinal numbers and other prefixes used to distinguish descriptive objects in this disclosure does not constitute a limitation on the described objects. The description of the described objects is given in the claims or the context of the embodiments, and should not be construed as an unnecessary limitation. Furthermore, in the description of this embodiment, unless otherwise stated, "multiple" means two or more.
[0039] Example 1
[0040] like Figure 1 As shown, according to a first aspect of this disclosure, a message processing method is provided, the message processing method comprising:
[0041] S11: Obtain the historical serial number information in the target storage unit, and initialize the current serial number information in the initial storage unit based on the historical serial number information;
[0042] S12: Based on the current serial number information, assign corresponding target serial number information to different message information in a sequentially accumulated manner; wherein, the target serial number information assigned to the last message information is used as the current serial number information;
[0043] S13: Starting with the historical serial number information, sequentially obtain the corresponding current serial number information, and sequentially store the corresponding message information into the target storage unit; wherein, the target serial number information corresponding to the last message information stored in the target storage unit is used as the historical serial number information.
[0044] The initial storage unit is memory, and the target storage unit is flash.
[0045] Specifically, during operation, the current serial number information is initialized with the historical serial number information in the target storage unit, and the corresponding serial numbers are assigned to different message information in sequence, starting with the current serial number information; during storage, the message corresponding to the current serial number information is obtained in sequence and stored, starting with the historical serial number information.
[0046] By obtaining the historical serial number information stored in the target storage unit, it is possible to store the data sequentially starting from the historical serial number information, effectively solving the problem of serial number rollback.
[0047] The message processing method in this embodiment also includes:
[0048] In response to the presence of message information in the initial storage unit within a preset time interval, the step of obtaining historical serial number information in the target storage unit is executed.
[0049] In one implementation, a preset time interval is set based on a timer.
[0050] By setting a timer to cache randomly generated messages and then uploading them in batches at regular intervals, the instantaneous peak traffic is further reduced, and the transmission success rate is improved.
[0051] The message processing method in this embodiment also includes:
[0052] Obtain the quantity information corresponding to the message information in the initial storage unit;
[0053] In response to the quantity information exceeding the first threshold, the message information and the corresponding current serial number information stored in the initial storage unit are stored in the target storage unit in a first-in-first-out manner.
[0054] In this embodiment, after obtaining the current serial number information in the initial storage unit, the message processing method further includes:
[0055] If the current serial number is greater than the target threshold, reset the current serial number.
[0056] By resetting the serial number information, the serial number wrapping error is prevented, and the bit width limitation problem is solved by periodically resetting.
[0057] The implementation principle of the message processing method in this embodiment is explained below with specific implementation methods:
[0058] The message is first recorded in memory, and each message is assigned a serial number (the serial number starts from 0X0000, increments by 1 each time it is used, up to a maximum of 0XFFFF, then returns to 0X0000 and continues to increment), and then reported to the server.
[0059] Due to poor network conditions, a large number of packets may accumulate in memory, or packets may be generated too quickly, leading to a large accumulation of packets in memory. Only when the number of packets in memory exceeds a certain threshold (which can be set) will the system consider storing the packets in memory into flash memory.
[0060] Use serial number variables A, B, and C. Serial number variable A is used for storage, serial number variable B is used to assign serial numbers to messages, and serial number variable C is the current message serial number that needs to be saved.
[0061] The serial number storage strategy is as follows:
[0062] 1. After a message is successfully sent, save the serial number variable C of the currently reported message. The saving logic is as follows: if the serial number variable C of the currently reported message is less than or equal to 0XFFFF and the serial number variable C is greater than the serial number variable A, then assign the value of the serial number variable C to the serial number variable A. If the value of the serial number variable A is greater than or equal to 0XFFFF at this time, then reset the value of the serial number variable A to 0X0000, and then save the serial number variable A.
[0063] 2. When the number of messages in memory exceeds a certain amount and needs to be stored in flash, save the serial number of these messages, and save the logic according to the method of strategy 1.
[0064] 3. Optimized timed save logic: When the timer expires, if a serial number needs to be saved, save the serial number and restart the timer; if no serial number needs to be saved (possibly because no new message was generated or it was just saved), no saving action is required, but the timer needs to be restarted. The saving logic is as follows: if the current serial number variable B to be stored is 0x0000, then assign 0x0000 to the serial number variable A; otherwise, decrement the current serial number variable B by 1 and assign it to the serial number variable A, then save the serial number variable A.
[0065] Serial number retrieval logic:
[0066] 1. After the device is powered on, if the currently stored serial number variable A is 0X0000, then the serial number variable B is assigned the value 0X0000; otherwise, the currently stored serial number variable A is incremented by 1 and then assigned to the serial number variable B. If the serial number variable B is greater than 0XFFFF, then the serial number variable B is reset to 0X0000.
[0067] 2. During normal operation of the equipment, a serial number variable B is used to assign a serial number to each message. After assignment, the serial number variable B is incremented by 1, with a maximum value of 0XFFFF, and then returns to 0X0000 to continue incrementing.
[0068] The specific message data processing flow is as follows: Figure 2 As shown, the device initializes upon power-on, reads flash data, obtains the saved serial number, assigns the serial number to the generated message, and increments the serial number by 1. The serial number saving logic is as follows: if the message is successfully sent, the message needs to be stored in flash, or the timer expires, the serial number is saved when any of the following conditions are met. The problem of serial number rollback is solved by the cooperation of the serial number variables A, B, and C.
[0069] Example 2
[0070] Corresponding to the aforementioned message processing method embodiments, this disclosure also provides embodiments of a message processing system.
[0071] like Figure 3 As shown, this embodiment provides a message processing system, which includes:
[0072] The acquisition module 100 is used to acquire historical serial number information in the target storage unit and initialize the current serial number information in the initial storage unit based on the historical serial number information;
[0073] The allocation module 200 is used to allocate corresponding target serial number information to different message information in a sequentially accumulated manner based on the current serial number information; wherein, the target serial number information allocated to the last message information is used as the current serial number information;
[0074] The storage module 300 is used to sequentially obtain the corresponding current serial number information starting from the historical serial number information, and sequentially store the corresponding message information into the target storage unit; wherein, the target serial number information corresponding to the message information last stored in the target storage unit is used as the historical serial number information.
[0075] In this embodiment, the acquisition module 100 is further configured to, in response to the presence of message information in the initial storage unit within a preset time interval, execute the step of acquiring historical serial number information in the target storage unit.
[0076] In this embodiment, a preset time interval is set based on a timer.
[0077] The acquisition module in this embodiment is also used for:
[0078] Obtain the quantity information corresponding to the message information in the initial storage unit;
[0079] In response to the quantity information exceeding the first threshold, the message information and the corresponding current serial number information stored in the initial storage unit are stored in the target storage unit in a first-in-first-out manner.
[0080] The message processing system in this embodiment also includes a reset module 400. The reset module 400 is used to reset the current serial number information after obtaining the current serial number information in the initial storage unit, in response to the current serial number information being greater than the target threshold.
[0081] The message processing system in this embodiment can obtain the historical serial number information stored in the target storage unit, and can store the data sequentially starting from the historical serial number information, effectively solving the problem of serial number rollback.
[0082] For the system embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to in the description of the method embodiments. The system embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this disclosure according to actual needs.
[0083] Example 3
[0084] This embodiment provides a baseband chip that can simultaneously acquire current serial number information and historical serial number information, establish dual reference points, and store them sequentially starting from the historical serial number information. This ensures storage continuity while solving the problem of serial number rollback.
[0085] Example 4
[0086] Figure 4 This is a schematic diagram of the structure of an electronic device according to Embodiment 3 of this disclosure. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the methods described in the above embodiments. Figure 4 The electronic device 30 shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments disclosed herein.
[0087] like Figure 4 As shown, the electronic device 30 can be represented in the form of a general computing device, such as a server device. The components of the electronic device 30 may include, but are not limited to: at least one processor 31, at least one memory 32, and a bus 33 connecting different system components (including memory 32 and processor 31).
[0088] Bus 33 includes a data bus, an address bus, and a control bus.
[0089] The memory 32 may include volatile memory, such as random access memory (RAM) 321 and / or cache memory 322, and may further include read-only memory (ROM) 323.
[0090] The memory 32 may also include a program / utility 325 having a set (at least one) of program modules 324, including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0091] The processor 31 performs various functional applications and data processing, such as the methods described in the above embodiments of this disclosure, by running computer programs stored in the memory 32.
[0092] Electronic device 30 can also communicate with one or more external devices 34 (e.g., keyboard, pointing device, etc.). This communication can be performed via input / output (I / O) interface 35. Furthermore, the model-generating device 30 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 36. Figure 4 As shown, network adapter 36 communicates with other modules of the model-generated device 30 via bus 33. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the model-generated device 30, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems.
[0093] It should be noted that although several units / modules or sub-units / modules of the electronic device have been mentioned in the detailed description above, this division is merely exemplary and not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided and embodied by multiple units / modules.
[0094] Example 5
[0095] This disclosure also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the message processing method provided in any of the above embodiments.
[0096] The readable storage medium may be more specifically adopted, including but not limited to: portable disk, hard disk, random access memory, read-only memory, erasable programmable read-only memory, optical storage device, magnetic storage device, or any suitable combination thereof.
[0097] Example 6
[0098] This disclosure also provides a computer program product, including a computer program that, when executed by a processor, implements the message processing method described in any of the above embodiments.
[0099] The program code for executing the computer program product of this disclosure can be written in any combination of one or more programming languages, and the program code can be executed entirely on a user device, partially on a user device, as a stand-alone software package, partially on a user device and partially on a remote device, or entirely on a remote device.
[0100] While specific embodiments of this disclosure have been described above, those skilled in the art should understand that these are merely illustrative examples, and the scope of protection of this disclosure is defined by the appended claims. Those skilled in the art can make various changes or modifications to these embodiments without departing from the principles and essence of this disclosure, but all such changes and modifications fall within the scope of protection of this disclosure.
Claims
1. A message processing method, characterized in that, The message processing method includes: Obtain historical serial number information from the target storage unit, and initialize the current serial number information in the initial storage unit based on the historical serial number information; Based on the current serial number information, target serial number information is assigned to different message information in a sequentially accumulated manner; wherein, the target serial number information assigned to the last message information is used as the current serial number information; Starting with the historical serial number information, the corresponding current serial number information is obtained sequentially, and the corresponding message information is stored in the target storage unit sequentially; wherein, the target serial number information corresponding to the last message information stored in the target storage unit is used as the historical serial number information.
2. The message processing method according to claim 1, characterized in that, The message processing method further includes: If the message information is present in the initial storage unit within a preset time interval, the step of obtaining the historical serial number information in the target storage unit is executed.
3. The message processing method according to claim 2, characterized in that, The preset time interval is set based on the timer.
4. The message processing method according to claim 1, characterized in that, The message processing method further includes: Obtain the quantity information corresponding to the message information in the initial storage unit; In response to the quantity information being greater than a first threshold, the message information and the corresponding current serial number information stored in the initial storage unit are stored in the target storage unit in a first-in-first-out manner.
5. The message processing method according to any one of claims 1-4, characterized in that, After the step of obtaining the current serial number information in the initial storage unit, the message processing method further includes: In response to the current serial number being greater than the target threshold, the current serial number is reset.
6. A message processing system, characterized in that, The processing system includes: The acquisition module is used to acquire historical serial number information in the target storage unit and initialize the current serial number information in the initial storage unit based on the historical serial number information; The allocation module is used to allocate corresponding target serial number information to different message information in a sequentially accumulated manner based on the current serial number information; wherein, the target serial number information allocated to the last message information is used as the current serial number information; The storage module is used to sequentially obtain the corresponding current serial number information, starting with the historical serial number information, and sequentially store the corresponding message information into the target storage unit; wherein, the target serial number information corresponding to the last message information stored in the target storage unit is used as the historical serial number information.
7. A baseband chip, characterized in that, The baseband chip includes the message processing system described in claim 6.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and for running on the processor, characterized in that, When the processor executes the computer program, it implements the message processing method according to any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the message processing method according to any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the message processing method as described in any one of claims 1 to 5.