CN104917799B - A kind of resource sharing method, resource gateway, first node and second node - Google Patents
A kind of resource sharing method, resource gateway, first node and second node Download PDFInfo
- Publication number
- CN104917799B CN104917799B CN201410094877.1A CN201410094877A CN104917799B CN 104917799 B CN104917799 B CN 104917799B CN 201410094877 A CN201410094877 A CN 201410094877A CN 104917799 B CN104917799 B CN 104917799B
- Authority
- CN
- China
- Prior art keywords
- node
- resource
- communication
- power consumption
- average power
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 55
- 238000004891 communication Methods 0.000 claims abstract description 152
- 230000004044 response Effects 0.000 claims abstract description 77
- 238000012546 transfer Methods 0.000 claims abstract description 41
- 230000005540 biological transmission Effects 0.000 claims description 37
- 235000014435 Mentha Nutrition 0.000 claims description 6
- 241001072983 Mentha Species 0.000 claims description 6
- 101100513476 Mus musculus Spen gene Proteins 0.000 claims description 6
- 235000014569 mints Nutrition 0.000 claims description 6
- 230000006870 function Effects 0.000 description 21
- 230000000694 effects Effects 0.000 description 16
- 238000010586 diagram Methods 0.000 description 10
- 238000004590 computer program Methods 0.000 description 7
- 238000012986 modification Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 238000012544 monitoring process Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000007639 printing Methods 0.000 description 1
- 238000000611 regression analysis Methods 0.000 description 1
- 238000005070 sampling Methods 0.000 description 1
- 238000007619 statistical method Methods 0.000 description 1
Landscapes
- Mobile Radio Communication Systems (AREA)
Abstract
本发明公开了一种资源分享方法,包括:在第一节点处于第一工作状态时,第一节点基于超文本传送协议HTTP1.1协议与资源网关建立第一通信;第一节点基于第一通信,向资源网关发送第一请求,第一请求用于向资源网关获取第二节点对应的第二节点相关信息;第一节点基于第一通信,接收资源网关反馈的第一请求响应,并从第一请求响应中获取第二节点相关信息;第一节点基于第二节点相关信息,从第二节点获取第一资源。同时,本发明还公开了一种资源网关、第一节点和第二节点。
The invention discloses a resource sharing method, comprising: when the first node is in the first working state, the first node establishes the first communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol; the first node establishes the first communication based on the first communication , send a first request to the resource gateway, the first request is used to obtain the second node-related information corresponding to the second node from the resource gateway; the first node receives the first request response fed back by the resource gateway based on the first communication, and obtains from the second node Obtaining related information of the second node in a request response; the first node acquires the first resource from the second node based on the related information of the second node. At the same time, the invention also discloses a resource gateway, a first node and a second node.
Description
技术领域technical field
本发明涉及电子技术领域,尤其涉及一种资源分享方法、资源网关、第一节点及第二节点。The present invention relates to the field of electronic technology, in particular to a resource sharing method, a resource gateway, a first node and a second node.
背景技术Background technique
随着科技的发展,越来越多的电子设备走进了人们的生活,给人们带来诸多便利。并且,这些电子设备可以在一家庭网络中实现资源的分享。With the development of science and technology, more and more electronic devices have entered people's lives, bringing many conveniences to people. Moreover, these electronic devices can share resources in a home network.
在现有技术中,各个电子设备大多采用UPnP AV架构下的协议进行数据传输,从而实现各个电子设备之间的资源分享。In the prior art, each electronic device mostly adopts a protocol under the UPnP AV framework for data transmission, so as to realize resource sharing among various electronic devices.
但,因为UPnP AV架构下的协议支持的类型过广(例如:支持独立的DVD设备播放与分享),这对电子设备在兼容性方面有很高的要求,导致电子设备在实现较高兼容性时的难度很大,往往需要花费大量的成本才能使电子设备获得较高的兼容性。However, because the protocol under the UPnP AV architecture supports a wide range of types (for example: supporting independent DVD device playback and sharing), this has high requirements on the compatibility of electronic devices, resulting in higher compatibility of electronic devices It is very difficult, and it often takes a lot of cost to make electronic equipment obtain high compatibility.
发明内容Contents of the invention
本申请实施例通过提供一种资源分享方法,解决了现有技术中由于使用UPnP AV架构下的协议实现各个电子设备之间资源分享,而造成电子设备不易实现较高的兼容性的技术问题。The embodiment of the present application provides a resource sharing method to solve the technical problem in the prior art that it is difficult for electronic devices to achieve high compatibility due to the use of protocols under the UPnP AV framework to realize resource sharing between electronic devices.
第一方面,本申请通过本申请的一实施例提供如下技术方案:In the first aspect, the present application provides the following technical solutions through an embodiment of the present application:
一种资源分享方法,包括:A resource sharing method, comprising:
在第一节点处于第一工作状态时,所述第一节点基于超文本传送协议HTTP1.1协议与资源网关建立第一通信;When the first node is in the first working state, the first node establishes a first communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol;
所述第一节点基于所述第一通信,向所述资源网关发送第一请求,所述第一请求用于向所述资源网关获取第二节点对应的第二节点相关信息;The first node sends a first request to the resource gateway based on the first communication, and the first request is used to obtain second node related information corresponding to the second node from the resource gateway;
所述第一节点基于所述第一通信,接收所述资源网关反馈的第一请求响应,并从所述第一请求响应中获取所述第二节点相关信息;The first node receives the first request response fed back by the resource gateway based on the first communication, and obtains the second node related information from the first request response;
所述第一节点基于所述第二节点相关信息,从所述第二节点获取第一资源。The first node acquires the first resource from the second node based on the second node related information.
由于,HTTP1.1(HTTP-Hypertext transfer protocol1.1,超文本传输协议1.1)是现在Internet(Internetwork,国际互联网)中标准的网页浏览协议,且大部分的设备都支持HTTP1.1协议。HTTP1.1协议不仅定义了文本数据的传输,同时也定义了流媒体数据的传输方式。从设备支持与协议支持角度出发,HTTP1.1完全胜任家庭网络数据传输的工作。从物理设备上出发,现在的智能设备基本都支持HTTP1.1协议;从协议功能上出发,HTTP1.1协议可以为家庭的流媒体数据传输提供基础。从设备支持与协议功能上可以看出,使用HTTP1.1协议比较使用UPnP AV架构下的协议有兼容性更高,实现成本更低的优势。Because HTTP1.1 (HTTP-Hypertext transfer protocol1.1, Hypertext Transfer Protocol 1.1) is the standard web browsing protocol in the Internet (Internetwork, Internet), and most devices support the HTTP1.1 protocol. The HTTP1.1 protocol not only defines the transmission of text data, but also defines the transmission mode of streaming media data. From the point of view of device support and protocol support, HTTP1.1 is fully qualified for home network data transmission. From the perspective of physical equipment, the current smart equipment basically supports the HTTP1.1 protocol; from the perspective of protocol functions, the HTTP1.1 protocol can provide the basis for streaming media data transmission at home. It can be seen from the device support and protocol functions that using the HTTP1.1 protocol has the advantages of higher compatibility and lower implementation costs than using the protocol under the UPnP AV architecture.
由上述技术方案可知,第一节点基于超文本传送协议HTTP1.1协议与资源网关建立第一通信,有效地解决了现有技术中由于使用UPnP AV架构下的协议实现各个电子设备之间资源分享,而造成电子设备不易实现较高的兼容性的技术问题,实现了在保证各个设备间的资源共享的前提下,各个电子设备更容易获得较高的兼容性,且实现成本较低的技术效果。It can be seen from the above technical solution that the first node establishes the first communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol, which effectively solves the problem of resource sharing between electronic devices due to the use of protocols under the UPnP AV framework in the prior art. , and the technical problem that it is difficult for electronic devices to achieve high compatibility, realizes that under the premise of ensuring the resource sharing among various devices, it is easier for each electronic device to obtain high compatibility, and realize the technical effect of lower cost .
可选的,所述第二节点相关信息,包括:Optionally, the second node related information includes:
所述第二节点处于第二工作状态的第一时间段;和/或a first time period during which the second node is in a second working state; and/or
所述第二节点处于第二休眠状态的第二时间段;a second period of time during which the second node is in a second dormant state;
其中,在所述第二节点处于所述第二工作状态时,所述第二节点的平均功耗为第一平均功耗;在所述第二节点处于所述第二休眠状态时,所述第二节点的平均功耗为第二平均功耗,所述第二平均功耗小于所述第一平均功耗。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the The average power consumption of the second node is a second average power consumption, and the second average power consumption is smaller than the first average power consumption.
可选的,所述第一节点基于所述第二节点相关信息,从所述第二节点获取第一资源,包括:Optionally, the first node obtaining the first resource from the second node based on the second node related information includes:
所述第一节点从所述第一请求响应中获取所述第一时间段、和/或所述第二时间段;The first node obtains the first time period and/or the second time period from the first request response;
在所述第一节点基于所述第一时间段、和/或所述第二时间段,确定所述第二节点当前处于所述第二工作状态时,所述第一节点基于所述第一通信,向所述资源网关发送用于获取所述第一资源的第二请求;When the first node determines that the second node is currently in the second working state based on the first time period and/or the second time period, the first node based on the first communicating, sending a second request for acquiring the first resource to the resource gateway;
所述第一节点基于所述第一通信,接收所述资源网关反馈的第二请求响应,并从所述第二请求响应中获取所述第一资源。The first node receives the second request response fed back by the resource gateway based on the first communication, and acquires the first resource from the second request response.
可选的,所述第一节点基于所述第二节点相关信息,向所述第二节点获取所述第一资源,包括:Optionally, the first node acquiring the first resource from the second node based on the second node related information includes:
所述第一节点从所述第一请求响应中获取所述第一时间段、和/或所述第二时间段;The first node obtains the first time period and/or the second time period from the first request response;
在所述第一节点基于所述第一时间段、和/或所述第二时间段,确定所述第二节点当前处于所述第二休眠状态时,所述第一节点将所述第一工作状态调整为第一休眠状态;其中,在所述第一节点处于所述第一工作状态时,所述第一节点的平均功耗为第三平均功耗;在所述第一节点处于所述第一休眠状态时,所述第一节点的平均功耗为第四平均功耗,所述第四平均功耗小于所述第三平均功耗;When the first node determines that the second node is currently in the second dormant state based on the first time period and/or the second time period, the first node sets the first The working state is adjusted to the first sleep state; wherein, when the first node is in the first working state, the average power consumption of the first node is the third average power consumption; when the first node is in the In the first sleep state, the average power consumption of the first node is a fourth average power consumption, and the fourth average power consumption is less than the third average power consumption;
在当前时间为所述第一时间段的起始时间时,所述第一节点将所述第一休眠状态调整为所述第一工作状态;When the current time is the start time of the first time period, the first node adjusts the first sleep state to the first working state;
所述第一节点基于所述第一通信,向所述资源网关发送用于获取所述第一资源的第二请求;The first node sends a second request for acquiring the first resource to the resource gateway based on the first communication;
所述第一节点基于所述第一通信,接收所述资源网关反馈的第二请求响应,并从所述第二请求响应中获取所述第一资源。The first node receives the second request response fed back by the resource gateway based on the first communication, and acquires the first resource from the second request response.
由上述技术方案可知,在第一节点确认第二节点当前处于休眠状态时,第一节点也进入休眠状态,待第二节点由休眠状态进入工作状态时,第一节点再进入工作状态,向资源网关发送第二请求以获得第一资源,从而实现节约第一节点的电能的技术效果。It can be seen from the above technical solution that when the first node confirms that the second node is currently in the dormant state, the first node also enters the dormant state, and when the second node enters the working state from the dormant state, the first node enters the working state again and sends resources The gateway sends the second request to obtain the first resource, thereby realizing the technical effect of saving the electric energy of the first node.
第二方面,本申请通过本申请的一实施例提供如下技术方案:In the second aspect, the present application provides the following technical solutions through an embodiment of the present application:
一种资源分享方法,包括:A resource sharing method, comprising:
在资源网关处于工作状态时,所述资源网关基于超文本传送协议HTTP1.1协议与第一节点建立第一通信;When the resource gateway is in the working state, the resource gateway establishes a first communication with the first node based on the hypertext transfer protocol HTTP1.1 protocol;
所述资源网关基于所述第一通信,接收所述第一节点发送的第一请求,所述第一请求用于向所述资源网关获取第二节点对应的第二节点相关信息;The resource gateway receives a first request sent by the first node based on the first communication, and the first request is used to obtain second node related information corresponding to the second node from the resource gateway;
所述资源网关基于所述第一通信,向所述第一节点发送包含所述第二节点相关信息的第一请求响应,以使所述第一节点能够基于所述第二节点相关信息从所述第二节点获取第一资源。The resource gateway sends, based on the first communication, a first request response containing information about the second node to the first node, so that the first node can obtain information from the first node based on the information about the second node. The second node obtains the first resource.
由于,HTTP1.1是现在Internet(Internetwork,国际互联网)中标准的网页浏览协议,且大部分的设备都支持HTTP1.1协议。HTTP1.1协议不仅定义了文本数据的传输,同时也定义了流媒体数据的传输方式。从设备支持与协议支持角度出发,HTTP1.1完全胜任家庭网络数据传输的工作。从物理设备上出发,现在的智能设备基本都支持HTTP1.1协议;从协议功能上出发,HTTP1.1协议可以为家庭的流媒体数据传输提供基础。从设备支持与协议功能上可以看出,使用HTTP1.1协议比较使用UPnP AV架构下的协议有兼容性更高,实现成本更低的优势。Because HTTP1.1 is the standard web browsing protocol in the Internet (Internetwork, Internet), and most devices support the HTTP1.1 protocol. The HTTP1.1 protocol not only defines the transmission of text data, but also defines the transmission mode of streaming media data. From the point of view of device support and protocol support, HTTP1.1 is fully qualified for home network data transmission. From the perspective of physical equipment, the current smart equipment basically supports the HTTP1.1 protocol; from the perspective of protocol functions, the HTTP1.1 protocol can provide the basis for streaming media data transmission at home. It can be seen from the device support and protocol functions that using the HTTP1.1 protocol has the advantages of higher compatibility and lower implementation costs than using the protocol under the UPnP AV architecture.
由上述技术方案可知,资源网关基于超文本传送协议HTTP1.1协议与第一节点建立第一通信,有效地解决了现有技术中由于使用UPnP AV架构下的协议实现各个电子设备之间资源分享,而造成电子设备不易实现较高的兼容性的技术问题,实现了在保证各个设备间的资源共享的前提下,各个电子设备更容易获得较高的兼容性,且实现成本较低的技术效果。It can be seen from the above technical solution that the resource gateway establishes the first communication with the first node based on the hypertext transfer protocol HTTP1.1 protocol, which effectively solves the problem of resource sharing between electronic devices due to the use of protocols under the UPnP AV framework in the prior art. , and the technical problem that it is difficult for electronic devices to achieve high compatibility, realizes that under the premise of ensuring the resource sharing among various devices, it is easier for each electronic device to obtain high compatibility, and realize the technical effect of lower cost .
可选的,在所述资源网关基于所述第一通信,接收所述第一节点发送的第一请求之前,所述方法还包括:Optionally, before the resource gateway receives the first request sent by the first node based on the first communication, the method further includes:
所述资源网关基于所述超文本传送协议HTTP1.1协议与所述第二节点建立第二通信;The resource gateway establishes a second communication with the second node based on the hypertext transfer protocol HTTP1.1 protocol;
所述资源网关基于所述第二通信,接收所述第二节点发送的所述第二节点相关信息。The resource gateway receives the second node related information sent by the second node based on the second communication.
可选的,所述第二节点相关信息,包括:Optionally, the second node related information includes:
所述第二节点处于第二工作状态的第一时间段;和/或a first time period during which the second node is in a second working state; and/or
所述第二节点处于第二休眠状态的第二时间段;a second period of time during which the second node is in a second dormant state;
其中,在所述第二节点处于所述第二工作状态时,所述第二节点的平均功耗为第一平均功耗;在所述第二节点处于所述第二休眠状态时,所述第二节点的平均功耗为第二平均功耗,所述第二平均功耗小于所述第一平均功耗。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the The average power consumption of the second node is a second average power consumption, and the second average power consumption is smaller than the first average power consumption.
可选的,在所述资源网关基于所述第一通信,向所述第一节点发送包含所述第二节点相关信息的第一请求响应之后,所述方法还包括:Optionally, after the resource gateway sends the first request response including the relevant information of the second node to the first node based on the first communication, the method further includes:
所述资源网关基于所述第一通信,接收所述第一节点发送的用于获取所述第一资源的第二请求;receiving, by the resource gateway based on the first communication, a second request for acquiring the first resource sent by the first node;
所述资源网关基于所述第二通信,将所述第二请求发送给所述第二节点;sending, by the resource gateway, the second request to the second node based on the second communication;
所述资源网关基于所述第二通信,接收所述第二节点反馈的包含所述第一资源的第二请求响应;The resource gateway receives, based on the second communication, a second request response that includes the first resource fed back by the second node;
所述资源网关基于所述第一通信,将所述第二请求响应发送给所述第一节点。The resource gateway sends the second request response to the first node based on the first communication.
由上述技术方案可知,第一节点与第二节点的往来通信均通过资源网关进行转达,从而实现了通过资源网关对第一节点和第二节点进行数据监控的技术效果。It can be seen from the above technical solution that the communication between the first node and the second node is conveyed through the resource gateway, thereby realizing the technical effect of data monitoring of the first node and the second node through the resource gateway.
可选的,所述资源网关始终保持工作状态。Optionally, the resource gateway always keeps working.
由上述技术方案可知,由于资源网关始终处于工作状态,使得对于第一节点任意时刻发出的第一请求,都能进行及时地做出响应,从而这保证了资源网关的QoS(Qualityof Service,服务质量)。It can be seen from the above technical solution that since the resource gateway is always in the working state, it can respond in time to the first request sent by the first node at any time, thus ensuring the QoS (Quality of Service, quality of service) of the resource gateway. ).
第三方面,本申请通过本申请的一实施例提供如下技术方案:In the third aspect, the present application provides the following technical solutions through an embodiment of the present application:
一种资源分享方法,包括:A resource sharing method, comprising:
在第二节点处于第二工作状态时,所述第二节点基于超文本传送协议HTTP1.1协议与资源网关建立第二通信;When the second node is in the second working state, the second node establishes a second communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol;
所述第二节点基于所述第二通信,向所述资源网关发送第二节点相关信息,以使第一节点能够从所述资源网关获取所述第二节点相关信息,并基于所述第二节点相关信息从所述第二节点获取第一资源。The second node sends second node related information to the resource gateway based on the second communication, so that the first node can obtain the second node related information from the resource gateway, and based on the second The node-related information acquires the first resource from the second node.
由于,HTTP1.1是现在Internet(Internetwork,国际互联网)中标准的网页浏览协议,且大部分的设备都支持HTTP1.1协议。HTTP1.1协议不仅定义了文本数据的传输,同时也定义了流媒体数据的传输方式。从设备支持与协议支持角度出发,HTTP1.1完全胜任家庭网络数据传输的工作。从物理设备上出发,现在的智能设备基本都支持HTTP1.1协议;从协议功能上出发,HTTP1.1协议可以为家庭的流媒体数据传输提供基础。从设备支持与协议功能上可以看出,使用HTTP1.1协议比较使用UPnP AV架构下的协议有兼容性更高,实现成本更低的优势。Because HTTP1.1 is the standard web browsing protocol in the Internet (Internetwork, Internet), and most devices support the HTTP1.1 protocol. The HTTP1.1 protocol not only defines the transmission of text data, but also defines the transmission mode of streaming media data. From the point of view of device support and protocol support, HTTP1.1 is fully qualified for home network data transmission. From the perspective of physical equipment, the current smart equipment basically supports the HTTP1.1 protocol; from the perspective of protocol functions, the HTTP1.1 protocol can provide the basis for streaming media data transmission at home. It can be seen from the device support and protocol functions that using the HTTP1.1 protocol has the advantages of higher compatibility and lower implementation costs than using the protocol under the UPnP AV architecture.
由上述技术方案可知,第二节点基于超文本传送协议HTTP1.1协议与资源网关建立第二通信,有效地解决了现有技术中由于使用UPnP AV架构下的协议实现各个电子设备之间资源分享,而造成电子设备不易实现较高的兼容性的技术问题,实现了在保证各个设备间的资源共享的前提下,各个电子设备更容易获得较高的兼容性,且实现成本较低的技术效果。It can be seen from the above technical solution that the second node establishes the second communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol, which effectively solves the problem of resource sharing between electronic devices due to the use of protocols under the UPnP AV framework in the prior art. , and the technical problem that it is difficult for electronic devices to achieve high compatibility, realizes that under the premise of ensuring the resource sharing among various devices, it is easier for each electronic device to obtain high compatibility, and realize the technical effect of lower cost .
可选的,在所述第二节点基于所述第二通信,向所述资源网关发送第二节点相关信息之后,所述方法还包括:Optionally, after the second node sends information about the second node to the resource gateway based on the second communication, the method further includes:
所述第二节点接收所述资源网关发送的第二请求,所述第二请求为第一节点获取所述第二节点的第一资源的请求;The second node receives a second request sent by the resource gateway, where the second request is a request for the first node to obtain the first resource of the second node;
所述第二节点基于所述第二通信,向所述资源网关发送包含所述第一资源的第二请求响应。The second node sends a second request response including the first resource to the resource gateway based on the second communication.
可选的,在所述第二节点基于所述第二通信,向所述资源网关发送第二节点相关信息之前,所述方法还包括:Optionally, before the second node sends related information of the second node to the resource gateway based on the second communication, the method further includes:
所述第二节点确定处于所述第二工作状态的第一时间长度;the second node determines a first length of time in the second operational state;
所述第二节点确定处于第二休眠状态的第二时间长度;the second node determines a second length of time in a second dormant state;
其中,在第二节点处于所述第二工作状态时,所述第二节点的平均功耗为第一平均功耗;在第二节点处于所述第二休眠状态时,所述第二节点的平均功耗为第二平均功耗,所述第二平均功耗小于所述第一平均功耗,且所述第二节点无法接收所述第二请求。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the average power consumption of the second node is The average power consumption is a second average power consumption, the second average power consumption is smaller than the first average power consumption, and the second node cannot receive the second request.
可选的,所述方法还包括:Optionally, the method also includes:
所述第二节点基于当前时间、所述第一时间长度和所述第二时间长度,确定所述第二节点处于所述第二工作状态的第一时间段;determining, by the second node, a first time period during which the second node is in the second working state based on the current time, the first time length, and the second time length;
所述第二节点基于当前时间、所述第一时间长度和所述第二时间长度,确定所述第二节点处于所述第二休眠状态的第二时间段;determining, by the second node, a second period of time during which the second node is in the second dormant state based on current time, the first length of time, and the second length of time;
所述第二节点基于所述第一时间段和所述第二时间段,生成所述第二节点相关信息;The second node generates the second node related information based on the first time period and the second time period;
所述第二节点通过所述第二通信,将所述第二节点相关信息发送给所述资源网关。The second node sends the second node related information to the resource gateway through the second communication.
可选的,所述方法还包括:Optionally, the method also includes:
在当前时间处于所述第二时间段内时,所述第二节点调整所述第二工作状态为所述第二休眠状态;When the current time is within the second time period, the second node adjusts the second working state to the second sleep state;
在当前时间处于所述第一时间段内时,所述第二节点调整所述第二休眠状态为所述第二工作状态。When the current time is within the first time period, the second node adjusts the second sleep state to the second working state.
由上述技术方案可知,第二节点能够在第一时间段处于工作状态,而在第二时间段处于休眠状态。由于第二节点具有间歇式的工作方式,相比于持续的工作方式,具有间歇式的工作方式的第二节点更加节能。从而实现了节约第二节点的电能的技术效果。It can be known from the above technical solution that the second node can be in the working state during the first time period and be in the dormant state during the second time period. Since the second node has an intermittent working mode, compared with a continuous working mode, the second node having an intermittent working mode is more energy-efficient. Therefore, the technical effect of saving the electric energy of the second node is realized.
可选的,所述第二节点基于如下公式,确定所述第一时间长度:Optionally, the second node determines the first time length based on the following formula:
其中,Ti为所述第一时间长度,Sh为历史使用情况集合,Chu为历史时刻使用情况集合,N为历史统计总数,MaxTi为历史最大第一时间长度,MinTi为历史最小第一时间长度。Wherein, Ti is the first time length, Sh is the historical use case set, Chu is the historical time use case set, N is the total number of historical statistics, MaxTi is the historical maximum first time length, and MinTi is the historical minimum first time length.
可选的,所述第二节点基于如下公式,确定所述第二时间长度:Optionally, the second node determines the second time length based on the following formula:
其中,Ts为所述第二时间长度,Sh为历史使用情况集合,Chu为过去历史时刻使用情况集合,N为历史统计总数,MaxTs为历史最大第二时间长度,MinTs为历史最小第二时间长度。Wherein, Ts is the second time length, Sh is the historical usage set, Chu is the past historical time usage set, N is the total number of historical statistics, MaxTs is the historical maximum second time length, MinTs is the historical minimum second time length .
第四方面,本申请通过本申请的一实施例提供如下技术方案:In the fourth aspect, the present application provides the following technical solutions through an embodiment of the present application:
一种第一节点,包括:A first node comprising:
第一建立单元,用于在所述第一节点处于第一工作状态时,基于超文本传送协议HTTP1.1协议与资源网关建立第一通信;A first establishment unit, configured to establish a first communication with the resource gateway based on the Hypertext Transfer Protocol HTTP1.1 protocol when the first node is in the first working state;
第一发送单元,用于基于所述第一通信,向所述资源网关发送第一请求,所述第一请求用于向所述资源网关获取第二节点对应的第二节点相关信息;A first sending unit, configured to send a first request to the resource gateway based on the first communication, where the first request is used to obtain second node related information corresponding to the second node from the resource gateway;
第一接收单元,用于基于所述第一通信,接收所述资源网关反馈的第一请求响应,并从所述第一请求响应中获取所述第二节点相关信息;a first receiving unit, configured to receive a first request response fed back by the resource gateway based on the first communication, and obtain information related to the second node from the first request response;
第一获取单元,用于基于所述第二节点相关信息,从所述第二节点获取第一资源。The first acquiring unit is configured to acquire the first resource from the second node based on the second node related information.
可选的,所述第二节点相关信息,包括:Optionally, the second node related information includes:
所述第二节点处于第二工作状态的第一时间段;和/或a first time period during which the second node is in a second working state; and/or
所述第二节点处于第二休眠状态的第二时间段;a second period of time during which the second node is in a second dormant state;
其中,在所述第二节点处于所述第二工作状态时,所述第二节点的平均功耗为第一平均功耗;在所述第二节点处于所述第二休眠状态时,所述第二节点的平均功耗为第二平均功耗,所述第二平均功耗小于所述第一平均功耗。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the The average power consumption of the second node is a second average power consumption, and the second average power consumption is smaller than the first average power consumption.
可选的,所述第一获取单元,包括:Optionally, the first acquisition unit includes:
第一获取模块,用于从所述第一请求响应中获取所述第一时间段、和/或所述第二时间段;A first obtaining module, configured to obtain the first time period and/or the second time period from the first request response;
第一发送模块,用于在基于所述第一时间段、和/或所述第二时间段,确定所述第二节点当前处于所述第二工作状态时,基于所述第一通信,向所述资源网关发送用于获取所述第一资源的第二请求;The first sending module is configured to, when it is determined based on the first time period and/or the second time period that the second node is currently in the second working state, based on the first communication, send The resource gateway sends a second request for acquiring the first resource;
第一接收模块,用于基于所述第一通信,接收所述资源网关反馈的第二请求响应,并从所述第二请求响应中获取所述第一资源。The first receiving module is configured to receive the second request response fed back by the resource gateway based on the first communication, and obtain the first resource from the second request response.
可选的,所述第一获取单元,包括:Optionally, the first acquisition unit includes:
第二获取模块,用于从所述第一请求响应中获取所述第一时间段、和/或所述第二时间段;A second obtaining module, configured to obtain the first time period and/or the second time period from the first request response;
第一调整模块,用于在基于所述第一时间段、和/或所述第二时间段,确定所述第二节点当前处于所述第二休眠状态时,将所述第一工作状态调整为第一休眠状态;其中,在所述第一节点处于所述第一工作状态时,所述第一节点的平均功耗为第三平均功耗;在所述第一节点处于所述第一休眠状态时,所述第一节点的平均功耗为第四平均功耗,所述第四平均功耗小于所述第三平均功耗;A first adjustment module, configured to adjust the first working state when it is determined that the second node is currently in the second sleep state based on the first time period and/or the second time period is the first sleep state; wherein, when the first node is in the first working state, the average power consumption of the first node is a third average power consumption; when the first node is in the first In the dormant state, the average power consumption of the first node is a fourth average power consumption, and the fourth average power consumption is smaller than the third average power consumption;
第二调整模块,用于在当前时间为所述第一时间段的起始时间时,将所述第一休眠状态调整为所述第一工作状态;A second adjustment module, configured to adjust the first sleep state to the first working state when the current time is the start time of the first time period;
第二发送模块,用于基于所述第一通信,向所述资源网关发送用于获取所述第一资源的第二请求;A second sending module, configured to send a second request for acquiring the first resource to the resource gateway based on the first communication;
第二接收模块,用于基于所述第一通信,接收所述资源网关反馈的第二请求响应,并从所述第二请求响应中获取所述第一资源。The second receiving module is configured to receive a second request response fed back by the resource gateway based on the first communication, and obtain the first resource from the second request response.
第五方面,本申请通过本申请的一实施例提供如下技术方案:In the fifth aspect, the present application provides the following technical solutions through an embodiment of the present application:
一种资源网关,包括:A resource gateway comprising:
第二建立单元,用于在所述资源网关处于工作状态时,基于超文本传送协议HTTP1.1协议与第一节点建立第一通信;The second establishing unit is configured to establish the first communication with the first node based on the Hypertext Transfer Protocol HTTP1.1 protocol when the resource gateway is in the working state;
第二接收单元,用于基于所述第一通信,接收所述第一节点发送的第一请求,所述第一请求用于向所述资源网关获取第二节点对应的第二节点相关信息;A second receiving unit, configured to receive a first request sent by the first node based on the first communication, where the first request is used to acquire second node related information corresponding to the second node from the resource gateway;
第二发送单元,用于基于所述第一通信,向所述第一节点发送包含所述第二节点相关信息的第一请求响应,以使所述第一节点能够基于所述第二节点相关信息从所述第二节点获取第一资源。The second sending unit is configured to send to the first node a first request response containing information about the second node based on the first communication, so that the first node can associate information based on the second node The information obtains the first resource from the second node.
可选的,所述资源网关还包括:Optionally, the resource gateway further includes:
第三建立单元,用于在所述资源网关基于所述第一通信,接收所述第一节点发送的第一请求之前,基于所述超文本传送协议HTTP1.1协议与所述第二节点建立第二通信;A third establishing unit, configured to establish with the second node based on the hypertext transfer protocol HTTP1.1 before the resource gateway receives the first request sent by the first node based on the first communication second communication;
第三接收单元,用于基于所述第二通信,接收所述第二节点发送的所述第二节点相关信息。A third receiving unit, configured to receive the second node related information sent by the second node based on the second communication.
可选的,所述第二节点相关信息,包括:Optionally, the second node related information includes:
所述第二节点处于第二工作状态的第一时间段;和/或a first time period during which the second node is in a second working state; and/or
所述第二节点处于第二休眠状态的第二时间段;a second period of time during which the second node is in a second dormant state;
其中,在所述第二节点处于所述第二工作状态时,所述第二节点的平均功耗为第一平均功耗;在所述第二节点处于所述第二休眠状态时,所述第二节点的平均功耗为第二平均功耗,所述第二平均功耗小于所述第一平均功耗。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the The average power consumption of the second node is a second average power consumption, and the second average power consumption is smaller than the first average power consumption.
可选的,所述资源网关还包括:Optionally, the resource gateway further includes:
第四接收单元,用于在所述资源网关基于所述第一通信,向所述第一节点发送包含所述第二节点相关信息的第一请求响应之后,基于所述第一通信,接收所述第一节点发送的用于获取所述第一资源的第二请求;a fourth receiving unit, configured to receive, based on the first communication, the A second request sent by the first node for acquiring the first resource;
第三发送单元,用于基于所述第二通信,将所述第二请求发送给所述第二节点;a third sending unit, configured to send the second request to the second node based on the second communication;
第五接收单元,用于基于所述第二通信,接收所述第二节点反馈的包含所述第一资源的第二请求响应;a fifth receiving unit, configured to receive, based on the second communication, a second request response that includes the first resource fed back by the second node;
第四发送单元,用于基于所述第一通信,将所述第二请求响应发送给所述第一节点。A fourth sending unit, configured to send the second request response to the first node based on the first communication.
可选的,所述资源网关还包括:Optionally, the resource gateway further includes:
保持单元,用于始终保持工作状态。Hold unit, used to keep working status all the time.
第六方面,本申请通过本申请的一实施例提供如下技术方案:In the sixth aspect, the present application provides the following technical solutions through an embodiment of the present application:
一种第二节点,包括:A second node comprising:
第四建立单元,用于在所述第二节点处于第二工作状态时,基于超文本传送协议HTTP1.1协议与资源网关建立第二通信;A fourth establishment unit, configured to establish a second communication with the resource gateway based on the Hypertext Transfer Protocol HTTP1.1 protocol when the second node is in the second working state;
第五发送单元,用于基于所述第二通信,向所述资源网关发送第二节点相关信息,以使第一节点能够从所述资源网关获取所述第二节点相关信息,并基于所述第二节点相关信息从所述第二节点获取第一资源。A fifth sending unit, configured to send second node related information to the resource gateway based on the second communication, so that the first node can obtain the second node related information from the resource gateway, and based on the The second node-related information acquires the first resource from the second node.
可选的,所述第二节点还包括:Optionally, the second node further includes:
第六接收单元,用于在所述基于所述第二通信,向所述资源网关发送第二节点相关信息之后,接收所述资源网关发送的第二请求,所述第二请求为第一节点获取所述第二节点的第一资源的请求;A sixth receiving unit, configured to receive a second request sent by the resource gateway after the second node-related information is sent to the resource gateway based on the second communication, the second request being the first node acquire a request for the first resource of the second node;
第六发送单元,用于基于所述第二通信,向所述资源网关发送包含所述第一资源的第二请求响应。A sixth sending unit, configured to send a second request response including the first resource to the resource gateway based on the second communication.
可选的,所述第二节点还包括:Optionally, the second node further includes:
第一确定单元,用于在所述第二节点基于所述第二通信,向所述资源网关发送第二节点相关信息之前,确定处于所述第二工作状态的第一时间长度;A first determining unit, configured to determine a first length of time in the second working state before the second node sends information about the second node to the resource gateway based on the second communication;
第二确定单元,用于确定处于第二休眠状态的第二时间长度;a second determining unit, configured to determine a second time length in the second dormant state;
其中,在第二节点处于所述第二工作状态时,所述第二节点的平均功耗为第一平均功耗;在第二节点处于所述第二休眠状态时,所述第二节点的平均功耗为第二平均功耗,所述第二平均功耗小于所述第一平均功耗,且所述第二节点无法接收所述第二请求。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the average power consumption of the second node is The average power consumption is a second average power consumption, the second average power consumption is smaller than the first average power consumption, and the second node cannot receive the second request.
可选的,所述第二节点还包括:Optionally, the second node further includes:
第三确定单元,用于基于当前时间、所述第一时间长度和所述第二时间长度,确定所述第二节点处于所述第二工作状态的第一时间段;A third determining unit, configured to determine a first time period during which the second node is in the second working state based on the current time, the first time length, and the second time length;
第四确定单元,用于基于当前时间、所述第一时间长度和所述第二时间长度,确定所述第二节点处于所述第二休眠状态的第二时间段;a fourth determining unit, configured to determine a second time period during which the second node is in the second dormant state based on the current time, the first time length, and the second time length;
第一生成单元,用于基于所述第一时间段和所述第二时间段,生成所述第二节点相关信息;a first generating unit, configured to generate the second node-related information based on the first time period and the second time period;
第七发送单元,用于通过所述第二通信,将所述第二节点相关信息发送给所述资源网关。A seventh sending unit, configured to send the second node related information to the resource gateway through the second communication.
可选的,所述第二节点还包括:Optionally, the second node further includes:
第一调整单元,用于在当前时间处于所述第二时间段内时,调整所述第二工作状态为所述第二休眠状态;a first adjustment unit, configured to adjust the second working state to the second sleep state when the current time is within the second time period;
第二调整单元,用于在当前时间处于所述第一时间段内时,调整所述第二休眠状态为所述第二工作状态。A second adjusting unit, configured to adjust the second sleep state to the second working state when the current time is within the first time period.
可选的,所述第一确定单元基于如下公式,确定所述第一时间长度:Optionally, the first determining unit determines the first time length based on the following formula:
其中,Ti为所述第一时间长度,Sh为历史使用情况集合,Chu为历史时刻使用情况集合,N为历史统计总数,MaxTi为历史最大第一时间长度,MinTi为历史最小第一时间长度。Wherein, Ti is the first time length, Sh is the historical use case set, Chu is the historical time use case set, N is the total number of historical statistics, MaxTi is the historical maximum first time length, and MinTi is the historical minimum first time length.
可选的,所述第二确定单元基于如下公式,确定所述第二时间长度:Optionally, the second determining unit determines the second time length based on the following formula:
其中,Ts为所述第二时间长度,Sh为历史使用情况集合,Chu为过去历史时刻使用情况集合,N为历史统计总数,MaxTs为历史最大第二时间长度,MinTs为历史最小第二时间长度。Wherein, Ts is the second time length, Sh is the historical usage set, Chu is the past historical time usage set, N is the total number of historical statistics, MaxTs is the historical maximum second time length, MinTs is the historical minimum second time length .
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
图1为本申请实施例中资源共享系统的结构示意图;FIG. 1 is a schematic structural diagram of a resource sharing system in an embodiment of the present application;
图2为本申请实施例一中资源分型方法的流程图;FIG. 2 is a flow chart of the resource classification method in Embodiment 1 of the present application;
图3为本申请实施例二中资源分型方法的流程图;FIG. 3 is a flow chart of the resource classification method in Embodiment 2 of the present application;
图4为本申请实施例三中资源分型方法的流程图;FIG. 4 is a flow chart of the resource classification method in Embodiment 3 of the present application;
图5为本申请实施例四中第一节点的结构示意图;。FIG. 5 is a schematic structural diagram of the first node in Embodiment 4 of the present application;
图6为本申请实施例五中资源网关的结构示意图;FIG. 6 is a schematic structural diagram of the resource gateway in Embodiment 5 of the present application;
图7为本申请实施例六中第二节点的结构示意图。FIG. 7 is a schematic structural diagram of a second node in Embodiment 6 of the present application.
具体实施方式Detailed ways
本申请实施例通过提供一种资源分享方法,解决了现有技术中由于使用UPnP AV架构下的协议实现各个电子设备之间资源分享,而造成电子设备不易实现较高的兼容性的技术问题。The embodiment of the present application provides a resource sharing method to solve the technical problem in the prior art that it is difficult for electronic devices to achieve high compatibility due to the use of protocols under the UPnP AV framework to realize resource sharing between electronic devices.
本申请实施例的技术方案为解决上述技术问题,总体思路如下:The technical solution of the embodiment of the present application is to solve the above-mentioned technical problems, and the general idea is as follows:
一种资源分享方法,包括:A resource sharing method, comprising:
在第一节点处于第一工作状态时,所述第一节点基于超文本传送协议HTTP1.1协议与资源网关建立第一通信;When the first node is in the first working state, the first node establishes a first communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol;
所述第一节点基于所述第一通信,向所述资源网关发送第一请求,所述第一请求用于向所述资源网关获取第二节点对应的第二节点相关信息;The first node sends a first request to the resource gateway based on the first communication, and the first request is used to obtain second node related information corresponding to the second node from the resource gateway;
所述第一节点基于所述第一通信,接收所述资源网关反馈的第一请求响应,并从所述第一请求响应中获取所述第二节点相关信息;The first node receives the first request response fed back by the resource gateway based on the first communication, and obtains the second node related information from the first request response;
所述第一节点基于所述第二节点相关信息,从所述第二节点获取第一资源。The first node acquires the first resource from the second node based on the second node related information.
由于,HTTP1.1(HTTP-Hypertext transfer protocol1.1,超文本传输协议1.1)是现在Internet(Internetwork,国际互联网)中标准的网页浏览协议,且大部分的设备都支持HTTP1.1协议。HTTP1.1协议不仅定义了文本数据的传输,同时也定义了流媒体数据的传输方式。从设备支持与协议支持角度出发,HTTP1.1完全胜任家庭网络数据传输的工作。从物理设备上出发,现在的智能设备基本都支持HTTP1.1协议;从协议功能上出发,HTTP1.1协议可以为家庭的流媒体数据传输提供基础。从设备支持与协议功能上可以看出,使用HTTP1.1协议比较使用UPnP AV架构下的协议有兼容性更高,实现成本更低的优势。Because HTTP1.1 (HTTP-Hypertext transfer protocol1.1, Hypertext Transfer Protocol 1.1) is the standard web browsing protocol in the Internet (Internetwork, Internet), and most devices support the HTTP1.1 protocol. The HTTP1.1 protocol not only defines the transmission of text data, but also defines the transmission mode of streaming media data. From the point of view of device support and protocol support, HTTP1.1 is fully qualified for home network data transmission. From the perspective of physical equipment, the current smart equipment basically supports the HTTP1.1 protocol; from the perspective of protocol functions, the HTTP1.1 protocol can provide the basis for streaming media data transmission at home. It can be seen from the device support and protocol functions that using the HTTP1.1 protocol has the advantages of higher compatibility and lower implementation costs than using the protocol under the UPnP AV architecture.
由上述技术方案可知,第一节点基于超文本传送协议HTTP1.1协议与资源网关建立第一通信,有效地解决了现有技术中由于使用UPnP AV架构下的协议实现各个电子设备之间资源分享,而造成电子设备不易实现较高的兼容性的技术问题,实现了在保证各个设备间的资源共享的前提下,各个电子设备更容易获得较高的兼容性,且实现成本较低的技术效果。It can be seen from the above technical solution that the first node establishes the first communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol, which effectively solves the problem of resource sharing between electronic devices due to the use of protocols under the UPnP AV framework in the prior art. , and the technical problem that it is difficult for electronic devices to achieve high compatibility, realizes that under the premise of ensuring the resource sharing among various devices, it is easier for each electronic device to obtain high compatibility, and realize the technical effect of lower cost .
为使本申请一实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solution and advantages of an embodiment of the application clearer, the technical solution in the embodiment of the application will be clearly and completely described below in conjunction with the drawings in the embodiment of the application. Obviously, the described implementation The examples are some of the embodiments of the present application, not all of them. All other embodiments obtained by persons of ordinary skill in the art based on the embodiments in this application without creative efforts fall within the protection scope of the present invention.
首先说明,本文中出现的术语“和/或”,仅仅是一种描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。另外,本文中字符“/”,一般表示前后关联对象是一种“或”的关系。First of all, the term "and/or" that appears in this article is just an association relationship that describes associated objects, which means that there can be three relationships, for example, A and/or B, which can mean: there is A alone, and A exists at the same time and B, there are three cases of B alone. In addition, the character "/" in this article generally indicates that the contextual objects are an "or" relationship.
其次说明,本文中出现的术语“第一节点”,可以是任一智能电子设备,该电子设备与资源网关通过有线(或无线)方式连接,通过与资源网关进行通信,可以获得与资源网关连接的第二节点所提供的(第一)资源。Secondly, the term "first node" appearing in this article can be any intelligent electronic device, which is connected to the resource gateway by wire (or wirelessly). By communicating with the resource gateway, it can obtain The (first) resource provided by the second node.
再次说明,本文中出现的术语“第二节点”,可以是任一智能电子设备,该电子设备与资源网关通过有线(或无线)方式连接,通过与资源网关进行通信,可以向第一节点提供(第一)资源。To explain again, the term "second node" in this article can be any intelligent electronic device, which is connected to the resource gateway in a wired (or wireless) manner, and can provide the first node by communicating with the resource gateway. (first) resources.
再次说明,本文中出现的术语“资源网关”,可以是任一智能电子设备,该电子设备通过有线(或无线)方式连接与多个第一节点或第二节点连接,用于控制第一节点和第二节点,实现将第二节点的(第一)资源分享给第一节点。To explain again, the term "resource gateway" in this article can be any intelligent electronic device, which is connected to multiple first nodes or second nodes through wired (or wireless) connection, and is used to control the first node and the second node, sharing the (first) resource of the second node with the first node.
再次说明,本文中出现的术语“第一资源”或“资源”,是指第二节点所具有的资源,该资源可以是数据或文件、也可以是某一特定的业务,例如:打印业务、大屏显示业务、邮件业务、卫星定位业务等等,对于该特定业务具体是何种业务,本申请实施例不做具体限制。To explain again, the term "first resource" or "resource" in this article refers to the resource owned by the second node. The resource can be data or files, or a specific service, such as: printing service, Large-screen display service, mail service, satellite positioning service, etc., as to the specific service of the specific service, this embodiment of the present application does not specifically limit it.
实施例一Embodiment one
本实施例提供一种资源分享方法,在介绍该资源分享方法之前,先对第一节点所在的资源分享系统进行如下介绍:This embodiment provides a resource sharing method. Before introducing the resource sharing method, the resource sharing system where the first node is located is introduced as follows:
如图1所示,图1中给出了一种资源分享系统,该系统包括第一节点、资源网关和第二节点,第一节点与第二节点通过有线(或无线)方式与资源网关连接。第一节点做为资源使用者,通过资源网关获得第二节点提供的(第一)资源;第二节点作为资源拥有者,通过资源网关向第一节点提供(第一)资源。资源网关作为资源分享的管理者,将多个(或一个)第一节点和多个(或一个)第二节点连接起来,构成如图1所示的资源分享系统。As shown in Figure 1, a resource sharing system is shown in Figure 1, the system includes a first node, a resource gateway and a second node, and the first node and the second node are connected to the resource gateway in a wired (or wireless) manner . As a resource user, the first node obtains (first) resources provided by the second node through the resource gateway; as a resource owner, the second node provides (first) resources to the first node through the resource gateway. As a resource sharing manager, the resource gateway connects multiple (or one) first nodes and multiple (or one) second nodes to form a resource sharing system as shown in FIG. 1 .
如图2所示,站在第一节点侧,本实施例提供一种资源分享方法,包括:As shown in Figure 2, standing on the side of the first node, this embodiment provides a resource sharing method, including:
步骤101:在第一节点处于第一工作状态时,第一节点基于超文本传送协议HTTP1.1协议与资源网关建立第一通信;Step 101: When the first node is in the first working state, the first node establishes a first communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol;
步骤102:第一节点基于第一通信,向资源网关发送第一请求,第一请求用于向资源网关获取第二节点对应的第二节点相关信息;Step 102: The first node sends a first request to the resource gateway based on the first communication, and the first request is used to obtain relevant information of the second node corresponding to the second node from the resource gateway;
步骤103:第一节点基于第一通信,接收资源网关反馈的第一请求响应,并从第一请求响应中获取第二节点相关信息;Step 103: Based on the first communication, the first node receives the first request response fed back by the resource gateway, and obtains relevant information of the second node from the first request response;
步骤104:第一节点基于第二节点相关信息,从第二节点获取第一资源。Step 104: The first node acquires the first resource from the second node based on the relevant information of the second node.
由于,HTTP1.1是现在Internet(Internetwork,国际互联网)中标准的网页浏览协议,且大部分的设备都支持HTTP1.1协议。HTTP1.1协议不仅定义了文本数据的传输,同时也定义了流媒体数据的传输方式。从设备支持与协议支持角度出发,HTTP1.1完全胜任家庭网络数据传输的工作。从物理设备上出发,现在的智能设备基本都支持HTTP1.1协议;从协议功能上出发,HTTP1.1协议可以为家庭的流媒体数据传输提供基础。从设备支持与协议功能上可以看出,使用HTTP1.1协议比较使用UPnP AV架构下的协议有兼容性更高,实现成本更低的优势。Because HTTP1.1 is the standard web browsing protocol in the Internet (Internetwork, Internet), and most devices support the HTTP1.1 protocol. The HTTP1.1 protocol not only defines the transmission of text data, but also defines the transmission mode of streaming media data. From the point of view of device support and protocol support, HTTP1.1 is fully qualified for home network data transmission. From the perspective of physical equipment, the current smart equipment basically supports the HTTP1.1 protocol; from the perspective of protocol functions, the HTTP1.1 protocol can provide the basis for streaming media data transmission at home. It can be seen from the device support and protocol functions that using the HTTP1.1 protocol has the advantages of higher compatibility and lower implementation costs than using the protocol under the UPnP AV architecture.
由上述技术方案可知,第一节点基于超文本传送协议HTTP1.1协议与资源网关建立第一通信,有效地解决了现有技术中由于使用UPnP AV架构下的协议实现各个电子设备之间资源分享,而造成电子设备不易实现较高的兼容性的技术问题,实现了在保证各个设备间的资源共享的前提下,各个电子设备更容易获得较高的兼容性,且实现成本较低的技术效果。It can be seen from the above technical solution that the first node establishes the first communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol, which effectively solves the problem of resource sharing between electronic devices due to the use of protocols under the UPnP AV framework in the prior art. , and the technical problem that it is difficult for electronic devices to achieve high compatibility, realizes that under the premise of ensuring the resource sharing among various devices, it is easier for each electronic device to obtain high compatibility, and realize the technical effect of lower cost .
可选的,第二节点相关信息,包括:Optionally, the second node related information includes:
第二节点处于第二工作状态的第一时间段;和/或The first period of time that the second node is in the second working state; and/or
第二节点处于第二休眠状态的第二时间段;a second period of time during which the second node is in a second dormant state;
其中,在第二节点处于第二工作状态时,第二节点的平均功耗为第一平均功耗;在第二节点处于第二休眠状态时,第二节点的平均功耗为第二平均功耗,第二平均功耗小于第一平均功耗。对于第一时间段和第二时间段具体是哪个时间段,本申请实施例不做具体限制。可见,第二节点在处于第二休眠状态时,要比处在第二工作状态时更加节能。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the average power consumption of the second node is the second average power consumption consumption, the second average power consumption is less than the first average power consumption. The specific time period between the first time period and the second time period is not specifically limited in this embodiment of the present application. It can be seen that when the second node is in the second sleep state, it is more energy efficient than when it is in the second working state.
可选的,步骤104,包括:Optionally, step 104 includes:
第一节点从第一请求响应中获取第一时间段、和/或第二时间段;The first node acquires the first time period and/or the second time period from the first request response;
在第一节点基于第一时间段、和/或第二时间段,确定第二节点当前处于第二工作状态时,第一节点基于第一通信,向资源网关发送用于获取第一资源的第二请求;When the first node determines that the second node is currently in the second working state based on the first time period and/or the second time period, the first node sends to the resource gateway the first resource gateway for obtaining the first resource based on the first communication. Two requests;
第一节点基于第一通信,接收资源网关反馈的第二请求响应,并从第二请求响应中获取第一资源。Based on the first communication, the first node receives the second request response fed back by the resource gateway, and acquires the first resource from the second request response.
在具体实施过程中,第一节点在确认当前时间属于第一时间段时,即可确定第二节点处于工作状态,此时,第一节点向资源网关发送第二请求,以实现从第二节点获取第一资源。In the specific implementation process, when the first node confirms that the current time belongs to the first time period, it can determine that the second node is in the working state. At this time, the first node sends a second request to the resource gateway to realize from the second node Get the first resource.
举例来讲,第一时间段为9时05分00秒~9时10分00秒;当前时间为9时6分10秒,第一节点通过判断得知,当前时间属于第一时间段,则确定第二节点当前处于工作状态,则向资源网关发送第二请求,以通过资源网关从第二节点获取第一资源。For example, the first time period is from 9:05:00 to 9:10:00; the current time is 9:6:10, and the first node knows through judgment that the current time belongs to the first time period, then If it is determined that the second node is currently in a working state, then a second request is sent to the resource gateway to obtain the first resource from the second node through the resource gateway.
可选的,步骤104,包括:Optionally, step 104 includes:
第一节点从第一请求响应中获取第一时间段、和/或第二时间段;The first node acquires the first time period and/or the second time period from the first request response;
在第一节点基于第一时间段、和/或第二时间段,确定第二节点当前处于第二休眠状态时,第一节点将第一工作状态调整为第一休眠状态;其中,在第一节点处于第一工作状态时,第一节点的平均功耗为第三平均功耗;在第一节点处于第一休眠状态时,第一节点的平均功耗为第四平均功耗,第四平均功耗小于第三平均功耗;When the first node determines that the second node is currently in the second dormant state based on the first time period and/or the second time period, the first node adjusts the first working state to the first dormant state; wherein, in the first When the node is in the first working state, the average power consumption of the first node is the third average power consumption; when the first node is in the first sleep state, the average power consumption of the first node is the fourth average power consumption, the fourth average power consumption The power consumption is less than the third average power consumption;
在当前时间为第一时间段的起始时间时,第一节点将第一休眠状态调整为第一工作状态;When the current time is the start time of the first time period, the first node adjusts the first sleep state to the first working state;
第一节点基于第一通信,向资源网关发送用于获取第一资源的第二请求;The first node sends a second request for acquiring the first resource to the resource gateway based on the first communication;
第一节点基于第一通信,接收资源网关反馈的第二请求响应,并从第二请求响应中获取第一资源。Based on the first communication, the first node receives the second request response fed back by the resource gateway, and acquires the first resource from the second request response.
举例来讲,第二时间段为9时00分00秒~9时4分59秒,第一时间段为9时05分00秒~9时09分59秒;当前时间为9时2分10秒,第一节点通过判断得知,当前时间属于第二时间段,则确定第二节点当前处于休眠状态,此时,第一节点也将自己调整为休眠状态,待第一时间段到来时,再由休眠状态进入工作状态,并向资源网关发送用于获取第一资源的第二请求,以获取第一资源。For example, the second time period is from 9:00:00 to 9:4:59, the first time period is from 9:05:00 to 9:09:59; the current time is 9:02:10 Seconds, the first node judges that the current time belongs to the second time period, and then determines that the second node is currently in a dormant state. At this time, the first node also adjusts itself to a dormant state. When the first time period arrives, Then enter the working state from the dormant state, and send a second request for obtaining the first resource to the resource gateway, so as to obtain the first resource.
由上述技术方案可知,在第一节点确认第二节点当前处于休眠状态时,第一节点也进入休眠状态,待第二节点由休眠状态进入工作状态时,第一节点再进入工作状态,向资源网关发送第二请求以获得第一资源,从而实现节约第一节点的电能的技术效果。It can be seen from the above technical solution that when the first node confirms that the second node is currently in the dormant state, the first node also enters the dormant state, and when the second node enters the working state from the dormant state, the first node enters the working state again and sends resources The gateway sends the second request to obtain the first resource, thereby realizing the technical effect of saving the electric energy of the first node.
实施例二Embodiment two
如图3所示,站在资源网关点侧,本实施例提供一种资源分享方法,包括:As shown in Figure 3, standing on the resource gateway side, this embodiment provides a resource sharing method, including:
步骤201:在资源网关处于工作状态时,资源网关基于超文本传送协议HTTP1.1协议与第一节点建立第一通信;Step 201: When the resource gateway is in the working state, the resource gateway establishes a first communication with the first node based on the hypertext transfer protocol HTTP1.1 protocol;
步骤202:资源网关基于第一通信,接收第一节点发送的第一请求,第一请求用于向资源网关获取第二节点对应的第二节点相关信息;Step 202: The resource gateway receives the first request sent by the first node based on the first communication, and the first request is used to obtain the second node-related information corresponding to the second node from the resource gateway;
步骤203:资源网关基于第一通信,向第一节点发送包含相关信息的第一请求响应,以使第一节点能够基于第二节点相关信息从第二节点获取第一资源。Step 203: Based on the first communication, the resource gateway sends a first request response containing related information to the first node, so that the first node can obtain the first resource from the second node based on the related information of the second node.
由于,HTTP1.1(HTTP-Hypertext transfer protocol1.1,超文本传输协议1.1)是现在Internet(Internetwork,国际互联网)中标准的网页浏览协议,且大部分的设备都支持HTTP1.1协议。HTTP1.1协议不仅定义了文本数据的传输,同时也定义了流媒体数据的传输方式。从设备支持与协议支持角度出发,HTTP1.1完全胜任家庭网络数据传输的工作。从物理设备上出发,现在的智能设备基本都支持HTTP1.1协议;从协议功能上出发,HTTP1.1协议可以为家庭的流媒体数据传输提供基础。从设备支持与协议功能上可以看出,使用HTTP1.1协议比较使用UPnP AV架构下的协议有兼容性更高,实现成本更低的优势。Because HTTP1.1 (HTTP-Hypertext transfer protocol1.1, Hypertext Transfer Protocol 1.1) is the standard web browsing protocol in the Internet (Internetwork, Internet), and most devices support the HTTP1.1 protocol. The HTTP1.1 protocol not only defines the transmission of text data, but also defines the transmission mode of streaming media data. From the point of view of device support and protocol support, HTTP1.1 is fully qualified for home network data transmission. From the perspective of physical equipment, the current smart equipment basically supports the HTTP1.1 protocol; from the perspective of protocol functions, the HTTP1.1 protocol can provide the basis for streaming media data transmission at home. It can be seen from the device support and protocol functions that using the HTTP1.1 protocol has the advantages of higher compatibility and lower implementation costs than using the protocol under the UPnP AV architecture.
由上述技术方案可知,资源网关基于超文本传送协议HTTP1.1协议与第一节点建立第一通信,有效地解决了现有技术中由于使用UPnP AV架构下的协议实现各个电子设备之间资源分享,而造成电子设备不易实现较高的兼容性的技术问题,实现了在保证各个设备间的资源共享的前提下,各个电子设备更容易获得较高的兼容性,且实现成本较低的技术效果。It can be seen from the above technical solution that the resource gateway establishes the first communication with the first node based on the hypertext transfer protocol HTTP1.1 protocol, which effectively solves the problem of resource sharing between electronic devices due to the use of protocols under the UPnP AV framework in the prior art. , and the technical problem that it is difficult for electronic devices to achieve high compatibility, realizes that under the premise of ensuring the resource sharing among various devices, it is easier for each electronic device to obtain high compatibility, and realize the technical effect of lower cost .
可选的,在步骤202之前,该方法还包括:Optionally, before step 202, the method also includes:
资源网关基于超文本传送协议HTTP1.1协议与第二节点建立第二通信;The resource gateway establishes a second communication with the second node based on the Hypertext Transfer Protocol HTTP1.1 protocol;
资源网关基于第二通信,接收第二节点发送的第二节点相关信息。Based on the second communication, the resource gateway receives the second node related information sent by the second node.
可选的,第二节点相关信息,包括:Optionally, the information about the second node includes:
第二节点处于第二工作状态的第一时间段;和/或The first period of time that the second node is in the second working state; and/or
第二节点处于第二休眠状态的第二时间段;a second period of time during which the second node is in a second dormant state;
其中,在第二节点处于第二工作状态时,第二节点的平均功耗为第一平均功耗;在第二节点处于第二休眠状态时,第二节点的平均功耗为第二平均功耗,第二平均功耗小于第一平均功耗。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the average power consumption of the second node is the second average power consumption consumption, the second average power consumption is less than the first average power consumption.
可选的,在步骤203之后,该方法还包括:Optionally, after step 203, the method further includes:
资源网关基于第一通信,接收第一节点发送的用于获取第一资源的第二请求;The resource gateway receives a second request for acquiring the first resource sent by the first node based on the first communication;
资源网关基于第二通信,将第二请求发送给第二节点;The resource gateway sends the second request to the second node based on the second communication;
资源网关基于第二通信,接收第二节点反馈的包含第一资源的第二请求响应;The resource gateway receives, based on the second communication, a second request response containing the first resource fed back by the second node;
资源网关基于第一通信,将第二请求响应发送给第一节点。The resource gateway sends the second request response to the first node based on the first communication.
由上述技术方案可知,第一节点与第二节点的往来通信均通过资源网关进行转达,从而实现了通过资源网关对第一节点和第二节点进行数据监控的技术效果。It can be seen from the above technical solution that the communication between the first node and the second node is conveyed through the resource gateway, thereby realizing the technical effect of data monitoring of the first node and the second node through the resource gateway.
可选的,资源网关始终保持工作状态。Optionally, the resource gateway always keeps working.
由上述技术方案可知,由于资源网关始终处于工作状态,使得对于第一节点任意时刻发出的第一请求,都能进行及时地做出响应,从而这保证了资源网关的QoS(Qualityof Service,服务质量)。It can be seen from the above technical solution that since the resource gateway is always in the working state, it can respond in time to the first request sent by the first node at any time, thus ensuring the QoS (Quality of Service, quality of service) of the resource gateway. ).
实施例三Embodiment three
如图4所示,站在第二节点侧,本实施例提供一种资源分享方法,包括:As shown in FIG. 4, standing on the side of the second node, this embodiment provides a resource sharing method, including:
步骤301:在第二节点处于第二工作状态时,第二节点基于超文本传送协议HTTP1.1协议与资源网关建立第二通信;Step 301: When the second node is in the second working state, the second node establishes a second communication with the resource gateway based on the Hypertext Transfer Protocol HTTP1.1 protocol;
步骤302:第二节点基于第二通信,向资源网关发送第二节点相关信息,以使第一节点能够从资源网关获取第二节点相关信息,并基于第二节点相关信息从第二节点获取第一资源。Step 302: The second node sends related information of the second node to the resource gateway based on the second communication, so that the first node can obtain the related information of the second node from the resource gateway, and obtain the related information of the second node from the second node based on the related information of the second node. a resource.
由于,HTTP1.1(HTTP-Hypertext transfer protocol1.1,超文本传输协议1.1)是现在Internet(Internetwork,国际互联网)中标准的网页浏览协议,且大部分的设备都支持HTTP1.1协议。HTTP1.1协议不仅定义了文本数据的传输,同时也定义了流媒体数据的传输方式。从设备支持与协议支持角度出发,HTTP1.1完全胜任家庭网络数据传输的工作。从物理设备上出发,现在的智能设备基本都支持HTTP1.1协议;从协议功能上出发,HTTP1.1协议可以为家庭的流媒体数据传输提供基础。从设备支持与协议功能上可以看出,使用HTTP1.1协议比较使用UPnP AV架构下的协议有兼容性更高,实现成本更低的优势。Because HTTP1.1 (HTTP-Hypertext transfer protocol1.1, Hypertext Transfer Protocol 1.1) is the standard web browsing protocol in the Internet (Internetwork, Internet), and most devices support the HTTP1.1 protocol. The HTTP1.1 protocol not only defines the transmission of text data, but also defines the transmission mode of streaming media data. From the point of view of device support and protocol support, HTTP1.1 is fully qualified for home network data transmission. From the perspective of physical equipment, the current smart equipment basically supports the HTTP1.1 protocol; from the perspective of protocol functions, the HTTP1.1 protocol can provide the basis for streaming media data transmission at home. It can be seen from the device support and protocol functions that using the HTTP1.1 protocol has the advantages of higher compatibility and lower implementation costs than using the protocol under the UPnP AV architecture.
由上述技术方案可知,第二节点基于超文本传送协议HTTP1.1协议与资源网关建立第二通信,有效地解决了现有技术中由于使用UPnP AV架构下的协议实现各个电子设备之间资源分享,而造成电子设备不易实现较高的兼容性的技术问题,实现了在保证各个设备间的资源共享的前提下,各个电子设备更容易获得较高的兼容性,且实现成本较低的技术效果。It can be seen from the above technical solution that the second node establishes the second communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol, which effectively solves the problem of resource sharing between electronic devices due to the use of protocols under the UPnP AV framework in the prior art. , and the technical problem that it is difficult for electronic devices to achieve high compatibility, realizes that under the premise of ensuring the resource sharing among various devices, it is easier for each electronic device to obtain high compatibility, and realize the technical effect of lower cost .
可选的,在步骤302之后,该方法还包括:Optionally, after step 302, the method further includes:
第二节点接收资源网关发送的第二请求,第二请求为第一节点获取第二节点的第一资源的请求;The second node receives a second request sent by the resource gateway, and the second request is a request for the first node to obtain the first resource of the second node;
第二节点基于第二通信,向资源网关发送包含第一资源的第二请求响应。The second node sends a second request response including the first resource to the resource gateway based on the second communication.
可选的,在步骤302之前,该方法还包括:Optionally, before step 302, the method further includes:
第二节点确定处于第二工作状态的第一时间长度;the second node determines a first length of time in the second operating state;
第二节点确定处于第二休眠状态的第二时间长度;the second node determines a second length of time in the second dormant state;
其中,在第二节点处于第二工作状态时,第二节点的平均功耗为第一平均功耗;在第二节点处于第二休眠状态时,第二节点的平均功耗为第二平均功耗,第二平均功耗小于第一平均功耗,且第二节点无法接收第二请求。对于第一时间长度和第二时间长度,此处不做具体限制。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the average power consumption of the second node is the second average power consumption The second average power consumption is less than the first average power consumption, and the second node cannot receive the second request. For the first time length and the second time length, there is no specific limitation here.
可选的,在步骤302之前,该方法还包括:Optionally, before step 302, the method further includes:
第二节点基于当前时间、第一时间长度和第二时间长度,确定第二节点处于第二工作状态的第一时间段,第一时间段位于当前时间之后;The second node determines a first time period during which the second node is in a second working state based on the current time, the first time length, and the second time length, and the first time period is after the current time;
第二节点基于当前时间、第一时间长度和第二时间长度,确定第二节点处于第二休眠状态的第二时间段,第二时间段位于当前时间之后,且与第一时间段无重叠;The second node determines a second time period during which the second node is in the second dormant state based on the current time, the first time length, and the second time length, and the second time period is located after the current time and does not overlap with the first time period;
第二节点基于第一时间段和第二时间段,生成第二节点相关信息;The second node generates second node related information based on the first time period and the second time period;
第二节点通过第二通信,将第二节点相关信息发送给资源网关。The second node sends the related information of the second node to the resource gateway through the second communication.
举例说明:在确认第一时间长度为5分钟,第二时间长度为4分钟,当前时间为9时00分00秒时,可以确定第二时间段为:9时00分00秒~9时4分59秒;可以确定第一时间段为:9时05分00秒~9时8分59秒。Example: After confirming that the first time period is 5 minutes, the second time period is 4 minutes, and the current time is 9:00:00, the second time period can be determined as: 9:00:00 to 9:4 minutes and 59 seconds; the first time period can be determined as: 9:05:00 to 9:08:59.
可选的,该方法还包括:Optionally, the method also includes:
在当前时间处于第二时间段内时,第二节点调整第二工作状态为第二休眠状态;When the current time is within the second time period, the second node adjusts the second working state to the second sleep state;
在当前时间处于第一时间段内时,第二节点调整第二休眠状态为第二工作状态。When the current time is within the first time period, the second node adjusts the second sleep state to the second working state.
由上述技术方案可知,第二节点能够在第一时间段处于工作状态,而在第二时间段处于休眠状态。由于第二节点具有间歇式的工作方式,相比于持续的工作方式,具有间歇式的工作方式的第二节点更加节能。从而实现了节约第二节点的电能的技术效果。It can be known from the above technical solution that the second node can be in the working state during the first time period and be in the dormant state during the second time period. Since the second node has an intermittent working mode, compared with a continuous working mode, the second node having an intermittent working mode is more energy-efficient. Therefore, the technical effect of saving the electric energy of the second node is realized.
可选的,第二节点基于公式(1),确定第一时间长度:Optionally, the second node determines the first time length based on formula (1):
其中,Ti为第一时间长度,Sh为历史使用情况集合,Chu为历史时刻使用情况集合,N为历史统计总数,MaxTi为历史最大第一时间长度,MinTi为历史最小第一时间长度。Among them, Ti is the first time length, Sh is the set of historical usage, Chu is the set of historical usage, N is the total number of historical statistics, MaxTi is the largest first time length in history, and MinTi is the smallest first time length in history.
可选的,第二节点基于公式(2),确定第二时间长度:Optionally, the second node determines the second time length based on formula (2):
其中,Ts为第二时间长度,Sh为历史使用情况集合,Chu为过去历史时刻使用情况集合,N为历史统计总数,MaxTs为历史最大第二时间长度,MinTs为历史最小第二时间长度。Among them, Ts is the second time length, Sh is the set of historical usage, Chu is the set of past historical moments, N is the total number of historical statistics, MaxTs is the largest second time length in history, and MinTs is the smallest second time length in history.
此处,对于公式(1)和(2)进行说明:因为在人们的日常生活中,设备并非一直处于使用状态,很多时间中都是处于空闲状态,使用统计学习理论中的小样本统计方法,通过对服务请求的采样,统计请求其固定时间内的请求频次,也就是采集设备活动的时间,可以得到其活动的频繁制度与时间的对应关系,使用二维函数进行回归分析,可以得出一个近似的求解函数,通过此函数可以大概预测设置应该在何时处于活动状态,何时处于空闲状态,当判断出所处状态后可以设定Ts与Ti时长,在不同的状态下Ts与Ti是一固定值,活动状态时Ts会变小Ti会变大,空闲状态时Ts会变大,Ti会变小。考虑到突发状态导致预测结果不准确,在使用函数拟合同时,还会对短时间内的活动情况进行监听,若与预测状态不符合,及时修改设备状态,提高服务质量。Here, formulas (1) and (2) are explained: because in people's daily life, the equipment is not always in use, and it is idle for a lot of time, using the small sample statistical method in statistical learning theory, By sampling service requests and counting the frequency of requests within a fixed time period, that is, the time of collecting device activities, the corresponding relationship between the frequent system of its activities and time can be obtained, and a two-dimensional function can be used for regression analysis to obtain a Approximate solution function, through this function, you can roughly predict when the setting should be in the active state and when it should be in the idle state. After judging the state, you can set the duration of Ts and Ti. In different states, Ts and Ti are the same Fixed value, Ts will be smaller and Ti will be larger in active state, Ts will be larger and Ti will be smaller in idle state. Considering that the prediction results are inaccurate due to the unexpected state, while using the function fitting, it will also monitor the activities in a short period of time. If it does not match the predicted state, modify the device state in time to improve the service quality.
实施例四Embodiment four
如图5所示,本实施例提供一种第一节点,包括:As shown in Figure 5, this embodiment provides a first node, including:
第一建立单元401,用于在第一节点处于第一工作状态时,基于超文本传送协议HTTP1.1协议与资源网关建立第一通信;The first establishment unit 401 is configured to establish a first communication with the resource gateway based on the Hypertext Transfer Protocol HTTP1.1 protocol when the first node is in the first working state;
第一发送单元402,用于基于第一通信,向资源网关发送第一请求,第一请求用于向资源网关获取第二节点对应的第二节点相关信息;The first sending unit 402 is configured to send a first request to the resource gateway based on the first communication, where the first request is used to obtain from the resource gateway related information about the second node corresponding to the second node;
第一接收单元403,用于基于第一通信,接收资源网关反馈的第一请求响应,并从第一请求响应中获取第二节点相关信息;The first receiving unit 403 is configured to receive the first request response fed back by the resource gateway based on the first communication, and acquire second node related information from the first request response;
第一获取单元404,用于基于第二节点相关信息,从第二节点获取第一资源。The first obtaining unit 404 is configured to obtain the first resource from the second node based on the relevant information of the second node.
可选的,第二节点相关信息,包括:Optionally, the second node related information includes:
第二节点处于第二工作状态的第一时间段;和/或The first period of time that the second node is in the second working state; and/or
第二节点处于第二休眠状态的第二时间段;a second period of time during which the second node is in a second dormant state;
其中,在第二节点处于第二工作状态时,第二节点的平均功耗为第一平均功耗;在第二节点处于第二休眠状态时,第二节点的平均功耗为第二平均功耗,第二平均功耗小于第一平均功耗。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the average power consumption of the second node is the second average power consumption consumption, the second average power consumption is less than the first average power consumption.
可选的,第一获取单元404,包括:Optionally, the first acquiring unit 404 includes:
第一获取模块,用于从第一请求响应中获取第一时间段、和/或第二时间段;A first obtaining module, configured to obtain the first time period and/or the second time period from the first request response;
第一发送模块,用于在基于第一时间段、和/或第二时间段,确定第二节点当前处于第二工作状态时,基于第一通信,向资源网关发送用于获取第一资源的第二请求;The first sending module is configured to, when it is determined based on the first time period and/or the second time period that the second node is currently in the second working state, based on the first communication, send the information for acquiring the first resource to the resource gateway second request;
第一接收模块,用于基于第一通信,接收资源网关反馈的第二请求响应,并从第二请求响应中获取第一资源。The first receiving module is configured to receive the second request response fed back by the resource gateway based on the first communication, and obtain the first resource from the second request response.
可选的,第一获取单元404,包括:Optionally, the first acquiring unit 404 includes:
第二获取模块,用于从第一请求响应中获取第一时间段、和/或第二时间段;A second obtaining module, configured to obtain the first time period and/or the second time period from the first request response;
第一调整模块,用于在基于第一时间段、和/或第二时间段,确定第二节点当前处于第二休眠状态时,将第一工作状态调整为第一休眠状态;其中,在第一节点处于第一工作状态时,第一节点的平均功耗为第三平均功耗;在第一节点处于第一休眠状态时,第一节点的平均功耗为第四平均功耗,第四平均功耗小于第三平均功耗;The first adjustment module is configured to adjust the first working state to the first dormant state when it is determined that the second node is currently in the second dormant state based on the first time period and/or the second time period; wherein, at the When a node is in the first working state, the average power consumption of the first node is the third average power consumption; when the first node is in the first sleep state, the average power consumption of the first node is the fourth average power consumption, the fourth The average power consumption is less than the third average power consumption;
第二调整模块,用于在当前时间为第一时间段的起始时间时,将第一休眠状态调整为第一工作状态;The second adjustment module is configured to adjust the first sleep state to the first working state when the current time is the start time of the first time period;
第二发送模块,用于基于第一通信,向资源网关发送用于获取第一资源的第二请求;The second sending module is configured to send a second request for acquiring the first resource to the resource gateway based on the first communication;
第二接收模块,用于基于第一通信,接收资源网关反馈的第二请求响应,并从第二请求响应中获取第一资源。The second receiving module is configured to receive the second request response fed back by the resource gateway based on the first communication, and obtain the first resource from the second request response.
实施例五Embodiment five
如图6所示,本实施例提供一种资源网关,包括:As shown in Figure 6, this embodiment provides a resource gateway, including:
第二建立单元501,用于在资源网关处于工作状态时,基于超文本传送协议HTTP1.1协议与第一节点建立第一通信;The second establishment unit 501 is configured to establish a first communication with the first node based on the hypertext transfer protocol HTTP1.1 protocol when the resource gateway is in the working state;
第二接收单元502,用于基于第一通信,接收第一节点发送的第一请求,第一请求用于向资源网关获取第二节点对应的第二节点相关信息;The second receiving unit 502 is configured to receive a first request sent by the first node based on the first communication, and the first request is used to obtain second node related information corresponding to the second node from the resource gateway;
第二发送单元503,用于基于第一通信,向第一节点发送包含第二节点相关信息的第一请求响应,以使第一节点能够基于第二节点相关信息从第二节点获取第一资源。The second sending unit 503 is configured to send to the first node a first request response containing information about the second node based on the first communication, so that the first node can obtain the first resource from the second node based on the information about the second node .
可选的,资源网关还包括:Optionally, the resource gateway also includes:
第三建立单元,用于在资源网关基于第一通信,接收第一节点发送的第一请求之前,基于超文本传送协议HTTP1.1协议与第二节点建立第二通信;A third establishing unit, configured to establish a second communication with the second node based on the Hypertext Transfer Protocol HTTP1.1 protocol before the resource gateway receives the first request sent by the first node based on the first communication;
第三接收单元,用于基于第二通信,接收第二节点发送的第二节点相关信息。The third receiving unit is configured to receive the second node related information sent by the second node based on the second communication.
可选的,第二节点相关信息,包括:Optionally, the information about the second node includes:
第二节点处于第二工作状态的第一时间段;和/或The first period of time that the second node is in the second working state; and/or
第二节点处于第二休眠状态的第二时间段;a second period of time during which the second node is in a second dormant state;
其中,在第二节点处于第二工作状态时,第二节点的平均功耗为第一平均功耗;在第二节点处于第二休眠状态时,第二节点的平均功耗为第二平均功耗,第二平均功耗小于第一平均功耗。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the average power consumption of the second node is the second average power consumption consumption, the second average power consumption is less than the first average power consumption.
可选的,资源网关还包括:Optionally, the resource gateway also includes:
第四接收单元,用于在资源网关基于第一通信,向第一节点发送包含第二节点相关信息的第一请求响应之后,基于第一通信,接收第一节点发送的用于获取第一资源的第二请求;The fourth receiving unit is configured to, after the resource gateway sends the first request response containing the relevant information of the second node to the first node based on the first communication, based on the first communication, receive the request for obtaining the first resource sent by the first node. the second request of
第三发送单元,用于基于第二通信,将第二请求发送给第二节点;a third sending unit, configured to send the second request to the second node based on the second communication;
第五接收单元,用于基于第二通信,接收第二节点反馈的包含第一资源的第二请求响应;A fifth receiving unit, configured to receive, based on the second communication, a second request response that includes the first resource fed back by the second node;
第四发送单元,用于基于第一通信,将第二请求响应发送给第一节点。A fourth sending unit, configured to send the second request response to the first node based on the first communication.
可选的,所述资源网关还包括:Optionally, the resource gateway further includes:
保持单元,用于始终保持工作状态。Hold unit, used to keep working status all the time.
实施例六Embodiment six
如图7所示,本实施例提供一种第二节点,包括:As shown in FIG. 7, this embodiment provides a second node, including:
第四建立单元601,用于在第二节点处于第二工作状态时,基于超文本传送协议HTTP1.1协议与资源网关建立第二通信;The fourth establishment unit 601 is configured to establish a second communication with the resource gateway based on the hypertext transfer protocol HTTP1.1 protocol when the second node is in the second working state;
第五发送单元602,用于基于第二通信,向资源网关发送第二节点相关信息,以使第一节点能够从资源网关获取第二节点相关信息,并基于第二节点相关信息从第二节点获取第一资源。The fifth sending unit 602 is configured to send related information of the second node to the resource gateway based on the second communication, so that the first node can obtain the related information of the second node from the resource gateway, and obtain the related information of the second node from the second node based on the related information of the second node. Get the first resource.
可选的,第二节点还包括:Optionally, the second node also includes:
第六接收单元,用于在基于第二通信,向资源网关发送第二节点相关信息之后,接收资源网关发送的第二请求,第二请求为第一节点获取第二节点的第一资源的请求;The sixth receiving unit is configured to receive the second request sent by the resource gateway after sending the second node-related information to the resource gateway based on the second communication, where the second request is a request for the first node to obtain the first resource of the second node ;
第六发送单元,用于基于第二通信,向资源网关发送包含第一资源的第二请求响应。A sixth sending unit, configured to send a second request response containing the first resource to the resource gateway based on the second communication.
可选的,第二节点还包括:Optionally, the second node also includes:
第一确定单元,用于在第二节点基于第二通信,向资源网关发送第二节点相关信息之前,确定处于第二工作状态的第一时间长度;The first determining unit is configured to determine the first length of time in the second working state before the second node sends related information of the second node to the resource gateway based on the second communication;
第二确定单元,用于确定处于第二休眠状态的第二时间长度;a second determining unit, configured to determine a second time length in the second dormant state;
其中,在第二节点处于第二工作状态时,第二节点的平均功耗为第一平均功耗;在第二节点处于第二休眠状态时,第二节点的平均功耗为第二平均功耗,第二平均功耗小于第一平均功耗,且第二节点无法接收第二请求。Wherein, when the second node is in the second working state, the average power consumption of the second node is the first average power consumption; when the second node is in the second sleep state, the average power consumption of the second node is the second average power consumption The second average power consumption is less than the first average power consumption, and the second node cannot receive the second request.
可选的,第二节点还包括:Optionally, the second node also includes:
第三确定单元,用于基于当前时间、第一时间长度和第二时间长度,确定第二节点处于第二工作状态的第一时间段;A third determining unit, configured to determine a first time period during which the second node is in the second working state based on the current time, the first time length, and the second time length;
第四确定单元,用于基于当前时间、第一时间长度和第二时间长度,确定第二节点处于第二休眠状态的第二时间段;A fourth determining unit, configured to determine a second time period during which the second node is in the second dormant state based on the current time, the first time length, and the second time length;
第一生成单元,用于基于第一时间段和第二时间段,生成第二节点相关信息;A first generating unit, configured to generate second node related information based on the first time period and the second time period;
第七发送单元,用于通过第二通信,将第二节点相关信息发送给资源网关。The seventh sending unit is configured to send the related information of the second node to the resource gateway through the second communication.
可选的,第二节点还包括:Optionally, the second node also includes:
第一调整单元,用于在当前时间处于第二时间段内时,调整第二工作状态为第二休眠状态;The first adjustment unit is configured to adjust the second working state to the second sleep state when the current time is within the second time period;
第二调整单元,用于在当前时间处于第一时间段内时,调整第二休眠状态为第二工作状态。The second adjusting unit is configured to adjust the second sleep state to the second working state when the current time is within the first time period.
可选的,第一确定单元基于如下公式,确定第一时间长度:Optionally, the first determining unit determines the first time length based on the following formula:
其中,Ti为第一时间长度,Sh为历史使用情况集合,Chu为历史时刻使用情况集合,N为历史统计总数,MaxTi为历史最大第一时间长度,MinTi为历史最小第一时间长度。Among them, Ti is the first time length, Sh is the set of historical usage, Chu is the set of historical usage, N is the total number of historical statistics, MaxTi is the largest first time length in history, and MinTi is the smallest first time length in history.
可选的,第二确定单元基于如下公式,确定第二时间长度:Optionally, the second determining unit determines the second time length based on the following formula:
其中,Ts为第二时间长度,Sh为历史使用情况集合,Chu为过去历史时刻使用情况集合,N为历史统计总数,MaxTs为历史最大第二时间长度,MinTs为历史最小第二时间长度。Wherein, Ts is the second time length, Sh is the historical use case set, Chu is the past historical time use case set, N is the total number of historical statistics, MaxTs is the historical maximum second time length, and MinTs is the historical minimum second time length.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and combinations of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a Means for realizing the functions specified in one or more steps of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart flow or flows and/or block diagram block or blocks.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。While preferred embodiments of the invention have been described, additional changes and modifications to these embodiments can be made by those skilled in the art once the basic inventive concept is appreciated. Therefore, it is intended that the appended claims be construed to cover the preferred embodiment as well as all changes and modifications which fall within the scope of the invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention also intends to include these modifications and variations.
Claims (26)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410094877.1A CN104917799B (en) | 2014-03-13 | 2014-03-13 | A kind of resource sharing method, resource gateway, first node and second node |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410094877.1A CN104917799B (en) | 2014-03-13 | 2014-03-13 | A kind of resource sharing method, resource gateway, first node and second node |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN104917799A CN104917799A (en) | 2015-09-16 |
| CN104917799B true CN104917799B (en) | 2018-12-07 |
Family
ID=54086500
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201410094877.1A Active CN104917799B (en) | 2014-03-13 | 2014-03-13 | A kind of resource sharing method, resource gateway, first node and second node |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN104917799B (en) |
Family Cites Families (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US7213071B2 (en) * | 2001-04-03 | 2007-05-01 | International Business Machines Corporation | Quality of service improvements for network transactions |
| AU2003247842A1 (en) * | 2002-06-27 | 2004-01-19 | Axeda Systems Operating Company, Inc. | Screen sharing |
| CN101360075B (en) * | 2008-09-12 | 2011-02-09 | 华为技术有限公司 | Grouped gateway and method for saving power consumption |
| CN102186164B (en) * | 2011-02-18 | 2014-04-02 | 华为技术有限公司 | Method and management device for operating device resource |
| KR20130118961A (en) * | 2011-02-24 | 2013-10-30 | 닛본 덴끼 가부시끼가이샤 | Sleeping core network nodes for energy saving in 3g networks |
| CN103179099B (en) * | 2011-12-23 | 2016-04-06 | 北京新媒传信科技有限公司 | A kind ofly access the uniform authentication method of open website platform and a kind of website platform |
| CN103179210B (en) * | 2013-03-26 | 2016-04-13 | 太原罗克佳华工业有限公司 | The Internet of Things high in the clouds cut-in method of a kind of sing on web Service and system |
| CN103491172B (en) * | 2013-09-25 | 2017-11-03 | 深圳Tcl新技术有限公司 | Cloud sharing files method and system |
-
2014
- 2014-03-13 CN CN201410094877.1A patent/CN104917799B/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| CN104917799A (en) | 2015-09-16 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111048086B (en) | Voice wake-up method among multiple devices, and auto-negotiation voice wake-up method, device and system | |
| Zhou et al. | Cloudthings: A common architecture for integrating the internet of things with cloud computing | |
| JP6226348B2 (en) | Method for transmitting heartbeat message and portable terminal | |
| CN106659389B (en) | Method and system for reducing energy consumption of heart rate monitor | |
| US20180159746A1 (en) | Network node availability prediction based on past history data | |
| US20120188928A1 (en) | Method for maintaining connection between terminal and network server, terminal and network server | |
| CN106464543A (en) | Method and apparatus for radio resource control in mobile network | |
| WO2019024931A1 (en) | Power-saving processing method and apparatus, terminal device and computer-readable storage medium | |
| EP4369776A1 (en) | Computing power information acquiring method and related device | |
| CN103916879A (en) | Equipment discovery method, apparatus and system | |
| TW201010488A (en) | Methods and apparatus for scanning for mesh nodes | |
| CN107749797A (en) | Awakening mode management | |
| CN101489294A (en) | Method, router and network appliance for regulating power | |
| CN105897813A (en) | Heartbeat message sending method, heartbeat message receiving method, heartbeat message sending device and heartbeat message receiving device | |
| CN108173709B (en) | Keep-alive long connection method, device, terminal equipment and storage medium | |
| CN108650142A (en) | The control method and device of multiple gateway equipment in intelligent domestic system | |
| CN105703982A (en) | Method and device cooperating with human body equipment for communication | |
| JP2015521824A5 (en) | ||
| CN106610832B (en) | Page asynchronous rendering method and device | |
| CN105094944B (en) | A kind of virtual machine migration method and device | |
| CN102685815A (en) | Wireless network equipment and bandwidth sharing method thereof | |
| CN104917799B (en) | A kind of resource sharing method, resource gateway, first node and second node | |
| CN106686635B (en) | Data transmission method and device based on control and configuration protocol of wireless access point | |
| CN102137158A (en) | Method for sharing information equipment resources by utilizing equipment agent system | |
| CN106921710B (en) | Crowd sensing method and device |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |