Communication method and device, computer equipment, storage medium and program product
By determining the target master device in the smart home network and assigning communication tokens, the communication interruption problem caused by token loss is solved, and the order management and efficient recovery of communication is realized, ensuring network reliability and unique access to the device.
Patent Information
- Application Number
- CN202510769012.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-10
- Publication Date
- 2025-08-12
AI Technical Summary
In traditional token networks, the problem of communication interruption caused by token loss is difficult to effectively solve in the prior art.
In smart home networking, when multiple master devices do not receive communication tokens, the target master device is determined from multiple master devices through preset rules, and a communication token is allocated to them to ensure communication recovery. Specific measures include the counterclockwise transmission of tokens in the ring network structure, the allocation of random waiting cardinality and priority, the dynamic retransmission mechanism, and the use of unicast and multicast modes.
It realizes that communication can be restored even in the case of token loss, ensuring the order, reliability and efficiency of communication, reducing network load, and improving communication success rate and uniqueness of device access.
Smart Images

Figure CN120474856A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of smart home technology, and in particular to a communication method, device, computer equipment, storage medium and program product. Background Art
[0002] In the field of computer network communications, ensuring accurate, efficient, and stable data transmission is a crucial goal. To achieve this goal, a variety of network communication protocols and technologies have emerged. Among them, token networks, as an important local area network access control technology, play a key role in this scenario.
[0003] In related technologies, each node in a network determines when it can send data by monitoring a token signal on the network.
[0004] However, when the token is lost, nodes in the network will not be able to obtain the authority to send data.
[0005] Therefore, how to solve the communication interruption caused by token loss in traditional token networks becomes a technical problem that needs to be solved. Summary of the Invention
[0006] In view of this, the present invention provides a communication method, apparatus, computer equipment, storage medium and program product.
[0007] In a first aspect, the present invention provides a communication method, which includes: when multiple master devices in a smart home network have not received a communication token, determining a target master device from the multiple master devices according to a preset rule; wherein the target master device is a device that receives the communication token, and the smart home network includes multiple master devices; sending a communication token to the target master device so that the target master device communicates with a target slave device corresponding to the target master device according to the communication token.
[0008] The communication method provided by this embodiment is such that when the communication token is lost, nodes in the network will not be able to obtain permission to send data. When multiple master devices in a smart home network do not receive the communication token, the present application can determine a target master device from the multiple master devices according to a preset rule, that is, reallocate the communication token. This ensures that even if the communication token is lost, the communication token can be reallocated to the target master device, thereby restoring communication, so that the target master device can communicate with the target slave device corresponding to the target master device based on the communication token.
[0009] In one possible implementation, the method also includes: when the communication between the target master device and the target slave device is completed, determining the first master device from the ring network structure, sending a communication token to the first master device, and detecting whether the first master device has received the communication token; wherein the first master device is a master device adjacent to the first master device in the counterclockwise direction of the ring network structure; each master device among the multiple master devices forms a ring network structure according to the corresponding address; when the first master device does not receive the communication token, retransmission is triggered, and when the number of retransmissions reaches a preset number of times and the first master device does not receive the communication token, determining the second master device from the ring network structure, and sending the communication token to the second master device; wherein the second master device is a master device adjacent to the first master device in the counterclockwise direction of the ring network structure.
[0010] The communication method provided in this embodiment realizes orderly management of communication by passing the communication token in sequence in a counterclockwise direction in the ring network structure. After each master device completes the communication with the corresponding slave device, it passes the token to the next master device, ensuring the sequentiality and controllability of communication. In addition, when the first master device does not receive the communication token, the system triggers a retransmission mechanism. This retransmission mechanism increases the reliability of communication and ensures that the token can be successfully passed to the next master device. In addition, if the number of retransmissions reaches the preset number and the first master device still does not receive the token, the system will determine the second master device from the ring network structure (that is, the next master device in the counterclockwise direction of the first master device) and send the token to it. This flexible error handling mechanism ensures that the network can continue to operate normally even if a master device fails or has communication problems.
[0011] In one possible implementation, the method further includes: when a new master device joins the smart home network, obtaining the maximum available address and allocating the maximum available address to the new master device; when a new slave device joins the smart home network, obtaining the minimum available address and allocating the minimum available address to the new slave device.
[0012] The communication method provided in this embodiment ensures address uniqueness and network scalability in high-frequency device access scenarios by allocating addresses in reverse order from small to large for the master device and from large to small for the slave device, and automatically re-addressing when a conflict occurs.
[0013] In one possible implementation, a target master device is determined from multiple master devices according to preset rules, including: determining a random waiting cardinality and a priority of each master device; determining a waiting time of each master device according to the priority and the random waiting cardinality; wherein the waiting time indicates the time for the master device to request a communication token; and determining the master device with the shortest waiting time as the target master device.
[0014] The communication method provided in this embodiment can determine the waiting time of each master device by assigning a random waiting cardinality and priority to each master device, so that each master device has the opportunity to become the target master device within a reasonable time, thereby ensuring fair distribution of communication resources.
[0015] In one possible implementation, when the first master device does not receive the communication token, retransmission is triggered, including: when the first master device does not receive the communication token, determining the time period for each retransmission; wherein the time period for the next retransmission is greater than the time period for the current retransmission; within the time period of the target retransmission, randomly selecting a target time to send the communication token to the first master device; wherein the target time is any time within the target time period, and the target time is any time of each time.
[0016] The communication method provided in this embodiment avoids network congestion or conflicts that might be caused by a fixed retransmission interval by increasing the time period for each retransmission. For example, if the retransmission interval is too short, multiple master devices might retransmit simultaneously, causing network interference; while if the interval is too long, communication delays might result. Dynamically adjusting the retransmission interval balances these two factors, improving communication success rates. Furthermore, randomly selecting a target time within the target time period to send the token further reduces the probability of multiple master devices retransmitting simultaneously. This randomness increases network uncertainty, ensuring that even when multiple master devices need to retransmit, conflicts are less likely to occur.
[0017] In one possible implementation, the process of the target master device communicating with the target slave device corresponding to the target master device based on the communication token includes: the first device communicating with the target slave device corresponding to the target master device through a unicast mode based on the communication token; the target master device communicating with the target slave device corresponding to the first device through a multicast mode based on the communication token.
[0018] The communication method provided in this embodiment directly sends data packets to the target slave device in unicast mode without broadcasting or multicasting, thereby reducing unnecessary data transmission in the network, lowering the network load, and improving communication efficiency.
[0019] In addition, multicast mode allows the target master device to send data packets to multiple target master devices simultaneously, without having to send a data packet to each slave device separately. This reduces duplicate data transmission in the network and improves communication efficiency, especially in scenarios where multiple slave devices need to be controlled simultaneously.
[0020] In a second aspect, the present invention provides a communication device, which is applied to smart home devices, and the device includes: a determination module, which is used to determine a target master device from multiple master devices according to preset rules when multiple master devices in the smart home network have not received a communication token; wherein the target master device is a device that receives a communication token, and the smart home network includes multiple master devices; a sending module, which is used to send a communication token to the target master device, so that the target master device communicates with the target slave device corresponding to the target master device according to the communication token.
[0021] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the communication method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0022] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to enable a computer to execute the communication method of the first aspect or any corresponding embodiment thereof.
[0023] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions for causing a computer to execute the communication method of the first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0025] Figure 1 is a flow chart of a communication method according to an embodiment of the present invention;
[0026] Figure 2 is a structural block diagram of a communication device according to an embodiment of the present invention;
[0027] Figure 3 Schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0028] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.
[0029] According to an embodiment of the present invention, a communication method embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] In this embodiment, a communication method is provided, which can be used in computer devices, such as computers, servers, etc. Figure 1 FIG. 1 is a flow chart of a communication method according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0031] Step S101, when multiple master devices in the smart home network have not received the communication token, a target master device is determined from the multiple master devices according to a preset rule; wherein the target master device is a device that receives the communication token, and the smart home network includes multiple master devices.
[0032] Smart home networking involves connecting multiple smart home devices (such as smart lamps, smart sockets, smart cameras, and smart thermostats) together via wired or wireless connections to form a network system that enables communication and collaboration. In a smart home network, multiple master devices share a communication token to communicate with their respective slave devices. If none of the master devices receive a communication token, a target master device is identified from the master devices using pre-defined rules. This target master device then receives the communication token for subsequent communication.
[0033] In smart home networking, a master device can be a device with control or management capabilities. They can send commands to other devices (slave devices) and may receive feedback or status information from slave devices. Master devices can include, but are not limited to, smart home hubs, smart gateways, smartphone apps, or other devices with control capabilities.
[0034] If multiple master devices do not receive the communication token, a master device is determined from these master devices according to preset rules (such as priority, random selection, polling, etc.) and becomes the target master device. The target master device will receive the communication token and obtain the permission to communicate with the slave device.
[0035] In a smart home network, slave devices are those that receive and execute commands from the master device. They typically don't have direct control capabilities, but instead perform actions (such as turning on or off, adjusting brightness or temperature) based on the master device's instructions. Slave devices can include smart lamps, smart sockets, smart curtains, and more.
[0036] In one scenario, a smart home network includes three master devices: a smart thermostat (master A), a smart lighting controller (master B), and a smart security controller (master C). Each master device controls multiple slave devices (such as sensors and actuators). Communication tokens are used to control the access rights of these master devices to the network.
[0037] At a certain moment, none of the master devices A, B, and C receive the communication token, causing them to be unable to communicate with their respective slave devices. At this point, a target master device needs to be selected from the three master devices according to a preset rule.
[0038] As an example, a priority is set for the master device (such as smart security controller > smart lighting controller > smart thermostat). When multiple master devices do not receive the communication token, the master device with the highest priority is selected as the target master device.
[0039] As an example, random waiting times are assigned to the master devices, and the master device with the shortest waiting time becomes the target master device.
[0040] As an example, a random waiting time is assigned to the master device, and the waiting time of the master device is determined in combination with the priority, and the master device with the shortest waiting time is selected as the target master device.
[0041] Step S102: sending a communication token to the target master device, so that the target master device communicates with the target slave device corresponding to the target master device according to the communication token.
[0042] After determining the target master device, a communication token can be sent to the target master device to enable the target master device to resume communication. After the target master device receives the communication token, it can communicate with its corresponding target slave device, such as a camera, door and window sensor, to perform security monitoring tasks.
[0043] In one scenario, the master device sends a read command: CMD = 0x01, Data = [sensor ID]; the slave device returns in a specified time slot: Status = 0x00, Data = [Temperature: 25.3°C, Humidity: 60%]; the master device updates the data cache and releases the token.
[0044] In one scenario, a slave device triggers a hardware interrupt line; the master device inserts an urgent process in the token cycle: suspends the current data transfer; preferentially reads the interrupted slave device status; and resumes the token transfer after the process is completed.
[0045] The communication method provided by this embodiment is such that when the communication token is lost, nodes in the network will not be able to obtain permission to send data. When multiple master devices in a smart home network do not receive the communication token, the present application can determine a target master device from the multiple master devices according to a preset rule, that is, reallocate the communication token. This ensures that even if the communication token is lost, the communication token can be reallocated to the target master device, thereby restoring communication, so that the target master device can communicate with the target slave device corresponding to the target master device based on the communication token.
[0046] In one possible implementation, determining the target master device from multiple master devices according to a preset rule in step S101 includes:
[0047] Step S1011 , determining the random waiting cardinality and priority of each master device.
[0048] The random wait base can be a randomly generated value used in subsequent steps to calculate the wait time for each master device, combined with the priority. Priority can be a priority value assigned to a master device, used to determine which master device should receive a communication token when multiple masters simultaneously request a token. Priority can be determined based on device type, function, user settings, or other factors.
[0049] Step S1012: determining the waiting time of each master device according to the priority and the random waiting cardinality; wherein the waiting time indicates the time for the master device to request a communication token.
[0050] The waiting time can be indicated by calculating the priority and the random waiting base, so that the master device with high priority can obtain a shorter waiting time in most cases, but the introduction of the random waiting base also ensures that the master device with low priority still has the opportunity to obtain the token under certain circumstances.
[0051] As an example, the waiting time may be determined by performing weighted summation or multiplication operation based on the priority and the random waiting base.
[0052] For example, suppose there are three master devices in a smart home network: Master A (smart thermostat), Master B (smart lighting controller), and Master C (smart security controller). Currently, none of these three master devices have received the communication token, so you need to follow the steps above to determine the target master device.
[0053] Each master device is assigned a random wait base and a priority.
[0054] Master device A: random wait cardinality = 3, priority = 2.
[0055] Master device B: random waiting cardinality = 1, priority = 1.
[0056] Master device C: random wait cardinality = 5, priority = 3.
[0057] Assume that the calculation formula for waiting time is: waiting time = (10-priority) × random waiting base (this is just an example, the actual formula may be different). Calculate the waiting time of each master device:
[0058] Master device A: waiting time = (10-2) × 3 = 24.
[0059] Master device B: waiting time = (10-1) × 1 = 9.
[0060] Master device C: waiting time = (10-3) × 5 = 35.
[0061] Step S1013: Determine the master device with the shortest waiting time as the target master device.
[0062] After determining the waiting time of each master device, the master device with the shortest waiting time is determined as the target master device. The target master device can then immediately broadcast the token holding statement to the entire network to establish control.
[0063] The communication method provided in this embodiment can determine the waiting time of each master device by assigning a random waiting cardinality and priority to each master device, so that each master device has the opportunity to become the target master device within a reasonable time, thereby ensuring fair distribution of communication resources.
[0064] In one possible implementation, the method further includes:
[0065] Step S201, when the communication between the target master device and the target slave device is completed, determine the first master device from the ring network structure, send a communication token to the first master device, and detect whether the first master device receives the communication token; wherein, the first master device is the master device adjacent to the first master device in the counterclockwise direction of the ring network structure; each master device among the multiple master devices forms a ring network structure according to the corresponding address.
[0066] In the smart home networking, the master device (such as the air conditioner central control host) dynamically assigns a unique address to the slave device (air conditioner extension 1) and establishes a binding relationship; the master device polls the air conditioner extension temperature data during the token holding period, and after the communication is completed, it passes the token to the next master device (such as the security host) according to the optimal path, forming a ring scheduling network to achieve orderly collaboration among multiple master devices and efficient response from the slave devices. Among them, the master device of this application is not limited to the smart center in the smart home, but more generally refers to master devices such as the air conditioner central control, multi-switch panel central control, and security central control with simple management slave devices. These master devices are directly managed by the smart center.
[0067] In specific implementation, when the communication between the target master device and the target slave device is completed, it is necessary to determine the next master device (i.e., the first master device) from the ring network structure to receive the communication token; wherein, the first master device is the master device adjacent to the first master device in the counterclockwise direction of the ring network structure; each of the multiple master devices forms a ring network structure according to the corresponding address.
[0068] Send a communication token to the first master device and detect whether the first master device has received the communication token. This can be done by detecting whether the first master device has initiated a new communication. When the first master device initiates a new communication, the communication token is deemed to have been successfully delivered.
[0069] In one possible implementation, the master's token holding time can be used as a transfer condition. Specifically, when a master holds the token for a set time, it sends the communication token to the next master. The set time can be dynamically calculated. For example, it can be calculated as: 100ms base time + 5ms for each slave device to be queried. Permitted operations include querying any slave device, sending management information to other masters, and updating network topology data.
[0070] Step S202, when the first master device does not receive the communication token, retransmission is triggered, and when the number of retransmissions reaches a preset number and the first master device does not receive the communication token, the second master device is determined from the ring network structure, and the communication token is sent to the second master device; wherein the second master device is the master device adjacent to the first master device in the counterclockwise direction of the ring network structure.
[0071] The preset number of times may be indicated as a pre-set number of times, i.e., the number of retransmissions. When the first master device fails to receive the communication token, retransmission is triggered, i.e., the communication token is resent to the first master device. When the number of retransmissions reaches the preset number of times and the first master device fails to receive the communication token, a second master device is determined from the ring network structure. The second master device is a master device adjacent to the first master device in a counterclockwise direction of the ring network structure.
[0072] For example, a ring network structure consists of four master devices (master device A, master device B, master device C, and master device D). They are connected in a clockwise direction to form the following topology: master device A → master device B → master device C → master device D → master device A.
[0073] Assume that master device A currently holds a communication token and has completed communication with its slave devices. Based on the ring network structure, master device A determines that the first master device is master device B. Master device A sends a communication token to master device B and checks whether master device B has received the communication token. Master device B successfully receives the communication token and can communicate with its slave devices. When master device B detects that it has not received the communication token, a retransmission is triggered. Master device A attempts to send the communication token to master device B again. After three retransmissions, master device B still has not received the communication token. Because the number of retransmissions has reached the preset number and master device B has not received the communication token, master device A abandons sending the token to master device B. Based on the ring network structure, master device A determines that the second master device is master device D. It then sends the communication token to master device D.
[0074] The communication method provided in this embodiment realizes orderly management of communication by passing the communication token in sequence in a counterclockwise direction in the ring network structure. After each master device completes the communication with the corresponding slave device, it passes the token to the next master device, ensuring the sequentiality and controllability of communication. In addition, when the first master device does not receive the communication token, the system triggers a retransmission mechanism. This retransmission mechanism increases the reliability of communication and ensures that the token can be successfully passed to the next master device. In addition, if the number of retransmissions reaches the preset number and the first master device still does not receive the token, the system will determine the second master device from the ring network structure (that is, the next master device in the counterclockwise direction of the first master device) and send the token to it. This flexible error handling mechanism ensures that the network can continue to operate normally even if a master device fails or has communication problems.
[0075] In one possible implementation, in step S202, when the first master device does not receive the communication token, triggering retransmission includes:
[0076] Step S2021: When the first master device does not receive the communication token, determine the time period for each retransmission; wherein the time period for the next retransmission is greater than the time period for the current retransmission.
[0077] When the first master device does not receive the communication token, it is necessary to resend the communication token to the first master device. Before sending the communication token to the first master device, it is necessary to determine the time period for sending the communication token to the first master device, that is, the waiting time for sending the communication token to the first master device. For example: when the time period is 10s, it is necessary to wait 10s to send the communication token to the first master device.
[0078] The next retransmission time period is longer than the current retransmission time period, indicating that if the current retransmission fails, the next retransmission time period can be increased. For example, if the current retransmission time period is 10 seconds, the next retransmission time period can be 20 seconds.
[0079] Step S2022: within the target retransmission time period, randomly select a target time to send a communication token to the first master device; wherein the target time is any time within the target time period, and the target time is any time in each retransmission.
[0080] The target retransmission is any one of the retransmissions, and the target time is any time within the target time period. Within the target retransmission time period, that is, within the waiting time, a random time can be selected as the time to send the communication token to the first master device. For example, if the time period is 10 seconds, the communication token can be sent to the first master device at 5 seconds.
[0081] In one scenario, assume that master device A fails to transfer the token, triggering the time-sharing retransmission mechanism:
[0082] The first retransmission waits for 10ms, and randomly backs off and selects the 5th ms to send.
[0083] If it still fails, wait for the second 20ms window and randomly select the 12th ms to send.
[0084] If other master devices (such as B and C) are also retransmitting, they will likely retry at different time points due to the differences in time-slot increments and random backoffs, thereby significantly reducing continuous conflicts and improving overall network recovery efficiency.
[0085] The communication method provided in this embodiment avoids network congestion or conflicts that might be caused by a fixed retransmission interval by increasing the time period for each retransmission. For example, if the retransmission interval is too short, multiple master devices might retransmit simultaneously, causing network interference; while if the interval is too long, communication delays might result. Dynamically adjusting the retransmission interval balances these two factors, improving communication success rates. Furthermore, randomly selecting a target time within the target time period to send the token further reduces the probability of multiple master devices retransmitting simultaneously. This randomness increases network uncertainty, ensuring that even when multiple master devices need to retransmit, conflicts are less likely to occur.
[0086] In one possible implementation, the method further includes:
[0087] Step S301: When a new master device joins the smart home network, the maximum available address is obtained and allocated to the new master device.
[0088] When a new master device joins the smart home network, it needs to be assigned an address. The largest available address is found from the currently unassigned addresses and assigned to the new master device.
[0089] The address pool corresponding to the master device may be 0x00-0x7F.
[0090] Step S302: When a new slave device joins the smart home network, a minimum available address is obtained and the minimum available address is allocated to the new slave device.
[0091] When a new slave device joins the smart home network, it needs to be assigned an address. Find the smallest available address from the currently unassigned addresses and assign this smallest available address to the new slave device.
[0092] The address pool corresponding to the slave device may be 0x80-0xFF.
[0093] The communication method provided in this embodiment ensures address uniqueness and network scalability in high-frequency device access scenarios by allocating addresses in reverse order from small to large for the master device and from large to small for the slave device, and automatically re-addressing when a conflict occurs.
[0094] In one possible implementation, a process in which a target master device communicates with a target slave device corresponding to the target master device according to a communication token includes:
[0095] Step S401: The first device communicates with the target slave device corresponding to the target master device in unicast mode according to the communication token.
[0096] Unicast is a one-to-one communication method, where a target master device sends data to a single target slave device. The master device can maintain a dynamically updated slave device response schedule and optimize the query order based on historical response times. Data is sent to the target slave devices in the order in which they were queried.
[0097] Step S402: The first device communicates with the target slave device corresponding to the target master device in a multicast mode according to the communication token.
[0098] When there are multiple target slave devices, this application can support combined query commands to query multiple target slave devices during one token holding period.
[0099] The communication method provided in this embodiment directly sends data packets to the target slave device in unicast mode without broadcasting or multicasting, thereby reducing unnecessary data transmission in the network, lowering the network load, and improving communication efficiency.
[0100] In addition, multicast mode allows the target master device to send data packets to multiple target master devices simultaneously, without having to send a data packet to each slave device separately. This reduces duplicate data transmission in the network and improves communication efficiency, especially in scenarios where multiple target slave devices need to be controlled simultaneously.
[0101] In this embodiment, a communication device is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments. Details already described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0102] This embodiment provides a communication device, such as Figure 2 As shown, it includes: a determination module 201, which is used to determine a target master device from multiple master devices according to preset rules when multiple master devices in the smart home network have not received the communication token; wherein the target master device is a device that receives the communication token, and the smart home network includes multiple master devices; a sending module 202, which is used to send the communication token to the target master device, so that the target master device communicates with the target slave device corresponding to the target master device according to the communication token.
[0103] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0104] The communication device in this embodiment is presented in the form of a functional unit, where the functional unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0105] The embodiment of the present invention also provides a computer device having the above Figure 2 The communication device shown.
[0106] See also Figure 3 , Figure 3 is a structural diagram of a computer device provided by an optional embodiment of the present invention, such as Figure 3As shown, the computer device includes: one or more processors 10, memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components utilize different buses to communicate with each other and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in the memory or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Equally, multiple computer devices can be connected, and each device provides part of the necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 3 A processor 10 is taken as an example.
[0107] The processor 10 may be a central processing unit, a network processor, or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit, a programmable logic device, or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic, or any combination thereof.
[0108] The memory 20 stores instructions that can be executed by at least one processor 10, so as to enable at least one processor 10 to execute the method shown in the above embodiment.
[0109] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created based on the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely located relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0110] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid-state drive; the memory 20 may also include a combination of the above types of memory.
[0111] The computer device further includes a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0112] The embodiment of the present invention also provides a computer-readable storage medium. The above-mentioned method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and downloaded through a network and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state drive, etc.; further, the storage medium can also include a combination of the above-mentioned types of memory. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.
[0113] A portion of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the form in which the computer program instruction exists in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc. Accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium that can be accessed by the computer.
[0114] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A communication method, characterized in that: The method is applied to a smart home device, and the method includes: When multiple master devices in the smart home network do not receive the communication token, a target master device is determined from the multiple master devices according to a preset rule; wherein the target master device is the device that receives the communication token, and the smart home network includes multiple master devices; A communication token is sent to the target master device, so that the target master device communicates with a target slave device corresponding to the target master device according to the communication token.
2. The communication method according to claim 1, wherein: The method further comprises: After the communication between the target master device and the target slave device is completed, the first master device is determined from the ring network structure, the communication token is sent to the first master device, and whether the first master device receives the communication token is detected; wherein the first master device is the master device adjacent to the first master device in the counterclockwise direction of the ring network structure; each of the multiple master devices forms a ring network structure according to the corresponding address; When the first master device does not receive the communication token, retransmission is triggered, and when the number of retransmissions reaches a preset number and the first master device does not receive the communication token, a second master device is determined from the ring network structure, and the communication token is sent to the second master device; wherein, the second master device is a master device adjacent to the first master device in the counterclockwise direction of the ring network structure.
3. The communication method according to claim 1, wherein: The method further comprises: When a new master device joins the smart home network, obtaining a maximum available address and allocating the maximum available address to the new master device; When a new slave device joins the smart home network, a minimum available address is obtained and the minimum available address is allocated to the new slave device.
4. The communication method according to claim 1, wherein: The target master device is determined from multiple master devices according to preset rules, including: Determine the random wait base and priority of each master device; Determining a waiting time for each master device according to the priority and the random waiting cardinality; wherein the waiting time indicates the time for the master device to request a communication token; The master device with the shortest waiting time is determined as the target master device.
5. The communication method according to claim 2, wherein: When the first master device fails to receive the communication token, triggering retransmission includes: When the first master device does not receive the communication token, determining a time period for each retransmission; wherein the time period for the next retransmission is greater than the time period for the current retransmission; During the target retransmission time period, a target time is randomly selected to send the communication token to the first master device; wherein the target time is any time within the target time period, and the target time is any time during each retransmission. The communication method according to claim 1 , wherein: The process of the target master device communicating with the target slave device corresponding to the target master device according to the communication token includes: The first device communicates with the target slave device corresponding to the target master device in unicast mode according to the communication token; The first device communicates with the target slave device corresponding to the target master device in a multicast mode according to the communication token.
7. A communication device, characterized in that: The device is applied to smart home equipment, and the device includes: a determination module, configured to determine a target master device from among the multiple master devices according to a preset rule when none of the multiple master devices in the smart home network receive the communication token; wherein the target master device is the device that receives the communication token, and the smart home network includes multiple master devices; The sending module is used to send a communication token to the target master device, so that the target master device communicates with the target slave device corresponding to the target master device according to the communication token.
8. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the communication method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the communication method according to any one of claims 1 to 6.
10. A computer program product, characterized in that The method comprises computer instructions for causing a computer to execute the communication method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and apparatus for implementing packet differential service
CN101478491A
Master communication device for a token network
CN107889550A
Data communication method and system
CN116383115A
Intelligent equipment control method and device, intelligent equipment and storage medium
CN116931471A
Control method and device of smart home Internet of Things equipment, equipment and medium
CN116938546A
Cited By
Ad-hoc network method, device and equipment of electrical equipment and readable storage medium
CN121174302A