Communication method, system and device
Through the target device, the gateway discovers requests in the SigMesh network, selects and establishes an association relationship with high-quality gateways, the control conflicts and message duplication problems caused by insufficient binding between the device and the gateway are solved, and network communication efficiency and stability are improved.
Patent Information
- Application Number
- CN202510702898.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-28
- Publication Date
- 2025-08-05
AI Technical Summary
Due to the lack of a binding mechanism between devices and gateways in the SigMesh network, control conflicts, message duplication and air port load are too high, affecting network communication efficiency and stability.
When the target device is initialized, the broadcast gateway discovers a request, receives response messages from each gateway, selects the associated gateway based on parameter information such as signal quality, priority and system load, and establishes an association relationship with it, maintains a connection through the heartbeat mechanism to avoid control conflicts and message duplication.
Through the device-led gateway selection mechanism, control conflicts and message duplication are avoided, air port load is reduced, and overall network communication efficiency and stability are improved.
Smart Images

Figure CN120434699A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technologies, and in particular to a communication method, system and device. Background Art
[0002] With the widespread adoption of the Internet of Things (IoT) technology, wireless communication protocols with low power consumption and strong self-organizing networking capabilities are playing a vital role in smart homes, smart buildings, and other fields. Among them, the Bluetooth-based SigMesh network has become one of the mainstream IoT networking solutions due to its support for large-scale device networking and multi-path forwarding mechanisms.
[0003] In existing technologies, SigMesh networks (Bluetooth Mesh networks) typically use a flooding broadcast mechanism for message distribution, allowing all nodes to participate in message forwarding without the need for a fixed topology. However, in multi-gateway scenarios, due to the lack of a binding mechanism between devices and gateways, the same device may receive different commands from multiple gateways simultaneously, leading to control conflicts and message duplication. Furthermore, because multiple gateways simultaneously send the same control command to the same device, the air interface load is excessive, resulting in a network flooding effect, which in turn reduces the overall communication efficiency of the network and may also interfere with other normal communications, affecting the stability and performance of the entire network. Summary of the Invention
[0004] In view of this, the purpose of the embodiments of the present invention is to provide a communication method, system and device that can avoid control conflicts and message duplication, and at the same time, reduce the load in the air interface, thereby improving the overall communication efficiency of the network and improving the stability and performance of the entire network.
[0005] In a first aspect, an embodiment of the present invention provides a communication method, the method comprising:
[0006] In response to the target device initialization, broadcasting a gateway discovery request;
[0007] Receive first response messages from each gateway;
[0008] Determining parameter information corresponding to each first response message, the parameter information including at least one of signal quality, priority, system load, and number of associated devices;
[0009] Determining an associated gateway among the gateways according to the parameter information;
[0010] Sending a confirmation message to the association gateway to establish an association relationship with the association gateway, wherein the association gateway is used to store the association relationship;
[0011] Communication is performed based on the associated gateway.
[0012] In some embodiments, the method further comprises:
[0013] Sending a heartbeat message to the association gateway, wherein the association gateway is configured to send a second response message to the target device when receiving the heartbeat message;
[0014] Determining a communication connection state with the associated gateway according to the received second response message;
[0015] In response to the abnormal communication connection state, the gateway discovery request is rebroadcasted, and a new associated gateway is found to establish an associated relationship.
[0016] In some embodiments, determining the communication connection status with the associated gateway according to the received second response message includes:
[0017] In response to the fact that the second response message corresponding to the heartbeat message is not received continuously for a predetermined number of times, it is determined that the communication connection state is abnormal.
[0018] In some embodiments, determining an associated gateway among the gateways according to the parameter information includes:
[0019] Determine the parameter value corresponding to each parameter information;
[0020] Performing weighted summation on the parameter values according to predetermined weights to obtain a correlation score corresponding to each gateway;
[0021] The associated gateway is determined among the gateways according to the associated scores.
[0022] In some embodiments, communicating based on the associated gateway includes:
[0023] The communication message sent by the association gateway is received, and the association gateway is used to forward the communication message to the target device when detecting that the communication message meets the association relationship.
[0024] In a second aspect, an embodiment of the present invention provides a communication system, the system comprising:
[0025] at least one device, configured to broadcast a gateway discovery request in response to device initialization;
[0026] at least one gateway, configured to send a first response message to the target device upon receiving a gateway discovery request sent by the target device;
[0027] The target device is further configured to receive first response messages from each gateway, determine parameter information corresponding to each first response message, the parameter information including at least one of signal quality, priority, system load, and number of associated devices, determine an associated gateway from among the gateways based on the parameter information, and send a confirmation message to the associated gateway;
[0028] The association gateway is further configured to establish an association relationship with the target device upon receiving the confirmation message, and store the association relationship;
[0029] The target device communicates based on the associated gateway.
[0030] In some embodiments, the target device is further configured to send a heartbeat message to the association gateway, and the association gateway is configured to send a second response message to the target device upon receiving the heartbeat message;
[0031] The target device is further configured to determine a communication connection state with the associated gateway according to the received second response message, and in response to an abnormality in the communication connection state, rebroadcast a gateway discovery request and search for a new associated gateway to establish an association relationship.
[0032] In some embodiments, the target device is configured to determine that the communication connection state is abnormal in response to failure to continuously receive a second response message corresponding to the heartbeat message for a predetermined number of times.
[0033] In some embodiments, the target device is used to determine parameter values corresponding to various parameter information, perform weighted summation on the parameter values according to predetermined weights to obtain association scores corresponding to various gateways, and determine the associated gateway among the various gateways according to the association scores.
[0034] In some embodiments, the target device is configured to receive a communication message sent by the association gateway, and the association gateway is configured to forward the communication message to the target device when detecting that the communication message satisfies the association relationship.
[0035] In a third aspect, an embodiment of the present invention provides a communication device, the device comprising:
[0036] A broadcast unit, configured to broadcast a gateway discovery request in response to target device initialization;
[0037] A first receiving unit, configured to receive a first response message from each gateway;
[0038] an information determining unit, configured to determine parameter information corresponding to each first response message, the parameter information including at least one of signal quality, priority, system load, and number of associated devices;
[0039] an associated gateway determining unit, configured to determine an associated gateway among the gateways according to the parameter information;
[0040] a confirmation message sending unit, configured to send a confirmation message to the association gateway to establish an association relationship with the association gateway, wherein the association gateway is configured to store the association relationship;
[0041] A communication unit is configured to communicate based on the associated gateway.
[0042] In a fourth aspect, an embodiment of the present invention provides an electronic device comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method described in the first aspect.
[0043] In a fifth aspect, an embodiment of the present invention provides a computer program product, which includes a computer program. When the computer program runs on a computer, the computer executes the method described in any one of the first aspects above.
[0044] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium storing computer program instructions, which implement the method described in the first aspect when executed by a processor.
[0045] The technical solution of the embodiment of the present invention involves broadcasting a gateway discovery request when the target device is initialized, receiving first response messages from each gateway, determining parameter information corresponding to each first response message, the parameter information including at least one of signal quality, priority, system load, and the number of associated devices, determining an associated gateway from each gateway based on the parameter information, and sending a confirmation message to the associated gateway to establish an association relationship with the associated gateway. The associated gateway is used to store the association relationship and communicate based on the associated gateway. As a result, the target device communicates based on the associated gateway, avoiding control conflicts and message duplication, while reducing the load on the air interface, thereby improving the overall communication efficiency of the network and enhancing the stability and performance of the entire network. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:
[0047] Figure 1 is a schematic diagram of a communication system according to an embodiment of the present invention;
[0048] Figure 2 is an interaction diagram of a communication method according to an embodiment of the present invention;
[0049] Figure 3is a flow chart of obtaining an associated gateway according to an embodiment of the present invention;
[0050] Figure 4 is an interaction diagram of a communication method according to another embodiment of the present invention;
[0051] Figure 5 is an interaction diagram of a communication method according to yet another embodiment of the present invention;
[0052] Figure 6 is a flow chart of a communication method according to an embodiment of the present invention;
[0053] Figure 7 is a schematic diagram of a communication device according to an embodiment of the present invention;
[0054] Figure 8 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The present application is described below based on the following embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, certain specific details are described in detail. Those skilled in the art can fully understand the present application without the description of these details. To avoid obscuring the essence of the present application, well-known methods, processes, procedures, components, and circuits are not described in detail.
[0056] Furthermore, persons of ordinary skill in the art will appreciate that the figures provided herein are for illustration purposes only and are not necessarily drawn to scale.
[0057] Unless the context clearly requires otherwise, words like “include”, “comprising” and the like throughout this application should be interpreted as including rather than exclusive or exhaustive; that is, as meaning “including but not limited to”.
[0058] In the description of this application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood to indicate or imply relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.
[0059] Where the solutions described in this specification and in the examples involve the processing of personal information, such processing will be conducted with a legitimate basis (e.g., with the consent of the personal information subject or as necessary for the performance of a contract) and only within the prescribed or agreed scope. A user's refusal to process personal information other than that required for basic functions will not affect the user's use of these basic functions.
[0060] Figure 1 FIG is a schematic diagram of a communication system according to an embodiment of the present invention. Figure 1As shown, the communication system of the embodiment of the present invention includes at least one device and at least one gateway. Figure 1 In the illustrated embodiment, an example is given in which the number of devices is 4 and the number of gateways is 3, that is, the devices include 1a, 1b, 1c, and 1d, and the gateways include 2a, 2b, and 2c.
[0061] Among them, the device is a SigMesh device, which refers to a smart device that implements and is compatible with the Bluetooth Low Energy (BLE) Mesh network protocol. These devices can participate in the BLE Mesh network and realize message transmission and control between devices through relay, proxy and neighbor functions. SigMesh devices use BLE technology to communicate at low power consumption, which is especially important for battery-powered devices. At the same time, with the help of relay nodes in the network, messages can reach different devices through multi-hop transmission, thereby covering a wider range. Moreover, the device connection in the network can be automatically configured and maintained without the need for a central controller, and the message transmission confirmation mechanism is used to ensure reliable data transmission.
[0062] The gateway connects the SigMesh network to other networks (such as Wi-Fi and Ethernet) and serves as a communication bridge between Mesh network devices and external devices. The gateway converts data between the SigMesh protocol and other network protocols, such as converting SigMesh messages into IP packets for transmission to the internet. The gateway routes messages between different networks, ensuring they are reliably delivered to their destination devices. The gateway enables unified management of devices in the Mesh network, such as device registration and configuration. The gateway provides authentication and data encryption to ensure secure network communications.
[0063] In the existing technology, the problem in SigMesh networks is that there is no clear association between devices and gateways. As a result, there are several serious deficiencies in device control and message management:
[0064] First, the lack of association leads to conflicting control. Specifically, because there's no clear association between devices and gateways, multiple gateways may simultaneously send different control commands to the same device. This results in redundant and inconsistent commands received by the device, ultimately causing the device's control behavior to differ from expectations. For example, if a user frequently performs opposite control operations on a lighting device (such as "on" and "off"), and the lighting device receives "on" and "off" commands from multiple gateways simultaneously, the lighting's status may become confused.
[0065] Secondly, without a correlation, the device cannot effectively distinguish duplicate messages from different gateways and cannot perform deduplication. In this case, if multiple gateways send the same control command to the same device, the device will perform the same operation multiple times, wasting device resources.
[0066] Furthermore, because multiple gateways simultaneously send the same control command to the same device, the air interface load is excessive, causing network flooding. This not only reduces overall network communication efficiency but can also interfere with other normal communications, affecting the stability and performance of the entire network.
[0067] Thus, in an embodiment of the present invention, at least one device broadcasts a gateway discovery request in response to device initialization. Upon receiving the gateway discovery request from the target device, the gateway is configured to send a first response message to the target device. The target device is further configured to receive the first response messages from each gateway, determine parameter information corresponding to each first response message, the parameter information including at least one of signal quality, priority, system load, and the number of associated devices, determine an associated gateway from among the gateways based on the parameter information, and send a confirmation message to the associated gateway. Upon receiving the confirmation message, the associated gateway is further configured to establish an association with the target device and store the association. The target device communicates based on the associated gateway. Unlike traditional methods where device-gateway associations are determined through distributed communication and negotiation between gateways, embodiments of the present invention utilize a device-driven gateway selection mechanism, in which devices proactively broadcast discovery requests and select a preferred gateway based on signal quality and priority. This simplifies the synchronization and negotiation process between gateways, reduces system complexity, avoids issues caused by inconsistent data between gateways, and improves the efficiency and reliability of the device-gateway association process.
[0068] In some embodiments, the target device is further configured to send a heartbeat message to the associated gateway, and the associated gateway is configured to send a second response message to the target device upon receiving the heartbeat message. The target device is further configured to determine the communication connection status with the associated gateway based on the received second response message, and in response to an abnormal communication connection status, rebroadcast a gateway discovery request and search for a new associated gateway to establish an association relationship. The associated gateway is the primary gateway of the target device.
[0069] In some embodiments, the target device is configured to determine that the communication connection state is abnormal in response to failure to continuously receive a second response message corresponding to the heartbeat message for a predetermined number of times.
[0070] In this embodiment of the present invention, after establishing a connection with a primary gateway, a device periodically sends heartbeat messages to confirm the gateway's online status. If no heartbeat response is received within a set period, the device automatically initiates a failover mechanism and reselects a new gateway. This ensures a continuous and stable connection between the device and the gateway, improves the network's dynamic adaptability, and reduces the risk of connection interruption due to gateway failure.
[0071] Furthermore, device-driven broadcast communication is used for gateway discovery, avoiding distributed synchronization between gateways and reducing communication overhead. Unicast communication is used to transmit heartbeat messages between the device and the selected gateway. This reduces network communication overhead, avoids network flooding, and improves overall network communication efficiency and stability. Furthermore, by setting up a regular heartbeat mechanism and automatic timeout handling strategy, the device can quickly re-initiate gateway discovery requests and switch to a new primary gateway if the primary gateway fails. This enhances the system's fault tolerance and self-recovery capabilities in complex network environments, ensuring continuous and stable device operation.
[0072] In some embodiments, the target device is used to determine parameter values corresponding to various parameter information, perform weighted summation on the parameter values according to predetermined weights to obtain association scores corresponding to various gateways, and determine the associated gateway among the various gateways according to the association scores.
[0073] In some embodiments, the target device is configured to receive a communication message sent by the association gateway, and the association gateway is configured to forward the communication message to the target device when detecting that the communication message satisfies the association relationship.
[0074] Through the device's active discovery and selection mechanism, the association between the device and a single gateway is clearly defined, avoiding communication conflicts and execution confusion caused by multiple gateways sending control commands simultaneously. This ensures the consistency of control commands received by the device and the expected execution results, reducing resource waste and control failures caused by multiple redundant commands.
[0075] In an embodiment of the present invention, when a target device is initialized, it broadcasts a gateway discovery request, receives a first response message from each gateway, determines parameter information corresponding to each first response message, and the parameter information includes at least one of signal quality, priority, system load, and the number of associated devices. Based on the parameter information, an associated gateway is determined from each gateway, and a confirmation message is sent to the associated gateway to establish an association relationship with the associated gateway. The associated gateway is used to store the association relationship and communicate based on the associated gateway. As a result, the target device communicates based on the associated gateway, avoiding control conflicts and message duplication, while also reducing the load on the air interface, thereby improving the overall communication efficiency of the network and enhancing the stability and performance of the entire network.
[0076] Figure 2 It is an interaction diagram of a communication method according to an embodiment of the present invention. Figure 2 The communication method shown is used to establish an association between a device and a gateway, and specifically includes the following steps:
[0077] Step S101: Initialize the target device.
[0078] In this embodiment, the device starts up and prepares to access the network. After the device starts up, it performs a self-check and enters a standby mode, waiting for network discovery and connection.
[0079] Specifically, target device initialization refers to the operation or steps that start the network access process. Specifically, in a SigMesh network environment, initialization is a key step for new devices that need to be connected to the network or for devices that already exist on the network but are experiencing poor network conditions or even disconnection. This process usually involves operations such as device authentication and network configuration parameter settings to enable these devices to correctly and securely access the SigMesh network and ensure normal data communication.
[0080] Step S102: Broadcast a gateway discovery request.
[0081] Step S103: Broadcast a gateway discovery request.
[0082] Step S104: Broadcast a gateway discovery request.
[0083] Figure 2 The illustrated process uses a SigMesh network with three gateways as an example. In steps S102-S104, a device broadcasts a gateway discovery request to find an available primary gateway. The device sends a broadcast message containing a device identifier, a request identifier, and a timestamp to find all available gateways in the network.
[0084] Specifically, the target device broadcasts a gateway discovery request. During this process, the target device sends a broadcast message, namely a gateway discovery request. The gateway discovery request is used to find an available gateway in the network in order to establish or re-establish a connection with the network.
[0085] The gateway discovery request includes one or more of device identification information, device type and function, service requirements, network configuration information, signal strength indication, timestamp or other dynamic information, security-related information, etc.
[0086] The device identification information is used to uniquely identify the device sending the request, and may include the device name, serial number, or MAC (Media Access Control Address) address, etc., to ensure that the gateway can identify the specific device.
[0087] The device type and capability describe the function and type of the device, such as whether it is a sensor, controller, or other type of device. This helps the gateway understand the purpose of the device and its role in the network.
[0088] Service requirements indicate the type of service that the device hopes to obtain through the gateway, such as data transmission rate requirements, security level requirements, etc. This helps the gateway determine whether it can meet the needs of the device.
[0089] Network configuration information contains the device's current network settings, such as the network ID it is trying to connect to, encryption method, etc.
[0090] The signal strength indicator is used to help the gateway understand the distance or signal quality between the device and the gateway, thereby optimizing network performance.
[0091] Timestamps or other dynamic information: To prevent decisions from being made based on outdated information, include timestamps or other dynamically generated data to ensure the freshness and relevance of communications.
[0092] Security-related information includes authentication requests, encryption algorithm support, etc., to ensure the security of subsequent connections.
[0093] In this embodiment, the target device sends the gateway discovery request in a broadcast manner, and each gateway can receive the gateway discovery request.
[0094] Step S105: Send a first response message.
[0095] In this embodiment, each gateway sends a first response message after receiving a gateway discovery request. This message contains information such as the gateway's signal quality, priority, resource load, and the number of currently associated devices. After receiving a device's discovery request, each gateway analyzes the current network status and returns a response message. The first response message contains information such as the gateway's identity, signal strength, priority, resource load (CPU and memory usage), and the number of currently associated devices.
[0096] Specifically, after receiving the gateway discovery request, the gateway 1a sends a first response message to the target device, so that the target device can understand the identity of the gateway and the services it provides.
[0097] The first response message includes gateway identification information, supported services and functions, network configuration parameters, security-related information and related parameter information, etc.
[0098] The gateway identification information is used to uniquely identify the gateway, including the gateway name, serial number or MAC address, to ensure that the device can identify the specific gateway.
[0099] Supported services and functions describe the functions and service types supported by the gateway, such as data transmission rate, supported protocol version (such as SigMesh protocol version), Quality of Service (QoS) level, etc.
[0100] Network configuration parameters include information about the network to which the gateway is connected, such as network ID, encryption method, frequency channel, etc.
[0101] Security-related information includes supported security mechanisms and protocols, such as encryption algorithms and authentication methods.
[0102] Furthermore, the relevant parameter information includes signal quality, priority, system load, and the number of associated devices.
[0103] The signal quality refers to the quality of the wireless communication link between the target device and the gateway, which can be measured by the received signal strength indication (RSSI).
[0104] Priority indicates a gateway's importance within the network or its current availability. For example, in some cases, a specific gateway may be prioritized to optimize network resource utilization or ensure connection quality for critical devices. A gateway with a higher priority may be a more ideal choice.
[0105] System load indicates how busy the gateway is currently processing tasks, including but not limited to the amount of data being transferred, the number of connected devices and their activity levels, etc. A lower system load means the gateway has more resources available for new connections, providing more stable and efficient service.
[0106] The number of associated devices is the number of devices that the current gateway has associated with.
[0107] Step S106: Send a first response message.
[0108] In this embodiment, after receiving the gateway discovery request, the gateway 1b sends a first response message to the target device.
[0109] Step S107: Send a first response message.
[0110] In this embodiment, after receiving the gateway discovery request, the gateway 1c sends a first response message to the target device.
[0111] That is, the target device sends the gateway discovery request in a broadcast manner, and each gateway can receive the gateway discovery request. The gateway that receives the gateway discovery request returns a first response message to the target device.
[0112] Step S108: Determine the associated gateway.
[0113] In this embodiment, the device analyzes all received first response messages from gateways and selects the optimal gateway based on criteria such as signal quality, priority, and resource load. The device collects and analyzes all received gateway responses and determines the optimal primary gateway based on selection criteria such as signal strength, priority, resource load, and number of associated devices.
[0114] Specifically, after receiving the first response messages sent by each gateway, the target device processes the received first response messages within a specified time and selects an associated gateway.
[0115] Specifically, Figure 3 FIG. 1 is a flow chart of obtaining an associated gateway according to an embodiment of the present invention. Figure 3 As shown, obtaining the associated gateway includes the following steps:
[0116] Step S1081: Determine the parameter value corresponding to each parameter information.
[0117] In this embodiment, the target device determines parameter information corresponding to each first response message, wherein the parameter information includes at least one of signal quality, priority, system load, and number of associated devices. Each parameter is quantified to obtain a corresponding parameter value.
[0118] For example, for signal quality RSSI, generally speaking, the range of RSSI value is from -100dBm (very weak signal) to 0dBm (strong signal). Therefore, the quantification of signal quality can be expressed as:
[0119] A1=E+RSSI
[0120] Wherein, A1 is the parameter value corresponding to the signal quality, E is a preset constant, and RSSI is the received signal strength indicator.
[0121] As mentioned earlier, RSSI typically ranges from -100dBm to 0dBm. Within this range, values closer to 0dBm represent stronger signals, while values closer to -100dBm represent weaker signals. Assuming E is set to 100, the above formula can be used to map the original RSSI value (assuming it ranges from -100 to 0) to a new range of 0 to 100. This results in a new value that is a positive number ranging from 0 to 100, with larger values representing stronger signal strength.
[0122] Priorities can be pre-set based on the priority classification, and parameter values corresponding to each priority can be set to quantify them. For example, assume that priorities are divided into five levels (lowest, low, medium, medium-high, and high), and the parameter values corresponding to lowest, low, medium, medium-high, and high are set to 20, 40, 60, 80, and 100, respectively. In this way, priorities can be quantified.
[0123] Regarding system load, generally speaking, a higher system load means more resource usage, which may not be the best choice. Therefore, it can be quantified by the following formula:
[0124]
[0125] Among them, A3 is the parameter value corresponding to the system load, L C is the current system load, L M is the maximum system load.
[0126] The maximum system load can be the maximum number of connected devices, the maximum data processing volume, etc. obtained based on the hardware specifications of the gateway or historical data.
[0127] Regarding the number of associated devices, generally speaking, a larger number of associated devices means more gateway resources are occupied, which may not be the best choice. Therefore, it can be quantified by the following formula:
[0128]
[0129] Among them, A4 is the parameter value corresponding to the number of associated devices, N C is the current number of associated devices, L M The maximum number of associated devices.
[0130] Among them, L M It can be a preset value, such as 10, 15, 20, etc.
[0131] Step S1082: Perform weighted summation on the parameter values according to predetermined weights to obtain a correlation score corresponding to each gateway.
[0132] In this embodiment, weights corresponding to various parameter values are preset, and the parameter values are weighted and summed according to the predetermined weights to obtain the association scores corresponding to various gateways.
[0133] Assuming that the weights of signal quality, priority, system load, and number of associated devices are W1, W2, W3, and W4 respectively, the formula for calculating the association score is as follows:
[0134] S=W1*A1+W2*A2+W3*A3+W4*A4
[0135] Among them, A1 is the parameter value corresponding to signal quality, A2 is the parameter value corresponding to priority, A3 is the parameter value corresponding to system load, and A4 is the parameter value corresponding to the number of associated devices.
[0136] In some embodiments, W1, W2, W3, and W4 are all positive numbers, and W1+W2+W3+W4=1.
[0137] Step S1083: Determine the associated gateway among the gateways according to the association scores.
[0138] In this embodiment, the gateway with the highest association score is selected as the associated gateway.
[0139] Step S109: Send a confirmation message.
[0140] In this embodiment, the device sends a selection confirmation message to the selected preferred gateway to confirm that the gateway serves as the primary gateway. The device sends a selection confirmation message containing a device identifier, an associated gateway identifier, a confirmation status, and a timestamp to notify the selected gateway that it has been confirmed as the primary gateway.
[0141] That is, after the target device determines the associated gateway, it sends a confirmation message to the associated gateway. Figure 2 In the description, the target device selects gateway 2b as the associated gateway as an example.
[0142] Step S110: Save the association relationship.
[0143] In this embodiment, after receiving the confirmation message, the association gateway establishes an association relationship with the association gateway and stores the association relationship.
[0144] Storing the association relationship may include storing a unique identifier of the target device in a relationship table, where the unique identifier is used to identify a unique device, and may be a device identifier or a communication address.
[0145] In an embodiment of the present invention, when a target device is initialized, it broadcasts a gateway discovery request, receives a first response message from each gateway, determines parameter information corresponding to each first response message, and the parameter information includes at least one of signal quality, priority, system load, and the number of associated devices. Based on the parameter information, an associated gateway is determined from each gateway, and a confirmation message is sent to the associated gateway to establish an association relationship with the associated gateway. The associated gateway is used to store the association relationship and communicate based on the associated gateway. As a result, the target device communicates based on the associated gateway, avoiding control conflicts and message duplication, while also reducing the load on the air interface, thereby improving the overall communication efficiency of the network and enhancing the stability and performance of the entire network.
[0146] Figure 4 It is an interaction diagram of a communication method according to another embodiment of the present invention. Figure 4 The communication method shown is used to implement the heartbeat mechanism and the connection maintenance and self-recovery process, and specifically includes the following steps:
[0147] Step S201: Send a heartbeat message.
[0148] In this embodiment, the device periodically sends heartbeat messages to the primary gateway to confirm the status of the gateway and maintain the connection.
[0149] Specifically, after establishing a connection, the device enters normal operation. At predetermined intervals, the device periodically sends heartbeat messages to the primary gateway. These messages contain the device's identity, status information, and a timestamp. Once the target device establishes an association with the associated gateway, it periodically sends heartbeat messages to the associated gateway using a periodic heartbeat timer.
[0150] Heartbeat messaging is a widely used technology in network communications, distributed systems, and IoT devices to confirm the active status of communication links and detect potential failures. The heartbeat mechanism maintains the validity of connections by periodically sending short messages (i.e., heartbeat messages) to ensure that the connection between devices or services at both ends is active.
[0151] Step S202: Send a second response message.
[0152] In this embodiment, after receiving the heartbeat message, the association gateway sends a second response message to the target device.
[0153] Step S203: Send a heartbeat message.
[0154] Step S204: Send a second response message.
[0155] In steps S203-S204, consistent with steps S201-S202, the target device periodically sends heartbeat messages to the associated gateway. If the associated gateway works normally, a second response message is returned.
[0156] That is, after receiving the heartbeat message, the associated gateway immediately responds with a second response message to confirm its online status.
[0157] Step S205: Determine the communication connection status.
[0158] In this embodiment, if no response is received within a preset heartbeat period, the device considers the associated gateway to be invalid. Specifically, after receiving the heartbeat message, the associated gateway sends a second response message containing a gateway identifier, a response confirmation, and a timestamp. If the device does not receive a heartbeat response within the preset period, the associated gateway is considered invalid. Thus, the target device can determine the communication connection status based on the received second response message.
[0159] Specifically, the target device periodically sends heartbeat messages to the associated gateway. If the associated gateway is functioning normally, a second response message is returned. If the associated gateway is functioning abnormally or is down, no second response message is returned. Thus, the target device determines that the communication connection state is abnormal in response to not receiving the second response message corresponding to the heartbeat message for a predetermined number of consecutive times.
[0160] If the communication connection status is normal, other processes are executed, for example, continuing to send heartbeat messages, or executing communication functions, etc.
[0161] Step S206: Re-establish the association relationship.
[0162] In this embodiment, in response to the abnormal communication connection state, the device rebroadcasts a gateway discovery request and searches for a new associated gateway to establish an association relationship. The specific implementation method can be found in steps S101-S110, and this embodiment of the present invention will not be further described here. Specifically, if the heartbeat times out, the device rebroadcasts a gateway discovery request, selects a new associated gateway, sends a selection confirmation message, establishes a connection, and continues the heartbeat mechanism.
[0163] For example, if the device does not receive a response from the primary gateway for three consecutive heartbeat cycles, it determines that the primary gateway has failed. The device will execute the timeout processing process, rebroadcast the discovery request, select a new gateway, send a selection confirmation message, and establish a connection with the new primary gateway, continuing the heartbeat mechanism.
[0164] Furthermore, after the new gateway establishes an association with the device, the device notifies the original gateway to disassociate and clear the old association record. Specifically, the device sends a selection confirmation message to the new associated gateway. After confirming the association, it sends a disassociation message to the original gateway, notifying it to clear the association record. Upon receiving this message, the original gateway clears the device's association record.
[0165] In this embodiment of the present invention, a heartbeat message is sent to the associated gateway. Upon receiving the heartbeat message, the associated gateway sends a second response message to the target device. Based on the received second response message, the target device determines the communication connection status with the associated gateway. In response to an abnormality in the communication connection status, the target device rebroadcasts a gateway discovery request and seeks a new associated gateway to establish an association relationship. This allows the target device to find a new associated gateway for communication when an associated gateway fails, thereby improving the stability and performance of the entire network.
[0166] Figure 5 It is an interaction diagram of a communication method according to yet another embodiment of the present invention. Figure 5 The communication method shown is used to implement the communication function, and specifically includes the following steps:
[0167] Step S301: Send a communication message.
[0168] Step S302: Send a communication message.
[0169] Step S303: Send a communication message.
[0170] In this embodiment, a message source sends a communication message to each gateway. The message source is the device that needs to send a communication message to the target device. The communication message includes information such as a unique identifier and communication content. The communication content can be control instructions or configuration information. The unique identifier is used to uniquely identify a device and can be a device identifier or communication address.
[0171] Step S304: Check whether the association relationship is satisfied.
[0172] Step S305, end.
[0173] Step S306: Check whether the association relationship is satisfied.
[0174] Step S307: Whether the association relationship is satisfied.
[0175] Step S308, end.
[0176] Step S309: Send a communication message.
[0177] In steps S304-S309, after receiving the communication message, each gateway obtains the unique identifier in the communication message and detects whether the unique identifier exists in the association relationship. If so, the communication message is forwarded; if not, the process ends, that is, the communication message is not forwarded.
[0178] exist Figure 5 In the embodiment shown, the description is made by taking the gateway 2b as an example in which the associated gateway of the target device is used.
[0179] For gateway 2a, in step S304, after receiving the communication message, it is determined through detection that the communication message does not satisfy the association relationship, and the process goes to step S305 and ends.
[0180] For gateway 2b, in step S306, after receiving the communication message, it is determined through detection that the communication message satisfies the association relationship, and then the process goes to step S309 to send the communication message to the target device.
[0181] For the gateway 2c, in step S307, after receiving the communication message, it is determined through detection that the communication message does not satisfy the association relationship, and the process goes to step S308 and ends.
[0182] Therefore, when multiple gateways receive communication messages for the same device, they decide whether to send the control command based on the associations they maintain with the sub-devices. When a gateway receives a control command, it first checks its internal device association table. If the device currently has a valid connection to the gateway, the gateway sends the control command; otherwise, it ignores the command.
[0183] In this embodiment of the present invention, upon receiving a communication message, the association gateway detects whether the message satisfies the association relationship. If so, the message is sent to the target device. This allows the target device to communicate via the association gateway, avoiding control conflicts and message duplication. This also reduces the load on the air interface, thereby improving overall network communication efficiency, stability, and performance.
[0184] As a result, devices select their associated gateways by directly broadcasting gateway discovery requests, rather than relying on negotiation between gateways. Each device selects a gateway with the best communication acquaintance based on priority information such as signal quality, gateway load, and capabilities. Furthermore, devices periodically send heartbeat messages to their selected primary gateway to confirm its online status and clarify its association with a single gateway. If a device does not receive a response from a gateway within the predetermined heartbeat period, it reselects an associated gateway. While no longer relying on synchronous communication between gateways, centralized management and logging can be performed through a central point (such as a cloud server) to ensure global visibility of network policies. By reducing inter-gateway communication and the need to explicitly associate devices with a single gateway, air interface load and potential network flooding are reduced. This reduces the need for distributed negotiation protocols and consensus algorithms, thereby reducing implementation complexity. This improves system robustness by eliminating the need for real-time synchronization between gateways, reducing single points of failure and enhancing network stability. This conserves network resources, and the centralized and intuitive device-gateway association mechanism reduces inter-device communication load and potential conflicts. It also offers improved scalability, as the complex coordination process between gateways is eliminated, allowing for greater system scalability when adding new devices or gateways.
[0185] Figure 6 FIG. 1 is a flow chart of a communication method according to an embodiment of the present invention. Figure 6 As shown, a communication method according to an embodiment of the present invention includes the following steps:
[0186] Step S410: In response to the target device initialization, a gateway discovery request is broadcast.
[0187] Step S420: Receive first response messages from each gateway.
[0188] Step S430: Determine parameter information corresponding to each first response message, where the parameter information includes at least one of signal quality, priority, system load, and the number of associated devices.
[0189] Step S440: Determine an associated gateway among the gateways according to the parameter information.
[0190] Step S450: Send a confirmation message to the association gateway to establish an association relationship with the association gateway, and the association gateway is used to store the association relationship.
[0191] Step S460: Communicate based on the associated gateway.
[0192] In some embodiments, the method further comprises:
[0193] Sending a heartbeat message to the association gateway, wherein the association gateway is configured to send a second response message to the target device when receiving the heartbeat message;
[0194] Determining a communication connection state with the associated gateway according to the received second response message;
[0195] In response to the abnormal communication connection state, the gateway discovery request is rebroadcasted, and a new associated gateway is found to establish an associated relationship.
[0196] In some embodiments, determining the communication connection status with the associated gateway according to the received second response message includes:
[0197] In response to the fact that the second response message corresponding to the heartbeat message is not received continuously for a predetermined number of times, it is determined that the communication connection state is abnormal.
[0198] In some embodiments, determining an associated gateway among the gateways according to the parameter information includes:
[0199] Determine the parameter value corresponding to each parameter information;
[0200] Performing weighted summation on the parameter values according to predetermined weights to obtain a correlation score corresponding to each gateway;
[0201] The associated gateway is determined among the gateways according to the associated scores.
[0202] In some embodiments, communicating based on the associated gateway includes:
[0203] The communication message sent by the association gateway is received, and the association gateway is used to forward the communication message to the target device when detecting that the communication message meets the association relationship.
[0204] In an embodiment of the present invention, when a target device is initialized, it broadcasts a gateway discovery request, receives a first response message from each gateway, determines parameter information corresponding to each first response message, and the parameter information includes at least one of signal quality, priority, system load, and the number of associated devices. Based on the parameter information, an associated gateway is determined from each gateway, and a confirmation message is sent to the associated gateway to establish an association relationship with the associated gateway. The associated gateway is used to store the association relationship and communicate based on the associated gateway. As a result, the target device communicates based on the associated gateway, avoiding control conflicts and message duplication, while also reducing the load on the air interface, thereby improving the overall communication efficiency of the network and enhancing the stability and performance of the entire network.
[0205] Figure 7 Schematic diagram of a communication device according to an embodiment of the present invention. Figure 7 As shown, the communication device of the embodiment of the present invention includes a broadcast unit 71, a first receiving unit 72, an information determination unit 73, an associated gateway determination unit 74, a confirmation message sending unit 75, and a communication unit 76. The broadcast unit 71 is configured to broadcast a gateway discovery request in response to target device initialization. The first receiving unit 72 is configured to receive first response messages from each gateway. The information determination unit 73 is configured to determine parameter information corresponding to each first response message, wherein the parameter information includes at least one of signal quality, priority, system load, and the number of associated devices. The associated gateway determination unit 74 is configured to determine an associated gateway from each gateway based on the parameter information. The confirmation message sending unit 75 is configured to send a confirmation message to the associated gateway to establish an association relationship with the associated gateway, and the associated gateway is configured to store the association relationship. The communication unit 76 is configured to communicate based on the associated gateway.
[0206] In an embodiment of the present invention, when a target device is initialized, it broadcasts a gateway discovery request, receives a first response message from each gateway, determines parameter information corresponding to each first response message, and the parameter information includes at least one of signal quality, priority, system load, and the number of associated devices. Based on the parameter information, an associated gateway is determined from each gateway, and a confirmation message is sent to the associated gateway to establish an association relationship with the associated gateway. The associated gateway is used to store the association relationship and communicate based on the associated gateway. As a result, the target device communicates based on the associated gateway, avoiding control conflicts and message duplication, while also reducing the load on the air interface, thereby improving the overall communication efficiency of the network and enhancing the stability and performance of the entire network.
[0207] Figure 8 Schematic diagram of an electronic device according to an embodiment of the present invention. In this embodiment, the electronic device 8 includes a server, a terminal, etc. Figure 8 As shown, the electronic device 8 includes: at least one processor 81; a memory 82 communicatively connected to the at least one processor 81; and a communication component 83 communicatively connected to the scanning device, the communication component 83 receiving and sending data under the control of the processor 81; wherein the memory 82 stores instructions that can be executed by the at least one processor 81, and the instructions are executed by the at least one processor 81 to implement the above-mentioned communication method.
[0208] Specifically, the electronic device includes: one or more processors 81 and a memory 82, Figure 8 In the example, a processor 81 is used. The processor 81 and the memory 82 can be connected via a bus or other means. Figure 8 In the example above, a bus connection is used. Memory 82, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs, and modules. Processor 81 executes the non-volatile software programs, instructions, and modules stored in memory 82 to execute various functional applications and data processing of the device, thereby implementing the aforementioned communication method.
[0209] The memory 82 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store a list of options, etc. Furthermore, the memory 82 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 82 may optionally include a memory remotely located relative to the processor 81, and such remote memory may be connected to an external device via a network. Examples of the aforementioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0210] One or more modules are stored in the memory 82 and, when executed by one or more processors 81 , perform the communication method in any of the above method embodiments.
[0211] The above-mentioned product can execute the method provided in the embodiment of this application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of this application.
[0212] In an embodiment of the present invention, when a target device is initialized, it broadcasts a gateway discovery request, receives a first response message from each gateway, determines parameter information corresponding to each first response message, and the parameter information includes at least one of signal quality, priority, system load, and the number of associated devices. Based on the parameter information, an associated gateway is determined from each gateway, and a confirmation message is sent to the associated gateway to establish an association relationship with the associated gateway. The associated gateway is used to store the association relationship and communicate based on the associated gateway. As a result, the target device communicates based on the associated gateway, avoiding control conflicts and message duplication, while also reducing the load on the air interface, thereby improving the overall communication efficiency of the network and enhancing the stability and performance of the entire network.
[0213] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used to enable a computer to execute part or all of the above method embodiments.
[0214] That is, those skilled in the art will understand that all or part of the steps in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a program, which is stored in a storage medium and includes a number of instructions for causing a device (which may be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the methods described in the embodiments of the present application. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., various media that can store program code.
[0215] The foregoing is merely a preferred embodiment of the present application and is not intended to limit the present application. Persons skilled in the art will readily appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application are intended to be within the scope of protection of the present application.
Claims
1. A communication method, characterized in that: The method comprises: In response to the target device initialization, broadcasting a gateway discovery request; Receive first response messages from each gateway; Determining parameter information corresponding to each first response message, the parameter information including at least one of signal quality, priority, system load, and number of associated devices; Determining an associated gateway among the gateways according to the parameter information; Sending a confirmation message to the association gateway to establish an association relationship with the association gateway, wherein the association gateway is used to store the association relationship; Communication is performed based on the associated gateway.
2. The method according to claim 1, characterized in that The method further comprises: Sending a heartbeat message to the association gateway, wherein the association gateway is configured to send a second response message to the target device when receiving the heartbeat message; Determining a communication connection state with the associated gateway according to the received second response message; In response to the abnormal communication connection state, the gateway discovery request is rebroadcasted, and a new associated gateway is found to establish an associated relationship.
3. The method according to claim 2, characterized in that The determining of the communication connection state with the associated gateway according to the received second response message includes: In response to the fact that the second response message corresponding to the heartbeat message is not received continuously for a predetermined number of times, it is determined that the communication connection state is abnormal.
4. The method according to claim 1, wherein Determining an associated gateway among the gateways according to the parameter information includes: Determine the parameter value corresponding to each parameter information; Performing weighted summation on the parameter values according to predetermined weights to obtain a correlation score corresponding to each gateway; The associated gateway is determined among the gateways according to the associated scores.
5. The method according to claim 1, wherein The communicating based on the associated gateway includes: The communication message sent by the association gateway is received, and the association gateway is used to forward the communication message to the target device when detecting that the communication message meets the association relationship.
6. A communication system, characterized in that: The system comprises: at least one device, configured to broadcast a gateway discovery request in response to device initialization; at least one gateway, configured to send a first response message to the target device upon receiving a gateway discovery request sent by the target device; The target device is further configured to receive first response messages from each gateway, determine parameter information corresponding to each first response message, the parameter information including at least one of signal quality, priority, system load, and number of associated devices, determine an associated gateway from among the gateways based on the parameter information, and send a confirmation message to the associated gateway; The association gateway is further configured to establish an association relationship with the target device upon receiving the confirmation message, and store the association relationship; The target device communicates based on the associated gateway.
7. The system according to claim 6, characterized in that The target device is further configured to send a heartbeat message to the associated gateway, and the associated gateway is configured to send a second response message to the target device upon receiving the heartbeat message; The target device is further configured to determine a communication connection state with the associated gateway according to the received second response message, and in response to an abnormality in the communication connection state, rebroadcast a gateway discovery request and search for a new associated gateway to establish an association relationship.
8. The system according to claim 7, characterized in that The target device is configured to determine that the communication connection state is abnormal in response to failure to continuously receive a second response message corresponding to the heartbeat message for a predetermined number of times.
9. The system according to claim 6, wherein: The target device is used to determine parameter values corresponding to various parameter information, perform weighted summation on the parameter values according to predetermined weights to obtain association scores corresponding to various gateways, and determine the associated gateway among the various gateways according to the association scores.
10. The system according to claim 6, wherein: The target device is used to receive the communication message sent by the association gateway, and the association gateway is used to forward the communication message to the target device when detecting that the communication message meets the association relationship.
11. A communication device, characterized in that: The device comprises: A broadcast unit, configured to broadcast a gateway discovery request in response to target device initialization; A first receiving unit, configured to receive a first response message from each gateway; an information determining unit, configured to determine parameter information corresponding to each first response message, the parameter information including at least one of signal quality, priority, system load, and number of associated devices; an associated gateway determining unit, configured to determine an associated gateway among the gateways according to the parameter information; a confirmation message sending unit, configured to send a confirmation message to the association gateway to establish an association relationship with the association gateway, wherein the association gateway is configured to store the association relationship; A communication unit is configured to communicate based on the associated gateway.
12. An electronic device comprising a memory and a processor, characterized in that: The memory is configured to store one or more computer program instructions, wherein the one or more computer program instructions are executed by the processor to implement the method according to any one of claims 1 to 5.
13. A computer program product comprising a computer program, characterized in that When the computer program is run on a computer, the computer executes the method according to any one of claims 1 to 5.
14. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: The computer program instructions implement the method according to any one of claims 1 to 5 when executed by a processor.