[go: up one dir, main page]

CN103019907B - A kind of end cell temperature monitoring method and device and terminal - Google Patents

A kind of end cell temperature monitoring method and device and terminal Download PDF

Info

Publication number
CN103019907B
CN103019907B CN201210488942.XA CN201210488942A CN103019907B CN 103019907 B CN103019907 B CN 103019907B CN 201210488942 A CN201210488942 A CN 201210488942A CN 103019907 B CN103019907 B CN 103019907B
Authority
CN
China
Prior art keywords
file
battery temperature
temperature data
battery
terminal
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.)
Active
Application number
CN201210488942.XA
Other languages
Chinese (zh)
Other versions
CN103019907A (en
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.)
Beijing Qihoo Technology Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co 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 Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to CN201210488942.XA priority Critical patent/CN103019907B/en
Publication of CN103019907A publication Critical patent/CN103019907A/en
Application granted granted Critical
Publication of CN103019907B publication Critical patent/CN103019907B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Secondary Cells (AREA)
  • Charge And Discharge Circuits For Batteries Or The Like (AREA)

Abstract

本发明实施例公开了一种终端电池温度监测方法和装置,以及一种终端,以解决由于无法获取当前的电池温度数据,致使电池温度数据过高而影响终端性能的问题。其中,终端电池温度监测方法包括:分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径;其中,所述电池温度数据是系统预先调用驱动程序通知操作系统写入到文件中的数据;读取所述文件路径对应的文件内容;从所述文件内容中提取所述电池温度数据。本发明实施例能够及时准确地读取电池温度数据,减少对终端性能的影响,并且在获取到终端的电池温度数据之后,可以将该电池温度数据显示在终端的用户界面上,从而可以更加直观地显示所述电池温度数据。

The embodiment of the present invention discloses a terminal battery temperature monitoring method and device, and a terminal to solve the problem that the battery temperature data is too high due to the inability to obtain the current battery temperature data, which affects the terminal performance. Wherein, the terminal battery temperature monitoring method includes: analyzing the file path of the file where the battery temperature data sensed by the temperature sensor in the terminal battery is located; wherein, the battery temperature data is that the system pre-calls the driver to notify the operating system to write into the file data; read the file content corresponding to the file path; extract the battery temperature data from the file content. The embodiment of the present invention can read the battery temperature data timely and accurately, reducing the impact on the performance of the terminal, and after acquiring the battery temperature data of the terminal, the battery temperature data can be displayed on the user interface of the terminal, so that it can be more intuitive display the battery temperature data.

Description

一种终端电池温度监测方法和装置及终端A terminal battery temperature monitoring method and device and terminal

技术领域technical field

本发明实施例涉及终端技术领域,具体涉及一种终端电池温度监测方法和装置,以及一种终端。The embodiments of the present invention relate to the technical field of terminals, and in particular to a method and device for monitoring battery temperature of a terminal, and a terminal.

背景技术Background technique

随着移动互联网的兴起,越来越多的用户选择了智能移动终端。现在的智能移动终端发展迅速,性能越来越强、屏幕尺寸越来越大、设备尺寸越来越薄,为了支撑更强的性能和更大的屏幕,一般都会配备更大容量的电池。With the rise of the mobile Internet, more and more users choose smart mobile terminals. Today's smart mobile terminals are developing rapidly, with increasingly powerful performance, larger screen sizes, and thinner device sizes. In order to support stronger performance and larger screens, batteries with larger capacities are generally equipped.

由于电池在使用过程中会产生热量,但是较薄的终端机身尺寸不利于散热,从而导致电池温度上升。特别是使用者在玩手机游戏的时候,这个情况更为突出,温度上升会影响终端的性能,甚至在极端情况下可能出现过热而导致爆炸。Since the battery generates heat during use, the thinner terminal body size is not conducive to heat dissipation, resulting in a rise in battery temperature. Especially when the user is playing mobile games, this situation is more prominent. A rise in temperature will affect the performance of the terminal, and may even cause an explosion due to overheating in extreme cases.

针对上述情况,目前还没有提出一种有效地解决上述问题的方法。In view of the above-mentioned situation, a method for effectively solving the above-mentioned problems has not been proposed yet.

发明内容Contents of the invention

鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的一种终端电池温度监测方法和装置,以及一种终端。In view of the above problems, the present invention is proposed to provide a terminal battery temperature monitoring method and device and a terminal that overcome the above problems or at least partially solve the above problems.

根据本发明的一个方面,提供了一种终端电池温度监测方法,包括:According to one aspect of the present invention, a terminal battery temperature monitoring method is provided, including:

分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径;其中,所述电池温度数据是系统预先调用驱动程序通知操作系统写入到文件中的数据;Analyzing the file path of the file where the battery temperature data sensed by the temperature sensor in the battery of the terminal is located; wherein, the battery temperature data is the data that the system pre-calls the driver to notify the operating system to write into the file;

读取所述文件路径对应的文件内容;Read the file content corresponding to the file path;

从所述文件内容中提取所述电池温度数据。The battery temperature data is extracted from the file content.

本发明实施例中,温度传感器数据感测到的电池温度所在文件的文件路径包括多个文件路径,In the embodiment of the present invention, the file path of the file containing the battery temperature sensed by the temperature sensor data includes multiple file paths,

所述读取所述文件路径对应的文件内容,包括:The reading of the file content corresponding to the file path includes:

依次从所述多个文件路径下读取对应的文件内容,所述依次读取为按照预先设置的顺序遍历读取;Read the corresponding file content from the plurality of file paths sequentially, the sequential reading is traversal reading according to the preset order;

依次读取时,当从任何一个文件路径下读取到文件内容时,停止读取下一个文件路径对应的文件内容。When reading sequentially, when the file content is read from any file path, stop reading the file content corresponding to the next file path.

本发明实施例中,依次读取时,当从任何一个文件路径读取到文件内容时,停止读取下一个文件路径对应的文件内容,包括:In the embodiment of the present invention, when reading in sequence, when the file content is read from any file path, stop reading the file content corresponding to the next file path, including:

当所述任何一个文件路径对应的文件内容读取成功时,判断所述任何一个文件路径对应的文件内容是否为空内容;When the file content corresponding to any one of the file paths is read successfully, it is judged whether the file content corresponding to any one of the file paths is an empty content;

当所述文件内容不为空内容时,停止读取下一个文件路径对应的文件内容。When the file content is not empty, stop reading the file content corresponding to the next file path.

本发明实施例中,读取所述文件路径对应的文件内容,还包括:In the embodiment of the present invention, reading the file content corresponding to the file path also includes:

依次读取时,当所述任何一个文件路径对应的文件内容读取失败,或者所述任何一个文件路径对应的文件内容为空内容时,继续读取下一个文件路径对应的文件内容。When reading sequentially, when the reading of the file content corresponding to any one file path fails, or the file content corresponding to any one file path is empty, continue to read the file content corresponding to the next file path.

本发明实施例中,依次从所述多个文件路径下读取对应的文件内容,包括:In the embodiment of the present invention, reading corresponding file contents from the plurality of file paths in turn includes:

调用信息读取ReadInfo函数,依次将所述多个文件路径作为参数传递给所述ReadInfo函数;Calling the information to read the ReadInfo function, and passing the multiple file paths to the ReadInfo function as parameters in turn;

接收所述ReadInfo函数的返回值,所述返回值为所述文件路径对应的文件内容。The return value of the ReadInfo function is received, and the return value is the file content corresponding to the file path.

本发明实施例中,在安卓操作系统中,所述多个文件路径包括文件路径/sys/class/hwmon/hwmon0/device/temp1_input、文件路径/sys/class/power_supply/battery/temp和文件路径/sys/class/power_supply/battery/batt_temp。In the embodiment of the present invention, in the Android operating system, the multiple file paths include the file path /sys/class/hwmon/hwmon0/device/temp1_input, the file path /sys/class/power_supply/battery/temp, and the file path / sys/class/power_supply/battery/batt_temp.

本发明实施例中,终端电池温度监测方法还包括:In the embodiment of the present invention, the terminal battery temperature monitoring method further includes:

当检测到电池的状态发生变化时,监听终端操作系统发出的广播事件;When it is detected that the state of the battery changes, listen to the broadcast event sent by the terminal operating system;

读取所述广播事件的附加数据,并从所述附加数据中提取电池温度数据。Additional data for the broadcast event is read, and battery temperature data is extracted from the additional data.

本发明实施例中,电池的状态发生变化包括:In the embodiment of the present invention, the state of the battery changes includes:

充电开始、充电完成、或者电池的电量变化量达到预设的阈值。The charging starts, the charging is completed, or the battery power variation reaches a preset threshold.

本发明实施例中,终端电池温度监测方法还包括:In the embodiment of the present invention, the terminal battery temperature monitoring method further includes:

将提取的电池温度数据与预设的温度范围进行比较;Compare the extracted battery temperature data with the preset temperature range;

当所述电池温度数据在所述温度范围之内时,确定所述在温度范围之内的电池温度数据为终端的电池温度数据;When the battery temperature data is within the temperature range, determine that the battery temperature data within the temperature range is the battery temperature data of the terminal;

当所述电池温度数据超出所述温度范围时,将所述电池温度数据转换成在所述温度范围之内的温度数据,并将转换后的电池温度数据作为终端的电池温度数据。When the battery temperature data exceeds the temperature range, the battery temperature data is converted into temperature data within the temperature range, and the converted battery temperature data is used as the battery temperature data of the terminal.

根据本发明的另一方面,提供了一种终端电池温度监测装置,包括:According to another aspect of the present invention, a terminal battery temperature monitoring device is provided, including:

路径分析模块,适于分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径;其中,所述电池温度数据是系统预先调用驱动程序通知操作系统写入到文件中的数据;The path analysis module is adapted to analyze the file path of the file where the battery temperature data sensed by the temperature sensor in the terminal battery is located; wherein, the battery temperature data is the data that the system calls the driver in advance to notify the operating system to write into the file;

温度读取模块,适于读取所述文件路径对应的文件内容;A temperature reading module, adapted to read the file content corresponding to the file path;

第一提取模块,适于从所述文件内容中提取所述电池温度数据。The first extraction module is adapted to extract the battery temperature data from the file content.

本发明实施例中,温度传感器感测到的电池温度数据所在文件的文件路径包括多个文件路径,In the embodiment of the present invention, the file path of the file containing the battery temperature data sensed by the temperature sensor includes multiple file paths,

所述温度读取模块依次从所述多个文件路径下读取对应的文件内容,在依次读取时,当从任何一个文件路径下读取到文件内容时,停止读取下一个文件路径对应的文件内容,其中,所述依次读取为按照预先设置的顺序遍历读取。The temperature reading module sequentially reads the corresponding file contents from the plurality of file paths. When reading in sequence, when the file content is read from any file path, stop reading the corresponding file path of the next file path. The content of the file, wherein the sequential reading is traversal reading according to a preset order.

本发明实施例中,温度读取模块包括:In the embodiment of the present invention, the temperature reading module includes:

判断子模块,适于当所述任何一个文件路径对应的文件内容读取成功时,判断所述任何一个文件路径对应的文件内容是否为空内容;The judging submodule is adapted to judge whether the file content corresponding to any one file path is empty when the file content corresponding to any one file path is successfully read;

停止读取子模块,适于当判断子单元判断出所述文件内容不为空内容时,停止读取下一个文件路径对应的文件内容。The stop reading submodule is adapted to stop reading the file content corresponding to the next file path when the judging subunit judges that the file content is not empty.

本发明实施例中,温度读取模块还包括:In the embodiment of the present invention, the temperature reading module also includes:

继续读取子模块,适于在依次读取时,当所述任何一个文件路径对应的文件内容读取失败,或者所述任何一个文件路径对应的文件内容为空内容时,继续读取下一个文件路径对应的文件内容。Continue to read the sub-module, which is adapted to continue to read the next file when reading the file content corresponding to any one of the file paths fails, or the file content corresponding to any one of the file paths is empty when reading in sequence The content of the file corresponding to the file path.

本发明实施例中,温度读取模块包括:In the embodiment of the present invention, the temperature reading module includes:

调用子模块,适于调用信息读取ReadInfo函数,依次将所述多个文件路径作为参数传递给所述ReadInfo函数;Calling the submodule is suitable for calling the information to read the ReadInfo function, and passing the multiple file paths to the ReadInfo function as parameters in turn;

接收子模块,适于接收所述ReadInfo函数的返回值,所述返回值为所述文件路径对应的文件内容。The receiving submodule is adapted to receive the return value of the ReadInfo function, and the return value is the file content corresponding to the file path.

本发明实施例中,在安卓操作系统中,所述多个文件路径包括文件路径/sys/class/hwmon/hwmon0/device/temp1_input、文件路径/sys/class/power_supply/battery/temp和文件路径/sys/class/power_supply/battery/batt_temp。In the embodiment of the present invention, in the Android operating system, the multiple file paths include the file path /sys/class/hwmon/hwmon0/device/temp1_input, the file path /sys/class/power_supply/battery/temp, and the file path / sys/class/power_supply/battery/batt_temp.

本发明实施例中,终端电池温度监测装置还包括:In the embodiment of the present invention, the terminal battery temperature monitoring device further includes:

第二提取模块,适于当检测到电池的状态发生变化时,监听终端操作系统发出的广播事件,读取所述广播事件的附加数据,并从所述附加数据中提取电池温度数据。The second extracting module is adapted to monitor a broadcast event sent by the terminal operating system when detecting a change in the state of the battery, read additional data of the broadcast event, and extract battery temperature data from the additional data.

本发明实施例中,电池的状态发生变化包括:In the embodiment of the present invention, the state of the battery changes includes:

充电开始、充电完成、或者电池的电量变化量达到预设的阈值。The charging starts, the charging is completed, or the battery power variation reaches a preset threshold.

本发明实施例中,终端电池温度监测装置还包括:In the embodiment of the present invention, the terminal battery temperature monitoring device further includes:

比较模块,适于将提取的电池温度数据与预设的温度范围进行比较;A comparison module, adapted to compare the extracted battery temperature data with a preset temperature range;

确定模块,适于当比较模块的比较结果为所述电池温度数据在所述温度范围之内时,确定所述在温度范围之内的电池温度数据为终端的电池温度数据;A determination module, adapted to determine that the battery temperature data within the temperature range is terminal battery temperature data when the comparison result of the comparison module is that the battery temperature data is within the temperature range;

转换模块,适于当比较模块的比较结果为所述电池温度数据超出所述温度范围时,将所述电池温度数据转换成在所述温度范围之内的温度,并将转换后的电池温度数据作为终端的电池温度数据。A conversion module, adapted to convert the battery temperature data into a temperature within the temperature range when the comparison result of the comparison module is that the battery temperature data exceeds the temperature range, and convert the converted battery temperature data As terminal battery temperature data.

根据本发明的另一方面,提供了一种终端,包括:CPU、电池、温度传感器、存储器,以及如上所述的终端电池温度监测装置。According to another aspect of the present invention, a terminal is provided, including: a CPU, a battery, a temperature sensor, a memory, and the terminal battery temperature monitoring device as described above.

根据本发明实施例的终端电池温度监测方法和装置,可以分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径,并且读取所述文件路径对应的文件内容,这些文件路径为通过对系统底层源码进行分析得出的对应温度传感器数据所在文件的文件路径,因此从所述文件内容中可以直接提取终端的电池温度数据。由此解决了由于无法获取当前的电池温度数据,致使电池温度过高而影响终端性能的问题,取得了能够及时准确地读取电池温度数据,减少对终端性能的影响的有益效果。According to the terminal battery temperature monitoring method and device of the embodiments of the present invention, it is possible to analyze the file path of the file where the battery temperature data sensed by the temperature sensor in the terminal battery is located, and read the file content corresponding to the file path. These file paths are The file path of the file corresponding to the temperature sensor data is obtained by analyzing the underlying source code of the system, so the battery temperature data of the terminal can be directly extracted from the content of the file. This solves the problem that the battery temperature is too high and affects the terminal performance due to the inability to obtain the current battery temperature data, and achieves the beneficial effect of being able to read the battery temperature data in a timely and accurate manner and reducing the impact on the terminal performance.

上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。The above description is only an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention, it can be implemented according to the contents of the description, and in order to make the above and other purposes, features and advantages of the present invention more obvious and understandable , the specific embodiments of the present invention are enumerated below.

附图说明Description of drawings

通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiment. The drawings are only for the purpose of illustrating a preferred embodiment and are not to be considered as limiting the invention. Also throughout the drawings, the same reference numerals are used to designate the same components. In the attached picture:

图1示出了根据本发明一个实施例的一种终端电池温度监测方法的流程图;FIG. 1 shows a flow chart of a method for monitoring terminal battery temperature according to an embodiment of the present invention;

图2示出了根据本发明一个具体实施例的一种终端电池温度监测方法的流程图;FIG. 2 shows a flow chart of a method for monitoring terminal battery temperature according to a specific embodiment of the present invention;

图3示出了根据本发明一个实施例的一种终端电池温度监测装置的结构框图;Fig. 3 shows a structural block diagram of a terminal battery temperature monitoring device according to an embodiment of the present invention;

图4示出了根据本发明一个实施例的一种终端电池温度显示方法的流程图;FIG. 4 shows a flowchart of a method for displaying terminal battery temperature according to an embodiment of the present invention;

图5示出了本发明实施例所述的电池温度显示的界面图;以及Fig. 5 shows the interface diagram of battery temperature display according to the embodiment of the present invention; and

图6示出了根据本发明一个实施例的一种终端电池温度显示装置的结构框图。Fig. 6 shows a structural block diagram of a terminal battery temperature display device according to an embodiment of the present invention.

具体实施方式detailed description

下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited by the embodiments set forth herein. Rather, these embodiments are provided for more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.

本发明实施例可以应用于计算机系统/服务器,其可与众多其它通用或专用计算系统环境或配置一起操作。适于与计算机系统/服务器一起使用的众所周知的计算系统、环境和/或配置的例子包括但不限于:个人计算机系统、服务器计算机系统、瘦客户机、厚客户机、手持或膝上设备、基于微处理器的系统、机顶盒、可编程消费电子产品、网络个人电脑、小型计算机系统、大型计算机系统和包括上述任何系统的分布式云计算技术环境,等等。Embodiments of the invention may be applied to computer systems/servers that are operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well-known computing systems, environments and/or configurations suitable for use with computer systems/servers include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, Microprocessor-based systems, set-top boxes, programmable consumer electronics, networked personal computers, minicomputer systems, mainframe computer systems, and distributed cloud computing technology environments including any of the foregoing, among others.

计算机系统/服务器可以在由计算机系统执行的计算机系统可执行指令(诸如程序模块)的一般语境下描述。通常,程序模块可以包括例程、程序、目标程序、组件、逻辑、数据结构等等,它们执行特定的任务或者实现特定的抽象数据类型。计算机系统/服务器可以在分布式云计算环境中实施,分布式云计算环境中,任务是由通过通信网络链接的远程处理设备执行的。在分布式云计算环境中,程序模块可以位于包括存储设备的本地或远程计算系统存储介质上。Computer systems/servers may be described in the general context of computer system-executable instructions, such as program modules, being executed by the computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc., that perform particular tasks or implement particular abstract data types. The computer system/server can be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computing system storage media including storage devices.

参考图1,示出了本发明实施例中提出的一种终端电池温度监测方法的流程图,该方法具体可以包括:Referring to FIG. 1 , it shows a flow chart of a method for monitoring the temperature of a terminal battery proposed in an embodiment of the present invention. The method may specifically include:

步骤100,分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径。Step 100, analyzing the file path of the file where the battery temperature data sensed by the temperature sensor in the battery of the terminal is located.

其中,所述电池温度数据是系统预先调用驱动程序通知操作系统写入到文件中的数据。Wherein, the battery temperature data is the data that the system pre-calls the driver to notify the operating system to write into the file.

随着互联网的发展,越来越多的用户选择了智能移动终端,现在的智能移动终端发展迅速,为了支撑更强的性能和更大的屏幕,一般都会为终端配备更大容量的电池。而电池在使用过程中会产生热量,如果电池温度过高,则会影响终端的性能。With the development of the Internet, more and more users choose smart mobile terminals. The current smart mobile terminals are developing rapidly. In order to support stronger performance and larger screens, terminals are generally equipped with batteries with larger capacity. The battery generates heat during use, and if the temperature of the battery is too high, it will affect the performance of the terminal.

因此,本发明实施例提出了一种终端电池温度监测方法,该方法通过读取终端内部温度传感器的数据可以直接获得电池温度数据。在终端的内部会安装一些温度传感器,这些温度传感器可以实时监测终端内部设备的温度数据,通过生产厂商实现的设备驱动可以从温度传感器获得具体的温度数据,然后系统预先调用驱动程序通知操作系统,再由操作系统将这些温度数据写入到对应的文件中。Therefore, an embodiment of the present invention proposes a terminal battery temperature monitoring method, which can directly obtain battery temperature data by reading data from a terminal internal temperature sensor. Some temperature sensors are installed inside the terminal. These temperature sensors can monitor the temperature data of the internal equipment of the terminal in real time. The device driver implemented by the manufacturer can obtain specific temperature data from the temperature sensor, and then the system calls the driver in advance to notify the operating system. Then the operating system writes these temperature data into corresponding files.

本发明实施例中,首先可以通过对终端系统的底层源码进行分析,以找出终端电池中温度传感器数据存储在哪个文件中、文件路径是什么,在找出文件路径之后,后续可以对这些文件路径下的文件内容进行处理。In the embodiment of the present invention, first of all, by analyzing the underlying source code of the terminal system, it is possible to find out which file the temperature sensor data in the terminal battery is stored in and what the file path is. After finding the file path, these files can be subsequently The content of the file under the path is processed.

步骤102,读取所述文件路径对应的文件内容。Step 102, read the content of the file corresponding to the file path.

在步骤100中分析出终端电池中温度传感器感测到的电池温度数据所在文件的文件路径,由于在所述文件路径下的文件为通过对终端进行分析之后确定出的存储有电池温度数据的文件,因此,在获取到上述文件路径之后,即可读取所述文件路径对应的文件内容。In step 100, analyze the file path of the file where the battery temperature data sensed by the temperature sensor in the battery of the terminal is located, because the file under the file path is a file that stores battery temperature data determined after analyzing the terminal , therefore, after the above file path is obtained, the file content corresponding to the file path can be read.

其中,所述文件内容中包括电池温度数据,还可以包括一些其他信息,本发明实施例对此并不加以限制。Wherein, the file content includes battery temperature data, and may also include some other information, which is not limited in this embodiment of the present invention.

步骤104,从所述文件内容中提取所述电池温度数据。Step 104, extracting the battery temperature data from the file content.

读取到所述文件路径对应的文件内容,即可以从所述文件内容中直接提取出电池温度数据。After reading the file content corresponding to the file path, the battery temperature data can be directly extracted from the file content.

如果当前的电池温度过高,可以采取一些措施以降低电池温度(例如,如果当前正在玩游戏,可以停止当前的游戏)。If the current battery temperature is too high, some measures can be taken to reduce the battery temperature (for example, if the current game is being played, the current game can be stopped).

对于上述各个步骤的具体过程,将在下面的实施例中详细介绍。The specific process of the above steps will be described in detail in the following embodiments.

本发明实施例提出的终端电池温度监测方法可以分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径,并且读取所述文件路径对应的文件内容,这些文件路径为通过对系统底层源码进行分析得出的对应温度传感器数据所在文件的文件路径,因此从所述文件内容中可以直接提取终端的电池温度数据。由此解决了由于无法获取当前的电池温度数据,致使电池温度过高而影响终端性能的问题,能够及时准确地读取电池温度数据,减少对终端性能的影响。The terminal battery temperature monitoring method proposed in the embodiment of the present invention can analyze the file path of the file where the battery temperature data sensed by the temperature sensor in the terminal battery is located, and read the file content corresponding to the file path. These file paths are passed to the system The file path of the file corresponding to the temperature sensor data is obtained from the analysis of the underlying source code, so the battery temperature data of the terminal can be directly extracted from the content of the file. This solves the problem that the battery temperature is too high and affects the performance of the terminal due to the inability to obtain the current battery temperature data, and can read the battery temperature data in a timely and accurate manner, reducing the impact on the terminal performance.

下面,对本发明实施例提出的终端电池温度监测方法进行详细介绍。In the following, the method for monitoring the temperature of the terminal battery proposed in the embodiment of the present invention will be introduced in detail.

参考图2,示出了根据本发明一个具体实施例的一种终端电池温度监测方法的流程图,该方法可以包括:Referring to FIG. 2 , it shows a flow chart of a method for monitoring terminal battery temperature according to a specific embodiment of the present invention. The method may include:

步骤200,分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径。Step 200, analyzing the file path of the file where the battery temperature data sensed by the temperature sensor in the battery of the terminal is located.

根据上述实施例一的相关描述,本发明实施例中首先可以通过对终端系统的底层源码进行分析,确定出存储终端电池中温度传感器数据的文件的路径,在找出文件路径之后,后续可以对这些文件路径下的文件内容进行处理。According to the relevant description of the first embodiment above, in the embodiment of the present invention, the path of the file storing the temperature sensor data in the battery of the terminal can be determined first by analyzing the underlying source code of the terminal system. After finding the path of the file, the follow-up can The contents of files under these file paths are processed.

对于具体的分析过程,本领域技术人员根据实际情况进行相应处理即可,本发明实施例在此不再详细论述。As for the specific analysis process, those skilled in the art can perform corresponding processing according to the actual situation, and the embodiments of the present invention will not be discussed in detail here.

其中,所述电池温度数据是系统预先调用驱动程序通知操作系统写入到文件中的数据。Wherein, the battery temperature data is the data that the system pre-calls the driver to notify the operating system to write into the file.

考虑到每个终端的生产厂商可能不同,而生产厂商不同的终端的操作系统将温度数据写入的文件的位置不同,因此用于存储电池温度数据的文件的路径也有可能不同,因此可以分别对不同的生产厂商生产的终端进行分析,从而得出针对不同的终端,其中用于存储电池温度数据的文件的路径都有哪些。Considering that the manufacturers of each terminal may be different, and the location of the file where the operating system of different manufacturers write the temperature data is different, so the path of the file used to store the battery temperature data may also be different, so you can separately Terminals produced by different manufacturers are analyzed to obtain the paths of files used to store battery temperature data for different terminals.

因此,在本发明实施例中,所述温度传感器感测到的电池温度数据所在文件的文件路径可以包括多个文件路径。Therefore, in the embodiment of the present invention, the file path of the file where the battery temperature data sensed by the temperature sensor is located may include multiple file paths.

步骤202,读取所述文件路径对应的文件内容。Step 202, read the content of the file corresponding to the file path.

在确定出终端中用于存储电池温度数据的文件的路径之后,由于在这些文件路径下的文件内容中存储有终端的电池温度数据,因此,可以通过系统读取所述文件路径对应的文件内容。After determining the path of the file used to store the battery temperature data in the terminal, since the battery temperature data of the terminal is stored in the file content under these file paths, the file content corresponding to the file path can be read through the system .

本发明实施例中,可以设置一个定时器,通过该定时器可以定时通知系统直接去所述文件路径下读取文件内容。对于读取的时间间隔,本发明实施例并不加以限制。In the embodiment of the present invention, a timer can be set, and the system can be regularly notified through the timer to read the file content directly from the file path. The embodiment of the present invention does not limit the time interval for reading.

根据上述步骤200的相关描述可以得知,本发明实施例中所述温度传感器数据所在文件的文件路径可以包括多个文件路径,因此,该步骤202具体可以包括:According to the relevant description of the above step 200, it can be known that the file path of the file where the temperature sensor data is located in the embodiment of the present invention may include multiple file paths. Therefore, this step 202 may specifically include:

子步骤2021,依次从所述多个文件路径下读取对应的文件内容。Sub-step 2021, sequentially read the corresponding file content from the multiple file paths.

本发明实施例中,针对不同生产厂商的终端,其中存储有电池温度数据的文件可能不同,因此经过分析可以得到多个不同的文件路径,对于某个终端,其电池温度数据会存储在这些文件路径中的一个文件路径对应的文件中。因此,本发明实施例在从所述多个文件路径下读取对应的文件内容时,可以按照预先设置的顺序依次遍历读取所述多个文件路径,直到从其中一个文件路径下的读取到对应的文件内容为止。In the embodiment of the present invention, for terminals of different manufacturers, the files storing the battery temperature data may be different, so a plurality of different file paths can be obtained after analysis. For a certain terminal, its battery temperature data will be stored in these files A file path in the path corresponds to a file in the path. Therefore, in the embodiment of the present invention, when reading the corresponding file content from the multiple file paths, the multiple file paths can be sequentially traversed and read according to the preset order until reading from one of the file paths to the corresponding file content.

例如,首先可以分析针对当前终端来说,各个文件路径下的文件内容中包括所述电池温度数据的可能性,然后按照可能性的大小对所述多个文件路径进行排序,最后依次读取排序后的文件路径。For example, firstly, for the current terminal, the possibility of including the battery temperature data in the file content under each file path can be analyzed, and then the multiple file paths are sorted according to the possibility, and finally the sorted files are read sequentially. following file path.

当然,还可以采用文件路径的其他一些特性进行排序,本发明实施例对此并不加以限制。Of course, some other characteristics of the file path can also be used for sorting, which is not limited in this embodiment of the present invention.

本发明实施例中,可以通过信息读取函数(ReadInfo函数)从所述多个文件路径下读取对应的文件内容。In the embodiment of the present invention, the corresponding file content can be read from the plurality of file paths through an information reading function (ReadInfo function).

该子步骤2021可以包括:This sub-step 2021 may include:

a1,调用ReadInfo函数,依次将所述多个文件路径作为参数传递给所述ReadInfo函数。a1, calling the ReadInfo function, and sequentially passing the multiple file paths as parameters to the ReadInfo function.

a2,接收所述ReadInfo函数的返回值,所述返回值为所述文件路径对应的文件内容。a2. Receive the return value of the ReadInfo function, where the return value is the file content corresponding to the file path.

其中,ReadInfo函数为操作系统的信息读取函数,对于通过该系统函数读取文件内容的具体过程,本领域技术人员根据实际情况进行相应处理即可,本发明实施例在此不再详细论述。Wherein, the ReadInfo function is an information reading function of the operating system. For the specific process of reading the file content through the system function, those skilled in the art can perform corresponding processing according to the actual situation, and the embodiments of the present invention will not be discussed in detail here.

子步骤2022,依次读取时,当从任何一个文件路径下读取到文件内容时,停止读取下一个文件路径对应的文件内容。Sub-step 2022, when reading sequentially, when the file content is read from any file path, stop reading the file content corresponding to the next file path.

对于不同的终端,其存储电池温度数据的文件的路径可能不同,经过分析,将这些可能的文件路径作为温度传感器感测到的电池温度数据所在文件的文件路径。当针对一个终端进行处理时,如果从其中一个文件路径下读取到文件内容,则说明该文件路径下的文件即为该终端中用于存储电池温度数据的文件,此时,可以不再针对其他的路径读取其文件内容。For different terminals, the path of the file storing the battery temperature data may be different. After analysis, these possible file paths are taken as the file path of the file where the battery temperature data sensed by the temperature sensor is located. When processing a terminal, if the file content is read from one of the file paths, it means that the file under the file path is the file used to store the battery temperature data in the terminal. At this time, you can no longer target Other paths read their file contents.

本发明实施例中,该子步骤2022可以包括:In the embodiment of the present invention, the sub-step 2022 may include:

b1,当所述任何一个文件路径对应的文件内容读取成功时,判断所述任何一个文件路径对应的文件内容是否为空内容。b1, when the file content corresponding to any one file path is read successfully, judge whether the file content corresponding to any one file path is empty content.

b2,当所述文件内容不为空内容时,停止读取下一个文件路径对应的文件内容。b2, when the content of the file is not empty, stop reading the content of the file corresponding to the next file path.

子步骤2023,依次读取时,当所述任何一个文件路径对应的文件内容读取失败,或者所述任何一个文件路径对应的文件内容为空内容时,继续读取下一个文件路径对应的文件内容。Sub-step 2023, when reading sequentially, when the reading of the file content corresponding to any one of the file paths fails, or when the content of the file corresponding to any one of the file paths is empty, continue to read the file corresponding to the next file path content.

下面,以安卓系统为例进行介绍,经过分析,在安卓操作系统中,用于存储电池温度数据的文件的路径可以包括以下几种:In the following, the Android system is taken as an example. After analysis, in the Android operating system, the path of the file used to store the battery temperature data may include the following:

(1)/sys/class/hwmon/hwmon0/device/temp1_input(1) /sys/class/hwmon/hwmon0/device/temp1_input

(2)/sys/class/power_supply/battery/temp(2)/sys/class/power_supply/battery/temp

(3)/sys/class/power_supply/battery/batt_temp(3)/sys/class/power_supply/battery/batt_temp

对于不同的生产厂商,终端的操作系统将温度数据写入的文件的位置不同,但是经过分析发现,温度数据存储的位置为上述三个文件路径中的一个路径对应的文件中。因此,本发明实施例中,可以依次将上述三个文件路径定期传递至ReadInfo函数,然后接收ReadInfo函数的返回值(例如,可以通过鲁大师定期向ReadInfo函数传递文件路径),直到从其中一个文件路径下读取到对应的文件内容为止。具体过程可以包括:For different manufacturers, the location of the file where the operating system of the terminal writes the temperature data is different, but after analysis, it is found that the temperature data is stored in the file corresponding to one of the above three file paths. Therefore, in the embodiment of the present invention, the above three file paths can be regularly passed to the ReadInfo function in turn, and then the return value of the ReadInfo function can be received (for example, the file path can be passed to the ReadInfo function regularly through Master Lu), until one of the files Path to read the corresponding file content. Specific procedures can include:

步骤1、将文件路径/sys/class/hwmon/hwmon0/device/temp1_input作为参数传递给ReadInfo函数。Step 1. Pass the file path /sys/class/hwmon/hwmon0/device/temp1_input as a parameter to the ReadInfo function.

如果ReadInfo函数成功获取到该文件路径下的文件内容,则执行步骤2;如果文件内容获取失败,则执行步骤4。If the ReadInfo function successfully obtains the content of the file under the file path, perform step 2; if the acquisition of the file content fails, perform step 4.

步骤2,判断所述文件内容是否为空。Step 2, judging whether the content of the file is empty.

如果所述文件内容不为空,则执行步骤3;如果所述文件内容为空,则执行步骤4。If the content of the file is not empty, execute step 3; if the content of the file is empty, execute step 4.

步骤3,接收ReadInfo函数的返回值,所述返回值即为所述文件路径/sys/class/hwmon/hwmon0/device/temp1_input对应的文件内容。Step 3: Receive the return value of the ReadInfo function, and the return value is the file content corresponding to the file path /sys/class/hwmon/hwmon0/device/temp1_input.

步骤4,将文件路径/sys/class/power_supply/battery/temp作为参数传递给ReadInfo函数。Step 4, pass the file path /sys/class/power_supply/battery/temp as a parameter to the ReadInfo function.

如果ReadInfo函数成功获取到该文件路径下的文件内容,则执行步骤5如果文件内容获取失败,则执行步骤7。If the ReadInfo function successfully obtains the file content under the file path, perform step 5; if the file content acquisition fails, perform step 7.

步骤5,判断所述文件内容是否为空。Step 5, judging whether the content of the file is empty.

如果所述文件内容不为空,则执行步骤6;如果所述文件内容为空,则执行步骤7。If the file content is not empty, execute step 6; if the file content is empty, execute step 7.

步骤6,接收ReadInfo函数的返回值,所述返回值即为所述文件路径/sys/class/power_supply/battery/temp对应的文件内容。Step 6: Receive the return value of the ReadInfo function, and the return value is the file content corresponding to the file path /sys/class/power_supply/battery/temp.

步骤7、将文件路径/sys/class/power_supply/battery/batt_temp作为参数传递给ReadInfo函数。Step 7. Pass the file path /sys/class/power_supply/battery/batt_temp as a parameter to the ReadInfo function.

如果ReadInfo函数成功获取到该文件路径下的文件内容,并且所述文件内容不为空,则执行步骤8。If the ReadInfo function successfully obtains the file content under the file path, and the file content is not empty, step 8 is performed.

步骤8,接收ReadInfo函数的返回值,所述返回值即为所述文件路径/sys/class/power_supply/battery/batt_temp对应的文件内容。Step 8: Receive the return value of the ReadInfo function, and the return value is the file content corresponding to the file path /sys/class/power_supply/battery/batt_temp.

由于经过上述描述可以得知上述三种文件路径即为可能存储电池温度数据的文件的路径,因此,本发明实施例中,至少可以在其中的一个文件路径下读取到对应的文件内容。因此,在上述过程中,如果在文件路径/sys/class/hwmon/hwmon0/device/temp1_input和文件路径/sys/class/power_supply/battery/temp下都没有读取到对应的文件内容,则在文件路径/sys/class/power_supply/battery/batt_temp下可以读取到对应的文件路径。From the above description, it can be known that the above three file paths are paths of files that may store battery temperature data, therefore, in the embodiment of the present invention, at least one of the file paths can read the corresponding file content. Therefore, in the above process, if the corresponding file content is not read under the file path /sys/class/hwmon/hwmon0/device/temp1_input and the file path /sys/class/power_supply/battery/temp, then in the file The corresponding file path can be read under the path /sys/class/power_supply/battery/batt_temp.

需要说明的是,本发明实施例中对于上述三种文件路径的读取顺序并不加以限制。并且,上述三种文件路径是针对安卓操作系统而言的,但是,本发明实施例并不限定于上述三种文件路径,例如对于其他一些操作系统可能为其他的文件路径,本发明实施例对此不再详细论述。It should be noted that, in the embodiment of the present invention, there is no limitation on the reading order of the above three file paths. Moreover, the above three file paths are for the Android operating system, but the embodiment of the present invention is not limited to the above three file paths, for example, it may be other file paths for some other operating systems. This will not be discussed in detail.

步骤204,从所述文件内容中提取所述电池温度数据。Step 204, extracting the battery temperature data from the file content.

在步骤202中读取到对应的文件路径之后,由于该文件路径下的文件内容中存储有电池温度数据,因此,在该步骤中即可以从读取到的文件内容中提取电池温度数据。After the corresponding file path is read in step 202, since the battery temperature data is stored in the file content under the file path, the battery temperature data can be extracted from the read file content in this step.

本发明实施例中,通过上述步骤200-步骤204可以实时获取到终端的电池温度数据,使得电池温度数据的获取更加及时。In the embodiment of the present invention, the battery temperature data of the terminal can be obtained in real time through the above steps 200 to 204, so that the battery temperature data can be obtained more timely.

另一方面,经过分析发现,当终端的电池状态发生变化时,终端操作系统系统会发出广播事件,该广播事件的附加数据中包含了终端的电池温度数据信息。因此,本发明实施例还进一步提出了通过该广播事件获取电池温度数据的方法。On the other hand, after analysis, it is found that when the battery status of the terminal changes, the terminal operating system system will send a broadcast event, and the additional data of the broadcast event includes the battery temperature data information of the terminal. Therefore, the embodiment of the present invention further proposes a method for acquiring battery temperature data through the broadcast event.

具体的,本发明实施例的电池温度监测方法还可以包括:Specifically, the battery temperature monitoring method in the embodiment of the present invention may further include:

步骤206,当检测到电池的状态发生变化时,监听终端操作系统发出的广播事件。Step 206, when it is detected that the state of the battery changes, monitor the broadcast event sent by the terminal operating system.

本发明实施例中,所述电池的状态发生变化可以包括以下几种情况:In the embodiment of the present invention, the state of the battery changes may include the following situations:

充电开始(例如检测到插入充电器)、充电完成(例如检测到拔出充电器)、或者电池的电量变化量达到预设的阈值(例如电池的电量变化量达到1%或者其他数值)。Charging starts (for example, it is detected that the charger is plugged in), charging is completed (for example, it is detected that the charger is pulled out), or the change in battery power reaches a preset threshold (for example, the change in battery power reaches 1% or other values).

当然,本发明实施例所述的电池状态发生变化并不限定于上述几种情况,还可以包括其他的情况,本发明实施例对此并不加以限制。Certainly, the change of the battery state described in the embodiment of the present invention is not limited to the above situations, and may also include other situations, which are not limited in the embodiment of the present invention.

步骤208,读取所述广播事件的附加数据,并从所述附加数据中提取电池温度数据。Step 208, read the additional data of the broadcast event, and extract battery temperature data from the additional data.

上述操作系统发出的广播事件中包含有附加数据,这些附加数据中包含了终端的电池温度数据,所述电池温度数据也可以为通过上述读取预设文件路径下对应的文件内容的方法获得的电池温度数据,对于具体的过程,本发明实施例在此不再详细论述。The above-mentioned broadcast event sent by the operating system contains additional data, and these additional data include the battery temperature data of the terminal, and the battery temperature data can also be obtained by the above-mentioned method of reading the corresponding file content under the preset file path For the specific process of battery temperature data, this embodiment of the present invention will not discuss in detail here.

在终端操作系统发出广播事件后,即可读取该广播事件的附加数据,并从读取到的附加数据中提取其中的电池温度数据。After the terminal operating system sends out the broadcast event, it can read the additional data of the broadcast event, and extract the battery temperature data therein from the read additional data.

需要说明的是,上述步骤206-步骤208是通过读取操作系统的广播事件以获取电池温度数据的过程。但是,终端操作系统只有在检测到电池的状态发生变化时才会发出该广播事件,即如果利用上述读取广播事件的方法,只有在电池状态发生变化才能够获取到对应的电池温度数据,而其余的时候即使电池温度数据发生了变化也是不能获取到对应的电池温度数据的。因此,通过读取广播事件获取电池温度数据的方式存在电池温度数据更新不及时的问题。It should be noted that the above step 206 to step 208 is a process of obtaining battery temperature data by reading broadcast events of the operating system. However, the terminal operating system will only send the broadcast event when it detects that the state of the battery changes, that is, if the above method of reading broadcast events is used, the corresponding battery temperature data can only be obtained when the battery state changes, In the rest of the time, even if the battery temperature data changes, the corresponding battery temperature data cannot be obtained. Therefore, there is a problem that the battery temperature data is not updated in time in the manner of acquiring the battery temperature data by reading broadcast events.

因此,本发明实施例为了解决该问题,提出了通过步骤200-步骤204中实时读取温度传感器感测到的电池温度数据所在文件的文件路径对应的文件内容来获取电池温度数据的方法。该方法首先确定出终端中可能存储有电池温度数据的文件的路径,然后可以实时地读取这些文件路径下的文件内容,从而可以不受电池状态的限制,即使电池状态没有发生变化时,也是可以获取到对应的电池温度数据的。因此,相对于上述通过读取广播事件获取电池温度数据的方法,该读取预设文件路径下对应的文件内容的方法可以不受外界条件(电池的状态变化)的限制,使电池温度数据的更新更加及时。Therefore, in order to solve this problem, the embodiment of the present invention proposes a method of acquiring battery temperature data by reading the file content corresponding to the file path of the file where the battery temperature data sensed by the temperature sensor is located in real time in steps 200-204. This method firstly determines the paths of files that may store battery temperature data in the terminal, and then can read the contents of files under these file paths in real time, so that it is not limited by the state of the battery, even if the state of the battery does not change. The corresponding battery temperature data can be obtained. Therefore, compared to the above-mentioned method of obtaining battery temperature data by reading broadcast events, the method of reading the corresponding file content under the preset file path may not be limited by external conditions (changes in the state of the battery), so that the battery temperature data Updates are more timely.

由于一些终端具有特殊性,这些终端获取到的电池温度数据的单位可能不是℃,因此,为了统一获取到的温度的取值范围,本发明实施例中可以设置电池温度数据均以℃为单位。Due to the particularity of some terminals, the unit of the battery temperature data obtained by these terminals may not be °C. Therefore, in order to unify the value range of the obtained temperature, in the embodiment of the present invention, the unit of the battery temperature data can be set to be °C.

本发明实施例中,可以预先设置温度范围,当获取到的电池温度数据在该预设的温度范围之内时,确定该温度为终端的电池温度数据。In the embodiment of the present invention, a temperature range may be preset, and when the acquired battery temperature data is within the preset temperature range, the temperature is determined to be the battery temperature data of the terminal.

因此,本发明实施例所述的电池温度数据监测方法还可以包括以下步骤:Therefore, the battery temperature data monitoring method described in the embodiment of the present invention may further include the following steps:

步骤210,将提取的电池温度数据与预设的温度范围进行比较。Step 210, comparing the extracted battery temperature data with a preset temperature range.

步骤212,当所述电池温度数据在所述温度范围之内时,确定所述在温度范围之内的电池温度数据为终端的电池温度数据。Step 212, when the battery temperature data is within the temperature range, determine that the battery temperature data within the temperature range is the battery temperature data of the terminal.

本发明实施例中,可以设置所述温度范围为15℃-60℃,如果提取出的电池温度数据在该温度范围之内时,则可以将该温度作为终端的电池温度数据。In the embodiment of the present invention, the temperature range can be set to 15°C-60°C, and if the extracted battery temperature data is within the temperature range, the temperature can be used as the battery temperature data of the terminal.

步骤214,当所述电池温度数据超出所述温度范围时,将所述电池温度数据转换成在所述温度范围之内的温度,并将转换后的电池温度数据作为终端的电池温度数据。Step 214, when the battery temperature data exceeds the temperature range, convert the battery temperature data into a temperature within the temperature range, and use the converted battery temperature data as the battery temperature data of the terminal.

如果提取出的电池温度数据超出了上述温度范围,本发明实施例还可以进一步对提取出的温度进行处理,以使其处于正常的温度范围之内。If the extracted battery temperature data exceeds the above temperature range, the embodiment of the present invention may further process the extracted temperature to make it within a normal temperature range.

例如,如果提取出的电池温度数据为300(其单位可能不是℃),则本发明实施例可以将该数值除以一个固定值(例如除以10)。如果除以该固定值之后的数值还不在上述温度范围之内,则可以继续将得到的数值除以上述固定值,直到得出的数值在所述温度范围内为止,最后将所述在温度范围之内的电池温度数据确定为终端的电池温度数据。For example, if the extracted battery temperature data is 300 (the unit may not be °C), the embodiment of the present invention may divide this value by a fixed value (for example, by 10). If the value after dividing by the fixed value is not within the above temperature range, you can continue to divide the obtained value by the above fixed value until the obtained value is within the temperature range, and finally put the value in the temperature range The battery temperature data within is determined as the battery temperature data of the terminal.

需要说明的是,上述的温度范围只是用于示例,本发明实施例对具体的数值并不加以限制。It should be noted that the above-mentioned temperature range is only for example, and the embodiment of the present invention does not limit specific values.

本发明实施例的终端电池温度监测方法不仅可以分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径,并定期从所述文件路径下读取文件内容,并从中提取电池温度数据,还可以通过系统发出的广播事件获取电池温度数据,从而可以更加及时准确地获得终端的电池温度数据,由此解决了由于无法获取当前的电池温度数据,致使电池温度过高而影响终端性能的问题,取得了能够及时准确地读取电池温度数据,减少对终端性能的影响的有益效果。The terminal battery temperature monitoring method of the embodiment of the present invention can not only analyze the file path of the file where the battery temperature data sensed by the temperature sensor in the terminal battery is located, but also regularly read the file content from the file path, and extract the battery temperature data from it , the battery temperature data can also be obtained through the broadcast event sent by the system, so that the battery temperature data of the terminal can be obtained more timely and accurately, thus solving the problem that the battery temperature is too high and affects the terminal performance due to the inability to obtain the current battery temperature data problem, the beneficial effect of being able to read battery temperature data in a timely and accurate manner and reducing the impact on terminal performance has been achieved.

需要说明的是,对于前述的方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作并不一定是本申请所必需的。It should be noted that, for the foregoing method embodiments, for the sake of simple description, they are expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence, because Depending on the application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification belong to preferred embodiments, and the actions involved are not necessarily required by this application.

参照图3,示出了本发明实施例三的一种终端电池温度监测装置的结构框图,该装置可以包括:路径分析模块300、温度读取模块302、第一提取模块304、第二提取模块306、比较模块308、确定模块310、转换模块312。Referring to FIG. 3 , it shows a structural block diagram of a terminal battery temperature monitoring device according to Embodiment 3 of the present invention. The device may include: a path analysis module 300, a temperature reading module 302, a first extraction module 304, and a second extraction module 306 , a comparison module 308 , a determination module 310 , and a conversion module 312 .

其中,in,

路径分析模块300,适于分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径;The path analysis module 300 is adapted to analyze the file path of the file where the battery temperature data sensed by the temperature sensor in the battery of the terminal is located;

其中,所述电池温度数据是系统预先调用驱动程序通知操作系统写入到文件中的数据。Wherein, the battery temperature data is the data that the system pre-calls the driver to notify the operating system to write into the file.

温度读取模块302,适于读取所述文件路径对应的文件内容;The temperature reading module 302 is adapted to read the file content corresponding to the file path;

本发明实施例中,所述终端电池温度监测装置还可以包括定时器,通过该定时器可以定时通知系统直接去所述文件路径下读取文件内容。In the embodiment of the present invention, the terminal battery temperature monitoring device may further include a timer, through which the system can be regularly notified to read file content directly from the file path.

由于各个终端的生产厂商可能不同,因此其中用于存储电池温度数据的文件的路径也可能不同,因此,本发明实施例中,所述终端电池中温度传感器感测到的电池温度数据所在文件的文件路径可以包括多个文件路径。Since the manufacturers of each terminal may be different, the path of the file used to store the battery temperature data may also be different. Therefore, in the embodiment of the present invention, the battery temperature data sensed by the temperature sensor in the battery of the terminal is located in the file A file path can include multiple file paths.

例如,在安卓操作系统中,所述多个文件路径可以包括文件路径/sys/class/hwmon/hwmon0/device/temp1_input、文件路径/sys/class/power_supply/battery/temp和文件路径/sys/class/power_supply/battery/batt_temp。For example, in the Android operating system, the multiple file paths may include the file path /sys/class/hwmon/hwmon0/device/temp1_input, the file path /sys/class/power_supply/battery/temp, and the file path /sys/class /power_supply/battery/batt_temp.

具体的,所述温度读取模块302依次从所述多个文件路径下读取对应的文件内容,在依次读取时,当从任何一个文件路径下读取到文件内容时,停止读取下一个文件路径对应的文件内容。Specifically, the temperature reading module 302 sequentially reads the corresponding file content from the multiple file paths, and when reading in sequence, when the file content is read from any file path, stop reading the next The content of a file corresponding to a file path.

其中,所述依次读取为按照预先设置的顺序遍历读取。Wherein, the sequential reading is traversal reading according to a preset order.

所述温度读取模块302可以包括:The temperature reading module 302 may include:

调用子模块,适于调用ReadInfo函数,依次将所述多个文件路径作为参数传递给所述ReadInfo函数;Calling the submodule is suitable for calling the ReadInfo function, and passing the multiple file paths to the ReadInfo function as parameters in turn;

接收子模块,适于接收所述ReadInfo函数的返回值,所述返回值为所述文件路径对应的文件内容;The receiving submodule is adapted to receive the return value of the ReadInfo function, and the return value is the file content corresponding to the file path;

判断子模块,适于当所述任何一个文件路径对应的文件内容读取成功时,判断所述任何一个文件路径对应的文件内容是否为空内容;The judging submodule is adapted to judge whether the file content corresponding to any one file path is empty when the file content corresponding to any one file path is successfully read;

停止读取子模块,适于当判断子单元判断出所述文件内容不为空内容时,停止读取下一个文件路径对应的文件内容;The stop reading submodule is adapted to stop reading the file content corresponding to the next file path when the judging subunit judges that the file content is not empty;

继续读取子模块,适于在依次读取时,当所述任何一个文件路径对应的文件内容读取失败,或者所述任何一个文件路径对应的文件内容为空内容时,继续读取下一个文件路径对应的文件内容。Continue to read the sub-module, which is adapted to continue to read the next file when reading the file content corresponding to any one of the file paths fails, or the file content corresponding to any one of the file paths is empty when reading in sequence The content of the file corresponding to the file path.

第一提取模块304,适于从所述文件内容中提取所述电池温度数据;The first extraction module 304 is adapted to extract the battery temperature data from the file content;

第二提取模块306,适于当检测到电池的状态发生变化时,监听终端操作系统发出的广播事件,读取所述广播事件的附加数据,并从所述附加数据中提取电池温度数据;The second extraction module 306 is adapted to monitor the broadcast event sent by the terminal operating system when detecting a change in the state of the battery, read the additional data of the broadcast event, and extract the battery temperature data from the additional data;

其中,所述电池的状态发生变化包括以下几种情况:Wherein, the state of the battery changes includes the following situations:

充电开始、充电完成、或者电池的电量变化量达到预设的阈值。The charging starts, the charging is completed, or the battery power variation reaches a preset threshold.

当然,还可以包括其他的情况,本发明实施例对此并不加以限制。Of course, other situations may also be included, which are not limited in this embodiment of the present invention.

由于一些终端具有特殊性,为了统一获取到的温度的取值范围,本发明实施例中,可以预先设置温度范围,当获取到的电池温度数据在该预设的温度范围之内时,确定该温度为终端的电池温度数据。Due to the particularity of some terminals, in order to unify the value range of the obtained temperature, in the embodiment of the present invention, the temperature range can be preset, and when the obtained battery temperature data is within the preset temperature range, the Temperature is the battery temperature data of the terminal.

因此,本发明实施例所述的装置还可以包括:Therefore, the device described in the embodiment of the present invention may also include:

比较模块308,适于将提取的电池温度数据与预设的温度范围进行比较;A comparison module 308, adapted to compare the extracted battery temperature data with a preset temperature range;

确定模块310,适于当比较模块的比较结果为所述电池温度数据在所述温度范围之内时,确定所述在温度范围之内的电池温度数据为终端的电池温度数据;The determination module 310 is adapted to determine that the battery temperature data within the temperature range is the battery temperature data of the terminal when the comparison result of the comparison module is that the battery temperature data is within the temperature range;

转换模块312,适于当比较模块的比较结果为所述电池温度数据超出所述温度范围时,将所述电池温度数据转换成在所述温度范围之内的温度,并将转换后的电池温度数据作为终端的电池温度数据。The conversion module 312 is adapted to convert the battery temperature data into a temperature within the temperature range when the comparison result of the comparison module is that the battery temperature data exceeds the temperature range, and convert the converted battery temperature The data is used as the battery temperature data of the terminal.

对于上述终端电池温度监测装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见图1和图2所示方法实施例的部分说明即可。For the above-mentioned embodiment of the terminal battery temperature monitoring device, because it is basically similar to the method embodiment, the description is relatively simple. For the relevant parts, refer to the part of the description of the method embodiment shown in FIG. 1 and FIG. 2 .

本发明实施例的终端电池温度监测装置可以更加及时准确地获得终端的电池温度数据,由此解决了由于无法获取当前的电池温度数据,致使电池温度过高而影响终端性能的问题,取得了能够及时准确地读取电池温度数据,减少对终端性能的影响的有益效果。The terminal battery temperature monitoring device of the embodiment of the present invention can obtain the terminal battery temperature data more timely and accurately, thereby solving the problem that the battery temperature is too high and affecting the terminal performance due to the inability to obtain the current battery temperature data, and has achieved Timely and accurate reading of battery temperature data has the beneficial effect of reducing the impact on terminal performance.

基于上述终端电池温度监测装置实施例,本发明实施例还提供了一种包含CPU、电池、温度传感器、存储器,以及该终端电池温度监测装置的终端。所述终端可以分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径,并且读取所述文件路径对应的文件内容,这些文件路径为通过对系统底层源码进行分析得出的对应温度传感器数据所在文件的文件路径,因此从所述文件内容中可以直接提取终端的电池温度数据。由此解决了由于无法获取当前的电池温度数据,致使电池温度过高而影响终端性能的问题,取得了能够及时准确地读取电池温度数据,减少对终端性能的影响的有益效果。Based on the above embodiment of the terminal battery temperature monitoring device, the embodiment of the present invention further provides a terminal including a CPU, a battery, a temperature sensor, a memory, and the terminal battery temperature monitoring device. The terminal can analyze the file path of the file where the battery temperature data sensed by the temperature sensor in the battery of the terminal is located, and read the file content corresponding to the file path. These file paths are obtained by analyzing the underlying source code of the system. The file path of the file where the temperature sensor data is stored, so the battery temperature data of the terminal can be directly extracted from the content of the file. This solves the problem that the battery temperature is too high and affects the terminal performance due to the inability to obtain the current battery temperature data, and achieves the beneficial effect of being able to read the battery temperature data in a timely and accurate manner and reducing the impact on the terminal performance.

电池在使用过程中会产生热量,导致电池温度上升,而电池温度上升会影响终端的性能,甚至在极端情况下可能出现过热而导致爆炸。因此,在终端的使用过程中,为了不影响终端的性能,如果电池温度过高,可以暂时停止目前正在执行的程序,以降低电池温度。The battery will generate heat during use, causing the temperature of the battery to rise, and the temperature rise of the battery will affect the performance of the terminal, and may even cause an explosion due to overheating in extreme cases. Therefore, during the use of the terminal, in order not to affect the performance of the terminal, if the temperature of the battery is too high, the program currently being executed may be temporarily stopped to reduce the temperature of the battery.

因此,本发明实施例中,提出了一种终端电池温度显示方法,在得到终端的电池温度数据之后,还可以在终端的用户界面上显示所述电池温度数据,以更直观地将所述电池温度数据显示给用户。Therefore, in the embodiment of the present invention, a terminal battery temperature display method is proposed. After obtaining the battery temperature data of the terminal, the battery temperature data can also be displayed on the user interface of the terminal, so as to display the battery temperature more intuitively. The temperature data is displayed to the user.

如图4所示,为本发明实施例所述的一种终端电池温度显示方法的流程图,所述方法包括:As shown in FIG. 4, it is a flow chart of a terminal battery temperature display method according to an embodiment of the present invention, and the method includes:

步骤400,分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径。Step 400, analyzing the file path of the file where the battery temperature data sensed by the temperature sensor in the battery of the terminal is located.

其中,所述电池温度数据是系统预先调用驱动程序通知操作系统写入到文件中的数据。Wherein, the battery temperature data is the data that the system pre-calls the driver to notify the operating system to write into the file.

步骤402,读取所述文件路径对应的文件内容。Step 402, read the file content corresponding to the file path.

步骤404,从所述文件内容中提取所述电池温度数据。Step 404, extracting the battery temperature data from the file content.

对于上述步骤400-步骤404的具体过程,参见图1和图2所示方法实施例的部分说明即可,本发明实施例在此不再详细论述。For the specific process of the above step 400-step 404, please refer to the partial description of the method embodiment shown in FIG. 1 and FIG. 2, and the embodiment of the present invention will not be discussed in detail here.

步骤406,在终端的用户界面上显示所述电池温度数据。Step 406, displaying the battery temperature data on the user interface of the terminal.

其中,所述用户界面为以下的任意一种:Wherein, the user interface is any one of the following:

桌面的插件,桌面悬浮窗和浏览器的插件。Desktop plug-ins, desktop floating windows and browser plug-ins.

例如,本发明实施例可以通过桌面的插件widget来显示所述电池温度数据。For example, in this embodiment of the present invention, the battery temperature data may be displayed through a desktop widget.

widget最初是源于苹果电脑的一个插件工具——Konfabulator,现在已经扩展应用到windows系统,这个软件可以把它的功能块放到终端的桌面上,这些功能块就是widget。比如说:时钟widget,就是在桌面上显示当前的时间;天气widget,可以显示定制的地区的天气预报;cpuwidget可以显示cpu的占用比率;还有桌面搜索widget、股票widget等等。Widget originally originated from a plug-in tool of Apple Computer—Konfabulator, and now it has been extended to the Windows system. This software can put its functional blocks on the desktop of the terminal, and these functional blocks are widgets. For example: the clock widget, which displays the current time on the desktop; the weather widget, which can display the weather forecast of a customized region; the cpu widget, which can display the CPU usage ratio; and desktop search widgets, stock widgets, etc.

具体的,本发明实施例可以通过widget显示所述电池温度数据,其中可以包括电池温度数据以及当前的温度状态(例如正常、过高等)。Specifically, in the embodiment of the present invention, the battery temperature data may be displayed through a widget, which may include the battery temperature data and the current temperature state (eg, normal, too high, etc.).

参考图5,示出了本发明实施例所述的电池温度显示的界面图,从图5可以看出,当前的电池温度数据为29°,状态为正常。Referring to FIG. 5 , it shows the interface diagram of the battery temperature display according to the embodiment of the present invention. It can be seen from FIG. 5 that the current battery temperature data is 29°, and the status is normal.

当然,本发明实施例中还可以将一些其他的与电池温度数据相关的信息(例如当前的电池温度比正常温度高多少)显示在终端的用户界面(例如桌面)上,本发明实施例对此并不加以限制。Certainly, in the embodiment of the present invention, some other information related to the battery temperature data (such as how much the current battery temperature is higher than the normal temperature) can also be displayed on the user interface (such as the desktop) of the terminal. Not limited.

另外,本发明实施例还可以通过桌面悬浮窗显示所述电池温度数据。In addition, in this embodiment of the present invention, the battery temperature data can also be displayed through a floating window on the desktop.

终端上的软件会在终端的屏幕上生成相应的悬浮窗,这些悬浮窗的作用在于,当主程序的窗口在最小化时,还可以提示用户该程序的运行状态,并可以通过点击这些小窗口,快捷地打开主程序的窗口。例如,360手机安全卫士提供了一个悬浮窗,可以显示在终端屏幕上,悬浮窗显示了终端已使用的内存占用量等系统资源信息。The software on the terminal will generate corresponding floating windows on the terminal screen. The function of these floating windows is that when the window of the main program is minimized, it can also remind the user of the running status of the program, and by clicking these small windows , to open the window of the main program quickly. For example, 360 Mobile Security Guard provides a floating window that can be displayed on the terminal screen, and the floating window displays system resource information such as the amount of memory used by the terminal.

本发明实施例中可以通过桌面悬浮窗显示所述电池温度数据,该悬浮窗内可以包括一个用于展示电池温度检测结果的预设入口,可以实时接收用户端的请求(例如在悬浮窗内设置一个操作的按钮,当用户端点击按钮时即可触发请求),在接收到用户端的请求之后,即可将温度数据的实时测量结果展示出来。In the embodiment of the present invention, the battery temperature data can be displayed through the desktop floating window, which can include a preset entry for displaying the battery temperature detection result, and can receive the request of the user terminal in real time (for example, setting a The operation button can trigger the request when the user clicks the button), and after receiving the request from the user, the real-time measurement results of the temperature data can be displayed.

当然,还可以通过其他的方式显示所述温度数据,本发明实施例对此并不加以限制。Certainly, the temperature data may also be displayed in other ways, which is not limited in this embodiment of the present invention.

与上述实施例描述的终端电池温度显示的方法相对应,本发明实施例还提出了一种终端电池温度显示装置。Corresponding to the method for displaying the temperature of the terminal battery described in the foregoing embodiments, the embodiments of the present invention further provide a device for displaying the temperature of the terminal battery.

图6示出了本发明实施例所述的终端电池温度显示装置的结构框图,所述装置可以包括:Fig. 6 shows a structural block diagram of a terminal battery temperature display device according to an embodiment of the present invention, and the device may include:

路径分析模块600,适于分析终端电池中温度传感器感测到的电池温度数据所在文件的文件路径;The path analysis module 600 is adapted to analyze the file path of the file where the battery temperature data sensed by the temperature sensor in the battery of the terminal is located;

其中,所述电池温度数据是系统预先调用驱动程序通知操作系统写入到文件中的数据。Wherein, the battery temperature data is the data that the system pre-calls the driver to notify the operating system to write into the file.

温度读取模块602,适于读取所述文件路径对应的文件内容;The temperature reading module 602 is adapted to read the file content corresponding to the file path;

第一提取模块604,适于从所述文件内容中提取所述电池温度数据。The first extracting module 604 is adapted to extract the battery temperature data from the file content.

显示模块606,适于在终端的用户界面上显示所述电池温度数据。The display module 606 is adapted to display the battery temperature data on the user interface of the terminal.

其中,所述用户界面为以下的任意一种:Wherein, the user interface is any one of the following:

桌面的插件,桌面悬浮窗和浏览器的插件。Desktop plug-ins, desktop floating windows and browser plug-ins.

其中,对于路径分析模块600、温度读取模块602和第一提取模块604的具体描述,可以参照上述终端电池温度数据监测装置实施例的相关描述,本发明实施例在此不再详细论述。Wherein, for the specific description of the path analysis module 600, the temperature reading module 602 and the first extraction module 604, reference may be made to the related description of the above embodiment of the terminal battery temperature data monitoring device, and the embodiment of the present invention will not be discussed in detail here.

上述实施例提出的终端电池温度数据显示方法和装置可以在获取到终端的电池温度数据之后,进一步将所述电池温度数据显示在终端的用户界面上,从而用户可以更加直观地了解电池温度数据,并根据当前的电池温度数据情况对终端执行相应的操作,例如如果当前的电池温度过高,可以通过暂停某些应用程序,以使电池温度降低,从而减少对终端性能的影响。The terminal battery temperature data display method and device proposed in the above embodiments can further display the battery temperature data on the terminal user interface after acquiring the terminal battery temperature data, so that the user can understand the battery temperature data more intuitively, And perform corresponding operations on the terminal according to the current battery temperature data. For example, if the current battery temperature is too high, you can suspend some applications to lower the battery temperature, thereby reducing the impact on terminal performance.

基于上述终端电池温度显示装置实施例,本发明实施例还提供了一种包含CPU、电池、温度传感器、存储器,以及该终端电池温度显示装置的终端。所述终端可以在获取到终端的电池温度数据之后,将所述电池温度数据显示在终端的用户界面上,从而用户可以更加直观地了解电池温度数据。Based on the above embodiment of the terminal battery temperature display device, the embodiment of the present invention further provides a terminal including a CPU, a battery, a temperature sensor, a memory, and the terminal battery temperature display device. The terminal may display the battery temperature data on a user interface of the terminal after acquiring the battery temperature data of the terminal, so that the user can understand the battery temperature data more intuitively.

本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other.

本领域技术人员易于想到的是:上述各个实施例的任意组合应用都是可行的,故上述各个实施例之间的任意组合都是本申请的实施方案,但是由于篇幅限制,本说明书在此就不一一详述了。It is easy for those skilled in the art to think that: any combination of the above-mentioned embodiments is feasible, so any combination of the above-mentioned embodiments is the embodiment of the present application, but due to space limitations, this description will be limited here Not detailed one by one.

在此提供的算法和显示不与任何特定计算机、虚拟系统或者其它设备固有相关。各种通用系统也可以与基于在此的示教一起使用。根据上面的描述,构造这类系统所要求的结构是显而易见的。此外,本发明也不针对任何特定编程语言。应当明白,可以利用各种编程语言实现在此描述的本发明的内容,并且上面对特定语言所做的描述是为了披露本发明的最佳实施方式。The algorithms and displays presented herein are not inherently related to any particular computer, virtual system, or other device. Various generic systems can also be used with the teachings based on this. The structure required to construct such a system is apparent from the above description. Furthermore, the present invention is not specific to any particular programming language. It should be understood that various programming languages can be used to implement the contents of the present invention described herein, and the above description of specific languages is for disclosing the best mode of the present invention.

在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure the understanding of this description.

类似地,应当理解,为了精简本公开并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该公开的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面公开的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline this disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of disclosure, however, is not to be interpreted as reflecting an intention that the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

本领域那些技术人员可以理解,可以对实施例中的设备中的模块进行自适应性地改变并且把它们设置在与该实施例不同的一个或多个设备中。可以把实施例中的模块或单元或组件组合成一个模块或单元或组件,以及此外可以把它们分成多个子模块或子单元或子组件。除了这样的特征和/或过程或者单元中的至少一些是相互排斥之外,可以采用任何组合对本说明书(包括伴随的权利要求、摘要和附图)中公开的所有特征以及如此公开的任何方法或者设备的所有过程或单元进行组合。除非另外明确陈述,本说明书(包括伴随的权利要求、摘要和附图)中公开的每个特征可以由提供相同、等同或相似目的的替代特征来代替。Those skilled in the art can understand that the modules in the device in the embodiment can be adaptively changed and arranged in one or more devices different from the embodiment. Modules or units or components in the embodiments may be combined into one module or unit or component, and furthermore may be divided into a plurality of sub-modules or sub-units or sub-assemblies. All features disclosed in this specification (including accompanying claims, abstract and drawings) and any method or method so disclosed may be used in any combination, except that at least some of such features and/or processes or units are mutually exclusive. All processes or units of equipment are combined. Each feature disclosed in this specification (including accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.

此外,本领域的技术人员能够理解,尽管在此所述的一些实施例包括其它实施例中所包括的某些特征而不是其它特征,但是不同实施例的特征的组合意味着处于本发明的范围之内并且形成不同的实施例。例如,在下面的权利要求书中,所要求保护的实施例的任意之一都可以以任意的组合方式来使用。Furthermore, those skilled in the art will understand that although some embodiments described herein include some features included in other embodiments but not others, combinations of features from different embodiments are meant to be within the scope of the invention. and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.

本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的电池温度监测装置中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载体信号上提供,或者以任何其他形式提供。The various component embodiments of the present invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art should understand that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components in the battery temperature monitoring device according to the embodiments of the present invention. The present invention can also be implemented as an apparatus or an apparatus program (for example, a computer program and a computer program product) for performing a part or all of the methods described herein. Such a program for realizing the present invention may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet site, or provided on a carrier signal, or provided in any other form.

应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention can be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In a unit claim enumerating several means, several of these means can be embodied by one and the same item of hardware. The use of the words first, second, and third, etc. does not indicate any order. These words can be interpreted as names.

Claims (13)

1. A terminal battery temperature monitoring method comprises the following steps:
analyzing a file path of a file where battery temperature data sensed by a temperature sensor in a terminal battery is located; the battery temperature data is data which is written into a file by a system calling a driver in advance to inform an operating system, and the file path of the file in which the battery temperature is sensed by the temperature sensor data comprises a plurality of file paths;
reading corresponding file contents from the plurality of file paths in sequence; when reading in sequence, when the reading of the file content corresponding to any one file path fails or the file content corresponding to any one file path is empty, continuing to read the file content corresponding to the next file path; when the file content corresponding to any one file path is read successfully, judging whether the file content corresponding to any one file path is empty content, and when the file content is not the empty content, stopping reading the file content corresponding to the next file path; wherein, the sequential reading is traversing reading according to a preset sequence;
extracting the battery temperature data from the file content.
2. The method of claim 1, wherein said sequentially reading corresponding file contents from said plurality of file paths comprises:
calling information to read a ReadInfo function, and sequentially transmitting the multiple file paths serving as parameters to the ReadInfo function;
and receiving a return value of the ReadInfo function, wherein the return value is the file content corresponding to the file path.
3. The method of claim 1, wherein the plurality of file paths comprise file path/sys/class/hwmon/hwmon 0/device/temp1_ input, file path/sys/class/power _ supply/basic/temp, and file path/sys/class/power _ supply/basic/temp in an android operating system.
4. The method of claim 1, further comprising:
monitoring a broadcast event sent by a terminal operating system when the state of the battery is detected to be changed;
additional data of the broadcast event is read and battery temperature data is extracted from the additional data.
5. The method of claim 4, the changing the state of the battery comprising:
the charging is started, the charging is finished, or the electric quantity variation of the battery reaches a preset threshold value.
6. The method of claim 1 or 4, further comprising:
comparing the extracted battery temperature data with a preset temperature range;
when the battery temperature data is within the temperature range, determining the battery temperature data within the temperature range as the battery temperature data of the terminal;
and when the battery temperature data exceeds the temperature range, converting the battery temperature data into temperature data within the temperature range, and taking the converted battery temperature data as the battery temperature data of the terminal.
7. A terminal battery temperature monitoring device comprising:
the path analysis module is suitable for analyzing a file path of a file where battery temperature data sensed by a temperature sensor in the terminal battery is located; the battery temperature data is data which is written into a file by a system calling a driver in advance to inform an operating system, and the file path of the file in which the battery temperature data sensed by the temperature sensor is located comprises a plurality of file paths;
the temperature reading module is suitable for reading corresponding file contents from the plurality of file paths in sequence; the method comprises the following steps: the reading continuing sub-module is suitable for continuing to read the file content corresponding to the next file path when the file content corresponding to any one file path fails to be read or the file content corresponding to any one file path is empty content during sequential reading; the judging submodule is suitable for judging whether the file content corresponding to any file path is empty content or not when the file content corresponding to any file path is read successfully; the reading stopping submodule is suitable for stopping reading the file content corresponding to the next file path when the judging subunit judges that the file content is not the empty content; wherein, the sequential reading is traversing reading according to a preset sequence;
a first extraction module adapted to extract the battery temperature data from the file content.
8. The apparatus of claim 7, the temperature reading module comprising:
the calling submodule is suitable for calling information to read the ReadInfo function, and the plurality of file paths are sequentially used as parameters to be transmitted to the ReadInfo function;
and the receiving submodule is suitable for receiving a return value of the ReadInfo function, and the return value is the file content corresponding to the file path.
9. The apparatus of claim 7, wherein the plurality of file paths comprise file path/sys/class/hwmon/hwmon 0/device/temp1_ input, file path/sys/class/power _ supply/basic/temp, and file path/sys/class/power _ supply/basic/temp in an android operating system.
10. The apparatus of claim 7, further comprising:
and the second extraction module is suitable for monitoring a broadcast event sent by a terminal operating system when the state of the battery is detected to be changed, reading additional data of the broadcast event and extracting battery temperature data from the additional data.
11. The apparatus of claim 10, the change in the state of the battery comprising:
the charging is started, the charging is finished, or the electric quantity variation of the battery reaches a preset threshold value.
12. The apparatus of claim 7 or 10, further comprising:
the comparison module is suitable for comparing the extracted battery temperature data with a preset temperature range;
the determining module is used for determining that the battery temperature data within the temperature range is the battery temperature data of the terminal when the comparison result of the comparing module is that the battery temperature data is within the temperature range;
and the conversion module is suitable for converting the battery temperature data into the temperature within the temperature range when the comparison result of the comparison module indicates that the battery temperature data exceeds the temperature range, and taking the converted battery temperature data as the battery temperature data of the terminal.
13. A terminal, comprising: a CPU, a battery, a temperature sensor, a memory, and a terminal battery temperature monitoring device according to any one of claims 7 to 12.
CN201210488942.XA 2012-11-26 2012-11-26 A kind of end cell temperature monitoring method and device and terminal Active CN103019907B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210488942.XA CN103019907B (en) 2012-11-26 2012-11-26 A kind of end cell temperature monitoring method and device and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210488942.XA CN103019907B (en) 2012-11-26 2012-11-26 A kind of end cell temperature monitoring method and device and terminal

Publications (2)

Publication Number Publication Date
CN103019907A CN103019907A (en) 2013-04-03
CN103019907B true CN103019907B (en) 2016-05-04

Family

ID=47968536

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210488942.XA Active CN103019907B (en) 2012-11-26 2012-11-26 A kind of end cell temperature monitoring method and device and terminal

Country Status (1)

Country Link
CN (1) CN103019907B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103257320B (en) * 2013-05-08 2019-04-02 百度在线网络技术(北京)有限公司 The electric quantity environment construction method and apparatus of mobile terminal
CN105242996A (en) * 2014-07-09 2016-01-13 腾讯科技(深圳)有限公司 Electric quantity simulation method and apparatus for intelligent terminal
CN116028314B (en) * 2022-05-16 2023-11-14 荣耀终端有限公司 Temperature parameter reading method, electronic device and computer-readable storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101210955A (en) * 2006-08-02 2008-07-02 新神户电机株式会社 Battery monitoring device and battery
CN101499544A (en) * 2008-01-28 2009-08-05 联想(北京)有限公司 Battery apparatus, protection circuit, temperature monitoring method and temperature sensor laying method
CN202411012U (en) * 2011-12-05 2012-09-05 哈尔滨智木科技有限公司 Battery separation equipment with temperature monitor

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7095211B2 (en) * 2004-04-16 2006-08-22 O2Micro International Limited Battery gas gauge

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101210955A (en) * 2006-08-02 2008-07-02 新神户电机株式会社 Battery monitoring device and battery
CN101499544A (en) * 2008-01-28 2009-08-05 联想(北京)有限公司 Battery apparatus, protection circuit, temperature monitoring method and temperature sensor laying method
CN202411012U (en) * 2011-12-05 2012-09-05 哈尔滨智木科技有限公司 Battery separation equipment with temperature monitor

Also Published As

Publication number Publication date
CN103019907A (en) 2013-04-03

Similar Documents

Publication Publication Date Title
US20180107353A1 (en) Electronic device and method for playing multimedia content by electronic device
CN106604362B (en) Wireless fidelity Wi-Fi scanning method and mobile terminal
EP3402160A1 (en) Service processing method and apparatus
US9823945B2 (en) Method and apparatus for managing application program
CN110825456A (en) Loading time calculation method and device, computer equipment and storage medium
CN105630566A (en) Application page loading duration determining method and application page loading duration determining device
KR20200015000A (en) Method for memory leak detection and electronic device thereof
CN105988805A (en) Application program management method and mobile terminal
CN103049069B (en) End cell process for temperature indication and device and terminal
CN105630585A (en) Periodic task processing method and apparatus
CN107291603A (en) Power consumption log analysis method, device, mobile terminal and readable storage medium
CN105980957B (en) Power monitoring system for virtual platform simulation
WO2016023520A1 (en) Method and device for recognizing application causing temperature rise of terminal, and terminal
CN103019907B (en) A kind of end cell temperature monitoring method and device and terminal
CN105575412A (en) Method and electronic device for storing audio data
US10108391B2 (en) Audio data operating method and electronic device supporting the same
US20140136664A1 (en) Resource based mobile device application streaming
CN108345791B (en) Processor security detection method, system and detection device
CN103514021B (en) The method and apparatus of browser is provided
CN106709330B (en) Method and device for recording file execution behaviors
CN113961427B (en) System memory analysis method and electronic device
CN108388616B (en) Data collection device, method, system and computer readable storage medium
US10210104B2 (en) Apparatus and method for providing handoff thereof
CN105550098B (en) Electronic device and method for controlling content in the electronic device
EP3819763B1 (en) Electronic device and operating method thereof

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20220728

Address after: Room 801, 8th floor, No. 104, floors 1-19, building 2, yard 6, Jiuxianqiao Road, Chaoyang District, Beijing 100015

Patentee after: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Address before: 100088 room 112, block D, 28 new street, new street, Xicheng District, Beijing (Desheng Park)

Patentee before: BEIJING QIHOO TECHNOLOGY Co.,Ltd.

Patentee before: Qizhi software (Beijing) Co.,Ltd.

TR01 Transfer of patent right