Mesh gateway selection method and device

文档序号:703416 发布日期:2021-04-13 浏览:6次 中文

阅读说明:本技术 Mesh网关选择方法及装置 (Mesh gateway selection method and device ) 是由 樊明 于 2020-12-08 设计创作,主要内容包括:本发明提供了一种Mesh网关选择方法和装置,该方法包括:Mesh设备接收Mesh网络中的Mesh网关设备发送的宣告报文;所述Mesh设备根据所述宣告报文维护一个Mesh网关设备列表;所述Mesh设备从所述Mesh网关设备列表中选择一个Mesh网关设备作为与云端通信的服务Mesh网关设备。在本发明中,Mesh设备可灵活选择Mesh网关设备,解决了相关技术中所选择的Mesh网关设备可靠性低,以及通信数据量大的问题,进而提高了通信可靠性并降低通信数据量和处理的复杂性。(The invention provides a Mesh gateway selection method and a device, wherein the method comprises the following steps: the Mesh equipment receives an announcement message sent by Mesh gateway equipment in a Mesh network; the Mesh equipment maintains a Mesh gateway equipment list according to the declaration message; and the Mesh device selects one Mesh gateway device from the Mesh gateway device list as a service Mesh gateway device communicated with the cloud. In the invention, the Mesh device can flexibly select the Mesh gateway device, thereby solving the problems of low reliability and large communication data volume of the selected Mesh gateway device in the related technology, further improving the communication reliability and reducing the communication data volume and the processing complexity.)

1. A Mesh gateway selection method is characterized by comprising the following steps:

the Mesh equipment receives an announcement message sent by Mesh gateway equipment in a Mesh network;

the Mesh equipment maintains a Mesh gateway equipment list according to the declaration message;

and the Mesh device selects one Mesh gateway device from the Mesh gateway device list as a service Mesh gateway device communicated with the cloud.

2. The method of claim 1, wherein the receiving, by the Mesh device, the announcement message sent by the Mesh gateway device in the Mesh network comprises:

the Mesh device periodically receives the announcement message sent by the Mesh gateway device through multicast or broadcast, wherein the announcement message at least includes the following information of the Mesh gateway device: the Mesh gateway device identification, the communication quality of the Mesh gateway device and the cloud end, and whether the Mesh gateway device is off-line or not.

3. The method of claim 2, wherein the Mesh device maintaining a list of Mesh gateway devices according to the announcement message comprises one of:

if the Mesh gateway device does not exist in the Mesh gateway device list, adding the Mesh gateway device into the Mesh gateway device list, and starting a failure timer of the Mesh gateway device;

if the Mesh gateway device exists in the Mesh gateway device list and the information of the Mesh gateway device changes, updating the information of the Mesh gateway device in the gateway device list and resetting a failure timer of the Mesh gateway device;

if the Mesh gateway device exists in the Mesh gateway device list and the information of the Mesh gateway device is unchanged, resetting a failure timer of the Mesh gateway device;

and if the Mesh gateway equipment is off-line, deleting the Mesh gateway equipment from the Mesh gateway equipment list.

4. The method of claim 1, wherein the selecting, by the Mesh device, one Mesh gateway device from the list of Mesh gateway devices as a serving Mesh gateway device in communication with a cloud comprises:

the Mesh device selects one Mesh gateway device as a service Mesh gateway device according to at least one of the following information in the Mesh gateway device list: the communication quality of the service Mesh gateway device and the cloud end, the identification of the service Mesh gateway device and the communication quality of the Mesh device and the service Mesh gateway device.

5. The method of claim 4, wherein the Mesh device selects the serving Mesh gateway device according to at least one of the following:

when only one Mesh gateway device exists in the Mesh gateway device list, the Mesh gateway device is used as a service Mesh gateway device;

when a plurality of Mesh gateway devices exist in the Mesh gateway device list, preferentially selecting a Mesh gateway device with good communication quality with a cloud end as a service Mesh gateway device;

when a plurality of Mesh gateway devices exist in the Mesh gateway device list, preferentially selecting a Mesh gateway device with good communication quality with the Mesh device as a service Mesh gateway device;

and when a plurality of Mesh gateway devices exist in the Mesh gateway device list, preferentially selecting the Mesh gateway device with a large device identification value as the service Mesh gateway device.

6. The method of claim 1, wherein before the Mesh device selects one Mesh gateway device as a serving Mesh gateway device according to the Mesh gateway device list, the method further comprises:

dividing the communication quality of the service Mesh gateway device and the cloud end into a plurality of quality levels according to round-trip delay and/or hop count of the message between the service Mesh gateway device and the cloud end; and/or

And dividing the communication quality of the Mesh equipment and the service Mesh gateway equipment into a plurality of quality levels according to the round-trip delay and/or the hop count of the message between the Mesh equipment and the service Mesh gateway equipment.

7. The method of claim 1, wherein after the Mesh device selects one Mesh gateway device from the Mesh gateway device list as a Mesh gateway device in communication with a cloud, the method further comprises:

and if the information of the Mesh gateway equipment in the Mesh gateway equipment list changes, re-selecting a service Mesh gateway equipment communicated with the cloud end from the Mesh gateway equipment list.

8. A Mesh gateway selection apparatus, located in a Mesh device, comprising:

the receiving module is used for receiving an announcement message sent by the Mesh gateway equipment in the Mesh network;

the maintenance module is used for maintaining a Mesh gateway equipment list according to the declaration message;

and the selecting module is used for selecting one Mesh gateway device from the Mesh gateway device list as the Mesh gateway device communicated with the cloud.

9. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is arranged to perform the method of any of claims 1 to 7 when executed.

10. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 7.

Technical Field

The invention relates to the field of network communication, in particular to a Mesh gateway selection method and device.

Background

The Mesh network is a network topology for many-to-many device communication, and a plurality of devices can exchange and transmit information through the Mesh network. The Mesh network is usually applied to a local scope, and communication with a cloud terminal must be established through Mesh gateway equipment, so that a complete Mesh network internet of things solution is formed.

There may be a plurality of Mesh gateway devices in a Mesh network. When a plurality of Mesh gateway devices exist, the problem of Mesh gateway device selection is necessarily faced. An existing Mesh gateway selection method is as follows: and the Mesh device sets a default Mesh gateway device. The method has poor reliability, and communication is interrupted when the default Mesh gateway equipment fails. Another Mesh gateway selection method is as follows: the Mesh equipment establishes a concurrent channel with the cloud end through each Mesh gateway equipment, and the cloud end realizes selective receiving. The complexity of the Mesh device and the cloud end is increased by concurrent selective receiving processing in the method, and the data volume of the whole communication is increased by times along with the increase of the data volume of the Mesh device and the cloud end and the increase of the Mesh gateway device.

Aiming at the problems in the Mesh gateway selection mode, an effective solution is not provided at present.

Disclosure of Invention

The embodiment of the invention provides a Mesh gateway selection method, a device, a storage medium and an electronic device, which are used for at least solving the problems of low reliability, complex processing and large overall communication data volume of the Mesh gateway selection method in the related technology.

According to an embodiment of the present invention, there is provided a Mesh gateway selection method, including: the Mesh equipment receives an announcement message sent by Mesh gateway equipment in a Mesh network; the Mesh equipment maintains a Mesh gateway equipment list according to the declaration message; and the Mesh device selects one Mesh gateway device from the Mesh gateway device list as a service Mesh gateway device communicated with the cloud.

In an exemplary embodiment, the receiving, by the Mesh device, the announcement message sent by the Mesh gateway device in the Mesh network may include: the Mesh device periodically receives the announcement message sent by the Mesh gateway device through multicast or broadcast, wherein the announcement message at least includes the following information of the Mesh gateway device: the Mesh gateway device identification, the communication quality of the Mesh gateway device and the cloud end, and whether the Mesh gateway device is off-line or not.

Further, the step of the Mesh device maintaining a Mesh gateway device list according to the announcement message may include one of the following steps: if the Mesh gateway device does not exist in the Mesh gateway device list, adding the Mesh gateway device into the Mesh gateway device list, and starting a failure timer of the Mesh gateway device; if the Mesh gateway device exists in the Mesh gateway device list and the information of the Mesh gateway device changes, updating the information of the Mesh gateway device in the gateway device list and resetting a failure timer of the Mesh gateway device; if the Mesh gateway device exists in the Mesh gateway device list and the information of the Mesh gateway device is unchanged, resetting a failure timer of the Mesh gateway device; and if the Mesh gateway equipment is off-line, deleting the Mesh gateway equipment from the Mesh gateway equipment list.

Further, the method can also comprise the following steps: and deleting the Mesh gateway equipment with the expired failure timer from the Mesh gateway equipment list.

In an exemplary embodiment, the selecting, by the Mesh device, one Mesh gateway device from the Mesh gateway device list as a serving Mesh gateway device in communication with a cloud may include: the Mesh device selects one Mesh gateway device as a service Mesh gateway device according to at least one of the following information in the Mesh gateway device list: the communication quality of the service Mesh gateway device and the cloud end, the identification of the service Mesh gateway device and the communication quality of the Mesh device and the service Mesh gateway device.

Further, the Mesh device may select the serving Mesh gateway device according to at least one of the following ways: when only one Mesh gateway device exists in the Mesh gateway device list, the Mesh gateway device is used as a service Mesh gateway device; when a plurality of Mesh gateway devices exist in the Mesh gateway device list, preferentially selecting a Mesh gateway device with good communication quality with a cloud end as a service Mesh gateway device; when a plurality of Mesh gateway devices exist in the Mesh gateway device list, preferentially selecting a Mesh gateway device with good communication quality with the Mesh device as a service Mesh gateway device; and when a plurality of Mesh gateway devices exist in the Mesh gateway device list, preferentially selecting the Mesh gateway device with a large device identification value as the service Mesh gateway device.

In an exemplary embodiment, before the Mesh device selects one Mesh gateway device as the serving Mesh gateway device according to the Mesh gateway device list, the method may further include: dividing the communication quality of the service Mesh gateway device and the cloud end into a plurality of quality levels according to round-trip delay and/or hop count of the message between the service Mesh gateway device and the cloud end; and/or dividing the communication quality of the Mesh equipment and the service Mesh gateway equipment into a plurality of quality levels according to the round-trip delay and/or the hop count of the message between the Mesh equipment and the service Mesh gateway equipment.

In an exemplary embodiment, after the Mesh device selects one Mesh gateway device from the Mesh gateway device list as a Mesh gateway device in communication with a cloud, the method may further include: and if the information of the Mesh gateway equipment in the Mesh gateway equipment list changes, re-selecting a service Mesh gateway equipment communicated with the cloud end from the Mesh gateway equipment list.

According to another embodiment of the present invention, there is provided a Mesh gateway selection apparatus, where the Mesh gateway selection apparatus is located in the Mesh device, and the apparatus may include: the receiving module is used for receiving an announcement message sent by the Mesh gateway equipment in the Mesh network; the maintenance module is used for maintaining a Mesh gateway equipment list according to the declaration message; and the selecting module is used for selecting one Mesh gateway device from the Mesh gateway device list as the Mesh gateway device communicated with the cloud.

According to a further embodiment of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.

According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.

Through the embodiment of the invention, the Mesh device can discover and flexibly select the Mesh gateway device, so that the problems of low reliability, complex processing and large overall communication data volume of a Mesh gateway selection mode in the related technology can be solved, and the effects of improving the communication reliability and reducing the communication data volume and the processing complexity are achieved.

Drawings

The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:

fig. 1 is a block diagram of a hardware structure of a computer terminal of a Mesh gateway selection method according to an embodiment of the present invention;

fig. 2 is a flowchart of a Mesh gateway selection method according to an embodiment of the present invention;

fig. 3 is a block diagram of a Mesh gateway selection apparatus according to an embodiment of the present invention;

fig. 4 is a flowchart of a Mesh gateway selection method in the related art according to an embodiment of the present invention;

fig. 5 is a flowchart of a Mesh gateway selection method in the related art according to an alternative embodiment of the present invention;

fig. 6 is a flowchart of a Mesh gateway selection method according to an alternative embodiment of the present invention.

Detailed Description

In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.

It should be noted that the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.

In order to better understand the technical solutions of the embodiments and the alternative embodiments of the present invention, the following description is made on possible application scenarios in the embodiments and the alternative embodiments of the present invention, but is not limited to the application of the following scenarios.

The method provided by the first embodiment of the present application may be executed in a computer terminal, a server, or a similar computing device. Taking the example of running on a computer terminal, fig. 1 is a block diagram of a hardware structure of a computer terminal of a Mesh gateway selection method according to an embodiment of the present invention. As shown in fig. 1, the computer terminal 10 may include one or more (only one shown in fig. 1) processors 102 (the processor 102 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and in an exemplary embodiment, may also include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. For example, the computer terminal 10 may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.

The memory 104 may be used to store a computer program, for example, a software program and a module of an application software, such as a computer program corresponding to the Mesh gateway selection method in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, so as to implement the method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.

The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include wired or wireless networks provided by the communication provider of the computer terminal 10. In one example, the transmission device 106 includes a Network adapter (NIC) that can be connected to other Network devices via a broadband Network so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.

In this embodiment, a Mesh gateway selection method operating in the computer terminal is provided, and fig. 2 is a flowchart of the Mesh gateway selection method according to the embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:

step S201, a Mesh device receives an announcement message sent by a Mesh gateway device in a Mesh network;

step S202, the Mesh equipment maintains a Mesh gateway equipment list according to the declaration message;

step S203, the Mesh device selects a Mesh gateway device from the Mesh gateway device list as a service Mesh gateway device in communication with the cloud.

In this embodiment, step S201 may include: the Mesh device periodically receives the announcement message sent by the Mesh gateway device through multicast or broadcast, wherein the announcement message at least includes the following information of the Mesh gateway device: the Mesh gateway device identification, the communication quality of the Mesh gateway device and the cloud end, and whether the Mesh gateway device is off-line or not.

In this embodiment, step S202 may include one of the following: if the Mesh gateway device does not exist in the Mesh gateway device list, adding the Mesh gateway device into the Mesh gateway device list, and starting a failure timer of the Mesh gateway device; if the Mesh gateway device exists in the Mesh gateway device list and the information of the Mesh gateway device changes, updating the information of the Mesh gateway device in the gateway device list and resetting a failure timer of the Mesh gateway device; if the Mesh gateway device exists in the Mesh gateway device list and the information of the Mesh gateway device is unchanged, resetting a failure timer of the Mesh gateway device; and if the Mesh gateway equipment is off-line, deleting the Mesh gateway equipment from the Mesh gateway equipment list.

In this embodiment, the method may further include: and deleting the Mesh gateway equipment with the expired failure timer from the Mesh gateway equipment list.

In this embodiment, step S203 may include: the Mesh device selects one Mesh gateway device as a service Mesh gateway device according to at least one of the following information in the Mesh gateway device list: the communication quality of the service Mesh gateway device and the cloud end, the identification of the service Mesh gateway device and the communication quality of the Mesh device and the service Mesh gateway device.

In this embodiment, the Mesh device may select the serving Mesh gateway device according to at least one of the following manners: when only one Mesh gateway device exists in the Mesh gateway device list, the Mesh gateway device is used as a service Mesh gateway device; when a plurality of Mesh gateway devices exist in the Mesh gateway device list, preferentially selecting a Mesh gateway device with good communication quality with a cloud end as a service Mesh gateway device; when a plurality of Mesh gateway devices exist in the Mesh gateway device list, preferentially selecting a Mesh gateway device with good communication quality with the Mesh device as a service Mesh gateway device; and when a plurality of Mesh gateway devices exist in the Mesh gateway device list, preferentially selecting the Mesh gateway device with a large device identification value as the service Mesh gateway device.

Before step S203 in this embodiment, the method may further include: dividing the communication quality of the service Mesh gateway device and the cloud end into a plurality of quality levels according to round-trip delay and/or hop count of the message between the service Mesh gateway device and the cloud end; and/or dividing the communication quality of the Mesh equipment and the service Mesh gateway equipment into a plurality of quality levels according to the round-trip delay and/or the hop count of the message between the Mesh equipment and the service Mesh gateway equipment.

After step S203 in this embodiment, the method may further include: and if the information of the Mesh gateway equipment in the Mesh gateway equipment list changes, re-selecting a service Mesh gateway equipment communicated with the cloud end from the Mesh gateway equipment list.

Through the steps, the Mesh device can discover and flexibly select the Mesh gateway device, so that the problems of low reliability, complex processing and large overall communication data volume of a Mesh gateway selection mode in the related technology can be solved, and the effects of improving the communication reliability and reducing the communication data volume and the processing complexity are achieved.

Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.

In this embodiment, a Mesh gateway selection device is further provided, and the device is used to implement the foregoing embodiments and preferred embodiments, and details of which have been already described are omitted. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.

Fig. 3 is a block diagram of a Mesh gateway selection apparatus according to an embodiment of the present invention, and as shown in fig. 3, the apparatus includes a receiving module 10, a maintaining module 20, and a selecting module 30.

The receiving module 10 is configured to receive an announcement message sent by a Mesh gateway device in a Mesh network.

The maintenance module 20 is configured to maintain a Mesh gateway device list according to the announcement message.

The selecting module 30 is configured to select a Mesh gateway device from the Mesh gateway device list as a Mesh gateway device in communication with a cloud.

It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.

In order to facilitate understanding of the technical solutions provided by the present invention, the following detailed description will be made with reference to embodiments of specific scenarios.

By way of contrast, two Mesh gateway selection methods commonly used in the prior art will now be briefly described.

Fig. 4 is a flowchart of a Mesh gateway selection method according to the related art, as shown in fig. 4, the flowchart includes the steps of:

step S401, a default Mesh gateway device is preset in the Mesh device.

Step S402, when the Mesh device communicates with the cloud, the information is sent to the default Mesh gateway device.

Step S403, the Mesh gateway device sends the information from the cloud to the Mesh device.

Step S404, when the Mesh gateway device fails, the Mesh device cannot communicate with the cloud.

It can be seen that the above Mesh gateway selection method has the disadvantage of low reliability.

Fig. 5 is a flowchart of another Mesh gateway selection method according to the related art, as shown in fig. 5, the flowchart includes the steps of:

step S501, the Mesh device sends information communicated with the cloud end to the Mesh network in a broadcasting mode, and each piece of information is uniquely identified.

Step S502, after each Mesh gateway device receives the information, the information is forwarded to the cloud.

And step S503, after receiving the information from the Mesh gateway devices, the cloud performs duplicate removal processing according to the unique identifier of the information, and completes the information reception.

Step S504, when any Mesh gateway device fails, the Mesh device may communicate with the cloud through another Mesh gateway device.

As can be seen from the above description, the Mesh gateway selection method in fig. 5 has the disadvantages of complex processing and large overall communication data volume.

Therefore, the embodiment provides a new Mesh gateway selection method, and compared with the Mesh gateway selection methods shown in fig. 4 and 5, the Mesh gateway selection provided by the embodiment can improve the reliability and reduce the communication data volume and the processing complexity.

In this embodiment, when a plurality of Mesh gateway devices exist in a Mesh network, the Mesh devices automatically discover the Mesh gateway devices, and the Mesh devices run a selection algorithm to select an optimal gateway device, and communicate with the cloud through the gateway device. In this embodiment, the Mesh device may determine the optimal gateway device according to parameters such as the communication quality between the Mesh gateway device and the cloud, the communication quality between the Mesh device and the Mesh gateway device, and the like.

In this embodiment, the Mesh device and the cloud communicate in a mode from the Mesh device to the Mesh gateway device and then to the cloud. When a plurality of Mesh Gateway devices exist in the Mesh network, the Mesh device calculates an optimal Mesh Gateway device (Gateway, abbreviated as GW).

Fig. 6 is a flowchart of a Mesh gateway selection method according to an alternative embodiment of the present invention, and as shown in fig. 6, the flowchart of the new Mesh gateway selection method includes the following steps:

step S601, the Mesh gateway device periodically sends an announcement message of the Mesh gateway device in a multicast or broadcast manner.

In this embodiment, the multicast or broadcast announcement message of the Mesh gateway device may include an identifier of the Mesh gateway device, communication quality between the Mesh gateway device and the cloud, and whether the Mesh gateway device is in an offline state.

Step S602, the Mesh device automatically discovers all Mesh gateway devices in the Mesh network.

In this embodiment, the Mesh device may automatically discover all Mesh gateway devices in the Mesh network through the received announcement message.

Step S603, the Mesh device locally maintains a Mesh gateway device list.

In this embodiment, the Mesh device may maintain a local Mesh gateway device list according to the information in the received announcement message. Specifically, the list of Mesh gateway devices may be maintained by: and if the gateway equipment is off-line, deleting the gateway equipment from the gateway equipment list. And if the gateway equipment does not exist in the gateway equipment list, adding the gateway equipment into the list, and starting a gateway equipment failure timer. And if the gateway equipment exists in the gateway equipment list, updating the gateway equipment information if the information changes.

In addition, when the Mesh device maintains the Mesh gateway device list, after the Mesh device receives the announcement message of the gateway device, the Mesh device needs to reset the failure timer of the gateway device regardless of whether the information of the Mesh gateway device changes. And if the failure timer of the Mesh gateway equipment is overtime, deleting the gateway equipment from the gateway equipment list.

Step S604, based on the maintained Mesh gateway device list, the Mesh device calculates the optimal Mesh gateway device through a selection algorithm. When the Mesh device needs to communicate with the cloud, data transfer can be performed through the Mesh gateway device.

In step S605, when the Mesh gateway device list changes, for example, information of the added gateway device, the deleted gateway device, and the gateway device changes, the selection algorithm needs to be run again to reselect the optimal gateway device.

The following describes a selection algorithm of the Mesh gateway device in this embodiment.

In step S604 of the present embodiment, the election algorithm mainly depends on the following parameters: the communication quality between the Mesh gateway device and the cloud, the Mesh gateway device identification and the communication quality between the Mesh device and the Mesh gateway device. When the communication between the Mesh gateway device and the cloud end fails or the quality is degraded, switching can be dynamically completed to provide better communication service, and the gateway device identification is mainly used for the algorithm to generate a result.

In this embodiment, based on the gateway device list, when the selection algorithm is run, the following steps are sequentially performed until the result is generated:

if the gateway device list only has one Mesh gateway device at present, selecting the Mesh gateway device as a gateway device communicated with the cloud;

comparing the communication quality of each gateway device in the gateway device list and the cloud end, and selecting the good-quality Mesh gateway device as the gateway device communicated with the cloud end;

comparing the communication quality of the Mesh equipment and the gateway equipment in the gateway equipment list, and selecting the good-quality Mesh gateway equipment as the gateway equipment for communicating with the cloud;

and comparing the device identification of each Mesh gateway device in the gateway device list, and selecting the Mesh gateway device with a large identification value as the gateway device communicated with the cloud.

In this embodiment, the communication quality between the Mesh device and the gateway device may be classified into quality classes according to parameters such as round trip delay and hop count of the packet between the Mesh device and the gateway device, for example, the quality classes may be classified into the following five classes: unusable, worse, medium, better, excellent.

Similarly, the communication quality between the Mesh gateway device and the cloud may also be classified into quality classes according to parameters such as round-trip delay and hop count of the packet between the Mesh gateway device and the cloud, for example, the quality classes may be classified into the following five classes: unusable, worse, medium, better, excellent.

In this embodiment, the Mesh device selects the optimal Mesh gateway device through the selection algorithm, and when the Mesh device communicates with the cloud, the Mesh device only needs to communicate with the cloud through the optimal Mesh gateway device without performing other complex processing (e.g., concurrent operation). In addition, because only one Mesh gateway device provides cloud communication service, the whole communication data volume cannot be increased along with the increase of the Mesh gateway devices, and the cloud does not need to perform other complex processing (such as concurrent sending and selective receiving operations). Moreover, when the Mesh gateway device providing the data communication service breaks down, the Mesh device can calculate a new optimal Mesh gateway device in time, so that the communication continuity is ensured, and the reliability is improved. Finally, through parameters such as the communication quality between the Mesh gateway device and the cloud, the communication quality between the Mesh device and the Mesh gateway device and the like, the Mesh device can dynamically select the best Mesh gateway device, and a better communication guarantee can be provided.

Embodiments of the present invention also provide a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.

In an exemplary embodiment, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:

s1, the Mesh device receives the declaration message sent by the Mesh gateway device in the Mesh network;

s2, the Mesh device maintains a Mesh gateway device list according to the announcement message;

and S3, the Mesh device selects one Mesh gateway device from the Mesh gateway device list as a service Mesh gateway device communicated with the cloud.

In an exemplary embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.

Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.

In an exemplary embodiment, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.

In an exemplary embodiment, in the present embodiment, the processor may be configured to execute the following steps by a computer program:

s1, the Mesh device receives the declaration message sent by the Mesh gateway device in the Mesh network;

s2, the Mesh device maintains a Mesh gateway device list according to the announcement message;

and S3, the Mesh device selects one Mesh gateway device from the Mesh gateway device list as a service Mesh gateway device communicated with the cloud.

In an exemplary embodiment, for specific examples in this embodiment, reference may be made to the examples described in the above embodiments and optional implementation manners, and details of this embodiment are not described herein again.

It will be apparent to those skilled in the art that the various modules or steps of the invention described above may be implemented using a general purpose computing device, which may be centralized on a single computing device or distributed across a network of computing devices, and in one exemplary embodiment may be implemented using program code executable by a computing device, such that the steps shown and described may be executed by a computing device stored in a memory device and, in some cases, executed in a sequence different from that shown and described herein, or separately fabricated into individual integrated circuit modules, or multiple ones of them fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.

The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种多路中频与基带高速交换路由的装置及其通信方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!