Networking method, apparatus, system, medium, product and device
Patent Information
- Application Number
- CN202410528597.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-29
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2044-04-29
AI Technical Summary
在多个设备之间的交互联动场景中,现有技术存在云端服务器控制信号执行时间长、数据泄露风险高、网络质量影响大以及本地服务器处理压力大和成本高等问题。
采用网关设备实现设备间的直接联动,通过BLE Mesh网络和IP网络的组合,利用CoAP协议进行状态观察和消息反馈,建立分布式组网,减少对外网云端服务器的依赖。
提高了设备组网的稳定性和安全性,降低了数据处理要求和成本,减少了网络带宽占用,实现了更快速的控制信号执行。
Smart Images

Figure CN118827742B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, and in particular to a networking method, apparatus, system, medium, product and equipment. Background Technology
[0002] In scenarios involving interaction between multiple devices connected to different networks (such as scene linkage between smart devices), it is necessary to establish relationships between these devices for interaction and linkage. Currently, interaction and linkage between multiple devices are typically handled by setting up a local server as the communication hub for each device, or by connecting each device to an external cloud server.
[0003] However, the cloud server solution has problems such as long execution time for control signals, potential data leakage, significant impact from network quality, and potential interruption of the external network during execution; while the local server solution has problems such as high message processing pressure on the server when there are many devices on the network, high requirements for server message processing capabilities and stability, and high cost. Summary of the Invention
[0004] To address the aforementioned technical problems, embodiments of this application propose a networking method, apparatus, system, medium, product, and equipment.
[0005] This application provides a networking method applied to a gateway device, wherein the gateway device and a plurality of first network devices are all connected to a first network, the gateway device and a plurality of second network devices are all communicatively connected, and the plurality of second network devices are connected to a second network different from the first network, the method comprising:
[0006] In response to a first linkage request sent by any first network device, observe the second target network device among the plurality of second network devices that corresponds to the first linkage request;
[0007] When a change in the state of the second target network device is observed, a first message indicating the change in the state of the second target network device is fed back to any of the first network devices.
[0008] In response to a second linkage request sent by any second network device, when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, a second message is fed back to any second network device, wherein the second message is used to indicate the state change of the first target network device.
[0009] Furthermore, the first network is a BLE Mesh network, the first network device is a BLE Mesh network device, the gateway device is a BLE Mesh gateway device, the second network is an IP network, and the second network device is an IP network device.
[0010] Furthermore, both the gateway device and the plurality of second network devices support the CoAP protocol. The step of responding to a first linkage request sent by any first network device by observing the second target network device among the plurality of second network devices corresponding to the first linkage request includes:
[0011] Based on the CoAP protocol, actively register as an observer of the second target network device, so that the second target network device can report its own second CoAP resources or report its own second CoAP resources and change notifications, as the result observed for the second target network device;
[0012] The second CoAP resource is determined from all CoAP resources of the second target network device based on the first linkage request, and the change notification of the second CoAP resource indicates the change of the second CoAP resource.
[0013] Furthermore, the first linkage request carries a subscription message, and the step of feeding back a first message to any of the first network devices to indicate the state change of the second target network device when a change in the state of the second target network device is observed includes:
[0014] Configure the subscription message into the first set of addresses, and add the first set of addresses to the local machine, so that both the first network device and the gateway device are associated with the first set of addresses;
[0015] Add the second CoAP resource to the local machine and establish a first mapping relationship between the first set of addresses and the second CoAP resource;
[0016] In response to a change notification of the second CoAP resource, the first message is sent to the first group of addresses based on the first mapping relationship, so that any of the first network devices can obtain the first message, wherein the first message is determined by the change notification of the second CoAP resource.
[0017] Furthermore, the resource visibility, resource access permissions, and resource observation characteristics in the CoAP resources of each second network device are determined based on the access security rules and / or functional characteristics of that second network device.
[0018] Furthermore, both the gateway device and the plurality of first network devices support the CoAP protocol. The second linkage request is used to instruct the gateway device to register any of the second network devices as an observer of a first CoAP resource of the first target network device. The first CoAP resource is determined among all CoAP resources of the first target network device based on the second linkage request.
[0019] Furthermore, when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, the step of feeding back a second message to any of the second network devices includes:
[0020] Based on the second linkage request, determine the device publication message of the first target network device;
[0021] Configure the device publishing message to the second set of addresses, add the second set of addresses to the local machine, and send the device publishing message to the first target network device, so that both the first target network device and the gateway device are associated with the second set of addresses;
[0022] Add the first CoAP resource to the local machine and establish a second mapping relationship between the second set of addresses and the first CoAP resource;
[0023] In response to a change notification of the first CoAP resource sent by the first target network device to the second set of addresses, the second message is fed back to any of the second network devices based on the second mapping relationship, wherein the change notification of the first CoAP resource indicates a change in the first CoAP resource, and the second message is determined by the change notification of the first CoAP resource.
[0024] Furthermore, the gateway device is communicatively connected to several second network devices, including:
[0025] The gateway device is added to a distributed network formed by connecting the plurality of second network devices, so that the gateway device and the plurality of second network devices form a distributed network.
[0026] Furthermore, the gateway device is used to communicate with the plurality of first network devices through the Proxy node function. The gateway device pre-stores a whitelist and / or blacklist for message filtering processing in the Proxy node function. The gateway device is used to configure and manage each device connected in the first network.
[0027] Furthermore, the gateway device stores an online status table, which records the online status of each of the plurality of first network devices. The method further includes:
[0028] In response to a device discovery request sent by the second network device, based on the online status table, current online device information is fed back to the second network device, wherein the current online device information is used to indicate the devices whose online status is characterized as currently online among the plurality of first network devices.
[0029] Furthermore, the method also includes at least one of the following:
[0030] According to a preset period, a second heartbeat message is sent to the plurality of second network devices, wherein the second heartbeat message carries the online status table;
[0031] Receive a first heartbeat message sent by any first network device, wherein the first heartbeat message is used to update the online status of the corresponding first network device recorded in the online status table.
[0032] This application embodiment also provides a networking device applied to a gateway device, wherein the gateway device and a plurality of first network devices are all connected to a first network, the gateway device and a plurality of second network devices are all communicatively connected, and the plurality of second network devices are connected to a second network different from the first network, the device comprising:
[0033] The first linkage request response module is used to respond to a first linkage request sent by any first network device and observe the second target network device corresponding to the first linkage request among the plurality of second network devices;
[0034] The first message feedback module is used to feed back a first message indicating the state change of the second target network device to any of the first network devices when a change in the state of the second target network device is observed.
[0035] The second linkage request response module is used to respond to a second linkage request sent by any second network device. When it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, the module sends a second message to any second network device, wherein the second message is used to indicate the state change of the first target network device.
[0036] This application embodiment also provides a networking system, including a gateway device, a plurality of first network devices, and a plurality of second network devices. The gateway device and the plurality of first network devices are all connected to a first network, and the gateway device and the plurality of second network devices are all communicatively connected. The plurality of second network devices are connected to a second network different from the first network.
[0037] Any first network device is used to send a first linkage request to the gateway device;
[0038] The gateway device is configured to respond to the first linkage request, observe the second target network device corresponding to the first linkage request among the plurality of second network devices, and when the state of the second target network device is observed to change, send a first message to any first network device to indicate the state change of the second target network device.
[0039] Any second network device is used to send a second linkage request to the gateway device;
[0040] The gateway device is further configured to respond to the second linkage request and, when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, to send a second message to any of the second network devices, wherein the second message is used to indicate the state change of the first target network device.
[0041] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the networking method described in any of the above claims.
[0042] This application also provides a computer program product, including computer instructions that, when executed by a processor, implement the steps of the networking method described in any of the above claims.
[0043] This application also provides a computer device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the steps of the networking method described in any of the above claims.
[0044] In summary, the embodiments of this application have at least one of the following beneficial effects:
[0045] 1) After the devices are networked, the data exchanged between the network devices does not need to be forwarded through the external cloud server when they are linked, thereby reducing the time required for the execution of control signals, improving the security of data transmission, and being unaffected by the network quality and / or disconnection between the network devices and the cloud server, thus achieving a more stable device network.
[0046] 2) Since the gateway device only needs to process messages describing the state changes of the target network devices that the network devices need to link, the amount of data that the gateway device needs to process is less, reducing the data processing requirements and network bandwidth consumption. In addition, there is no need to set up a local server, thus saving costs. Attached Figure Description
[0047] Figure 1 This is a flowchart illustrating a networking method provided in an embodiment of this application;
[0048] Figure 2 This is a schematic diagram of the structure of a networking device provided in an embodiment of this application;
[0049] Figure 3 This is a schematic diagram of a networking system provided in an embodiment of this application;
[0050] Figure 4 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application;
[0051] Figure 5 This is a schematic diagram of the network configuration provided in an embodiment of this application;
[0052] Figure 6 This is a schematic diagram of the Proxy node function provided in the embodiments of this application;
[0053] Figure 7 This is a schematic diagram of data interaction between two devices in a distributed network provided in an embodiment of this application. Detailed Implementation
[0054] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0055] In the description of this application, the terms "first," "second," "third," etc., are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined with "first," "second," "third," etc., may explicitly or implicitly include one or more of that feature. In the description of this application, unless otherwise stated, "a plurality of" means two or more. In the description of this application, the term "comprising" and its variations are open-ended, meaning "including but not limited to." The term "based on" means "at least partially based on." The term "according to" means "at least partially according to." The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments."
[0056] In the description of this application, it should be noted that, unless otherwise expressly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection between two components. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0057] In the description of this application, it should be noted that, unless otherwise defined, all technical and scientific terms used in this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in this application is for the purpose of describing specific embodiments only and is not intended to limit the application. Those skilled in the art can understand the specific meaning of the above terms in this application based on the specific circumstances.
[0058] The following explains some terms and concepts used in the embodiments of this application:
[0059] BLE: Bluetooth Low Energy (or Bluetooth LE) is a personal area network (PAN) technology designed and marketed by the Bluetooth Special Interest Group (SIG). It is intended for emerging applications in healthcare, sports and fitness, beacons, security, and home entertainment. Compared to classic Bluetooth, Bluetooth Low Energy aims to significantly reduce power consumption and cost while maintaining the same communication range.
[0060] Mesh networks, also known as wireless mesh networks, are multi-hop networks evolved from ad hoc networks and are a key technology for solving the "last mile" problem. Wireless is an indispensable technology in the evolution to next-generation networks. Wireless meshes can communicate collaboratively with other networks, forming a dynamic and continuously expandable network architecture where any two devices can maintain wireless interconnection.
[0061] IP Networks: IP (Internet Protocol) refers to the Internet Protocol. IP is the core of the entire TCP / IP protocol suite and the foundation of the Internet. IP resides in the network layer of the TCP / IP model (equivalent to the network layer of the OSI model). It can provide information on various protocols, such as TCP and UDP, to the transport layer; and it can place IP packets at the link layer for transmission through various technologies such as Ethernet and Token Ring networks.
[0062] See Figure 1 This diagram illustrates a network topology method according to an embodiment of this application. The method is applied to a gateway device, which is connected to a first network along with several first network devices. The gateway device is also communicatively connected to several second network devices, which are connected to a second network different from the first network. The method includes steps S1-S3, as detailed below:
[0063] S1, in response to a first linkage request sent by any first network device, observe the second target network device among the plurality of second network devices that corresponds to the first linkage request;
[0064] Specifically, in this embodiment, since both the gateway device and the first network device are connected to the first network, the first linkage request can be transmitted directly through the first network. As for the second target network device, since there is a communication connection between it and the gateway device, the gateway device can use the communication connection to observe the second target network device.
[0065] It should be noted that in this embodiment, there may be one or more first network devices that send the first linkage request to the gateway device. The first linkage request sent by each first network device may correspond to the same or different second target network devices, which means that each first network device that sends the first linkage request needs to link with the second target network device corresponding to the first linkage request it sent.
[0066] For example, the first network in this embodiment can be any of the following:
[0067] In the case of Ethernet, the first network device and the gateway device can transmit various messages / requests via Ethernet cable through the TCP / IP protocol stack;
[0068] In a wireless local area network (WLAN), such as a Wi-Fi network, the first network device and the gateway device can transmit various messages / requests in the form of radio waves through the air using Wi-Fi protocols (such as the 802.11 series standards).
[0069] Whether wired or wireless, message transmission between the first network device and the gateway device typically uses protocols such as ARP (Address Resolution Protocol) to locate the MAC address (Media Access Control Address) of the destination device. Then, data is encapsulated through transport layer protocols such as TCP (Transmission Control Protocol) and UDP (User Datagram Protocol). Finally, various messages / requests are routed and transmitted within the local area network via the IP (Internet Protocol).
[0070] Specific application protocols may encapsulate the specific message content within a specific application layer protocol. For example, MQTT (Message Queuing Telemetry Transport) is used for message passing between IoT devices, or CoAP (Constrained Application Protocol) is used for resource-constrained network devices.
[0071] Furthermore, the second network in this embodiment can also be the network shown in the above embodiments, as long as the second network is different from the network selected by the first network, which will not be elaborated here.
[0072] For example, the communication connection can be any of the following:
[0073] Gateway bridging allows gateway devices to act as bridges between different networks. Through protocol conversion or routing functions, they transform data packets from one network to another, converting them into a format or protocol that the other network can recognize. For example, a gateway can simultaneously connect to Wi-Fi and cellular networks (such as 4G / 5G) and transmit data packets between the two networks using network tunneling technologies such as GRE (Generic Routing Encapsulation), L2TP (Layer 2 Tunneling Protocol), and IPSec VPN (Internet Protocol Security Virtual Private Network).
[0074] Protocol conversion: Gateway devices can support multiple protocols and can convert between various protocols such as TCP / IP, UDP, MQTT, CoAP, and LoRa (Long Range Radio) according to the characteristics of different networks, enabling devices on two different networks to communicate through the gateway.
[0075] S2, when a change in the state of the second target network device is observed, a first message indicating the change in the state of the second target network device is fed back to any of the first network devices;
[0076] It should be noted that, in this embodiment, after the gateway device observes a change in the state of the second target network device (for example, the gateway device can receive a second target network device state change message sent by the second target network device in response to a change in its own state through the communication connection shown in any of the above embodiments to determine that the state of the second target network device has changed), based on the observed change in the state of the second target network device, it generates a first message to indicate the change in the state of the second target network device, and sends it to all first network devices that have sent a first linkage request corresponding to the second target network device whose state has changed, thereby enabling the gateway device to promptly inform all first network devices that need to be linked with the second target network device of the state change of the second target network device.
[0077] Optionally, the first message can be transmitted through a pre-configured peer communication link between the gateway device and any of the first network devices to update the peer resource status.
[0078] S3, in response to a second linkage request sent by any second network device, when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, a second message is fed back to any second network device, wherein the second message is used to indicate the state change of the first target network device.
[0079] It should be noted that in this embodiment, there may be one or more second network devices that send a second linkage request to the gateway device. The second linkage request sent by each second network device may correspond to the same or different first target network devices, which means that each second network device that sends a second linkage request needs to link with the first target network device corresponding to its second linkage request.
[0080] Specifically, in this embodiment, since there is a communication connection between the gateway device and the first network device, the gateway device can receive the second linkage request sent by the second network device through the communication connection shown in any of the above embodiments. For the first target network device, the gateway device can determine the state of the first target network device through the first network it shares access with (for example, the gateway device can receive the first target network device state change message sent by the first target network device in response to a change in its own state through the first network to determine that the state of the first target network device has changed). After the determination, the gateway device can generate a second message to indicate the state change of the first target network device based on the determined state change of the first target network device, and send it to all the second network devices that have sent the second linkage request corresponding to the first target network device whose state has changed, so that the gateway device can promptly inform all the second network devices that need to be linked with the first target network device of the state change of the first target network device.
[0081] In this embodiment, after the devices complete the network formation, when the first network device and the second network device interact, the data required for the interaction can be forwarded by the gateway device without going through the external cloud server. This reduces the time required to execute control signals, improves data transmission security, and is unaffected by network quality and / or disconnection between the network devices and the cloud server, thus achieving a more stable device network. Furthermore, since the gateway device only needs to process messages describing the state changes of the target network device requiring interaction, the amount of data processed by the gateway device is reduced, lowering data processing requirements and network bandwidth consumption. Additionally, the elimination of the need to set up a local server saves costs.
[0082] Optionally, the second message can be transmitted through a pre-configured peer communication link between the gateway device and any of the second network devices to update the peer resource status.
[0083] In one optional implementation, the first network is a BLE Mesh network, the first network device is a BLE Mesh network device, the gateway device is a BLE Mesh gateway device, the second network is an IP network, and the second network device is an IP network device.
[0084] It should be noted that, see Figure 5 In this embodiment, the BLE Mesh gateway device is a gateway in the BLE Mesh network. It is used to configure the network access of each device that wants to access the BLE Mesh network and to configure the node functions of each device that has accessed the BLE Mesh network. In addition, since the BLE Mesh gateway device communicates with each IP network device, it can also be understood that the BLE Mesh gateway device also has the function of discovering other devices in the IP network and their capabilities on the IP network side. Similarly, the BLE Mesh gateway device and its capabilities can also be discovered by other devices in the IP network.
[0085] In this embodiment, the BLE Mesh gateway device can act as a message relay station between the BLE Mesh network and the IP network, thereby ensuring that the BLE Mesh gateway device can convert and send necessary interactive messages between the BLE Mesh network and the IP network (e.g., the first message and / or the second message described in the above embodiment), and filter other unnecessary messages.
[0086] In one optional implementation, both the gateway device and the plurality of second network devices support the CoAP protocol. The step of observing the second target network device among the plurality of second network devices corresponding to the first linkage request in response to a first linkage request sent by any first network device includes:
[0087] Based on the CoAP protocol, actively register as an observer of the second target network device, so that the second target network device can report its own second CoAP resources or report its own second CoAP resources and change notifications, as the result observed for the second target network device;
[0088] The second CoAP resource is determined from all CoAP resources of the second target network device based on the first linkage request, and the change notification of the second CoAP resource indicates the change of the second CoAP resource.
[0089] Specifically, in this embodiment, based on the CoAP protocol, actively registering as an observer for the second target network device can be achieved through the following steps: The gateway device selects to subscribe to or observe the second CoAP resource on the second target network device; the gateway device registers as an observer by sending a GET request (the standard operation used to obtain the resource value) carrying the "observe" option to the second target network device. This indicates that the gateway device expects to receive a notification describing the updated second CoAP resource whenever its data changes; after receiving the GET request, the second target network device confirms the gateway device's observer status and begins to periodically send CON (acknowledgment) messages to the client, carrying the latest resource value or change notification of the second CoAP resource, either periodically or when the resource content changes; the gateway device will continuously receive feedback from the second target network device regarding the second CoAP resource and its change notifications, thereby achieving real-time monitoring and management.
[0090] It should be understood that the second CoAP resource is the CoAP resource that any of the first network devices indicated by the first linkage request needs to subscribe to during the linkage process with the second target network device.
[0091] This embodiment can greatly improve the efficiency of information acquisition, especially in resource-constrained Internet of Things (IoT) environments.
[0092] Optionally, the gateway device may be pre-configured with a first resource observation condition, which includes AND / OR logic, trigger thresholds, and / or multiple preset CoAP resource changes. The step of actively registering as an observer of the second target network device based on the CoAP protocol includes: when the first resource observation condition is met, actively registering as an observer of the second target network device based on the CoAP protocol.
[0093] It should be noted that, in this embodiment and / or subsequent corresponding embodiments, for each device that supports the CoAP protocol, the CoAP resources of the device can be used to describe the interactive identification function of the device. The interactive identification function can include attributes, actions and / or events. Examples of attributes can include sensor values (configured to be read-only), configuration parameters (configured to be read-write), object states (configured to be read-only or read-write), etc. Examples of actions can include changing multiple attributes simultaneously and / or changing attributes over time or through a non-disclosed process (such as a proprietary control loop algorithm) (such as dimming lights), etc. Examples of events can include alarms and / or timed push events, etc.
[0094] In one optional implementation, the first linkage request carries a subscription message, and the step of feeding back a first message to either of the first network devices to indicate the state change of the second target network device when a change in the state of the second target network device is observed includes:
[0095] Configure the subscription message into the first set of addresses, and add the first set of addresses to the local machine, so that both the first network device and the gateway device are associated with the first set of addresses;
[0096] Add the second CoAP resource to the local machine and establish a first mapping relationship between the first set of addresses and the second CoAP resource;
[0097] In response to a change notification of the second CoAP resource, the first message is sent to the first group of addresses based on the first mapping relationship, so that any of the first network devices can obtain the first message, wherein the first message is determined by the change notification of the second CoAP resource.
[0098] Specifically, in this embodiment, after receiving a subscription message from any first network device indicating a corresponding subscription action, the gateway device configures the subscription message into the first set of addresses to be subscribed to. At this time, the gateway device is responsible for processing and forwarding these subscription messages. The gateway device first records the subscription message in its internal configuration storage, that is, it associates the first set of addresses with the subscription action corresponding to the subscription message. At the same time, in order to ensure that all relevant first network devices can receive the message to subscribe to the first set of addresses, the gateway device adds the first set of addresses to its local subscription list. In this way, whenever a message to be subscribed to for the subscription action is sent to the first set of addresses, whether it is directly aimed at the gateway device or generated by other network devices, the gateway device will broadcast or forward the message sent to the first set of addresses to all first network devices that have subscribed to the first set of addresses according to its local subscription list. In general, the gateway device acts as an intermediary and agent in this process, enabling multiple first network devices to share and synchronize relevant information by subscribing to the same set of addresses.
[0099] Optionally, if any of the first network devices needs to cancel the linkage with the second target network device, the first network device may send a first linkage cancellation request to the gateway device. After receiving the first linkage cancellation request, the gateway device cancels all steps executed in response to the first linkage request, thereby canceling the linkage between the first network device and the second target network device.
[0100] In one alternative implementation, the resource visibility, resource access permissions, and resource observation characteristics in the CoAP resources of each second network device are determined based on the access security rules and / or functional characteristics of the second network device.
[0101] Specifically, in this embodiment, since each second network device and the gateway device are connected to different networks, it is possible to configure corresponding resource visibility, resource access permissions and resource observation characteristics for each second network device according to its own access security rules and / or functional characteristics, thereby improving the security of data interaction between each second network device and the gateway device.
[0102] For example, resource visibility may include hiding and / or being discovered, resource access permissions may include read-write, write-only and / or read-only, and resource observation characteristics may include not being observable and / or being observable, for example, refer to the RFC8323 / RFC7641 protocol.
[0103] In one optional implementation, the gateway device and the plurality of first network devices all support the CoAP protocol, and the second linkage request is used to instruct the gateway device to register any of the second network devices as an observer of a first CoAP resource of the first target network device, the first CoAP resource being determined from all CoAP resources of the first target network device based on the second linkage request.
[0104] Specifically, this embodiment is similar to the embodiment described above where the gateway device actively registers as an observer of the second target network device. The process will not be repeated here. The main difference lies in the following: Since the gateway device and the first network device share access to the first network, when the first network device needs to interact with the second target network device, the gateway device can actively observe the second target network device instead of the first network device. (At this time, the first network device can synchronize data with the gateway device through the first network to obtain the observed results. Of course, data synchronization can also be achieved through other means; this embodiment only uses the first network as an example.) However, in this embodiment, since the second network device and the gateway device access different networks, when the second network device needs to interact with the first target network device, it needs to act as an observer to observe the corresponding CoAP resources of the first target network device in the gateway device. At this time, the gateway device can still synchronize data with the first target network device through the first network, thus allowing the second network device to simply register as an observer within the gateway device.
[0105] It should be understood that the first CoAP resource is the CoAP resource that any second network device indicated by the second linkage request needs to subscribe to during the linkage process with the first target network device.
[0106] Optionally, after registering any of the second network devices as observers of the first CoAP resource of the first target network device, the gateway device may also send a registration success message to any of the second network devices.
[0107] Optionally, the gateway device may be pre-configured with a second resource observation condition, which includes AND / OR logic, trigger thresholds, and / or multiple preset CoAP resource changes. Registering any second network device as an observer of the first CoAP resource of the first target network device in the gateway device includes: when the second resource observation condition is met, registering any second network device as an observer of the first CoAP resource of the first target network device in the gateway device.
[0108] In one optional implementation, when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, feeding back a second message to any of the second network devices includes:
[0109] Based on the second linkage request, determine the device publication message of the first target network device;
[0110] Configure the device publishing message to the second set of addresses, add the second set of addresses to the local machine, and send the device publishing message to the first target network device, so that both the first target network device and the gateway device are associated with the second set of addresses;
[0111] Add the first CoAP resource to the local machine and establish a second mapping relationship between the second set of addresses and the first CoAP resource;
[0112] In response to a change notification of the first CoAP resource sent by the first target network device to the second set of addresses, the second message is fed back to any of the second network devices based on the second mapping relationship, wherein the change notification of the first CoAP resource indicates a change in the first CoAP resource, and the second message is determined by the change notification of the first CoAP resource.
[0113] Specifically, in this embodiment, a second set of addresses can be used instead of the data synchronization achieved through the first network. The gateway device first determines the device publication message of the first target network device according to the second linkage request, and configures the device publication message into the second set of addresses, adds the second set of addresses to the local machine, and sends the device publication message to the first target network device, so that both the first target network device and the gateway device are associated with the second set of addresses. Then, the first target network device can send the change notification of the first CoAP resource to the second set of addresses, so that the gateway device can obtain the change notification of the first CoAP resource, and further broadcast or forward the message sent to the second set of addresses to all second network devices that have sent the second linkage request according to the second mapping relationship.
[0114] Optionally, if any of the second network devices needs to cancel the linkage with the first target network device, the second network device may send a second linkage cancellation request to the gateway device. After receiving the second linkage cancellation request, the gateway device cancels all steps executed in response to the second linkage request, thereby canceling the linkage between the second network device and the first target network device.
[0115] In one optional implementation, the gateway device is communicatively connected to several second network devices, including:
[0116] The gateway device is added to a distributed network formed by connecting the plurality of second network devices, so that the gateway device and the plurality of second network devices form a distributed network.
[0117] It should be noted that the distributed networking in this embodiment refers to grouping different devices into a local network, where each device provides different functions based on its own capabilities. The functional modules of different devices can communicate and collaborate with each other, and finally, the functions of the devices within the distributed network are aggregated to provide a unified set of functions, thus forming a super-large virtual device. Distributed communication devices (i.e., any device in the distributed network) can have capability publishing, capability discovery, and connection management functions. Capability publishing is mainly used to publish the device's own capabilities to the distributed network; capability discovery is mainly used to discover the capabilities published by other devices; and connection management is mainly used to enable two devices to establish connection sessions, negotiate how to transmit data, and manage the specific operations of data transmission. After joining the distributed network, distributed communication devices can perform functions such as automatic network discovery (i.e., newly joined devices can automatically detect other nodes in the network and dynamically establish connections with other devices), cross-device invocation, and cross-device task collaboration.
[0118] It is understood that, in this embodiment, since the gateway device is also part of the distributed network, data transmission between the gateway device and each of the second network devices can be carried out through the distributed network. Furthermore, the gateway device has the function of discovering each of the second network devices and their capabilities in the distributed network, and at the same time, the gateway device and its capabilities can also be discovered by each of the second network devices in the distributed network.
[0119] Specifically, in this embodiment, after the distributed network is established, each device in the distributed network can perform cross-device calls, task collaboration, and scene linkage operations by discovering, reading / writing, and observing the resources of other devices.
[0120] For example, the distributed network can be constructed using networking methods such as Wi-Fi and / or Ethernet.
[0121] In this embodiment, when the first network device, gateway device, and second network device complete the network formation, there is no coupling relationship between the devices. When a new second network device joins the distributed network, it will automatically perform the aforementioned network formation, allowing it to immediately interact with the first network device. Similarly, when the first network device joins the first network, it can immediately interact with other devices in the distributed network (such as the second network device). In this embodiment, adding and deleting devices in the first and distributed networks is simple, has no impact on existing devices or the network formation, and imposes no restrictions on newly added devices, thus achieving flexible and convenient networking.
[0122] For example, see Figure 7 In this embodiment, when two devices in the distributed network are making cross-device calls and cooperating on tasks, taking the audio collected by device A and played on device B as an example, device B in the distributed network retrieves the data stream of the audio to be played from the transmission endpoint TX_EP1 in device A through the transmission endpoint RX_EP2.
[0123] In IoT communication and other distributed networking systems, this embodiment effectively tracks and controls the working status of different streaming endpoints (such as audio input / output streams, video streams, etc.) on each device by managing the usage status of local streaming endpoints on distributed networked devices. This ensures that in multi-connection or multi-tasking scenarios, devices can rationally allocate and schedule resources, achieving efficient task processing and connection management. Specifically, each streaming endpoint is treated as an independent entity with its own independent state and attributes. This allows specific streams to be dynamically enabled or disabled as needed without affecting the normal operation of other streams. Before establishing a data stream channel, the system automatically performs capability queries and negotiates transmission parameters, such as determining audio sampling rate, video resolution, and encoding format, to ensure that both ends of the device can match and adapt to each other's media processing capabilities. For developers, this design greatly reduces the complexity of product development. They do not need to deeply understand the specific media processing details of each device; they only need to focus on the highest or lowest media capability boundaries supported by the device and publish this capability information through a unified interface. In this way, both internal communication between the same device and cross-device communication between different devices can transmit streaming data in a standardized and modular manner, improving the system's flexibility and scalability. Furthermore, since it does not impose special requirements or restrictions on equipment, this mechanism is conducive to building large-scale, highly distributed communication systems. When new equipment joins the network, it can quickly integrate into the overall architecture based on its own capabilities, thereby promoting the rapid expansion and upgrading of the entire network.
[0124] In one optional implementation, the gateway device is used to communicate with the plurality of first network devices through the Proxy node function. The gateway device pre-stores a whitelist and / or blacklist for message filtering processing of the Proxy node function. The gateway device is used to configure and manage each device connected in the first network.
[0125] It should be noted that, see Figure 6 In this embodiment, the Proxy node is a special type of node capable of connecting the first network (such as a BLE Mesh network) to ordinary BLE GATT (Generic Attribution Profile) devices. Once a device successfully configures itself and joins the first network, the gateway device can use the Proxy node function to achieve bidirectional communication with other nodes within the first network. The Proxy node acts as an intermediary for data exchange between the first network and external networks, receiving messages from external networks (such as Wi-Fi or Ethernet) and forwarding them to internal node devices via the first network; conversely, the Proxy node can also forward messages from node devices within the first network to external networks.
[0126] It should be noted that the gateway device pre-stores whitelists and / or blacklists so that the Proxy node function can obtain the filtering rules and then perform message filtering processing on behalf of the gateway device according to the filtering rules, thereby reducing the amount of data processing required by the gateway device.
[0127] For example, the configuration management may include binding App Key (short for application layer key, used to encrypt application layer data; for example, in a BLE Mesh network, the App Key is used to encrypt and decrypt model messages to ensure the security and privacy of data during transmission), grouping, setting up publishing and / or subscription.
[0128] In one optional implementation, the gateway device stores an online status table, which records the online status of each of the plurality of first network devices, and the method further includes:
[0129] In response to a device discovery request sent by the second network device, based on the online status table, current online device information is fed back to the second network device, wherein the current online device information is used to indicate the devices whose online status is characterized as currently online among the plurality of first network devices.
[0130] It should be understood that the online status in this embodiment can indicate whether the user is online or offline, and can also specifically indicate the online time or offline time.
[0131] In one alternative implementation, the method further includes at least one of the following:
[0132] According to a preset period, a second heartbeat message is sent to the plurality of second network devices, wherein the second heartbeat message carries the online status table;
[0133] Receive a first heartbeat message sent by any first network device, wherein the first heartbeat message is used to update the online status of the corresponding first network device recorded in the online status table.
[0134] Accordingly, this application also provides a networking device that can implement all the processes of the networking method provided in the above embodiments.
[0135] See Figure 2 This diagram illustrates the structure of a networking device provided in an embodiment of this application. The networking device is applied to a gateway device. The gateway device and several first network devices are all connected to a first network. The gateway device and several second network devices are all communicatively connected. The several second network devices are connected to a second network different from the first network. The device includes:
[0136] The first linkage request response module 201 is used to respond to a first linkage request sent by any first network device and observe the second target network device among the plurality of second network devices that corresponds to the first linkage request.
[0137] The first message feedback module 202 is used to feed back a first message indicating the state change of the second target network device to any first network device when a change in the state of the second target network device is observed.
[0138] The second linkage request response module 203 is used to respond to a second linkage request sent by any second network device. When it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, the module sends a second message to any second network device. The second message is used to indicate the state change of the first target network device.
[0139] In one optional implementation, the first network is a BLE Mesh network, the first network device is a BLE Mesh network device, the gateway device is a BLE Mesh gateway device, the second network is an IP network, and the second network device is an IP network device.
[0140] In one optional implementation, both the gateway device and the plurality of second network devices support the CoAP protocol. The step of observing the second target network device among the plurality of second network devices corresponding to the first linkage request in response to a first linkage request sent by any first network device includes:
[0141] Based on the CoAP protocol, actively register as an observer of the second target network device, so that the second target network device can report its own second CoAP resources or report its own second CoAP resources and change notifications, as the result observed for the second target network device;
[0142] The second CoAP resource is determined from all CoAP resources of the second target network device based on the first linkage request, and the change notification of the second CoAP resource indicates the change of the second CoAP resource.
[0143] In one optional implementation, the first linkage request carries a subscription message, and the step of feeding back a first message to either of the first network devices to indicate the state change of the second target network device when a change in the state of the second target network device is observed includes:
[0144] Configure the subscription message into the first set of addresses, and add the first set of addresses to the local machine, so that both the first network device and the gateway device are associated with the first set of addresses;
[0145] Add the second CoAP resource to the local machine and establish a first mapping relationship between the first set of addresses and the second CoAP resource;
[0146] In response to a change notification of the second CoAP resource, the first message is sent to the first group of addresses based on the first mapping relationship, so that any of the first network devices can obtain the first message, wherein the first message is determined by the change notification of the second CoAP resource.
[0147] In one alternative implementation, the resource visibility, resource access permissions, and resource observation characteristics in the CoAP resources of each second network device are determined based on the access security rules and / or functional characteristics of the second network device.
[0148] In one optional implementation, the gateway device and the plurality of first network devices all support the CoAP protocol, and the second linkage request is used to instruct the gateway device to register any of the second network devices as an observer of a first CoAP resource of the first target network device, the first CoAP resource being determined from all CoAP resources of the first target network device based on the second linkage request.
[0149] In one optional implementation, when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, feeding back a second message to any of the second network devices includes:
[0150] Based on the second linkage request, determine the device publication message of the first target network device;
[0151] Configure the device publishing message to the second set of addresses, add the second set of addresses to the local machine, and send the device publishing message to the first target network device, so that both the first target network device and the gateway device are associated with the second set of addresses;
[0152] Add the first CoAP resource to the local machine and establish a second mapping relationship between the second set of addresses and the first CoAP resource;
[0153] In response to a change notification of the first CoAP resource sent by the first target network device to the second set of addresses, the second message is fed back to any of the second network devices based on the second mapping relationship, wherein the change notification of the first CoAP resource indicates a change in the first CoAP resource, and the second message is determined by the change notification of the first CoAP resource.
[0154] In one optional implementation, the gateway device is communicatively connected to several second network devices, including:
[0155] The gateway device is added to a distributed network formed by connecting the plurality of second network devices, so that the gateway device and the plurality of second network devices form a distributed network.
[0156] In one optional implementation, the gateway device is used to communicate with the plurality of first network devices through the Proxy node function. The gateway device pre-stores a whitelist and / or blacklist for message filtering processing of the Proxy node function. The gateway device is used to configure and manage each device connected in the first network.
[0157] In one optional implementation, the gateway device stores an online status table, which records the online status of each of the plurality of first network devices, and the apparatus further includes:
[0158] The current online device information feedback module is used to respond to the device discovery request sent by the second network device and, based on the online status table, feed back current online device information to the second network device, wherein the current online device information is used to indicate the devices whose online status is characterized as currently online among the plurality of first network devices.
[0159] In one alternative embodiment, the device further includes at least one of the following:
[0160] The second heartbeat message sending module is used to send a second heartbeat message to the plurality of second network devices according to a preset period, wherein the second heartbeat message carries the online status table;
[0161] The first heartbeat message receiving module is used to receive a first heartbeat message sent by any first network device, wherein the first heartbeat message is used to update the online status of the corresponding first network device recorded in the online status table.
[0162] See Figure 3The diagram illustrates a networking system provided in an embodiment of this application. This networking system includes a gateway device 303, a plurality of first network devices 301, and a plurality of second network devices 302. The gateway device 303 and the plurality of first network devices 301 are all connected to a first network. The gateway device 303 and the plurality of second network devices 302 are all communicatively connected. The plurality of second network devices 302 are connected to a second network different from the first network.
[0163] Any first network device 301 is used to send a first linkage request to the gateway device 303;
[0164] The gateway device 303 is configured to respond to the first linkage request by observing the second target network device among the plurality of second network devices 302 that corresponds to the first linkage request, and when the state of the second target network device is observed to change, to send a first message to any first network device 301 to indicate the state change of the second target network device.
[0165] Any second network device 302 is used to send a second linkage request to the gateway device 303;
[0166] The gateway device 303 is further configured to respond to the second linkage request and, when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices 301 has changed, to send a second message to any second network device 302, wherein the second message is used to indicate the state change of the first target network device.
[0167] In one optional implementation, the first network is a BLE Mesh network, the first network device 301 is a BLE Mesh network device, the gateway device 303 is a BLE Mesh gateway device 303, the second network is an IP network, and the second network device 302 is an IP network device.
[0168] In one optional implementation, both the gateway device 303 and the plurality of second network devices 302 support the CoAP protocol. The step of observing the second target network device among the plurality of second network devices 302 corresponding to the first linkage request in response to the first linkage request includes:
[0169] Based on the CoAP protocol, actively register as an observer of the second target network device, so that the second target network device can report its own second CoAP resources or report its own second CoAP resources and change notifications, as the result observed for the second target network device;
[0170] The second CoAP resource is determined from all CoAP resources of the second target network device based on the first linkage request, and the change notification of the second CoAP resource indicates the change of the second CoAP resource.
[0171] In one optional implementation, the first linkage request carries a subscription message, and the step of feeding back a first message to either of the first network devices 301 to indicate the state change of the second target network device when a change in the state of the second target network device is observed includes:
[0172] Configure the subscription message into the first set of addresses, and add the first set of addresses to the local machine, so that both the first network device 301 and the gateway device 303 are associated with the first set of addresses;
[0173] Add the second CoAP resource to the local machine and establish a first mapping relationship between the first set of addresses and the second CoAP resource;
[0174] In response to a change notification of the second CoAP resource, the first message is sent to the first group of addresses based on the first mapping relationship, so that any first network device 301 can obtain the first message, wherein the first message is determined by the change notification of the second CoAP resource.
[0175] In one alternative implementation, the resource visibility, resource access permissions, and resource observation characteristics in the CoAP resources of each second network device 302 are determined based on the access security rules and / or functional characteristics of the second network device 302.
[0176] In one optional implementation, the gateway device 303 and the plurality of first network devices 301 all support the CoAP protocol, and the second linkage request is used to instruct the gateway device 303 to register any of the second network devices 302 as an observer of a first CoAP resource for the first target network device, the first CoAP resource being determined from all CoAP resources of the first target network device based on the second linkage request.
[0177] In an optional implementation, the step of sending a second message to any of the second network devices 302 when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices 301 has changed includes:
[0178] Based on the second linkage request, determine the device publication message of the first target network device;
[0179] Configure the device publishing message to the second set of addresses, add the second set of addresses to the local machine, and send the device publishing message to the first target network device, so that both the first target network device and the gateway device 303 are associated with the second set of addresses;
[0180] Add the first CoAP resource to the local machine and establish a second mapping relationship between the second set of addresses and the first CoAP resource;
[0181] In response to a change notification of the first CoAP resource sent by the first target network device to the second set of addresses, the second message is fed back to any of the second network devices 302 based on the second mapping relationship, wherein the change notification of the first CoAP resource indicates a change in the first CoAP resource, and the second message is determined by the change notification of the first CoAP resource.
[0182] In one optional implementation, the gateway device 303 is communicatively connected to all of the plurality of second network devices 302, including:
[0183] The gateway device 303 joins the distributed network formed by the network of the plurality of second network devices 302, so that the gateway device 303 and the plurality of second network devices 302 form a distributed network.
[0184] In one optional implementation, the gateway device 303 is used to communicate with the plurality of first network devices 301 through the Proxy node function. The gateway device 303 pre-stores a whitelist and / or blacklist for message filtering processing of the Proxy node function. The gateway device 303 is used to configure and manage each device accessed in the first network.
[0185] In one optional implementation, the gateway device 303 stores an online status table, which records the online status of each of the plurality of first network devices 301.
[0186] The gateway device 303 is further configured to respond to a device discovery request sent by the second network device 302, and based on the online status table, feed back current online device information to the second network device 302, wherein the current online device information is used to indicate the devices whose online status is characterized as currently online among the plurality of first network devices 301.
[0187] In one alternative implementation, the gateway device 303 is further configured to include at least one of the following:
[0188] According to a preset period, a second heartbeat message is sent to the plurality of second network devices 302, wherein the second heartbeat message carries the online status table;
[0189] Receive a first heartbeat message sent by any first network device 301, wherein the first heartbeat message is used to update the online status of the corresponding first network device 301 recorded in the online status table.
[0190] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the networking method described in any of the above claims.
[0191] This application also provides a computer program product, including computer instructions that, when executed by a processor, implement the steps of the networking method described in any of the above claims.
[0192] This application also provides a computer device, including a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the steps of the networking method described in any of the above claims.
[0193] See Figure 4 The computer device in this embodiment includes a processor 401, a memory 402, and a computer program stored in the memory 402 and executable on the processor 401, such as a networking program. When the processor 401 executes the computer program, it implements the steps in the various networking method embodiments described above, for example... Figure 1 Steps S1-S3 are shown.
[0194] For example, the computer program may be divided into one or more modules / units, which are stored in the memory 402 and executed by the processor 401 to complete this application. The one or more modules / units may be a series of computer program instruction segments capable of performing a specific function, which describe the execution process of the computer program in the computer device.
[0195] The computer device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will understand that the schematic diagram is merely an example of a computer device and does not constitute a limitation on the computer device. It may include more or fewer components than shown, or combine certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.
[0196] The processor 401 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor, or processor 401 can be any conventional processor. The processor 401 is the control center of the computer device, connecting various parts of the entire computer device through various interfaces and lines.
[0197] The memory 402 can be used to store the computer programs and / or modules. The processor 401 implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory 402 and calling the data stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the mobile phone (such as audio data, phonebook, etc.). In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, memory, plug-in hard disk, smart memory card (SMC), secure digital card (SD) card, flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0198] Wherein, if the modules / units integrated into the computer device are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by the processor 401, it can implement the steps of the various method embodiments described above. Wherein, the computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium, etc.
[0199] In summary, the embodiments of this application have at least one of the following beneficial effects:
[0200] 1) After the devices are networked, the data exchanged between the network devices does not need to be forwarded through the external cloud server when they are linked, thereby reducing the time required for the execution of control signals, improving the security of data transmission, and being unaffected by the network quality and / or disconnection between the network devices and the cloud server, thus achieving a more stable device network.
[0201] 2) Since the gateway device only needs to process messages describing the state changes of the target network devices that the network devices need to link, the amount of data that the gateway device needs to process is less, reducing the data processing requirements and network bandwidth consumption. In addition, there is no need to set up a local server, thus saving costs.
[0202] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary hardware platforms, or it can be implemented entirely by hardware. Based on this understanding, all or part of the technical solutions of this application that contribute to the background technology can be embodied in the form of a software product. This computer software product can be stored in a storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this application.
[0203] The above description is the preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications are also considered to be within the scope of protection of this application.
Claims
1. A networking method, characterized in that, The method, applied to a gateway device, wherein the gateway device and a plurality of first network devices are all connected to a first network, and the gateway device and a plurality of second network devices are all communicatively connected, and the plurality of second network devices are connected to a second network different from the first network, includes: In response to a first linkage request sent by any first network device, observe the second target network device among the plurality of second network devices that corresponds to the first linkage request; When a change in the state of the second target network device is observed, a first message indicating the change in the state of the second target network device is fed back to any of the first network devices. In response to a second linkage request sent by any second network device, when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, a second message is fed back to any second network device, wherein the second message is used to indicate the state change of the first target network device.
2. The networking method as described in claim 1, characterized in that, The first network is a BLE Mesh network, the first network device is a BLE Mesh network device, the gateway device is a BLE Mesh gateway device, the second network is an IP network, and the second network device is an IP network device.
3. The networking method as described in claim 1, characterized in that, The gateway device and the plurality of second network devices all support the CoAP protocol. The step of responding to a first linkage request sent by any first network device by observing the second target network device among the plurality of second network devices corresponding to the first linkage request includes: Based on the CoAP protocol, actively register as an observer of the second target network device, so that the second target network device can report its own second CoAP resources or report its own second CoAP resources and change notifications, as the result observed for the second target network device; The second CoAP resource is determined from all CoAP resources of the second target network device based on the first linkage request, and the change notification of the second CoAP resource indicates the change of the second CoAP resource.
4. The networking method as described in claim 3, characterized in that, The first linkage request carries a subscription message. The step of sending a first message to either of the first network devices to indicate the state change of the second target network device when a change in the state of the second target network device is observed includes: Configure the subscription message into the first set of addresses, and add the first set of addresses to the local machine, so that both the first network device and the gateway device are associated with the first set of addresses; Add the second CoAP resource to the local machine and establish a first mapping relationship between the first set of addresses and the second CoAP resource; In response to a change notification of the second CoAP resource, the first message is sent to the first group of addresses based on the first mapping relationship, so that any of the first network devices can obtain the first message, wherein the first message is determined by the change notification of the second CoAP resource.
5. The networking method as described in claim 3, characterized in that, The resource visibility, resource access permissions, and resource observation characteristics in the CoAP resources of each second network device are determined based on the access security rules and / or functional characteristics of that second network device.
6. The networking method as described in claim 1, characterized in that, The gateway device and the plurality of first network devices all support the CoAP protocol. The second linkage request is used to instruct the gateway device to register any of the second network devices as an observer of a first CoAP resource of the first target network device. The first CoAP resource is determined among all CoAP resources of the first target network device based on the second linkage request.
7. The networking method as described in claim 6, characterized in that, When it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, the second message is fed back to any of the second network devices, including: Based on the second linkage request, determine the device publication message of the first target network device; Configure the device publishing message to the second set of addresses, add the second set of addresses to the local machine, and send the device publishing message to the first target network device, so that both the first target network device and the gateway device are associated with the second set of addresses; Add the first CoAP resource to the local machine and establish a second mapping relationship between the second set of addresses and the first CoAP resource; In response to a change notification of the first CoAP resource sent by the first target network device to the second set of addresses, the second message is fed back to any of the second network devices based on the second mapping relationship, wherein the change notification of the first CoAP resource indicates a change in the first CoAP resource, and the second message is determined by the change notification of the first CoAP resource.
8. The networking method according to any one of claims 1-7, characterized in that, The gateway device is communicatively connected to several second network devices, including: The gateway device is added to a distributed network formed by connecting the plurality of second network devices, so that the gateway device and the plurality of second network devices form a distributed network.
9. The networking method according to any one of claims 1-7, characterized in that, The gateway device is used to communicate with the plurality of first network devices through the Proxy node function. The gateway device pre-stores a whitelist and / or blacklist for message filtering processing of the Proxy node function. The gateway device is used to configure and manage each device connected in the first network.
10. The networking method according to any one of claims 1-7, characterized in that, The gateway device stores an online status table, which records the online status of each of the plurality of first network devices. The method further includes: In response to a device discovery request sent by the second network device, based on the online status table, current online device information is fed back to the second network device, wherein the current online device information is used to indicate the devices whose online status is characterized as currently online among the plurality of first network devices.
11. The networking method as described in claim 10, characterized in that, The method further includes at least one of the following: According to a preset period, a second heartbeat message is sent to the plurality of second network devices, wherein the second heartbeat message carries the online status table; Receive a first heartbeat message sent by any first network device, wherein the first heartbeat message is used to update the online status of the corresponding first network device recorded in the online status table.
12. A networking device, characterized in that, An apparatus for use in a gateway device, wherein the gateway device and a plurality of first network devices are all connected to a first network, the gateway device and a plurality of second network devices are all communicatively connected, and the plurality of second network devices are connected to a second network different from the first network, the apparatus comprising: The first linkage request response module is used to respond to a first linkage request sent by any first network device and observe the second target network device corresponding to the first linkage request among the plurality of second network devices; The first message feedback module is used to feed back a first message indicating the state change of the second target network device to any of the first network devices when a change in the state of the second target network device is observed. The second linkage request response module is used to respond to a second linkage request sent by any second network device. When it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, the module sends a second message to any second network device, wherein the second message is used to indicate the state change of the first target network device.
13. A networking system, characterized in that, The system includes a gateway device, a plurality of first network devices, and a plurality of second network devices. The gateway device and the plurality of first network devices are all connected to a first network. The gateway device and the plurality of second network devices are all communicatively connected. The plurality of second network devices are connected to a second network different from the first network. Any first network device is used to send a first linkage request to the gateway device; The gateway device is configured to respond to the first linkage request, observe the second target network device corresponding to the first linkage request among the plurality of second network devices, and when the state of the second target network device is observed to change, send a first message to any first network device to indicate the state change of the second target network device. Any second network device is used to send a second linkage request to the gateway device; The gateway device is further configured to respond to the second linkage request and, when it is determined that the state of the first target network device corresponding to the second linkage request among the plurality of first network devices has changed, to send a second message to any of the second network devices, wherein the second message is used to indicate the state change of the first target network device.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the networking method according to any one of claims 1-11.
15. A computer program product comprising computer instructions, characterized in that, When the computer instructions are executed by the processor, they implement the networking method according to any one of claims 1-11.
16. A computer device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and configured to be executed by the processor, wherein the processor executes the computer program to implement the networking method according to any one of claims 1-11.
Citation Information
Patent Citations
Heterogeneous network access and conversion method for Internet of Things ubiquitous access gateway, and gateway
CN113852546A
Instant messaging method and system, computer equipment and storage medium
CN115277048A