Data processing method, electronic equipment, storage medium and chip

By setting a sleep pre-detection mechanism in electronic devices, the sensor module can be controlled to stop reporting data when sleep detection is not required, thus solving the problem of high energy consumption in traditional electronic devices and achieving longer battery life and a better user experience.

CN121644731APending Publication Date: 2026-03-10HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

Traditional electronic devices consume a lot of power during sleep detection, resulting in poor battery life and a poor user experience.

Method used

By controlling the sensor module to stop reporting data when the user's state is determined to be that sleep detection is not required, and combined with the sleep pre-detection mechanism, the wake-up frequency and data acquisition frequency of the processing module are reduced, thereby reducing energy consumption.

Benefits of technology

It effectively reduces the energy consumption of electronic devices, increases battery life, and enhances the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121644731A_ABST
    Figure CN121644731A_ABST
Patent Text Reader

Abstract

The invention discloses a data processing method, electronic equipment, a storage medium and a chip. The method is applied to the electronic equipment comprising a sensing module and a processing module and comprises the steps that first acceleration data reported to the processing module by the sensing module are obtained, and the first acceleration data are acceleration data of a user collected by the sensing module within a first preset time period; sleep detection is carried out through the processing module based on the first acceleration data to determine the state of the user, the state of the user is a first state or a second state, the first state comprises a sleep state or a motion state, and the second state is a state except the first state; under the condition that the state of the user is the first state, the sensing module is controlled by the processing module to stop reporting the acceleration data collected by the sensing module to the processing module, so that the processing module stops sleep detection. Based on the method provided by the invention, the energy consumption of the electronic equipment can be reduced, the endurance time of the electronic equipment is prolonged, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and more particularly, to a data processing method, an electronic device, a storage medium and a chip. BACKGROUND

[0002] Electronic devices (for example, mobile phones or wearable devices) have a variety of functions, which improve the quality of people's lives and make people's work and study more efficient. In some scenarios, the sensors of the electronic device can collect acceleration data generated by a user holding the electronic device, and report the collected acceleration data to the processor of the electronic device for sleep detection processing, so as to realize sleep detection of the user, so that the user can know the sleep condition of himself (for example, sleep state, light sleep state, deep sleep state or continuous deep sleep state, etc.). In the traditional technology, there is a problem of high energy consumption of the electronic device and poor endurance of the electronic device when detecting the sleep of the user, which leads to poor user experience. SUMMARY

[0003] The present application provides a data processing method, an electronic device, a storage medium and a chip, which can reduce the energy consumption of the electronic device, improve the endurance time of the electronic device, and improve the user experience.

[0004] In a first aspect, an embodiment of the present application provides a data processing method applied to an electronic device including a sensor and a processor, the method comprising: obtaining first acceleration data reported by a sensing module to a processing module, the first acceleration data being acceleration data of a user collected by the sensing module in a first preset time period; performing sleep detection by the processing module based on the first acceleration data to determine a state of the user, the state of the user being a first state or a second state, the first state including a sleep state or a motion state, and the second state being a state other than the first state; and in a case where the state of the user is the first state, controlling, by the processing module, the sensing module to stop reporting acceleration data collected by the sensing module to the processing module, so that the processing module stops sleep detection.

[0005] Sleep detection (also referred to as sleep detection processing) is used to determine the sleep state of the user (for example, falling asleep, light sleep, deep sleep, etc.). The processing module is used to perform sleep detection on the acceleration data reported by the sensing module. It should be understood that, in a case where the processing module does not receive the acceleration data reported by the sensing module, the processing module does not perform sleep detection; in a case where the processing module receives the acceleration data reported by the sensing module, the processing module is woken up to perform sleep detection on the acceleration data reported by the sensing module.

[0006] The state of the user is a first state or a second state, and the second state is a state other than the first state. It should be understood that in the scenario of sleep detection of the user, when the state of the user is the first state (for example, a sleep state or a motion state), it can be considered that the sleep detection of the user is not required. When the state of the user is the second state, it can be considered that the sleep detection of the user is required.

[0007] In the technical solution, after the processing module of the electronic device obtains the acceleration data (that is, the first acceleration data) collected by the sensing module in a time period (that is, the first preset time period), the processing module performs sleep detection processing on the acceleration data (that is, the first acceleration data), and the state of the user can be determined. Then, in the case where it is determined that the state of the user is a state in which sleep detection is not required (that is, the first state, for example, the first state is a sleep state), the electronic device can control the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module by the processing module, so that the processing module stops sleep detection. In the implementation process, the processing module can be prevented from being frequently woken up to perform sleep detection after receiving the acceleration data frequently reported by the sensing module, the power consumption of the electronic device can be reduced, the endurance time of the electronic device can be improved, and the user experience can be improved.

[0008] In a possible implementation, before the sleep detection is performed by the processing module based on the first acceleration data to determine the state of the user, the method further includes: obtaining second acceleration data collected by the sensing module in a second preset time period; and performing sleep pre-detection based on the second acceleration data to determine that the state of the user is a suspected first state.

[0009] The first preset time period is a time period after the second preset time period, or a part of the first preset time period is the time period of the second preset time period, and the remaining time period of the first preset time period is a time period after the second preset time period.

[0010] The sleep pre-detection is used to process the collected acceleration data of the user to preliminarily determine the sleep state of the user. That is, in the case where it is determined based on the sleep pre-detection that the state of the user is a suspected first state, it is determined based on the sleep detection that the state of the user can be the first state or the second state.

[0011] Optionally, if the electronic device determines that the state of the user is not a suspected first state based on the sleep pre-detection processing of the acceleration data collected by the sensing module in a time period, the electronic device will not continue to perform the sleep detection processing thereafter.

[0012] In the above technical solution, the electronic device performs sleep pre-detection processing on the acceleration data (i.e., second acceleration data) collected by the sensing module within a preset time period (i.e., the second preset time period) to determine that the user's state is a suspected first state (i.e., a state where sleep detection processing is suspected to be unnecessary). Then, the electronic device performs precise sleep detection processing on the acceleration data (i.e., first acceleration data) collected by the sensor within another preset time period (i.e., the first preset time period) to determine that the user's state is the first state. Since the computational load of sleep pre-detection is less than that of sleep detection, when the electronic device determines that the user's state is not a suspected first state based on sleep pre-detection, the electronic device does not need to perform the computationally intensive sleep detection, i.e., it only performs the computationally intensive sleep pre-detection, which can reduce the power consumption of the electronic device to a certain extent. Subsequently, when it is determined that the user's state is a state where sleep detection is unnecessary (i.e., the first state), the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, so that the processing module stops sleep detection. This implementation process can reduce the power consumption of the electronic device, increase the battery life of the electronic device, and improve the user experience.

[0013] In another possible implementation, sleep pre-detection is performed based on the second acceleration data to determine that the user's state is suspected to be the first state, including: the sensing module performs sleep pre-detection based on the second acceleration data to determine that the user's state is suspected to be the first state.

[0014] In the above technical solution, after the sensing module collects the second acceleration data, it can perform sleep pre-detection on the second acceleration data to determine if the user's state is suspected to be the first state. Only when the user's state is suspected to be the first state will the processing module perform sleep detection on the first acceleration data. This effectively avoids the processing module being repeatedly woken up by the acceleration data reported by the sensing module to perform sleep detection processing on the acceleration data reported by the sensing module when the user's state is determined to be not suspected to be the first state (i.e., not suspected to be the first state), thus avoiding wasted power consumption in both the processing module and the sensing module's data transmission. This implementation, by setting the sensing module to perform sleep pre-detection, effectively reduces the power consumption of electronic devices, increases their battery life, and improves the user experience.

[0015] In another possible implementation, the method further includes: the processing module acquiring second acceleration data reported by the sensing module to the processing module; performing sleep pre-detection based on the second acceleration data to determine that the user's state is suspected to be the first state, including: the processing module performing sleep pre-detection based on the second acceleration data to determine that the user's state is suspected to be the first state.

[0016] In the above technical solution, the processing module can perform sleep pre-detection based on the second acceleration data reported by the sensor module to determine if the user's state is suspected to be the first state. Then, if the user's state is suspected to be the first state, the processing module continues to perform sleep detection on the first acceleration data to determine the user's sleep state.

[0017] In another possible implementation, the first acceleration data is the user's acceleration data collected by the sensing module at a first sampling frequency within a first preset time period. Furthermore, when the user is in a first state, the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, thereby causing the processing module to stop sleep detection. This includes: when the user is in the first state, the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, and controls the sensing module to collect the user's acceleration data at a second sampling frequency lower than the first sampling frequency.

[0018] In the above technical solution, the processing module of the electronic device acquires acceleration data (i.e., first acceleration data) reported by the sensing module, which was collected by the sensing module at a relatively high sampling frequency (i.e., first sampling frequency) within a certain period of time (i.e., a first preset time period). The processing module then performs sleep detection processing on this acceleration data (i.e., first acceleration data) to determine the user's state. Subsequently, if it is determined that the user's state does not require sleep detection (i.e., the first state), the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, thereby stopping sleep detection. This reduces the detection power consumption of the processing module and the data transmission power consumption of the sensing module. Furthermore, by controlling the sensing module to collect the user's acceleration data at a lower sampling frequency (i.e., second sampling frequency), the sampling power consumption of the sensing module can be reduced to a certain extent. Therefore, the power consumption of the electronic device can be reduced, the battery life of the electronic device can be increased, and the user experience can be improved.

[0019] In another possible implementation, the first state is a sleep state, the second state is a wake-up state, and; when the user's state is the first state, after the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, the method further includes: in response to the user's action being detected by the sensing module, performing sleep pre-detection on the third acceleration data collected by the sensing module within a third preset time period to determine the user's suspected state, the third preset time period being the time period after the user's action is detected, and the user's suspected state being a suspected wake-up state or a non-suspected wake-up state; when the user's suspected state is a suspected wake-up state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module so that the processing module performs sleep detection.

[0020] The implementation method of the electronic device detecting user actions through the sensing module is not specifically limited. For example, the electronic device detecting user actions through the sensing module includes: when the sensing module detects that a user in a sleep state has performed an action, the sensing module generates an interrupt signal, which is used to indicate that the user in a sleep state has performed an action.

[0021] It should be understood that if the electronic device performs sleep pre-detection on the acceleration data corresponding to the actions of a user in a sleep state collected by the sensor module and determines that the user's suspected state is not a suspected awakening state, that is, although the user in a sleep state has made an action (e.g., turning over or kicking his legs), the user is still in a sleep state, then the electronic device needs to continue to maintain the current state where the sensor module stops reporting the acceleration data collected by the sensor module to the processing module.

[0022] In the above technical solution, when the electronic device determines that the user is in a sleep state (i.e., an example of the first state) and controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, if the electronic device detects that the user in the sleep state has made a move through the sensing module, the electronic device will perform sleep pre-detection on the acceleration data (i.e., the third acceleration data) collected by the sensing module within a preset time period (i.e., the third preset time period) after the user's action. Then, if it is determined that the user's suspected state is a suspected awakening state, the electronic device needs to resume the data reporting process of the sensing module reporting the acceleration data collected by the sensing module to the processing module, so that the processing module can perform more accurate sleep detection processing on the acceleration data reported by the sensing module to determine the user's sleep state. Furthermore, if the user's suspected state is determined to be a non-suspected sleep state (i.e., the user is still asleep), the electronic device will still control the sensors to stop reporting the acceleration data collected by the sensor module to the processing module. This will cause the processing module to stop performing sleep detection processing. By setting the sensor module to perform a sleep pre-detection mechanism, the processing module is effectively prevented from being repeatedly woken up by the acceleration data reported by the sensor module while the user is asleep. This also avoids the processing module continuously performing sleep detection while the user is asleep, which would cause power waste. This implementation process can effectively reduce the power consumption of electronic devices, increase the battery life of electronic devices, and improve the user experience.

[0023] In another possible implementation, when the user's state is in the first state, the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module. This includes: when the user's state is in the first state, the processing module controls the sensing module to set the value of the first flag bit of the sensing module to a first value, which is used to instruct the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module.

[0024] When the value of the first flag is set to the first value, the first flag can be considered invalid. When the first flag is invalid, the sensing module will stop reporting the acceleration data collected by the sensing module to the processing module.

[0025] In the above technical solution, the electronic device sets the value of a certain flag bit (i.e., the first flag bit) of the sensing module to a preset value (i.e., the first value) to achieve the purpose of stopping the sensing module from reporting the acceleration data collected by the sensing module to the processing module. This implementation process does not require the introduction of additional external hardware, is relatively simple, and is conducive to improving data processing efficiency.

[0026] In another possible implementation, the method further includes: when the user's state is in the second state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module so that the processing module can perform sleep detection.

[0027] The second state is any state other than the first state. When the user's state is the first state, it can be considered that there is no need to perform sleep monitoring on the user; when the user's state is the second state, it can be considered that sleep monitoring on the user is required.

[0028] In the above technical solution, after the processing module of the electronic device obtains the acceleration data (i.e., first acceleration data) collected by the sensor module within a certain period of time (i.e., a first preset time period) reported by the sensor module, the processing module performs sleep detection processing on the acceleration data (i.e., first acceleration data) to determine the user's state. Then, if it is determined that the user's state requires sleep detection (i.e., the second state), the sensor module reports the acceleration data collected by the sensor module to the processing module, so that the processing module can perform sleep detection on the user's acceleration data reported by the sensor module, thus meeting the user's sleep detection needs and improving the user experience.

[0029] In another possible implementation, before the processing module performs sleep detection based on the first acceleration data to determine the user's state, the method further includes: acquiring fourth acceleration data collected by the sensing module within a fourth preset time period; performing sleep pre-detection based on the fourth acceleration data to determine that the user's state is a suspected second state.

[0030] The first preset time period is the time period after the fourth preset time period, or; a portion of the first preset time period is the time period of the third preset time period, and the remaining time period of the first preset time period is the time period after the fourth preset time period.

[0031] Optionally, if the electronic device determines that the user's state is not a suspected second state by performing sleep pre-detection processing based on the acceleration data collected by the sensing module within a certain time period, the electronic device will not continue to perform sleep detection processing thereafter.

[0032] In the above technical solution, the electronic device performs sleep pre-detection processing on the acceleration data (i.e., the fourth acceleration data) collected by the sensing module within a preset time period (i.e., the fourth preset time period) to determine that the user's state is suspected to be the second state (i.e., a state suspected of requiring sleep detection processing). Then, the electronic device performs precise sleep detection processing on the acceleration data (i.e., the first acceleration data) collected by the sensor within another preset time period (i.e., the first preset time period) to determine that the user's state is the first state. Since the computational load of sleep pre-detection is less than that of sleep detection, if the electronic device determines that the user's state is not suspected to be the second state based on sleep pre-detection, the electronic device does not need to perform the computationally intensive sleep detection, i.e., it performs the computationally less intensive sleep pre-detection, which can reduce the energy consumption of the electronic device to a certain extent. Subsequently, if it is determined that the user's state requires sleep detection (i.e., the second state), the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module, so that the processing module can perform sleep detection to meet the user's sleep detection needs and improve the user experience.

[0033] In another possible implementation, sleep pre-detection is performed based on the fourth acceleration data to determine that the user's state is suspected to be the second state, including: the sensing module performs sleep pre-detection based on the fourth acceleration data to determine that the user's state is suspected to be the second state.

[0034] In the above technical solution, after the sensing module collects the fourth acceleration data, it can perform sleep pre-detection on the fourth acceleration data to determine if the user's state is a suspected second state. Only when the user's state is a suspected second state will the processing module perform sleep detection processing on the first acceleration data collected by the sensing module. This effectively avoids the processing module being repeatedly woken up by the acceleration data reported by the sensing module to perform sleep detection processing on the acceleration data reported by the sensing module when the user's state is determined not to be a suspected second state, thus avoiding wasted power consumption in both the processing module and the sensing module's data transmission. This implementation process, by setting the sensing module to perform sleep pre-detection, can effectively reduce the power consumption of electronic devices, increase the battery life of electronic devices, and improve the user experience.

[0035] In another possible implementation, the method further includes: the processing module acquiring the fourth acceleration data reported by the sensing module to the processing module; and performing sleep pre-detection based on the fourth acceleration data to determine that the user's state is a suspected second state, including: the processing module performing sleep pre-detection based on the fourth acceleration data to determine that the user's state is a suspected second state.

[0036] In the above technical solution, the processing module can perform sleep pre-detection based on the fourth acceleration data reported by the sensor module to determine if the user's state is suspected to be the second state. Then, if the user's state is suspected to be the second state, the processing module continues to perform sleep detection on the second acceleration data to determine the user's sleep state.

[0037] In another possible implementation, when the user is in the second state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module, including: when the user is in the second state, the processing module controls the sensing module to set the value of the first flag bit of the sensing module to a second value, the second value being used to instruct the sensing module to report the acceleration data collected by the sensing module to the processing module.

[0038] The second value differs from the first value, and there are no specific restrictions on the values ​​of the second and first values.

[0039] When the value of the first flag is set to the second value, the first flag can be considered valid. When the first flag is valid, the sensing module will continuously report the acceleration data collected by the sensing module to the processing module.

[0040] In the above technical solution, the electronic device sets the value of a certain flag bit (i.e., the first flag bit) of the sensing module to a preset value (i.e., the second value) to achieve the purpose of the sensing module continuously reporting the acceleration data collected by the sensing module to the processing module. This implementation process does not require the introduction of additional external hardware, is relatively simple, and is conducive to improving data processing efficiency.

[0041] In another possible implementation, the sensing module includes a cache module, wherein the sensing module is also used to cache the collected acceleration data in the cache module, the first flag bit is a flag bit of the cache module, and the sensing module is also used to report the acceleration data cached in the cache module to the processing module when the value of the first flag bit is a second value.

[0042] The maximum cached data size (also known as the watermark) of the caching module is a preset data size. There are no specific limitations on the maximum cached data size or the cache size of the caching module, and it can be set according to the actual situation. For example, the maximum cached data size can be 60% of the cache size of the caching module, or the maximum cached data size can also be equal to the cache size of the caching module.

[0043] In the above technical solution, the sensing module in the electronic device first stores the collected user acceleration data in the sensing module's cache module. Furthermore, when the amount of acceleration data cached in the cache module reaches a preset amount, the sensing module reports the preset amount of acceleration data cached in the cache module to the processing module all at once. This avoids the sensing module performing a data transmission process of reporting the collected acceleration data to the processing module every time it collects acceleration data. This can reduce the power consumption of data transmission in the sensing module to a certain extent, thereby reducing the power consumption of the electronic device, increasing its battery life, and improving the user experience.

[0044] In another possible implementation, acquiring the first acceleration data reported by the sensing module to the processing module includes: the processing module acquiring the first acceleration data reported by the sensing module to the processing module; the processing module performing sleep detection based on the first acceleration data to determine the user's state includes: the processing module performing sleep detection based on the first acceleration data to determine the user's state; if the user's state is a first state, the processing module controlling the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module includes: if the user's state is the first state, the processing module sending a first instruction to the sensing module; the sensing module controlling the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module according to the first instruction.

[0045] In the above technical solution, after the processing module performs sleep detection processing based on the first acceleration data reported by the sensor module, it determines the user's state as the first state. Subsequently, the processing module can control the sensor module to stop reporting the acceleration data it has collected to the processing module by sending a command (i.e., the first command), which is a relatively simple process.

[0046] In another possible implementation, acquiring the first acceleration data reported by the sensing module to the processing module includes: the processing module acquiring the first acceleration data reported by the sensing module to the processing module; the processing module performing sleep detection based on the first acceleration data to determine the user's state, including: the processing module performing sleep detection based on the first acceleration data to determine the user's state; and, if the user's state is a second state, the processing module controlling the sensing module to report the acceleration data collected by the sensing module to the processing module, including: if the user's state is a second state, the processing module sending a second instruction to the sensing module; and the sensing module controlling the sensing module to report the acceleration data collected by the sensing module to the processing module according to the second instruction.

[0047] In the above technical solution, after the processing module performs sleep detection processing based on the first acceleration data reported by the sensor module, it determines that the user's state is the second state. Subsequently, the processing module can control the sensor module to continue reporting the acceleration data collected by the sensor module to the processing module by sending a command (i.e., the second command), which is a relatively simple process.

[0048] In another possible implementation, the sensing module is a triaxial accelerometer and the processing module is a microcontroller.

[0049] Optionally, when the sensor module includes a buffer module, the buffer module can be a first-in-first-out buffer.

[0050] Optionally, the processor can be the main processor in an electronic device.

[0051] In another possible implementation, the second state is the state of waking up from sleep, or the state of performing an action exceeding a preset range while in a sleep state.

[0052] Secondly, embodiments of this application provide a data processing apparatus, including a processing unit for performing any of the data processing methods in the first aspect.

[0053] Thirdly, embodiments of this application provide an electronic device including a unit for performing any of the data processing methods described in the first aspect. The electronic device may be a terminal device or a chip within a terminal device. The electronic device may include an input unit and a processing unit.

[0054] When the electronic device is a terminal device, the processing unit may be a processor, and the input unit may be a communication interface; the terminal device may also include a memory for storing computer program code, which, when the processor executes the computer program code stored in the memory, causes the terminal device to perform any of the data processing methods in the first aspect.

[0055] When the electronic device is a chip within a terminal device, the processing unit can be an internal processing unit of the chip, and the input unit can be an output interface, pin, or circuit, etc.; the chip may also include a memory, which can be an internal memory of the chip (e.g., registers, cache, etc.) or an external memory (e.g., read-only memory, random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip performs any of the data processing methods in the first aspect.

[0056] In one possible implementation, the memory is used to store computer program code; the processor executes the computer program code stored in the memory, and when the computer program code stored in the memory is executed, the processor is used to perform any of the data processing methods in the first aspect.

[0057] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer program code, which, when executed by an electronic device, causes the electronic device to perform any of the data processing methods described in the first aspect.

[0058] Fifthly, embodiments of this application provide a computer program product, the computer program product comprising: computer program code, which, when executed by an electronic device, causes the electronic device to perform any of the data processing methods described in the first aspect.

[0059] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here.

[0060] It should be understood that the descriptions of technical features, technical solutions, beneficial effects, or similar language in this application do not imply that all features and advantages can be achieved in any single embodiment. Rather, it is understood that the description of a feature or beneficial effect means that a specific technical feature, technical solution, or beneficial effect is included in at least one embodiment. Therefore, the descriptions of technical features, technical solutions, or beneficial effects in this specification do not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions, and beneficial effects described in this embodiment can be combined in any suitable manner. Those skilled in the art will understand that embodiments can be implemented without one or more specific technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be identified in specific embodiments that do not embody all embodiments. Attached Figure Description

[0061] Figure 1 This is a schematic diagram of the hardware architecture of an electronic device 100 provided in an embodiment of this application.

[0062] Figure 2 The above Figure 1 A schematic diagram of the structure of the processor and acceleration sensor in the provided electronic device 100.

[0063] Figure 3 This is a schematic diagram of the software system of an electronic device 100 provided in an embodiment of this application.

[0064] Figure 4 This is a schematic diagram of a data processing method provided in an embodiment of this application.

[0065] Figure 5 This is a schematic diagram of a data processing method provided in an embodiment of this application.

[0066] Figure 6 The above Figure 5 A schematic diagram of step S502 in the provided data processing method.

[0067] Figure 7 The above Figure 5 A schematic diagram of step S507 in the provided data processing method.

[0068] Figure 8 This is a schematic diagram of a data processing method provided in an embodiment of this application.

[0069] Figure 9 This is a schematic diagram of a data processing method provided in an embodiment of this application.

[0070] Figure 10 This is a schematic diagram of the data processing apparatus provided in the embodiments of this application. Detailed Implementation

[0071] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0072] The terms "first," "second," etc., used in this application specification, claims, and drawings are used to distinguish different objects and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, features defined as "first" or "second" may explicitly or implicitly include one or more of that feature.

[0073] In the embodiments of this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design that is described as "exemplary" or "for example" in the embodiments of this application should not be construed as being more preferred or advantageous than other embodiments or design. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.

[0074] Currently, electronic devices (such as mobile phones or wearable devices) are developing rapidly and becoming increasingly widespread. These devices offer a wide range of functions, improving people's quality of life and making work and study more efficient. In certain scenarios, the accelerometer sensor in an electronic device can collect acceleration data (e.g., triaxial acceleration data) generated by the user holding the device and report this data to the device's processor (e.g., a microcontroller unit, MCU) for sleep detection processing. This allows users to understand their sleep patterns (e.g., wakefulness, light sleep, and deep sleep), enhancing the user experience.

[0075] In traditional technologies, during sleep monitoring, the ACC sensor in an electronic device maintains constant communication with the processor, and the ACC sensor is always operational. The operational ACC sensor continuously collects acceleration data generated by the user holding the device and caches this data in a built-in buffer (e.g., a first-in-first-out (FIFO) buffer). Because communication between the ACC sensor and the processor is always open, when the amount of acceleration data cached in the buffer reaches a preset threshold, the ACC sensor proactively reports all the cached acceleration data to the processor. Upon receiving the acceleration data reported by the ACC sensor, the processor is awakened and enters operational mode. The operational processor automatically invokes a sleep algorithm to process the acceleration data reported by the ACC sensor to determine the user's sleep state.

[0076] As can be seen, in the traditional sleep detection process described above, the ACC sensor continuously collects the acceleration data generated by the user regardless of their state (e.g., sleep, wakefulness, or movement). Simultaneously, when the acceleration data cached in the ACC sensor reaches a preset threshold, the ACC sensor immediately reports the cached acceleration data to the processor to wake it up and run the sleep algorithm. In other words, in traditional technology, the ACC sensor is always active, and the processor is frequently woken up to run the sleep algorithm. However, in scenarios where the user is not asleep (e.g., in a movement-related situation) or is already asleep, the continuous collection of acceleration data by the ACC sensor and its constant waking of the processor to run the sleep algorithm leads to wasted energy, reduced battery life, and a poor user experience.

[0077] To address the aforementioned problems, this application provides a data processing method, an electronic device, a storage medium, and a chip. The method includes: a processing module of the electronic device acquiring acceleration data (i.e., first acceleration data) collected by a sensing module within a certain time period (i.e., a first preset time period) reported by the sensing module; and then performing sleep detection processing on the acceleration data (i.e., the first acceleration data) to determine the user's state. Subsequently, if it is determined that the user's state is one where sleep detection is unnecessary (i.e., a first state), the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, thereby stopping sleep detection. This reduces the power consumption of the electronic device, increases its battery life, and improves the user experience.

[0078] The data processing method provided in this application can be applied to electronic devices, and the type of electronic device is not specifically limited, but can be selected according to the actual scenario. For example, the electronic device may be, but is not limited to, at least one of smartphones, tablets, wearable devices (e.g., smartwatches), in-vehicle electronic devices, laptops, game consoles, augmented reality (AR) devices, virtual reality (VR) devices, and in-vehicle devices.

[0079] The hardware structure, software structure, and processor operation of the electronic device applicable to the data processing method provided in the embodiments of this application will be described in detail below with reference to the accompanying drawings.

[0080] For example, Figure 1 This is a schematic diagram of the hardware architecture of an electronic device 100 provided in an embodiment of this application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a power management module 140, a communication management module 150, a display screen 160, and a sensor module 170, etc.

[0081] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the hardware structure of the electronic device 100. In other embodiments, the electronic device 100 may include... Figure 1 The diagram shows more or fewer components, or combinations of some components, or splitting of some components, or different arrangements of components. Figure 1 The components shown can be implemented in hardware, software, or a combination of both.

[0082] Processor 110 can implement the functions of a processor in various possible implementations of electronic device 100. In one example, processor 110 is used to perform the following steps: acquiring first acceleration data reported by the sensing module to the processor, the first acceleration data being the acceleration data of the user collected by the sensing module within a first preset time period; performing sleep detection based on the first acceleration data to determine the user's state, the user's state being a first state or a second state, the first state including a sleep state or a movement state, the second state being a state other than the first state; if the user's state is the first state, controlling the sensing module to stop reporting the acceleration data collected by the sensing module to the processor, so that the processor stops sleep detection.

[0083] In some embodiments, processor 110 may include at least a microcontroller unit (MCU). Optionally, processor 110 may include at least one of the following processing units: application processor (AP), system-on-chip (SOC), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and neural network processing unit (NPU). These different processing units may be independent devices or integrated devices.

[0084] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.

[0085] The processor 110 can also contain a memory ( Figure 1 (Not shown in the image) The memory in processor 110 is used to store instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that processor 110 has just used or that are used repeatedly. If processor 110 needs to use the instruction or data again, it can directly retrieve it from the memory. This avoids repeated accesses, reduces the waiting time of processor 110, and thus improves system efficiency.

[0086] In some embodiments, the processor 110 may include one or more interfaces. These interfaces may include an inter-integrated circuit (I2C) interface, an improved inter-integrated circuit (I3C) interface, a serial peripheral interface (SPI) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0087] Sensor module 170 includes sensor hardware, which may include... Figure 1 The accelerometer 171A is shown. Accelerometer 171A can detect the magnitude of acceleration of electronic device 100 in various directions (typically the x-axis, y-axis, and z-axis). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. Accelerometer 171A can also be used to identify the attitude of electronic device 100, serving as input parameters for applications such as screen orientation switching and pedometers.

[0088] In some implementations, the accelerometer 171A includes a buffer for buffering the data acquired by the accelerometer 171A. For example, this buffer could be... Figure 2 The buffer 1711 in the illustrated accelerometer 171A, for example, can be, but is not limited to, a FIFO buffer. Additionally, Figure 2 The above shown Figure 1The processor 110 may include a memory 111 and a memory 112. Memory 111 may be used to store instructions and data related to executing data processing methods (e.g., acceleration data), and memory 112 may be used to store the results of the data processing methods (e.g., sleep detection results). In one example, memory 111 may be static random access memory (SRAM) or pseudo static random access memory (PSRAM), and memory 112 may be Flash memory. The processor 110 communicates with the accelerometer 171A via a bus (e.g., I2C, I3C, or SPI).

[0089] Optionally, the sensor module 170 may also include other sensor hardware, which may be, but is not limited to, at least one of the following sensors: gyroscope sensor, temperature sensor, humidity sensor, pressure sensor, barometric pressure sensor, distance sensor, proximity sensor, fingerprint sensor, touch sensor, ambient light sensor, bone conduction sensor, etc.

[0090] The power management module 140 is used to power the electronic device 100. The power management module 140 is connected to the processor 110. The power management module 140 receives external power input and powers the processor 110, internal memory 121, external memory, display screen 160, and communication management module 150, etc.

[0091] The communication management module 150 can provide communication solutions for use on the electronic device 100. Optionally, the communication management module 150 can be a wireless communication module, providing solutions for use on the electronic device 100 including WLAN (such as WIFI), Bluetooth, Global Navigation Satellite System (GNSS), Frequency Modulation (FM), Near Field Communication (NFC), Infrared (IR), and other wireless communication technologies.

[0092] The communication management module 150 may be one or more devices integrating at least one communication processing module. The communication management module 150 receives electromagnetic waves via an antenna, performs frequency modulation and filtering of the electromagnetic wave signal, and sends the processed signal to the processor 110. The communication management module 150 may also receive signals to be transmitted from the processor 110, perform frequency modulation and amplification on them, and then convert them into electromagnetic waves for radiation via the antenna.

[0093] Electronic device 100 implements display functions through a GPU, a display screen 160, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 160 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0094] Display screen 160 is used to display map application interfaces, VR video application interfaces, game application interfaces, etc. Display screen 160 includes a display panel. In some embodiments, electronic device 100 may include one or L displays, where L is an integer greater than 1.

[0095] The external storage interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0096] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. For example, in this embodiment, processor 110 can execute instructions stored in internal memory 121, which may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phone book, etc.). In addition, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.

[0097] It should be understood that, Figure 1 The connection relationships between the modules shown are merely illustrative and do not constitute a limitation on the connection relationships between the modules of the electronic device 100. Optionally, the modules of the electronic device 100 may also adopt a combination of various connection methods described in the above embodiments.

[0098] The software system of the aforementioned electronic device 100 is described below. The software system may adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment takes a layered architecture as an example to exemplarily describe the software system of the electronic device 100.

[0099] For example,Figure 3 This is a schematic diagram of the software system of an electronic device 100 provided in an embodiment of this application.

[0100] See Figure 3 This software system adopts a layered architecture. The layered architecture divides the software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided from top to bottom into the application layer, application framework layer, Android Runtime and core library layer, hardware abstraction layer (HAL), and kernel layer.

[0101] The application layer can include a series of application packages. For example, an application package may include applications such as health, sleep monitoring, maps, calendar, gallery, calling, camera, and Bluetooth. Each application in the application layer can generate application data; for example, a health application or a sleep monitoring application generates the user's sleep data (e.g., light sleep, deep sleep, etc.).

[0102] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications within the application layer. The application framework layer includes a set of predefined functions.

[0103] The application framework layer may include a sensor manager, activity manager, input manager, resource manager, notification manager, view system, content provider, etc.

[0104] The Sensor Manager is a core component of the Android system's sensor framework. It serves as the entry point for applications (such as health apps, sleep tracking apps, or map apps) to access sensor data. The Sensor Manager manages all sensors on the electronic device 100 and provides APIs for applications to access this data. In some implementations, the Sensor Manager can be understood as a separate thread.

[0105] The Android Runtime consists of core libraries and a virtual machine. The Android Runtime is responsible for scheduling and managing the Android system.

[0106] The core library consists of two parts: one part is the functionalities that need to be called by programming languages ​​(such as Java), and the other part is the Android core library.

[0107] The application layer and application framework layer run in a virtual machine. The virtual machine executes the programming files (such as Java files) of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.

[0108] The core library layer can include multiple functional modules, which may include, but are not limited to, a surface manager, a media framework, libc, and SQLite. The surface manager manages the display subsystem and provides the fusion of 2D and 3D layers for multiple applications. The media framework supports playback and recording of various common audio and video formats, as well as still image files. libc is the standard C library and one of the lowest-level libraries in the system, implemented through Linux system calls. For example, libc can be used to connect or disconnect camera services, set camera shooting parameters, start and stop previews, and take photos.

[0109] The Hardware Abstraction Layer (HAL) is an interface layer located between the operating system kernel and upper-layer software. The HAL abstracts the hardware of electronic device 100, providing a consistent interface for the upper-layer software of electronic device 100. For example... Figure 3 As shown, the hardware abstraction layer includes a sensor module, also known as the sensor HAL. In some implementations, when acceleration data generated by the accelerometer is stored in the shared memory of the kernel layer, the sensor module can retrieve the stored acceleration data by calling the shared memory interface and provide it to the upper-layer interface, allowing upper-layer applications (such as health applications or sleep monitoring applications) to access the acceleration data. Optionally, the hardware abstraction layer may also include other modules, each of which implements an interface for a specific type of hardware component. For example, other modules may be, but are not limited to, a display module, which can provide an interface for accessing the display hardware component.

[0110] The kernel layer is the foundation of the Android operating system; all the final functions of the Android operating system are implemented through the kernel layer. For example... Figure 3 As shown, the kernel layer may include shared memory for caching data (such as acceleration data), a display driver, and a Bluetooth driver. Furthermore, the kernel layer may also include various communication interfaces ( Figure 3 (Not shown in the image). Optionally, the kernel layer may also include removing... Figure 3Other drivers shown, such as other drivers, may include, but are not limited to, camera drivers and / or audio drivers, etc.

[0111] It should be noted that the application provided Figure 3 The illustrated software architecture diagram of the electronic device 100 is merely an example and does not limit the specific module divisions within different layers of the Android operating system. For details, please refer to the descriptions of the Android operating system software architecture in conventional technologies. Furthermore, the data processing method provided in this application can also be implemented on other operating systems (e.g., iOS or HarmonyOS), which will not be listed here.

[0112] Below, in conjunction with Figure 4 to Figure 9 The data processing method provided in the embodiments of this application will be described in detail.

[0113] Example 1

[0114] Figure 4 This is a schematic diagram illustrating a data processing method provided in an embodiment of this application. The data processing method provided in this embodiment can be executed by an electronic device. It is understood that the electronic device can be implemented as software, or a combination of software and hardware. For example, the electronic device in this embodiment can be, but is not limited to, […]. Figure 1 The electronic device 100 is shown. (For example...) Figure 4 As shown, the data processing method provided in this application embodiment may include steps S410 to S450. Steps S410 to S450 will be described in detail below.

[0115] In step S410, the ACC sensor in the electronic device acquires acceleration data and caches the acquired acceleration data in the FIFO buffer built into the ACC sensor.

[0116] The ACC sensor in an electronic device is used to collect acceleration data. In other words, the ACC sensor can collect acceleration data generated by the user holding the electronic device. The acceleration data generated by the user holding the electronic device can be understood as the acceleration data of the electronic device detected by the ACC sensor when the user causes the electronic device to be in a certain state.

[0117] The data type of the acceleration data acquired by the ACC sensor is related to the type of ACC sensor. In this embodiment, neither the type of ACC sensor nor the data type of the acceleration data acquired by the ACC sensor is specifically limited; it can be set according to actual needs. In one example, the ACC sensor can be a triaxial accelerometer. In this implementation, the acceleration data acquired by the ACC sensor (e.g., acceleration data #1) can be triaxial acceleration data, meaning that the triaxial acceleration data is the acceleration data of the user-held electronic device in the x, y, and z directions. In another example, the ACC sensor can be an acceleration sensor other than a triaxial accelerometer, which will not be elaborated further here.

[0118] In this embodiment, before the electronic device executes step S410, the communication between the ACC sensor and the processor in the electronic device remains open, and the ACC sensor is in a working state. The working ACC sensor continuously collects acceleration data generated by the user holding the electronic device and caches the collected acceleration data in a built-in FIFO buffer. Since the communication between the ACC sensor and the processor remains open, when the amount of acceleration data cached in the buffer reaches a preset threshold, the ACC sensor actively reports all the acceleration data cached in the buffer to the processor. Upon receiving the acceleration data reported by the ACC sensor, the processor is awakened, i.e., it enters a working state. The processor in a working state automatically calls a sleep algorithm to perform sleep detection processing on the acceleration data reported by the ACC sensor to determine the user's sleep state.

[0119] It should be understood that step S410 above uses the FIFO buffer built into the ACC sensor as an example. Optionally, the buffer built into the ACC sensor can also be other types of buffers. There are no specific limitations on other types of buffers, and they can be set according to actual needs.

[0120] In step S420, in response to the acceleration data #1 cached in the FIFO buffer reaching the preset water level and the full recognition flag of the FIFO buffer being valid, the ACC sensor reports the acceleration data #1 cached in the FIFO buffer to the MCU of the electronic device.

[0121] Before the ACC sensor executes step S420, the full recognition flag of the FIFO buffer built into the ACC sensor is valid. It should be understood that when the full recognition flag of the FIFO buffer is valid, if the amount of acceleration data buffered in the FIFO buffer reaches a preset level, the ACC sensor will automatically report all the acceleration data buffered in the FIFO buffer to the MCU. Therefore, when the ACC sensor executes step S420, that is, when the full recognition flag of the FIFO buffer is valid and the amount of acceleration data #1 buffered in the FIFO buffer reaches the preset level, the ACC sensor will actively report acceleration data #1 to the MCU.

[0122] Acceleration data #1 may include at least one set of acceleration data (e.g., a set of triaxial acceleration data) collected by the ACC sensor at at least one acquisition moment, wherein each set of acceleration data includes acceleration data of the electronic device in different directions. In one example, when the ACC sensor is a triaxial accelerometer, acceleration data #1 includes at least one set of acceleration data collected at at least one acquisition moment within a preset time period, and the at least one set of acceleration data includes acceleration data of the electronic device in the x-direction, y-direction, and z-direction, respectively, wherein the x-direction, y-direction, and z-direction are mutually perpendicular. For example, acceleration data #1 may include, but is not limited to, three sets of triaxial acceleration data collected by the ACC sensor at three acquisition moments, with a one-to-one correspondence between the three acquisition moments and the three sets of triaxial acceleration data, and each set of triaxial acceleration data being the user's acceleration data collected by the ACC sensor at the corresponding acquisition moment.

[0123] A preset water level is used to indicate a preset amount of data. The amount of data indicated by the preset water level should not exceed the maximum amount of data that the FIFO buffer can hold. In this embodiment, the size of the amount of data indicated by the preset water level is not specifically limited. The amount of data indicated by the preset water level can be the maximum amount of data that the FIFO buffer can hold, or the amount of data indicated by the preset water level can be less than the maximum amount of data that the FIFO buffer can hold.

[0124] For example, the maximum amount of data that a FIFO buffer can cache is 1 kilobyte (KB), and the data amount indicated by the preset water level can be 0.7KB or 1KB.

[0125] When the full flag of the FIFO buffer is valid, its value is not specifically limited. In one example, a value of "1" indicates the full flag is valid, and a value of "0" indicates it is invalid. In other words, in this implementation, if the electronic device detects a value of "1" for the full flag, it considers it valid; if it detects a value of "0", it considers it invalid. In another example, a value of "0" indicates the full flag is valid, and a value of "1" indicates it is invalid.

[0126] Optionally, after the ACC sensor performs step S420 above, the electronic device (e.g., the ACC sensor) can also clear the cached acceleration data #1 in the FIFO buffer. Then, when the ACC sensor acquires new acceleration data, it can successfully store the newly acquired acceleration data in the FIFO buffer.

[0127] Optionally, after the ACC sensor performs the above step S420, since the amount of acceleration data cached in the current FIFO buffer is already the maximum amount of data that the FIFO buffer can cache, when the ACC sensor stores the newly acquired acceleration data into the FIFO buffer, the acceleration data cached first in the FIFO buffer will be removed from the FIFO buffer.

[0128] In step S430, the MCU in the electronic device uses a sleep algorithm to process the acceleration data reported by the ACC sensor acquired within a preset time period A to determine the user's state. The acceleration data reported by the ACC sensor acquired within the preset time period A includes at least acceleration data #1.

[0129] Within the preset time period A, the MCU can receive at least one acceleration data #1 reported by the ACC sensor. That is, the acceleration data reported by the ACC sensor obtained by the MCU within the preset time period A includes at least acceleration data #1.

[0130] Optionally, within a preset time period A, the MCU can receive acceleration data reported multiple times by the ACC sensor. The amount of acceleration data reported by the ACC sensor to the MCU each time can be the same or different. For example, taking multiple reports as two reports, within the preset time period A, the MCU can receive the first acceleration data #1 reported by the ACC sensor, and the second acceleration data #2 reported by the ACC sensor. Acceleration data #2 is the new acceleration data collected by the ACC sensor after reporting the acceleration data #1 cached in the FIFO buffer to the MCU.

[0131] In this embodiment, the user's state may include state #1 and state #2, where state #2 includes all states except state #1. It should be understood that in a scenario where sleep detection is performed on the user, when the user is in state #1, sleep detection is not required; when the user is in state #2, sleep detection is required. Therefore, the time period corresponding to the user being in state #1 can be called the time period for which sleep state detection is not required; the time period corresponding to the user being in state #2 can be called the time period for which sleep state detection is required. Neither state #1 nor state #2 is specifically limited and can be set according to actual needs. In one example, state #1 can be a prolonged static state of falling asleep (also known as a sleep state) or a prolonged state of movement; state #2 can be at least one of the following states: transitioning from a waking state to a falling asleep state, performing an action exceeding a preset range while in a falling asleep state (e.g., the user turning over), or transitioning from a falling asleep state to an awakening state.

[0132] The sleep algorithm is used to process the collected acceleration data of the user to determine the user's sleep state. In this embodiment, the sleep algorithm is not specifically limited; for example, the MCU can execute the above step S430 according to an existing sleep algorithm.

[0133] For example, taking state #1 as a long-term static state of falling asleep and state #2 as a transition from falling asleep to waking up, the MCU uses a sleep algorithm to process the acceleration data reported by the ACC sensor within a preset time period A to determine the user's state. This can include the following steps: The MCU determines the user's activity duration within at least one preset duration #A within the preset time period A based on the acceleration data reported by the ACC sensor within the preset time period A; if the user's activity duration within each preset duration #A is less than the preset duration #1, the MCU determines the user's state as a long-term static state of falling asleep (i.e., an example of state #1); or, if the user's activity duration within at least one preset duration #A is greater than or equal to the preset duration #1, the MCU determines the user's state as a transition from falling asleep to waking up (i.e., an example of state #2).

[0134] The duration of preset duration #1, the duration of preset time period A, the amount of data of preset duration #A included in preset time period A, and the duration of each preset duration #A are not specifically limited and can be set according to actual conditions. For example, preset duration #1 can be, but is not limited to, 10 seconds, 20 seconds, 1 minute, etc., preset time period A can be, but is not limited to, 20 minutes, and at least one preset duration #A in preset time period A can include 3 preset duration #A, and these 3 preset duration #A are 30 seconds, 10 minutes, and 20 minutes, respectively.

[0135] In this embodiment, after the MCU executes step S430, the user's state includes the two states described above (i.e., state #1 or state #2). Therefore, after the MCU executes step S430, it will include... Figure 4 The examples show scenarios 1 and 2. Specifically, if the MCU determines that the user's state is in state #1 after executing step S430, then it is scenario 2, and step S450 is executed; if the MCU determines that the user's state is in state #2 after executing step S430, then it is scenario 1, and step S440 is executed.

[0136] The above step S430 uses the example of the MCU determining the user's state based on acceleration data #1 as an illustration. This is for illustrative purposes only and does not constitute any limitation. Optionally, the MCU can also determine the user's state based on acceleration data #1 and other physiological data of the user corresponding to the acquisition of acceleration data #1. There are no specific limitations on the other physiological data of the user; they can be set according to actual needs. For example, this physiological data can be, but is not limited to, blood oxygen data and / or heart rate data, etc., which will not be elaborated here.

[0137] It should be understood that during and after the execution of steps S410 to S430, the full recognition flag of the FIFO buffer built into the ACC sensor is valid (i.e., in response to the amount of acceleration data buffered in the FIFO buffer reaching a preset level, the ACC sensor will report all the acceleration data buffered in the FIFO buffer to the MCU), and the ACC sensor continues to collect acceleration data. Subsequently, when the MCU receives new acceleration data reported by the ACC sensor, the MCU will be woken up and put into working mode to run the sleep algorithm to process the new acceleration data and determine the user's status. In other words, during and after the execution of steps S410 to S430, the communication between the ACC sensor and the MCU is always open; the ACC sensor is in working mode, and the MCU is woken up by the acceleration data reported by the ACC sensor to run the sleep algorithm, meaning the MCU is also in working mode.

[0138] In step S440, when the user is in state #2, both the ACC sensor and the MCU are in working state.

[0139] Executing step S440 above, where the MCU determines the user is in state #2, requires sleep detection. At this time, both the ACC sensor and the MCU are active. The ACC sensor continuously collects acceleration data, and when the amount of acceleration data in the FIFO buffer reaches a preset level, the ACC sensor actively reports the cached acceleration data to the MCU. When the MCU receives newly reported acceleration data from the ACC sensor, the MCU is woken up and enters active mode to run the sleep algorithm to process the newly reported acceleration data.

[0140] It should be understood that when the ACC sensor is operational, it performs at least the following operations: acquires acceleration data and buffers the acquired acceleration data in a FIFO buffer; and when the acceleration data buffered in the FIFO buffer reaches a preset level, it reports all the acceleration data buffered in the FIFO buffer to the MCU. It should also be understood that, under normal communication conditions between the MCU and the ACC sensor, the MCU can successfully receive the acceleration data reported by the ACC sensor.

[0141] It should be understood that when the MCU is in operation, the MCU performs at least the following operations: runs a sleep algorithm to perform sleep detection processing on the acceleration data reported by the ACC sensor.

[0142] As described above, after executing step S430, both the ACC sensor and the MCU are in working condition. Therefore, executing step S440, which means controlling both the ACC sensor and the MCU to be in working condition when the user is in state #2, can be understood as the electronic device maintaining its current state to control both the ACC sensor and the MCU to be in working condition.

[0143] In step S450, when the user is in state #1, both the ACC sensor and the MCU are in sleep mode.

[0144] When step S450 is executed, i.e. the MCU determines that the user is in state #1, there is no need to perform sleep detection on the user. At this time, both the ACC sensor and the MCU are in sleep mode. In this case, the ACC sensor can collect the user's acceleration data at a lower acquisition frequency. The ACC sensor will not report the acceleration data cached in the FIFO buffer to the MCU. At the same time, the MCU will not run the sleep algorithm.

[0145] It should be understood that when the ACC sensor is in sleep mode, the ACC sensor can collect the acceleration data of the user holding the electronic device at a lower acquisition frequency, and the ACC sensor stops reporting the acceleration data to the MCU. Even if the acceleration data cached in the FIFO buffer reaches the preset water level, the ACC sensor will not report the acceleration data cached in the FIFO buffer to the MCU.

[0146] It should be understood that the MCU will not run the sleep algorithm when it is in sleep mode.

[0147] It is important to emphasize that when the ACC sensor is in sleep mode, if the ACC sensor (e.g., the motion detection module) detects a preset trigger event (such as a user turning over), the ACC sensor will switch from sleep mode to working mode. Then, the working ACC sensor can collect the user's acceleration data at a higher sampling frequency and cache the collected acceleration data in a FIFO buffer. Subsequently, when the amount of acceleration data collected by the ACC sensor in the FIFO buffer reaches a preset threshold, and the full recognition flag of the FIFO buffer is valid, the ACC sensor will report all the acceleration data cached in the FIFO buffer to the MCU to wake up the MCU and run the sleep algorithm to process the acceleration data and detect the user's sleep state.

[0148] It is important to emphasize that when the MCU is in sleep mode, if the MCU receives acceleration data reported by the ACC sensor, the MCU will switch from sleep mode to working mode. In working mode, the MCY will run the sleep algorithm to perform sleep detection processing on the acceleration data reported by the ACC sensor in order to detect the user's sleep state.

[0149] During and after the execution of steps S410 to S430, both the MCU and the ACC sensor are in working state. Specifically, the full recognition flag of the FIFO buffer built into the ACC sensor remains valid. Once the amount of acceleration data buffered in the FIFO buffer reaches a preset level, the ACC sensor will automatically report all the acceleration data buffered in the FIFO buffer to the MCU. Furthermore, when the MCU receives new acceleration data reported by the ACC sensor, the MCU will be woken up and put into working state to process the new acceleration data using the running sleep algorithm. Therefore, after executing step S430, executing step S450, i.e., when the user is in state #1, controls both the ACC sensor and the MCU to be in sleep state, can, for example, include the following steps: when the user is in state #1, perform the following operations: set the full recognition flag of the FIFO buffer to invalidate, set the ACC sensor to collect the user's acceleration data at a lower acquisition frequency, and set the MCU to stop running the sleep algorithm. It should be understood that when the full recognition flag of the FIFO buffer is invalid, even if the amount of acceleration data buffered in the FIFO buffer reaches the preset water level, the ACC sensor will not report all the acceleration data buffered in the FIFO buffer to the MCU.

[0150] It should be understood that the above Figure 4 The data processing method shown is for illustrative purposes only and does not constitute any limitation on the data processing method provided in the embodiments of this application. Optionally, for ease of description, the acquisition frequency of the ACC sensor before it stops reporting the user's acceleration data collected by the ACC sensor to the MCU is recorded as acquisition frequency #1, and the acquisition frequency of the ACC sensor after it reports the user's acceleration data collected by the ACC sensor to the MCU is recorded as acquisition frequency #2. Acquisition frequency #1 can also be equal to acquisition frequency #2.

[0151] In this embodiment, the electronic device determines the user's state based on the acceleration data generated by the user and collected by the ACC sensor. Then, based on the user's state, the electronic device controls the ACC sensor and MCU to be in a state matching the user's state (e.g., active or sleep state). Specifically, when the user's state requires sleep detection (i.e., the user is in state #2), the ACC sensor and MCU are controlled to be in active state to achieve sleep detection, thus satisfying the user experience. When the user's state does not require sleep detection (i.e., the user is in state #1), the ACC sensor and MCU are controlled to be in sleep state, effectively reducing the power consumption of the electronic device, improving its battery life, and thus enhancing the user experience. Furthermore, in the above data processing, by modifying the full recognition flag of the FIFO buffer in the ACC sensor, the ACC sensor is controlled to report acceleration data to the MCU. This implementation process is convenient and simple, and helps improve data processing efficiency. In summary, the data processing method provided in this embodiment can improve data processing performance.

[0152] Example 2

[0153] Figure 5 This is a schematic diagram illustrating a data processing method provided in an embodiment of this application. It should be understood that... Figure 5 The data processing method shown is based on the above. Figure 4 Taking state #1 as falling asleep and state #2 as waking up as an example, before using the sleep algorithm to determine the user's state, the electronic device also needs to use a sleep prediction algorithm to process the acceleration data collected by the ACC sensor to determine the user's suspected sleep state (i.e., the user's possible sleep state). The data processing method provided in this application embodiment can be executed by an electronic device. It is understood that the electronic device can be implemented as software, or a combination of software and hardware. For example, the electronic device in this application embodiment can be, but is not limited to, software. Figure 1 The electronic device 100 is shown. For example, such as... Figure 5 As shown, the data processing method provided in this application embodiment includes steps S501 to S510. Steps S501 to S510 will be described in detail below.

[0154] In step S501, the ACC sensor in the electronic device acquires acceleration data and caches the acquired acceleration data in the FIFO buffer of the ACC sensor.

[0155] Step S501 is similar to step S410 above. For details not described in detail here, please refer to the relevant description in step S410 above.

[0156] In step S502, the ACC sensor uses a sleep state prediction algorithm to process the acceleration data #0 to determine whether the user is in a suspected sleep state.

[0157] The ACC sensor performs step S502, which involves acquiring acceleration data and storing the acquired acceleration data in a FIFO buffer. The ACC sensor can then use a sleep state prediction algorithm to process the current acceleration data #0 buffered in the FIFO buffer to determine whether the user holding the electronic device was in a suspected sleep state when the acceleration data #0 was acquired. The user holding the electronic device can refer to a user holding a handheld electronic device (e.g., a mobile phone) or a user wearing an electronic device (e.g., a smartwatch). This embodiment does not specifically limit this.

[0158] Acceleration data #0 may include at least one set of acceleration data acquired by the ACC sensor at at least one acquisition moment within a preset time period. Each set of acceleration data includes acceleration data of the electronic device in different directions. For example, when the ACC sensor is a triaxial accelerometer, acceleration data #0 includes at least one set of acceleration data acquired at at least one acquisition moment within the preset time period, and the at least one set of acceleration data includes acceleration data of the electronic device in the x-direction, y-direction, and z-direction, respectively, wherein the x-direction, y-direction, and z-direction are perpendicular to each other.

[0159] There are no specific limitations on the data volume and preset time period for acceleration data #0; they can be set according to actual conditions. For example, the data volume of acceleration data #0 can be less than the maximum data volume that the FIFO buffer can hold (i.e., the data volume corresponding to the preset water level of the FIFO buffer). For example, the data volume of acceleration data #0 can be equal to the maximum data volume that the FIFO buffer can hold. For example, the preset time period can be, but is not limited to, 15 seconds, 20 seconds, or 30 seconds.

[0160] The ACC sensor executes step S502 above, that is, the ACC sensor processes the acceleration data #0 using the sleep state prediction algorithm to determine whether the user is in a suspected sleep state. This includes: after the ACC sensor processes the acceleration data #0 using the sleep state prediction algorithm and determines that the user is in a suspected sleep state, it continues to execute steps S503 and S504; or, after the ACC sensor processes the acceleration data #0 using the sleep state prediction algorithm and determines that the user is not in a suspected sleep state, the ACC sensor returns to execute step S501 above.

[0161] It should be understood that after the ACC sensor executes step S502, if it determines that the user is in a suspected sleep state, it will continue to execute steps S503 and S504 to further determine whether the user is actually asleep. If, after the ACC sensor executes step S502, it determines that the user is not in a suspected sleep state, the ACC sensor will return to executing step S501. That is, if the ACC sensor determines that the user is not in a suspected sleep state based on the acceleration data (i.e., acceleration data #0) in the current FIFO buffer, the ACC sensor needs to continue collecting new acceleration data and store the collected new acceleration data in the FIFO buffer. Afterward, the ACC sensor determines whether the user is in a suspected sleep state based on the acceleration data within a preset time period stored in the FIFO buffer. It should also be understood that when the amount of acceleration data cached in the FIFO buffer has reached the preset water level, and the ACC sensor is still in the state of collecting acceleration data, the ACC sensor will store the newly collected acceleration data in the FIFO buffer, and the acceleration data stored first in the FIFO buffer will be automatically removed from the FIFO buffer.

[0162] In this embodiment, the implementation method of the ACC sensor determining whether a user is in a suspected sleep state based on acceleration data is not specifically limited. Below, an example is given to illustrate a method for the ACC sensor to determine whether a user is in a suspected sleep state based on acceleration data.

[0163] In one example, the ACC sensor performing step S502 above may include, for example: Figure 6 Steps S5021 to S5026 are shown. It should be understood that... Figure 6 The process shown is for illustrative purposes only and does not constitute any limitation on the method by which the ACC sensor performs step S502 above.

[0164] The following describes steps S5021 to S5026.

[0165] In step S5021, the ACC sensor obtains the resultant acceleration data #0 based on the acceleration data #0.

[0166] As described above, acceleration data #0 includes at least one set of acceleration data acquired at at least one acquisition time. That is, acceleration data #0 can include one set of acceleration data corresponding to a single acquisition time, or it can include multiple sets of acceleration data corresponding to multiple acquisition times. For example, if acceleration data #0 includes acceleration data of an electronic device in different directions acquired at two acquisition times, then acceleration data #0 includes two sets of acceleration data corresponding to these two acquisition times, with each set of acceleration data including acceleration data of the electronic device in different directions acquired at the corresponding acquisition time.

[0167] For example, when the ACC sensor is a triaxial accelerometer, and the acceleration data #0 includes two sets of acceleration data corresponding to two acquisition times, after the ACC sensor performs the above step S5021, the obtained resultant acceleration data #0 includes the two resultant acceleration data corresponding to these two acquisition times. The resultant acceleration data corresponding to each acquisition time can be obtained by processing the set of acceleration data corresponding to each acquisition time based on the following formula:

[0168]

[0169] In the above formula, a x a y and a z Each represents a set of three-axis acceleration data, that is, the acceleration data of the electronic device in the three axial directions (x-axis, y-axis and z-axis), and 'a' represents the resultant acceleration data corresponding to this set of three-axis acceleration data.

[0170] In step S5022, the ACC sensor performs a filtering operation on the resultant acceleration data #0 to obtain the resultant acceleration data #0 after the filtering operation.

[0171] In step S5023, the ACC sensor determines N fluctuation data quantities based on the resultant acceleration data #0 after filtering operation.

[0172] The N fluctuating data points and the N adjacent resultant acceleration data points after filtering are in one-to-one correspondence. Each fluctuating data point is the difference between the corresponding adjacent resultant acceleration data points, and each fluctuating data point is greater than the preset threshold #1.

[0173] Preset threshold #1 is a preset threshold that can be set according to actual conditions, and is not specifically limited thereto. For example, preset threshold #1 can be, but is not limited to, 0.2 times the gravitational acceleration (g), that is, preset threshold #1 can be, but is not limited to, 0.2 multiplied by 9.8 (unit: meters per second squared, m / s). 2 ).

[0174] In step S5024, the ACC sensor determines whether N is less than the preset threshold #1.

[0175] The preset threshold #1 is a preset value. There is no specific limitation on the value of the preset threshold #1, and it can be set according to actual needs. For example, the preset threshold #1 can be, but is not limited to, equal to 4, 5, or 6.

[0176] In step S5025, the ACC sensor determines that the user is in a state of suspected sleep.

[0177] The ACC sensor performs the above step S5025, that is, when the ACC sensor determines that N is less than the preset threshold #1, the ACC sensor determines whether the user holding the electronic device is in a suspected sleep state during the period of collecting acceleration data stored in the FIFO buffer.

[0178] In step S5026, the ACC sensor returns to execute step S501.

[0179] The ACC sensor executes step S5026 above, that is, if the ACC sensor determines that N is greater than or equal to the preset threshold #1, the ACC sensor returns to execute step S501 above.

[0180] It should be understood that the above Figure 6 The method shown, which uses a sleep state prediction algorithm to process acceleration data #0 to determine whether the user is in a suspected sleep state, is merely illustrative and does not constitute any limitation on the way step S502 is implemented. Optionally, the above... Figure 6 The method shown for determining whether a user is in a suspected sleep state based on acceleration data #0 can also be replaced by a method for determining whether a user is in a suspected sleep state based on acceleration data #0 and blood oxygen data (i.e., the user's blood oxygen data corresponding to the time acceleration data #0 was collected), or a method for determining whether a user is in a suspected sleep state based on acceleration data #0, heart rate data (i.e., the user's heart rate data corresponding to the time acceleration data #0 was collected), and blood oxygen data (i.e., the user's blood oxygen data corresponding to the time acceleration data #0 was collected). These methods will not be elaborated on here.

[0181] In step S503, in response to the amount of acceleration data #1 cached in the FIFO buffer reaching the preset water level and the full recognition flag of the FIFO buffer being valid, the ACC sensor reports the acceleration data #1 cached in the FIFO buffer to the MCU of the electronic device so that the MCU can acquire the acceleration data #1.

[0182] After the ACC sensor performs the above step S502, the ACC sensor is still in working state, that is, the ACC sensor will continue to collect acceleration data and cache the collected acceleration data in the FIFO buffer so that the FIFO buffer contains acceleration data #1.

[0183] In this embodiment, acceleration data #1 and acceleration data #0 may be the same or different, and no specific limitation is made therein. When acceleration data #1 is different from acceleration data #0, the acquisition time corresponding to acceleration data #1 can be an acquisition time after the acquisition time corresponding to acceleration data #0, that is, acceleration data #1 is acceleration data acquired by the ACC sensor after acquiring acceleration data #0; or, the acquisition time corresponding to acceleration data #1 includes the acquisition time corresponding to acceleration data #0, and the other acquisition times corresponding to acceleration data #1 are acquisition times after the acquisition time corresponding to acceleration data #0, that is, acceleration data #1 includes acceleration data #0 and acceleration data acquired by the ACC sensor at the other acquisition times.

[0184] The method by which the ACC sensor performs step S503 is the same as described above. Figure 4 The ACC sensor shown performs the same method as step S420 above. For details not described in detail here, please refer to the description of step S420 above.

[0185] In step S504, the MCU uses a sleep state algorithm to process the acceleration data reported by the ACC sensor acquired within a preset time period A to determine whether the user is in a sleep state.

[0186] The acceleration data reported by the ACC sensor within the preset time period A can include multiple sets of acceleration data collected at multiple acquisition times. The multiple acquisition times and multiple sets of acceleration data correspond one-to-one. Each set of acceleration data is the user-generated acceleration data collected by the ACC sensor at the corresponding acquisition time. Each set of acceleration data includes the acceleration data of the electronic device in different directions.

[0187] In one example, the MCU uses a sleep state algorithm to process the acceleration data reported by the ACC sensor acquired within a preset time period A. After determining that the user is asleep, it continues to execute steps S505 to S507. In another example, the MCU uses a sleep state algorithm to process the acceleration data reported by the ACC sensor acquired within a preset time period A. After determining that the user is not asleep, it continues to execute step S501.

[0188] The method by which the MCU executes step S504 above is the same as described above. Figure 4The MCU shown performs the same method as step S430 above. For details not described in detail here, please refer to the description of step S430 above.

[0189] Optionally, the aforementioned sleep state algorithm is also used to determine the user's sleep time based on the acceleration data reported by the ACC sensor acquired within a preset time period A. Therefore, after the MCU executes step S504, the MCU can also acquire the user's sleep time. For example, if the length of the preset time period A is less than a preset threshold, the end time corresponding to the preset time period A can be determined as the user's sleep time.

[0190] In step S505, the MCU stores the sleep time corresponding to the acceleration data reported by the ACC sensor within the preset time period A.

[0191] For example, the MCU can store the sleep time point corresponding to the acceleration data reported by the ACC sensor within a preset time period A into the MCU's Flash memory.

[0192] Optionally, the MCU may not execute step S505. In this implementation, after the MCU executes step S504, the ACC sensor continues to execute step S506.

[0193] Optionally, after the MCU executes the above step S505, the electronic device can also display the user's sleep time to the user through the user interface of the electronic device.

[0194] It should be understood that after performing the above step S505, the user holding the electronic device is in a sleep state (i.e., a sleep state).

[0195] In step S506, the ACC sensor stops reporting acceleration data and collects the user's acceleration data at a lower acquisition frequency; the MCU stops running the sleep algorithm, which includes a sleep state algorithm and a sleep state algorithm.

[0196] When the ACC sensor stops reporting acceleration data, that is, when the ACC sensor stops reporting acceleration data to the MCU, the communication between the ACC sensor and the MCU can remain connected.

[0197] When step S506 is executed, that is, when it is determined that the user is in a sleep state, the electronic device will control both the ACC sensor and the MCU to be in a sleep state, so that the ACC sensor stops reporting acceleration data to the MCU and collects the user's acceleration data at a lower acquisition frequency; the MCU stops running the sleep algorithm.

[0198] The specific process of the ACC sensor performing step S506 is the same as described above. Figure 4The specific process of performing step S450 is similar to that shown above. For details not described in detail here, please refer to the relevant description in step S450 above.

[0199] In step S507, the ACC sensor uses a sleep-out state prediction algorithm to process the acceleration data corresponding to the interrupt signal output by the ACC sensor to determine whether the user is in a suspected sleep-out state.

[0200] An interrupt signal is a signal generated when the ACC sensor, which is in a dormant state, detects user movement (such as turning over) while the user is asleep. In other words, the interrupt signal indicates that the user, while asleep, has made a new movement. It should be understood that because the ACC sensor includes a motion detection module, it can still detect user movement even in a dormant state.

[0201] The acceleration data corresponding to the interrupt signal refers to the acceleration data collected by the ACC sensor within a preset time period after the interrupt signal is generated. In other words, the acceleration data corresponding to the interrupt signal refers to the user's acceleration data collected by the ACC sensor within a preset time period after detecting a new action by a user who is in a sleeping state. The relationship between this preset time period and the preset time period B mentioned below is not specifically limited. For example, this preset time period could be a preset time period preceding preset time period B mentioned below. For example, this preset time period could be preset time period B mentioned below.

[0202] The acceleration data corresponding to the interrupt signal can include multiple sets of acceleration data corresponding to multiple acquisition times. Each set of acceleration data includes the acceleration data of the electronic device held by the user in different directions.

[0203] After the ACC sensor executes step S507, if the ACC sensor determines that the user is in a suspected state of waking up from sleep, then steps S508 and S509 are executed; if the ACC sensor determines that the user is not in a suspected state of waking up from sleep (i.e., the user is still in a state of falling asleep), then step S506 is executed. In this embodiment of the application, the algorithm for predicting the state of waking up from sleep is not specifically limited.

[0204] For example, the ACC sensor performing the above step S507 may include Figure 7 Steps S5071 to S5075 are shown. It should be understood that... Figure 7 The process shown is for illustrative purposes only and does not constitute any limitation on the method by which the ACC sensor performs step S507 above.

[0205] The following describes steps S5071 to S5075.

[0206] In step S5071, the ACC sensor performs filtering processing on the acceleration data corresponding to the interrupt signal to obtain the filtered acceleration data corresponding to the interrupt signal.

[0207] The purpose of the ACC sensor performing the above step S5071 is to remove noise from the acceleration data corresponding to the interrupt signal, so as to obtain clean acceleration data that does not contain noise as much as possible. This is beneficial to improving the accuracy of subsequent judgment of suspected sleep state.

[0208] For example, in one instance, the ACC sensor performs filtering on the acceleration data corresponding to the interrupt signal to obtain filtered acceleration data corresponding to the interrupt signal, including: the ACC sensor performs low-pass filtering on the acceleration data corresponding to the interrupt signal to obtain filtered acceleration data corresponding to the interrupt signal.

[0209] In step S5072, the ACC sensor determines M fluctuation data based on the acceleration data corresponding to the filtered interrupt signal.

[0210] The M fluctuating data points and the acceleration data corresponding to the filtered interrupt signal are in one-to-one correspondence with the M adjacent acceleration data points. Each fluctuating data point is the difference between the corresponding adjacent acceleration data points, and each fluctuating data point is greater than the preset threshold #2.

[0211] The preset threshold #2 and the preset threshold #1 in step S5024 can be the same, or the preset threshold #2 can be greater than the preset threshold #1; there are no specific limitations on this. For example, both the preset threshold #2 and the preset threshold #1 are equal to 0.2g. For example, the preset threshold #2 is equal to 0.5g, and the preset threshold #1 is equal to 0.2g.

[0212] In this embodiment, the M adjacent acceleration data are not specifically limited. In one example, the acceleration data corresponding to the filtered interrupt signal is triaxial acceleration data. Therefore, the M adjacent acceleration data may include s adjacent acceleration data in the x-direction, p adjacent acceleration data in the y-direction, and q adjacent acceleration data in the z-direction, where M = s + p + q, and M, s, p, and q are integers greater than or equal to zero.

[0213] In step S5073, the ACC sensor determines whether M is greater than or equal to the preset threshold #2.

[0214] After the ACC sensor performs step S5073, if the ACC sensor determines that M is greater than or equal to the preset threshold #2, then step S5074 is performed after step S5073; if the ACC sensor determines that M is less than the preset threshold #2, then step S5075 (i.e. step S506) is performed after step S5073.

[0215] In step S5074, the ACC sensor determines that the user is in a state of suspected wakefulness.

[0216] The ACC sensor executes the above step S5074, that is, if it determines that M is greater than or equal to the preset threshold #2, the ACC sensor determines that the user is in a suspected sleep state.

[0217] In step S5075, the ACC sensor performs step S506.

[0218] It should be understood that the above text Figure 7 The method shown for implementing step S507 is merely illustrative and does not constitute any limitation on the implementation of step S507 by the ACC sensor. Optionally, after performing step S5071, the ACC sensor can first process the acceleration data corresponding to the filtered interrupt signal obtained in step S5071 to obtain the resultant acceleration data corresponding to the filtered interrupt signal. Then, the ACC sensor determines M fluctuation data quantities based on the resultant acceleration data corresponding to the filtered interrupt signal. In this implementation, the M fluctuation data quantities and the M adjacent resultant acceleration data included in the resultant acceleration data corresponding to the filtered interrupt signal correspond one-to-one, each fluctuation data quantity is the difference between the corresponding adjacent acceleration data, and each fluctuation data quantity is greater than a preset threshold #2. Afterwards, the ACC sensor performs steps S5073 to S5075.

[0219] In step S508, the ACC sensor resumes reporting acceleration data, resumes collecting acceleration data, and the MCU resumes running the sleep algorithm.

[0220] When the ACC sensor performs step S508, that is, when it is determined that the user is in a suspected sleep state, the electronic device controls the ACC sensor and MCU to be in working state, so that the ACC sensor resumes reporting acceleration data, resumes collecting acceleration data, and the MCU resumes running the sleep algorithm.

[0221] The specific process for performing step S508 is the same as that for performing step S440. For details not elaborated here, please refer to the relevant description in step S440.

[0222] In step S509, the MCU uses the sleep-out state algorithm to process the acceleration data reported by the ACC sensor acquired within the preset time period B to determine whether the user is in a sleep-out state.

[0223] The acceleration data reported by the ACC sensor acquired within the preset time period B can include multiple sets of acceleration data collected at multiple acquisition times. Each set of acceleration data includes acceleration data of the electronic device in different directions. The two sets of acceleration data collected at any two acquisition times can be the same or different.

[0224] The duration of preset time period B can be the same as or different from the duration of preset time period A. This application embodiment does not impose specific limitations on this, and can be set according to the actual scenario.

[0225] After the MCU executes step S509, if the MCU processes the acceleration data reported by the ACC sensor acquired within the preset time period B using the sleep-out state algorithm and determines that the user is in a sleep-out state, then it continues to execute step S510; if the MCU processes the acceleration data reported by the ACC sensor acquired within the preset time period B using the sleep-out state algorithm and determines that the user is not in a sleep-out state, then it continues to execute steps S506 and S507. It should be understood that after executing step S509, if the MCU determines that the user is not in a sleep-out state, then the user is in a sleep state (i.e., a sleep state).

[0226] It should be understood that the acceleration data reported by the ACC sensor obtained by the MCU within the preset time period B in step S509 above can be new acceleration data collected by the ACC sensor after step S508 above is executed.

[0227] For example, the MCU processes the acceleration data reported by the ACC sensor within a preset time period B using a sleep-out state algorithm to determine whether the user is in a sleep-out state. This can include the following steps: The MCU determines the user's activity duration within at least one preset duration #B within the preset time period B based on the acceleration data reported by the ACC sensor within the preset time period B; if the user's activity duration within each preset duration #B is greater than or equal to a preset duration #1, the MCU determines that the user is in a sleep-out state; or, if the user's activity duration within at least one preset duration #B is less than a preset duration #1, the MCU determines that the user is not in a sleep-out state.

[0228] Optionally, the aforementioned sleep-out state algorithm is also used to determine the user's sleep-in time based on the acceleration data reported by the ACC sensor acquired within a preset time period B. Therefore, after the MCU executes step S509, the MCU can also acquire the user's sleep-out time. For example, if the length of the preset time period B is less than a preset threshold, the end time corresponding to the preset time period B can be determined as the user's sleep-out time.

[0229] In step S510, the MCU stores the sleep time points corresponding to the acceleration data reported by the ACC sensor within the preset time period B.

[0230] For example, the MCU can store the sleep time point in the MCU's Flash memory.

[0231] Optionally, the MCU may not execute the above step S510. In this implementation, after the MCU executes the above step S509, the ACC sensor continues to execute step S510.

[0232] Optionally, after the MCU executes the above step S510, the electronic device can also display the user's sleep and wake times to the user through the user interface of the electronic device.

[0233] After performing the above step S510, the user holding the electronic device is in a sleep state.

[0234] It should be understood that the above Figure 5 The data processing methods shown are for illustrative purposes only and do not constitute any limitation on the data processing methods provided in the embodiments of this application. For example, the ACC sensor's acquisition frequency is the same before and after it stops reporting acceleration data.

[0235] In this embodiment, the ACC sensor of the electronic device executes a sleep state pre-judgment algorithm on the acceleration data collected over a period of time. When the electronic device initially determines that the user is in a suspected sleep state (i.e., possibly asleep), the ACC sensor continuously collects acceleration data and stores it in the ACC sensor's FIFO buffer. Once the amount of acceleration data buffered in the FIFO buffer reaches a preset level, the MCU calls the sleep algorithm (i.e., sleep state algorithm) based on the acquired acceleration data to further determine whether the user is asleep. If the user is determined to be asleep, the MCU and ACC sensor are put into sleep mode. Subsequently, upon detecting an interrupt signal from the ACC sensor indicating a change in action state, the ACC sensor activates the wake-up state pre-judgment algorithm. If the user is determined to be in a suspected wake-up state, the ACC sensor and MCU are put into working mode to achieve sleep detection for the user, thus meeting the user's sleep detection needs and improving the user experience. Subsequently, once the amount of acceleration data buffered in the FIFO buffer of the ACC sensor reaches a preset level, all the acceleration data buffered in the FIFO buffer is reported to the MCU. This allows the MCU to invoke its sleep algorithm (i.e., the wake-up algorithm) to further evaluate the acceleration data reported by the ACC sensor to determine if the user is in a wake-up state. If the user is not in a wake-up state (i.e., the user is in a sleep state), the ACC sensor and MCU are put into a sleep state until the user wakes up, at which point the ACC sensor and MCU are put into an active state. This method can effectively reduce the power consumption of electronic devices, improve their battery life, and enhance the user experience.

[0236] Example 3

[0237] Figure 8 This is a schematic diagram illustrating a data processing method provided in an embodiment of this application. It should be understood that... Figure 8 The data processing method shown is as described above. Figure 5 The diagram illustrates a specific interactive flowchart of a data processing method. The data processing method provided in this application embodiment can be executed by an electronic device. It is understood that the electronic device can be implemented as software, or a combination of software and hardware. For example, the electronic device in this application embodiment may be, but is not limited to, […]. Figure 1 The electronic device 100 is shown. (For example...) Figure 8 As shown, the data processing method provided in this application embodiment includes steps S801 to S817. Steps S801 to S817 will be described in detail below.

[0238] In step S801, the ACC sensor of the electronic device collects acceleration data and stores the collected acceleration data in the FIFO buffer.

[0239] In this embodiment of the application, the full recognition flag bit of the FIFO buffer built into the ACC sensor is valid before performing the above step S801.

[0240] The specific process of the ACC sensor performing step S801 is the same as described above. Figure 5 The ACC sensor in the process performs the same procedure as step S501 above. For details not described here, please refer to the relevant description in step S501 above.

[0241] In step S802, the ACC sensor uses a sleep state prediction algorithm to process the acceleration data #0 to determine whether the user is in a suspected sleep state.

[0242] The specific process of the ACC sensor performing step S802 is the same as described above. Figure 5 The ACC sensor in the process performs the same procedure as step S502 above. For details not described here, please refer to the relevant description in step S502 above.

[0243] In step S803, in response to the amount of acceleration data in the FIFO buffer reaching a preset level and the full recognition flag of the FIFO buffer being valid, the ACC sensor sends acceleration data #1 to the MCU. Accordingly, the MCU receives acceleration data #1 sent by the ACC sensor.

[0244] The specific process of the ACC sensor performing step S803 is the same as described above. Figure 5 The ACC sensor in the process performs the same procedure as step S503 above. For details not described in detail here, please refer to the relevant description in step S503 above.

[0245] In step S804, the MCU processes the acceleration data reported by the ACC sensor acquired within the preset time period A according to the sleep state algorithm to determine whether the user is in a sleep state.

[0246] The specific process of the MCU executing step S804 above is the same as described above. Figure 5 The specific process of the MCU executing step S504 above is the same. For details not described in detail here, please refer to the relevant description in step S504 above.

[0247] After the MCU executes step S804, if it determines that the user is asleep, it continues to execute steps S806 to S810; if the MCU determines that the user is not asleep, it returns to execute steps S801 to S804 again. It should be understood that when the MCU determines that the user is not asleep and returns to execute steps S801 to S804 again, the acceleration data cached in the FIFO buffer differs from the data cached in the previous execution of steps S801 to S804; otherwise, they remain the same.

[0248] In step S805, the MCU sends command A to the ACC sensor. Correspondingly, the ACC sensor receives command A from the MCU.

[0249] Instruction A is used to instruct the full recognition flag of the FIFO buffer to be modified to invalid, and to instruct the ACC sensor to collect the user's acceleration data at a lower frequency. The information included in Instruction A is not specifically limited. In one example, Instruction A may include modification information for instructing the full recognition flag of the FIFO buffer to be modified to invalid, and frequency information for instructing the ACC sensor to collect the user's acceleration data at a lower frequency. For example, assuming the full recognition flag of the FIFO buffer is "1" indicating that the full recognition flag is valid, and the full recognition flag is "0" indicating that the full recognition flag is invalid, in this implementation, the modification information included in Instruction A may specifically be information for instructing the full recognition flag of the FIFO buffer to be modified to "0", thereby invalidating the full recognition flag.

[0250] In this embodiment, the above steps S801, S802, S803, S804 and S805 are executed sequentially. That is, if the user is suspected to be asleep based on the acceleration data generated by the user collected in a short period of time (i.e. acceleration data #0), and the user is further determined to be asleep based on the acceleration data generated by the user collected over a longer period of time, it is necessary to control the ACC sensor to stop reporting ACC data to the MCU and control the ACC sensor to collect the user's acceleration data at a lower frequency. Therefore, the MCU achieves this purpose by sending instruction A to the ACC sensor.

[0251] In this embodiment, the MCU and the ACC sensor can communicate via a bus. Therefore, the MCU executes step S805 above, that is, the MCU sends command A to the ACC sensor via the bus. The bus is not specifically limited and can be configured according to actual conditions. For example, the bus can be, but is not limited to, I2C, I3C, or SPI.

[0252] In step S806, the ACC sensor, according to instruction A, modifies the full recognition flag of the FIFO buffer to invalid to stop reporting acceleration data, and collects the user's acceleration data at a lower acquisition frequency.

[0253] After the ACC sensor performs the above step S806, the ACC sensor stops reporting acceleration data to the MCU, and at the same time, the ACC sensor collects the user's acceleration data at a lower frequency.

[0254] In this embodiment, the full recognition flag of the FIFO buffer is valid in steps S801 to S805. Therefore, the ACC sensor executes step S806, that is, the ACC sensor modifies the full recognition flag of the FIFO buffer to invalid according to instruction A, that is, it changes the full recognition flag of the FIFO buffer from valid to invalid.

[0255] The specific method for implementing the ACC sensor to collect user acceleration data at a lower frequency is not limited. For example, taking an Android electronic device as an example, the data acquisition of the ACC sensor can be achieved through the SensorManager.

[0256] It should be understood that after the ACC sensor collects the user's acceleration data at a low frequency, if the user holding the electronic device makes a movement (such as the user turning over), the ACC sensor will detect the movement.

[0257] It should be noted that, in steps S804 to S806 above, the example of the MCU determining that the user is asleep and sending instruction A to the ACC sensor to instruct the full recognition flag of the FIFO buffer to be invalidated and to instruct the collection of the user's acceleration data at a lower frequency illustrates that when the user is asleep, the full recognition flag of the FIFO buffer needs to be invalidated to control the ACC sensor to stop reporting acceleration data and collect the user's acceleration data at a lower frequency. Optionally, steps S804 to S806 above can also be replaced by the following steps: After the MCU determines that the user is asleep, the MCU can send user sleep status information to the ACC sensor, which is used to indicate that the user is asleep. Therefore, after the ACC sensor acquires the user's sleep status information, the ACC sensor automatically modifies the full recognition flag of the FIFO buffer to invalid to stop reporting acceleration data according to the preset rules, and collects the user's acceleration data at a lower frequency. The preset rules are used to instruct that when the user is in a sleep state, the full recognition flag of the FIFO buffer should be modified to invalid to stop reporting acceleration data, and the user's acceleration data should be collected at a lower collection frequency.

[0258] In step S807, the ACC sensor sends a response message for command A to the MCU. Correspondingly, the MCU receives the response message for command A sent by the ACC sensor.

[0259] The response message for instruction A is used to indicate that the full recognition flag of the FIFO buffer is invalid.

[0260] When the ACC sensor executes step S807, that is, when the ACC sensor sets the full recognition flag of the FIFO buffer to invalid, the ACC sensor will send the message of successful setting to the MCU so that the MCU knows that the full recognition flag of the FIFO buffer in the ACC sensor is invalid.

[0261] In step S808, in response to receiving the response message of instruction A, the MCU enters a sleep state to stop running the sleep algorithm.

[0262] When the MCU executes step S808, that is, when the user is asleep and the ACC sensor stops reporting acceleration data to the MCU, the MCU is in a sleep state and stops running the sleep algorithm because the ACC sensor will no longer report new acceleration data to the MCU.

[0263] In this embodiment of the application, steps S804 to S808 are executed, that is, when the user is in a sleep state, the ACC sensor is controlled to be in a sleep state, and the MCU is controlled to be in a sleep state.

[0264] In step S809, the MCU determines the sleep time point based on the acceleration data acquired within the preset time period A, and stores the sleep time point.

[0265] The specific implementation method for the MCU to determine the sleep time point based on the acceleration data acquired within the preset time period A is not limited and will not be elaborated here.

[0266] Optionally, the MCU may not execute step S809. In this implementation, after the MCU executes step S808, the ACC sensor continues to execute step S810.

[0267] Optionally, after the MCU executes the above step S809, that is, after the MCU stores the sleep time point, the electronic device can also display the sleep time point to the user through the user interface of the electronic device.

[0268] It should be understood that after performing steps S801 to S809 above, the user holding the electronic device is in a sleep state.

[0269] In step S810, in response to detecting a user action, the ACC sensor generates an interrupt signal #j.

[0270] When a user holding an electronic device is asleep, if the user makes a turning motion or engages in frequent movements after waking up, the ACC sensor will detect the change in motion and generate an interrupt signal #j corresponding to that motion. Simultaneously, the ACC sensor, which is currently collecting the user's acceleration data at a lower frequency, can switch to a higher frequency to collect acceleration data more efficiently over a preset time period following the user's action.

[0271] In step S811, the ACC sensor uses the sleep-out prediction algorithm to process the acceleration data corresponding to the interrupt signal #j to determine whether the user is in a suspected sleep-out state, where j is a positive integer.

[0272] In one example, after the ACC sensor determines that the user is in a suspected awakening state, it continues to execute steps S812 to S816. In another example, after the ACC sensor determines that the user is not in a suspected awakening state, the ACC sensor sets j = j + 1 and returns to continue executing step S810, where the interrupt signal #j+1 refers to the next interrupt signal collected after the ACC sensor collects the interrupt signal #j.

[0273] The specific process of the ACC sensor performing step S811 is the same as described above. Figure 5 The specific process of step S507 is the same. The acceleration data corresponding to the interrupt signal #j in step S811 is a specific example of the acceleration data corresponding to the interrupt signal in step S507 above. For details not elaborated here, please refer to the description in step S507 above.

[0274] In step S812, the ACC sensor changes the full recognition flag of the FIFO buffer from invalid to valid and resumes collecting acceleration data.

[0275] The ACC sensor executes step S812 above, that is, when it determines that the user is in a suspected sleep state, the ACC sensor changes the full recognition flag of the FIFO buffer from invalid to valid, so that the ACC sensor resumes reporting acceleration data to the MCU. At the same time, the ACC sensor resumes collecting acceleration data.

[0276] It should be understood that after the ACC sensor performs step S812 above, it resumes collecting acceleration data and stores the collected acceleration data in the FIFO buffer. Subsequently, when the amount of acceleration data buffered in the FIFO buffer reaches a preset threshold, the ACC sensor will proactively report all the acceleration data stored in the FIFO buffer to the MCU, as described in step S815 below.

[0277] In step S813, the ACC sensor sends command B to the MCU. Correspondingly, the MCU receives command B sent by the ACC sensor.

[0278] Instruction B is used to indicate that the full flag of the FIFO buffer is valid. Therefore, after receiving instruction B, the MCU can know that the full flag of the FIFO buffer is currently valid.

[0279] In step S814, in response to receiving instruction B, the MCU resumes running the sleep algorithm.

[0280] The MCU resumes running the sleep algorithm. Understandably, once the MCU receives new ACC data, it will execute the sleep algorithm on the new ACC data. The sleep algorithm is used to determine the sleep state (e.g., falling asleep, waking up, deep sleep, etc.).

[0281] After the MCU executes step S814, that is, after the MCU receives instruction B sent by the ACC sensor, it knows that the full recognition flag of the FIFO buffer is valid. Therefore, the MCU resumes running the sleep algorithm.

[0282] In step S815, in response to the acceleration data stored in the FIFO buffer reaching a preset level, the ACC sensor sends acceleration data to the MCU. Correspondingly, the MCU receives the acceleration data sent by the ACC sensor.

[0283] The preset water level in step S815 can be the same as the preset water level in step S803. For details not elaborated here, please refer to the relevant description in step S803 above.

[0284] The specific process of the ACC sensor performing step S815 is the same as described above. Figure 5 The specific process for the ACC sensor to recover and report acceleration data in step S508 is the same. For details not elaborated here, please refer to the description in step S508 above.

[0285] In step S816, the MCU processes the acceleration data acquired within the preset time period B according to the sleep state algorithm, and the MCU determines whether the user is in a sleep state.

[0286] In one example, after the MCU determines that the user is awakening from sleep, it continues to execute step S817. In another example, if the MCU determines that the user is not awakening from sleep (i.e., the user is still asleep), it returns to execute steps S805 to S811.

[0287] The specific process of the MCU executing step S816 is the same as described above. Figure 5 The specific process of step S509 is the same. For details not elaborated here, please refer to the description of step S509 above.

[0288] In step S817, the acceleration data acquired by the MCU within the preset time period B determines the sleep time point and stores the sleep time point.

[0289] The specific process of the MCU executing step S817 is the same as described above. Figure 5 The specific process of step S510 is the same as that in the previous step. For details not described in detail here, please refer to the description of step S510 above.

[0290] Optionally, after the MCU executes the above step S817, that is, after the MCU stores the sleep time point, the electronic device can also display the sleep time point to the user through the user interface of the electronic device.

[0291] Optionally, the MCU may not need to perform the above step S817.

[0292] It should be understood that the above Figure 8 The data processing methods shown are for illustrative purposes only and do not constitute any limitation on the data processing methods provided in this application.

[0293] In this embodiment, the ACC sensor of the electronic device executes a sleep state pre-judgment algorithm on the acceleration data collected over a period of time. When the electronic device initially determines that the user is in a suspected sleep state (i.e., possibly asleep), the ACC sensor continuously collects acceleration data and stores it in the ACC sensor's FIFO buffer. Once the amount of acceleration data buffered in the FIFO buffer reaches a preset level, the MCU calls the sleep algorithm (i.e., sleep state algorithm) based on the acquired acceleration data to further determine whether the user is asleep. If the user is determined to be asleep, the MCU and ACC sensor are put into sleep mode. Subsequently, upon detecting an interrupt signal from the ACC sensor indicating a change in action state, the ACC sensor activates the wake-up state pre-judgment algorithm. If the user is determined to be in a suspected wake-up state, the ACC sensor and MCU are put into working mode to achieve sleep detection for the user, thus meeting the user's sleep detection needs and improving the user experience. Subsequently, once the amount of acceleration data buffered in the FIFO buffer of the ACC sensor reaches a preset level, all the acceleration data buffered in the FIFO buffer is reported to the MCU. This allows the MCU to invoke its sleep algorithm (i.e., the wake-up algorithm) to further evaluate the acceleration data reported by the ACC sensor to determine if the user is in a wake-up state. If the user is not in a wake-up state (i.e., the user is in a sleep state), the ACC sensor and MCU are put into a sleep state until the user wakes up, at which point the ACC sensor and MCU are put into an active state. This method can effectively reduce the power consumption of electronic devices, improve their battery life, and enhance the user experience.

[0294] Example 4

[0295] Figure 9 This is a schematic diagram illustrating a data processing method provided in an embodiment of this application. The data processing method provided in this embodiment can be executed by an electronic device. It is understood that the electronic device can be implemented as software, or a combination of software and hardware. For example, the electronic device in this embodiment can be, but is not limited to, […]. Figure 1 The electronic device 100 is shown. (For example...) Figure 9 As shown, the data processing method provided in this application embodiment may include steps S910 to S930. Steps S910 to S930 will be described in detail below.

[0296] In step S910, the electronic device acquires the first acceleration data reported by the sensing module to the processing module. The first acceleration data is the acceleration data of the user collected by the sensing module within a first preset time period.

[0297] The data processing method provided in this application can be applied to electronic devices including a sensing module and a processing module. The sensing module and the processing module can communicate to achieve data interaction. The communication method between the sensing module and the processing module is not specifically limited and can be configured according to actual conditions. In one example, the sensing module and the processing module can communicate via a bus, such as, but not limited to, I2C, I3C, or SPI.

[0298] A sensing module refers to a module capable of acquiring acceleration data, and a processing module refers to a module capable of processing data. In this embodiment, the specific presentation of the sensing module and processing module is not limited and can be configured according to actual circumstances.

[0299] In one example, the sensing module is a triaxial accelerometer, and the processing module is a microcontroller. Optionally, the sensing module includes a buffer module, wherein the sensing module is further used to buffer the acquired acceleration data into the buffer module, and the sensing module is also used to report acceleration data buffered in the buffer module to the processing module in an amount equal to a preset data volume. It should be understood that the maximum buffered data volume (also known as the waterline) of the buffer module is a preset data volume, and there is no specific limitation on the maximum buffered data volume and the buffer capacity of the buffer module; it can be set according to the actual situation. For example, the maximum buffered data volume can be 60% of the buffer capacity of the buffer module, or the maximum buffered data volume can also be equal to the buffer capacity of the buffer module.

[0300] For example, a specific example of the sensing module in the above example could be the one described above. Figure 2 The accelerometer 171A shown above, and a specific example of the buffer module in the above example, could be the aforementioned... Figure 2 The buffer 1711 shown above, a specific example of the processing module in the above example, can be the one described above. Figure 2 The processor 110 is shown.

[0301] In another example, the sensing module may also be an acceleration sensor of a type other than a triaxial accelerometer, or it may be another type of module or unit. Optionally, the processing module may also be a processor (e.g., a CPU, etc.) in an electronic device.

[0302] The acceleration data collected by the sensing module at each acquisition moment within a first preset time period constitutes a set of acceleration data. Each set of acceleration data includes the acceleration data of the electronic device held by the user in different directions. Therefore, the first acceleration data includes at least one set of acceleration data collected by the sensing module within the first preset time period. Specifically, when the first preset time period includes only one acquisition moment, the first acceleration data includes a set of acceleration data of the electronic device held by the user collected by the sensing module at that acquisition moment. When the first preset time period includes only multiple acquisition moments, the first acceleration data includes multiple sets of acceleration data of the electronic device collected at those multiple acquisition moments, wherein the multiple sets of acceleration data correspond one-to-one with the multiple acquisition moments, and each set of acceleration data is the acceleration data of the electronic device held by the user collected by the sensing module at the corresponding acquisition moment.

[0303] For example, when the sensing module is a triaxial accelerometer, the set of acceleration data collected by the sensing module at each acquisition moment within the first preset time period will include the acceleration data of the electronic device held by the user in the x-direction, the acceleration data in the y-direction, and the acceleration data in the z-direction, respectively, wherein the three directions of x-direction, y-direction, and z-direction are mutually perpendicular.

[0304] In step S910 above, the electronic device acquires the first acceleration data reported by the sensing module to the processing module, including: the processing module of the electronic device acquires the first acceleration data reported by the sensing module to the processing module.

[0305] As described above, the first acceleration data includes at least one set of acceleration data, and there is no specific limit to the number of times the sensing module reports the first acceleration data to the processing module. For example, the first acceleration data may be reported to the processing module once or multiple times by the sensing module, and the acceleration data reported by the sensing module to the processing module each time is a set of acceleration data included in the first acceleration data.

[0306] In one example, the sensing module includes a cache module, and the maximum cached data size of the cache module is a preset data size. Therefore, the processing module obtains the first acceleration data reported by the sensing module, which includes: when the data size of the first acceleration data is Q times the preset data size, the processor obtains the acceleration data reported by the sensing module Q times, where Q is a positive integer.

[0307] For example, a specific example of the above-mentioned sensing module may be the one described above. Figure 4 The ACC sensor in the provided data processing method, the aforementioned processing module can be the aforementioned Figure 4 In the MCU, a specific example of the acceleration data reported by the aforementioned sensing module to the processing module each time can be the above.Figure 4 In step S420, the acceleration data #1, a specific example of the preset data amount mentioned above can be the above. Figure 4 The data volume corresponding to the preset water level in step S420, and a specific example of the first preset time period mentioned above, can be the aforementioned... Figure 4 The preset time period A in step S430, which is not detailed here, can be found in the above text. Figure 4 The relevant descriptions in the provided data processing methods.

[0308] The sampling frequency when the sensor module collects the first acceleration data is not specifically limited and can be set according to the actual situation. For ease of description, the sampling frequency when the sensor module collects the first acceleration data will be referred to as the first sampling frequency in the following text.

[0309] In step S920, the electronic device performs sleep detection based on the first acceleration data through the processing module to determine the user's state. The user's state is either a first state or a second state. The first state includes a sleep state or a movement state, and the second state is any state other than the first state.

[0310] The user's state is either the first state or the second state, where the second state is any state other than the first state.

[0311] It should be understood that in scenarios where sleep monitoring is performed on users, if the user's state is in the first state (such as sleep or movement), it can be considered that sleep monitoring is not necessary.

[0312] For example, taking the first state as a sleep state, if the user is in a sleep state, even if the sensing module continues to report new acceleration data generated by the user to the processing module, and the processing module runs a sleep state judgment algorithm to perform sleep detection processing on the new acceleration data reported by the sensing module, the user's state will still be determined to be a sleep state. For example, taking the first state as a motion state, if the user is in a motion state, even if the sensing module continues to report new acceleration data generated by the user to the processing module, and the processing module runs a sleep state judgment algorithm to perform sleep detection processing on the new acceleration data reported by the sensing module, the user's state will still not be a sleep state. It can be seen that in scenarios where user sleep state detection is required, when the user is in a sleep or motion state, even if the sensing module stops reporting new acceleration data generated by the user to the processing module, causing the processing module to stop running the sleep state judgment algorithm to perform sleep detection, it will not affect the user's sleep detection results.

[0313] It should be understood that in scenarios involving sleep monitoring of users, sleep monitoring is considered necessary when the user's state is in a second state other than the first state described above. In this embodiment, the second state is not specifically limited. In one example, the second state is the state of waking up from sleep, or the state of performing an action exceeding a preset range while in a sleep state.

[0314] Sleep detection (also known as sleep detection processing) is used to determine a user's sleep state (e.g., falling asleep, light sleep, or deep sleep). The implementation method of sleep detection processing is not specifically limited. For example, sleep detection based on first acceleration data can be performed by a processing module, including: using a sleep state determination algorithm to perform sleep detection processing on the first acceleration data.

[0315] The electronic device executes step S920 above, that is, the electronic device performs sleep detection based on the first acceleration data through the processing module to determine the user's state, including: the processing module performs sleep detection based on the first acceleration data to determine the user's state. The implementation method of the processing module performing sleep detection based on the first acceleration data to determine the user's state is not specifically limited and can be determined according to the actual situation.

[0316] For example, the processing module performs sleep detection based on the first acceleration data to obtain the first activity duration of the user's activity within a first preset time period. If the first activity duration is greater than the preset activity duration A, the user's state is the movement state included in the first state; if the first activity duration is less than the preset activity duration B, the user's state is the sleep state included in the first state, where the preset activity duration B is less than the preset amount A; if the first activity duration is greater than or equal to the preset activity duration B and less than or equal to the preset activity duration A, the user's state is the second state.

[0317] Optionally, the processing module can perform sleep detection based on the first acceleration data and the first physiological data to determine the user's state. The first physiological data is the user's physiological characteristic data (e.g., blood oxygen data and / or heart rate data) within a first preset time period.

[0318] In this embodiment of the application, before the electronic device performs the above step S910, that is, before the processing module performs sleep detection based on the first acceleration data to determine the user's state, the electronic device can also perform the following steps to achieve the purpose of performing sleep pre-detection on the user before performing sleep detection on the user: the electronic device acquires the second acceleration data collected by the sensing module within a second preset time period; the electronic device performs sleep pre-detection based on the second acceleration data to determine that the user's state is suspected to be the first state.

[0319] A user's status as "suspected first state" means that the user's state may be the first state. In other words, when a user's status is "suspected first state," the user's state is not necessarily the first state.

[0320] Sleep pre-detection is used to process the collected acceleration data of the user to make a preliminary judgment on the user's sleep state. That is, if sleep pre-detection determines that the user's state is suspected to be in the first sleep state, sleep detection may determine that the user's state is either in the first or second sleep state. If sleep pre-detection determines that the user's state is suspected to be in the second sleep state, sleep detection may determine that the user's state is either in the second or first sleep state.

[0321] The first preset time period is the time period following the second preset time period, or a portion of the first preset time period is the time period of the second preset time period, and the remaining portion of the first preset time period is the time period following the second preset time period. The lengths of the first and second preset time periods are not specifically limited and can be set according to actual circumstances. For example, the length of the first preset time period can be greater than or equal to the length of the second preset time period, or the length of the first preset time period can be less than or equal to the length of the second preset time period.

[0322] Optionally, if the electronic device determines that the user's state is not suspected to be the first state by performing sleep pre-detection processing based on the acceleration data collected by the sensing module within a certain time period, the electronic device will not continue to perform sleep detection processing thereafter.

[0323] In the above implementation, the electronic device performs sleep pre-detection processing on the acceleration data (i.e., the second acceleration data) collected by the sensing module within a preset time period (i.e., the second preset time period) to determine that the user's state is a suspected first state (i.e., a state where sleep detection processing is not required). Then, the electronic device performs precise sleep detection processing on the acceleration data (i.e., the first acceleration data) collected by the sensor within another preset time period (i.e., the first preset time period) to determine that the user's state is the first state. Since the computational load of sleep pre-detection is less than that of sleep detection, when the electronic device determines that the user's state is not a suspected first state based on sleep pre-detection, the electronic device does not need to perform the computationally intensive sleep detection, i.e., it performs the less computationally intensive sleep pre-detection, which can reduce the power consumption of the electronic device to a certain extent. Subsequently, when it is determined that the user's state is a state where sleep detection is not required (i.e., the first state), the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, so that the processing module stops sleep detection. This can reduce the power consumption of the electronic device, increase the battery life of the electronic device, and improve the user experience.

[0324] In this embodiment, the implementation method of determining the user's state as a suspected first state by the electronic device performing sleep pre-detection based on the second acceleration data is not specifically limited.

[0325] In one example, the process of the above-mentioned electronic device performing sleep pre-detection based on the second acceleration data and determining that the user's state is suspected to be the first state is exemplary, including: the sensing module performing sleep pre-detection based on the second acceleration data and determining that the user's state is suspected to be the first state.

[0326] In the above implementation, after the sensing module collects the second acceleration data, it can perform sleep pre-detection on the second acceleration data to determine if the user's state is suspected to be the first state. Only when the user's state is suspected to be the first state will the processing module perform sleep detection on the first acceleration data. This effectively avoids the processing module being repeatedly woken up by the acceleration data reported by the sensing module to perform sleep detection processing on the acceleration data reported by the sensing module when the user's state is determined to be not suspected to be the first state. This avoids wasting power on both the processing module and the sensing module's data transmission. This implementation process, by setting the sensing module to perform sleep pre-detection, can effectively reduce the power consumption of electronic devices, increase the battery life of electronic devices, and improve the user experience.

[0327] In another example, before the electronic device performs sleep pre-detection based on the second acceleration data and determines that the user's state is suspected to be the first state, the electronic device may also perform the following steps: the electronic device obtains the second acceleration data reported by the sensing module to the processing module through the processing module; the electronic device performs sleep pre-detection based on the second acceleration data and determines that the user's state is suspected to be the first state, including: the processing module of the electronic device performs sleep pre-detection based on the second acceleration data and determines that the user's state is suspected to be the first state.

[0328] In the above technical solution, the processing module can perform sleep pre-detection based on the second acceleration data reported by the sensor module to determine if the user's state is suspected to be the first state. Then, if the user's state is suspected to be the first state, the processing module continues to perform sleep detection on the first acceleration data to determine the user's sleep state.

[0329] For example, a specific example of the first state in step S920 above could be the one described above. Figure 4 In step S450, state #1, a specific example of the second state in step S920 above could be the above. Figure 4 In step S440, state #2, details not elaborated here can be found above. Figure 5The relevant descriptions of the steps in the provided data processing method.

[0330] For example, a specific example of the suspected first state in step S920 above can be the suspected sleep state in step S502 above, and a specific example of the first state above can be the above... Figure 5 In step S504, the sleep state can be categorized as follows: a specific example of the suspected second state could be the suspected wake-up state in step S507; a specific example of the second state could be the wake-up state in step S509; a specific example of the first acceleration data could be acceleration data #1 in step S503; a specific example of the second acceleration data could be acceleration data #0 in step S504; a specific example of sleep detection could include the detection process corresponding to the sleep state algorithm in step S504 and the detection process corresponding to the wake-up state algorithm in step S509; a specific example of sleep pre-detection could include the detection process corresponding to the sleep state pre-judgment algorithm in step S502 and the detection process corresponding to the wake-up state pre-judgment algorithm in step S507. Details not elaborated here can be found in the preceding text. Figure 4 The relevant descriptions of the steps in the provided data processing method.

[0331] In step S930, when the user's state is in the first state, the electronic device controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module through the processing module, so that the processing module stops sleep detection.

[0332] When the electronic device executes step S930, i.e., when the user's state is one where sleep detection is not required (i.e., the first state), the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module. Since the processing module is woken up upon receiving the acceleration data reported by the sensing module, it performs sleep detection processing on the acceleration data. Therefore, when the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module, the processing module will not be woken up to perform sleep detection processing. When the processing module does not receive acceleration data reported by the sensing module, it is in an unwakeable state. In this case, the processing module may not execute the sleep detection process, and this unwakeable state can also be understood as the processing module being in a hibernation state (i.e., a non-working state).

[0333] In one example, when the user's state is in the first state, the electronic device controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module through the processing module, so that the processing module stops sleep detection. This includes: when the user's state is in the first state, the electronic device controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module through the processing module, so that the processing module stops sleep detection.

[0334] In the above implementation, when the user's state is in the first state, the sensing module stops reporting the acceleration data collected by the sensing module to the processing module, but the sensing module can still continue to collect acceleration data. It should be understood that the sensing module has the ability to cache acceleration data; therefore, the sensing module can cache the collected acceleration data.

[0335] In another example, when the user's state is a first state, the first acceleration data is the user's acceleration data collected by the sensing module at a first sampling frequency within a first preset time period. The processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, so that the processing module stops sleep detection. This includes: when the user's state is a first state, controlling the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module so that the processing module stops sleep detection; and controlling the sensing module to collect the user's acceleration data at a second sampling frequency lower than the first sampling frequency.

[0336] The values ​​of the first and second sampling frequencies are not specifically limited and can be set according to the actual situation. For example, the first sampling frequency can be 20 Hz and the second sampling frequency can be 10 Hz.

[0337] When the sensing module acquires acceleration data at the second acquisition frequency and stops reporting acceleration data to the processing module, it can be considered to be in a sleep state. It should be understood that a sensing module in a sleep state can still detect actions performed by a sleeping user (e.g., turning over).

[0338] For example, a specific example of the first state in the above example is as follows. Figure 5 In step S450, state #1, as described in the example above, involves the processing module controlling the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, thus stopping the processing module's sleep detection. A specific example of controlling the sensing module to collect acceleration data at the second acquisition frequency is that in step S450, both the ACC sensor and the MCU are placed in sleep mode. Details not elaborated here can be found in the preceding text. Figure 8The relevant descriptions of the steps in the provided data processing method.

[0339] In the above implementation, the processing module of the electronic device obtains the user's acceleration data (i.e., first acceleration data) collected by the sensor module at a higher sampling frequency (i.e., first sampling frequency) within a certain period of time (i.e., a first preset time period) reported by the sensor module. Then, the processing module performs sleep detection processing on this acceleration data (i.e., first acceleration data) to determine the user's state. Subsequently, if it is determined that the user's state does not require sleep detection (i.e., the first state), the processing module controls the sensor module to stop reporting the acceleration data collected by the sensor module to the processing module, thereby stopping the sleep detection. This reduces the detection power consumption of the processing module and the data transmission power consumption of the sensor module. Furthermore, by controlling the sensor module to collect the user's acceleration data at a lower sampling frequency (i.e., second sampling frequency), the sampling power consumption of the sensor module can be reduced. Therefore, the power consumption of the electronic device can be reduced, the battery life of the electronic device can be increased, and the user experience can be improved.

[0340] Optionally, the first and second sampling frequencies can be the same. For example, the first and second sampling frequencies can both be 10Hz or 20Hz.

[0341] In the above implementation, after the processing module of the electronic device obtains the user's acceleration data (i.e., first acceleration data) collected by the sensor module at a first sampling frequency within a certain period of time (i.e., a first preset time period) reported by the sensor module, the processing module performs sleep detection processing on the acceleration data (i.e., first acceleration data) to determine the user's state. Then, if it is determined that the user's state does not require sleep detection (i.e., the first state), the processing module controls the sensor module to stop reporting the acceleration data collected by the sensor module to the processing module, thereby stopping the sleep detection. This reduces the detection power consumption of the processing module and the data transmission power consumption of the sensor module, thus reducing the power consumption of the electronic device, increasing the battery life of the electronic device, and improving the user experience.

[0342] The specific implementation method for the processing module to control the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module in the above implementation method is not limited.

[0343] In one example, when the user's state is in the first state, the implementation method of controlling the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module through the processing module may include the following steps: when the user's state is in the first state, the processing module controls the sensing module to set the value of the first flag bit of the sensing module to a first value, which is used to instruct the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module.

[0344] Optionally, when the above-mentioned sensing module includes a cache module, the sensing module is further configured to cache the collected acceleration data into the cache module, the first flag bit is the flag bit of the cache module, and the sensing module is further configured to report the acceleration data cached in the cache module to the processing module when the value of the first flag bit is the second value.

[0345] When the value of the first flag is set to the first value, the first flag can be considered invalid. When the first flag is invalid, the sensing module will stop reporting the acceleration data collected by the sensing module to the processing module.

[0346] In another example, when the user's state is in the first state, the processing module controls the sensing module to stop reporting the acceleration data it has collected to the processing module. This includes: when the user's state is in the first state, the processing module controls the communication connection between the sensing module and the processing module to be disconnected, thereby controlling the sensing module to stop reporting the acceleration data it has collected to the processing module. Subsequently, if it is necessary to resume the sensing module reporting the acceleration data it has collected to the processing module, the processing module can control the communication connection between the sensing module and the processing module to be connected, thereby controlling the sensing module to report the acceleration data it has collected to the processing module.

[0347] In this embodiment of the application, the implementation method of the above step S930 by the electronic device is not specifically limited.

[0348] In one example, when the user's state is in the first state, the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module. This includes: when the user's state is in the first state, the processing module sends a first instruction to the sensing module; and the sensing module, according to the first instruction, controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module.

[0349] When the electronic device executes the above step S930, and controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, and controls the sensing module to collect the user's acceleration data at the second collection frequency, the first instruction can be used to instruct the sensing module to collect acceleration data at the second collection frequency, and to instruct the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module.

[0350] For example, a specific example of the above-mentioned sensing module may be the one described above. Figure 8 The ACC sensor in the provided data processing method, and a specific example of the aforementioned processing module, could be the one described above. Figure 8The MCU in the provided data processing method, and a specific example of the aforementioned first preset time period, can be the above. Figure 8 In the provided data processing method, step S804, the preset time period A, a specific example of the aforementioned first acceleration data can be the acceleration data acquired within the preset time period A in step S804, and a specific example of the aforementioned first state can be the aforementioned... Figure 8 The sleep state in step S804 of the provided data processing method, and a specific example of the aforementioned first instruction, could be the above-mentioned... Figure 8 The instruction A in step S805 of the provided data processing method, which is not detailed here, can be found in the above text. Figure 5 The relevant descriptions of the steps in the provided data processing method.

[0351] The above example illustrates the data processing flow where, after an electronic device executes steps S910 and S920 and determines the user's state as a first state, the electronic device continues to execute step S930 to control the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module when the user's state is in the first state. After the electronic device executes step S930, the user's state in the first state may change. Accordingly, this application also provides a data processing flow for situations where the user's state in the first state changes.

[0352] Optionally, the first state in step S930 above is a sleep state, and the second state other than the first state is an awakening state; and; when the user's state is the first state, after the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module (i.e., step S930), the electronic device may further perform the following steps: in response to the user's action detected by the sensing module, perform sleep pre-detection on the third acceleration data collected by the sensing module within a third preset time period to determine the user's suspected state, the third preset time period being the time period after the action is detected, and the user's suspected state being a suspected awakening state or a non-suspected awakening state; when the user's suspected state is a suspected awakening state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module so that the processing module performs sleep detection.

[0353] The third preset time period is the preset time period following the first preset time period. The length of the third preset time period is not specifically limited and can be set according to actual needs. For example, the length of the third preset time period can be, but is not limited to, 30 seconds.

[0354] The implementation method of an electronic device detecting a user's actions through a sensing module is not specifically limited. For example, detecting a user's actions through a sensing module includes: when the sensing module detects that a user in a sleep state has performed an action, an interrupt signal is generated by the sensing module, wherein the interrupt signal is used to indicate that the user in a sleep state has performed an action.

[0355] It should be understood that when the sensing module is collecting user acceleration data at a lower acquisition frequency (i.e., the second acquisition frequency), and the user in sleep mode performs an action, the sensing module can detect this action. Before detecting the user's action, if the sensing module is collecting acceleration data at a lower acquisition frequency (i.e., the second acquisition frequency), then after detecting the user's action, the sensing module can be controlled to continue collecting acceleration data at a higher acquisition frequency (i.e., the first acquisition frequency) for a period of time following the moment the user performed the action. For example, if the sensing module has a motion / static detection function, when the user in sleep mode performs an action, the motion / static detection function in the sensing module can detect this action.

[0356] It should be understood that if the electronic device performs sleep pre-detection on the acceleration data corresponding to the actions of a user in a sleep state collected by the sensor module and determines that the user's suspected state is not a suspected awakening state, that is, although the user in a sleep state has made an action (e.g., turning over or kicking his legs), the user is still in a sleep state, then the electronic device needs to continue to maintain the current state where the sensor module stops reporting the acceleration data collected by the sensor module to the processing module.

[0357] It should be understood that in the above implementation, when the user's suspected state is a suspected sleep state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module. During sleep detection, if the processing module performs sleep detection on the fifth acceleration within the fifth preset time period reported by the sensing module and determines that the user's state is the first state, the electronic device will again control the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, thus stopping the sleep detection. The fifth preset time period can be a preset time period following the third preset time period.

[0358] For example, a specific example of the aforementioned sensing module could be the one described above. Figure 5 The ACC sensor in the provided data processing method, and a specific example of the aforementioned processing module, can be found in the above text. Figure 5 In the provided data processing method, a specific example of the aforementioned interrupt signal in the MCU can be found in the above text. Figure 5The interrupt signal in step S507 of the provided data processing method, a specific example of the aforementioned third acceleration data, can be the acceleration data corresponding to the interrupt signal in step S507; a specific example of the aforementioned suspected sleep-out state can be the suspected sleep-out state in step S507; a specific example of enabling the processing module to perform sleep detection can be the MCU resuming the sleep detection algorithm in step S508. Details not elaborated here can be found above. Figure 8 The relevant descriptions of the steps in the provided data processing method.

[0359] In the aforementioned data processing flow for situations where the user's state changes while in the first state, if the electronic device determines that the user is in a sleep state (an example of the first state) and controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, and the electronic device detects that the user in the sleep state has made an action through the sensing module, then the electronic device will perform sleep pre-detection on the acceleration data (i.e., the third acceleration data) collected by the sensing module within a preset time period (i.e., the third preset time period) after the user's action. Subsequently, if it is determined that the user's suspected state is a suspected awakening state, the electronic device needs to resume the data reporting process of the sensing module reporting the acceleration data collected by the sensing module to the processing module, so that the processing module can perform more accurate sleep detection processing on the acceleration data reported by the sensing module to determine the user's sleep state. Furthermore, if the user's suspected state is determined to be a non-suspected awakening state (i.e., still asleep), the electronic device will still control the sensors to stop reporting the acceleration data collected by the sensor module to the processing module. This will cause the processing module to stop performing sleep detection processing. By setting the sensor module to perform a sleep pre-detection mechanism, the processing module is effectively prevented from being repeatedly woken up by the acceleration data reported by the sensor module while the user is asleep. This avoids the processing module continuously performing sleep detection while the user is asleep, which would cause power waste. This implementation process can effectively reduce the power consumption of electronic devices, increase the battery life of electronic devices, and improve the user experience.

[0360] It should be understood that the above example, using the electronic device determining the user's state as the first state after executing steps S910 and S920, illustrates how the electronic device continues to execute step S930 when the user's state is in the first state. Optionally, after executing steps S910 and S920, the electronic device will determine the user's state as the second state. Below, the relevant data processing steps performed by the electronic device after executing steps S910 and S920 and determining the user's state as the second state are described.

[0361] Optionally, after the electronic device performs the above step S920, the electronic device may also perform the following steps: when the user's state is the second state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module so that the processing module can perform sleep detection.

[0362] In one example, when the user is in the second state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module, including: when the user is in the second state, the processing module sends a second instruction to the sensing module; the sensing module, according to the second instruction, controls the sensing module to report the acceleration data collected by the sensing module to the processing module.

[0363] For example, a specific example of the above second instruction is the above. Figure 5 The instruction B in step S813 of the provided data processing method, which is not detailed here, can be found in the relevant description of step S813 above.

[0364] In this embodiment, before the electronic device determines that the user's state is the second state, the electronic device may also perform sleep pre-detection on the user based on the acquired user's acceleration data to determine that the user's state is suspected to be the second state. The process of the electronic device performing sleep pre-detection to determine that the user's state is suspected to be the second state is described below.

[0365] Optionally, before the electronic device performs the aforementioned sleep detection through the processing module, that is, before the electronic device performs sleep detection based on the first acceleration data through the processing module to determine the user's state, the electronic device may also perform a sleep pre-detection processing procedure, which includes: the electronic device acquiring the fourth acceleration data collected by the sensing module within a fourth preset time period; the electronic device performing sleep pre-detection based on the fourth acceleration data to determine that the user's state is a suspected second state.

[0366] The first preset time period is the time period after the fourth preset time period, or; a portion of the first preset time period is the time period of the third preset time period, and the remaining time period of the first preset time period is the time period after the fourth preset time period.

[0367] Optionally, if the electronic device determines that the user's state is not a suspected second state by performing sleep pre-detection processing based on the acceleration data collected by the sensing module within a certain time period, the electronic device will not continue to perform sleep detection processing thereafter.

[0368] In the above implementation, when the electronic device determines that the user is in a sleep state (i.e., an example of the first state) and controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, if the electronic device detects that the user in the sleep state has made a move through the sensing module, the electronic device will perform sleep pre-detection on the acceleration data (i.e., the third acceleration data) collected by the sensing module within a preset time period (i.e., the third preset time period) after the user's action. Then, if it is determined that the user's suspected state is a suspected awakening state, the electronic device needs to resume the data reporting process of the sensing module reporting the acceleration data collected by the sensing module to the processing module, so that the processing module can perform more accurate sleep detection processing on the acceleration data reported by the sensing module to determine the user's sleep state. Furthermore, if the user's suspected state is determined to be a non-suspected sleep state (i.e., the user is still asleep), the electronic device will still control the sensors to stop reporting the acceleration data collected by the sensor module to the processing module. This will cause the processing module to stop performing sleep detection processing. By setting the sensor module to perform a sleep pre-detection mechanism, the processing module is effectively prevented from being repeatedly woken up by the acceleration data reported by the sensor module while the user is asleep. This also avoids the processing module continuously performing sleep detection while the user is asleep, which would cause power waste. This implementation process can effectively reduce the power consumption of electronic devices, increase the battery life of electronic devices, and improve the user experience.

[0369] The implementation method described above, in which the electronic device performs sleep pre-detection based on the fourth acceleration data to determine that the user's state is suspected to be the second state, is not specifically limited.

[0370] In one example, the aforementioned electronic device performs sleep pre-detection based on fourth acceleration data to determine that the user's state is suspected to be a second state, including: the sensing module performs sleep pre-detection based on fourth acceleration data to determine that the user's state is suspected to be a second state.

[0371] In the above technical solution, after the sensing module collects the fourth acceleration data, it can perform sleep pre-detection on the fourth acceleration data to determine if the user's state is a suspected second state. Only when the user's state is a suspected second state will the processing module perform sleep detection processing on the first acceleration data collected by the sensing module. This effectively avoids the processing module being repeatedly woken up by the acceleration data reported by the sensing module to perform sleep detection processing on the acceleration data reported by the sensing module when the user's state is determined not to be a suspected second state, thus avoiding wasted power consumption in both the processing module and the sensing module's data transmission. This implementation process, by setting the sensing module to perform sleep pre-detection, can effectively reduce the power consumption of electronic devices, increase the battery life of electronic devices, and improve the user experience.

[0372] In another example, the processing module is also used to acquire the fourth acceleration data reported by the sensing module to the processing module, and; the above-mentioned electronic device performs sleep pre-detection based on the fourth acceleration data to determine that the user's state is suspected to be the second state, including: the processing module performs sleep pre-detection based on the fourth acceleration data to determine that the user's state is suspected to be the second state.

[0373] In the above technical solution, after the processing module of the electronic device obtains the acceleration data (i.e., first acceleration data) collected by the sensor module within a certain period of time (i.e., a first preset time period) reported by the sensor module, the processing module performs sleep detection processing on the acceleration data (i.e., first acceleration data) to determine the user's state. Then, if it is determined that the user's state requires sleep detection (i.e., the second state), the sensor module reports the acceleration data collected by the sensor module to the processing module, so that the processing module can perform sleep detection on the user's acceleration data reported by the sensor module, thus meeting the user's sleep detection needs and improving the user experience.

[0374] The implementation method described above, which controls the sensing module to report the acceleration data collected by the sensing module to the processing module, is not specifically limited.

[0375] In one example, when the user is in the second state, the processing module controls the sensing module to report the acceleration data it has collected to the processing module. This includes: when the user is in the second state, the processing module controls the communication connection between the sensing module and the processing module to be connected, thereby controlling the sensing module to report the acceleration data it has collected. Subsequently, if it is necessary to control the sensing module to stop reporting the acceleration data it has collected to the processing module, this can be achieved by controlling the communication connection between the sensing module and the processing module to be disconnected, thereby controlling the sensing module to stop reporting the acceleration data it has collected to the processing module.

[0376] In another example, when the user's state is in the second state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module. This includes: when the user's state is in the second state, the processing module controls the sensing module to set the value of the first flag bit of the sensing module to a second value. The second value is used to instruct the sensing module to report the acceleration data collected by the sensing module to the processing module.

[0377] Unlike the first value, the second value does not impose specific restrictions on the values ​​of the first and second values. For example, the first value can be "0" and the second value can be "1".

[0378] It should be understood that when the value of the first flag is set to the second value, the first flag can be considered valid. When the first flag is valid, the sensing module will continuously report the acceleration data collected by the sensing module to the processing module.

[0379] Optionally, when the above-mentioned sensing module includes a cache module, the sensing module is also used to cache the collected acceleration data into the cache module, the first flag bit is the flag bit of the cache module, and the sensing module is also used to report the acceleration data cached in the cache module to the processing module when the value of the first flag bit is the second value.

[0380] For example, a specific example of the above-mentioned caching module could be the one described above. Figure 5 In the provided data processing method, the FIFO buffer, a specific example of the first flag bit mentioned above could be the one described above. Figure 5 The full recognition flag of the FIFO buffer in the provided data processing method, which is not detailed here, can be found in the above text. Figure 9 The relevant descriptions of the steps in the provided data processing method.

[0381] In the above implementation, the electronic device sets the value of a certain flag bit (i.e., the first flag bit) of the sensing module to a preset value (i.e., the first value) to achieve the purpose of stopping the sensing module from reporting the acceleration data collected by the sensing module to the processing module. This implementation process is relatively simple and is conducive to improving data processing efficiency.

[0382] It should be understood that the above Figure 1 to Figure 9 The data processing methods shown are for illustrative purposes only and do not constitute any limitation on the data processing methods provided in this application.

[0383] In this embodiment, after the processing module of the electronic device obtains the acceleration data (i.e., the first acceleration data) collected by the sensor module within a certain period of time (i.e., the first preset time period) reported by the sensor module, the processing module performs sleep detection processing on the acceleration data (i.e., the first acceleration data) to determine the user's state. Subsequently, if it is determined that the user's state does not require sleep detection (i.e., the first state, for example, the first state is sleep), the electronic device can control the sensor module to stop reporting the acceleration data collected by the sensor module to the processing module, thereby stopping the processing module from performing sleep detection. This implementation avoids the processing module being frequently woken up for sleep detection due to frequent acceleration data reports from the sensor module, reducing the power consumption of the electronic device, increasing its battery life, and improving the user experience.

[0384] The above text combinedFigure 10 This document describes in detail the application scenarios and data processing methods of the data processing methods in the embodiments of this application. The following will combine... Figure 4 The apparatus embodiments of this application are described in detail below. It should be understood that the data processing apparatus in the embodiments of this application can perform the functions described above. Figure 5 , Figure 6 , Figure 7 , Figure 8 , Figure 9 or Figure 10 The various data processing methods, namely the specific working processes of the various products below, can be referred to the corresponding processes in the aforementioned method embodiments.

[0385] Figure 10 This is a schematic diagram of a data processing apparatus provided in an embodiment of this application. For example, ​ The data processing device 1000 shown includes a processing module 1010 and a sensing module 1020. The functions of the processing module 1010 and the sensing module 1020 will be described below.

[0386] The processing module 1010 is configured to: acquire first acceleration data reported by the sensing module 1020, wherein the first acceleration data is the acceleration data of the user collected by the sensing module 1020 within a first preset time period; perform sleep detection based on the first acceleration data to determine the user's state, wherein the user's state is a first state or a second state, wherein the first state includes a sleep state or a movement state, and the second state is a state other than the first state; and, if the user's state is the first state, control the sensing module 1020 to stop reporting the acceleration data collected by the sensing module 1020 to the processing module 1010, so that the processing module 1010 stops sleep detection.

[0387] In another possible implementation, before the processing module 1010 performs sleep detection based on the first acceleration data to determine the user's state, the sensing module 1020 is further configured to: acquire second acceleration data collected by the sensing module 1020 within a second preset time period; and perform sleep pre-detection based on the second acceleration data to determine that the user's state is a suspected first state.

[0388] In one possible implementation, the processing module 1010 is further configured to: perform the following steps before performing sleep detection based on the first acceleration data to determine the user's state: acquire second acceleration data collected by the sensing module 1020 within a second preset time period; perform sleep pre-detection based on the second acceleration data to determine that the user's state is a suspected first state.

[0389] In another possible implementation, the first acceleration data is the user's acceleration data collected by the sensing module at a first sampling frequency within a first preset time period. The processing module 1010 is further configured to: control the sensing module 1020 to stop reporting the acceleration data collected by the sensing module 1020 to the processing module 1010 when the user's state is the first state, and control the sensing module 1020 to collect the user's acceleration data at a second sampling frequency lower than the first sampling frequency.

[0390] In another possible implementation, the first state is the sleep state, the second state is the wake-up state, and the sensing module 1020 is further configured to: when the user's state is the first state, after controlling the sensing module 1020 to stop reporting the acceleration data collected by the sensing module 1020 to the processing module 1010, perform the following steps: in response to the user's action being detected by the sensing module 1020, perform sleep pre-detection on the third acceleration data collected by the sensing module 1020 within a third preset time period to determine the user's suspected state, the third preset time period being the time period after the action is detected, and the user's suspected state being a suspected wake-up state or a non-suspected wake-up state; the processing module 1010 is further configured to: when the user's suspected state is the suspected wake-up state, control the sensing module 1020 to report the acceleration data collected by the sensing module 1020 to the processing module 1010, so that the processing module 1010 performs sleep detection.

[0391] In another possible implementation, the processing module 1010 is further configured to: when the user's state is the first state, control the sensing module 1020 to set the value of the first flag bit of the sensing module 1020 to a first value, the first value being used to instruct the sensing module 1020 to stop reporting the acceleration data collected by the sensing module 1020 to the processing module.

[0392] In another possible implementation, the processing module 1010 is further configured to: when the user's state is the second state, control the sensing module 1020 to report the acceleration data collected by the sensing module 1020 to the processing module so that the processing module 1010 can perform sleep detection.

[0393] In another possible implementation, the processing module 1010 is further configured to: before performing sleep detection based on the first acceleration data to determine the user's state, perform the following steps: acquire the fourth acceleration data collected by the sensing module 1020 within a fourth preset time period; perform sleep pre-detection based on the fourth acceleration data to determine that the user's state is a suspected second state.

[0394] In another possible implementation, the sensing module 1020 is further configured to: before the processing module performs sleep detection based on the first acceleration data to determine the user's state, perform the following steps: acquire fourth acceleration data collected by the sensing module 1020 within a fourth preset time period; perform sleep pre-detection based on the fourth acceleration data to determine that the user's state is a suspected second state.

[0395] In another possible implementation, the processing module 1010 is further configured to: when the user's state is the second state, control the sensing module 1020 to set the value of the first flag bit of the sensing module 1020 to a second value, the second value being used to instruct the sensing module 1020 to report the acceleration data collected by the sensing module 1020 to the processing module 1010.

[0396] In another possible implementation, the sensing module 1020 includes a cache module, wherein the sensing module 1020 is further configured to cache the collected acceleration data in the cache module, the first flag bit is a flag bit of the cache module, and the sensing module 1020 is further configured to report the acceleration data cached in the cache module to the processing module 1010 when the value of the first flag bit is a second value.

[0397] In another possible implementation, the processing module 1010 is further configured to: send a first instruction to the sensing module 1020 when the user's state is the first state; the sensing module 1020 is further configured to: control the sensing module 1020 to stop reporting the acceleration data collected by the sensing module 1020 to the processing module 1010 according to the first instruction.

[0398] In another possible implementation, the processing module 1010 is further configured to: send a second instruction to the sensing module 1020 when the user's state is the second state; the sensing module 1020 is further configured to: control the sensing module 1020 to report the acceleration data collected by the sensing module 1020 to the processing module 1010 according to the second instruction.

[0399] In another possible implementation, the sensing module 1020 is a triaxial accelerometer, and the processing module 1010 is a microcontroller.

[0400] In another possible implementation, the second state is the state of waking up from sleep, or the state of performing an action exceeding a preset range while in a sleep state.

[0401] It should be noted that the aforementioned data processing device 1000 is embodied in the form of a functional unit. The term "unit" here can be implemented in software and / or hardware, and there is no specific limitation on this.

[0402] For example, a "unit" can be a software program, a hardware circuit, or a combination of both that implements the above functions. The hardware circuit may include an application-specific integrated circuit (ASIC), electronic circuitry, a processor (e.g., a shared processor, a proprietary processor, or a group processor) and memory for executing one or more software or firmware programs, integrated logic circuitry, and / or other suitable components that support the described functions.

[0403] Therefore, the units of the various examples described in the embodiments of this application can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0404] This application also provides a computer program product that, when executed by a processor, implements the data processing method described in any of the method embodiments of this application.

[0405] The computer program product can be stored in memory, for example, it is a program. The program is eventually converted into an executable object file that can be executed by the processor after processes such as preprocessing, compilation, assembly and linking.

[0406] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a computer, implements the data processing method described in any of the method embodiments of this application. The computer program may be a high-level language program or an executable object program.

[0407] This application also provides a chip for use in an electronic device. The chip includes one or more processors that invoke computer instructions to cause the electronic device to execute the data processing method described in any of the method embodiments of this application.

[0408] In this application, "at least one" means one or more, and "more than one" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.

[0409] It should be understood that in the various embodiments of this application, the order of the above-mentioned processes does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0410] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0411] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0412] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for example, the division of units is merely a logical functional division, and other division methods may exist in actual implementation; for example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0413] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0414] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0415] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data processing method, characterized by, Applied to an electronic device comprising a sensing module and a processing module, the method comprises: obtaining first acceleration data reported by the sensing module to the processing module, the first acceleration data being acceleration data of a user collected by the sensing module in a first preset time period; performing sleep detection by the processing module based on the first acceleration data to determine a state of the user, the state of the user being a first state or a second state, the first state comprising a sleep state or a motion state, and the second state being a state other than the first state; in a case where the state of the user is the first state, controlling, by the processing module, the sensing module to stop reporting acceleration data collected by the sensing module to the processing module, so that the processing module stops sleep detection.

2. The method of claim 1, wherein, Before the sleep detection by the processing module based on the first acceleration data to determine the state of the user, the method further comprises: obtaining second acceleration data collected by the sensing module in a second preset time period; performing sleep pre-detection according to the second acceleration data to determine that the state of the user is a suspected first state.

3. The method of claim 2, wherein, The sleep pre-detection according to the second acceleration data to determine that the state of the user is a suspected first state comprises: the sensing module performs sleep pre-detection according to the second acceleration data to determine that the state of the user is the suspected first state.

4. The method according to any one of claims 1 to 3, characterized in that, The first acceleration data is acceleration data of the user collected by the sensing module in the first preset time period at a first collection frequency, and in a case where the state of the user is the first state, the method further comprises: in a case where the state of the user is the first state, controlling, by the processing module, the sensing module to stop reporting acceleration data collected by the sensing module to the processing module, and controlling the sensing module to collect acceleration data of the user at a second collection frequency smaller than the first collection frequency.

5. The method according to any one of claims 1 to 4, characterized in that, The first state is a sleep state, and the second state is a wake-up state, and after the processing module controls the sensing module to stop reporting acceleration data collected by the sensing module to the processing module in a case where the state of the user is the first state, the method further comprises: in response to detecting, by the sensing module, a motion of the user, performing sleep pre-detection on third acceleration data collected by the sensing module in a third preset time period to determine a suspected state of the user, the third preset time period being a time period after the motion is detected, and the suspected state of the user being a suspected wake-up state or a non-suspected wake-up state; In a case where the suspected state of the user is the suspected sleep state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module, so that the processing module performs sleep detection.

6. The method according to any one of claims 1 to 5, characterized in that, In a case where the state of the user is the first state, the processing module controls the sensing module to stop reporting the acceleration data collected by the sensing module to the processing module, including: In a case where the state of the user is the first state, the processing module controls the sensing module to set the value of the first flag bit of the sensing module to a first value, the first value being used to indicate that the sensing module stops reporting the acceleration data collected by the sensing module to the processing module.

7. The method according to any one of claims 1 to 6, characterized in that, The method further includes: In a case where the state of the user is the second state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module, so that the processing module performs sleep detection.

8. The method of claim 7, wherein, Before the processing module performs sleep detection based on the first acceleration data to determine the state of the user, the method further includes: obtaining fourth acceleration data collected by the sensing module in a fourth preset time period; performing sleep pre-detection based on the fourth acceleration data to determine that the state of the user is a suspected second state.

9. The method of claim 8, wherein, The performing sleep pre-detection based on the fourth acceleration data to determine that the state of the user is a suspected second state includes: The sensing module performs sleep pre-detection based on the fourth acceleration data to determine that the state of the user is the suspected second state.

10. The method according to any one of claims 7 to 9, characterized in that, In a case where the state of the user is the second state, the processing module controls the sensing module to report the acceleration data collected by the sensing module to the processing module, including: In a case where the state of the user is the second state, the processing module controls the sensing module to set the value of the first flag bit of the sensing module to a second value, the second value being used to indicate that the sensing module reports the acceleration data collected by the sensing module to the processing module.

11. The method according to claim 6 or 10, characterized in that, The sensing module includes a cache module, wherein The sensing module is further configured to cache the collected acceleration data in the cache module, the first flag bit is a flag bit of the cache module, and the sensing module is further configured to report, to the processing module, acceleration data with a data amount of a preset data amount in the cache module in a case where the value of the first flag bit is the second value.

12. The method of any one of claims 1 to 11, wherein The obtaining the first acceleration data reported by the sensing module to the processing module includes: The processing module obtains the first acceleration data reported by the sensing module to the processing module; The performing sleep detection by the processing module based on the first acceleration data to determine the state of the user includes: The processing module performs sleep detection based on the first acceleration data to determine the state of the user; and The processing module performs sleep detection based on the first acceleration data to determine the state of the user. In a case where the state of the user is the first state, the processing module controls the sensing module to stop reporting acceleration data collected by the sensing module to the processing module, including: In a case where the state of the user is the first state, the processing module sends a first instruction to the sensing module; The sensing module controls the sensing module to stop reporting acceleration data collected by the sensing module to the processing module according to the first instruction.

13. The method according to any one of claims 1 to 12, characterized in that, The sensing module is a three-axis acceleration sensor, and the processing module is a microcontroller.

14. The method according to any one of claims 1 to 4, characterized in that, The second state is a state of falling asleep or a state of producing an action exceeding a preset amplitude while sleeping.

15. An electronic device, comprising: The electronic device comprises one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are configured to store a computer program, and when the one or more processors execute the computer program, the electronic device is caused to perform the method according to any one of claims 1 to 14.

16. A chip system applied to an electronic device, the chip system comprising one or more processors, characterized in that, The processor is configured to invoke a computer instruction to cause the electronic device to perform the method according to any one of claims 1 to 14.

17. A computer readable storage medium comprising a computer program, characterized in that, When the computer program runs on the electronic device, the electronic device is caused to perform the method according to any one of claims 1 to 14.