Equipment interaction method and device, medium and electronic equipment
By deploying proxy gateways in devices and dynamically updating routing tables, the problem of limited interaction between multiple devices is solved, sensingless interaction and function expansion between devices is achieved, and user experience and system performance is improved.
Patent Information
- Application Number
- CN202411865857.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-09-02
AI Technical Summary
In the prior art, interaction between multiple devices is limited by the single function and high cost of hardware gateways, and the lack of protocol conversion, secure isolation and scalability between devices communication channels for wireless or wired connections, resulting in limited interaction functions between devices.
By deploying a proxy gateway in the device, the routing table of the first proxy gateway determines the target routing information of the interactive request instructions, and forwards instructions through the proxy gateway, direct or indirect interaction between devices is realized, and the routing table is dynamically updated to adapt to network topology changes.
It realizes sensorless interaction between devices with different protocols, improves the collaborative working ability between devices, reduces costs, simplifies connection configuration, and improves the scalability and user experience of the system.
Smart Images

Figure CN120583026A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of communication technologies, and in particular to a device interaction method, apparatus, medium, and electronic device. Background Art
[0002] With the rapid development of smart devices, users may use multiple electronic devices simultaneously in their daily lives, such as smartphones, tablets, smart home devices, etc. Interaction between multiple devices makes it possible to realize more complex functions. Summary of the Invention
[0003] The present disclosure provides a device interaction method, apparatus, medium, and electronic device to enhance the collaborative working capability between devices.
[0004] According to a first aspect of an embodiment of the present disclosure, a device interaction method is provided, which is applied to a first device and includes:
[0005] In response to an interaction request instruction for a second device, determining, based on a first routing table of a first proxy gateway in the first device, target routing information for sending the interaction request instruction to the second device, wherein the first routing table includes routing information for direct interaction between the first device and the second device and / or routing information for interaction between the first device and the second device through a third device;
[0006] The interaction request instruction is sent to the second device through the first proxy gateway according to the target routing information, so that the second device performs the target interaction function in response to the interaction request instruction.
[0007] Optionally, the first routing table is obtained in the following manner:
[0008] Obtaining an initial routing table of the first proxy gateway;
[0009] receiving a second routing table sent by a second proxy gateway in the third device, where the second routing table includes routing information for direct interaction between the third device and the second device and / or routing information for interaction between the third device and the second device through a fourth device;
[0010] According to the second routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table.
[0011] Optionally, the second routing table includes routing information from the third device to different destination devices, the routing information including routing distances from the third device to the different destination devices and next-hop gateway information of the third device, and updating the initial routing table of the first proxy gateway according to the second routing table to obtain the first routing table includes:
[0012] Increasing each routing distance in the second routing table by 1, and setting the next-hop gateway information of the third device to the gateway information of the second proxy gateway, to obtain a third routing table;
[0013] According to the third routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table.
[0014] Optionally, updating the initial routing table of the first proxy gateway according to the third routing table to obtain the first routing table includes:
[0015] In a case where the initial routing table does not include the destination device in the third routing table, the routing information corresponding to the destination device in the third routing table is added to the initial routing table to obtain the first routing table.
[0016] Optionally, updating the initial routing table of the first proxy gateway according to the third routing table to obtain the first routing table includes:
[0017] In the case where the initial routing table includes the destination device in the third routing table, if the next-hop gateway information corresponding to the destination device in the initial routing table is the same as the next-hop gateway information corresponding to the destination device in the third routing table, the corresponding routing information of the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
[0018] Optionally, updating the initial routing table of the first proxy gateway according to the third routing table to obtain the first routing table includes:
[0019] In a case where the initial routing table includes the destination device in the third routing table, if the next-hop gateway information corresponding to the destination device in the initial routing table is different from the next-hop gateway information corresponding to the destination device in the third routing table, determining a magnitude relationship between a routing distance corresponding to the destination device in the initial routing table and a routing distance corresponding to the destination device in the third routing table;
[0020] According to the size relationship, the initial routing table is updated to obtain the first routing table.
[0021] Optionally, updating the initial routing table according to the size relationship to obtain the first routing table includes:
[0022] If the size relationship indicates that the routing distance corresponding to the destination device in the initial routing table is greater than the routing distance corresponding to the destination device in the third routing table, the routing information corresponding to the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
[0023] Optionally, the method further includes:
[0024] If the size relationship indicates that the routing distance corresponding to the destination device in the initial routing table is less than the routing distance corresponding to the destination device in the third routing table, the routing information corresponding to the destination device in the initial routing table is kept unchanged to obtain the first routing table.
[0025] Optionally, updating the initial routing table according to the size relationship to obtain the first routing table includes:
[0026] If the size relationship indicates that the routing distance corresponding to the destination device in the third routing table is equal to the routing distance corresponding to the destination device in the initial routing table, determining a first communication distance between the destination device in the initial routing table and the gateway corresponding to the next-hop gateway information and a second communication distance between the destination device in the third routing table and the gateway corresponding to the next-hop gateway information;
[0027] If the second communication distance is smaller than the first communication distance, the routing information corresponding to the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
[0028] Optionally, the method further includes:
[0029] If the second routing table sent by the second proxy gateway is not received within the first preset time period, the routing distance in which the next hop gateway in the initial routing table or the first routing table is the second proxy gateway is set to a preset value, where the preset value is used to indicate that the second proxy gateway is an unreachable gateway.
[0030] Optionally, the second routing table is sent when the first proxy gateway and the second proxy gateway are connected based on a heartbeat mechanism; or
[0031] The second routing table is sent by the second proxy gateway when the second proxy gateway detects the second routing table at intervals of a second preset time and when the second routing table changes; or
[0032] If the connection between the first proxy gateway and the second proxy gateway does not have a heartbeat mechanism, the second routing table is sent by the second proxy gateway at intervals of a third preset time period.
[0033] Optionally, the method further includes:
[0034] If the connection between the first proxy gateway and the second proxy gateway has a heartbeat mechanism, when the connection between the first proxy gateway and the second proxy gateway is disconnected, or when the heartbeat between the first proxy gateway and the second proxy gateway is lost, deleting the routing information associated with the second proxy gateway in the first routing table;
[0035] If the connection between the first proxy gateway and the second proxy gateway does not have a heartbeat mechanism, when the connection between the first proxy gateway and the second proxy gateway is disconnected, or when the first proxy gateway does not receive the second routing table sent by the second proxy gateway after a fourth preset time period has expired, the routing information associated with the second proxy gateway in the first routing table is deleted, where the fourth preset time period is greater than the third preset time period.
[0036] Optionally, the third devices include at least two, and correspondingly, the target routing information includes at least two, the target routing information includes routing information for the first device to interact with the second device through the corresponding third device, and sending the interaction request instruction to the second device according to the target routing information includes:
[0037] Determining routing distances corresponding to at least two pieces of target routing information respectively;
[0038] Determining the first target routing information having the shortest routing distance among the at least two target routing information;
[0039] The interaction request instruction is sent to the second device according to the first target routing information.
[0040] Optionally, the sending the interaction request instruction to the second device according to the first target routing information includes:
[0041] If there are at least two first target routing information, determining a third communication distance between the second device and the next hop gateway of the first device in each first target routing information;
[0042] Determine, among at least two of the first target routing information, the second target routing information having the shortest third communication distance;
[0043] The interaction request instruction is sent to the second device according to the second target routing information.
[0044] Optionally, the first proxy gateway does not support an automatic retransmission function, and / or the first proxy gateway supports at least one of the following functions:
[0045] Asynchronous transmission function for the interaction request instruction;
[0046] The reject reception function is used to reject the reception of information when the amount of information received by the first proxy gateway exceeds a preset upper limit threshold.
[0047] According to a second aspect of an embodiment of the present disclosure, there is provided a device interaction apparatus, applied to a first device, including:
[0048] a determining module configured to, in response to an interaction request instruction to a second device, determine, based on a first routing table of a first proxy gateway in the first device, target routing information for sending the interaction request instruction to the second device, wherein the first routing table includes routing information for direct interaction between the first device and the second device and / or routing information for interaction between the first device and the second device through a third device;
[0049] The sending module is configured to send the interaction request instruction to the second device through the first proxy gateway according to the target routing information, so that the second device performs the target interaction function in response to the interaction request instruction.
[0050] According to a third aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, on which computer program instructions are stored. When the program instructions are executed by a processor, the device interaction method described in the first aspect of the embodiment of the present disclosure is implemented.
[0051] According to a fourth aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0052] a storage device for storing a computer program;
[0053] An execution device is used to execute the computer program to implement the device interaction method described in the first aspect of the embodiment of the present disclosure.
[0054] The technical solutions provided by the embodiments of the present disclosure may have the following beneficial effects:
[0055] The present disclosure determines the target routing information for sending the interaction request instruction to the second device according to the first routing table of the first proxy gateway in the first device in response to the interaction request instruction to the second device by the first device, and sends the interaction request instruction to the second device according to the target routing information through the first proxy gateway, so that the second device performs the target interaction function in response to the interaction request instruction. In this way, devices with different protocols can interact with each other through the proxy gateway, realizing seamless interaction across devices, and the first routing table can include routing information of the second device that directly communicates and / or indirectly communicates with the first device, which can realize interaction across multiple devices, increase the functions that can be realized by the devices, and enhance the user experience.
[0056] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0058] Figure 1 The figure is a flow chart of a device interaction method according to an exemplary embodiment.
[0059] Figure 2 The figure is a flow chart of a device interaction method according to an exemplary embodiment.
[0060] Figure 3 The figure is a schematic diagram showing a process of updating a routing table according to an exemplary embodiment.
[0061] Figure 4 The figure is a schematic diagram showing a device interaction scenario according to an exemplary embodiment.
[0062] Figure 5 is a schematic diagram showing another device interaction scenario according to an exemplary embodiment.
[0063] Figure 6 is a schematic diagram showing another device interaction scenario according to an exemplary embodiment.
[0064] Figure 7 is a schematic diagram showing another device interaction scenario according to an exemplary embodiment.
[0065] Figure 8 is a schematic diagram showing another device interaction scenario according to an exemplary embodiment.
[0066] Figure 9 The figure is a block diagram showing a device interaction apparatus according to an exemplary embodiment.
[0067] Figure 10 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0068] Exemplary embodiments will be described in detail herein, with examples illustrated in the accompanying drawings. In the following description, when referring to the drawings, identical numerals in different figures represent identical or similar elements, unless otherwise indicated. The embodiments described in the following exemplary embodiments are not intended to represent all possible embodiments consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
[0069] In related technologies, the interaction between multiple devices can be achieved through hardware gateway routing communication, or through wireless media or wired media point-to-point communication to achieve collaborative work between multiple devices. The hardware gateway has a single function and high cost, and is not convenient for function upgrades. Wireless media include Bluetooth signals, WiFi (Wireless Fidelity) signals, etc., and limited media include network cables. Devices connected by wireless media or wired media can achieve point-to-point communication between devices, but because the communication channel between wireless or wired connected devices does not have the protocol conversion, security isolation, scalability and other functions that the gateway can achieve, the transmission of data or instructions between the communication channels is usually restricted, resulting in the inability to achieve many device interaction functions.
[0070] Reference Figure 1 , Figure 1 is a flow chart showing a device interaction method according to an exemplary embodiment. Figure 1 As shown, the device interaction method is applied to the first device and includes the following steps.
[0071] In step S101, in response to an interaction request instruction to the second device, target routing information for sending the interaction request instruction to the second device is determined according to a first routing table of a first proxy gateway in the first device, wherein the first routing table includes routing information for direct interaction between the first device and the second device and / or routing information for interaction between the first device and the second device through a third device.
[0072] In step S102, the interaction request instruction is sent to the second device through the first proxy gateway according to the target routing information, so that the second device performs the target interaction function in response to the interaction request instruction.
[0073] For example, the first device can be a device that generates an interaction request instruction, and the first device can also be a device that forwards the interaction request instruction. The second device is the destination device of the interaction request instruction, that is, the device with which the device that generates the interaction request instruction wants to interact. The third device is a device that the first device may pass through when sending the interaction request instruction to the second device. In this case, after the first device sends the interaction request instruction to the third device, it directly sends it to the second device through the third device; or the third device may also forward the interaction request instruction to the next device again, and then the next device sends it to the second device. There is no limit on the number of intermediate devices that the first device passes through when sending the interaction request instruction to the second device. The present disclosure can realize the connection between multiple devices based on the proxy gateway to form multiple routing link paths for transmitting information.
[0074] For example, the interaction request instruction can be an instruction issued by a user through the first device or other device. The interaction request instruction can also be an instruction generated by the first device based on business needs and sent to the second device, or an instruction generated by other devices based on business needs and sent to the second device, which is forwarded to the second device through the first device. Through the interaction request instruction, the device that generates the interaction request instruction can request the second device to implement the target interaction function.
[0075] For example, the routing information includes different devices that can be reached by the local device where the proxy gateway is located, the routing distances for the local device to reach the different devices respectively, the next-hop gateway address of the local device when the local device reaches the different devices respectively, the protocol type between the local device and the next-hop gateway, etc.
[0076] For example, the target interaction function can be the second device returning the information requested in the interaction request instruction to the device that generated the interaction request instruction, or the second device executing a corresponding function based on the function required by the interaction request instruction. For example, in one scenario, a smartphone can query the user's heart rate detected by a sports watch through an interaction request instruction; in another scenario, the smartphone can control the sports watch to display text messages sent by the smartphone through an interaction request instruction.
[0077] For example, a proxy is a network service that can request data from other network services on behalf of a device. A proxy gateway is a soft gateway that possesses basic gateway functions, including data forwarding, protocol conversion, content filtering, and authentication. However, unlike traditional hardware gateways, a proxy gateway does not require additional hardware support. Instead, it is a software program running on a general-purpose operating system. Software gateways can run on a variety of operating systems and hardware platforms, and their functionality can be expanded through software upgrades or the addition of functional modules, offering extreme flexibility and scalability.
[0078] For example, a proxy gateway can be developed and deployed on key devices for device communication, allowing users to control other non-critical devices based on the key devices. For example, a soft proxy gateway can be developed and deployed on key devices such as the cloud, cars, mobile phones, and tablet devices. Non-critical devices such as watches, car air conditioners, and IoT (Internet of Things) devices can be controlled through key devices, and key devices can also control their own capabilities. Instructions for controlling non-critical devices or requesting information from non-critical devices can be routed and forwarded through the proxy gateway deployed in the key device so that the instructions reach the non-critical device.
[0079] For example, a proxy gateway can directly proxy the critical device it is in to access non-critical devices directly connected to the critical device or other non-critical devices connected across devices. For example, a first proxy gateway is deployed in a first device, and the first device is a device directly proxyed by the first proxy gateway. Because the first routing table of the first proxy gateway includes routing information for direct interaction between the first device and the second device and / or routing information for interaction between the first device and the second device via a third device, the second device is a device that the first device can directly access, and the second device can also be a device that the first device can indirectly access via a third device.
[0080] For example, the first proxy gateway of the first device can send an interaction request instruction to the second device based on the routing information in the first routing table, so that the interaction request instruction can accurately reach the second device. The first routing table is stored in the first proxy gateway, where the first routing table includes routing information for interactions between the first device and different devices, such as routing paths for direct and / or indirect interactions, which can be used to determine how to transmit the interaction request instruction to each device in the first routing table.
[0081] As an example, if the first routing table in the first proxy gateway of the first device includes routing information for direct interaction between the first device and the second device, the first proxy gateway may send the interaction request instruction directly to the second device based on the routing information. As another example, if the first routing table in the first proxy gateway of the first device includes routing information for interaction between the first device and the second device through a third device, the first proxy gateway may send the interaction request instruction to the third device based on the routing information, and the third device may send the interaction request instruction to the second device based on the routing table in its proxy gateway.
[0082] It is understandable that when the third device sends the interaction request instruction to the second device based on the routing table in its proxy gateway, it can also refer to the above two scenario examples to interact directly or indirectly with the second device to send the interaction request instruction to the second device.
[0083] The present disclosure determines the target routing information for sending the interaction request instruction to the second device according to the first routing table of the first proxy gateway in the first device in response to the interaction request instruction to the second device by the first device, and sends the interaction request instruction to the second device according to the target routing information through the first proxy gateway, so that the second device performs the target interaction function in response to the interaction request instruction. In this way, devices with different protocols can interact with each other through the proxy gateway, realizing seamless interaction across devices, and the first routing table can include routing information of the second device that directly communicates and / or indirectly communicates with the first device, which can realize interaction across multiple devices, increase the functions that can be realized by the devices, and enhance the user experience.
[0084] The present disclosure improves the collaborative working ability between devices and reduces the dependence on physical hardware gateways by using the first proxy gateway and the first routing table to forward instructions, which can reduce costs, simplify the connection and configuration between devices, and improve the scalability and maintainability of the system.
[0085] When the present disclosure includes routing information for the first device to interact with the second device through a third device in the first routing table, an information interaction process across multiple devices can be realized, thereby improving the flexibility of communication between devices and expanding the complex functions that can be achieved when multiple devices collaborate. At the same time, it is also beneficial to increase the convenience of users operating different devices and enhance the user experience.
[0086] As an optional embodiment, the first routing table is obtained in the following manner:
[0087] Obtaining the initial routing table of the first proxy gateway;
[0088] receiving a second routing table sent by a second proxy gateway in a third device, where the second routing table includes routing information for direct interaction between the third device and the second device and / or routing information for interaction between the third device and the second device through a fourth device;
[0089] According to the second routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table.
[0090] For example, a first device may communicate with a second device through a third device. The third device is an intermediate node in the communication network used by the first and second devices for communication. The third device may be directly connected to the second device or indirectly connected to the second device through a fourth device. The fourth device may be another node in the communication network used by the first and second devices for communication and may serve as an intermediate device for indirect communication between the third and second devices.
[0091] For example, the initial routing table is a set of routing information of the first proxy gateway in an unupdated state, such as a routing table when not connected to the second proxy gateway, or a routing table when the second proxy gateway has not yet sent an update to the second routing table of the first proxy gateway. The initial routing table includes routing information of devices reachable by the first device.
[0092] For example, the second proxy gateway is a gateway located in the third device and can be used to manage and forward communications between the third device and other devices. The second routing table is a routing table maintained by the second proxy gateway and contains routing information for direct interactions between the third device and the second device, or routing information for interactions between the third device and the second device through the fourth device.
[0093] For example, the first proxy gateway obtains its own initial routing table, which includes routing information of devices that the first device can communicate with. The first proxy gateway can receive a second routing table from the second proxy gateway in the third device and update the initial routing table based on the second routing table. The second routing table includes routing information of devices that the third device can communicate with, wherein the third device can communicate directly with the second device, and the third device can also communicate indirectly with the second device through a fourth device. Then, the updated first routing table not only includes the device information that the first device can directly reach, but also includes the routing information of devices that the first device can reach through the third device.
[0094] It can be understood that when the first proxy gateway updates the local initial routing table based on the second routing table sent by the second proxy gateway, the first proxy gateway will also send the local initial routing table to the second proxy gateway, so that the second proxy gateway can update the second routing table of the second proxy gateway based on the initial routing table. The principle and process are similar to those of the first proxy gateway updating the local initial routing table, and will not be repeated here.
[0095] The present disclosure can dynamically adapt to changes in network topology through a routing table update mechanism without manual intervention. In a dynamically changing communication network, devices can join or leave the communication network. The dynamic update mechanism enables the communication network to adapt to changes and can more effectively utilize available communication paths to improve overall performance.
[0096] In addition, if the second routing table includes both routing information for the third device to interact directly with the second device and routing information for the third device to interact with the second device through the fourth device, in some cases, if the direct path is unavailable, the first proxy gateway can find an alternative path through the third device or the fourth device, thereby improving the reliability of communication.
[0097] As an optional embodiment, the second routing table includes routing information from the third device to different destination devices, the routing information including routing distances from the third device to the different destination devices and next-hop gateway information of the third device. Based on the second routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table, including:
[0098] Increasing each routing distance in the second routing table by 1, and setting the next-hop gateway information of the third device to the gateway information of the second proxy gateway, to obtain a third routing table;
[0099] According to the third routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table.
[0100] For example, the destination device is a device reachable by the third device. The routing distance is the number of hops from the third device to the destination device. Next-hop gateway information can be used to specify the next gateway that a data packet or instruction should pass through after being sent from the third device in order to be forwarded to the destination device. The next-hop gateway information may include the address information, subnet mask, etc. of the next-hop gateway. The third routing table is a new routing table obtained by processing the second routing table and contains updated routing information.
[0101] For example, the first proxy gateway receives a second routing table containing routing information from a third device to different destination devices from a second proxy gateway, and processes each routing information in the second routing table to obtain a third routing table. The routing distance corresponding to each routing information in the second routing table represents the number of hops required to reach the corresponding destination device from the third device. Increasing the routing distance corresponding to each routing information in the second routing table by 1 indicates that the first device requires an additional hop to reach the destination device via the third device. Setting the next-hop gateway information to the gateway information of the second proxy gateway indicates that the first device needs to reach the third device's destination device via the third device, and the first device's next-hop gateway is the second proxy gateway in the third device.
[0102] For example, the first proxy gateway updates its initial routing table based on the third routing table, and uses the new routing information in the third routing table to update the initial routing table, thereby obtaining the first routing table. In this way, the first proxy gateway can extend the communication network coverage to the third device and its reachable destination devices through the updated first routing table.
[0103] As an optional embodiment, the initial routing table of the first proxy gateway is updated according to the third routing table to obtain the first routing table, including:
[0104] In a case where the initial routing table does not include the destination device in the third routing table, routing information corresponding to the destination device in the third routing table is added to the initial routing table to obtain a first routing table.
[0105] For example, if the initial routing table does not include a destination device in the third routing table, this may indicate that the destination device was originally unreachable by the first device. Through the connection between the first proxy gateway and the second proxy gateway, the first proxy gateway can communicate with the destination device through the second proxy gateway. In other words, the first proxy gateway can treat the destination device as a newly reachable device and add the destination device and its corresponding routing information to the initial routing table. The first device can then communicate with the destination device reachable by the third device based on the updated first routing table.
[0106] In this disclosure, the first proxy gateway updates its routing table to add new destination devices. This allows it to connect to previously inaccessible devices, allowing more devices to be accessed and managed, improving the connectivity of the entire network. Furthermore, the first proxy gateway can autonomously discover and add new routing information, enhancing the network's self-organization and self-management capabilities.
[0107] As an optional embodiment, the initial routing table of the first proxy gateway is updated according to the third routing table to obtain the first routing table, including:
[0108] In the case where the initial routing table includes the destination device in the third routing table, if the next-hop gateway information corresponding to the destination device in the initial routing table is the same as the next-hop gateway information corresponding to the destination device in the third routing table, the corresponding routing information of the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
[0109] For example, when a first device communicates with a second device, the routing information for reaching the second device from the third device may change, for example, from indirect interaction between the third device and the second device via a fourth device to direct interaction between the third device and the second device. If the initial routing table includes the destination device in the third routing table, this indicates that the routing information of the first proxy gateway already includes the routing information for reaching the destination device from the first device. The next-hop gateway information corresponding to the destination device is then compared to ensure it is identical to the next-hop gateway information for the corresponding destination device in the third routing table.
[0110] For example, if the next-hop gateway information is the same, it can be said that the two pieces of routing information describe the routing path from the first proxy gateway to the destination device through the second proxy gateway, and the routing path from the second proxy gateway to the destination device may actually change, that is, the routing distance may change. In order to ensure that the routing path from the first proxy gateway to the destination device through the second proxy gateway in the routing table is the latest, the routing distance in the initial routing table can be updated to the routing distance in the third routing table.
[0111] In the present disclosure, the first proxy gateway can continuously maintain and optimize the performance of data transmission by dynamically updating the routing table, ensuring that the routing information of the destination device reachable by the third device in the routing table of the first proxy gateway is consistent with the actual routing information included in the second proxy gateway of the third device.
[0112] As an optional embodiment, the initial routing table of the first proxy gateway is updated according to the third routing table to obtain the first routing table, including:
[0113] In a case where the initial routing table includes the destination device in the third routing table, if the next-hop gateway information corresponding to the destination device in the initial routing table is different from the next-hop gateway information corresponding to the destination device in the third routing table, determining a magnitude relationship between the routing distance corresponding to the destination device in the initial routing table and the routing distance corresponding to the destination device in the third routing table;
[0114] According to the size relationship, the initial routing table is updated to obtain the first routing table.
[0115] For example, when a first device communicates with a second device, there may be multiple corresponding routing paths. For example, the first device communicates with the second device through device A, the first device communicates with the second device through device B, the first device communicates with the second device through devices C and D, and so on.
[0116] For example, if the next-hop gateway information corresponding to the destination device in the initial routing table is different from the next-hop gateway information corresponding to the destination device in the third routing table, that is, the next-hop gateway from the first device to the destination device in the initial routing table is not the second proxy gateway. This can mean that the first proxy gateway could have originally reached the destination device, but the routing path to the destination device may not have passed through the second proxy gateway; or that the first proxy gateway could have originally reached the destination device, perhaps passing through the second proxy gateway, but the second proxy gateway is not the next gateway for the first device, for example, it may be the gateway after the next gateway. In this case, the relationship between the routing distances corresponding to the destination devices in the initial routing table and the third routing table can be used to further determine how to update the initial routing table.
[0117] As an example, if the vehicle can forward routing through the vehicle cloud device, mobile phone cloud device, and mobile phone in sequence, and communicate with a smart watch connected to the mobile phone, the vehicle can also forward routing directly through the watch, and communicate with a smart watch connected to the mobile phone. The routing distance for the vehicle to communicate with the smart watch through the mobile phone is shorter, then the routing information corresponding to the vehicle communicating with the smart watch through the mobile phone can be used as the routing information for the vehicle to communicate with the smart watch in the first routing table after the initial routing table is updated.
[0118] In the present disclosure, the first proxy gateway can select the shortest path to the destination device by comparing the different routing paths to the same destination device in the initial routing table and the third routing table, thereby improving data transmission efficiency, helping to reduce the transmission time of data or instructions in the communication network, and improving overall performance.
[0119] As an optional embodiment, the initial routing table is updated according to the size relationship to obtain a first routing table, including:
[0120] If the size relationship indicates that the routing distance corresponding to the destination device in the initial routing table is greater than the routing distance corresponding to the destination device in the third routing table, the routing information corresponding to the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
[0121] For example, if the initial routing table and the third routing table contain the same destination device but different next-hop gateway information, if the routing distance corresponding to the destination device in the initial routing table is greater than the routing distance corresponding to the destination device in the third routing table, this can indicate that the path to the destination device in the initial routing table is a routing path with a longer routing distance, that is, compared to the routing path to the destination device in the third routing table, the path to the destination device in the initial routing table is not a more optimal routing path. In this case, the routing information for the destination device in the initial routing table can be updated with the routing information in the third routing table. In this way, the routing distance corresponding to the routing path from the first device to the destination device in the first routing table is shorter.
[0122] In the present disclosure, the first proxy gateway can improve data transmission efficiency by replacing the routing path to the destination device with a routing path with a shorter routing distance, and can also reduce unnecessary network traffic and alleviate network congestion.
[0123] As an optional embodiment, the method further includes:
[0124] If the size relationship indicates that the routing distance corresponding to the destination device in the initial routing table is smaller than the routing distance corresponding to the destination device in the third routing table, the routing information corresponding to the destination device in the initial routing table is kept unchanged to obtain the first routing table.
[0125] For example, if the initial routing table and the third routing table contain the same destination device but different next-hop gateway information, if the routing distance corresponding to the destination device in the initial routing table is shorter than the routing distance corresponding to the destination device in the third routing table, this indicates that the path to the destination device in the initial routing table is the routing path with the shorter routing distance. In this case, the path to the destination device in the initial routing table can be considered the preferred routing path. Maintaining the preferred routing path in the initial routing table ensures that data packets are transmitted along the optimal path, improving transmission efficiency.
[0126] For example, while keeping the routing information corresponding to the destination device in the initial routing table unchanged, the routing information corresponding to other destination devices in the initial routing table may be updated by other methods of updating the initial routing table to obtain the first routing table.
[0127] As an optional embodiment, the initial routing table is updated according to the size relationship to obtain a first routing table, including:
[0128] If the size relationship indicates that the routing distance corresponding to the destination device in the third routing table is equal to the routing distance corresponding to the destination device in the initial routing table, determine a first communication distance between the destination device in the initial routing table and the gateway corresponding to the next-hop gateway information, and a second communication distance between the destination device in the third routing table and the gateway corresponding to the next-hop gateway information;
[0129] If the second communication distance is less than the first communication distance, the routing information corresponding to the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
[0130] For example, if the initial routing table and the third routing table contain the same destination device but different next-hop gateway information, if the routing distance corresponding to the destination device in the third routing table is equal to the routing distance corresponding to the destination device in the initial routing table, it can be indicated that the routing distance corresponding to the path to the destination device in the initial routing table and the path to the destination device in the third routing table are the same. In this case, a determination can be made based on the communication distance between the destination device and the gateway corresponding to the next-hop gateway information, and the routing information with the shorter communication distance can be selected as the routing information corresponding to the destination device in the initial routing table.
[0131] For example, when the first communication distance is less than the second communication distance, the routing information corresponding to the destination device in the initial routing table can be kept unchanged. While keeping the routing information corresponding to the destination device in the initial routing table unchanged, the routing information corresponding to other destination devices in the initial routing table can be updated by other methods for updating the initial routing table to obtain the first routing table.
[0132] For example, the communication distance can be determined by the communication method between the next-hop gateway in the routing table and the destination device. For example, if a vehicle can communicate with a smartwatch via the manufacturer's cloud device, the vehicle can also communicate with the smartwatch via a mobile phone. However, the communication method between the device and the cloud is remote communication. That is, the communication distance between the vehicle and the smartwatch via the mobile phone is shorter than the communication distance between the vehicle and the smartwatch via the manufacturer's cloud device. Here, the routing information corresponding to the vehicle communicating with the smartwatch via the mobile phone can be used as the routing information for communication between the vehicle and the smartwatch in the first routing table after the initial routing table is updated.
[0133] In the present disclosure, the first proxy gateway compares the communication distances and selects a path with a shorter communication distance. The shorter communication distance helps to reduce the transmission time of data in the network, improve the overall network performance, improve data transmission efficiency, and reduce network delay.
[0134] As a specific example, Figure 2 Taking the routing information exchange between the CRRC gateway and the mobile gateway as an example, the gateway information of the vehicle gateway is A, and the gateway information of the mobile gateway is B. It can be understood that the vehicle gateway can serve as either the first or second proxy gateway. Here, when updating the routing table in the vehicle gateway, the vehicle gateway serves as the first proxy gateway. Correspondingly, the mobile gateway serves as the second proxy gateway. Table a is the initial routing table, table b is the second routing table, table c is the third routing table, and table d is the first routing table.
[0135] The initial routing table of the vehicle gateway includes routing information for destination devices reachable by the vehicle gateway, namely, the routing information for devices dev2 and dev3. The second routing table of the mobile gateway includes routing information for destination devices reachable by the mobile gateway, namely, the routing information for devices dev1, dev2, and dev3.
[0136] For example, when updating the routing table of the car gateway, the car gateway first obtains the second routing table of the mobile gateway, that is, Table B, and then modifies the routing distance and next-hop gateway information of all destination devices in Table B. Specifically, the gateway information in the next-hop gateway information is changed to the gateway information corresponding to the mobile gateway, that is, the next-hop gateway information of all destination devices in Table B is changed to mobile gateway B, and all routing distance values are added by 1 to obtain the third routing table, that is, Table C.
[0137] For example, the following steps may be performed on each piece of routing information in the modified third routing table (table c):
[0138] If there is no destination device in Table a, the routing information corresponding to the destination device in Table c is added to Table a. For example, if the routing information for device dev1 does not exist in Table a, but exists in Table c, the routing information for device dev1 in Table c is added to Table a.
[0139] If there is a destination device in Table a, first check whether the next-hop gateway information of the destination device is the gateway information of the mobile gateway. If so, replace the routing information corresponding to the destination device in Table c with the routing information corresponding to the destination device in Table a. For example, if there is routing information for device dev2 in both Table a and Table c, and the next-hop gateway information of device dev2 in both Table a and Table c is mobile gateway B, the routing information corresponding to device dev2 in Table c can be replaced with the routing information corresponding to device dev2 in Table a. Among them, the routing distance of device dev2 in Table a is 3, and the routing distance of device dev2 in Table c is 5. It can be seen that the routing path from the mobile gateway to device dev2 is actually changed. In this way, the routing information corresponding to device dev2 in the car gateway can be updated to the latest routing information.
[0140] If a destination device exists in Table a and its next-hop gateway information isn't the mobile gateway's, the route information corresponding to that destination device in Table a or Table c with the shorter route distance will be used as the route information from the vehicle gateway to that destination device. For example, if route information for device dev3 exists in both Table a and Table c, the next-hop gateway information for device dev3 in Table a is device B, while the next-hop gateway information for device dev3 in Table c is mobile gateway B. The route distance corresponding to device dev3 in Table a is 4, while the route distance corresponding to device dev3 in Table c is 2. Therefore, the route information corresponding to device dev3 in Table c can be used to replace the route information corresponding to device dev2 in Table a.
[0141] When the routing distance corresponding to the destination device in Table a is greater than the routing distance corresponding to the destination device in Table c, the routing distance corresponding to the destination device in Table c replaces the routing distance corresponding to the destination device in Table a. When the routing distance corresponding to the destination device in Table a is less than the routing distance corresponding to the destination device in Table c, the routing information corresponding to the destination device in Table a remains unchanged. When the routing distance corresponding to the destination device in Table a is equal to the routing distance corresponding to the destination device in Table c, it can be determined whether the communication method from the destination device to the next-hop gateway is near-field communication or far-field communication. The routing information corresponding to near-field communication is used as the routing information for the vehicle gateway to reach the destination device.
[0142] As an optional embodiment, the method further includes:
[0143] If the second routing table sent by the second proxy gateway is not received within the first preset time period, the routing distance of the second proxy gateway in the initial routing table or the first routing table is set to a preset value, which is used to indicate that the second proxy gateway is an unreachable gateway.
[0144] For example, both the first preset duration and the preset value can be set based on actual needs. The preset value can be sufficient as long as it indicates that the second proxy gateway is an unreachable gateway. An unreachable gateway indicates that the first proxy gateway is connected to the second proxy gateway, but the first proxy gateway cannot access the second proxy gateway due to a configuration error or other issue. The first preset duration is used to determine whether the routing table sent by the second proxy gateway has been successfully received within this time. The first preset duration can be set to 180 seconds, and the preset value can be set to 16 seconds.
[0145] In this disclosure, the first proxy gateway can mark the gateway as unreachable to prevent data packets or instructions from being sent indefinitely to the unreachable gateway, thereby improving network stability and efficiency. When the second proxy gateway becomes reachable again, the network connection can be quickly restored by only updating the routing distance field corresponding to the second proxy gateway, thereby reducing network failure recovery time.
[0146] As an optional embodiment, the second routing table is sent when the first proxy gateway and the second proxy gateway are connected based on a heartbeat mechanism; or,
[0147] The second routing table is sent by the second proxy gateway when the second proxy gateway detects the second routing table at intervals of a second preset time and when the second routing table changes; or
[0148] If the connection between the first proxy gateway and the second proxy gateway does not have a heartbeat mechanism, the second routing table is sent by the second proxy gateway at intervals of a third preset time period.
[0149] For example, the heartbeat mechanism refers to the periodic sending of signals to confirm the validity of the connection in network communication. The heartbeat mechanism can ensure the active state of the gateway connection and promptly detect and respond when the connection is disconnected. The second preset duration and the third preset duration can be set according to actual needs. For example, the second preset duration can be greater than the third preset duration, the second preset duration can be less than the third preset duration, or the second preset duration can be equal to the third preset duration. For example, the second preset duration and the third preset duration can both be set to 30 seconds.
[0150] For example, when a heartbeat-based connection is established between a first proxy gateway and a second proxy gateway, the second proxy gateway sends a second routing table when the heartbeat signal confirms the connection is valid, so that the first proxy gateway receives the second routing table and updates the initial routing table in the first proxy gateway based on the second routing table to obtain the first routing table. The second proxy gateway can then determine whether the second routing table has changed after each second preset time interval. For example, the second proxy gateway can make a determination based on the hash value corresponding to the root directory stored in the second routing table. If it is determined that the second routing table has changed, the second proxy gateway will send the changed second routing table to the first proxy gateway, so that the first proxy gateway can update the routing information based on the received second routing table to obtain the first routing table.
[0151] For example, when there is no heartbeat mechanism between the first proxy gateway and the second proxy gateway, the second proxy gateway will send the second routing table to the first proxy gateway every third preset time interval, so that the first proxy gateway updates the routing information based on the received second routing table to obtain the first routing table.
[0152] In the present disclosure, by setting the timing of exchanging routing tables between the first proxy gateway and the second proxy gateway, the routing tables of the first proxy gateway and the second proxy gateway can be updated in a timely manner, which is conducive to optimizing routing path selection, reducing network delay, and improving network throughput.
[0153] As an optional embodiment, the method further includes:
[0154] If the connection between the first proxy gateway and the second proxy gateway has a heartbeat mechanism, when the connection between the first proxy gateway and the second proxy gateway is disconnected, or when the heartbeat between the first proxy gateway and the second proxy gateway is lost, deleting the routing information associated with the second proxy gateway in the first routing table;
[0155] If the connection between the first proxy gateway and the second proxy gateway does not have a heartbeat mechanism, when the connection between the first proxy gateway and the second proxy gateway is disconnected, or when the first proxy gateway does not receive the second routing table sent by the second proxy gateway after exceeding a fourth preset time period, the routing information associated with the second proxy gateway in the first routing table is deleted, and the fourth preset time period is greater than the third preset time period.
[0156] For example, the fourth preset time length can be set according to actual conditions, and the fourth preset time length is greater than the third preset time length. For example, when the third preset time length is 60 seconds, the fourth preset time length can be 180 seconds, 240 seconds, 480 seconds, etc.
[0157] For example, if the connection between the first proxy gateway and the second proxy gateway has a heartbeat mechanism, the first proxy gateway will delete the routing information associated with the second proxy gateway when the connection is disconnected or the heartbeat is lost. If the connection between the first proxy gateway and the second proxy gateway does not have a heartbeat mechanism, the first proxy gateway will delete the relevant routing information if it does not receive the second routing table sent by the second proxy gateway after a fourth predetermined period of time.
[0158] In the present disclosure, the first proxy gateway can avoid data packets being mistakenly sent to the disconnected connection by promptly deleting the routing information of the second proxy gateway that has been disconnected or may be disconnected, thereby improving the stability of the network.
[0159] As an optional embodiment, the third device includes at least two, and correspondingly, the target routing information includes at least two, the target routing information includes routing information for the first device to interact with the second device through the corresponding third device, and sending the interaction request instruction to the second device according to the target routing information includes:
[0160] Determine routing distances corresponding to at least two pieces of target routing information respectively;
[0161] Determining the first target routing information having the shortest routing distance among the at least two target routing information;
[0162] The interaction request instruction is sent to the second device according to the first target routing information.
[0163] For example, there may be at least two third devices, i.e., there are at least two indirect routing paths from the first device to the second device, and each third device may be an intermediate node in the communication between the first proxy gateway and the second device. Here, the interaction request instruction can be sent to the second device by determining the first target routing information with the shortest routing distance from the at least two target routing information. This can reduce data transmission delays and improve network communication efficiency.
[0164] For example, refer to Figure 3 The controlling device can communicate with the controlled device through intermediate gateways 1 and 2, respectively. The controlling device can also communicate with the controlled device through intermediate gateway 3 to send interaction request instructions to the controlled device. The devices corresponding to intermediate gateways 1 and 3 can both serve as third devices. It can be determined that the route for communicating with the controlled device through intermediate gateway 3 is the shortest, meaning that the controlling device can send interaction request instructions to the controlled device through intermediate gateway 3.
[0165] As an optional embodiment, sending the interaction request instruction to the second device according to the first target routing information includes:
[0166] If there are at least two first target routing information, determining a third communication distance between the second device and the next hop gateway of the first device in each first target routing information;
[0167] Determining, among at least two first target routing information, second target routing information having the shortest third communication distance;
[0168] The interaction request instruction is sent to the second device according to the second target routing information.
[0169] For example, there may be a situation where the first target routing information includes at least two, that is, among multiple routing paths that indirectly reach the second device from the first device, at least two routing paths have the same shortest routing distance. Here, by determining the second target routing information with the shortest communication distance among the at least two first target routing information, the interaction request instruction can be sent to the second device, thereby improving the efficiency of network communication.
[0170] For example, refer to Figure 4 , the control-end device can communicate with the controlled-end device through the cloud gateway in turn, and the control-end device can also communicate with the controlled-end device through the device gateway to send the interaction request instruction to the controlled-end device. The devices corresponding to the cloud gateway and the device gateway here can both serve as the third device. Moreover, the routing distance for the control-end device to communicate with the controlled-end device through the cloud gateway is equal to the routing distance for the control-end device to communicate with the controlled-end device through the device gateway, both of which are 2. However, since the communication with the cloud gateway is far-field communication, the communication distance for the control-end device to communicate with the controlled-end device through the cloud gateway is greater than the communication distance for the control-end device to communicate with the controlled-end device through the device gateway. Therefore, it can be determined that the communication distance for communicating with the controlled-end device through the device gateway is the shortest, that is, the control-end device can send the interaction request instruction to the controlled-end device through the device gateway.
[0171] As an optional embodiment, the first proxy gateway does not support the automatic retransmission function, and / or the first proxy gateway supports at least one of the following functions:
[0172] Asynchronous transmission function for interactive request instructions;
[0173] The reject reception function is used to reject reception of information when the amount of information received by the first proxy gateway exceeds a preset upper limit threshold.
[0174] For example, to prevent network congestion caused by excessive messages, the first proxy gateway does not support automatic retransmission. This means that unacknowledged messages will not be automatically retransmitted. Disabling automatic retransmission corresponds to QoS level 0, meaning that after a message is published, it will be delivered at most once, but there is no guarantee of successful reception. In this mode, messages may be lost, but transmission speeds are faster. When sending data, if QoS level 0 is selected, the first proxy gateway will not confirm or retransmit messages. This means that after sending an interaction request instruction, it will not wait for confirmation from the instruction recipient, nor will it retransmit if the interaction request instruction fails.
[0175] For example, the first proxy gateway supports asynchronous transmission, allowing it to continue processing other tasks without waiting for the recipient to respond to the interaction request instruction, thereby improving the efficiency of network communication. The first proxy gateway also supports a reject-receive function. When the amount of data received by the first proxy gateway exceeds a preset threshold, the reject-receive function is activated, which helps prevent network congestion caused by excessive data volume and protects network stability.
[0176] Reference Figure 5 As an exemplary scenario, through the device interaction method disclosed herein, cross-device applications on a device can access the device's own capabilities through a proxy gateway. For example, a cross-device application in a car can access the car's capabilities through the car's proxy gateway, such as querying the car's air conditioning data, querying the car's instrument data, controlling the car's air conditioning parameters, and so on.
[0177] Reference Figure 6 As an exemplary scenario, through the device interaction method disclosed herein, cross-end applications on a device can access accessory devices or connected IoT devices through a proxy gateway. For example, a cross-end application on a car can access car accessory devices through a proxy gateway in the car, such as accessing navigation system data, sensor data, and control system data. A cross-end application on a car can also access IoT devices directly connected to the vehicle through a proxy gateway in the car, for example, accessing data from a driving recorder, controlling the car audio system, controlling the smart rearview mirror, and so on.
[0178] Reference Figure 7 As an exemplary scenario, through the device interaction method disclosed herein, a cross-device application on a local device can access the capabilities of a peer device or the devices connected to the peer device through a proxy gateway. For example, a cross-device application on a car can access the functions on the phone, access IoT devices connected to the phone, wearable devices, etc., such as IoT devices in smart homes, smart watches, and other wearable devices, through the proxy gateway in the car and the proxy gateway in the phone.
[0179] As an example, see Figure 8 , taking the car-watch linkage as an example of device interaction scenarios, such as the car navigation information is transmitted to the smart watch for display, or the user's heart rate detected by the smart watch is transmitted to the car computer for display, etc.
[0180] The mobile proxy gateway discovers the smartwatch through the connection between the phone and the smartwatch, acts as a proxy for the smartwatch, and materializes the smartwatch's hardware and software capabilities. The phone and watch can communicate using the mobile proxy gateway and a universal language, such as the object model Spec instructions. Object modeling refers to the digitization of physical entities and the creation of a data model of these entities in the cloud. Spec instructions are a universal language that defines the types and formats of commands that a smartwatch can execute.
[0181] Among them, the car proxy gateway discovers the smart watch through the connection between the car and the mobile phone, exchanges routing information with the mobile phone proxy gateway, obtains the routing information of the smart watch in the mobile phone proxy gateway, and updates the routing table in the car proxy gateway.
[0182] The vehicle proxy gateway then sends a Spec command, a physical model used to query or control the smartwatch. Using the vehicle proxy gateway's updated routing table, it queries the smartwatch's routing information and finds that its next-hop gateway is the mobile proxy gateway. After receiving the Spec command, the mobile proxy gateway locates the smartwatch device it's acting as a proxy for. Ultimately, the mobile proxy gateway passes the Spec command to the smartwatch's application SDK (Software Development Kit). The smartwatch SDK then parses the command and calls the application, implementing the returned functionality. For example, the smartwatch can send the detected user's heart rate to the vehicle, which can then display the heart rate on the vehicle's display to indicate the user's health status. Alternatively, the smartwatch can display navigation information transmitted by the vehicle.
[0183] Similarly, mobile phone applications can remotely control all devices accessible through the vehicle's smart cockpit domain cloud gateway. Mobile phone applications can also access vehicle functions or control all devices accessible through the vehicle proxy gateway via the mobile gateway and vehicle gateway. Vehicle applications can remotely transmit information to mobile phone applications or control the phone through the vehicle's smart cockpit domain cloud gateway and mobile phone gateway to enable phone functions. Vehicle applications can directly transmit information to or control the phone through the vehicle proxy gateway and mobile phone proxy gateway to enable phone functions such as playing music and navigation voice.
[0184] Reference Figure 9 , Figure 9FIG. 1 is a block diagram of a device interaction apparatus according to an exemplary embodiment. Figure 9 As shown, the device interaction apparatus 900 is applied to a first device, and includes a determination module 901 and a sending module 902 .
[0185] a determination module 901 configured to, in response to an interaction request instruction to a second device, determine target routing information for sending the interaction request instruction to the second device based on a first routing table of a first proxy gateway in the first device, wherein the first routing table includes routing information for direct interaction between the first device and the second device and / or routing information for interaction between the first device and the second device through a third device;
[0186] The sending module 902 is configured to send the interaction request instruction to the second device through the first proxy gateway according to the target routing information, so that the second device performs the target interaction function in response to the interaction request instruction.
[0187] As an optional embodiment, the first routing table is obtained in the following manner:
[0188] Obtaining the initial routing table of the first proxy gateway;
[0189] receiving a second routing table sent by a second proxy gateway in a third device, where the second routing table includes routing information for direct interaction between the third device and the second device and / or routing information for interaction between the third device and the second device through a fourth device;
[0190] According to the second routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table.
[0191] As an optional embodiment, the second routing table includes routing information from the third device to different destination devices, the routing information including routing distances from the third device to the different destination devices and next-hop gateway information of the third device. Based on the second routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table, including:
[0192] Increasing each routing distance in the second routing table by 1, and setting the next-hop gateway information of the third device to the gateway information of the second proxy gateway, to obtain a third routing table;
[0193] According to the third routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table.
[0194] As an optional embodiment, the initial routing table of the first proxy gateway is updated according to the third routing table to obtain the first routing table, including:
[0195] In a case where the initial routing table does not include the destination device in the third routing table, routing information corresponding to the destination device in the third routing table is added to the initial routing table to obtain a first routing table.
[0196] As an optional embodiment, the initial routing table of the first proxy gateway is updated according to the third routing table to obtain the first routing table, including:
[0197] In the case where the initial routing table includes the destination device in the third routing table, if the next-hop gateway information corresponding to the destination device in the initial routing table is the same as the next-hop gateway information corresponding to the destination device in the third routing table, the corresponding routing information of the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
[0198] As an optional embodiment, the initial routing table of the first proxy gateway is updated according to the third routing table to obtain the first routing table, including:
[0199] In a case where the initial routing table includes the destination device in the third routing table, if the next-hop gateway information corresponding to the destination device in the initial routing table is different from the next-hop gateway information corresponding to the destination device in the third routing table, determining a magnitude relationship between the routing distance corresponding to the destination device in the initial routing table and the routing distance corresponding to the destination device in the third routing table;
[0200] According to the size relationship, the initial routing table is updated to obtain the first routing table.
[0201] As an optional embodiment, the initial routing table is updated according to the size relationship to obtain a first routing table, including:
[0202] If the size relationship indicates that the routing distance corresponding to the destination device in the initial routing table is greater than the routing distance corresponding to the destination device in the third routing table, the routing information corresponding to the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
[0203] As an optional embodiment, the first routing table is also obtained in the following manner:
[0204] If the size relationship indicates that the routing distance corresponding to the destination device in the initial routing table is smaller than the routing distance corresponding to the destination device in the third routing table, the routing information corresponding to the destination device in the initial routing table is kept unchanged to obtain the first routing table.
[0205] As an optional embodiment, the initial routing table is updated according to the size relationship to obtain a first routing table, including:
[0206] If the size relationship indicates that the routing distance corresponding to the destination device in the third routing table is equal to the routing distance corresponding to the destination device in the initial routing table, determine a first communication distance between the destination device in the initial routing table and the gateway corresponding to the next-hop gateway information, and a second communication distance between the destination device in the third routing table and the gateway corresponding to the next-hop gateway information;
[0207] If the second communication distance is less than the first communication distance, the routing information corresponding to the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
[0208] As an optional embodiment, the first routing table is also obtained in the following manner:
[0209] If the second routing table sent by the second proxy gateway is not received within the first preset time period, the routing distance of the second proxy gateway in the initial routing table or the first routing table is set to a preset value, which is used to indicate that the second proxy gateway is an unreachable gateway.
[0210] As an optional embodiment, the second routing table is sent when the first proxy gateway and the second proxy gateway are connected based on a heartbeat mechanism; or,
[0211] The second routing table is sent by the second proxy gateway when the second proxy gateway detects the second routing table at intervals of a second preset time and when the second routing table changes; or
[0212] If the connection between the first proxy gateway and the second proxy gateway does not have a heartbeat mechanism, the second routing table is sent by the second proxy gateway at intervals of a third preset time period.
[0213] As an optional embodiment, the first routing table is also obtained in the following manner:
[0214] If the connection between the first proxy gateway and the second proxy gateway has a heartbeat mechanism, when the connection between the first proxy gateway and the second proxy gateway is disconnected, or when the heartbeat between the first proxy gateway and the second proxy gateway is lost, deleting the routing information associated with the second proxy gateway in the first routing table;
[0215] If the connection between the first proxy gateway and the second proxy gateway does not have a heartbeat mechanism, when the connection between the first proxy gateway and the second proxy gateway is disconnected, or when the first proxy gateway does not receive the second routing table sent by the second proxy gateway after exceeding a fourth preset time period, the routing information associated with the second proxy gateway in the first routing table is deleted, and the fourth preset time period is greater than the third preset time period.
[0216] As an optional embodiment, the third device includes at least two, and correspondingly, the target routing information includes at least two, and the target routing information includes routing information for the first device to interact with the second device through the corresponding third device. The sending module 902 is further configured to include:
[0217] Determine routing distances corresponding to at least two pieces of target routing information respectively;
[0218] Determining the first target routing information having the shortest routing distance among the at least two target routing information;
[0219] The interaction request instruction is sent to the second device according to the first target routing information.
[0220] As an optional embodiment, the sending module 902 is further configured to:
[0221] If there are at least two first target routing information, determining a third communication distance between the second device and the next hop gateway of the first device in each first target routing information;
[0222] Determining, among at least two first target routing information, second target routing information having the shortest third communication distance;
[0223] The interaction request instruction is sent to the second device according to the second target routing information.
[0224] As an optional embodiment, the first proxy gateway does not support the automatic retransmission function, and / or the first proxy gateway supports at least one of the following functions:
[0225] Asynchronous transmission function for interactive request instructions;
[0226] The reject reception function is used to reject reception of information when the amount of information received by the first proxy gateway exceeds a preset upper limit threshold.
[0227] Regarding the device interaction apparatus 900 in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the device interaction method, and will not be elaborated here.
[0228] Based on the same inventive concept, the present disclosure also provides a computer-readable storage medium having computer program instructions stored thereon, which implement the device interaction method of the present disclosure when the program instructions are executed by a processor.
[0229] Based on the same inventive concept, the present disclosure further provides an electronic device, comprising:
[0230] a storage device for storing a computer program;
[0231] The execution device is used to execute the computer program to implement the device interaction method disclosed in the present invention.
[0232] Figure 10 This is a block diagram of an electronic device 1000 according to an exemplary embodiment. For example, electronic device 1000 may be a mobile phone, a computer, a tablet device, an in-vehicle computer, a cloud server, etc. The in-vehicle computer may be installed in a vehicle, which may be an autonomous vehicle, a semi-autonomous vehicle, or a non-autonomous vehicle. The cloud server may be a vehicle-side cloud server, a mobile phone-side cloud server, etc.
[0233] Reference Figure 10 The electronic device 1000 may include one or more of the following components: a processing component 1002 , a memory 1004 , a power component 1006 , a multimedia component 1008 , an audio component 1010 , an input / output interface 1012 , a sensor component 1014 , and a communication component 1016 .
[0234] The processing component 1002 generally controls the overall operation of the electronic device 1000, such as operations associated with display, phone calls, data communications, camera operation, and recording operations. The processing component 1002 may include one or more processors 1020 to execute instructions to perform all or part of the steps of the above-described method. In addition, the processing component 1002 may include one or more modules to facilitate interaction between the processing component 1002 and other components. For example, the processing component 1002 may include a multimedia module to facilitate interaction between the multimedia component 1008 and the processing component 1002.
[0235] The memory 1004 is configured to store various types of data to support operations on the electronic device 1000. Examples of such data include instructions for any application or method operating on the electronic device 1000, contact data, phone book data, messages, pictures, videos, etc. The memory 1004 can be implemented by any type of volatile or non-volatile storage device, or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk, or optical disk.
[0236] The power supply assembly 1006 provides power to the various components of the electronic device 1000. The power supply assembly 1006 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1000.
[0237] The multimedia component 1008 includes a screen that provides an output interface between the electronic device 1000 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, slides, and gestures on the touch panel. The touch sensor can not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1008 includes a front camera and / or a rear camera. When the electronic device 1000 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera can receive external multimedia data. Each front camera and rear camera can be a fixed optical lens system or have a focal length and optical zoom capability.
[0238] The audio component 1010 is configured to output and / or input audio signals. For example, the audio component 1010 includes a microphone (MIC), which is configured to receive external audio signals when the electronic device 1000 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal can be further stored in the memory 1004 or transmitted via the communication component 1016. In some embodiments, the audio component 1010 also includes a speaker for outputting audio signals.
[0239] The input / output interface 1012 provides an interface between the processing component 1002 and peripheral interface modules, such as a keyboard, a click wheel, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0240] The sensor assembly 1014 includes one or more sensors for providing various aspects of status assessment for the electronic device 1000. For example, the sensor assembly 1014 can detect the open / closed state of the electronic device 1000, the relative positioning of components, such as the display and keypad of the electronic device 1000. The sensor assembly 1014 can also detect changes in the position of the electronic device 1000 or a component of the electronic device 1000, the presence or absence of user contact with the electronic device 1000, the orientation or acceleration / deceleration of the electronic device 1000, and temperature changes of the electronic device 1000. The sensor assembly 1014 can include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 1014 can also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1014 can also include an accelerometer, a gyroscope, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0241] The communication component 1016 is configured to facilitate wired or wireless communication between the electronic device 1000 and other devices. The electronic device 1000 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 1016 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1016 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0242] In an exemplary embodiment, the electronic device 1000 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above-described methods.
[0243] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1004 including instructions, and the instructions can be executed by the processor 1020 of the electronic device 1000 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0244] In another exemplary embodiment, a computer program product is further provided. The computer program product includes a computer program that can be executed by a programmable device, and the computer program has a code portion for executing the above-mentioned device interaction method when executed by the programmable device.
[0245] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the present disclosure. This disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the following claims.
[0246] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A device interaction method, characterized in that: Applied to a first device, comprising: In response to an interaction request instruction for a second device, determining, based on a first routing table of a first proxy gateway in the first device, target routing information for sending the interaction request instruction to the second device, wherein the first routing table includes routing information for direct interaction between the first device and the second device and / or routing information for interaction between the first device and the second device through a third device; The interaction request instruction is sent to the second device through the first proxy gateway according to the target routing information, so that the second device performs the target interaction function in response to the interaction request instruction.
2. The method according to claim 1, characterized in that The first routing table is obtained in the following manner: Obtaining an initial routing table of the first proxy gateway; receiving a second routing table sent by a second proxy gateway in the third device, where the second routing table includes routing information for direct interaction between the third device and the second device and / or routing information for interaction between the third device and the second device through a fourth device; According to the second routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table.
3. The method according to claim 2, characterized in that The second routing table includes routing information from the third device to different destination devices, the routing information including routing distances from the third device to the different destination devices and next-hop gateway information of the third device. The updating of the initial routing table of the first proxy gateway according to the second routing table to obtain the first routing table includes: Increasing each routing distance in the second routing table by 1, and setting the next-hop gateway information of the third device to the gateway information of the second proxy gateway, to obtain a third routing table; According to the third routing table, the initial routing table of the first proxy gateway is updated to obtain the first routing table.
4. The method according to claim 3, characterized in that The updating of the initial routing table of the first proxy gateway according to the third routing table to obtain the first routing table includes: In a case where the initial routing table does not include the destination device in the third routing table, the routing information corresponding to the destination device in the third routing table is added to the initial routing table to obtain the first routing table.
5. The method according to claim 3, characterized in that The updating of the initial routing table of the first proxy gateway according to the third routing table to obtain the first routing table includes: In the case where the initial routing table includes the destination device in the third routing table, if the next-hop gateway information corresponding to the destination device in the initial routing table is the same as the next-hop gateway information corresponding to the destination device in the third routing table, the corresponding routing information of the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
6. The method according to claim 3, characterized in that The updating of the initial routing table of the first proxy gateway according to the third routing table to obtain the first routing table includes: In a case where the initial routing table includes the destination device in the third routing table, if the next-hop gateway information corresponding to the destination device in the initial routing table is different from the next-hop gateway information corresponding to the destination device in the third routing table, determining a magnitude relationship between a routing distance corresponding to the destination device in the initial routing table and a routing distance corresponding to the destination device in the third routing table; According to the size relationship, the initial routing table is updated to obtain the first routing table.
7. The method according to claim 6, characterized in that The updating of the initial routing table according to the size relationship to obtain the first routing table includes: If the size relationship indicates that the routing distance corresponding to the destination device in the initial routing table is greater than the routing distance corresponding to the destination device in the third routing table, the routing information corresponding to the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
8. The method according to claim 6, characterized in that The method further comprises: If the size relationship indicates that the routing distance corresponding to the destination device in the initial routing table is less than the routing distance corresponding to the destination device in the third routing table, the routing information corresponding to the destination device in the initial routing table is kept unchanged to obtain the first routing table.
9. The method according to claim 6, characterized in that The updating of the initial routing table according to the size relationship to obtain the first routing table includes: If the size relationship indicates that the routing distance corresponding to the destination device in the third routing table is equal to the routing distance corresponding to the destination device in the initial routing table, determining a first communication distance between the destination device in the initial routing table and the gateway corresponding to the next-hop gateway information and a second communication distance between the destination device in the third routing table and the gateway corresponding to the next-hop gateway information; If the second communication distance is smaller than the first communication distance, the routing information corresponding to the destination device in the initial routing table is replaced with the routing information corresponding to the destination device in the third routing table to obtain the first routing table.
10. The method according to claim 2, characterized in that The method further comprises: If the second routing table sent by the second proxy gateway is not received within the first preset time period, the routing distance in which the next hop gateway in the initial routing table or the first routing table is the second proxy gateway is set to a preset value, where the preset value is used to indicate that the second proxy gateway is an unreachable gateway.
11. The method according to any one of claims 2 to 10, characterized in that: The second routing table is sent when the first proxy gateway and the second proxy gateway are connected based on a heartbeat mechanism; or, The second routing table is sent by the second proxy gateway when the second proxy gateway detects the second routing table at intervals of a second preset time and when the second routing table changes; or, If the connection between the first proxy gateway and the second proxy gateway does not have a heartbeat mechanism, the second routing table is sent by the second proxy gateway at intervals of a third preset time period.
12. The method according to any one of claims 2 to 10, characterized in that: The method further comprises: If the connection between the first proxy gateway and the second proxy gateway has a heartbeat mechanism, when the connection between the first proxy gateway and the second proxy gateway is disconnected, or when the heartbeat between the first proxy gateway and the second proxy gateway is lost, deleting the routing information associated with the second proxy gateway in the first routing table; If the connection between the first proxy gateway and the second proxy gateway does not have a heartbeat mechanism, when the connection between the first proxy gateway and the second proxy gateway is disconnected, or when the first proxy gateway does not receive the second routing table sent by the second proxy gateway after a fourth preset time period has expired, the routing information associated with the second proxy gateway in the first routing table is deleted, where the fourth preset time period is greater than the third preset time period.
13. The method according to any one of claims 1 to 10, characterized in that The third devices include at least two, and correspondingly, the target routing information includes at least two, the target routing information includes routing information for the first device to interact with the second device through the corresponding third device, and the sending the interaction request instruction to the second device according to the target routing information includes: Determining routing distances corresponding to at least two pieces of target routing information respectively; Determining the first target routing information having the shortest routing distance among the at least two target routing information; The interaction request instruction is sent to the second device according to the first target routing information.
14. The method according to claim 13, characterized in that The sending the interaction request instruction to the second device according to the first target routing information includes: If there are at least two first target routing information, determining a third communication distance between the second device and the next hop gateway of the first device in each first target routing information; Determine, among at least two of the first target routing information, the second target routing information having the shortest third communication distance; The interaction request instruction is sent to the second device according to the second target routing information.
15. The method according to any one of claims 1 to 10, characterized in that The first proxy gateway does not support an automatic retransmission function, and / or the first proxy gateway supports at least one of the following functions: Asynchronous transmission function for the interaction request instruction; The reject reception function is used to reject the reception of information when the amount of information received by the first proxy gateway exceeds a preset upper threshold.
16. A device interaction apparatus, characterized in that: Applied to a first device, comprising: a determining module configured to, in response to an interaction request instruction to a second device, determine, based on a first routing table of a first proxy gateway in the first device, target routing information for sending the interaction request instruction to the second device, wherein the first routing table includes routing information for direct interaction between the first device and the second device and / or routing information for interaction between the first device and the second device through a third device; The sending module is configured to send the interaction request instruction to the second device through the first proxy gateway according to the target routing information, so that the second device performs the target interaction function in response to the interaction request instruction.
17. A computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the device interaction method described in any one of claims 1 to 15 is implemented.
18. An electronic device, characterized in that: include: a storage device for storing a computer program; An execution device is used to execute the computer program to implement the device interaction method described in any one of claims 1-15.