CN115225983A - Battery data reporting method and device, storage medium and electronic equipment - Google Patents

Battery data reporting method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN115225983A
CN115225983A CN202210843348.1A CN202210843348A CN115225983A CN 115225983 A CN115225983 A CN 115225983A CN 202210843348 A CN202210843348 A CN 202210843348A CN 115225983 A CN115225983 A CN 115225983A
Authority
CN
China
Prior art keywords
battery
preset
data
battery data
condition
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210843348.1A
Other languages
Chinese (zh)
Inventor
李志杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN202210843348.1A priority Critical patent/CN115225983A/en
Publication of CN115225983A publication Critical patent/CN115225983A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04QSELECTING
    • H04Q9/00Arrangements in telecontrol or telemetry systems for selectively calling a substation from a main station, in which substation desired apparatus is selected for applying a control signal thereto or for obtaining measured values therefrom
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04QSELECTING
    • H04Q2209/00Arrangements in telecontrol or telemetry systems
    • H04Q2209/80Arrangements in the sub-station, i.e. sensing device
    • H04Q2209/82Arrangements in the sub-station, i.e. sensing device where the sensing device takes the initiative of sending data
    • H04Q2209/823Arrangements in the sub-station, i.e. sensing device where the sensing device takes the initiative of sending data where the data is sent when the measured values exceed a threshold, e.g. sending an alarm

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Charge And Discharge Circuits For Batteries Or The Like (AREA)

Abstract

The disclosure provides a battery data reporting method and device, a storage medium and electronic equipment, and relates to the technical field of computers. The battery data reporting method comprises the following steps: responding to the condition meeting the preset condition, and acquiring target battery data needing to be reported; under the condition that a preset identification bit is detected to be a first numerical value, the preset identification bit is adjusted to be a second numerical value, and the target battery data are reported; and if the target battery data is successfully reported within a first preset time, adjusting the preset identification bit back to the first numerical value. The method and the device are beneficial to realizing effective monitoring and management of the battery data.

Description

Battery data reporting method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a battery data reporting method, a battery data reporting apparatus, a computer-readable storage medium, and an electronic device.
Background
Electronic devices such as cell phones are increasingly dependent on battery power. In the related art, it is difficult to effectively monitor and manage battery data, which results in failure to optimize the endurance of the device and improve the user experience.
Disclosure of Invention
The present disclosure provides a battery data reporting method, a battery data reporting device, a computer-readable storage medium and an electronic device, so as to solve, at least to a certain extent, a problem that it is difficult to effectively monitor and manage battery data in related technologies.
According to a first aspect of the present disclosure, a method for reporting battery data is provided, including: responding to the condition meeting the preset condition, and acquiring target battery data needing to be reported; under the condition that a preset identification bit is detected to be a first numerical value, the preset identification bit is adjusted to be a second numerical value, and the target battery data are reported; and if the target battery data is successfully reported within a first preset time, adjusting the preset identification bit back to the first numerical value.
According to a second aspect of the present disclosure, there is provided a device for reporting battery data, including: the data acquisition module is configured to respond to the condition that a preset condition is met and acquire target battery data needing to be reported; the data reporting module is configured to adjust a preset identification bit to a second value and report the target battery data under the condition that the preset identification bit is detected to be a first value; and the preset identification bit recovery module is configured to adjust the preset identification bit back to the first value if the target battery data is successfully reported within a first preset time.
According to a third aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the battery data reporting method of the first aspect and possible implementations thereof.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: a processor; a memory for storing executable instructions of the processor. The processor is configured to execute the executable instructions to perform the method for reporting battery data of the first aspect and possible implementation manners thereof.
The technical scheme of the disclosure has the following beneficial effects:
on one hand, the scheme for reporting the battery data is provided, which is beneficial to effectively monitoring and managing the battery data, and further realizes the control and optimization of the charging process, the battery use and the like. On the other hand, when the target battery data is reported, the interference problem of the reported data among different threads can be improved based on the use of the preset identification bits, and the accuracy of data reporting is improved.
Drawings
FIG. 1 shows a schematic diagram of a system architecture in the present exemplary embodiment;
fig. 2 is a flowchart illustrating a method for reporting battery data in the present exemplary embodiment;
fig. 3 shows a schematic flow of a battery data reporting method in the present exemplary embodiment;
fig. 4 shows a sub-flowchart of a method for reporting battery data in the present exemplary embodiment;
FIG. 5 illustrates a process flow for triggering a charging intermittent landfill in wired charging in the present exemplary embodiment;
fig. 6 shows a process flow for triggering a charging intermittent burying point in wireless charging in the present exemplary embodiment;
fig. 7 is a sub-flowchart of a method for reporting battery data in the present exemplary embodiment;
FIG. 8 illustrates a process flow for triggering a low voltage buried point in the present exemplary embodiment;
FIG. 9 illustrates a process flow for triggering a low-charge retention buried point in the present exemplary embodiment;
fig. 10 is a sub-flowchart of a method for reporting battery data in the present exemplary embodiment;
fig. 11 is a sub-flowchart of a method for reporting battery data in the present exemplary embodiment;
FIG. 12 shows a process flow for triggering burn-in prevention in the present exemplary embodiment;
fig. 13 is a schematic structural diagram of a device for reporting battery data in this exemplary embodiment;
fig. 14 shows a schematic structural diagram of an electronic device in the present exemplary embodiment.
Detailed Description
Exemplary embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings.
The figures are schematic illustrations of the present disclosure and are not necessarily drawn to scale. Some of the block diagrams shown in the figures may be functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in hardware modules or integrated circuits, or in a network, processor or microcontroller. Embodiments may be embodied in many different forms and should not be construed as limited to the examples set forth herein. The described features, structures, or characteristics of the disclosure may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough explanation of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that one or more of the specific details can be omitted, or one or more of the specific details can be replaced with other methods, components, devices, steps, etc., in implementing the embodiments of the disclosure.
In the related art, a scheme for reporting battery data is lacked, and the battery data is difficult to be effectively monitored and managed. For example, when charging abnormality or power change abnormality occurs, it is difficult to record and analyze the relevant data. Especially, it is difficult for equipment manufacturers or battery manufacturers to obtain large-scale actual battery data, so that control and optimization of charging processes, battery usage, and the like cannot be performed.
In view of the foregoing problems, an exemplary embodiment of the present disclosure first provides a method for reporting battery data. The system architecture and scenario of the battery data reporting method operating environment will be described with reference to fig. 1.
Fig. 1 shows a system architecture in the present exemplary embodiment. The system architecture 100 may include a terminal 110 and a server 120. The terminal 110 is an electronic device that needs to be charged, such as a mobile phone, a tablet computer, a notebook computer, a wearable device, and the like, and is powered by a rechargeable battery, and the battery data can be used for reporting. Server 120 generally refers to a backend system that provides battery management or optimization services, such as a server that may be a device vendor or a battery vendor of terminal 110. The server 120 may be a server or a cluster of servers, which is not limited by this disclosure. The terminal 110 and the server 120 may form a connection through a wired or wireless communication link for data interaction.
In this exemplary embodiment, the method for reporting battery data may be executed by the terminal 110. The terminal 110 may report the target battery data to be reported inside the terminal 110 by executing the method for reporting battery data, for example, report the target battery data from the kernel state to the User state of the terminal 110, and further analyze and process the target battery data in the User state, or display the target battery data through a User Interface (UI). The terminal 110 may also report the target battery data to the server 120, and the server 120 analyzes the target battery data and returns an analysis result or a charging optimization result related to the terminal 110.
Fig. 2 shows an exemplary flow of a method for reporting battery data, which may include:
step S210, responding to the preset condition, acquiring the target battery data to be reported;
step S220, under the condition that the preset identification bit is detected to be a first numerical value, the preset identification bit is adjusted to be a second numerical value, and target battery data are reported;
in step S230, if it is determined that the target battery data is successfully reported within the first preset duration, the preset flag is adjusted back to the first value.
Based on the method, on one hand, a scheme for reporting the battery data is provided, which is beneficial to effectively monitoring and managing the battery data, and further realizes the control and optimization of the charging process, the battery use and the like. On the other hand, when the target battery data is reported, the interference problem of the reported data among different threads can be improved based on the use of the preset identification bits, and the accuracy of data reporting is improved.
The steps in fig. 2 will be specifically described below.
Referring to fig. 2, in step S210, in response to meeting a preset condition, target battery data that needs to be reported is obtained.
The preset condition refers to a condition for triggering reporting of battery data, and for example, the preset condition may be satisfied when the battery reaches a certain state or a certain event related to the battery occurs.
In an embodiment, the reporting of the battery data may be performed in a point burying manner, and the meeting of the preset condition may include: and triggering the battery buried point. The battery burying point refers to a code for acquiring battery data set for a specific node (which may be a time node or an event node) in the battery usage (including the charging process), and may also refer to a specific event that can trigger the burying point. For example, the battery burying point may be triggered periodically during normal charging, such as once every certain time (e.g., 2 minutes), or triggered when the charging phase changes (e.g., from constant voltage charging to constant current charging), or triggered when a specific charging abnormal event occurs, such as charging interruption, etc.
When the preset condition is met, the battery data needing to be reported is indicated, and the battery data needing to be reported is acquired at the moment and is called target battery data. Target battery data may include, but is not limited to: various battery or charging index data, such as voltage, current, battery temperature, etc., at present or over a period of time; time information; and the category information of the battery buried point, such as the category of the charging abnormal event.
In one embodiment, which battery data need to be reported can be determined according to the category of the battery buried point, so as to obtain the target battery data. For example, for a battery burying point triggered periodically in normal charging, the required battery data may be different from a battery burying point triggered by a charging abnormal event, i.e., the specific kind or specific content of the target battery data may be different.
In one embodiment, the target battery data may be verified when the target battery data is obtained. If the verification passes, the step S220 may be continuously executed, and if the verification fails, a prompt message indicating that the verification fails may be returned. The verification of the target battery data may include: checking whether a key field in the target battery data is not empty, if so, checking whether the key index data of the battery is empty, and if not, checking not to pass; and checking whether different fields in the target battery data are matched or not, if the types of different levels in the type information of the battery buried point are matched or not, if the types of the different levels are not matched, the checking is not passed.
In one embodiment, after the target battery data is obtained, further pre-processing may be performed on the target battery data. To prevent other threads from modifying the data, a data lock, such as a mutex lock, may be first applied to the target battery data, in which case only the thread that is used to pre-process the target battery data may modify the target battery data. And then preprocessing the target battery data, such as data packaging, format conversion, writing into a buried point cache and the like. After the pre-processing of the target battery data is completed, the data lock may be released.
With reference to fig. 2, in step S220, under the condition that the preset flag is detected as the first value, the preset flag is adjusted to the second value, and the target battery data is reported.
The preset identification bit is used for indicating whether the reporting function of the battery data is available at present, so that data interference caused by the fact that different threads use the reporting function at the same time is prevented. The preset identification bit is available when the first numerical value represents, and the preset identification bit is unavailable when the second numerical value represents. For example, when the identification bit track _ ack =0 (the first value) is preset, the target battery data may be reported; when track _ ack =1 (the second value), the target battery data cannot be reported, and at this time, the target battery data needs to be reported after the preset identification bit is recovered to the first value.
In an embodiment, the battery data may be reported in a point-burying manner, and the preset identification bit may be set in a point-burying lock manner. The buried point lock is used for locking the buried point function so as to prevent a plurality of events from triggering the buried point in the same period of time to cause conflict of buried point resources or confusion of buried point data. The preset identification bit is a first numerical value, namely the embedded point lock is in an unlocked state and indicates that the embedded point function is available, and the preset identification bit is a second numerical value, namely the embedded point lock is in a locked state and does not indicate that the embedded point function is available. Accordingly, step S220 may include: and under the condition that the embedded point lock is detected to be in an unlocked state, adjusting the embedded point lock to be in a locked state, and reporting target battery data.
In the exemplary embodiment, according to the sharing condition of various resources and tools in the buried point, a buried point lock may be set for the battery buried point, or a buried point lock may be set for the battery buried point and a non-battery buried point (referring to a buried point unrelated to the battery and the charging, for example, if the working condition of the touch screen of the terminal is monitored, the buried point of the touch screen may be set, and the buried point of the touch screen belongs to the non-battery buried point). For example, if the battery buries the point and shares one burial point reporting thread or one storage area, and the non-battery buries the point and does not share the burial point reporting thread or the storage area, the battery burial point can be provided with a burial point lock to prevent a plurality of burial point events from simultaneously using the battery burial point function and simultaneously using the burial point reporting thread or the storage area, and the burial point lock does not prohibit the simultaneous use of the battery burial point function and the non-battery burial point function. If the battery buried point and the non-battery buried point share the buried point reporting thread or the storage area, the buried point lock can be set for the battery buried point and the non-battery buried point, so that the simultaneous use of the battery buried point function and the non-battery buried point function are forbidden.
Before reporting the target battery data, the state of the embedded point lock needs to be detected. If the embedded point lock is in a locked state, it indicates that other embedded point events are using the embedded point function, and at this time, the embedded point lock can wait until the embedded point lock is switched from the locked state to the unlocked state and then perform subsequent operations. For example, in step S210, the battery burying event is triggered due to the occurrence of the abnormal charging event, and the time is closer to the last periodic buried point event (i.e. the event that periodically triggers the battery burying point during normal charging), the battery data reporting process has not been completed by the last periodic buried point event, the buried point lock is in a locked state, and the battery data reporting process of the current abnormal charging event can be continued only after the lock is released.
In one embodiment, if multiple flush point events all need to wait for a flush point lock, then the flush points (which may include battery flush points or non-battery flush points) may be queued in chronological order of triggering the flush points.
When the preset identification bit is detected to be the first value, subsequent operations such as data reporting can be performed. Generally, the preset flag may be first adjusted to a second value to prevent other threads or other events from using the reporting function, and if the preset flag is the second value, the target battery data is reported, so that the use of the resource, tool, etc. of the embedded point may not be affected by other threads or events in the reporting process.
In one embodiment, reporting the target battery data may be performed by a buried point reporting thread. The buried point reporting thread can be in a dormant state and is awakened when data needing to be reported exists. For example, in step S210, whether the target battery data is ready (if yes, preprocessing is completed), and if so, the value of the trigger _ data _ ok parameter becomes true; in step S220, the buried point reporting thread may be awakened when the buried point lock is in an unlocked state, and the buried point reporting thread performs reporting of the target battery data when detecting trigger _ data _ ok = true.
Reporting the target battery data may include: and reporting the target battery data in the terminal, such as reporting the target battery data from the kernel mode to the user mode, or reporting the target battery data to a server, and the like.
In one embodiment, the target battery data may be reported from the kernel mode to the user mode, and then reported to the corresponding server through the user mode.
In an embodiment, the reporting of the target battery data may include the following steps:
writing target battery data into a preset storage area;
and extracting the classification information and the key information of the target battery data from a preset storage area, generating a target character string corresponding to the target battery data, and reporting the target character string.
The preset storage area can be used for storing data to be reported. For example, the preset storage region may be a buried point storage region for storing buried point data, such as a storage region shared by the battery buried points or a storage region shared by the battery buried points and non-battery buried points.
The classification information of the target battery data may be used to indicate the classification of the reporting event and to analyze the reason for reporting the data, such as the classification of the buried point. For example, the classification information of the target battery data may include: tag, a domain label, such as a tag for battery data may be a charge or other specific character, used to indicate that the data is charge related; event _ id, an identifier of an event, which may correspond to a destination address reported by the battery data, for example, different event _ ids correspond to different servers, and which server the target battery data is reported to may be determined according to the event _ id; the type, the major category of the event (or the major category of the battery buried point), such as the type of the charging abnormal event and the periodic reporting event, can be different; flag, which may be different, may be a further classification of type, such as a different specific exception type under a charging exception event. The key information of the target battery data may include battery indicator data with high correlation with the reported event, so as to reflect the actual situation of the event.
The target battery data is written into the preset storage area, and the buried point reporting thread can read the data from the preset storage area, so that the addressing overhead of the buried point reporting thread on the target battery data in the memory is reduced, and the buried point reporting thread is prevented from obtaining wrong data.
The buried point reporting thread can extract the classification information and the key information from the target battery data and convert the classification information and the key information into character strings, for example, the classification information and the key information can be connected into character strings, or the character strings can be connected after adding separators. In one embodiment, the classification information and the key information of the target battery data can be converted into character strings according to the data format requirement of the battery buried point. For example, in the data format requirement of the battery burying point, a character string of each item of information (such as tag, event _ id, type, flag, time information, and the like) may be specified to be a specific length, and thus, the classification information and the key information may be processed according to the specific length. In the present exemplary embodiment, the character string corresponding to the target battery data is referred to as a target character string.
In an embodiment, the target character string may further include other information besides the classification information and the key information, such as time information, and the like, which is not limited by the disclosure.
After the target character string is obtained, the target character string is reported to replace reported target battery data, so that the data transmission overhead can be reduced, and a receiver (such as a user mode or a server) can conveniently read data.
In an embodiment, the writing of the target battery data into the preset storage area may include:
and locking the preset storage area, and writing the target battery data into the preset storage area.
The locking of the preset storage area refers to exclusive setting of write permission of the preset storage area, and only one thread (such as a buried point reporting thread) is allowed to write data (including modified data) into the preset storage area, so that data errors caused by writing data into the preset storage area by other threads are prevented. For example, a preset memory area may be locked using a mutual exclusion lock. Generally, the preset storage area may be locked first, then the target battery data is written into the preset storage area, and after the target battery data is written or after the target battery data is reported, the preset storage area is unlocked. For example, the trigger _ data _ lock and trigger _ data _ unlock commands may be used to lock and unlock the preset storage area.
And if the preset storage area is in a locked state when the target battery data needs to be written into the preset storage area, indicating that other threads are using the preset storage area, and executing the step of locking the preset storage area and writing the target battery data into the preset storage area after waiting for the lock of the preset storage area to be released.
In an embodiment, the reporting the target string may include the following steps:
and locking a preset uploading channel, and reporting the target character string through the preset uploading channel.
The preset upload channel may be a transmission path for data reporting, such as a data transmission path between a kernel mode and a user mode. If the data is reported through the battery embedded point, the preset uploading channel can be an embedded data transmission path. In one embodiment, the default upload channel may be a data channel for interprocess communication.
In an embodiment, data reporting may be performed through a delay _ work of a preset upload channel.
The locking of the preset uploading channel refers to exclusive setting of the use permission of the preset uploading channel, and only one thread (such as a buried point reporting thread) is allowed to use the preset uploading channel, so that data errors caused by the fact that other threads also use the preset uploading channel are prevented. For example, a preset upload channel may be locked using a mutual exclusion lock. Generally, the preset uploading channel may be locked, then the preset uploading channel is filled with the target character string, and the target character string is reported, and then the preset uploading channel is unlocked after the target character string is reported. For example, the dcs _ info _ lock (dcs represents a preset upload channel) and the dcs _ info _ unlock command may be used to lock and unlock the preset upload channel.
And if the preset uploading channel is found to be in a locked state when the target character string needs to be reported by using the preset uploading channel, the preset uploading channel is found to be in a locked state, and the other threads use the preset uploading channel, and then the step of locking the preset uploading channel and reporting the target character string through the preset uploading channel can be executed after the locking of the preset uploading channel is released.
Referring to fig. 2, in step S230, if it is determined that the target battery data is successfully reported within the first preset time period, the preset flag is adjusted back to the first value.
The first preset time may be the longest waiting time for reporting the target battery data, and may be set according to experience or specific conditions, for example, may be 3 seconds. If the target battery data is successfully reported within the first preset time, the process of reporting the target battery data at this time can be ended, and the preset identification bit is adjusted back to the first value, so that other threads or events can normally use the reporting function. If the success of reporting the target battery data is not confirmed within the first preset time period, a response timeout (e.g., wait _ for _ timeout) result may be returned, or a report failure may be confirmed.
In an embodiment, the method for reporting battery data may further include the following steps:
and after the target battery data is reported, whether the report is successful is confirmed according to the return value.
The return value may be a response value returned by a receiver of the target battery data, or a state value determined by the buried point reporting thread according to a response of the receiver. Whether the report is successful can be confirmed according to the return value. For example, if the return value is the first preset value, the report is confirmed to be successful. The first preset value is a numerical value representing the success of reporting. For example, if the target battery data is reported from the kernel state to the user state, a return value ret may be obtained through a ret = Fb _ key _ send _ to _ user command, where ret is 0, that is, a first preset value, which indicates that the report is successful.
In an embodiment, the determining whether the report is successful according to the return value may include:
if the return value of the first preset value is obtained within the second preset time, the report success is confirmed;
and if the return value of the first preset value is not obtained within the second preset time, reporting the target battery data again and obtaining the return value, and if the return value of the first preset value is not obtained within the second preset time after the target battery data is reported for the kth 1 time, confirming that the reporting fails.
In one reporting process, multiple attempts to report the target battery data are allowed, k1 represents the allowed maximum number of times and is a positive integer not less than 2, and the second preset time length is the waiting response time length after the target battery data is reported once, and both the time length and the waiting response time length can be set according to experience or specific conditions. For example, k1 may be 3, and the second preset time may be 500ms, that is, after reporting the target battery data, if a return value of 0 is not obtained within 500ms, indicating that the report success cannot be confirmed this time, reporting the target battery data again, and if no return value of 0 is obtained after 3 consecutive reports, confirming that the report of the battery burying point event fails this time. The single reporting is possibly influenced by the network environment, the working state of the equipment and the like, the situation of unsuccessful reporting exists, multiple times of reporting attempts are allowed to increase the success rate of reporting, and the robustness of the scheme is improved.
The first preset duration > the second preset duration k1, as in the above example, if the target battery data is attempted to be reported 3 times, 500ms × 3=1.5s is required, and in addition, the time required for reporting the target battery data itself (usually 1-20ms is required for one report) and the time of other links are required, and the first preset duration is used as the longest waiting time and needs to be longer than 1.5s, so that enough time is left for waiting for reporting the target battery data.
Fig. 3 shows a schematic flow of a battery data reporting method, which is mainly executed by a buried point triggering thread and a buried point reporting thread. The process may include the following steps:
step S301, triggering the battery buried point, and waking up the buried point triggering thread to execute steps S301-S308 and S322-S324;
step S302, preparing target battery data;
step S303, checking the target battery data, if the checking is not passed, executing step S304, and if the checking is passed, executing step S305;
step S304, returning the information that the verification fails;
step S305, locking a buried point lock and a data lock;
step S306, preprocessing the target battery data, and setting trigger _ data _ ok = true to indicate that the target battery data is ready;
step S307, unlocking the data lock, and initializing a buried point completion amount trigger _ ack, wherein the trigger _ ack can be initialized to 0 if yes;
step S308, awakening a buried point reporting thread, and executing steps S309-S321 by the buried point reporting thread;
step S309, judging whether the trigger _ data _ ok is true, wherein the judgment is shown whether the target battery data is ready, if not, executing step S310, and if so, executing step S311;
step S310, waiting for the preparation of target battery data, and executing step S309 again;
step S311, executing trigger _ data _ lock, and locking a preset storage area;
step S312, writing the target battery data into a preset storage area, and extracting a target character string, for example, tag, event _ id, type, flag, time information, key information and the like in the target battery data can be connected into the target character string;
step 313, executing trigger _ data _ unlock, unlocking a preset storage area, and setting trigger _ data _ ok = false so as to conveniently judge whether the target battery data is ready to be finished or not at the next time of embedding;
step S314, filling the target character string into the uploading channel dcs, if the buffer of dcs can be emptied first, then filling the buffer with the target character string;
step S315, the dcs _ info _ lock is executed to lock the uploading channel;
step S316, executing ret = Fb _ key _ send _ to _ user, reporting the target character string from the kernel state to the user state, and acquiring a return value ret;
step S317, performing dcs _ info _ unlock to unlock the uploading channel;
step S318, determining whether ret is 0, if not, performing step S319, and if so, performing step S321;
step S319, determining whether the number of times of trying to report reaches 3 times, if not, performing step S315, and if so, performing step S320;
step S320, confirming the report failure and waiting for overtime;
step S321, executing complete (trigger _ ack), confirming that the report is successful, and triggering the thread through the buried point;
step S322, after waking up the buried point reporting thread, the buried point triggering thread waits for the completion of trigger _ ack within 3 seconds at most, if not, executing step S323, and if yes, executing step S324;
step S323, confirm overtime, return to timeout;
and step S324, unlocking the buried point lock, and completing the process of reporting the target battery data by the whole buried point.
The battery data reporting process can solve the problems of missing report, false report and frequent report of the buried points, and the accuracy of the battery data is ensured from the source, so that effective monitoring and evaluation can be conveniently carried out according to the battery data in the follow-up process, and the use scheme of the battery is optimized.
The above describes the process of reporting the target battery data when the preset condition is satisfied. In this exemplary embodiment, different preset conditions may be set, for example, different types of battery burying points may be set to correspond to different events in the battery use or charging process, so that when a corresponding event occurs, reporting of target battery data may be triggered. The following describes several cases in which the preset conditions are satisfied:
1. charging intermittent event
In one embodiment, it may be provided that the preset condition is met in the event of a charge interruption event, for example, setting a battery burial point may include a charge interruption burial point. Intermittent charging refers to a phenomenon in which connection and disconnection are repeated due to a contact failure with a charger or the like. Generally, connecting a charger means starting charging, disconnecting the charger means ending charging, and starting or ending charging may trigger a battery burying point and need to report battery data. If charging is interrupted, battery embedding points for starting charging or finishing charging are triggered repeatedly, so that a large amount of meaningless battery data are reported, statistics of the battery data are interfered, and the waste of embedding point resources is caused. Based on this, the problem can be solved by using the charging interruption as a special battery embedding point, recognizing the charging interruption event and triggering the charging interruption embedding point, and reporting the target battery data reflecting the real situation instead of repeatedly triggering the battery embedding point for starting charging or finishing charging.
Specifically, referring to fig. 4, the meeting of the preset condition may include the following steps S410 to S430:
step S410, when the charger is connected, if the current charging connection state is opposite to the preorder charging connection state, recording the current time as the connection time;
step S420, determining whether a charging intermittent event occurs according to the interval duration between the connection time and the recorded disconnection time;
in step S430, if a charge interruption event occurs, it is determined that a preset condition is satisfied.
And the current charging connection state represents the currently recorded connection state of the terminal and the charger. In one embodiment, the current charging connection state may include a current wired charging connection state and a current wireless charging connection state, for example, the current wired charging connection state is vbus _ rising, vbus _ rising = true indicates that a wired charger is connected (i.e., a charger plugged-in port), vbus _ rising = false indicates that a connection is disconnected (i.e., a charger unplugged port); the current wireless charging connection state is connect, connect = true indicates that the wireless charger is connected, and connect = false indicates that the connection is disconnected. The preamble charge connection state refers to a charge connection state earlier than the current charge connection state, and may be a last recorded charge connection state or a charge connection state that is delayed from the current charge connection state. For example, pre _ vbus _ rising may be used to indicate the preamble wired charging connection state, and pre _ connect may be used to indicate the preamble wireless charging connection state.
When the charger is connected, the current charging connection state is usually "connected", and if the previous charging connection state is "disconnected", the two are opposite, which means that the current charging connection state is changed from the disconnected state to the connected state, and the current time is recorded as the connection time.
The recorded disconnect time may be the time the last time the connection to the charger was disconnected. In one embodiment, when the connection with the charger is disconnected, if the current charging connection state is opposite to the preceding charging connection state, the current time is recorded as the disconnection time. In some cases, the interrupt signal of the charger may be triggered multiple times, but the time of the first disconnection needs to be recorded and is taken as the disconnection time, the current charging connection state and the preamble charging connection state are satisfied in the first disconnection, and then the disconnection time is recorded, and the current charging connection state and the preamble charging connection state may not be satisfied in the subsequent triggering of the interrupt signal, and thus the disconnection time is not recorded. Thereby ensuring the accuracy of the disconnection time.
The recorded disconnection time is generally earlier than the current connection time, and the interval duration between the two is the interval duration of plugging and unplugging the charger, and if the interval duration is too short, it indicates that there may be charging discontinuity. In the present exemplary embodiment, whether the charge interruption event occurs is determined according to the interval duration between the connection time and the disconnection time.
Based on the scheme of fig. 4, the preset condition is met when the charging intermittent event occurs, the target battery data related to the charging intermittent event is reported, the intermittent condition occurring when the terminal is charged in a wired or wireless mode can be monitored, and data support is provided for statistical analysis and early warning of an abnormal mechanism of charging intermittent.
In one embodiment, the occurrence of a charge interruption event is determined if the duration of the interval between the connection time and the recorded disconnection time is less than a third predetermined duration. The third preset time period is used for measuring whether the interval time period is too short, and may be set according to experience or specific conditions, for example, a default value of the third preset time period may be 1 second, and different third preset time periods may be configured for different charging schemes. And the interval duration is less than the third preset duration, which indicates that the interval duration of the current connection charger and the last disconnection is too short, and a charging intermittent event occurs. Therefore, the method meets the preset conditions, and can further acquire the related target battery data for reporting.
In an embodiment, the determining that the preset condition is met if the charge interruption event occurs may include:
and if the charging intermittent event occurs and the charging intermittent record identifier indicates that the charging intermittent event is not recorded, determining that the preset condition is met.
Wherein the charging discontinuous record identifier is used for indicating whether the charging discontinuous event is recorded. For example, the charging interruption event may be represented by break _ recording = true, and the charging interruption event is recorded by break _ recording = false. In a charge interruption event, the charge interruption usually occurs repeatedly and continues for a while, and the terminal records when the charge interruption event is found for the first time, and the break _ recording changes from false to true. Illustratively, it is determined that a charge interruption event occurs, and break _ recording = false, indicating that the current charge interruption event is found for the first time, when the preset condition is satisfied. After recording the current charge interruption event, break _ recording changes from false to true. If the same charging intermittent event is continuously generated in the follow-up process, the data reporting is not required to be triggered repeatedly.
In an embodiment, the method for reporting battery data may further include the following steps:
and determining whether the charging intermittent events comprise fast charging interruption or not according to the exit fast charging indication codes in the charging intermittent events, and if so, adding fast charging intermittent information to the target battery data.
Wherein, the quit quick charging indication code is used for indicating that the quick charging is quitted (namely the quick charging mode) for any reason. Generally, in the fast charging process, the default value of the exiting fast charging indication code is 0, and a value other than 0 indicates that the fast charging is exited, and a specific numerical value thereof represents a specific reason, and the exiting fast charging indication code (fastchg _ code) in different fast charging schemes is shown below.
For the fast charging scheme controlled by the MCU (micro control unit), the exit fast charging indication code can be shown as the following code:
Chg_track_mcu_voocphy_break_code{
TRACK_MCU_VOOCPHY_BREAK_DEFAULT=0,
TRACK_MCU_VOOCPHY_FAST_ABSENT,
TRACK_MCU_VOOCPHY_BAD_CONNECTED,
TRACK_MCU_VOOCPHY_BTB_TEMP_OVER,
};
for the fast charging scheme controlled by ADSP _ vophy (analog digital signal processing chip — flash physical layer), the exit fast charging indicator code may be as follows:
Chg_track_adsp_voocphy_break_code{
TRACK_ADSP_VOOCPHY_BREAK_DEFAULT=0,
TRACK_ADSP_VOOCPHY_BAD_CONNECTED,
TRACK_ADSP_VOOCPHY_FRAME_H_ERR,
TRACK_ADSP_VOOCPHY_CLK_ERR,
TRACK_ADSP_VOOCPHY_HW_VBATT_HIGH,
TRACK_ADSP_VOOCPHY_HW_TBATT_HIGH,
TRACK_ADSP_VOOCPHY_COMMU_TIME_OUT,
TRACK_ADSP_VOOCPHY_ADAPTER_COPYCAT,
TRACK_ADSP_VOOCPHY_BTB_TEMP_OVER,
};
for CP _ VOOCPHY (charging port-flash physical layer) controlled fast charging scheme, the exit fast charging indicator code may be as follows:
Chg_track_cp_voocphy_break_code{
TRACK_CP_VOOCPHY_BREAK_DEFAULT=0,
TRACK_CP_VOOCPHY_FAST_ABSENT,
TRACK_CP_VOOCPHY_BAD_CONNECTED,
TRACK_CP_VOOCPHY_FRAME_H_ERR,
TRACK_CP_VOOCPHY_BTB_TEMP_OVER,
TRACK_CP_VOOCPHY_COMMU_TIME_OUT,
TRACK_CP_VOOCPHY_ADAPTER_COPYCAT,
};
according to the exit quick charge indication code in the charge interruption event, whether quick charge interruption occurs in the charge interruption event can be determined. And if the target battery data comprises the quick charge interruption, adding quick charge interruption information to the target battery data for reporting, so as to facilitate analysis of interruption reasons.
In an embodiment, the method for reporting battery data may further include the following steps:
and under the condition that the preorder charging connection state updating condition is met, updating the preorder charging connection state by adopting the current charging connection state.
Wherein the preamble charging connection state update condition may include: when the charger is connected or disconnected, if the current charging connection state is the same as the preorder charging connection state, the updating condition of the preorder charging connection state is met; or, after the preparation of the target battery data is completed, the preorder charging connection state updating condition is satisfied. The preorder charging connection state is updated to be the same as the current charging connection state under the above conditions, so that whether the current charging connection state is the same as or opposite to the preorder charging connection state is effectively judged when the charger is connected or disconnected next time, and accurate processing is further executed.
Fig. 5 shows a process flow for triggering a charging intermittent buried point in wired charging, which may include:
step S501, a wired plugin (plug-in) is triggered in an interruption mode, and the plugging event of a wired charger is indicated;
step S502, judging whether vbus _ rising is true or not, indicating whether the vbus _ rising is a charger insertion event or not, if not, executing step S503, and if so, executing step S507;
step S503, judging whether pre _ vbus _ rising is not equal to vbus _ rising (namely whether the two are opposite), if so, executing steps S504-S506, otherwise, executing step S506;
step S504, recording wired pull-out time vbus _ detach _ t;
step S505, recording wired charging information, including information of a charger (adapter), information in a register and the like;
step S506, updating pre _ vbus _ rising = vbus _ rising;
step S507, determining whether pre _ vbus _ rising is not equal to vbus _ rising (i.e., whether the two are opposite), if yes, performing step S508, and if not, performing step S506;
step S508, recording the wired insertion time vbus _ attach _ t;
step S509, determining whether an interval duration Δ t between the vbus _ attach _ t and the vbus _ detach _ t is less than a third preset duration fastchg _ break _ t of fast charging (for example, 1S), and an exit fast charging indication code fastchg _ code is not equal to 0 (that is, there is a fast charging interruption), if not, performing step S510, and if so, performing step S512;
step S510, determining whether the interval duration Δ t of vbus _ attach _ t and vbus _ detach _ t is less than a third preset duration normal _ break _ t of wired general charging (non-rapid charging) (if yes, 500 ms), if no, executing step S511, and if yes, executing step S512;
step S511, setting a charging discontinuous recording identifier break _ recording = false;
step S512, determining whether the break _ recording is false, which indicates whether the charging intermittent record identifier indicates that the charging intermittent event is not recorded, if yes, performing step S513, and if not, performing step S515;
step S513, setting break _ recording = true;
step S514, preparing target battery data, and if the fast charging interruption exists, writing fast charging interruption information into the target battery data;
step S515, judging whether the conventional battery burying points need to be reported, wherein the conventional battery burying points comprise battery burying points in a conventional charging process, battery burying points triggered slowly during charging or battery burying points triggered without charging, if not, executing step S516, and if so, executing step S506;
in step S516, the conventional battery burying point is cancelled, the charging intermittent burying point can be directly executed, and finally, step S506 is executed, and the process ends.
Fig. 6 shows a process flow for triggering a charging intermittent burying point in wireless charging, which may include:
step S601, triggering interruption of wireless connection, and indicating that an event of connection or disconnection of a wireless charger occurs;
step S602, determining whether the connect is true, which indicates whether the connect is a charger connection event, if not, performing step S603, and if so, performing step S607;
step S603, determining whether pre _ connect is not equal to connect (i.e. whether the two are opposite), if yes, performing steps S604-S606, otherwise, performing step S606;
step S604, recording wireless disconnection time wls _ detach _ t;
step S605, recording wireless charging information, including information of a charger (adapter), key information in a register and the like;
step S606, update pre _ connect = connect;
step S607, determining whether pre _ connect is not equal to connect (i.e. whether the two are opposite), if yes, performing step S608, otherwise, performing step S606;
step S608, recording wireless connection time wls _ attach _ t;
step S609, judging whether the interval duration delta t of the wls _ attach _ t and the wls _ detach _ t is less than a third preset duration wls _ break _ t (if the interval duration delta t is 6 seconds), if not, executing step S610, and if the interval duration delta t is greater than the third preset duration wls _ break _ t, executing step S611;
step S610, setting a charging discontinuous record identifier break _ recording = false;
step S611, determining whether the break _ recording is false, which indicates whether the charging intermittent record identifier indicates that the charging intermittent event is not recorded, if yes, performing step S612, and if not, performing step S614;
step S612, setting break _ recording = true;
step S613, preparing target battery data to which the wireless intermittent information may be added;
step S614, judging whether the conventional battery burying points need to be reported, wherein the conventional battery burying points comprise battery burying points in the conventional charging process, battery burying points triggered slowly during charging or battery burying points triggered without charging, if not, executing step S615, and if so, executing step S606;
in step S615, the conventional battery burying is cancelled, the charging intermittent burying can be directly executed, and finally step S606 is executed, and the process ends.
Through the method of fig. 5 or fig. 6, the intermittent charging burying point can be linked with the reporting of the battery data of the conventional battery burying point, so that the user can record and report the data only once when plugging and unplugging.
2. Low voltage event
The low voltage event refers to an event that the battery voltage is too low, and related target battery data can be reported. In one embodiment, as shown in fig. 7, the meeting of the preset condition may include the following steps S710 and S720:
step S710, if the battery voltage is detected to be less than the low voltage threshold, determining that the current battery state is a low voltage state;
in step S720, if the current battery state is a low voltage state and the preorder battery state is a non-low voltage state, it is determined that a preset condition is satisfied.
The low voltage threshold is a threshold for measuring whether the battery voltage is too low, and may be set according to experience or specific conditions, such as 3.3V. If the detected battery voltage is less than the low voltage threshold, the low voltage state is indicated. The preamble battery state means a state earlier than the current battery state, and indicates whether the battery is at a low voltage at a certain time earlier than the current time. If the current battery state is a low-voltage state and the preorder battery state is a non-low-voltage state, the battery is changed from the non-low-voltage state to the low-voltage state, namely, the battery enters the low-voltage state for the first time, and under the condition, the preset condition is determined to be met so as to trigger reporting of target battery data. Thereafter, the battery is continuously in a low voltage state without repeatedly triggering a low voltage buried point.
In an embodiment, a corresponding battery burying point may be set for a low voltage event, for example, the battery burying point may be a low voltage burying point, and when the condition of fig. 7 is satisfied, the low voltage burying point is triggered, and then target battery data may be reported.
In an embodiment, the method for reporting battery data may further include the following steps:
and under the condition that the preorder battery state updating condition is met, updating the preorder battery state by adopting the current battery state.
Wherein the preamble battery status update condition may include: after judging whether the current battery state is a low-voltage state and the preorder battery state is a non-low-voltage state, updating conditions of the preorder battery state are met; after the low voltage buried point is triggered, the updating condition of the preorder battery state is met. The preorder battery state is updated to be the same as the current battery state under the above conditions, so that whether the condition of step S720 is satisfied can be effectively judged when the battery voltage is detected to be less than the low voltage threshold value next time and the current battery state is determined, and then accurate processing is performed.
FIG. 8 shows a process flow for triggering a low voltage buried point, which may include:
step S801, detecting battery voltage;
step S802, judging whether the battery voltage is smaller than a low voltage threshold value, if not, executing step S803, and if so, executing step S804;
step S803, update pre _ vbatt _ too _ low = vbatt _ too _ low, which means that the preamble battery state is updated to be the same as the current battery state;
step S804, determining that the current battery state is a low voltage state, and setting vbatt _ too _ low = true;
step S805, determining whether pre _ vbatt _ too _ low is false and vbatt _ too _ low is true, indicating whether the preorder battery state is a non-low voltage state and whether the current battery state is a low voltage state, if not, performing step S803, and if so, performing step S806;
step S806, triggering a low-voltage buried point;
in step S807, target battery data, which may include current battery level, battery voltage, and the like, is prepared.
3. Low battery retention event
The low power retention event is an event for reporting the time for the battery to maintain the terminal on under the low power. In an embodiment, the meeting the preset condition may include:
and if the detected battery UI electric quantity is less than or equal to the low electric quantity threshold value in the continuous k2 calculation periods, determining that the preset condition is met.
The electric quantity of the battery UI (User Interface) refers to the electric quantity displayed on the UI, such as UISOC, and the electric quantity of the battery UI is obtained by calculating according to the actual electric quantity of the battery in a calculation period, such as by performing smooth calculation according to the actual electric quantity of the battery within 5 seconds; k2 represents the number of continuous calculation cycles of low battery and is a positive integer not less than 2. Generally, if the battery UI power is less than or equal to the low power threshold for k2 consecutive calculation cycles, the low power auto-off may be triggered. The low battery threshold may be set empirically or on a case-by-case basis, such as may be 1%. Illustratively, if it is detected that the power of the battery UI is reduced to 1% and k2 calculation cycles are maintained for 1%, a preset condition is met, and reporting of data of low power retention time and other related battery data is triggered.
In an embodiment, if it is detected that the power level of the battery UI is less than or equal to the low power threshold in k2 consecutive calculation cycles, determining that the preset condition is met may include the following steps:
when the electric quantity of the battery UI is reduced to a low electric quantity threshold value, counting is started, and when a calculation period is passed and the electric quantity of the battery UI is kept smaller than or equal to the low electric quantity threshold value, a count value is increased by one;
and if the count value reaches k2 and the low power retention record identifier indicates that no low power retention event is recorded, determining that the preset condition is met.
Wherein the low power retention record identifier is used to indicate whether a low power retention event has been recorded. For example, the event may be represented by uisoc _ keep _1_ record (1 represents a low battery threshold), uisoc _ keep _1_ record = true indicating that a low battery event has been recorded, and uisoc _ keep _1_ record = false indicating that a low battery event has not been recorded. In this exemplary embodiment, when the count value reaches k2, it indicates that the power of the UI in k2 consecutive calculation cycles is less than or equal to the low power threshold, and the low power retention record identifier indicates that no low power retention event is recorded, which indicates that the data report has not been triggered by the low power retention event this time, in this case, a preset condition is satisfied to trigger the data report, so that the data report can be prevented from being repeatedly triggered in one low power retention event.
In an embodiment, the time when the power of the battery UI first drops to the low power threshold may be recorded as the low power retention start time, and when a preset condition is satisfied, the current time is recorded as the low power retention end time, and the low power retention time obtained by subtracting the current time from the low power retention end time is used as a part of the target battery data and may be reported.
In one embodiment, a corresponding battery burying point may be set for the low battery retention event, for example, the battery burying point may be a low battery retention burying point, and the low battery retention related target battery data may be reported by triggering the low battery retention burying point.
FIG. 9 illustrates a process flow for triggering a low-charge retention buried point, which may include:
step S901, detecting a battery uisoc;
step S902, determining whether uisoc is not equal to uisoc _ pre and whether uisoc is equal to 1% (i.e., a low power threshold), where uisoc _ pre represents a preamble battery UI power, which is a battery UI power earlier than a current time, if yes, it indicates that the battery UI power first drops to 1%, then step S903 is executed, and if no, step S904 is executed;
step S903, recording the current time as a low power retention start time start _ time;
step S904, updating uisoc _ pre to be the same as uisoc, jumping to step S901 if step S904 is executed if the condition of step S902 is not satisfied, and continuing to execute step S905 if step S904 is executed if the condition of step S902 is satisfied;
step S905, determining whether vbatt _ min is smaller than vbat _ keep _ soc _1, where vbatt _ min is a minimum battery voltage value, and vbat _ keep _ soc _1 is a low battery holding voltage threshold, which may be set according to experience or specific circumstances, such as 3.31V; if not, executing step S906, if yes, executing step S907;
step S906, setting reduce _ count =0, which indicates that the count value is cleared;
step S907, count the reduce _ count according to the calculation period, and increase one for each calculation period;
step S908, determining whether reduce _ count is greater than or equal to k2 and uisoc _ keep _1 \/u record (i.e. low battery keep record indication) is false, if not, performing step S909, and if yes, performing step S910;
step S909, setting uisoc _ keep _1 \ u record = false, and jumping to step S901;
step S910, setting uisoc _ keep _1 \ u record = true;
step S911, triggering a low-electricity-quantity maintenance buried point;
step S912, recording end _ time;
step S913, calculating the low-battery retention time = end _ time-start _ time;
in step S914, target battery data is prepared, which may include a low battery retention time, a maximum battery voltage, a minimum battery voltage, an actual battery level, a UI battery level, a battery capacity when the uisoc is reduced to 1%, a battery capacity when the battery is turned off, a current battery current, and the like.
4. Cell differential pressure event
The battery cell pressure difference event refers to an event that the pressure difference between different battery cells is too large, and can be used for reporting related abnormal data of the battery cell with the too large pressure difference. In one embodiment, as shown in fig. 10, the meeting of the preset condition may include the following steps S1010 and S1020:
step S1010, obtaining the maximum voltage value and the minimum voltage value of a plurality of battery cells;
in step S1020, if the difference between the maximum voltage value and the minimum voltage value exceeds the differential pressure threshold, it is determined that the preset condition is satisfied.
It should be noted that the scheme of fig. 10 is directed to the terminals of multiple battery cells. Generally, the voltages of a plurality of battery cells should be relatively close, and if the difference is relatively large, it indicates that there may be a battery abnormality. The voltage difference threshold is a threshold for measuring whether the cell voltage difference is too large, and may be set according to experience or specific conditions, for example, may be 1V. If the difference value between the maximum voltage value and the minimum voltage value in the plurality of battery cells exceeds the voltage difference threshold value, the voltage difference value of at least two battery cells is too large, at the moment, a preset condition is met, and the report of relevant target battery data with too large battery cell voltage difference is triggered. The target battery data may include: battery voltage maximum, battery voltage minimum, actual battery charge, battery UI charge, whether in charge, etc. Therefore, monitoring and management of overlarge cell voltage difference can be realized, and the abnormal problem of the multi-cell battery is solved.
In an embodiment, a corresponding battery burying point may be set for a cell voltage difference event, for example, the battery burying point may be set, and target battery data related to the cell voltage difference is reported by triggering the cell voltage difference burying point.
5. Burn-in prevention event
The burn-in prevention event refers to an event that protection is triggered to prevent a port from being damaged when the temperature of a charging port (such as a USB port) is abnormal, and can be used for reporting target battery data related to burn-in prevention. In one embodiment, as shown in fig. 11, the meeting of the preset condition may include the following steps S1110 and S1120:
step S1110, under the condition that the USB port is inserted into the charger, judging whether the anti-burning condition is met according to the battery temperature and the USB port temperature;
in step S1120, if the burn-out prevention condition is satisfied, it is determined that the preset condition is satisfied.
The anti-burning condition is used for judging whether the anti-burning function of the terminal is triggered or not, and the anti-burning function is mainly used for judging whether the charging port has an overheating risk. And under the condition of meeting the burn-in prevention condition, determining that the preset condition is met, and triggering and reporting target battery data related to the burn-in prevention.
In one embodiment, the burn-out prevention condition may include at least one of:
the battery temperature is less than the first temperature, and the USB port temperature is greater than the second temperature;
the battery temperature is higher than a first temperature, and the temperature difference value between the USB port temperature and the battery temperature is higher than a first temperature difference threshold value;
the temperature difference value between the temperature of the USB port and the temperature of the battery is larger than a second temperature difference threshold value, and the rising rate of the temperature of the USB port reaches a preset temperature rising rate.
The first temperature, the second temperature, the first temperature difference threshold, the second temperature difference threshold and the preset temperature rise rate can be set according to experience or specific conditions. For example, the first temperature is 50 degrees, the second temperature is 57 degrees, the first temperature difference threshold is 7 degrees, the second temperature difference threshold is 5 degrees, and the preset temperature rise rate is 1 degree/minute.
For example, if the battery temperature is less than 50 degrees, the USB port temperature exceeds 57 degrees, or the battery temperature is greater than 50 degrees, the USB port temperature exceeds 7 degrees, which triggers the burn prevention, the above-mentioned trigger condition may be marked as condition 1. If the temperature of the USB port exceeds the battery temperature and reaches 5 degrees, and the temperature of the USB port rises to 3 degrees within 3 consecutive seconds, the burn-out prevention is also triggered, and the trigger condition may be marked as condition 2.
In one embodiment, a corresponding battery burying point may be set for the burn-out prevention event, for example, the battery burying point may be the burn-out prevention burying point, and target battery data related to the burn-out prevention is reported by triggering the burn-out prevention burying point.
Fig. 12 shows a process flow for triggering burn-in prevention, which may include:
step S1201, monitoring the battery temperature and the USB port temperature;
step S1202, determining whether to trigger the burn-out prevention condition1, if so, executing step S1203, otherwise, executing step S1204;
step S1203, setting condition =1;
step S1204, judge whether to trigger the mouth condition2 of preventing burning, if, carry out step S1205, if not, jump to step S1201;
step S1205, setting condition =2;
step S1206, determining whether the condition is non-zero, if yes, executing step S1207, otherwise, jumping to step S1201;
step S1207, triggering the burning-prevention port buried points;
step S1208, determining whether the condition is 1, if yes, performing step S1209, and if no, performing step S1210;
step S1209, determining the burning-prevention reason as condition1, and continuing to execute step S1211;
step S1210, determining the burning prevention reason as condition2, and continuing to execute step S1211;
in step S1211, target battery data, which may include burn-in prevention reason information, a battery temperature, a USB port temperature (which may include a temperature of the USB), and the like, is prepared.
Several events (or battery burial points) requiring reporting of battery data are described above. In the present exemplary embodiment, new events may be added according to actual needs. The method comprises the steps of adding event classification information such as type and flag in a data reporting drive registration file, adding mapping relation (such as type and flag mapping relation) between different levels of classification information, filling a structure body defined by a buried point, and uploading specific information required by a new event, so that the addition of the event is conveniently completed, and various types of events can be reported to monitor and manage related battery data.
The exemplary embodiment of the present disclosure also provides a device for reporting battery data. Referring to fig. 13, the apparatus 1300 for reporting battery data may include:
a data obtaining module 1310 configured to obtain target battery data to be reported in response to a preset condition being met;
a data reporting module 1320, configured to adjust the preset identification bit to a second value and report the target battery data when detecting that the preset identification bit is the first value;
the preset flag bit recovery module 1330 is configured to adjust the preset flag bit back to the first value if it is determined that the report on the target battery data is successful within the first preset duration.
In an embodiment, the reporting of the target battery data includes:
writing target battery data into a preset storage area;
and extracting the classification information and the key information of the target battery data from a preset storage area, generating a target character string corresponding to the target battery data, and reporting the target character string.
In an embodiment, the writing the target battery data into the preset storage area includes:
and locking the preset storage area, and writing the target battery data into the preset storage area.
In an embodiment, the reporting of the target string includes:
and locking a preset uploading channel, and reporting the target character string through the preset uploading channel.
In one embodiment, the data reporting module 1320 is further configured to:
and after the target battery data is reported, whether the report is successful is confirmed according to the return value.
In an embodiment, the determining whether the report is successful according to the return value includes:
if the return value of the first preset value is obtained within the second preset time, the report success is confirmed;
if the return value of the first preset value is not obtained within the second preset time, reporting the target battery data again and obtaining the return value, and if the return value of the first preset value is not obtained within the second preset time after the target battery data is reported for the kth 1 time, confirming that the reporting fails;
wherein k1 is a positive integer not less than 2, and the first preset time length is greater than k1 times of the second preset time length.
In an embodiment, the meeting of the preset condition includes:
when the charger is connected, if the current charging connection state is opposite to the preorder charging connection state, recording the current time as the connection time;
determining whether a charging intermittent event occurs according to the interval duration between the connection time and the recorded disconnection time;
and if the charging intermittent event occurs, determining that the preset condition is met.
In one embodiment, the data obtaining module 1310 is further configured to:
when the connection with the charger is disconnected, if the current charging connection state is opposite to the preorder charging connection state, recording the current time as the disconnection time.
In one embodiment, the determining whether the charge interruption event occurs according to the interval duration between the connection time and the recorded disconnection time includes:
and if the interval duration between the connection time and the recorded disconnection time is less than a third preset duration, determining that a charging intermittent event occurs.
In an embodiment, the determining that the preset condition is met if the charge interruption event occurs includes:
and if the charging intermittent event occurs and the charging intermittent record identifier indicates that the charging intermittent event is not recorded, determining that the preset condition is met.
In one embodiment, the data acquisition module 1310 is further configured to:
and determining whether the charging intermittent events comprise fast charging interruption or not according to the exit fast charging indication codes in the charging intermittent events, and if so, adding fast charging intermittent information to the target battery data.
In one embodiment, the data acquisition module 1310 is further configured to:
and under the condition that the update condition of the preorder charging connection state is met, updating the preorder charging connection state by adopting the current charging connection state.
In an embodiment, the meeting of the preset condition includes:
if the battery voltage is detected to be smaller than the low voltage threshold value, determining that the current battery state is a low voltage state;
and if the current battery state is a low-voltage state and the preorder battery state is a non-low-voltage state, determining that the preset condition is met.
In one embodiment, the data acquisition module 1310 is further configured to:
and under the condition that the preorder battery state updating condition is met, updating the preorder battery state by adopting the current battery state.
In an embodiment, the meeting of the preset condition includes:
if the detected battery UI electric quantity is less than or equal to the low electric quantity threshold value in k2 continuous calculation cycles, determining that a preset condition is met;
the UI electric quantity of the battery is obtained by calculation according to the actual electric quantity of the battery in the calculation period; k2 is a positive integer not less than 2.
In an embodiment, if it is detected that the power level of the battery UI is less than or equal to the low power threshold in k2 consecutive calculation cycles, determining that the preset condition is met includes:
when the electric quantity of the battery UI is reduced to a low electric quantity threshold value, counting is started, and when a calculation period is passed and the electric quantity of the battery UI is kept smaller than or equal to the low electric quantity threshold value, a count value is increased by one;
and if the count value reaches k2 and the low power keeping record identifier indicates that the low power keeping event is not recorded, determining that the preset condition is met.
In an embodiment, the meeting of the preset condition includes:
acquiring a maximum voltage value and a minimum voltage value in a plurality of battery cells;
and if the difference value of the maximum voltage value and the minimum voltage value exceeds the pressure difference threshold value, determining that the preset condition is met.
In an embodiment, the meeting of the preset condition includes:
judging whether the anti-burning condition is met or not according to the battery temperature and the USB port temperature under the condition that the USB port is inserted into the charger;
and if the burning prevention condition is met, determining that the preset condition is met.
In one embodiment, the burn-out prevention condition comprises at least one of:
the battery temperature is less than the first temperature, and the USB port temperature is greater than the second temperature;
the battery temperature is higher than a first temperature, and the temperature difference value between the USB port temperature and the battery temperature is higher than a first temperature difference threshold value;
the temperature difference value between the temperature of the USB port and the temperature of the battery is larger than a second temperature difference threshold value, and the rising rate of the temperature of the USB port reaches a preset temperature rising rate.
In an embodiment, the reporting of the target battery data includes:
and reporting the target battery data from the kernel mode to the user mode.
The specific details of each part in the above device have been described in detail in the method embodiment, and thus are not described in detail.
Exemplary embodiments of the present disclosure also provide a computer-readable storage medium, which may be implemented in the form of a program product, including program code for causing an electronic device to perform the steps according to various exemplary embodiments of the present disclosure described in the above-mentioned "exemplary method" section of this specification, when the program product is run on the electronic device. In an alternative embodiment, the program product may be embodied as a portable compact disc read only memory (CD-ROM) and include program code, and may be run on an electronic device, such as a personal computer. However, the program product of the present disclosure is not so limited, and in this document, a readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
A computer readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A readable signal medium may be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Exemplary embodiments of the present disclosure also provide an electronic device, such as the terminal 110 described above. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as may be program code. The processor executes the executable instructions to perform the method for reporting battery data in the exemplary embodiment.
The structure of the electronic device will be exemplarily explained below by taking the mobile terminal 1400 in fig. 14 as an example. It will be appreciated by those skilled in the art that the configuration in figure 14 can also be applied to fixed type devices, in addition to components specifically intended for mobile purposes.
As shown in fig. 14, the mobile terminal 1400 may specifically include: processor 1401, memory 1402, bus 1403, mobile communication module 1404, antenna 1, wireless communication module 1405, antenna 2, display 1406, camera module 1407, audio module 1408, power module 1409, and sensor module 1410.
Processor 1401 may include one or more processing units, such as: the Processor 1401 may include an AP (Application Processor), a modem Processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband Processor, and/or an NPU (Neural-Network Processing Unit), etc.
The processor 1401 may be connected to the memory 1402 or other components by a bus 1403.
Memory 1402 may be used to store computer-executable program code, which may include instructions. Processor 1401 executes various functional applications and data processing of mobile terminal 1400 by executing instructions stored in memory 1402. The memory 1402 may also store application data, such as files for storing images, videos, and the like.
The communication function of the mobile terminal 1400 may be implemented by the mobile communication module 1404, the antenna 1, the wireless communication module 1405, the antenna 2, the modem processor, the baseband processor, and the like. The antennas 1 and 2 are used for transmitting and receiving electromagnetic wave signals. The mobile communication module 1404 may provide mobile communication solutions of 3G, 4G, 5G, etc. applied to the mobile terminal 1400. The wireless communication module 1405 may provide wireless communication solutions such as wireless local area network, bluetooth, near field communication, etc. applied to the mobile terminal 1400.
The display screen 1406 is used to implement display functions, such as displaying user interfaces, images, videos, and the like. The camera module 1407 is used to implement a shooting function, such as shooting images, videos, and the like. The audio module 1408 is used for performing audio functions, such as playing audio, capturing voice, and the like. The power module 1409 is configured to implement power management functions, such as charging a battery, powering a device, monitoring a battery status, and so on. The sensor module 1410 may include one or more sensors for implementing corresponding sensing functions.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functions of two or more modules or units described above may be embodied in one module or unit, according to exemplary embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the present disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.), or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system. Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This disclosure is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is to be limited only by the following claims.

Claims (23)

1. A method for reporting battery data is characterized by comprising the following steps:
responding to the condition meeting the preset condition, and acquiring target battery data needing to be reported;
under the condition that a preset identification bit is detected to be a first numerical value, the preset identification bit is adjusted to be a second numerical value, and the target battery data is reported;
and if the target battery data is successfully reported within a first preset time, adjusting the preset identification bit back to the first numerical value.
2. The method of claim 1, wherein reporting the target battery data comprises:
writing the target battery data into a preset storage area;
and extracting the classification information and the key information of the target battery data from the preset storage area, generating a target character string corresponding to the target battery data, and reporting the target character string.
3. The method of claim 2, wherein writing the target battery data to a predetermined storage area comprises:
and locking the preset storage area, and writing the target battery data into the preset storage area.
4. The method of claim 2, wherein the reporting the target string comprises:
and locking a preset uploading channel, and reporting the target character string through the preset uploading channel.
5. The method of claim 1, further comprising:
and after the target battery data is reported, whether the report is successful is confirmed according to a return value.
6. The method of claim 5, wherein the determining whether reporting is successful according to the returned value comprises:
if the return value of the first preset value is obtained within the second preset time, the report success is confirmed;
if the return value of the first preset value is not obtained within the second preset time, reporting the target battery data again and obtaining the return value, and if the return value of the first preset value is not obtained within the second preset time after the target battery data is reported for the kth 1 time, confirming that the reporting fails;
and k1 is a positive integer not less than 2, and the first preset time length is greater than k1 times of the second preset time length.
7. The method according to claim 1, wherein the meeting of the preset condition comprises:
when the charger is connected, if the current charging connection state is opposite to the preorder charging connection state, recording the current time as the connection time;
determining whether a charging intermittent event occurs according to the interval duration between the connection time and the recorded disconnection time;
and if the charging intermittent event occurs, determining that the preset condition is met.
8. The method of claim 7, further comprising:
when the connection with the charger is disconnected, if the current charging connection state is opposite to the preorder charging connection state, recording the current time as the disconnection time.
9. The method of claim 7, wherein determining whether a charge interruption event has occurred based on a length of time between the connection time and the recorded disconnection time comprises:
and if the interval duration between the connection time and the recorded disconnection time is less than a third preset duration, determining that a charging intermittent event occurs.
10. The method of claim 7, wherein determining that the preset condition is met if a charge interruption event occurs comprises:
and if the charging intermittent event occurs and the charging intermittent record identifier indicates that the charging intermittent event is not recorded, determining that the preset condition is met.
11. The method of claim 7, further comprising:
and determining whether the charging intermittent event comprises a quick charging intermittent event or not according to the exit quick charging indication code in the charging intermittent event, and if so, adding quick charging intermittent information to the target battery data.
12. The method of claim 7, further comprising:
and under the condition that the update condition of the preorder charging connection state is met, updating the preorder charging connection state by adopting the current charging connection state.
13. The method according to claim 1, wherein the meeting of the preset condition comprises:
if the battery voltage is detected to be smaller than the low voltage threshold value, determining that the current battery state is a low voltage state;
and if the current battery state is a low-voltage state and the preorder battery state is a non-low-voltage state, determining that the preset condition is met.
14. The method of claim 13, further comprising:
and under the condition that the updating condition of the preorder battery state is met, updating the preorder battery state by adopting the current battery state.
15. The method according to claim 1, wherein the meeting of the preset condition comprises:
if the detected battery UI electric quantity is less than or equal to a low electric quantity threshold value in k2 continuous calculation cycles, determining that the preset condition is met;
the UI electric quantity of the battery is obtained by calculation according to the actual electric quantity of the battery in the calculation period; k2 is a positive integer not less than 2.
16. The method according to claim 15, wherein determining that the preset condition is met if it is detected that the battery UI power level is less than or equal to the low power threshold for k2 consecutive calculation cycles comprises:
when the electric quantity of the battery UI is reduced to the low electric quantity threshold value, counting is started, and when one calculation period is passed and the electric quantity of the battery UI is kept smaller than or equal to the low electric quantity threshold value, a count value is increased by one;
and if the count value reaches k2 and the low power retention record identifier indicates that no low power retention event is recorded, determining that the preset condition is met.
17. The method according to claim 1, wherein the meeting of the preset condition comprises:
acquiring a maximum voltage value and a minimum voltage value in a plurality of battery cells;
and if the difference value between the maximum voltage value and the minimum voltage value exceeds a pressure difference threshold value, determining that the preset condition is met.
18. The method according to claim 1, wherein the meeting of the preset condition comprises:
judging whether the anti-burning condition is met or not according to the battery temperature and the USB port temperature under the condition that the USB port is inserted into the charger;
and if the burning-preventing condition is met, determining that the preset condition is met.
19. The method of claim 18, wherein the burn port prevention condition comprises at least one of:
the battery temperature is less than the first temperature, and the USB port temperature is greater than the second temperature;
the battery temperature is higher than a first temperature, and the temperature difference value between the USB port temperature and the battery temperature is higher than a first temperature difference threshold value;
the temperature difference value between the temperature of the USB port and the temperature of the battery is larger than a second temperature difference threshold value, and the rising rate of the temperature of the USB port reaches a preset temperature rising rate.
20. The method of claim 1, wherein reporting the target battery data comprises:
and reporting the target battery data from the kernel mode to the user mode.
21. A device for reporting battery data is characterized by comprising:
the data acquisition module is configured to respond to the condition that a preset condition is met and acquire target battery data needing to be reported;
the data reporting module is configured to adjust a preset identification bit to a second value and report the target battery data under the condition that the preset identification bit is detected to be a first value;
and the preset identification bit recovery module is configured to adjust the preset identification bit back to the first value if the target battery data is successfully reported within a first preset time.
22. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the method of any one of claims 1 to 20.
23. An electronic device, comprising:
a processor;
a memory for storing executable instructions of the processor;
wherein the processor is configured to perform the method of any of claims 1 to 20 via execution of the executable instructions.
CN202210843348.1A 2022-07-18 2022-07-18 Battery data reporting method and device, storage medium and electronic equipment Pending CN115225983A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210843348.1A CN115225983A (en) 2022-07-18 2022-07-18 Battery data reporting method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210843348.1A CN115225983A (en) 2022-07-18 2022-07-18 Battery data reporting method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN115225983A true CN115225983A (en) 2022-10-21

Family

ID=83611157

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210843348.1A Pending CN115225983A (en) 2022-07-18 2022-07-18 Battery data reporting method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN115225983A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117395544A (en) * 2023-12-12 2024-01-12 西安荣耀终端有限公司 Battery state data reporting method, terminal equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117395544A (en) * 2023-12-12 2024-01-12 西安荣耀终端有限公司 Battery state data reporting method, terminal equipment and storage medium
CN117395544B (en) * 2023-12-12 2024-05-07 西安荣耀终端有限公司 Battery state data reporting method, terminal equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109522147A (en) A kind of method, apparatus, storage medium and the terminal of record booting exception information
CN106488335A (en) Live-broadcast control method and device
CN111479016B (en) Terminal use duration reminding method and device, terminal and storage medium
CN115225983A (en) Battery data reporting method and device, storage medium and electronic equipment
CN113259744B (en) Video display method, device, equipment and medium
CN112428863A (en) Method for positioning charging system fault
CN115292052A (en) Memory recovery method, electronic device and computer-readable storage medium
US20200250451A1 (en) Information processing apparatus for analyzing image data, control method for the same, and storage medium
CN102880478A (en) Software updating method
CN105307103A (en) Communication apparatus and method for controlling communication apparatus
CN105958562A (en) Electronic equipment, charging protection method and device thereof
CN113434915A (en) Case intrusion state detection device and method and edge server
CN111830394A (en) Charging circuit fault detection method, electronic device and computer readable storage medium
CN105573934A (en) Method and device for operating multi-system slave device to access master device through USB connection
CN111124455B (en) Battery management system upgrading method, device, server and storage medium
CN114844179A (en) Electronic device and electricity meter resetting method
CN109426589B (en) File repair method and device
CN116450390A (en) Watchdog detection method and electronic equipment
CN116450386A (en) Watchdog detection method, device and storage medium
JP7150796B2 (en) Charging information management system and charging information management method
CN111756103A (en) Mobile terminal and charging method thereof
CN117093278B (en) Kernel shutdown method, electronic device and storage medium
CN117440088B (en) Conversation method and related equipment
CN106250865A (en) Based on the application scenarios recognition methods taken pictures and device
CN116501534B (en) Charging abnormality management method and related device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination