Background
At present, a sleep sensor sends acquired sleep data of a user to a gateway, the gateway uploads the sleep data to a server in real time, the server sends out a corresponding control signal according to the sleep data, and the gateway and the server are always in an online connection state, so that the power consumption of the gateway is high, and the loss of electric quantity is increased.
Content of application
Aiming at the defects of the prior art, the application provides a method and a device for uploading sleep data, and aims to solve the problems that the power consumption of a gateway is high and the loss of electric quantity is increased because the gateway and a server are always in an online connection state.
The technical scheme provided by the application is as follows:
a method of sleep data upload, the method comprising:
receiving an upload mode command;
judging whether the uploading mode command is in a real-time uploading mode or not;
if so, switching the current uploading mode into a real-time uploading mode, acquiring sleep data from a sleep sensor according to a first frequency preset in the real-time uploading mode, and uploading the sleep data to a server in real time;
if not, the current uploading mode is switched to a non-real-time uploading mode, the sleep data are acquired from the sleep sensor according to a second frequency preset by the non-real-time uploading mode, and the sleep data are uploaded to the server in a non-real-time mode.
Further, in the step of receiving an upload mode command, the method includes:
receiving voice information of a user;
and recognizing the voice information to obtain an uploading mode command.
Further, in the step of recognizing the voice information and obtaining an upload mode command, the method includes:
extracting voiceprint features in the voice information;
judging whether the user is a legal user or not according to the voiceprint characteristics;
and if so, identifying the voice information to obtain an uploading mode command.
Further, after the step of switching the current uploading mode to the real-time uploading mode, acquiring sleep data from a sleep sensor according to a first frequency preset in the real-time uploading mode, and uploading the sleep data to the server in real time, or after the step of switching the current uploading mode to the non-real-time uploading mode, acquiring sleep data from the sleep sensor according to a second frequency preset in the non-real-time uploading mode, and uploading the sleep data to the server in non-real time, the method includes:
receiving an automatic switching mode command;
and responding to the automatic mode switching command, and automatically switching the current uploading mode into a real-time uploading mode or a non-real-time uploading mode according to a triggering event.
Further, in the step of automatically switching the current upload mode to the real-time upload mode or the non-real-time upload mode according to the trigger event, the method includes:
when the time reaches a preset first time, starting detection;
detecting whether a person is at the bedside;
if so, switching the current uploading mode into a non-real-time uploading mode, acquiring sleep data from a sleep sensor according to a third frequency preset by the non-real-time uploading mode, and uploading the sleep data to a server in a non-real-time manner;
detecting whether a person is in a bed;
if so, adjusting the third frequency to a fourth frequency, wherein the fourth frequency is lower than the third frequency;
detecting whether a person in bed falls asleep;
if so, adjusting the fourth frequency to a fifth frequency, wherein the fifth frequency is lower than the fourth frequency;
when the time reaches a preset second time, switching the current uploading mode into a real-time uploading mode, acquiring sleep data from a sleep sensor according to a sixth frequency preset by the real-time uploading mode, and uploading the sleep data to a server in real time;
detecting whether a person in the bed gets up;
if so, adjusting the sixth frequency to a seventh frequency, wherein the seventh frequency is higher than the sixth frequency.
The present application further provides a device for uploading sleep data, the device includes:
the first receiving module is used for receiving an uploading mode command;
the judging module is used for judging whether the uploading mode command is in a real-time uploading mode;
the first processing module is used for switching the current uploading mode into a real-time uploading mode, acquiring sleep data from a sleep sensor according to a first frequency preset by the real-time uploading mode and uploading the sleep data to a server in real time if the current uploading mode is the real-time uploading mode;
and the second processing module is used for switching the current uploading mode into a non-real-time uploading mode if the current uploading mode is not the real-time uploading mode, acquiring sleep data from the sleep sensor according to a second frequency preset in the non-real-time uploading mode, and uploading the sleep data to the server in a non-real-time manner.
Further, the first receiving module comprises:
the sub-receiving module is used for receiving the voice information of the user;
and the recognition module is used for recognizing the voice information to obtain an uploading mode command.
Further, the identification module includes:
the sub-extraction module is used for extracting the voiceprint features in the voice information;
the sub-judgment module is used for judging whether the user is a legal user or not according to the voiceprint characteristics;
and the sub-recognition module is used for recognizing the voice information if the voice information is in the uploading mode, so as to obtain an uploading mode command.
Further, the apparatus comprises:
the second receiving module is used for receiving an automatic switching mode command;
and the third processing module is used for responding to the automatic mode switching command and automatically switching the current uploading mode into a real-time uploading mode or a non-real-time uploading mode according to a triggering event.
Further, the third processing module comprises:
the starting module is used for starting detection when the time reaches a preset first time;
the first detection module is used for detecting whether a person is beside a bed;
the first sub-processing module is used for switching the current uploading mode into a non-real-time uploading mode if the current uploading mode is the non-real-time uploading mode, acquiring sleep data from a sleep sensor according to a third frequency preset in the non-real-time uploading mode, and uploading the sleep data to a server in a non-real-time manner;
the second detection module is used for detecting whether a person is in the bed;
a first adjusting module, configured to adjust the third frequency to a fourth frequency if the third frequency is higher than the fourth frequency;
the third detection module is used for detecting whether the person in the bed falls asleep or not;
a second adjusting module, configured to adjust the fourth frequency to a fifth frequency if the fourth frequency is higher than the fourth frequency;
the second sub-processing module is used for switching the current uploading mode into a real-time uploading mode when the time reaches a preset second time, acquiring sleep data from the sleep sensor according to a sixth frequency preset by the real-time uploading mode, and uploading the sleep data to the server in real time;
the fourth detection module is used for detecting whether a person in the bed gets up;
and a third adjusting module, configured to adjust the sixth frequency to a seventh frequency if the sixth frequency is higher than the sixth frequency.
According to the technical scheme, the method has the advantages that: different uploading modes are switched according to the uploading mode command, when the current uploading mode is switched to the real-time uploading mode, the online connection state with the server is required to be kept, the sleep data are uploaded to the server in real time, when the current uploading mode is switched to the non-real-time uploading mode, the online connection state with the server is not required to be kept, the sleep data are uploaded to the server in non-real time, and the problems that the gateway and the server are always kept in the online connection state, the power consumption of the gateway is high, and the loss of electric quantity is increased are solved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
As shown in fig. 1, an embodiment of the present application provides a method for uploading sleep data, where the method includes the following steps:
and step S101, receiving an uploading mode command.
In this embodiment, the execution subject is a smart speaker. And receiving an uploading mode command output by a user, wherein the uploading mode command can be output by the user through a key, can be sent by a mobile phone, and can be output by voice.
In this embodiment, the upload mode command includes a real-time upload mode command and a non-real-time upload mode command.
And step S102, judging whether the uploading mode command is in a real-time uploading mode.
After receiving the upload mode command, it is determined whether the upload mode command is a real-time upload mode, and specifically, the voice output can be identified by keywords, for example, "real-time" is a real-time upload mode, and "non-real-time" is a non-real-time upload mode. The key output can preset one key as a real-time uploading mode, and the other key as a non-real-time uploading mode.
Step S103, if yes, switching the current uploading mode to a real-time uploading mode, acquiring sleep data from a sleep sensor according to a first frequency preset by the real-time uploading mode, and uploading the sleep data to a server in real time.
If the real-time uploading mode is judged, the current uploading mode is switched to the real-time uploading mode, in the real-time uploading mode, the intelligent sound box needs to be in an online connection state with the server, sleep data are acquired through the first frequency and then uploaded to the server in real time, the first frequency is the frequency capable of guaranteeing that the sleep data can be uploaded in real time, and the sleep data are uploaded to the server through the first frequency, so that real-time uploading can be achieved.
And step S104, if not, switching the current uploading mode into a non-real-time uploading mode, acquiring sleep data from a sleep sensor according to a second frequency preset in the non-real-time uploading mode, and uploading the sleep data to a server in a non-real-time manner.
If the non-real-time uploading mode is judged, the current uploading mode is switched to the non-real-time uploading mode, in the non-real-time uploading mode, the intelligent sound box does not need to be in an online connection state with the server, namely, the intelligent sound box can be in a disconnection state with the server, when the sleep data need to be uploaded to the server, the intelligent sound box is connected with the server again, and therefore power consumption of the intelligent sound box can be reduced.
In some embodiments, the sleep data obtained at the second frequency has been delayed from being immediately uploaded to the server, and thus is not real-time sleep data, and may be immediately uploaded to the server or delayed from being uploaded to the server for a period of time after the sleep data obtained at the second frequency.
Different uploading modes are switched according to the uploading mode command, when the current uploading mode is switched to the real-time uploading mode, the online connection state with the server is required to be kept, the sleep data are uploaded to the server in real time, when the current uploading mode is switched to the non-real-time uploading mode, the online connection state with the server is not required to be kept, the sleep data are uploaded to the server in non-real time, and the problems that the gateway and the server are always kept in the online connection state, the power consumption of the gateway is high, and the loss of electric quantity is increased are solved.
In this embodiment, step S101 includes:
receiving voice information of a user;
and recognizing the voice information to obtain an uploading mode command.
The uploading mode command is obtained through the voice information, so that the operation of a user is facilitated.
In this embodiment, the step of recognizing the voice information and obtaining an upload mode command includes:
extracting voiceprint features in the voice information;
judging whether the user is a legal user or not according to the voiceprint characteristics;
and if so, identifying the voice information to obtain an uploading mode command.
The voice message processing method includes the steps that a preset part of voiceprint features are legal users, the voiceprint features are extracted after voice messages of the users are received, if the matching degree of the extracted voiceprint features and the preset voiceprint features is larger than a preset threshold value, the extracted voiceprint features are judged to be the legal users, otherwise, the voiceprint features are illegal users, if the voiceprint features are the legal users, voice messages are recognized, uploading mode commands are obtained, and if the voiceprint features are the illegal users, actions of recognizing the voice messages are not executed.
In the present embodiment, after step S103, or after step S104, the method includes:
receiving an automatic switching mode command;
and responding to the automatic mode switching command, and automatically switching the current uploading mode into a real-time uploading mode or a non-real-time uploading mode according to a triggering event.
After receiving the command of automatically switching the mode, the current uploading mode is automatically switched to the real-time uploading mode or the non-real-time uploading mode according to the trigger event, and the switching of the real-time uploading mode or the non-real-time uploading mode can be carried out without the uploading mode command.
In the step of automatically switching the current uploading mode to the real-time uploading mode or the non-real-time uploading mode according to the trigger event, the method includes:
when the time reaches a preset first time, starting detection;
detecting whether a person is at the bedside;
if so, switching the current uploading mode into a non-real-time uploading mode, acquiring sleep data from a sleep sensor according to a third frequency preset by the non-real-time uploading mode, and uploading the sleep data to a server in a non-real-time manner;
detecting whether a person is in a bed;
if so, adjusting the third frequency to a fourth frequency, wherein the fourth frequency is lower than the third frequency;
detecting whether a person in bed falls asleep;
if so, adjusting the fourth frequency to a fifth frequency, wherein the fifth frequency is lower than the fourth frequency;
when the time reaches a preset second time, switching the current uploading mode into a real-time uploading mode, acquiring sleep data from a sleep sensor according to a sixth frequency preset by the real-time uploading mode, and uploading the sleep data to a server in real time;
detecting whether a person in the bed gets up;
if so, adjusting the sixth frequency to a seventh frequency, wherein the seventh frequency is higher than the sixth frequency.
The time of sleep is after 9 pm, the first time can be set to be 9 pm, when the time reaches 9 pm, detection is started, people are detected at the bedside, the current uploading mode is switched to the non-real-time uploading mode, the sleep data are acquired from the sleep sensor according to the third frequency, then the sleep data are uploaded to the server in non-real time, and the sleep data cannot be acquired in real time by adopting the third frequency, so that the sleep data are not required to be uploaded in real time in the scene. Then, the person is detected to be in the bed, and the third frequency is adjusted to a fourth frequency, wherein the fourth frequency is lower than the third frequency. After that it is detected that the person in bed falls asleep, the fourth frequency is adjusted to a fifth frequency again, the fifth frequency being a lower frequency than the fourth frequency. Generally, the user gets up in the next morning, the preset second time is 4 o 'clock 30 minutes in the morning, when the time reaches 4 o' clock 30 minutes in the morning, the current uploading mode is switched to the real-time uploading mode, the sleep data are acquired from the sleep sensor according to the sixth frequency, then the sleep data are uploaded to the server in real time, and the sleep data can be acquired in real time by adopting the sixth frequency, so that the sleep data need to be uploaded in real time in the scene. And when the user gets up, the server sends a control command to control corresponding intelligent household equipment to work, such as opening a curtain.
As shown in fig. 2, anapparatus 1 for uploading sleep data is provided in an embodiment of the present application, where theapparatus 1 includes afirst receiving module 11, a determiningmodule 12, afirst processing module 13, and asecond processing module 14.
Thefirst receiving module 11 is configured to receive an upload mode command.
In this embodiment, the execution subject is a smart speaker. And receiving an uploading mode command output by a user, wherein the uploading mode command can be output by the user through a key, can be sent by a mobile phone, and can be output by voice.
In this embodiment, the upload mode command includes a real-time upload mode command and a non-real-time upload mode command.
And the judgingmodule 12 is configured to judge whether the upload mode command is a real-time upload mode.
After receiving the upload mode command, it is determined whether the upload mode command is a real-time upload mode, and specifically, the voice output can be identified by keywords, for example, "real-time" is a real-time upload mode, and "non-real-time" is a non-real-time upload mode. The key output can preset one key as a real-time uploading mode, and the other key as a non-real-time uploading mode.
And thefirst processing module 13 is configured to switch the current uploading mode to a real-time uploading mode if the current uploading mode is the real-time uploading mode, acquire sleep data from the sleep sensor according to a first frequency preset in the real-time uploading mode, and upload the sleep data to the server in real time.
If the real-time uploading mode is judged, the current uploading mode is switched to the real-time uploading mode, in the real-time uploading mode, the intelligent sound box needs to be in an online connection state with the server, sleep data are acquired through the first frequency and then uploaded to the server in real time, the first frequency is the frequency capable of guaranteeing that the sleep data can be uploaded in real time, and the sleep data are uploaded to the server through the first frequency, so that real-time uploading can be achieved.
And thesecond processing module 14 is configured to, if not, switch the current uploading mode to the non-real-time uploading mode, acquire sleep data from the sleep sensor according to a second frequency preset in the non-real-time uploading mode, and upload the sleep data to the server in a non-real-time manner.
If the non-real-time uploading mode is judged, the current uploading mode is switched to the non-real-time uploading mode, in the non-real-time uploading mode, the intelligent sound box does not need to be in an online connection state with the server, namely, the intelligent sound box can be in a disconnection state with the server, when the sleep data need to be uploaded to the server, the intelligent sound box is connected with the server again, and therefore power consumption of the intelligent sound box can be reduced.
In some embodiments, the sleep data obtained at the second frequency has been delayed from being immediately uploaded to the server, and thus is not real-time sleep data, and may be immediately uploaded to the server or delayed from being uploaded to the server for a period of time after the sleep data obtained at the second frequency.
Different uploading modes are switched according to the uploading mode command, when the current uploading mode is switched to the real-time uploading mode, the online connection state with the server is required to be kept, the sleep data are uploaded to the server in real time, when the current uploading mode is switched to the non-real-time uploading mode, the online connection state with the server is not required to be kept, the sleep data are uploaded to the server in non-real time, and the problems that the gateway and the server are always kept in the online connection state, the power consumption of the gateway is high, and the loss of electric quantity is increased are solved.
In this embodiment, thefirst receiving module 11 includes:
the sub-receiving module is used for receiving the voice information of the user;
and the recognition module is used for recognizing the voice information to obtain an uploading mode command.
The uploading mode command is obtained through the voice information, so that the operation of a user is facilitated.
In this embodiment, the identification module includes:
the sub-extraction module is used for extracting the voiceprint features in the voice information;
the sub-judgment module is used for judging whether the user is a legal user or not according to the voiceprint characteristics;
and the sub-recognition module is used for recognizing the voice information if the voice information is in the uploading mode, so as to obtain an uploading mode command.
The voice message processing method includes the steps that a preset part of voiceprint features are legal users, the voiceprint features are extracted after voice messages of the users are received, if the matching degree of the extracted voiceprint features and the preset voiceprint features is larger than a preset threshold value, the extracted voiceprint features are judged to be the legal users, otherwise, the voiceprint features are illegal users, if the voiceprint features are the legal users, voice messages are recognized, uploading mode commands are obtained, and if the voiceprint features are the illegal users, actions of recognizing the voice messages are not executed.
In the present embodiment, theapparatus 1 comprises:
the second receiving module is used for receiving an automatic switching mode command;
and the third processing module is used for responding to the automatic mode switching command and automatically switching the current uploading mode into a real-time uploading mode or a non-real-time uploading mode according to a triggering event.
After receiving the command of automatically switching the mode, the current uploading mode is automatically switched to the real-time uploading mode or the non-real-time uploading mode according to the trigger event, and the switching of the real-time uploading mode or the non-real-time uploading mode can be carried out without the uploading mode command.
The third processing module comprises:
the starting module is used for starting detection when the time reaches a preset first time;
the first detection module is used for detecting whether a person is beside a bed;
the first sub-processing module is used for switching the current uploading mode into a non-real-time uploading mode if the current uploading mode is the non-real-time uploading mode, acquiring sleep data from a sleep sensor according to a third frequency preset in the non-real-time uploading mode, and uploading the sleep data to a server in a non-real-time manner;
the second detection module is used for detecting whether a person is in the bed;
a first adjusting module, configured to adjust the third frequency to a fourth frequency if the third frequency is higher than the fourth frequency;
the third detection module is used for detecting whether the person in the bed falls asleep or not;
a second adjusting module, configured to adjust the fourth frequency to a fifth frequency if the fourth frequency is higher than the fourth frequency;
the second sub-processing module is used for switching the current uploading mode into a real-time uploading mode when the time reaches a preset second time, acquiring sleep data from the sleep sensor according to a sixth frequency preset by the real-time uploading mode, and uploading the sleep data to the server in real time;
the fourth detection module is used for detecting whether a person in the bed gets up;
and a third adjusting module, configured to adjust the sixth frequency to a seventh frequency if the sixth frequency is higher than the sixth frequency.
The time of sleep is after 9 pm, the first time can be set to be 9 pm, when the time reaches 9 pm, detection is started, people are detected at the bedside, the current uploading mode is switched to the non-real-time uploading mode, the sleep data are acquired from the sleep sensor according to the third frequency, then the sleep data are uploaded to the server in non-real time, and the sleep data cannot be acquired in real time by adopting the third frequency, so that the sleep data are not required to be uploaded in real time in the scene. Then, the person is detected to be in the bed, and the third frequency is adjusted to a fourth frequency, wherein the fourth frequency is lower than the third frequency. After that it is detected that the person in bed falls asleep, the fourth frequency is adjusted to a fifth frequency again, the fifth frequency being a lower frequency than the fourth frequency. Generally, the user gets up in the next morning, the preset second time is 4 o 'clock 30 minutes in the morning, when the time reaches 4 o' clock 30 minutes in the morning, the current uploading mode is switched to the real-time uploading mode, the sleep data are acquired from the sleep sensor according to the sixth frequency, then the sleep data are uploaded to the server in real time, and the sleep data can be acquired in real time by adopting the sixth frequency, so that the sleep data need to be uploaded in real time in the scene. And when the user gets up, the server sends a control command to control corresponding intelligent household equipment to work, such as opening a curtain.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.