Background
With the development of the internet of things and digital home technology, more and more intelligent devices enter a home, the scenes of the home are more and more, under most conditions, one user home can introduce one optical fiber and install one intelligent home gateway, but under some conditions, for example, in large shopping malls, villas and the like, in order to realize the comprehensive coverage of a plurality of intelligent devices in a certain area, a plurality of optical fibers are required to be introduced in the certain area to set a plurality of gateways, in the prior art, the intelligent devices hung under a single gateway can generally realize the control of scene linkage, however, as a plurality of gateways are arranged in the certain area, linkage is required among the intelligent devices under different gateways. In the prior art, scene linkage is generally executed by using a cloud terminal. Namely, the user configures the linkage scheme among different intelligent devices through the APP, the cloud platform generates the rule template for the scheme of the user after the configuration is finished, when the user triggers a certain event, the cloud platform judges whether the rule meets the triggering condition through the rule engine, and then the cloud generates a series of control instructions to be issued to the devices, so that the execution of the whole linkage scene is completed. If the scheme is configured properly, the device linkage between the cross gateways and the cross local area networks can be completed.
However, the inventor of the present invention finds that, in the prior art, when the gateways perform the linkage, data calculation needs to be performed by means of the cloud, and the linkage rule determination logic using the cloud as a center can complete the linkage between the devices of different home intelligent gateways, but the centralization problem is serious, for a large cloud with tens of millions of users, the calculated amount is large, resources are consumed, when the network environment is complex, the execution efficiency is low, the time delay is large, and the user experience is poor.
Disclosure of Invention
The embodiment of the invention aims to provide a gateway linkage method, a gateway, a cloud server and a user terminal, which can improve linkage efficiency and reduce linkage time delay.
In order to solve the above technical problem, an embodiment of the present invention provides a gateway linkage method, which is applied to a gateway, and includes the following steps: establishing communication connection with a cloud server; establishing a communication connection with other gateways via the cloud server; acquiring a rule template file from the cloud server, wherein the rule template file comprises a trigger mark and an execution action corresponding to the trigger mark; when the trigger mark is detected, executing the execution action and sending a trigger notification message to the other gateways, wherein the trigger notification message comprises the trigger mark; and when receiving the trigger notification message sent by the other gateway, acquiring the trigger mark detected by the other gateway according to the trigger notification message, acquiring the execution action corresponding to the trigger mark detected by the other gateway, and executing the execution action.
An embodiment of the present invention further provides a gateway, including: at least one processor; and a memory communicatively coupled to at least one of the processors; wherein the memory stores instructions executable by at least one of the processors to enable the at least one of the processors to perform the gateway linkage method as described above.
The embodiment of the invention also provides a gateway linkage method, which is applied to the cloud server and comprises the following steps: establishing communication connection with a plurality of gateways respectively to acquire users to which the gateways belong; establishing communication connection between target gateways, wherein the target gateways are a plurality of gateways which belong to the same user or a plurality of gateways contained in a received linkage request sent by a user terminal; and acquiring a rule template file from the user terminal, and sending the rule template file to the gateway.
An embodiment of the present invention further provides a cloud server, including: at least one processor; and a memory communicatively coupled to at least one of the processors; wherein the memory stores instructions executable by at least one of the processors to enable the at least one of the processors to perform the gateway linkage method as described above.
The embodiment of the invention also provides a gateway linkage method, which is applied to the user terminal and comprises the following steps: acquiring a linkage rule formulated by a user, constructing a rule template file according to the linkage rule, and sending the rule template file to the cloud server; and acquiring a plurality of gateways which are specified by the user and need to be linked, and sending a linkage request to the cloud server, wherein the linkage request comprises the plurality of gateways which need to be linked.
An embodiment of the present invention further provides a user terminal, including: at least one processor; and a memory communicatively coupled to at least one of the processors; wherein the memory stores instructions executable by at least one of the processors to enable the at least one of the processors to perform the gateway linkage method as described above.
Compared with the prior art, the method and the system for realizing the linkage between the two or more gateways establish communication connection through the cloud server, send the rule template file to the gateways, send the trigger notification message to other gateways in communication connection with the gateways when the gateways detect the trigger mark due to the fact that the rule template file comprises the trigger mark and the execution action corresponding to the trigger mark, wherein the trigger notification message comprises the trigger mark, and after the other gateways receive the trigger notification message, the trigger mark can be acquired from the trigger notification message, and the corresponding execution action is executed according to the trigger mark, so that the linkage between the two or more gateways is realized. Because the gateways are linked only through the communication connection between the gateways, the cloud server is only used for establishing the communication connection between the gateways and does not participate in the linkage of the trigger marks, the decentralized effect is achieved, the linkage efficiency is improved, and the linkage time delay is reduced.
In addition, after the rule template issued by the cloud server is obtained, the method further includes: when a rule updating message sent by the cloud server is received, acquiring a new rule template file from the cloud server; and updating the trigger mark and the execution action of the local rule template file according to the new rule template file.
In addition, the gateway performs the following steps each time the start-up is completed: acquiring a new rule template file from the cloud server; and updating the trigger mark and the execution action according to the new rule template file.
In addition, the executing act specifically includes: acquiring a sub-action which needs to be executed by the intelligent equipment hung down by the gateway in the execution action; and controlling the intelligent equipment to execute the sub-action.
In addition, after sending the rule template file to the gateway, the method further includes: when receiving a rule updating message sent by the user terminal, acquiring a new rule template file from the user terminal; and sending the new rule template file to the gateway.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. However, it will be appreciated by those of ordinary skill in the art that numerous technical details are set forth in order to provide a better understanding of the present application in various embodiments of the present invention. However, the technical solution claimed in the present application can be implemented without these technical details and various changes and modifications based on the following embodiments.
A first embodiment of the present invention relates to a gateway linkage method. The specific process is shown in fig. 1, and comprises the following steps:
step S101: and establishing communication connection with the cloud server and establishing communication connection with other gateways through the cloud server.
Specifically, in the present embodiment, a communication connection between gateways is established using a P2P (peer-to-peer) technology. That is, after the cloud server establishes communication connection, the gateway periodically sends a P2P connection heartbeat, maintains a continuous connection state with the cloud server, and sends a public network IP (Internet Protocol, Internet interconnection Protocol) of the gateway itself to the cloud server, when communication connection needs to be established between two gateways, for example, a first gateway and a second gateway, the first gateway can obtain the public network IP of the second gateway from the cloud server, the second gateway obtains the public network IP of the first gateway from the cloud server, and respectively sends messages to the public network IP of the other side by using the principle of "P2P hole punching", thereby completing a process of communication connection between the first gateway and the second gateway. It is to be understood that the aforementioned establishment of the communication connection between the first gateway and the second gateway through the P2P technology is only a specific example in this embodiment, and is not limited thereto.
Preferably, in this embodiment, the first gateway may obtain the public network IP of the second gateway from the cloud server, before the second gateway obtains the public network IP of the first gateway from the cloud server, the cloud server further needs to perform security mechanism authentication on the first gateway and the second gateway, and after the first gateway and the second gateway pass the authentication, the cloud server sends the public network IP of the other side to the corresponding gateway. It can be understood that there are many methods for authenticating the security mechanism, such as password verification, etc., and the method can be flexibly configured according to actual needs, which is not listed here.
Preferably, in this embodiment, in the process of establishing the communication connection, the first gateway and the second gateway may further feed back whether the communication connection is successful to the cloud server in real time. When the first gateway and the second gateway confirm that the communication connection is established, linkage is carried out, so that linkage errors caused by the fact that a single gateway considers that the communication connection is established and is not actually completed are avoided.
Step S102: and acquiring a rule template file from the cloud server, wherein the rule template file comprises a trigger mark and an execution action corresponding to the trigger mark.
Specifically, in this embodiment, after the first gateway and the second gateway establish the communication connection, the rule template file may be acquired from the cloud server. The rule template file is a linkage rule formulated by a user according to needs, and comprises a trigger identifier and an execution action corresponding to the trigger identifier, and the corresponding execution action is executed when the trigger identifier is detected. For example, when a trigger action a of the user is detected, an execution action B corresponding to the trigger action a is executed.
Step S103: when the trigger flag is detected, performing an action and sending a trigger notification message to the other gateway, the trigger notification message including the trigger flag.
Specifically, in the present embodiment, when a trigger is detected by a certain first gateway, an execution operation corresponding to the trigger is executed. And sending a trigger notification message to other gateways such as a second gateway which are in communication connection with the first gateway, wherein the trigger notification message comprises a trigger identifier, namely the second gateway is notified that the first gateway detects the trigger mark, after receiving the trigger notification message, the second gateway can judge whether the second gateway has an execution action corresponding to the trigger identifier according to the trigger identifier, and if the second gateway has the execution action corresponding to the trigger identifier, the second gateway executes the execution action correspondingly.
Step S104: when receiving a trigger notification message sent by other gateways, acquiring trigger marks detected by other gateways according to the trigger notification message, acquiring execution actions corresponding to the trigger marks detected by other gateways, and executing the execution actions.
Specifically, in this embodiment, when a certain first gateway receives a trigger notification message of another gateway, for example, a second gateway, the trigger notification message includes a trigger flag, that is, the trigger flag detected by the other gateway is the trigger flag, which can be obtained from the trigger notification message, for example, if the trigger notification message indicates that the second gateway detects the trigger flag a, the first gateway obtains an execution action B corresponding to the trigger flag a, and executes the execution action B.
Specifically, in this embodiment, executing the executing action B specifically includes obtaining a sub-action that needs to be executed by the smart device that is under the first gateway in the executing action B, and controlling the smart internet of things device to execute the sub-action. For example, if the sub-action that needs to be executed by the intelligent device that is hung down by the first gateway in the action B is to start the air conditioner in the preset area, the first gateway directly sends a start message to the air conditioner in the preset area that is hung down, and the air conditioner in the preset area is controlled to start. It should be understood that the foregoing is only an example of one specific application of the present embodiment, and is not limiting.
Compared with the prior art, in the gateway linkage method provided by the first embodiment of the present invention, a cloud server establishes communication connection between two or more gateways, and sends a rule template file to the gateways, because the rule template file includes a trigger flag and an execution action corresponding to the trigger flag, when the gateways detect the trigger flag, the gateway sends a trigger notification message to other gateways in communication connection therewith, where the trigger notification message includes the trigger flag, and after receiving the trigger notification message, other gateways can acquire the trigger flag from the trigger notification message and execute the corresponding execution action according to the trigger flag, thereby implementing linkage between two or more gateways. Because the gateways are linked only through the communication connection between the gateways, the cloud server is only used for establishing the communication connection between the gateways and does not participate in the linkage of the trigger marks, the decentralized effect is achieved, the linkage efficiency is improved, and the linkage time delay is reduced.
A second embodiment of the present invention relates to a gateway linkage method. The second embodiment is substantially the same as the first embodiment, and includes, as shown in fig. 2, the steps of:
step S201: and establishing communication connection with the cloud server and establishing communication connection with other gateways through the cloud server.
Step S202: and acquiring a rule template file from the cloud server, wherein the rule template file comprises a trigger mark and an execution action corresponding to the trigger mark.
Specifically, step S201 and step S202 in the gateway linkage method according to the second embodiment of the present invention are substantially the same as step S101 and step S102 in the first embodiment, and are not repeated here, and specific descriptions in the first embodiment may be referred to.
Step S203: and when a rule updating message sent by the cloud server is received, acquiring a new rule template file from the cloud server, and updating the trigger mark and the execution action of the local rule template file according to the new rule template file.
Specifically, in this embodiment, when the user changes the linkage rule, the cloud server may send a rule update message to the gateway, and when the gateway receives the rule update message sent by the cloud server, the gateway may obtain a new rule template file from the cloud server, and update the trigger flag and the execution action of the local rule template file according to the new rule template file. For example, when a user adds/modifies a linkage rule, the cloud server sends a rule update message to the gateway, and after receiving the rule update message, the gateway acquires a new rule template file from the cloud server again and updates a rule engine in the gateway according to the new rule template file; when a user deletes a linkage rule, the cloud server sends a rule updating message to the gateway, and after receiving the rule updating message, the gateway acquires a new rule template file from the cloud server again, deletes the rule according to the new rule template file, and updates a rule engine in the gateway. It should be understood that the foregoing is only an example of specific application of updating the linkage rule in the present embodiment, and is not limiting.
Preferably, in addition to receiving the rule update message sent by the cloud server, in other embodiments of the present invention, the gateway may also obtain a new rule template file from the cloud server every time the gateway is started; updating the trigger flag and executing the action according to the new rule template file.
Step S204: when the trigger flag is detected, performing an action and sending a trigger notification message to the other gateway, the trigger notification message including the trigger flag.
Step S205: when receiving a trigger notification message sent by other gateways, acquiring trigger marks detected by other gateways according to the trigger notification message, acquiring execution actions corresponding to the trigger marks detected by other gateways, and executing the execution actions.
Specifically, step S204 and step S205 in the gateway linkage method provided by the second embodiment of the present invention are substantially the same as step S104 and step S105 in the first embodiment, and are not repeated here, and specific descriptions in the first embodiment may be referred to.
Compared with the prior art, the gateway linkage method provided by the second embodiment of the invention can obtain a new rule template file while keeping the technical effect of the first embodiment, and update the trigger mark and the execution action according to the new rule template file, thereby ensuring that the latest requirements of a user can be met during gateway linkage and improving the use experience of the user.
The steps of the above methods are divided for clarity, and the implementation may be combined into one step or split some steps, and the steps are divided into multiple steps, so long as the steps contain the same logical relationship, which is within the protection scope of the present patent; it is within the scope of the patent to add insignificant modifications to the algorithms or processes or to introduce insignificant design changes to the core design without changing the algorithms or processes.
A third embodiment of the present invention relates to a gateway, as shown in fig. 3, including: at least one processor 301; and a memory 302 communicatively coupled to the at least one processor 301; the memory 302 stores instructions executable by the at least one processor 301, and the instructions are executed by the at least one processor 301, so that the at least one processor 301 can execute the gateway linkage method.
Where the memory 302 and the processor 301 are coupled in a bus, the bus may comprise any number of interconnected buses and bridges, the buses coupling one or more of the various circuits of the processor 301 and the memory 302. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 301 is transmitted over a wireless medium through an antenna, which further receives the data and transmits the data to the processor 301.
The processor 301 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 302 may be used to store data used by processor 301 in performing operations.
It should be noted that each module referred to in this embodiment is a logical module, and in practical applications, one logical unit may be one physical unit, may be a part of one physical unit, and may be implemented by a combination of multiple physical units. In addition, in order to highlight the innovative part of the present invention, elements that are not so closely related to solving the technical problems proposed by the present invention are not introduced in the present embodiment, but this does not indicate that other elements are not present in the present embodiment.
A fourth embodiment of the present invention relates to a gateway linkage method applied to a cloud server, as shown in fig. 4, including the steps of:
step S401: and establishing communication connection with the plurality of gateways respectively to acquire the users to which the gateways belong.
Specifically, in this embodiment, each gateway has a master, that is, a user to which the gateway belongs, and only if the users are the same, the gateway can be called, so that the user to which the gateway belongs is obtained to be used for binding with the gateway.
Step S402: and establishing communication connection among the target gateways, wherein the target gateways are a plurality of gateways which belong to the same user, or the target gateways are a plurality of gateways contained in the received linkage request sent by the user terminal.
Specifically, in the present embodiment, when a plurality of gateways belong to the same user, the plurality of gateways can be linked with each other, and therefore, the plurality of gateways belonging to the same user are set as target gateways to establish communication connection between the target gateways. In addition, the user terminal can also send the linkage request to the cloud server, the linkage request comprises a plurality of gateways, and after receiving the linkage request, the cloud server takes the plurality of gateways contained in the linkage request as target gateways to establish communication connection among the target gateways.
Step S403: and acquiring the rule template file from the user terminal, and sending the rule template file to the gateway.
Specifically, in this embodiment, a user may edit the linkage rule on the user terminal, the user terminal forms a rule template file according to the linkage rule edited by the user, the rule template file includes the trigger flag and the execution action corresponding to the trigger flag, the rule template file is sent from the user terminal to the sending cloud server, and the cloud server sends the rule template file to the gateway.
Preferably, in other embodiments of the present invention, the user may further modify and update the specified linkage rule, after the user completes modification and update of the linkage rule on the user terminal, the user terminal may form a new rule template file according to the modification and update of the user, and send a rule update message to the cloud server, and after receiving the rule update message, the user terminal may obtain the new rule template file from the user terminal, and send the new rule template file to the gateway. By updating the rule template file, the latest gateway linkage requirement of a user can be met during gateway linkage, and the use experience of the user is improved.
Compared with the prior art, in the gateway linkage method provided by the fourth embodiment of the present invention, the cloud server establishes communication connection between two or more gateways, and sends the rule template file formed according to the linkage rule to the gateways, thereby implementing linkage between the two or more gateways.
A fifth embodiment of the present invention relates to a gateway, as shown in fig. 5, including: at least one processor 501; and a memory 502 communicatively coupled to the at least one processor 501; the memory 502 stores instructions executable by the at least one processor 501, and the instructions are executed by the at least one processor 501 to enable the at least one processor 501 to perform the gateway linkage method as described above.
The memory 502 and the processor 501 are coupled by a bus, which may include any number of interconnected buses and bridges that couple one or more of the various circuits of the processor 501 and the memory 502 together. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 501 is transmitted over a wireless medium through an antenna, which further receives the data and transmits the data to the processor 501.
The processor 501 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And memory 502 may be used to store data used by processor 501 in performing operations.
A sixth embodiment of the present invention relates to a gateway linkage method applied to a user terminal, as shown in fig. 6, including the steps of:
step S601: the method comprises the steps of obtaining a linkage rule formulated by a user, and constructing a rule template file according to the linkage rule, wherein the rule template file comprises a trigger mark and an execution action corresponding to the trigger mark.
Specifically, in this embodiment, a human-computer interaction interface is provided on the user terminal, and a user can set a linkage rule on the user terminal through the human-computer interaction interface, that is, specify a trigger flag and an execution action corresponding to the trigger flag. The user terminal constructs a rule template file according to a linkage rule formulated by a user, wherein the rule template file comprises a trigger mark and an execution action corresponding to the trigger mark.
Step S602: and sending the rule template file to a cloud server.
Step S603: the method comprises the steps of obtaining a plurality of gateways which need to be linked and are appointed by a user, and sending a linkage request to a cloud server, wherein the linkage request comprises the plurality of gateways which need to be linked.
Specifically, in this embodiment, the user may also designate a plurality of gateways for linkage through a human-computer interaction interface on the user terminal. The user terminal sends a linkage request to the cloud server according to the designation of the user, wherein the linkage request comprises a plurality of gateways which are designated by the user and need to be linked.
Compared with the prior art, in the gateway linkage method provided by the sixth embodiment of the invention, the user terminal indicates linkage among the plurality of gateways by constructing the rule template file and sending the linkage request, but the user terminal does not participate in the linkage process of the gateways, so that the decentralized effect is realized, the linkage efficiency is improved, and the linkage delay is reduced.
A seventh embodiment of the present invention relates to a gateway, as shown in fig. 7, including: at least one processor 701; and, a memory 702 communicatively coupled to the at least one processor 701; the memory 702 stores instructions executable by the at least one processor 701, and the instructions are executed by the at least one processor 701 to enable the at least one processor 701 to perform the gateway linkage method as described above.
The memory 702 and the processor 701 are coupled by a bus, which may comprise any number of interconnecting buses and bridges that couple one or more of the various circuits of the processor 701 and the memory 702. The bus may also connect various other circuits such as peripherals, voltage regulators, power management circuits, and the like, which are well known in the art, and therefore, will not be described any further herein. A bus interface provides an interface between the bus and the transceiver. The transceiver may be one element or a plurality of elements, such as a plurality of receivers and transmitters, providing a means for communicating with various other apparatus over a transmission medium. The data processed by the processor 701 is transmitted over a wireless medium through an antenna, which receives the data and transmits the data to the processor 701.
The processor 701 is responsible for managing the bus and general processing and may also provide various functions including timing, peripheral interfaces, voltage regulation, power management, and other control functions. And the memory 702 may be used for storing data used by the processor 701 in performing operations.
Those skilled in the art can understand that all or part of the steps in the method of the foregoing embodiments may be implemented by a program to instruct related hardware, where the program is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
It will be understood by those of ordinary skill in the art that the foregoing embodiments are specific examples for carrying out the invention, and that various changes in form and details may be made therein without departing from the spirit and scope of the invention in practice.