CN112099857B - Dormancy awakening method of electronic equipment and electronic equipment - Google Patents

Dormancy awakening method of electronic equipment and electronic equipment Download PDF

Info

Publication number
CN112099857B
CN112099857B CN202010864928.XA CN202010864928A CN112099857B CN 112099857 B CN112099857 B CN 112099857B CN 202010864928 A CN202010864928 A CN 202010864928A CN 112099857 B CN112099857 B CN 112099857B
Authority
CN
China
Prior art keywords
electronic equipment
electronic device
observer
state
sleep
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010864928.XA
Other languages
Chinese (zh)
Other versions
CN112099857A (en
Inventor
刘均
罗勇波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Launch Technology Co Ltd
Original Assignee
Shenzhen Launch Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Launch Technology Co Ltd filed Critical Shenzhen Launch Technology Co Ltd
Priority to CN202010864928.XA priority Critical patent/CN112099857B/en
Publication of CN112099857A publication Critical patent/CN112099857A/en
Application granted granted Critical
Publication of CN112099857B publication Critical patent/CN112099857B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/4401Bootstrapping
    • G06F9/4418Suspend and resume; Hibernate and awake
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Abstract

The application is applicable to the technical field of electronic equipment, and provides a dormancy awakening method of the electronic equipment and the electronic equipment, wherein the electronic equipment adopts a publish-subscribe mode, the publish-subscribe mode comprises an abstract observer and an abstract theme, the abstract observer is inherited by a specific observer, the specific observer corresponds to a specific observer object one by one, the specific observer object is registered under the abstract theme, and the dormancy awakening method of the electronic equipment comprises the following steps: if the sleep wakeup class determines that the state of the electronic equipment is changed, storing the changed state of the electronic equipment into all specific observer objects; the sleep and wake-up class is used for monitoring state change of the electronic equipment, inherits an abstract theme, and comprises a sleep state and a wake-up state; the specific observer executes the corresponding action according to the changed state of the electronic device stored in the specific observer object. By the method, the workload of expansion and maintenance of the electronic equipment can be reduced.

Description

Dormancy awakening method of electronic equipment and electronic equipment
Technical Field
The present application belongs to the technical field of electronic devices, and in particular, to a sleep wake-up method for an electronic device, and a computer-readable storage medium.
Background
In the software design of the electronic device, the business logic of the software modules related to the sleep-wake is integrated in the sleep-wake module. That is, when the electronic device needs to be hibernated or awakened, the hibernating and awakening module needs to notify the software module of the electronic device respectively, so that the software module executes the corresponding internal service logic during hibernation or awakening, thereby implementing the orderly operation of each function of the electronic device.
In the existing scheme, because the service logic of the functional modules related to sleep and wake-up is integrated in the sleep and wake-up module, (1) the sleep and wake-up module needs to know how many software modules are related to sleep and wake-up and how the software modules work, so that the software modules can be accurately notified to execute the corresponding service logic; (2) when a new software module needs to be added, the sleeping and awakening module also needs to add the service logic of the new software module; (3) when the sleep/wake module is changed, other software modules are also changed correspondingly.
Therefore, when the sleep wake-up function of the conventional electronic device is realized through the sleep wake-up module, the sleep wake-up module is a very large and bloated module, and the coupling between the sleep wake-up module and other software modules is high, so that the expansion and maintenance workload of the electronic device is large, and the stability is poor.
Disclosure of Invention
The embodiment of the application provides a sleep awakening method for electronic equipment, which can solve the problems that when the sleep awakening function of the conventional electronic equipment is realized, a sleep awakening module which is too bulky and has high coupling with other software modules needs to be generated, so that the electronic equipment has large expansion and maintenance workload and poor stability. The electronic equipment of the application includes, but is not limited to, electronic equipment capable of supporting multi-task software module operation, such as vehicle-mounted equipment, handheld terminals, and PC terminals.
In a first aspect, an embodiment of the present application provides a sleep wake-up method for an electronic device, where the electronic device adopts a publish-subscribe mode, the publish-subscribe mode includes an abstract observer and an abstract theme, the abstract observer is inherited by a concrete observer, the concrete observer corresponds to a concrete observer object one to one, and the concrete observer object is registered under the abstract theme, and the sleep wake-up method for the electronic device includes:
if the sleep wakeup class determines that the state of the electronic equipment is changed, storing the changed state of the electronic equipment into all specific observer objects; the sleep and wake-up class is used for monitoring state change of the electronic equipment, inherits the abstract theme, and the state of the electronic equipment comprises a sleep state and a wake-up state;
and the specific observer executes corresponding action according to the changed state of the electronic equipment stored in the specific observer object.
Compared with the prior art, the embodiment of the application has the advantages that: in the embodiment of the application, because the electronic device adopts a publish-subscribe mode, the concrete observer inherits the abstract observer, and the sleep wake-up class inherits the abstract theme, the concrete observer and the sleep wake-up class can inherit the relationship between the abstract theme and the abstract observer. In addition, since the abstract theme registers the specific observer object, the sleep/wake class only needs to store the state (whether the state is a sleep state or a wake state) of the electronic device in the specific observer object, and the specific observer corresponding to the specific observer object can perform corresponding actions according to the state of the electronic device. That is, there is no coupling between the sleep wakeup class and the specific observer (the specific observer is a software module), and it is not necessary to know how the specific observer works, nor how many specific observers are related to the sleep wakeup class.
Optionally, if the specific observer is an upgrade module, the specific observer executes a corresponding action according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the upgrading module checks whether the electronic equipment has an application needing upgrading, if so, the upgrading action is executed on the application needing upgrading and the electronic equipment is restarted after the upgrading action is executed, and if not, the upgrading action is not executed on the application needing upgrading;
and if the changed state of the electronic equipment is the awakening state, the upgrading module does not check whether the electronic equipment has the application needing upgrading.
Optionally, if the specific observer is an upgrade module, the specific observer executes a corresponding action according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the upgrading module checks whether the electronic equipment has an application needing upgrading, if so, the upgrading action is executed on the application needing upgrading and the electronic equipment is restarted after the upgrading action is executed, and if not, the upgrading action is not executed on the application needing upgrading;
if the changed state of the electronic device is an awakening state, the upgrading module checks whether an application needing to be upgraded exists in the electronic device, if the application needing to be upgraded exists, the upgrading module identifies whether the application needing to be upgraded is a designated application, if the application needing to be upgraded is the designated application, the upgrading action is executed on the application needing to be upgraded, the electronic device is not restarted after the upgrading action is executed, and if the application needing to be upgraded is not the designated application, the upgrading action is not executed on the application needing to be upgraded, wherein the designated application is an application unrelated to the configuration of the electronic device, or the application does not affect the function of the electronic device.
Optionally, if the specific observer is a management module, the specific observer executes a corresponding action according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the management module stops sending network data;
and if the changed state of the electronic equipment is an awakening state, the management module executes network connection action and sends network data to be sent.
Optionally, if the specific observer is a log module, the specific observer executes a corresponding action according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the log module stops writing the log file to a flash memory and only stores the log file to an internal memory;
and if the changed state of the electronic equipment is an awakening state, the log module writes a log file to a flash memory.
Optionally, if the electronic device includes a newly added software module, the method for waking up from sleep of the electronic device includes:
determining a software module object corresponding to the newly added software module, registering the software module object as a specific observer object to be added to the abstract theme, and setting the newly added software module to inherit the abstract observer so as to enable the newly added software module to execute an action corresponding to the changed state of the electronic device.
Optionally, the sleep-wake class determines whether to store the changed state of the electronic device into all specific observer objects by:
determining the current occupancy rate of a Central Processing Unit (CPU) of the electronic equipment and the number of concrete observer objects registered under the abstract theme;
determining a duration value according to the current occupancy rate of the CPU and the number of concrete observer objects registered under the abstract theme, wherein the duration value is used for representing the shortest duration required for storing the changed state of the electronic equipment into all the concrete observer objects; if the time length from the moment of storing the changed state of the electronic equipment to the first specific observer object to the current moment is greater than or equal to the determined time length value, the sleep awakening class is judged to store the changed state of the electronic equipment into all the specific observer objects, and otherwise, the sleep awakening class is judged not to store the changed state of the electronic equipment into all the specific observer objects.
Optionally, if the number of the specific observer objects is greater than or equal to a preset number threshold, setting the number of the sleep wake-up classes to be greater than 2, storing the changed state of the electronic device to the specific observer objects in parallel by each sleep wake-up class, and the specific observer objects corresponding to different sleep wake-up classes are different.
In a second aspect, an embodiment of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method according to any one of the first aspect when executing the computer program.
In a third aspect, the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the method according to any one of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer program product, which, when run on an electronic device, causes the electronic device to perform the method of any one of the above first aspects.
It is understood that the beneficial effects of the second to fourth aspects can be seen from the description of the first aspect, and are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the embodiments or the description of the prior art will be briefly described below.
Fig. 1 is a flowchart of a sleep wake-up method of an electronic device according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of an electronic device according to a second embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items and includes such combinations.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather mean "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The first embodiment is as follows:
in the existing electronic device, the software modules related to sleep and wake-up are integrated in the sleep and wake-up module in business logic, so that the sleep and wake-up module is very large and redundant. For example, if a new software module needs to be added, the service logic of the new software module needs to be added to the sleep/wake-up module, and if the sleep/wake-up module needs to be modified, corresponding modifications also need to be performed on other software modules. In order to solve the above technical problem, the electronic device according to the embodiment of the present application adopts a Publish/Subscribe (Publish/Subscribe) mode, which is also referred to as a watcher mode. In the publish-subscribe mode, the sleep wake class inherits the abstract theme that registers the concrete observer object, so that the sleep wake class only needs to store the state (whether the sleep state or the wake state) of the electronic device in the concrete observer object, and the concrete observer corresponding to the concrete observer object can execute the corresponding action according to the state of the electronic device. That is, there is no coupling between the sleep/wake-up class and the specific observer (the specific observer is a software module and may also be referred to as an interface required for implementing an abstract observer), and it does not need to know how the specific observer works, and does not need to know how many specific observers are related to the sleep/wake-up class.
In order to describe the sleep/wake method of the electronic device in detail, the following embodiments are described in detail, in which:
fig. 1 is a flowchart illustrating a sleep-wake method of an electronic device according to an embodiment of the present application, where the electronic device adopts a publish-subscribe mode, where the publish-subscribe mode includes an abstract viewer and an abstract topic, and the abstract viewer is inherited by a concrete viewer, so that the concrete viewer inherits a relationship between the abstract topic and the abstract viewer, and the concrete viewer is in one-to-one correspondence with a concrete viewer object, and the concrete viewer object is registered under the abstract topic (e.g., by storing a reference of the concrete viewer object in an aggregate, where the aggregate refers to a pointer set (array) of the concrete viewer object), and the sleep-wake method of the electronic device includes:
step S11, if the sleep/wake class determines that the state of the electronic device has changed, store the changed state of the electronic device in all the specific observer objects. The sleep and wake-up class is used for monitoring state change of the electronic equipment, inherits the abstract theme, and the state of the electronic equipment comprises a sleep state and a wake-up state.
Since the hibernate wake class inherits the abstract theme and the concrete observer inherits the abstract observer, the hibernate wake class and the concrete observer have a relationship between the abstract theme and the abstract observer.
In this embodiment, a sleep/wake class is set for monitoring a state change of the electronic device, for example, monitoring whether the state of the electronic device is switched from a sleep state to a wake state, and monitoring whether the state of the electronic device is switched from the wake state to the sleep state. When the state of the electronic device is switched from the sleep state to the wake state (or from the wake state to the sleep state), the state of the electronic device is determined to be changed. And if the state of the electronic equipment is switched from the dormant state to the awakening state, the awakening state is used as the changed state of the electronic equipment, and the changed state of the electronic equipment is stored in all the concrete observer objects registered to the abstract theme, so that concrete observers corresponding to the concrete observer objects one to one can know the changed state of the electronic equipment.
It should be noted that the number of concrete observer objects registered in the abstract theme is the same as the number of concrete observers, and if the number of concrete observers is 3, the number of concrete observer objects registered in the abstract theme is also 3.
Step S12, the specific observer executes a corresponding action according to the changed state of the electronic device stored in the specific observer object.
In this embodiment, different specific watchers perform different actions in the same state of the electronic device, that is, the performed actions are related to the business logic of the specific watchers.
In the embodiment of the application, because the electronic device adopts a publish-subscribe mode, the concrete observer inherits the abstract observer, and the sleep wake-up class inherits the abstract theme, the concrete observer and the sleep wake-up class can inherit the relationship between the abstract theme and the abstract observer. In addition, since the abstract theme registers the specific observer object, the sleep/wake class only needs to store the state (whether the state is a sleep state or a wake state) of the electronic device in the specific observer object, and the specific observer corresponding to the specific observer object can perform corresponding actions according to the state of the electronic device. That is, there is no coupling between the sleep wakeup class and the specific observer (the specific observer is a software module), and it is not necessary to know how the specific observer works, nor how many specific observers are related to the sleep wakeup class.
In some embodiments, after the application of the electronic device is upgraded, the electronic device is restarted, so that integrity and various states of an operating environment of the whole electronic device can be guaranteed to be uniform when a relevant configuration of a system of the electronic device is changed, and an error of the electronic device is avoided. Specifically, if the specific observer is an upgrade module, the step S12 includes:
a1, if the changed state of the electronic device is a dormant state, the upgrade module checks whether the electronic device has an application that needs to be upgraded, if so, the upgrade module executes an upgrade action on the application that needs to be upgraded and restarts the electronic device after executing the upgrade action, and if not, the upgrade module does not execute the upgrade action on the application that needs to be upgraded.
A2, if the changed state of the electronic device is an awake state, the upgrade module does not check whether the electronic device has an application that needs to be upgraded.
In the above-mentioned a1 and a2, when the state of the changed electronic device is in the sleep state, if there is an application that needs to be upgraded, the application is upgraded, otherwise, the upgrade operation of the application is not performed, and when the state of the changed electronic device is in the wake state, it is not detected whether there is an application that needs to be upgraded. Through the operation, the situation that the electronic equipment is in the awakening state and the use of the electronic equipment is influenced by the restarting of the electronic equipment after the application is upgraded is avoided.
In some embodiments, it is considered that when an application which changes the configuration of the electronic device itself is upgraded, an error of the electronic device may be caused, and therefore, an application which does not change the configuration of the electronic device itself (or does not affect the function) may be set to perform an upgrade action when the application is in a wake-up state, so as to improve the timeliness of the upgrade. At this time, if the specific observer is the upgrade module, step S12 includes:
a 1', if the changed state of the electronic device is a dormant state, the upgrade module checks whether the electronic device has an application that needs to be upgraded, if so, executes an upgrade action on the application that needs to be upgraded and restarts the electronic device after executing the upgrade action, and if not, does not execute the upgrade action on the application that needs to be upgraded.
A2', if the changed state of the electronic device is an awake state, the upgrade module checks whether the electronic device has an application that needs to be upgraded, if so, identifies whether the application that needs to be upgraded is a designated application, if so, executes an upgrade action on the application that needs to be upgraded and does not restart the electronic device after executing the upgrade action, and if not, does not execute the upgrade action on the application that needs to be upgraded.
The designated application is an application that is not related to the configuration of the electronic device itself, or an application that does not affect the function of the electronic device.
In this embodiment, if the electronic device is in a dormant state, an upgrade action is performed on the application to be upgraded, and the electronic device is restarted after the upgrade of the application is completed, so that the application can be upgraded in time, and the integrity of the operating environment of the whole electronic device can be ensured; if the electronic device is in the wake-up state, only the designated application (the application unrelated to the configuration of the electronic device or the application not affecting the function of the electronic device) can execute the upgrade action, so that the designated application can be upgraded timely, and the integrity of the operating environment of the whole electronic device cannot be affected without restarting the electronic device after the designated application is upgraded, so that the use of the electronic device cannot be affected.
In some embodiments, if the specific watcher is a management module, the step S12 includes:
b1, if the changed state of the electronic device is a dormant state, the management module stops sending network data.
B2, if the changed state of the electronic device is an awake state, the management module executes a network connection action and sends network data to be sent.
The network data to be sent comprises: the management module stops sending the network data which is left unsent after the network data is sent, and the newly generated network data which needs to be sent when the electronic equipment is in the awakening state.
In the above-mentioned B1 and B2, when the electronic device is in the sleep state, if the network data is still transmitted, the network data may be lost, so that the network data to be transmitted is transmitted only when the electronic device is in the wake state, and the success rate of transmitting the network data can be improved.
In some embodiments, if the specific watcher is a log module, step S12 includes:
c1, if the changed state of the electronic device is a dormant state, the log module stops writing the log file to a flash memory (flash), and only stores the log file to a memory.
And C2, if the changed state of the electronic equipment is an awakened state, the log module writes a log file to a flash memory.
The memory is mainly used for temporarily storing a Central Processing Unit (CPU), and when the electronic device is powered off, data stored in the memory is lost, while data stored in the flash memory is not lost when the electronic device is powered off. Because the log file in the dormant state is usually not very important, the log file is only saved to the memory in the dormant state, and the occupation of the flash memory can be reduced. And when the log file is in the wake-up state, the log file is saved to a flash memory, so that important information can be stored.
In some embodiments, if the electronic device includes a newly added software module, the method for waking up from sleep of the electronic device includes:
determining a software module object corresponding to the newly added software module, registering the software module object as a specific observer object to be added to the abstract theme, and setting the newly added software module to inherit the abstract observer so as to enable the newly added software module to execute an action corresponding to the changed state of the electronic device.
In this embodiment, if a software module notified by an abstract theme needs to be added, a software module object corresponding to the newly added software module is registered in the abstract theme, and specifically, the abstract theme provides an interface for adding a specific observer object.
In some embodiments, the interface provided by the abstract theme is also used to delete registered concrete observer objects. Specifically, a concrete observer object to be deleted is searched in the abstract theme, the corresponding concrete observer object is deleted according to the search result, and in addition, the concrete observer object to be deleted is set not to inherit the abstract observer any more.
In some embodiments, when the number of the specific observer objects is large, it is difficult for the sleep-wakeup class to quickly store the changed state of the electronic device into the specific observer object, and considering that the current occupancy rate of the CPU of the electronic device also affects the stored action, therefore, in order to ensure that the changed state of the electronic device is stored into all the registered specific observer objects, the sleep-wakeup class determines whether the changed state of the electronic device has been stored into all the specific observer objects by:
determining a current occupancy rate of a CPU of the electronic device and a number of concrete observer objects registered under the abstract theme; determining a duration value according to the current occupancy rate of the CPU and the number of concrete observer objects registered under the abstract theme, wherein the duration value is used for representing the shortest duration required for storing the changed state of the electronic equipment into all the concrete observer objects; if the time length from the moment of storing the changed state of the electronic equipment to the first specific observer object to the current moment is greater than or equal to the determined time length value, the sleep awakening class is judged to store the changed state of the electronic equipment into all the specific observer objects, and otherwise, the sleep awakening class is judged not to store the changed state of the electronic equipment into all the specific observer objects.
Specifically, the corresponding relation between the current occupancy rate of the CPU, the number of the specific observer objects registered under the abstract theme and the duration value is preset; or, presetting a corresponding relation between a total weight and a duration value, wherein the total weight is calculated by the current occupancy rate of the CPU, a preset weight value of the CPU, and the number of the specific observer objects registered under the abstract theme and the preset weight value. Thus, after the current occupancy rate of the CPU of the electronic equipment and the number of the specific observer objects registered under the abstract theme are determined, the corresponding time length value can be quickly determined, if the time length from the time when the changed state of the electronic equipment is stored to the time when the first specific observer object is stored to the current time is greater than or equal to the determined time length value, the sleep awakening class is judged to store the changed state of the electronic equipment into all the specific observer objects, and otherwise, the sleep awakening class is judged not to store the changed state of the electronic equipment into all the specific observer objects.
In some embodiments, in order to increase the logging speed of the changed state of the electronic device, considering that when the number of specific observer objects is large, the time required for logging the changed state of the electronic device into all the specific observer objects by a single sleep/wake class is long: if the number of the specific observer objects is larger than or equal to a preset number threshold, setting the number of the dormancy wakeup classes to be larger than 2, storing the changed state of the electronic equipment to the specific observer objects in parallel by each dormancy wakeup class, wherein the specific observer objects corresponding to different dormancy wakeup classes are different.
In this embodiment, at least 2 sleep wake-up classes are set, each sleep wake-up class can be stored in parallel from the changed state of the electronic device to the corresponding specific observer object, and the specific observer objects corresponding to different sleep wake-up classes are different, i.e., the specific observer objects are divided into multiple groups, and each group is stored in the changed state of the electronic device by the corresponding sleep wake-up class at the same time, so that the storage speed of the changed state of the electronic device is increased.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Example two:
fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 2, the electronic apparatus 2 of the embodiment includes: at least one processor 20 (only one processor is shown in fig. 2), a memory 21, and a computer program 22 stored in the memory 21 and executable on the at least one processor 20, the processor 20 implementing the steps in any of the various method embodiments described above when executing the computer program 22:
the electronic device adopts a publish-subscribe mode, the publish-subscribe mode includes abstract observers and abstract themes, the abstract observers are inherited by concrete observers, the concrete observers correspond to concrete observer objects one to one, the concrete observer objects are registered under the abstract themes, and the sleep-wake method of the electronic device includes:
if the sleep wakeup class determines that the state of the electronic equipment is changed, storing the changed state of the electronic equipment into all specific observer objects; the sleep and wake-up class is used for monitoring state change of the electronic equipment, inherits the abstract theme, and the state of the electronic equipment comprises a sleep state and a wake-up state;
and the specific observer executes corresponding action according to the changed state of the electronic equipment stored in the specific observer object.
Optionally, if the specific observer is an upgrade module, the specific observer executes a corresponding action according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the upgrading module checks whether the electronic equipment has an application needing upgrading, if so, the upgrading action is executed on the application needing upgrading and the electronic equipment is restarted after the upgrading action is executed, and if not, the upgrading action is not executed on the application needing upgrading;
and if the changed state of the electronic equipment is the awakening state, the upgrading module does not check whether the electronic equipment has the application needing upgrading.
Optionally, if the specific observer is an upgrade module, the specific observer executes a corresponding action according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the upgrading module checks whether the electronic equipment has an application needing upgrading, if so, the upgrading action is executed on the application needing upgrading and the electronic equipment is restarted after the upgrading action is executed, and if not, the upgrading action is not executed on the application needing upgrading;
if the changed state of the electronic device is an awakening state, the upgrading module checks whether an application needing to be upgraded exists in the electronic device, if the application needing to be upgraded exists, the upgrading module identifies whether the application needing to be upgraded is a designated application, if the application needing to be upgraded is the designated application, the upgrading action is executed on the application needing to be upgraded, the electronic device is not restarted after the upgrading action is executed, and if the application needing to be upgraded is not the designated application, the upgrading action is not executed on the application needing to be upgraded, wherein the designated application is an application unrelated to the configuration of the electronic device, or the application does not affect the function of the electronic device.
Optionally, if the specific observer is a management module, the specific observer executes a corresponding action according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the management module stops sending network data;
and if the changed state of the electronic equipment is an awakening state, the management module executes network connection action and sends network data to be sent.
Optionally, if the specific observer is a log module, the specific observer executes a corresponding action according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the log module stops writing the log file to a flash memory and only stores the log file to an internal memory;
and if the changed state of the electronic equipment is an awakening state, the log module writes a log file to a flash memory.
Optionally, if the electronic device includes a newly added software module, the method for waking up from sleep of the electronic device includes:
determining a software module object corresponding to the newly added software module, registering the software module object as a specific observer object to be added to the abstract theme, and setting the newly added software module to inherit the abstract observer so as to enable the newly added software module to execute an action corresponding to the changed state of the electronic device.
Optionally, the sleep-wake class determines whether to store the changed state of the electronic device into all specific observer objects by:
determining the current occupancy rate of a Central Processing Unit (CPU) of the electronic equipment and the number of concrete observer objects registered under the abstract theme;
determining a duration value according to the current occupancy rate of the CPU and the number of concrete observer objects registered under the abstract theme, wherein the duration value is used for representing the shortest duration required for storing the changed state of the electronic equipment into all the concrete observer objects; if the time length from the moment of storing the changed state of the electronic equipment to the first specific observer object to the current moment is greater than or equal to the determined time length value, the sleep awakening class is judged to store the changed state of the electronic equipment into all the specific observer objects, and otherwise, the sleep awakening class is judged not to store the changed state of the electronic equipment into all the specific observer objects.
Optionally, if the number of the specific observer objects is greater than or equal to a preset number threshold, setting the number of the sleep wake-up classes to be greater than 2, storing the changed state of the electronic device to the specific observer objects in parallel by each sleep wake-up class, and the specific observer objects corresponding to different sleep wake-up classes are different.
The electronic device 2 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The electronic device may include, but is not limited to, a processor 20, a memory 21. Those skilled in the art will appreciate that fig. 2 is merely an example of the electronic device 2, and does not constitute a limitation of the electronic device 2, and may include more or less components than those shown, or combine some of the components, or different components, such as an input-output device, a network access device, etc.
The Processor 20 may be a Central Processing Unit (CPU), and the Processor 20 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 21 may in some embodiments be an internal storage unit of the electronic device 2, such as a hard disk or a memory of the electronic device 2. The memory 21 may also be an external storage device of the electronic device 2 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the electronic device 2. Further, the memory 21 may also include both an internal storage unit and an external storage device of the electronic device 2. The memory 21 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer programs. The memory 21 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
An embodiment of the present application further provides a network device, where the network device includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, the processor implementing the steps of any of the various method embodiments described above when executing the computer program.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the above-mentioned method embodiments.
The embodiments of the present application provide a computer program product, which when running on a mobile terminal, enables the mobile terminal to implement the steps in the above method embodiments when executed.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include at least: any entity or device capable of carrying computer program code to a photographing apparatus/electronic device, recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, and software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other ways. For example, the above-described apparatus/network device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (10)

1. A sleep wake-up method of an electronic device, wherein the electronic device adopts a publish-subscribe mode, the publish-subscribe mode includes an abstract observer and an abstract theme, the abstract observer is inherited by a concrete observer, the concrete observer corresponds to a concrete observer object one to one, and the concrete observer object is registered under the abstract theme, the sleep wake-up method of the electronic device includes:
if the sleep wakeup class determines that the state of the electronic equipment is changed, storing the changed state of the electronic equipment into all specific observer objects; the sleep and wake-up class is used for monitoring state change of the electronic equipment, inherits the abstract theme, and the state of the electronic equipment comprises a sleep state and a wake-up state;
and the specific observer executes corresponding action according to the changed state of the electronic equipment stored in the specific observer object.
2. The sleep/wake up method for electronic devices according to claim 1, wherein if the specific observer is an upgrade module, the specific observer performs corresponding actions according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the upgrading module checks whether the electronic equipment has an application needing upgrading, if so, the upgrading action is executed on the application needing upgrading and the electronic equipment is restarted after the upgrading action is executed, and if not, the upgrading action is not executed;
and if the changed state of the electronic equipment is the awakening state, the upgrading module does not check whether the electronic equipment has the application needing upgrading.
3. The sleep/wake up method for electronic devices according to claim 1, wherein if the specific observer is an upgrade module, the specific observer performs corresponding actions according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the upgrading module checks whether the electronic equipment has an application needing upgrading, if so, the upgrading action is executed on the application needing upgrading and the electronic equipment is restarted after the upgrading action is executed, and if not, the upgrading action is not executed;
if the changed state of the electronic device is an awakening state, the upgrading module checks whether an application needing to be upgraded exists in the electronic device, if the application needing to be upgraded exists, the upgrading module identifies whether the application needing to be upgraded is a designated application, if the application needing to be upgraded is the designated application, the upgrading action is executed on the application needing to be upgraded, the electronic device is not restarted after the upgrading action is executed, and if the application needing to be upgraded is not the designated application, the upgrading action is not executed on the application needing to be upgraded, wherein the designated application is an application unrelated to the configuration of the electronic device, or the application does not affect the function of the electronic device.
4. The sleep/wake up method for electronic devices according to claim 1, wherein if the specific observer is a management module, the specific observer executes corresponding actions according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the management module stops sending network data;
and if the changed state of the electronic equipment is an awakening state, the management module executes network connection action and sends network data to be sent.
5. The sleep/wake up method for electronic devices according to claim 1, wherein if the specific observer is a log module, the specific observer executes corresponding actions according to the changed state of the electronic device stored in the specific observer object, including:
if the changed state of the electronic equipment is a dormant state, the log module stops writing the log file to a flash memory and only stores the log file to an internal memory;
and if the changed state of the electronic equipment is an awakening state, the log module writes a log file to a flash memory.
6. The sleep-wake method for an electronic device according to any of claims 1 to 5, wherein if the electronic device includes a newly added software module, the sleep-wake method for the electronic device comprises:
determining a software module object corresponding to the newly added software module, registering the software module object as a specific observer object to be added to the abstract theme, and setting the newly added software module to inherit the abstract observer so as to enable the newly added software module to execute an action corresponding to the changed state of the electronic device.
7. The sleep-wake method for an electronic device according to any of the claims 1 to 5, wherein the sleep-wake class determines whether the changed state of the electronic device has been stored in all specific observer objects by:
determining the current occupancy rate of a Central Processing Unit (CPU) of the electronic equipment and the number of concrete observer objects registered under the abstract theme;
determining a duration value according to the current occupancy rate of the CPU and the number of concrete observer objects registered under the abstract theme, wherein the duration value is used for representing the shortest duration required for storing the changed state of the electronic equipment into all the concrete observer objects; if the time length from the moment of storing the changed state of the electronic equipment to the first specific observer object to the current moment is greater than or equal to the determined time length value, the sleep awakening class is judged to store the changed state of the electronic equipment into all the specific observer objects, and otherwise, the sleep awakening class is judged not to store the changed state of the electronic equipment into all the specific observer objects.
8. The method according to any one of claims 1 to 5, wherein if the number of the specific observer objects is greater than or equal to a preset number threshold, the number of the sleep/wake-up classes is set to be greater than 2, each sleep/wake-up class stores the changed state of the electronic device to the specific observer object in parallel, and the specific observer objects corresponding to different sleep/wake-up classes are different.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 8 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 8.
CN202010864928.XA 2020-08-25 2020-08-25 Dormancy awakening method of electronic equipment and electronic equipment Active CN112099857B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010864928.XA CN112099857B (en) 2020-08-25 2020-08-25 Dormancy awakening method of electronic equipment and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010864928.XA CN112099857B (en) 2020-08-25 2020-08-25 Dormancy awakening method of electronic equipment and electronic equipment

Publications (2)

Publication Number Publication Date
CN112099857A CN112099857A (en) 2020-12-18
CN112099857B true CN112099857B (en) 2022-05-17

Family

ID=73754332

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010864928.XA Active CN112099857B (en) 2020-08-25 2020-08-25 Dormancy awakening method of electronic equipment and electronic equipment

Country Status (1)

Country Link
CN (1) CN112099857B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103428274A (en) * 2013-07-26 2013-12-04 浪潮电子信息产业股份有限公司 Method for sending short messages in observer mode through short message modem
CN109995788A (en) * 2019-04-10 2019-07-09 华夏天信(北京)智能低碳技术研究院有限公司 A kind of equipment publication based on RED-MOS industry Internet of Things operating system and subscription design method

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002063832A1 (en) * 2001-02-05 2002-08-15 Personity, Inc. A system and method for filtering unavailable devices in a presence and availability management system
CN101022429A (en) * 2007-03-19 2007-08-22 中兴通讯股份有限公司 Method for realizing presenting contact person personal information in dynamic number book
US8578144B2 (en) * 2010-08-04 2013-11-05 International Business Machines Corporation Partial hibernation restore for boot time reduction
US8868943B2 (en) * 2010-11-29 2014-10-21 Microsoft Corporation Stateless remote power management of computers
US9351254B2 (en) * 2014-01-22 2016-05-24 Seven Networks, Llc Method for power saving in mobile devices by optimizing wakelocks
US9716762B2 (en) * 2014-03-31 2017-07-25 Ford Global Technologies Llc Remote vehicle connection status
CN104778089B (en) * 2015-04-23 2017-12-26 河北远东通信系统工程有限公司 It is a kind of based on the multiple spot of linux kernel to multipoint data issue and method for subscribing
WO2019125425A1 (en) * 2017-12-20 2019-06-27 Nokia Technologies Oy Power saving for wireless device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103428274A (en) * 2013-07-26 2013-12-04 浪潮电子信息产业股份有限公司 Method for sending short messages in observer mode through short message modem
CN109995788A (en) * 2019-04-10 2019-07-09 华夏天信(北京)智能低碳技术研究院有限公司 A kind of equipment publication based on RED-MOS industry Internet of Things operating system and subscription design method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于观察者的动态演化一致性研究;杨秋翔 等;《计算机应用研究》;20180930;第35卷(第9期);第2811-2814页 *
观察者模式在面向抽象编程中的应用;刘凌云;《计算机与数字工程》;20160820;第44卷(第08期);第1474-1477、1522页 *

Also Published As

Publication number Publication date
CN112099857A (en) 2020-12-18

Similar Documents

Publication Publication Date Title
US11200101B2 (en) Managing applications for power conservation
CN102789305B (en) Postponing suspend
EP2756385B1 (en) Managing processes within suspend states and execution states
US8863109B2 (en) Updating secure pre-boot firmware in a computing system in real-time
US9952897B2 (en) Managing processes within suspend states and execution states
EP2756386B1 (en) Managing processes within suspend states and execution states
US8806246B1 (en) Enforcing and complying with a computing device power policy
CN111694677A (en) Message queue management method, device, terminal and computer-readable storage medium
CN112346834A (en) Database request processing method and device, electronic equipment and medium
US11907153B2 (en) System and method for distributed subscription management
CN111459629A (en) Azkaban-based project operation method and device and terminal equipment
CN112099857B (en) Dormancy awakening method of electronic equipment and electronic equipment
CN108132803B (en) Timing keep-alive and awakening method, system, terminal and medium based on mobile terminal
US10571992B2 (en) Electronic device having a controller to enter a low power mode
CN115756322A (en) Data storage method and device, electronic equipment and storage medium
CN109799715B (en) Data receiving method, device and terminal equipment
CN110147379B (en) Information acquisition method and device based on data lock and computer equipment
CN111813596A (en) Chip restarting method and device and computing equipment
CN114884724B (en) Cloud server interaction method and device, readable storage medium and terminal equipment
CN117971844A (en) Method, apparatus, device and storage medium for data processing
CN107958041B (en) Data storage method, device, server and readable storage medium
CN116627917A (en) Read control method, device, equipment and storage medium
CN115373874A (en) Cross-process event processing method and device, electronic equipment, storage medium and vehicle
CN115129536A (en) Dynamic monitoring
CN116302126A (en) Equipment operation method, device, equipment and storage medium

Legal Events

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