A smart battery charging and discharging simulation method and related equipment

By utilizing the Android application interface in cloud gaming services to obtain battery information and simulate charging and discharging, the problem of the inability to dynamically change the battery state in existing technologies is solved, and automatic charging and discharging cycle control of intelligent batteries is realized.

CN122085152APending Publication Date: 2026-05-26HUNAN XIAOSUAN TECH INFORMATION CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HUNAN XIAOSUAN TECH INFORMATION CO LTD
Filing Date
2026-04-16
Publication Date
2026-05-26

AI Technical Summary

Technical Problem

Existing Android system battery management methods cannot simulate the real charging and discharging process, and cannot meet the dynamic changes in battery status required for cloud gaming devices to operate continuously while plugged in.

Method used

The system obtains battery power, charger connection status, and charging/discharging speed parameters through the standard Android application programming interface, activates the battery simulation switch, and simulates charging and discharging on the information processor thread to form an automatic charging and discharging cycle for the smart battery.

Benefits of technology

It enables continuous changes in battery power during cloud gaming services, forming a stable charge-discharge cycle and ensuring dynamic simulation and automatic control of battery status.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122085152A_ABST
    Figure CN122085152A_ABST
Patent Text Reader

Abstract

This invention provides a smart battery charging and discharging simulation method and related equipment, applied to cloud gaming services. It obtains the battery level, charger connection status, charging and discharging speed parameters, and upper and lower battery level thresholds at the start of the cloud gaming service through a standard Android application programming interface (API), and then activates a battery simulation switch. When the battery simulation switch is activated, charging and discharging are simulated on an information processor thread based on the battery level, upper and lower battery level thresholds, and charger connection status. The simulation results are obtained, and the battery level is updated according to the simulation results and charging and discharging speed parameters to obtain the updated battery level. Compared with existing technologies, this invention automatically discharges when the battery level reaches the upper limit and automatically charges when it reaches the lower limit, forming a continuous charging and discharging cycle, thus realizing automatic charging and discharging cycle control of the smart battery.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of power management technology for mobile devices, and in particular to a smart battery charging and discharging simulation method and related equipment. Background Technology

[0002] Existing Android system battery management methods mainly include: Static battery status settings: Parameters such as battery level and charging status can be set directly through system commands, but this method can only set fixed values ​​and cannot simulate the real charging and discharging process; Hardware battery management: Relies on physical battery hardware to provide battery status information, but cannot provide dynamically changing battery status in scenarios such as cloud gaming devices that operate for long periods of time while plugged in. Simple battery simulation: It can only set the battery level, lacks automatic charge / discharge cycle mechanism and charge / discharge speed control mechanism, and cannot meet the application's need for continuous changes in battery state. Summary of the Invention

[0003] This invention provides a method and related equipment for simulating the charging and discharging of a smart battery, the purpose of which is to realize automatic charging and discharging cycle control of a smart battery.

[0004] To achieve the above objectives, the present invention provides a smart battery charging and discharging simulation method, applied to cloud gaming services, the method comprising: Step 1: Obtain the battery level, charger connection status, charging and discharging speed parameters, and upper and lower battery thresholds when the cloud gaming service starts through the standard Android application interface, and start the battery simulation switch. Step 2: When the battery simulation switch is started, the charging and discharging is simulated on the information processor thread according to the battery power value, the upper and lower power limits and the charger connection status to obtain the simulation results. The battery power value is then updated according to the simulation results and the charging and discharging speed parameters to obtain the updated battery power value.

[0005] Furthermore, when the battery simulation switch is activated, charging and discharging are simulated on the information processor thread based on the battery level, upper and lower charge thresholds, and charger connection status, yielding simulation results, including: When the battery simulation switch is activated, the current battery level is obtained and assigned to the current level variable, and the current charger connection status is assigned to the charging variable. When the current battery level variable is less than or equal to the lower limit threshold, the current battery level is below the lower limit. Based on the charging variable, the charging is simulated on the information processor thread to obtain the simulation result. If the current battery level variable is greater than or equal to the upper limit of the battery level, then the current battery level is higher than the upper limit. Based on the charging variable, the discharge is simulated in the information processor thread to obtain the simulation result. When the current power level variable is between the upper and lower thresholds, the charging and discharging direction is determined based on the charging variable, and the charging and discharging is simulated in the information processing thread according to the charging and discharging direction to obtain the simulation results.

[0006] Furthermore, by simulating charging on the information processor thread based on the charging variable, the simulation results are obtained, including: When the current power variable is greater than the upper limit threshold, the charging variable is set to 0, indicating that the charger is disconnected, a discharge message is sent to simulate discharge, and the simulated discharge result is obtained. Add the current energy level variable to the charge / discharge step size constant to obtain the next energy level variable; When the next power variable is greater than or equal to the upper limit threshold, the battery power is updated to the upper limit threshold, the charging variable is set to 0, a discharge message is sent to simulate discharge, and the simulated discharge result is obtained. When the next power level variable is less than the upper limit threshold, the power level variable is updated to the next power level variable and a charging message is sent to simulate charging, thus obtaining the simulated charging result.

[0007] Furthermore, based on the charging variable, the discharge is simulated in the information processor thread to obtain simulation results, including: When the current power variable is less than or equal to the lower power threshold, the charging variable is set to 1, indicating that the charger is connected, a charging message is sent to simulate charging, and the simulated charging result is obtained. Subtract the current energy level variable from the charge / discharge step size constant to obtain the next energy level variable; When the next power variable is less than or equal to the lower limit threshold, the battery power is updated to the lower limit threshold, the charging variable is set to 1, charging information is sent to simulate charging, and the simulated charging result is obtained. When the next power variable is greater than the lower threshold, the power variable is updated to the next power variable and a discharge message is sent to simulate discharge, thus obtaining the simulated discharge result.

[0008] Furthermore, when updating the battery power value based on the simulation results and charging / discharging speed parameters, the battery parameters are updated through the battery command utility class. The battery parameters include the power value, charger connection status, and battery status value. The battery status value includes 2, 3, and 5, where 2 indicates charging, 3 indicates discharging, and 5 indicates the battery is fully charged.

[0009] Furthermore, when updating the battery level based on simulation results and charge / discharge rate parameters, the battery status is read through the standard Android application programming interface, including: Create an intent filter object using the standard Android application programming interface, and receive battery status information through the intent filter object; Obtain the value of the battery level field from the battery status information and use it as the current battery level value; Obtain the value of the maximum battery level field from the battery status information as the maximum battery level, and calculate the battery percentage using the current battery level and the maximum battery level. Retrieve the value of the battery status field from the battery status information, use it as the battery status, and determine the battery status value.

[0010] Furthermore, the battery level, charger connection status, charging and discharging speed parameters, and upper and lower battery level thresholds when the cloud gaming service is started are all stored in the system global settings database of the Android system equipped with cloud gaming.

[0011] This invention also provides an intelligent battery charging and discharging simulation device for use in cloud gaming services. The device includes: The acquisition module is used to obtain the battery level, charger connection status, charging and discharging speed parameters, and upper and lower battery thresholds when the cloud gaming service starts through the standard Android application interface, and to start the battery simulation switch. The simulation module is used to simulate charging and discharging on the information processor thread based on the battery level, upper and lower limit thresholds, and charger connection status when the battery simulation switch is activated, obtain simulation results, and update the battery level according to the simulation results and charging and discharging speed parameters to obtain the updated battery level.

[0012] The present invention also provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement a smart battery charging and discharging simulation method.

[0013] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements a smart battery charging and discharging simulation method.

[0014] The above-described solution of the present invention has the following beneficial effects: This invention is applied to cloud gaming services. It obtains the battery level, charger connection status, charging / discharging speed parameters, and upper and lower battery level thresholds at the start of the cloud gaming service through a standard Android application programming interface (API), and then activates a battery simulation switch. When the battery simulation switch is activated, it simulates charging and discharging on an information processor thread based on the battery level, upper and lower battery level thresholds, and charger connection status, obtaining simulation results. The battery level is then updated according to the simulation results and charging / discharging speed parameters to obtain the updated battery level. Compared with existing technologies, this invention automatically discharges when the battery level reaches its upper limit and automatically charges when it reaches its lower limit, forming a continuous charging / discharging cycle, thus achieving automatic charging / discharging cycle control of a smart battery.

[0015] Other beneficial effects of the present invention will be described in detail in the following detailed description section. Attached Figure Description

[0016] Figure 1 This is a flowchart illustrating an embodiment of the present invention; Figure 2 This is a schematic diagram of the structure of the intelligent battery charging and discharging simulation device in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of the terminal device in an embodiment of the present invention. Detailed Implementation

[0017] To make the technical problems, solutions, and advantages of this invention clearer, a detailed description will be provided below with reference to the accompanying drawings and specific embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0018] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0019] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0020] This invention addresses existing problems by providing an intelligent battery charging and discharging simulation method and related equipment.

[0021] like Figure 1 As shown, an embodiment of the present invention provides a smart battery charging and discharging simulation method, applied to cloud gaming services, the method comprising: Step 1: Obtain the battery level, charger connection status, charging and discharging speed parameters, and upper and lower battery thresholds when the cloud gaming service starts through the standard Android application interface, and start the battery simulation switch. Step 2: When the battery simulation switch is started, the charging and discharging is simulated on the information processor thread according to the battery power value, the upper and lower power limits and the charger connection status to obtain the simulation results. The battery power value is then updated according to the simulation results and the charging and discharging speed parameters to obtain the updated battery power value.

[0022] In this embodiment of the invention, when an Android system with cloud gaming is started, the constructor of the cloud gaming service lifecycle class first calls the parent class constructor and passes in the context object, then creates the context object, then creates a message handler and sets the asynchronous message handling flag to true, and finally passes in a battery observer instance, along with the context object and the message handler.

[0023] This invention sets battery simulation parameters through a standard Android application programming interface (API). The setting methods include: Method 1: Configure via Android Debug Bridge commands. Specifically, use the Android Debug Bridge command-line tool to set the following parameters in the system settings / global settings command: Setting the simulated battery level to 80% indicates that the initial battery level is 80%. Set the simulated battery charger connection status to 1 or 0 to indicate whether the charger is connected or disconnected. Setting the simulated battery switch to on or off indicates whether the simulated switch is turned on or off. Setting the simulated battery charging speed to 60 indicates a charging speed of 60 seconds per 1%. Setting the simulated battery discharge rate to 600 means the discharge rate is 600 seconds / 1%. Setting the simulated battery capacity upper limit threshold to 95% indicates a maximum capacity of 95%. Setting the simulated battery capacity lower limit threshold to 25% indicates a minimum battery capacity of 25%. Method 2: Through programmatic settings, specifically: in the application code, set integer parameters through the content resolver object, including: The simulated battery level is set to 80%, the simulated battery charger online setting is 1%, the simulated battery charging speed is set to 60%, the simulated battery discharging speed is set to 600%, the simulated battery upper limit threshold is set to 95%, and the simulated battery lower limit threshold is set to 25%. The simulated battery switch is set to "On" using the string value method.

[0024] Specifically, when the battery simulation switch is activated, charging and discharging are simulated on the information processor thread based on the battery level, upper and lower charge thresholds, and charger connection status, yielding simulation results, including: When the battery simulation switch is activated, the current battery level is obtained and assigned to the current level variable, and the current charger connection status is assigned to the charging variable. When the current battery level variable is less than or equal to the lower limit threshold, the current battery level is below the lower limit. Based on the charging variable, the charging is simulated on the information processor thread to obtain the simulation result. If the current battery level variable is greater than or equal to the upper limit of the battery level, then the current battery level is higher than the upper limit. Based on the charging variable, the discharge is simulated in the information processor thread to obtain the simulation result. When the current power level variable is between the upper and lower thresholds, the charging and discharging direction is determined based on the charging variable, and the charging and discharging is simulated in the information processing thread according to the charging and discharging direction to obtain the simulation results.

[0025] Specifically, charging is simulated on the information processor thread based on the charging variable, and the simulation results are obtained, including: When the current power variable is greater than the upper limit threshold, the charging variable is set to 0, indicating that the charger is disconnected, a discharge message is sent to simulate discharge, and the simulated discharge result is obtained. Add the current energy level variable to the charge / discharge step size constant to obtain the next energy level variable; When the next power variable is greater than or equal to the upper limit threshold, the battery power is updated to the upper limit threshold, the charging variable is set to 0, a discharge message is sent to simulate discharge, and the simulated discharge result is obtained. When the next power level variable is less than the upper limit threshold, the power level variable is updated to the next power level variable and a charging message is sent to simulate charging, thus obtaining the simulated charging result.

[0026] Specifically, based on the charging variable, the discharge is simulated in the information processor thread to obtain simulation results, including: When the current power variable is less than or equal to the lower power threshold, the charging variable is set to 1, indicating that the charger is connected, a charging message is sent to simulate charging, and the simulated charging result is obtained. Subtract the current energy level variable from the charge / discharge step size constant to obtain the next energy level variable; When the next power variable is less than or equal to the lower limit threshold, the battery power is updated to the lower limit threshold, the charging variable is set to 1, charging information is sent to simulate charging, and the simulated charging result is obtained. When the next power variable is greater than the lower threshold, the power variable is updated to the next power variable and a discharge message is sent to simulate discharge, thus obtaining the simulated discharge result.

[0027] Specifically, when updating the battery power value according to the simulation results and charging / discharging speed parameters, the battery parameters are updated through the battery command utility class. The battery parameters include the power value, charger connection status, and battery status value. The battery status value includes 2, 3, and 5, where 2 indicates charging, 3 indicates discharging, and 5 indicates the battery is fully charged.

[0028] In this embodiment of the invention, an instance is obtained through the runtime environment and system commands are executed. The command string is "Battery command set forced flag power" + power value, which is used to set the battery power; the command string is "Battery command set forced flag AC charger" + connection status value, which is used to set the AC charger status. Then, if the connection status is equal to 0, an instance is obtained through the runtime environment and system commands are executed. The command string is "Battery command set forced flag USB charger 0", which is used to disconnect USB charging; the command string is "Battery command set forced flag status" + status value, which is used to set the battery status.

[0029] Specifically, when updating the battery level based on simulation results and charge / discharge rate parameters, the battery status is read through the standard Android application programming interface, including: Create an intent filter object using the standard Android application programming interface, and receive battery status information through the intent filter object; Obtain the value of the battery level field from the battery status information and use it as the current battery level value; Obtain the value of the maximum battery level field from the battery status information as the maximum battery level, and calculate the battery percentage using the current battery level and the maximum battery level. Retrieve the value of the battery status field from the battery status information, use it as the battery status, and determine the battery status value.

[0030] Specifically, the battery level, charger connection status, charging and discharging speed parameters, and upper and lower battery level thresholds when the cloud gaming service is started are all stored in the system global settings database of the Android system equipped with cloud gaming.

[0031] Specifically, embodiments of the present invention also include: Step 1: The user or system sets the battery simulation parameters and writes them to the system database through the system settings application interface; Step 2: The content observer is triggered and invoked within 100 milliseconds after the battery simulation parameters are written; Step 3: The battery observer identifies the type of changed battery simulation parameters and uses the Uniform Resource Identifier to determine which configuration item has changed; Step 4: Based on the type of change in the battery simulation parameters, send the corresponding message processor message to the simulated battery object. The message types include changes in simulation switch, charging speed, discharging speed, upper threshold, and lower threshold.

[0032] Step 5: Simulate the battery object to process the received messages and execute the corresponding processing logic according to the message type; Step 6: Update internal state variables, including charging and discharging speed, power threshold, etc., and use the volatile keyword to ensure multi-threaded visibility; Step 7: If the current simulation is true, recalculate the charge / discharge logic. This may require stopping the current simulation and restarting it to apply the new battery simulation parameters. Step 9: Update the system battery status, including battery level, charger status, and battery status, by calling system commands through the battery command utility class. Step 10: The application reads the new battery status through the battery manager interface or battery status change action broadcast, and the read status is completely consistent with the simulated status.

[0033] To ensure state consistency in a multi-threaded environment, this invention uses the volatile keyword to declare key state variables, guaranteeing visibility in a multi-threaded environment. These variables include: a current battery level variable to store the current battery level, a charging status variable to store the charging state, a charging speed variable to store the charging speed (in milliseconds), a discharging speed variable to store the discharging speed (in milliseconds), an upper threshold variable to store the upper threshold, and a lower threshold variable to store the lower threshold. The volatile keyword ensures that when one thread modifies the value of these variables, other threads can immediately see the latest value, avoiding data inconsistency issues. A separate message handler thread is used to handle the charging and discharging logic, avoiding blocking the main thread. A message handler thread object named "Battery Discharging" is created, and then the startup method is called to start the thread, creating a simulated battery instance object and passing in the context object and the message loop object of the message handler thread. In this way, all charging and discharging message processing is performed in a separate thread, without affecting the performance of the main thread.

[0034] To ensure the validity and security of battery power values, this embodiment of the invention first checks whether the battery power value is within a valid range when setting the battery power. The minimum battery power value is defined as 10, and the maximum battery power value is defined as 100. If the input battery power value is less than the minimum value, it is automatically adjusted to the minimum value of 10; if it is greater than the maximum value, it is automatically adjusted to the maximum value of 100. This prevents abnormal battery power values ​​from causing system instability. When updating the threshold, a range check is also performed. The upper threshold cannot exceed 100 or be less than 10; the lower threshold cannot be less than 10 or be greater than the upper threshold. If the lower threshold is greater than the upper threshold, it is automatically adjusted to be equal to the upper threshold. This check mechanism ensures the rationality of the threshold configuration and avoids logical errors.

[0035] The embodiments of the present invention were verified in a real environment of a cloud gaming platform. The experimental process and results are as follows: Experimental environment: Android 13 system, cloud gaming Pod device (powered on continuously), test applications: multiple mainstream cloud gaming applications; Experimental procedure: 1. Configure battery simulation parameters: Initial battery level: 80%, charging speed: 60 seconds / 1%, discharging speed: 600 seconds / 1%, upper battery level threshold: 95%, lower battery level threshold: 25%; 2. Activate the battery simulation function and observe the charge / discharge cycle process; 3. Test dynamic configuration updates: Modify the charge and discharge speed during the simulation and observe whether it takes effect in real time; 4. Test application compatibility: Verify that the battery status read by the game application is consistent with the simulated status.

[0036] The experimental results are as follows: 1. Charge-discharge cycle verification: The battery starts charging from 80% and reaches the upper limit of 95% after about 15 minutes, automatically switching to discharge mode; after discharging for about 70 minutes, it reaches the lower limit of 25% and automatically switches to charging mode, forming a stable cycle. 100 complete charge-discharge cycles were tested, with an average cycle time of 85 minutes (15 minutes of charging + 70 minutes of discharging). The cycle time was stable with an error of less than 1%. 2. Stability Verification: After 72 hours of continuous operation, the system remained stable during charge-discharge cycles, completing approximately 51 full cycles without any abnormal conditions or system crashes. During the test, the average CPU utilization was 0.08%, with a peak of no more than 0.15%; memory usage remained stable at around 4.2MB, with a peak of no more than 5MB.

[0037] This invention is applied to cloud gaming services. It obtains the battery level, charger connection status, charging / discharging speed parameters, and upper and lower battery level thresholds at the start of the cloud gaming service through a standard Android application programming interface (API), and activates a battery simulation switch. When the battery simulation switch is activated, it simulates charging and discharging on an information processor thread based on the battery level, upper and lower battery level thresholds, and charger connection status, obtaining simulation results. The battery level is then updated according to the simulation results and charging / discharging speed parameters to obtain the updated battery level. Compared to existing technologies, this invention automatically discharges when the battery level reaches its upper limit and automatically charges when it reaches its lower limit, forming a continuous charging / discharging cycle, thus achieving automatic charging / discharging cycle control of the intelligent battery.

[0038] Corresponding to the intelligent battery charge and discharge simulation method described in the above embodiments, such as Figure 2 As shown, this embodiment of the invention also provides an intelligent battery charging and discharging simulation device 100, applied to cloud gaming services. The intelligent battery charging and discharging simulation device includes: The acquisition module 101 is used to acquire the battery power value, charger connection status, charging and discharging speed parameters and upper and lower power limits when the cloud gaming service starts through the standard Android application interface, and to start the battery simulation switch. The simulation module 102 is used to simulate charging and discharging on the information processor thread according to the battery power value, upper and lower power limit thresholds and charger connection status when the battery simulation switch is started, obtain simulation results, and update the battery power value according to the simulation results and charging and discharging speed parameters to obtain the updated battery power value.

[0039] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0040] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0041] This invention also provides a terminal device, such as... Figure 3 As shown, the terminal device D10 of this embodiment includes: at least one processor D100 ( Figure 3 The diagram shows only one processor, a memory D101, and a computer program D102 stored in the memory D101 and executable on the at least one processor D100. When the processor D100 executes the computer program D102, it implements the above-described intelligent battery charging and discharging simulation method.

[0042] The terminal device D10 can be a desktop computer, laptop, handheld computer, server, server cluster, or cloud server, etc. This terminal device may include, but is not limited to, a processor D100 and a memory D101. Those skilled in the art will understand that... Figure 3This is merely an example of terminal device D10 and does not constitute a limitation on terminal device D10. It may include more or fewer components than shown in the figure, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0043] The processor D100 can be a central processing unit (CPU), or it can be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.

[0044] In some embodiments, the memory D101 may be an internal storage unit of the terminal device D10, such as a hard disk or memory of the terminal device D10. In other embodiments, the memory D101 may be an external storage device of the terminal device D10, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the terminal device D10. Furthermore, the memory D101 may include both internal and external storage units of the terminal device D10. The memory D101 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory D101 can also be used to temporarily store data that has been output or will be output.

[0045] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0046] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0047] This invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements a smart battery charging and discharging simulation method.

[0048] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying the computer program code to a building device / terminal device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks.

[0049] The above description represents the preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for simulating the charging and discharging of an intelligent battery, characterized in that, Applied to cloud gaming services, the method includes: Step 1: Obtain the battery level, charger connection status, charging and discharging speed parameters, and upper and lower battery thresholds when the cloud gaming service starts through the standard Android application interface, and start the battery simulation switch. Step 2: When the battery simulation switch is activated, the charging and discharging is simulated on the information processor thread according to the battery power value, the upper and lower power limits and the charger connection status to obtain the simulation results. The battery power value is then updated according to the simulation results and the charging and discharging speed parameters to obtain the updated battery power value.

2. The intelligent battery charging and discharging simulation method according to claim 1, characterized in that, When the battery simulation switch is activated, charging and discharging are simulated on the information processor thread based on the battery level, the upper and lower limit thresholds of the battery level, and the charger connection status, to obtain simulation results, including: When the battery simulation switch is activated, the current battery level is obtained and assigned to the current level variable, and the current charger connection status is assigned to the charging variable. When the current battery level variable is less than or equal to the lower battery level threshold, the current battery level is below the lower limit. Based on the charging variable, charging is simulated on the information processor thread to obtain the simulation result. When the current battery level variable is greater than or equal to the upper limit threshold, the current battery level is higher than the upper limit. Based on the charging variable, the battery is simulated to discharge in the information processor thread to obtain the simulation result. When the current power level variable is between the upper and lower power level thresholds, the charging and discharging direction is determined based on the charging variable, and the charging and discharging is simulated in the information processing thread according to the charging and discharging direction to obtain the simulation result.

3. The intelligent battery charging and discharging simulation method according to claim 2, characterized in that, Based on the charging variable, charging is simulated on the information processor thread to obtain simulation results, including: When the current power variable is greater than the upper limit threshold, the charging variable is set to 0, indicating that the charger is disconnected, a discharge message is sent to simulate discharge, and the simulated discharge result is obtained. The current energy level variable is added to the charge / discharge step size constant to obtain the next energy level variable; When the next power variable is greater than or equal to the upper limit threshold, the battery power is updated to the upper limit threshold, the charging variable is set to 0, a discharge message is sent to simulate discharge, and the simulated discharge result is obtained. When the next power variable is less than the upper limit threshold, the power variable is updated to the next power variable and a charging message is sent to simulate charging to obtain the simulated charging result.

4. The intelligent battery charging and discharging simulation method according to claim 2, characterized in that, Based on the charging variable, a discharge is simulated in the information processor thread to obtain simulation results, including: When the current power variable is less than or equal to the lower power threshold, the charging variable is set to 1, indicating that the charger is connected, a charging message is sent to simulate charging, and the simulated charging result is obtained. Subtract the current energy level variable from the charge / discharge step size constant to obtain the next energy level variable; When the next power variable is less than or equal to the lower limit threshold, the battery power is updated to the lower limit threshold, the charging variable is set to 1, charging information is sent to simulate charging, and the simulated charging result is obtained. When the next power variable is greater than the lower threshold, the power variable is updated to the next power variable and a discharge message is sent to simulate discharge, thus obtaining the simulated discharge result.

5. The intelligent battery charging and discharging simulation method according to claim 1, characterized in that, When updating the battery power value according to the simulation results and the charging and discharging speed parameters, the battery parameters are updated through the battery command utility class. The battery parameters include the power value, charger connection status, and battery status value. The battery status value includes 2, 3, and 5, where 2 indicates charging, 3 indicates discharging, and 5 indicates the battery is fully charged.

6. The intelligent battery charging and discharging simulation method according to claim 1, characterized in that, When updating the battery charge value based on the simulation results and the charge / discharge rate parameters, the battery status is read through the standard Android application programming interface, including: Create an intent filter object using the standard Android application programming interface, and receive battery status information through the intent filter object; The value of the power field is obtained from the battery status information and used as the current power value; The value of the maximum battery level field is obtained from the battery status information and used as the maximum battery level. The battery percentage is then calculated using the current battery level and the maximum battery level. The value of the battery status field is obtained from the battery status information as the battery status, and the battery status value of the battery status is determined.

7. The intelligent battery charging and discharging simulation method according to claim 1, characterized in that, The battery level, charger connection status, charging and discharging speed parameters, and upper and lower battery limits when the cloud gaming service is started are all stored in the system global settings database of the Android system equipped with cloud gaming.

8. A smart battery charging and discharging simulation device, characterized in that, The device, used for cloud gaming services, includes: The acquisition module is used to obtain the battery level, charger connection status, charging and discharging speed parameters, and upper and lower battery thresholds when the cloud gaming service starts through the standard Android application interface, and to start the battery simulation switch. The simulation module is used to simulate charging and discharging on the information processor thread according to the battery power value, the upper and lower power limits and the charger connection status when the battery simulation switch is activated, obtain the simulation results, and update the battery power value according to the simulation results and the charging and discharging speed parameters to obtain the updated battery power value.

9. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the intelligent battery charging and discharging simulation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the intelligent battery charging and discharging simulation method as described in any one of claims 1 to 7.